diff --git a/Announcers/instructions.txt b/Announcers/instructions.txt index 272930e3b0..a9a2af9a95 100644 --- a/Announcers/instructions.txt +++ b/Announcers/instructions.txt @@ -1,50 +1,50 @@ -Place announcer folders in this directory. - -[Announcer format] -sm-ssc's announcers look for certain names. These can either be a single sound, -or a folder containing many sounds (of which one is picked at random). - -[Announcer calls] -Grouped by Screen/Element that calls them, though only the sound/folder name for -each item is important. - -ScreenWithMenuElements -* (ScreenName) intro - -ScreenTitleMenu -* title menu game name - -ScreenSelect -* (ScreenName) IdleComment - -ScreenSelectMusic -* select music intro -* select music comment general -* select music comment hard -* select music comment new -* select music comment repeat -* select course comment general - -ScreenGameplay -* gameplay intro -* gameplay ready -* gameplay here we go normal -* gameplay here we go final -* gameplay here we go extra -* gameplay comment hot -* gameplay comment danger -* gameplay comment good -* gameplay comment oni -* gameplay (100-1000) combo -* gameplay combo stopped -* gameplay combo overflow -* gameplay battle trick level(1-3) -* gameplay battle damage level(1-3) -* gameplay extra -* gameplay cleared -* gameplay failed -* gameplay oni failed -* gameplay oni failed halfway - -MenuTimer +Place announcer folders in this directory. + +[Announcer format] +sm-ssc's announcers look for certain names. These can either be a single sound, +or a folder containing many sounds (of which one is picked at random). + +[Announcer calls] +Grouped by Screen/Element that calls them, though only the sound/folder name for +each item is important. + +ScreenWithMenuElements +* (ScreenName) intro + +ScreenTitleMenu +* title menu game name + +ScreenSelect +* (ScreenName) IdleComment + +ScreenSelectMusic +* select music intro +* select music comment general +* select music comment hard +* select music comment new +* select music comment repeat +* select course comment general + +ScreenGameplay +* gameplay intro +* gameplay ready +* gameplay here we go normal +* gameplay here we go final +* gameplay here we go extra +* gameplay comment hot +* gameplay comment danger +* gameplay comment good +* gameplay comment oni +* gameplay (100-1000) combo +* gameplay combo stopped +* gameplay combo overflow +* gameplay battle trick level(1-3) +* gameplay battle damage level(1-3) +* gameplay extra +* gameplay cleared +* gameplay failed +* gameplay oni failed +* gameplay oni failed halfway + +MenuTimer * hurry up \ No newline at end of file diff --git a/BGAnimations/flash/default.lua b/BGAnimations/flash/default.lua index 34c29f1505..7340bdc838 100644 --- a/BGAnimations/flash/default.lua +++ b/BGAnimations/flash/default.lua @@ -1,4 +1,4 @@ -return Def.Quad { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;diffuse, Var "Color1";); - GainFocusCommand=cmd(finishtweening;diffusealpha,1;accelerate,0.6;diffusealpha,0); +return Def.Quad { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;diffuse, Var "Color1";); + GainFocusCommand=cmd(finishtweening;diffusealpha,1;accelerate,0.6;diffusealpha,0); }; \ No newline at end of file diff --git a/BGAnimations/instructions.txt b/BGAnimations/instructions.txt index 97f75f9d9c..baf640d65f 100644 --- a/BGAnimations/instructions.txt +++ b/BGAnimations/instructions.txt @@ -1 +1 @@ -Place BGAnimation folders in here. +Place BGAnimation folders in here. diff --git a/BGAnimations/white flash/default.lua b/BGAnimations/white flash/default.lua index 45fed37319..6b4bb74a03 100644 --- a/BGAnimations/white flash/default.lua +++ b/BGAnimations/white flash/default.lua @@ -1,4 +1,4 @@ -return Def.Quad { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2); - GainFocusCommand=cmd(finishtweening;diffusealpha,1;accelerate,0.6;diffusealpha,0); +return Def.Quad { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2); + GainFocusCommand=cmd(finishtweening;diffusealpha,1;accelerate,0.6;diffusealpha,0); }; \ No newline at end of file diff --git a/BGAnimations/yellow flash/default.lua b/BGAnimations/yellow flash/default.lua index 935f8cd8be..0681c212ce 100644 --- a/BGAnimations/yellow flash/default.lua +++ b/BGAnimations/yellow flash/default.lua @@ -1,4 +1,4 @@ -return Def.Quad { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2); - GainFocusCommand=cmd(finishtweening;diffuse,color("#FFFFA0");accelerate,0.6;diffusealpha,0); +return Def.Quad { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH*2,SCREEN_HEIGHT*2); + GainFocusCommand=cmd(finishtweening;diffuse,color("#FFFFA0");accelerate,0.6;diffusealpha,0); }; \ No newline at end of file diff --git a/BackgroundEffects/Centered.lua b/BackgroundEffects/Centered.lua index 11b2bb3075..054dcfe18b 100644 --- a/BackgroundEffects/Centered.lua +++ b/BackgroundEffects/Centered.lua @@ -1,11 +1,11 @@ --- Centered. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- Centered. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/Checkerboard1File2x2.lua b/BackgroundEffects/Checkerboard1File2x2.lua index 295246395b..a16d65732b 100644 --- a/BackgroundEffects/Checkerboard1File2x2.lua +++ b/BackgroundEffects/Checkerboard1File2x2.lua @@ -1,15 +1,15 @@ --- 4 repeats of the same file using File 1 -local cColor1 = color(Var "Color1"); -local a = LoadActor(Var "File1") .. { - OnCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); -}; -local t = Def.ActorFrame { - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; -}; - -return t; +-- 4 repeats of the same file using File 1 +local cColor1 = color(Var "Color1"); +local a = LoadActor(Var "File1") .. { + OnCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); +}; +local t = Def.ActorFrame { + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; +}; + +return t; diff --git a/BackgroundEffects/Checkerboard2File2x2.lua b/BackgroundEffects/Checkerboard2File2x2.lua index 58087d2f2b..fc69f569de 100644 --- a/BackgroundEffects/Checkerboard2File2x2.lua +++ b/BackgroundEffects/Checkerboard2File2x2.lua @@ -1,16 +1,16 @@ --- 4 repeats of the same file using File 2 -local cColor1 = color(Var "Color1"); -local a = LoadActor(Var "File2") .. { - OnCommand=cmd(scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); -}; -local t = Def.ActorFrame { - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; -}; - -return t; - +-- 4 repeats of the same file using File 2 +local cColor1 = color(Var "Color1"); +local a = LoadActor(Var "File2") .. { + OnCommand=cmd(scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); +}; +local t = Def.ActorFrame { + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; +}; + +return t; + diff --git a/BackgroundEffects/Checkerboard2x2.lua b/BackgroundEffects/Checkerboard2x2.lua index 7d498ac1cb..e963a4e8ac 100644 --- a/BackgroundEffects/Checkerboard2x2.lua +++ b/BackgroundEffects/Checkerboard2x2.lua @@ -1,9 +1,9 @@ --- Alternating files being played back at once -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; - LoadActor(Var "File2") .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; - LoadActor(Var "File2") .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; - LoadActor(Var "File1") .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; -}; - +-- Alternating files being played back at once +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; + LoadActor(Var "File2") .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; + LoadActor(Var "File2") .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; + LoadActor(Var "File1") .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);scaletoclipped,SCREEN_WIDTH/2,SCREEN_HEIGHT/2;rate,0.25) }; +}; + return t \ No newline at end of file diff --git a/BackgroundEffects/Kaleidoscope2x2.lua b/BackgroundEffects/Kaleidoscope2x2.lua index 06ba1b64d3..12ed17a001 100644 --- a/BackgroundEffects/Kaleidoscope2x2.lua +++ b/BackgroundEffects/Kaleidoscope2x2.lua @@ -1,16 +1,16 @@ --- 4 repeats of the same file in a kaleidoscope fashion. -local cColor1 = color(Var "Color1"); -local a = LoadActor(Var "File1") .. { - OnCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;zoomx,self:GetZoomX()*-1;zoomy,self:GetZoomY()*-1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); -}; - -local t = Def.ActorFrame { - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; - a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; -}; - -return t; +-- 4 repeats of the same file in a kaleidoscope fashion. +local cColor1 = color(Var "Color1"); +local a = LoadActor(Var "File1") .. { + OnCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;zoomx,self:GetZoomX()*-1;zoomy,self:GetZoomY()*-1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); +}; + +local t = Def.ActorFrame { + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; + a .. { OnCommand=cmd(x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM)); }; +}; + +return t; diff --git a/BackgroundEffects/SongBgWithMovieViz.lua b/BackgroundEffects/SongBgWithMovieViz.lua index 243abd0bcb..720b252891 100644 --- a/BackgroundEffects/SongBgWithMovieViz.lua +++ b/BackgroundEffects/SongBgWithMovieViz.lua @@ -1,17 +1,17 @@ --- A visualization overplayed on the songs background. -local cColor1 = color(Var "Color1"); -local cColor2 = color(Var "Color2"); -local t = Def.ActorFrame { - Def.Sprite { - InitCommand=cmd(LoadFromCurrentSongBackground); - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - }; - - LoadActor(Var "File1") .. { - OnCommand=cmd(blend,"BlendMode_Add";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor2); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- A visualization overplayed on the songs background. +local cColor1 = color(Var "Color1"); +local cColor2 = color(Var "Color2"); +local t = Def.ActorFrame { + Def.Sprite { + InitCommand=cmd(LoadFromCurrentSongBackground); + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + }; + + LoadActor(Var "File1") .. { + OnCommand=cmd(blend,"BlendMode_Add";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor2); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNoLoop.lua b/BackgroundEffects/StretchNoLoop.lua index 9477f9fbbc..a14665361c 100644 --- a/BackgroundEffects/StretchNoLoop.lua +++ b/BackgroundEffects/StretchNoLoop.lua @@ -1,11 +1,11 @@ --- A stretched file that does not loop back. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;loop,false); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- A stretched file that does not loop back. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;loop,false); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNormal.lua b/BackgroundEffects/StretchNormal.lua index 6c366f1351..d47ba747f8 100644 --- a/BackgroundEffects/StretchNormal.lua +++ b/BackgroundEffects/StretchNormal.lua @@ -1,11 +1,11 @@ --- A Movie that plays stretched. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- A Movie that plays stretched. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNormalAlignLeft.lua b/BackgroundEffects/StretchNormalAlignLeft.lua index 582770f3ca..bb46f5723b 100644 --- a/BackgroundEffects/StretchNormalAlignLeft.lua +++ b/BackgroundEffects/StretchNormalAlignLeft.lua @@ -1,11 +1,11 @@ --- Align left when cropping to 4:3. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(horizalign,left;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- Align left when cropping to 4:3. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(horizalign,left;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNormalBlue.lua b/BackgroundEffects/StretchNormalBlue.lua index 881c455fd0..ac78cc73ec 100644 --- a/BackgroundEffects/StretchNormalBlue.lua +++ b/BackgroundEffects/StretchNormalBlue.lua @@ -1,11 +1,11 @@ --- Stretch a file with blue diffusion. -local cColor1 = color("0,0,1,1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- Stretch a file with blue diffusion. +local cColor1 = color("0,0,1,1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNormalGreen.lua b/BackgroundEffects/StretchNormalGreen.lua index 357cf29a18..4fa459cb6d 100644 --- a/BackgroundEffects/StretchNormalGreen.lua +++ b/BackgroundEffects/StretchNormalGreen.lua @@ -1,11 +1,11 @@ ---- Stretch a file with green diffusion. -local cColor1 = color("0,1,0,1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +--- Stretch a file with green diffusion. +local cColor1 = color("0,1,0,1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchNormalRed.lua b/BackgroundEffects/StretchNormalRed.lua index 7bda72b2a2..c41c266d09 100644 --- a/BackgroundEffects/StretchNormalRed.lua +++ b/BackgroundEffects/StretchNormalRed.lua @@ -1,11 +1,11 @@ ---- Stretch a file with red diffusion. -local cColor1 = color("1,0,0,1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +--- Stretch a file with red diffusion. +local cColor1 = color("1,0,0,1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchPaused.lua b/BackgroundEffects/StretchPaused.lua index 48e54bddb0..d03b7ba9bb 100644 --- a/BackgroundEffects/StretchPaused.lua +++ b/BackgroundEffects/StretchPaused.lua @@ -1,11 +1,11 @@ --- Stretched & Paused. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;pause); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +-- Stretched & Paused. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;pause); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundEffects/StretchRewind.lua b/BackgroundEffects/StretchRewind.lua index 753fc4a759..0808073561 100644 --- a/BackgroundEffects/StretchRewind.lua +++ b/BackgroundEffects/StretchRewind.lua @@ -1,12 +1,12 @@ --- Stretch & Replay. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;position,0); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; - +-- Stretch & Replay. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,cColor1;position,0); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; + diff --git a/BackgroundEffects/UpperLeft.lua b/BackgroundEffects/UpperLeft.lua index fba7e826d2..418117019b 100644 --- a/BackgroundEffects/UpperLeft.lua +++ b/BackgroundEffects/UpperLeft.lua @@ -1,12 +1,12 @@ --- Upper left corner of the screen. -local cColor1 = color(Var "Color1"); -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(diffuse,cColor1); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; - +-- Upper left corner of the screen. +local cColor1 = color(Var "Color1"); +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(diffuse,cColor1); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; + diff --git a/BackgroundEffects/Vizualization2File.lua b/BackgroundEffects/Vizualization2File.lua index dba37d5290..17378e20e7 100644 --- a/BackgroundEffects/Vizualization2File.lua +++ b/BackgroundEffects/Vizualization2File.lua @@ -1,16 +1,16 @@ -local Color1 = color(Var "Color1"); -local Color2 = color(Var "Color2"); - -local t = Def.ActorFrame { - LoadActor(Var "File1") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color1;effectclock,"music"); - }; - - LoadActor(Var "File2") .. { - OnCommand=cmd(blend,"BlendMode_Add";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color2;effectclock,"music"); - GainFocusCommand=cmd(play); - LoseFocusCommand=cmd(pause); - }; -}; - -return t; +local Color1 = color(Var "Color1"); +local Color2 = color(Var "Color2"); + +local t = Def.ActorFrame { + LoadActor(Var "File1") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color1;effectclock,"music"); + }; + + LoadActor(Var "File2") .. { + OnCommand=cmd(blend,"BlendMode_Add";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color2;effectclock,"music"); + GainFocusCommand=cmd(play); + LoseFocusCommand=cmd(pause); + }; +}; + +return t; diff --git a/BackgroundTransitions/CrossFade.xml b/BackgroundTransitions/CrossFade.xml index 734ecbdd9a..9816a0e129 100644 --- a/BackgroundTransitions/CrossFade.xml +++ b/BackgroundTransitions/CrossFade.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/FadeDown.xml b/BackgroundTransitions/FadeDown.xml index 94e77631bd..dfeecd1852 100644 --- a/BackgroundTransitions/FadeDown.xml +++ b/BackgroundTransitions/FadeDown.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/FadeLeft.xml b/BackgroundTransitions/FadeLeft.xml index 0389c72e70..9b5e1ceadd 100644 --- a/BackgroundTransitions/FadeLeft.xml +++ b/BackgroundTransitions/FadeLeft.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/FadeRight.xml b/BackgroundTransitions/FadeRight.xml index a1f20f497c..e586ad6feb 100644 --- a/BackgroundTransitions/FadeRight.xml +++ b/BackgroundTransitions/FadeRight.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/FadeUp.xml b/BackgroundTransitions/FadeUp.xml index 144d8c4181..166635a6af 100644 --- a/BackgroundTransitions/FadeUp.xml +++ b/BackgroundTransitions/FadeUp.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/SlideDown.xml b/BackgroundTransitions/SlideDown.xml index 399b35962f..bce4299052 100644 --- a/BackgroundTransitions/SlideDown.xml +++ b/BackgroundTransitions/SlideDown.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/SlideLeft.xml b/BackgroundTransitions/SlideLeft.xml index cd0bedabd4..913dc83351 100644 --- a/BackgroundTransitions/SlideLeft.xml +++ b/BackgroundTransitions/SlideLeft.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/SlideRight.xml b/BackgroundTransitions/SlideRight.xml index 1d7f6f21ee..4965150109 100644 --- a/BackgroundTransitions/SlideRight.xml +++ b/BackgroundTransitions/SlideRight.xml @@ -1,4 +1,4 @@ - + diff --git a/BackgroundTransitions/SlideUp.xml b/BackgroundTransitions/SlideUp.xml index 447489f6c9..9311b5c8b3 100644 --- a/BackgroundTransitions/SlideUp.xml +++ b/BackgroundTransitions/SlideUp.xml @@ -1,4 +1,4 @@ - + diff --git a/CDTitles/Instructions.txt b/CDTitles/Instructions.txt index 1477129755..fc7ee8df73 100644 --- a/CDTitles/Instructions.txt +++ b/CDTitles/Instructions.txt @@ -1,5 +1,5 @@ -DWI-style CDTitles can be placed here. - -However, you are highly encouraged to place the CDTitle graphics -inside the song folder since the package manager cannot use the +DWI-style CDTitles can be placed here. + +However, you are highly encouraged to place the CDTitle graphics +inside the song folder since the package manager cannot use the DWI-style CDTitles or Music folders. \ No newline at end of file diff --git a/Characters/Instructions.txt b/Characters/Instructions.txt index 5b974250e2..c4c642717e 100644 --- a/Characters/Instructions.txt +++ b/Characters/Instructions.txt @@ -1,21 +1,21 @@ -IF YOU DO NOT HAVE THE BONE FILES, 3D DANCING CHARACTERS WILL NOT WORK. -THE BONE FILES ARE NOT DISTRIBUTED WITH ANY VERSION OF STEPMANIA/sm-ssc SINCE -THEY CONTAIN COPYRIGHTED MATERIAL NOT MADE BY US. IF WE COME UP WITH DATA LATER, -COOL. IF NOT, SO BE IT. - -http://stepmaniathings.com/downloads/characters/-required-bones-and-helper-files.html -EXTRACT THE FILES IN THIS FOLDER SO THAT YOU SEE tons of _DDRPC_*.bones.txt files. - -THEN 3D CHARACTERS WILL WORK. -JUST DON'T SPAM THE FORUMS AND BUGTRACKER ABOUT IT. -THE INSTRUCTIONS COME WITH THE PROGRAM. YOU'RE READING THEM RIGHT NOW!!! - -oh and for compatibility, you will want to perform the following renames: - -old name | new name -------------------+-------------- - DancePad-DDR.txt | DancePad.txt -DancePads-DDR.txt | DancePads.txt - -a bit presumptious, but anything in the name of keeping it safe in regards to +IF YOU DO NOT HAVE THE BONE FILES, 3D DANCING CHARACTERS WILL NOT WORK. +THE BONE FILES ARE NOT DISTRIBUTED WITH ANY VERSION OF STEPMANIA/sm-ssc SINCE +THEY CONTAIN COPYRIGHTED MATERIAL NOT MADE BY US. IF WE COME UP WITH DATA LATER, +COOL. IF NOT, SO BE IT. + +http://stepmaniathings.com/downloads/characters/-required-bones-and-helper-files.html +EXTRACT THE FILES IN THIS FOLDER SO THAT YOU SEE tons of _DDRPC_*.bones.txt files. + +THEN 3D CHARACTERS WILL WORK. +JUST DON'T SPAM THE FORUMS AND BUGTRACKER ABOUT IT. +THE INSTRUCTIONS COME WITH THE PROGRAM. YOU'RE READING THEM RIGHT NOW!!! + +oh and for compatibility, you will want to perform the following renames: + +old name | new name +------------------+-------------- + DancePad-DDR.txt | DancePad.txt +DancePads-DDR.txt | DancePads.txt + +a bit presumptious, but anything in the name of keeping it safe in regards to copyright, yeah? \ No newline at end of file diff --git a/Characters/default/character.ini b/Characters/default/character.ini index 82a87050bc..894ff3fac6 100644 --- a/Characters/default/character.ini +++ b/Characters/default/character.ini @@ -1,10 +1,10 @@ -[Character] -Level1Attack1=1.5x -Level1Attack2=hidden -Level1Attack3=reverse -Level2Attack1=dizzy -Level2Attack2=sudden -Level2Attack3=expand -Level3Attack1=0.5x -Level3Attack2=drunk +[Character] +Level1Attack1=1.5x +Level1Attack2=hidden +Level1Attack3=reverse +Level2Attack1=dizzy +Level2Attack2=sudden +Level2Attack3=expand +Level3Attack1=0.5x +Level3Attack2=drunk Level3Attack3=brake \ No newline at end of file diff --git a/Courses/instructions.txt b/Courses/instructions.txt index 55ab90a49c..b79847fc82 100644 --- a/Courses/instructions.txt +++ b/Courses/instructions.txt @@ -1,3 +1,3 @@ -Course files (.crs) typically go in folders, though they aren't shown like that -on the wheel... yet. (Coming soon: a metric that allows a theme to do that, once +Course files (.crs) typically go in folders, though they aren't shown like that +on the wheel... yet. (Coming soon: a metric that allows a theme to do that, once we get the wheel to treat course directories like song directories) \ No newline at end of file diff --git a/Data/AI.ini b/Data/AI.ini index 1ca1b06323..c2584caf8f 100644 --- a/Data/AI.ini +++ b/Data/AI.ini @@ -1,55 +1,55 @@ -[Skill0] -WeightMiss=8 -WeightW5=8 -WeightW4=8 -WeightW3=30 -WeightW2=30 -WeightW1=30 - -[Skill1] -WeightMiss=5 -WeightW5=5 -WeightW4=5 -WeightW3=25 -WeightW2=30 -WeightW1=35 - -[Skill2] -WeightMiss=3 -WeightW5=3 -WeightW4=3 -WeightW3=20 -WeightW2=30 -WeightW1=40 - -[Skill3] -WeightMiss=2 -WeightW5=2 -WeightW4=2 -WeightW3=15 -WeightW2=30 -WeightW1=45 - -[Skill4] -WeightMiss=1 -WeightW5=1 -WeightW4=1 -WeightW3=10 -WeightW2=30 -WeightW1=50 - -[Skill5] -WeightMiss= -WeightW5=1 -WeightW4=1 -WeightW3=5 -WeightW2=30 -WeightW1=55 - -[Skill6] -WeightMiss= -WeightW5= -WeightW4= -WeightW3=5 -WeightW2=30 -WeightW1=70 +[Skill0] +WeightMiss=8 +WeightW5=8 +WeightW4=8 +WeightW3=30 +WeightW2=30 +WeightW1=30 + +[Skill1] +WeightMiss=5 +WeightW5=5 +WeightW4=5 +WeightW3=25 +WeightW2=30 +WeightW1=35 + +[Skill2] +WeightMiss=3 +WeightW5=3 +WeightW4=3 +WeightW3=20 +WeightW2=30 +WeightW1=40 + +[Skill3] +WeightMiss=2 +WeightW5=2 +WeightW4=2 +WeightW3=15 +WeightW2=30 +WeightW1=45 + +[Skill4] +WeightMiss=1 +WeightW5=1 +WeightW4=1 +WeightW3=10 +WeightW2=30 +WeightW1=50 + +[Skill5] +WeightMiss= +WeightW5=1 +WeightW4=1 +WeightW3=5 +WeightW2=30 +WeightW1=55 + +[Skill6] +WeightMiss= +WeightW5= +WeightW4= +WeightW3=5 +WeightW2=30 +WeightW1=70 diff --git a/Data/AutoMappings/GamePad Pro USB.ini b/Data/AutoMappings/GamePad Pro USB.ini index f6dd11cce1..2472a314cf 100644 --- a/Data/AutoMappings/GamePad Pro USB.ini +++ b/Data/AutoMappings/GamePad Pro USB.ini @@ -1,28 +1,28 @@ -[AutoMapping] -;Intentional space at the end of the Device name -DeviceRegex=GamePad Pro USB -Description=GamePad Pro USB - -[dance] -1_Back=Joy1_B9 -1_Down=Joy1_Down1:Joy1_B2 -1_Left=Joy1_Left1:Joy1_B1 -1_Right=Joy1_Right1:Joy1_B3 -1_Start=Joy1_B10 -1_Up=Joy1_Up1:Joy1_B4 -1_UpLeft=Joy1_B5 -1_UpRight=Joy1_B6 - -[pump] -1_Back=Joy1_B9 -1_Center=Joy1_B1 -1_DownLeft=Joy1_B7 -1_DownRight=Joy1_B8 -1_MenuDown=Joy1_Down1 -1_MenuLeft=Joy1_Left1 -1_MenuRight=Joy1_Right1 -1_MenuUp=Joy1_Up1 -1_Start=Joy1_B10 -1_UpLeft=Joy1_B5 -1_UpRight=Joy1_B6 - +[AutoMapping] +;Intentional space at the end of the Device name +DeviceRegex=GamePad Pro USB +Description=GamePad Pro USB + +[dance] +1_Back=Joy1_B9 +1_Down=Joy1_Down1:Joy1_B2 +1_Left=Joy1_Left1:Joy1_B1 +1_Right=Joy1_Right1:Joy1_B3 +1_Start=Joy1_B10 +1_Up=Joy1_Up1:Joy1_B4 +1_UpLeft=Joy1_B5 +1_UpRight=Joy1_B6 + +[pump] +1_Back=Joy1_B9 +1_Center=Joy1_B1 +1_DownLeft=Joy1_B7 +1_DownRight=Joy1_B8 +1_MenuDown=Joy1_Down1 +1_MenuLeft=Joy1_Left1 +1_MenuRight=Joy1_Right1 +1_MenuUp=Joy1_Up1 +1_Start=Joy1_B10 +1_UpLeft=Joy1_B5 +1_UpRight=Joy1_B6 + diff --git a/Data/NamesBlacklist.txt b/Data/NamesBlacklist.txt index 6b4a966785..8f0f690293 100644 --- a/Data/NamesBlacklist.txt +++ b/Data/NamesBlacklist.txt @@ -1,2 +1,2 @@ -#P1# -#P2# +#P1# +#P2# diff --git a/Data/RandomAttacks.txt b/Data/RandomAttacks.txt index 59a7d6ee3f..a0af0a7832 100644 --- a/Data/RandomAttacks.txt +++ b/Data/RandomAttacks.txt @@ -1,73 +1,73 @@ -// File for specifying Random Attacks, used by the Random Attacks mod and Attack Mines mod. -// Only specify one modifier per attack. -// -// Sample lines: -// -// #ATTACK:drunk; -// #ATTACK:30% tornado; -// #ATTACK:-20% beat; -// - -// -// Speed Mods -// -#ATTACK:0.5x; -#ATTACK:1x; -#ATTACK:1.5x; -#ATTACK:2x; - -// -// Accel Mods -// -#ATTACK:boost; -#ATTACK:brake; -#ATTACK:wave; -#ATTACK:expand; - -// -// Effect Mods -// -#ATTACK:drunk; -#ATTACK:dizzy; -#ATTACK:confusion; -#ATTACK:65% mini; -#ATTACK:20% flip; -#ATTACK:30% invert; -#ATTACK:30% tornado; -#ATTACK:tipsy; -#ATTACK:beat; -#ATTACK:bumpy; - -// -// Appearance Mods -// -#ATTACK:50% hidden; -#ATTACK:50% sudden; -#ATTACK:30% blink; - -// -// Hide Mods -// -#ATTACK:dark; -#ATTACK:blind; - -// -// Transform Mods -// -#ATTACK:mines; - -// -// Scroll -// -#ATTACK:30% reverse; -#ATTACK:reverse; -#ATTACK:centered; - -// -// Perspective Mods -// -#ATTACK:hallway; -#ATTACK:space; -#ATTACK:incoming; -#ATTACK:overhead; +// File for specifying Random Attacks, used by the Random Attacks mod and Attack Mines mod. +// Only specify one modifier per attack. +// +// Sample lines: +// +// #ATTACK:drunk; +// #ATTACK:30% tornado; +// #ATTACK:-20% beat; +// + +// +// Speed Mods +// +#ATTACK:0.5x; +#ATTACK:1x; +#ATTACK:1.5x; +#ATTACK:2x; + +// +// Accel Mods +// +#ATTACK:boost; +#ATTACK:brake; +#ATTACK:wave; +#ATTACK:expand; + +// +// Effect Mods +// +#ATTACK:drunk; +#ATTACK:dizzy; +#ATTACK:confusion; +#ATTACK:65% mini; +#ATTACK:20% flip; +#ATTACK:30% invert; +#ATTACK:30% tornado; +#ATTACK:tipsy; +#ATTACK:beat; +#ATTACK:bumpy; + +// +// Appearance Mods +// +#ATTACK:50% hidden; +#ATTACK:50% sudden; +#ATTACK:30% blink; + +// +// Hide Mods +// +#ATTACK:dark; +#ATTACK:blind; + +// +// Transform Mods +// +#ATTACK:mines; + +// +// Scroll +// +#ATTACK:30% reverse; +#ATTACK:reverse; +#ATTACK:centered; + +// +// Perspective Mods +// +#ATTACK:hallway; +#ATTACK:space; +#ATTACK:incoming; +#ATTACK:overhead; #ATTACK:distant; \ No newline at end of file diff --git a/Data/Translations.xml b/Data/Translations.xml index a50d15f46e..f7a62fe884 100644 --- a/Data/Translations.xml +++ b/Data/Translations.xml @@ -1,439 +1,439 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/Changelog_SSCformat.txt b/Docs/Changelog_SSCformat.txt index dcba411279..c50c25737f 100644 --- a/Docs/Changelog_SSCformat.txt +++ b/Docs/Changelog_SSCformat.txt @@ -1,30 +1,30 @@ -.ssc Format Changelog -________________________________________________________________________________ -In case anyone else wishes to implement the .ssc format in their own simulator, -a changelog is provided here between each version. - -Notice: .ssc is not a finalized format at the moment. There are plans for a -change to JSON, but it is unsure if this will be done. - -Implement .ssc at your own risk. -________________________________________________________________________________ - -[v0.55] - Wolfman2000 -* Add #COMBOS tag to the Song and Steps (does nothing here). - -[v0.54] - Wolfman2000 -* Add #ATTACKS tag to the Notedata sections. Right now it does nothing. - -[v0.53] - Wolfman2000 -* Added Fakes to the RadarCategories. Start parsing between versions. -* Always write out the latest version to cache and hard drive. - -[v0.52] - AJ -* Add CHARTSTYLE tag to NoteData section. - -[v0.51] - AJ -* Move VERSION tag to the first line. -* Limit VERSION tag to two decimal places. - -[v0.5] - Wolfman2000 -* Initial MSD-based version. +.ssc Format Changelog +________________________________________________________________________________ +In case anyone else wishes to implement the .ssc format in their own simulator, +a changelog is provided here between each version. + +Notice: .ssc is not a finalized format at the moment. There are plans for a +change to JSON, but it is unsure if this will be done. + +Implement .ssc at your own risk. +________________________________________________________________________________ + +[v0.55] - Wolfman2000 +* Add #COMBOS tag to the Song and Steps (does nothing here). + +[v0.54] - Wolfman2000 +* Add #ATTACKS tag to the Notedata sections. Right now it does nothing. + +[v0.53] - Wolfman2000 +* Added Fakes to the RadarCategories. Start parsing between versions. +* Always write out the latest version to cache and hard drive. + +[v0.52] - AJ +* Add CHARTSTYLE tag to NoteData section. + +[v0.51] - AJ +* Move VERSION tag to the first line. +* Limit VERSION tag to two decimal places. + +[v0.5] - Wolfman2000 +* Initial MSD-based version. diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index bf6bdfe5bc..57a2fa0398 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -1,2108 +1,2108 @@ -sm-ssc Changelog -________________________________________________________________________________ -The sm-ssc changelog mostly deals with source code-related changes, -as theme changes happen at a faster pace. - -Changes are grouped by date. -Not all changes are documented, for various reasons. -(Some changes were later reverted, other changes relate to things that aren't -supported but exist anyways.) -_____________________________________________________________________________ - -================================================================================ -sm-ssc v1.2.4 | 20110??? --------------------------------------------------------------------------------- - -20110316 --------- -* [NotesLoaderSMA] Allow for preliminary support of loading SMA files. This - will become better once Split Timing is in place. [Wolfman2000] - -20110313 --------- -* [NotesWriterSM] Allow for either the #DESCRIPTION or #CREDIT tags to be used - for the .sm format's description token. [Wolfman2000] -* [ScreenEdit] Add Tap Note Cycling to allow inputting all of the taps. The way - to make holds and rolls are still the same as before. [Wolfman2000] - -================================================================================ -sm-ssc v1.2.3 | 20110323 --------------------------------------------------------------------------------- - -20110309 --------- -* [MusicWheelItem] Added Label param, renamed SongGroup param to Text. [AJ] - -20110308 --------- -* [WheelBase] Add GetCurrentIndex and GetNumItems Lua bindings. [AJ] -* [ScreenSelectMusic] Add GetMusicWheel Lua binding. [AJ] -* Added custom MusicWheel items. [AJ] -* [MeterDisplay] Add Lua binding. "Allow setting and changing the width - dynamically. Phase out the "StreamWidth" node property; set it with - SetStreamWidth instead." [Glenn Maynard] - -20110305 --------- -* Added #COMBOS tag to the .ssc format. [Wolfman2000] - -20110302 --------- -* [ScreenGameplaySyncMachine] Allow themers to use either .ssc or .sm files. [AJ] -* [ScreenHowToPlay] Allow themers to use either .ssc or .sm files. [AJ] -* [ScreenGameplay] Footer to prevent 'arrow overflow' [Midiman] - -20110301 --------- -* Allow Tickcount Segments to have a value of 0 to better replicate some - charts in the Pump series. [Wolfman2000] - -20110228 --------- -* Add Fakes to the RadarCategories. [Wolfman2000] -* [ScreenEdit] Display the number of Lifts and Fakes in a stepchart in the - editor. These use metrics, so the lines can be made empty in themes that - require them. [Wolfman2000] -* [ArrowEffects] Allow for dizzy hold heads. Again, enable at your own risk. - [Wolfman2000] -* [StepsDisplay] Allow for displaying the chart artist in a separate field. - This defaults to false for the moment. [Wolfman2000] -* [PlayerOptions, NoteDataUtil] Add transform mods for removing lifts and - fakes from the Notedata. This mods can disqualify of course. [Wolfman2000] - -20110227 --------- -* [PlayerState] The old GetPlayerOptions() binding is now GetPlayerOptionsString(). - There is a new GetPlayerOptions() binding that gets the PlayerOptions object, - which has a GetNoteSkin() binding (and hopefully more in the future). [AJ] - -20110226 --------- -* [ScreenOptionsToggleSongs] The structure of this screen has now changed. - Before, it contained the entire list of songs. Now, the main page - (ScreenOptionsToggleSongs) holds the groups, and a sub-page - (ScreenOptionsToggleSongsSubPage) holds the songs in each group. [AJ] - -20110225 --------- -* Add lifts and fakes to all Pump noteskins. [Daisuke Master, Wolfman2000] - -20110224 --------- -* [NotesLoaderSSC] Allowed reading of #NOTES2 again. [AJ] - -20110223 --------- -* [Steps] Added GetChartStyle() Lua binding. [AJ] - -20110222 --------- -* [ScreenEdit] Display the Player Number for Routine mode. [Wolfman2000] -* [ScreenEdit] Add format string metrics for the right hand side of the editor. - [Wolfman2000] - -20110221 --------- -* Reverted ArrowSpacing back to 64 (which was the previous value). - Please re-adjust your speed mods accordingly. [AJ] -* [OptionRow] Added GetLayoutType() and GetSelectType() Lua bindings. [AJ] -* Fix .sm-style edits not being loaded. [AJ] -* [Common] Added OperatorMenuScreen metric. [AJ] - -================================================================================ -sm-ssc v1.2.2 | 20110220 --------------------------------------------------------------------------------- - -20110219 --------- -* [BPMDisplay] Added FormatString metric. [AJ] -* [GrooveRadar] Changed "Label#OffsetX/Y" metrics to "Label#X/Y". [AJ] -* [GrooveRadar] Fixed RadarFrame from not running commands on RadarFrame base. [AJ] -* [GrooveRadar] Removed RadarFrameTweenOnScreen and RadarFrameTweenOffScreen metrics. (Themers: Use RadarFrameOnCommand and RadarFrameOffCommand instead) [AJ] -* [GrooveRadar] Removed non-working PreDelayOnCommand, PostDelayOnCommand. (Themers: Use Label#OnCommand and Label#OffCommand instead.) [AJ] -* [ScreenOptions] Renamed "GetCurrentRow" Lua binding to "GetCurrentRowIndex". [AJ] -* [OptionRow] Added FirstItemGoesDown(), GetChoiceInRowWithFocus(PlayerNumber), - GetName(), GetNumChoices(), GetRowTitle(), HasFocus(PlayerNumber), - and OneChoiceForAllPlayers() Lua bindings. [AJ] -* [ScreenOptions] Added Change message (params: RowIndex, ChangedToExit). [AJ] -* [ScreenOptions] Added FocusedItemEndsScreen(PlayerNumber) and GetOptionRow(int) - Lua bindings. [AJ] -* [ScreenPlayerOptions] now derives from ScreenOptions, allowing it to get the - new ScreenOptions bindings. [AJ] - -20110218 --------- -* [WheelBase] Added SetOpenSection Lua binding. [AJ] - -20110217 --------- -* Allowed refreshing of Fonts again. [AJ] - -20110214 --------- -* Added #CHARTSTYLE to .ssc format, mainly meant for Pad/Keyboard distinctions. [AJ] - -20110213 --------- -* Life Difficulty 4 is now as difficult as Life 6 was. [AJ] - Change name of the life difficulty options: - Old: 1, 2, 3, 4, 5, 6, 7 - New: 1.2, 1.0, 0.8, 0.6, 0.4, 0.33, 0.25 - -20110212 --------- -* [PlayerOptions] Added metrics to allow changing how often random modifiers - activate in the proper setting. At this time, the mods to be activated have - NOT been changed. [Wolfman2000] -* [ArrowEffects] Allow the Boomerang, Expand, Tipsy, Drunk, Tornado, Beat, and - Mini modifiers to be customized by metrics. As usual, change at your own - risk here. [Wolfman2000] -* Started the process of doxygen'ing the code. Goodness knows we need more - documentation on here. For the most part, don't expect comments on - particular files, though this may change. [Wolfman2000] -* [TimingData] Fix getting a Stop or Delay at a row if one of each occupies - the same row. This may need some extra testing. [Wolfman2000] - -20110211 --------- -* Introduced the .ssc file format for future features and expansion. All .sm - files will still work, and will still be generated when saved in the editor. - At this point, saving to the DWI format is being deprecated. [Wolfman2000] - -================================================================================ -sm-ssc v1.2.1 | 20110210 --------------------------------------------------------------------------------- - -20110210 --------- -* Had to go back on the ScreenNetSelectMusic controls commit. My apologies. [AJ] - -20110209 --------- -* [ScreenOptionsMemoryCard] Added three strings: "(no label)", "size ???", and - "%dMB". [AJ] -* [ScreenSelectMusic] Added RouletteTimerSeconds metric. [AJ] -* [ArrowEffects] Added QuantizeArrowYPosition metric. [AJ] - -20110208 --------- -* [ScreenNetSelectMusic] Added MusicWheelType metric. [AJ] - -20110201 --------- -* [Song] Added IsDisplayBpmRandom Lua binding. [AJ] - -20110130 --------- -* [ScreenSelectMaster] Only run cursor commands on players if they exist. [AJ] - -20110118 --------- -* [ScreenEdit] Move editing Timing Data to their own mini menu. [Wolfman2000] -* Implement #TICKCOUNTS tag for better checkpoint behavior. - This officially deprecates the CheckpointsUseTimeSignatures metric for - the CheckpointsUseTickcounts metric. [Wolfman2000] -* [NoteField] Add metrics for more flexible TimingData labels. [Wolfman2000] - -20110116 --------- -* [ScreenEdit] Allow editing TimeSignatureSegments one fractional half at - a time. [Wolfman2000] - -20110115 --------- -* [ArrowEffects] Allow modifying modifier characteristics in the metrics. - At present, Blink, Boost, Brake, and Wave can have modifications. - [Wolfman2000] -* [Player] Allow Combo Stopped message to be flexible via metrics. The - default is 50, as it was before. [Wolfman2000] -* [Player] Allow the default attack times for both random and mine attacks - to be changed. [Wolfman2000] -* [NoteField] Allow for adjustable fade fail time (for AJ). [Wolfman2000] -* [MenuTimer] Allow the hurry up transition to be adjusted. [Wolfman2000] -* [MusicWheel] Added RouletteColor, RandomColor, and PortalColor metrics. [freem] -* Fix a bug with VisualDelaySeconds where choosing -1 would lead to it being +1. [freem] - -20110112 --------- -* [PlayerStageStats] Change score to an unsigned long from a signed int. [FSX] -* Noteskin changes. [Daisuke Master] -* [SpecialScoring] MIGS scoring, improved SN and SN2 scoring. [FSX] -* [RageFile] Added ReadBytes() Lua binding. [FSX] -* [NetworkSyncManager] Added CloseConnection() Lua binding. [freem] -* [ScreenTextEntry] Added Load(TextEntrySettings) Lua binding. [freem] - TextEntrySettings is implemented similar to the Attributes in BitmapText. -local teSettings = { - SendOnPop = "", -- ScreenMessage to send on pop (optional, "SM_None" if omitted) - Question = "", -- The question to display - InitialAnswer = "", -- Initial answer text - MaxInputLength = 0, -- Maximum amount of characters - Password = false, -- Mask character input (optional) - Validate = nil, -- Validation function; function(answer, errorOut), must return boolean, string. - OnOK = nil, -- On OK; function(answer) - OnCancel = nil, -- On Cancel; function() - ValidateAppend = nil, -- Validate appending a character; function(answer,append), must return boolean - FormatAnswerForDisplay = nil, -- Format answer for display; function(answer), must return string -}; - -20110111 --------- -* [ScreenManager] Added ReloadOverlayScreens() Lua binding. [freem] - -20110110 --------- -* [Character] Added GetDisplayName Lua binding. [freem] -* Make sure that DELAYS come first if STOPS share the same beat. [Wolfman2000] - -20110109 --------- -* Add the semicolon and apostrophe keys as alternatives to the Page Up and Page - Down keys in the editor, mainly for laptop users. [Wolfman2000] -* Removed Song sample length limitations. [freem] -* Removed hard-coded values from the Step Editor. Now TimeSignatures are used - in place of these former constants. [Wolfman2000] -* [RoomWheel] Various metrics changes: [freem] - * Removed TextWidth/DescWidth metrics. - * "Desc" is now "Description". (DescX -> DescriptionX) - * Removed hardcoded commands (shadowlength,0;maxwidth,[max width metric];halign,0). - -================================================================================ -sm-ssc v1.2 | 20110107 --------------------------------------------------------------------------------- - -20110107 --------- -* Fix PrefsManager init list not being in order [vyhd] -* Add hack to ThemeManager to make GetThemeName() work intuitively for Scripts dirs [vyhd] -* [SongManager] Check the root Songs/ folder for extra stage course files. [freem] -* Make routine mode use ScreenGameplayShared instead of ScreenGameplay. [freem] -* Make pump-routine spacing the same as pump-double spacing. [FSX] - -20110106 --------- -* [SpecialScoring] Fix some minor issues [FSX] -* New pump routine noteskins [cesarmades] - -20110102 --------- -* Fix routine mode saving in the editor. [Wolfman2000] - -20110101 --------- -* [Screen] Added HandleBackButton metric; useful for custom menus that need to - use the Back button for more user-friendly canceling. [freem] - -20101230 --------- -* [StepsDisplay] Make the StepsType react to SetMessage as well. [freem] - -20101229 --------- -* [ScreenHowToPlay] Replaced LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND macro - calls with ActorUtil::LoadAllCommandsAndSetXY(). Fixes an odd bug I ran into - during the porting of DDR 5th Mix. [freem] -* [ScreenInstallOverlay] Added bare DownloadFinished message. [freem] - -20101228 --------- -* [ScreenHowToPlay] Have Character ignore the Miss steps instead of trying to - hit them. [freem] - -20101227 --------- -* [ScreenHowToPlay] Added CharacterName metric, which will force the Character - that shows up. [freem] - -20101226 --------- -* [ScreenEdit] Added GetEditState Lua binding. [freem] -* [ScreenNetSelectMusic] StepsDisplay changed to load from StepsDisplayNet. [freem] -* [RoomWheelItem] Added OverPart (just like in MusicWheelItem). [freem] -* [SongManager] Added GetSongRank(Song) Lua binding. [freem] -* Changed Steps picking logic in ScreenGameplaySyncMachine; now playable Steps - are chosen, instead of whatever NoteData happens to be first. - Also added pump-single data to ScreenGameplaySyncMachine music.sm. [freem] -* [Banner, FadingBanner] Various changes: [freem] - * Removed (now unused) All Music banner. - * Fixed swapped ScrollRandom and ScrollRoulette metrics. -* [Banner] Added GetScrolling(), GetPercentScrolling() and - SetScrolling(bool,float) Lua bindings. -* [FadingBanner] Added GetLatestIndex() Lua binding. [freem] - -20101225 --------- -* Fixed Life difficulty scale being 0. [Daisuke Master] - -20101223 --------- -* Added Banners for most SortOrders. (Group is excluded (song group banners - still work), as is Recent (which has no sections).) [freem] - -20101222 --------- -* Added Shift+Ctrl+F2 shortcut for reloading overlay screens (and metrics) [freem] - -20101221 --------- -* SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda] -* [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again. -* [ScreenInstallOverlay] Installs won't jump to SelMusic on Gameplay or System - Menus (e.g. Edit Mode) anymore on download completion. [freem] - -20101220 --------- -* [Actor] Add bezier. (_fallback/02 Actor.lua) [FSX] -* [MessageManager] Added MenuStartP1 and MenuStartP2 messages. [freem] -* [ScreenSelectMaster] Broadcast MenuStartP# messages; allow themers to handle - the MenuStartP# messageitems. [freem] - -20101219 --------- -* [WheelNotifyIcon] add BlinkPlayersBest metric. [freem] -* [GameCommand] Add GetScreen, GetSteps, GetCourse, GetTrail, and GetCharacter - Lua bindings. [freem] -* [StreamDisplay] Remove UseThreePartMethod. -* [Style] Add ColumnsPerPlayer and NeedsZoomOutWith2Players bindings. [freem] -* [Profile] Add GetLastUsedHighScoreName Lua binding. [freem] - -20101218 --------- -* [MusicWheelItem] Add OverPart. [freem] -* [Profile] SetCharacter(sCharID) Lua binding added. [freem] -* [GameState] GetCharacter(PlayerNumber) and SetCharacter(PlayerNumber,sCharID) - Lua bindings added. [freem] - -20101217 --------- -* [Sprite] Added SetAllStateDelays(fDelay) Lua binding. [freem] -* [MusicWheelItem] Added metric commands to NormalPart/ColorPart. [freem] - -20101215 --------- -* Transplanted file download code from SM4 into sm-ssc. - sm-ssc can now handle the stepmania:// url protocol. [Chris Danford, freem] - -20101214 --------- -* [RollingNumbers] Added Load(sMetricsGroup) Lua binding. [freem] -* Modifications to pump mode spacing. [Daisuke Master] -* Add eval song data for songs with no banner. [Midiman] - -20101213 --------- -* [EditMenu] Enable the EditMenu to be themed more extensively. [freem] - Splits out the rows into Label and Value. - -20101212 --------- -* [MusicWheelItem] Gave NormalPart/ColorPart names, so metrics can be used to - manipulate them. [freem] -* [MusicWheelItem] add Color param to SetMessage. [freem] -* Added --with-sse2 configure flag for SSE2 heuristic optimizations. [vyhd] -* Added 03 IniFile to start building new userprefs/themeprefs API. [vyhd] -* [EditMenu] Converted old non-specific metrics to more specific metrics. [freem] - {Metric Changes} - SongBannerWidth,SongBannerHeight -> SongBannerOnCommand - GroupBannerWidth,GroupBannerHeight -> GroupBannerOnCommand - RowLabelsX -> Label#X - RowLabelOnCommand -> Label#OnCommand - RowValue#X -> Value#X - RowValueOnCommand -> Row#OnCommand - {Metric Additions} - SongBannerChangeCommand/GroupBannerChangeCommand - runs when song/group - banner is changed. - Label#GainFocus/LoseFocusCommand and Value#GainFocus/LoseFocusCommand - runs - when the Label and Value gain/lose focus. - -20101128 --------- -* Increased default scrolling speed. Modifies how the speed mods work. [shakesoda] - -================================================================================ -sm-ssc v1.1 | 20101120 --------------------------------------------------------------------------------- - -20100929 --------- -* Fix issues with RequireStepOnHoldHeads not working properly if the W5 - window is zero. [FSX] - -20100925 --------- -* Add SetScore Lua binding to PlayerStageStats. [FSX] -* Don't increase combo on AvoidMine if AvoidMineIncrementsCombo is false. [FSX] -* Change build.sh to use ffmpeg 0.6 under Linux. [FSX] - -20100913 --------- -* Attempt to fix issues with full combos occuring when checkpoints - have been missed. [FSX] -* Fix NotesLoaderKSF. [Daisuke Master] - -20100912 --------- -* Add a hack allowing all courses to play, regardless of missing noteskins [wolfman2000] -* Restore ITG behavior, allow survivals to be won. [wolfman2000] - -================================================================================ -sm-ssc v1.0 "final" | 20100910 --------------------------------------------------------------------------------- - -20100910 --------- -* [ScreenNetSelectBase] Metric name changes: UsersDX -> UserSpacingX, - UsersAY -> UsersLine2Y -* [ScoreKeeperNormal] add MineHitIncrementsMissCombo and - AvoidMineIncrementsCombo metrics. [FSX] - -20100907 --------- -* [StepsDisplay] Make everything else (that isn't the frame) react to the - Set message. - -20100829 --------- -* [SongManager] Added SetPreferredSongs(string) and SetPreferredCourses(string) - Lua bindings. The files have to be named "SongManager .txt" - Example: SONGMAN:SetPreferredSongs("mysongs.txt") calls the file - "SongManager mysongs.txt". [cerbo] - -20100826 --------- -* Make Ctrl+[letter] work as expected in Artist sort. [Midiman, AJ] - -20100822 --------- -* Add [ArrowEffects] DrawHiddenNotesAfterReceptor metric [Daisuke Master] - -================================================================================ -sm-ssc v1.0 Release Candidate 2 | 20100822 --------------------------------------------------------------------------------- - -20100821 --------- -* Add roll and twirl from OpenITG [vyhd] -* Ignore invalid notes in KSF files [Daisuke Master] - -20100817 --------- -* [GraphDisplay] Allow Line to be themed via metrics. - -20100815 --------- -* [GameCommand] Remove pushscreen command -* [ScreenOptionsMasterPrefs] Reset Judge and Life values to the ones used in SM4 -* [ScreenNetEvaluation] add Score, Grade, PlayerOptions params to - UpdateNetEvalStats message -* [PlayerState] add GetHealthState Lua binding -* [Player] fix a warning [shakesoda] -* [Player] Change combo coloring logic in course mode: - "PERCENT_UNTIL_COLOR_COMBO refers to how long through the course the combo - color should appear (scaling to the number of songs). (This may not be - desired behavior, however.)" Let me know if I should add an alternate way to - specify course combo color logic. -aj -* [ScreenRanking] Cleanup and un-hardcode shadowlength -* [ThemeManager] add GetSelectableThemeNames Lua binding; returns a table of - themes as strings. - -20100814 --------- -sm4.0: - * r28482: number measures starting with 0 (makes the mental conversion - between the .SM and the editor much easier) [Chris Danford] - -20100811 --------- -sm-ssc: - * [Player] Implement a hack for miniholds until a proper solution can be found. - * [ActorSound] Fix Play() so that stop and pause are usable. [Daisuke Master] - -sm4.0: - * r28455: fix EFFECT_BOUNCE, give particles a start position uniformly - distributed across the screen [Chris Danford] - * r28456: change flip effects to use degrees, not radians [Chris Danford] - -20100810 --------- -[ScreenNetEvaluation] - * Replace hardcoded rainbow effect with UserTier02OrBetterCommand. - * Added Difficulty and Steps param to UpdateNetEvalStats message. The - beginning of custom-themable online stuff begins. - -[ScreenNetSelectMusic] - * Started to port SampleMusicPreviewMode from ScreenSelectMusic. - * Changed MusicWheel metrics to read from OnlineMusicWheel instead. - * Added section, roulette, and random music (not used yet). - * Stop the music when reaching a section. - -20100808 --------- -* [ScreenDebugOverlay] force sm-ssc to read the OnCommand for ButtonText, - FunctionText and PageText. - -20100807 --------- -* [ScreenManager] add AddNewScreenToTop Lua binding. - -20100804 --------- -* [ScreenDebugOverlay] add PageStartX and PageSpacingX metrics. - -20100801 --------- -* sm5svn r28402: Fix compile on some systems. [Steve Checkoway] - -20100731 --------- -* Add "package" to StepMania's Lua. [shakesoda] - -20100727 --------- -* Allow editing of a Song's #GENRE tag within the editor. - -20100726 --------- -* Fix |D| tag handling in Direct Move KSFs [Daisuke Master] -* Fix up alternate mappings for kb7 [shakesoda] -* [MusicWheel] Add RemindWheelPositions metric. [Daisuke Master] - -20100725 --------- -* [MusicWheel] JumpToNext/PrevGroup functions tweaked [juanelote] -* [MusicWheel] Added OnlyShowActiveSection metric. Only shows one group at - time. Use the Next/Previous Group codes to switch groups. [Daisuke Master] -* Allowed group changing via GameButtons as well. [Daisuke Master] -* [SongManager] Added GetSongGroupByIndex function. [juanelote] - (to-do: Give this a Lua binding. -aj) - -================================================================================ -sm-ssc v1.0 Release Candidate 1.5 | 20100723 --------------------------------------------------------------------------------- - -20100721 --------- -* Major tweaks to notesloaderksf, |E| Tags are working as they should now - [Daisuke Master] -* More column spacing values edited for Pump [Daisuke Master] - -20100719 --------- -* Allow noteskins to use animation based on beats or seconds via a new noteskin - metric: AnimationIsBeatBased. [Daisuke Master] -* Widen the lane for the middle note in kb7. [shakesoda] - -20100718 --------- -* Change screenshot naming format from "screen#####" to "YYYY-MM-DD_HHMMSS". - This should solve an issue where screen00000 was getting written multiple - times for unknown reasons. -* Make EnteredPrevSteps/EnteredNextSteps codes only trigger if - CHANGE_STEPS_WITH_GAME_BUTTONS = true. [Daisuke Master] -* [ScreenGameplay] Added UnpauseWithStart metric. [Daisuke Master] - -20100717 --------- -sm4svn: -* r28385: Fix memory card port handling on newer kernels. There's got to be a - better way to parse out a USB device's connection path. [Glenn Maynard] -* r28386: Fix partitioned USB devices not always being seen correctly due to - race condition with the kernel partition scan. The sleep was a hack to work - around this issue which doesn't work in all cases. [Glenn Maynard] - -sm-ssc: -* Added Menu(Left/Right/Up/Down)(P1/P2) messages to ScreenOptions. -* [ScreenSelectMusic] Add ChangeStepsWithGameButtons, PreviousDifficultyButton, - and NextDifficultyButton metrics, allowing the themer to not have to use - CodeDetector. [Daisuke Master] - - -20100715 --------- -* Fix spacing of various pump modes. [Daisuke Master] - -20100710 --------- -sm4svn: - * r28376: use GetProcessImageFileName instead of GetModuleFileNameEx; - it works in more cases, eg. when losing focus to the taskbar [Glenn Maynard] - -20100709 --------- -* Modify Autoplay/AutoplayCPU's tap note offset code to generate proper offsets - (as opposed to offsets between -0.1f and 0.1f, which makes Selling Out Made - Simple 2's protiming look weird). - -20100708 --------- -* [ScreenSelectProfile] Transplant menu input functions from ScreenSelectMaster. - Now you no longer have to rely on stuffing the directions into the Codeset. - (Of course, you still have to handle Start and Back yourself.) - -20100706 --------- -* [ScreenSelectMusic] add a code for closing the current folder from any - location (a la DDR X2). - -20100705 --------- -* [Player] add RequireStepOnMines metric. This allows DDR's Shock Arrows to - be emulated. (currently incomplete) [FSX] - -20100703 --------- -sm4svn: - * r28374: add GetBestFullComboTapNoteScore [Chris Danford] - (This replaces the IsFullComboW* bindings, which we never fully took in. -aj) - -sm-ssc: - * [Course] add GetCourseEntries() Lua binding. - * [Trail] add GetEntries() Lua binding. - * [ScreenTextEntry] replace hardcoded underscore and double space with - AnswerCaret and AnswerBlank strings. - -20100702 --------- -sm4svn: - * r28372: use MercifulDrain logic for MercifulBeginner [Chris Danford] - * r28373: don't override user scroll in courses [Chris Danford] - -20100630 --------- -sm4svn commits: - * r28367: fix resampler noise [Glenn Maynard] - * r28368: fix get_readable_ranges error handling [Glenn Maynard] - * r28369: don't use fprintf from the crash handler [Glenn Maynard] - * r28370: work around not all recursive crashes being caught [Glenn Maynard] - * r28371: use /proc weirdness to make the crash handler work even after - the binary has been deleted or replaced [Glenn Maynard] - -sm-ssc: -* [ScreenDebugOverlay] add new metrics: LineStartY, LineSpacing, - LineButtonX, LineFunctionX. -* Fix an odd mapping issue in dance mode where keypad 7 and 9 would control - up/down as well as upleft/upright. (Numpad 8 is now up and numpad 2 is now - down.) -* Step editor can now process meters from 0-25. -* MAX_METER upped to 35. - -20100629 --------- -* Fix an issue involving setting a group via GameCommand and a metric ([MusicWheel] - UseSectionsWithPreferredGroup=false). Previously, this situation would ignore - the group and show all songs. Instead, it has been fixed to work as intended, - only showing the songs in that group. (A DDR 4th Mix theme is feasible again.) -* If [MusicWheel] UseSectionsWithPreferredGroup=true and a song group is set - via GameCommand, the wheel will now scroll to the first song in the desired - group, instead of the very first wheel item. -* [CourseUtil] make the "All Songs" course use the current theme's - Graphics/Banner all music file. - -================================================================================ -sm-ssc v1.0 Release Candidate 1 | 20100627 --------------------------------------------------------------------------------- - -20100627 --------- -* [NotesLoaderKSF] Support reading of #PLAYER and #MUSICINTRO/#INTRO tags in - KSF files. [based on code by Aldo_MX] -* Adjust KB7 draw order which still seems wrong, change noteskin. - Use default-p2 and join as player 2 to play with original spacing. [shakesoda] - -20100626 --------- -* Fixed a bug with urlnoexit GameCommand always returning the "Could not - launch web browser" message. -* Removed some untested/non-working Model Lua bindings. -* Only autogen Medium difficulty steps for Routine modes. -* Added PlayerState:GetPlayerOptionsArray() Lua binding. -* Revert a commit from 20091219 regarding profile loading on ScreenSelectMusic. - -20100623 --------- -* Implement the last remaining SampleMusicPreviewMode: StartToPreview. - This one requires [ScreenSelectMusic] TwoPartConfirmsOnly=true in the - metrics to work correctly. -* Added Actor:Real(), which makes graphics their true size at - any resolution. [shakesoda] - -20100619 --------- -* [HighScore] add GetGrade() Lua binding. - -20100618 --------- -* Allow RShift+Print Screen to take uncompressed screenshots. - -20100614 --------- -* Attempt to fix screenshot numbering bug. Seems to work, if testing is - any indication. (Did not work.) - -20100612 --------- -* sm4svn r28359-r28364. [Chris Danford] - Notable commit logs: - * r28359: "fix BackgroundChange color values being written with commas. - Commas are a reserved character that seprate values in a tag. - Caret was used to separate RGBA values in a color in this case and - NotesLoaderSM already handles that." - * r28361: "normalize colors in BGCHANGES to HTML colors, to fix weird escaping" - -20100610 --------- -* Fix Rave/Battle crashes, allowing it to work again. -* Chris Danford changed galopin's code for detecting pump mats. -* [Actor] add basezoom, basezoomz, GetBaseZoomY(), GetBaseZoomZ(), and - GetGlow() Lua bindings -* [Screen] add GetScreenType() Lua binding. -* howl's patch for fixing LowLevelWindow - (stepmania4-fullscreen-focus-lost-and-restore-resolution2.patch) - http://www.stepmania.com/forums/showthread.php?t=23693 - -20100608 --------- -* sm4svn r28359: fix BackgroundChange color values being written with commas. - Commas are a reserved character that seprate values in a tag. Caret was - used to separate RGBA values in a color in this case and NotesLoaderSM - already handles that. [Chris Danford] - -20100605 --------- -* Add Windows 7 and Windows Vista as identified OS versions in DebugInfoHunt. - -20100603 --------- -* [MusicWheel] If AutoSetStyle is on and Autogen is off, some songs with valid - steps may be missing from the wheel. Re-add them by checking for every - playable StepsType when AutoSetStyle is on. - Fixes issue 147: http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=147 -* Fix a crash that occured when changing themes that had differing numbers - of song/course group colors. (Yes, finally.) - -20100602 --------- -* [Actor] add addrotationx, addrotationy, addrotationz bindings/commands -* [GameCommand] Don't allow battle/rave with Routine - (StyleType_TwoPlayersSharedSides). -* Reordered ScreenEdit's main menu (escape) slightly. -* Expand various floats from 3 decimal places to 6 (experimental) [Midiman] -* [BPMDisplay] add RandomText metric for theming the "..." that appears when - BPMs don't cycle and MinBPM == -1. - -20100601 --------- -* [MusicWheel] added UseSectionsWithPreferredGroup metric - (allows sm-ssc to display all song groups if you use the songgroup - GameCommand, instead of no groups.) -* [Character] add GetCharacterDir() and GetCharacterID() Lua bindings. - -================================================================================ -sm-ssc v1.0 Public Beta 4 | 20100531 --------------------------------------------------------------------------------- -The letter grade tiers have been reset to the old SM4CVS/3.9 values. You -should probably reset your scores to maintain consistency. (Though if you -used themes with their own scoring system, you never had consistency in the -first place. :s) - -20100531 --------- -* [Trail] Add GetTrailEntry() Lua binding. -* [TrailEntry] Allow TrailEntry to push itself, making Lua bindings possible. - TrailEntry's Lua bindings include GetSong(), GetSteps(), IsSecret() and - GetNormalModifiers(). - -20100527 --------- -* Add Direction param to ChangeStepsMessage. - -20100526 --------- -* Enable upper diagonal keys for Positive Gaming Impact dance mat [corec] - -20100525 --------- -* [ScreenSelectProfile] Actually load player's last used settings. -* [ScreenNetEvaluation] Don't assume every theme has a Grade display and/or - Points display; This fixes crashes in themes which don't have them when - people go to view another player's stats. -* [ScoreKeeperNormal] add [Gameplay] MaxScoreToIncrementMissCombo metric. -* [Course] add GetCourseDir(), HasBackground(), IsAnEdit() Lua bindings. -* [GameManager] rework how the IsGameEnabled() Lua binding works: - it now takes a string as a parameter. -* [ScoreKeeper] allow ScoreKeeperRave to be used as a ScoreKeeper. -* [ThemeManager] add GetCurLanguage() Lua binding. - -20100522 --------- -* [CourseLoaderCRS] up the maximum size of an edit course from 30KB to 32KB; - allow the #BACKGROUND tag to be read from .crs files. -* [HelpDisplay] new TipSwitchTime metric -* [PrefsManager] add PreferenceExists(sPrefName) Lua binding; - removed now-unused ShowSelectGroup preference. -* [ScreenSelectMusic] make the ScoreDisplay 0 out if nothing is selected. - -20100518 --------- -* The great Lua binding addition begins... - * [Actor] GetHAlign(), GetVAlign() - * [LifeMeterBattery] GetLivesLeft() - * [MemoryCardManager] GetCardLocked(pn), IsNameAvailable(pn) - * [MenuTimer] GetSeconds() - * [PlayerStageStats] GetRadarPossible(), GetRadarActual() - * [ProfileManager] LastLoadWasFromLastGood(pn), LastLoadWasTamperedOrCorrupt(pn) - -20100515 --------- -* [AnnouncerManager] Lua bindings get added to AnnouncerManager, which now - exists as ANNOUNCER. New bindings: - ANNOUNCER:DoesAnnouncerExist(sAnnouncer) - returns a bool - ANNOUNCER:GetAnnouncerNames() - returns a table of strings - ANNOUNCER:GetCurrentAnnouncer() - returns a string - ANNOUNCER:SetCurrentAnnouncer(sAnnouncer) - Sets the announcer if it exists. - -20100513 --------- -* [ScreenEvalation] Graphic "time label" renamed to "TimeLabel" for the sake - of naming consistency. -* Add GetOSName() binding. Returns a string representing the current OS. -* Allow Negative stops to "work" again in Quirks Mode. -* [ScreenSelectMaster] Fix "THE" cursor crash by testing if the cursor object - is actually there (a.k.a. not null). It should be noted that cursors can - still crash, however. (yay bugs) - -20100512 --------- -* [NotesLoaderSM] Only apply the old .sm format difficulty hacks if - difficulty == Difficulty_Hard. -* [TimingData] add HasNegativeBpms() Lua binding. - -20100507 --------- -* [PaneDisplay] Show fallback values when Song/Course is null. - -20100506 --------- -* [ScreenSelectMusic] Make it so changing difficulty also cancels - TwoPartSelection if TwoPartConfirmsOnly. - -20100504 --------- -* [ScreenGameplay] Un-hardcoded the diffuse command on CourseSongNumber. - -20100502 --------- -* Add dance-threepanel StepsType. Thanks to kurisu for the original 3.9 code. -* XMode mod added, thanks to v1toko/StepNXA. -* [Song] add GetDisplayBpms() [a table of two floats], IsDisplayBpmSecret(), - IsDisplayBpmConstant() [both bools] Lua bindings - -20100501 --------- -* Fixed an issue with StepsDisplayList crashing if more than 21 difficulties are - playable. This allows Technomotion to work with AutoSetStyle and Autogen on. - -================================================================================ -sm-ssc v1.0 Public Beta 3 | 20100430 --------------------------------------------------------------------------------- -There's an important change for themers that needs to be noted: -We have renamed two screens in _fallback to match StepMania's names. - -ScreenSelectPlayMode (previously the select style screen) -has been renamed to ScreenSelectStyle. - -ScreenSelectPlayStyle (previously select play mode) has been renamed -to ScreenSelectPlayMode. - -This change effects branches (_fallback/02 Branches.lua) and metrics, so if -you're not handling the two screens yourself, you will probably have to change -some things around in your theme. - -20100430 --------- -* [GameState] added DisablePremiumInEventMode metric. - -20100426 --------- -* [Course.cpp] add a few Lua bindings to CourseEntry: - * IsSecret - bool - * IsFixedSong - bool - * GetGainSeconds - float - * GetGainLives - int - * GetNormalModifiers - string - * GetNumModChanges - int - * GetTextDescription - string -* Re-add ScreenGameplaySyncMachine to project files that were missing it. - -20100422 --------- -* libpng upgraded from 1.2.7 to 1.4.1 (Windows, Mac, BSD) - (libpng upgrade was not carried out for Xbox, but that version does - not run anyways, so it is no operational loss.) - -20100420 --------- -* Convert |T| values in KSF files to TimeSignatures for [Player] - CheckpointsUseTimeSignatures metric. - -20100419 --------- -* Add SampleMusicPreviewMode_LastSong, which gives similar behavior to - DDR Extreme. There is a hack for the random music based on Takuya's - DDR Extreme theme; I am unsure if this is accurate behavior or not. [AJ] -* Allow MusicWheelItem Random and Portal to have different graphics - from Roulette. -* Added Song:HasAttacks() Lua binding. - -20100417 --------- -* Finally get rid of PLAYER_COLOR. ColorP1Command and ColorP2Command no - longer exist. The last things that were being diffused with player color - in the code included text in the Oni score display and ScreenSelectMusic score. - I'm sure you can diffuse ScoreDisplayOni Numbers, but I can't seem to find any - references to them in the metrics of any released theme. [AJ] - -20100404 --------- -* [SongManager] Added GetSongGroupNames(), GetSongsInGroup(string) Lua bindings - -20100403 --------- -* Fixed an issue where course banners were always cached, regardless of setting. - -20100401 --------- -(Not jokes) -* NextSong/PrevSong now work when TwoPartSelection=true and - TwoPartConfirmsOnly=true on ScreenSelectMusic. A new message - ("TwoPartConfirmCanceled") was added to catch when this happens. - -20100331 --------- -* Added Lifts to PaneDisplay. (StepMania 3.9+/Plus Redux had them) - -================================================================================ -sm-ssc v1.0 Public Beta 2 | 20100331 --------------------------------------------------------------------------------- - -20100329 --------- -* Added SONGMAN:ShortenGroupName(string) Lua binding - -20100328 --------- -* sm4svn r28340: Don't call GetFirstCompatibleStyle if numSidesJoined == 0 - (ScreenContinue) [Chris Danford] -* [ScreenSelectMusic] TwoPartTimerSeconds metric added - -20100326 --------- -* [BPMDisplay] make the "Various" text a theme-able string. -* Allow ';' to start a comment in .ini files -* [MenuTimer] Attempt to fix dialogs that come up when changing themes - (where one theme's warning timer starts higher than another). -* [Player] PercentUntilColorCombo metric added. [Wolfman] - (float value in the range of 0..1) - -20100325 --------- -* Fixed a crash caused by switching themes in StepMania. This crash was related - to the song group colors, which weren't getting reloaded on theme switch. - Since themes use different numbers of group colors... crashes! Not anymore. - -20100321 --------- -* Fix a rounding bug that causes resolutions like 639x480 (4/3) and 853x480 - (16/9); now they should be 640x480 and 854x480 as expected. Applies to - screenshots as well. - (Also, this fixes Midiman's pet peeve of having to add +1 to SCREEN_WIDTH) - * [RageDisplay.cpp] modified screenshot function - * [ScreenDimensions] modified SCREEN_WIDTH and SCREEN_HEIGHT algorithms - * [StepMania.cpp] modified windowed mode width calculation - -20100315 --------- -* Make steps labeled as "freestyle" in .ksfs use doubles - -20100313 --------- -* ScoreKeeperNormal double shot. - 1) convert toasty trigger from a single number to a Lua table. Only problem - is, the toasty only triggers on the first one. Since this makes it - equivalent to how it was set up before, I'm okay with this. [AJ] - 2) FSX submitted a patch that supposedly fixes the broken combo problem. - I can't fully test this, so I'm committing it in the hopes that someone - else tests it too. - -20100312 --------- -* sm4svn r28332: if a BGCHANGE file can't be resolved, don't use the specified - effect because it may require 2 files and all random BGs specify only 1 file - [Chris Danford] -* SM4SVN r28328, "draw glow using stroke texture" forces the BitmapText to glow - both the inner and stroke elements. This makes BitmapText elements with an - invisible stroke have a glowing stroke instead. Not good. - To combat this, I have developed the BitmapText::textglowmode command, along - with the TextGlowMode enum. Valid values include 'TextGlowMode_Inner', - 'TextGlowMode_Stroke', 'TextGlowMode_Both'. [AJ] - -20100311 --------- -* [Player.cpp] Don't add checkpoints to the combo if Autoplay is on. -* Re-add the ability to reload a theme's Lua scripts, this time using Ctrl+F2. -* Convert GrooveRadar base into an AutoActor. (Now it can use a Lua BGAnim.) - -20100309 --------- -* [ScreenSelectMaster] Add GetSelectionIndex(pn) Lua binding. (You'll have to - call this one using GAMESTATE:GetTopScreen():GetSelectionIndex(PLAYER_1) or - something like that.) - -20100308 --------- -* [PlayerStageStats] add GetPercentageOfTaps(TapNoteScore) Lua binding -* [PlayerState] add GetMultiPlayerNumber() Lua binding (untested) - -sm4svn catch up, all by Chris Danford: -* r28326: fix handling of noteskins with an uppercase letter -* r28327: track W4 full combo -* r28328: draw glow using stroke texture - -20100306 --------- -* [ScreenEvaluation] New metric DetailLineFormat. Must contain two integer flags - (%d or %i should work.) - -20100305 --------- -* [ScreenNetEvaluation] add GetNumActivePlayers() binding and UpdateNetEvalStats - message (one param, ActivePlayerIndex). This is currently untested. - -20100301 --------- -* Re-add SM4SVN r28063 "Allow for 'confirmation only' double press mechanisms -as a choice for two part selection on ScreenSelectMusic" since - 1) It actually did have a use - 2) [AJ] was thinking of adding it anyways and forgot it was already made. - -================================================================================ -sm-ssc v1.0 Public Beta 1 | 20100301 --------------------------------------------------------------------------------- -This represents the first public version of sm-ssc. The previously publicly -available release was not the official public beta version, but was released -for more people to get their hands on it for testing. - -sm-ssc v1.0 Public Beta 1 has 111 Lua bindings that you currently can't find in -StepMania 4 alpha versions as of 2010/02/28. That doesn't include the various -helper functions available to you in scripts via the fallback theme, either. :) - -20100228 --------- -* Applied stutter fix hack by Henke37 - (src: http://www.pasteall.org/11353/diff) -* [ScreenPackages] Some strings that were once hardcoded are now not: - "VisitURL", "DL @ %d KB/s", "Failed.", "Invalid URL.", "File Already Exists", - "Failed to connect.", "Header Sent.", "Waiting for header." -* Allow multiple random modifiers to be listed in RandomModifiers.txt. - The random number generation for RandomModifiers has also changed. - -20100227 --------- -* [GameState] add GetCurMusicSeconds binding. Values can be negative, - so watch out when using. - -20100226 --------- -* rework some bindings to match SM4: - GetBPMAtBeat, GetBeatFromElapsedTime, and GetElapsedTimeFromBeat have - moved from Song to TimingData. - If you were using these against the Song, they will fail in your theme. - -* [TimingData] GetStops only returns Stops now (and not Delays). - If you want Delays, there is a new GetDelays() binding, which works - like GetStops. - -20100225 --------- -* Added ToastyDropped message. [Midiman] - -20100223 --------- -* [Player] CheckpointsFlashOnHold metric added. Fixes issue 16. - - -20100222 --------- -* [CodeDetector] NextBannerGroup and NextBannerGroup2 were previously used - for MusicBannerWheel, which is currently not used in sm-ssc. These codes - have been changed to NextGroup and PrevGroup. The codes switch between - groups as you would expect. - -20100219 --------- -* sm4svn r28313: don't filter NoteSkins at a PrefsManager/NoteSkinManager level. - Leave the NoteSkin sorting and filtering up to the theme. [Chris Danford] -* load lighting from ActorFrame xnodes (in addition to Lua commands) -* add Cancel command on ScreenWithMenuElements, so other things can react - to Screen cancel. - -20100218 --------- -* Added Fonts/ScreenReloadSongs LoadingText, making the text on - ScreenReloadSongs themeable. -* Added Fonts/NoteField MeasureNumber, ScreenGameplay debug, - ScreenGameplaySyncMachine SyncInfo. - -20100216 --------- -sm4svn r28309: Fix crash in course mode, another (and, from the looks of it, - the last) dumb bug this block o' hack caused [vyhd] - -20100215 --------- -Some more sm4svn commits: -* r28304: read-ahead tweaks; support os read cache flushing [Glenn Maynard] -* r28306: experimental code for storing Lua data in Profiles and - converting between XML and Lua data. [vyhd] - -20100214 --------- -sm4svn catchup... Noticing a pattern? -* r28293: add RageFile::GetFD for specialized file handling [Glenn Maynard] - (FD meaning File Descriptor -aj) -* r28294: "remove absolutely pointless revision tags that cause [aclocal.m4 and - ltmain.sh in libmad] to constantly show up as modified" [Glenn Maynard] -* r28295: [fix] copy and paste error [Glenn Maynard] -* r28296: Experimental: hint the OS caching to avoid skips when starting/looping - movies [Glenn Maynard] -* r28297: fix a bug, then disable the whole thing for now due to dup() - braindamage; Linux version works fine (posix_fadvise) [Glenn Maynard] -* r28299: fix m_iFilePos updating on seek [Glenn Maynard] -* r28300: Added theme metric for Routine noteskins (to enforce separate noteskins - per player, or at least conscious thought toward that issue), added fix for - ScreenEdit only handling switching players on dance-routine [vyhd] - (editor's note: the new metrics are RoutineNoteSkinP1 and RoutineNoteSkinP2 -aj) -* r28303: make sure routine always writes as two charts, even if only one has - steps; DEBUG_ASSERT -> ASSERT [Glenn Maynard] - -20100213 --------- -Even more sm4svn catchup: -* r28277: remove preferred group filtering (leaving the setting in for later use) [Glenn Maynard] -* r28279: simplify SongUtil::GetStepsTypeAndDifficultyFromSortOrder [Glenn Maynard] -* r28281: fix SSM crashes when selecting a song with only one - player enabled [Glenn Maynard] -* r28284: add Style::GetUsesCenteredArrows (doubles + routine) -* r28285: sanity check (on ScreenGameplay) [Glenn Maynard] -* various commits related to routine mode [Glenn Maynard] - (specifically, r28282,r28286,r28287,r28289,r28290) -* r28291: fix pump routine right side DownLeft not drawn [Chris Danford] -* r28292: easier debug stepping [Chris Danford] - -20100211 --------- -sm-ssc: -* Fix a crash with AutoKeysounds. - -Playing catch-up with sm4svn. This happens a lot. -* r28273: "Added more logical handling of Routine mode selection - (see source code comments); hopefully, we can write up a more standard - solution to this later, since this is kind of a hack" [vyhd] -* r28274: course type param to GetCustomDifficulty is optional [Glenn Maynard] -* r28276: Lua binding for MeterDisplay. Allow setting and changing the - width dynamically. Phase out the "StreamWidth" node property; set it with - SetStreamWidth instead. [Glenn Maynard] - -20100210 --------- -* Possible fix for handling of delays in autoplay. May also fix things - elsewhere (editor?), but that is untested. Autoplay seemed to work well - with Uprock (the song), so I have no complaints. -aj -* Glenn started to revert some of Frieza's code in sm4: - * "Personally, there is an assert for checking if the noteskin is not empty. - Based on other code, it seems like the noteskin would have to be set - somewhere else. If this is a problem somewhere else, find where it's a - problem and don't patch this function." -aj re: NoteSkinManager.cpp r2098 - * r28076 "Adds metric options to flash the lifebar when a note is hit" - My comment on why I did this: "Any competent themer can make a lifebar - flash when a note is hit. Just hook something up to a JudgmentMesageCommand, - read the params, and go from there. If it doesn't work on - StreamDisplay/LifeMeterBar, then GO CODE YOUR OWN LIFE METER IN LUA!! - Seriously there are enough publicly available references (moonlight, - optical, NCEvo if you want to go back in time to see a different type - of life meter) that claiming 'oh I don't know how to' isn't an excuse. - Please actually put in effort and seek examples when you try stuff - kthx i told you this would be ranty" -aj - -20100209 --------- -* sm4svn r28266: Fix GAMESTATE:GetCurrentSteps() only returns single-player - steps for any difficulty [vyhd] - -20100207 --------- -* sm4svn r28264: subtractive blend (OpenGL only for now) [Glenn Maynard] - (D3D version untested, I'm unsure of the behavior -aj) - -20100204 --------- -* [MusicWheel] add RecentSongsToShow metric. - -20100203 --------- -* "First pass of toasty message, hopefully this doesn't break!" [Midiman] - -20100202 --------- -* [Course.cpp] HasTimedMods() now actually checks for timed mods - (technically non-global) instead of being a clone of HasMods(). -* [Player.cpp] add MAX_HOLD_LIFE/[Player] MaxHoldLife metric - -20100130 --------- -* "various commits from wolfman from the hg repo; mostly cleanup aside from - rev. 79071b3442, which adds a new metric. (that change is forthcoming)" - -20100128 --------- -* Add DELAYS to list of known .sm tags [Wolfman; sm-ssc hg ebb2bda5b4] -* fix Windows icons for compiling on VS2003 and VS2005 -* add ScoreKeeperShared.cpp/.h to VS2k3 project - -20100127 --------- -* sm4svn r28259: Change OptionsList behavior to pop menu on Select and - default to Exit only on SELECT_ONE [vyhd] - -20100126 --------- -* Add ScreenGameplayShared, ScoreKeeperShared to Makefile.am - -================================================================================ -sm-ssc Private Beta Wave 1.4 | 20100125 --------------------------------------------------------------------------------- - -20100125 --------- -* Catching up with StepMania 4 SVN. All code by Glenn Maynard. - * r28254 (GameConstantsAndTypes.h GameManager.cpp): routine style for pump - * r28255 Steps.cpp: fix routine special case so it works in all styles - * r28256 ScoreKeeper.cpp: support ScoreKeeperShared in - ScoreKeeper::MakeScoreKeeper - * r28257 ScreenGameplayShared.cpp: update old ScreenGameplayShared code - to mostly use PlayerInfo::Load; fixes some stuff but still not right - -20100124 --------- -* [Player] new ScoreMissedHoldsAndRolls metric (FSX) -* [Song] add GetFirstBeat and GetLastBeat Lua bindings -* Make RandomBackgroundMode use BGMODE_RANDOMMOVIES by default - -20100122 --------- -* Add support for Pump It Up delays with #DELAYS tag in .sm files & treating all - stops in .KSF files as delays. -* Use RollingNumbers methods in ScreenNetEvaluation now that ScreenEvaluation - uses them, as opposed to settext (which caused a few visual issues). -* [ScreenEvaluation] add SongOptions as a metric-able item. - -20100119 --------- -* Make FGAnimations (#FGCHANGES:) work again. (hopefully; it semeed to work - using a test file.) - -20100118 --------- -mostly [ScreenNetSelectBase] related changes: -* remove some now-unused metrics (namely ChatInputBoxWidth/Height and - ChatOutputBoxWidth/Height). -* Rename "Meter" to "StepsDisplay" -* RoomWheel now uses a MusicWheel-like setup for items (NormalPart/ColorPart) - instead of a single bar graphic. - -20100117 --------- -* [ScreenNetSelectBase] Sprite -> AutoActor for chat boxes, un-hardcode some - commands on items to allow for better theming. -* Disable Control+Letter "sort by title" shortcut in course mode. - -20100116 --------- -* Pump-Doubles has better (more accurate?) spacing between the two sides -* Enable saving replays. The replay data format will likely change over time, - and there is currently no mechanism to replay the data back as another player. - -20100114 --------- -* add GAMESTATE:GetHardestStepsDifficulty() Lua binding -* Don't complain about #SELECTABLE:Roulette; even though it's not implemented - for some reason. - -20100112 --------- -* Added more milestones (25, 50, 250) -* {issue 73} If the wheel is locked, don't accept Ctrl+Letter to sort -* [NotesLoaderKSF] implement DirectMove |E| type (DelayBeat) - -20100111 --------- -* [CourseLoaderCRS.cpp] add GRADEBEST and GRADEWORST to possible values. - -20100107 --------- -* [GameConstantsAndTypes.h] bump MAX_METER from 13 to 20. -* [MemoryCardManager] add GetName(pn) Lua binding. Returns the name of the device. - -================================================================================ -sm-ssc Private Beta Wave 1.3 | 20100106 --------------------------------------------------------------------------------- - -20100105 --------- -* [LifeMeterBattery] Instead of using various hardcoded values, make them metrics. - BatteryBlinkTime (float), BatteryP*X/Y and NumLivesP*X/Y metrics added. -* [GameSoundManager] use the sound's fade in and out times instead of the - hardcoded fade in (1.5sec) and out (0.3sec) times. - -20100101 --------- -* [GrooveRadar] run commands on RadarValueMapP* so we can color it again -* [Song.cpp] Make AutoGen on Pump a bit more bearable by only AutoGenerating - Medium difficulty for HalfDoubles steps. - -20091229 --------- -* [GameState] new Lua bindings: JoinPlayer(pn), UnjoinPlayer(pn), and - GetSongPercent(fBeat) - -20091227 --------- -* [ScreenSelectMusic] Allow un-selecting the song if two part selection is - enabled (press back). Only works if all human players have not chosen steps - yet. (If a player has chosen steps and the other wants to change the song, - the other player has to cancel his step selection.) -* [NoteSkinManager] New Lua binding NOTESKIN:DoesNoteSkinExist(sName) for - finding if the specified noteskin exists in the current gametype. - -20091226 --------- -* New Lua binding: NOTESKIN:GetNoteSkinNames(), which returns a table of all - noteskins for the current gametype. - -20091225 --------- -* New Lua bindings for Profile: GetTotalSessions(), GetTotalSessionSeconds(), - GetTotalGameplaySeconds() - -20091221 --------- -* Support "converge" as an alias for "centered" since some courses use it. - -20091220 --------- -* [EditMenu] new metric TextBannerType -* Fixed issue 38 (Servers line in ScreenNetworkOptions) - -20091219 --------- -* Make it possible to change the alpha of the center of the groove radar [shakesoda] -* [ScreenSelectMusic] make profile load with late join on. [AJ] -* Fix OS hotkey issues by invalidating input on ScreenEdit while meta keys - (cmd or winkey) are being held. [shakesoda] - -================================================================================ -sm-ssc Private Beta Wave 1.2 | 20091219 --------------------------------------------------------------------------------- -Theme-related additions/bugfixes aren't listed here, usually. - -20091218 --------- -* Fix bug in GAMESTATE:GetCurrentSteps(pn) where it didn't bother trying to - return the player's actual steps before trying to do: - (1) SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->m_PreferredDifficulty[pn] ); - (2) SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->GetClosestShownDifficulty(pn) ); - And with AutoSetStyle on, how the hell is it going to know the style with - those two SongUtil things in the way? By moving the player's steps to the - top, that fixes the problem. -aj - -20091217 --------- -* Make DeviceList on ScreenTestInput metricable - (commands only, X and Y are elusive for some reason.) - -20091215 --------- -* Fix option underlines diffusing color when they should just be diffusing alpha. -* [ScreenOptions] new Lua binding: AllAreOnLastRow() -* [ScreenSelectMaster] add DoSwitchAnyways [shakesoda] - -20091214 --------- -* new Course Lua bindings: IsNonstop(), IsOni(), HasBanner() - -20091213 --------- -* Support Pump it Up Exceed PS2 USB mat [galopin] - (see stepmania-devs mailing list 20091213 11:27 -0800 [Pacific Standard Time]) - -20091212 --------- -* (smpackage) sm4svn r28243: "fix for FlushDirCache" [Chris Danford] -* Fix Beginner Helper rest location [sy567] - (see http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12) - -20091211 --------- -Cel shader update [shakesoda] - -20091209 --------- -[StepsDisplay] StepsType is an AutoActor now (was Sprite) - -================================================================================ -sm-ssc Private Beta Wave 1.1 | 20091208 --------------------------------------------------------------------------------- -Theme-related bugfixes aren't listed here, usually. -See the sm-ssc bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ for more -information on bugs, feature requests, and the status of both. - -In addition to the bugfixes, the following changes have been made: - -20091208 --------- -Refresh the metrics when changing the gametype. Fixes an issue where changing -the gametype causes the DifficultyList/StepsDisplayList to not show anything. - -20091207 --------- -* [Character.cpp] fix GetModelPath() Lua binding. -* [Sprite.cpp] add GetState() and GetNumStates() Lua bindings. - -20091206 --------- -Implement a patch to support modern versions of ffmpeg. -(See http://www.stepmania.com/forums/showthread.php?t=21434 for more info.) - -Petr Baudis (3): - video.m4: Add libswscale checks. - MovieTexture_FFMpeg: Port img_convert to libswscale method. - MovieTexture_Theora: Port img_convert to libswscale method. - -David Santamaría Rogado (howl) (12): - video.m4: Simplify FFMpeg checks. - ArchHooks_Unix: Correct ffmpeg include. - MovieTexture_FFMpeg: Add and correct ffmpeg necessary includes. - MovieTexture_FFMpeg: Replace avcodec_build() with avcodec_version(), avcodec_build() now doesn't exists and avcodec_version() has always return the same value of avcodec_build(). - MovieTexture_FFMpeg: Replace avcodec::offset_t type with int64_t type to complain the new FFMpeg API . - MovieTexture_FFMpeg: Corrected seek component of RageProtocol to complain the new FFMpeg, if not videos with malformed headers fails to play. - MovieTexture_FFMpeg: Fix compilation warning of RageProtocol. - MovieTexture_FFMpeg: Add destruction conditions for swscale context to avoid possible crashes. - MovieTexture_FFMpeg: Add initialization conditions for swscale context to avoid possible unused memory if there is no garbage collector and improve performance. - MovieTexture_Theora: Add and correct ffmpeg necessary includes. - MovieTexture_Theora: Add destruction conditions for swscale context to avoid possible crashes. - MovieTexture_Theora: Add initialization conditions for swscale context to avoid possible unused memory if there is no garbage collector and improve performance. - -20091205 --------- -* [Player.cpp/.h] new metric: ComboUnderField. It should be true by default if - you want to match how StepMania 4 does it. [AJ] - -20091204 --------- -* Fix a sm-ssc bug where you couldn't change course difficulties. - -20091203 --------- -* Two new GameCommands: - * fademusic,fVolume,fDuration (though I wish fDuration was how long to fade the - music for; instead the fade lengths are consts in GameSoundManager.) - * pushscreen,sScreenName (though it doesn't push screens like I had thought it - would. maybe I'm doing it wrong.) [AJ] - -20091202 --------- -* Profile name max length changed from 12 to 32 characters. [AJ] -* Modified character camera values. [shakesoda] - -20091201 --------- -* [ScreenSelectMusic] new metric SamplePreviewMusicMode, which has one of two - possible values as of r127. 'SamplePreviewMusicMode_Normal' is business as - usual (sample music plays), while 'SampleMusicPreviewMode_ScreenMusic' - disables song samples, using /{theme}/Sounds/ScreenSelectMusic loop music.* - as the file to play. No, this doesn't support Lua music yet. [AJ] - -================================================================================ -sm-ssc Private Beta Wave 1 | 20091201 --------------------------------------------------------------------------------- -The list below comprises sm-ssc Private Beta Wave 1's changes. Some of the -changes are from baseline StepMania 4 SVN, in order to keep compatibility. - -20091130 --------- -* [StepMania.cpp] (any)Shift+F2 = reload metrics only. - F2 = reload metrics and textures. -* [Course.cpp] GetPlayMode() and GetCourseType() return actual enums now, - instead of numbers. -* Add improved cel shading for people with GLSL support. [shakesoda] - -20091129 --------- -* [TimingData] add GetActualBPM() Lua binding that returns a table holding the - min and max BPMs, in that order. - -20091127 --------- -* Disable color keying banners (it's 2009, I don't think anyone is using the - old rotated banners anymore. -aj) [shakesoda] -* Add OptionsListTimeout metric. [shakesoda] - -20091126 (SSC turkey day) -------------------------- -* [Song] new Lua bindings: NormallyDisplayed(), GetStepsSeconds() -* Themes will load Lua scripts from subdirectories first now. - -20091122 --------- -* [ArchHooks_Unix] Follow user's system language as default. - [David Santamaría Rogado (howl)] - See http://www.stepmania.com/forums/showthread.php?t=21471 for more info. - -20091120 --------- -* Fixed a crash with lifemultipliers > 1.0 in debug builds - -20091117 --------- -* F2 reloads metrics again, just like in StepMania 3.9. (This is probably one - of those changes that won't get backported to baseline StepMania...) -* [ScoreKeeperNormal] version 0.5 of ToastyTriggersAt added; only allows for - one value, unlike 3.9+ (which used a String with multiple values). The final - version will use a Lua table, similar to [MusicWheel] SortOrders. - -20091116 --------- -* [Character] new Lua bindings: GetModelPath(), GetRestAnimationPath(), - GetWarmUpAnimationPath(), GetDanceAnimationPath() -* [CharacterManager] GetRandomCharacter() Lua binding added -* [RageFileManager] GetDirListing(sPath,bOnlyDirs,bPathToo) Lua binding added -* [CharacterManager] GetAllCharacters() Lua binding added. - -20091115 --------- -* Prevent focus lost at Fullscreen on X11, fix windowed->fullscreen resolution - changes so that they save [David Santamaría Rogado (howl)] - (http://www.stepmania.com/forums/showthread.php?t=21430) - -20091114 --------- -* Add support for .oga and .ogv files. [David Santamaría Rogado (howl)] - (http://pastie.org/698741) - -20091113 --------- -* sm4svn r28233 [Glenn Maynard]: - "Fix ThemeMetric gives the first value of the enum when the theme - metric is nil, instead of EnumType_INVALID. - This happened because ThemeMetric was setting the value to its default, - eg. EnumType(), when LuaHelpers::FromStack returned false. - This behavior doesn't make sense in the general case, since EnumType() results - in an arbitrary value (the first one) rather than Invalid. Every FromStack - function sets a reasonable default on invalid data, anyway, and only RageColor - and enums can return false in any case. - This fixes CustomDifficulty when CourseType = nil." - -* Fix a crash in StepsDisplay that allows Course mode to at least run. - -20091111 --------- -* MusicWheelItem SetMessage has a new param, Type (string that returns the - item type). -* Add sort songs by most recently played. (not feature-complete yet.) - -20091103 to 20091109 --------------------- -* Changes from SM4SVN: - * r28211: [HighScore.cpp] "logic fixup" [Glenn Maynard] - * r28215: "default to showing backgrounds in editor" [Chris Danford] - * r28217: "Fix crash on reload metrics due to faulty FlushDirCache logic." - [Steve Checkoway], implemented along with code that was originally submitted - as r076 but removed. See this fix log to figure out why we'd bother. :) - * r28218: "crash handler is crashing in 2.6.31 in GetBacktrace, causing a - recursive crash handler crash that we aren't handling, leading to recursion" - [Glenn Maynard] - * r28219: "add 'DIRRO' driver for read-only access" [Glenn Maynard] - * r28220: "fix confusing comment. Escaping doesn't affect this; commas aren't - escaped, since they're split from the value itself, long after MsdFile is - loaded." [Glenn Maynard] (We'll be keeping the 1,1,1,1 colors in sm-ssc, and - may provide a compatibility script for SM4SVN, so be on the lookout.) - * r28221: "allow overriding, like PRODUCT_ID" [Glenn Maynard] - * r28222-28223: "adding support for pms files" [GRIM657] - * The pulseaudio patch [David Santamaría Rogado (howl), Ondřej Hošek, Damien Thébault] - (see http://www.stepmania.com/forums/showthread.php?t=21348) - * Greg Nadja's OpenGL/Windows patch - * Load Splash.png instead of an .xpm [David Santamaría Rogado (howl)] - (http://www.stepmania.com/forums/showpost.php?p=157340&postcount=3) - -* sm-ssc Changes: - * [ScreenSelectMusic.cpp] Add SelectMenuInputMessage, has params Player and - Button. Broadcast messages when holding select and a button other than Select - is pushed. - * Windowed mode is now the default display mode. - * [HighScore.cpp] new Lua bindings: - * GetModifiers() - * GetTapNoteScore(TapNoteScore) - * GetHoldNoteScore(HoldNoteScore) - * GetRadarValues() - * [ProfileManager.cpp] added IsSongNew(Song) Lua binding - -r088 | 20091101 12:19:47 ------------------------- -* SM4SVN r28203-28208, all by Glenn Maynard. - * r28203: "skip exporting round data when nothing was played (no taps, no holds)" - * r28204: "fix signatures not being written" (we had this already) - * r28205: "don't fail if there's no course; just hide" - * r28206: "move course rename and delete into Overview" - * r28208: "disable rename and delete for courses that havn't been saved yet" -r28207 was a theme edit. - -20091029 --------- -sm4svn r28202: helper for cycling through an enum [Glenn Maynard] - -20091028 --------- -sm4svn r28201: "refactor RageInput to not call GetDevicesAndDescriptions -constantly; it can be slightly complex and get called thousands of -times a second" [Glenn Maynard] - -20091027 --------- -* SM4SVN r28198-28200 - * r28198: Fix GetFileSizeInBytes to return an int instead of unsigned. - "this returns -1 on error (this should actually be 64-bit, - but that's a bigger change)" [Glenn Maynard] - * r28199: The official log is as follows: - "Hack to get the decorations to be deleted. Fixes crashes, - but probably not the best way to go about this." - [Steve Checkoway] - * r28200: The official log is as follows: - "Do not use an AutoActor to keep track of the children." - However, this also fixes the hack in r28199. [Steve Checkoway] - -* Allow for Codes on ScreenGameplay. [shakesoda] - -* New Lua bindings for ScreenGameplay: - * PauseGame(bool) - Pauses/unpauses the game. - * IsPaused() - returns true or false depending on if the game is paused or not. - -20091015 --------- -* Support loading Lua scripts from subdirectories of the Scripts folder, - to allow for better organization. The scripts in the root Scripts folder - will run first, then any Lua scripts in subdirectories of the Scripts folder - will be run. It currently only works with one folder depth, for example: - Scripts/subfolder/script.lua. - - This is not likely to be changed. If you can see a possible need for paths - like Scripts/subfolder/subfolder2/script.lua, please make a Feature Request - ticket on the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ with - an explanation of what you have in mind. - -20091012 --------- -* Change BitmapText defaults to no stroke + no shadow. -* Added DefaultTheme preference in order to fix crashes. - (sm-ssc's fallback theme is _fallback [and therefore normally unselectable].) - -20091005 --------- -* [NotesLoaderSM.cpp] Changes based on SM4SVN r28197 [Archer] - -20091002 --------- -* Event Mode turned on by default, as it should be. :) - (sm-ssc is a home mode-based version of StepMania.) - -20090925 --------- -* SM4SVN r28192-28196. - * r28192: HexToBinary for RString -> RString. [Glenn Maynard] - * r28193: show all songs in EditCourse, not just preferred songs [Chris Danford] - * r28194: [ScreenDebugOverlay] Glenn made this themeable in SM4SVN, finally - catching up. This means we've had to rename a few things: - * DebugMenuHeader -> HeaderText - * PageName -> PageText - ButtonText and FunctionText were added, as well. - The font names remain the same, only the metrics change. - (Can you believe they're still using Common normal as the font?) - * r28195,28196: fix ComboChanged message sent when m_bSendJudgmentAndComboMessages - is false, fix doing unnecessary work in multiplayer [Glenn Maynard] - -20090920 --------- -* [StepsDisplay] Fixed it so it actually shows up again. - -20090919 --------- -Happy talk like k//eternal day! -* [Font.cpp] Don't show strokes by default. -* [NoteDisplay] fRotation -> fRotationZ in anticipation of multiple rotation mods. -* [PaneDisplay] changed one thing that used a goto; doesn't use it anymore. seems to work for me, though I'm not 100% sure. -* [ThemeManager] don't reload Lua scripts when you reload the metrics. - This is a temporary fix, and may be deemed safe at some point in the future. - -20090914 --------- -(SM4SVN r28189) - -* SM4SVN r28190,28191 (25 files worth). This was later reverted, as it caused -reloading the metrics to crash. Since sm-ssc is primarily for themers, this is a -dealbreaker. A lot of things were unofficially added to sm-ssc at this point: - -* [ActorFrame] Added RemoveAllChildren() and RemoveChild(sName) bindings. - These are not guaranteed to work. Don't use them. They are very dangerous. -* [IniFile] added Lua's '--' syntax for commenting (along with '//' and '#', - which were already supported). -* New blend modes Modulate (subject to renaming later) and AlphaMultiply. -* [RageUtil] Added various bindings for formatting time that were already built - into StepMania: SecondsToHHMMSS, SecondsToMMSSMsMs, SecondsToMMSSMsMsMs, - SecondsToMSS, SecondsToMMSS. All bindings take in a float (number of seconds). -* [RageUtil] Added IsHexVal(string) binding. -* Added groups to sort length (based on BPM ranges), so the songs no longer - show up without groups. - -20090913 --------- -(SM4SVN r28180-28185) - -20090913 --------- -* Added WeightedMultiply and InvertDest blend modes to Direct3D. - -20090912 --------- -* Change decorations draw order so it breaks things less. - -20090911 --------- -* "hidden" removed from Actor commands. It was deprecated. - A compatibility alias was added to replicate its functionality. However, this - will not work with NoteSkins, so be sure to make sure to check them for the - use of hidden. - - Handy replacement guide: - hidden,true / hidden,1 = visible,false - hidden,false / hidden,0 = visible,true - -20090907 --------- -* Add Sprite:CropTo() function + Lua binding. - -20090906 --------- -* Base theme changed from "default" to "_fallback". - As a result, all themes will fallback on _fallback instead of default. - -20090905 --------- -* add URLEncode Lua binding to RageUtil. -* [ScreenWithMenuElements.cpp, ThemeManager.cpp] Load and parse Lua as music. - This makes conditional music possible. - -20090904 --------- -* Change many things on ScreenEdit to go 5 decimal places instead of 3. -* Beginnings of Xbox controller mappings for edit mode (currently untested) - -20090903 --------- -* Binding naming format changed for BPM bindings. Always uses all caps BPM. - Changes in the codebase due to this: - * [Song] HasSignificantBpmChangesOrStops -> HasSignificantBPMChangesOrStops - * [TimingData] HasBpmChanges -> HasBPMChanges -* [TimingData] New bindings. (GetStops, GetBPMsAndTimes) -* [ScreenPackages] attempt to not call MoveLeft by duplicating code. - Seemed to work okay. - -20090831 --------- -* ScreenPackages changes: - * Backgrounds from Sprites to AutoActors (Lua can be used now). - * DefaultUrl metric added. -* [ActorScroller] Make naming of commands consistent (some were all lowercase, - some were CamelCase), all are now CamelCase. - -20090828 --------- -* Added ScreenGameplay:GetPlayerInfo(PlayerNumber) Lua binding - -20090827 --------- -* Added LifeChanged message to LifeMeterBattery, meaning certain hackily-coded - custom life meters by a certain SSC member can work in Oni mode again. ;) -* MAX_EDIT_STEPS_SIZE_BYTES changed from 30KB to 60KB. -* Added --theme= and --language= command line options. - -20090826 --------- -* SSE2 build configuration added to Visual Studio 2008 project file. -* new Lua bindings for WheelBase: IsSettled(), IsLocked() - -20090822 --------- -* Add Beginner meter sort. -* [CommandLineActions] Implement --version command line argument. - Prints out the version of sm-ssc. Please build sm-ssc with HAVE_VERSION_TIME - if possible for compatibility with all possible sm-ssc themes. - -20090821 --------- -(SM4SVN r28172-28174) - -20090810 --------- -* [GameCommand.cpp] add GetUrl() Lua binding. -* [GameManager.cpp] add IsGameEnabled(Game) Lua binding. -* [GrooveRadar] name m_GrooveRadarValueMap "RadarValueMap(P1/P2)" - (commands untested); new todo note in header file -* [ScoreDisplayOni.cpp] give it a name ("ScoreDisplayOni Numbers") and run - commands. (untested) -* removing player color diffuse commands, in the hopes this can be replicated - using Lua commands. - [GrooveRadar.cpp, ScoreDisplayLifeTime.cpp, ScreenSelectMusic.cpp] - -20090810 --------- -(SM4SVN r28170: vdl's fixes for Xbox building; he says they should be tested.) - -20090815 --------- -* add THEME:GetPathO() Lua binding - -20090810 --------- -(SM4SVN r28140-r28166; code changes only) - -20090808 --------- -(SM4SVN r28135, r28137, r28138) -* Lossless screenshots now save as PNG. -* Conversion of decorations to not be children of the screen; they load in - a similar fashion to overlay/underlay, but still using LoadB so everything - works correctly. (Tested against SM4 default theme for compatibility.) - -20090729 --------- -* add GetRotationX, GetRotationZ commands to Actor -* add urlnoexit game command, which won't exit upon loading the browser. -* add OldHealthState to HealthStateChanged message on ScreenGameplay - -20090726 --------- -* (untested) GrooveRadar plays commands on the frame now, allowing for -customized in and out transitions, using TweenOnScreen/TweenOffScreen Commands. -* add PlayerController enum binding -* add PlayerState:GetPlayerController() [untested] - -20090725 --------- -ScreenDebugOverlay changes: -* add OnCommand, X, Y to Debug Header -* add GainFocus/LoseFocus commands to page names -* add LineOnColor/LineOffColor - -20090724 --------- -* Add StartRoulette and StartRandom messages to MusicWheel. -* Fix default stroke color and shadow length. (BitmapText) - -20090719 --------- -* patch by theDtTvB: http://share11.appspot.com/20421 - (some parts relating to Player.cpp were later reverted; will be reimplemented) -* Add SetPref to GameCommands. - -20090718 --------- -* New ThemeManager Lua bindings: - * GetCurrentThemeDirectory - * ReloadMetrics -* Added more internal font mappings: auxc, auxd, auxz, auxwhite, auxblack, - auxlb, auxrb, auxlt, auxrt -* Add conf,PercentageScoring. - -20090712 --------- -* ActorScroller: add GetNumItems binding. -* ThemeManager: add bindings for GetThemeDisplayName() and - GetThemeDisplayAuthor() (for the current theme only). - -20090711 --------- -* Fixes songs with only Edit steps from crashing. -* Lights fix from ??? -* Add GAMESTATE:IsBattleMode() binding. - -20090708 --------- -* (sync with SM4SVN: LightsManager.cpp, ScreenGameplay.cpp) - -20090707 --------- -* Add GetProfileDir() binding to ProfileManager. -* Added ProfileSlotNames enum. -* Add broadcasted message "SongChosen" on ScreenSelectMusic. - -20090626 --------- -* Allow meters to go up to 20 in Edit Mode. - -20090623 --------- -* Added io, os, and packages to Lua bindings. They are disabled for now. -* Fix instance in ScreenSelectMaster where hitting Up wouldn't count as going - backwards. - -20090617 --------- -* Add Overlay shader. [AJ] - -20090615 --------- -(sync with SM4SVN) - -More Lua bindings: -* PlayerStageStats:FullComboOfScore(tns) - -* RageFileManager is now accessible through FILEMAN with these bindings: - * FILEMAN:DoesFileExist(path) - * FILEMAN:GetHashForFile(path) - -* Add bindings to Song: - * GetSongFilePath - * GetMusicPath - * GetCDTitlePath - * GetLyricsPath - * IsEnabled - * HasStepsType - * HasMusic - * HasBanner - * HasBackground - * HasCDTitle - * HasBGChanges - * HasLyrics - * GetBPMAtBeat - * GetBeatFromElapsedTime - * GetElapsedTimeFromBeat - * HasSignificantBpmChangesOrStops - * HasEdits - * IsEasy - -* Add bindings to Steps: - * IsAnEdit - * IsAPlayerEdit - * GetHash - * disabled stub for GetSMNoteData (untested) - -20090612 --------- -* Work-in-progress bindings for ActorSound: - * pause - * stop -* Work-in-progress bindings for RageSound: - * volume - * SetStopMode - -20090529 --------- -(sync with SM4SVN: Archer adding 5:4 support) - -20090527 --------- -Add three new Lua bindings to RageFile: -* GetError -* ClearError -* AtEOF - -20090525 --------- -(sync with SM4SVN) -* [Actor.cpp] add GetDiffuse() Lua binding - -20090523 --------- -* Add glowramp to Actor - -20090518 --------- -* (changes from SM4SVN: Frieza and Wolfman [OnlyPreferredDifficulties]) - -20090517 --------- -* New RageFile bindings: Seek, Tell -* Added more internal font mappings: auxa, auxb, auxy, auxl, auxr - -20090513 --------- -ActorScroller changes: -* Can now actually set size of the mask with SetMask -* Add more Lua bindings: - * SetNumItemsToDraw - * GetFullScrollLengthSeconds - * GetCurrentItem - * GetDestinationItem - -20090509 --------- -* Add skewy to valid Actor commands. - -20090505 --------- -(SM4SVN: ComboMultiplier by Frieza in ScoreKeeperNormal + r28060, r28061) - -20090502 --------- -(changes from SM4SVN: ScreenSelect* changes by Frieza) -* Make ScreenDebugOverlay use its own fonts, namely: - * ScreenDebugOverlay header - * ScreenDebugOverlay page - * ScreenDebugOverlay line -* Add GetServerName() binding to NetworkSyncManager. -* Add GetText() binding to BPMDisplay. -* add MD5 String/File and SHA1 String hashing via Lua: - * CRYPTMAN:MD5String(str) - * CRYPTMAN:MD5File(path) - * CRYPTMAN:SHA1String(str) -* Add more Lua bindings to PlayerStageStats: - * GetCurrentMissCombo - * GetCurrentPossibleDancePoints - * GetAliveSeconds -* Add GetThemeAuthor() to ThemeManager. -* Add bindings to Song: - * GetDisplaySubTitle - * GetTranslitSubTitle - -20090501 --------- -(changes from SM4SVN: tons of changes by Frieza) - -20090425 --------- -(changes from SM4SVN: GameManager.cpp, RollingNumbers.cpp) - -20090419 --------- -* Make some crash explanations more detailed. Changed files include: - * Actor.cpp - PercentThroughEffect, PercentBetweenColors, DeltaTime - * Attack.cpp - * GameManager.cpp - * GameState.cpp - * InputFilter.cpp - * NoteData.cpp -* Add new Lua bindings to TimingData: HasBpmChanges, GetBpms, GetStops. - -20090418 --------- -* Project begins. -* Remove ScreenEz2SelectPlayer, which only the Xbox project still referenced. -_____________________________________________________________________________ +sm-ssc Changelog +________________________________________________________________________________ +The sm-ssc changelog mostly deals with source code-related changes, +as theme changes happen at a faster pace. + +Changes are grouped by date. +Not all changes are documented, for various reasons. +(Some changes were later reverted, other changes relate to things that aren't +supported but exist anyways.) +_____________________________________________________________________________ + +================================================================================ +sm-ssc v1.2.4 | 20110??? +-------------------------------------------------------------------------------- + +20110316 +-------- +* [NotesLoaderSMA] Allow for preliminary support of loading SMA files. This + will become better once Split Timing is in place. [Wolfman2000] + +20110313 +-------- +* [NotesWriterSM] Allow for either the #DESCRIPTION or #CREDIT tags to be used + for the .sm format's description token. [Wolfman2000] +* [ScreenEdit] Add Tap Note Cycling to allow inputting all of the taps. The way + to make holds and rolls are still the same as before. [Wolfman2000] + +================================================================================ +sm-ssc v1.2.3 | 20110323 +-------------------------------------------------------------------------------- + +20110309 +-------- +* [MusicWheelItem] Added Label param, renamed SongGroup param to Text. [AJ] + +20110308 +-------- +* [WheelBase] Add GetCurrentIndex and GetNumItems Lua bindings. [AJ] +* [ScreenSelectMusic] Add GetMusicWheel Lua binding. [AJ] +* Added custom MusicWheel items. [AJ] +* [MeterDisplay] Add Lua binding. "Allow setting and changing the width + dynamically. Phase out the "StreamWidth" node property; set it with + SetStreamWidth instead." [Glenn Maynard] + +20110305 +-------- +* Added #COMBOS tag to the .ssc format. [Wolfman2000] + +20110302 +-------- +* [ScreenGameplaySyncMachine] Allow themers to use either .ssc or .sm files. [AJ] +* [ScreenHowToPlay] Allow themers to use either .ssc or .sm files. [AJ] +* [ScreenGameplay] Footer to prevent 'arrow overflow' [Midiman] + +20110301 +-------- +* Allow Tickcount Segments to have a value of 0 to better replicate some + charts in the Pump series. [Wolfman2000] + +20110228 +-------- +* Add Fakes to the RadarCategories. [Wolfman2000] +* [ScreenEdit] Display the number of Lifts and Fakes in a stepchart in the + editor. These use metrics, so the lines can be made empty in themes that + require them. [Wolfman2000] +* [ArrowEffects] Allow for dizzy hold heads. Again, enable at your own risk. + [Wolfman2000] +* [StepsDisplay] Allow for displaying the chart artist in a separate field. + This defaults to false for the moment. [Wolfman2000] +* [PlayerOptions, NoteDataUtil] Add transform mods for removing lifts and + fakes from the Notedata. This mods can disqualify of course. [Wolfman2000] + +20110227 +-------- +* [PlayerState] The old GetPlayerOptions() binding is now GetPlayerOptionsString(). + There is a new GetPlayerOptions() binding that gets the PlayerOptions object, + which has a GetNoteSkin() binding (and hopefully more in the future). [AJ] + +20110226 +-------- +* [ScreenOptionsToggleSongs] The structure of this screen has now changed. + Before, it contained the entire list of songs. Now, the main page + (ScreenOptionsToggleSongs) holds the groups, and a sub-page + (ScreenOptionsToggleSongsSubPage) holds the songs in each group. [AJ] + +20110225 +-------- +* Add lifts and fakes to all Pump noteskins. [Daisuke Master, Wolfman2000] + +20110224 +-------- +* [NotesLoaderSSC] Allowed reading of #NOTES2 again. [AJ] + +20110223 +-------- +* [Steps] Added GetChartStyle() Lua binding. [AJ] + +20110222 +-------- +* [ScreenEdit] Display the Player Number for Routine mode. [Wolfman2000] +* [ScreenEdit] Add format string metrics for the right hand side of the editor. + [Wolfman2000] + +20110221 +-------- +* Reverted ArrowSpacing back to 64 (which was the previous value). + Please re-adjust your speed mods accordingly. [AJ] +* [OptionRow] Added GetLayoutType() and GetSelectType() Lua bindings. [AJ] +* Fix .sm-style edits not being loaded. [AJ] +* [Common] Added OperatorMenuScreen metric. [AJ] + +================================================================================ +sm-ssc v1.2.2 | 20110220 +-------------------------------------------------------------------------------- + +20110219 +-------- +* [BPMDisplay] Added FormatString metric. [AJ] +* [GrooveRadar] Changed "Label#OffsetX/Y" metrics to "Label#X/Y". [AJ] +* [GrooveRadar] Fixed RadarFrame from not running commands on RadarFrame base. [AJ] +* [GrooveRadar] Removed RadarFrameTweenOnScreen and RadarFrameTweenOffScreen metrics. (Themers: Use RadarFrameOnCommand and RadarFrameOffCommand instead) [AJ] +* [GrooveRadar] Removed non-working PreDelayOnCommand, PostDelayOnCommand. (Themers: Use Label#OnCommand and Label#OffCommand instead.) [AJ] +* [ScreenOptions] Renamed "GetCurrentRow" Lua binding to "GetCurrentRowIndex". [AJ] +* [OptionRow] Added FirstItemGoesDown(), GetChoiceInRowWithFocus(PlayerNumber), + GetName(), GetNumChoices(), GetRowTitle(), HasFocus(PlayerNumber), + and OneChoiceForAllPlayers() Lua bindings. [AJ] +* [ScreenOptions] Added Change message (params: RowIndex, ChangedToExit). [AJ] +* [ScreenOptions] Added FocusedItemEndsScreen(PlayerNumber) and GetOptionRow(int) + Lua bindings. [AJ] +* [ScreenPlayerOptions] now derives from ScreenOptions, allowing it to get the + new ScreenOptions bindings. [AJ] + +20110218 +-------- +* [WheelBase] Added SetOpenSection Lua binding. [AJ] + +20110217 +-------- +* Allowed refreshing of Fonts again. [AJ] + +20110214 +-------- +* Added #CHARTSTYLE to .ssc format, mainly meant for Pad/Keyboard distinctions. [AJ] + +20110213 +-------- +* Life Difficulty 4 is now as difficult as Life 6 was. [AJ] + Change name of the life difficulty options: + Old: 1, 2, 3, 4, 5, 6, 7 + New: 1.2, 1.0, 0.8, 0.6, 0.4, 0.33, 0.25 + +20110212 +-------- +* [PlayerOptions] Added metrics to allow changing how often random modifiers + activate in the proper setting. At this time, the mods to be activated have + NOT been changed. [Wolfman2000] +* [ArrowEffects] Allow the Boomerang, Expand, Tipsy, Drunk, Tornado, Beat, and + Mini modifiers to be customized by metrics. As usual, change at your own + risk here. [Wolfman2000] +* Started the process of doxygen'ing the code. Goodness knows we need more + documentation on here. For the most part, don't expect comments on + particular files, though this may change. [Wolfman2000] +* [TimingData] Fix getting a Stop or Delay at a row if one of each occupies + the same row. This may need some extra testing. [Wolfman2000] + +20110211 +-------- +* Introduced the .ssc file format for future features and expansion. All .sm + files will still work, and will still be generated when saved in the editor. + At this point, saving to the DWI format is being deprecated. [Wolfman2000] + +================================================================================ +sm-ssc v1.2.1 | 20110210 +-------------------------------------------------------------------------------- + +20110210 +-------- +* Had to go back on the ScreenNetSelectMusic controls commit. My apologies. [AJ] + +20110209 +-------- +* [ScreenOptionsMemoryCard] Added three strings: "(no label)", "size ???", and + "%dMB". [AJ] +* [ScreenSelectMusic] Added RouletteTimerSeconds metric. [AJ] +* [ArrowEffects] Added QuantizeArrowYPosition metric. [AJ] + +20110208 +-------- +* [ScreenNetSelectMusic] Added MusicWheelType metric. [AJ] + +20110201 +-------- +* [Song] Added IsDisplayBpmRandom Lua binding. [AJ] + +20110130 +-------- +* [ScreenSelectMaster] Only run cursor commands on players if they exist. [AJ] + +20110118 +-------- +* [ScreenEdit] Move editing Timing Data to their own mini menu. [Wolfman2000] +* Implement #TICKCOUNTS tag for better checkpoint behavior. + This officially deprecates the CheckpointsUseTimeSignatures metric for + the CheckpointsUseTickcounts metric. [Wolfman2000] +* [NoteField] Add metrics for more flexible TimingData labels. [Wolfman2000] + +20110116 +-------- +* [ScreenEdit] Allow editing TimeSignatureSegments one fractional half at + a time. [Wolfman2000] + +20110115 +-------- +* [ArrowEffects] Allow modifying modifier characteristics in the metrics. + At present, Blink, Boost, Brake, and Wave can have modifications. + [Wolfman2000] +* [Player] Allow Combo Stopped message to be flexible via metrics. The + default is 50, as it was before. [Wolfman2000] +* [Player] Allow the default attack times for both random and mine attacks + to be changed. [Wolfman2000] +* [NoteField] Allow for adjustable fade fail time (for AJ). [Wolfman2000] +* [MenuTimer] Allow the hurry up transition to be adjusted. [Wolfman2000] +* [MusicWheel] Added RouletteColor, RandomColor, and PortalColor metrics. [freem] +* Fix a bug with VisualDelaySeconds where choosing -1 would lead to it being +1. [freem] + +20110112 +-------- +* [PlayerStageStats] Change score to an unsigned long from a signed int. [FSX] +* Noteskin changes. [Daisuke Master] +* [SpecialScoring] MIGS scoring, improved SN and SN2 scoring. [FSX] +* [RageFile] Added ReadBytes() Lua binding. [FSX] +* [NetworkSyncManager] Added CloseConnection() Lua binding. [freem] +* [ScreenTextEntry] Added Load(TextEntrySettings) Lua binding. [freem] + TextEntrySettings is implemented similar to the Attributes in BitmapText. +local teSettings = { + SendOnPop = "", -- ScreenMessage to send on pop (optional, "SM_None" if omitted) + Question = "", -- The question to display + InitialAnswer = "", -- Initial answer text + MaxInputLength = 0, -- Maximum amount of characters + Password = false, -- Mask character input (optional) + Validate = nil, -- Validation function; function(answer, errorOut), must return boolean, string. + OnOK = nil, -- On OK; function(answer) + OnCancel = nil, -- On Cancel; function() + ValidateAppend = nil, -- Validate appending a character; function(answer,append), must return boolean + FormatAnswerForDisplay = nil, -- Format answer for display; function(answer), must return string +}; + +20110111 +-------- +* [ScreenManager] Added ReloadOverlayScreens() Lua binding. [freem] + +20110110 +-------- +* [Character] Added GetDisplayName Lua binding. [freem] +* Make sure that DELAYS come first if STOPS share the same beat. [Wolfman2000] + +20110109 +-------- +* Add the semicolon and apostrophe keys as alternatives to the Page Up and Page + Down keys in the editor, mainly for laptop users. [Wolfman2000] +* Removed Song sample length limitations. [freem] +* Removed hard-coded values from the Step Editor. Now TimeSignatures are used + in place of these former constants. [Wolfman2000] +* [RoomWheel] Various metrics changes: [freem] + * Removed TextWidth/DescWidth metrics. + * "Desc" is now "Description". (DescX -> DescriptionX) + * Removed hardcoded commands (shadowlength,0;maxwidth,[max width metric];halign,0). + +================================================================================ +sm-ssc v1.2 | 20110107 +-------------------------------------------------------------------------------- + +20110107 +-------- +* Fix PrefsManager init list not being in order [vyhd] +* Add hack to ThemeManager to make GetThemeName() work intuitively for Scripts dirs [vyhd] +* [SongManager] Check the root Songs/ folder for extra stage course files. [freem] +* Make routine mode use ScreenGameplayShared instead of ScreenGameplay. [freem] +* Make pump-routine spacing the same as pump-double spacing. [FSX] + +20110106 +-------- +* [SpecialScoring] Fix some minor issues [FSX] +* New pump routine noteskins [cesarmades] + +20110102 +-------- +* Fix routine mode saving in the editor. [Wolfman2000] + +20110101 +-------- +* [Screen] Added HandleBackButton metric; useful for custom menus that need to + use the Back button for more user-friendly canceling. [freem] + +20101230 +-------- +* [StepsDisplay] Make the StepsType react to SetMessage as well. [freem] + +20101229 +-------- +* [ScreenHowToPlay] Replaced LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND macro + calls with ActorUtil::LoadAllCommandsAndSetXY(). Fixes an odd bug I ran into + during the porting of DDR 5th Mix. [freem] +* [ScreenInstallOverlay] Added bare DownloadFinished message. [freem] + +20101228 +-------- +* [ScreenHowToPlay] Have Character ignore the Miss steps instead of trying to + hit them. [freem] + +20101227 +-------- +* [ScreenHowToPlay] Added CharacterName metric, which will force the Character + that shows up. [freem] + +20101226 +-------- +* [ScreenEdit] Added GetEditState Lua binding. [freem] +* [ScreenNetSelectMusic] StepsDisplay changed to load from StepsDisplayNet. [freem] +* [RoomWheelItem] Added OverPart (just like in MusicWheelItem). [freem] +* [SongManager] Added GetSongRank(Song) Lua binding. [freem] +* Changed Steps picking logic in ScreenGameplaySyncMachine; now playable Steps + are chosen, instead of whatever NoteData happens to be first. + Also added pump-single data to ScreenGameplaySyncMachine music.sm. [freem] +* [Banner, FadingBanner] Various changes: [freem] + * Removed (now unused) All Music banner. + * Fixed swapped ScrollRandom and ScrollRoulette metrics. +* [Banner] Added GetScrolling(), GetPercentScrolling() and + SetScrolling(bool,float) Lua bindings. +* [FadingBanner] Added GetLatestIndex() Lua binding. [freem] + +20101225 +-------- +* Fixed Life difficulty scale being 0. [Daisuke Master] + +20101223 +-------- +* Added Banners for most SortOrders. (Group is excluded (song group banners + still work), as is Recent (which has no sections).) [freem] + +20101222 +-------- +* Added Shift+Ctrl+F2 shortcut for reloading overlay screens (and metrics) [freem] + +20101221 +-------- +* SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda] +* [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again. +* [ScreenInstallOverlay] Installs won't jump to SelMusic on Gameplay or System + Menus (e.g. Edit Mode) anymore on download completion. [freem] + +20101220 +-------- +* [Actor] Add bezier. (_fallback/02 Actor.lua) [FSX] +* [MessageManager] Added MenuStartP1 and MenuStartP2 messages. [freem] +* [ScreenSelectMaster] Broadcast MenuStartP# messages; allow themers to handle + the MenuStartP# messageitems. [freem] + +20101219 +-------- +* [WheelNotifyIcon] add BlinkPlayersBest metric. [freem] +* [GameCommand] Add GetScreen, GetSteps, GetCourse, GetTrail, and GetCharacter + Lua bindings. [freem] +* [StreamDisplay] Remove UseThreePartMethod. +* [Style] Add ColumnsPerPlayer and NeedsZoomOutWith2Players bindings. [freem] +* [Profile] Add GetLastUsedHighScoreName Lua binding. [freem] + +20101218 +-------- +* [MusicWheelItem] Add OverPart. [freem] +* [Profile] SetCharacter(sCharID) Lua binding added. [freem] +* [GameState] GetCharacter(PlayerNumber) and SetCharacter(PlayerNumber,sCharID) + Lua bindings added. [freem] + +20101217 +-------- +* [Sprite] Added SetAllStateDelays(fDelay) Lua binding. [freem] +* [MusicWheelItem] Added metric commands to NormalPart/ColorPart. [freem] + +20101215 +-------- +* Transplanted file download code from SM4 into sm-ssc. + sm-ssc can now handle the stepmania:// url protocol. [Chris Danford, freem] + +20101214 +-------- +* [RollingNumbers] Added Load(sMetricsGroup) Lua binding. [freem] +* Modifications to pump mode spacing. [Daisuke Master] +* Add eval song data for songs with no banner. [Midiman] + +20101213 +-------- +* [EditMenu] Enable the EditMenu to be themed more extensively. [freem] + Splits out the rows into Label and Value. + +20101212 +-------- +* [MusicWheelItem] Gave NormalPart/ColorPart names, so metrics can be used to + manipulate them. [freem] +* [MusicWheelItem] add Color param to SetMessage. [freem] +* Added --with-sse2 configure flag for SSE2 heuristic optimizations. [vyhd] +* Added 03 IniFile to start building new userprefs/themeprefs API. [vyhd] +* [EditMenu] Converted old non-specific metrics to more specific metrics. [freem] + {Metric Changes} + SongBannerWidth,SongBannerHeight -> SongBannerOnCommand + GroupBannerWidth,GroupBannerHeight -> GroupBannerOnCommand + RowLabelsX -> Label#X + RowLabelOnCommand -> Label#OnCommand + RowValue#X -> Value#X + RowValueOnCommand -> Row#OnCommand + {Metric Additions} + SongBannerChangeCommand/GroupBannerChangeCommand - runs when song/group + banner is changed. + Label#GainFocus/LoseFocusCommand and Value#GainFocus/LoseFocusCommand - runs + when the Label and Value gain/lose focus. + +20101128 +-------- +* Increased default scrolling speed. Modifies how the speed mods work. [shakesoda] + +================================================================================ +sm-ssc v1.1 | 20101120 +-------------------------------------------------------------------------------- + +20100929 +-------- +* Fix issues with RequireStepOnHoldHeads not working properly if the W5 + window is zero. [FSX] + +20100925 +-------- +* Add SetScore Lua binding to PlayerStageStats. [FSX] +* Don't increase combo on AvoidMine if AvoidMineIncrementsCombo is false. [FSX] +* Change build.sh to use ffmpeg 0.6 under Linux. [FSX] + +20100913 +-------- +* Attempt to fix issues with full combos occuring when checkpoints + have been missed. [FSX] +* Fix NotesLoaderKSF. [Daisuke Master] + +20100912 +-------- +* Add a hack allowing all courses to play, regardless of missing noteskins [wolfman2000] +* Restore ITG behavior, allow survivals to be won. [wolfman2000] + +================================================================================ +sm-ssc v1.0 "final" | 20100910 +-------------------------------------------------------------------------------- + +20100910 +-------- +* [ScreenNetSelectBase] Metric name changes: UsersDX -> UserSpacingX, + UsersAY -> UsersLine2Y +* [ScoreKeeperNormal] add MineHitIncrementsMissCombo and + AvoidMineIncrementsCombo metrics. [FSX] + +20100907 +-------- +* [StepsDisplay] Make everything else (that isn't the frame) react to the + Set message. + +20100829 +-------- +* [SongManager] Added SetPreferredSongs(string) and SetPreferredCourses(string) + Lua bindings. The files have to be named "SongManager .txt" + Example: SONGMAN:SetPreferredSongs("mysongs.txt") calls the file + "SongManager mysongs.txt". [cerbo] + +20100826 +-------- +* Make Ctrl+[letter] work as expected in Artist sort. [Midiman, AJ] + +20100822 +-------- +* Add [ArrowEffects] DrawHiddenNotesAfterReceptor metric [Daisuke Master] + +================================================================================ +sm-ssc v1.0 Release Candidate 2 | 20100822 +-------------------------------------------------------------------------------- + +20100821 +-------- +* Add roll and twirl from OpenITG [vyhd] +* Ignore invalid notes in KSF files [Daisuke Master] + +20100817 +-------- +* [GraphDisplay] Allow Line to be themed via metrics. + +20100815 +-------- +* [GameCommand] Remove pushscreen command +* [ScreenOptionsMasterPrefs] Reset Judge and Life values to the ones used in SM4 +* [ScreenNetEvaluation] add Score, Grade, PlayerOptions params to + UpdateNetEvalStats message +* [PlayerState] add GetHealthState Lua binding +* [Player] fix a warning [shakesoda] +* [Player] Change combo coloring logic in course mode: + "PERCENT_UNTIL_COLOR_COMBO refers to how long through the course the combo + color should appear (scaling to the number of songs). (This may not be + desired behavior, however.)" Let me know if I should add an alternate way to + specify course combo color logic. -aj +* [ScreenRanking] Cleanup and un-hardcode shadowlength +* [ThemeManager] add GetSelectableThemeNames Lua binding; returns a table of + themes as strings. + +20100814 +-------- +sm4.0: + * r28482: number measures starting with 0 (makes the mental conversion + between the .SM and the editor much easier) [Chris Danford] + +20100811 +-------- +sm-ssc: + * [Player] Implement a hack for miniholds until a proper solution can be found. + * [ActorSound] Fix Play() so that stop and pause are usable. [Daisuke Master] + +sm4.0: + * r28455: fix EFFECT_BOUNCE, give particles a start position uniformly + distributed across the screen [Chris Danford] + * r28456: change flip effects to use degrees, not radians [Chris Danford] + +20100810 +-------- +[ScreenNetEvaluation] + * Replace hardcoded rainbow effect with UserTier02OrBetterCommand. + * Added Difficulty and Steps param to UpdateNetEvalStats message. The + beginning of custom-themable online stuff begins. + +[ScreenNetSelectMusic] + * Started to port SampleMusicPreviewMode from ScreenSelectMusic. + * Changed MusicWheel metrics to read from OnlineMusicWheel instead. + * Added section, roulette, and random music (not used yet). + * Stop the music when reaching a section. + +20100808 +-------- +* [ScreenDebugOverlay] force sm-ssc to read the OnCommand for ButtonText, + FunctionText and PageText. + +20100807 +-------- +* [ScreenManager] add AddNewScreenToTop Lua binding. + +20100804 +-------- +* [ScreenDebugOverlay] add PageStartX and PageSpacingX metrics. + +20100801 +-------- +* sm5svn r28402: Fix compile on some systems. [Steve Checkoway] + +20100731 +-------- +* Add "package" to StepMania's Lua. [shakesoda] + +20100727 +-------- +* Allow editing of a Song's #GENRE tag within the editor. + +20100726 +-------- +* Fix |D| tag handling in Direct Move KSFs [Daisuke Master] +* Fix up alternate mappings for kb7 [shakesoda] +* [MusicWheel] Add RemindWheelPositions metric. [Daisuke Master] + +20100725 +-------- +* [MusicWheel] JumpToNext/PrevGroup functions tweaked [juanelote] +* [MusicWheel] Added OnlyShowActiveSection metric. Only shows one group at + time. Use the Next/Previous Group codes to switch groups. [Daisuke Master] +* Allowed group changing via GameButtons as well. [Daisuke Master] +* [SongManager] Added GetSongGroupByIndex function. [juanelote] + (to-do: Give this a Lua binding. -aj) + +================================================================================ +sm-ssc v1.0 Release Candidate 1.5 | 20100723 +-------------------------------------------------------------------------------- + +20100721 +-------- +* Major tweaks to notesloaderksf, |E| Tags are working as they should now + [Daisuke Master] +* More column spacing values edited for Pump [Daisuke Master] + +20100719 +-------- +* Allow noteskins to use animation based on beats or seconds via a new noteskin + metric: AnimationIsBeatBased. [Daisuke Master] +* Widen the lane for the middle note in kb7. [shakesoda] + +20100718 +-------- +* Change screenshot naming format from "screen#####" to "YYYY-MM-DD_HHMMSS". + This should solve an issue where screen00000 was getting written multiple + times for unknown reasons. +* Make EnteredPrevSteps/EnteredNextSteps codes only trigger if + CHANGE_STEPS_WITH_GAME_BUTTONS = true. [Daisuke Master] +* [ScreenGameplay] Added UnpauseWithStart metric. [Daisuke Master] + +20100717 +-------- +sm4svn: +* r28385: Fix memory card port handling on newer kernels. There's got to be a + better way to parse out a USB device's connection path. [Glenn Maynard] +* r28386: Fix partitioned USB devices not always being seen correctly due to + race condition with the kernel partition scan. The sleep was a hack to work + around this issue which doesn't work in all cases. [Glenn Maynard] + +sm-ssc: +* Added Menu(Left/Right/Up/Down)(P1/P2) messages to ScreenOptions. +* [ScreenSelectMusic] Add ChangeStepsWithGameButtons, PreviousDifficultyButton, + and NextDifficultyButton metrics, allowing the themer to not have to use + CodeDetector. [Daisuke Master] + + +20100715 +-------- +* Fix spacing of various pump modes. [Daisuke Master] + +20100710 +-------- +sm4svn: + * r28376: use GetProcessImageFileName instead of GetModuleFileNameEx; + it works in more cases, eg. when losing focus to the taskbar [Glenn Maynard] + +20100709 +-------- +* Modify Autoplay/AutoplayCPU's tap note offset code to generate proper offsets + (as opposed to offsets between -0.1f and 0.1f, which makes Selling Out Made + Simple 2's protiming look weird). + +20100708 +-------- +* [ScreenSelectProfile] Transplant menu input functions from ScreenSelectMaster. + Now you no longer have to rely on stuffing the directions into the Codeset. + (Of course, you still have to handle Start and Back yourself.) + +20100706 +-------- +* [ScreenSelectMusic] add a code for closing the current folder from any + location (a la DDR X2). + +20100705 +-------- +* [Player] add RequireStepOnMines metric. This allows DDR's Shock Arrows to + be emulated. (currently incomplete) [FSX] + +20100703 +-------- +sm4svn: + * r28374: add GetBestFullComboTapNoteScore [Chris Danford] + (This replaces the IsFullComboW* bindings, which we never fully took in. -aj) + +sm-ssc: + * [Course] add GetCourseEntries() Lua binding. + * [Trail] add GetEntries() Lua binding. + * [ScreenTextEntry] replace hardcoded underscore and double space with + AnswerCaret and AnswerBlank strings. + +20100702 +-------- +sm4svn: + * r28372: use MercifulDrain logic for MercifulBeginner [Chris Danford] + * r28373: don't override user scroll in courses [Chris Danford] + +20100630 +-------- +sm4svn commits: + * r28367: fix resampler noise [Glenn Maynard] + * r28368: fix get_readable_ranges error handling [Glenn Maynard] + * r28369: don't use fprintf from the crash handler [Glenn Maynard] + * r28370: work around not all recursive crashes being caught [Glenn Maynard] + * r28371: use /proc weirdness to make the crash handler work even after + the binary has been deleted or replaced [Glenn Maynard] + +sm-ssc: +* [ScreenDebugOverlay] add new metrics: LineStartY, LineSpacing, + LineButtonX, LineFunctionX. +* Fix an odd mapping issue in dance mode where keypad 7 and 9 would control + up/down as well as upleft/upright. (Numpad 8 is now up and numpad 2 is now + down.) +* Step editor can now process meters from 0-25. +* MAX_METER upped to 35. + +20100629 +-------- +* Fix an issue involving setting a group via GameCommand and a metric ([MusicWheel] + UseSectionsWithPreferredGroup=false). Previously, this situation would ignore + the group and show all songs. Instead, it has been fixed to work as intended, + only showing the songs in that group. (A DDR 4th Mix theme is feasible again.) +* If [MusicWheel] UseSectionsWithPreferredGroup=true and a song group is set + via GameCommand, the wheel will now scroll to the first song in the desired + group, instead of the very first wheel item. +* [CourseUtil] make the "All Songs" course use the current theme's + Graphics/Banner all music file. + +================================================================================ +sm-ssc v1.0 Release Candidate 1 | 20100627 +-------------------------------------------------------------------------------- + +20100627 +-------- +* [NotesLoaderKSF] Support reading of #PLAYER and #MUSICINTRO/#INTRO tags in + KSF files. [based on code by Aldo_MX] +* Adjust KB7 draw order which still seems wrong, change noteskin. + Use default-p2 and join as player 2 to play with original spacing. [shakesoda] + +20100626 +-------- +* Fixed a bug with urlnoexit GameCommand always returning the "Could not + launch web browser" message. +* Removed some untested/non-working Model Lua bindings. +* Only autogen Medium difficulty steps for Routine modes. +* Added PlayerState:GetPlayerOptionsArray() Lua binding. +* Revert a commit from 20091219 regarding profile loading on ScreenSelectMusic. + +20100623 +-------- +* Implement the last remaining SampleMusicPreviewMode: StartToPreview. + This one requires [ScreenSelectMusic] TwoPartConfirmsOnly=true in the + metrics to work correctly. +* Added Actor:Real(), which makes graphics their true size at + any resolution. [shakesoda] + +20100619 +-------- +* [HighScore] add GetGrade() Lua binding. + +20100618 +-------- +* Allow RShift+Print Screen to take uncompressed screenshots. + +20100614 +-------- +* Attempt to fix screenshot numbering bug. Seems to work, if testing is + any indication. (Did not work.) + +20100612 +-------- +* sm4svn r28359-r28364. [Chris Danford] + Notable commit logs: + * r28359: "fix BackgroundChange color values being written with commas. + Commas are a reserved character that seprate values in a tag. + Caret was used to separate RGBA values in a color in this case and + NotesLoaderSM already handles that." + * r28361: "normalize colors in BGCHANGES to HTML colors, to fix weird escaping" + +20100610 +-------- +* Fix Rave/Battle crashes, allowing it to work again. +* Chris Danford changed galopin's code for detecting pump mats. +* [Actor] add basezoom, basezoomz, GetBaseZoomY(), GetBaseZoomZ(), and + GetGlow() Lua bindings +* [Screen] add GetScreenType() Lua binding. +* howl's patch for fixing LowLevelWindow + (stepmania4-fullscreen-focus-lost-and-restore-resolution2.patch) + http://www.stepmania.com/forums/showthread.php?t=23693 + +20100608 +-------- +* sm4svn r28359: fix BackgroundChange color values being written with commas. + Commas are a reserved character that seprate values in a tag. Caret was + used to separate RGBA values in a color in this case and NotesLoaderSM + already handles that. [Chris Danford] + +20100605 +-------- +* Add Windows 7 and Windows Vista as identified OS versions in DebugInfoHunt. + +20100603 +-------- +* [MusicWheel] If AutoSetStyle is on and Autogen is off, some songs with valid + steps may be missing from the wheel. Re-add them by checking for every + playable StepsType when AutoSetStyle is on. + Fixes issue 147: http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=147 +* Fix a crash that occured when changing themes that had differing numbers + of song/course group colors. (Yes, finally.) + +20100602 +-------- +* [Actor] add addrotationx, addrotationy, addrotationz bindings/commands +* [GameCommand] Don't allow battle/rave with Routine + (StyleType_TwoPlayersSharedSides). +* Reordered ScreenEdit's main menu (escape) slightly. +* Expand various floats from 3 decimal places to 6 (experimental) [Midiman] +* [BPMDisplay] add RandomText metric for theming the "..." that appears when + BPMs don't cycle and MinBPM == -1. + +20100601 +-------- +* [MusicWheel] added UseSectionsWithPreferredGroup metric + (allows sm-ssc to display all song groups if you use the songgroup + GameCommand, instead of no groups.) +* [Character] add GetCharacterDir() and GetCharacterID() Lua bindings. + +================================================================================ +sm-ssc v1.0 Public Beta 4 | 20100531 +-------------------------------------------------------------------------------- +The letter grade tiers have been reset to the old SM4CVS/3.9 values. You +should probably reset your scores to maintain consistency. (Though if you +used themes with their own scoring system, you never had consistency in the +first place. :s) + +20100531 +-------- +* [Trail] Add GetTrailEntry() Lua binding. +* [TrailEntry] Allow TrailEntry to push itself, making Lua bindings possible. + TrailEntry's Lua bindings include GetSong(), GetSteps(), IsSecret() and + GetNormalModifiers(). + +20100527 +-------- +* Add Direction param to ChangeStepsMessage. + +20100526 +-------- +* Enable upper diagonal keys for Positive Gaming Impact dance mat [corec] + +20100525 +-------- +* [ScreenSelectProfile] Actually load player's last used settings. +* [ScreenNetEvaluation] Don't assume every theme has a Grade display and/or + Points display; This fixes crashes in themes which don't have them when + people go to view another player's stats. +* [ScoreKeeperNormal] add [Gameplay] MaxScoreToIncrementMissCombo metric. +* [Course] add GetCourseDir(), HasBackground(), IsAnEdit() Lua bindings. +* [GameManager] rework how the IsGameEnabled() Lua binding works: + it now takes a string as a parameter. +* [ScoreKeeper] allow ScoreKeeperRave to be used as a ScoreKeeper. +* [ThemeManager] add GetCurLanguage() Lua binding. + +20100522 +-------- +* [CourseLoaderCRS] up the maximum size of an edit course from 30KB to 32KB; + allow the #BACKGROUND tag to be read from .crs files. +* [HelpDisplay] new TipSwitchTime metric +* [PrefsManager] add PreferenceExists(sPrefName) Lua binding; + removed now-unused ShowSelectGroup preference. +* [ScreenSelectMusic] make the ScoreDisplay 0 out if nothing is selected. + +20100518 +-------- +* The great Lua binding addition begins... + * [Actor] GetHAlign(), GetVAlign() + * [LifeMeterBattery] GetLivesLeft() + * [MemoryCardManager] GetCardLocked(pn), IsNameAvailable(pn) + * [MenuTimer] GetSeconds() + * [PlayerStageStats] GetRadarPossible(), GetRadarActual() + * [ProfileManager] LastLoadWasFromLastGood(pn), LastLoadWasTamperedOrCorrupt(pn) + +20100515 +-------- +* [AnnouncerManager] Lua bindings get added to AnnouncerManager, which now + exists as ANNOUNCER. New bindings: + ANNOUNCER:DoesAnnouncerExist(sAnnouncer) - returns a bool + ANNOUNCER:GetAnnouncerNames() - returns a table of strings + ANNOUNCER:GetCurrentAnnouncer() - returns a string + ANNOUNCER:SetCurrentAnnouncer(sAnnouncer) - Sets the announcer if it exists. + +20100513 +-------- +* [ScreenEvalation] Graphic "time label" renamed to "TimeLabel" for the sake + of naming consistency. +* Add GetOSName() binding. Returns a string representing the current OS. +* Allow Negative stops to "work" again in Quirks Mode. +* [ScreenSelectMaster] Fix "THE" cursor crash by testing if the cursor object + is actually there (a.k.a. not null). It should be noted that cursors can + still crash, however. (yay bugs) + +20100512 +-------- +* [NotesLoaderSM] Only apply the old .sm format difficulty hacks if + difficulty == Difficulty_Hard. +* [TimingData] add HasNegativeBpms() Lua binding. + +20100507 +-------- +* [PaneDisplay] Show fallback values when Song/Course is null. + +20100506 +-------- +* [ScreenSelectMusic] Make it so changing difficulty also cancels + TwoPartSelection if TwoPartConfirmsOnly. + +20100504 +-------- +* [ScreenGameplay] Un-hardcoded the diffuse command on CourseSongNumber. + +20100502 +-------- +* Add dance-threepanel StepsType. Thanks to kurisu for the original 3.9 code. +* XMode mod added, thanks to v1toko/StepNXA. +* [Song] add GetDisplayBpms() [a table of two floats], IsDisplayBpmSecret(), + IsDisplayBpmConstant() [both bools] Lua bindings + +20100501 +-------- +* Fixed an issue with StepsDisplayList crashing if more than 21 difficulties are + playable. This allows Technomotion to work with AutoSetStyle and Autogen on. + +================================================================================ +sm-ssc v1.0 Public Beta 3 | 20100430 +-------------------------------------------------------------------------------- +There's an important change for themers that needs to be noted: +We have renamed two screens in _fallback to match StepMania's names. + +ScreenSelectPlayMode (previously the select style screen) +has been renamed to ScreenSelectStyle. + +ScreenSelectPlayStyle (previously select play mode) has been renamed +to ScreenSelectPlayMode. + +This change effects branches (_fallback/02 Branches.lua) and metrics, so if +you're not handling the two screens yourself, you will probably have to change +some things around in your theme. + +20100430 +-------- +* [GameState] added DisablePremiumInEventMode metric. + +20100426 +-------- +* [Course.cpp] add a few Lua bindings to CourseEntry: + * IsSecret - bool + * IsFixedSong - bool + * GetGainSeconds - float + * GetGainLives - int + * GetNormalModifiers - string + * GetNumModChanges - int + * GetTextDescription - string +* Re-add ScreenGameplaySyncMachine to project files that were missing it. + +20100422 +-------- +* libpng upgraded from 1.2.7 to 1.4.1 (Windows, Mac, BSD) + (libpng upgrade was not carried out for Xbox, but that version does + not run anyways, so it is no operational loss.) + +20100420 +-------- +* Convert |T| values in KSF files to TimeSignatures for [Player] + CheckpointsUseTimeSignatures metric. + +20100419 +-------- +* Add SampleMusicPreviewMode_LastSong, which gives similar behavior to + DDR Extreme. There is a hack for the random music based on Takuya's + DDR Extreme theme; I am unsure if this is accurate behavior or not. [AJ] +* Allow MusicWheelItem Random and Portal to have different graphics + from Roulette. +* Added Song:HasAttacks() Lua binding. + +20100417 +-------- +* Finally get rid of PLAYER_COLOR. ColorP1Command and ColorP2Command no + longer exist. The last things that were being diffused with player color + in the code included text in the Oni score display and ScreenSelectMusic score. + I'm sure you can diffuse ScoreDisplayOni Numbers, but I can't seem to find any + references to them in the metrics of any released theme. [AJ] + +20100404 +-------- +* [SongManager] Added GetSongGroupNames(), GetSongsInGroup(string) Lua bindings + +20100403 +-------- +* Fixed an issue where course banners were always cached, regardless of setting. + +20100401 +-------- +(Not jokes) +* NextSong/PrevSong now work when TwoPartSelection=true and + TwoPartConfirmsOnly=true on ScreenSelectMusic. A new message + ("TwoPartConfirmCanceled") was added to catch when this happens. + +20100331 +-------- +* Added Lifts to PaneDisplay. (StepMania 3.9+/Plus Redux had them) + +================================================================================ +sm-ssc v1.0 Public Beta 2 | 20100331 +-------------------------------------------------------------------------------- + +20100329 +-------- +* Added SONGMAN:ShortenGroupName(string) Lua binding + +20100328 +-------- +* sm4svn r28340: Don't call GetFirstCompatibleStyle if numSidesJoined == 0 + (ScreenContinue) [Chris Danford] +* [ScreenSelectMusic] TwoPartTimerSeconds metric added + +20100326 +-------- +* [BPMDisplay] make the "Various" text a theme-able string. +* Allow ';' to start a comment in .ini files +* [MenuTimer] Attempt to fix dialogs that come up when changing themes + (where one theme's warning timer starts higher than another). +* [Player] PercentUntilColorCombo metric added. [Wolfman] + (float value in the range of 0..1) + +20100325 +-------- +* Fixed a crash caused by switching themes in StepMania. This crash was related + to the song group colors, which weren't getting reloaded on theme switch. + Since themes use different numbers of group colors... crashes! Not anymore. + +20100321 +-------- +* Fix a rounding bug that causes resolutions like 639x480 (4/3) and 853x480 + (16/9); now they should be 640x480 and 854x480 as expected. Applies to + screenshots as well. + (Also, this fixes Midiman's pet peeve of having to add +1 to SCREEN_WIDTH) + * [RageDisplay.cpp] modified screenshot function + * [ScreenDimensions] modified SCREEN_WIDTH and SCREEN_HEIGHT algorithms + * [StepMania.cpp] modified windowed mode width calculation + +20100315 +-------- +* Make steps labeled as "freestyle" in .ksfs use doubles + +20100313 +-------- +* ScoreKeeperNormal double shot. + 1) convert toasty trigger from a single number to a Lua table. Only problem + is, the toasty only triggers on the first one. Since this makes it + equivalent to how it was set up before, I'm okay with this. [AJ] + 2) FSX submitted a patch that supposedly fixes the broken combo problem. + I can't fully test this, so I'm committing it in the hopes that someone + else tests it too. + +20100312 +-------- +* sm4svn r28332: if a BGCHANGE file can't be resolved, don't use the specified + effect because it may require 2 files and all random BGs specify only 1 file + [Chris Danford] +* SM4SVN r28328, "draw glow using stroke texture" forces the BitmapText to glow + both the inner and stroke elements. This makes BitmapText elements with an + invisible stroke have a glowing stroke instead. Not good. + To combat this, I have developed the BitmapText::textglowmode command, along + with the TextGlowMode enum. Valid values include 'TextGlowMode_Inner', + 'TextGlowMode_Stroke', 'TextGlowMode_Both'. [AJ] + +20100311 +-------- +* [Player.cpp] Don't add checkpoints to the combo if Autoplay is on. +* Re-add the ability to reload a theme's Lua scripts, this time using Ctrl+F2. +* Convert GrooveRadar base into an AutoActor. (Now it can use a Lua BGAnim.) + +20100309 +-------- +* [ScreenSelectMaster] Add GetSelectionIndex(pn) Lua binding. (You'll have to + call this one using GAMESTATE:GetTopScreen():GetSelectionIndex(PLAYER_1) or + something like that.) + +20100308 +-------- +* [PlayerStageStats] add GetPercentageOfTaps(TapNoteScore) Lua binding +* [PlayerState] add GetMultiPlayerNumber() Lua binding (untested) + +sm4svn catch up, all by Chris Danford: +* r28326: fix handling of noteskins with an uppercase letter +* r28327: track W4 full combo +* r28328: draw glow using stroke texture + +20100306 +-------- +* [ScreenEvaluation] New metric DetailLineFormat. Must contain two integer flags + (%d or %i should work.) + +20100305 +-------- +* [ScreenNetEvaluation] add GetNumActivePlayers() binding and UpdateNetEvalStats + message (one param, ActivePlayerIndex). This is currently untested. + +20100301 +-------- +* Re-add SM4SVN r28063 "Allow for 'confirmation only' double press mechanisms +as a choice for two part selection on ScreenSelectMusic" since + 1) It actually did have a use + 2) [AJ] was thinking of adding it anyways and forgot it was already made. + +================================================================================ +sm-ssc v1.0 Public Beta 1 | 20100301 +-------------------------------------------------------------------------------- +This represents the first public version of sm-ssc. The previously publicly +available release was not the official public beta version, but was released +for more people to get their hands on it for testing. + +sm-ssc v1.0 Public Beta 1 has 111 Lua bindings that you currently can't find in +StepMania 4 alpha versions as of 2010/02/28. That doesn't include the various +helper functions available to you in scripts via the fallback theme, either. :) + +20100228 +-------- +* Applied stutter fix hack by Henke37 + (src: http://www.pasteall.org/11353/diff) +* [ScreenPackages] Some strings that were once hardcoded are now not: + "VisitURL", "DL @ %d KB/s", "Failed.", "Invalid URL.", "File Already Exists", + "Failed to connect.", "Header Sent.", "Waiting for header." +* Allow multiple random modifiers to be listed in RandomModifiers.txt. + The random number generation for RandomModifiers has also changed. + +20100227 +-------- +* [GameState] add GetCurMusicSeconds binding. Values can be negative, + so watch out when using. + +20100226 +-------- +* rework some bindings to match SM4: + GetBPMAtBeat, GetBeatFromElapsedTime, and GetElapsedTimeFromBeat have + moved from Song to TimingData. + If you were using these against the Song, they will fail in your theme. + +* [TimingData] GetStops only returns Stops now (and not Delays). + If you want Delays, there is a new GetDelays() binding, which works + like GetStops. + +20100225 +-------- +* Added ToastyDropped message. [Midiman] + +20100223 +-------- +* [Player] CheckpointsFlashOnHold metric added. Fixes issue 16. + + +20100222 +-------- +* [CodeDetector] NextBannerGroup and NextBannerGroup2 were previously used + for MusicBannerWheel, which is currently not used in sm-ssc. These codes + have been changed to NextGroup and PrevGroup. The codes switch between + groups as you would expect. + +20100219 +-------- +* sm4svn r28313: don't filter NoteSkins at a PrefsManager/NoteSkinManager level. + Leave the NoteSkin sorting and filtering up to the theme. [Chris Danford] +* load lighting from ActorFrame xnodes (in addition to Lua commands) +* add Cancel command on ScreenWithMenuElements, so other things can react + to Screen cancel. + +20100218 +-------- +* Added Fonts/ScreenReloadSongs LoadingText, making the text on + ScreenReloadSongs themeable. +* Added Fonts/NoteField MeasureNumber, ScreenGameplay debug, + ScreenGameplaySyncMachine SyncInfo. + +20100216 +-------- +sm4svn r28309: Fix crash in course mode, another (and, from the looks of it, + the last) dumb bug this block o' hack caused [vyhd] + +20100215 +-------- +Some more sm4svn commits: +* r28304: read-ahead tweaks; support os read cache flushing [Glenn Maynard] +* r28306: experimental code for storing Lua data in Profiles and + converting between XML and Lua data. [vyhd] + +20100214 +-------- +sm4svn catchup... Noticing a pattern? +* r28293: add RageFile::GetFD for specialized file handling [Glenn Maynard] + (FD meaning File Descriptor -aj) +* r28294: "remove absolutely pointless revision tags that cause [aclocal.m4 and + ltmain.sh in libmad] to constantly show up as modified" [Glenn Maynard] +* r28295: [fix] copy and paste error [Glenn Maynard] +* r28296: Experimental: hint the OS caching to avoid skips when starting/looping + movies [Glenn Maynard] +* r28297: fix a bug, then disable the whole thing for now due to dup() + braindamage; Linux version works fine (posix_fadvise) [Glenn Maynard] +* r28299: fix m_iFilePos updating on seek [Glenn Maynard] +* r28300: Added theme metric for Routine noteskins (to enforce separate noteskins + per player, or at least conscious thought toward that issue), added fix for + ScreenEdit only handling switching players on dance-routine [vyhd] + (editor's note: the new metrics are RoutineNoteSkinP1 and RoutineNoteSkinP2 -aj) +* r28303: make sure routine always writes as two charts, even if only one has + steps; DEBUG_ASSERT -> ASSERT [Glenn Maynard] + +20100213 +-------- +Even more sm4svn catchup: +* r28277: remove preferred group filtering (leaving the setting in for later use) [Glenn Maynard] +* r28279: simplify SongUtil::GetStepsTypeAndDifficultyFromSortOrder [Glenn Maynard] +* r28281: fix SSM crashes when selecting a song with only one + player enabled [Glenn Maynard] +* r28284: add Style::GetUsesCenteredArrows (doubles + routine) +* r28285: sanity check (on ScreenGameplay) [Glenn Maynard] +* various commits related to routine mode [Glenn Maynard] + (specifically, r28282,r28286,r28287,r28289,r28290) +* r28291: fix pump routine right side DownLeft not drawn [Chris Danford] +* r28292: easier debug stepping [Chris Danford] + +20100211 +-------- +sm-ssc: +* Fix a crash with AutoKeysounds. + +Playing catch-up with sm4svn. This happens a lot. +* r28273: "Added more logical handling of Routine mode selection + (see source code comments); hopefully, we can write up a more standard + solution to this later, since this is kind of a hack" [vyhd] +* r28274: course type param to GetCustomDifficulty is optional [Glenn Maynard] +* r28276: Lua binding for MeterDisplay. Allow setting and changing the + width dynamically. Phase out the "StreamWidth" node property; set it with + SetStreamWidth instead. [Glenn Maynard] + +20100210 +-------- +* Possible fix for handling of delays in autoplay. May also fix things + elsewhere (editor?), but that is untested. Autoplay seemed to work well + with Uprock (the song), so I have no complaints. -aj +* Glenn started to revert some of Frieza's code in sm4: + * "Personally, there is an assert for checking if the noteskin is not empty. + Based on other code, it seems like the noteskin would have to be set + somewhere else. If this is a problem somewhere else, find where it's a + problem and don't patch this function." -aj re: NoteSkinManager.cpp r2098 + * r28076 "Adds metric options to flash the lifebar when a note is hit" + My comment on why I did this: "Any competent themer can make a lifebar + flash when a note is hit. Just hook something up to a JudgmentMesageCommand, + read the params, and go from there. If it doesn't work on + StreamDisplay/LifeMeterBar, then GO CODE YOUR OWN LIFE METER IN LUA!! + Seriously there are enough publicly available references (moonlight, + optical, NCEvo if you want to go back in time to see a different type + of life meter) that claiming 'oh I don't know how to' isn't an excuse. + Please actually put in effort and seek examples when you try stuff + kthx i told you this would be ranty" -aj + +20100209 +-------- +* sm4svn r28266: Fix GAMESTATE:GetCurrentSteps() only returns single-player + steps for any difficulty [vyhd] + +20100207 +-------- +* sm4svn r28264: subtractive blend (OpenGL only for now) [Glenn Maynard] + (D3D version untested, I'm unsure of the behavior -aj) + +20100204 +-------- +* [MusicWheel] add RecentSongsToShow metric. + +20100203 +-------- +* "First pass of toasty message, hopefully this doesn't break!" [Midiman] + +20100202 +-------- +* [Course.cpp] HasTimedMods() now actually checks for timed mods + (technically non-global) instead of being a clone of HasMods(). +* [Player.cpp] add MAX_HOLD_LIFE/[Player] MaxHoldLife metric + +20100130 +-------- +* "various commits from wolfman from the hg repo; mostly cleanup aside from + rev. 79071b3442, which adds a new metric. (that change is forthcoming)" + +20100128 +-------- +* Add DELAYS to list of known .sm tags [Wolfman; sm-ssc hg ebb2bda5b4] +* fix Windows icons for compiling on VS2003 and VS2005 +* add ScoreKeeperShared.cpp/.h to VS2k3 project + +20100127 +-------- +* sm4svn r28259: Change OptionsList behavior to pop menu on Select and + default to Exit only on SELECT_ONE [vyhd] + +20100126 +-------- +* Add ScreenGameplayShared, ScoreKeeperShared to Makefile.am + +================================================================================ +sm-ssc Private Beta Wave 1.4 | 20100125 +-------------------------------------------------------------------------------- + +20100125 +-------- +* Catching up with StepMania 4 SVN. All code by Glenn Maynard. + * r28254 (GameConstantsAndTypes.h GameManager.cpp): routine style for pump + * r28255 Steps.cpp: fix routine special case so it works in all styles + * r28256 ScoreKeeper.cpp: support ScoreKeeperShared in + ScoreKeeper::MakeScoreKeeper + * r28257 ScreenGameplayShared.cpp: update old ScreenGameplayShared code + to mostly use PlayerInfo::Load; fixes some stuff but still not right + +20100124 +-------- +* [Player] new ScoreMissedHoldsAndRolls metric (FSX) +* [Song] add GetFirstBeat and GetLastBeat Lua bindings +* Make RandomBackgroundMode use BGMODE_RANDOMMOVIES by default + +20100122 +-------- +* Add support for Pump It Up delays with #DELAYS tag in .sm files & treating all + stops in .KSF files as delays. +* Use RollingNumbers methods in ScreenNetEvaluation now that ScreenEvaluation + uses them, as opposed to settext (which caused a few visual issues). +* [ScreenEvaluation] add SongOptions as a metric-able item. + +20100119 +-------- +* Make FGAnimations (#FGCHANGES:) work again. (hopefully; it semeed to work + using a test file.) + +20100118 +-------- +mostly [ScreenNetSelectBase] related changes: +* remove some now-unused metrics (namely ChatInputBoxWidth/Height and + ChatOutputBoxWidth/Height). +* Rename "Meter" to "StepsDisplay" +* RoomWheel now uses a MusicWheel-like setup for items (NormalPart/ColorPart) + instead of a single bar graphic. + +20100117 +-------- +* [ScreenNetSelectBase] Sprite -> AutoActor for chat boxes, un-hardcode some + commands on items to allow for better theming. +* Disable Control+Letter "sort by title" shortcut in course mode. + +20100116 +-------- +* Pump-Doubles has better (more accurate?) spacing between the two sides +* Enable saving replays. The replay data format will likely change over time, + and there is currently no mechanism to replay the data back as another player. + +20100114 +-------- +* add GAMESTATE:GetHardestStepsDifficulty() Lua binding +* Don't complain about #SELECTABLE:Roulette; even though it's not implemented + for some reason. + +20100112 +-------- +* Added more milestones (25, 50, 250) +* {issue 73} If the wheel is locked, don't accept Ctrl+Letter to sort +* [NotesLoaderKSF] implement DirectMove |E| type (DelayBeat) + +20100111 +-------- +* [CourseLoaderCRS.cpp] add GRADEBEST and GRADEWORST to possible values. + +20100107 +-------- +* [GameConstantsAndTypes.h] bump MAX_METER from 13 to 20. +* [MemoryCardManager] add GetName(pn) Lua binding. Returns the name of the device. + +================================================================================ +sm-ssc Private Beta Wave 1.3 | 20100106 +-------------------------------------------------------------------------------- + +20100105 +-------- +* [LifeMeterBattery] Instead of using various hardcoded values, make them metrics. + BatteryBlinkTime (float), BatteryP*X/Y and NumLivesP*X/Y metrics added. +* [GameSoundManager] use the sound's fade in and out times instead of the + hardcoded fade in (1.5sec) and out (0.3sec) times. + +20100101 +-------- +* [GrooveRadar] run commands on RadarValueMapP* so we can color it again +* [Song.cpp] Make AutoGen on Pump a bit more bearable by only AutoGenerating + Medium difficulty for HalfDoubles steps. + +20091229 +-------- +* [GameState] new Lua bindings: JoinPlayer(pn), UnjoinPlayer(pn), and + GetSongPercent(fBeat) + +20091227 +-------- +* [ScreenSelectMusic] Allow un-selecting the song if two part selection is + enabled (press back). Only works if all human players have not chosen steps + yet. (If a player has chosen steps and the other wants to change the song, + the other player has to cancel his step selection.) +* [NoteSkinManager] New Lua binding NOTESKIN:DoesNoteSkinExist(sName) for + finding if the specified noteskin exists in the current gametype. + +20091226 +-------- +* New Lua binding: NOTESKIN:GetNoteSkinNames(), which returns a table of all + noteskins for the current gametype. + +20091225 +-------- +* New Lua bindings for Profile: GetTotalSessions(), GetTotalSessionSeconds(), + GetTotalGameplaySeconds() + +20091221 +-------- +* Support "converge" as an alias for "centered" since some courses use it. + +20091220 +-------- +* [EditMenu] new metric TextBannerType +* Fixed issue 38 (Servers line in ScreenNetworkOptions) + +20091219 +-------- +* Make it possible to change the alpha of the center of the groove radar [shakesoda] +* [ScreenSelectMusic] make profile load with late join on. [AJ] +* Fix OS hotkey issues by invalidating input on ScreenEdit while meta keys + (cmd or winkey) are being held. [shakesoda] + +================================================================================ +sm-ssc Private Beta Wave 1.2 | 20091219 +-------------------------------------------------------------------------------- +Theme-related additions/bugfixes aren't listed here, usually. + +20091218 +-------- +* Fix bug in GAMESTATE:GetCurrentSteps(pn) where it didn't bother trying to + return the player's actual steps before trying to do: + (1) SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->m_PreferredDifficulty[pn] ); + (2) SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->GetClosestShownDifficulty(pn) ); + And with AutoSetStyle on, how the hell is it going to know the style with + those two SongUtil things in the way? By moving the player's steps to the + top, that fixes the problem. -aj + +20091217 +-------- +* Make DeviceList on ScreenTestInput metricable + (commands only, X and Y are elusive for some reason.) + +20091215 +-------- +* Fix option underlines diffusing color when they should just be diffusing alpha. +* [ScreenOptions] new Lua binding: AllAreOnLastRow() +* [ScreenSelectMaster] add DoSwitchAnyways [shakesoda] + +20091214 +-------- +* new Course Lua bindings: IsNonstop(), IsOni(), HasBanner() + +20091213 +-------- +* Support Pump it Up Exceed PS2 USB mat [galopin] + (see stepmania-devs mailing list 20091213 11:27 -0800 [Pacific Standard Time]) + +20091212 +-------- +* (smpackage) sm4svn r28243: "fix for FlushDirCache" [Chris Danford] +* Fix Beginner Helper rest location [sy567] + (see http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12) + +20091211 +-------- +Cel shader update [shakesoda] + +20091209 +-------- +[StepsDisplay] StepsType is an AutoActor now (was Sprite) + +================================================================================ +sm-ssc Private Beta Wave 1.1 | 20091208 +-------------------------------------------------------------------------------- +Theme-related bugfixes aren't listed here, usually. +See the sm-ssc bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ for more +information on bugs, feature requests, and the status of both. + +In addition to the bugfixes, the following changes have been made: + +20091208 +-------- +Refresh the metrics when changing the gametype. Fixes an issue where changing +the gametype causes the DifficultyList/StepsDisplayList to not show anything. + +20091207 +-------- +* [Character.cpp] fix GetModelPath() Lua binding. +* [Sprite.cpp] add GetState() and GetNumStates() Lua bindings. + +20091206 +-------- +Implement a patch to support modern versions of ffmpeg. +(See http://www.stepmania.com/forums/showthread.php?t=21434 for more info.) + +Petr Baudis (3): + video.m4: Add libswscale checks. + MovieTexture_FFMpeg: Port img_convert to libswscale method. + MovieTexture_Theora: Port img_convert to libswscale method. + +David Santamaría Rogado (howl) (12): + video.m4: Simplify FFMpeg checks. + ArchHooks_Unix: Correct ffmpeg include. + MovieTexture_FFMpeg: Add and correct ffmpeg necessary includes. + MovieTexture_FFMpeg: Replace avcodec_build() with avcodec_version(), avcodec_build() now doesn't exists and avcodec_version() has always return the same value of avcodec_build(). + MovieTexture_FFMpeg: Replace avcodec::offset_t type with int64_t type to complain the new FFMpeg API . + MovieTexture_FFMpeg: Corrected seek component of RageProtocol to complain the new FFMpeg, if not videos with malformed headers fails to play. + MovieTexture_FFMpeg: Fix compilation warning of RageProtocol. + MovieTexture_FFMpeg: Add destruction conditions for swscale context to avoid possible crashes. + MovieTexture_FFMpeg: Add initialization conditions for swscale context to avoid possible unused memory if there is no garbage collector and improve performance. + MovieTexture_Theora: Add and correct ffmpeg necessary includes. + MovieTexture_Theora: Add destruction conditions for swscale context to avoid possible crashes. + MovieTexture_Theora: Add initialization conditions for swscale context to avoid possible unused memory if there is no garbage collector and improve performance. + +20091205 +-------- +* [Player.cpp/.h] new metric: ComboUnderField. It should be true by default if + you want to match how StepMania 4 does it. [AJ] + +20091204 +-------- +* Fix a sm-ssc bug where you couldn't change course difficulties. + +20091203 +-------- +* Two new GameCommands: + * fademusic,fVolume,fDuration (though I wish fDuration was how long to fade the + music for; instead the fade lengths are consts in GameSoundManager.) + * pushscreen,sScreenName (though it doesn't push screens like I had thought it + would. maybe I'm doing it wrong.) [AJ] + +20091202 +-------- +* Profile name max length changed from 12 to 32 characters. [AJ] +* Modified character camera values. [shakesoda] + +20091201 +-------- +* [ScreenSelectMusic] new metric SamplePreviewMusicMode, which has one of two + possible values as of r127. 'SamplePreviewMusicMode_Normal' is business as + usual (sample music plays), while 'SampleMusicPreviewMode_ScreenMusic' + disables song samples, using /{theme}/Sounds/ScreenSelectMusic loop music.* + as the file to play. No, this doesn't support Lua music yet. [AJ] + +================================================================================ +sm-ssc Private Beta Wave 1 | 20091201 +-------------------------------------------------------------------------------- +The list below comprises sm-ssc Private Beta Wave 1's changes. Some of the +changes are from baseline StepMania 4 SVN, in order to keep compatibility. + +20091130 +-------- +* [StepMania.cpp] (any)Shift+F2 = reload metrics only. + F2 = reload metrics and textures. +* [Course.cpp] GetPlayMode() and GetCourseType() return actual enums now, + instead of numbers. +* Add improved cel shading for people with GLSL support. [shakesoda] + +20091129 +-------- +* [TimingData] add GetActualBPM() Lua binding that returns a table holding the + min and max BPMs, in that order. + +20091127 +-------- +* Disable color keying banners (it's 2009, I don't think anyone is using the + old rotated banners anymore. -aj) [shakesoda] +* Add OptionsListTimeout metric. [shakesoda] + +20091126 (SSC turkey day) +------------------------- +* [Song] new Lua bindings: NormallyDisplayed(), GetStepsSeconds() +* Themes will load Lua scripts from subdirectories first now. + +20091122 +-------- +* [ArchHooks_Unix] Follow user's system language as default. + [David Santamaría Rogado (howl)] + See http://www.stepmania.com/forums/showthread.php?t=21471 for more info. + +20091120 +-------- +* Fixed a crash with lifemultipliers > 1.0 in debug builds + +20091117 +-------- +* F2 reloads metrics again, just like in StepMania 3.9. (This is probably one + of those changes that won't get backported to baseline StepMania...) +* [ScoreKeeperNormal] version 0.5 of ToastyTriggersAt added; only allows for + one value, unlike 3.9+ (which used a String with multiple values). The final + version will use a Lua table, similar to [MusicWheel] SortOrders. + +20091116 +-------- +* [Character] new Lua bindings: GetModelPath(), GetRestAnimationPath(), + GetWarmUpAnimationPath(), GetDanceAnimationPath() +* [CharacterManager] GetRandomCharacter() Lua binding added +* [RageFileManager] GetDirListing(sPath,bOnlyDirs,bPathToo) Lua binding added +* [CharacterManager] GetAllCharacters() Lua binding added. + +20091115 +-------- +* Prevent focus lost at Fullscreen on X11, fix windowed->fullscreen resolution + changes so that they save [David Santamaría Rogado (howl)] + (http://www.stepmania.com/forums/showthread.php?t=21430) + +20091114 +-------- +* Add support for .oga and .ogv files. [David Santamaría Rogado (howl)] + (http://pastie.org/698741) + +20091113 +-------- +* sm4svn r28233 [Glenn Maynard]: + "Fix ThemeMetric gives the first value of the enum when the theme + metric is nil, instead of EnumType_INVALID. + This happened because ThemeMetric was setting the value to its default, + eg. EnumType(), when LuaHelpers::FromStack returned false. + This behavior doesn't make sense in the general case, since EnumType() results + in an arbitrary value (the first one) rather than Invalid. Every FromStack + function sets a reasonable default on invalid data, anyway, and only RageColor + and enums can return false in any case. + This fixes CustomDifficulty when CourseType = nil." + +* Fix a crash in StepsDisplay that allows Course mode to at least run. + +20091111 +-------- +* MusicWheelItem SetMessage has a new param, Type (string that returns the + item type). +* Add sort songs by most recently played. (not feature-complete yet.) + +20091103 to 20091109 +-------------------- +* Changes from SM4SVN: + * r28211: [HighScore.cpp] "logic fixup" [Glenn Maynard] + * r28215: "default to showing backgrounds in editor" [Chris Danford] + * r28217: "Fix crash on reload metrics due to faulty FlushDirCache logic." + [Steve Checkoway], implemented along with code that was originally submitted + as r076 but removed. See this fix log to figure out why we'd bother. :) + * r28218: "crash handler is crashing in 2.6.31 in GetBacktrace, causing a + recursive crash handler crash that we aren't handling, leading to recursion" + [Glenn Maynard] + * r28219: "add 'DIRRO' driver for read-only access" [Glenn Maynard] + * r28220: "fix confusing comment. Escaping doesn't affect this; commas aren't + escaped, since they're split from the value itself, long after MsdFile is + loaded." [Glenn Maynard] (We'll be keeping the 1,1,1,1 colors in sm-ssc, and + may provide a compatibility script for SM4SVN, so be on the lookout.) + * r28221: "allow overriding, like PRODUCT_ID" [Glenn Maynard] + * r28222-28223: "adding support for pms files" [GRIM657] + * The pulseaudio patch [David Santamaría Rogado (howl), Ondřej Hošek, Damien Thébault] + (see http://www.stepmania.com/forums/showthread.php?t=21348) + * Greg Nadja's OpenGL/Windows patch + * Load Splash.png instead of an .xpm [David Santamaría Rogado (howl)] + (http://www.stepmania.com/forums/showpost.php?p=157340&postcount=3) + +* sm-ssc Changes: + * [ScreenSelectMusic.cpp] Add SelectMenuInputMessage, has params Player and + Button. Broadcast messages when holding select and a button other than Select + is pushed. + * Windowed mode is now the default display mode. + * [HighScore.cpp] new Lua bindings: + * GetModifiers() + * GetTapNoteScore(TapNoteScore) + * GetHoldNoteScore(HoldNoteScore) + * GetRadarValues() + * [ProfileManager.cpp] added IsSongNew(Song) Lua binding + +r088 | 20091101 12:19:47 +------------------------ +* SM4SVN r28203-28208, all by Glenn Maynard. + * r28203: "skip exporting round data when nothing was played (no taps, no holds)" + * r28204: "fix signatures not being written" (we had this already) + * r28205: "don't fail if there's no course; just hide" + * r28206: "move course rename and delete into Overview" + * r28208: "disable rename and delete for courses that havn't been saved yet" +r28207 was a theme edit. + +20091029 +-------- +sm4svn r28202: helper for cycling through an enum [Glenn Maynard] + +20091028 +-------- +sm4svn r28201: "refactor RageInput to not call GetDevicesAndDescriptions +constantly; it can be slightly complex and get called thousands of +times a second" [Glenn Maynard] + +20091027 +-------- +* SM4SVN r28198-28200 + * r28198: Fix GetFileSizeInBytes to return an int instead of unsigned. + "this returns -1 on error (this should actually be 64-bit, + but that's a bigger change)" [Glenn Maynard] + * r28199: The official log is as follows: + "Hack to get the decorations to be deleted. Fixes crashes, + but probably not the best way to go about this." + [Steve Checkoway] + * r28200: The official log is as follows: + "Do not use an AutoActor to keep track of the children." + However, this also fixes the hack in r28199. [Steve Checkoway] + +* Allow for Codes on ScreenGameplay. [shakesoda] + +* New Lua bindings for ScreenGameplay: + * PauseGame(bool) - Pauses/unpauses the game. + * IsPaused() - returns true or false depending on if the game is paused or not. + +20091015 +-------- +* Support loading Lua scripts from subdirectories of the Scripts folder, + to allow for better organization. The scripts in the root Scripts folder + will run first, then any Lua scripts in subdirectories of the Scripts folder + will be run. It currently only works with one folder depth, for example: + Scripts/subfolder/script.lua. + + This is not likely to be changed. If you can see a possible need for paths + like Scripts/subfolder/subfolder2/script.lua, please make a Feature Request + ticket on the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ with + an explanation of what you have in mind. + +20091012 +-------- +* Change BitmapText defaults to no stroke + no shadow. +* Added DefaultTheme preference in order to fix crashes. + (sm-ssc's fallback theme is _fallback [and therefore normally unselectable].) + +20091005 +-------- +* [NotesLoaderSM.cpp] Changes based on SM4SVN r28197 [Archer] + +20091002 +-------- +* Event Mode turned on by default, as it should be. :) + (sm-ssc is a home mode-based version of StepMania.) + +20090925 +-------- +* SM4SVN r28192-28196. + * r28192: HexToBinary for RString -> RString. [Glenn Maynard] + * r28193: show all songs in EditCourse, not just preferred songs [Chris Danford] + * r28194: [ScreenDebugOverlay] Glenn made this themeable in SM4SVN, finally + catching up. This means we've had to rename a few things: + * DebugMenuHeader -> HeaderText + * PageName -> PageText + ButtonText and FunctionText were added, as well. + The font names remain the same, only the metrics change. + (Can you believe they're still using Common normal as the font?) + * r28195,28196: fix ComboChanged message sent when m_bSendJudgmentAndComboMessages + is false, fix doing unnecessary work in multiplayer [Glenn Maynard] + +20090920 +-------- +* [StepsDisplay] Fixed it so it actually shows up again. + +20090919 +-------- +Happy talk like k//eternal day! +* [Font.cpp] Don't show strokes by default. +* [NoteDisplay] fRotation -> fRotationZ in anticipation of multiple rotation mods. +* [PaneDisplay] changed one thing that used a goto; doesn't use it anymore. seems to work for me, though I'm not 100% sure. +* [ThemeManager] don't reload Lua scripts when you reload the metrics. + This is a temporary fix, and may be deemed safe at some point in the future. + +20090914 +-------- +(SM4SVN r28189) + +* SM4SVN r28190,28191 (25 files worth). This was later reverted, as it caused +reloading the metrics to crash. Since sm-ssc is primarily for themers, this is a +dealbreaker. A lot of things were unofficially added to sm-ssc at this point: + +* [ActorFrame] Added RemoveAllChildren() and RemoveChild(sName) bindings. + These are not guaranteed to work. Don't use them. They are very dangerous. +* [IniFile] added Lua's '--' syntax for commenting (along with '//' and '#', + which were already supported). +* New blend modes Modulate (subject to renaming later) and AlphaMultiply. +* [RageUtil] Added various bindings for formatting time that were already built + into StepMania: SecondsToHHMMSS, SecondsToMMSSMsMs, SecondsToMMSSMsMsMs, + SecondsToMSS, SecondsToMMSS. All bindings take in a float (number of seconds). +* [RageUtil] Added IsHexVal(string) binding. +* Added groups to sort length (based on BPM ranges), so the songs no longer + show up without groups. + +20090913 +-------- +(SM4SVN r28180-28185) + +20090913 +-------- +* Added WeightedMultiply and InvertDest blend modes to Direct3D. + +20090912 +-------- +* Change decorations draw order so it breaks things less. + +20090911 +-------- +* "hidden" removed from Actor commands. It was deprecated. + A compatibility alias was added to replicate its functionality. However, this + will not work with NoteSkins, so be sure to make sure to check them for the + use of hidden. + + Handy replacement guide: + hidden,true / hidden,1 = visible,false + hidden,false / hidden,0 = visible,true + +20090907 +-------- +* Add Sprite:CropTo() function + Lua binding. + +20090906 +-------- +* Base theme changed from "default" to "_fallback". + As a result, all themes will fallback on _fallback instead of default. + +20090905 +-------- +* add URLEncode Lua binding to RageUtil. +* [ScreenWithMenuElements.cpp, ThemeManager.cpp] Load and parse Lua as music. + This makes conditional music possible. + +20090904 +-------- +* Change many things on ScreenEdit to go 5 decimal places instead of 3. +* Beginnings of Xbox controller mappings for edit mode (currently untested) + +20090903 +-------- +* Binding naming format changed for BPM bindings. Always uses all caps BPM. + Changes in the codebase due to this: + * [Song] HasSignificantBpmChangesOrStops -> HasSignificantBPMChangesOrStops + * [TimingData] HasBpmChanges -> HasBPMChanges +* [TimingData] New bindings. (GetStops, GetBPMsAndTimes) +* [ScreenPackages] attempt to not call MoveLeft by duplicating code. + Seemed to work okay. + +20090831 +-------- +* ScreenPackages changes: + * Backgrounds from Sprites to AutoActors (Lua can be used now). + * DefaultUrl metric added. +* [ActorScroller] Make naming of commands consistent (some were all lowercase, + some were CamelCase), all are now CamelCase. + +20090828 +-------- +* Added ScreenGameplay:GetPlayerInfo(PlayerNumber) Lua binding + +20090827 +-------- +* Added LifeChanged message to LifeMeterBattery, meaning certain hackily-coded + custom life meters by a certain SSC member can work in Oni mode again. ;) +* MAX_EDIT_STEPS_SIZE_BYTES changed from 30KB to 60KB. +* Added --theme= and --language= command line options. + +20090826 +-------- +* SSE2 build configuration added to Visual Studio 2008 project file. +* new Lua bindings for WheelBase: IsSettled(), IsLocked() + +20090822 +-------- +* Add Beginner meter sort. +* [CommandLineActions] Implement --version command line argument. + Prints out the version of sm-ssc. Please build sm-ssc with HAVE_VERSION_TIME + if possible for compatibility with all possible sm-ssc themes. + +20090821 +-------- +(SM4SVN r28172-28174) + +20090810 +-------- +* [GameCommand.cpp] add GetUrl() Lua binding. +* [GameManager.cpp] add IsGameEnabled(Game) Lua binding. +* [GrooveRadar] name m_GrooveRadarValueMap "RadarValueMap(P1/P2)" + (commands untested); new todo note in header file +* [ScoreDisplayOni.cpp] give it a name ("ScoreDisplayOni Numbers") and run + commands. (untested) +* removing player color diffuse commands, in the hopes this can be replicated + using Lua commands. + [GrooveRadar.cpp, ScoreDisplayLifeTime.cpp, ScreenSelectMusic.cpp] + +20090810 +-------- +(SM4SVN r28170: vdl's fixes for Xbox building; he says they should be tested.) + +20090815 +-------- +* add THEME:GetPathO() Lua binding + +20090810 +-------- +(SM4SVN r28140-r28166; code changes only) + +20090808 +-------- +(SM4SVN r28135, r28137, r28138) +* Lossless screenshots now save as PNG. +* Conversion of decorations to not be children of the screen; they load in + a similar fashion to overlay/underlay, but still using LoadB so everything + works correctly. (Tested against SM4 default theme for compatibility.) + +20090729 +-------- +* add GetRotationX, GetRotationZ commands to Actor +* add urlnoexit game command, which won't exit upon loading the browser. +* add OldHealthState to HealthStateChanged message on ScreenGameplay + +20090726 +-------- +* (untested) GrooveRadar plays commands on the frame now, allowing for +customized in and out transitions, using TweenOnScreen/TweenOffScreen Commands. +* add PlayerController enum binding +* add PlayerState:GetPlayerController() [untested] + +20090725 +-------- +ScreenDebugOverlay changes: +* add OnCommand, X, Y to Debug Header +* add GainFocus/LoseFocus commands to page names +* add LineOnColor/LineOffColor + +20090724 +-------- +* Add StartRoulette and StartRandom messages to MusicWheel. +* Fix default stroke color and shadow length. (BitmapText) + +20090719 +-------- +* patch by theDtTvB: http://share11.appspot.com/20421 + (some parts relating to Player.cpp were later reverted; will be reimplemented) +* Add SetPref to GameCommands. + +20090718 +-------- +* New ThemeManager Lua bindings: + * GetCurrentThemeDirectory + * ReloadMetrics +* Added more internal font mappings: auxc, auxd, auxz, auxwhite, auxblack, + auxlb, auxrb, auxlt, auxrt +* Add conf,PercentageScoring. + +20090712 +-------- +* ActorScroller: add GetNumItems binding. +* ThemeManager: add bindings for GetThemeDisplayName() and + GetThemeDisplayAuthor() (for the current theme only). + +20090711 +-------- +* Fixes songs with only Edit steps from crashing. +* Lights fix from ??? +* Add GAMESTATE:IsBattleMode() binding. + +20090708 +-------- +* (sync with SM4SVN: LightsManager.cpp, ScreenGameplay.cpp) + +20090707 +-------- +* Add GetProfileDir() binding to ProfileManager. +* Added ProfileSlotNames enum. +* Add broadcasted message "SongChosen" on ScreenSelectMusic. + +20090626 +-------- +* Allow meters to go up to 20 in Edit Mode. + +20090623 +-------- +* Added io, os, and packages to Lua bindings. They are disabled for now. +* Fix instance in ScreenSelectMaster where hitting Up wouldn't count as going + backwards. + +20090617 +-------- +* Add Overlay shader. [AJ] + +20090615 +-------- +(sync with SM4SVN) + +More Lua bindings: +* PlayerStageStats:FullComboOfScore(tns) + +* RageFileManager is now accessible through FILEMAN with these bindings: + * FILEMAN:DoesFileExist(path) + * FILEMAN:GetHashForFile(path) + +* Add bindings to Song: + * GetSongFilePath + * GetMusicPath + * GetCDTitlePath + * GetLyricsPath + * IsEnabled + * HasStepsType + * HasMusic + * HasBanner + * HasBackground + * HasCDTitle + * HasBGChanges + * HasLyrics + * GetBPMAtBeat + * GetBeatFromElapsedTime + * GetElapsedTimeFromBeat + * HasSignificantBpmChangesOrStops + * HasEdits + * IsEasy + +* Add bindings to Steps: + * IsAnEdit + * IsAPlayerEdit + * GetHash + * disabled stub for GetSMNoteData (untested) + +20090612 +-------- +* Work-in-progress bindings for ActorSound: + * pause + * stop +* Work-in-progress bindings for RageSound: + * volume + * SetStopMode + +20090529 +-------- +(sync with SM4SVN: Archer adding 5:4 support) + +20090527 +-------- +Add three new Lua bindings to RageFile: +* GetError +* ClearError +* AtEOF + +20090525 +-------- +(sync with SM4SVN) +* [Actor.cpp] add GetDiffuse() Lua binding + +20090523 +-------- +* Add glowramp to Actor + +20090518 +-------- +* (changes from SM4SVN: Frieza and Wolfman [OnlyPreferredDifficulties]) + +20090517 +-------- +* New RageFile bindings: Seek, Tell +* Added more internal font mappings: auxa, auxb, auxy, auxl, auxr + +20090513 +-------- +ActorScroller changes: +* Can now actually set size of the mask with SetMask +* Add more Lua bindings: + * SetNumItemsToDraw + * GetFullScrollLengthSeconds + * GetCurrentItem + * GetDestinationItem + +20090509 +-------- +* Add skewy to valid Actor commands. + +20090505 +-------- +(SM4SVN: ComboMultiplier by Frieza in ScoreKeeperNormal + r28060, r28061) + +20090502 +-------- +(changes from SM4SVN: ScreenSelect* changes by Frieza) +* Make ScreenDebugOverlay use its own fonts, namely: + * ScreenDebugOverlay header + * ScreenDebugOverlay page + * ScreenDebugOverlay line +* Add GetServerName() binding to NetworkSyncManager. +* Add GetText() binding to BPMDisplay. +* add MD5 String/File and SHA1 String hashing via Lua: + * CRYPTMAN:MD5String(str) + * CRYPTMAN:MD5File(path) + * CRYPTMAN:SHA1String(str) +* Add more Lua bindings to PlayerStageStats: + * GetCurrentMissCombo + * GetCurrentPossibleDancePoints + * GetAliveSeconds +* Add GetThemeAuthor() to ThemeManager. +* Add bindings to Song: + * GetDisplaySubTitle + * GetTranslitSubTitle + +20090501 +-------- +(changes from SM4SVN: tons of changes by Frieza) + +20090425 +-------- +(changes from SM4SVN: GameManager.cpp, RollingNumbers.cpp) + +20090419 +-------- +* Make some crash explanations more detailed. Changed files include: + * Actor.cpp - PercentThroughEffect, PercentBetweenColors, DeltaTime + * Attack.cpp + * GameManager.cpp + * GameState.cpp + * InputFilter.cpp + * NoteData.cpp +* Add new Lua bindings to TimingData: HasBpmChanges, GetBpms, GetStops. + +20090418 +-------- +* Project begins. +* Remove ScreenEz2SelectPlayer, which only the Xbox project still referenced. +_____________________________________________________________________________ diff --git a/Docs/CommandLineArgs.txt b/Docs/CommandLineArgs.txt index cd59d529fd..da567dbfc6 100644 --- a/Docs/CommandLineArgs.txt +++ b/Docs/CommandLineArgs.txt @@ -1,55 +1,55 @@ -sm-ssc Command Line Arguments -================================================================================ -Pass all arguments with --. For example, version would be entered as --version. -stepmania --version - -Passing package files to StepMania on the command line will install them: -stepmania moonlight.smzip -================================================================================ -[GameState] -* player -usage: --player=1 -Joins in the specified player. Can also pass --player=2 at the same time, -if desired. However, sm-ssc does not support more than two players, so don't -go past 2. - -* mode -usage: --mode= -Applys a GameCommand to all players if valid. --------------------------------------------------------------------------------- -[NetworkSyncManager] -* netip -usage: --netip=localhost -Connects to a server for online play. --------------------------------------------------------------------------------- -[PrefsManager] -* Type -usage: --Type=arcade -Reads preferences from [Preferences-{Type}], usually from the metrics. --------------------------------------------------------------------------------- -[StepMania] -* ExportNsisStrings -usage: --ExportNsisStrings -Exports strings for the installer. - -* ExportLuaInformation -usage: --ExportLuaInformation -Exports Lua.xml using the default theme (and anything it falls back on) -for reference. - -* theme -usage: --theme=default | --theme="theme with spaces" -Sets the current theme. - -* language -usage: --language=en -Sets the current language. - -* version -usage: --version -Displays version information. --------------------------------------------------------------------------------- -[ThemeManager] -* metric -usage: --metric=(element)::(metric)=(value) +sm-ssc Command Line Arguments +================================================================================ +Pass all arguments with --. For example, version would be entered as --version. +stepmania --version + +Passing package files to StepMania on the command line will install them: +stepmania moonlight.smzip +================================================================================ +[GameState] +* player +usage: --player=1 +Joins in the specified player. Can also pass --player=2 at the same time, +if desired. However, sm-ssc does not support more than two players, so don't +go past 2. + +* mode +usage: --mode= +Applys a GameCommand to all players if valid. +-------------------------------------------------------------------------------- +[NetworkSyncManager] +* netip +usage: --netip=localhost +Connects to a server for online play. +-------------------------------------------------------------------------------- +[PrefsManager] +* Type +usage: --Type=arcade +Reads preferences from [Preferences-{Type}], usually from the metrics. +-------------------------------------------------------------------------------- +[StepMania] +* ExportNsisStrings +usage: --ExportNsisStrings +Exports strings for the installer. + +* ExportLuaInformation +usage: --ExportLuaInformation +Exports Lua.xml using the default theme (and anything it falls back on) +for reference. + +* theme +usage: --theme=default | --theme="theme with spaces" +Sets the current theme. + +* language +usage: --language=en +Sets the current language. + +* version +usage: --version +Displays version information. +-------------------------------------------------------------------------------- +[ThemeManager] +* metric +usage: --metric=(element)::(metric)=(value) Sets [Element] Metric=Value in the metrics. Can be used multiple times. \ No newline at end of file diff --git a/Docs/CustomMissionReference.txt b/Docs/CustomMissionReference.txt index c06003a17f..4f1f499ba5 100644 --- a/Docs/CustomMissionReference.txt +++ b/Docs/CustomMissionReference.txt @@ -1,36 +1,36 @@ -Mission Mode Specifications/Draft - --- #TITLE:; self explanitory -#TITLE:; --- #METER:; defines the meter that shows up in StepsDisplay's. -#METER:; --- #BANNER:; is a great thing to add because it makes sense in the long run. -#BANNER:; --- #STYLE:; restricts playmodes ala Pump Pro. -#STYLE:; --- #MISSIONREF:; is a complete LuaReference that has a params table passed --- into the function, and is required to pass either: --- A: A true / false parameter for MISSION CLEARED / FAILED --- B: A seperate grade tier for missions, complimenting the default grade - score. --- C: A replacement grade tier for missions, requesting an enum for - the grade to be set. -#MISSIONREF:; - -#SONG:; - ---[[ Example ]] -#TITLE:Test Mission; -#METER:9; -#BANNER:TestMission.png; -#STYLE:Single,Versus; -#MISSIONREF:function(self,params) - local tPlayerStats = params.PlayerStageStats; - - if tPlayerStats.GetTapNoteScores('TapNoteScore_W2') > 0 then - return 'Grade_Failed' - else - return 'Grade_Tier01' - end -end; -#SONG:In The Groove 2/Determinator:Medium:2x,Hidden; +Mission Mode Specifications/Draft + +-- #TITLE:; self explanitory +#TITLE:; +-- #METER:; defines the meter that shows up in StepsDisplay's. +#METER:; +-- #BANNER:; is a great thing to add because it makes sense in the long run. +#BANNER:; +-- #STYLE:; restricts playmodes ala Pump Pro. +#STYLE:; +-- #MISSIONREF:; is a complete LuaReference that has a params table passed +-- into the function, and is required to pass either: +-- A: A true / false parameter for MISSION CLEARED / FAILED +-- B: A seperate grade tier for missions, complimenting the default grade + score. +-- C: A replacement grade tier for missions, requesting an enum for + the grade to be set. +#MISSIONREF:; + +#SONG:; + +--[[ Example ]] +#TITLE:Test Mission; +#METER:9; +#BANNER:TestMission.png; +#STYLE:Single,Versus; +#MISSIONREF:function(self,params) + local tPlayerStats = params.PlayerStageStats; + + if tPlayerStats.GetTapNoteScores('TapNoteScore_W2') > 0 then + return 'Grade_Failed' + else + return 'Grade_Tier01' + end +end; +#SONG:In The Groove 2/Determinator:Medium:2x,Hidden; diff --git a/Docs/Devdocs/CodingStyle.txt b/Docs/Devdocs/CodingStyle.txt index 2c82b9bf4f..8888b85dae 100644 --- a/Docs/Devdocs/CodingStyle.txt +++ b/Docs/Devdocs/CodingStyle.txt @@ -1,84 +1,84 @@ -sm-ssc Code Style Guidelines --------------------------------------------------------------------------------- -AJ is biased, but prefers to edit text in SciTE and just uses Visual Studio when -necessary. "It's really slow!" - -That being said, the sm-ssc code style guidelines are as follows: - -1) Follow the current coding conventions set forth in the source code. -This means use tabs. AJ prefers tabs have a width of 4. Visual Studio and web -browsers assume tabs to be 8 by default. :/ -Use of the tab character means you can define however wide you want it to be. - -Use of the space character is allowed for complex alignment. There are many -examples of this in the code. - -If it can be done in one line, do so: -int xTwenty(int factor){ return factor*20; } - -Otherwise, follow what's in the code, namely... - -for single line ifs : -if( somecrap ) - dosomethingelse(); - -for multi-lines: -if( anothercrap ) -{ - omg(); - lotsofstuff(); -} - -Naming conventions seem to be Hungarian (of Apps or System, I do not know). - -2) Remove any unnecessary whitespace. "Unnecessary" whitespace includes tabs -at the end of } characters, tabs that lead nowhere, like this one: - -and keep in mind that this can be done with spaces too: - -so watch yourself. Remove 'em all. - -3) When making LOG->Trace()s in code, it's best to include the name of the Class -and Function in [], like so: -LOG->Info( "[NetworkSyncManager::Listen] Initializing socket..." ); -You may not always need to do this, but it helps for clarity and sanity. - -4) Comment style. (This is a preferred suggestion. You may choose to do whatever -you like, but it is recommended to follow this style when submitting code for -inclusion.) -// is preferred for one-liners -// and also blocks of text where the comment isn't too long. -// sometimes you'll find // comments longer than this thrown in there by AJ -/* instead of doing this. - * when making a new line in a long form comment, start like this line. - * and put the end where it fits. */ - -/* - * doing this (first line blank) is discouraged, but is allowed in certain places. - * Copyright notices use this style and should remain doing so; don't clean it up - * in that instance. All new copyright notices should follow this style as well, - * for consistency's sake. - */ - -/* use of long comments for one line is VERY discouraged */ -// usually, it will will get cleaned up into this style, but there are exceptions: - -// exception #1: function arguments -void SomeFunction(size_t /*ACTUAL DATA TYPE*/) -// where you need to have it be /* */ or else it'll mess up. - -// exception #2: #defines -#define /* you must use long form in defines, */ \ - // otherwise it won't parse the newline correctly (this will cause an error) \ - -// exception #3: .h files -/* ScreenTypicalExample - this always shows up like this. It usually is always one line, even when it extends past column 80. This is acceptible; Most people don't write novels here like I just did. */ - -// on comment length: -/* typically total 80 characters is the preferred width per line, like this one. - * Sometimes, you can get away with sentences where a word or phrase hangs over the edge, - * especially if you can guess the context without needing to scroll. - * Pre-existing comments are usually trimmed to meet the 80-column width if they - * go way overboard. */ - +sm-ssc Code Style Guidelines +-------------------------------------------------------------------------------- +AJ is biased, but prefers to edit text in SciTE and just uses Visual Studio when +necessary. "It's really slow!" + +That being said, the sm-ssc code style guidelines are as follows: + +1) Follow the current coding conventions set forth in the source code. +This means use tabs. AJ prefers tabs have a width of 4. Visual Studio and web +browsers assume tabs to be 8 by default. :/ +Use of the tab character means you can define however wide you want it to be. + +Use of the space character is allowed for complex alignment. There are many +examples of this in the code. + +If it can be done in one line, do so: +int xTwenty(int factor){ return factor*20; } + +Otherwise, follow what's in the code, namely... + +for single line ifs : +if( somecrap ) + dosomethingelse(); + +for multi-lines: +if( anothercrap ) +{ + omg(); + lotsofstuff(); +} + +Naming conventions seem to be Hungarian (of Apps or System, I do not know). + +2) Remove any unnecessary whitespace. "Unnecessary" whitespace includes tabs +at the end of } characters, tabs that lead nowhere, like this one: + +and keep in mind that this can be done with spaces too: + +so watch yourself. Remove 'em all. + +3) When making LOG->Trace()s in code, it's best to include the name of the Class +and Function in [], like so: +LOG->Info( "[NetworkSyncManager::Listen] Initializing socket..." ); +You may not always need to do this, but it helps for clarity and sanity. + +4) Comment style. (This is a preferred suggestion. You may choose to do whatever +you like, but it is recommended to follow this style when submitting code for +inclusion.) +// is preferred for one-liners +// and also blocks of text where the comment isn't too long. +// sometimes you'll find // comments longer than this thrown in there by AJ +/* instead of doing this. + * when making a new line in a long form comment, start like this line. + * and put the end where it fits. */ + +/* + * doing this (first line blank) is discouraged, but is allowed in certain places. + * Copyright notices use this style and should remain doing so; don't clean it up + * in that instance. All new copyright notices should follow this style as well, + * for consistency's sake. + */ + +/* use of long comments for one line is VERY discouraged */ +// usually, it will will get cleaned up into this style, but there are exceptions: + +// exception #1: function arguments +void SomeFunction(size_t /*ACTUAL DATA TYPE*/) +// where you need to have it be /* */ or else it'll mess up. + +// exception #2: #defines +#define /* you must use long form in defines, */ \ + // otherwise it won't parse the newline correctly (this will cause an error) \ + +// exception #3: .h files +/* ScreenTypicalExample - this always shows up like this. It usually is always one line, even when it extends past column 80. This is acceptible; Most people don't write novels here like I just did. */ + +// on comment length: +/* typically total 80 characters is the preferred width per line, like this one. + * Sometimes, you can get away with sentences where a word or phrase hangs over the edge, + * especially if you can guess the context without needing to scroll. + * Pre-existing comments are usually trimmed to meet the 80-column width if they + * go way overboard. */ + 5) There are no other rules (yet). \ No newline at end of file diff --git a/Docs/Devdocs/CompileFlags.txt b/Docs/Devdocs/CompileFlags.txt index 63679968e3..769606ca45 100644 --- a/Docs/Devdocs/CompileFlags.txt +++ b/Docs/Devdocs/CompileFlags.txt @@ -1,17 +1,17 @@ -sm-ssc has a few compile flags that are helpful to know, as well as ones -inherited from StepMania. -================================================================================ -stepmania: -================================================================================ -WITHOUT_NETWORKING -Disables all networking stuff (SMO). -================================================================================ -sm-ssc: -================================================================================ -SSC_FUTURES -{todo} --------------------------------------------------------------------------------- -HAVE_VERSION_INFO -If this isn't defined, passing in --version will only show the name of the -current sm-ssc version, no build number or date. +sm-ssc has a few compile flags that are helpful to know, as well as ones +inherited from StepMania. +================================================================================ +stepmania: +================================================================================ +WITHOUT_NETWORKING +Disables all networking stuff (SMO). +================================================================================ +sm-ssc: +================================================================================ +SSC_FUTURES +{todo} +-------------------------------------------------------------------------------- +HAVE_VERSION_INFO +If this isn't defined, passing in --version will only show the name of the +current sm-ssc version, no build number or date. Please define HAVE_VERSION_INFO if you can when building sm-ssc. \ No newline at end of file diff --git a/Docs/Devdocs/GoldenRules.txt b/Docs/Devdocs/GoldenRules.txt index ff49f87578..3a6543ae3b 100644 --- a/Docs/Devdocs/GoldenRules.txt +++ b/Docs/Devdocs/GoldenRules.txt @@ -1,23 +1,23 @@ -The Golden Rules of sm-ssc Development --------------------------------------------------------------------------------- -In addition to CodingStyle.txt, this is the doctrine for operation of sm-ssc. - -1) Always remember that the original branch of StepMania exists, and that we need -to give back to it in order for sm-ssc to survive. -(Literal: Be sure to commit useful changes/fixes to the mainline StepMania branch -every so often.) - -2) If you want something done, you should probably work on it yourself. However, -SSC members should be willing to help if their area of expertise and the problem -domain overlap (life permitting). - -3) Always know your priorities. sm-ssc is important, but it's not life itself. -Take breaks every once in a while. Work on other things. Don't get burned out -from nonstop sm-ssc development. - -4) Patches should be checked for compatibility/compilability before being -accepted and integrated. Common sense, but a golden rule nevertheless. - -5) Anyone who decides to theme for sm-ssc during development is willing to -accept that occasionally, changes to the default and/or fallback theme will +The Golden Rules of sm-ssc Development +-------------------------------------------------------------------------------- +In addition to CodingStyle.txt, this is the doctrine for operation of sm-ssc. + +1) Always remember that the original branch of StepMania exists, and that we need +to give back to it in order for sm-ssc to survive. +(Literal: Be sure to commit useful changes/fixes to the mainline StepMania branch +every so often.) + +2) If you want something done, you should probably work on it yourself. However, +SSC members should be willing to help if their area of expertise and the problem +domain overlap (life permitting). + +3) Always know your priorities. sm-ssc is important, but it's not life itself. +Take breaks every once in a while. Work on other things. Don't get burned out +from nonstop sm-ssc development. + +4) Patches should be checked for compatibility/compilability before being +accepted and integrated. Common sense, but a golden rule nevertheless. + +5) Anyone who decides to theme for sm-ssc during development is willing to +accept that occasionally, changes to the default and/or fallback theme will break things. \ No newline at end of file diff --git a/Docs/Devdocs/SMLanProtocol.txt b/Docs/Devdocs/SMLanProtocol.txt index bea1378782..97ecf87943 100644 --- a/Docs/Devdocs/SMLanProtocol.txt +++ b/Docs/Devdocs/SMLanProtocol.txt @@ -1,466 +1,466 @@ - -PRELIMINARY - - - - - - - - 05/03/2004 -Protocol version 4 - But 0x04 will be its version for inter-protocol purposes. - -This protocol is only intended to replace current protocol. Because current protocol -not expanable - -SMLAN PROTCOL TCP/8765 - -Protcol is entirelly packaged in EzSockets Data Packets (use send and receive packet) - -This will prevent any out-of-sync errors with future or past versions. - -The protocol is impervious to fragmented, or bonded TCP packets. - -Basic Representation: - -Octet 0123 4 5 - +----+-+---//--+ - |ssss|C|Payload| - +----+-+---//--+ - -ssss - size of packet, handled by ezsockets (if you're using C++) -C - Command. -Payload - variable size based on command - -The payload may contain more data than expected, i.e. new protocol version. - - -In the following protocol, the term size means the size of the chunk of data. -If the "size" is "NT" then that means it's a null-terminating string. - "MSN" most significant 4 bits (byte/16) - "LSN" least significant 4 bits (byte%16) - - -Note: Primary player is 0x0, secondary player is 0x1 - -CLIENT to SERVER protocol: - -000: No Operation - Desc: This command will cause server to respond with a no op response. - Payload: None - Response: Server 001 - -001: No Operation Response - Desc: This command is used to respond to a no operation. - Payload: None - Response: None - -002: Hello - Desc: This is the first packet from a client to server, stating below - information (NOTE: Names are no longer sent in this packet) - Payload: - Size Description: - 1 Client protocol version - NT Name of build of StepMania - Response: Server 002 - - - -003: Game Start Request - Desc: This command is called once after most loading is done, and - again immediately before the sound starts. - Payload: - Size Description - MSN Primary player difficulty (feet) (0 for no player) - LSN Secondary player difficulty (feet) (0 for no player) - MSN Primary player difficulty (0=Beginner, 1=easy, etc.) - LSN Second player difficulty (0=Beginner, 1=easy, etc.) - MSN Start Position (0 is pre-sync, 1 is for sync) - LSN Reserved - NT Song Title - NT Song Subtitle - NT Song Artist - NT Course Title (If none exists; make it just a null) - NT Song Options (in string-format) - NT Primary Player's options (Null if non-existant) - NT Secondary Player's Options (Null if non-existant) - - Response: Server 003 - - -004: Game Over Notice - Desc: This command is sent when end of game is encounterd - Payload: None. - Response: None. - -005: Game Status update - Desc: Updates game info for each step - Payload: - Size Description - MSN Player # -Protocol <= 2 - LSN StepID - 1: Miss - 2: W5 - 3: W4 - 4: W3 - 5: W2 - 6: W1 - 7: LetGo - 8: Held -Protocol >= 3 - LSN StepID - 1: HitMine - 2: AvoidMine - 3: Miss - 4: W5 - 5: W4 - 6: W3 - 7: W2 - 8: W1 - 9: LetGo - 10: Held - - MSN Projected Grade (StepMania enum int) - LSN Reserved - 4 Net-order long containing score. - 2 Net-order int containing combo. - 2 Net-order int containing health. - 2 Net-order # containing offset - 32767 would be DEAD on the note - If the user is hitting late, the # will be higher - It if the user is exactly 0.25 seconds off, the - number will be different by 500, if 0.5, it will be - different by 1000. - Response: None. - -006: Style Update (PLEASE NOTE THIS HAS NOTHING TO DO WITH SERVER COMMAND 6) - Desc: This is sent when a style is chosen. - Size: - 1 # of enabled players (1 means 1, 2 means 2) - 1 Player # (0 means 1st, 1 means 2nd) - NT Player Name for # - (Additional player's and #'s) (enabled players ONLY) - - Response: None - -007: Chat message - Desc: The user typed a message for general chat. - Size: - NT Message - -008: Request Start Game and Tell server existance/non existance of song. - Desc: The user selected a song on a Net-enabled selection - Size: - 1 Usage of message - 0: (in response to server 8) User has specified song - 1: (in response to server 8) User does NOT have specified song - 2: User requested a start game on given song - NT Song Title (As gotten by GetTranslitMainTitle) - NT Song Artist (As Gotten by GetTranslitArtist) - NT Song Subtitle (As gotten by GetTranslitSubTitle) - -009: //Reserved - -010: User entered/exited Network Music Selection Screen - Size: - 1 - 0: exited ScreenNetSelectMusic - 1: entered ScreenNetSelectMusic - 2: **Not Sent** - 3: entered options screen - 4: exited the evaluation screen - 5: entered evaluation screen - 6: exited ScreenNetRoom - 7: entered ScreenNetRoom - -011: User has changed player options - Size: - NT Player 0's options - NT Player 1's options - - -012: SMOnline Packet. //SPECIAL CASE!!! - NOTE: The smonline packet is not defined here. - The SMLan packet 12 is a wrapper for the SMOnline packet. - This is so that we can have "protection" of sorts when - it comes to the coding of SMOnline, so we don't have to - use the lower level commands when dealing with SMOnline. - Size: - 1 SMOnline command //This used to say 2, but it looks like 1 in all cases - SMOnline data - - -013: Reserved - -014: Reserved - -015: XML Packet. This packet contains data in XML format. - Size: - NT XML - -SERVER to CLIENT protocol: (begins at 128) - -NOTE: Server responses always add 128, thus a server response for no operation - is 128, not 000 - -000(128):No Operation - Desc: This command will cause server to respond with a no op response. - Payload: None - Response: Server 001 - -001(129):No Operation Response - Desc: This command is used to respond to a no operation. - Payload: None - Response: None - -002(130):Server Hello Response - Desc: This introduces the server. - Payload: - Size Description - 1 Server protocol version //NOTE: if protocol version is 128+, then this - server is an SMOnline server - NT Server Name - 4 Random key ( at the moment only used for an alternate login method ) - -003(131):Allow Start - Desc: This will cause the client to start the game. - Payload: None - Response: None - -004(132):Game over stats - Desc: this packet is send in response to the game over packet - it contains information regarding how well each player did. - Payload: - 1 # of players sent in this packet (active players) - The way this works is to send every player's info for a given - field. Like every player's score will be sent first, then every - player's grade. - 1 First player's player ID - - 4 Score - - 1 Grade - - 1 Difficulty (0=beginner, 1=light, etc.) - - - #this next chunk of step types is actually reversed - 2 miss - - 2 boo - - 2 good (All players) - 2 great (All players) - 2 perfect (All players) - 2 marvelous (All players) - - 2 ok (All players) - 2 max_combo (All players) - NT Player's options - - - -005:(133)Scoreboard update - Desc: This will update the client's scoreboard. - Payload: - Size - 1 Which section - 0: Names - 1: Combos - 2: Projected Grades - 1 # of players to display - - If Names, then: - 1 Player in first place's index - 1 Player in second place's index - ... - 1 Last player's index - If Combos, then: - 2 First player's combo - 2 Second Player's combo - ... - 2 Last player's combo - If Project grades - 1 Player 1's grade (in the same format used when reporting projected grades) - 1 Player 2's grade - ... - 1 Last player's projected grade - - -006:(134)System Message (PLEASE NOTE THIS HAS NOTHING TO DO WITH CLIENT COMMAND 6) - Desc: Send system message to user - Payload: - Size Description - NT Message - -007:(135)Chat Message - Desc: Add a chat message to the chat window on some StepMania screens. - Payload: - Size Description - NT Message - -008:(136)Tell client to start song/ask if client has song - Desc: The user selected a song on a Net-enabled selection - Size: - 1 Usage of message - 0: See if client has song - 1: See if client has song, if so, scroll to song - 2: See if client has song, if so, scroll to song, and play that song - 3: Blindly start song - NT Song Title (As gotten by GetTranslitMainTitle) - NT Song Artist (As Gotten by GetTranslitArtist) - NT Song Subtitle (As gotten by GetTranslitSubTitle) - -009:(137)Update user list - Desc: This sends all the users currently connected - Size: - 1 Max # of players - 1 # of players in this packet - 1 Player 0's status - NT Player 0's name (if there is no player here... make it a null ("")) - 1 Player 1's status - NT Player 1's name - ... - 1 Last player's status - NT Last player's name - Status: - 0 Inative (no info on this user yet) - 1 Active (you know who it is) - 2 In Selection Screen - 3 In Options - 4 In Evaluation - -010:(138)Force change to Networking select music screen. - Size: - NT Set Specified gametype - NT Set Specified style - -011:(139)Reserved - - -012:(140)SMOnline Packet. //SPECIAL CASE!!! - NOTE: The smonline packet is not defined here. - The SMLan packet 12 is a wrapper for the SMOnline packet. - This is so that we can have "protection" of sorts when - it comes to the coding of SMOnline, so we don't have to - use the lower level commands when dealing with SMOnline. - Size: - 1 SMOnline command - SMOnline data - - -013:(141)Formatted information packet - Desc: Send formatted information regarding the server back to the player. - NOTE: The purpose of this function is alternatively to be a broadcast - packet. (You can expect it via UDP broadcast) - Size: - NT Server Name - 2 Port the server is listening on - 2 Number of players connected - -014:(142)Attack Client - Size: - 1 Player Number - 4 Time to Last (in MS) - NT Text describing modifiers. - -015:(143) XML reply. Contains XML - Size: - NT XML - - ----------------------------------------------------------------- -Client SMOnline packets: -000: Send Login Information - Size: - 1 Player Number - 1 Encryption text - 0: MD5 hash - 1: MD5 ( MD5 hash + salt ) (salt is plain text, base 10 string ) - NT Username - NT Password - - Note: The client is not permitted to use method (1) for authentication - if the salt it received from the server is 0 - -001: User asks to enter room - Size: - 1 Enter/Exit? - 0: User wishes to exit room - 1: User wishes to enter room - NT Room Name (Used when entering rooms) - NT Password (Empty if password not used) - -002: Create a new Room - Size: - 1 Room Type - 0: Normal room (has sub rooms) - 1: Game room (no sub rooms) - NT Room Title - NT Room Description - NT Room Password (blank if no password) - -003: Requests Room Info - Size: - NT Room Name - - -Server SMOnline packets: -000: Login Response - 1 Approval Status - 0: Approved - 1: Approval Failed - NT Login response (plain text) - -001: Room Update (Changing rooms) - Size: - 1 Type of update - 0: Change Room Title - 1: Update List of other rooms (or games) - - If Room Title Update: - NT Room Title - NT Room Description - 1 Type of room: - 0: Chat room - 1: Game room - 1 Allows creation of sub room. - 0: Does not allow creation of subrooms - 1: Allows creation of subrooms - - If Room List Update: - 1 Number of rooms - NT Room1 Title - NT Room1 Description - NT Room2 Title - NT Room2 Description - ... - NT RoomN Title - NT RoomN Description - - Room Status appended for reverse compatibility - 1 Room1 Status - 0: Normal Room - 1: Unused - 2: Room in game - 3: First stage of song selection has been done - 4: Second stage of song selection has been done - 1 Room2 Status - ... - 1 RoomN Status - - Room Flags appended for reverse compatibility - 1 Room1 Flags - bit 0: Passworded if true - 1 Room2 Status - ... - 1 RoomN Status - -002: Request general information from server. - 1 Format for stats - 0: Normal unformatted stats - -003: Room Info - Size: - NT Last Song Title - NT Last Song Subtitle - NT Last Song Artist - 1 Num Players - 1 Max Players - NT Player1 Name - ... - NT PlayerN Name + +PRELIMINARY - - - - - - - - 05/03/2004 +Protocol version 4 + But 0x04 will be its version for inter-protocol purposes. + +This protocol is only intended to replace current protocol. Because current protocol +not expanable + +SMLAN PROTCOL TCP/8765 + +Protcol is entirelly packaged in EzSockets Data Packets (use send and receive packet) + +This will prevent any out-of-sync errors with future or past versions. + +The protocol is impervious to fragmented, or bonded TCP packets. + +Basic Representation: + +Octet 0123 4 5 + +----+-+---//--+ + |ssss|C|Payload| + +----+-+---//--+ + +ssss - size of packet, handled by ezsockets (if you're using C++) +C - Command. +Payload - variable size based on command + +The payload may contain more data than expected, i.e. new protocol version. + + +In the following protocol, the term size means the size of the chunk of data. +If the "size" is "NT" then that means it's a null-terminating string. + "MSN" most significant 4 bits (byte/16) + "LSN" least significant 4 bits (byte%16) + + +Note: Primary player is 0x0, secondary player is 0x1 + +CLIENT to SERVER protocol: + +000: No Operation + Desc: This command will cause server to respond with a no op response. + Payload: None + Response: Server 001 + +001: No Operation Response + Desc: This command is used to respond to a no operation. + Payload: None + Response: None + +002: Hello + Desc: This is the first packet from a client to server, stating below + information (NOTE: Names are no longer sent in this packet) + Payload: + Size Description: + 1 Client protocol version + NT Name of build of StepMania + Response: Server 002 + + + +003: Game Start Request + Desc: This command is called once after most loading is done, and + again immediately before the sound starts. + Payload: + Size Description + MSN Primary player difficulty (feet) (0 for no player) + LSN Secondary player difficulty (feet) (0 for no player) + MSN Primary player difficulty (0=Beginner, 1=easy, etc.) + LSN Second player difficulty (0=Beginner, 1=easy, etc.) + MSN Start Position (0 is pre-sync, 1 is for sync) + LSN Reserved + NT Song Title + NT Song Subtitle + NT Song Artist + NT Course Title (If none exists; make it just a null) + NT Song Options (in string-format) + NT Primary Player's options (Null if non-existant) + NT Secondary Player's Options (Null if non-existant) + + Response: Server 003 + + +004: Game Over Notice + Desc: This command is sent when end of game is encounterd + Payload: None. + Response: None. + +005: Game Status update + Desc: Updates game info for each step + Payload: + Size Description + MSN Player # +Protocol <= 2 + LSN StepID + 1: Miss + 2: W5 + 3: W4 + 4: W3 + 5: W2 + 6: W1 + 7: LetGo + 8: Held +Protocol >= 3 + LSN StepID + 1: HitMine + 2: AvoidMine + 3: Miss + 4: W5 + 5: W4 + 6: W3 + 7: W2 + 8: W1 + 9: LetGo + 10: Held + + MSN Projected Grade (StepMania enum int) + LSN Reserved + 4 Net-order long containing score. + 2 Net-order int containing combo. + 2 Net-order int containing health. + 2 Net-order # containing offset + 32767 would be DEAD on the note + If the user is hitting late, the # will be higher + It if the user is exactly 0.25 seconds off, the + number will be different by 500, if 0.5, it will be + different by 1000. + Response: None. + +006: Style Update (PLEASE NOTE THIS HAS NOTHING TO DO WITH SERVER COMMAND 6) + Desc: This is sent when a style is chosen. + Size: + 1 # of enabled players (1 means 1, 2 means 2) + 1 Player # (0 means 1st, 1 means 2nd) + NT Player Name for # + (Additional player's and #'s) (enabled players ONLY) + + Response: None + +007: Chat message + Desc: The user typed a message for general chat. + Size: + NT Message + +008: Request Start Game and Tell server existance/non existance of song. + Desc: The user selected a song on a Net-enabled selection + Size: + 1 Usage of message + 0: (in response to server 8) User has specified song + 1: (in response to server 8) User does NOT have specified song + 2: User requested a start game on given song + NT Song Title (As gotten by GetTranslitMainTitle) + NT Song Artist (As Gotten by GetTranslitArtist) + NT Song Subtitle (As gotten by GetTranslitSubTitle) + +009: //Reserved + +010: User entered/exited Network Music Selection Screen + Size: + 1 + 0: exited ScreenNetSelectMusic + 1: entered ScreenNetSelectMusic + 2: **Not Sent** + 3: entered options screen + 4: exited the evaluation screen + 5: entered evaluation screen + 6: exited ScreenNetRoom + 7: entered ScreenNetRoom + +011: User has changed player options + Size: + NT Player 0's options + NT Player 1's options + + +012: SMOnline Packet. //SPECIAL CASE!!! + NOTE: The smonline packet is not defined here. + The SMLan packet 12 is a wrapper for the SMOnline packet. + This is so that we can have "protection" of sorts when + it comes to the coding of SMOnline, so we don't have to + use the lower level commands when dealing with SMOnline. + Size: + 1 SMOnline command //This used to say 2, but it looks like 1 in all cases + SMOnline data + + +013: Reserved + +014: Reserved + +015: XML Packet. This packet contains data in XML format. + Size: + NT XML + +SERVER to CLIENT protocol: (begins at 128) + +NOTE: Server responses always add 128, thus a server response for no operation + is 128, not 000 + +000(128):No Operation + Desc: This command will cause server to respond with a no op response. + Payload: None + Response: Server 001 + +001(129):No Operation Response + Desc: This command is used to respond to a no operation. + Payload: None + Response: None + +002(130):Server Hello Response + Desc: This introduces the server. + Payload: + Size Description + 1 Server protocol version //NOTE: if protocol version is 128+, then this + server is an SMOnline server + NT Server Name + 4 Random key ( at the moment only used for an alternate login method ) + +003(131):Allow Start + Desc: This will cause the client to start the game. + Payload: None + Response: None + +004(132):Game over stats + Desc: this packet is send in response to the game over packet + it contains information regarding how well each player did. + Payload: + 1 # of players sent in this packet (active players) + The way this works is to send every player's info for a given + field. Like every player's score will be sent first, then every + player's grade. + 1 First player's player ID + + 4 Score + + 1 Grade + + 1 Difficulty (0=beginner, 1=light, etc.) + + + #this next chunk of step types is actually reversed + 2 miss + + 2 boo + + 2 good (All players) + 2 great (All players) + 2 perfect (All players) + 2 marvelous (All players) + + 2 ok (All players) + 2 max_combo (All players) + NT Player's options + + + +005:(133)Scoreboard update + Desc: This will update the client's scoreboard. + Payload: + Size + 1 Which section + 0: Names + 1: Combos + 2: Projected Grades + 1 # of players to display + + If Names, then: + 1 Player in first place's index + 1 Player in second place's index + ... + 1 Last player's index + If Combos, then: + 2 First player's combo + 2 Second Player's combo + ... + 2 Last player's combo + If Project grades + 1 Player 1's grade (in the same format used when reporting projected grades) + 1 Player 2's grade + ... + 1 Last player's projected grade + + +006:(134)System Message (PLEASE NOTE THIS HAS NOTHING TO DO WITH CLIENT COMMAND 6) + Desc: Send system message to user + Payload: + Size Description + NT Message + +007:(135)Chat Message + Desc: Add a chat message to the chat window on some StepMania screens. + Payload: + Size Description + NT Message + +008:(136)Tell client to start song/ask if client has song + Desc: The user selected a song on a Net-enabled selection + Size: + 1 Usage of message + 0: See if client has song + 1: See if client has song, if so, scroll to song + 2: See if client has song, if so, scroll to song, and play that song + 3: Blindly start song + NT Song Title (As gotten by GetTranslitMainTitle) + NT Song Artist (As Gotten by GetTranslitArtist) + NT Song Subtitle (As gotten by GetTranslitSubTitle) + +009:(137)Update user list + Desc: This sends all the users currently connected + Size: + 1 Max # of players + 1 # of players in this packet + 1 Player 0's status + NT Player 0's name (if there is no player here... make it a null ("")) + 1 Player 1's status + NT Player 1's name + ... + 1 Last player's status + NT Last player's name + Status: + 0 Inative (no info on this user yet) + 1 Active (you know who it is) + 2 In Selection Screen + 3 In Options + 4 In Evaluation + +010:(138)Force change to Networking select music screen. + Size: + NT Set Specified gametype + NT Set Specified style + +011:(139)Reserved + + +012:(140)SMOnline Packet. //SPECIAL CASE!!! + NOTE: The smonline packet is not defined here. + The SMLan packet 12 is a wrapper for the SMOnline packet. + This is so that we can have "protection" of sorts when + it comes to the coding of SMOnline, so we don't have to + use the lower level commands when dealing with SMOnline. + Size: + 1 SMOnline command + SMOnline data + + +013:(141)Formatted information packet + Desc: Send formatted information regarding the server back to the player. + NOTE: The purpose of this function is alternatively to be a broadcast + packet. (You can expect it via UDP broadcast) + Size: + NT Server Name + 2 Port the server is listening on + 2 Number of players connected + +014:(142)Attack Client + Size: + 1 Player Number + 4 Time to Last (in MS) + NT Text describing modifiers. + +015:(143) XML reply. Contains XML + Size: + NT XML + + +---------------------------------------------------------------- +Client SMOnline packets: +000: Send Login Information + Size: + 1 Player Number + 1 Encryption text + 0: MD5 hash + 1: MD5 ( MD5 hash + salt ) (salt is plain text, base 10 string ) + NT Username + NT Password + + Note: The client is not permitted to use method (1) for authentication + if the salt it received from the server is 0 + +001: User asks to enter room + Size: + 1 Enter/Exit? + 0: User wishes to exit room + 1: User wishes to enter room + NT Room Name (Used when entering rooms) + NT Password (Empty if password not used) + +002: Create a new Room + Size: + 1 Room Type + 0: Normal room (has sub rooms) + 1: Game room (no sub rooms) + NT Room Title + NT Room Description + NT Room Password (blank if no password) + +003: Requests Room Info + Size: + NT Room Name + + +Server SMOnline packets: +000: Login Response + 1 Approval Status + 0: Approved + 1: Approval Failed + NT Login response (plain text) + +001: Room Update (Changing rooms) + Size: + 1 Type of update + 0: Change Room Title + 1: Update List of other rooms (or games) + + If Room Title Update: + NT Room Title + NT Room Description + 1 Type of room: + 0: Chat room + 1: Game room + 1 Allows creation of sub room. + 0: Does not allow creation of subrooms + 1: Allows creation of subrooms + + If Room List Update: + 1 Number of rooms + NT Room1 Title + NT Room1 Description + NT Room2 Title + NT Room2 Description + ... + NT RoomN Title + NT RoomN Description + + Room Status appended for reverse compatibility + 1 Room1 Status + 0: Normal Room + 1: Unused + 2: Room in game + 3: First stage of song selection has been done + 4: Second stage of song selection has been done + 1 Room2 Status + ... + 1 RoomN Status + + Room Flags appended for reverse compatibility + 1 Room1 Flags + bit 0: Passworded if true + 1 Room2 Status + ... + 1 RoomN Status + +002: Request general information from server. + 1 Format for stats + 0: Normal unformatted stats + +003: Room Info + Size: + NT Last Song Title + NT Last Song Subtitle + NT Last Song Artist + 1 Num Players + 1 Max Players + NT Player1 Name + ... + NT PlayerN Name diff --git a/Docs/Devdocs/SMO_protocol-aj.txt b/Docs/Devdocs/SMO_protocol-aj.txt index b84a4669ad..3c48553656 100644 --- a/Docs/Devdocs/SMO_protocol-aj.txt +++ b/Docs/Devdocs/SMO_protocol-aj.txt @@ -1,554 +1,554 @@ -A re-writing of the SMLan Protocol, because I wish to understand it in -my own words. -aj - -Protocol version: 0x04 (v4) -This has nothing to do with the server versions (see below) - -==Client Versions== -(NETPROTOCOLVERSION in NetworkSyncManager.h) -1: StepMania 3.9 (SMLan?) -2: StepMania 3.95 -3: StepMania 4 alphas/sm-ssc v1.0 RC1-Final - -==Server Versions== - 1: SMLan (old) -128: SMOnline -129: SMOnline with "better song identification using chart hashes" - -==Notes== -I use the term "client" and "player" interchangeably. -The original document used "client" and "user" interchangeably. - -These two notes are from the SMOCaml project: -https://sourceforge.net/projects/smocaml/ - -Command S2C 004 (132): The data from miss to marvelous are reversed - -Commands C2S 012-001 and 012-001: when there is no password the 'password' field - isn't sended at all, not even a NULL character - -==Information== -The default port is 8765/tcp, though this is actually assigned to Ultraseek HTTP -by the IANA (see http://www.iana.org/assignments/port-numbers). - -A sm-ssc version of a online server for StepMania will use the currently -unassigned port 48040/tcp (and/or udp if the need arises). - -The protocol is packaged in "EzSockets Data Packets". - -A basic representation - - 0123 4 5...... [Octets] -+----+-+---//--+ -|ssss|C|Payload| [data] -+----+-+---//--+ -where: -ssss = Size of packet (handled by EzSockets if using C++) -C = Command -Payload = (variable size based on command) - -The payload may contain more data than expected, for instance, if it's a new -protocol version. - -"Size" refers to the size of the data chunk. -Some commonly referred to size types: - NT = Null-terminated string -MSN = Most significant 4 bits (byte/16) -LSN = Least significant 4 bits (byte%16) - -The primary player is 0x0, secondary is 0x1. This does not take into account -Multiplayer notefields. - -==[ Client -> Server Communication Protocol ]=================================== -0x00 (000) No Operation -This command will case the server to respond with a nop. - -Payload: None -Expected response: Server 0x01 (001) -________________________________________________________________________________ -0x01 (001) No Operation Response -This command is used to respond to a no operation. - -Payload: None -Expected response: None -________________________________________________________________________________ -0x02 (002) Hello -This is the first packet a client sends to the server. - -Payload: -[Size] [Description] - 0x01 Client Protocol Version (see Client Versions above) - NT StepMania build name (PRODUCT_ID) - -Expected response: Server 0x02 (002) -________________________________________________________________________________ -0x03 (003) Game Start Request - -Payload: -[Size] [Description] - MSN Primary Player Meter [0 if no player] - LSN Secondary Player Meter [0 if no player] - MSN Primary Player Difficulty - 0 = Beginner - 1 = Easy - 2 = Medium - 3 = Hard - 4 = Expert - LSN Secondary Player Difficulty (values same as primary) - MSN Start Position: - 0 = pre-sync - 1 = sync - LSN Reserved - NT Song Title - NT Song Subtitle - NT Song Artist - NT Course Title (null if doesn't exist) - NT Song options string - NT Primary player's options (null if doesn't exist) - NT Secondary player's options (null if doesn't exist) - -Expected response: Server 0x03 (003) -________________________________________________________________________________ -0x04 (004) Game Over Notice -Sent when end of game is encountered. I think technically this is round over. - -Payload: None -Expected response: None (though later in the document you'd assume Server 0x04) -________________________________________________________________________________ -0x05 (005) Game Status Update - -The payload changes between protocols, and it will likely have to change again -to account for some more StepIDs. - -Payload: -[Size] [Description] - MSN Player Number - LSN StepID - (if Protocol >= 3) - 1 = HitMine - 2 = AvoidMine - 3 = Miss - 4 = W5 - 5 = W4 - 6 = W3 - 7 = W2 - 8 = W1 - 9 = LetGo - 10 = Held - - (if Protocol <= 2; Don't support these in any new server software) - 1 = Miss - 2 = W5 - 3 = W4 - 4 = W3 - 5 = W2 - 6 = W1 - 7 = LetGo - 8 = Held - - MSN Projected Grade (StepMania enum int, which can cause problems with themes.) - LSN Reserved (so discuss it with people if changing) - 0x04 Score (net-order long) - 0x02 Combo (net-order int; songs with large combos may cause issues?) - 0x02 Health (net-order int) - 0x02 Offset (net-order number. huh) - 32767 would be DEAD on the note - If the user is hitting late, the # will be higher. - It if the user is exactly 0.25 seconds off, the number will be - different by 500. With this pattern 0.5 seconds gives a difference of 1000. - -Expected response: None -________________________________________________________________________________ -0x06 (006) Style Update -!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT! -This is sent when a style is chosen. - -Payload: -[Size] [Description] - 0x01 Number of enabled players (1 or 2) - 0x01 Player Number (0 = P1, 1 = P2) - NT Player name for specified player number - -Expected response: None -________________________________________________________________________________ -0x07 (007) Chat Message -Send a general chat message. - -Payload: -[Size] [Description] - NT Message - -Expected response: none? -________________________________________________________________________________ -0x08 (008) Request Start Game, Tell server if Song exists or not. -The player selected a song on a net-enabled screen. - -Payload: -[Size] [Description] - 0x01 Message Use: - 0 = User has specified song (response to Server 0x08) - 1 = User does not have specified song (response to Server 0x08) - 2 = User has requested start game for the song - NT Song Title (GetTranslitMainTitle) - NT Song Artist (GetTranslitArtist) - NT Song Subtitle (GetTranslitSubTitle) - -Expected response: none? -________________________________________________________________________________ -0x09 (009) [Reserved] -________________________________________________________________________________ -0x0A (010) User entered/exited a network screen - -Payload: -[Size] [Description] - 0x01 Status: - 0 = exited ScreenNetSelectMusic - 1 = entered ScreenNetSelectMusic - 2 = not sent - 3 = entered Options - 4 = exited ScreenNetEvaluation - 5 = entered ScreenNetEvaluation - 6 = exited ScreenNetRoom - 7 = entered ScreenNetRoom - -Expected response: none? -________________________________________________________________________________ -0x0B (011) Player options changed - -Payload: -[Size] [Description] - NT Player 0's options (PLAYER_1) - NT Player 1's options (PLAYER_2) - -Expected response: none? -________________________________________________________________________________ -0x0C (012) SMOnline Packet (Special Case) -The SMOnline Packet is not defined here. -SMLan packet 12 is a wrapper for the SMOnline packet. It is used for -"protection" of sorts for the SMO coders. - -Payload: -[Size] [Description] - 0x01 SMOnline command - <...> SMOnline data (<...> = "" in original docs) - -Expected response: none? -________________________________________________________________________________ -0x0D (013) [Reserved] -________________________________________________________________________________ -0x0E (014) [Reserved] -________________________________________________________________________________ -0x0F (015) XML Packet -This packet contains data in XML format. - -Payload: -[Size] [Description] - NT XML - -Expected response: none? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -==[ Server -> Client Communication Protocol ]=================================== -The Server->Client Communication Protocol begins at 0x80 (128). References to -protocol numbers based on 000 will appear here as well. -________________________________________________________________________________ -0x80 (128) [0x00 (000)] No Operation -This command makes the server respond with a nop. - -Expected Response: Server 0x01 (001; so really 0x81/129?) -________________________________________________________________________________ -0x81 (129) [0x01 (001)] No Operation Response -The response the server gives to a client nop. -________________________________________________________________________________ -0x82 (130) [0x02 (002)] Server Hello Response -Introduces the server to the client. - -Payload: -[Size] [Description] - 0x01 Server Protocol version (if >= 128; server is SMOnline.) - NT Server Name - 0x04 Random Key (or Salt, iirc. Used for alternate login method.) -________________________________________________________________________________ -0x83 (131) [0x03 (003)] Allow Start -Causes the client to start the game. -________________________________________________________________________________ -0x84 (132) [0x04 (004)] Game over stats -Sent in response to the game over packet. -(Technically, this is the evaluation stats.) - -Payload: -[Size] [Description] - 0x01 Number of players in this packet (active) - Send every player's information for a given field. - 0x01 First player's PlayerID - - 0x04 Score - - 0x01 Grade - - 0x01 Difficulty (0 = Beginner, &c.) - - - (the steps type section is reversed. We may need to do some packet analysis.) - 0x02 Judgement_Miss - - 0x02 Judgement_W5 (Boo) - - 0x02 Judgement_W4 (Good) - - 0x02 Judgement_W3 (Great) - - 0x02 Judgement_W2 (Perfect) - - 0x02 Judgement_W1 (Marvelous) - - 0x02 Judgement_Held (OK) - - (LetGo doesn't seem to be handled.) - 0x02 Max Combo - - NT Player options - -________________________________________________________________________________ -0x85 (133) [0x05 (005)] Scoreboard update -Update the client's scoreboard. - -Payload: -[Size] [Description] - 0x01 Section - 0 = names - 1 = combos - 2 = grades (Projected) - 0x01 Number of players to display - -The rest of the payload depends on section. -switch(section) -{ - case Names: - 0x01 Index of Player in 1st place - 0x01 Index of Player in 2nd place - ... - 0x01 Last player's index - break; - - case Combos: - 0x01 Player 1's combo - 0x01 Player 2's combo - ... - 0x01 Last player's combo - break; - - case Grades: // uses same format as other Grade reports - 0x01 Player 1's grade - 0x01 Player 2's grade - ... - 0x01 Last player's grade - break; -} -________________________________________________________________________________ -0x86 (134) [0x06 (006)] System Message -!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT! -Send a system message to the user. - -Payload: -[Size] [Description] - NT Message -________________________________________________________________________________ -0x87 (135) [0x07 (007)] Chat Message -Add a message to the chat window. ("on some StepMania screens.") - -Payload: -[Size] [Description] - NT Message -________________________________________________________________________________ -0x88 (136) [0x08 (008)] Ask if client has song/Tell client to start song -The player selected a song on a net-enabled screen. - -Payload: -[Size] [Description] - 0x01 Message Type - 0 = See if client has song. - 1 = See if client has song. If so, scroll to it. - 2 = See if client has song. If so, scroll to it and play it. - 3 = Blindly start song. (Probably assumes everyone has the song.) - NT Song Title (GetTranslitMainTitle) - NT Song Artist (GetTranslitArtist) - NT Song Subtitle (GetTranslitSubTitle) - -________________________________________________________________________________ -0x89 (137) [0x09 (009)] Update user list -Sends all the players currently connected. - -Payload: -[Size] [Description] - 0x01 Max number of players - 0x01 Number of players in this packet - 0x01 Player 0's status - NT Player 0's name (if no player, it should be an empty string ("").) - ... - 0x01 Last player's status - NT Last player's name - -The status flag: -0x00 = Inactive (user unknown) -0x01 = Active (user known) -0x02 = On a selection screen -0x02 = In options -0x02 = On Eval. -________________________________________________________________________________ -0x8A (138) [0x0A (010)] Force change to NetSelectMusic - -Payload: -[Size] [Description] - NT Gametype to set - NT Style to set -________________________________________________________________________________ -0x8B (139) [0x0B (011)] Reserved -________________________________________________________________________________ -0x8C (140) [0x0C (012)] SMOnline Packet (Special Case) -The SMOnline Packet is not defined here. -SMLan packet 12 is a wrapper for the SMOnline packet. It is used for -"protection" of sorts for the SMO coders. - -Payload: -[Size] [Description] - 1 SMOnline command - <...> SMOnline data (<...> = "" in original docs) -________________________________________________________________________________ -0x8D (141) [0x0D (013)] Formatted information packet -Send formatted information about the server back to the player. -This function is alternatively a broadcast packet (via UDP). - -Payload: -[Size] [Description] - NT Server name - 0x02 Server port - 0x02 Number of players connected -________________________________________________________________________________ -0x8E (142) [0x0E (014)] Attack client - -Payload: -[Size] [Description] - 0x01 Player number - 0x04 Attack length (milliseconds) - NT Modifier string -________________________________________________________________________________ -0x8F (143) [0x0F (015)] XML reply - -Payload: -[Size] [Description] - NT XML data - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -==[ Client SMOnline Packets ]=================================================== -0x00 (000) Send Login Information - -Payload: -[Size] [Description] - 0x01 Player Number - 0x01 Encryption Text: - 0 = MD5 hash - 1 = MD5(MD5 hash + salt), where salt is a plaintext base 10 string. - NT Username - NT Password - -If the server's salt is 0, Encryption Text can't be 1. Block login. -________________________________________________________________________________ -0x01 (001) Ask to enter room - -Payload: -[Size] [Description] - 0x01 Enter or Exit?: - 0 = Exit - 1 = Enter - NT Room Name (only when entering) - NT Password (empty if unused) - -________________________________________________________________________________ -0x02 (002) Create a new room - -Payload: -[Size] [Description] - 0x01 Room Type: - 0 = Normal (with subrooms) - 1 = Game (no subrooms) - NT Room Title - NT Room Description - NR Room Password (blank if no password) - -________________________________________________________________________________ -0x03 (003) Request room info - -Payload: -[Size] [Description] - NT Room name - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -==[ Server SMOnline Packets ]=================================================== -0x00 (000) Login Response -Payload: -[Size] [Description] - 0x01 Approval status: - 0 = Login OK - 1 = Login Failed - NT Login Response (plaintext) -________________________________________________________________________________ -0x01 (001) - -Payload: -The payload changes depending on the type of update. -[Size] [Description] - 0x01 Update Type: - 0 = Change Room Title - 1 = Update List of rooms/games - -if Update Type == 0 (Change Room Title) -[Size] [Description] - NT Room Title - NT Room Description - 0x01 Room Type: - 0 = Chat - 1 = Game - 0x01 Allow Subroom creation? - 0 = No - 1 = Yes - -if Update Type == 1 (Update room/game list) -[Size] [Description] - 0x01 Number of rooms -for 1 to Number of Rooms where room number = # do - NT Room# Title - NT Room# Description - -Reverse compatiblity Room Status -[Size] [Description] - 0x01 Room# Status - 0 = Normal - 1 = unused - 2 = Playing Game - 3 = Song Selection Stage1 - 4 = Song Selection Stage2 - -Reverse compatiblity Room Flags -[Size] [Description] - 0x01 Room# Flags - if bit 0, Passworded -________________________________________________________________________________ -0x02 (002) Request general information from server. - -Payload: -[Size] [Description] - 0x01 Stats format - 0 = Normal unformatted stats -________________________________________________________________________________ -0x03 (003) Request room information - -Payload: -[Size] [Description] - NT Last Song Title - NT Last Song Subtitle - NT Last Song Artist - 0x01 Number of players - 0x01 Max players - NT Player1 name - ... +A re-writing of the SMLan Protocol, because I wish to understand it in +my own words. -aj + +Protocol version: 0x04 (v4) +This has nothing to do with the server versions (see below) + +==Client Versions== +(NETPROTOCOLVERSION in NetworkSyncManager.h) +1: StepMania 3.9 (SMLan?) +2: StepMania 3.95 +3: StepMania 4 alphas/sm-ssc v1.0 RC1-Final + +==Server Versions== + 1: SMLan (old) +128: SMOnline +129: SMOnline with "better song identification using chart hashes" + +==Notes== +I use the term "client" and "player" interchangeably. +The original document used "client" and "user" interchangeably. + +These two notes are from the SMOCaml project: +https://sourceforge.net/projects/smocaml/ + +Command S2C 004 (132): The data from miss to marvelous are reversed + +Commands C2S 012-001 and 012-001: when there is no password the 'password' field + isn't sended at all, not even a NULL character + +==Information== +The default port is 8765/tcp, though this is actually assigned to Ultraseek HTTP +by the IANA (see http://www.iana.org/assignments/port-numbers). + +A sm-ssc version of a online server for StepMania will use the currently +unassigned port 48040/tcp (and/or udp if the need arises). + +The protocol is packaged in "EzSockets Data Packets". + +A basic representation + + 0123 4 5...... [Octets] ++----+-+---//--+ +|ssss|C|Payload| [data] ++----+-+---//--+ +where: +ssss = Size of packet (handled by EzSockets if using C++) +C = Command +Payload = (variable size based on command) + +The payload may contain more data than expected, for instance, if it's a new +protocol version. + +"Size" refers to the size of the data chunk. +Some commonly referred to size types: + NT = Null-terminated string +MSN = Most significant 4 bits (byte/16) +LSN = Least significant 4 bits (byte%16) + +The primary player is 0x0, secondary is 0x1. This does not take into account +Multiplayer notefields. + +==[ Client -> Server Communication Protocol ]=================================== +0x00 (000) No Operation +This command will case the server to respond with a nop. + +Payload: None +Expected response: Server 0x01 (001) +________________________________________________________________________________ +0x01 (001) No Operation Response +This command is used to respond to a no operation. + +Payload: None +Expected response: None +________________________________________________________________________________ +0x02 (002) Hello +This is the first packet a client sends to the server. + +Payload: +[Size] [Description] + 0x01 Client Protocol Version (see Client Versions above) + NT StepMania build name (PRODUCT_ID) + +Expected response: Server 0x02 (002) +________________________________________________________________________________ +0x03 (003) Game Start Request + +Payload: +[Size] [Description] + MSN Primary Player Meter [0 if no player] + LSN Secondary Player Meter [0 if no player] + MSN Primary Player Difficulty + 0 = Beginner + 1 = Easy + 2 = Medium + 3 = Hard + 4 = Expert + LSN Secondary Player Difficulty (values same as primary) + MSN Start Position: + 0 = pre-sync + 1 = sync + LSN Reserved + NT Song Title + NT Song Subtitle + NT Song Artist + NT Course Title (null if doesn't exist) + NT Song options string + NT Primary player's options (null if doesn't exist) + NT Secondary player's options (null if doesn't exist) + +Expected response: Server 0x03 (003) +________________________________________________________________________________ +0x04 (004) Game Over Notice +Sent when end of game is encountered. I think technically this is round over. + +Payload: None +Expected response: None (though later in the document you'd assume Server 0x04) +________________________________________________________________________________ +0x05 (005) Game Status Update + +The payload changes between protocols, and it will likely have to change again +to account for some more StepIDs. + +Payload: +[Size] [Description] + MSN Player Number + LSN StepID + (if Protocol >= 3) + 1 = HitMine + 2 = AvoidMine + 3 = Miss + 4 = W5 + 5 = W4 + 6 = W3 + 7 = W2 + 8 = W1 + 9 = LetGo + 10 = Held + + (if Protocol <= 2; Don't support these in any new server software) + 1 = Miss + 2 = W5 + 3 = W4 + 4 = W3 + 5 = W2 + 6 = W1 + 7 = LetGo + 8 = Held + + MSN Projected Grade (StepMania enum int, which can cause problems with themes.) + LSN Reserved (so discuss it with people if changing) + 0x04 Score (net-order long) + 0x02 Combo (net-order int; songs with large combos may cause issues?) + 0x02 Health (net-order int) + 0x02 Offset (net-order number. huh) + 32767 would be DEAD on the note + If the user is hitting late, the # will be higher. + It if the user is exactly 0.25 seconds off, the number will be + different by 500. With this pattern 0.5 seconds gives a difference of 1000. + +Expected response: None +________________________________________________________________________________ +0x06 (006) Style Update +!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT! +This is sent when a style is chosen. + +Payload: +[Size] [Description] + 0x01 Number of enabled players (1 or 2) + 0x01 Player Number (0 = P1, 1 = P2) + NT Player name for specified player number + +Expected response: None +________________________________________________________________________________ +0x07 (007) Chat Message +Send a general chat message. + +Payload: +[Size] [Description] + NT Message + +Expected response: none? +________________________________________________________________________________ +0x08 (008) Request Start Game, Tell server if Song exists or not. +The player selected a song on a net-enabled screen. + +Payload: +[Size] [Description] + 0x01 Message Use: + 0 = User has specified song (response to Server 0x08) + 1 = User does not have specified song (response to Server 0x08) + 2 = User has requested start game for the song + NT Song Title (GetTranslitMainTitle) + NT Song Artist (GetTranslitArtist) + NT Song Subtitle (GetTranslitSubTitle) + +Expected response: none? +________________________________________________________________________________ +0x09 (009) [Reserved] +________________________________________________________________________________ +0x0A (010) User entered/exited a network screen + +Payload: +[Size] [Description] + 0x01 Status: + 0 = exited ScreenNetSelectMusic + 1 = entered ScreenNetSelectMusic + 2 = not sent + 3 = entered Options + 4 = exited ScreenNetEvaluation + 5 = entered ScreenNetEvaluation + 6 = exited ScreenNetRoom + 7 = entered ScreenNetRoom + +Expected response: none? +________________________________________________________________________________ +0x0B (011) Player options changed + +Payload: +[Size] [Description] + NT Player 0's options (PLAYER_1) + NT Player 1's options (PLAYER_2) + +Expected response: none? +________________________________________________________________________________ +0x0C (012) SMOnline Packet (Special Case) +The SMOnline Packet is not defined here. +SMLan packet 12 is a wrapper for the SMOnline packet. It is used for +"protection" of sorts for the SMO coders. + +Payload: +[Size] [Description] + 0x01 SMOnline command + <...> SMOnline data (<...> = "" in original docs) + +Expected response: none? +________________________________________________________________________________ +0x0D (013) [Reserved] +________________________________________________________________________________ +0x0E (014) [Reserved] +________________________________________________________________________________ +0x0F (015) XML Packet +This packet contains data in XML format. + +Payload: +[Size] [Description] + NT XML + +Expected response: none? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +==[ Server -> Client Communication Protocol ]=================================== +The Server->Client Communication Protocol begins at 0x80 (128). References to +protocol numbers based on 000 will appear here as well. +________________________________________________________________________________ +0x80 (128) [0x00 (000)] No Operation +This command makes the server respond with a nop. + +Expected Response: Server 0x01 (001; so really 0x81/129?) +________________________________________________________________________________ +0x81 (129) [0x01 (001)] No Operation Response +The response the server gives to a client nop. +________________________________________________________________________________ +0x82 (130) [0x02 (002)] Server Hello Response +Introduces the server to the client. + +Payload: +[Size] [Description] + 0x01 Server Protocol version (if >= 128; server is SMOnline.) + NT Server Name + 0x04 Random Key (or Salt, iirc. Used for alternate login method.) +________________________________________________________________________________ +0x83 (131) [0x03 (003)] Allow Start +Causes the client to start the game. +________________________________________________________________________________ +0x84 (132) [0x04 (004)] Game over stats +Sent in response to the game over packet. +(Technically, this is the evaluation stats.) + +Payload: +[Size] [Description] + 0x01 Number of players in this packet (active) + Send every player's information for a given field. + 0x01 First player's PlayerID + + 0x04 Score + + 0x01 Grade + + 0x01 Difficulty (0 = Beginner, &c.) + + + (the steps type section is reversed. We may need to do some packet analysis.) + 0x02 Judgement_Miss + + 0x02 Judgement_W5 (Boo) + + 0x02 Judgement_W4 (Good) + + 0x02 Judgement_W3 (Great) + + 0x02 Judgement_W2 (Perfect) + + 0x02 Judgement_W1 (Marvelous) + + 0x02 Judgement_Held (OK) + + (LetGo doesn't seem to be handled.) + 0x02 Max Combo + + NT Player options + +________________________________________________________________________________ +0x85 (133) [0x05 (005)] Scoreboard update +Update the client's scoreboard. + +Payload: +[Size] [Description] + 0x01 Section + 0 = names + 1 = combos + 2 = grades (Projected) + 0x01 Number of players to display + +The rest of the payload depends on section. +switch(section) +{ + case Names: + 0x01 Index of Player in 1st place + 0x01 Index of Player in 2nd place + ... + 0x01 Last player's index + break; + + case Combos: + 0x01 Player 1's combo + 0x01 Player 2's combo + ... + 0x01 Last player's combo + break; + + case Grades: // uses same format as other Grade reports + 0x01 Player 1's grade + 0x01 Player 2's grade + ... + 0x01 Last player's grade + break; +} +________________________________________________________________________________ +0x86 (134) [0x06 (006)] System Message +!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT! +Send a system message to the user. + +Payload: +[Size] [Description] + NT Message +________________________________________________________________________________ +0x87 (135) [0x07 (007)] Chat Message +Add a message to the chat window. ("on some StepMania screens.") + +Payload: +[Size] [Description] + NT Message +________________________________________________________________________________ +0x88 (136) [0x08 (008)] Ask if client has song/Tell client to start song +The player selected a song on a net-enabled screen. + +Payload: +[Size] [Description] + 0x01 Message Type + 0 = See if client has song. + 1 = See if client has song. If so, scroll to it. + 2 = See if client has song. If so, scroll to it and play it. + 3 = Blindly start song. (Probably assumes everyone has the song.) + NT Song Title (GetTranslitMainTitle) + NT Song Artist (GetTranslitArtist) + NT Song Subtitle (GetTranslitSubTitle) + +________________________________________________________________________________ +0x89 (137) [0x09 (009)] Update user list +Sends all the players currently connected. + +Payload: +[Size] [Description] + 0x01 Max number of players + 0x01 Number of players in this packet + 0x01 Player 0's status + NT Player 0's name (if no player, it should be an empty string ("").) + ... + 0x01 Last player's status + NT Last player's name + +The status flag: +0x00 = Inactive (user unknown) +0x01 = Active (user known) +0x02 = On a selection screen +0x02 = In options +0x02 = On Eval. +________________________________________________________________________________ +0x8A (138) [0x0A (010)] Force change to NetSelectMusic + +Payload: +[Size] [Description] + NT Gametype to set + NT Style to set +________________________________________________________________________________ +0x8B (139) [0x0B (011)] Reserved +________________________________________________________________________________ +0x8C (140) [0x0C (012)] SMOnline Packet (Special Case) +The SMOnline Packet is not defined here. +SMLan packet 12 is a wrapper for the SMOnline packet. It is used for +"protection" of sorts for the SMO coders. + +Payload: +[Size] [Description] + 1 SMOnline command + <...> SMOnline data (<...> = "" in original docs) +________________________________________________________________________________ +0x8D (141) [0x0D (013)] Formatted information packet +Send formatted information about the server back to the player. +This function is alternatively a broadcast packet (via UDP). + +Payload: +[Size] [Description] + NT Server name + 0x02 Server port + 0x02 Number of players connected +________________________________________________________________________________ +0x8E (142) [0x0E (014)] Attack client + +Payload: +[Size] [Description] + 0x01 Player number + 0x04 Attack length (milliseconds) + NT Modifier string +________________________________________________________________________________ +0x8F (143) [0x0F (015)] XML reply + +Payload: +[Size] [Description] + NT XML data + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +==[ Client SMOnline Packets ]=================================================== +0x00 (000) Send Login Information + +Payload: +[Size] [Description] + 0x01 Player Number + 0x01 Encryption Text: + 0 = MD5 hash + 1 = MD5(MD5 hash + salt), where salt is a plaintext base 10 string. + NT Username + NT Password + +If the server's salt is 0, Encryption Text can't be 1. Block login. +________________________________________________________________________________ +0x01 (001) Ask to enter room + +Payload: +[Size] [Description] + 0x01 Enter or Exit?: + 0 = Exit + 1 = Enter + NT Room Name (only when entering) + NT Password (empty if unused) + +________________________________________________________________________________ +0x02 (002) Create a new room + +Payload: +[Size] [Description] + 0x01 Room Type: + 0 = Normal (with subrooms) + 1 = Game (no subrooms) + NT Room Title + NT Room Description + NR Room Password (blank if no password) + +________________________________________________________________________________ +0x03 (003) Request room info + +Payload: +[Size] [Description] + NT Room name + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +==[ Server SMOnline Packets ]=================================================== +0x00 (000) Login Response +Payload: +[Size] [Description] + 0x01 Approval status: + 0 = Login OK + 1 = Login Failed + NT Login Response (plaintext) +________________________________________________________________________________ +0x01 (001) + +Payload: +The payload changes depending on the type of update. +[Size] [Description] + 0x01 Update Type: + 0 = Change Room Title + 1 = Update List of rooms/games + +if Update Type == 0 (Change Room Title) +[Size] [Description] + NT Room Title + NT Room Description + 0x01 Room Type: + 0 = Chat + 1 = Game + 0x01 Allow Subroom creation? + 0 = No + 1 = Yes + +if Update Type == 1 (Update room/game list) +[Size] [Description] + 0x01 Number of rooms +for 1 to Number of Rooms where room number = # do + NT Room# Title + NT Room# Description + +Reverse compatiblity Room Status +[Size] [Description] + 0x01 Room# Status + 0 = Normal + 1 = unused + 2 = Playing Game + 3 = Song Selection Stage1 + 4 = Song Selection Stage2 + +Reverse compatiblity Room Flags +[Size] [Description] + 0x01 Room# Flags + if bit 0, Passworded +________________________________________________________________________________ +0x02 (002) Request general information from server. + +Payload: +[Size] [Description] + 0x01 Stats format + 0 = Normal unformatted stats +________________________________________________________________________________ +0x03 (003) Request room information + +Payload: +[Size] [Description] + NT Last Song Title + NT Last Song Subtitle + NT Last Song Artist + 0x01 Number of players + 0x01 Max players + NT Player1 name + ... NT Last player (PlayerN) name \ No newline at end of file diff --git a/Docs/Devdocs/SMXML.txt b/Docs/Devdocs/SMXML.txt index b58b6f459d..d3d9222d63 100644 --- a/Docs/Devdocs/SMXML.txt +++ b/Docs/Devdocs/SMXML.txt @@ -1,34 +1,34 @@ -SMXML Control Format | Informal and Unofficial Specification -____________________________________________________________ -There is no formal DTD for SMXML as of this writing, so we can only go on the -example file and comments written about the format from developers. - -Chris Danford writes[1]: -"I've been finishing a new in-game download system. The goal is to: -- Have as few user clicks as possible to install a package (or many packages) -- Have one cross-platform method of installing packages - -The new file association - .smxml - contains control data that StepMania will use -on launch. The file format currently supports one or more packages to install." - -The canonical sample SMXML file[2] looks like this: - - - chrisdanford - #&DJASDJ#$&$JSD - - - http://stepmaniam3.com/sm/data/files/Songs_DJMcFox_PlagueMixOne.smzip - - - http://stepmaniam3.com/sm/data/files/Songs_DJMcFox_PlagueMixTwo.smzip - - - -The Credentials section seems to be optional, but is useful to know about: -"In the future, it might also be used to pass login credentials or other tokens -from the web site to StepMania for things like in-game uploads (instead of going -to stepmaniashare.com)"[1] -__________________________________________________________ -[1] http://www.stepmania.com/forums/showthread.php?t=24203 +SMXML Control Format | Informal and Unofficial Specification +____________________________________________________________ +There is no formal DTD for SMXML as of this writing, so we can only go on the +example file and comments written about the format from developers. + +Chris Danford writes[1]: +"I've been finishing a new in-game download system. The goal is to: +- Have as few user clicks as possible to install a package (or many packages) +- Have one cross-platform method of installing packages + +The new file association - .smxml - contains control data that StepMania will use +on launch. The file format currently supports one or more packages to install." + +The canonical sample SMXML file[2] looks like this: + + + chrisdanford + #&DJASDJ#$&$JSD + + + http://stepmaniam3.com/sm/data/files/Songs_DJMcFox_PlagueMixOne.smzip + + + http://stepmaniam3.com/sm/data/files/Songs_DJMcFox_PlagueMixTwo.smzip + + + +The Credentials section seems to be optional, but is useful to know about: +"In the future, it might also be used to pass login credentials or other tokens +from the web site to StepMania for things like in-game uploads (instead of going +to stepmaniashare.com)"[1] +__________________________________________________________ +[1] http://www.stepmania.com/forums/showthread.php?t=24203 [2] http://www.stepmania.com/test.smxml \ No newline at end of file diff --git a/Docs/Devdocs/TextEntry.txt b/Docs/Devdocs/TextEntry.txt index c5e975d583..5d472fdd39 100644 --- a/Docs/Devdocs/TextEntry.txt +++ b/Docs/Devdocs/TextEntry.txt @@ -1,14 +1,14 @@ -Code that uses ScreenTextEntry::TextEntry() -------------------------------------------- -RoomWheel.cpp -ScreenEdit.cpp -ScreenEditMenu.cpp -ScreenNetRoom.cpp -ScreenNetworkOptions.cpp -ScreenOptionsCourseOverview.cpp -ScreenOptionsManageCourses.cpp -ScreenOptionsManageEditSteps.cpp -ScreenOptionsManageProfiles.cpp -ScreenOptionsReviewWorkout.cpp -ScreenPackages.cpp +Code that uses ScreenTextEntry::TextEntry() +------------------------------------------- +RoomWheel.cpp +ScreenEdit.cpp +ScreenEditMenu.cpp +ScreenNetRoom.cpp +ScreenNetworkOptions.cpp +ScreenOptionsCourseOverview.cpp +ScreenOptionsManageCourses.cpp +ScreenOptionsManageEditSteps.cpp +ScreenOptionsManageProfiles.cpp +ScreenOptionsReviewWorkout.cpp +ScreenPackages.cpp ScreenTestFonts.cpp \ No newline at end of file diff --git a/Docs/Devdocs/WarpNotes.txt b/Docs/Devdocs/WarpNotes.txt index db51bd1ba5..906efb9b02 100644 --- a/Docs/Devdocs/WarpNotes.txt +++ b/Docs/Devdocs/WarpNotes.txt @@ -1,17 +1,17 @@ -warps are purple in the editor btw - -beat 445.500 = 107.02325 seconds ----------------------------------- -beat 453.72919 = 107.04103 seconds - - -00:03.145: ==NotesLoSM negbpm== -00:03.145: fnextposbeat = 449.500000, fnextposbpm = 47.419998, -00:03.145: fdelta = 4.040333, fwarpto = 453.540344 - -00:47.228: ==TimingData Delta as NoteRows== -00:47.228: fDeltaBeat = 4.000000 (beat) -00:47.228: fDeltaBeat = (NextBPMSeg 0.790333 - abs(fBPS 0.750000)) + (nextStartRow 21576 - thisRow 21384) -00:47.228: ==TimingData Delta as Beats== -00:47.228: fDeltaBeat = 4.000000 (beat) +warps are purple in the editor btw + +beat 445.500 = 107.02325 seconds +---------------------------------- +beat 453.72919 = 107.04103 seconds + + +00:03.145: ==NotesLoSM negbpm== +00:03.145: fnextposbeat = 449.500000, fnextposbpm = 47.419998, +00:03.145: fdelta = 4.040333, fwarpto = 453.540344 + +00:47.228: ==TimingData Delta as NoteRows== +00:47.228: fDeltaBeat = 4.000000 (beat) +00:47.228: fDeltaBeat = (NextBPMSeg 0.790333 - abs(fBPS 0.750000)) + (nextStartRow 21576 - thisRow 21384) +00:47.228: ==TimingData Delta as Beats== +00:47.228: fDeltaBeat = 4.000000 (beat) 00:47.228: fDeltaBeat = (NextBPMSeg 0.790333 - abs(fBPS 0.750000)) + (nextStartRow 21576 - thisRow 21384) \ No newline at end of file diff --git a/Docs/Devdocs/ezsockets.txt b/Docs/Devdocs/ezsockets.txt index c64c15dbec..fc7b455641 100644 --- a/Docs/Devdocs/ezsockets.txt +++ b/Docs/Devdocs/ezsockets.txt @@ -1,132 +1,132 @@ -HOW 2 UZE EZSOKETS BY FWEEM INC - -Hey there. ezsockets is the socket library used in StepMania. If you are going to -develop any extended network functionality, it would be good to know about -ezsockets. This is by no means an exhaustive guide, as it just covers what's -contained in the header, as well as what that code does. - -Section 1: low level commands=================================================== -These are typically used for connecting to the server, according to a cursory -glance at ScreenPackages code. - -=="Crating" a socket== (lol typos in the comments) -There are three functions here, each with different arguments (yay overloading). -All of them return a bool. - -bool create(int Protocol, int Type); -This shows what's needed to make a socket. Consult the internet for complete -documentation as to possible values, but here are some ones to know: - -[Protocol] -TCP = IPPROTO_TCP -UDP = IPPROTO_UDP -Raw sockets = IPPROTO_RAW (though "Protocol" is used in the code. Raw sockets -are not supported on Xbox) - -bool create(); -Creates a socket using (IPPROTO_TCP, SOCK_STREAM) as the parameters. - -bool create(int Protocol); -This picks the right Type for you based on what Protocol you choose. -TCP uses SOCK_STREAM, UDP uses SOCK_DGRAM for the Type value. - -==Binding Sockets to a Local Port== -bool bind(unsigned short port); - -==Listening== -bool listen() - -==Accepting== -bool accept(EzSockets &socket); -If it's not blocking and you can't read it, this will return false. -Other than that... ?? - -==Connecting to Server== -bool connect(const string& host, unsigned short port); -Connects to the server at host using port. - -==Closing/Killing Sockets== -void close(); -Sets the state to disconnected, sets the buffers to empty strings, -then closes the socket. - -==Checking Socket Status== -bool check(); -"see if socket has been created". It checks (sock != INVALID_SOCKET) on the -Xbox and (sock > SOCKET_NONE) on every other platform. - -bool CanRead(); -Returns true if you can read from the socket. - -bool DataAvailable() { return ( ( inBuffer.length()>0 ) || CanRead() ); } -Yeah that's it in a nutshell. If the input buffer has data or you can read, -there's data available. - -bool IsError(); -Returns true if there's an error. - -bool CanWrite(); -Returns true if you can write to the socket. - -==???== -long uAddr(); -void update(); - -Section 2: Higher Level Commands================================================ -These are higher level, since they assume you've already gotten the socket up -and running (see check() in Section 1). - -//Raw data system -void SendData(const string& outData); -void SendData(const char *data, unsigned int bytes); -Send off some data that's either a string or a char buffer + num bytes. - -int ReadData(char *data, unsigned int bytes); -Reads data, returns number of bytes read. - -int PeekData(char *data, unsigned int bytes); -Peeks at the data, returns number of bytes read. - -//Packet system (for structures and classes) -void SendPack(const char *data, unsigned int bytes); -int ReadPack(char *data, unsigned int max); -int PeekPack(char *data, unsigned int max); -Similar to the raw data system above, but... you guessed it, for structures and classes. - -//String (Flash) system / Null-terminated strings -void SendStr(const string& data, char delim = '\0'); -int ReadStr(string& data, char delim = '\0'); -int PeekStr(string& data, char delim = '\0'); -Similar to above, with null terminated strings. - -Section 3: putting it all together============================================== -okay i didn't test this; this is based on ScreenPackages code (specifically -ScreenPackages::EnterURL()), which assumes you have a private EzSockets object -named m_wSocket. - -{ - // defaults - RString sProto; - RString sServer; - int iPort=80; - RString sAddress; - - m_wSocket.create(); // will create a TCP socket - m_wSocket.blocking = true; // you want to set this so that nothing else can use this socket and fuck things up - m_wSocket.connect( sServer, (short)iPort ); // connect uses an unsigned short, so a cast is needed. (int was used because of other code) check if this returns true/false, pls - - // makin' headers (using SendData with raw data; http 1.0 in this case) - RString Header=""; - - Header = "GET "+sAddress+" HTTP/1.0\r\n"; - Header+= "Host: " + Server + "\r\n"; - Header+= "Connection: closed\r\n\r\n"; - - m_wSocket.SendData( Header.c_str(), Header.length() ); - - m_wSocket.blocking = false; // once you're done, you don't need to have the socket blocking anymore - - // some other code can go here... - - m_wSocket.close(); // and if you're done, you can close the socket. +HOW 2 UZE EZSOKETS BY FWEEM INC + +Hey there. ezsockets is the socket library used in StepMania. If you are going to +develop any extended network functionality, it would be good to know about +ezsockets. This is by no means an exhaustive guide, as it just covers what's +contained in the header, as well as what that code does. + +Section 1: low level commands=================================================== +These are typically used for connecting to the server, according to a cursory +glance at ScreenPackages code. + +=="Crating" a socket== (lol typos in the comments) +There are three functions here, each with different arguments (yay overloading). +All of them return a bool. + +bool create(int Protocol, int Type); +This shows what's needed to make a socket. Consult the internet for complete +documentation as to possible values, but here are some ones to know: + +[Protocol] +TCP = IPPROTO_TCP +UDP = IPPROTO_UDP +Raw sockets = IPPROTO_RAW (though "Protocol" is used in the code. Raw sockets +are not supported on Xbox) + +bool create(); +Creates a socket using (IPPROTO_TCP, SOCK_STREAM) as the parameters. + +bool create(int Protocol); +This picks the right Type for you based on what Protocol you choose. +TCP uses SOCK_STREAM, UDP uses SOCK_DGRAM for the Type value. + +==Binding Sockets to a Local Port== +bool bind(unsigned short port); + +==Listening== +bool listen() + +==Accepting== +bool accept(EzSockets &socket); +If it's not blocking and you can't read it, this will return false. +Other than that... ?? + +==Connecting to Server== +bool connect(const string& host, unsigned short port); +Connects to the server at host using port. + +==Closing/Killing Sockets== +void close(); +Sets the state to disconnected, sets the buffers to empty strings, +then closes the socket. + +==Checking Socket Status== +bool check(); +"see if socket has been created". It checks (sock != INVALID_SOCKET) on the +Xbox and (sock > SOCKET_NONE) on every other platform. + +bool CanRead(); +Returns true if you can read from the socket. + +bool DataAvailable() { return ( ( inBuffer.length()>0 ) || CanRead() ); } +Yeah that's it in a nutshell. If the input buffer has data or you can read, +there's data available. + +bool IsError(); +Returns true if there's an error. + +bool CanWrite(); +Returns true if you can write to the socket. + +==???== +long uAddr(); +void update(); + +Section 2: Higher Level Commands================================================ +These are higher level, since they assume you've already gotten the socket up +and running (see check() in Section 1). + +//Raw data system +void SendData(const string& outData); +void SendData(const char *data, unsigned int bytes); +Send off some data that's either a string or a char buffer + num bytes. + +int ReadData(char *data, unsigned int bytes); +Reads data, returns number of bytes read. + +int PeekData(char *data, unsigned int bytes); +Peeks at the data, returns number of bytes read. + +//Packet system (for structures and classes) +void SendPack(const char *data, unsigned int bytes); +int ReadPack(char *data, unsigned int max); +int PeekPack(char *data, unsigned int max); +Similar to the raw data system above, but... you guessed it, for structures and classes. + +//String (Flash) system / Null-terminated strings +void SendStr(const string& data, char delim = '\0'); +int ReadStr(string& data, char delim = '\0'); +int PeekStr(string& data, char delim = '\0'); +Similar to above, with null terminated strings. + +Section 3: putting it all together============================================== +okay i didn't test this; this is based on ScreenPackages code (specifically +ScreenPackages::EnterURL()), which assumes you have a private EzSockets object +named m_wSocket. + +{ + // defaults + RString sProto; + RString sServer; + int iPort=80; + RString sAddress; + + m_wSocket.create(); // will create a TCP socket + m_wSocket.blocking = true; // you want to set this so that nothing else can use this socket and fuck things up + m_wSocket.connect( sServer, (short)iPort ); // connect uses an unsigned short, so a cast is needed. (int was used because of other code) check if this returns true/false, pls + + // makin' headers (using SendData with raw data; http 1.0 in this case) + RString Header=""; + + Header = "GET "+sAddress+" HTTP/1.0\r\n"; + Header+= "Host: " + Server + "\r\n"; + Header+= "Connection: closed\r\n\r\n"; + + m_wSocket.SendData( Header.c_str(), Header.length() ); + + m_wSocket.blocking = false; // once you're done, you don't need to have the socket blocking anymore + + // some other code can go here... + + m_wSocket.close(); // and if you're done, you can close the socket. } \ No newline at end of file diff --git a/Docs/Devdocs/interesting_sm4_commit_logs.txt b/Docs/Devdocs/interesting_sm4_commit_logs.txt index 99e2083e29..a8b8f0ca6b 100644 --- a/Docs/Devdocs/interesting_sm4_commit_logs.txt +++ b/Docs/Devdocs/interesting_sm4_commit_logs.txt @@ -1,26 +1,26 @@ -Notable StepMania CVS commit logs --------------------------------------------------------------------------------- -http://sourceforge.net/mailarchive/forum.php?thread_name=E1ICWkp-00073O-Ay%40mail.sourceforge.net&forum_name=stepmania-cvs -"Any given step can continue the combo, maintain the combo, break the combo, or -outright miss. Those that break the combo aren't misses and shouldn't increase -the miss counter but they should break the combo." -Yeah right it doesn't seem to do that... --------------------------------------------------------------------------------- -http://sourceforge.net/mailarchive/message.php?msg_id=E1FWjDl-0000Ob-IY%40mail.sourceforge.net -"remove unfinished, crufty multiplayer stuff" -+ -http://sourceforge.net/mailarchive/message.php?msg_id=E1FWjpV-0007eC-2G%40mail.sourceforge.net -"remove unfinished multiplayer stuff" - -Some of the multiplayer stuff was later re-assembled but I think some of the -pieces are missing. - -http://sourceforge.net/mailarchive/message.php?msg_id=E1HbPRZ-0003kC-8h%40mail.sourceforge.net -"We have two ways of only showing songs in roulette: unlocks and "#SELECTABLE". - -I'm not sure if this feature is worth keeping, but there definitely doesn't -need to be two ways to do it. Remove #SELECTABLE:ROULETTE." -________________________________________________________________________________ -Viewing old source code: -http://stepmania.cvs.sourceforge.net/stepmania/stepmania/src/ +Notable StepMania CVS commit logs +-------------------------------------------------------------------------------- +http://sourceforge.net/mailarchive/forum.php?thread_name=E1ICWkp-00073O-Ay%40mail.sourceforge.net&forum_name=stepmania-cvs +"Any given step can continue the combo, maintain the combo, break the combo, or +outright miss. Those that break the combo aren't misses and shouldn't increase +the miss counter but they should break the combo." +Yeah right it doesn't seem to do that... +-------------------------------------------------------------------------------- +http://sourceforge.net/mailarchive/message.php?msg_id=E1FWjDl-0000Ob-IY%40mail.sourceforge.net +"remove unfinished, crufty multiplayer stuff" ++ +http://sourceforge.net/mailarchive/message.php?msg_id=E1FWjpV-0007eC-2G%40mail.sourceforge.net +"remove unfinished multiplayer stuff" + +Some of the multiplayer stuff was later re-assembled but I think some of the +pieces are missing. + +http://sourceforge.net/mailarchive/message.php?msg_id=E1HbPRZ-0003kC-8h%40mail.sourceforge.net +"We have two ways of only showing songs in roulette: unlocks and "#SELECTABLE". + +I'm not sure if this feature is worth keeping, but there definitely doesn't +need to be two ways to do it. Remove #SELECTABLE:ROULETTE." +________________________________________________________________________________ +Viewing old source code: +http://stepmania.cvs.sourceforge.net/stepmania/stepmania/src/ put a filename at the end of it. \ No newline at end of file diff --git a/Docs/Devdocs/possible memory leaks.txt b/Docs/Devdocs/possible memory leaks.txt index 18a81c2999..18d4c8f61b 100644 --- a/Docs/Devdocs/possible memory leaks.txt +++ b/Docs/Devdocs/possible memory leaks.txt @@ -1,38 +1,38 @@ -as found by cppcheck against normal sm4svn source (as of 20090527), so -line numbers will be different in sm-ssc for some of these. -================================================================================== -[.\ActorFrameTexture.h:38]: (all) Memory leak: ActorFrameTexture::m_pRenderTarget - -[.\AdjustSync.h:16]: (all) Memory leak: AdjustSync::s_pTimingDataOriginal - -[.\AutoKeysounds.h:32]: (all) Memory leak: AutoKeysounds::m_pSharedSound - -[.\Font.cpp:748]: (all) Memory leak: pPage - -[.\GameSoundManager.cpp:267]: (all) Memory leak: pSound - -[.\LifeMeterTime.h:40]: (all) Memory leak: LifeMeterTime::m_pStream - -[.\MusicWheelItem.h:55]: (all) Memory leak: MusicWheelItem::m_pTextSectionCount - -[.\OptionRow.h:131]: (all) Memory leak: OptionRow::m_textTitle - -[.\PitchDetectionTestUtil.cpp:928]: (error) Mismatching allocation and deallocation: inarray -[.\PitchDetectionTestUtil.cpp:968]: (error) Mismatching allocation and deallocation: a - -[.\RageFile.cpp:377]: (all) Memory leak: pFile - -[.\RageFileDriverDeflate.cpp:533]: (all) Memory leak: mem - -[.\RageSoundReader_ChannelSplit.h:57]: (all) Memory leak: RageSoundSplitter::m_pImpl - -[.\RageSoundReader_PitchChange.h:25]: (all) Memory leak: RageSoundReader_PitchChange::m_pSpeedChange -[.\RageSoundReader_PitchChange.h:26]: (all) Memory leak: RageSoundReader_PitchChange::m_pResample - -[.\RageThreads.cpp:141]: (all) Memory leak: pLock - -[.\archutils\Unix\CrashHandlerChild.cpp:290]: (error) Resource leak: tty - -[.\crypto\CryptRSA.cpp:447]: (error) Memory leak: rsa - +as found by cppcheck against normal sm4svn source (as of 20090527), so +line numbers will be different in sm-ssc for some of these. +================================================================================== +[.\ActorFrameTexture.h:38]: (all) Memory leak: ActorFrameTexture::m_pRenderTarget + +[.\AdjustSync.h:16]: (all) Memory leak: AdjustSync::s_pTimingDataOriginal + +[.\AutoKeysounds.h:32]: (all) Memory leak: AutoKeysounds::m_pSharedSound + +[.\Font.cpp:748]: (all) Memory leak: pPage + +[.\GameSoundManager.cpp:267]: (all) Memory leak: pSound + +[.\LifeMeterTime.h:40]: (all) Memory leak: LifeMeterTime::m_pStream + +[.\MusicWheelItem.h:55]: (all) Memory leak: MusicWheelItem::m_pTextSectionCount + +[.\OptionRow.h:131]: (all) Memory leak: OptionRow::m_textTitle + +[.\PitchDetectionTestUtil.cpp:928]: (error) Mismatching allocation and deallocation: inarray +[.\PitchDetectionTestUtil.cpp:968]: (error) Mismatching allocation and deallocation: a + +[.\RageFile.cpp:377]: (all) Memory leak: pFile + +[.\RageFileDriverDeflate.cpp:533]: (all) Memory leak: mem + +[.\RageSoundReader_ChannelSplit.h:57]: (all) Memory leak: RageSoundSplitter::m_pImpl + +[.\RageSoundReader_PitchChange.h:25]: (all) Memory leak: RageSoundReader_PitchChange::m_pSpeedChange +[.\RageSoundReader_PitchChange.h:26]: (all) Memory leak: RageSoundReader_PitchChange::m_pResample + +[.\RageThreads.cpp:141]: (all) Memory leak: pLock + +[.\archutils\Unix\CrashHandlerChild.cpp:290]: (error) Resource leak: tty + +[.\crypto\CryptRSA.cpp:447]: (error) Memory leak: rsa + [.\smpackage\ZipArchive\Linux\ZipPlatform.cpp:87]: (style) Found 'mktemp'. You should use 'mkstemp' instead \ No newline at end of file diff --git a/Docs/Devdocs/rivaldata.txt b/Docs/Devdocs/rivaldata.txt index 5e1732ff9e..0fdcbb9a96 100644 --- a/Docs/Devdocs/rivaldata.txt +++ b/Docs/Devdocs/rivaldata.txt @@ -1,80 +1,80 @@ -okay what we should probabably do for rival data is fuck up stats somehow. - -Here's what rival data should have, taken from Stats.xml - -==GeneralData== -This section holds very BASIC identifying and general information. - - - AJ - 5ece7871bd060600 - faeae5b0da56509c - 2008-07-06 - - -==SongScores== -Where song scores are held. Each song has its own entry in here. - - - - - 2 - 2008-02-08 - Tier02 - - - Tier02 - 0.952000 - 3x, Overhead, delta - 2008-02-08 17:12:08 - 5ece7871bd060600 - faeae5b0da56509c - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 41 - 244 - 0 - - - - 0 - 0 - - - - - Tier03 - 0.942600 - 3x, delta - 2008-02-08 17:08:17 - 5ece7871bd060600 - faeae5b0da56509c - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 46 - 238 - 0 - - - - 0 - 0 - - - - +okay what we should probabably do for rival data is fuck up stats somehow. + +Here's what rival data should have, taken from Stats.xml + +==GeneralData== +This section holds very BASIC identifying and general information. + + + AJ + 5ece7871bd060600 + faeae5b0da56509c + 2008-07-06 + + +==SongScores== +Where song scores are held. Each song has its own entry in here. + + + + + 2 + 2008-02-08 + Tier02 + + + Tier02 + 0.952000 + 3x, Overhead, delta + 2008-02-08 17:12:08 + 5ece7871bd060600 + faeae5b0da56509c + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 41 + 244 + 0 + + + + 0 + 0 + + + + + Tier03 + 0.942600 + 3x, delta + 2008-02-08 17:08:17 + 5ece7871bd060600 + faeae5b0da56509c + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 46 + 238 + 0 + + + + 0 + 0 + + + + \ No newline at end of file diff --git a/Docs/Devdocs/versioning.txt b/Docs/Devdocs/versioning.txt index ac5f679065..5e214d5d66 100644 --- a/Docs/Devdocs/versioning.txt +++ b/Docs/Devdocs/versioning.txt @@ -1,12 +1,12 @@ -[as taken from src/ProductInfo.h] - -Version info displayed to the user. - -These are the 'official' version designations: - * "experimental: pre-release versions - * "private beta v0.0": hmm, think about it for a second there. - ==Public versions below this line== - * "v0.0 alpha #": Alpha versions (bug squashing, polishing until we reach beta) - * "v0.0 beta #": Beta versions (bug squashing, _focus_ is on high priority bugs) - * "v0.0 rc#": Release Candidates (if there are no problems, move on to final) +[as taken from src/ProductInfo.h] + +Version info displayed to the user. + +These are the 'official' version designations: + * "experimental: pre-release versions + * "private beta v0.0": hmm, think about it for a second there. + ==Public versions below this line== + * "v0.0 alpha #": Alpha versions (bug squashing, polishing until we reach beta) + * "v0.0 beta #": Beta versions (bug squashing, _focus_ is on high priority bugs) + * "v0.0 rc#": Release Candidates (if there are no problems, move on to final) * "v0.0": Final Releases \ No newline at end of file diff --git a/Docs/Licenses.txt b/Docs/Licenses.txt index 4df820042c..b720391eb4 100644 --- a/Docs/Licenses.txt +++ b/Docs/Licenses.txt @@ -1,170 +1,170 @@ -The following license applies to most of the sm-ssc additions: - -sm-ssc is copyright AJ Kelly, Midiman, shakesoda (referred to as -"the spinal shark collective" hereafter), and other contributors. -All rights reserved. - -"sm-ssc" is defined as the changes made to StepMania that do not make their -way back into the main StepMania repository for various reasons. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons to -whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT -OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -The rest of the codebase is then licensed as follows: -****************************************************************************** - -StepMania is (c) Chris Danford, the StepMania development team, et al. -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons to -whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT -OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -****************************************************************************** - -RageSurface_Load_GIF contains code from Xpaint under the following license: - - Copyright 1990, 1991, 1993 David Koblas. - Copyright 1996 Torsten Martinsen. - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that copyright notice and this permission - notice appear in supporting documentation. This software is - provided "as is" without express or implied warranty. - -****************************************************************************** - -Code in src/crypto/ is under the following permissive license: - -PuTTY is copyright 1997-2001 Simon Tatham. - -Portions copyright Robert de Bath, Joris van Rantwijk, Delian -Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, -Justin Bradford, and CORE SDI S.A. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation files -(the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE -FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -****************************************************************************** - -Code in RageSurfaceUtilsPalettize.cpp is under the following permissive -license: - -Copyright (C) 1989, 1991 by Jef Poskanzer. -Copyright (C) 1997, 2000, 2002 by Greg Roelofs; based on an idea by - Stefan Schneider. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. This software is provided "as is" without express or -implied warranty. - -****************************************************************************** - -PCRE is distributed under the 3-clause BSD license: - -Written by: Philip Hazel - -Copyright (c) 1997-2003 University of Cambridge -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the University of Cambridge nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -****************************************************************************** - -The MAD library (included with most Windows binary distributions), and -interface code in RageSoundReader_MP3, is under the GPL, available in -Copying.MAD. Support for this library can be disabled at compile-time. - -****************************************************************************** - -NotesLoaderMidi contains code from STK under the following license: - -Copyright 2003 Gary P. Scavone - -LEGAL AND ETHICAL: - -This software was designed and created to be made publicly available for -free, primarily for academic purposes, so if you use it, pass it on with -this documentation, and for free. - -On April 19 2007, StepMania was granted an MIT license by Gary Scavone -for any STK code on the condition that all of the the STK -credits/disclaimers/copyrights from the README are retained in the -source code and in the project documentation. +The following license applies to most of the sm-ssc additions: + +sm-ssc is copyright AJ Kelly, Midiman, shakesoda (referred to as +"the spinal shark collective" hereafter), and other contributors. +All rights reserved. + +"sm-ssc" is defined as the changes made to StepMania that do not make their +way back into the main StepMania repository for various reasons. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +The rest of the codebase is then licensed as follows: +****************************************************************************** + +StepMania is (c) Chris Danford, the StepMania development team, et al. +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +****************************************************************************** + +RageSurface_Load_GIF contains code from Xpaint under the following license: + + Copyright 1990, 1991, 1993 David Koblas. + Copyright 1996 Torsten Martinsen. + Permission to use, copy, modify, and distribute this software + and its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation. This software is + provided "as is" without express or implied warranty. + +****************************************************************************** + +Code in src/crypto/ is under the following permissive license: + +PuTTY is copyright 1997-2001 Simon Tatham. + +Portions copyright Robert de Bath, Joris van Rantwijk, Delian +Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, +Justin Bradford, and CORE SDI S.A. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +****************************************************************************** + +Code in RageSurfaceUtilsPalettize.cpp is under the following permissive +license: + +Copyright (C) 1989, 1991 by Jef Poskanzer. +Copyright (C) 1997, 2000, 2002 by Greg Roelofs; based on an idea by + Stefan Schneider. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided +that the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. This software is provided "as is" without express or +implied warranty. + +****************************************************************************** + +PCRE is distributed under the 3-clause BSD license: + +Written by: Philip Hazel + +Copyright (c) 1997-2003 University of Cambridge +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +****************************************************************************** + +The MAD library (included with most Windows binary distributions), and +interface code in RageSoundReader_MP3, is under the GPL, available in +Copying.MAD. Support for this library can be disabled at compile-time. + +****************************************************************************** + +NotesLoaderMidi contains code from STK under the following license: + +Copyright 2003 Gary P. Scavone + +LEGAL AND ETHICAL: + +This software was designed and created to be made publicly available for +free, primarily for academic purposes, so if you use it, pass it on with +this documentation, and for free. + +On April 19 2007, StepMania was granted an MIT license by Gary Scavone +for any STK code on the condition that all of the the STK +credits/disclaimers/copyrights from the README are retained in the +source code and in the project documentation. diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 634915d001..d489f9638b 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1,1997 +1,1997 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sm-ssc v1.2.3 - 2011-03-15 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sm-ssc v1.2.3 + 2011-03-15 + diff --git a/Docs/Luadoc/Lua.xsl b/Docs/Luadoc/Lua.xsl index f4adcbbf4d..69ffebfcde 100644 --- a/Docs/Luadoc/Lua.xsl +++ b/Docs/Luadoc/Lua.xsl @@ -1,692 +1,692 @@ - - - - - - - -This file is automatically generated. Do not edit it. - - - sm-ssc Lua Information - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
Sections
SingletonsClassesNamespacesGlobal FunctionsEnumsConstants
-
-
-
- Function Colors -
Available in SM4 baseline and sm-ssc
-
Renamed or otherwise modified in sm-ssc
-
Available in sm-ssc only (compared to StepMania 4 alpha 5)
-
Defined in sm-ssc's _fallback theme
-
Defined in sm-ssc's default theme
-
-
- - - - - - -
- - -
- - - -
-

Singletons

- -
-
- - - -
-

Classes

- - - -
-
- - -
-

Namespaces

- - - -
-
- - - - - -
- - - Class - - - - : - - - - - -
-
- - - -
- - - Namespace - - - -
-
- - -
-

Global Functions

- - - - - - - -
Functions
-
-
- - - - - - { - - - - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ... - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - renamed - sm-ssc - _fallbackTheme - defaultTheme - descriptionCell - - - - - - - - - - - - - - ( - - - - ) - -

- - - -

- -
- - - - - - sm-ssc - descriptionCell - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - () - - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - () - - - -
-

Enums

- - - -
-
- - - - -
- - - Enum - - -
-
- - - -

- - - -

-
- - -
-

Constants

- - - - - - - - - - - - -
ConstantValue
- - -
-
-
-
- - - - - - - - - - -
-
- + + + + + + + +This file is automatically generated. Do not edit it. + + + sm-ssc Lua Information + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
Sections
SingletonsClassesNamespacesGlobal FunctionsEnumsConstants
+
+
+
+ Function Colors +
Available in SM4 baseline and sm-ssc
+
Renamed or otherwise modified in sm-ssc
+
Available in sm-ssc only (compared to StepMania 4 alpha 5)
+
Defined in sm-ssc's _fallback theme
+
Defined in sm-ssc's default theme
+
+
+ + + + + + +
+ + +
+ + + +
+

Singletons

+ +
+
+ + + +
+

Classes

+ + + +
+
+ + +
+

Namespaces

+ + + +
+
+ + + + + +
+ + + Class + + + + : + + + + + +
+
+ + + +
+ + + Namespace + + + +
+
+ + +
+

Global Functions

+ + + + + + + +
Functions
+
+
+ + + + + + { + + + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ... + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + renamed + sm-ssc + _fallbackTheme + defaultTheme + descriptionCell + + + + + + + + + + + + + + ( + + + + ) + +

+ + + +

+ +
+ + + + + + sm-ssc + descriptionCell + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + () + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + () + + + +
+

Enums

+ + + +
+
+ + + + +
+ + + Enum + + +
+
+ + + +

+ + + +

+
+ + +
+

Constants

+ + + + + + + + + + + + +
ConstantValue
+ + +
+
+
+
+ + + + + + + + + + +
+
+ diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 7f33265edb..cf44a947be 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -1,3425 +1,3425 @@ - - - - - - - - - - - [02 StageMods.lua] - - - [02 StageMods.lua] - - - Issues an error when v is false (or nil). Returns all arguments otherwise. sAssertMessage is an optional error message (the default is "assertion failed!"). - - - Returns the base name of file path. - - - [02 Colors.lua] - - - [03 HSV.lua] - - - [03 Gameplay.lua] - - - CLAMP is an all-female Japanese mangaka group that formed in the mid 1980s. Erm, I mean... Clamps fValue between fLow and fHigh. - - - Closes any connection to an online server. - - - A generic interface to Lua's garbage collector. Performs different functions based on the value of opt. - - - Returns a color from a string. color can be in - hex ("#FFFFFFFF") or 0..1 values ("1.0,1.0,1.0,1.0"), - in RGBA order. - - - [03 Gameplay.lua] Determines what TapNoteScore allows for continuing the combo. - - - [03 Gameplay.lua] Determines what TapNoteScore allows for maintaining the combo. - - - [03 Gameplay.lua] Determines if combo should be per row (Jump = 1) or per column (Jump = 2). - - - Tries to connect to the server at sAddress. - - - Returns the current day of the month. - - - Returns the current day of the year. - - - [01 base.lua] "Override Lua's dofile to use our loadfile." - - - [02 Utilities.lua] Find a key in tab with the given value. - - - [02 Utilities.lua] Return the index of a true value in list. - - - Returns the number passed to the function followed by its suffix ("th", "nd", and so on). - - - Returns fPercentDancePoints formatted as a percentage. - - - [03 Gameplay.lua] Returns a list of valid styles for the current gametype. - - - Returns the corresponding CustomDifficulty string for a StepsType/Difficulty (/optional CourseType) combination. - - - [03 EnvUtils2.lua] Returns the value of name from the Env table. - - - [03 Gameplay.lua] Returns the number at which the Extra color should be used. - - - Returns a corresponding for the given percentage. - - - Returns the current Life Difficulty. - - - Returns a string representing the name of the operating system being used. (e.g. "Xbox", "Windows", "Linux", "Mac, "Unknown") - - - [03 ThemePrefs.lua] Returns true if player pn is using ProTiming. - - - Returns the theme's aspect ratio. - - - [03 UserPreferences2.lua] Themer-facing function for getting a user preference. - - - [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a boolean. - - - [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a color. - - - [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a number. - - - Returns the current hour. - - - [03 ThemePrefs.lua] Initializes various user preferences. - - - [03 ProductivityHelpers.lua] Returns true if the coin mode is not set to CoinMode_Home. - - - Returns true if Event Mode is turned on. - - - [03 ProductivityHelpers.lua] Returns true if Arcade and the coin mode is CoinMode_Free. - - - [03 ProductivityHelpers.lua] Returns true if the coin mode is set to CoinMode_Home. - - - Returns true if connected to the Internet. - - - Returns true if connected to StepMania Online. - - - Returns true if Player pn is logged on to - a SMOnline server. - - - [04 WidescreenHelpers.lua] Returns true if the aspect ratio is 16:10 (1.6) or higher. - - - [01 base.lua] "Like ipairs(), but returns only values." - - - [02 Utilities.lua] Joins a table, splitting each item with delimiter, returning a string of the results. - - - Returns an Actor definition for the actor at sPath. If sPath points to a Lua file, any additional arguments will be passed to that script. - - - [02 ActorDef.lua] Loads an actor template. This is the actual core of LoadActor. - - - [02 ActorDef.lua] Loads an actor with params. - - - [01 base.lua] "Override Lua's loadfile to use lua.ReadFile." - - - [02 ActorDef.lua] Load the fallback BGA for the element that is currently being loaded. - - - [02 ActorDef.lua] Loads a font. - - - [02 Sprite.lua] Returns a Sprite with the current song's background. - - - Returns the current Minute. - - - Returns the current month of the year. - - - Returns Month m as a localized string. - - - Returns Month m as a string. - - - [03 ProductivityHelpers.lua] Converts a PlayerNumber into a short string (e.g. "P1", "P2"). - - - [00 init.lua] - - - [02 ActorDef.lua] - - - [03 UserPreferences2.lua] (internal) Reads the specified user preference from its config file. - - - [02 Utilities.lua] Round a number. - - - [03 Gameplay.lua] Returns the primary ScoreKeeper class to use. - - - Returns the current second. - - - Converts fSecs to Minutes:Seconds.Milliseconds format. - - - [02 Branches.lua] Determines the correct music/course selection screen to use and returns it. - - - [03 Gameplay.lua] (soon to be deprecated) Returns a list of codes to use on ScreenSelectProfile. - - - [03 EnvUtils2.lua] Sets the value of name to value in the Env table. - - - [03 UserPreferences2.lua] Themer-facing function for setting a user preference. - - - [02 ActorDef.lua] Returns true if a decoration should be shown on the current screen or not. - - - [02 Utilities.lua] Splits a string at every occurence of delimiter, returning a table of the results. - - - [02 ActorDef.lua] - - - [02 ActorDef.lua] - - - [02 ActorDef.lua] - - - [02 Utilities.lua] Look up each value in a table, returning a table with the resulting strings. - - - [02 TextBanner.lua] This function defines how the TextBanner is laid out. - - - [03 ProductivityHelpers.lua] Converts a string or number to a bool. - - - [02 Enum.lua] Returns a string representing an enum starting from '_'. For example, passing PlayerNumber_P1 to this function will return P1. - - - [00 init.lua] Alias for . - - - [01 base.lua] Alias for lua.GetThreadVariable. - - - [00 init.lua] Alias for . - - - [04 WidescreenHelpers.lua] Depending on the screen width, scales between ar43 (4:3; 640px) and ar169 (16:9; 854px). - - - [02 ActorDef.lua] Wraps the children in an ActorFrame. - - - [03 UserPreferences2.lua] (internal) Writes user preference prefName to its config file with value being tostring'd. - - - Returns the current year. - - - Returns the length of the multi-byte character string sString. - - - - Returns the name of the currently connected server. - - - Converts fSecs to Minutes:Seconds:Milliseconds format using two digits for each section. - - - Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section. - - - Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section except Milliseconds (uses 3). - - - Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section except Minutes (uses 1). - - - Converts fSecs to Minutes:Seconds format. - - - Returns a string with characters escaped for URLs. (e.g. a space becomes '%20') - - - - [03 CustomSpeedMods.lua] Returns a Lua option row with the custom speed mods defined in SpeedMods.txt. - - - - [04 FileUtils.lua] Reads the file at path and returns its contents. - - - [04 FileUtils.lua] Writes buf to the file at path. - - - - [03 ThemePrefs.lua] Returns a Lua option row for ProTiming. - - - [03 ThemePrefs.lua] Returns a Lua option row for toggling AutoSetStyle. - - - [03 ThemePrefs.lua] Returns a Lua option row for displaying the score on ScreenGameplay. - - - [03 ThemePrefs.lua] Returns a Lua option row for displaying the StepsDisplay on ScreenGameplay. - - - [03 ThemePrefs.lua] Returns a Lua option row for determining the fail length. - - - [03 ThemePrefs.lua] Returns a Lua option row for determining the receptor arrow position. - - - [03 ThemePrefs.lua] Returns a Lua option row determining how deep the player options menu should go. - - - - - - - - Returns true if sClassName is a registered Class. - - - - - Enumerated types are lookup tables associating a string to each numerical - value for each Enum. For example, - [1] would be the - string 'PlayerNumber_P1'.
- The functions defined in the Enum namespace are valid member - functions of every Enum where the first argument is - omitted and the name of the Enum is used in place - of Enum. Instead of - Enum.GetName( - ) or - Enum.Reverse( - ), one can use - :GetName() or - :Reverse(), respectively. -
- - Both x and y need to be elements of the enumerated - type e. Returns a value less than/greater than/equal to - 0 corresponding to the numerical value of x being - less than/greater than/equal to the numerical value of y as - determined by - Enum.Reverse( e ). - - - Returns the type of e. For example, - Enum.GetName( ) - will return the string 'PlayerNumber'. - - - Returns a reverse lookup table for the enumerated type e. For - example:
local r = - Enum.Reverse( );
- local n = r['PlayerNumber_P2'];

- The value of n in this case would be 1 corresponding - to the 0-based indexing using in C++ and not 2 as might be - expected for the 1-based indexing used in Lua. -
-
- - - Writes sString to log.txt. Aliased by - . - - - Writes sString to info.txt and log.txt as - a warning. Aliased by . - - - Flushes log files to disk. - - - - - Creates a RageFile handle with which one can use the commands in . - - - - - Gets the credits message for Player pn. - - - - - Returns true if the song's steps (st) are playable. - - - Returns true if the song's StepsType (st) are playable. - - - - - Returns the number of songs in a Trail. - - - Returns the Trail's total length in seconds. - - -
- - - - - - Returns the Actor's parent, or nil if it doesn't have one. - - - Returns the Actor's visibility. - - - Returns the Actor's x position. - - - Returns the Actor's y position. - - - Returns the Actor's z position. - - - Returns the Actor's zoom. - - - Returns the Actor's X zoom. - - - Returns the Actor's Y zoom. - - - Returns the Actor's Z zoom. - - - Sets Texture Filtering for an Actor to b. - - - Plays the commands that follow at an accelerated rate (fRate * fRate), where fRate is in seconds. - - - Adds rot to the Actor's current x rotation. - - - Adds rot to the Actor's current y rotation. - - - Adds rot to the Actor's current z rotation. - - - Adds xPos to the Actor's current x position. - - - Adds yPos to the Actor's current y position. - - - Adds zPos to the Actor's current z position. - - - [02 Actor.lua] Sets the alignment of an Actor, where h and v are in the range 0..1. - - - Sets whether or not the Actor should animate. - - - Sets the Actor's aux value. (This can be a solution for coupling data with an Actor.) - - - If true, cull the Actor's back faces. See also: . - - - Sets the Actor's base alpha to fAlpha, where fAlpha is in the range 0..1. - - - Sets the Actor's base X rotation to rot. - - - Sets the Actor's base Y rotation to rot. - - - Sets the Actor's base Z rotation to rot. - - - Sets the Actor's base zoom to zoom. - - - Sets the Actor's base X zoom to zoom. - - - Sets the Actor's base Y zoom to zoom. - - - Sets the Actor's base Z zoom to zoom. - - - Sets the Actor to use the specified blend mode. - - - Makes the Actor bob up and down. Can use to define different bobbing behavior. - - - Makes the Actor bounce, similar to bob but with one point acting as the ground. Can use to define different bouncing behavior (with effectmagnitude values relating to x, y, and z movement). - - - [02 Actor.lua] - - - [02 Actor.lua] - - - [02 Actor.lua] Centers an Actor. - - - Crops percent of the Actor from the bottom, where percent is in the range 0..1. - - - Crops percent of the Actor from the left, where percent is in the range 0..1. - - - Crops percent of the Actor from the right, where percent is in the range 0..1. - - - Crops percent of the Actor from the top, where percent is in the range 0..1. - - - Sets the Actor's cull mode to mode. - - - Plays the commands that follow at an decelerated rate (1 - (1-fRate) * (1-fRate)), where fRate is in seconds. - - - Set the Actor's diffuse color to c. - - - Sets the Actor's alpha level to fAlpha, where fAlpha is in the range 0..1. - - - Sets the Actor's bottom edge color to c. - - - Set the Actor's diffuse color to c, ignoring any alpha value in c. - - - Sets the Actor's left edge color to c. - - - Sets the Actor's lower left corner color to c. - - - Sets the Actor's lower right corner color to c. - - - Sets the Actor's right edge color to c. - - - Sets the Actor's top edge color to c. - - - Sets the Actor's upper left corner color to c. - - - Sets the Actor's upper right corner color to c. - - - Sets the Actor's draworder to iOrder, where larger values display first. - - - [02 Actor.lua] (Added in sm-ssc) - - - [02 Actor.lua] - - - Set the Actor's effect clock to s. - - - Sets the first effect color to c. - - - Sets the second effect color to c. - - - Set the Actor's effect magnitude in each direction to the given values. - - - Set the Actor's effect offset to fTime. - - - Set the Actor's effect period to fTime. - - - Set the Actor's effect timing. - - - Fades percent of the Actor from the bottom where percent is in the range 0..1. - - - Fades percent of the Actor from the left where percent is in the range 0..1. - - - Fades percent of the Actor from the right where percent is in the range 0..1. - - - Fades percent of the Actor from the top where percent is in the range 0..1. - - - Finishes up an Actor's tween immediately. - - - [02 Actor.lua] Stretches an Actor to fill the entire screen. - - - Returns the Actor's aux value. - - - Returns the Actor's base X zoom value. - - - Returns the Actor's base Y zoom value. - - - Returns the Actor's base Z zoom value. - - - Returns true if the Actor has a command named sCmdName. - - - Returns the Actor's current diffuse color. - - - Returns the Actor's current diffusealpha. - - - Returns the Actor's current effect delta. - - - Returns the Actor's current effect magnitude as three floats (not one; I hate Lua.xsd). - - - Returns the Actor's current glow color. - - - Returns the Actor's horizontal alignment as a number in the range 0..1. - - - Returns the Actor's name. - - - Returns the number of states the Actor has. - - - Returns the Actor's current height. - - - Returns the Actor's current X rotation. - - - Returns the Actor's current Y rotation. - - - Returns the Actor's current Z rotation. - - - Returns the number of seconds into the currently running effect (e.g. diffuseshift, bob). - - - Returns how much time is remaining for the current tween. - - - Returns the Actor's vertical alignment as a number in the range 0..1. - - - Returns the Actor's current width. - - - Returns the zoomed height of an Actor. - - - Returns the zoomed width of an Actor. - - - Sets the Actor's glow color. - - - - - - Set the fractional horizontal alignment of the Actor according to fAlign which should be a float in the range 0..1. An alignment of 0 is left aligned while an alignment of 1 is right aligned. See for the common case. - - - Hides the Actor for the specified amount of time. - - - [Deprecated] Compatibility alias for the hidden command, which was removed in sm-ssc. Use instead. - - - [02 Actor.lua] "Hide if b is true, but don't unhide if b is false." - - - Set the horizontal alignment of the Actor according to align. See for fractional alignment. - - - Hurries up an Actor's tweening by factor. - - - Plays the commands that follow at a normal rate, where fRate is in seconds. - - - [02 Lyrics.lua] Plays the lyric command for the specified side ("Back" or "Front"). - - - Sets the Actor's name to sName. - - - Stops the Actor's movement. (Usually used for Sprites or Models.) - - - Starts the Actor's movement. (Usually used for Sprites or Models.) - - - Plays a command named sCommandName. - - - [02 Actor.lua] Sets the visibility of the Actor based on p being a human player. - - - Makes the Actor grow and shrink. Can use to define different pulsing behavior. - - - Queues a command named sCommandName to be played. - - - Basically creates a command named !sMessageName (Note the ! at the beginning. The source code says this: "Hack: use "!" as a marker to broadcast a command, instead of playing a command, so we don't have to add yet another element to every tween state for this rarely-used command.") - - - Makes the Actor change colors continually using colors of the rainbow. - - - Set the Actor's rotation on the X axis to fAlign. - - - Set the Actor's rotation on the Y axis to fAlign. - - - Set the Actor's rotation on the Z axis to fAlign. - - - [02 Actor.lua] An alternative version of . - - - [02 Actor.lua] - - - Scales the Actor to cover a rectangle defined by the four float arguments. - - - Scales the Actor to fit inside a rectangle defined by the four float arguments. - - - Sets the height of the Actor. - - - Sets the size of the Actor. - - - [01 alias.lua] Alias for setsize. - - - Sets a multi-framed Actor's state to iNewState. - - - Sets the width of the Actor. - - - Sets the shadow's color to c. - - - Sets the Actor's shadow length to fLength. - - - Sets the Actor's horizontal shadow length to fLength. - - - Sets the Actor's vertical shadow length to fLength. - - - Skews the Actor on the x axis by fAmount. - - - Skews the Actor on the y axis by fAmount. - - - Waits fSeconds before executing the next command. - - - [02 Actor.lua] - - - Tells the Actor to spin. Can use to define different spinning behavior. - - - Stops any effect the Actor has. - - - Stretches the Actor to a rectangle of a specific size. - - - Set the fractional vertical alignment of the Actor according to fAlign which should be a float in the range 0..1. An alignment of 0 is top aligned while an alignment of 1 is bottom aligned. See for the common case. - - - Set the vertical alignment of the Actor according to align. See for fractional alignment. - - - Makes the Actor vibrate violently. Can use to define different vibration behavior. - - - Sets an Actor's visibility to b. - - - Set the x position of the Actor to xPos. - - - Set the y position of the Actor to yPos. - - - Set the z position of the Actor to zPos. - - - Zooms the Actor to zoom scale. - - - Zooms the Actor on both the X and Y axis using zoomX and zoomY. - - - Zooms the Actor to zoom height. See also: . - - - Zooms the Actor to zoom width. See also: . - - - Zooms the Actor to zoom scale on the X axis. - - - Zooms the Actor to zoom scale on the Y axis. - - - Zooms the Actor to zoom scale on the Z axis. - - - - [02 Actor.lua] - - - [03 ProductivityHelpers.lua] Centers an Actor on the X axis. (equivalent to x,SCREEN_CENTER_X) - - - [03 ProductivityHelpers.lua] Centers an Actor on the y axis. (equivalent to y,SCREEN_CENTER_Y) - - - [03 ProductivityHelpers.lua] A customized version of pulse that is more appealing for on-beat effects. - - - [03 ProductivityHelpers.lua] Sets and Actor as a mask destination. - - - [03 ProductivityHelpers.lua] Sets an Actor as a mask source. (Also clears zbuffer; other mask sources need to not clear the zbuffer) - - - [03 ProductivityHelpers.lua] Make graphics their true size at any resolution. - - - [03 ProductivityHelpers.lua] Scale things back up after they have already been scaled down. - - - [03 ProductivityHelpers.lua] A customized version of pulse that is more appealing for on-beat effects. - - - [03 ProductivityHelpers.lua] Sets the x and y location of the Actor in one command. - - - - - Sets the field of view for the ActorFrame. - - - Returns the child with a name of sName. - - - Returns a table of all the children in the ActorFrame. - - - Gets the ActorFrame's Draw function. - - - Returns the number of children in the ActorFrame. - - - Plays the sCommandName command on the ActorFrame's children. - - - Plays the sCommandName command on the ActorFrame's leaves. - - - Sets if the Actorframe should propagate commands to its children. - - - [02 Actor.lua] Propagates a command to the ActorFrame's children. - - - Runs the commands in cmds on the ActorFrame's children. - - - Runs the commands in cmds on the ActorFrame's leaves. - - - Sets the ActorFrame's ambient light color to c. - - - Sets the ActorFrame's diffuse light color to c. - - - Sets if the ActorFrame should draw by Z position. - - - Sets the ActorFrame's Draw function to the specified Lua function. - - - Sets the field of view for the ActorFrame. - - - Currently unimplemented since it does not handle errors correctly. Arguments must be passed in as a table. - - - Sets the ActorFrame's specular light color to c. - - - Sets the ActorFrame's update function to the specified Lua function. - - - Sets the update function's rate to fRate. - - - Tells the ActorFrame to sort by draw order. - - - Sets the vanishing point for the ActorFrame. - - - - - Clears all the textures from the MultiTexture. - - - Sets the EffectMode on the MultiTexture. - - - Sets a TextureMode on the specified index. - - - - - Returns the target of the ActorProxy. - - - Sets the ActorProxy target to a. - - - - - Returns the scroller's current item. - - - Returns the item the scroller's going to. - - - Returns how long it will take for the scroller to completely scroll through all its items. - - - Returns the number of items in the ActorScroller. - - - Returns the number of seconds until the scroller reaches its destination. - - - Compatibility alias for . - - - Positions the scroller items. - - - Scrolls through all the items in the scroller. - - - Compatibility alias for . - - - Scrolls through all the items in the scroller with padding at the beginning and end. - - - Compatibility alias for . - - - Sets the item the scroller should scroll to next and makes it the current item. - - - Sets the item the scroller should scroll to next. - - - Sets if the scroller should catch up fast. - - - Compatibility alias for . - - - Specifies if the scroller should loop or not. - - - Sets the scroller's mask to a Quad that is fWidth by fHeight pixels. - - - Sets the scroller to draw fNumItems items. - - - Sets the number of subdivisions in the scroller. - - - Compatibility alias for . - - - Sets the scroller's pause countdown to fSecs. - - - Sets the scroller's pause between items to fSeconds. - - - Sets how many seconds the scroller should spend on each item.
- A value of 0 means the scroller will not scroll. -
- - Compatibility alias for . - - - Sets the scroller's transform function to the specified Lua function. - - - Sets the scroller's transform function from fItemHeight. - - - Sets the scroller's transform function from fItemWidth. - -
- - - This Actor represents a playable sound. There are two attributes that can be set on load.
- * SupportPan - Let the sound pan from side to side.
- * SupportRateChanging - Let the sound change rate and pitch. -
- - Returns the that can be played by this Actor. - - - Loads the sound at sPath. - - - Pauses or unpauses the sound based on bPause. - - - Plays the sound. - - - [02 Sound.lua] Plays the sound on the given player's side. You must set SupportPan = true on load. - - - Stops the sound. - -
- - - Returns true if Announcer sAnnouncer exists. - - - Returns a table of installed announcers. - - - Returns the current announcer's name. - - - Sets the announcer to sNewAnnouncer. - - - - - Returns true if the Banner is currently scrolling. - - - - - - Loads the background from an UnlockEntry. - - - Loads the banner from an UnlockEntry. - - - Loads the card image from the specified Character. - - - - - - Loads a Banner from a specified Course. - - - Loads a Banner from a specified Song. - - - Loads a Banner from a specified Song Group. - - - Loads a Banner from a specified SortOrder. - - - Loads an icon from the specified Character. - - - See . - - - See . - - - - - - - - Add the attribute attr to the string at position - iPos.
- The attribute is a table that must contain Length - which specifies how many (multi-byte) characters the attribute - is to apply. If Length=-1, then the attribute applies - until another attribute overrides it.
- If the table contains Diffuse, then the color value - is applied to the range of text.
- If the table contains Diffuses, then it should be - an array of 4 colors which specify the diffuse color for the - top left, top right, bottom left, and bottom right.
- If the table contains Glow, then the color value - is applied as a glow to the range of text.
- Example:
- attr = { Length = 10; Diffuse = color("#AABBCC"); } -
- - Clear all attributes associated with the BitmapText. - - - [03 ProductivityHelpers.lua] Sets the diffuse and stroke color of text in one command. - - - Returns the text that is currently set. - - - If bJitter is true, move each character of the string around by a small random amount. - - - Set the maximum height of the unzoomed text to fHeight. If fHeight is 0, then there is no maximum height. - - - Set the maximum width of the unzoomed text to fWidth. If fWidth is 0, then there is no maximum width. - - - [03 ProductivityHelpers.lua] Remove any stroke color. - - - [03 ProductivityHelpers.lua] Alias for setting to false. - - - If true, set each character of the text in turn to the rainbow colors in the metrics BitmapText::RainbowColor#. - - - Set the text to sText. This clears all attributes. - - - [03 ProductivityHelpers.lua] Sets text using string.format(sFormat, ...). - - - [03 ProductivityHelpers.lua] Alias for . - - - Sets the stroke color to c. - - - If the text is glowing, specify if just the stroke layer, just the inner layer, or both are affected by the glow. - - - If true, make all text uppercase. - - - Add iSpacing pixels of padding between lines of text. - - - Wrap the unzoomed text at iWidth pixels. If you or by x and you want the text wrapped at width, then you should use wrapwidthpixels(width/x). - -
- - - Returns the text that is currently set at the exact moment you call it. This is likely only going to be useful in an Update command. - - - Sets the BPMDisplay from the GameState. - - - - - Returns the path to the character's card graphic. - - - Returns this character's directory. - - - Returns this character's ID. - - - Returns the path of the dancing animation of this character. - - - Returns the character's display name. - - - Returns the path to the character's icon. - - - Returns the path of the model of this character. - - - Returns the path of the rest animation of this character. - - - Returns the path to the character's ScreenSelectMode icon. - - - Returns the path to the character's ScreenStage icon. - - - Returns the path of the warm-up animation of this character. - - - - - Returns a table of all characters installed. - - - Return the corresponding to sID. - - - Returns a random character. - - - - - Loads the ComboGraph commands from the Metrics in group sMetricsGroup. - - - Sets the values of the ComboGraph using the specified StageStats and PlayerStageStats. - - - - - Loads the ControllerStateDisplay from the specified GameController. - - - Loads the ControllerStateDisplay from the specified MultiPlayer. - - - - - Returns a table of all the Trails in the Course. - - - Returns the path to the Course's background. - - - Returns the path to the Course's banner. - - - Returns the Course's directory. - - - Returns a table of CourseEntry items. - - - Gets the CourseEntry at iIndex from the Course. - - - Returns the Course's . (Returns CourseType in sm-ssc; integer in SM4) - - - Returns the full display title of the Course. - - - Returns the estimated number of stages for the Course. - - - Returns the goal seconds for the Course. - - - Returns the Course's group name. - - - Returns the Course's . (Returns PlayMode in sm-ssc; integer in SM4) - - - Returns the total length of the Course in seconds. - - - Returns the full transliterated title of the Course. - - - Returns true if the Course has a background. - - - Returns true if the Course has a banner. - - - Returns true if the Course has modifiers. - - - Returns true if the Course has timed modifiers. - - - Returns true if the Course is an edit. - - - Returns true if the Course was automatically generated. - - - Returns true if the Course is Endless. - - - Returns true if the Course is Nonstop. - - - Returns true if the Course is Oni. - - - - - Sets the CourseContentsList from the GameState. - - - - - Returns the Song that this CourseEntry corresponds to. - - - - Returns the number of lives gained after completing the song. - - - Returns the number of seconds gained after completing the song. - - - Returns any stage (non-timed) modifiers. - - - Returns the number of modifier changes in this CourseEntry. - - - Returns a comma-delimited string representing various facts about the CourseEntry. - - - Returns true if this CourseEntry is a fixed song. - - - Returns true if this CourseEntry is secret. - - - - - Returns the MD5 hash for the file at sPath. - - - Returns the MD5 hash for s. - - - Returns the SHA-1 hash for s. - - - - - Sets the DifficultyIcon's state from the difficulty passed in. - - - Sets the DifficultyIcon's Player to pn, - then sets the DifficultyIcon's state from the difficulty of Steps pSteps - - - Sets the DifficultyIcon's Player to pn, - then sets the DifficultyIcon's state from the difficulty of Trail pTrail - - - Sets the DifficultyIcon's Player to pn. - - - Blanks the DifficultyIcon. - - - - - Sets the StepsDisplayList from the GameState. - - - - - Returns the name of the game such as "dance" or "pump". - - - - - Returns any Character associated with this item (or nil if there isn't one). - - - Returns any Course that may have been set. - - - Returns the index of this item. - - - Returns any MultiPlayer that may have been set. - - - Returns the choice name. - - - Returns any Profile ID that may have been set. - - - Returns any screen that may have been set as a string. - - - Returns any Song that may have been set. - - - Returns the name of any song group that may have been set. - - - Returns any Steps that may have been set. - - - Returns any Style that may have been set. - - - Returns the display text. - - - Returns any Trail that may have been set. - - - Returns any Url that may have been set. - - - - - Return the first for the specified game. - - - Returns true if any noteskins exist for the specified Game s. - - - Return the localized string representation of st. - - - - - Set the music volume to fVolume for fDuration seconds. - - - - Return the sound balance for pn. - - - Play the sound at sPath one time. - - - - - Returns true if any player has performed a feat worthy of ranking. - - - The second argument is optional. Apply the GameCommand represented by sCommand - for pn, if given. See . - - - Returns true if enough credits have been inserted to join. - - - fishpolk.mid; See also: Rise of the Triad - - - Returns the environment table. See . - - - Returns the current for the specified . - - - Returns the current . - - - Return the number of inserted but unused coins. This number is - decremented when players join. - - - Return the number of coins needed to join based on the current coin and premium modes - as well as the number of people joined, if that matters for the premium mode. See - and . - - - The s in a are numbered sequentially - starting from 0. Return the number of the current . - - - Return the current number of seconds that have passed in the current song. This value can be negative. - - - Return the current . - - - Return the current . - - - Return the current . - - - Return the current . - - - Returns the current stage index (starts at 0). - - - Return the current for the specified Player. - - - Return a variable number of arguments based on the being - played by all players. For each distinct being played by - the players, in increasing order, - the difficulty and description of the is returned as strings. -
For example,
- local credits = {GAMESTATE:GetCurrentStepsCredits()};
- will make a table of the difficulties and descriptions. -
- - Return the current . - - - Return the current for the specified player. - - - Return a string representation of the default song options. - - - Return the easiest of the - currently selected steps by all players. For example, if player 1 has - selected Hard steps and player 2 has selected Medium steps, Medium will - be returned. - - - - - - - Return the Edit Local or nil if - it does not exist. - - - - - - Return the source for the editor or nil - if it does not exist. - - - Return the random seed for the game. - - - Return true if the gameplay lead in is enabled. If - false, gameplay begins immediately. - - - Return the hardest of the - currently selected steps by all players. For example, if player 1 has - selected Hard steps and player 2 has selected Medium steps, Hard will - be returned. - - - Returns an array of s corresponding to Human players. - - - Returns the master player number. - - - Returns true if the game is Multiplayer. - - - Returns the number of active multiplayer NoteFields. - - - Returns the number of players enabled. - - - Returns the number of sides joined. - - - Returns the number of stages for the current Song and its Steps or the current Course. - - - Returns the number of stages left for player pn. - - - Returns the display name for player pn. - - - Returns the PlayerState for player pn. - - - Returns the current PlayMode. - - - Returns the preferred difficulty. - - - Returns the preferred song. - - - Returns the preferred song group. - - - Returns the current Premium. - - - - Returns the current beat of the song. - - - Returns the current visible beat of the song. - - - Returns the song's current beats per second. - - - Returns true if a delay is active in the song. - - - Returns true if the song is currently in a freeze. - - - Returns the song options for the specified ModsLevel as a string. - - - Returns the song options as a string. - - - Returns how much of the song is through at beat fBeat. - - - Returns the current SortOrder. - - - Returns the current stage index. - - - Return the random seed for the current stage. - - - Returns true if the workout goal is complete. - - - Returns true if an extra stage was earned. - - - Returns true if this is an extra stage. - - - Returns true if any human player is using a memory card. - - - Returns true if playing in Battle mode. - - - Returns true if playing in a Course mode. - - - Returns true if in Demonstration mode. - - - Returns true if the match was a draw. - - - Returns true if Event Mode is on, temporary or otherwise. - - - Returns true if this is the first extra stage. - - - Returns true if this is the second extra stage. - - - Returns true if player pn has completed the current Goal. - - - Returns true if player pn is human. - - - Returns true if player pn is enabled. - - - Returns true if player pn has joined the game. - - - Returns true if player pn is the winner. - - - Joins player pn. - - - Returns true if player pn is using modifier sModifier. - - - Returns true if players can join the game. - - - Resets the GameState. - - - Saves the bookkeeping and machine profile data. - - - Sets the current for the specified . - - - Sets the current Course to course. - - - Sets the current Song to song. - - - Sets Player pn's current Steps to steps. - - - Sets the current Trail to trail. - - - Sets if the Jukebox should use modifiers. - - - - - - Sets the number of multiplayer notefields to iFields - - - Sets the preferred difficulty of Player pn to Difficulty dc. - - - Sets the preferred Song to song. - - - Sets the preferred song group to sGroup. - - - Sets the Song Options from so using ModsLevel m. - - - Turns temporary Event Mode on or off, depending on bOn. - - - Determines if Judgment W1 should be shown based on bOn. - - - Unjoins player pn. - -
- - - Loads the GradeDisplay commands from the Metrics in group sMetricsGroup. - - - Sets the GradeDisplay to show Grade g. - - - - - Loads the GraphDisplay commands from the Metrics in group sMetricsGroup. - - - Sets the values of the GraphDisplay using the specified StageStats and PlayerStageStats. - - - - - Sets the GrooveRadar values for Player pn to empty. - - - Sets the GrooveRadar values for Player pn from RadarValues rv - - - Tweens the GrooveRadar off screen. - - - Tweens the GrooveRadar on screen. - - - - - Returns two tables representing the tips and alternate tips in the HelpDisplay. - - - Sets the seconds between switches of tips to fSeconds. - - - Sets the HelpDisplay's tips using tips (and optionally altTips). - - - Sets the HelpDisplay's text from sTips using colons to separate new sections. - - - - - Returns the date and time the high score was achieved. - - - Returns the Grade of this high score. - - - Return the number of HoldNoteScores that match hns. - - - Returns the modifiers used for this HighScore. - - - Returns the name associated with the high score. - - - Returns the percentage of dance points associated with the high score. - - - Returns the RadarValues for this HighScore. - - - Returns the score associated with the high score. - - - Returns the number of seconds survived associated with the high score. - - - Return the number of TapNoteScores that match tns. - - - - - You can get a HighScoreList using . - - - Returns a table of the high scores. - - - - - Loads the HoldJudgment for the specified MultiPlayer. - - - - - Returns the X position of the mouse. - - - Returns the Y position of the mouse. - - - - - Returns the amount of life left in the LifeMeter as a float in the range 0..1. - - - Returns true if failing. - - - Returns true if the LifeMeter is "hot". - - - Returns true if in danger. - - - - - Returns the number of lives remaining. - - - - - - - - Returns true if player pn's card is locked. - - - Return the state for player pn. - - - Returns the name of the storage device. - - - Returns true if player pn's name is available. - - - - - Returns the current MenuTimer's value. - - - Pauses the MenuTimer, stopping it from counting down. - - - Sets the MenuTimer's value to fSeconds. - - - Sets the MenuTimer's silent setting to bSilent. - - - Sets the MenuTimer's stealth setting to bStealth. If - true, the timer will be invisible and silent. - - - Stops the MenuTimer by setting it to 0 and pausing. - - - - - Broadcast the message to all listeners subscribed to sMessage. The - second argument is an optional table of parameters. It may be omitted or explicitly - set to nil. - - - - - Sets the width of the MeterDisplay to fWidth. - - - - - Controls if the model should loop or not. - - - Plays animation sAniName at fPlayRate speed (default 1.0). - - - Sets how far into the animation the model is. - - - Sets the current animation's playback rate to fRate. - - - Sets the model's default animation to sAnimation at fPlayRate speed (default 1.0). - - - - Returns the number of states the Model has. - - - - - Loads the ModIconRow of Player pn from the Metrics in group sMetricsGroup. - - - - - Returns a command from the specified element and value. - - - Returns a command from the specified element and value using NoteSkin sNoteSkin. - - - Returns a bool from the specified element and value. - - - Returns a bool from the specified element and value using NoteSkin sNoteSkin. - - - Returns a float from the specified element and value. - - - Returns a float from the specified element and value using NoteSkin sNoteSkin. - - - Returns a integer from the specified element and value. - - - Returns a integer from the specified element and value using NoteSkin sNoteSkin. - - - Returns the path for the specified sButton sElement. - - - Returns the path for the specified sButton sElement using NoteSkin sNoteSkin. - - - Returns the actor for the specified sButton sElement. - - - Returns the actor for the specified sButton sElement using NoteSkin sNoteSkin. - - - - Returns true if the strName noteskin exists in the current gametype. - - - Returns a table of noteskin names for the current gametype. - - - - - Returns true if the first item in the row goes down. - - - Returns an index of the choice in the row that player pn is on. - - - Returns the OptionRow's layout type. - - - Returns the name of the OptionRow. - - - Returns the number of choices in this OptionRow. - - - Returns the row title string. - - - Returns the OptionRow's select type. - - - Returns true if this row is focused by player pn. - - - Returns true if this row forces one choice on all players. - - - - - Sets the PaneDisplay from the GameState. - - - - - Sets the PercentageDisplay from the specified PlayerState and PlayerStageStats. - - - - (PlayerInfo is a part of ScreenGameplay.) - - Returns the of player pn. - - - - - - - - Returns the current NoteSkin set in the PlayerOptions. - - - - - Returns true if a full combo (TNS_W3 and up) was obtained. - - - Returns true if a full combo (tns and up) was obtained. - - - Returns the number of Dance Points obtained by the player. - - - Returns how long the player has been alive. - - - Returns the best tap note score for a full combo. - - - Returns the number of calories burned. - - - Returns the player's current combo. - - - Returns the player's current life from 0..1. - - - Returns the player's current miss combo. - - - Returns the number of Dance Points possible to be obtained by the player. - - - Returns the player's current score multiplier. - - - Returns the player's grade. - - - Returns the number of judgments for a specified HoldNoteScore. - - - Returns the player's actual score on the lesson. - - - Returns the score needed to pass the lesson. - - - Returns the player's life remaining seconds. - - - Returns the machine high score index for this performance. - - - Returns the peak combo award for this performance. - - - Returns the personal high score index for this performance. - - - Returns a table of played steps. - - - Gets the percentage of taps that were scored as tns. - - - Returns the player's Dance Point percentage. - - - Returns the number of possible Dance Points. - - - Returns a table of possible steps. - - - Returns a RadarValues object representing the player's actual performance. - - - Returns a RadarValues object representing the total values for the song. - - - Returns the score. - - - Returns the stage award for this performance. - - - Returns how long the player survived in seconds. - - - Returns the number of judgments for a specified TapNoteScore. - - - - Returns the max combo for this performance. - - - Returns true if the player was disqualified from ranking. - - - Sets the Player's score to iScore. - - - - - Returns the HealthState for this PlayerState. - - - Returns the multiplayer number for this PlayerState. - - - Returns the PlayerController for this PlayerState. - - - Returns the player number for this PlayerState. - - - Returns a PlayerOptions object for the specified ModsLevel. - - - Returns a string of player options for the specified ModsLevel. (was GetPlayerOptions in v1.2.2 and prior) - - - Returns a table of strings, containing the player options for the specified ModsLevel. - - - Sets the player options to sPlayerOptions for the specified ModsLevel. - - - - - Return the value of the preference sPreference. - - - Return true if preference sPreference exists. - - - Set the value of the preference sPreference to value. - - - Reset preference sPreference to the default value. - - - - - Returns the number of calories burned during the current day. - - - Returns the Character being used by this profile. - - - Returns a composite of your high scores over courses with the specified StepsType and Difficulty. - - - Returns the percentage of courses that you've completed with the specified StepsType and Difficulty. - - - Returns the possible score of courses with the specified StepsType and Difficulty. - - - Returns the profile's display name. - - - Return the number of calories burned as a string. - - - Returns the number of calories needed to reach the goal. - - - Returns the number of seconds needed to reach the goal. - - - Returns the current goal type. - - - Gets the profile's HighScoreList for a specified Song and Steps. (Alternate arguments for Courses: Course c, Trail t) - - - Returns the number of Toasties gotten using the specified profile. - - - Returns the profile's most popular course. - - - Returns the profile's most popular song. - - - Returns the total number of songs played with the profile. - - - Returns the number of times song s has been played with the profile. - - - Returns a composite of your high scores over songs with the specified StepsType and Difficulty. - - - Returns the percent complete for all songs and courses for the specified StepsType st. - - - Returns the percentage of songs that you've completed with the specified StepsType and Difficulty. - - - Returns the possible score of songs with the specified StepsType and Difficulty. - - - Return the total number of calories burned. - - - Returns the number of Hands stepped on. - - - Returns the number of successful Holds. - - - Returns the number of Jumps stepped on. - - - Returns the number of successful Lifts. - - - Returns the number of Mines stepped on. - - - Returns the total number of songs played with the profile. - - - Returns the number of successful Rolls. - - - Returns the number of steps with the specified StepsType and Difficulty that you've scored a certain Grade g on. - - - Returns the number of Taps and successful Holds. - - - Returns the number of trails with the specified StepsType and Difficulty that you've scored a certain Grade g on. - - - Returns how much the player weighs. - - - Returns true if the player has passed any steps in the specified Song s. - - - Returns true if the specified code sUnlockEntryID is unlocked. - - - Sets the current for the Profile. - - - Sets the goal to iCals calories. - - - Sets the goal to iSecs seconds. - - - Sets the current goal type to gt. - - - Sets how much the player weighs (in pounds) to weightPounds. - - - - Returns the amount of time this profile has spent in gameplay (in seconds). - - - Returns the number of sessions this profile has had. - - - Returns the total session length (in seconds) of this profile. - - - - - - - - - Retuns the machine profile. - - - Retuns the amount of local profiles. - - - Returns the profile for player pn. - - - Returns the profile directory of the specified ProfileSlot. - - - Returns true if player pn's profile is persistent. - - - Returns true if Song s has never been played before (according to the machine profile). - - - Returns true if the last load of player pn's profile was a LastGood copy of the profile. - - - Returns true if the last load of player pn's profile resulted in a tampered or corrupt profile. - - - Saves the machine profile. - - - - - Returns the value of rc from . - - - - - Return the height of the display. - - - Return the width of the display. - - - - - These commands require a RageFile handle. You can create one using - . - - - Returns true if the current position within the file is the end. (EOF = End of File) - - - Clears the last error message. - - - Closes the file and releases it from memory. - - - Safely deletes the file handle. - - - Gets the last error message and returns it. - - - Gets a line and returns it. - - - Opens a file at sPath (relative to the StepMania root directory).
- iAccessType can be set to read (1), write (2), stream (4) or flush to disk on close (8).
- These can also be combined with addition. For example, to set up read and write, set iAccessType to 3 (1+2). -
- - Puts a new line in the file. - - - Returns a string containing the entire contents of the file. - - - Returns length bytes from the RageFile's current position. - - - Seeks to a position in the file and returns the new position. - - - Returns the current position in the file. - - - Writes a file with the contents of str. - -
- - - Returns true if a file exists at sPath. - - - Returns a listing of files from sPath. The last two arguments are optional (and default to false). - - - Returns a file's size in bytes. - - - Returns the hash of the file at sPath. - - - - - Return an array of connected input device descriptions. - - - - - See for loading a sound. - - - Sets the value of sProperty to fVal. The supported properties depend on how the associated was loaded. - - - Sets the pitch to fPitch. The associated have SupportsRateChanging = true on load. - - - Sets the speed (that is, the rate at which the sound plays) to fSpeed. The associated must have SupportsRateChanging = true on load. - - - Sets the volume to fVolume, which is between 0..1. - - - - - Return the texture coordinate rectangle as {left, top, right, bottom}. - - - Sets the animation or movie looping to bLoop. - - - Sets the animation or movie position to fPos. - - - Sets the animation or movie playback rate to fRate. - - - - - Loads the metrics for this RollingNumbers from sGroupName. - - - Sets the target number to f. - - - - - Returns the name of the next Screen. - - - Returns the name of the previous Screen. - - - Locks input for f seconds. - - - Posts a message with the text sScreenMsg to the Screen. - - - - - Returns the current . - - - - - Returns the current StageStats. - - - - - Returns true if a single has its NoteField centered. - - - Returns a dummy PlayerInfo for the specified index. - - - Returns the for the specified pn. - - - Returns the next in the current . - - - Returns the PlayerInfo for player pn. - - - Sets the next Screen to be loaded. - - - Returns true if the game is paused. - - - Pauses or unpauses the game, depending on the value of bPause. - - - - - Returns the LifeMeter. - - - - - Adds a screen at the top of the screen stack. - - - Gets the screen at the top of the screen stack. - - - Reloads any loaded overlay screens. - - - Returns true if screen class s exists. - - - Returns true if screen s is prepared. - - - Sets the next screen to s. - - - Broadcasts a system message. - - - - - Returns true if Player pn backspaced successfully. - - - Returns true if Player pn was able to add sKey to their name. - - - Attempts to finish Player pn and returns true - if successful. - - - Returns true if anyone is entering their name. - - - Returns true if anyone is still entering their name.
- (As opposed to those who are Finalized; see ) -
- - Returns true if Player pn is entering their name. - - - Returns true if Player pn is finished entering their name. - - - Gets the currently selected letter of Player pn. - -
- - - Returns the number of active players. - - - - - Returns true if all active players are on the last options row. - - - Returns true if the specified player is on an items that ends the screen. - - - Returns the current row that player pn is on. (Was previously GetCurrentRow.) - - - Returns the specified OptionRow. - - - - - Returns true if we are going to PlayerOptions. - - - - - Continues to the next screen. - - - Returns true if there is a profile that can be loaded. - - - - - Continues to the next screen. - - - Returns true if there is a profile that can be saved. - - - - - Returns player pn's current selected item as an integer. - - - - - Returns true if the player is going to the options screen. - - - Returns the MusicWheel used on this screen. - - - [02 StageMods.lua] Sets up modifiers for course modes. - - - [02 StageMods.lua] Sets up modifiers for non-course modes. - - - - - Tells the screen to go to the previous screen. - - - Attempts to finish the screen and returns true - if successful. - - - Returns the profile index of the specified Player. - - - Sets the profile index of Player pn to iProfileIndex. - - - - - See the Changelog for details on TextEntrySetting's format. - - - Sets up a ScreenTextEntry's values. - - - - - Tells the screen to go to the previous screen. - - - - - Returns an array of all the available objects for a . - - - Returns the path to the song's background image. - - - Returns the path to the song's banner. - - - Gets the path to the CDTitle. - - - Returns the displayed artist of the song. - - - Returns a table of 2 floats containing the display BPMs. - - - Returns the displayed full title of the song, including subtitle. - - - Returns the displayed main title of the song. - - - Returns the displayed subtitle of the song. - - - Returns the first beat of the song. - - - Returns the genre of the song. - - - Returns the group name that the song is in. - - - Returns the last beat of the song. - - - Gets the path to the lyrics. - - - Gets the path to the music file. - - - Returns a Step object if the StepType and Difficulty exist. - - - Returns the song's directory. - - - Returns the songfile path. - - - Returns a table of Steps that have StepsType st. - - - Returns how long the longest stepchart is in seconds. - - - Returns the song's TimingData. - - - Returns the transliterated artist of the song. - - - Returns the transliterated full title of the song, including subtitle. - - - Returns the transliterated main title of the song. - - - Returns the transliterated subtitle of the song. - - - Returns true if the song has steps for the specified difficulty in st. - - - Returns true if the song has attacks. - - - Returns true if the song has a background. - - - Returns true if the song has a banner. - - - Returns true if the song has BGChanges. - - - Returns true if the song has a CDTitle. - - - Returns true if the song has edits. - - - Returns true if the song has lyrics. - - - Returns true if the song has music. - - - Returns true if the song has significant elephants or bison. - - - Returns true if the song has . - - - Returns true if the song's DisplayBPM is constant. - - - Returns true if the song's DisplayBPM is random. - - - Returns true if the song's DisplayBPM is secret. - - - Returns true if the song is considered easy. - - - Returns true if the song is enabled. - - - Returns true if the song meets the criteria for a "Long Version". - - - Returns true if the song meets the criteria for "Marathon" length. - - - Returns true if the song only has Beginner steps. - - - Returns the length of the song in seconds. - - - Returns true if the song is normally displayed. - - - - - Returns a Course if one matching sCourse is found. - - - Returns a Song if one matching sSong is found. - - - Returns an array of all the installed courses. - - - Returns an array of all the installed songs. - - - Returns the course color of Course c. - - - Returns the extra stage info (Song, Steps) for the specified Style s. (If bExtra2 is true, it will use the second Extra Stage data instead of the first. Again, Lua.xsd sucks) - - - Returns the number of courses loaded via Additional folders. - - - Returns the number of songs loaded via Additional folders. - - - Returns the number of course groups. - - - Returns the number of courses. - - - Returns the number of selectable and unlocked songs. - - - Returns the number of song groups. - - - Returns the number of songs. - - - Returns the number of unlocked songs. - - - Returns a random course. - - - Returns a random song. - - - Returns the song color of Song s. - - - Returns a Song given a set of Steps st. - - - Returns the song group color of sGroupName. - - - - Returns a table containing all of the song group names. - - - Returns the rank (popularity) of Song s. - - - Returns a table containing all of the songs in group sGroupName. - - - Returns the shortened group name (based on entries in Translations.xml). - - - Loads preferred courses from {theme}/Other/SongManager sListName.txt. - - - Loads preferred songs from {theme}/Other/SongManager sListName.txt. - - - - - Returns the length of the animation in seconds. - - - Return the number of states this Sprite has. - - - Returns the Sprite's current state (frame number in a multi-frame sprite). - - - Returns the Sprite's texture. - - - [02 Sprite.lua] Returns a Frames table consisting of iNumFrames frames lasting for a total of fSeconds seconds. This function is not a member function and should be used as Frames = Sprite.LinearFrames( 5, 2.6 ). - - - If sPath is nil, then unload the texture. Otherwise, load the texture at path sPath. - - - Load the song background texture at sPath. - - - Load the song banner texture at sPath. - - - [02 Sprite.lua] Load the texture for song's background. - - - [02 Sprite.lua] Load the texture for song's banner. - - - Sets the custom image rectangle. (Works in image pixel space.) - - - Set the to mode. - - - Set the texture to texture. - - - - - - Allows the themer to set a custom texture rectangle that effects the way the texture is drawn. - - - [02 Sprite.lua] Call RageTexture:loop( bLoop ) on the texture. - - - [02 Sprite.lua] Call RageTexture:position( fPos ) on the texture. - - - [02 Sprite.lua] Call RageTexture:rate( fRate ) on the texture. - - - Scale the Sprite to width fWidth and height fHeight clipping if the dimensions do not match. - - - Set the Sprite's state to iNewState. - - - - - - Set the texture coordinate velocity which controls how the Sprite changes as it animates. - - - - Crops the Sprite to fWidthxfHeight. - - - [01 alias.lua] Alias for CropTo. - - - Sets all the state delays to fRate. Useful for Sprites that need to change by BPM (e.g. Tran from DDR 5th Mix, the cube from DS EuroMix 2). - - - - - Returns true if everyone failed. - - - Returns the EarnedExtraStage value. - - - Returns the number of seconds played. - - - Returns the PlayerStageStats of multiplayer mp. - - - - Returns the PlayerStageStats of player pn. - - - - Returns the Stage value. - - - Returns the stage index. - - - Returns true if at least one person passed. - - - Returns true if player pn has a high score. - - - - - Returns the accumulated played StageStats. - - - Returns the best final grade. - - - Returns the best grade. - - - Returns the current StageStats. - - - Returns player pn's final grade. - - - Get the StageStats from iAgo rounds ago. - - - Returns the number of stages played. - - - Returns the worst grade. - - - Resets the stats. - - - - - Returns the author that made that particular Steps pattern. - - - Returns the Chart Style for this Steps. - - - Returns the Steps description. - - - Returns the Steps difficulty. - - - Returns the Steps filename from the Cache. - - - Returns a hash of the Steps. - - - Returns the numerical difficulty of the Steps. - - - Returns the complete list of RadarValues for player pn. Use to grab a specific value. - - - Returns the Steps type. - - - Returns true if the Steps are an edit. - - - Returns true if the Steps are a player edit (loaded from a profile). - - - Returns true if the steps were automatically generated. - - - - - Loads the StepsDisplay commands from the Metrics in group sMetricsGroup. - - - Sets the StepsDisplay from the GameState using Player pn. - - - Sets the StepsDisplay based on Steps pSteps. - - - Sets the StepsDisplay based on the passed in StepsType, iMeter, and Difficulty. - - - Sets the StepsDisplay based on Trail pTrail. - - - - - Returns the number of total tracks this Style contains (e.g. 4 for dance-versus, but 8 for dance-double). - - - Returns the name of the Style. - - - Returns the StepsType for this Style. - - - Returns the StyleType for this Style. - - - Returns true if the Style needs to be zoomed out with two players. - - - - - Loads the TextBanner from the specified metrics group. - - - Loads the TextBanner's child elements from a . - - - Loads the TextBanner's child elements from strings. - - - - - Returns the current language. - - - Returns the theme's current directory. - - - Returns the value of Element in Class from metrics.ini. - - - Returns the number of selectable themes. - - - Returns the path of ClassName Element in the BGAnimations folder. - - - Returns the path of an element in the Fonts folder. - - - Returns the path of an element in the Graphics folder. - - - returns three strings: BGAnimation ResolvedPath, MatchingMetricsGroup, MatchingElement. Used in LoadFallbackB in themes/_fallback/02 Other.lua. (Lua.xsd sucks) - - - Returns the path of an element in the Other folder. - - - Returns the path of an element in the Sounds folder. - - - Returns a table of selectable theme directories. - - - Returns the value of Element in Class for the currently loaded language. - - - Returns the author of the current theme or "[unknown author]". - - - Returns the display name of the current theme. - - - Reloads the current theme's metrics. - - - - - Returns the minimum and maximum BPM of the song in a table (in that order). - - - Returns the beat from fElapsedTime. - - - Returns the BPM at fBeat. - - - Returns a table of the BPMs as strings. - - - Returns a table of the BPMs and the times they happen as strings with the format "beat=BPM". - - - Returns the elapsed time from fBeat. - - - Returns a table of the Stops and the times they happen as strings with the format "beat=stop seconds". - - - Returns a table of the Delays and the times they happen as strings with the format "beat=stop seconds". - - - Returns true if the TimingData contains BPM changes. - - - Returns true if the TimingData contains any BPM changes with a negative BPM. - - - Returns true if the TimingData contains stops. - - - - - Returns an array with all the artists in the Trail. - - - Returns the Trail's difficulty. - - - Returns a table of TrailEntry items. - - - Returns the Trail's difficulty rating. - - - Returns the Trail's RadarValues. - - - Returns the Trail's StepsType. - - - Returns the TrailEntry at index iEntry. - - - - - Returns a string of modifiers used in this TrailEntry. - - - Returns the Song used in this TrailEntry. - - - Returns the Steps used in this TrailEntry. - - - (why'd I think this was a good idea when we have ?) - - - - - Sets the UnlockEntry's ID to m_sEntryID. - - - Sets the UnlockEntry's course to sCourseName.
- Example: course,"Driven" -
- - Returns the unlock description. - - - Returns the UnlockRequirement. - - - Returns true if the UnlockEntry requires you to pass Hard steps. - - - Returns the Song related to the UnlockEntry. - - - Returns the UnlockRewardType for this entry. - - - Returns true if the UnlockEntry is locked. - - - Sets the UnlockEntry's modifier to sModifier. - - - Sets the requirement for this unlock to m_fRequirement. - - - Makes the UnlockEntry require passing Hard steps. - - - Makes the UnlockEntry hide in Roulette. - - - Sets the UnlockEntry's song to sSongName.
- sSongName also requires the group.
- Example: song,"In The Groove/Pandemonium" -
- - Sets the UnlockEntry to unlock a specified song's steps.
- Example: steps,"In The Groove/Pandemonium","expert" -
-
- - - Returns true if there are any unlocks to celebrate. - - - Returns the associated EntryID. - - - Returns the number of unlocked items. - - - Returns the number of all unlock items, regardless of status. - - - Returns the number of points until the next unlock. - - - Returns a table of songs unlocked by UnlockEntry sEntryID. - - - Returns a table of steps unlocked by UnlockEntry sEntryID. - - - Returns the UnlockEntry at iIndex. - - - Returns the UnlockEntry index to celebrate. - - - - Unlocks an entry by ID. - - - Unlocks an entry by index. - - - - - Returns the wheel's current index. - - - Returns the total number of items in the wheel. - - - Returns the WheelItem at index iIndex. - - - Returns true if the wheel is locked. - - - Returns true if the wheel is settled/stopped moving. - - - Moves the wheel by n. - - - Attempts to set the open section to sSection. - - - - - Sets the WorkoutGraph from the current Workout. - - - Sets the WorkoutGraph from GameState and song index iSongIndex. - - -
- - - - - Blending modes. See . - - - - - Horizontal alignment. See . - - - - - Vertical alignment. See . - - - -
+ + + + + + + + + + + [02 StageMods.lua] + + + [02 StageMods.lua] + + + Issues an error when v is false (or nil). Returns all arguments otherwise. sAssertMessage is an optional error message (the default is "assertion failed!"). + + + Returns the base name of file path. + + + [02 Colors.lua] + + + [03 HSV.lua] + + + [03 Gameplay.lua] + + + CLAMP is an all-female Japanese mangaka group that formed in the mid 1980s. Erm, I mean... Clamps fValue between fLow and fHigh. + + + Closes any connection to an online server. + + + A generic interface to Lua's garbage collector. Performs different functions based on the value of opt. + + + Returns a color from a string. color can be in + hex ("#FFFFFFFF") or 0..1 values ("1.0,1.0,1.0,1.0"), + in RGBA order. + + + [03 Gameplay.lua] Determines what TapNoteScore allows for continuing the combo. + + + [03 Gameplay.lua] Determines what TapNoteScore allows for maintaining the combo. + + + [03 Gameplay.lua] Determines if combo should be per row (Jump = 1) or per column (Jump = 2). + + + Tries to connect to the server at sAddress. + + + Returns the current day of the month. + + + Returns the current day of the year. + + + [01 base.lua] "Override Lua's dofile to use our loadfile." + + + [02 Utilities.lua] Find a key in tab with the given value. + + + [02 Utilities.lua] Return the index of a true value in list. + + + Returns the number passed to the function followed by its suffix ("th", "nd", and so on). + + + Returns fPercentDancePoints formatted as a percentage. + + + [03 Gameplay.lua] Returns a list of valid styles for the current gametype. + + + Returns the corresponding CustomDifficulty string for a StepsType/Difficulty (/optional CourseType) combination. + + + [03 EnvUtils2.lua] Returns the value of name from the Env table. + + + [03 Gameplay.lua] Returns the number at which the Extra color should be used. + + + Returns a corresponding for the given percentage. + + + Returns the current Life Difficulty. + + + Returns a string representing the name of the operating system being used. (e.g. "Xbox", "Windows", "Linux", "Mac, "Unknown") + + + [03 ThemePrefs.lua] Returns true if player pn is using ProTiming. + + + Returns the theme's aspect ratio. + + + [03 UserPreferences2.lua] Themer-facing function for getting a user preference. + + + [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a boolean. + + + [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a color. + + + [03 UserPreferences2.lua] Themer-facing function for getting a user preference as a number. + + + Returns the current hour. + + + [03 ThemePrefs.lua] Initializes various user preferences. + + + [03 ProductivityHelpers.lua] Returns true if the coin mode is not set to CoinMode_Home. + + + Returns true if Event Mode is turned on. + + + [03 ProductivityHelpers.lua] Returns true if Arcade and the coin mode is CoinMode_Free. + + + [03 ProductivityHelpers.lua] Returns true if the coin mode is set to CoinMode_Home. + + + Returns true if connected to the Internet. + + + Returns true if connected to StepMania Online. + + + Returns true if Player pn is logged on to + a SMOnline server. + + + [04 WidescreenHelpers.lua] Returns true if the aspect ratio is 16:10 (1.6) or higher. + + + [01 base.lua] "Like ipairs(), but returns only values." + + + [02 Utilities.lua] Joins a table, splitting each item with delimiter, returning a string of the results. + + + Returns an Actor definition for the actor at sPath. If sPath points to a Lua file, any additional arguments will be passed to that script. + + + [02 ActorDef.lua] Loads an actor template. This is the actual core of LoadActor. + + + [02 ActorDef.lua] Loads an actor with params. + + + [01 base.lua] "Override Lua's loadfile to use lua.ReadFile." + + + [02 ActorDef.lua] Load the fallback BGA for the element that is currently being loaded. + + + [02 ActorDef.lua] Loads a font. + + + [02 Sprite.lua] Returns a Sprite with the current song's background. + + + Returns the current Minute. + + + Returns the current month of the year. + + + Returns Month m as a localized string. + + + Returns Month m as a string. + + + [03 ProductivityHelpers.lua] Converts a PlayerNumber into a short string (e.g. "P1", "P2"). + + + [00 init.lua] + + + [02 ActorDef.lua] + + + [03 UserPreferences2.lua] (internal) Reads the specified user preference from its config file. + + + [02 Utilities.lua] Round a number. + + + [03 Gameplay.lua] Returns the primary ScoreKeeper class to use. + + + Returns the current second. + + + Converts fSecs to Minutes:Seconds.Milliseconds format. + + + [02 Branches.lua] Determines the correct music/course selection screen to use and returns it. + + + [03 Gameplay.lua] (soon to be deprecated) Returns a list of codes to use on ScreenSelectProfile. + + + [03 EnvUtils2.lua] Sets the value of name to value in the Env table. + + + [03 UserPreferences2.lua] Themer-facing function for setting a user preference. + + + [02 ActorDef.lua] Returns true if a decoration should be shown on the current screen or not. + + + [02 Utilities.lua] Splits a string at every occurence of delimiter, returning a table of the results. + + + [02 ActorDef.lua] + + + [02 ActorDef.lua] + + + [02 ActorDef.lua] + + + [02 Utilities.lua] Look up each value in a table, returning a table with the resulting strings. + + + [02 TextBanner.lua] This function defines how the TextBanner is laid out. + + + [03 ProductivityHelpers.lua] Converts a string or number to a bool. + + + [02 Enum.lua] Returns a string representing an enum starting from '_'. For example, passing PlayerNumber_P1 to this function will return P1. + + + [00 init.lua] Alias for . + + + [01 base.lua] Alias for lua.GetThreadVariable. + + + [00 init.lua] Alias for . + + + [04 WidescreenHelpers.lua] Depending on the screen width, scales between ar43 (4:3; 640px) and ar169 (16:9; 854px). + + + [02 ActorDef.lua] Wraps the children in an ActorFrame. + + + [03 UserPreferences2.lua] (internal) Writes user preference prefName to its config file with value being tostring'd. + + + Returns the current year. + + + Returns the length of the multi-byte character string sString. + + + + Returns the name of the currently connected server. + + + Converts fSecs to Minutes:Seconds:Milliseconds format using two digits for each section. + + + Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section. + + + Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section except Milliseconds (uses 3). + + + Converts fSecs to Minutes:Seconds.Milliseconds format using two digits for each section except Minutes (uses 1). + + + Converts fSecs to Minutes:Seconds format. + + + Returns a string with characters escaped for URLs. (e.g. a space becomes '%20') + + + + [03 CustomSpeedMods.lua] Returns a Lua option row with the custom speed mods defined in SpeedMods.txt. + + + + [04 FileUtils.lua] Reads the file at path and returns its contents. + + + [04 FileUtils.lua] Writes buf to the file at path. + + + + [03 ThemePrefs.lua] Returns a Lua option row for ProTiming. + + + [03 ThemePrefs.lua] Returns a Lua option row for toggling AutoSetStyle. + + + [03 ThemePrefs.lua] Returns a Lua option row for displaying the score on ScreenGameplay. + + + [03 ThemePrefs.lua] Returns a Lua option row for displaying the StepsDisplay on ScreenGameplay. + + + [03 ThemePrefs.lua] Returns a Lua option row for determining the fail length. + + + [03 ThemePrefs.lua] Returns a Lua option row for determining the receptor arrow position. + + + [03 ThemePrefs.lua] Returns a Lua option row determining how deep the player options menu should go. + + + + + + + + Returns true if sClassName is a registered Class. + + + + + Enumerated types are lookup tables associating a string to each numerical + value for each Enum. For example, + [1] would be the + string 'PlayerNumber_P1'.
+ The functions defined in the Enum namespace are valid member + functions of every Enum where the first argument is + omitted and the name of the Enum is used in place + of Enum. Instead of + Enum.GetName( + ) or + Enum.Reverse( + ), one can use + :GetName() or + :Reverse(), respectively. +
+ + Both x and y need to be elements of the enumerated + type e. Returns a value less than/greater than/equal to + 0 corresponding to the numerical value of x being + less than/greater than/equal to the numerical value of y as + determined by + Enum.Reverse( e ). + + + Returns the type of e. For example, + Enum.GetName( ) + will return the string 'PlayerNumber'. + + + Returns a reverse lookup table for the enumerated type e. For + example:
local r = + Enum.Reverse( );
+ local n = r['PlayerNumber_P2'];

+ The value of n in this case would be 1 corresponding + to the 0-based indexing using in C++ and not 2 as might be + expected for the 1-based indexing used in Lua. +
+
+ + + Writes sString to log.txt. Aliased by + . + + + Writes sString to info.txt and log.txt as + a warning. Aliased by . + + + Flushes log files to disk. + + + + + Creates a RageFile handle with which one can use the commands in . + + + + + Gets the credits message for Player pn. + + + + + Returns true if the song's steps (st) are playable. + + + Returns true if the song's StepsType (st) are playable. + + + + + Returns the number of songs in a Trail. + + + Returns the Trail's total length in seconds. + + +
+ + + + + + Returns the Actor's parent, or nil if it doesn't have one. + + + Returns the Actor's visibility. + + + Returns the Actor's x position. + + + Returns the Actor's y position. + + + Returns the Actor's z position. + + + Returns the Actor's zoom. + + + Returns the Actor's X zoom. + + + Returns the Actor's Y zoom. + + + Returns the Actor's Z zoom. + + + Sets Texture Filtering for an Actor to b. + + + Plays the commands that follow at an accelerated rate (fRate * fRate), where fRate is in seconds. + + + Adds rot to the Actor's current x rotation. + + + Adds rot to the Actor's current y rotation. + + + Adds rot to the Actor's current z rotation. + + + Adds xPos to the Actor's current x position. + + + Adds yPos to the Actor's current y position. + + + Adds zPos to the Actor's current z position. + + + [02 Actor.lua] Sets the alignment of an Actor, where h and v are in the range 0..1. + + + Sets whether or not the Actor should animate. + + + Sets the Actor's aux value. (This can be a solution for coupling data with an Actor.) + + + If true, cull the Actor's back faces. See also: . + + + Sets the Actor's base alpha to fAlpha, where fAlpha is in the range 0..1. + + + Sets the Actor's base X rotation to rot. + + + Sets the Actor's base Y rotation to rot. + + + Sets the Actor's base Z rotation to rot. + + + Sets the Actor's base zoom to zoom. + + + Sets the Actor's base X zoom to zoom. + + + Sets the Actor's base Y zoom to zoom. + + + Sets the Actor's base Z zoom to zoom. + + + Sets the Actor to use the specified blend mode. + + + Makes the Actor bob up and down. Can use to define different bobbing behavior. + + + Makes the Actor bounce, similar to bob but with one point acting as the ground. Can use to define different bouncing behavior (with effectmagnitude values relating to x, y, and z movement). + + + [02 Actor.lua] + + + [02 Actor.lua] + + + [02 Actor.lua] Centers an Actor. + + + Crops percent of the Actor from the bottom, where percent is in the range 0..1. + + + Crops percent of the Actor from the left, where percent is in the range 0..1. + + + Crops percent of the Actor from the right, where percent is in the range 0..1. + + + Crops percent of the Actor from the top, where percent is in the range 0..1. + + + Sets the Actor's cull mode to mode. + + + Plays the commands that follow at an decelerated rate (1 - (1-fRate) * (1-fRate)), where fRate is in seconds. + + + Set the Actor's diffuse color to c. + + + Sets the Actor's alpha level to fAlpha, where fAlpha is in the range 0..1. + + + Sets the Actor's bottom edge color to c. + + + Set the Actor's diffuse color to c, ignoring any alpha value in c. + + + Sets the Actor's left edge color to c. + + + Sets the Actor's lower left corner color to c. + + + Sets the Actor's lower right corner color to c. + + + Sets the Actor's right edge color to c. + + + Sets the Actor's top edge color to c. + + + Sets the Actor's upper left corner color to c. + + + Sets the Actor's upper right corner color to c. + + + Sets the Actor's draworder to iOrder, where larger values display first. + + + [02 Actor.lua] (Added in sm-ssc) + + + [02 Actor.lua] + + + Set the Actor's effect clock to s. + + + Sets the first effect color to c. + + + Sets the second effect color to c. + + + Set the Actor's effect magnitude in each direction to the given values. + + + Set the Actor's effect offset to fTime. + + + Set the Actor's effect period to fTime. + + + Set the Actor's effect timing. + + + Fades percent of the Actor from the bottom where percent is in the range 0..1. + + + Fades percent of the Actor from the left where percent is in the range 0..1. + + + Fades percent of the Actor from the right where percent is in the range 0..1. + + + Fades percent of the Actor from the top where percent is in the range 0..1. + + + Finishes up an Actor's tween immediately. + + + [02 Actor.lua] Stretches an Actor to fill the entire screen. + + + Returns the Actor's aux value. + + + Returns the Actor's base X zoom value. + + + Returns the Actor's base Y zoom value. + + + Returns the Actor's base Z zoom value. + + + Returns true if the Actor has a command named sCmdName. + + + Returns the Actor's current diffuse color. + + + Returns the Actor's current diffusealpha. + + + Returns the Actor's current effect delta. + + + Returns the Actor's current effect magnitude as three floats (not one; I hate Lua.xsd). + + + Returns the Actor's current glow color. + + + Returns the Actor's horizontal alignment as a number in the range 0..1. + + + Returns the Actor's name. + + + Returns the number of states the Actor has. + + + Returns the Actor's current height. + + + Returns the Actor's current X rotation. + + + Returns the Actor's current Y rotation. + + + Returns the Actor's current Z rotation. + + + Returns the number of seconds into the currently running effect (e.g. diffuseshift, bob). + + + Returns how much time is remaining for the current tween. + + + Returns the Actor's vertical alignment as a number in the range 0..1. + + + Returns the Actor's current width. + + + Returns the zoomed height of an Actor. + + + Returns the zoomed width of an Actor. + + + Sets the Actor's glow color. + + + + + + Set the fractional horizontal alignment of the Actor according to fAlign which should be a float in the range 0..1. An alignment of 0 is left aligned while an alignment of 1 is right aligned. See for the common case. + + + Hides the Actor for the specified amount of time. + + + [Deprecated] Compatibility alias for the hidden command, which was removed in sm-ssc. Use instead. + + + [02 Actor.lua] "Hide if b is true, but don't unhide if b is false." + + + Set the horizontal alignment of the Actor according to align. See for fractional alignment. + + + Hurries up an Actor's tweening by factor. + + + Plays the commands that follow at a normal rate, where fRate is in seconds. + + + [02 Lyrics.lua] Plays the lyric command for the specified side ("Back" or "Front"). + + + Sets the Actor's name to sName. + + + Stops the Actor's movement. (Usually used for Sprites or Models.) + + + Starts the Actor's movement. (Usually used for Sprites or Models.) + + + Plays a command named sCommandName. + + + [02 Actor.lua] Sets the visibility of the Actor based on p being a human player. + + + Makes the Actor grow and shrink. Can use to define different pulsing behavior. + + + Queues a command named sCommandName to be played. + + + Basically creates a command named !sMessageName (Note the ! at the beginning. The source code says this: "Hack: use "!" as a marker to broadcast a command, instead of playing a command, so we don't have to add yet another element to every tween state for this rarely-used command.") + + + Makes the Actor change colors continually using colors of the rainbow. + + + Set the Actor's rotation on the X axis to fAlign. + + + Set the Actor's rotation on the Y axis to fAlign. + + + Set the Actor's rotation on the Z axis to fAlign. + + + [02 Actor.lua] An alternative version of . + + + [02 Actor.lua] + + + Scales the Actor to cover a rectangle defined by the four float arguments. + + + Scales the Actor to fit inside a rectangle defined by the four float arguments. + + + Sets the height of the Actor. + + + Sets the size of the Actor. + + + [01 alias.lua] Alias for setsize. + + + Sets a multi-framed Actor's state to iNewState. + + + Sets the width of the Actor. + + + Sets the shadow's color to c. + + + Sets the Actor's shadow length to fLength. + + + Sets the Actor's horizontal shadow length to fLength. + + + Sets the Actor's vertical shadow length to fLength. + + + Skews the Actor on the x axis by fAmount. + + + Skews the Actor on the y axis by fAmount. + + + Waits fSeconds before executing the next command. + + + [02 Actor.lua] + + + Tells the Actor to spin. Can use to define different spinning behavior. + + + Stops any effect the Actor has. + + + Stretches the Actor to a rectangle of a specific size. + + + Set the fractional vertical alignment of the Actor according to fAlign which should be a float in the range 0..1. An alignment of 0 is top aligned while an alignment of 1 is bottom aligned. See for the common case. + + + Set the vertical alignment of the Actor according to align. See for fractional alignment. + + + Makes the Actor vibrate violently. Can use to define different vibration behavior. + + + Sets an Actor's visibility to b. + + + Set the x position of the Actor to xPos. + + + Set the y position of the Actor to yPos. + + + Set the z position of the Actor to zPos. + + + Zooms the Actor to zoom scale. + + + Zooms the Actor on both the X and Y axis using zoomX and zoomY. + + + Zooms the Actor to zoom height. See also: . + + + Zooms the Actor to zoom width. See also: . + + + Zooms the Actor to zoom scale on the X axis. + + + Zooms the Actor to zoom scale on the Y axis. + + + Zooms the Actor to zoom scale on the Z axis. + + + + [02 Actor.lua] + + + [03 ProductivityHelpers.lua] Centers an Actor on the X axis. (equivalent to x,SCREEN_CENTER_X) + + + [03 ProductivityHelpers.lua] Centers an Actor on the y axis. (equivalent to y,SCREEN_CENTER_Y) + + + [03 ProductivityHelpers.lua] A customized version of pulse that is more appealing for on-beat effects. + + + [03 ProductivityHelpers.lua] Sets and Actor as a mask destination. + + + [03 ProductivityHelpers.lua] Sets an Actor as a mask source. (Also clears zbuffer; other mask sources need to not clear the zbuffer) + + + [03 ProductivityHelpers.lua] Make graphics their true size at any resolution. + + + [03 ProductivityHelpers.lua] Scale things back up after they have already been scaled down. + + + [03 ProductivityHelpers.lua] A customized version of pulse that is more appealing for on-beat effects. + + + [03 ProductivityHelpers.lua] Sets the x and y location of the Actor in one command. + + + + + Sets the field of view for the ActorFrame. + + + Returns the child with a name of sName. + + + Returns a table of all the children in the ActorFrame. + + + Gets the ActorFrame's Draw function. + + + Returns the number of children in the ActorFrame. + + + Plays the sCommandName command on the ActorFrame's children. + + + Plays the sCommandName command on the ActorFrame's leaves. + + + Sets if the Actorframe should propagate commands to its children. + + + [02 Actor.lua] Propagates a command to the ActorFrame's children. + + + Runs the commands in cmds on the ActorFrame's children. + + + Runs the commands in cmds on the ActorFrame's leaves. + + + Sets the ActorFrame's ambient light color to c. + + + Sets the ActorFrame's diffuse light color to c. + + + Sets if the ActorFrame should draw by Z position. + + + Sets the ActorFrame's Draw function to the specified Lua function. + + + Sets the field of view for the ActorFrame. + + + Currently unimplemented since it does not handle errors correctly. Arguments must be passed in as a table. + + + Sets the ActorFrame's specular light color to c. + + + Sets the ActorFrame's update function to the specified Lua function. + + + Sets the update function's rate to fRate. + + + Tells the ActorFrame to sort by draw order. + + + Sets the vanishing point for the ActorFrame. + + + + + Clears all the textures from the MultiTexture. + + + Sets the EffectMode on the MultiTexture. + + + Sets a TextureMode on the specified index. + + + + + Returns the target of the ActorProxy. + + + Sets the ActorProxy target to a. + + + + + Returns the scroller's current item. + + + Returns the item the scroller's going to. + + + Returns how long it will take for the scroller to completely scroll through all its items. + + + Returns the number of items in the ActorScroller. + + + Returns the number of seconds until the scroller reaches its destination. + + + Compatibility alias for . + + + Positions the scroller items. + + + Scrolls through all the items in the scroller. + + + Compatibility alias for . + + + Scrolls through all the items in the scroller with padding at the beginning and end. + + + Compatibility alias for . + + + Sets the item the scroller should scroll to next and makes it the current item. + + + Sets the item the scroller should scroll to next. + + + Sets if the scroller should catch up fast. + + + Compatibility alias for . + + + Specifies if the scroller should loop or not. + + + Sets the scroller's mask to a Quad that is fWidth by fHeight pixels. + + + Sets the scroller to draw fNumItems items. + + + Sets the number of subdivisions in the scroller. + + + Compatibility alias for . + + + Sets the scroller's pause countdown to fSecs. + + + Sets the scroller's pause between items to fSeconds. + + + Sets how many seconds the scroller should spend on each item.
+ A value of 0 means the scroller will not scroll. +
+ + Compatibility alias for . + + + Sets the scroller's transform function to the specified Lua function. + + + Sets the scroller's transform function from fItemHeight. + + + Sets the scroller's transform function from fItemWidth. + +
+ + + This Actor represents a playable sound. There are two attributes that can be set on load.
+ * SupportPan - Let the sound pan from side to side.
+ * SupportRateChanging - Let the sound change rate and pitch. +
+ + Returns the that can be played by this Actor. + + + Loads the sound at sPath. + + + Pauses or unpauses the sound based on bPause. + + + Plays the sound. + + + [02 Sound.lua] Plays the sound on the given player's side. You must set SupportPan = true on load. + + + Stops the sound. + +
+ + + Returns true if Announcer sAnnouncer exists. + + + Returns a table of installed announcers. + + + Returns the current announcer's name. + + + Sets the announcer to sNewAnnouncer. + + + + + Returns true if the Banner is currently scrolling. + + + + + + Loads the background from an UnlockEntry. + + + Loads the banner from an UnlockEntry. + + + Loads the card image from the specified Character. + + + + + + Loads a Banner from a specified Course. + + + Loads a Banner from a specified Song. + + + Loads a Banner from a specified Song Group. + + + Loads a Banner from a specified SortOrder. + + + Loads an icon from the specified Character. + + + See . + + + See . + + + + + + + + Add the attribute attr to the string at position + iPos.
+ The attribute is a table that must contain Length + which specifies how many (multi-byte) characters the attribute + is to apply. If Length=-1, then the attribute applies + until another attribute overrides it.
+ If the table contains Diffuse, then the color value + is applied to the range of text.
+ If the table contains Diffuses, then it should be + an array of 4 colors which specify the diffuse color for the + top left, top right, bottom left, and bottom right.
+ If the table contains Glow, then the color value + is applied as a glow to the range of text.
+ Example:
+ attr = { Length = 10; Diffuse = color("#AABBCC"); } +
+ + Clear all attributes associated with the BitmapText. + + + [03 ProductivityHelpers.lua] Sets the diffuse and stroke color of text in one command. + + + Returns the text that is currently set. + + + If bJitter is true, move each character of the string around by a small random amount. + + + Set the maximum height of the unzoomed text to fHeight. If fHeight is 0, then there is no maximum height. + + + Set the maximum width of the unzoomed text to fWidth. If fWidth is 0, then there is no maximum width. + + + [03 ProductivityHelpers.lua] Remove any stroke color. + + + [03 ProductivityHelpers.lua] Alias for setting to false. + + + If true, set each character of the text in turn to the rainbow colors in the metrics BitmapText::RainbowColor#. + + + Set the text to sText. This clears all attributes. + + + [03 ProductivityHelpers.lua] Sets text using string.format(sFormat, ...). + + + [03 ProductivityHelpers.lua] Alias for . + + + Sets the stroke color to c. + + + If the text is glowing, specify if just the stroke layer, just the inner layer, or both are affected by the glow. + + + If true, make all text uppercase. + + + Add iSpacing pixels of padding between lines of text. + + + Wrap the unzoomed text at iWidth pixels. If you or by x and you want the text wrapped at width, then you should use wrapwidthpixels(width/x). + +
+ + + Returns the text that is currently set at the exact moment you call it. This is likely only going to be useful in an Update command. + + + Sets the BPMDisplay from the GameState. + + + + + Returns the path to the character's card graphic. + + + Returns this character's directory. + + + Returns this character's ID. + + + Returns the path of the dancing animation of this character. + + + Returns the character's display name. + + + Returns the path to the character's icon. + + + Returns the path of the model of this character. + + + Returns the path of the rest animation of this character. + + + Returns the path to the character's ScreenSelectMode icon. + + + Returns the path to the character's ScreenStage icon. + + + Returns the path of the warm-up animation of this character. + + + + + Returns a table of all characters installed. + + + Return the corresponding to sID. + + + Returns a random character. + + + + + Loads the ComboGraph commands from the Metrics in group sMetricsGroup. + + + Sets the values of the ComboGraph using the specified StageStats and PlayerStageStats. + + + + + Loads the ControllerStateDisplay from the specified GameController. + + + Loads the ControllerStateDisplay from the specified MultiPlayer. + + + + + Returns a table of all the Trails in the Course. + + + Returns the path to the Course's background. + + + Returns the path to the Course's banner. + + + Returns the Course's directory. + + + Returns a table of CourseEntry items. + + + Gets the CourseEntry at iIndex from the Course. + + + Returns the Course's . (Returns CourseType in sm-ssc; integer in SM4) + + + Returns the full display title of the Course. + + + Returns the estimated number of stages for the Course. + + + Returns the goal seconds for the Course. + + + Returns the Course's group name. + + + Returns the Course's . (Returns PlayMode in sm-ssc; integer in SM4) + + + Returns the total length of the Course in seconds. + + + Returns the full transliterated title of the Course. + + + Returns true if the Course has a background. + + + Returns true if the Course has a banner. + + + Returns true if the Course has modifiers. + + + Returns true if the Course has timed modifiers. + + + Returns true if the Course is an edit. + + + Returns true if the Course was automatically generated. + + + Returns true if the Course is Endless. + + + Returns true if the Course is Nonstop. + + + Returns true if the Course is Oni. + + + + + Sets the CourseContentsList from the GameState. + + + + + Returns the Song that this CourseEntry corresponds to. + + + + Returns the number of lives gained after completing the song. + + + Returns the number of seconds gained after completing the song. + + + Returns any stage (non-timed) modifiers. + + + Returns the number of modifier changes in this CourseEntry. + + + Returns a comma-delimited string representing various facts about the CourseEntry. + + + Returns true if this CourseEntry is a fixed song. + + + Returns true if this CourseEntry is secret. + + + + + Returns the MD5 hash for the file at sPath. + + + Returns the MD5 hash for s. + + + Returns the SHA-1 hash for s. + + + + + Sets the DifficultyIcon's state from the difficulty passed in. + + + Sets the DifficultyIcon's Player to pn, + then sets the DifficultyIcon's state from the difficulty of Steps pSteps + + + Sets the DifficultyIcon's Player to pn, + then sets the DifficultyIcon's state from the difficulty of Trail pTrail + + + Sets the DifficultyIcon's Player to pn. + + + Blanks the DifficultyIcon. + + + + + Sets the StepsDisplayList from the GameState. + + + + + Returns the name of the game such as "dance" or "pump". + + + + + Returns any Character associated with this item (or nil if there isn't one). + + + Returns any Course that may have been set. + + + Returns the index of this item. + + + Returns any MultiPlayer that may have been set. + + + Returns the choice name. + + + Returns any Profile ID that may have been set. + + + Returns any screen that may have been set as a string. + + + Returns any Song that may have been set. + + + Returns the name of any song group that may have been set. + + + Returns any Steps that may have been set. + + + Returns any Style that may have been set. + + + Returns the display text. + + + Returns any Trail that may have been set. + + + Returns any Url that may have been set. + + + + + Return the first for the specified game. + + + Returns true if any noteskins exist for the specified Game s. + + + Return the localized string representation of st. + + + + + Set the music volume to fVolume for fDuration seconds. + + + + Return the sound balance for pn. + + + Play the sound at sPath one time. + + + + + Returns true if any player has performed a feat worthy of ranking. + + + The second argument is optional. Apply the GameCommand represented by sCommand + for pn, if given. See . + + + Returns true if enough credits have been inserted to join. + + + fishpolk.mid; See also: Rise of the Triad + + + Returns the environment table. See . + + + Returns the current for the specified . + + + Returns the current . + + + Return the number of inserted but unused coins. This number is + decremented when players join. + + + Return the number of coins needed to join based on the current coin and premium modes + as well as the number of people joined, if that matters for the premium mode. See + and . + + + The s in a are numbered sequentially + starting from 0. Return the number of the current . + + + Return the current number of seconds that have passed in the current song. This value can be negative. + + + Return the current . + + + Return the current . + + + Return the current . + + + Return the current . + + + Returns the current stage index (starts at 0). + + + Return the current for the specified Player. + + + Return a variable number of arguments based on the being + played by all players. For each distinct being played by + the players, in increasing order, + the difficulty and description of the is returned as strings. +
For example,
+ local credits = {GAMESTATE:GetCurrentStepsCredits()};
+ will make a table of the difficulties and descriptions. +
+ + Return the current . + + + Return the current for the specified player. + + + Return a string representation of the default song options. + + + Return the easiest of the + currently selected steps by all players. For example, if player 1 has + selected Hard steps and player 2 has selected Medium steps, Medium will + be returned. + + + + + + + Return the Edit Local or nil if + it does not exist. + + + + + + Return the source for the editor or nil + if it does not exist. + + + Return the random seed for the game. + + + Return true if the gameplay lead in is enabled. If + false, gameplay begins immediately. + + + Return the hardest of the + currently selected steps by all players. For example, if player 1 has + selected Hard steps and player 2 has selected Medium steps, Hard will + be returned. + + + Returns an array of s corresponding to Human players. + + + Returns the master player number. + + + Returns true if the game is Multiplayer. + + + Returns the number of active multiplayer NoteFields. + + + Returns the number of players enabled. + + + Returns the number of sides joined. + + + Returns the number of stages for the current Song and its Steps or the current Course. + + + Returns the number of stages left for player pn. + + + Returns the display name for player pn. + + + Returns the PlayerState for player pn. + + + Returns the current PlayMode. + + + Returns the preferred difficulty. + + + Returns the preferred song. + + + Returns the preferred song group. + + + Returns the current Premium. + + + + Returns the current beat of the song. + + + Returns the current visible beat of the song. + + + Returns the song's current beats per second. + + + Returns true if a delay is active in the song. + + + Returns true if the song is currently in a freeze. + + + Returns the song options for the specified ModsLevel as a string. + + + Returns the song options as a string. + + + Returns how much of the song is through at beat fBeat. + + + Returns the current SortOrder. + + + Returns the current stage index. + + + Return the random seed for the current stage. + + + Returns true if the workout goal is complete. + + + Returns true if an extra stage was earned. + + + Returns true if this is an extra stage. + + + Returns true if any human player is using a memory card. + + + Returns true if playing in Battle mode. + + + Returns true if playing in a Course mode. + + + Returns true if in Demonstration mode. + + + Returns true if the match was a draw. + + + Returns true if Event Mode is on, temporary or otherwise. + + + Returns true if this is the first extra stage. + + + Returns true if this is the second extra stage. + + + Returns true if player pn has completed the current Goal. + + + Returns true if player pn is human. + + + Returns true if player pn is enabled. + + + Returns true if player pn has joined the game. + + + Returns true if player pn is the winner. + + + Joins player pn. + + + Returns true if player pn is using modifier sModifier. + + + Returns true if players can join the game. + + + Resets the GameState. + + + Saves the bookkeeping and machine profile data. + + + Sets the current for the specified . + + + Sets the current Course to course. + + + Sets the current Song to song. + + + Sets Player pn's current Steps to steps. + + + Sets the current Trail to trail. + + + Sets if the Jukebox should use modifiers. + + + + + + Sets the number of multiplayer notefields to iFields + + + Sets the preferred difficulty of Player pn to Difficulty dc. + + + Sets the preferred Song to song. + + + Sets the preferred song group to sGroup. + + + Sets the Song Options from so using ModsLevel m. + + + Turns temporary Event Mode on or off, depending on bOn. + + + Determines if Judgment W1 should be shown based on bOn. + + + Unjoins player pn. + +
+ + + Loads the GradeDisplay commands from the Metrics in group sMetricsGroup. + + + Sets the GradeDisplay to show Grade g. + + + + + Loads the GraphDisplay commands from the Metrics in group sMetricsGroup. + + + Sets the values of the GraphDisplay using the specified StageStats and PlayerStageStats. + + + + + Sets the GrooveRadar values for Player pn to empty. + + + Sets the GrooveRadar values for Player pn from RadarValues rv + + + Tweens the GrooveRadar off screen. + + + Tweens the GrooveRadar on screen. + + + + + Returns two tables representing the tips and alternate tips in the HelpDisplay. + + + Sets the seconds between switches of tips to fSeconds. + + + Sets the HelpDisplay's tips using tips (and optionally altTips). + + + Sets the HelpDisplay's text from sTips using colons to separate new sections. + + + + + Returns the date and time the high score was achieved. + + + Returns the Grade of this high score. + + + Return the number of HoldNoteScores that match hns. + + + Returns the modifiers used for this HighScore. + + + Returns the name associated with the high score. + + + Returns the percentage of dance points associated with the high score. + + + Returns the RadarValues for this HighScore. + + + Returns the score associated with the high score. + + + Returns the number of seconds survived associated with the high score. + + + Return the number of TapNoteScores that match tns. + + + + + You can get a HighScoreList using . + + + Returns a table of the high scores. + + + + + Loads the HoldJudgment for the specified MultiPlayer. + + + + + Returns the X position of the mouse. + + + Returns the Y position of the mouse. + + + + + Returns the amount of life left in the LifeMeter as a float in the range 0..1. + + + Returns true if failing. + + + Returns true if the LifeMeter is "hot". + + + Returns true if in danger. + + + + + Returns the number of lives remaining. + + + + + + + + Returns true if player pn's card is locked. + + + Return the state for player pn. + + + Returns the name of the storage device. + + + Returns true if player pn's name is available. + + + + + Returns the current MenuTimer's value. + + + Pauses the MenuTimer, stopping it from counting down. + + + Sets the MenuTimer's value to fSeconds. + + + Sets the MenuTimer's silent setting to bSilent. + + + Sets the MenuTimer's stealth setting to bStealth. If + true, the timer will be invisible and silent. + + + Stops the MenuTimer by setting it to 0 and pausing. + + + + + Broadcast the message to all listeners subscribed to sMessage. The + second argument is an optional table of parameters. It may be omitted or explicitly + set to nil. + + + + + Sets the width of the MeterDisplay to fWidth. + + + + + Controls if the model should loop or not. + + + Plays animation sAniName at fPlayRate speed (default 1.0). + + + Sets how far into the animation the model is. + + + Sets the current animation's playback rate to fRate. + + + Sets the model's default animation to sAnimation at fPlayRate speed (default 1.0). + + + + Returns the number of states the Model has. + + + + + Loads the ModIconRow of Player pn from the Metrics in group sMetricsGroup. + + + + + Returns a command from the specified element and value. + + + Returns a command from the specified element and value using NoteSkin sNoteSkin. + + + Returns a bool from the specified element and value. + + + Returns a bool from the specified element and value using NoteSkin sNoteSkin. + + + Returns a float from the specified element and value. + + + Returns a float from the specified element and value using NoteSkin sNoteSkin. + + + Returns a integer from the specified element and value. + + + Returns a integer from the specified element and value using NoteSkin sNoteSkin. + + + Returns the path for the specified sButton sElement. + + + Returns the path for the specified sButton sElement using NoteSkin sNoteSkin. + + + Returns the actor for the specified sButton sElement. + + + Returns the actor for the specified sButton sElement using NoteSkin sNoteSkin. + + + + Returns true if the strName noteskin exists in the current gametype. + + + Returns a table of noteskin names for the current gametype. + + + + + Returns true if the first item in the row goes down. + + + Returns an index of the choice in the row that player pn is on. + + + Returns the OptionRow's layout type. + + + Returns the name of the OptionRow. + + + Returns the number of choices in this OptionRow. + + + Returns the row title string. + + + Returns the OptionRow's select type. + + + Returns true if this row is focused by player pn. + + + Returns true if this row forces one choice on all players. + + + + + Sets the PaneDisplay from the GameState. + + + + + Sets the PercentageDisplay from the specified PlayerState and PlayerStageStats. + + + + (PlayerInfo is a part of ScreenGameplay.) + + Returns the of player pn. + + + + + + + + Returns the current NoteSkin set in the PlayerOptions. + + + + + Returns true if a full combo (TNS_W3 and up) was obtained. + + + Returns true if a full combo (tns and up) was obtained. + + + Returns the number of Dance Points obtained by the player. + + + Returns how long the player has been alive. + + + Returns the best tap note score for a full combo. + + + Returns the number of calories burned. + + + Returns the player's current combo. + + + Returns the player's current life from 0..1. + + + Returns the player's current miss combo. + + + Returns the number of Dance Points possible to be obtained by the player. + + + Returns the player's current score multiplier. + + + Returns the player's grade. + + + Returns the number of judgments for a specified HoldNoteScore. + + + Returns the player's actual score on the lesson. + + + Returns the score needed to pass the lesson. + + + Returns the player's life remaining seconds. + + + Returns the machine high score index for this performance. + + + Returns the peak combo award for this performance. + + + Returns the personal high score index for this performance. + + + Returns a table of played steps. + + + Gets the percentage of taps that were scored as tns. + + + Returns the player's Dance Point percentage. + + + Returns the number of possible Dance Points. + + + Returns a table of possible steps. + + + Returns a RadarValues object representing the player's actual performance. + + + Returns a RadarValues object representing the total values for the song. + + + Returns the score. + + + Returns the stage award for this performance. + + + Returns how long the player survived in seconds. + + + Returns the number of judgments for a specified TapNoteScore. + + + + Returns the max combo for this performance. + + + Returns true if the player was disqualified from ranking. + + + Sets the Player's score to iScore. + + + + + Returns the HealthState for this PlayerState. + + + Returns the multiplayer number for this PlayerState. + + + Returns the PlayerController for this PlayerState. + + + Returns the player number for this PlayerState. + + + Returns a PlayerOptions object for the specified ModsLevel. + + + Returns a string of player options for the specified ModsLevel. (was GetPlayerOptions in v1.2.2 and prior) + + + Returns a table of strings, containing the player options for the specified ModsLevel. + + + Sets the player options to sPlayerOptions for the specified ModsLevel. + + + + + Return the value of the preference sPreference. + + + Return true if preference sPreference exists. + + + Set the value of the preference sPreference to value. + + + Reset preference sPreference to the default value. + + + + + Returns the number of calories burned during the current day. + + + Returns the Character being used by this profile. + + + Returns a composite of your high scores over courses with the specified StepsType and Difficulty. + + + Returns the percentage of courses that you've completed with the specified StepsType and Difficulty. + + + Returns the possible score of courses with the specified StepsType and Difficulty. + + + Returns the profile's display name. + + + Return the number of calories burned as a string. + + + Returns the number of calories needed to reach the goal. + + + Returns the number of seconds needed to reach the goal. + + + Returns the current goal type. + + + Gets the profile's HighScoreList for a specified Song and Steps. (Alternate arguments for Courses: Course c, Trail t) + + + Returns the number of Toasties gotten using the specified profile. + + + Returns the profile's most popular course. + + + Returns the profile's most popular song. + + + Returns the total number of songs played with the profile. + + + Returns the number of times song s has been played with the profile. + + + Returns a composite of your high scores over songs with the specified StepsType and Difficulty. + + + Returns the percent complete for all songs and courses for the specified StepsType st. + + + Returns the percentage of songs that you've completed with the specified StepsType and Difficulty. + + + Returns the possible score of songs with the specified StepsType and Difficulty. + + + Return the total number of calories burned. + + + Returns the number of Hands stepped on. + + + Returns the number of successful Holds. + + + Returns the number of Jumps stepped on. + + + Returns the number of successful Lifts. + + + Returns the number of Mines stepped on. + + + Returns the total number of songs played with the profile. + + + Returns the number of successful Rolls. + + + Returns the number of steps with the specified StepsType and Difficulty that you've scored a certain Grade g on. + + + Returns the number of Taps and successful Holds. + + + Returns the number of trails with the specified StepsType and Difficulty that you've scored a certain Grade g on. + + + Returns how much the player weighs. + + + Returns true if the player has passed any steps in the specified Song s. + + + Returns true if the specified code sUnlockEntryID is unlocked. + + + Sets the current for the Profile. + + + Sets the goal to iCals calories. + + + Sets the goal to iSecs seconds. + + + Sets the current goal type to gt. + + + Sets how much the player weighs (in pounds) to weightPounds. + + + + Returns the amount of time this profile has spent in gameplay (in seconds). + + + Returns the number of sessions this profile has had. + + + Returns the total session length (in seconds) of this profile. + + + + + + + + + Retuns the machine profile. + + + Retuns the amount of local profiles. + + + Returns the profile for player pn. + + + Returns the profile directory of the specified ProfileSlot. + + + Returns true if player pn's profile is persistent. + + + Returns true if Song s has never been played before (according to the machine profile). + + + Returns true if the last load of player pn's profile was a LastGood copy of the profile. + + + Returns true if the last load of player pn's profile resulted in a tampered or corrupt profile. + + + Saves the machine profile. + + + + + Returns the value of rc from . + + + + + Return the height of the display. + + + Return the width of the display. + + + + + These commands require a RageFile handle. You can create one using + . + + + Returns true if the current position within the file is the end. (EOF = End of File) + + + Clears the last error message. + + + Closes the file and releases it from memory. + + + Safely deletes the file handle. + + + Gets the last error message and returns it. + + + Gets a line and returns it. + + + Opens a file at sPath (relative to the StepMania root directory).
+ iAccessType can be set to read (1), write (2), stream (4) or flush to disk on close (8).
+ These can also be combined with addition. For example, to set up read and write, set iAccessType to 3 (1+2). +
+ + Puts a new line in the file. + + + Returns a string containing the entire contents of the file. + + + Returns length bytes from the RageFile's current position. + + + Seeks to a position in the file and returns the new position. + + + Returns the current position in the file. + + + Writes a file with the contents of str. + +
+ + + Returns true if a file exists at sPath. + + + Returns a listing of files from sPath. The last two arguments are optional (and default to false). + + + Returns a file's size in bytes. + + + Returns the hash of the file at sPath. + + + + + Return an array of connected input device descriptions. + + + + + See for loading a sound. + + + Sets the value of sProperty to fVal. The supported properties depend on how the associated was loaded. + + + Sets the pitch to fPitch. The associated have SupportsRateChanging = true on load. + + + Sets the speed (that is, the rate at which the sound plays) to fSpeed. The associated must have SupportsRateChanging = true on load. + + + Sets the volume to fVolume, which is between 0..1. + + + + + Return the texture coordinate rectangle as {left, top, right, bottom}. + + + Sets the animation or movie looping to bLoop. + + + Sets the animation or movie position to fPos. + + + Sets the animation or movie playback rate to fRate. + + + + + Loads the metrics for this RollingNumbers from sGroupName. + + + Sets the target number to f. + + + + + Returns the name of the next Screen. + + + Returns the name of the previous Screen. + + + Locks input for f seconds. + + + Posts a message with the text sScreenMsg to the Screen. + + + + + Returns the current . + + + + + Returns the current StageStats. + + + + + Returns true if a single has its NoteField centered. + + + Returns a dummy PlayerInfo for the specified index. + + + Returns the for the specified pn. + + + Returns the next in the current . + + + Returns the PlayerInfo for player pn. + + + Sets the next Screen to be loaded. + + + Returns true if the game is paused. + + + Pauses or unpauses the game, depending on the value of bPause. + + + + + Returns the LifeMeter. + + + + + Adds a screen at the top of the screen stack. + + + Gets the screen at the top of the screen stack. + + + Reloads any loaded overlay screens. + + + Returns true if screen class s exists. + + + Returns true if screen s is prepared. + + + Sets the next screen to s. + + + Broadcasts a system message. + + + + + Returns true if Player pn backspaced successfully. + + + Returns true if Player pn was able to add sKey to their name. + + + Attempts to finish Player pn and returns true + if successful. + + + Returns true if anyone is entering their name. + + + Returns true if anyone is still entering their name.
+ (As opposed to those who are Finalized; see ) +
+ + Returns true if Player pn is entering their name. + + + Returns true if Player pn is finished entering their name. + + + Gets the currently selected letter of Player pn. + +
+ + + Returns the number of active players. + + + + + Returns true if all active players are on the last options row. + + + Returns true if the specified player is on an items that ends the screen. + + + Returns the current row that player pn is on. (Was previously GetCurrentRow.) + + + Returns the specified OptionRow. + + + + + Returns true if we are going to PlayerOptions. + + + + + Continues to the next screen. + + + Returns true if there is a profile that can be loaded. + + + + + Continues to the next screen. + + + Returns true if there is a profile that can be saved. + + + + + Returns player pn's current selected item as an integer. + + + + + Returns true if the player is going to the options screen. + + + Returns the MusicWheel used on this screen. + + + [02 StageMods.lua] Sets up modifiers for course modes. + + + [02 StageMods.lua] Sets up modifiers for non-course modes. + + + + + Tells the screen to go to the previous screen. + + + Attempts to finish the screen and returns true + if successful. + + + Returns the profile index of the specified Player. + + + Sets the profile index of Player pn to iProfileIndex. + + + + + See the Changelog for details on TextEntrySetting's format. + + + Sets up a ScreenTextEntry's values. + + + + + Tells the screen to go to the previous screen. + + + + + Returns an array of all the available objects for a . + + + Returns the path to the song's background image. + + + Returns the path to the song's banner. + + + Gets the path to the CDTitle. + + + Returns the displayed artist of the song. + + + Returns a table of 2 floats containing the display BPMs. + + + Returns the displayed full title of the song, including subtitle. + + + Returns the displayed main title of the song. + + + Returns the displayed subtitle of the song. + + + Returns the first beat of the song. + + + Returns the genre of the song. + + + Returns the group name that the song is in. + + + Returns the last beat of the song. + + + Gets the path to the lyrics. + + + Gets the path to the music file. + + + Returns a Step object if the StepType and Difficulty exist. + + + Returns the song's directory. + + + Returns the songfile path. + + + Returns a table of Steps that have StepsType st. + + + Returns how long the longest stepchart is in seconds. + + + Returns the song's TimingData. + + + Returns the transliterated artist of the song. + + + Returns the transliterated full title of the song, including subtitle. + + + Returns the transliterated main title of the song. + + + Returns the transliterated subtitle of the song. + + + Returns true if the song has steps for the specified difficulty in st. + + + Returns true if the song has attacks. + + + Returns true if the song has a background. + + + Returns true if the song has a banner. + + + Returns true if the song has BGChanges. + + + Returns true if the song has a CDTitle. + + + Returns true if the song has edits. + + + Returns true if the song has lyrics. + + + Returns true if the song has music. + + + Returns true if the song has significant elephants or bison. + + + Returns true if the song has . + + + Returns true if the song's DisplayBPM is constant. + + + Returns true if the song's DisplayBPM is random. + + + Returns true if the song's DisplayBPM is secret. + + + Returns true if the song is considered easy. + + + Returns true if the song is enabled. + + + Returns true if the song meets the criteria for a "Long Version". + + + Returns true if the song meets the criteria for "Marathon" length. + + + Returns true if the song only has Beginner steps. + + + Returns the length of the song in seconds. + + + Returns true if the song is normally displayed. + + + + + Returns a Course if one matching sCourse is found. + + + Returns a Song if one matching sSong is found. + + + Returns an array of all the installed courses. + + + Returns an array of all the installed songs. + + + Returns the course color of Course c. + + + Returns the extra stage info (Song, Steps) for the specified Style s. (If bExtra2 is true, it will use the second Extra Stage data instead of the first. Again, Lua.xsd sucks) + + + Returns the number of courses loaded via Additional folders. + + + Returns the number of songs loaded via Additional folders. + + + Returns the number of course groups. + + + Returns the number of courses. + + + Returns the number of selectable and unlocked songs. + + + Returns the number of song groups. + + + Returns the number of songs. + + + Returns the number of unlocked songs. + + + Returns a random course. + + + Returns a random song. + + + Returns the song color of Song s. + + + Returns a Song given a set of Steps st. + + + Returns the song group color of sGroupName. + + + + Returns a table containing all of the song group names. + + + Returns the rank (popularity) of Song s. + + + Returns a table containing all of the songs in group sGroupName. + + + Returns the shortened group name (based on entries in Translations.xml). + + + Loads preferred courses from {theme}/Other/SongManager sListName.txt. + + + Loads preferred songs from {theme}/Other/SongManager sListName.txt. + + + + + Returns the length of the animation in seconds. + + + Return the number of states this Sprite has. + + + Returns the Sprite's current state (frame number in a multi-frame sprite). + + + Returns the Sprite's texture. + + + [02 Sprite.lua] Returns a Frames table consisting of iNumFrames frames lasting for a total of fSeconds seconds. This function is not a member function and should be used as Frames = Sprite.LinearFrames( 5, 2.6 ). + + + If sPath is nil, then unload the texture. Otherwise, load the texture at path sPath. + + + Load the song background texture at sPath. + + + Load the song banner texture at sPath. + + + [02 Sprite.lua] Load the texture for song's background. + + + [02 Sprite.lua] Load the texture for song's banner. + + + Sets the custom image rectangle. (Works in image pixel space.) + + + Set the to mode. + + + Set the texture to texture. + + + + + + Allows the themer to set a custom texture rectangle that effects the way the texture is drawn. + + + [02 Sprite.lua] Call RageTexture:loop( bLoop ) on the texture. + + + [02 Sprite.lua] Call RageTexture:position( fPos ) on the texture. + + + [02 Sprite.lua] Call RageTexture:rate( fRate ) on the texture. + + + Scale the Sprite to width fWidth and height fHeight clipping if the dimensions do not match. + + + Set the Sprite's state to iNewState. + + + + + + Set the texture coordinate velocity which controls how the Sprite changes as it animates. + + + + Crops the Sprite to fWidthxfHeight. + + + [01 alias.lua] Alias for CropTo. + + + Sets all the state delays to fRate. Useful for Sprites that need to change by BPM (e.g. Tran from DDR 5th Mix, the cube from DS EuroMix 2). + + + + + Returns true if everyone failed. + + + Returns the EarnedExtraStage value. + + + Returns the number of seconds played. + + + Returns the PlayerStageStats of multiplayer mp. + + + + Returns the PlayerStageStats of player pn. + + + + Returns the Stage value. + + + Returns the stage index. + + + Returns true if at least one person passed. + + + Returns true if player pn has a high score. + + + + + Returns the accumulated played StageStats. + + + Returns the best final grade. + + + Returns the best grade. + + + Returns the current StageStats. + + + Returns player pn's final grade. + + + Get the StageStats from iAgo rounds ago. + + + Returns the number of stages played. + + + Returns the worst grade. + + + Resets the stats. + + + + + Returns the author that made that particular Steps pattern. + + + Returns the Chart Style for this Steps. + + + Returns the Steps description. + + + Returns the Steps difficulty. + + + Returns the Steps filename from the Cache. + + + Returns a hash of the Steps. + + + Returns the numerical difficulty of the Steps. + + + Returns the complete list of RadarValues for player pn. Use to grab a specific value. + + + Returns the Steps type. + + + Returns true if the Steps are an edit. + + + Returns true if the Steps are a player edit (loaded from a profile). + + + Returns true if the steps were automatically generated. + + + + + Loads the StepsDisplay commands from the Metrics in group sMetricsGroup. + + + Sets the StepsDisplay from the GameState using Player pn. + + + Sets the StepsDisplay based on Steps pSteps. + + + Sets the StepsDisplay based on the passed in StepsType, iMeter, and Difficulty. + + + Sets the StepsDisplay based on Trail pTrail. + + + + + Returns the number of total tracks this Style contains (e.g. 4 for dance-versus, but 8 for dance-double). + + + Returns the name of the Style. + + + Returns the StepsType for this Style. + + + Returns the StyleType for this Style. + + + Returns true if the Style needs to be zoomed out with two players. + + + + + Loads the TextBanner from the specified metrics group. + + + Loads the TextBanner's child elements from a . + + + Loads the TextBanner's child elements from strings. + + + + + Returns the current language. + + + Returns the theme's current directory. + + + Returns the value of Element in Class from metrics.ini. + + + Returns the number of selectable themes. + + + Returns the path of ClassName Element in the BGAnimations folder. + + + Returns the path of an element in the Fonts folder. + + + Returns the path of an element in the Graphics folder. + + + returns three strings: BGAnimation ResolvedPath, MatchingMetricsGroup, MatchingElement. Used in LoadFallbackB in themes/_fallback/02 Other.lua. (Lua.xsd sucks) + + + Returns the path of an element in the Other folder. + + + Returns the path of an element in the Sounds folder. + + + Returns a table of selectable theme directories. + + + Returns the value of Element in Class for the currently loaded language. + + + Returns the author of the current theme or "[unknown author]". + + + Returns the display name of the current theme. + + + Reloads the current theme's metrics. + + + + + Returns the minimum and maximum BPM of the song in a table (in that order). + + + Returns the beat from fElapsedTime. + + + Returns the BPM at fBeat. + + + Returns a table of the BPMs as strings. + + + Returns a table of the BPMs and the times they happen as strings with the format "beat=BPM". + + + Returns the elapsed time from fBeat. + + + Returns a table of the Stops and the times they happen as strings with the format "beat=stop seconds". + + + Returns a table of the Delays and the times they happen as strings with the format "beat=stop seconds". + + + Returns true if the TimingData contains BPM changes. + + + Returns true if the TimingData contains any BPM changes with a negative BPM. + + + Returns true if the TimingData contains stops. + + + + + Returns an array with all the artists in the Trail. + + + Returns the Trail's difficulty. + + + Returns a table of TrailEntry items. + + + Returns the Trail's difficulty rating. + + + Returns the Trail's RadarValues. + + + Returns the Trail's StepsType. + + + Returns the TrailEntry at index iEntry. + + + + + Returns a string of modifiers used in this TrailEntry. + + + Returns the Song used in this TrailEntry. + + + Returns the Steps used in this TrailEntry. + + + (why'd I think this was a good idea when we have ?) + + + + + Sets the UnlockEntry's ID to m_sEntryID. + + + Sets the UnlockEntry's course to sCourseName.
+ Example: course,"Driven" +
+ + Returns the unlock description. + + + Returns the UnlockRequirement. + + + Returns true if the UnlockEntry requires you to pass Hard steps. + + + Returns the Song related to the UnlockEntry. + + + Returns the UnlockRewardType for this entry. + + + Returns true if the UnlockEntry is locked. + + + Sets the UnlockEntry's modifier to sModifier. + + + Sets the requirement for this unlock to m_fRequirement. + + + Makes the UnlockEntry require passing Hard steps. + + + Makes the UnlockEntry hide in Roulette. + + + Sets the UnlockEntry's song to sSongName.
+ sSongName also requires the group.
+ Example: song,"In The Groove/Pandemonium" +
+ + Sets the UnlockEntry to unlock a specified song's steps.
+ Example: steps,"In The Groove/Pandemonium","expert" +
+
+ + + Returns true if there are any unlocks to celebrate. + + + Returns the associated EntryID. + + + Returns the number of unlocked items. + + + Returns the number of all unlock items, regardless of status. + + + Returns the number of points until the next unlock. + + + Returns a table of songs unlocked by UnlockEntry sEntryID. + + + Returns a table of steps unlocked by UnlockEntry sEntryID. + + + Returns the UnlockEntry at iIndex. + + + Returns the UnlockEntry index to celebrate. + + + + Unlocks an entry by ID. + + + Unlocks an entry by index. + + + + + Returns the wheel's current index. + + + Returns the total number of items in the wheel. + + + Returns the WheelItem at index iIndex. + + + Returns true if the wheel is locked. + + + Returns true if the wheel is settled/stopped moving. + + + Moves the wheel by n. + + + Attempts to set the open section to sSection. + + + + + Sets the WorkoutGraph from the current Workout. + + + Sets the WorkoutGraph from GameState and song index iSongIndex. + + +
+ + + + + Blending modes. See . + + + + + Horizontal alignment. See . + + + + + Vertical alignment. See . + + + +
diff --git a/Docs/SimfileFormats/BMS/BMS_Reading_Tutorial.txt b/Docs/SimfileFormats/BMS/BMS_Reading_Tutorial.txt index 78423d4dd9..47d2c87d21 100644 --- a/Docs/SimfileFormats/BMS/BMS_Reading_Tutorial.txt +++ b/Docs/SimfileFormats/BMS/BMS_Reading_Tutorial.txt @@ -1,323 +1,323 @@ -..: HOW TO READ A .BMS/.BME WITH A NOTEPAD AND A BRAIN :.. - ..: Tutorial v1.1 by Jack A. Trades :.. - -~ v1.1 differences -~1 Updated BPM Change method for over 255 and/or decimal BPM usage. -~2 Spelling/word errors fixed. -~3 Added a new KEYLOCATION variable, to go with the ~1 update. - -!TIP! -This tutorial is best viewed in fixed-width fonts, like Lucida Console or Courier New. It's also best viewed when Word Wrap feature is enabled, so if you need to copy and paste the entire tutorial to a temporary Notepad, then you may do so. You can always get the .rtf version if that's a hassle. - -!NOTE! -This tutorial is intended for the creation/viewing/translation (what the hell?) of a .bms/.bme for any beatmania game. I will not include any other function that might also function in other BEMANI games such as DDR arrows or whatever else that a .bms/.bme can do. BEATMANIA ONLY PLZTHXBYE. - -!!DISCLAIMER!! -This tutorial is created entirely from my knowledge and experience of .bms/.bme. I am not responsible for any loss of work, destruction of property, or loss of sanity when you are deciphering your own .bms/.bme and using this tutorial as your guide. Do not bug me if you somehow burned your computer or threw your cat out of the balcony. I don't want to hear it, except the cat part. I'll be sure to call Humane Society on that one. - - - So you want to read a BMS, eh? Well then, read on and I'll show what little bits of pieces of a .bms/.bme stand for, for I had no life, and I deciphered almost each of the mechanics a BMS/BME can have. - - - A BMS have two parts: HEADER and MAIN DATA FIELD. Without each other, they're useless, basically. - - - - -*----------HEADER - - There are three sections of the header: BASIC, EXTENSION, and the third section that I like to call ASSIGNMENT. - - BASIC is the heart and soul of the .bms/.bme, where it tells the simulator (and you) what the hell is the song about. Title of the song, artist name, genre, BPM, play mode, and play level is specified here. - EXTENSION is the optional header that can contain tags you can put as cosmetics, basically. - ASSIGNMENT is the last, but not least, section of the header. This is where the life of keysounds and background animations (hereon called as "bga") begin. You can specify as many as 255 keysound tags and 255 bga tags so the simulator knows what file to play at where and when. - - We will begin by explaining each available tags for BASIC header. Notice that lines that begin with *--- are my comments in the header section, as to not confuse you in an actual .bms/.bme. - -*---BASIC HEADER - - - -#PLAYER # -*---specifies player amount (options are 1 or 2). Use your logic; if it's 5/7-keys, use #PLAYER 1. If it's 10/14-keys, use #PLAYER 2. - -#GENRE [x] -*---specifies the genre [x] when the song is currently highlighted. - -#TITLE [x] -*---specifies the title [x] when the song is currently highlighted. - -#ARTIST [x] -*---specifies the artist [x] when the song is currently highlighted. - -#BPM ### -*---specifies ### ( 0 to 999 ) as the first (or only) BPM value of the song. - -#PLAYLEVEL ## -*---specifies # ( 0 to 9 ) as the amount of difficulty (stars) of the song. Some simulators, from my experience, can support values above 9, but let's not be that stupid, shall we? - -#MIDIFILE xxx.mid -*---This tag is optional if a bgm .wav/.mp3 already exists. Specifies the MIDI file to be played at the beginning of the song. MIDI file must be in the same directory where your .bms/.bme exists. - - - -*---EXTENSION HEADER - - - -#RANK # -*---specifies # ( 0 to 3, where 0 is Very Hard, 1 is Hard, 2 is Normal, and 3 is Easy) as the "rank" of the song. I don't know the exact function, but I don't think it'll tell the simulator to change the judge setting. - -#TOTAL ### -*---I'm not quite sure about this, but I think this specifies the maximum notes you can get in this song. So values from 0 to 9999 works, I guess. - -#VOLWAV ??? -*---I don't know the actual specifier, but I have a hunch this tells the simulator to decrease or increase the volume of the bgm with/out keysounds. - -#STAGEFILE xxx.yyy -*---specifies the "preview" graphic of the song. Think backgrounds in DDR. This will be shown after you choose the song, during the loading of keysounds and bganimations, if available, and will disappear when the song starts. xxx.yyy specifies the filename and filetype respectively. I think you can also use directory command (Using ..\..\hi.jpg may tell the simulator to use the file hi.jpg two directories above the directory where this .bms/.bme exist) but I haven't tested it. - -%EMAIL [x] -*---a comment header; you can enter your e-mail address, if desired. - -%URL [x] -*---a comment header; you can enter your website url address, if desired. - - - -*---ASSIGNMENT HEADER - - - -#WAV** xxx.yyy - -*---this is where you specify the keysound file to be stored into a local variable by the simulator, where it will be able to be called upon during the gameplay of the song, and where ** is a two-digit hex value, xxx is the filename, and yyy is the filetype (commonly used are either WAV or MP3 files). -*---In Layman's terms, this is where you'll give the simulator a cardboard sign that says a two-digit number (or letter. explanation later...) and tell it to play SUCH AND SUCH file whenever you tell it to. So, an example would be: - -*---#WAV01 kickdrum.wav - -*---This means that whenever there's a section in the .bms/.bme that asks for a 01 in the keysound section, the simulator will then play the file kickdrum.wav, under two conditions: (1) IF AND ONLY IF the player actually presses the key, or (2) IF AND ONLY IF the digit called is in the Always-autoplay section. - -*---Confused with those new vocabularies? Read on and you'll understand what the hell I'm babbling. - -*---The **, or the two-digit number (or letter), ranges from 00 to FF. If you haven't noticed, it's the range of a 2-byte hex value. This means that you can specify up to 255 _different_ keysound files for the simulator to memorize. To assign more variables, just make a new line with changed variable number and filename. Example: - -*---#WAV01 kickdrum.wav -*---#WAV02 hi-hats.wav - -#BMP** xxx.yyy - -*---The #BMP tag has the same idea as the #WAV tag, and also the same usage. The only difference is that the variables will be called in different sections. See the Main Data Field for further explanation. - -*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON -*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON -*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON - -*---You do NOT need to specify every single variable. That means stop typing 500 lines of specifying nothing. Any unspecified variables will be assumed as "blanks" by the simulator, and when it is called, the simulator will do nothing, if it's a keysound, or the simulator will stop any animation previously and display nothing, if it's a bga. - - -*----------MAIN DATA FIELD - - _THIS_ is the fun part. This section is where all of the keysounds are specified in bits and pieces of measures of the music, and _THIS_ is where you must act like a detective and decipher what the hell each line stands for. Thankfully, I have come with aid. And chips. And guacamole dip. - -BACK TO THE POINT - - Many of you will see jumbles of nothing but digits in a normal .bms/.bme file, but do you ever wonder how does it work? I'm sure you do, because if you've never wondered so, you won't be reading through here. Or to here, even. - - So we will begin, with the explanation. I'll have fun 'splaining as I will 'yping. - 'ey! 'ccent 're 'ool! 'nd 'nintelligible 'oo!!! 'o 'ffense. - - - - So here you are, wandering around the main data field, and you see numbers like this. - -#00412:00000000000000005F0000001A000000E3 - -and something like that repeated differently about 3000 times. - -Let's begin understanding each section by breaking down the given example line. Obviously you should already understand the #. All codes begin with #. Duh. - -# 004 12 :00000000000000005F0000001A000000E3 - ^ - | - | - -This is your _Measure #_ . Obviously it ranges from Measure 1 (000) to Measure 1000 (999), but what song have 1000 measures? Hopefully you're not making a .bms/.bme to a nonstop megamix. Anyway, this tells the simulator what's going on in such measure. In this example, there are...12...thing...with a colon and many zeroes and 5F and 1A and E3 here and there in measure 5....interesting. Don't worry; you'll understand those things soon. - -Speaking of soon, we're moving right along to the next part. Boy was that quick or what? - - -# 004 12 :00000000000000005F0000001A000000E3 - ^ - | - | - - This is what I like to call KEY LOCATION variable, where it tells the simulator to put those...zeroes...and 5F...and the rest of the garbage into a variable of digit "12." - That didn't make a lot of sense, did it? Of course not. It didn't to me at first, until I deciphered the possible variables of key locations. Below is the list of the KEY LOCATION and its variable two-digit number. - - -KEYLOCATION - ACTUAL LOCATION/FUNCTION -====================================== -11 - White key 1 (Most left) -12 - Blue key 1 (Most left) -13 - White key 2 (Second from the left) -14 - Blue key 2 (Center) -15 - White key 3 (Second from the right) -18 - Blue key 3 (Most right) -19 - White key 4 (Most right) -16 - Scratch (The big circle thing that makes wiki wiki wiki wik wik sound) -17 - unknown function currently -04 - BGA -07 - unknown function currently -06 - MISS BGA -01 - Always Autoplay -03 - BPM Change -08 - "Advanced" BPM Change - - - So in the above example, the code 00000000000000005F0000001A000000E3 will all be executed solely for the Blue key 1. - - - "BUT JACK A. TRADES, I WANNA KNOW HOW THOSE NUMBERS WORK AND WHAT ARE THEY ACTUALLY!?!??!?!/1/1/131'31'3nklnalndkland" - - Let's stop the question and start looking at the example below. - -# 004 12 :00000000000000005F0000001A000000E3 - ^ ^ - -------------------------------- - | - | - - _NOT_ simply put, they are the codes that tell the simulator to call up all of the specified variables in a single measure. I lost you, didn't I? - Simply put, in this example, the simulator is told to call the following variables: 00 (8 times), 5F, 00 (3 times), 1A, 00 (3 times), and E3. That means the simulator will first find what you have specified earlier in the ASSIGNMENT HEADER, follow your command, and open/play that file for you at that point of time. - But how should this help you in terms of music? How can you specify exact call locations for the simulator, like a kick drum every beat in a measure, or a hi-hats for every-other-eighth-beat in a measure? This is where the (other) fun part comes in. - - The amount of digits available will determine what kind of a note each double-digit is. I lost you again, didn't I? - - For (another?) example, if you put a line of code such as this instead of the given example above: - - #00412:5F - - You're telling the simulator to play the 5F keysound whenever the player presses the blue key 1 at the first beat of measure 5. - - HOLY CRAP HOW DID I KNOW THAT!? - Well, if you've studied music, and understand what the hell I was saying earlier, then you must know you only specified one digit for the measure, and that means the simulator will assume that double-digit as a whole note. Remember: 4 beats equal a measure, and a whole note = 4 beats. - - So if you specify this instead: - - #00412:5F005F00 - - The simulator will assume each double-digit as _quarter note_ and do the polka. I mean, do its thing. Play 5F in the first beat of the measure, play 00 in the second beat, play 5F in the third and finally play 00 in the fourth. - - If I specify: - - #00412:001A001A001A001A - - I'm telling the simulator to play the 1A in every other sixteenth notes. Get the picture? - - THE AMOUNT OF DOUBLE DIGITS AvAILABLE IN THE LINE OF CODE SPECIFIES THE TYPE OF NOTE EACH ARE - - If there is one double-digit, it is a whole note. - If there are two double-digits, each double-digit is a half note. - If there are four double-digits, each double-digit is a quarter note. - If there are eight double-digits, each double-digit is a eighth note. - If there are sixteen double-digits, each double-digit is a sixteenth note. - If there are twelve double-digits, each double-digit is a twelveth note. - If there are thirty two double-digits, each double-digit is a thirty-second note. - ET CETERA - - The highest note type a simulator can take, usually, is a 192nd note. If you go beyond that, something is wrong with you or the song. Probably you, but you never know. - - - So let's recap! What does this code actually tell you? - - #00412:00000000000000005F0000001A000000E3 - - At measure 5 ( #004 = MEASURE #5 ), - The following variables are to be called in the Blue Key 1 section ( #xxx12 = Blue Key 1 ): - 00,00,00,00,00,00,00,00,5F,00,00,00,1A,00,00,00,E3 - Where each note is assumed as (in this strange case) a seventeenth note. - Therefore, the simulator must play the keysound of variable 00 in the first seventeenth note, then another 00 in the second seventeenth note, etc. - - - And you're done! See, that wasn't so hard, was it? But you think I'm forgetting something. Actually, two things. Well, I'm not, so shut up. That code always apply to everything you see in the KEYLOCATION table, including BGA and Always Autoplay. - The difference in the BGA, however, is that the simulator will load the graphics of the specified variables. So, if you've specified #BMP01 neh.bmp, and you want to call the graphic in a note, then the simulator will _NOT_ play the keysound for 01, but it will instead load the neh.bmp file. - The other and my last point that you think I've forgotten is the actual explanation of the other KEYLOCATION functions. I'll put the table below again for your convenience. - - - -KEYLOCATION - ACTUAL LOCATION/FUNCTION -====================================== -11 - White key 1 (Most left) -12 - Blue key 1 (Most left) -13 - White key 2 (Second from the left) -14 - Blue key 2 (Center) -15 - White key 3 (Second from the right) -18 - Blue key 3 (Most right) -19 - White key 4 (Most right) -16 - Scratch (The big circle thing that makes wiki wiki wiki wik wik sound) -17 - unknown function currently -04 - BGA -07 - unknown function currently -06 - MISS BGA -01 - Always Autoplay -03 - BPM Change -08 - "Extended" BPM Change - - - -So what's 17 and 07 all about? I sure as hell don't know. Perhaps if you know, you would help me out with this tutorial. C'mon; I typed everything you see here, from my brain, in one single session. - -Never mind that for now. What's MISS BGA, Always Autoplay, and BPM, you ask? - - MISS BGA is where you can specify any custom animations you have when the player is currently missing the notes he's playing. If you want an absolute, easy example, find and download onoken - P8107 bms file with the background, and just miss a couple of notes (or the whole song and failing it, like I did!). You'll see that onoken has incorporated a custom MISS animation. - Of course, if you don't have the patience to make one, you can always specify a single image that has the word MISS in bold, or something. Preferably red, you know. - But nevertheless, to specify them is the exact same as how you would specify BGA or keysounds, but the only hassle is you have to copy and paste the same exact line for each measure you have. - - This is also true for my next topic: Always Autoplay. Mostly used in [L7] and usually in [7] keysound files, this baby will make sure any sound (or annoying noises) will always be played even if the player just sits there and watches himself plummet to a Game Over screen. Or something. The usage is a bit different, however. Remember that THE AMOUNT OF DOUBLE DIGITS AvAILABLE IN THE LINE OF CODE SPECIFIES THE TYPE OF NOTE EACH ARE rule? Well, it applies to every code you can see, even those beyond the horizon. - - So what do you have to do when you want to have two, three, or even four or more keysounds to play at the same exact time? Specify a new line, with different codes! Example is below: - -#00001:01 -#00001:02 -#00001:03 - -This tells the simulator to play keysounds 01, 02, and 03 at the first note in measure 1. Simple, no? - - But when you blame me for forgetting things, you are right for one thing, but ONLY one thing. I forgot to mention the BPM. That lil' bugger is used when you want to suddenly change the BPM value of the song. The usage is still the same, with a little variation. - -#01103:96 - - The lil' code above this paragraph tells the simulator to change the BPm at measure 12 to 150 BPM. So how did I get 150 from 96? Some weird formula like standard deviation of the population mean in a binomial distribution? - - Heck no, I got 150 because 96 is the hex value of 150. Let me remind you that 2-byte hex value only goes up to 255 in decimal, so in short, if you're trying to create a .bms/.bme for MaxX Unlimited, where the BPM changes from 300 to 280 to 300 to 150 to 320, we might have a problem. How would you specify a BPM value over 255? - -[credit goes to pukpuk/2220 for finding the method originally and jammitch for pointing me to the solution] - - You can specify your BPM in the ASSIGNMENT header, as you may recall. The process is the same; the code tag is the only one different. So if you want to specify a BPM of 320, put: - -#BPM01 320 - - And call it in the main data field like: - -#00408:01 - - This will call the BPM Change of 01 in measure 5, and thus changing the song's BPM to 320. - - - So if you want multiple BPM changes: - -#01103:96AFC8E1 - - This tells the simulator to change the BPM to 150 at the first quarter note of Measure 12, to 175 at second quarter note, 200 at third, and 225 and fourth. - - - - - - - - -And with that, I conclude this tutorial. Hopefully I have made a tutorial that can actually help you read .bms/.bme more intelligently, and not think of egyptian inscriptions when you see those codes. Until next time, I am Jack A. Trades. - +..: HOW TO READ A .BMS/.BME WITH A NOTEPAD AND A BRAIN :.. + ..: Tutorial v1.1 by Jack A. Trades :.. + +~ v1.1 differences +~1 Updated BPM Change method for over 255 and/or decimal BPM usage. +~2 Spelling/word errors fixed. +~3 Added a new KEYLOCATION variable, to go with the ~1 update. + +!TIP! +This tutorial is best viewed in fixed-width fonts, like Lucida Console or Courier New. It's also best viewed when Word Wrap feature is enabled, so if you need to copy and paste the entire tutorial to a temporary Notepad, then you may do so. You can always get the .rtf version if that's a hassle. + +!NOTE! +This tutorial is intended for the creation/viewing/translation (what the hell?) of a .bms/.bme for any beatmania game. I will not include any other function that might also function in other BEMANI games such as DDR arrows or whatever else that a .bms/.bme can do. BEATMANIA ONLY PLZTHXBYE. + +!!DISCLAIMER!! +This tutorial is created entirely from my knowledge and experience of .bms/.bme. I am not responsible for any loss of work, destruction of property, or loss of sanity when you are deciphering your own .bms/.bme and using this tutorial as your guide. Do not bug me if you somehow burned your computer or threw your cat out of the balcony. I don't want to hear it, except the cat part. I'll be sure to call Humane Society on that one. + + + So you want to read a BMS, eh? Well then, read on and I'll show what little bits of pieces of a .bms/.bme stand for, for I had no life, and I deciphered almost each of the mechanics a BMS/BME can have. + + + A BMS have two parts: HEADER and MAIN DATA FIELD. Without each other, they're useless, basically. + + + + +*----------HEADER + + There are three sections of the header: BASIC, EXTENSION, and the third section that I like to call ASSIGNMENT. + + BASIC is the heart and soul of the .bms/.bme, where it tells the simulator (and you) what the hell is the song about. Title of the song, artist name, genre, BPM, play mode, and play level is specified here. + EXTENSION is the optional header that can contain tags you can put as cosmetics, basically. + ASSIGNMENT is the last, but not least, section of the header. This is where the life of keysounds and background animations (hereon called as "bga") begin. You can specify as many as 255 keysound tags and 255 bga tags so the simulator knows what file to play at where and when. + + We will begin by explaining each available tags for BASIC header. Notice that lines that begin with *--- are my comments in the header section, as to not confuse you in an actual .bms/.bme. + +*---BASIC HEADER + + + +#PLAYER # +*---specifies player amount (options are 1 or 2). Use your logic; if it's 5/7-keys, use #PLAYER 1. If it's 10/14-keys, use #PLAYER 2. + +#GENRE [x] +*---specifies the genre [x] when the song is currently highlighted. + +#TITLE [x] +*---specifies the title [x] when the song is currently highlighted. + +#ARTIST [x] +*---specifies the artist [x] when the song is currently highlighted. + +#BPM ### +*---specifies ### ( 0 to 999 ) as the first (or only) BPM value of the song. + +#PLAYLEVEL ## +*---specifies # ( 0 to 9 ) as the amount of difficulty (stars) of the song. Some simulators, from my experience, can support values above 9, but let's not be that stupid, shall we? + +#MIDIFILE xxx.mid +*---This tag is optional if a bgm .wav/.mp3 already exists. Specifies the MIDI file to be played at the beginning of the song. MIDI file must be in the same directory where your .bms/.bme exists. + + + +*---EXTENSION HEADER + + + +#RANK # +*---specifies # ( 0 to 3, where 0 is Very Hard, 1 is Hard, 2 is Normal, and 3 is Easy) as the "rank" of the song. I don't know the exact function, but I don't think it'll tell the simulator to change the judge setting. + +#TOTAL ### +*---I'm not quite sure about this, but I think this specifies the maximum notes you can get in this song. So values from 0 to 9999 works, I guess. + +#VOLWAV ??? +*---I don't know the actual specifier, but I have a hunch this tells the simulator to decrease or increase the volume of the bgm with/out keysounds. + +#STAGEFILE xxx.yyy +*---specifies the "preview" graphic of the song. Think backgrounds in DDR. This will be shown after you choose the song, during the loading of keysounds and bganimations, if available, and will disappear when the song starts. xxx.yyy specifies the filename and filetype respectively. I think you can also use directory command (Using ..\..\hi.jpg may tell the simulator to use the file hi.jpg two directories above the directory where this .bms/.bme exist) but I haven't tested it. + +%EMAIL [x] +*---a comment header; you can enter your e-mail address, if desired. + +%URL [x] +*---a comment header; you can enter your website url address, if desired. + + + +*---ASSIGNMENT HEADER + + + +#WAV** xxx.yyy + +*---this is where you specify the keysound file to be stored into a local variable by the simulator, where it will be able to be called upon during the gameplay of the song, and where ** is a two-digit hex value, xxx is the filename, and yyy is the filetype (commonly used are either WAV or MP3 files). +*---In Layman's terms, this is where you'll give the simulator a cardboard sign that says a two-digit number (or letter. explanation later...) and tell it to play SUCH AND SUCH file whenever you tell it to. So, an example would be: + +*---#WAV01 kickdrum.wav + +*---This means that whenever there's a section in the .bms/.bme that asks for a 01 in the keysound section, the simulator will then play the file kickdrum.wav, under two conditions: (1) IF AND ONLY IF the player actually presses the key, or (2) IF AND ONLY IF the digit called is in the Always-autoplay section. + +*---Confused with those new vocabularies? Read on and you'll understand what the hell I'm babbling. + +*---The **, or the two-digit number (or letter), ranges from 00 to FF. If you haven't noticed, it's the range of a 2-byte hex value. This means that you can specify up to 255 _different_ keysound files for the simulator to memorize. To assign more variables, just make a new line with changed variable number and filename. Example: + +*---#WAV01 kickdrum.wav +*---#WAV02 hi-hats.wav + +#BMP** xxx.yyy + +*---The #BMP tag has the same idea as the #WAV tag, and also the same usage. The only difference is that the variables will be called in different sections. See the Main Data Field for further explanation. + +*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON +*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON +*---HUGE NOTE, AS IN READ THE BELOW COMMENT BEFORE YOU GO ON + +*---You do NOT need to specify every single variable. That means stop typing 500 lines of specifying nothing. Any unspecified variables will be assumed as "blanks" by the simulator, and when it is called, the simulator will do nothing, if it's a keysound, or the simulator will stop any animation previously and display nothing, if it's a bga. + + +*----------MAIN DATA FIELD + + _THIS_ is the fun part. This section is where all of the keysounds are specified in bits and pieces of measures of the music, and _THIS_ is where you must act like a detective and decipher what the hell each line stands for. Thankfully, I have come with aid. And chips. And guacamole dip. + +BACK TO THE POINT + + Many of you will see jumbles of nothing but digits in a normal .bms/.bme file, but do you ever wonder how does it work? I'm sure you do, because if you've never wondered so, you won't be reading through here. Or to here, even. + + So we will begin, with the explanation. I'll have fun 'splaining as I will 'yping. + 'ey! 'ccent 're 'ool! 'nd 'nintelligible 'oo!!! 'o 'ffense. + + + + So here you are, wandering around the main data field, and you see numbers like this. + +#00412:00000000000000005F0000001A000000E3 + +and something like that repeated differently about 3000 times. + +Let's begin understanding each section by breaking down the given example line. Obviously you should already understand the #. All codes begin with #. Duh. + +# 004 12 :00000000000000005F0000001A000000E3 + ^ + | + | + +This is your _Measure #_ . Obviously it ranges from Measure 1 (000) to Measure 1000 (999), but what song have 1000 measures? Hopefully you're not making a .bms/.bme to a nonstop megamix. Anyway, this tells the simulator what's going on in such measure. In this example, there are...12...thing...with a colon and many zeroes and 5F and 1A and E3 here and there in measure 5....interesting. Don't worry; you'll understand those things soon. + +Speaking of soon, we're moving right along to the next part. Boy was that quick or what? + + +# 004 12 :00000000000000005F0000001A000000E3 + ^ + | + | + + This is what I like to call KEY LOCATION variable, where it tells the simulator to put those...zeroes...and 5F...and the rest of the garbage into a variable of digit "12." + That didn't make a lot of sense, did it? Of course not. It didn't to me at first, until I deciphered the possible variables of key locations. Below is the list of the KEY LOCATION and its variable two-digit number. + + +KEYLOCATION - ACTUAL LOCATION/FUNCTION +====================================== +11 - White key 1 (Most left) +12 - Blue key 1 (Most left) +13 - White key 2 (Second from the left) +14 - Blue key 2 (Center) +15 - White key 3 (Second from the right) +18 - Blue key 3 (Most right) +19 - White key 4 (Most right) +16 - Scratch (The big circle thing that makes wiki wiki wiki wik wik sound) +17 - unknown function currently +04 - BGA +07 - unknown function currently +06 - MISS BGA +01 - Always Autoplay +03 - BPM Change +08 - "Advanced" BPM Change + + + So in the above example, the code 00000000000000005F0000001A000000E3 will all be executed solely for the Blue key 1. + + + "BUT JACK A. TRADES, I WANNA KNOW HOW THOSE NUMBERS WORK AND WHAT ARE THEY ACTUALLY!?!??!?!/1/1/131'31'3nklnalndkland" + + Let's stop the question and start looking at the example below. + +# 004 12 :00000000000000005F0000001A000000E3 + ^ ^ + -------------------------------- + | + | + + _NOT_ simply put, they are the codes that tell the simulator to call up all of the specified variables in a single measure. I lost you, didn't I? + Simply put, in this example, the simulator is told to call the following variables: 00 (8 times), 5F, 00 (3 times), 1A, 00 (3 times), and E3. That means the simulator will first find what you have specified earlier in the ASSIGNMENT HEADER, follow your command, and open/play that file for you at that point of time. + But how should this help you in terms of music? How can you specify exact call locations for the simulator, like a kick drum every beat in a measure, or a hi-hats for every-other-eighth-beat in a measure? This is where the (other) fun part comes in. + + The amount of digits available will determine what kind of a note each double-digit is. I lost you again, didn't I? + + For (another?) example, if you put a line of code such as this instead of the given example above: + + #00412:5F + + You're telling the simulator to play the 5F keysound whenever the player presses the blue key 1 at the first beat of measure 5. + + HOLY CRAP HOW DID I KNOW THAT!? + Well, if you've studied music, and understand what the hell I was saying earlier, then you must know you only specified one digit for the measure, and that means the simulator will assume that double-digit as a whole note. Remember: 4 beats equal a measure, and a whole note = 4 beats. + + So if you specify this instead: + + #00412:5F005F00 + + The simulator will assume each double-digit as _quarter note_ and do the polka. I mean, do its thing. Play 5F in the first beat of the measure, play 00 in the second beat, play 5F in the third and finally play 00 in the fourth. + + If I specify: + + #00412:001A001A001A001A + + I'm telling the simulator to play the 1A in every other sixteenth notes. Get the picture? + + THE AMOUNT OF DOUBLE DIGITS AvAILABLE IN THE LINE OF CODE SPECIFIES THE TYPE OF NOTE EACH ARE + + If there is one double-digit, it is a whole note. + If there are two double-digits, each double-digit is a half note. + If there are four double-digits, each double-digit is a quarter note. + If there are eight double-digits, each double-digit is a eighth note. + If there are sixteen double-digits, each double-digit is a sixteenth note. + If there are twelve double-digits, each double-digit is a twelveth note. + If there are thirty two double-digits, each double-digit is a thirty-second note. + ET CETERA + + The highest note type a simulator can take, usually, is a 192nd note. If you go beyond that, something is wrong with you or the song. Probably you, but you never know. + + + So let's recap! What does this code actually tell you? + + #00412:00000000000000005F0000001A000000E3 + + At measure 5 ( #004 = MEASURE #5 ), + The following variables are to be called in the Blue Key 1 section ( #xxx12 = Blue Key 1 ): + 00,00,00,00,00,00,00,00,5F,00,00,00,1A,00,00,00,E3 + Where each note is assumed as (in this strange case) a seventeenth note. + Therefore, the simulator must play the keysound of variable 00 in the first seventeenth note, then another 00 in the second seventeenth note, etc. + + + And you're done! See, that wasn't so hard, was it? But you think I'm forgetting something. Actually, two things. Well, I'm not, so shut up. That code always apply to everything you see in the KEYLOCATION table, including BGA and Always Autoplay. + The difference in the BGA, however, is that the simulator will load the graphics of the specified variables. So, if you've specified #BMP01 neh.bmp, and you want to call the graphic in a note, then the simulator will _NOT_ play the keysound for 01, but it will instead load the neh.bmp file. + The other and my last point that you think I've forgotten is the actual explanation of the other KEYLOCATION functions. I'll put the table below again for your convenience. + + + +KEYLOCATION - ACTUAL LOCATION/FUNCTION +====================================== +11 - White key 1 (Most left) +12 - Blue key 1 (Most left) +13 - White key 2 (Second from the left) +14 - Blue key 2 (Center) +15 - White key 3 (Second from the right) +18 - Blue key 3 (Most right) +19 - White key 4 (Most right) +16 - Scratch (The big circle thing that makes wiki wiki wiki wik wik sound) +17 - unknown function currently +04 - BGA +07 - unknown function currently +06 - MISS BGA +01 - Always Autoplay +03 - BPM Change +08 - "Extended" BPM Change + + + +So what's 17 and 07 all about? I sure as hell don't know. Perhaps if you know, you would help me out with this tutorial. C'mon; I typed everything you see here, from my brain, in one single session. + +Never mind that for now. What's MISS BGA, Always Autoplay, and BPM, you ask? + + MISS BGA is where you can specify any custom animations you have when the player is currently missing the notes he's playing. If you want an absolute, easy example, find and download onoken - P8107 bms file with the background, and just miss a couple of notes (or the whole song and failing it, like I did!). You'll see that onoken has incorporated a custom MISS animation. + Of course, if you don't have the patience to make one, you can always specify a single image that has the word MISS in bold, or something. Preferably red, you know. + But nevertheless, to specify them is the exact same as how you would specify BGA or keysounds, but the only hassle is you have to copy and paste the same exact line for each measure you have. + + This is also true for my next topic: Always Autoplay. Mostly used in [L7] and usually in [7] keysound files, this baby will make sure any sound (or annoying noises) will always be played even if the player just sits there and watches himself plummet to a Game Over screen. Or something. The usage is a bit different, however. Remember that THE AMOUNT OF DOUBLE DIGITS AvAILABLE IN THE LINE OF CODE SPECIFIES THE TYPE OF NOTE EACH ARE rule? Well, it applies to every code you can see, even those beyond the horizon. + + So what do you have to do when you want to have two, three, or even four or more keysounds to play at the same exact time? Specify a new line, with different codes! Example is below: + +#00001:01 +#00001:02 +#00001:03 + +This tells the simulator to play keysounds 01, 02, and 03 at the first note in measure 1. Simple, no? + + But when you blame me for forgetting things, you are right for one thing, but ONLY one thing. I forgot to mention the BPM. That lil' bugger is used when you want to suddenly change the BPM value of the song. The usage is still the same, with a little variation. + +#01103:96 + + The lil' code above this paragraph tells the simulator to change the BPm at measure 12 to 150 BPM. So how did I get 150 from 96? Some weird formula like standard deviation of the population mean in a binomial distribution? + + Heck no, I got 150 because 96 is the hex value of 150. Let me remind you that 2-byte hex value only goes up to 255 in decimal, so in short, if you're trying to create a .bms/.bme for MaxX Unlimited, where the BPM changes from 300 to 280 to 300 to 150 to 320, we might have a problem. How would you specify a BPM value over 255? + +[credit goes to pukpuk/2220 for finding the method originally and jammitch for pointing me to the solution] + + You can specify your BPM in the ASSIGNMENT header, as you may recall. The process is the same; the code tag is the only one different. So if you want to specify a BPM of 320, put: + +#BPM01 320 + + And call it in the main data field like: + +#00408:01 + + This will call the BPM Change of 01 in measure 5, and thus changing the song's BPM to 320. + + + So if you want multiple BPM changes: + +#01103:96AFC8E1 + + This tells the simulator to change the BPM to 150 at the first quarter note of Measure 12, to 175 at second quarter note, 200 at third, and 225 and fourth. + + + + + + + + +And with that, I conclude this tutorial. Hopefully I have made a tutorial that can actually help you read .bms/.bme more intelligently, and not think of egyptian inscriptions when you see those codes. Until next time, I am Jack A. Trades. + ~ let empathy fill the void ~ \ No newline at end of file diff --git a/Docs/SimfileFormats/BMS/_src.txt b/Docs/SimfileFormats/BMS/_src.txt index c7b3a79e27..d58b71a110 100644 --- a/Docs/SimfileFormats/BMS/_src.txt +++ b/Docs/SimfileFormats/BMS/_src.txt @@ -1,17 +1,17 @@ -BM98Data_format_specification.html = http://www.sun-inet.or.jp/~yaneurao/bm98/bmsformat.html -BM98FinalSecret.html = http://www.sun-inet.or.jp/~yaneurao/bm98/bm98secret.html (Japanese) -tmp.txt = http://unhappyangel.at.infoseek.co.jp/bms/tmp.txt -BMS_Reading_Tutorial.txt = http://www.angelfire.com/ga4/jackatrades606606/BMS_Reading_Tutorial.txt - -[BMS Dialects] -Drum BMS: http://wiki.bms.ms/Drum_BMS:Spec (Japanese) -DDR BMS - * http://wiki.bms.ms/DDR_BMS:Spec (Japanese) - * http://www.mni.ne.jp/~asuma/dde/explain.html (Japanese) - * http://homepage1.nifty.com/nickle/ex_format.html (Japanese) - -[not in repository but good reading] -http://fileformats.wikia.com/wiki/Be-Music_Script -http://nvyu.net/rdm/rby_ex.php (warning: Korean language material) -http://wiki.bms.ms/Bms:Spec +BM98Data_format_specification.html = http://www.sun-inet.or.jp/~yaneurao/bm98/bmsformat.html +BM98FinalSecret.html = http://www.sun-inet.or.jp/~yaneurao/bm98/bm98secret.html (Japanese) +tmp.txt = http://unhappyangel.at.infoseek.co.jp/bms/tmp.txt +BMS_Reading_Tutorial.txt = http://www.angelfire.com/ga4/jackatrades606606/BMS_Reading_Tutorial.txt + +[BMS Dialects] +Drum BMS: http://wiki.bms.ms/Drum_BMS:Spec (Japanese) +DDR BMS + * http://wiki.bms.ms/DDR_BMS:Spec (Japanese) + * http://www.mni.ne.jp/~asuma/dde/explain.html (Japanese) + * http://homepage1.nifty.com/nickle/ex_format.html (Japanese) + +[not in repository but good reading] +http://fileformats.wikia.com/wiki/Be-Music_Script +http://nvyu.net/rdm/rby_ex.php (warning: Korean language material) +http://wiki.bms.ms/Bms:Spec http://wiki.bms.ms/index.php?title=Bms:Format&oldid=1615 (last good revision) \ No newline at end of file diff --git a/Docs/SimfileFormats/BMS/tmp.txt b/Docs/SimfileFormats/BMS/tmp.txt index 1f916d0d8a..9ce2bbe99d 100644 --- a/Docs/SimfileFormats/BMS/tmp.txt +++ b/Docs/SimfileFormats/BMS/tmp.txt @@ -1,187 +1,187 @@ -BMS Format Specification(Remake version.) -Written in June 28th 2003. - -original document written by Urao Yane. -edited by U(uhangel4u@yahoo.co.jp) - -"BMS" means a Be-Music Source file. A file which has BMS suffix is regarded as the BMS file. -This file format was produced by Urao Yane and NBK in 1998.and It revised sometime. -And I adopted this file format to BM98, Delight Delight Reduplication, MixWaver, nazoBMPlay and so on. -Now,anyone can use this format freely. - -BM98 Drink Edition -http://www5c.biglobe.ne.jp/~kbs/bm98/ (Japanese) -Delight Delight Reduplicaton -http://nickle.hey.to/ (Japanese) -MixWaver -http://hello.to/mixwaver/ (Korean) -nazoBMPlay -http://www.nothing.sh/nazobmplay/ (Japanese) - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - -The line begining at '#' is the command line. All the rest are ignored (use for comments). -And this BMS file is compiled at runtime , so you can order any lines freely. -And there is no difference in the command line between using a capital letter or not. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -
- -#PLAYER [1-4] - -#PLAYER 1 -This data is for Single Play. -#PLAYER 2 -This data is for Two Players. -#PLAYER 3 -This data is for Double Play. -#PLAYER 4 -This data is for Two Players.(Players will plays same sequence) - -#GENRE xxxxxxxx -Definition of Genre. - -#TITLE xxxxxxxx -Definition of Title. - -#ARTIST xxxxxxxx -Definition of Artist. - -#BPM xxx -Definition of BPM.(Beats Per Minite) at the top of music. default : 130 value type : double. - -#MIDIFILE xxxxxxx.mid -Background music by MIDI.but,It's not recommend. - -#PLAYLEVEL x -Information of Game Level for player. - -#RANK [0-3] -judgement level. -x = 0 :very hard, 1: hard, 2: normal, 3: easy default : 2 - -#VOLWAV xxx -relative volume control (percentage) - -#TOTAL xxx -increments of Groove Gauge -ex. -#TOTAL 120 -It means when all sequence was played over great, Groove Gauge's value is 120% - -#WAVxx yyyyyyyy.wav(or .mp3) -definition of Wave Data. xx : 01 to FZ(01-09-0A-0Z-10-1Z...) , yyyyyyyy.wav : wave file name -When use mp3 files,you need mp3 CODEC. - -e.g. -#WAV01 HOUSE01.WAV // assign HOUSE01.WAV to 01 wav -#WAV02 HOUSE02.WAV // assign HOUSE02.WAV to 02 wav -#WAVFZ HOUSE03.mp3 // assign HOUSE03.mp3 to FZ wav - -#BMPxx yyyyyyyy.bmp(or gif,jpg,png) -definition of Bitmap file. xx : 01 to FF(Hex) , yyyyyyyy.bmp : bitmap file name -Bitmap size must be 256 * 256.(max color 65536) -If you use "gif or jpg or png", with Susie Plug-in. -gif : ifgif.spi jpg : ifjpg.spi png : ifpng.spi - -About Susie Plug-ins : http://www.digitalpad.co.jp/~takechin/ - -e.g. -#BMP01 HOUSE01.BMP // assign HOUSE01.BMP to 01 bitmap -#BMP02 HOUSE02.BMP // assign HOUSE02.BMP to 02 bitmap -#BMPEE HOUSE03.PNG // assign HOUSE03.PNG to EE bitmap - -#StageFile xxxx.bmp(or gif,jpg,png) -Show assigned Picture when loading bitmaps,wavs and compiling bms. - -#BPMxx yyy -Use to change BPM(Beats Per Minite). xx : 01 to ff(Hex) - -But ,the bitmap defined by #BMP00 is something special. -This bitmap shows when a player do a poor play. - -#STOPxx yyy -Use to stop sequence. xx : 01 to ff(Hex) -yyy : a quarter note = 48 - an eighth note = 24 - a whole note = 192 - note / n = 192/n - -#CDDA xx -Audio cds Track No. - -#BackBMP xxxx.bmp(or gif,jpg,png) -Set BackGround Picture.(size:640*480) - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -// a sample of random loading function - -#random 2 // create a random number (1 or 2) - -#if 1 // if the number was equal to 1 then... -#00111:31313131 // this is effective... -#endif - -#if 2 // if the number was equal to 2 then... -#00113:32003232 // this is effective -#endif - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - -#aaabb:cccccccc - -aaa: track number (from 000 to 999) -bb : channel number where you want to send message.(from 00 to FF) -cccccccc : - - - -01 : BGM(background music by WAVE) -02 : shortening note. -03 : changing a Tempo[1-255] -04 : BGA(background animation) -06 : changing Poor-bitmap -07 : BGA Layer. -08 : Extended BPM(Use assigned of #BPMxx) -09 : Stop the sequence(Use assigned of #STOPxx) - -11 to 19 : Object Channel of 1 player side -21 to 29 : Object Channel of 2 player side -31 to 39 : Can't show Object Channel of 1 player side -41 to 49 : Can't show Object Channel of 2 player side -51 to 59 : Long note Object Channel of 1 player side -61 to 69 : Long note Object Channel of 2 player side - - - -#00211:03030303 -This means 4 objects at the left of 1 player side in 002 track. -This object is assigned to wave No.03 which was defined by #WAV03 xxxx.wav. -And this 4 objects are arranged evenly in this track. - -Please try the following patterns. - -#00211:0303030303 - -#00211:0303000303 - -#00211:010101 -#00211:00020202 - -P.S. - -#00202:0.5 : Track2 have Half length. - - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -This document and this format is free! -I hope the day will come when my BMS format will use all over the world. - +BMS Format Specification(Remake version.) +Written in June 28th 2003. + +original document written by Urao Yane. +edited by U(uhangel4u@yahoo.co.jp) + +"BMS" means a Be-Music Source file. A file which has BMS suffix is regarded as the BMS file. +This file format was produced by Urao Yane and NBK in 1998.and It revised sometime. +And I adopted this file format to BM98, Delight Delight Reduplication, MixWaver, nazoBMPlay and so on. +Now,anyone can use this format freely. + +BM98 Drink Edition +http://www5c.biglobe.ne.jp/~kbs/bm98/ (Japanese) +Delight Delight Reduplicaton +http://nickle.hey.to/ (Japanese) +MixWaver +http://hello.to/mixwaver/ (Korean) +nazoBMPlay +http://www.nothing.sh/nazobmplay/ (Japanese) + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + + +The line begining at '#' is the command line. All the rest are ignored (use for comments). +And this BMS file is compiled at runtime , so you can order any lines freely. +And there is no difference in the command line between using a capital letter or not. + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +
+ +#PLAYER [1-4] + +#PLAYER 1 +This data is for Single Play. +#PLAYER 2 +This data is for Two Players. +#PLAYER 3 +This data is for Double Play. +#PLAYER 4 +This data is for Two Players.(Players will plays same sequence) + +#GENRE xxxxxxxx +Definition of Genre. + +#TITLE xxxxxxxx +Definition of Title. + +#ARTIST xxxxxxxx +Definition of Artist. + +#BPM xxx +Definition of BPM.(Beats Per Minite) at the top of music. default : 130 value type : double. + +#MIDIFILE xxxxxxx.mid +Background music by MIDI.but,It's not recommend. + +#PLAYLEVEL x +Information of Game Level for player. + +#RANK [0-3] +judgement level. +x = 0 :very hard, 1: hard, 2: normal, 3: easy default : 2 + +#VOLWAV xxx +relative volume control (percentage) + +#TOTAL xxx +increments of Groove Gauge +ex. +#TOTAL 120 +It means when all sequence was played over great, Groove Gauge's value is 120% + +#WAVxx yyyyyyyy.wav(or .mp3) +definition of Wave Data. xx : 01 to FZ(01-09-0A-0Z-10-1Z...) , yyyyyyyy.wav : wave file name +When use mp3 files,you need mp3 CODEC. + +e.g. +#WAV01 HOUSE01.WAV // assign HOUSE01.WAV to 01 wav +#WAV02 HOUSE02.WAV // assign HOUSE02.WAV to 02 wav +#WAVFZ HOUSE03.mp3 // assign HOUSE03.mp3 to FZ wav + +#BMPxx yyyyyyyy.bmp(or gif,jpg,png) +definition of Bitmap file. xx : 01 to FF(Hex) , yyyyyyyy.bmp : bitmap file name +Bitmap size must be 256 * 256.(max color 65536) +If you use "gif or jpg or png", with Susie Plug-in. +gif : ifgif.spi jpg : ifjpg.spi png : ifpng.spi + +About Susie Plug-ins : http://www.digitalpad.co.jp/~takechin/ + +e.g. +#BMP01 HOUSE01.BMP // assign HOUSE01.BMP to 01 bitmap +#BMP02 HOUSE02.BMP // assign HOUSE02.BMP to 02 bitmap +#BMPEE HOUSE03.PNG // assign HOUSE03.PNG to EE bitmap + +#StageFile xxxx.bmp(or gif,jpg,png) +Show assigned Picture when loading bitmaps,wavs and compiling bms. + +#BPMxx yyy +Use to change BPM(Beats Per Minite). xx : 01 to ff(Hex) + +But ,the bitmap defined by #BMP00 is something special. +This bitmap shows when a player do a poor play. + +#STOPxx yyy +Use to stop sequence. xx : 01 to ff(Hex) +yyy : a quarter note = 48 + an eighth note = 24 + a whole note = 192 + note / n = 192/n + +#CDDA xx +Audio cds Track No. + +#BackBMP xxxx.bmp(or gif,jpg,png) +Set BackGround Picture.(size:640*480) + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +// a sample of random loading function + +#random 2 // create a random number (1 or 2) + +#if 1 // if the number was equal to 1 then... +#00111:31313131 // this is effective... +#endif + +#if 2 // if the number was equal to 2 then... +#00113:32003232 // this is effective +#endif + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + + +#aaabb:cccccccc + +aaa: track number (from 000 to 999) +bb : channel number where you want to send message.(from 00 to FF) +cccccccc : + + + +01 : BGM(background music by WAVE) +02 : shortening note. +03 : changing a Tempo[1-255] +04 : BGA(background animation) +06 : changing Poor-bitmap +07 : BGA Layer. +08 : Extended BPM(Use assigned of #BPMxx) +09 : Stop the sequence(Use assigned of #STOPxx) + +11 to 19 : Object Channel of 1 player side +21 to 29 : Object Channel of 2 player side +31 to 39 : Can't show Object Channel of 1 player side +41 to 49 : Can't show Object Channel of 2 player side +51 to 59 : Long note Object Channel of 1 player side +61 to 69 : Long note Object Channel of 2 player side + + + +#00211:03030303 +This means 4 objects at the left of 1 player side in 002 track. +This object is assigned to wave No.03 which was defined by #WAV03 xxxx.wav. +And this 4 objects are arranged evenly in this track. + +Please try the following patterns. + +#00211:0303030303 + +#00211:0303000303 + +#00211:010101 +#00211:00020202 + +P.S. + +#00202:0.5 : Track2 have Half length. + + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +This document and this format is free! +I hope the day will come when my BMS format will use all over the world. + Urao Yane \ No newline at end of file diff --git a/Docs/SimfileFormats/DWI/DWI.txt b/Docs/SimfileFormats/DWI/DWI.txt index 6668020847..8a3549a203 100644 --- a/Docs/SimfileFormats/DWI/DWI.txt +++ b/Docs/SimfileFormats/DWI/DWI.txt @@ -1,311 +1,311 @@ -This text was taken from Dance With Intensity's README file, accessed online at -http://dwi.ddruk.com/readme.php#4 -It has been reformatted to fit 80 characters in a line, except when necessary. -------------------------------------------------------------------------------- -4. DWI FILE FORMAT - -Steps - -DWI uses step-files that are similar to the ".MSD" file format. However, there -are new additions and some tags are treated slightly differently, so the -extension was changed to avoid confusion. DWI files with these new additions -will not work properly in other simulators. - -Step-patterns are defined in the same way as .MSD files - use the numeric -keypad as a reference for most patterns: - - 7=U+L 8=U 9=U+R - - 4=L 6=R - - 1=D+L 2=D 3=D+R - - (U+D = A and L+R = B) - -A '0' indicates no step. Each character defaults to one 1/8 of a beat. Surround -a series of characters with the following brackets to change the rate at which -the steps come: - - (...) = 1/16 steps - [...] = 1/24 steps - {...} = 1/64 steps - `...' = 1/192 steps - -6-panel (Solo) mode uses additional characters: - - -\---- = C - ----/- = D - - L\---- = E - -\D--- = F - -\-U-- = G - -\---R = H - - L---/- = I - --D-/- = J - ---U/- = K - ----/R = L - - -\--/- = M - -To do more than 2 panels at a time, you can join codes together with the "<..>" -object, and they will all count as the same beat. So, to do a jump that involves -Left, Right, Up-Left, and Up-Right, you could do: - - -\--/- = M - L----R = B - ====== - L\--/R = (or , , <46M>, etc.) - -MSD files from other simulators will work with DWI, with a change in the 'GAP' -value being the only change usually necessary. DWI calculates the 'GAP' value -differently than other simulators that use the MSD format. - -DWI does not support the BMS file format. There is a utility available that can -convert any BMS file into DWI format. Each song only requires one DWI file for -all of its steps, so if you are converting BMS files please remember that all -the different difficulties of step patterns will be contained in the same DWI -file. - -Hold Arrows - -In the DWI file format a hold arrow is signified with the ! symbol. The string -8!8 will begin an 'up' hold arrow, and the arrow will be released the next time -the program encounters an 'up' arrow: by itself or combined with another arrow -(7, 8, 9, A, etc.) The characters 7!4 would show both 'up' and 'left' arrows but -only the left arrow would be held. The format could best be described as -"show!hold". - -Tags - -These tags should be in every DWI file: - -#TITLE:...; title of the song. -#ARTIST:...; artist of the song. -#GAP:...; number of milliseconds that pass before the program starts counting beats. Used to sync the steps to the music. -#BPM:...; BPM of the music - -Additionally, the following tags can be given: - -#DISPLAYTITLE:...; provides an alternate version of the song name that can also include special characters. -#DISPLAYARTIST:...; provides an alternate version of the artist name that can also include special characters. - -Special Characters are denoted by giving filenames in curly-brackets. -eg. #DISPLAYTITLE:The {kanji.png} Song; - -The extra character files should be 50 pixels high and be black-and-white. -The baseline for the font should be 34 pixels from the top. - -#DISPLAYBPM:...; tells DWI to display the BPM on the song select screen in a user-defined way. Options can be: -* - BPM cycles randomly -a - BPM stays set at 'a' value (no cycling) -a..b - BPM cycles between 'a' and 'b' values - -#FILE:...; path to the music file to play (eg. /music/mysongs/abc.mp3 ) -(NB: if the file is not found, a .wav or .mp3 file in the same folder as the DWI file is used) -#MD5:...; an MD5 string for the music file. Helps ensure that same music file is used on all systems. -#FREEZE:...; a value of the format "BBB=sss". Indicates that at 'beat' "BBB", the motion of the arrows should stop for "sss" milliseconds. Turn on beat-display in the System menu to help determine what values to use. Multiple freezes can be given by separating them with commas. -#CHANGEBPM:...; a value of the format "BBB=nnn". Indicates that at 'beat' "BBB", the speed of the arrows will change to reflect a new BPM of "nnn". Multiple BPM changes can be given by separating them with commas. -#STATUS:...; can be "NEW" or "NORMAL". Changes the display of songs on the song-select screen. -#GENRE:...; a genre to assign to the song if "sort by Genre" is selected in the System Options. Multiple Genres can be given by separating them with commas. -#CDTITLE:...; points to a small graphic file (64x40) that will display in the song selection screen in the bottom right of the background, showing which CD the song is from. The colour of the pixel in the upper-left will be made transparent. -#SAMPLESTART:...; the time in the music file that the preview music should start at the song-select screen. Can be given in Milliseconds (eg. 5230), Seconds (eg. 5.23), or minutes (eg. 0:05.23). Prefix the number with a "+" to factor in the GAP value. -#SAMPLELENGTH:...; how long to play the preview music for at the song-select screen. Can be in milliseconds, seconds, or minutes. -#RANDSEED:x; provide a number that will influence what AVIs DWI picks and their order. Will be the same animation each time if AVI filenames and count doesn't change (default is random each time). -#RANDSTART:x; tells DWI what beat to start the animations on. Default is 32. -#RANDFOLDER:...; tells DWI to look in another folder when choosing AVIs, allowing 'themed' folders. -#RANDLIST:...; a list of comma-separated filenames to use in the folder. - -Each pattern of steps for different modes have the same basic format: - -#SINGLE:BASIC:X:...; - ^ ^ ^ ^ - | | | + step patterns. In doubles, the left pad's steps are given first, - | | | then the right pad's, separated by a colon (:). - | | | - | | + difficulty rating. Should be 1 or higher. - | | - | + Difficulty. Can be one of "BASIC", "ANOTHER", "MANIAC", or "SMANIAC" - | - + Style. Can be one of "SINGLE", "DOUBLE", "COUPLE", or "SOLO". "COUPLE" is - Battle-mode steps. - -Comments can be used by using "//". Everything after this on the same line in -the file will be ignored. - -Background Animations, Movies, and Visualizations - -DWI allows for background animations using a special script within the -step-file. A script consists of static images, animated images, and/or an AVI -movie. Using the script, you can create a variety of layered effects. A sample -animation is described below: - - #BACKGROUND: - - M:MOVIE:.\movies\sfx.avi STARTAT:-1.0 LAYER:0; - V:VIS:.\Vis\somevis.svp LAYER:0; - E:FILE:.\anim\equalizer.png ANIMATE:10,33 POSITION:-33,0 SPACING:40,40 LAYER:1; - D:FILE:.\anim\dancer-m1.png ANIMATE:24,66 SIZE:2 MULT:0,0.5,1 SPACING:30,30 LAYER:1; - X:LAYER:1 OFF; - - SCRIPT:M....................... - ................E............... - D...............X,V...............E...............D............... - X,M...............E...............D...............X,V............... - E...............D...............X,M...............E............... - D...............X,V...............E...............D............... - X,M...............E...............D...............X; - - #END; - -The first part of the "BACKGROUND" definition defines the effects. Each effect is attributed to a letter or number ("a-z", "A-Z", "1-9"). The format for defining an effect is: - -The first four tags cannot be used together... -FILE: path to a file. Either a still image, or an animation (multiple frames of animation are stacked *vertically* in the image). -MOVIE: path to a standard Windows AVI file. Note that the movie won't play unless you have the right codecs installed in Windows. Movies are currently stretched to fill the whole screen. -VIS: path to a Sonique Visualization plug-in (SVP). Visualizations are currently stretched to fill the whole screen and are always put on Layer 0, and no other commands will affect it. -OFF turns off a layer, effectively making it invisible. Will not turn off layer 0. - -LAYER:l the layer to use (required): - - 0 - base layer. - (Image/Movie is always tiled and SPACING is ignored). - 1 - overlay layer - 2 - overlay layer - 3 - overlay layer - - -STARTAT:t number of seconds into the AVI file to start at. If negative, the movie will wait that many seconds before playing. Can be decimal (eg. 1.3 = 1300ms). -MULT:r,g,b Red, Green, and Blue pixels in the image/movie are tinted by the given amounts. This way the same image/movie can be used multiple times across DWI files and have different colours. -ANIMATE:f,n1,n2,...nF indicates that the FILE contains multiple frames of animation. "f" is the number of frames of animation. Each following value is the number of milliseconds each frame of animation is displayed. If not enough time-values are given, the last given value is used. Ignored for MOVIE type. -MOVE:x,y the image/movie is moved by the given number of pixels every millisecond. -SPACING:x,y images are always tiled if they don't fill up the screen. This tag allows you to add some spacing between the images by the given number of pixels horizontally and vertically (Layer > 0) -SIZE:s multiplies the image size by 's' in both directions. Must be a whole number. -KEEPPOS normally when a new effect is turned on, its position is reset. This tag keeps the layer where it is, useful for keeping images moving smoothly. -KEEPTIME (MOVIEs only) normally when a movie starts, it starts from the beginning or the time given in the "STARTAT" tag. Adding this tag will keep it playing so when that layer is enabled again, it will have kept going. - -Following the effect definition, comes the actual animation script. This is a -sequence of characters in a similar way as the step-patterns are given - each -character normally is 1/8 of a beat, though brackets can be used to change the -time-values. In this way, background animations can be syched to the steps. -It is suggested that the steps for "SINGLE:BASIC" are copied to after the -"SCRIPT:" tag, and then the effects be set. In this way one knows that the -script will match the same length of the music. - -The animations take effect as that point in the song is reached. Multiple -effects can occur at the same time if they are separated with a comma. A period -(.) means no new effect should take place at that point. A zero (0) turns off -all effects and returns the background to the original graphic. - -More Information - -Please check our website for more information and links to useful resources. - -5. NONSTOP MODE AND CRS FILE FORMAT - -DWI uses special CRS files that should be put in subfolders of the "Courses" -directory. Now courses can be shared with others if they have the same files and -directory structure as you. - -CRS files are similar to DWI files in structure. The file defines the basic -details about the course, such as its name and which songs should be played. -Currently these tags are supported: - -Required tags: - -#COURSE:...; the name of the course. -#DISPLAYCOURSE:...; alternate name of course that can include special characters. Similar to #DISPLAYTITLE and #DISPLAYARTIST in DWI files. -#SONG:...; defines a song in the course. This can either be a selection from the Player's Best (or Worst), a Random stage or a predefined stage. The syntax for each is given below: - - PLAYER'S BEST/WORST STAGE: - #SONG:BESTx:[BASIC|ANOTHER|MANAIC|SMANIAC]; - #SONG:WORSTx:[BASIC|ANOTHER|MANAIC|SMANIAC]; - - choose a song with the given index 'x'. So BEST1 is the most popular - song, and WORST5 is the 5th least popular song. If the given - difficulty is not available, DWI will choose the next closest difficulty. - Songs that are equally popular will be put in random order. - - RANDOM STAGE: - #SONG:*:[a]|[a..b]; - - choose a random song, with a difficulty rating equal to or between 'a' and 'b'. - - if only 'a' is given, 'b' is assumed to be the same as 'a'. - - #SONG:*:[BASIC|ANOTHER|MANIAC|SMANAIC]; - - choose a random song with a given difficulty level. - - #SONG:folder\*:[a]|[a..b]|[BASIC|ANOTHER|MANIAC|SMANIAC]; - - choose a random song from a given folder. - - DEFINED STAGE: - #SONG:\:; - - will use a song from with the given title. - So to play a song called "My Song", which is in - './Songs/Default/mysong/mysong.dwi', on MANIAC, - you would say: - - #SONG:Default\My Song:MANIAC; - -NB: Either the TITLE or folder the DWI file is in can be used. - -In addition, modifiers can be defined for each song by adding a list of -comma-separated values to the end of the #SONG line. These modifiers are the -same as listed above, plus - - xRANDOM - where 'x' is the number of random effects to apply. - 'x' can be 1 to 7. - AWARDx - where 'x' is the number of lives to award after - finishing the stage. - -So to play "My Song", Maniac, with 2.0x, Left, Hidden, and with one random -effect, use: -#SONG:Default\My Song:MANIAC:2.0x,LEFT,HIDDEN,1RANDOM; - -Optional tags: - -#REPEAT:...; can be "YES" or "NO". If set, starts course over from the beginning after last song. -#COMBO:PERFECT; during play, the combo counter will only go up if a "PERFECT" is made. -#COMBOMODE:1; sets how much is added to the combo counter for jumps. Can be 1 or 2. -#LIVES:4; sets the number of 'lives' given to each player at the start of game play. After each stage is cleared, a given number of lives is added, either by a value specified by the "AWARDx" tag in the CRS file, or using the scale below: - - Song was 6 feet or less - 1 life. - Song was 7 or 8 feet - 2 lives. - Song was 9 feet or more - 3 lives. - -At the course selection screen, courses that have songs without steps for the -current style (SINGLE, DOUBLE, etc) will be filtered out. Courses are loaded -when DWI starts. - -6. LRC (LYRICS) FILE FORMAT - -DWI can display lyrics during a song if it finds a .LRC file in the same folder -as the step-file. The file should have the same file-base as the .DWI file - -so, for example, if your DWI file is called "mysong.dwi", the lyrics file should -be called "mysong.lrc". - -This file is a simple text-file that tells the program what text to display and -when. It can also define the colour the text is displayed in. - -Each line starts with a tag in the format [xxxxxx]. Currently, these tags are -supported: - -[COLOUR] Sets the colour for the following text. After the tag, a colour value is given in hex (ie. yellow would be 0xFFFF00). Up to 10 colour values can be given, separated by commas. -[offset:xxxx] Makes timestamps following this tag have their times adjusted by 'xxxx' milliseconds. Use to fine-tune timings for lyrics. -[MM:SS.ss] Sets a time. -The text following the tag will be shown on the screen after this -time has passed, replacing any text that was there before. To clear text, -provide just a tag with no text after it. - -A line-break can be defined using the pipe "|" symbol. - -A new colour can be selected from the defined colours by using "{cX}", where -"X" is a number from 0 to 9. - -Sample LRC file: - -[0:00.00]aye-aye-aye|aye-aye-aye|aye-aye-aye -[0:05.30]Where's my samurai? -[0:07.00] -[COLOUR]0xffff00 -[0:13.50]I've been searching for a man -[0:16.00]All across Japan. +This text was taken from Dance With Intensity's README file, accessed online at +http://dwi.ddruk.com/readme.php#4 +It has been reformatted to fit 80 characters in a line, except when necessary. +------------------------------------------------------------------------------- +4. DWI FILE FORMAT + +Steps + +DWI uses step-files that are similar to the ".MSD" file format. However, there +are new additions and some tags are treated slightly differently, so the +extension was changed to avoid confusion. DWI files with these new additions +will not work properly in other simulators. + +Step-patterns are defined in the same way as .MSD files - use the numeric +keypad as a reference for most patterns: + + 7=U+L 8=U 9=U+R + + 4=L 6=R + + 1=D+L 2=D 3=D+R + + (U+D = A and L+R = B) + +A '0' indicates no step. Each character defaults to one 1/8 of a beat. Surround +a series of characters with the following brackets to change the rate at which +the steps come: + + (...) = 1/16 steps + [...] = 1/24 steps + {...} = 1/64 steps + `...' = 1/192 steps + +6-panel (Solo) mode uses additional characters: + + -\---- = C + ----/- = D + + L\---- = E + -\D--- = F + -\-U-- = G + -\---R = H + + L---/- = I + --D-/- = J + ---U/- = K + ----/R = L + + -\--/- = M + +To do more than 2 panels at a time, you can join codes together with the "<..>" +object, and they will all count as the same beat. So, to do a jump that involves +Left, Right, Up-Left, and Up-Right, you could do: + + -\--/- = M + L----R = B + ====== + L\--/R = (or , , <46M>, etc.) + +MSD files from other simulators will work with DWI, with a change in the 'GAP' +value being the only change usually necessary. DWI calculates the 'GAP' value +differently than other simulators that use the MSD format. + +DWI does not support the BMS file format. There is a utility available that can +convert any BMS file into DWI format. Each song only requires one DWI file for +all of its steps, so if you are converting BMS files please remember that all +the different difficulties of step patterns will be contained in the same DWI +file. + +Hold Arrows + +In the DWI file format a hold arrow is signified with the ! symbol. The string +8!8 will begin an 'up' hold arrow, and the arrow will be released the next time +the program encounters an 'up' arrow: by itself or combined with another arrow +(7, 8, 9, A, etc.) The characters 7!4 would show both 'up' and 'left' arrows but +only the left arrow would be held. The format could best be described as +"show!hold". + +Tags + +These tags should be in every DWI file: + +#TITLE:...; title of the song. +#ARTIST:...; artist of the song. +#GAP:...; number of milliseconds that pass before the program starts counting beats. Used to sync the steps to the music. +#BPM:...; BPM of the music + +Additionally, the following tags can be given: + +#DISPLAYTITLE:...; provides an alternate version of the song name that can also include special characters. +#DISPLAYARTIST:...; provides an alternate version of the artist name that can also include special characters. + +Special Characters are denoted by giving filenames in curly-brackets. +eg. #DISPLAYTITLE:The {kanji.png} Song; + +The extra character files should be 50 pixels high and be black-and-white. +The baseline for the font should be 34 pixels from the top. + +#DISPLAYBPM:...; tells DWI to display the BPM on the song select screen in a user-defined way. Options can be: +* - BPM cycles randomly +a - BPM stays set at 'a' value (no cycling) +a..b - BPM cycles between 'a' and 'b' values + +#FILE:...; path to the music file to play (eg. /music/mysongs/abc.mp3 ) +(NB: if the file is not found, a .wav or .mp3 file in the same folder as the DWI file is used) +#MD5:...; an MD5 string for the music file. Helps ensure that same music file is used on all systems. +#FREEZE:...; a value of the format "BBB=sss". Indicates that at 'beat' "BBB", the motion of the arrows should stop for "sss" milliseconds. Turn on beat-display in the System menu to help determine what values to use. Multiple freezes can be given by separating them with commas. +#CHANGEBPM:...; a value of the format "BBB=nnn". Indicates that at 'beat' "BBB", the speed of the arrows will change to reflect a new BPM of "nnn". Multiple BPM changes can be given by separating them with commas. +#STATUS:...; can be "NEW" or "NORMAL". Changes the display of songs on the song-select screen. +#GENRE:...; a genre to assign to the song if "sort by Genre" is selected in the System Options. Multiple Genres can be given by separating them with commas. +#CDTITLE:...; points to a small graphic file (64x40) that will display in the song selection screen in the bottom right of the background, showing which CD the song is from. The colour of the pixel in the upper-left will be made transparent. +#SAMPLESTART:...; the time in the music file that the preview music should start at the song-select screen. Can be given in Milliseconds (eg. 5230), Seconds (eg. 5.23), or minutes (eg. 0:05.23). Prefix the number with a "+" to factor in the GAP value. +#SAMPLELENGTH:...; how long to play the preview music for at the song-select screen. Can be in milliseconds, seconds, or minutes. +#RANDSEED:x; provide a number that will influence what AVIs DWI picks and their order. Will be the same animation each time if AVI filenames and count doesn't change (default is random each time). +#RANDSTART:x; tells DWI what beat to start the animations on. Default is 32. +#RANDFOLDER:...; tells DWI to look in another folder when choosing AVIs, allowing 'themed' folders. +#RANDLIST:...; a list of comma-separated filenames to use in the folder. + +Each pattern of steps for different modes have the same basic format: + +#SINGLE:BASIC:X:...; + ^ ^ ^ ^ + | | | + step patterns. In doubles, the left pad's steps are given first, + | | | then the right pad's, separated by a colon (:). + | | | + | | + difficulty rating. Should be 1 or higher. + | | + | + Difficulty. Can be one of "BASIC", "ANOTHER", "MANIAC", or "SMANIAC" + | + + Style. Can be one of "SINGLE", "DOUBLE", "COUPLE", or "SOLO". "COUPLE" is + Battle-mode steps. + +Comments can be used by using "//". Everything after this on the same line in +the file will be ignored. + +Background Animations, Movies, and Visualizations + +DWI allows for background animations using a special script within the +step-file. A script consists of static images, animated images, and/or an AVI +movie. Using the script, you can create a variety of layered effects. A sample +animation is described below: + + #BACKGROUND: + + M:MOVIE:.\movies\sfx.avi STARTAT:-1.0 LAYER:0; + V:VIS:.\Vis\somevis.svp LAYER:0; + E:FILE:.\anim\equalizer.png ANIMATE:10,33 POSITION:-33,0 SPACING:40,40 LAYER:1; + D:FILE:.\anim\dancer-m1.png ANIMATE:24,66 SIZE:2 MULT:0,0.5,1 SPACING:30,30 LAYER:1; + X:LAYER:1 OFF; + + SCRIPT:M....................... + ................E............... + D...............X,V...............E...............D............... + X,M...............E...............D...............X,V............... + E...............D...............X,M...............E............... + D...............X,V...............E...............D............... + X,M...............E...............D...............X; + + #END; + +The first part of the "BACKGROUND" definition defines the effects. Each effect is attributed to a letter or number ("a-z", "A-Z", "1-9"). The format for defining an effect is: + +The first four tags cannot be used together... +FILE: path to a file. Either a still image, or an animation (multiple frames of animation are stacked *vertically* in the image). +MOVIE: path to a standard Windows AVI file. Note that the movie won't play unless you have the right codecs installed in Windows. Movies are currently stretched to fill the whole screen. +VIS: path to a Sonique Visualization plug-in (SVP). Visualizations are currently stretched to fill the whole screen and are always put on Layer 0, and no other commands will affect it. +OFF turns off a layer, effectively making it invisible. Will not turn off layer 0. + +LAYER:l the layer to use (required): + + 0 - base layer. + (Image/Movie is always tiled and SPACING is ignored). + 1 - overlay layer + 2 - overlay layer + 3 - overlay layer + + +STARTAT:t number of seconds into the AVI file to start at. If negative, the movie will wait that many seconds before playing. Can be decimal (eg. 1.3 = 1300ms). +MULT:r,g,b Red, Green, and Blue pixels in the image/movie are tinted by the given amounts. This way the same image/movie can be used multiple times across DWI files and have different colours. +ANIMATE:f,n1,n2,...nF indicates that the FILE contains multiple frames of animation. "f" is the number of frames of animation. Each following value is the number of milliseconds each frame of animation is displayed. If not enough time-values are given, the last given value is used. Ignored for MOVIE type. +MOVE:x,y the image/movie is moved by the given number of pixels every millisecond. +SPACING:x,y images are always tiled if they don't fill up the screen. This tag allows you to add some spacing between the images by the given number of pixels horizontally and vertically (Layer > 0) +SIZE:s multiplies the image size by 's' in both directions. Must be a whole number. +KEEPPOS normally when a new effect is turned on, its position is reset. This tag keeps the layer where it is, useful for keeping images moving smoothly. +KEEPTIME (MOVIEs only) normally when a movie starts, it starts from the beginning or the time given in the "STARTAT" tag. Adding this tag will keep it playing so when that layer is enabled again, it will have kept going. + +Following the effect definition, comes the actual animation script. This is a +sequence of characters in a similar way as the step-patterns are given - each +character normally is 1/8 of a beat, though brackets can be used to change the +time-values. In this way, background animations can be syched to the steps. +It is suggested that the steps for "SINGLE:BASIC" are copied to after the +"SCRIPT:" tag, and then the effects be set. In this way one knows that the +script will match the same length of the music. + +The animations take effect as that point in the song is reached. Multiple +effects can occur at the same time if they are separated with a comma. A period +(.) means no new effect should take place at that point. A zero (0) turns off +all effects and returns the background to the original graphic. + +More Information + +Please check our website for more information and links to useful resources. + +5. NONSTOP MODE AND CRS FILE FORMAT + +DWI uses special CRS files that should be put in subfolders of the "Courses" +directory. Now courses can be shared with others if they have the same files and +directory structure as you. + +CRS files are similar to DWI files in structure. The file defines the basic +details about the course, such as its name and which songs should be played. +Currently these tags are supported: + +Required tags: + +#COURSE:...; the name of the course. +#DISPLAYCOURSE:...; alternate name of course that can include special characters. Similar to #DISPLAYTITLE and #DISPLAYARTIST in DWI files. +#SONG:...; defines a song in the course. This can either be a selection from the Player's Best (or Worst), a Random stage or a predefined stage. The syntax for each is given below: + + PLAYER'S BEST/WORST STAGE: + #SONG:BESTx:[BASIC|ANOTHER|MANAIC|SMANIAC]; + #SONG:WORSTx:[BASIC|ANOTHER|MANAIC|SMANIAC]; + - choose a song with the given index 'x'. So BEST1 is the most popular + song, and WORST5 is the 5th least popular song. If the given + difficulty is not available, DWI will choose the next closest difficulty. + Songs that are equally popular will be put in random order. + + RANDOM STAGE: + #SONG:*:[a]|[a..b]; + - choose a random song, with a difficulty rating equal to or between 'a' and 'b'. + - if only 'a' is given, 'b' is assumed to be the same as 'a'. + + #SONG:*:[BASIC|ANOTHER|MANIAC|SMANAIC]; + - choose a random song with a given difficulty level. + + #SONG:folder\*:[a]|[a..b]|[BASIC|ANOTHER|MANIAC|SMANIAC]; + - choose a random song from a given folder. + + DEFINED STAGE: + #SONG:\:; + - will use a song from with the given title. + So to play a song called "My Song", which is in + './Songs/Default/mysong/mysong.dwi', on MANIAC, + you would say: + + #SONG:Default\My Song:MANIAC; + +NB: Either the TITLE or folder the DWI file is in can be used. + +In addition, modifiers can be defined for each song by adding a list of +comma-separated values to the end of the #SONG line. These modifiers are the +same as listed above, plus + + xRANDOM - where 'x' is the number of random effects to apply. + 'x' can be 1 to 7. + AWARDx - where 'x' is the number of lives to award after + finishing the stage. + +So to play "My Song", Maniac, with 2.0x, Left, Hidden, and with one random +effect, use: +#SONG:Default\My Song:MANIAC:2.0x,LEFT,HIDDEN,1RANDOM; + +Optional tags: + +#REPEAT:...; can be "YES" or "NO". If set, starts course over from the beginning after last song. +#COMBO:PERFECT; during play, the combo counter will only go up if a "PERFECT" is made. +#COMBOMODE:1; sets how much is added to the combo counter for jumps. Can be 1 or 2. +#LIVES:4; sets the number of 'lives' given to each player at the start of game play. After each stage is cleared, a given number of lives is added, either by a value specified by the "AWARDx" tag in the CRS file, or using the scale below: + + Song was 6 feet or less - 1 life. + Song was 7 or 8 feet - 2 lives. + Song was 9 feet or more - 3 lives. + +At the course selection screen, courses that have songs without steps for the +current style (SINGLE, DOUBLE, etc) will be filtered out. Courses are loaded +when DWI starts. + +6. LRC (LYRICS) FILE FORMAT + +DWI can display lyrics during a song if it finds a .LRC file in the same folder +as the step-file. The file should have the same file-base as the .DWI file - +so, for example, if your DWI file is called "mysong.dwi", the lyrics file should +be called "mysong.lrc". + +This file is a simple text-file that tells the program what text to display and +when. It can also define the colour the text is displayed in. + +Each line starts with a tag in the format [xxxxxx]. Currently, these tags are +supported: + +[COLOUR] Sets the colour for the following text. After the tag, a colour value is given in hex (ie. yellow would be 0xFFFF00). Up to 10 colour values can be given, separated by commas. +[offset:xxxx] Makes timestamps following this tag have their times adjusted by 'xxxx' milliseconds. Use to fine-tune timings for lyrics. +[MM:SS.ss] Sets a time. +The text following the tag will be shown on the screen after this +time has passed, replacing any text that was there before. To clear text, +provide just a tag with no text after it. + +A line-break can be defined using the pipe "|" symbol. + +A new colour can be selected from the defined colours by using "{cX}", where +"X" is a number from 0 to 9. + +Sample LRC file: + +[0:00.00]aye-aye-aye|aye-aye-aye|aye-aye-aye +[0:05.30]Where's my samurai? +[0:07.00] +[COLOUR]0xffff00 +[0:13.50]I've been searching for a man +[0:16.00]All across Japan. ...etc... \ No newline at end of file diff --git a/Docs/SimfileFormats/KSF/_src.txt b/Docs/SimfileFormats/KSF/_src.txt index 362fa378b9..d4fc880763 100644 --- a/Docs/SimfileFormats/KSF/_src.txt +++ b/Docs/SimfileFormats/KSF/_src.txt @@ -1,5 +1,5 @@ -ksf-format.txt = http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/docs/ksf-format.txt - -[not in repository but good reading] -http://worldance.us/foro/archive/index.php?t-1647.html (Spanish; Direct Move KSF) +ksf-format.txt = http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/docs/ksf-format.txt + +[not in repository but good reading] +http://worldance.us/foro/archive/index.php?t-1647.html (Spanish; Direct Move KSF) http://www.ph-online.net/html/ph_newspage_v3_09.html ("Explanation of KSF Pump It Up Step Format" by Turkeyslam) \ No newline at end of file diff --git a/Docs/SimfileFormats/KSF/ksf-format.txt b/Docs/SimfileFormats/KSF/ksf-format.txt index b52689280c..4ad838f457 100644 --- a/Docs/SimfileFormats/KSF/ksf-format.txt +++ b/Docs/SimfileFormats/KSF/ksf-format.txt @@ -1,157 +1,157 @@ -Documentation on the KSF Format -------------------------------- -The KSF format is designed for representing steps for 5 panel diagonal -dancing games, such as Pump It Up. It was originally used in the Kick It Up -simulator, but can also be parsed by other programs. However, this seems -to be the only actual format description available. - -The intention of this document is not to encourage creation of KSF files. -I believe the format to be broken, and provide this reference only for -people wishing to implement legacy file readers. Any new 5 panel dancing -patterns should use a well-defined format such as .dance or .sm. - -Directory Layout ----------------- -KSF filenames are case-insensitive. - -A KSF directory contains the following files: - -- At least one file matching *.KSF, containing the step data. -- A file named SONG.MP3, SONG.WAV, or SONG.OGG. -- A file named INTRO.MP3, INTRO.WAV, or INTRO.OGG, containing a sound clip, - used to preview the song in song selectors. -- Disc.bmp, a 300x200 image used in song selectors. -- Back.bmp or Title.bmp, a 640x480 image used as a background during the song. - -KSF directories may not have a special naming format, but some simulators -will use the directory name to get the artist and title name, if it's not -available in the KSF files themseleves. The format is "Title", -"Title - Artist", or "Title - Artist - Difficulty". Difficulty can be -ignored here, as it can be gotten from the KSF filename. Using the path -name to determine the metadata for the song should only be used if it's -not available in #TITLE. - -Concievably other audio or image formats could be used. None have been -seen in the wild. - -KSF Filenames -------------- -KSF filenames describe the game type and difficulty. Each file holds the -data for only one level of difficulty. There are two possible forms of -the name: **.ksf, or *_*.ksf. - -The first type is used for double mode, and half-double mode. Double.ksf -contains the steps for "Double" mode, where one player uses both paths. -Stepmania supports Halfdouble.ksf, which ignores the outer 4 panels. - -The latter type is used for single ("unison", which is not the same -as Dance Dance Revolution's Unison mode in early mixes) steps, where both -players have the same steps, and couple steps, where players have different -ones. If the player number is 1, they are single steps; if it's 2, they're -couple steps. Difficulty is a difficulty name. - -KSF Headers ------------ -The basic KSF format is similar to DWI, SM, and MSD. Metadata is given -in the format of: -#TAGNAME:VALUE; - -The exception being the #STEPS tag, which has a newline between the ":" -and the first line of steps, and ends in "2222222222222" on a line by -itself instead of ";". - -KSF files seem to use CRLF (Windows-style) line termination. The vast -majority of KSF files are in CP942/KSC 5601 encoding, but some are -in EUC-KR. If ASCII alternatives are needed for these encodings, the -path name must be checked as above. - -Common headers in KSF files are as follows: - -#TITLE: The artist and title of the song, and sometimes the difficulty. -These are separated by " - "s, so the format is either "Title", -"Artist - Title", or "Artist - Title - Difficulty". Information missing -from this line can be filled in via path or file names. - -#BPM: The BPM of the song. This is analogous to the BPM value for every other -dance format. - -#STARTTIME: The time into the song to offset events, in centiseconds. This -is the opposite of .dance's gap and .sm's offset, and the same as .dwi's -gap (although they use different units). - -#TICKCOUNT: Each step line specifies 1/TICKCOUNT beats. That is, if -TICKCOUNT is 1, each line is the equivalent of a 'q' in .dance. If it's -2, each line is the same as a normal length note in DWI (an 'e' in .dance). - -#STEP: Until a line of "2222222222222" is encountered, each line after this -one represents a set of steps. - -Step Lines ----------- -Each line in the step section represents one "line" of steps, like SM -or .dance. Each line is 13 digits long; in single (unison) modes, only the -first 5 are used; in couple and double, the first 10 are used. - -The order of the steps is Down Left, Up Left, Center, Up Right, Down Right. -The second player's (or second pad in double) steps are the same order, -but in positions 6-10 instead of 1-5. - -A 0 in a position indicates no step. A 1 indicates a regular step. A 4 -indicates a hold, for as long as a 4 is found in that column. The hold -ends on the beat of the last 4, not on the first 0. - -Some files have been seen with repeated '1's in this manner as well; -it is unknown if any dance simulator supports this use of KSF, and since -a perfectly good non-ambiguous means of representing holds is available, -its use is not recommended. - -A 2 (or a line of 13 2s) indicates the end of the step pattern. - -BPM Changes ------------ -BPM changes are handled by header values; they are specified by a pair -of values #BPMx and #BUNKIx, where x is an integer. An example is: - -#BPM:146.10; -#BPM2:180.20; -#BPM3:195.00; -#TICKCOUNT:2; -#STARTTIME:0; -#BUNKI:4200; -#BUNKI2:10000; - -BPMn+1 starts at the time specified in centiseconds by BUNKIn (where n -is omitted if it is 1). In the above, 42 seconds (4200 centiseconds) -into the song, the BPM changes from its initial 146.1 to 180.2, and -then 100 seconds into the song, from 180.2 to 195. - -BUNKIs can be a decimal value. - -Syntax Exceptions ------------------ -Unlike DWI files, KSF files seem to have few exceptions or violations of -their syntax in the files seen in the wild. This may be because the format -is so mind-numbingly stupid. - -Still Unknown -------------- -Some files contain a #STARTTIMEx (like #BPMx or #BUNKIx). - -KSF step lines are 13 digits wide; only 10 digits appear to specify steps, -but the last 3 are not always 0. They probably represent something. - -Author ------- -This document was written by Joe Wreschnig . It is -released into the public domain. - -Changes -------- -2003.08.15 - - Initial check in / release. - -Acknowledgements ----------------- -This document is based primarily off of extensive work done by Matt Reppert. -The Stepmania KSF loader source code (src/NotesLoaderKSF.cpp) also proved -useful in verifying some information. +Documentation on the KSF Format +------------------------------- +The KSF format is designed for representing steps for 5 panel diagonal +dancing games, such as Pump It Up. It was originally used in the Kick It Up +simulator, but can also be parsed by other programs. However, this seems +to be the only actual format description available. + +The intention of this document is not to encourage creation of KSF files. +I believe the format to be broken, and provide this reference only for +people wishing to implement legacy file readers. Any new 5 panel dancing +patterns should use a well-defined format such as .dance or .sm. + +Directory Layout +---------------- +KSF filenames are case-insensitive. + +A KSF directory contains the following files: + +- At least one file matching *.KSF, containing the step data. +- A file named SONG.MP3, SONG.WAV, or SONG.OGG. +- A file named INTRO.MP3, INTRO.WAV, or INTRO.OGG, containing a sound clip, + used to preview the song in song selectors. +- Disc.bmp, a 300x200 image used in song selectors. +- Back.bmp or Title.bmp, a 640x480 image used as a background during the song. + +KSF directories may not have a special naming format, but some simulators +will use the directory name to get the artist and title name, if it's not +available in the KSF files themseleves. The format is "Title", +"Title - Artist", or "Title - Artist - Difficulty". Difficulty can be +ignored here, as it can be gotten from the KSF filename. Using the path +name to determine the metadata for the song should only be used if it's +not available in #TITLE. + +Concievably other audio or image formats could be used. None have been +seen in the wild. + +KSF Filenames +------------- +KSF filenames describe the game type and difficulty. Each file holds the +data for only one level of difficulty. There are two possible forms of +the name: **.ksf, or *_*.ksf. + +The first type is used for double mode, and half-double mode. Double.ksf +contains the steps for "Double" mode, where one player uses both paths. +Stepmania supports Halfdouble.ksf, which ignores the outer 4 panels. + +The latter type is used for single ("unison", which is not the same +as Dance Dance Revolution's Unison mode in early mixes) steps, where both +players have the same steps, and couple steps, where players have different +ones. If the player number is 1, they are single steps; if it's 2, they're +couple steps. Difficulty is a difficulty name. + +KSF Headers +----------- +The basic KSF format is similar to DWI, SM, and MSD. Metadata is given +in the format of: +#TAGNAME:VALUE; + +The exception being the #STEPS tag, which has a newline between the ":" +and the first line of steps, and ends in "2222222222222" on a line by +itself instead of ";". + +KSF files seem to use CRLF (Windows-style) line termination. The vast +majority of KSF files are in CP942/KSC 5601 encoding, but some are +in EUC-KR. If ASCII alternatives are needed for these encodings, the +path name must be checked as above. + +Common headers in KSF files are as follows: + +#TITLE: The artist and title of the song, and sometimes the difficulty. +These are separated by " - "s, so the format is either "Title", +"Artist - Title", or "Artist - Title - Difficulty". Information missing +from this line can be filled in via path or file names. + +#BPM: The BPM of the song. This is analogous to the BPM value for every other +dance format. + +#STARTTIME: The time into the song to offset events, in centiseconds. This +is the opposite of .dance's gap and .sm's offset, and the same as .dwi's +gap (although they use different units). + +#TICKCOUNT: Each step line specifies 1/TICKCOUNT beats. That is, if +TICKCOUNT is 1, each line is the equivalent of a 'q' in .dance. If it's +2, each line is the same as a normal length note in DWI (an 'e' in .dance). + +#STEP: Until a line of "2222222222222" is encountered, each line after this +one represents a set of steps. + +Step Lines +---------- +Each line in the step section represents one "line" of steps, like SM +or .dance. Each line is 13 digits long; in single (unison) modes, only the +first 5 are used; in couple and double, the first 10 are used. + +The order of the steps is Down Left, Up Left, Center, Up Right, Down Right. +The second player's (or second pad in double) steps are the same order, +but in positions 6-10 instead of 1-5. + +A 0 in a position indicates no step. A 1 indicates a regular step. A 4 +indicates a hold, for as long as a 4 is found in that column. The hold +ends on the beat of the last 4, not on the first 0. + +Some files have been seen with repeated '1's in this manner as well; +it is unknown if any dance simulator supports this use of KSF, and since +a perfectly good non-ambiguous means of representing holds is available, +its use is not recommended. + +A 2 (or a line of 13 2s) indicates the end of the step pattern. + +BPM Changes +----------- +BPM changes are handled by header values; they are specified by a pair +of values #BPMx and #BUNKIx, where x is an integer. An example is: + +#BPM:146.10; +#BPM2:180.20; +#BPM3:195.00; +#TICKCOUNT:2; +#STARTTIME:0; +#BUNKI:4200; +#BUNKI2:10000; + +BPMn+1 starts at the time specified in centiseconds by BUNKIn (where n +is omitted if it is 1). In the above, 42 seconds (4200 centiseconds) +into the song, the BPM changes from its initial 146.1 to 180.2, and +then 100 seconds into the song, from 180.2 to 195. + +BUNKIs can be a decimal value. + +Syntax Exceptions +----------------- +Unlike DWI files, KSF files seem to have few exceptions or violations of +their syntax in the files seen in the wild. This may be because the format +is so mind-numbingly stupid. + +Still Unknown +------------- +Some files contain a #STARTTIMEx (like #BPMx or #BUNKIx). + +KSF step lines are 13 digits wide; only 10 digits appear to specify steps, +but the last 3 are not always 0. They probably represent something. + +Author +------ +This document was written by Joe Wreschnig . It is +released into the public domain. + +Changes +------- +2003.08.15 + - Initial check in / release. + +Acknowledgements +---------------- +This document is based primarily off of extensive work done by Matt Reppert. +The Stepmania KSF loader source code (src/NotesLoaderKSF.cpp) also proved +useful in verifying some information. diff --git a/Docs/SimfileFormats/SDF/SDF.txt b/Docs/SimfileFormats/SDF/SDF.txt index aa28773264..f387210532 100644 --- a/Docs/SimfileFormats/SDF/SDF.txt +++ b/Docs/SimfileFormats/SDF/SDF.txt @@ -1,67 +1,67 @@ -Used by Pocket DDR (http://www.stepmania.com/forums/showthread.php?t=6621). -Basically a compressed version of a .SM that includes the banner and background -in the file as well. - -{Banner} -{Background} -{SDF data} - -When running SM2SDF.exe with /log, the process looks like this: -------------------------------------------------- - SM 2 SCF Converter v.1.0 by Robot2037 -------------------------------------------------- - SM File: test.sm - Loading file test.sm...done. - [LOG] parsing SM file - [LOG] songTitle = test song - [LOG] songSubTitle = a remix - [LOG] songArtist = kurt angle! - [LOG] songCredits = aj jelly - [LOG] songBanner = ssc-banner.png - [LOG] songBackground = ssc-bg.png - [LOG] songOffset = -0.060 - [LOG] songBPMs = 0.000=93.810; - [LOG] songStops = ; - [LOG] parsing stepcharts - [LOG] difficulty 0 stepchart found, step difficulty = 2 - [LOG] difficulty 1 stepchart found, step difficulty = 4 - [LOG] difficulty 2 stepchart found, step difficulty = 6 - [LOG] difficulty 3 stepchart found, step difficulty = 10 - converting... - [LOG] converting song properties - [LOG] converting BPMs - [LOG] converting stops - [LOG] converting offset - [LOG] converting stepcharts - [LOG] converting stepchart 0 - [LOG] converting done - [LOG] converting stepchart 1 - [LOG] converting done - [LOG] converting stepchart 2 - [LOG] converting done - [LOG] converting stepchart 3 - [LOG] converting done - compressing stepchart 0 [ 576 -> 39 ] - compressing stepchart 1 [ 576 -> 71 ] - compressing stepchart 2 [ 576 -> 167 ] - compressing stepchart 3 [ 576 -> 233 ] - Converting image ssc-bg.png...done. - Converting image ssc-banner.png...done. - Writing file test.sdf...done. - -test_sm2sdf.sm is the equivalent of test.sm in the above example. -test.sdf is the output file, with two BPMs. -test-1bpm.sdf is an output file with only one BPM change (and a changed offset). -the two images are included as well. --------------------------------------------------------------------------------- -A cursory glance at the steps part of the .SDF shows this: - -0x00-0x04: [000204060A] -0x05-0x??: Title (first byte is number of characters/length of string) -then Subtitle, Artist, and Credit follow the same pattern. -That's followed by the Offset. +1.000 = 0x0003E8. -0.060 = 0x01003C. -I think they call this binary coded decimal. - -After that is the number of BPMs, presumably followed by those BPMs. -0x0007D0=0x0A2C2B == #BPMS:2.000=666.667; +Used by Pocket DDR (http://www.stepmania.com/forums/showthread.php?t=6621). +Basically a compressed version of a .SM that includes the banner and background +in the file as well. + +{Banner} +{Background} +{SDF data} + +When running SM2SDF.exe with /log, the process looks like this: +------------------------------------------------- + SM 2 SCF Converter v.1.0 by Robot2037 +------------------------------------------------- + SM File: test.sm + Loading file test.sm...done. + [LOG] parsing SM file + [LOG] songTitle = test song + [LOG] songSubTitle = a remix + [LOG] songArtist = kurt angle! + [LOG] songCredits = aj jelly + [LOG] songBanner = ssc-banner.png + [LOG] songBackground = ssc-bg.png + [LOG] songOffset = -0.060 + [LOG] songBPMs = 0.000=93.810; + [LOG] songStops = ; + [LOG] parsing stepcharts + [LOG] difficulty 0 stepchart found, step difficulty = 2 + [LOG] difficulty 1 stepchart found, step difficulty = 4 + [LOG] difficulty 2 stepchart found, step difficulty = 6 + [LOG] difficulty 3 stepchart found, step difficulty = 10 + converting... + [LOG] converting song properties + [LOG] converting BPMs + [LOG] converting stops + [LOG] converting offset + [LOG] converting stepcharts + [LOG] converting stepchart 0 + [LOG] converting done + [LOG] converting stepchart 1 + [LOG] converting done + [LOG] converting stepchart 2 + [LOG] converting done + [LOG] converting stepchart 3 + [LOG] converting done + compressing stepchart 0 [ 576 -> 39 ] + compressing stepchart 1 [ 576 -> 71 ] + compressing stepchart 2 [ 576 -> 167 ] + compressing stepchart 3 [ 576 -> 233 ] + Converting image ssc-bg.png...done. + Converting image ssc-banner.png...done. + Writing file test.sdf...done. + +test_sm2sdf.sm is the equivalent of test.sm in the above example. +test.sdf is the output file, with two BPMs. +test-1bpm.sdf is an output file with only one BPM change (and a changed offset). +the two images are included as well. +-------------------------------------------------------------------------------- +A cursory glance at the steps part of the .SDF shows this: + +0x00-0x04: [000204060A] +0x05-0x??: Title (first byte is number of characters/length of string) +then Subtitle, Artist, and Credit follow the same pattern. +That's followed by the Offset. +1.000 = 0x0003E8. -0.060 = 0x01003C. +I think they call this binary coded decimal. + +After that is the number of BPMs, presumably followed by those BPMs. +0x0007D0=0x0A2C2B == #BPMS:2.000=666.667; I'm just not sure how they're picking the places to store the decimal. \ No newline at end of file diff --git a/Docs/SimfileFormats/SDF/test.sm b/Docs/SimfileFormats/SDF/test.sm index 7288da7a16..5b6cb80e1d 100644 --- a/Docs/SimfileFormats/SDF/test.sm +++ b/Docs/SimfileFormats/SDF/test.sm @@ -1,651 +1,651 @@ -#TITLE:test song; -#SUBTITLE:a remix; -#ARTIST:kurt angle!; -#TITLETRANSLIT:{ignored by sm2sdf}; -#SUBTITLETRANSLIT:{ignored by sm2sdf}; -#ARTISTTRANSLIT:{ignored by sm2sdf}; -#GENRE:{ignored by sm2sdf}; -#CREDIT:aj jelly; -#BANNER:ssc-banner.png; -#BACKGROUND:ssc-bg.png; -#LYRICSPATH:{ignored by sm2sdf}; -#CDTITLE:{ignored by sm2sdf}; -#MUSIC:{ignored by sm2sdf}; -#OFFSET:-0.060; -#SAMPLESTART:{ignored by sm2sdf}; -#SAMPLELENGTH:{ignored by sm2sdf}; -#SELECTABLE:YES; -#BPMS:0.000=93.810,5.000=187.62; -#STOPS:; -#TIMESIGNATURES:{ignored by sm2sdf}; -#BGCHANGES:{ignored by sm2sdf}; -#KEYSOUNDS:{ignored by sm2sdf}; - -//---------------dance-single - ---------------- -#NOTES: - dance-single: - : - Beginner: - 1: - 0.035,0.034,0.000,0.000,0.000,5.000,0.000,0.000,0.000,0.000,0.000,0.035,0.034,0.000,0.000,0.000,5.000,0.000,0.000,0.000,0.000,0.000: -1000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -; - -//---------------dance-single - Copied from---------------- -#NOTES: - dance-single: - Copied from: - Easy: - 2: - 0.063,0.039,0.000,0.000,0.000,9.000,0.000,0.000,0.000,0.000,0.000,0.063,0.039,0.000,0.000,0.000,9.000,0.000,0.000,0.000,0.000,0.000: -1000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -, -0001 -0000 -0000 -0000 -, -1000 -0000 -0000 -0000 -; - -//---------------dance-single - ---------------- -#NOTES: - dance-single: - : - Medium: - 4: - 0.119,0.078,0.000,0.000,0.000,17.000,0.000,0.000,0.000,0.000,0.000,0.119,0.078,0.000,0.000,0.000,17.000,0.000,0.000,0.000,0.000,0.000: -1000 -0000 -0010 -0000 -, -0100 -0000 -0001 -0000 -, -1000 -0000 -0100 -0000 -, -1000 -0000 -0001 -0000 -, -0100 -0000 -0010 -0000 -, -1000 -0000 -0001 -0000 -, -0010 -0000 -0001 -0000 -, -0100 -0000 -0001 -0000 -, -1000 -0000 -0000 -0000 -; - -//---------------dance-single - Copied from---------------- -#NOTES: - dance-single: - Copied from: - Hard: - 6: - 0.286,0.195,0.390,0.781,0.000,17.000,8.000,16.000,0.000,8.000,0.000,0.286,0.195,0.390,0.781,0.000,17.000,8.000,16.000,0.000,8.000,0.000: -1000 -0000 -2020 -0000 -, -3130 -0000 -0202 -0000 -, -1303 -0000 -0220 -0000 -, -1330 -0000 -0202 -0000 -, -1303 -0000 -2020 -0000 -, -3031 -0000 -0202 -0000 -, -0313 -0000 -2002 -0000 -, -3103 -0000 -0202 -0000 -, -1303 -0000 -0000 -0000 -; - -//---------------dance-single - ---------------- -#NOTES: - dance-single: - : - Challenge: - 10: - 0.425,0.293,0.195,0.000,0.390,57.000,4.000,0.000,0.000,0.000,0.000,0.425,0.293,0.195,0.000,0.390,57.000,4.000,0.000,0.000,0.000,0.000: - // measure 1 -1000 -0000 -0000 -0001 -0000 -0000 -1000 -0100 -0000 -0000 -1000 -0000 -0010 -0000 -0001 -0000 -, // measure 2 -0100 -0000 -0000 -0001 -0000 -0000 -1000 -0100 -0000 -0000 -0001 -0000 -0100 -0000 -0010 -0000 -, // measure 3 -1001 -0000 -0000 -1000 -0000 -0000 -0001 -0010 -0000 -0000 -0001 -0000 -0100 -0000 -1000 -0000 -, // measure 4 -0010 -0000 -0000 -1000 -0000 -0000 -0001 -0010 -0000 -0000 -1000 -0000 -0010 -0000 -0100 -0000 -, // measure 5 -1010 -0000 -0000 -0001 -0000 -0000 -1000 -0100 -0000 -0000 -1000 -0000 -0010 -0000 -0001 -0000 -, // measure 6 -0100 -0000 -0000 -0001 -0000 -0000 -1000 -0100 -0000 -0000 -0001 -0000 -0100 -0000 -0010 -0000 -, // measure 7 -1001 -0000 -0000 -1000 -0000 -0000 -0001 -0010 -0000 -0000 -0001 -0000 -0100 -0000 -1000 -0000 -, // measure 8 -0010 -0000 -0000 -1000 -0000 -0000 -0001 -0010 -0000 -0000 -1000 -0000 -0010 -0000 -0100 -0000 -, // measure 9 -1010 -0000 -0000 -0000 -; - -//---------------dance-single - ---------------- -#NOTES: - dance-single: - : - Edit: - 13: - 1.000,0.736,0.000,0.000,1.000,152.000,0.000,0.000,0.000,0.000,0.000,1.000,0.736,0.000,0.000,1.000,152.000,0.000,0.000,0.000,0.000,0.000: -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0100 -1000 -0001 -1000 -0100 -1000 -0000 -, -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0010 -0001 -1000 -0001 -0010 -0001 -0000 -, -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0100 -1000 -0001 -1000 -0100 -1000 -0000 -, -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0010 -0001 -1000 -0001 -0010 -0001 -0000 -, -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0100 -1000 -0001 -1000 -0100 -1000 -0000 -, -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0010 -0001 -1000 -0001 -0010 -0001 -0000 -, -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0000 -0100 -0000 -0010 -0000 -0001 -0000 -1000 -0100 -1000 -0001 -1000 -0100 -1000 -0000 -, -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0000 -0010 -0000 -0100 -0000 -1000 -0000 -0001 -0010 -0001 -1000 -0001 -0010 -0001 -0000 -; +#TITLE:test song; +#SUBTITLE:a remix; +#ARTIST:kurt angle!; +#TITLETRANSLIT:{ignored by sm2sdf}; +#SUBTITLETRANSLIT:{ignored by sm2sdf}; +#ARTISTTRANSLIT:{ignored by sm2sdf}; +#GENRE:{ignored by sm2sdf}; +#CREDIT:aj jelly; +#BANNER:ssc-banner.png; +#BACKGROUND:ssc-bg.png; +#LYRICSPATH:{ignored by sm2sdf}; +#CDTITLE:{ignored by sm2sdf}; +#MUSIC:{ignored by sm2sdf}; +#OFFSET:-0.060; +#SAMPLESTART:{ignored by sm2sdf}; +#SAMPLELENGTH:{ignored by sm2sdf}; +#SELECTABLE:YES; +#BPMS:0.000=93.810,5.000=187.62; +#STOPS:; +#TIMESIGNATURES:{ignored by sm2sdf}; +#BGCHANGES:{ignored by sm2sdf}; +#KEYSOUNDS:{ignored by sm2sdf}; + +//---------------dance-single - ---------------- +#NOTES: + dance-single: + : + Beginner: + 1: + 0.035,0.034,0.000,0.000,0.000,5.000,0.000,0.000,0.000,0.000,0.000,0.035,0.034,0.000,0.000,0.000,5.000,0.000,0.000,0.000,0.000,0.000: +1000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +; + +//---------------dance-single - Copied from---------------- +#NOTES: + dance-single: + Copied from: + Easy: + 2: + 0.063,0.039,0.000,0.000,0.000,9.000,0.000,0.000,0.000,0.000,0.000,0.063,0.039,0.000,0.000,0.000,9.000,0.000,0.000,0.000,0.000,0.000: +1000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +, +0001 +0000 +0000 +0000 +, +1000 +0000 +0000 +0000 +; + +//---------------dance-single - ---------------- +#NOTES: + dance-single: + : + Medium: + 4: + 0.119,0.078,0.000,0.000,0.000,17.000,0.000,0.000,0.000,0.000,0.000,0.119,0.078,0.000,0.000,0.000,17.000,0.000,0.000,0.000,0.000,0.000: +1000 +0000 +0010 +0000 +, +0100 +0000 +0001 +0000 +, +1000 +0000 +0100 +0000 +, +1000 +0000 +0001 +0000 +, +0100 +0000 +0010 +0000 +, +1000 +0000 +0001 +0000 +, +0010 +0000 +0001 +0000 +, +0100 +0000 +0001 +0000 +, +1000 +0000 +0000 +0000 +; + +//---------------dance-single - Copied from---------------- +#NOTES: + dance-single: + Copied from: + Hard: + 6: + 0.286,0.195,0.390,0.781,0.000,17.000,8.000,16.000,0.000,8.000,0.000,0.286,0.195,0.390,0.781,0.000,17.000,8.000,16.000,0.000,8.000,0.000: +1000 +0000 +2020 +0000 +, +3130 +0000 +0202 +0000 +, +1303 +0000 +0220 +0000 +, +1330 +0000 +0202 +0000 +, +1303 +0000 +2020 +0000 +, +3031 +0000 +0202 +0000 +, +0313 +0000 +2002 +0000 +, +3103 +0000 +0202 +0000 +, +1303 +0000 +0000 +0000 +; + +//---------------dance-single - ---------------- +#NOTES: + dance-single: + : + Challenge: + 10: + 0.425,0.293,0.195,0.000,0.390,57.000,4.000,0.000,0.000,0.000,0.000,0.425,0.293,0.195,0.000,0.390,57.000,4.000,0.000,0.000,0.000,0.000: + // measure 1 +1000 +0000 +0000 +0001 +0000 +0000 +1000 +0100 +0000 +0000 +1000 +0000 +0010 +0000 +0001 +0000 +, // measure 2 +0100 +0000 +0000 +0001 +0000 +0000 +1000 +0100 +0000 +0000 +0001 +0000 +0100 +0000 +0010 +0000 +, // measure 3 +1001 +0000 +0000 +1000 +0000 +0000 +0001 +0010 +0000 +0000 +0001 +0000 +0100 +0000 +1000 +0000 +, // measure 4 +0010 +0000 +0000 +1000 +0000 +0000 +0001 +0010 +0000 +0000 +1000 +0000 +0010 +0000 +0100 +0000 +, // measure 5 +1010 +0000 +0000 +0001 +0000 +0000 +1000 +0100 +0000 +0000 +1000 +0000 +0010 +0000 +0001 +0000 +, // measure 6 +0100 +0000 +0000 +0001 +0000 +0000 +1000 +0100 +0000 +0000 +0001 +0000 +0100 +0000 +0010 +0000 +, // measure 7 +1001 +0000 +0000 +1000 +0000 +0000 +0001 +0010 +0000 +0000 +0001 +0000 +0100 +0000 +1000 +0000 +, // measure 8 +0010 +0000 +0000 +1000 +0000 +0000 +0001 +0010 +0000 +0000 +1000 +0000 +0010 +0000 +0100 +0000 +, // measure 9 +1010 +0000 +0000 +0000 +; + +//---------------dance-single - ---------------- +#NOTES: + dance-single: + : + Edit: + 13: + 1.000,0.736,0.000,0.000,1.000,152.000,0.000,0.000,0.000,0.000,0.000,1.000,0.736,0.000,0.000,1.000,152.000,0.000,0.000,0.000,0.000,0.000: +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0100 +1000 +0001 +1000 +0100 +1000 +0000 +, +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0010 +0001 +1000 +0001 +0010 +0001 +0000 +, +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0100 +1000 +0001 +1000 +0100 +1000 +0000 +, +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0010 +0001 +1000 +0001 +0010 +0001 +0000 +, +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0100 +1000 +0001 +1000 +0100 +1000 +0000 +, +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0010 +0001 +1000 +0001 +0010 +0001 +0000 +, +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0000 +0100 +0000 +0010 +0000 +0001 +0000 +1000 +0100 +1000 +0001 +1000 +0100 +1000 +0000 +, +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0000 +0010 +0000 +0100 +0000 +1000 +0000 +0001 +0010 +0001 +1000 +0001 +0010 +0001 +0000 +; diff --git a/Docs/SimfileFormats/dance-spec.txt b/Docs/SimfileFormats/dance-spec.txt index 1d81fa4972..a658d3947f 100644 --- a/Docs/SimfileFormats/dance-spec.txt +++ b/Docs/SimfileFormats/dance-spec.txt @@ -1,337 +1,337 @@ -The "Dance" Format ------------------- -The goals of this format are easy parsability, easy human readability, -brevity, and disambiguity. - -Generic Information -------------------- -All strings are case-sensitive. Filenames are case-sensitive. The -directory separator is '/' regardless of the platform. All text -is encoded in UTF-8. Byte-order marking is not allowed. - -Enhanced Backus-Naur Form (ENBF) Specification ----------------------------------------------- -This is purely the grammar. A semantic explanation is below. - -Although this is given as a CFG specification, .dance is designed to be -parsed by a table-based DFA (as in pydance's fileparsers.py) - -Primitives: - ::= a sequence of characters - ::= 0.0 to Inf, decimal value - ::= 0 | -1 | -2 | -3 ... - ::= 0 | 1 | 2 | 3 ... - -Almost primitives: - ::= (" " | "\t")+ - ::= "\n" | "\r\n" | "\r" - ::= ( )* - ::= "end" - ::= | - ::= [("#" ) | ] - -Basic Structure: - ::= [+] + - -Metadata Storage: - ::= ( | )+ - ::= ( | | <Subtitle> | <Artist> | <Mix> | - <BPM> | <Offset> | <BG> | <Banner> | <Preview> | - <Checksum> | <StartAt> | <EndAt> | <Author> | <CDTitle> | - <RevisionDate> | <Valid> | <Movie>) <Newline> -<Filename> ::= "filename" <Whitespace> <LongString> -<Title> ::= "title" <Whitespace> <LongString> -<Subtitle> ::= "subtitle" <Whitespace> <LongString> -<Artist> ::= "artist" <Whitespace> <LongString> -<Mix> ::= "mix" <Whitespace> <LongString> -<BPM> ::= "bpm" <Whitespace> <Float> -<BPMDisplay> :: "bpmdisplay" ((<Whitespace> <Float>)+ | "*") -<Gap> ::= "gap" <Whitespace> <Int> -<StartAt> ::= "startat" <Whitespace> <Float> -<EndAt> ::= "endat" <Whitespace> <Float> -<BG> ::= "background" <Whitespace> <LongString> -<Banner> ::= "banner" <Whitespace> <LongString> -<Banner> ::= "cdtitle" <Whitespace> <LongString> -<Preview> :: "preview" <Whitespace> <Float> <Whitespace> <Float> -<Checksum> ::= "md5sum" <Whitespace> <String> -<Author> ::= "author" <Whitespace> <LongString> -<Movie> ::= "movie" <Whitespace> <LongString> -<RevisionDate> ::= "revision" <Whitespace> <LongString> -<Valid> ::= "valid" <Whitespace> 1 | 0 - -Text Sections: -<TextSection> ::= [<Description>] [<Lyrics>] -<Lyrics> ::= "LYRICS" <Newline> (<LyricLine>)+ <EndToken> -<LyricLine> ::= <Float> <Whitespace> <PosInt> <Whitespace> <LongString> <Newline> -<Description> ::= "DESCRIPTION" <Newline> (<LongString> <Newline>)+ <EndToken> - -Step Sections: -<StepSection> ::= <GameMode> <Difficulty> <Sequence>+ <EndToken> -<GameMode> ::= <String> <Newline> -<Difficulty> ::= <String> <Whitespace> <PosInt> <Newline> -<Sequence> ::= (<Comment> | <Buttons> | <Command>) <Newline> - -Note Sequences: -<Buttons> ::= <NoteType> (<Whitespace> <ButtonPresses>)+ -<NoteType> ::= "u" | "n" | "x" | "t" | "f" | "s" | "w" | "e" | "q" | "h" | "o" -<ButtonPresses> ::= (0 | 1 | 3 | 5 | 7)+ - -Song Commands: -<Command> ::= <ChangeBPM> | <Ready> | <Wait> | <Stop> | <Delay> | <Lyric> -<ChangeBPM> ::= "B" <Whitespace> <Float> -<Ready> ::= "R" -<Wait> ::= "W" <Whitespace> <Float> -<Stop> ::= "S" <Whitespace> <Float> -<Delay> ::= "D" <Whitespace> <Float> -<Lyric> ::= "L" <Whitespace> <Float> <Whitespace> <PosInt> <Whitespace> - <LongString> - -Informal & Semantic Description -------------------------------- -The dance format is basically the step format, but generalized, smaller, -and more readable. A script to convert .step files to .dance files is -forthcoming. - -A simple file might look like: - -filename asong.ogg -title A Song -subtitle Crazy Mix -artist Someone -# This is a comment -end -DESCRIPTION - This is an example song. - It's pretty uninteresting. -end -SINGLE -BASIC 0 -q 1010 -# This is another comment. -q 0101 -q 3030 -q 1010 -end - -Metadata Section: - -The metadata section of the song is the first section, and contains -important data about the file. An explanation of the keys follow: - -'filename': The filename of the audio file to play. - -'title': The name of the song. This should not include "Foo Mix". - -'subtitle': "Foo Mix", "Crazy Version", whatever. Default none. - -'artist': The name of the artist(s) and any remixers. - -'bpm': The beats per minute of the song. - -'gap': The millisecond offset into the song at which the arrows should - start. If the first beat is 0.3 seconds into the song, for example, - this should be -300. This can be negative. Default 0. - -'bpmdisplay': A whitespace-separated list of floats, which will be - cycled through on the song selector's BPM display. If - not present this defaults to the BPM if the song. If "*", - the BPM is displayed as constantly changing. - -'background': A background image (to display while the song is playing). - Default none. - -'banner': A banner for the song (to display in the song select). Default none. - -'cdtitle': A small (64x40) image to use as a CD title. Default none. This - path should either be relative to a special CD title directory, - or to the directory the file is in. - -'preview': An offset to seconds to start a song preview at, and a length to - play the preview. Default 45.0 and 10.0. - -'startat', 'endat': Start and end the music at these positions in seconds. - offset and the steps are then relative to the startat - position. Default 0.0 and the length of the song. - -'md5sum': If present, the MD5 checksum of the 'filename' file. If it's - present and the file doesn't match, a warning can be issued. - -'author': The person who wrote this file. Default none. - -'revision': The date of the last revision of this file, in YYYY.MM.DD format. - Defaults to "1970.01.01". - -'movie': The filename of a background movie; defaults to none. - -'valid': If not true, this song should be not selected using in random play - modes (e.g., it's not finished, hasn't been timed, etc). Default 1. - -The 'filename', 'title', 'artist', and 'bpm' keys are mandatory. - -Note that songs in this format will *NOT* have any files autodetected. If -you want them to be found, explicitly state them in the file. - -The metadata section, like all sections, must end with "end" on a line -by itself. - -Text Sections: - -There are two "text" sections in dance files; these are essentially -extended metadata sections. - -The DESCRIPTION section contains a description of the song. The format -roughly follows the DPKG description format: All lines of text start -with a space. Whitespace, including newlines, is ignored. A period ('.') -on a line by itself (with a space before it!) is to be interpreted as a -paragraph separator. An 'end' token on a single line, with no space before -it, ends the description. - -The LYRICS section contains lyric timing information. The format -of each line is, an integer, a float, and then a string. The integer -specifies the lyric "channel"; lyrics in the same channel should overwrite -each other, appear in the same place on the screen, etc. The float is the -time into the song during which the lyric should appear, irrespective -of the 'gap' value. - -Step Sections: - -The meat of the file is in the step sections, which actually describe -the game-related stuff. A step section is started as soon as an unknown -section token is encounter (i.e. currently not LYRICS or DESCRIPTION). -This first token is then taken as the "game mode". The two tokens on the -next line are the difficulty name and rating number. - -Then, until the "end" token, there are lines describing the steps. These -may be either a command, or a set of buttons to press. The "base" is 'q', -the quarter note, which represents one beat in the song. - -o Whole note (4 on-beat arrows) -h 1/2 note -q 1/4 note -e 1/8 note -w 1/12 note -s 1/16 note -f 1/24 note -t 1/32 note -u 1/48 note -x 1/64 note -n 1/192 note - -After the note comes a string of buttons. All these strings should be -the same length across game modes. Example strings might "1001" or "0030". - -0 No button at this time -1 A regular press at this time -3 This button must be pressed here and held down until a 1 is encounted -5 A secret step at this time. -7 A secret step and hold at this time. - -(Note - With bitwise &, - num & 1 => pressed here, - num & 2 => hold here, - num & 4 => this is a secret note. - -This correspondance is not necesarily guaranateed to be true for all -future additions to the .dance format, but will be maintained if possible.) - -Possible commands are: - -B <Float> Change the BPM of the song to this number at this point. -R "Ready? Go!" graphics/sound, if any. -W <Float> Wait this many seconds before the next event. -S <Float> Stop scrolling for this many seconds before the next event. -D <Float> The same as a sequence of 0 note strings for this many beats. -L <PosInt> <LongString> Display some lyrics at this point. - -Failing Gracefully ------------------- -Often, your parsers may come across tokens they don't know; maybe because -someone made an invalid file, or because the parser doesn't support all -of this format (or an old version of this format). If this is a section -token, this isn't a big problem; jump to the next end token and keep -going. Metadata tokens are equally easy to skip. - -Tokens in steps are more complicated. In general, you should treat -them as comments, treat unknown note types as 0s, and hope for the -best. - -Bad files shouldn't make your parser crash. It should return an error to -the program, which behaves accordingly. - -Future Extensions ------------------ -If this format is found to be inadaquate, the following extensions -may be added: - -New metadata keys. This would be a new line in the metadata section. -It is unlikely such a line would be mandatory, since current songs -work fine without them. - -New note types and commands. These would be new lowercase or uppercase -single characters in the song section. - -Standard Game Modes -------------------- -SINGLE - Normal single player with up, down, left, and right, or versus - mode, if no VERSUS is found. -VERSUS - Two players, both with the same steps. -COUPLE - Two players with different steps. -DOUBLE - Doubles, one player on both pads. - -5PANEL - Diagonal directions, and the center, for one player. -5VERSUS, 5COUPLE, 5DOUBLE - Similar to the 4 panel relationships. - -6PANEL, 6VERSUS, 6DOUBLE, 6COUPLE: Up left, up right, up, down, left, - and right. -8PANEL, etc: All directions except center. -9PANEL, etc: All directions including center. -3PANEL, etc: Up left, down, and up right. - -Changes: --------- -2004.03.01 - - Version 1.2, released with pydance 1.0. - - Add 9 panel game mode. - -2004.01.16 - - Include comments in the example. - -2003.12.23 - - 3 panel modes. - - bpmdisplay metadata key. - -2003.12.22 - - 'cdtitle' metadata line. - -2003.08.15 - - Specify note types more exactly. - - Fix the broken DESCRIPTION in the example. - - Remove obsolete notes about the pydance implementation. - - Add more game modes to the list (especially of note is VERSUS). - -2003.07.30 - - Fix example of 'gap' attribute (-300 instead of 300). - - Fix nonsensical hold arrow example. - -2003.06.29 - - Fix a typo ("::" => "::="). - -2003.06.27 - - Add EBNF for COUPLE-style modes (spaces in Buttons) - -2003.06.26 - - Add a missing newline to LyricLine. - - Add (currently unexplained) BACKGROUNDS section. - -2003.06.03 - - Version 1.1 - - Add 192nd notes with 'n', 48th with 'u'. - -2003.06.01 - - Version 1.0 - - No more I command. - -2003.05.23: - - Started changes. - - v1.0 draft preparation. - - Need to explain the I command. +The "Dance" Format +------------------ +The goals of this format are easy parsability, easy human readability, +brevity, and disambiguity. + +Generic Information +------------------- +All strings are case-sensitive. Filenames are case-sensitive. The +directory separator is '/' regardless of the platform. All text +is encoded in UTF-8. Byte-order marking is not allowed. + +Enhanced Backus-Naur Form (ENBF) Specification +---------------------------------------------- +This is purely the grammar. A semantic explanation is below. + +Although this is given as a CFG specification, .dance is designed to be +parsed by a table-based DFA (as in pydance's fileparsers.py) + +Primitives: +<String> ::= a sequence of characters +<Float> ::= 0.0 to Inf, decimal value +<NegInt> ::= 0 | -1 | -2 | -3 ... +<PosInt> ::= 0 | 1 | 2 | 3 ... + +Almost primitives: +<Whitespace> ::= (" " | "\t")+ +<Newline> ::= "\n" | "\r\n" | "\r" +<LongString> ::= <String> (<Whitespace> <String>)* +<EndToken> ::= "end" <Newline> +<Int> ::= <NegInt> | <PosInt> +<Comment> ::= [("#" <LongString>) | <Whitespace>] <Newline> + +Basic Structure: +<File> ::= <Metadata> [<TextSection>+] <StepSection>+ + +Metadata Storage: +<Metadata> ::= (<Comment> | <MetadataLine>)+ <EndToken> +<MetadataLine> ::= (<Filename> | <Title> | <Subtitle> | <Artist> | <Mix> | + <BPM> | <Offset> | <BG> | <Banner> | <Preview> | + <Checksum> | <StartAt> | <EndAt> | <Author> | <CDTitle> | + <RevisionDate> | <Valid> | <Movie>) <Newline> +<Filename> ::= "filename" <Whitespace> <LongString> +<Title> ::= "title" <Whitespace> <LongString> +<Subtitle> ::= "subtitle" <Whitespace> <LongString> +<Artist> ::= "artist" <Whitespace> <LongString> +<Mix> ::= "mix" <Whitespace> <LongString> +<BPM> ::= "bpm" <Whitespace> <Float> +<BPMDisplay> :: "bpmdisplay" ((<Whitespace> <Float>)+ | "*") +<Gap> ::= "gap" <Whitespace> <Int> +<StartAt> ::= "startat" <Whitespace> <Float> +<EndAt> ::= "endat" <Whitespace> <Float> +<BG> ::= "background" <Whitespace> <LongString> +<Banner> ::= "banner" <Whitespace> <LongString> +<Banner> ::= "cdtitle" <Whitespace> <LongString> +<Preview> :: "preview" <Whitespace> <Float> <Whitespace> <Float> +<Checksum> ::= "md5sum" <Whitespace> <String> +<Author> ::= "author" <Whitespace> <LongString> +<Movie> ::= "movie" <Whitespace> <LongString> +<RevisionDate> ::= "revision" <Whitespace> <LongString> +<Valid> ::= "valid" <Whitespace> 1 | 0 + +Text Sections: +<TextSection> ::= [<Description>] [<Lyrics>] +<Lyrics> ::= "LYRICS" <Newline> (<LyricLine>)+ <EndToken> +<LyricLine> ::= <Float> <Whitespace> <PosInt> <Whitespace> <LongString> <Newline> +<Description> ::= "DESCRIPTION" <Newline> (<LongString> <Newline>)+ <EndToken> + +Step Sections: +<StepSection> ::= <GameMode> <Difficulty> <Sequence>+ <EndToken> +<GameMode> ::= <String> <Newline> +<Difficulty> ::= <String> <Whitespace> <PosInt> <Newline> +<Sequence> ::= (<Comment> | <Buttons> | <Command>) <Newline> + +Note Sequences: +<Buttons> ::= <NoteType> (<Whitespace> <ButtonPresses>)+ +<NoteType> ::= "u" | "n" | "x" | "t" | "f" | "s" | "w" | "e" | "q" | "h" | "o" +<ButtonPresses> ::= (0 | 1 | 3 | 5 | 7)+ + +Song Commands: +<Command> ::= <ChangeBPM> | <Ready> | <Wait> | <Stop> | <Delay> | <Lyric> +<ChangeBPM> ::= "B" <Whitespace> <Float> +<Ready> ::= "R" +<Wait> ::= "W" <Whitespace> <Float> +<Stop> ::= "S" <Whitespace> <Float> +<Delay> ::= "D" <Whitespace> <Float> +<Lyric> ::= "L" <Whitespace> <Float> <Whitespace> <PosInt> <Whitespace> + <LongString> + +Informal & Semantic Description +------------------------------- +The dance format is basically the step format, but generalized, smaller, +and more readable. A script to convert .step files to .dance files is +forthcoming. + +A simple file might look like: + +filename asong.ogg +title A Song +subtitle Crazy Mix +artist Someone +# This is a comment +end +DESCRIPTION + This is an example song. + It's pretty uninteresting. +end +SINGLE +BASIC 0 +q 1010 +# This is another comment. +q 0101 +q 3030 +q 1010 +end + +Metadata Section: + +The metadata section of the song is the first section, and contains +important data about the file. An explanation of the keys follow: + +'filename': The filename of the audio file to play. + +'title': The name of the song. This should not include "Foo Mix". + +'subtitle': "Foo Mix", "Crazy Version", whatever. Default none. + +'artist': The name of the artist(s) and any remixers. + +'bpm': The beats per minute of the song. + +'gap': The millisecond offset into the song at which the arrows should + start. If the first beat is 0.3 seconds into the song, for example, + this should be -300. This can be negative. Default 0. + +'bpmdisplay': A whitespace-separated list of floats, which will be + cycled through on the song selector's BPM display. If + not present this defaults to the BPM if the song. If "*", + the BPM is displayed as constantly changing. + +'background': A background image (to display while the song is playing). + Default none. + +'banner': A banner for the song (to display in the song select). Default none. + +'cdtitle': A small (64x40) image to use as a CD title. Default none. This + path should either be relative to a special CD title directory, + or to the directory the file is in. + +'preview': An offset to seconds to start a song preview at, and a length to + play the preview. Default 45.0 and 10.0. + +'startat', 'endat': Start and end the music at these positions in seconds. + offset and the steps are then relative to the startat + position. Default 0.0 and the length of the song. + +'md5sum': If present, the MD5 checksum of the 'filename' file. If it's + present and the file doesn't match, a warning can be issued. + +'author': The person who wrote this file. Default none. + +'revision': The date of the last revision of this file, in YYYY.MM.DD format. + Defaults to "1970.01.01". + +'movie': The filename of a background movie; defaults to none. + +'valid': If not true, this song should be not selected using in random play + modes (e.g., it's not finished, hasn't been timed, etc). Default 1. + +The 'filename', 'title', 'artist', and 'bpm' keys are mandatory. + +Note that songs in this format will *NOT* have any files autodetected. If +you want them to be found, explicitly state them in the file. + +The metadata section, like all sections, must end with "end" on a line +by itself. + +Text Sections: + +There are two "text" sections in dance files; these are essentially +extended metadata sections. + +The DESCRIPTION section contains a description of the song. The format +roughly follows the DPKG description format: All lines of text start +with a space. Whitespace, including newlines, is ignored. A period ('.') +on a line by itself (with a space before it!) is to be interpreted as a +paragraph separator. An 'end' token on a single line, with no space before +it, ends the description. + +The LYRICS section contains lyric timing information. The format +of each line is, an integer, a float, and then a string. The integer +specifies the lyric "channel"; lyrics in the same channel should overwrite +each other, appear in the same place on the screen, etc. The float is the +time into the song during which the lyric should appear, irrespective +of the 'gap' value. + +Step Sections: + +The meat of the file is in the step sections, which actually describe +the game-related stuff. A step section is started as soon as an unknown +section token is encounter (i.e. currently not LYRICS or DESCRIPTION). +This first token is then taken as the "game mode". The two tokens on the +next line are the difficulty name and rating number. + +Then, until the "end" token, there are lines describing the steps. These +may be either a command, or a set of buttons to press. The "base" is 'q', +the quarter note, which represents one beat in the song. + +o Whole note (4 on-beat arrows) +h 1/2 note +q 1/4 note +e 1/8 note +w 1/12 note +s 1/16 note +f 1/24 note +t 1/32 note +u 1/48 note +x 1/64 note +n 1/192 note + +After the note comes a string of buttons. All these strings should be +the same length across game modes. Example strings might "1001" or "0030". + +0 No button at this time +1 A regular press at this time +3 This button must be pressed here and held down until a 1 is encounted +5 A secret step at this time. +7 A secret step and hold at this time. + +(Note - With bitwise &, + num & 1 => pressed here, + num & 2 => hold here, + num & 4 => this is a secret note. + +This correspondance is not necesarily guaranateed to be true for all +future additions to the .dance format, but will be maintained if possible.) + +Possible commands are: + +B <Float> Change the BPM of the song to this number at this point. +R "Ready? Go!" graphics/sound, if any. +W <Float> Wait this many seconds before the next event. +S <Float> Stop scrolling for this many seconds before the next event. +D <Float> The same as a sequence of 0 note strings for this many beats. +L <PosInt> <LongString> Display some lyrics at this point. + +Failing Gracefully +------------------ +Often, your parsers may come across tokens they don't know; maybe because +someone made an invalid file, or because the parser doesn't support all +of this format (or an old version of this format). If this is a section +token, this isn't a big problem; jump to the next end token and keep +going. Metadata tokens are equally easy to skip. + +Tokens in steps are more complicated. In general, you should treat +them as comments, treat unknown note types as 0s, and hope for the +best. + +Bad files shouldn't make your parser crash. It should return an error to +the program, which behaves accordingly. + +Future Extensions +----------------- +If this format is found to be inadaquate, the following extensions +may be added: + +New metadata keys. This would be a new line in the metadata section. +It is unlikely such a line would be mandatory, since current songs +work fine without them. + +New note types and commands. These would be new lowercase or uppercase +single characters in the song section. + +Standard Game Modes +------------------- +SINGLE - Normal single player with up, down, left, and right, or versus + mode, if no VERSUS is found. +VERSUS - Two players, both with the same steps. +COUPLE - Two players with different steps. +DOUBLE - Doubles, one player on both pads. + +5PANEL - Diagonal directions, and the center, for one player. +5VERSUS, 5COUPLE, 5DOUBLE - Similar to the 4 panel relationships. + +6PANEL, 6VERSUS, 6DOUBLE, 6COUPLE: Up left, up right, up, down, left, + and right. +8PANEL, etc: All directions except center. +9PANEL, etc: All directions including center. +3PANEL, etc: Up left, down, and up right. + +Changes: +-------- +2004.03.01 + - Version 1.2, released with pydance 1.0. + - Add 9 panel game mode. + +2004.01.16 + - Include comments in the example. + +2003.12.23 + - 3 panel modes. + - bpmdisplay metadata key. + +2003.12.22 + - 'cdtitle' metadata line. + +2003.08.15 + - Specify note types more exactly. + - Fix the broken DESCRIPTION in the example. + - Remove obsolete notes about the pydance implementation. + - Add more game modes to the list (especially of note is VERSUS). + +2003.07.30 + - Fix example of 'gap' attribute (-300 instead of 300). + - Fix nonsensical hold arrow example. + +2003.06.29 + - Fix a typo ("::" => "::="). + +2003.06.27 + - Add EBNF for COUPLE-style modes (spaces in Buttons) + +2003.06.26 + - Add a missing newline to LyricLine. + - Add (currently unexplained) BACKGROUNDS section. + +2003.06.03 + - Version 1.1 + - Add 192nd notes with 'n', 48th with 'u'. + +2003.06.01 + - Version 1.0 + - No more I command. + +2003.05.23: + - Started changes. + - v1.0 draft preparation. + - Need to explain the I command. diff --git a/Docs/SimfileFormats/misc.txt b/Docs/SimfileFormats/misc.txt index 88088cf679..cd71e86525 100644 --- a/Docs/SimfileFormats/misc.txt +++ b/Docs/SimfileFormats/misc.txt @@ -1,24 +1,24 @@ -Miscellaneous Simfile Formats without directories -------------------------------------------------------------------------------- -[MSD] -Along with BMS, the grand daddy of simfile formats. -http://doremi.kalin.to/ddr/msd_format.html - -[PMS] -It's pretty much like BMS. If you really need documentation, -see src/NotesLoaderPMS.cpp I guess. I'm not going to make a folder for it when -it's a BMS derivative :x. - -[KMS] -Like BMS but for Keyboardmania? See http://wiki.bms.ms/KMS:Spec - -[GDA] -Like BMS but for Session (Guitar Freaks/drummania). See http://wiki.bms.ms/GDA:Spec - -[pydance] -They call it ".dance". I call it ARGH. See dance-spec.txt for the info. -src: http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/docs/dance-spec.txt - -[D2R, SLO] -Obscure old Japanese formats. +Miscellaneous Simfile Formats without directories +------------------------------------------------------------------------------- +[MSD] +Along with BMS, the grand daddy of simfile formats. +http://doremi.kalin.to/ddr/msd_format.html + +[PMS] +It's pretty much like BMS. If you really need documentation, +see src/NotesLoaderPMS.cpp I guess. I'm not going to make a folder for it when +it's a BMS derivative :x. + +[KMS] +Like BMS but for Keyboardmania? See http://wiki.bms.ms/KMS:Spec + +[GDA] +Like BMS but for Session (Guitar Freaks/drummania). See http://wiki.bms.ms/GDA:Spec + +[pydance] +They call it ".dance". I call it ARGH. See dance-spec.txt for the info. +src: http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/docs/dance-spec.txt + +[D2R, SLO] +Obscure old Japanese formats. src: http://web.archive.org/web/20040205071612/http://paramax.hypermart.net/ \ No newline at end of file diff --git a/Docs/SimfileFormats/new format draft.txt b/Docs/SimfileFormats/new format draft.txt index b19f658190..bd14285113 100644 --- a/Docs/SimfileFormats/new format draft.txt +++ b/Docs/SimfileFormats/new format draft.txt @@ -1,47 +1,47 @@ -$INFORMATION:maintitle:subtitle:artist:genre:credit; -$TRANSLITS:main:sub:artist; -$GRAPHICS:banner:background:disc:cdtitle; -$MUSIC:music-file:base-track:intro-file:lyrics; -// should be used if a intro file is not defined -$SAMPLEPREVIEW:start:length; -$DISPLAYBPM:[from:to]|[one]|[show yes/no]; -$BGCHANGES: - beat=file:p,r,o,p,s -; -$FGCHANGES:; -$KEYSOUNDS:; - -// cache tags here -$CACHE: - firstbeat: - lastbeat: - songfilename: - hasmusic: - hasbanner -; - -// note data -#NOTEDATA# -$META: - STEPSTYPE=stepstype: - DIFFICULTY=difficulty: - DESCRIPTION=description: - METER=meter: - RADARVALUES=r,a,d,a,r,v,a,l,u,e,s; -$TIMINGDATA: - BPM=bpms: - SPEED=speed: - STOPS=stops: - DELAYS=delays: - TIMESIGNATURES=timesigs; -$NOTES: -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 +$INFORMATION:maintitle:subtitle:artist:genre:credit; +$TRANSLITS:main:sub:artist; +$GRAPHICS:banner:background:disc:cdtitle; +$MUSIC:music-file:base-track:intro-file:lyrics; +// should be used if a intro file is not defined +$SAMPLEPREVIEW:start:length; +$DISPLAYBPM:[from:to]|[one]|[show yes/no]; +$BGCHANGES: + beat=file:p,r,o,p,s +; +$FGCHANGES:; +$KEYSOUNDS:; + +// cache tags here +$CACHE: + firstbeat: + lastbeat: + songfilename: + hasmusic: + hasbanner +; + +// note data +#NOTEDATA# +$META: + STEPSTYPE=stepstype: + DIFFICULTY=difficulty: + DESCRIPTION=description: + METER=meter: + RADARVALUES=r,a,d,a,r,v,a,l,u,e,s; +$TIMINGDATA: + BPM=bpms: + SPEED=speed: + STOPS=stops: + DELAYS=delays: + TIMESIGNATURES=timesigs; +$NOTES: +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 ; \ No newline at end of file diff --git a/Docs/SimfileFormats/ssc_msd5.txt b/Docs/SimfileFormats/ssc_msd5.txt index ddea11957e..d3b7d092c1 100644 --- a/Docs/SimfileFormats/ssc_msd5.txt +++ b/Docs/SimfileFormats/ssc_msd5.txt @@ -1,59 +1,59 @@ -// sm-ssc step chart/msd5 hacky file format doc. -// based off of .sm, which was based off of DWI's modified MSD format. -#TITLE:; -#SUBTITLE:; -#ARTIST:; -#TITLETRANSLIT:; -#SUBTITLETRANSLIT:; -#ARTISTTRANSLIT:; -#GENRE:; -#CREDIT:; -#BANNER:; -#BACKGROUND:; -#LYRICSPATH:; -#CDTITLE:; -#MUSIC:; -#INSTRUMENTTRACK:; -#MUSICLENGTH:; -#OFFSET:; -#STOPS:; -#DELAYS:; -#BPMS:; -#TIMESIGNATURES:; -#LASTBEATHINT:; -#SAMPLESTART:; -#SAMPLELENGTH:; -#DISPLAYBPM:[xxx][xxx:xxx]|[*]; -#SELECTABLE:; -#BGCHANGES:; -#FGCHANGES:; -#KEYSOUNDS:; -#ATTACKS:; - -// stored in cache -#FIRSTBEAT:; // calculated -#LASTBEAT:; // calculated -#SONGFILENAME:; -#MUSICBYTES:; // ignored by loader -#HASMUSIC:; -#HASBANNER:; - -// begin -#NOTEDATA# // marks a new note data section -// information from #NOTES moved here -#STEPSTYPE:; -#DESCRIPTION:; -#DIFFICULTY:; -#METER:; -#RADARVALUES:; -#CREDIT:; - -// steps-based timingdata -#STOPS:; -#DELAYS:; -#BPMS:; -#TIMESIGNATURES:; -#LASTBEATHINT:; - -// actual step data +// sm-ssc step chart/msd5 hacky file format doc. +// based off of .sm, which was based off of DWI's modified MSD format. +#TITLE:; +#SUBTITLE:; +#ARTIST:; +#TITLETRANSLIT:; +#SUBTITLETRANSLIT:; +#ARTISTTRANSLIT:; +#GENRE:; +#CREDIT:; +#BANNER:; +#BACKGROUND:; +#LYRICSPATH:; +#CDTITLE:; +#MUSIC:; +#INSTRUMENTTRACK:; +#MUSICLENGTH:; +#OFFSET:; +#STOPS:; +#DELAYS:; +#BPMS:; +#TIMESIGNATURES:; +#LASTBEATHINT:; +#SAMPLESTART:; +#SAMPLELENGTH:; +#DISPLAYBPM:[xxx][xxx:xxx]|[*]; +#SELECTABLE:; +#BGCHANGES:; +#FGCHANGES:; +#KEYSOUNDS:; +#ATTACKS:; + +// stored in cache +#FIRSTBEAT:; // calculated +#LASTBEAT:; // calculated +#SONGFILENAME:; +#MUSICBYTES:; // ignored by loader +#HASMUSIC:; +#HASBANNER:; + +// begin +#NOTEDATA# // marks a new note data section +// information from #NOTES moved here +#STEPSTYPE:; +#DESCRIPTION:; +#DIFFICULTY:; +#METER:; +#RADARVALUES:; +#CREDIT:; + +// steps-based timingdata +#STOPS:; +#DELAYS:; +#BPMS:; +#TIMESIGNATURES:; +#LASTBEATHINT:; + +// actual step data #NOTES:; \ No newline at end of file diff --git a/Docs/Stats.xml b/Docs/Stats.xml index 58710348d6..d50b7418a2 100644 --- a/Docs/Stats.xml +++ b/Docs/Stats.xml @@ -1,5 +1,5 @@ -<html> -<body> -This is a dummy file, installed by the StepMania installer; it will be overwitten the first time machine stats are saved. -</body> -</html> +<html> +<body> +This is a dummy file, installed by the StepMania installer; it will be overwitten the first time machine stats are saved. +</body> +</html> diff --git a/Docs/Themerdocs/Noteskin elements Reference.txt b/Docs/Themerdocs/Noteskin elements Reference.txt index 32fcde44f0..3eb895febc 100644 --- a/Docs/Themerdocs/Noteskin elements Reference.txt +++ b/Docs/Themerdocs/Noteskin elements Reference.txt @@ -1,145 +1,145 @@ -[Noteskin Elements Reference] -{ Taps } -button Tap Note -button Tap Mine -button Tap Lift -button Tap Fake - -{ holds } ---active-- -button Hold Head Active -button Hold Topcap Active -button Hold Body Active -button Hold Bottomcap Active -button Hold Tail Active - ---inactive-- -button Hold Head Inactive -button Hold Topcap Inactive -button Hold Body Inactive -button Hold Bottomcap Inactive -button Hold Tail Inactive - -{ rolls } ---active-- -button Roll Head Active -button Roll Topcap Active -button Roll Body Active -button Roll Bottomcap Active -button Roll Tail Active - ---inactive-- -button Roll Head Inactive -button Roll Topcap Inactive -button Roll Body Inactive -button Roll Bottomcap Inactive -button Roll Tail Inactive - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -{ button } ---dance-- -Left -Right -Up -Down -UpLeft -UpRight - ---pump-- -UpLeft -UpRight -Center -DownLeft -DownRight - ---kb7-- -Key1 -Key2 -Key3 -Key4 -Key5 -Key6 -Key7 - ---ez2-- -FootUpLeft -FootUpRight -FootDown -HandUpLeft -HandUpRight -HandLrLeft -HandLrRight - ---para-- -Left -UpLeft -Up -UpRight -Right - ---ds3ddx-- -HandLeft -FootDownLeft -FootUpLeft -HandUp -HandDown -FootUpRight -FootDownRight -HandRight - ---beat-- -Key1 -Key2 -Key3 -Key4 -Key5 -Key6 -Key7 -Scratch up -Scratch down - ---maniax-- -HandUpLeft -HandUpRight -HandLrLeft -HandLrRight - ---techno-- -Left -Right -Up -Down -UpLeft -UpRight -Center -DownLeft -DownRight - ---popn-- -Left White -Left Yellow -Left Green -Left Blue -Red -Right Blue -Right Green -Right Yellow -Right White - ---guitar-- (not enabled yet) -Fret1 -Fret2 -Fret3 -Fret4 -Fret5 - ---lights-- (rofl) -MarqueeUpLeft -MarqueeUpRight -MarqueeLrLeft -MarqueeLrRight -ButtonsLeft -ButtonsRight -BassLeft +[Noteskin Elements Reference] +{ Taps } +button Tap Note +button Tap Mine +button Tap Lift +button Tap Fake + +{ holds } +--active-- +button Hold Head Active +button Hold Topcap Active +button Hold Body Active +button Hold Bottomcap Active +button Hold Tail Active + +--inactive-- +button Hold Head Inactive +button Hold Topcap Inactive +button Hold Body Inactive +button Hold Bottomcap Inactive +button Hold Tail Inactive + +{ rolls } +--active-- +button Roll Head Active +button Roll Topcap Active +button Roll Body Active +button Roll Bottomcap Active +button Roll Tail Active + +--inactive-- +button Roll Head Inactive +button Roll Topcap Inactive +button Roll Body Inactive +button Roll Bottomcap Inactive +button Roll Tail Inactive + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +{ button } +--dance-- +Left +Right +Up +Down +UpLeft +UpRight + +--pump-- +UpLeft +UpRight +Center +DownLeft +DownRight + +--kb7-- +Key1 +Key2 +Key3 +Key4 +Key5 +Key6 +Key7 + +--ez2-- +FootUpLeft +FootUpRight +FootDown +HandUpLeft +HandUpRight +HandLrLeft +HandLrRight + +--para-- +Left +UpLeft +Up +UpRight +Right + +--ds3ddx-- +HandLeft +FootDownLeft +FootUpLeft +HandUp +HandDown +FootUpRight +FootDownRight +HandRight + +--beat-- +Key1 +Key2 +Key3 +Key4 +Key5 +Key6 +Key7 +Scratch up +Scratch down + +--maniax-- +HandUpLeft +HandUpRight +HandLrLeft +HandLrRight + +--techno-- +Left +Right +Up +Down +UpLeft +UpRight +Center +DownLeft +DownRight + +--popn-- +Left White +Left Yellow +Left Green +Left Blue +Red +Right Blue +Right Green +Right Yellow +Right White + +--guitar-- (not enabled yet) +Fret1 +Fret2 +Fret3 +Fret4 +Fret5 + +--lights-- (rofl) +MarqueeUpLeft +MarqueeUpRight +MarqueeLrLeft +MarqueeLrRight +ButtonsLeft +ButtonsRight +BassLeft BassRight \ No newline at end of file diff --git a/Docs/Themerdocs/ScreenMessages.txt b/Docs/Themerdocs/ScreenMessages.txt index 2275ad22de..0dc8b46b33 100644 --- a/Docs/Themerdocs/ScreenMessages.txt +++ b/Docs/Themerdocs/ScreenMessages.txt @@ -1,209 +1,209 @@ -A list of screen messages that can be used with -SCREENMAN:GetTopScreen():PostScreenMessage('SM_*', delaySeconds). - -Duplicate screen messages may appear; the below lists include both -AutoScreenMessage()s and any messages that appear in -Screen*::HandleScreenMessage(const ScreenMessage SM). -Consider this a list of messages that screens can reply to. - -[ScreenMessage] -SM_Invalid -SM_None -SM_MenuTimer Timer = 00 -SM_DoneFadingIn Plays after sorting by draworder [ScreenWithMenuElements::BeginScreen()] -SM_BeginFadingOut Begins a fadeout? -SM_GoToNextScreen Goes to next screen? -SM_GoToPrevScreen Goes to prev screen? -SM_GainFocus -SM_LoseFocus -SM_Pause try it on Gameplay... :) -SM_Success -SM_Failure - -[Inventory] -SM_BattleDamageLevel1 -SM_BattleDamageLevel2 -SM_BattleDamageLevel3 - -[Player] -SM_100Combo -SM_200Combo -SM_300Combo -SM_400Combo -SM_500Combo -SM_600Combo -SM_700Combo -SM_800Combo -SM_900Combo -SM_1000Combo -SM_ComboStopped -SM_ComboContinuing - -[ScorekeeperNormal] -SM_PlayToasty what do you think it does - -[ScreenAttract] -SM_GoToStartScreen - -[ScreenGameplay] -SM_NotesEnded -SM_BeginFailed -SM_LeaveGameplay -SM_PlayGo -SM_LoadNextSong -SM_StartLoadingNextSong -SM_DoPrevScreen -SM_DoNextScreen -SM_StartHereWeGo -SM_StopHereWeGo -SM_BattleTrickLevel1 -SM_BattleTrickLevel2 -SM_BattleTrickLevel3 --- from elsewhere ---------- -SM_PlayToasty -SM_100Combo - SM_1000Combo - -[ScreenOptions] -SM_ExportOptions - -[MusicWheel] -SM_SongChanged -SM_SortOrderChanging -SM_SortOrderChanged - -[NetworkSyncManager] -SM_AddToChat -SM_ChangeSong -SM_GotEval -SM_UsersUpdate -SM_SMOnlinePack - -[RoomInfoDisplay] -SM_RoomInfoRetract -SM_RoomInfoDeploy - -[RoomWheel] -SM_BackFromRoomName -SM_RoomInfoRetract -SM_RoomInfoDeploy - -[ScreenEdit] -SM_UpdateTextInfo -SM_BackFromMainMenu -SM_BackFromAreaMenu -SM_BackFromStepsInformation -SM_BackFromOptions -SM_BackFromSongInformation -SM_BackFromBGChange -SM_BackFromInsertTapAttack -SM_BackFromInsertTapAttackPlayerOptions -SM_BackFromInsertCourseAttack -SM_BackFromInsertCourseAttackPlayerOptions -SM_BackFromCourseModeMenu -SM_DoRevertToLastSave -SM_DoRevertFromDisk -SM_BackFromBPMChange -SM_BackFromStopChange -SM_DoSaveAndExit -SM_DoExit -SM_SaveSuccessful -SM_SaveFailed - -[ScreenEditMenu] -SM_RefreshSelector -SM_BackFromEditDescription - -[ScreenEvaluation] -SM_PlayCheer -SM_AddBonus - -[ScreenMiniMenu] -SM_GoToOK -SM_GoToCancel - -[ScreenNetEvaluation] -SM_GotEval - -[ScreenNetRoom] -SM_SMOnlinePack -SM_BackFromRoomName -SM_BackFromRoomDesc -SM_BackFromRoomPass -SM_BackFromReqPass -SM_RoomInfoRetract -SM_RoomInfoDeploy - -[ScreenNetSelectBase] -SM_AddToChat -SM_UsersUpdate -SM_SMOnlinePack - -[ScreenNetSelectMusic] -SM_NoSongs -SM_ChangeSong -SM_SMOnlinePack -SM_SetWheelSong -SM_RefreshWheelLocation -SM_SongChanged -SM_UsersUpdate -SM_BackFromPlayerOptions - -[ScreenNetworkOptions] -SM_DoneConnecting - -[ScreenOptionsEditCourse] -SM_BackFromContextMenu - -[ScreenOptionsEditCourseEntry] -SM_BackFromCoursePlayerOptions - -[ScreenOptionsManageCourses] -SM_BackFromEnterNameForNew -SM_BackFromRename -SM_BackFromContextMenu - -[ScreenOptionsManageEditSteps] -SM_BackFromRename -SM_BackFromDelete -SM_BackFromContextMenu - -[ScreenOptionsManageProfiles] -SM_BackFromEnterNameForNew -SM_BackFromRename -SM_BackFromDeleteConfirm -SM_BackFromClearConfirm -SM_BackFromContextMenu - -[ScreenOptionsManageWorkouts] - -[ScreenOptionsReviewWorkout] - -[ScreenPackages] - -[ScreenRanking] - -[ScreenSelectMaster] - -[ScreenSelectMusic] -SM_AllowOptionsMenuRepeat -SM_SongChanged -SM_SortOrderChanging -SM_SortOrderChanged - -[ScreenSMOnlineLogin] -SM_SMOnlinePack -SM_PasswordDone -SM_NoProfilesDefined -SM_GoToNextScreen - -[ScreenSplash] -SM_PrepScreen - -[ScreenStage] -SM_PrepScreen - -[ScreenTestFonts] -SM_ChangeText - -[WheelBase] +A list of screen messages that can be used with +SCREENMAN:GetTopScreen():PostScreenMessage('SM_*', delaySeconds). + +Duplicate screen messages may appear; the below lists include both +AutoScreenMessage()s and any messages that appear in +Screen*::HandleScreenMessage(const ScreenMessage SM). +Consider this a list of messages that screens can reply to. + +[ScreenMessage] +SM_Invalid +SM_None +SM_MenuTimer Timer = 00 +SM_DoneFadingIn Plays after sorting by draworder [ScreenWithMenuElements::BeginScreen()] +SM_BeginFadingOut Begins a fadeout? +SM_GoToNextScreen Goes to next screen? +SM_GoToPrevScreen Goes to prev screen? +SM_GainFocus +SM_LoseFocus +SM_Pause try it on Gameplay... :) +SM_Success +SM_Failure + +[Inventory] +SM_BattleDamageLevel1 +SM_BattleDamageLevel2 +SM_BattleDamageLevel3 + +[Player] +SM_100Combo +SM_200Combo +SM_300Combo +SM_400Combo +SM_500Combo +SM_600Combo +SM_700Combo +SM_800Combo +SM_900Combo +SM_1000Combo +SM_ComboStopped +SM_ComboContinuing + +[ScorekeeperNormal] +SM_PlayToasty what do you think it does + +[ScreenAttract] +SM_GoToStartScreen + +[ScreenGameplay] +SM_NotesEnded +SM_BeginFailed +SM_LeaveGameplay +SM_PlayGo +SM_LoadNextSong +SM_StartLoadingNextSong +SM_DoPrevScreen +SM_DoNextScreen +SM_StartHereWeGo +SM_StopHereWeGo +SM_BattleTrickLevel1 +SM_BattleTrickLevel2 +SM_BattleTrickLevel3 +-- from elsewhere ---------- +SM_PlayToasty +SM_100Combo - SM_1000Combo + +[ScreenOptions] +SM_ExportOptions + +[MusicWheel] +SM_SongChanged +SM_SortOrderChanging +SM_SortOrderChanged + +[NetworkSyncManager] +SM_AddToChat +SM_ChangeSong +SM_GotEval +SM_UsersUpdate +SM_SMOnlinePack + +[RoomInfoDisplay] +SM_RoomInfoRetract +SM_RoomInfoDeploy + +[RoomWheel] +SM_BackFromRoomName +SM_RoomInfoRetract +SM_RoomInfoDeploy + +[ScreenEdit] +SM_UpdateTextInfo +SM_BackFromMainMenu +SM_BackFromAreaMenu +SM_BackFromStepsInformation +SM_BackFromOptions +SM_BackFromSongInformation +SM_BackFromBGChange +SM_BackFromInsertTapAttack +SM_BackFromInsertTapAttackPlayerOptions +SM_BackFromInsertCourseAttack +SM_BackFromInsertCourseAttackPlayerOptions +SM_BackFromCourseModeMenu +SM_DoRevertToLastSave +SM_DoRevertFromDisk +SM_BackFromBPMChange +SM_BackFromStopChange +SM_DoSaveAndExit +SM_DoExit +SM_SaveSuccessful +SM_SaveFailed + +[ScreenEditMenu] +SM_RefreshSelector +SM_BackFromEditDescription + +[ScreenEvaluation] +SM_PlayCheer +SM_AddBonus + +[ScreenMiniMenu] +SM_GoToOK +SM_GoToCancel + +[ScreenNetEvaluation] +SM_GotEval + +[ScreenNetRoom] +SM_SMOnlinePack +SM_BackFromRoomName +SM_BackFromRoomDesc +SM_BackFromRoomPass +SM_BackFromReqPass +SM_RoomInfoRetract +SM_RoomInfoDeploy + +[ScreenNetSelectBase] +SM_AddToChat +SM_UsersUpdate +SM_SMOnlinePack + +[ScreenNetSelectMusic] +SM_NoSongs +SM_ChangeSong +SM_SMOnlinePack +SM_SetWheelSong +SM_RefreshWheelLocation +SM_SongChanged +SM_UsersUpdate +SM_BackFromPlayerOptions + +[ScreenNetworkOptions] +SM_DoneConnecting + +[ScreenOptionsEditCourse] +SM_BackFromContextMenu + +[ScreenOptionsEditCourseEntry] +SM_BackFromCoursePlayerOptions + +[ScreenOptionsManageCourses] +SM_BackFromEnterNameForNew +SM_BackFromRename +SM_BackFromContextMenu + +[ScreenOptionsManageEditSteps] +SM_BackFromRename +SM_BackFromDelete +SM_BackFromContextMenu + +[ScreenOptionsManageProfiles] +SM_BackFromEnterNameForNew +SM_BackFromRename +SM_BackFromDeleteConfirm +SM_BackFromClearConfirm +SM_BackFromContextMenu + +[ScreenOptionsManageWorkouts] + +[ScreenOptionsReviewWorkout] + +[ScreenPackages] + +[ScreenRanking] + +[ScreenSelectMaster] + +[ScreenSelectMusic] +SM_AllowOptionsMenuRepeat +SM_SongChanged +SM_SortOrderChanging +SM_SortOrderChanged + +[ScreenSMOnlineLogin] +SM_SMOnlinePack +SM_PasswordDone +SM_NoProfilesDefined +SM_GoToNextScreen + +[ScreenSplash] +SM_PrepScreen + +[ScreenStage] +SM_PrepScreen + +[ScreenTestFonts] +SM_ChangeText + +[WheelBase] SM_SongChanged \ No newline at end of file diff --git a/Docs/Themerdocs/ScreenTextEntry.txt b/Docs/Themerdocs/ScreenTextEntry.txt index 4e3b4d2bf7..ccec70543b 100644 --- a/Docs/Themerdocs/ScreenTextEntry.txt +++ b/Docs/Themerdocs/ScreenTextEntry.txt @@ -1,17 +1,17 @@ --- how to connect to a server with the new ScreenTextEntry Lua bindings --- (this is the base code; I'll come up with a full tutorial later.) -SCREENMAN:AddNewScreenToTop("ScreenTextEntry"); -local serverSettings = { - Question = "Connect to server:", - MaxInputLength = 255, - OnOK = function(answer) - if IsNetConnected() then - -- close connection before connecting to new server - CloseConnection() - end - - -- connect to server - ConnectToServer(answer) - end, -}; +-- how to connect to a server with the new ScreenTextEntry Lua bindings +-- (this is the base code; I'll come up with a full tutorial later.) +SCREENMAN:AddNewScreenToTop("ScreenTextEntry"); +local serverSettings = { + Question = "Connect to server:", + MaxInputLength = 255, + OnOK = function(answer) + if IsNetConnected() then + -- close connection before connecting to new server + CloseConnection() + end + + -- connect to server + ConnectToServer(answer) + end, +}; SCREENMAN:GetTopScreen():Load(serverSettings); \ No newline at end of file diff --git a/Docs/Themerdocs/ThemePrefs.txt b/Docs/Themerdocs/ThemePrefs.txt index f9f60a3a19..d0307503ba 100644 --- a/Docs/Themerdocs/ThemePrefs.txt +++ b/Docs/Themerdocs/ThemePrefs.txt @@ -1,88 +1,88 @@ -ThemePrefs, v0.7 ----------------- - -ThemePrefs is a system for handling theme-specific preferences in a standard, -efficient, and predictable way. All you do, basically, is declare a table of -preferences and options and use GetThemePref(name) to get your preference -values as needed. This system will handle all disk I/O as well. - -Additionally, it can work in combination with ThemePrefsRows to generate -OptionsRows for all preferences, saving you (most of) the trouble with -integrating it into your theme. More on that later. - -The prefs are written, using IniFile, into Save/ThemePrefs.ini, written under -the section corresponding to your theme name (if ThemeInfo exists, it will -use the Name field listed there; otherwise, it will use the folder name). - ----------------------- -Section 1: Declaration ----------------------- - -To declare preferences for your theme to use, make a table with named -tables in it; its name is used for the preference, and the tables hold -the options for that preference. All you need to know for now is that -Default is required; for more options, check ThemePrefsRows. - -After the table is declared, pass it to the function ThemePrefs.InitAll(). -(If you're planning not to use any OptionsRows at all, you can just use -ThemePrefs.Init() to save some processing time, but seriously give the -ThemePrefsRows system a look before you disregard it.) - -[code] -local Prefs = -{ - BoolPref = { Default = false }, - IntPref = { Default = 3 }, -} - -ThemePrefs.InitAll( Prefs ) -[/code] - -If your theme is "default", this will generate a ThemePrefs.ini like so: - -[default] -BoolPref=false -IntPref=3 - ----------------- -Section 2: Usage ----------------- - -You can access the value with ThemePrefs.Get(name) or GetThemePref(name): -both calls work identically. The return type will be based on whatever you set -it to, but the subsystem will always try number, then bool, then string, in -that order. Use true and false for bools, not 1 and 0. - -For example, if you wanted to branch something in the metrics based on -the value of BoolPref (which is a boolean), you could use the following: - -NextScreen=GetThemePref('BoolPref') and "ScreenTrue" or "ScreenFalse" - -If you want to set a preference value for some reason, you can use either -ThemePrefs.Set(name, value) or SetThemePref(name, value), but the point of -this API is to simplify and standardize prefs handling, so you really should -not need it. (Use ThemePrefsRows instead.) - ------------------------ -Section 3: Localization ------------------------ - -ThemePrefs has two strings that can be localized, to be placed under -[ThemePrefs] in the appropriate language INI. - -IniFileMissing - displayed when IniFile.lua is not found, which means - ThemePrefs cannot be loaded from or written to disk - -UnknownPreference - displayed when an attempt is made to read or write - a preference that does not exist in the system. Uses %s for the - name of the unknown preference. - ---------------------- -Section 4: Disclaimer ---------------------- - -Though this is working fine so far, it is still experimental! If you run -into problems, or have suggestions, comments, questions, etc., please talk -to "vyhd" in #sm-ssc on irc.badnik.net, as it's his code to maintain; he -hates subjecting other people to his code (and occasionally vice versa), -but will gladly address concerns that come up. +ThemePrefs, v0.7 +---------------- + +ThemePrefs is a system for handling theme-specific preferences in a standard, +efficient, and predictable way. All you do, basically, is declare a table of +preferences and options and use GetThemePref(name) to get your preference +values as needed. This system will handle all disk I/O as well. + +Additionally, it can work in combination with ThemePrefsRows to generate +OptionsRows for all preferences, saving you (most of) the trouble with +integrating it into your theme. More on that later. + +The prefs are written, using IniFile, into Save/ThemePrefs.ini, written under +the section corresponding to your theme name (if ThemeInfo exists, it will +use the Name field listed there; otherwise, it will use the folder name). + +---------------------- +Section 1: Declaration +---------------------- + +To declare preferences for your theme to use, make a table with named +tables in it; its name is used for the preference, and the tables hold +the options for that preference. All you need to know for now is that +Default is required; for more options, check ThemePrefsRows. + +After the table is declared, pass it to the function ThemePrefs.InitAll(). +(If you're planning not to use any OptionsRows at all, you can just use +ThemePrefs.Init() to save some processing time, but seriously give the +ThemePrefsRows system a look before you disregard it.) + +[code] +local Prefs = +{ + BoolPref = { Default = false }, + IntPref = { Default = 3 }, +} + +ThemePrefs.InitAll( Prefs ) +[/code] + +If your theme is "default", this will generate a ThemePrefs.ini like so: + +[default] +BoolPref=false +IntPref=3 + +---------------- +Section 2: Usage +---------------- + +You can access the value with ThemePrefs.Get(name) or GetThemePref(name): +both calls work identically. The return type will be based on whatever you set +it to, but the subsystem will always try number, then bool, then string, in +that order. Use true and false for bools, not 1 and 0. + +For example, if you wanted to branch something in the metrics based on +the value of BoolPref (which is a boolean), you could use the following: + +NextScreen=GetThemePref('BoolPref') and "ScreenTrue" or "ScreenFalse" + +If you want to set a preference value for some reason, you can use either +ThemePrefs.Set(name, value) or SetThemePref(name, value), but the point of +this API is to simplify and standardize prefs handling, so you really should +not need it. (Use ThemePrefsRows instead.) + +----------------------- +Section 3: Localization +----------------------- + +ThemePrefs has two strings that can be localized, to be placed under +[ThemePrefs] in the appropriate language INI. + +IniFileMissing - displayed when IniFile.lua is not found, which means + ThemePrefs cannot be loaded from or written to disk + +UnknownPreference - displayed when an attempt is made to read or write + a preference that does not exist in the system. Uses %s for the + name of the unknown preference. + +--------------------- +Section 4: Disclaimer +--------------------- + +Though this is working fine so far, it is still experimental! If you run +into problems, or have suggestions, comments, questions, etc., please talk +to "vyhd" in #sm-ssc on irc.badnik.net, as it's his code to maintain; he +hates subjecting other people to his code (and occasionally vice versa), +but will gladly address concerns that come up. diff --git a/Docs/Themerdocs/ThemePrefsRows.txt b/Docs/Themerdocs/ThemePrefsRows.txt index 750843d798..42a9d6bf14 100644 --- a/Docs/Themerdocs/ThemePrefsRows.txt +++ b/Docs/Themerdocs/ThemePrefsRows.txt @@ -1,145 +1,145 @@ -ThemePrefsRows, v0.5 --------------------- - -ThemePrefsRows is an optional system that works with ThemePrefs to generate -Lua-based OptionsRows for every preference used in the system. All you do is -declare a table of preferences and pass it to ThemePrefs.InitAll(), which will -also initialize ThemePrefs. Note that you do need to add an entry for each -preference in [OptionTitles] and [OptionExplanations] to give the row its name -and describe what it does; I hope to find a (clean) way to do it from Lua. - ----------------------- -Section 1: Declaration ----------------------- - -Declaring preferences is the same basic concept as ThemePrefs; see that doc -for the basics. So I'll go into the stuff that's important to this API. - -As mentioned in ThemePrefs, the table contains options. The possible options -and their types are outlaid here. (The pref's type is defined by Default.) - -Default: whatever the value is set to by default. For sanity's sake, you - should have this in your Choices table. - -Choices (table): an indexed array containing all the possible OptionsRow - choices. If you're using a Values table, the array values should be - strings. If not, you can use any type that can cast to a string. - -Values (table): indexed array of the pref's type containing the value used when - the Choices entry with the same index is chosen in the row. If that - confused you, don't worry: it'll make more sense in the example. - This is optional, if your pref type can cast to strings. - -Params (table): optional modifications to the OptionsRow. I'll cover this in - more detail in a later section. You probably won't need it. - -To make this clearer, have an example of a valid prefs table: - -[code] -local prefs = -{ - BoolPref = - { - Default = false, - Choices = { "On", "Off" }, - Values = { true, false }, - }, - - IntPref = - { - Default = 3, - Choices = { 1, 2, 3, 4, 5 }, - Params = { SelectType = "ShowOneInRow" } - } -} - -ThemePrefs.InitAll( prefs ) -[/code] - -So when "On" is selected, BoolPref will be set to true, and selecting "Off" -will set it false. Simple enough, yeah? This will scale to any type you like. -Enumerations, strings, whatever. - ------------------ -Section 2: Params ------------------ - -We did promise a more in-depth look at Params, so here it is. - -The following arguments and values are currently accepted for Params: - -LayoutType (string): "ShowAllInRow" (default), "ShowOneInRow". - -ExportOnChange (bool): currently disabled in the source, but available to - set in case it's enabled later. If true, the Save function (which - handles actually setting the preference) is called whenever a value - is changed rather than when the screen changes. - -EnabledForPlayers (function): has 'self' as an argument, returns a table of - PlayerNumbers who are allowed to select stuff. Not important yet. - -ReloadRowMessages (table): contains an indexed array of strings. Whenever - any of the messages in this table are broadcast, the Load function - (which loads the list of possible options and sets the selected - value/s) is called again. - -LoadSelections (function): takes self, list, pn, overrides the default - function. This is advanced usage, so you should probably know - what you're doing to use it. Probably unnecessary. - -SaveSelections (function): takes self, list, pn, and overrides the default - function. This is advanced as well, for the same reasons. Fortunately, - you probably won't need it. - ----------------- -Section 3: Usage ----------------- - -To get the OptionsRow for the preference you want, use ThemePrefRow(name) -or ThemePrefsRows.GetRow(name); they're the same function. You'd use this -as, for example in the metrics: - -Line1="lua,ThemePrefRow('BoolPref')" - -Unfortunately, you do need to do some more work with the Language INIs too. -For each declared preference, you need an entry under [OptionTitles] for its -title and an entry under [OptionExplanations] for its description. The key for -both is the name of the preference. With the above example, that'd be e.g. - -[OptionTitles] -(...) -BoolPref=BoolPref -IntPref=IntPref - -[OptionExplanations] -(...) -BoolPref=Toggles a simple boolean preference between true and false. -IntPref=Sets an integer value between 1 and 5. - ------------------------ -Section 4: Localization ------------------------ - -ThemePrefsRows has three themable strings: - -NoDefaultInValues - if the default value isn't actually in choices or values, - this is displayed. Takes %s for the affected preference's name. - -TypeMismatch - if the default type and a value type mismatch, this is shown. - Takes %s, %d, and %s for the default's type, the index of the - mismatching value, and the value's type respectively. - -ChoicesSizeMismatch - if the Choices and Values arrays have different - lengths, this is displayed. Takes %d and %d for the size of - Choices and Values, respectively. - ---------------------- -Section 5: Disclaimer ---------------------- - -This isn't as tested as I'd like. For this version, it remains experimental. -Quite experimental. If you run into problems, please let me know so I can -fix them. - -Please direct all questions, comments, complaints, bug reports, etc. to "vyhd" -in #sm-ssc on irc.badnik.net or whatever other form of communication you like. +ThemePrefsRows, v0.5 +-------------------- + +ThemePrefsRows is an optional system that works with ThemePrefs to generate +Lua-based OptionsRows for every preference used in the system. All you do is +declare a table of preferences and pass it to ThemePrefs.InitAll(), which will +also initialize ThemePrefs. Note that you do need to add an entry for each +preference in [OptionTitles] and [OptionExplanations] to give the row its name +and describe what it does; I hope to find a (clean) way to do it from Lua. + +---------------------- +Section 1: Declaration +---------------------- + +Declaring preferences is the same basic concept as ThemePrefs; see that doc +for the basics. So I'll go into the stuff that's important to this API. + +As mentioned in ThemePrefs, the table contains options. The possible options +and their types are outlaid here. (The pref's type is defined by Default.) + +Default: whatever the value is set to by default. For sanity's sake, you + should have this in your Choices table. + +Choices (table): an indexed array containing all the possible OptionsRow + choices. If you're using a Values table, the array values should be + strings. If not, you can use any type that can cast to a string. + +Values (table): indexed array of the pref's type containing the value used when + the Choices entry with the same index is chosen in the row. If that + confused you, don't worry: it'll make more sense in the example. + This is optional, if your pref type can cast to strings. + +Params (table): optional modifications to the OptionsRow. I'll cover this in + more detail in a later section. You probably won't need it. + +To make this clearer, have an example of a valid prefs table: + +[code] +local prefs = +{ + BoolPref = + { + Default = false, + Choices = { "On", "Off" }, + Values = { true, false }, + }, + + IntPref = + { + Default = 3, + Choices = { 1, 2, 3, 4, 5 }, + Params = { SelectType = "ShowOneInRow" } + } +} + +ThemePrefs.InitAll( prefs ) +[/code] + +So when "On" is selected, BoolPref will be set to true, and selecting "Off" +will set it false. Simple enough, yeah? This will scale to any type you like. +Enumerations, strings, whatever. + +----------------- +Section 2: Params +----------------- + +We did promise a more in-depth look at Params, so here it is. + +The following arguments and values are currently accepted for Params: + +LayoutType (string): "ShowAllInRow" (default), "ShowOneInRow". + +ExportOnChange (bool): currently disabled in the source, but available to + set in case it's enabled later. If true, the Save function (which + handles actually setting the preference) is called whenever a value + is changed rather than when the screen changes. + +EnabledForPlayers (function): has 'self' as an argument, returns a table of + PlayerNumbers who are allowed to select stuff. Not important yet. + +ReloadRowMessages (table): contains an indexed array of strings. Whenever + any of the messages in this table are broadcast, the Load function + (which loads the list of possible options and sets the selected + value/s) is called again. + +LoadSelections (function): takes self, list, pn, overrides the default + function. This is advanced usage, so you should probably know + what you're doing to use it. Probably unnecessary. + +SaveSelections (function): takes self, list, pn, and overrides the default + function. This is advanced as well, for the same reasons. Fortunately, + you probably won't need it. + +---------------- +Section 3: Usage +---------------- + +To get the OptionsRow for the preference you want, use ThemePrefRow(name) +or ThemePrefsRows.GetRow(name); they're the same function. You'd use this +as, for example in the metrics: + +Line1="lua,ThemePrefRow('BoolPref')" + +Unfortunately, you do need to do some more work with the Language INIs too. +For each declared preference, you need an entry under [OptionTitles] for its +title and an entry under [OptionExplanations] for its description. The key for +both is the name of the preference. With the above example, that'd be e.g. + +[OptionTitles] +(...) +BoolPref=BoolPref +IntPref=IntPref + +[OptionExplanations] +(...) +BoolPref=Toggles a simple boolean preference between true and false. +IntPref=Sets an integer value between 1 and 5. + +----------------------- +Section 4: Localization +----------------------- + +ThemePrefsRows has three themable strings: + +NoDefaultInValues - if the default value isn't actually in choices or values, + this is displayed. Takes %s for the affected preference's name. + +TypeMismatch - if the default type and a value type mismatch, this is shown. + Takes %s, %d, and %s for the default's type, the index of the + mismatching value, and the value's type respectively. + +ChoicesSizeMismatch - if the Choices and Values arrays have different + lengths, this is displayed. Takes %d and %d for the size of + Choices and Values, respectively. + +--------------------- +Section 5: Disclaimer +--------------------- + +This isn't as tested as I'd like. For this version, it remains experimental. +Quite experimental. If you run into problems, please let me know so I can +fix them. + +Please direct all questions, comments, complaints, bug reports, etc. to "vyhd" +in #sm-ssc on irc.badnik.net or whatever other form of communication you like. diff --git a/Docs/Themerdocs/actordef.txt b/Docs/Themerdocs/actordef.txt index 9be6a71af5..ed91dd4c93 100644 --- a/Docs/Themerdocs/actordef.txt +++ b/Docs/Themerdocs/actordef.txt @@ -1,45 +1,45 @@ -[sm-ssc v1.0 public beta 2 | last update 2010/apr 11] -This is a list of all the known Actor classes in sm-ssc. You can use these by -prefixing "Def." on the end of the name (e.g. Def.PaneDisplay). - -Actor -ActorFrame -ActorFrameTexture -ActorMultiTexture -ActorProxy -ActorScroller -Banner -BGAnimation -BitmapText -BPMDisplay -ComboGraph -ControllerStateDisplay -CourseContentsList -DeviceList -DifficultyIcon -DynamicActorScroller -FadingBanner -GradeDisplay -GraphDisplay -GrooveRadar -HelpDisplay -HoldJudgment -InputList -MemoryCardDisplay -MeterDisplay -Model -ModIconRow -PaneDisplay -PercentageDisplay -Quad -RollingNumbers -ScoreDisplayAliveTime -ScoreDisplayCalories -SongBPMDisplay -SongMeterDisplay -Sound -Sprite -StepsDisplay -StepsDisplayList -TextBanner +[sm-ssc v1.0 public beta 2 | last update 2010/apr 11] +This is a list of all the known Actor classes in sm-ssc. You can use these by +prefixing "Def." on the end of the name (e.g. Def.PaneDisplay). + +Actor +ActorFrame +ActorFrameTexture +ActorMultiTexture +ActorProxy +ActorScroller +Banner +BGAnimation +BitmapText +BPMDisplay +ComboGraph +ControllerStateDisplay +CourseContentsList +DeviceList +DifficultyIcon +DynamicActorScroller +FadingBanner +GradeDisplay +GraphDisplay +GrooveRadar +HelpDisplay +HoldJudgment +InputList +MemoryCardDisplay +MeterDisplay +Model +ModIconRow +PaneDisplay +PercentageDisplay +Quad +RollingNumbers +ScoreDisplayAliveTime +ScoreDisplayCalories +SongBPMDisplay +SongMeterDisplay +Sound +Sprite +StepsDisplay +StepsDisplayList +TextBanner WorkoutGraph \ No newline at end of file diff --git a/Docs/Themerdocs/conditional_music.txt b/Docs/Themerdocs/conditional_music.txt index 2cc2c2140f..2adccbe5ba 100644 --- a/Docs/Themerdocs/conditional_music.txt +++ b/Docs/Themerdocs/conditional_music.txt @@ -1,61 +1,61 @@ -sm-ssc Conditional Music/Sounds [v0001 | 2010/03/23 | written by AJ] --------------------------------------------------------------------- -Conditional Music/Sounds allows a themer to use Lua scripts to determine what -sound is played. This can be useful for many reasons, mainly to give a theme -some extra flavor. It can be used (along with UserPreferences+EnvUtils2) to -mimic beatmania IIDX's BGM selection ability (also seen in various k//eternal -themes for StepMania 3.9 via an external program). - -This is a feature that will lock your theme to sm-ssc, since StepMania 4 does -not support it. If you care about having an easily-portable theme, conditional -music/sounds won't really help. However, it is a nice feature to have. - -Implementing conditional music/sounds in sm-ssc requires the following: -* multiple sound files in Themes/{yourtheme}/Sounds/ -* A Lua script that returns the path to one of these sounds, wrapped in a - THEME:GetPathS(). - -The canonical example is the one used to test the code in the first place. -This is a Lua script. - -[code] --- given two audio files _agB.(mp3/ogg/wav) and _agA.(mp3/ogg/wav), this will --- return a random sound. -local a = math.random(50); -local ret; -if a % 2 == 0 then - ret = "_agB"; -else - ret = "_agA"; -end; --- THEME:GetPathS() has to be used here since the script doesn't know where it is. -return THEME:GetPathS("",ret); -[/code] - -Of course, this file could be simplified, but since only two choices were -available at the time, there was no need. Unfortunately, that means a lot of -possible edge cases exist where problems could arise. - -For example: it's currently unknown if you can use EnvUtils or UserPreferences -to set the song. - -This example uses a different song each month. -[code] -local songs = { - "neatsong1", -- January - "neatsong2", -- February - "neatsong3", -- March - "joke", -- April - "fiesta", -- May - "anothersong", -- June - "airsong", -- July - "earthsong", -- August - "watersong", -- September - "spooky", -- October - "firesong", -- November - "holidays", -- December -}; --- MonthOfYear starts at 0. Lua arrays are 1-indexed, so fix the value -local curMonth = MonthOfYear()+1; -return THEME:GetPathS("",songs[curMonth]); +sm-ssc Conditional Music/Sounds [v0001 | 2010/03/23 | written by AJ] +-------------------------------------------------------------------- +Conditional Music/Sounds allows a themer to use Lua scripts to determine what +sound is played. This can be useful for many reasons, mainly to give a theme +some extra flavor. It can be used (along with UserPreferences+EnvUtils2) to +mimic beatmania IIDX's BGM selection ability (also seen in various k//eternal +themes for StepMania 3.9 via an external program). + +This is a feature that will lock your theme to sm-ssc, since StepMania 4 does +not support it. If you care about having an easily-portable theme, conditional +music/sounds won't really help. However, it is a nice feature to have. + +Implementing conditional music/sounds in sm-ssc requires the following: +* multiple sound files in Themes/{yourtheme}/Sounds/ +* A Lua script that returns the path to one of these sounds, wrapped in a + THEME:GetPathS(). + +The canonical example is the one used to test the code in the first place. +This is a Lua script. + +[code] +-- given two audio files _agB.(mp3/ogg/wav) and _agA.(mp3/ogg/wav), this will +-- return a random sound. +local a = math.random(50); +local ret; +if a % 2 == 0 then + ret = "_agB"; +else + ret = "_agA"; +end; +-- THEME:GetPathS() has to be used here since the script doesn't know where it is. +return THEME:GetPathS("",ret); +[/code] + +Of course, this file could be simplified, but since only two choices were +available at the time, there was no need. Unfortunately, that means a lot of +possible edge cases exist where problems could arise. + +For example: it's currently unknown if you can use EnvUtils or UserPreferences +to set the song. + +This example uses a different song each month. +[code] +local songs = { + "neatsong1", -- January + "neatsong2", -- February + "neatsong3", -- March + "joke", -- April + "fiesta", -- May + "anothersong", -- June + "airsong", -- July + "earthsong", -- August + "watersong", -- September + "spooky", -- October + "firesong", -- November + "holidays", -- December +}; +-- MonthOfYear starts at 0. Lua arrays are 1-indexed, so fix the value +local curMonth = MonthOfYear()+1; +return THEME:GetPathS("",songs[curMonth]); [/code] \ No newline at end of file diff --git a/Docs/Themerdocs/fontini.txt b/Docs/Themerdocs/fontini.txt index bd01d61d18..dcaa3b85c1 100644 --- a/Docs/Themerdocs/fontini.txt +++ b/Docs/Themerdocs/fontini.txt @@ -1,26 +1,26 @@ -SM4 Font .ini values - -[common] -CapitalsOnly - If set to 1, lowercase letters are drawn with uppercase letters instead. -RightToLeft - Font should be rendered as right to left. -DefaultStrokeColor - Sets default stroke color. (e.g. #00000000) - -[main] -import - Imports a font page into the current font. - -(per-page) -DrawExtraPixelsLeft - How many pixels to draw to the left of a character. -DrawExtraPixelsRight - How many pixels to draw to the right of a character. -AddToAllWidths - Adds x amount of pixels to all widths. -ScaleAllWidthsBy - Scales widths by the factor specified. -LineSpacing - Modifies line spacing. -Top - Specifies the top of the character. (in pixels) -Baseline - Specifies the baseline of the character. (in pixels) -DefaultWidth - Default width for a glyph. -AdvanceExtraPixels - Rudimentary way to control letter spacing -TextureHints - An alternative to throwing the TextureHints in the filename. - -(general commands) -MAP - Maps a keyword to a frame number. (e.g. map up=0) -RANGE - Defines a Unicode range to use. +SM4 Font .ini values + +[common] +CapitalsOnly - If set to 1, lowercase letters are drawn with uppercase letters instead. +RightToLeft - Font should be rendered as right to left. +DefaultStrokeColor - Sets default stroke color. (e.g. #00000000) + +[main] +import - Imports a font page into the current font. + +(per-page) +DrawExtraPixelsLeft - How many pixels to draw to the left of a character. +DrawExtraPixelsRight - How many pixels to draw to the right of a character. +AddToAllWidths - Adds x amount of pixels to all widths. +ScaleAllWidthsBy - Scales widths by the factor specified. +LineSpacing - Modifies line spacing. +Top - Specifies the top of the character. (in pixels) +Baseline - Specifies the baseline of the character. (in pixels) +DefaultWidth - Default width for a glyph. +AdvanceExtraPixels - Rudimentary way to control letter spacing +TextureHints - An alternative to throwing the TextureHints in the filename. + +(general commands) +MAP - Maps a keyword to a frame number. (e.g. map up=0) +RANGE - Defines a Unicode range to use. LINE - (e.g. Line 1=ABCDEFGH) \ No newline at end of file diff --git a/Docs/Themerdocs/gamecommands.txt b/Docs/Themerdocs/gamecommands.txt index 76176d1b5a..8b2f11a277 100644 --- a/Docs/Themerdocs/gamecommands.txt +++ b/Docs/Themerdocs/gamecommands.txt @@ -1,62 +1,62 @@ -all the known gamecommands (pre-sm-ssc) - -"style" -"playmode" -"difficulty" - -"announcer" {m_sAnnouncer = sValue;} - -"name" {m_sName = sValue;} - -"text" {m_sText = sValue;} - -"mod" {m_sPreferredModifiers += sValue;} - -"stagemod" {m_sStageModifiers += sValue;} - -"lua" - -"screen" {m_sScreen = sValue;} - -"song" -"steps" -"course" -"trail" - -"setenv" { - if( cmd.m_vsArgs.size() == 3 ) - m_SetEnv[ cmd.m_vsArgs[1] ] = cmd.m_vsArgs[2]; } - -"songgroup" {m_sSongGroup = sValue;} - -"sort" -{ - m_SortOrder = StringToSortOrder( sValue ); - if( m_SortOrder == SortOrder_Invalid ) - { - m_sInvalidReason = ssprintf( "SortOrder \"%s\" is not valid.", sValue.c_str() ); - m_bInvalid |= true; - } -} - -"weight" {m_iWeightPounds = atoi( sValue );} - -"goalcalories" {m_iGoalCalories = atoi( sValue );} - -"goaltype" {m_GoalType = StringToGoalType( sValue );} - -"profileid" {m_sProfileID = sValue;} - -"url" {m_sUrl = sValue;} - -"sound" {m_sSoundPath = sValue;} - -"preparescreen" {m_vsScreensToPrepare.push_back( sValue );} - -"insertcredit" {m_bInsertCredit = true;} - -"clearcredits" {m_bClearCredits = true;} - -"stopmusic" {m_bStopMusic = true;} - +all the known gamecommands (pre-sm-ssc) + +"style" +"playmode" +"difficulty" + +"announcer" {m_sAnnouncer = sValue;} + +"name" {m_sName = sValue;} + +"text" {m_sText = sValue;} + +"mod" {m_sPreferredModifiers += sValue;} + +"stagemod" {m_sStageModifiers += sValue;} + +"lua" + +"screen" {m_sScreen = sValue;} + +"song" +"steps" +"course" +"trail" + +"setenv" { + if( cmd.m_vsArgs.size() == 3 ) + m_SetEnv[ cmd.m_vsArgs[1] ] = cmd.m_vsArgs[2]; } + +"songgroup" {m_sSongGroup = sValue;} + +"sort" +{ + m_SortOrder = StringToSortOrder( sValue ); + if( m_SortOrder == SortOrder_Invalid ) + { + m_sInvalidReason = ssprintf( "SortOrder \"%s\" is not valid.", sValue.c_str() ); + m_bInvalid |= true; + } +} + +"weight" {m_iWeightPounds = atoi( sValue );} + +"goalcalories" {m_iGoalCalories = atoi( sValue );} + +"goaltype" {m_GoalType = StringToGoalType( sValue );} + +"profileid" {m_sProfileID = sValue;} + +"url" {m_sUrl = sValue;} + +"sound" {m_sSoundPath = sValue;} + +"preparescreen" {m_vsScreensToPrepare.push_back( sValue );} + +"insertcredit" {m_bInsertCredit = true;} + +"clearcredits" {m_bClearCredits = true;} + +"stopmusic" {m_bStopMusic = true;} + "applydefaultoptions" {m_bApplyDefaultOptions = true;} \ No newline at end of file diff --git a/Docs/Themerdocs/included_scripts.txt b/Docs/Themerdocs/included_scripts.txt index 5f69829d78..f2b4d02162 100644 --- a/Docs/Themerdocs/included_scripts.txt +++ b/Docs/Themerdocs/included_scripts.txt @@ -1,132 +1,132 @@ -Scripts included with sm-ssc's fallback theme ---------------------------------------------- -(as of sm-ssc v1.0 beta 2, this document is out of date. -Please see hierarchy.txt referenced below for an up-to-date look at the script -execution order/prefixes. This document will be updated again soon) - -As a StepMania fork focused on themers, sm-ssc is going to be a bit different -than a normal StepMania 4 setup. The fallback theme includes a number of scripts -you won't find in the SM4 default theme. This file is meant to be an overview of -what happens in the scripts; it does not go in depth with any of them. Please -see the documentation included in the scripts as comments, as well as any text -files for the more sufficiently advanced scripts. - -For an explanation of why the scripts are named with numbers at the beginning, -see hierarchy.txt in Themes/_fallback/Scripts/ for more information. - -==00 init.lua== (StepMania 4) -Always executed first, this file does the following: -* replaces Lua's Uppercase function with StepMania's (which is always UTF8) -* alias Trace, Warn, and print -* creates convienence aliases PLAYER_1, PLAYER_2, and NUM_PLAYERS -* creates find_last(text) function for strings. - -==01 alias.lua== (sm-ssc) -This file is used to create aliases for functions. Usually, it's used for making -case-sensitive commands case-insensitive without having to make source code -edits to accomplish the same thing. - -==01 base.lua== (StepMania 4) -* overrides loadfile to use StepMania's. -* overrides dofile to use SM's loadfile. -* creates a function ivalues(t), which is like pairs but returns only values. - -==01 compat.lua== (sm-ssc) -sm-ssc compatibility helpers. Since sm-ssc renames and deprecates some features, -this file is used to help ease the transition of themes that still use the old -commands. - -==02 CustomSpeedMods.lua== (sm-ssc) -This version of AJ Kelly's CustomSpeedMods is for sm-ssc, since it allows for -reading in of both player and machine slots, as well as merging of the speed -mods of all three (if applicable). By including this in _fallback, every sm-ssc -theme has access to custom speed mods from the start. - -To use CustomSpeedMods in your theme, find [ScreenPlayerOptions] in the metrics, -find "list,Speed" and replace it with "lua,SpeedMods()". - -==02 EnvUtils2.lua== (sm-ssc) -EnvUtils2 provides the getenv(name) and setenv(name,value) commands. - -==02 HSV.lua== (sm-ssc) -[to be written] - -==02 ProductivityHelpers.lua== (sm-ssc) -This file is the sm-ssc edition of ProductivityHelpers. It shouldn't be used -with any newly created regular SM4 themes, just sm-ssc ones. -* provides the Blend alias, allowing for commands like blend,Blend.Add; etc. -* provides the Health alias, which provides a mapping to various HealthState - enums. -* CenterX, CenterY, xy (set both the x and y coords in one command) -* MaskSource and MaskDest commands for easier masking. -Various others are included, see the file for more information. - -==02 UserPreferences2.lua== (sm-ssc) -[to be written] - -==03 FileUtils.lua== (sm-ssc) -FileUtils is used to read and write files with minimal effort. - -* File.Read(path) reads in the file at path. -* File.Write(path,buf) writes the contents of buf to the file at path. - -If either of the two error out/don't work, check the log for the reason why. - -==03 WidescreenHelpers.lua== (sm-ssc) -[to be written] - -==Actor.lua== (StepMania 4) -[to be written] - -==ActorDef.lua== (StepMania 4) -[to be written] - -==Branches.lua== (sm-ssc) -sm-ssc's branch system is slightly different than the one in StepMania 4. -Instead of having multiple functions, all the branches are contained within a -single table, Branch. All the branches are members of this table, so you'll see -things like -NextScreen=Branch.PlayerOptions() -in the theme. - -==Colors.lua== (StepMania 4) -[to be written] - -==DateTime.lua== (sm-ssc) -freem, inc.'s DateTime class only exists to provide two commands at the moment: -* Date.Today() - returns today's date as YYYYMMDD. -* Time.Now() - returns the current time in 24 hour format as HH:MM:SS. -Eventually, this class may grow bigger. - -==Debug.lua== (StepMania 4) -[to be written] - -==Enum.lua== (StepMania 4) -[to be written] - -==HelpDisplay.lua== (StepMania 4) -[to be written] - -==Lyrics.lua== (StepMania 4) -[to be written] - -==OptionsMenu.lua== (StepMania 4) -[to be written] - -==Other.lua== (StepMania 4) -[to be written] - -==Serialize.lua== (StepMania 4) -[to be written] - -==Sound.lua== (StepMania 4) -[to be written] - -==Sprite.lua== (StepMania 4) -[to be written] - -==StageMods.lua== (StepMania 4) -[to be written] - -==Utilities.lua== (StepMania 4) +Scripts included with sm-ssc's fallback theme +--------------------------------------------- +(as of sm-ssc v1.0 beta 2, this document is out of date. +Please see hierarchy.txt referenced below for an up-to-date look at the script +execution order/prefixes. This document will be updated again soon) + +As a StepMania fork focused on themers, sm-ssc is going to be a bit different +than a normal StepMania 4 setup. The fallback theme includes a number of scripts +you won't find in the SM4 default theme. This file is meant to be an overview of +what happens in the scripts; it does not go in depth with any of them. Please +see the documentation included in the scripts as comments, as well as any text +files for the more sufficiently advanced scripts. + +For an explanation of why the scripts are named with numbers at the beginning, +see hierarchy.txt in Themes/_fallback/Scripts/ for more information. + +==00 init.lua== (StepMania 4) +Always executed first, this file does the following: +* replaces Lua's Uppercase function with StepMania's (which is always UTF8) +* alias Trace, Warn, and print +* creates convienence aliases PLAYER_1, PLAYER_2, and NUM_PLAYERS +* creates find_last(text) function for strings. + +==01 alias.lua== (sm-ssc) +This file is used to create aliases for functions. Usually, it's used for making +case-sensitive commands case-insensitive without having to make source code +edits to accomplish the same thing. + +==01 base.lua== (StepMania 4) +* overrides loadfile to use StepMania's. +* overrides dofile to use SM's loadfile. +* creates a function ivalues(t), which is like pairs but returns only values. + +==01 compat.lua== (sm-ssc) +sm-ssc compatibility helpers. Since sm-ssc renames and deprecates some features, +this file is used to help ease the transition of themes that still use the old +commands. + +==02 CustomSpeedMods.lua== (sm-ssc) +This version of AJ Kelly's CustomSpeedMods is for sm-ssc, since it allows for +reading in of both player and machine slots, as well as merging of the speed +mods of all three (if applicable). By including this in _fallback, every sm-ssc +theme has access to custom speed mods from the start. + +To use CustomSpeedMods in your theme, find [ScreenPlayerOptions] in the metrics, +find "list,Speed" and replace it with "lua,SpeedMods()". + +==02 EnvUtils2.lua== (sm-ssc) +EnvUtils2 provides the getenv(name) and setenv(name,value) commands. + +==02 HSV.lua== (sm-ssc) +[to be written] + +==02 ProductivityHelpers.lua== (sm-ssc) +This file is the sm-ssc edition of ProductivityHelpers. It shouldn't be used +with any newly created regular SM4 themes, just sm-ssc ones. +* provides the Blend alias, allowing for commands like blend,Blend.Add; etc. +* provides the Health alias, which provides a mapping to various HealthState + enums. +* CenterX, CenterY, xy (set both the x and y coords in one command) +* MaskSource and MaskDest commands for easier masking. +Various others are included, see the file for more information. + +==02 UserPreferences2.lua== (sm-ssc) +[to be written] + +==03 FileUtils.lua== (sm-ssc) +FileUtils is used to read and write files with minimal effort. + +* File.Read(path) reads in the file at path. +* File.Write(path,buf) writes the contents of buf to the file at path. + +If either of the two error out/don't work, check the log for the reason why. + +==03 WidescreenHelpers.lua== (sm-ssc) +[to be written] + +==Actor.lua== (StepMania 4) +[to be written] + +==ActorDef.lua== (StepMania 4) +[to be written] + +==Branches.lua== (sm-ssc) +sm-ssc's branch system is slightly different than the one in StepMania 4. +Instead of having multiple functions, all the branches are contained within a +single table, Branch. All the branches are members of this table, so you'll see +things like +NextScreen=Branch.PlayerOptions() +in the theme. + +==Colors.lua== (StepMania 4) +[to be written] + +==DateTime.lua== (sm-ssc) +freem, inc.'s DateTime class only exists to provide two commands at the moment: +* Date.Today() - returns today's date as YYYYMMDD. +* Time.Now() - returns the current time in 24 hour format as HH:MM:SS. +Eventually, this class may grow bigger. + +==Debug.lua== (StepMania 4) +[to be written] + +==Enum.lua== (StepMania 4) +[to be written] + +==HelpDisplay.lua== (StepMania 4) +[to be written] + +==Lyrics.lua== (StepMania 4) +[to be written] + +==OptionsMenu.lua== (StepMania 4) +[to be written] + +==Other.lua== (StepMania 4) +[to be written] + +==Serialize.lua== (StepMania 4) +[to be written] + +==Sound.lua== (StepMania 4) +[to be written] + +==Sprite.lua== (StepMania 4) +[to be written] + +==StageMods.lua== (StepMania 4) +[to be written] + +==Utilities.lua== (StepMania 4) [to be written] \ No newline at end of file diff --git a/Docs/Themerdocs/moremsg.txt b/Docs/Themerdocs/moremsg.txt index c589fb3206..de661550df 100644 --- a/Docs/Themerdocs/moremsg.txt +++ b/Docs/Themerdocs/moremsg.txt @@ -1,158 +1,158 @@ -This file contains a list of messages that are used by certain actors. -The parameters are included within (), and will sometimes have the proper -type. (wip document lol) -================================================================================ -GhostArrowRow - -ColumnJudgmentMessage( - tns TapNoteScore - tns HoldNoteScore - bool Bright -) -=========================================== -CourseContentsList - -SetSongMessage( - PlayerNumber - Song - Steps - Difficulty - Meter - Number - Modifiers - Secret -) -=========================================== -DifficultyMeter - -SetMessage( - Steps - Trail - Meter - StepsType - Difficulty - IsCourseDifficulty - EditDescription -) -=========================================== -EditMenu - -SetMessage( Song ) -=========================================== -GameSoundManager - -CrossedBeat( Beat ) - -=========================================== -GameState - -MessageIDToString(Message_PlayerJoined)Message( Player ) -MessageIDToString(Message_PlayerUnjoined)Message( Player ) -=========================================== -LifeMeterBar - -LifeChangedMessage( - Player - LifeMeter -) -=========================================== -LifeMeterTime - -LifeChangedMessage( - Player - TapNoteScore - HoldNoteScore - OldLife - Difference - LifeMeter -) -=========================================== -MusicWheelItem - -SetMessage( - Song - Course - Index - HasFocus - SongGroup -) - -SetGradeMessage( - PlayerNumber - Grade - NumTimesPlayed -) -=========================================== -NoteDisplay - -SetAttackMessage( "Modifiers" ) -=========================================== -OptionRow - -RefreshMessage( GameCommand ) -=========================================== -Player - -TransformMessage( - Player - MultiPlayer - iEnabledPlayerIndex - iNumEnabledPlayers - bPlayerUsingBothSides - bReverse - bCentered -) - -ComboChangedMessage( - Player - OldCombo - OldMissCombo - PlayerState - PlayerStageStats -) - -StepMessage( PlayerNumber, MultiPlayer ) - -JudgmentMessage( - Player - MultiPlayer - TapNoteScore - Early - TapNoteOffset - HoldNoteScore -) - -ComboMessage( - Combo - Misses - FullComboW1 - FullComboW2 - FullComboW3 -) -=========================================== -ScoreKeeper* - -ScoreChangedMessage( PlayerNumber, MultiPlayer ) -=========================================== -ScreenContinue - -HurryTimerMessage( PlayerNumber ) -=========================================== -ScreenGameplay - -HealthStateChangedMessage( - PlayerNumber - HealthState -) - -PlayerFailedMessage( PlayerNumber ) -=========================================== -ScreenManager - -HideSystemMessage() -RefreshCreditText() -SystemMessageMessage( Message, NoAnimate ) -=========================================== -ScreenWithMenuElements - +This file contains a list of messages that are used by certain actors. +The parameters are included within (), and will sometimes have the proper +type. (wip document lol) +================================================================================ +GhostArrowRow + +ColumnJudgmentMessage( + tns TapNoteScore + tns HoldNoteScore + bool Bright +) +=========================================== +CourseContentsList + +SetSongMessage( + PlayerNumber + Song + Steps + Difficulty + Meter + Number + Modifiers + Secret +) +=========================================== +DifficultyMeter + +SetMessage( + Steps + Trail + Meter + StepsType + Difficulty + IsCourseDifficulty + EditDescription +) +=========================================== +EditMenu + +SetMessage( Song ) +=========================================== +GameSoundManager + +CrossedBeat( Beat ) + +=========================================== +GameState + +MessageIDToString(Message_PlayerJoined)Message( Player ) +MessageIDToString(Message_PlayerUnjoined)Message( Player ) +=========================================== +LifeMeterBar + +LifeChangedMessage( + Player + LifeMeter +) +=========================================== +LifeMeterTime + +LifeChangedMessage( + Player + TapNoteScore + HoldNoteScore + OldLife + Difference + LifeMeter +) +=========================================== +MusicWheelItem + +SetMessage( + Song + Course + Index + HasFocus + SongGroup +) + +SetGradeMessage( + PlayerNumber + Grade + NumTimesPlayed +) +=========================================== +NoteDisplay + +SetAttackMessage( "Modifiers" ) +=========================================== +OptionRow + +RefreshMessage( GameCommand ) +=========================================== +Player + +TransformMessage( + Player + MultiPlayer + iEnabledPlayerIndex + iNumEnabledPlayers + bPlayerUsingBothSides + bReverse + bCentered +) + +ComboChangedMessage( + Player + OldCombo + OldMissCombo + PlayerState + PlayerStageStats +) + +StepMessage( PlayerNumber, MultiPlayer ) + +JudgmentMessage( + Player + MultiPlayer + TapNoteScore + Early + TapNoteOffset + HoldNoteScore +) + +ComboMessage( + Combo + Misses + FullComboW1 + FullComboW2 + FullComboW3 +) +=========================================== +ScoreKeeper* + +ScoreChangedMessage( PlayerNumber, MultiPlayer ) +=========================================== +ScreenContinue + +HurryTimerMessage( PlayerNumber ) +=========================================== +ScreenGameplay + +HealthStateChangedMessage( + PlayerNumber + HealthState +) + +PlayerFailedMessage( PlayerNumber ) +=========================================== +ScreenManager + +HideSystemMessage() +RefreshCreditText() +SystemMessageMessage( Message, NoAnimate ) +=========================================== +ScreenWithMenuElements + SetHelpTextMessage( Text ) \ No newline at end of file diff --git a/Docs/Themerdocs/recommended_practices.txt b/Docs/Themerdocs/recommended_practices.txt index 7d722b34d8..29d7c70f2c 100644 --- a/Docs/Themerdocs/recommended_practices.txt +++ b/Docs/Themerdocs/recommended_practices.txt @@ -1,50 +1,50 @@ -Recommended Practices when theming for sm-ssc ---------------------------------------------- -1) Use the --theme= command line parameter to switch between themes quickly. -This way, you don't have to deal with the theme switch and all the possible -nonsense errors that might come up (due to you having a different amount of -song group colors, timer warning states, etc.), and you can quickly switch -themes if you work on many of them at once. - -2) If you want to create a theme that targets both regular StepMania 4 and -sm-ssc, there are a few precautions to take care of. - -2a) First, decide if you want to develop it on sm-ssc first or SM4 first. It is -usually easier to deal with making the theme in normal SM4 and using _portKit-SM4 -to get the theme running up in sm-ssc. - -If you do decide to make the theme for sm-ssc first, be prepared to fill in a lot -of files that sm-ssc _fallback makes empty for you, as the metrics, graphics, and -BGAnimations from SM4's default theme will be loaded instead of sm-ssc's _fallback. - -2b) sm-ssc's _fallback theme defines a variable, SSC, like so: -[code]SSC = (ProductID() == "sm-ssc");[/code] -This will return true if it's sm-ssc, or false if it's SM4. -You should define this in a script (00 themeInfo.lua is a good place), so that -SM4 will be able to recognize it. - -With this "SSC guard" in place, you can now wrap things in "if SSC then" -statements if they won't work on SM4. You can also provide alternatives if the -player isn't using sm-ssc, since sometimes SM4 will have an approximation or -alternate way to get the data. - -3) When dealing with frame size errors or theme code errors, don't just hide the -dialog and pretend they don't exist. Good themers fix these problems instead of -releasing the theme and saying "oh, just play it in fullscreen mode". - -If you have hidden the error dialogs, you'll need to modify Preferences.ini. -Find the IgnoredDialogs= line and remove everything after the = sign. You will -now recieve the error messages in windowed mode again. - -4) While this is a SSC-specific practice, having a themeInfo file set up in -your theme's Scripts directory is a good way to store information about the -theme (e.g. version number, date, product code, etc.) - -An example of a themeInfo script: -[code] -themeInfo = { - Name = "your theme's name", - Version = "v1.0", -- typically a float or string. floats are easier to compare. - Date = "20100426 1115", -}; +Recommended Practices when theming for sm-ssc +--------------------------------------------- +1) Use the --theme= command line parameter to switch between themes quickly. +This way, you don't have to deal with the theme switch and all the possible +nonsense errors that might come up (due to you having a different amount of +song group colors, timer warning states, etc.), and you can quickly switch +themes if you work on many of them at once. + +2) If you want to create a theme that targets both regular StepMania 4 and +sm-ssc, there are a few precautions to take care of. + +2a) First, decide if you want to develop it on sm-ssc first or SM4 first. It is +usually easier to deal with making the theme in normal SM4 and using _portKit-SM4 +to get the theme running up in sm-ssc. + +If you do decide to make the theme for sm-ssc first, be prepared to fill in a lot +of files that sm-ssc _fallback makes empty for you, as the metrics, graphics, and +BGAnimations from SM4's default theme will be loaded instead of sm-ssc's _fallback. + +2b) sm-ssc's _fallback theme defines a variable, SSC, like so: +[code]SSC = (ProductID() == "sm-ssc");[/code] +This will return true if it's sm-ssc, or false if it's SM4. +You should define this in a script (00 themeInfo.lua is a good place), so that +SM4 will be able to recognize it. + +With this "SSC guard" in place, you can now wrap things in "if SSC then" +statements if they won't work on SM4. You can also provide alternatives if the +player isn't using sm-ssc, since sometimes SM4 will have an approximation or +alternate way to get the data. + +3) When dealing with frame size errors or theme code errors, don't just hide the +dialog and pretend they don't exist. Good themers fix these problems instead of +releasing the theme and saying "oh, just play it in fullscreen mode". + +If you have hidden the error dialogs, you'll need to modify Preferences.ini. +Find the IgnoredDialogs= line and remove everything after the = sign. You will +now recieve the error messages in windowed mode again. + +4) While this is a SSC-specific practice, having a themeInfo file set up in +your theme's Scripts directory is a good way to store information about the +theme (e.g. version number, date, product code, etc.) + +An example of a themeInfo script: +[code] +themeInfo = { + Name = "your theme's name", + Version = "v1.0", -- typically a float or string. floats are easier to compare. + Date = "20100426 1115", +}; [/code] \ No newline at end of file diff --git a/Docs/Themerdocs/sm-ssc_themeguide.txt b/Docs/Themerdocs/sm-ssc_themeguide.txt index 952a7955ac..c19589acdd 100644 --- a/Docs/Themerdocs/sm-ssc_themeguide.txt +++ b/Docs/Themerdocs/sm-ssc_themeguide.txt @@ -1,226 +1,226 @@ -How to Theme for sm-ssc: THE DOC. -________________________________________________________________________________ -Table of Contents -i. Introduction -ii. Requirements ----------------- -1. Introduction to Concepts - 1. The Raw Elements - 1. Metrics - 2. BGAnimations - 3. Graphics - 4. Fonts - 5. Sounds - 6. Languages - 7. Scripts - 8. Other - 2. Screens, Classes, Managers and more -2. Elements in Detail - 1. Metrics and Languages - 2. BGAnimations - 3. Graphics - 4. Fonts - 5. Sounds - 6. Scripts -X. Making Your First sm-ssc Theme - 1. Setup - 2. -________________________________________________________________________________ - i. Introduction -________________________________________________________________________________ -ii. Requirements -In order to follow along with this guide, you will need the following: - -* sm-ssc (our fork of StepMania 4) -* A decent text editor (syntax highlighting is a plus) -* A decent graphics editor (for any graphics changes you want to make) -* A decent sound editor (in case you want to edit sounds) - -Some of these may not apply to you (e.g. you may just want to learn how to -do BGAnimations in Lua and what the differences in the metrics are). -That's fine. :) - -Other recommended utilities will be introduced throughout this guide; they are -not required if you do not wish to use them. -________________________________________________________________________________ -1. Introduction to Concepts -If you are familiar with theming for another version of StepMania already, you -can skim this section to see what differences exist between that version and -sm-ssc. --------------------------------------------------------------------------------- -1.1 The Raw Elements -A StepMania theme is comprised of multiple parts. Some of these parts are more -important than others. This section briefly introduces each of the elements, -explaining what they do and why they're important. -More in-depth descriptions will come with each chapter. - -1.1.1 Metrics -The metrics (metrics.ini) contain the core elements of a theme. Most everything -that has to do with StepMania's built-in types and elements will be found here. - -1.1.2 BGAnimations -BGAnimations are used to decorate screens. In SM4, they use Lua for BGAnims, -which allows for some amazing stuff if done right. This guide won't delve too -deeply into abusing BGAnimations for fun and profit (via custom coded elements), -but it will be brought up later. - -1.1.3 Graphics -Graphics are simply that. They go along with the metrics, but can also be -called from BGAnimations. Some graphics can be replaced with Lua files for more -complex creations. - -1.1.4 Fonts -Fonts are used to draw text to the Screen. They can consist of a normal page -and a stroke page, as well as the special numbers and alternate characters -pages. - -One of the problems with SM Fonts is that they require a program to generate the -required format. Both known programs are Windows-only, hindering those -developing StepMania themes on Mac and Linux (unless some sort of virtualization -solution is used). -When you make a non-text font, you only have the choice of an image editor. -Hope it has a customizable grid! (This is where Paint Shop Pro 7 beats any -version of Photoshop.) - -1.1.5 Sounds -The Sounds folder contains both sounds that play during the use of StepMania, -as well as any music your theme contains. - -1.1.6 Languages -Languages are where Strings that appear in the theme should be defined. Each -language is represented by a two letter code, with the following examples from -the default theme: -en - English -es - Spanish (Espanol) -fr - French (Francais) -it - Italian(o) -de - German (Deutsch) - -1.1.7 Scripts -Lua Scripts were introduced in StepMania 4 (really "3.95", if you want to get -technical). If you've come from theming an earlier version where they didn't -exist (3.9), this folder might take some getting used to. This directory holds -Lua scripts that are loaded on startup. Some scripts lay down the theming -foundation, meaning that if you're crazy enough, you can rewrite everything. -If you're capable of that, though, you probably don't need to read this guide. :) - -1.1.8 Other -The Other folder contains miscellaneous things. You generally won't need to -worry about this folder unless you need to edit some uncommon files. -________________________________________________________________________________ -2. Elements in Detail -Unless you are a very fast learner and can learn by looking at other people's -code, you are probably wanting to know more about the elements in detail. - -2.1 Metrics and Languages ______________________________________________________ -These two are grouped together since they both use ini files. This means the -layout of the file will contain groups, keys, and values. - -[Group] -Key=Value -{ caption: Example of various .ini elements } - -In StepMania, most groups are Screens. - -The Languages folder contains strings that StepMania displays when your theme -is used. Chances are, if you want to edit the text of something, there's an -entry for it in one of the Language files (en.ini, usually). - -By leaving out a key in your custom language, you tell StepMania to look in -the default language (typically en.ini) - -2.2. BGAnimations ______________________________________________________________ -Easily where you'll be spending the most time when making a theme, the -BGAnimations provide a way for you to customize various theme parts. - -There are multiple names StepMania recognizes for BGAnimation folders. Some -screens won't support all of these. -================================================================================ -ScreenExample in - Played when the screen is transitioning in. -ScreenExample background - Background of the screen. -ScreenExample underlay - Shows over the background, but under decorations and overlay. -ScreenExample decorations - Newly added in StepMania 4 alphas. -ScreenExample overlay - Shows over everything, usually. -ScreenExample out - Played when the screen is transitioning out. -ScreenExample cancel - Played when the screen is canceled. -================================================================================ - -In StepMania 4 alphas and sm-ssc, BGAnimations are done with Lua. -A sample Lua BGAnimation follows: -=[begin code example]=========================================================== -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#FFFFFF");diffusebottomedge,color("#AAAAAA");); - }; -}; -=[end code example]============================================================= -This will make a Quad (an untextured square) that fills the screen and fades from -white to light grey. It is best used as a background. You can try this example -out yourself by making a new folder in the Themes directory and putting this code -in ScreenTitleMenu background.lua; -The folder setup would end up like so: -sm-ssc/ - Themes/ - MyCoolTheme/ - BGAnimations/ - ScreenTitleMenu background.lua - -Now open up sm-ssc and change the theme (or pass in --theme="MyCoolTheme", -replacing "MyCoolTheme" with your theme's folder name), and head to the title menu. - -2.3. Graphics __________________________________________________________________ -The Graphics folder contains various files StepMania calls on. For example, the -header and footer are found here, along with Common window icon and others. - -The Graphics folder is also where Decorations expects to find files to load when -you use StandardDecorationFromFileOptional([MetricsName],[Filename]). - -2.4. Fonts _____________________________________________________________________ -StepMania fonts are a combination of images containing various characters, and -an ini file that defines the font metrics, such as spacing, character widths, -character mappings, and so on. - -Fonts are typically generated with Texture Font Generator (which is included -with sm-ssc) or Bitmap Font Builder, both programs being Windows only. If you -aren't on Windows, your choices are then limited to whatever image editor you -can find (typically Photoshop or The GIMP). - -fontini.txt in the ThemerDocs folder contains a list of all the known -font .ini values. The file is reprinted here: -================================================================================ -[common] -CapitalsOnly - If set to 1, lowercase letters are drawn with uppercase letters instead. -RightToLeft - If set to 1, font will be rendered as right to left. -DefaultStrokeColor - Sets default stroke color. (e.g. #00000000) - -[main] -import - Imports a font page into the current font. - -(per-page) -DrawExtraPixelsLeft - How many pixels to draw to the left of a character. -DrawExtraPixelsRight - How many pixels to draw to the right of a character. -AddToAllWidths - Adds x amount of pixels to all widths. -ScaleAllWidthsBy - Scales widths by the factor specified. -LineSpacing - Modifies line spacing. -Top - Specifies the top of the character. (in pixels) -Baseline - Specifies the baseline of the character. (in pixels) -DefaultWidth - Default width for a glyph. -AdvanceExtraPixels - Rudimentary way to control letter spacing -TextureHints - An alternative to throwing the TextureHints in the filename. - -(general commands) -MAP - Maps a keyword to a frame number. (e.g. map up=0) -RANGE - Defines a Unicode range to use. -LINE - (e.g. Line 1=ABCDEFGH) -================================================================================ -2.5. Sounds ____________________________________________________________________ - - -sm-ssc can load Lua files as music, allowing for conditional music/sounds. -conditional_music.txt in the ThemerDocs folder explains it in more detail with -code examples. - -2.6. Scripts ___________________________________________________________________ -Scripts allow you to define functions which can then be referenced in Metrics -and BGAnimations. Scripts can also store values and do other nice things, some +How to Theme for sm-ssc: THE DOC. +________________________________________________________________________________ +Table of Contents +i. Introduction +ii. Requirements +---------------- +1. Introduction to Concepts + 1. The Raw Elements + 1. Metrics + 2. BGAnimations + 3. Graphics + 4. Fonts + 5. Sounds + 6. Languages + 7. Scripts + 8. Other + 2. Screens, Classes, Managers and more +2. Elements in Detail + 1. Metrics and Languages + 2. BGAnimations + 3. Graphics + 4. Fonts + 5. Sounds + 6. Scripts +X. Making Your First sm-ssc Theme + 1. Setup + 2. +________________________________________________________________________________ + i. Introduction +________________________________________________________________________________ +ii. Requirements +In order to follow along with this guide, you will need the following: + +* sm-ssc (our fork of StepMania 4) +* A decent text editor (syntax highlighting is a plus) +* A decent graphics editor (for any graphics changes you want to make) +* A decent sound editor (in case you want to edit sounds) + +Some of these may not apply to you (e.g. you may just want to learn how to +do BGAnimations in Lua and what the differences in the metrics are). +That's fine. :) + +Other recommended utilities will be introduced throughout this guide; they are +not required if you do not wish to use them. +________________________________________________________________________________ +1. Introduction to Concepts +If you are familiar with theming for another version of StepMania already, you +can skim this section to see what differences exist between that version and +sm-ssc. +-------------------------------------------------------------------------------- +1.1 The Raw Elements +A StepMania theme is comprised of multiple parts. Some of these parts are more +important than others. This section briefly introduces each of the elements, +explaining what they do and why they're important. +More in-depth descriptions will come with each chapter. + +1.1.1 Metrics +The metrics (metrics.ini) contain the core elements of a theme. Most everything +that has to do with StepMania's built-in types and elements will be found here. + +1.1.2 BGAnimations +BGAnimations are used to decorate screens. In SM4, they use Lua for BGAnims, +which allows for some amazing stuff if done right. This guide won't delve too +deeply into abusing BGAnimations for fun and profit (via custom coded elements), +but it will be brought up later. + +1.1.3 Graphics +Graphics are simply that. They go along with the metrics, but can also be +called from BGAnimations. Some graphics can be replaced with Lua files for more +complex creations. + +1.1.4 Fonts +Fonts are used to draw text to the Screen. They can consist of a normal page +and a stroke page, as well as the special numbers and alternate characters +pages. + +One of the problems with SM Fonts is that they require a program to generate the +required format. Both known programs are Windows-only, hindering those +developing StepMania themes on Mac and Linux (unless some sort of virtualization +solution is used). +When you make a non-text font, you only have the choice of an image editor. +Hope it has a customizable grid! (This is where Paint Shop Pro 7 beats any +version of Photoshop.) + +1.1.5 Sounds +The Sounds folder contains both sounds that play during the use of StepMania, +as well as any music your theme contains. + +1.1.6 Languages +Languages are where Strings that appear in the theme should be defined. Each +language is represented by a two letter code, with the following examples from +the default theme: +en - English +es - Spanish (Espanol) +fr - French (Francais) +it - Italian(o) +de - German (Deutsch) + +1.1.7 Scripts +Lua Scripts were introduced in StepMania 4 (really "3.95", if you want to get +technical). If you've come from theming an earlier version where they didn't +exist (3.9), this folder might take some getting used to. This directory holds +Lua scripts that are loaded on startup. Some scripts lay down the theming +foundation, meaning that if you're crazy enough, you can rewrite everything. +If you're capable of that, though, you probably don't need to read this guide. :) + +1.1.8 Other +The Other folder contains miscellaneous things. You generally won't need to +worry about this folder unless you need to edit some uncommon files. +________________________________________________________________________________ +2. Elements in Detail +Unless you are a very fast learner and can learn by looking at other people's +code, you are probably wanting to know more about the elements in detail. + +2.1 Metrics and Languages ______________________________________________________ +These two are grouped together since they both use ini files. This means the +layout of the file will contain groups, keys, and values. + +[Group] +Key=Value +{ caption: Example of various .ini elements } + +In StepMania, most groups are Screens. + +The Languages folder contains strings that StepMania displays when your theme +is used. Chances are, if you want to edit the text of something, there's an +entry for it in one of the Language files (en.ini, usually). + +By leaving out a key in your custom language, you tell StepMania to look in +the default language (typically en.ini) + +2.2. BGAnimations ______________________________________________________________ +Easily where you'll be spending the most time when making a theme, the +BGAnimations provide a way for you to customize various theme parts. + +There are multiple names StepMania recognizes for BGAnimation folders. Some +screens won't support all of these. +================================================================================ +ScreenExample in - Played when the screen is transitioning in. +ScreenExample background - Background of the screen. +ScreenExample underlay - Shows over the background, but under decorations and overlay. +ScreenExample decorations - Newly added in StepMania 4 alphas. +ScreenExample overlay - Shows over everything, usually. +ScreenExample out - Played when the screen is transitioning out. +ScreenExample cancel - Played when the screen is canceled. +================================================================================ + +In StepMania 4 alphas and sm-ssc, BGAnimations are done with Lua. +A sample Lua BGAnimation follows: +=[begin code example]=========================================================== +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("#FFFFFF");diffusebottomedge,color("#AAAAAA");); + }; +}; +=[end code example]============================================================= +This will make a Quad (an untextured square) that fills the screen and fades from +white to light grey. It is best used as a background. You can try this example +out yourself by making a new folder in the Themes directory and putting this code +in ScreenTitleMenu background.lua; +The folder setup would end up like so: +sm-ssc/ + Themes/ + MyCoolTheme/ + BGAnimations/ + ScreenTitleMenu background.lua + +Now open up sm-ssc and change the theme (or pass in --theme="MyCoolTheme", +replacing "MyCoolTheme" with your theme's folder name), and head to the title menu. + +2.3. Graphics __________________________________________________________________ +The Graphics folder contains various files StepMania calls on. For example, the +header and footer are found here, along with Common window icon and others. + +The Graphics folder is also where Decorations expects to find files to load when +you use StandardDecorationFromFileOptional([MetricsName],[Filename]). + +2.4. Fonts _____________________________________________________________________ +StepMania fonts are a combination of images containing various characters, and +an ini file that defines the font metrics, such as spacing, character widths, +character mappings, and so on. + +Fonts are typically generated with Texture Font Generator (which is included +with sm-ssc) or Bitmap Font Builder, both programs being Windows only. If you +aren't on Windows, your choices are then limited to whatever image editor you +can find (typically Photoshop or The GIMP). + +fontini.txt in the ThemerDocs folder contains a list of all the known +font .ini values. The file is reprinted here: +================================================================================ +[common] +CapitalsOnly - If set to 1, lowercase letters are drawn with uppercase letters instead. +RightToLeft - If set to 1, font will be rendered as right to left. +DefaultStrokeColor - Sets default stroke color. (e.g. #00000000) + +[main] +import - Imports a font page into the current font. + +(per-page) +DrawExtraPixelsLeft - How many pixels to draw to the left of a character. +DrawExtraPixelsRight - How many pixels to draw to the right of a character. +AddToAllWidths - Adds x amount of pixels to all widths. +ScaleAllWidthsBy - Scales widths by the factor specified. +LineSpacing - Modifies line spacing. +Top - Specifies the top of the character. (in pixels) +Baseline - Specifies the baseline of the character. (in pixels) +DefaultWidth - Default width for a glyph. +AdvanceExtraPixels - Rudimentary way to control letter spacing +TextureHints - An alternative to throwing the TextureHints in the filename. + +(general commands) +MAP - Maps a keyword to a frame number. (e.g. map up=0) +RANGE - Defines a Unicode range to use. +LINE - (e.g. Line 1=ABCDEFGH) +================================================================================ +2.5. Sounds ____________________________________________________________________ + + +sm-ssc can load Lua files as music, allowing for conditional music/sounds. +conditional_music.txt in the ThemerDocs folder explains it in more detail with +code examples. + +2.6. Scripts ___________________________________________________________________ +Scripts allow you to define functions which can then be referenced in Metrics +and BGAnimations. Scripts can also store values and do other nice things, some of which is outside of the scope of this guide. \ No newline at end of file diff --git a/Docs/Userdocs/sm-ssc_beginner.txt b/Docs/Userdocs/sm-ssc_beginner.txt index 3f19b15605..6331eed27a 100644 --- a/Docs/Userdocs/sm-ssc_beginner.txt +++ b/Docs/Userdocs/sm-ssc_beginner.txt @@ -1,379 +1,379 @@ -sm-ssc Beginner's Guide -Written and edited by the spinal shark collective --------------------------------------------------------------------------------- -Table of Contents -1 Introduction -2 StepMania - 2.1. Terms and Concepts - 2.1.1 Notable StepMania Versions - 2.1.2 StepMania Components - 2.2 StepMania Configuration - 2.2.1 Frequently Asked Questions that can be - Solved by Changing the Configuration - 2.3. Installing Content - 2.3.1 Installing Song Files - 2.3.2 Installing Noteskins/New Gametypes - 2.3.3 Installing Themes -3. sm-ssc -================================================================================ -Chapter 1: Introduction -================================================================================ -Welcome to the sm-ssc Beginner's Guide. This guide is primarily meant for people -who do not have any previous experience with StepMania, but also includes -information on how sm-ssc differs from StepMania. If you already know what -StepMania is, and the basics of adding things to an install, you can skip ahead -to Chapter 3: sm-ssc. Otherwise, read on. - -================================================================================ -Chapter 2: StepMania -================================================================================ -StepMania is an open-source rhythm game/engine, used by many projects, both -commercial and free. It is the software from which sm-ssc is derived, and as -a result, must be learned before using sm-ssc if you're not already familiar -with how it works. - -Some of the things an average sm-ssc user is expected to know includes the -meanings/"proper names" of certain things, as well as how to install content -and configure the program to suit your playing style. - --------------------------------------------------------------------------------- -2.1: Terms and Concepts --------------------------------------------------------------------------------- -Like many other video games, StepMania has a rich lexicon of words which may -confuse others. The most important of the terms has to do with versions of -StepMania, as backwards compatibility is pretty much nonexistent between major -versions. - --------------------------------------------------------------------------------- -2.1.1: Notable StepMania Versions --------------------------------------------------------------------------------- -Knowing the versions of StepMania is helpful, as it will help you deduce what -you can and can not install. (Most songs are version-agnostic, though the -background animations may not be. Themes, Noteskins, etc. are tied to -specific versions.) - -* StepMania 3.9 -StepMania 3.9 is currently considered the stable version of StepMania. It dates -back to 2005, and is the version for which the bulk of content is produced. - -* StepMania 3.9 Plus/StepMania 3.9 Plus Redux -3.9 Plus/Redux is a fork of StepMania 3.9 that adds features from -later StepMania versions (such as rolls), as well as new features. - -* StepMania 3.95/StepMania Online -Generally, when people talk about this version, they refer to a CVS build of -StepMania from around June-August 2006. It was not an officially supported -build of StepMania. - -* OpenITG -OpenITG is a fork of the StepMania CVS code from around the time In The Groove 2 -was released. OpenITG's goal is to produce a replacement executable for ITG2 -machines with enhanced features, though it can also be used at home as well. - -* StepMania 4.0 CVS -This term is used to describe versions of StepMania 4 that appeared after "3.95" -up until January 2008, when the last build that could be categorized as "CVS" -was released. - -* StepMania 4.0 SVN/alpha -The current development version of StepMania. This is the version that sm-ssc -is forked off of. If you wish to port something to sm-ssc, it had better work -for this version first, unless you like working hard to port the theme past -various generations and default theme assumptions. - --------------------------------------------------------------------------------- -2.1.2: StepMania Components --------------------------------------------------------------------------------- -Despite the title, this is a bit more broader-reaching, as it covers terms that -you may see in StepMania communities and online. --------------------------------------------------------------------------------- -* Courses - Courses exist in many different forms, but in general, they take you through - multiple songs without a break in-between. There are multiple types of courses: - - * Nonstop Courses - Nonstop courses use the regular lifebar and typically have 4 songs per - course, though this isn't always the case. It is the easiest of the - course modes. - - * Oni/Challenge Courses - The Oni/challenge courses are quite difficult, usually giving you 4 lives - over multiple songs. If you get less than a Great, you lose a life. Once - you lose all your lives, the game is over. - - * Survival Courses - Survival courses go by time. Each step judgment is worth something on the - timer, with most of the values being negative by default. If you run out of - time before you complete the course, the game is over. - - * Endless Courses - Endless courses are like the name suggests. They don't end until you fail or - decide to quit. Like Nonstop courses, they have a normal lifebar as well. --------------------------------------------------------------------------------- -* Event Mode - Typically used during events, this disables the concept of stages and lets you - play songs until you decide to stop. It is quite useful in Home Mode, and this - guide recommends you enable it. - -* Gametypes - Gametypes are the different game modes StepMania can play. They generally - change things like number of default receptors, number of judgments, and more. - Gametypes are directly related to noteskins and unrelated to the different - play modes (Normal, Nonstop, Challenge, and so on). - Examples of gametypes include "dance", "pump", "beat", "techno", and so on. - -* NoteSkins - NoteSkins are the appearance of the notes. Most noteskins are bound to certain - gametypes, though some noteskins are easily adapted for other gametypes. - -* Pack/packs - A pack is a group of songs for StepMania. The term originated from the - community of StepMania keyboard creators, and can be seen prominently in - certain release names, such as Community Keyboard Mega Pack (CKMP). - When used as a single word question, e.g. "packs?", it is a request for what - packs you have installed. - -* Songs - StepMania songs contain a few files, but mainly the steps (.sm, .dwi, .ksf, - .bms, among many other formats) and song file itself (.mp3, .ogg, .wav). In - order to get the most out of StepMania, you'll need to know all about songs - and how to install them. - -* Themes - Themes are skins for StepMania. They change the look and feel, and in post-3.9 - versions, can also change elements of gameplay (scoring, grading) as well. - --------------------------------------------------------------------------------- -2.2: StepMania Configuration -or "How to use the Options Menu" --------------------------------------------------------------------------------- -Learning how to properly configure StepMania can save you headaches. - -Most themes will have the Options menu in plain sight on the Title Menu. -From there, it depends on which version of StepMania you have, as the options -menus were re-shuffled around for the StepMania 4 alphas. - -The typical StepMania 3.9 Options Menu: -* Appearance Options -* Background Options -* Bookkeeping -* Center Image -* Coin Options -* Config Key/Joy Mappings -* Input Options -* Gameplay Options -* Graphic Options -* Machine Options -* Sound Options -* Profile Options -* Other Options -* Reload Songs/Courses -* Test Input - -The StepMania 4.0 alpha 4 Options Menu: -* Config Key/Joy Mappings -* Test Input -* Appearance Options -* Graphics/Sound Options -* Advanced Options -* Network Options -* Profiles -* Reload Songs/Courses - -sm-ssc changes this up again, making the "Options" item on the Title Menu go -to System Direction (mostly-used options), leaving the normal options menu to -the Scroll Lock key. Blame Midiman. :) --------------------------------------------------------------------------------- -2.2.1: Frequently Asked Questions that can be Solved by Changing the Configuration --------------------------------------------------------------------------------- -With that in mind, it's time to answer some questions using this knowledge. - -Q: How do I disable the menu timer? -A: Where you go depends on the version of StepMania you use. - -[3.9] Machine Options -[4.0 alphas] Advanced Options -It will be the first option on each. - -Q: How do I play forever, without game overs? -A: Turn on Event Mode. Where you go depends on the version of StepMania you use. - -[3.9] Coin Options -[4.0 alphas] Advanced Options, a bit down the page. - -Q: What the heck is this thing that says "Toasty" and how do I get rid of it? -A: It's a reference to Mortal Kombat 2, where Dan Forden would pop out from -the side of the screen randomly after an uppercut. -In order to get a Toasty in StepMania, one must get a 250 combo without any -Greats. The number 250 is a reference to how many VS games of MK2 you had to -play before you could play Pong. - -As for turning it off, turn Easter Eggs off. -It appears in different locations between StepMania versions: -[3.9] Gameplay Options -[4.0 alphas] Advanced Options, a bit down the page. - --------------------------------------------------------------------------------- -2.3: Installing Content --------------------------------------------------------------------------------- -This is the most important section you will read, as all the time that you spend -not playing with StepMania will be adding/removing things to it. Well, not -completely, as you have other things to do. - -Before we touch on the specifics, there are a few skills you should learn. - -* Mac Users of StepMania 4.0 -Most of the game content is packaged in a file called StepMania.smzip. This has -the pros of not cluttering things up, but the con is that people don't know -where to put things. - -Wherever you have StepMania installed, make the following folders: - * Songs - * Themes - * Noteskins - (and the various gametype folders, which are optional. You need at least one - non-lights gametype in order to play.) - * Noteskins/dance - * Noteskins/pump - * Noteskins/para - * Noteskins/techno - * Noteskins/beat - * Noteskins/popn - * Noteskins/ez2 - * Announcers - (but at this point, no SM4 announcers have been released) - * Packages - (optional, but recommended) - -and then you can follow the rest of this guide. - -* Not on Windows and want to deal with .smzip files? -There are multiple ways to deal this. - 1) Put the SMZip file in the Packages folder. - 2) Rename the file to have an extension of .zip and extract in the root - StepMania folder. - 3) Pass the smzip's filename to StepMania on the command line/terminal. - Dragging and dropping the .smzip may or may not work; we have not tested it. - Also, this may or may not exist in your version of StepMania. - --------------------------------------------------------------------------------- -2.3.1: Installing Song Files --------------------------------------------------------------------------------- -Song files are distributed in many ways. The concept of packs was explained -above, in which multiple songs are included in one archive. - -For .smzip files, the section "Not on Windows and want to deal with .smzip -files?" details all possible ways of installing .smzip files, but the most -common ways are as follows: - -1) For operating systems with a filetype handler (Windows), you can double - click on the .smzip file and the StepMania tools will handle it. -2) Putting the .smzip file in the Packages folder, where it will be automatically - read by StepMania. - -If it's not a .smzip file, you'll have to do some detective work. -Open up the song archive and see how the files are laid out. - -The easiest single song installs will have a folder structure similar to this: -Group Name\ - Song Name\ - song file.sm - song file.ogg/mp3 - song file-bg.png - song file-bn.png - -With a setup like this, you can just extract it to the Songs folder with -directory structure intact. - -Sometimes, simfile authors don't package their file with a group name, -leaving you with a file structure like this: -Song Name\ - song file.sm - song file.ogg/mp3 - song file-bg.png - song file-bn.png - -You will need to extract this into a song group folder that exists already. - -An uncommon setup will only include the song files, without any folders at all. -These need to be put into the {Group Name}\{Song Name}\ folder in order to work. - -For packs, you follow the same logic. If there are multiple song folders, but no -group folder, you will have to make a group folder. (Flightmix 4 is an example -of a pack that exhibits this behavior.) - -Overall, the setup should look something like this: - -StepMania\ - Songs\ - Song Group 1\ - Song Group 2\ - Song Group 3\ - Song Group 4\ - Example Song\ - Example Song.sm - Example Song.mp3/ogg - Example Song-bn.png - Example Song-bg.png - --------------------------------------------------------------------------------- -2.3.2: Installing Noteskins/New Gametypes --------------------------------------------------------------------------------- -NoteSkins change the appearance of the arrows. They are also linked with getting -other gametypes supported in StepMania. - -The noteskin installation process looks something like this: -StepMania\ - NoteSkins\ - (gametype)\ - (noteskin for gametype)\ - default\ - (gametype2)\ - default\ - -"gametype"/"gametype2" etc. can be any one of the following: -dance (typically 4 panels) -pump (typically 5 panels) -para (5 receptors) -techno (4, 5, and 8 panel modes) -beat (5 and 7 key modes with a turntable on each) -popn (5 and 9 line modes) -kb7 (6 or 7 keys depending on when you try to use it) - --------------------------------------------------------------------------------- -2.3.3: Installing Themes --------------------------------------------------------------------------------- -Depending on if the theme is packaged in a SMZip or not, you have a few options. - -If it is in a .smzip, you can put it in the Packages directory: -StepMania/ - Packages/ - MyTheme.smzip -and StepMania will automatically read it. -On Windows, you can double click on the .smzip file to install it in your user -packages directory. THIS IS NOT RECOMMENDED BECAUSE IT CAUSES CONFUSION. - -Since .smzip files are really .zip files, you could also extract them in the -StepMania root folder. - -If the themer has not packaged the theme in a .smzip, then you have to look -inside the archive to see how the directory layout looks. -1) Themes folder - If it has a themes folder when you open it up, extract in the StepMania root - folder, like you would a .smzip file. -2) Theme name as a folder - This one will have to be extracted in the Themes directory. You will get a - new folder with the files. -3) A bunch of folders + metrics.ini - The themer was lazy; you're going to have to make a folder in the Themes - directory and extract the theme in there. - -When in doubt, read any documentation that comes with the theme for proper -installation instructions. - -================================================================================ -Chapter 3: sm-ssc -================================================================================ -sm-ssc is a fork of the current StepMania codebase. It is focused on adding -features for theming, but also tries to make the process of dealing with +sm-ssc Beginner's Guide +Written and edited by the spinal shark collective +-------------------------------------------------------------------------------- +Table of Contents +1 Introduction +2 StepMania + 2.1. Terms and Concepts + 2.1.1 Notable StepMania Versions + 2.1.2 StepMania Components + 2.2 StepMania Configuration + 2.2.1 Frequently Asked Questions that can be + Solved by Changing the Configuration + 2.3. Installing Content + 2.3.1 Installing Song Files + 2.3.2 Installing Noteskins/New Gametypes + 2.3.3 Installing Themes +3. sm-ssc +================================================================================ +Chapter 1: Introduction +================================================================================ +Welcome to the sm-ssc Beginner's Guide. This guide is primarily meant for people +who do not have any previous experience with StepMania, but also includes +information on how sm-ssc differs from StepMania. If you already know what +StepMania is, and the basics of adding things to an install, you can skip ahead +to Chapter 3: sm-ssc. Otherwise, read on. + +================================================================================ +Chapter 2: StepMania +================================================================================ +StepMania is an open-source rhythm game/engine, used by many projects, both +commercial and free. It is the software from which sm-ssc is derived, and as +a result, must be learned before using sm-ssc if you're not already familiar +with how it works. + +Some of the things an average sm-ssc user is expected to know includes the +meanings/"proper names" of certain things, as well as how to install content +and configure the program to suit your playing style. + +-------------------------------------------------------------------------------- +2.1: Terms and Concepts +-------------------------------------------------------------------------------- +Like many other video games, StepMania has a rich lexicon of words which may +confuse others. The most important of the terms has to do with versions of +StepMania, as backwards compatibility is pretty much nonexistent between major +versions. + +-------------------------------------------------------------------------------- +2.1.1: Notable StepMania Versions +-------------------------------------------------------------------------------- +Knowing the versions of StepMania is helpful, as it will help you deduce what +you can and can not install. (Most songs are version-agnostic, though the +background animations may not be. Themes, Noteskins, etc. are tied to +specific versions.) + +* StepMania 3.9 +StepMania 3.9 is currently considered the stable version of StepMania. It dates +back to 2005, and is the version for which the bulk of content is produced. + +* StepMania 3.9 Plus/StepMania 3.9 Plus Redux +3.9 Plus/Redux is a fork of StepMania 3.9 that adds features from +later StepMania versions (such as rolls), as well as new features. + +* StepMania 3.95/StepMania Online +Generally, when people talk about this version, they refer to a CVS build of +StepMania from around June-August 2006. It was not an officially supported +build of StepMania. + +* OpenITG +OpenITG is a fork of the StepMania CVS code from around the time In The Groove 2 +was released. OpenITG's goal is to produce a replacement executable for ITG2 +machines with enhanced features, though it can also be used at home as well. + +* StepMania 4.0 CVS +This term is used to describe versions of StepMania 4 that appeared after "3.95" +up until January 2008, when the last build that could be categorized as "CVS" +was released. + +* StepMania 4.0 SVN/alpha +The current development version of StepMania. This is the version that sm-ssc +is forked off of. If you wish to port something to sm-ssc, it had better work +for this version first, unless you like working hard to port the theme past +various generations and default theme assumptions. + +-------------------------------------------------------------------------------- +2.1.2: StepMania Components +-------------------------------------------------------------------------------- +Despite the title, this is a bit more broader-reaching, as it covers terms that +you may see in StepMania communities and online. +-------------------------------------------------------------------------------- +* Courses + Courses exist in many different forms, but in general, they take you through + multiple songs without a break in-between. There are multiple types of courses: + + * Nonstop Courses + Nonstop courses use the regular lifebar and typically have 4 songs per + course, though this isn't always the case. It is the easiest of the + course modes. + + * Oni/Challenge Courses + The Oni/challenge courses are quite difficult, usually giving you 4 lives + over multiple songs. If you get less than a Great, you lose a life. Once + you lose all your lives, the game is over. + + * Survival Courses + Survival courses go by time. Each step judgment is worth something on the + timer, with most of the values being negative by default. If you run out of + time before you complete the course, the game is over. + + * Endless Courses + Endless courses are like the name suggests. They don't end until you fail or + decide to quit. Like Nonstop courses, they have a normal lifebar as well. +-------------------------------------------------------------------------------- +* Event Mode + Typically used during events, this disables the concept of stages and lets you + play songs until you decide to stop. It is quite useful in Home Mode, and this + guide recommends you enable it. + +* Gametypes + Gametypes are the different game modes StepMania can play. They generally + change things like number of default receptors, number of judgments, and more. + Gametypes are directly related to noteskins and unrelated to the different + play modes (Normal, Nonstop, Challenge, and so on). + Examples of gametypes include "dance", "pump", "beat", "techno", and so on. + +* NoteSkins + NoteSkins are the appearance of the notes. Most noteskins are bound to certain + gametypes, though some noteskins are easily adapted for other gametypes. + +* Pack/packs + A pack is a group of songs for StepMania. The term originated from the + community of StepMania keyboard creators, and can be seen prominently in + certain release names, such as Community Keyboard Mega Pack (CKMP). + When used as a single word question, e.g. "packs?", it is a request for what + packs you have installed. + +* Songs + StepMania songs contain a few files, but mainly the steps (.sm, .dwi, .ksf, + .bms, among many other formats) and song file itself (.mp3, .ogg, .wav). In + order to get the most out of StepMania, you'll need to know all about songs + and how to install them. + +* Themes + Themes are skins for StepMania. They change the look and feel, and in post-3.9 + versions, can also change elements of gameplay (scoring, grading) as well. + +-------------------------------------------------------------------------------- +2.2: StepMania Configuration +or "How to use the Options Menu" +-------------------------------------------------------------------------------- +Learning how to properly configure StepMania can save you headaches. + +Most themes will have the Options menu in plain sight on the Title Menu. +From there, it depends on which version of StepMania you have, as the options +menus were re-shuffled around for the StepMania 4 alphas. + +The typical StepMania 3.9 Options Menu: +* Appearance Options +* Background Options +* Bookkeeping +* Center Image +* Coin Options +* Config Key/Joy Mappings +* Input Options +* Gameplay Options +* Graphic Options +* Machine Options +* Sound Options +* Profile Options +* Other Options +* Reload Songs/Courses +* Test Input + +The StepMania 4.0 alpha 4 Options Menu: +* Config Key/Joy Mappings +* Test Input +* Appearance Options +* Graphics/Sound Options +* Advanced Options +* Network Options +* Profiles +* Reload Songs/Courses + +sm-ssc changes this up again, making the "Options" item on the Title Menu go +to System Direction (mostly-used options), leaving the normal options menu to +the Scroll Lock key. Blame Midiman. :) +-------------------------------------------------------------------------------- +2.2.1: Frequently Asked Questions that can be Solved by Changing the Configuration +-------------------------------------------------------------------------------- +With that in mind, it's time to answer some questions using this knowledge. + +Q: How do I disable the menu timer? +A: Where you go depends on the version of StepMania you use. + +[3.9] Machine Options +[4.0 alphas] Advanced Options +It will be the first option on each. + +Q: How do I play forever, without game overs? +A: Turn on Event Mode. Where you go depends on the version of StepMania you use. + +[3.9] Coin Options +[4.0 alphas] Advanced Options, a bit down the page. + +Q: What the heck is this thing that says "Toasty" and how do I get rid of it? +A: It's a reference to Mortal Kombat 2, where Dan Forden would pop out from +the side of the screen randomly after an uppercut. +In order to get a Toasty in StepMania, one must get a 250 combo without any +Greats. The number 250 is a reference to how many VS games of MK2 you had to +play before you could play Pong. + +As for turning it off, turn Easter Eggs off. +It appears in different locations between StepMania versions: +[3.9] Gameplay Options +[4.0 alphas] Advanced Options, a bit down the page. + +-------------------------------------------------------------------------------- +2.3: Installing Content +-------------------------------------------------------------------------------- +This is the most important section you will read, as all the time that you spend +not playing with StepMania will be adding/removing things to it. Well, not +completely, as you have other things to do. + +Before we touch on the specifics, there are a few skills you should learn. + +* Mac Users of StepMania 4.0 +Most of the game content is packaged in a file called StepMania.smzip. This has +the pros of not cluttering things up, but the con is that people don't know +where to put things. + +Wherever you have StepMania installed, make the following folders: + * Songs + * Themes + * Noteskins + (and the various gametype folders, which are optional. You need at least one + non-lights gametype in order to play.) + * Noteskins/dance + * Noteskins/pump + * Noteskins/para + * Noteskins/techno + * Noteskins/beat + * Noteskins/popn + * Noteskins/ez2 + * Announcers + (but at this point, no SM4 announcers have been released) + * Packages + (optional, but recommended) + +and then you can follow the rest of this guide. + +* Not on Windows and want to deal with .smzip files? +There are multiple ways to deal this. + 1) Put the SMZip file in the Packages folder. + 2) Rename the file to have an extension of .zip and extract in the root + StepMania folder. + 3) Pass the smzip's filename to StepMania on the command line/terminal. + Dragging and dropping the .smzip may or may not work; we have not tested it. + Also, this may or may not exist in your version of StepMania. + +-------------------------------------------------------------------------------- +2.3.1: Installing Song Files +-------------------------------------------------------------------------------- +Song files are distributed in many ways. The concept of packs was explained +above, in which multiple songs are included in one archive. + +For .smzip files, the section "Not on Windows and want to deal with .smzip +files?" details all possible ways of installing .smzip files, but the most +common ways are as follows: + +1) For operating systems with a filetype handler (Windows), you can double + click on the .smzip file and the StepMania tools will handle it. +2) Putting the .smzip file in the Packages folder, where it will be automatically + read by StepMania. + +If it's not a .smzip file, you'll have to do some detective work. +Open up the song archive and see how the files are laid out. + +The easiest single song installs will have a folder structure similar to this: +Group Name\ + Song Name\ + song file.sm + song file.ogg/mp3 + song file-bg.png + song file-bn.png + +With a setup like this, you can just extract it to the Songs folder with +directory structure intact. + +Sometimes, simfile authors don't package their file with a group name, +leaving you with a file structure like this: +Song Name\ + song file.sm + song file.ogg/mp3 + song file-bg.png + song file-bn.png + +You will need to extract this into a song group folder that exists already. + +An uncommon setup will only include the song files, without any folders at all. +These need to be put into the {Group Name}\{Song Name}\ folder in order to work. + +For packs, you follow the same logic. If there are multiple song folders, but no +group folder, you will have to make a group folder. (Flightmix 4 is an example +of a pack that exhibits this behavior.) + +Overall, the setup should look something like this: + +StepMania\ + Songs\ + Song Group 1\ + Song Group 2\ + Song Group 3\ + Song Group 4\ + Example Song\ + Example Song.sm + Example Song.mp3/ogg + Example Song-bn.png + Example Song-bg.png + +-------------------------------------------------------------------------------- +2.3.2: Installing Noteskins/New Gametypes +-------------------------------------------------------------------------------- +NoteSkins change the appearance of the arrows. They are also linked with getting +other gametypes supported in StepMania. + +The noteskin installation process looks something like this: +StepMania\ + NoteSkins\ + (gametype)\ + (noteskin for gametype)\ + default\ + (gametype2)\ + default\ + +"gametype"/"gametype2" etc. can be any one of the following: +dance (typically 4 panels) +pump (typically 5 panels) +para (5 receptors) +techno (4, 5, and 8 panel modes) +beat (5 and 7 key modes with a turntable on each) +popn (5 and 9 line modes) +kb7 (6 or 7 keys depending on when you try to use it) + +-------------------------------------------------------------------------------- +2.3.3: Installing Themes +-------------------------------------------------------------------------------- +Depending on if the theme is packaged in a SMZip or not, you have a few options. + +If it is in a .smzip, you can put it in the Packages directory: +StepMania/ + Packages/ + MyTheme.smzip +and StepMania will automatically read it. +On Windows, you can double click on the .smzip file to install it in your user +packages directory. THIS IS NOT RECOMMENDED BECAUSE IT CAUSES CONFUSION. + +Since .smzip files are really .zip files, you could also extract them in the +StepMania root folder. + +If the themer has not packaged the theme in a .smzip, then you have to look +inside the archive to see how the directory layout looks. +1) Themes folder + If it has a themes folder when you open it up, extract in the StepMania root + folder, like you would a .smzip file. +2) Theme name as a folder + This one will have to be extracted in the Themes directory. You will get a + new folder with the files. +3) A bunch of folders + metrics.ini + The themer was lazy; you're going to have to make a folder in the Themes + directory and extract the theme in there. + +When in doubt, read any documentation that comes with the theme for proper +installation instructions. + +================================================================================ +Chapter 3: sm-ssc +================================================================================ +sm-ssc is a fork of the current StepMania codebase. It is focused on adding +features for theming, but also tries to make the process of dealing with StepMania a little easier. \ No newline at end of file diff --git a/Docs/WindowsNotes.txt b/Docs/WindowsNotes.txt index df305c466d..e51d6fb629 100644 --- a/Docs/WindowsNotes.txt +++ b/Docs/WindowsNotes.txt @@ -1,17 +1,17 @@ -[IMPORTANT INSTALL NOTE] -If you are using Windows Vista or Windows 7, please do not install StepMania SSC into the Program Files directory. - -[Using Google Chrome?] -If you are using Google Chrome as your primary web browser, you will have to perform some extra steps to get stepmania:// URI handling to work: - -Find yout user data -Windows XP: C:\Documents and Settings\<USERNAME>\Local Settings\Application Data\Google\Chrome\User Data -Windows Vista/7: C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data - -Add your protocol to the 'Local State' file under the 'protocol_handler' section, as such: -"protocol_handler": { - "excluded_schemes": { - ... - "stepmania": false, - ... +[IMPORTANT INSTALL NOTE] +If you are using Windows Vista or Windows 7, please do not install StepMania SSC into the Program Files directory. + +[Using Google Chrome?] +If you are using Google Chrome as your primary web browser, you will have to perform some extra steps to get stepmania:// URI handling to work: + +Find yout user data +Windows XP: C:\Documents and Settings\<USERNAME>\Local Settings\Application Data\Google\Chrome\User Data +Windows Vista/7: C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data + +Add your protocol to the 'Local State' file under the 'protocol_handler' section, as such: +"protocol_handler": { + "excluded_schemes": { + ... + "stepmania": false, + ... } \ No newline at end of file diff --git a/Docs/credits.txt b/Docs/credits.txt index ff068464c3..28c0f41096 100644 --- a/Docs/credits.txt +++ b/Docs/credits.txt @@ -1,148 +1,148 @@ -sm-ssc credits (in no particular order) ---------------------------------------- -* "Programming" is used in regards to the sm-ssc project. -* If you have any corrections to this list, let us know (via forums or IRC). - -==the spinal shark collective== -AJ Kelly - * Main programming - * UserPreferences and some other Lua scripts - * Some small theme edits here and there - * Noteskins (retro, retrobar*) - * Windows project file maintainer - -Midiman - * Did most of the work on _fallback and default themes - * Some programming - * Noteskins (midi-*) - -shakesoda - * Programming - * Noteskins (delta, gamma, port of orbital to kb7) - * Theme edits - * Mac OS X primary maintainer - -==sm-ssc Team== -(in no particular order) - -Aldo_MX - * Code (Pump it Up delays, among others), ideas, and support. - -cerbo - * [SongManager] SetPreferredSongs() and SetPreferredCourses() Lua bindings - -Daisuke Master - * Programming - * Pump/simple and Pump/complex noteskins - * /Docs/Themerdocs/Noteskin elements Reference.txt - * Taking advantage of sm-ssc's new features :) - -FSX - * Various fixes. (see Changelog_sm-ssc.txt for more details) - -Nicole Reid (okeeblow) - * Tested building sm-ssc on FreeBSD, provided fixes. - -Wolfman - * [Player] PercentUntilColorCombo metric - * Mac OS X maintainer - * Various fixes/changes. (see Changelog_sm-ssc.txt for more details) - -==other contributors== -(in no particular order, aside from having SM team at the top) - -StepMania Team - * Keeping StepMania 5 alive with changes, and providing a nice codebase for - us to work with. - -Kaox - * Pump/default noteskin - -cesarmades - * Pump/cmd-* noteskins - -David Santamara Rogado (howl) - * Various patches (see Changelog_sm-ssc.txt for more details and links) - -Kita K./D. Trucks - * sm-ssc default theme music - -kurisu - * Dance-threepanel gametype code (3.9; re-adapted for sm-ssc) - -v1toko - * Lead coder of StepNXA, which is where we got the original XMode code from. - -Macgravel - * Orbular noteskin (the default kb7 noteskin) - -theDtTvB - * Keysound patch (http://share11.appspot.com/20421) - [This patch is currently causing crashes for us, sadly.] - -sy567 - * Small beginner helper fix - (http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12) - -galopin - * Pump it Up Exceed PlayStation 2 USB dance mat support patch - (stepmania-devs mailing list 20091213 11:27 -0800 [Pacific Standard Time]) - -Henke37 - * [MovieTexture_FFMpeg] Stutter fix - (http://www.pasteall.org/11353/diff) - -corec - * [ArchHooks_Unix, MovieTexture_FFMpeg] Make sm-ssc work with system's FFMpeg. - (http://github.com/corec/cc-overlay/blob/master/games-arcade/sm-ssc/files/sm-ssc-ffmpeg-fixes-01.patch) - * [InputMapper] Enabling upper diagonal keys for Positive Gaming Impact dance mat - (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=137) - -gholms - * Make autogen.sh look for automake 1.11 - (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=140) - -juanelote - * [SongManager] GetSongGroupByIndex function - * [MusicWheel] JumpToNextGroup/JumpToPrevGroup logic modifications - -NitroX72 - * Pump/frame noteskin - -Tatsh - * A patch to fix building with system ffmpeg - (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=218) - -==the beta testers== -[SSC Beta Testing Team] -KeithD -tweak/tweak62 - -[Friends of the Devs] -And4713 -HankPeters -okeeblow -kdaymea -taiyal - -[Members of Team Step Masters (http://www.team-stepmasters.net/foro/)] -Daisuke Master -Nueel/emmanuel virus -Fye -Bijou -Nek0 -Jib -Robe -Urqui -h4m573r -Torta - -[Private Beta Wave 1.x Testers] -FSX -Sniper257 -Wolfman2000 -NitroX72 -Wanny -Tio -Cerbo +sm-ssc credits (in no particular order) +--------------------------------------- +* "Programming" is used in regards to the sm-ssc project. +* If you have any corrections to this list, let us know (via forums or IRC). + +==the spinal shark collective== +AJ Kelly + * Main programming + * UserPreferences and some other Lua scripts + * Some small theme edits here and there + * Noteskins (retro, retrobar*) + * Windows project file maintainer + +Midiman + * Did most of the work on _fallback and default themes + * Some programming + * Noteskins (midi-*) + +shakesoda + * Programming + * Noteskins (delta, gamma, port of orbital to kb7) + * Theme edits + * Mac OS X primary maintainer + +==sm-ssc Team== +(in no particular order) + +Aldo_MX + * Code (Pump it Up delays, among others), ideas, and support. + +cerbo + * [SongManager] SetPreferredSongs() and SetPreferredCourses() Lua bindings + +Daisuke Master + * Programming + * Pump/simple and Pump/complex noteskins + * /Docs/Themerdocs/Noteskin elements Reference.txt + * Taking advantage of sm-ssc's new features :) + +FSX + * Various fixes. (see Changelog_sm-ssc.txt for more details) + +Nicole Reid (okeeblow) + * Tested building sm-ssc on FreeBSD, provided fixes. + +Wolfman + * [Player] PercentUntilColorCombo metric + * Mac OS X maintainer + * Various fixes/changes. (see Changelog_sm-ssc.txt for more details) + +==other contributors== +(in no particular order, aside from having SM team at the top) + +StepMania Team + * Keeping StepMania 5 alive with changes, and providing a nice codebase for + us to work with. + +Kaox + * Pump/default noteskin + +cesarmades + * Pump/cmd-* noteskins + +David Santamara Rogado (howl) + * Various patches (see Changelog_sm-ssc.txt for more details and links) + +Kita K./D. Trucks + * sm-ssc default theme music + +kurisu + * Dance-threepanel gametype code (3.9; re-adapted for sm-ssc) + +v1toko + * Lead coder of StepNXA, which is where we got the original XMode code from. + +Macgravel + * Orbular noteskin (the default kb7 noteskin) + +theDtTvB + * Keysound patch (http://share11.appspot.com/20421) + [This patch is currently causing crashes for us, sadly.] + +sy567 + * Small beginner helper fix + (http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12) + +galopin + * Pump it Up Exceed PlayStation 2 USB dance mat support patch + (stepmania-devs mailing list 20091213 11:27 -0800 [Pacific Standard Time]) + +Henke37 + * [MovieTexture_FFMpeg] Stutter fix + (http://www.pasteall.org/11353/diff) + +corec + * [ArchHooks_Unix, MovieTexture_FFMpeg] Make sm-ssc work with system's FFMpeg. + (http://github.com/corec/cc-overlay/blob/master/games-arcade/sm-ssc/files/sm-ssc-ffmpeg-fixes-01.patch) + * [InputMapper] Enabling upper diagonal keys for Positive Gaming Impact dance mat + (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=137) + +gholms + * Make autogen.sh look for automake 1.11 + (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=140) + +juanelote + * [SongManager] GetSongGroupByIndex function + * [MusicWheel] JumpToNextGroup/JumpToPrevGroup logic modifications + +NitroX72 + * Pump/frame noteskin + +Tatsh + * A patch to fix building with system ffmpeg + (http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=218) + +==the beta testers== +[SSC Beta Testing Team] +KeithD +tweak/tweak62 + +[Friends of the Devs] +And4713 +HankPeters +okeeblow +kdaymea +taiyal + +[Members of Team Step Masters (http://www.team-stepmasters.net/foro/)] +Daisuke Master +Nueel/emmanuel virus +Fye +Bijou +Nek0 +Jib +Robe +Urqui +h4m573r +Torta + +[Private Beta Wave 1.x Testers] +FSX +Sniper257 +Wolfman2000 +NitroX72 +Wanny +Tio +Cerbo Daisuke Master \ No newline at end of file diff --git a/Docs/old_changelog.txt b/Docs/old_changelog.txt index 7db3baea65..53163a0351 100644 --- a/Docs/old_changelog.txt +++ b/Docs/old_changelog.txt @@ -1,814 +1,814 @@ -sm-ssc Changelog (mainly source code related) -_________________________________________________________________________ -All changelogs go by SVN revision number* for the time being. - -Not all changes are documented, as some were later reverted and other -features are meant to be undocumented for various reasons. - -Some changes are grouped together even though the commits may have -happened at different times. - -All times are in 24 hour format, Central Standard Time (UTC-6) unless between -dates where daylight savings time is in effect in the United States (then -it's UTC-5). -_____________________________________________________________________________ - -sm-ssc Private Beta Wave 1.1 | 20091208 ---------------------------------------- -The next Private Beta release will be termed Wave 1.1, and will be released -to current sm-ssc beta testers on December 8th, 2009. - -Bugfixes aren't listed here unless they're source code-related, usually. -See the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ for bugs/feature -requests and their status. - -In addition to the bugfixes, the following changes have been made: - -r130 | 20091203 15:17:13 ------------------------- -Two new GameCommands: -* fademusic,fVolume,fDuration (though I wish fDuration was how long to fade the - music for; instead the fade lengths are consts in GameSoundManager.) -* pushscreen,sScreenName (though it doesn't push screens like I had thought it - would. maybe I'm doing it wrong.) [AJ] - -r129 | 20091202 21:56:54 ------------------------- -Modified character camera values. [shakesoda] - -r128 | 20091202 01:16:28 ------------------------- -* Profile name max length changed from 12 to 32 characters. - -r127 | 20091201 23:43:10 ------------------------- -* [ScreenSelectMusic] new metric SamplePreviewMusicMode, which has one of two - possible values as of r127. 'SamplePreviewMusicMode_Normal' is business as - usual (sample music plays), while 'SampleMusicPreviewMode_ScreenMusic' - disables song samples, using /{theme}/Sounds/ScreenSelectMusic loop music.* - as the file to play. No, this doesn't support Lua music yet. [AJ] - -sm-ssc Private Beta Wave 1 | 20091201 -------------------------------------- -The list below comprises sm-ssc Private Beta Wave 1's changes. Some of the -changes are from baseline StepMania 4 SVN, in order to keep compatibility. - -r126 | 20091130 23:18:28 ------------------------- -* Add improved cel shading for people with GLSL support. [shakesoda] - -r125 | 20091130 18:18:43 ------------------------- -* [Course.cpp] GetPlayMode() and GetCourseType() return actual enums now, - instead of numbers. - -r124 | 20091130 14:45:37 ------------------------- -* [StepMania.cpp] (any)Shift+F2 = reload metrics only. - F2 = reload metrics and textures. - -r123 | 20091129 14:42:34 ------------------------- -* [TimingData] add GetActualBPM() Lua binding that returns a table holding the - min and max BPMs, in that order. - -r122 | 20091127 23:31:32 ------------------------- -* Add OptionsListTimeout [shakesoda] - -r121 | 20091127 15:57:10 ------------------------- -* Disable color keying banners (it's 2009, I don't think anyone is using the - old rotated banners anymore. -aj) [shakesoda] - -r112-r120 | 20091126 17:28:56-22:13:57 (SSC turkey day) -------------------------------------------------------- -* [Song] new Lua bindings: NormallyDisplayed(), GetStepsSeconds() -* Themes will load Lua scripts from subdirectories first now. - -r111 | 20091122 10:21:30 ------------------------- -* [ArchHooks_Unix] Follow user's system language as default. - [David Santamara Rogado (howl)] - See http://www.stepmania.com/forums/showthread.php?t=21471 for more info. - -r110 | 20091120 14:03:17 ------------------------- -* Fixed a crash with lifemultipliers > 1.0 in debug builds - -r109 | 20091117 11:05:29 ------------------------- -* F2 reloads metrics again, just like in StepMania 3.9. (This is probably one - of those changes that won't get backported to baseline StepMania...) -* [ScoreKeeperNormal] version 0.5 of ToastyTriggersAt added; only allows for - one value, unlike 3.9+ (which used a String with multiple values). The final - version will use a Lua table, similar to [MusicWheel] SortOrders. - -r108 | 20091116 02:19:05 ------------------------- -* [CharacterManager] GetAllCharacters() Lua binding added. - -r107 | 20091116 02:03:41 ------------------------- -* [Character] new Lua bindings: GetModelPath(), GetRestAnimationPath(), - GetWarmUpAnimationPath(), GetDanceAnimationPath() -* [CharacterManager] GetRandomCharacter() Lua binding added -* [RageFileManager] GetDirListing(sPath,bOnlyDirs,bPathToo) Lua binding added - -r106 | 20091115 21:33:28 ------------------------- -* Prevent focus lost at Fullscreen on X11, fix windowed->fullscreen resolution - changes so that they save [David Santamara Rogado (howl)] - (http://www.stepmania.com/forums/showthread.php?t=21430) - -r105 | 20091114 15:07:58 ------------------------- -* Add support for .oga and .ogv files. [David Santamara Rogado (howl)] - (http://pastie.org/698741) - -r104 | 20091113 22:13:47 ------------------------- -* Fix a crash in StepsDisplay that allows Course mode to at least run. - -r103 | 20091113 21:23:42 ------------------------- -* sm4svn r28233 [Glenn Maynard]: - "Fix ThemeMetric<EnumType> gives the first value of the enum when the theme - metric is nil, instead of EnumType_INVALID. - This happened because ThemeMetric was setting the value to its default, - eg. EnumType(), when LuaHelpers::FromStack returned false. - This behavior doesn't make sense in the general case, since EnumType() results - in an arbitrary value (the first one) rather than Invalid. Every FromStack - function sets a reasonable default on invalid data, anyway, and only RageColor - and enums can return false in any case. - This fixes CustomDifficulty when CourseType = nil." - -r102 | 20091111 04:00:46 ------------------------- -* MusicWheelItem SetMessage has a new param, Type (string that returns the - item type). -* Add sort songs by most recently played. (As of this writing, it's not - feature-complete yet.) - -r101 | 20091109 19:33:55 ------------------------- -* Implemented David Santamara Rogado (howl)'s patch for loading Splash.png instead of an .xpm -(http://www.stepmania.com/forums/showpost.php?p=157340&postcount=3) - -r089-100 | 20091103 01:45:01 - 20091109 04:01:31 ------------------------------------------------- -Okay let's just say it's r089 to r100 and call it a week. - -* Changes from SM4SVN: - * r28211: [HighScore.cpp] "logic fixup" [Glenn Maynard] - * r28215: "default to showing backgrounds in editor" [Chris Danford] - * r28217: "Fix crash on reload metrics due to faulty FlushDirCache logic." - [Steve Checkoway], implemented along with code that was originally submitted - as r076 but removed. See this fix log to figure out why we'd bother. :) - * r28218: "crash handler is crashing in 2.6.31 in GetBacktrace, causing a - recursive crash handler crash that we aren't handling, leading to recursion" - [Glenn Maynard] - * r28219: "add 'DIRRO' driver for read-only access" [Glenn Maynard] - * r28220: "fix confusing comment. Escaping doesn't affect this; commas aren't - escaped, since they're split from the value itself, long after MsdFile is - loaded." [Glenn Maynard] (We'll be keeping the 1,1,1,1 colors in sm-ssc, and - may provide a compatibility script for SM4SVN, so be on the lookout.) - * r28221: "allow overriding, like PRODUCT_ID" [Glenn Maynard] - * r28222-28223: "adding support for pms files" [GRIM657] - * The pulseaudio patch [David Santamara Rogado (howl), Ondřej Hošek, Damien Thébault] - (see http://www.stepmania.com/forums/showthread.php?t=21348) - * Greg Nadja's OpenGL/Windows patch - -* sm-ssc Changes: - * [ScreenSelectMusic.cpp] Add SelectMenuInputMessage, has params Player and - Button. Broadcast messages when holding select and a button other than Select - is pushed. - * Windowed mode is now the default display mode. - * [HighScore.cpp] new Lua bindings: - * GetModifiers() - * GetTapNoteScore(TapNoteScore) - * GetHoldNoteScore(HoldNoteScore) - * GetRadarValues() - * [ProfileManager.cpp] added IsSongNew(Song) Lua binding - -r088 | 20091101 12:19:47 ------------------------- -* SM4SVN r28203-28208, all by Glenn Maynard. - * r28203: "skip exporting round data when nothing was played (no taps, no holds)" - * r28204: "fix signatures not being written" (we had this already) - * r28205: "don't fail if there's no course; just hide" - * r28206: "move course rename and delete into Overview" - * r28208: "disable rename and delete for courses that havn't been saved yet" -r28207 was a theme edit. - -r087 | 20091029 15:48:06 ------------------------- -sm4svn r28202: helper for cycling through an enum [Glenn Maynard] - -r086 | 20091028 22:20:40 ------------------------- -sm4svn r28201: "refactor RageInput to not call GetDevicesAndDescriptions -constantly; it can be slightly complex and get called thousands of -times a second" [Glenn Maynard] - -r085 | 20091027 18:17:54 ------------------------- -* Allow for Codes on ScreenGameplay. -* New Lua bindings for ScreenGameplay: - * PauseGame(bool) - Pauses/unpauses the game. - * IsPaused() - returns true or false depending on if the game is paused or not. - -r084 | 20091027 04:40:01 ------------------------- -* SM4SVN r28198-28200 - * r28198: Fix GetFileSizeInBytes to return an int instead of unsigned. - "this returns -1 on error (this should actually be 64-bit, - but that's a bigger change)" [Glenn Maynard] - * r28199: The official log is as follows: - "Hack to get the decorations to be deleted. Fixes crashes, - but probably not the best way to go about this." - In addition to doing this, it adds GetChildren() to ActorFrame in the - code itself. (It already existed in Lua, I just felt like pointing - this out. :D) [Steve Checkoway] - * r28200: The official log is as follows: - "Do not use an AutoActor to keep track of the children." - However, this also fixes the hack in r28200. [Steve Checkoway] - -r083 | 20091015 02:52:45 ------------------------- -* Support loading Lua scripts from subdirectories of the Scripts folder, - to allow for better organization. The scripts in the root Scripts folder - will run first, then any Lua scripts in subdirectories of the Scripts folder - will be run. It currently only works with one folder depth, for example: - Scripts/subfolder/script.lua. - - This is not likely to be changed. If you can see a possible need for paths - like Scripts/subfolder/subfolder2/script.lua, please make a Feature Request - ticket on the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ with - an explanation of what you have in mind. - -r082 | 20091012 02:53:51 ------------------------- -* Change BitmapText defaults to no stroke + no shadow. -* Added DefaultTheme preference in order to fix crashes. - (sm-ssc's fallback theme is _fallback [and therefore normally unselectable].) - -r081 | 20091005 22:13:23 ------------------------- -* [NotesLoaderSM.cpp] Changes based on SM4SVN r28197 [Archer] - -r080 | 20091002 15:56:01 ------------------------- -* Event Mode turned on by default, as it should be. :) - -r079 | 20090925 21:20:49 ------------------------- -* SM4SVN r28192-28196. - * r28192: HexToBinary for RString -> RString. [Glenn Maynard] - * r28193: show all songs in EditCourse, not just preferred songs [Chris Danford] - * r28194: [ScreenDebugOverlay] Glenn made this themeable in SM4SVN, finally - catching up. This means we've had to rename a few things: - * DebugMenuHeader -> HeaderText - * PageName -> PageText - ButtonText and FunctionText were added, as well. - The font names remain the same, only the metrics change. - (Can you believe they're still using Common normal as the font?) - * r28195,28196: fix ComboChanged message sent when m_bSendJudgmentAndComboMessages - is false, fix doing unnecessary work in multiplayer [Glenn Maynard] - -r078 | 20090920 00:43:33 ------------------------- -* [StepsDisplay] Fixed it so it actually shows up again. - -r077 | 20090919 20:31:54 ------------------------- -Happy talk like k//eternal day! -* [Font.cpp] Don't show strokes by default. -* [NoteDisplay] fRotation -> fRotationZ in anticipation of multiple rotation mods. -* [PaneDisplay] changed one thing that used a goto; doesn't use it anymore. seems to work for me, though I'm not 100% sure. -* [ThemeManager] don't reload Lua scripts when you reload the metrics. - This is a temporary fix, and may be deemed safe at some point in the future. - -r076 | 20090914 03:42:25 ------------------------- -* SM4SVN r28190,28191 (25 files worth). This was later reverted, as it caused -reloading the metrics to crash. Since sm-ssc is primarily for themers, this is a -dealbreaker. A lot of things were unofficially added to sm-ssc at this point: - -* [ActorFrame] Added RemoveAllChildren() and RemoveChild(sName) bindings. - These are not guaranteed to work. Don't use them. They are very dangerous. -* [IniFile] added Lua's '--' syntax for commenting (along with '//' and '#', - which were already supported). -* New blend modes Modulate (subject to renaming later) and AlphaMultiply. -* [RageUtil] Added various bindings for formatting time that were already built - into StepMania: SecondsToHHMMSS, SecondsToMMSSMsMs, SecondsToMMSSMsMsMs, - SecondsToMSS, SecondsToMMSS. All bindings take in a float (number of seconds). -* [RageUtil] Added IsHexVal(string) binding. -* Added groups to sort length (based on BPM ranges), so the songs no longer - show up without groups. - -r075 | 20090914 00:41:36 ------------------------- -* SM4SVN r28189. - -r074 | 20090913 12:52:05 ------------------------- -* SM4SVN r28180-28185. - -r073 | 20090913 01:57:12 ------------------------- -* Added WeightedMultiply and InvertDest blend modes to Direct3D. - -r072 | 20090912 17:15:16 ------------------------- -* Change decorations draw order so it breaks things less. - -r071 | 20090911 01:29:41 ------------------------- -* "hidden" removed from Actor commands. It was deprecated. - A compatibility alias was added to replicate its functionality. However, this - will not work with NoteSkins, so be sure to make sure to check them for the - use of hidden. - - Handy replacement guide: - hidden,true / hidden,1 = visible,false - hidden,false / hidden,0 = visible,true - -r070 | 20090907 03:01:22 ------------------------- -* Add Sprite:CropTo() function + Lua binding. - -r069 | 20090906 03:59:10 ------------------------- -* Base theme changed from "default" to "_fallback". - As a result, all themes will fallback on _fallback. - _fallback is more or less the SM4SVN default. - -r068 | 20090905 21:05:17 ------------------------- -* [ScreenWithMenuElements.cpp, ThemeManager.cpp] Load and parse Lua as music. - This makes conditional music possible. - -r067 | 20090905 19:00:37 ------------------------- -* add URLEncode Lua binding to RageUtil. - -r066 | 20090904 14:19:28 ------------------------- -* Change many things on ScreenEdit to go 5 decimal places instead of 3. -* Beginnings of Xbox controller mappings for edit mode (untested) -* [REDACTED] preference renamed to be less specific but more accurate. - -r065 | 20090903 04:21:31 ------------------------- -* Binding naming format changed for BPM bindings. Always uses all caps BPM. - Changes in the codebase due to this: - * [Song] HasSignificantBpmChangesOrStops -> HasSignificantBPMChangesOrStops - * [TimingData] HasBpmChanges -> HasBPMChanges -* [TimingData] New bindings. (GetStops, GetBPMsAndTimes) -* [ScreenPackages] attempt to not call MoveLeft by duplicating code. - Seemed to work okay. - -r064 | 20090831 02:53:36 ------------------------- -* [ActorScroller] Make naming of commands consistent (some were all lowercase, - some were CamelCase), all are now CamelCase. - todo: add aliases in the _fallback theme for compatibility with - regular SM4 themes. - -r063 | 20090831 02:48:44 ------------------------- -ScreenPackages changes: -* Backgrounds from Sprites to AutoActors (Lua can be used now). -* DefaultUrl metric added. - -r062 | 20090829 04:00:16 ------------------------- -* Add metric for determining how to judge jumps: - [Gameplay] LastOrMinimumTapNoteScore - and an enum (TapNoteScoreJudgeType) to go with it. This idea was inspired - by PumpMania (Zmey, et al). - (This commit was later reverted, as it caused crashes.) - -r061 | 20090828 00:29:08 ------------------------- -* Added ScreenGameplay:GetPlayerInfo(PlayerNumber) Lua binding - -r060 | 20090827 03:27:21 ------------------------- -* Added LifeChanged message to LifeMeterBattery, meaning certain hackily-coded - custom life meters by a certain SSC member can work in Oni mode again. ;) -* MAX_EDIT_STEPS_SIZE_BYTES changed from 30KB to 60KB. -* Added --theme= and --language= command line options. - -r059 | 20090826 03:16:45 ------------------------- -* SSE2 build configuration (Visual Studio 2008 project files only). -* new Lua bindings for WheelBase: IsSettled(), IsLocked() - -r058 | 20090822 16:14:18 ------------------------- -* Implement --version command line argument. Prints out the version of sm-ssc. - Please build sm-ssc with HAVE_VERSION_TIME if possible. Untested on Linux/Mac. - -r057 | 20090822 03:21:14 ------------------------- -* add beginner meter sort - -r056 | 20090821 00:19:23 ------------------------- -* SM4SVN r28172-28174. - -r055 | 20090810 14:48:34 ------------------------- -* [GameCommand.cpp] add GetUrl() Lua binding. -* [GameManager.cpp] add IsGameEnabled(Game) Lua binding. -* removing player color diffuse commands, in the hopes this can be replicated - using Lua commands. - [GrooveRadar.cpp, ScoreDisplayLifeTime.cpp, ScreenSelectMusic.cpp] -* [CommandLineActions] Version() stub; when implemented, should print out - version number and quit. -* [GrooveRadar] name m_GrooveRadarValueMap "RadarValueMap(P1/P2)" - (commands untested); new todo note in header file -* [ScoreDisplayOni.cpp] give it a name ("ScoreDisplayOni Numbers") and run - commands. (untested) -* various pedantic edits, maybe some commenting - [Actor.cpp, GameCommand.cpp, MusicWheel.cpp, NotesLoaderBMS.cpp, - ScreenSelect.cpp] - -r054 | 20090810 14:36:10 ------------------------- -* SM4SVN r28170 (vdl's fixes for Xbox building; he says they should be tested.) - -r053 | 20090815 07:18:10 ------------------------- -* add GetPathO() Lua binding - -r052 | 20090810 12:09:00 ------------------------- -* SM4SVN r28140-r28166 (code changes only) - -r051 | 20090808 03:11:39 ------------------------- -* SM4SVN r28135, r28137, r28138 -* Lossless screenshots now save as PNG. -* Conversion of decorations to not be children of the screen; they load in - a similar fashion to overlay/underlay, but still using LoadB so everything - works correctly. (Tested against SM4 default theme for compatibility.) - -r050 | 20090729 22:57:52 ------------------------- -* add GetRotationX, GetRotationZ commands to Actor -* add urlnoexit game command, which won't exit upon loading the browser. -* add OldHealthState to HealthStateChanged message on ScreenGameplay - -r049 | 2009072? ??:??:?? ------------------------- -* [REDACTED] - -r048 | 20090726 18:36:41 ------------------------- -* (untested) GrooveRadar plays commands on the frame now, -allowing for customized in and out transitions, using the -TweenOnScreen/TweenOffScreen Commands. -* add PlayerController enum binding -* add PlayerState:GetPlayerController() [untested] - -r047 | 20090725 20:30:19 ------------------------- -ScreenDebugOverlay changes: -* add OnCommand, X, Y to Debug Header -* add GainFocus/LoseFocus commands to page names -* add LineOnColor/LineOffColor - -r046 | 20090724 00:55:11 ------------------------- -* Fix default stroke color and shadow length. (BitmapText) - -r045 | 20090724 00:55:11 ------------------------- -* Add StartRoulette and StartRandom messages to MusicWheel. - -r044 | 20090719 12:45:55 ------------------------- -* Add SetPref to GameCommands. - -r043 | 20090719 01:10:30 ------------------------- -* patch by theDtTvB: http://share11.appspot.com/20421 -(some parts relating to Player.cpp later reverted) - -r042 | 20090718 15:16:42 ------------------------- -* Add conf,PercentageScoring. - -r041 | 20090718 14:53:25 ------------------------- -Add more internal font mappings: -* auxc -* auxd -* auxz -* auxwhite -* auxblack -* auxlb -* auxrb -* auxlt -* auxrt - -r040 | 20090718 12:56:46 ------------------------- -New ThemeManager Lua bindings: -* GetCurrentThemeDirectory -* ReloadMetrics - -r039 | 20090712 14:56:36 ------------------------- -* ActorScroller: add GetNumItems binding. -* ThemeManager: add bindings for GetThemeDisplayName() and - GetThemeDisplayAuthor() (for the current theme only). -* Refreshing the metrics now also refreshes the Scripts directory. - This may cause a problem for certain scripts. - -r038 | 20090711 02:07:19 ------------------------- -* Add GAMESTATE:IsBattleMode() binding. - -r037 | 20090711 01:37:29 ------------------------- -* "smoke this joint" patch: Fixes songs with only Edit steps from crashing. - (like Slam This Joint, hence the name of this patch) -* Lights fix from ??? - -r036 | 20090708 11:47:22 ------------------------- -* (sync with SM4SVN: LightsManager.cpp, ScreenGameplay.cpp) - -r035 | 20090707 02:42:22 ------------------------- -* Add GetProfileDir() binding to ProfileManager. -* Added ProfileSlotNames enum. -* Add broadcasted message "SongChosen" on ScreenSelectMusic. - -r034 | 20090626 20:50:00 ------------------------- -* Allow meters to go up to 20 in Edit Mode. - -r033 | 20090623 13:59:38 ------------------------- -* Added io, os, and packages to Lua bindings. Some of these are dangerous. - Don't use them. - -* Fix instance in ScreenSelectMaster where hitting Up wouldn't count as going - backwards. - -r032 | 20090617 20:42:44 ------------------------- -* Add Overlay shader. - -r031 | 20090615 18:38:22 ------------------------- -* Add bindings to Song: - * GetMusicPath - * GetCDTitlePath - * GetLyricsPath - * IsEnabled - * HasStepsType - * HasMusic - * HasBanner - * HasBackground - * HasCDTitle - * HasBGChanges - * HasLyrics - * GetBPMAtBeat - * GetBeatFromElapsedTime - * GetElapsedTimeFromBeat - * HasSignificantBpmChangesOrStops - * HasEdits - * IsEasy -* Add bindings to Steps: - * IsAnEdit - * IsAPlayerEdit - * GetHash - * disabled stub for GetSMNoteData (untested) - -r030 | 20090615 17:27:52 ------------------------- -* (sync with SM4SVN) - -r029 | 20090615 16:27:53 ------------------------- -More Lua bindings: -* PlayerStageStats:FullComboOfScore(tns) -* RageFileManager is now accessible through FILEMAN with these bindings: - * FILEMAN:DoesFileExist(path) - * FILEMAN:GetHashForFile(path) -* Song:GetSongFilePath() - -r028 | 20090612 19:05:05 ------------------------- -* Work-in-progress bindings for ActorSound: - * pause - * stop -* Work-in-progress bindings for RageSound: - * volume - * SetStopMode - -r027 | 20090529 16:55:44 ------------------------- -(sync with SM4SVN: Archer adding 5:4 support) - -r026 | 20090527 23:53:45 ------------------------- -Add three new Lua bindings to RageFile: -* GetError -* ClearError -* AtEOF - -r025 | 20090525 02:25:51 ------------------------- -* Actor.cpp: add GetDiffuse() Lua binding -* (sync with SM4SVN: Player.cpp) - -r024 | 20090523 17:06:33-20090524 13:06:42 ------------------------------------------- -* (sync with SM4SVN) - -r023 | 20090523 00:58:16 ------------------------- -* Add glowramp to Actor -* (more changes from SM4SVN) - -r022 | 20090519 21:27:16 ------------------------- -* Soft shuffle stub. - -r021 | 20090518 17:50:49 ------------------------- -* (changes from SM4SVN: Frieza and Wolfman [OnlyPreferredDifficulties]) - -r020 | 20090517 20:11:19 ------------------------- -Add more internal font mappings: -* auxa -* auxb -* auxy -* auxl -* auxr - -r019 | 20090517 19:12:31 ------------------------- -New RageFile bindings: -* Seek -* Tell - -r018 | 20090513 04:44:00 ------------------------- -ActorScroller changes: -* Can now actually set size of the mask with SetMask -* Add more Lua bindings: - * SetNumItemsToDraw - * GetFullScrollLengthSeconds - * GetCurrentItem - * GetDestinationItem - -r017 | 20090509 12:52:13 ------------------------- -Add skewy to valid Actor commands. - -r016 | 20090505 14:08:09 ------------------------- -(SM4SVN r28060, r28060) - -r015 | 20090505 12:09:54 ------------------------- -(changes from SM4SVN: ComboMultiplier by Frieza in ScoreKeeperNormal) - -r014 | 20090502 21:31:13 ------------------------- -Add bindings to Song: -* GetDisplaySubTitle -* GetTranslitSubTitle - -r013 | 20090502 16:10:05 ------------------------- -Add GetThemeAuthor() to ThemeManager. - -r012 | 20090502 14:51:38 ------------------------- -(changes from SM4SVN: ScreenSelect* changes by Frieza) - -r011 | 20090502 02:54:54 ------------------------- -* Housekeeping. -* Add more Lua bindings to PlayerStageStats: - * GetCurrentMissCombo - * GetCurrentPossibleDancePoints - * GetAliveSeconds - -r010 | 20090502 02:26:43 ------------------------- -add MD5 String/File and SHA1 String hashing via Lua: -* CRYPTMAN:MD5String(str) -* CRYPTMAN:MD5File(path) -* CRYPTMAN:SHA1String(str) - -r009 | 20090502 02:25:46 ------------------------- -Add GetText() binding to BPMDisplay. - -r008 | 20090502 02:25:28 ------------------------- -Add GetServerName() binding to NetworkSyncManager. - -r007 | 20090502 01:58:19 ------------------------- -Make ScreenDebugOverlay use its own fonts: -* ScreenDebugOverlay header -* ScreenDebugOverlay page -* ScreenDebugOverlay line - -r006 | 20090501 20:01:52 ------------------------- -(changes from SM4SVN: tons of changes by Frieza) - -r005 | 20090425 16:17:39 ------------------------- -(changes from SM4SVN: GameManager.cpp, RollingNumbers.cpp) - -r004 | 20090419 00:37:05 ------------------------- -Add new Lua bindings to TimingData: -* HasBpmChanges -* GetBpms (untested) -* GetStops (untested) - -r003 | 20090419 00:15:04 ------------------------- -Make changes to a number of files making the crash explanations more detailed: -* Actor.cpp - PercentThroughEffect, PercentBetweenColors, DeltaTime -* Attack.cpp -* GameManager.cpp -* GameState.cpp -* InputFilter.cpp -* NoteData.cpp - -r002 | 20090418 23:54:23 ------------------------- -* Remove ScreenEz2SelectPlayer, which only the Xbox project still referenced. - -r001 | 20090418 22:51:30 ------------------------- -Initial commit. -_____________________________________________________________________________ -Footnotes: -* The actual revision numbers are different for various reasons. - -1) Currently, sm-ssc is being held in the general purpose SSC SVN repository, -which includes other projects, such as themes and non-StepMania related items. -What's called r001 in this changelog is actually r285 of the SSC SVN repo. -r107 in the changelog is r1146 in the SSC SVN repo, just to give you an idea -of something more recent. - -2) Other projects are being developed within sm-ssc (as demonstrations of some -of the more advanced things you can do with the platform) and are best served -living within the repository for the time being. - -3) The commit logs in here are distilled over the reality of our commits. -This is done for a few reasons. The first is that some changes span multiple -commits... let's compare what the changelog says is r106 with the actual -commits in a similar format to the changelog. Everything you see after the -dashes is the actual uncut and unchanged commit log messages. Commit numbers -use the actual SSC SVN revisions. - -r1136 | 20091115 20:43:48 -[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] -------------------------- -howl did it -http://www.stepmania.com/forums/showthread.php?p=157603#post157603 - -r1137 | 20091115 21:05:36 -[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] -------------------------- -howl's additions to his patch - -r1138 | 20091115 21:26:50 -[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] -------------------------- -another update to howl's patch - -r1138 | 20091115 21:33:28 -[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] -------------------------- -i bet howl updates it yet again - -================================================================== -For the most part, the commit logs that the sm-ssc devs (AJ, Midiman, and -shakesoda) enter aren't always the most descriptive. Some of them are also -not really safe for viewing. :s - -Plus, the rewrites let us expand on what was originally written in the commit -log, and/or edit it for better readability. - -(Also let it be said that those logs aren't the norm for commits. The ones -I end up doing are similar to what ends up in the changelog, mainly for my own +sm-ssc Changelog (mainly source code related) +_________________________________________________________________________ +All changelogs go by SVN revision number* for the time being. + +Not all changes are documented, as some were later reverted and other +features are meant to be undocumented for various reasons. + +Some changes are grouped together even though the commits may have +happened at different times. + +All times are in 24 hour format, Central Standard Time (UTC-6) unless between +dates where daylight savings time is in effect in the United States (then +it's UTC-5). +_____________________________________________________________________________ + +sm-ssc Private Beta Wave 1.1 | 20091208 +--------------------------------------- +The next Private Beta release will be termed Wave 1.1, and will be released +to current sm-ssc beta testers on December 8th, 2009. + +Bugfixes aren't listed here unless they're source code-related, usually. +See the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ for bugs/feature +requests and their status. + +In addition to the bugfixes, the following changes have been made: + +r130 | 20091203 15:17:13 +------------------------ +Two new GameCommands: +* fademusic,fVolume,fDuration (though I wish fDuration was how long to fade the + music for; instead the fade lengths are consts in GameSoundManager.) +* pushscreen,sScreenName (though it doesn't push screens like I had thought it + would. maybe I'm doing it wrong.) [AJ] + +r129 | 20091202 21:56:54 +------------------------ +Modified character camera values. [shakesoda] + +r128 | 20091202 01:16:28 +------------------------ +* Profile name max length changed from 12 to 32 characters. + +r127 | 20091201 23:43:10 +------------------------ +* [ScreenSelectMusic] new metric SamplePreviewMusicMode, which has one of two + possible values as of r127. 'SamplePreviewMusicMode_Normal' is business as + usual (sample music plays), while 'SampleMusicPreviewMode_ScreenMusic' + disables song samples, using /{theme}/Sounds/ScreenSelectMusic loop music.* + as the file to play. No, this doesn't support Lua music yet. [AJ] + +sm-ssc Private Beta Wave 1 | 20091201 +------------------------------------- +The list below comprises sm-ssc Private Beta Wave 1's changes. Some of the +changes are from baseline StepMania 4 SVN, in order to keep compatibility. + +r126 | 20091130 23:18:28 +------------------------ +* Add improved cel shading for people with GLSL support. [shakesoda] + +r125 | 20091130 18:18:43 +------------------------ +* [Course.cpp] GetPlayMode() and GetCourseType() return actual enums now, + instead of numbers. + +r124 | 20091130 14:45:37 +------------------------ +* [StepMania.cpp] (any)Shift+F2 = reload metrics only. + F2 = reload metrics and textures. + +r123 | 20091129 14:42:34 +------------------------ +* [TimingData] add GetActualBPM() Lua binding that returns a table holding the + min and max BPMs, in that order. + +r122 | 20091127 23:31:32 +------------------------ +* Add OptionsListTimeout [shakesoda] + +r121 | 20091127 15:57:10 +------------------------ +* Disable color keying banners (it's 2009, I don't think anyone is using the + old rotated banners anymore. -aj) [shakesoda] + +r112-r120 | 20091126 17:28:56-22:13:57 (SSC turkey day) +------------------------------------------------------- +* [Song] new Lua bindings: NormallyDisplayed(), GetStepsSeconds() +* Themes will load Lua scripts from subdirectories first now. + +r111 | 20091122 10:21:30 +------------------------ +* [ArchHooks_Unix] Follow user's system language as default. + [David Santamara Rogado (howl)] + See http://www.stepmania.com/forums/showthread.php?t=21471 for more info. + +r110 | 20091120 14:03:17 +------------------------ +* Fixed a crash with lifemultipliers > 1.0 in debug builds + +r109 | 20091117 11:05:29 +------------------------ +* F2 reloads metrics again, just like in StepMania 3.9. (This is probably one + of those changes that won't get backported to baseline StepMania...) +* [ScoreKeeperNormal] version 0.5 of ToastyTriggersAt added; only allows for + one value, unlike 3.9+ (which used a String with multiple values). The final + version will use a Lua table, similar to [MusicWheel] SortOrders. + +r108 | 20091116 02:19:05 +------------------------ +* [CharacterManager] GetAllCharacters() Lua binding added. + +r107 | 20091116 02:03:41 +------------------------ +* [Character] new Lua bindings: GetModelPath(), GetRestAnimationPath(), + GetWarmUpAnimationPath(), GetDanceAnimationPath() +* [CharacterManager] GetRandomCharacter() Lua binding added +* [RageFileManager] GetDirListing(sPath,bOnlyDirs,bPathToo) Lua binding added + +r106 | 20091115 21:33:28 +------------------------ +* Prevent focus lost at Fullscreen on X11, fix windowed->fullscreen resolution + changes so that they save [David Santamara Rogado (howl)] + (http://www.stepmania.com/forums/showthread.php?t=21430) + +r105 | 20091114 15:07:58 +------------------------ +* Add support for .oga and .ogv files. [David Santamara Rogado (howl)] + (http://pastie.org/698741) + +r104 | 20091113 22:13:47 +------------------------ +* Fix a crash in StepsDisplay that allows Course mode to at least run. + +r103 | 20091113 21:23:42 +------------------------ +* sm4svn r28233 [Glenn Maynard]: + "Fix ThemeMetric<EnumType> gives the first value of the enum when the theme + metric is nil, instead of EnumType_INVALID. + This happened because ThemeMetric was setting the value to its default, + eg. EnumType(), when LuaHelpers::FromStack returned false. + This behavior doesn't make sense in the general case, since EnumType() results + in an arbitrary value (the first one) rather than Invalid. Every FromStack + function sets a reasonable default on invalid data, anyway, and only RageColor + and enums can return false in any case. + This fixes CustomDifficulty when CourseType = nil." + +r102 | 20091111 04:00:46 +------------------------ +* MusicWheelItem SetMessage has a new param, Type (string that returns the + item type). +* Add sort songs by most recently played. (As of this writing, it's not + feature-complete yet.) + +r101 | 20091109 19:33:55 +------------------------ +* Implemented David Santamara Rogado (howl)'s patch for loading Splash.png instead of an .xpm +(http://www.stepmania.com/forums/showpost.php?p=157340&postcount=3) + +r089-100 | 20091103 01:45:01 - 20091109 04:01:31 +------------------------------------------------ +Okay let's just say it's r089 to r100 and call it a week. + +* Changes from SM4SVN: + * r28211: [HighScore.cpp] "logic fixup" [Glenn Maynard] + * r28215: "default to showing backgrounds in editor" [Chris Danford] + * r28217: "Fix crash on reload metrics due to faulty FlushDirCache logic." + [Steve Checkoway], implemented along with code that was originally submitted + as r076 but removed. See this fix log to figure out why we'd bother. :) + * r28218: "crash handler is crashing in 2.6.31 in GetBacktrace, causing a + recursive crash handler crash that we aren't handling, leading to recursion" + [Glenn Maynard] + * r28219: "add 'DIRRO' driver for read-only access" [Glenn Maynard] + * r28220: "fix confusing comment. Escaping doesn't affect this; commas aren't + escaped, since they're split from the value itself, long after MsdFile is + loaded." [Glenn Maynard] (We'll be keeping the 1,1,1,1 colors in sm-ssc, and + may provide a compatibility script for SM4SVN, so be on the lookout.) + * r28221: "allow overriding, like PRODUCT_ID" [Glenn Maynard] + * r28222-28223: "adding support for pms files" [GRIM657] + * The pulseaudio patch [David Santamara Rogado (howl), Ondřej Hošek, Damien Thébault] + (see http://www.stepmania.com/forums/showthread.php?t=21348) + * Greg Nadja's OpenGL/Windows patch + +* sm-ssc Changes: + * [ScreenSelectMusic.cpp] Add SelectMenuInputMessage, has params Player and + Button. Broadcast messages when holding select and a button other than Select + is pushed. + * Windowed mode is now the default display mode. + * [HighScore.cpp] new Lua bindings: + * GetModifiers() + * GetTapNoteScore(TapNoteScore) + * GetHoldNoteScore(HoldNoteScore) + * GetRadarValues() + * [ProfileManager.cpp] added IsSongNew(Song) Lua binding + +r088 | 20091101 12:19:47 +------------------------ +* SM4SVN r28203-28208, all by Glenn Maynard. + * r28203: "skip exporting round data when nothing was played (no taps, no holds)" + * r28204: "fix signatures not being written" (we had this already) + * r28205: "don't fail if there's no course; just hide" + * r28206: "move course rename and delete into Overview" + * r28208: "disable rename and delete for courses that havn't been saved yet" +r28207 was a theme edit. + +r087 | 20091029 15:48:06 +------------------------ +sm4svn r28202: helper for cycling through an enum [Glenn Maynard] + +r086 | 20091028 22:20:40 +------------------------ +sm4svn r28201: "refactor RageInput to not call GetDevicesAndDescriptions +constantly; it can be slightly complex and get called thousands of +times a second" [Glenn Maynard] + +r085 | 20091027 18:17:54 +------------------------ +* Allow for Codes on ScreenGameplay. +* New Lua bindings for ScreenGameplay: + * PauseGame(bool) - Pauses/unpauses the game. + * IsPaused() - returns true or false depending on if the game is paused or not. + +r084 | 20091027 04:40:01 +------------------------ +* SM4SVN r28198-28200 + * r28198: Fix GetFileSizeInBytes to return an int instead of unsigned. + "this returns -1 on error (this should actually be 64-bit, + but that's a bigger change)" [Glenn Maynard] + * r28199: The official log is as follows: + "Hack to get the decorations to be deleted. Fixes crashes, + but probably not the best way to go about this." + In addition to doing this, it adds GetChildren() to ActorFrame in the + code itself. (It already existed in Lua, I just felt like pointing + this out. :D) [Steve Checkoway] + * r28200: The official log is as follows: + "Do not use an AutoActor to keep track of the children." + However, this also fixes the hack in r28200. [Steve Checkoway] + +r083 | 20091015 02:52:45 +------------------------ +* Support loading Lua scripts from subdirectories of the Scripts folder, + to allow for better organization. The scripts in the root Scripts folder + will run first, then any Lua scripts in subdirectories of the Scripts folder + will be run. It currently only works with one folder depth, for example: + Scripts/subfolder/script.lua. + + This is not likely to be changed. If you can see a possible need for paths + like Scripts/subfolder/subfolder2/script.lua, please make a Feature Request + ticket on the bugtracker at http://ssc.ajworld.net/sm-ssc/bugtracker/ with + an explanation of what you have in mind. + +r082 | 20091012 02:53:51 +------------------------ +* Change BitmapText defaults to no stroke + no shadow. +* Added DefaultTheme preference in order to fix crashes. + (sm-ssc's fallback theme is _fallback [and therefore normally unselectable].) + +r081 | 20091005 22:13:23 +------------------------ +* [NotesLoaderSM.cpp] Changes based on SM4SVN r28197 [Archer] + +r080 | 20091002 15:56:01 +------------------------ +* Event Mode turned on by default, as it should be. :) + +r079 | 20090925 21:20:49 +------------------------ +* SM4SVN r28192-28196. + * r28192: HexToBinary for RString -> RString. [Glenn Maynard] + * r28193: show all songs in EditCourse, not just preferred songs [Chris Danford] + * r28194: [ScreenDebugOverlay] Glenn made this themeable in SM4SVN, finally + catching up. This means we've had to rename a few things: + * DebugMenuHeader -> HeaderText + * PageName -> PageText + ButtonText and FunctionText were added, as well. + The font names remain the same, only the metrics change. + (Can you believe they're still using Common normal as the font?) + * r28195,28196: fix ComboChanged message sent when m_bSendJudgmentAndComboMessages + is false, fix doing unnecessary work in multiplayer [Glenn Maynard] + +r078 | 20090920 00:43:33 +------------------------ +* [StepsDisplay] Fixed it so it actually shows up again. + +r077 | 20090919 20:31:54 +------------------------ +Happy talk like k//eternal day! +* [Font.cpp] Don't show strokes by default. +* [NoteDisplay] fRotation -> fRotationZ in anticipation of multiple rotation mods. +* [PaneDisplay] changed one thing that used a goto; doesn't use it anymore. seems to work for me, though I'm not 100% sure. +* [ThemeManager] don't reload Lua scripts when you reload the metrics. + This is a temporary fix, and may be deemed safe at some point in the future. + +r076 | 20090914 03:42:25 +------------------------ +* SM4SVN r28190,28191 (25 files worth). This was later reverted, as it caused +reloading the metrics to crash. Since sm-ssc is primarily for themers, this is a +dealbreaker. A lot of things were unofficially added to sm-ssc at this point: + +* [ActorFrame] Added RemoveAllChildren() and RemoveChild(sName) bindings. + These are not guaranteed to work. Don't use them. They are very dangerous. +* [IniFile] added Lua's '--' syntax for commenting (along with '//' and '#', + which were already supported). +* New blend modes Modulate (subject to renaming later) and AlphaMultiply. +* [RageUtil] Added various bindings for formatting time that were already built + into StepMania: SecondsToHHMMSS, SecondsToMMSSMsMs, SecondsToMMSSMsMsMs, + SecondsToMSS, SecondsToMMSS. All bindings take in a float (number of seconds). +* [RageUtil] Added IsHexVal(string) binding. +* Added groups to sort length (based on BPM ranges), so the songs no longer + show up without groups. + +r075 | 20090914 00:41:36 +------------------------ +* SM4SVN r28189. + +r074 | 20090913 12:52:05 +------------------------ +* SM4SVN r28180-28185. + +r073 | 20090913 01:57:12 +------------------------ +* Added WeightedMultiply and InvertDest blend modes to Direct3D. + +r072 | 20090912 17:15:16 +------------------------ +* Change decorations draw order so it breaks things less. + +r071 | 20090911 01:29:41 +------------------------ +* "hidden" removed from Actor commands. It was deprecated. + A compatibility alias was added to replicate its functionality. However, this + will not work with NoteSkins, so be sure to make sure to check them for the + use of hidden. + + Handy replacement guide: + hidden,true / hidden,1 = visible,false + hidden,false / hidden,0 = visible,true + +r070 | 20090907 03:01:22 +------------------------ +* Add Sprite:CropTo() function + Lua binding. + +r069 | 20090906 03:59:10 +------------------------ +* Base theme changed from "default" to "_fallback". + As a result, all themes will fallback on _fallback. + _fallback is more or less the SM4SVN default. + +r068 | 20090905 21:05:17 +------------------------ +* [ScreenWithMenuElements.cpp, ThemeManager.cpp] Load and parse Lua as music. + This makes conditional music possible. + +r067 | 20090905 19:00:37 +------------------------ +* add URLEncode Lua binding to RageUtil. + +r066 | 20090904 14:19:28 +------------------------ +* Change many things on ScreenEdit to go 5 decimal places instead of 3. +* Beginnings of Xbox controller mappings for edit mode (untested) +* [REDACTED] preference renamed to be less specific but more accurate. + +r065 | 20090903 04:21:31 +------------------------ +* Binding naming format changed for BPM bindings. Always uses all caps BPM. + Changes in the codebase due to this: + * [Song] HasSignificantBpmChangesOrStops -> HasSignificantBPMChangesOrStops + * [TimingData] HasBpmChanges -> HasBPMChanges +* [TimingData] New bindings. (GetStops, GetBPMsAndTimes) +* [ScreenPackages] attempt to not call MoveLeft by duplicating code. + Seemed to work okay. + +r064 | 20090831 02:53:36 +------------------------ +* [ActorScroller] Make naming of commands consistent (some were all lowercase, + some were CamelCase), all are now CamelCase. + todo: add aliases in the _fallback theme for compatibility with + regular SM4 themes. + +r063 | 20090831 02:48:44 +------------------------ +ScreenPackages changes: +* Backgrounds from Sprites to AutoActors (Lua can be used now). +* DefaultUrl metric added. + +r062 | 20090829 04:00:16 +------------------------ +* Add metric for determining how to judge jumps: + [Gameplay] LastOrMinimumTapNoteScore + and an enum (TapNoteScoreJudgeType) to go with it. This idea was inspired + by PumpMania (Zmey, et al). + (This commit was later reverted, as it caused crashes.) + +r061 | 20090828 00:29:08 +------------------------ +* Added ScreenGameplay:GetPlayerInfo(PlayerNumber) Lua binding + +r060 | 20090827 03:27:21 +------------------------ +* Added LifeChanged message to LifeMeterBattery, meaning certain hackily-coded + custom life meters by a certain SSC member can work in Oni mode again. ;) +* MAX_EDIT_STEPS_SIZE_BYTES changed from 30KB to 60KB. +* Added --theme= and --language= command line options. + +r059 | 20090826 03:16:45 +------------------------ +* SSE2 build configuration (Visual Studio 2008 project files only). +* new Lua bindings for WheelBase: IsSettled(), IsLocked() + +r058 | 20090822 16:14:18 +------------------------ +* Implement --version command line argument. Prints out the version of sm-ssc. + Please build sm-ssc with HAVE_VERSION_TIME if possible. Untested on Linux/Mac. + +r057 | 20090822 03:21:14 +------------------------ +* add beginner meter sort + +r056 | 20090821 00:19:23 +------------------------ +* SM4SVN r28172-28174. + +r055 | 20090810 14:48:34 +------------------------ +* [GameCommand.cpp] add GetUrl() Lua binding. +* [GameManager.cpp] add IsGameEnabled(Game) Lua binding. +* removing player color diffuse commands, in the hopes this can be replicated + using Lua commands. + [GrooveRadar.cpp, ScoreDisplayLifeTime.cpp, ScreenSelectMusic.cpp] +* [CommandLineActions] Version() stub; when implemented, should print out + version number and quit. +* [GrooveRadar] name m_GrooveRadarValueMap "RadarValueMap(P1/P2)" + (commands untested); new todo note in header file +* [ScoreDisplayOni.cpp] give it a name ("ScoreDisplayOni Numbers") and run + commands. (untested) +* various pedantic edits, maybe some commenting + [Actor.cpp, GameCommand.cpp, MusicWheel.cpp, NotesLoaderBMS.cpp, + ScreenSelect.cpp] + +r054 | 20090810 14:36:10 +------------------------ +* SM4SVN r28170 (vdl's fixes for Xbox building; he says they should be tested.) + +r053 | 20090815 07:18:10 +------------------------ +* add GetPathO() Lua binding + +r052 | 20090810 12:09:00 +------------------------ +* SM4SVN r28140-r28166 (code changes only) + +r051 | 20090808 03:11:39 +------------------------ +* SM4SVN r28135, r28137, r28138 +* Lossless screenshots now save as PNG. +* Conversion of decorations to not be children of the screen; they load in + a similar fashion to overlay/underlay, but still using LoadB so everything + works correctly. (Tested against SM4 default theme for compatibility.) + +r050 | 20090729 22:57:52 +------------------------ +* add GetRotationX, GetRotationZ commands to Actor +* add urlnoexit game command, which won't exit upon loading the browser. +* add OldHealthState to HealthStateChanged message on ScreenGameplay + +r049 | 2009072? ??:??:?? +------------------------ +* [REDACTED] + +r048 | 20090726 18:36:41 +------------------------ +* (untested) GrooveRadar plays commands on the frame now, +allowing for customized in and out transitions, using the +TweenOnScreen/TweenOffScreen Commands. +* add PlayerController enum binding +* add PlayerState:GetPlayerController() [untested] + +r047 | 20090725 20:30:19 +------------------------ +ScreenDebugOverlay changes: +* add OnCommand, X, Y to Debug Header +* add GainFocus/LoseFocus commands to page names +* add LineOnColor/LineOffColor + +r046 | 20090724 00:55:11 +------------------------ +* Fix default stroke color and shadow length. (BitmapText) + +r045 | 20090724 00:55:11 +------------------------ +* Add StartRoulette and StartRandom messages to MusicWheel. + +r044 | 20090719 12:45:55 +------------------------ +* Add SetPref to GameCommands. + +r043 | 20090719 01:10:30 +------------------------ +* patch by theDtTvB: http://share11.appspot.com/20421 +(some parts relating to Player.cpp later reverted) + +r042 | 20090718 15:16:42 +------------------------ +* Add conf,PercentageScoring. + +r041 | 20090718 14:53:25 +------------------------ +Add more internal font mappings: +* auxc +* auxd +* auxz +* auxwhite +* auxblack +* auxlb +* auxrb +* auxlt +* auxrt + +r040 | 20090718 12:56:46 +------------------------ +New ThemeManager Lua bindings: +* GetCurrentThemeDirectory +* ReloadMetrics + +r039 | 20090712 14:56:36 +------------------------ +* ActorScroller: add GetNumItems binding. +* ThemeManager: add bindings for GetThemeDisplayName() and + GetThemeDisplayAuthor() (for the current theme only). +* Refreshing the metrics now also refreshes the Scripts directory. + This may cause a problem for certain scripts. + +r038 | 20090711 02:07:19 +------------------------ +* Add GAMESTATE:IsBattleMode() binding. + +r037 | 20090711 01:37:29 +------------------------ +* "smoke this joint" patch: Fixes songs with only Edit steps from crashing. + (like Slam This Joint, hence the name of this patch) +* Lights fix from ??? + +r036 | 20090708 11:47:22 +------------------------ +* (sync with SM4SVN: LightsManager.cpp, ScreenGameplay.cpp) + +r035 | 20090707 02:42:22 +------------------------ +* Add GetProfileDir() binding to ProfileManager. +* Added ProfileSlotNames enum. +* Add broadcasted message "SongChosen" on ScreenSelectMusic. + +r034 | 20090626 20:50:00 +------------------------ +* Allow meters to go up to 20 in Edit Mode. + +r033 | 20090623 13:59:38 +------------------------ +* Added io, os, and packages to Lua bindings. Some of these are dangerous. + Don't use them. + +* Fix instance in ScreenSelectMaster where hitting Up wouldn't count as going + backwards. + +r032 | 20090617 20:42:44 +------------------------ +* Add Overlay shader. + +r031 | 20090615 18:38:22 +------------------------ +* Add bindings to Song: + * GetMusicPath + * GetCDTitlePath + * GetLyricsPath + * IsEnabled + * HasStepsType + * HasMusic + * HasBanner + * HasBackground + * HasCDTitle + * HasBGChanges + * HasLyrics + * GetBPMAtBeat + * GetBeatFromElapsedTime + * GetElapsedTimeFromBeat + * HasSignificantBpmChangesOrStops + * HasEdits + * IsEasy +* Add bindings to Steps: + * IsAnEdit + * IsAPlayerEdit + * GetHash + * disabled stub for GetSMNoteData (untested) + +r030 | 20090615 17:27:52 +------------------------ +* (sync with SM4SVN) + +r029 | 20090615 16:27:53 +------------------------ +More Lua bindings: +* PlayerStageStats:FullComboOfScore(tns) +* RageFileManager is now accessible through FILEMAN with these bindings: + * FILEMAN:DoesFileExist(path) + * FILEMAN:GetHashForFile(path) +* Song:GetSongFilePath() + +r028 | 20090612 19:05:05 +------------------------ +* Work-in-progress bindings for ActorSound: + * pause + * stop +* Work-in-progress bindings for RageSound: + * volume + * SetStopMode + +r027 | 20090529 16:55:44 +------------------------ +(sync with SM4SVN: Archer adding 5:4 support) + +r026 | 20090527 23:53:45 +------------------------ +Add three new Lua bindings to RageFile: +* GetError +* ClearError +* AtEOF + +r025 | 20090525 02:25:51 +------------------------ +* Actor.cpp: add GetDiffuse() Lua binding +* (sync with SM4SVN: Player.cpp) + +r024 | 20090523 17:06:33-20090524 13:06:42 +------------------------------------------ +* (sync with SM4SVN) + +r023 | 20090523 00:58:16 +------------------------ +* Add glowramp to Actor +* (more changes from SM4SVN) + +r022 | 20090519 21:27:16 +------------------------ +* Soft shuffle stub. + +r021 | 20090518 17:50:49 +------------------------ +* (changes from SM4SVN: Frieza and Wolfman [OnlyPreferredDifficulties]) + +r020 | 20090517 20:11:19 +------------------------ +Add more internal font mappings: +* auxa +* auxb +* auxy +* auxl +* auxr + +r019 | 20090517 19:12:31 +------------------------ +New RageFile bindings: +* Seek +* Tell + +r018 | 20090513 04:44:00 +------------------------ +ActorScroller changes: +* Can now actually set size of the mask with SetMask +* Add more Lua bindings: + * SetNumItemsToDraw + * GetFullScrollLengthSeconds + * GetCurrentItem + * GetDestinationItem + +r017 | 20090509 12:52:13 +------------------------ +Add skewy to valid Actor commands. + +r016 | 20090505 14:08:09 +------------------------ +(SM4SVN r28060, r28060) + +r015 | 20090505 12:09:54 +------------------------ +(changes from SM4SVN: ComboMultiplier by Frieza in ScoreKeeperNormal) + +r014 | 20090502 21:31:13 +------------------------ +Add bindings to Song: +* GetDisplaySubTitle +* GetTranslitSubTitle + +r013 | 20090502 16:10:05 +------------------------ +Add GetThemeAuthor() to ThemeManager. + +r012 | 20090502 14:51:38 +------------------------ +(changes from SM4SVN: ScreenSelect* changes by Frieza) + +r011 | 20090502 02:54:54 +------------------------ +* Housekeeping. +* Add more Lua bindings to PlayerStageStats: + * GetCurrentMissCombo + * GetCurrentPossibleDancePoints + * GetAliveSeconds + +r010 | 20090502 02:26:43 +------------------------ +add MD5 String/File and SHA1 String hashing via Lua: +* CRYPTMAN:MD5String(str) +* CRYPTMAN:MD5File(path) +* CRYPTMAN:SHA1String(str) + +r009 | 20090502 02:25:46 +------------------------ +Add GetText() binding to BPMDisplay. + +r008 | 20090502 02:25:28 +------------------------ +Add GetServerName() binding to NetworkSyncManager. + +r007 | 20090502 01:58:19 +------------------------ +Make ScreenDebugOverlay use its own fonts: +* ScreenDebugOverlay header +* ScreenDebugOverlay page +* ScreenDebugOverlay line + +r006 | 20090501 20:01:52 +------------------------ +(changes from SM4SVN: tons of changes by Frieza) + +r005 | 20090425 16:17:39 +------------------------ +(changes from SM4SVN: GameManager.cpp, RollingNumbers.cpp) + +r004 | 20090419 00:37:05 +------------------------ +Add new Lua bindings to TimingData: +* HasBpmChanges +* GetBpms (untested) +* GetStops (untested) + +r003 | 20090419 00:15:04 +------------------------ +Make changes to a number of files making the crash explanations more detailed: +* Actor.cpp - PercentThroughEffect, PercentBetweenColors, DeltaTime +* Attack.cpp +* GameManager.cpp +* GameState.cpp +* InputFilter.cpp +* NoteData.cpp + +r002 | 20090418 23:54:23 +------------------------ +* Remove ScreenEz2SelectPlayer, which only the Xbox project still referenced. + +r001 | 20090418 22:51:30 +------------------------ +Initial commit. +_____________________________________________________________________________ +Footnotes: +* The actual revision numbers are different for various reasons. + +1) Currently, sm-ssc is being held in the general purpose SSC SVN repository, +which includes other projects, such as themes and non-StepMania related items. +What's called r001 in this changelog is actually r285 of the SSC SVN repo. +r107 in the changelog is r1146 in the SSC SVN repo, just to give you an idea +of something more recent. + +2) Other projects are being developed within sm-ssc (as demonstrations of some +of the more advanced things you can do with the platform) and are best served +living within the repository for the time being. + +3) The commit logs in here are distilled over the reality of our commits. +This is done for a few reasons. The first is that some changes span multiple +commits... let's compare what the changelog says is r106 with the actual +commits in a similar format to the changelog. Everything you see after the +dashes is the actual uncut and unchanged commit log messages. Commit numbers +use the actual SSC SVN revisions. + +r1136 | 20091115 20:43:48 +[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] +------------------------- +howl did it +http://www.stepmania.com/forums/showthread.php?p=157603#post157603 + +r1137 | 20091115 21:05:36 +[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] +------------------------- +howl's additions to his patch + +r1138 | 20091115 21:26:50 +[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] +------------------------- +another update to howl's patch + +r1138 | 20091115 21:33:28 +[Modified /sm-ssc3/src/arch/LowLevelWindow/LowLevelWindowX11.cpp] +------------------------- +i bet howl updates it yet again + +================================================================== +For the most part, the commit logs that the sm-ssc devs (AJ, Midiman, and +shakesoda) enter aren't always the most descriptive. Some of them are also +not really safe for viewing. :s + +Plus, the rewrites let us expand on what was originally written in the commit +log, and/or edit it for better readability. + +(Also let it be said that those logs aren't the norm for commits. The ones +I end up doing are similar to what ends up in the changelog, mainly for my own convienence.) \ No newline at end of file diff --git a/Docs/opensource_simulators.txt b/Docs/opensource_simulators.txt index 90c234ece3..b95a0f45f0 100644 --- a/Docs/opensource_simulators.txt +++ b/Docs/opensource_simulators.txt @@ -1,17 +1,17 @@ -Some other rhythm game simulators are open source. -Here's where to find code. --------------------------------------------------------------------------------- -Delight Delight Reduplication [Boost Software License] -http://sourceforge.jp/projects/delight/svn/view/trunk/src/?root=delight - -Direct Move [unknown license] -http://zsoo.net/38 - -pydance [see http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/LICENSE] -http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/ - -be-pachi music [MIT license] -http://x-raise.cjb.net/bpm.html - -marfitude [GPL license] +Some other rhythm game simulators are open source. +Here's where to find code. +-------------------------------------------------------------------------------- +Delight Delight Reduplication [Boost Software License] +http://sourceforge.jp/projects/delight/svn/view/trunk/src/?root=delight + +Direct Move [unknown license] +http://zsoo.net/38 + +pydance [see http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/LICENSE] +http://kai.vm.bytemark.co.uk/svn/pydance/trunk/pydance/ + +be-pachi music [MIT license] +http://x-raise.cjb.net/bpm.html + +marfitude [GPL license] http://www.erestar.net/games/marfitude/ \ No newline at end of file diff --git a/Docs/steps.lua b/Docs/steps.lua index c5d1b0a826..4f8d015e9c 100644 --- a/Docs/steps.lua +++ b/Docs/steps.lua @@ -1,208 +1,208 @@ --- steps.lua: rough rough draft. Please don't use until finalized. --- ver 20100116 - --- shakesoda is going to be making this more generic for use in rhythm. - -local MetaTags = { - Title = {"Dyamite Rave","(transliteration)"}, - Subtitle = {"Down Bird Sota Mix","(transliteration)"}, - Artist = {"NAOKI","(transliteration)"}, - Genre = {"Scouse House","(transliteration)"}, - License = "CC-BY-NC", - URL = "http://shakesoda.org/" -} - ---[[ - If an int is used in a field that expects a time of some sort, it is - assumed to use beats. If it's a float, it assumes seconds instead. -]] - -local CacheData { - HasAttacks = true, - HasBanner = true, - HasBackground = true, - HasKeysounds = true, - HasLyrics = true, - HasMusic = true, - SongFileNames = "path/from/song/folder", - LongestChartLength = 220.000 -- use this to thwart the ogg length patch -} - -local MetaData = { - Attacks = { - -- start = length, startup time, mod string - 0 = { 10, 1.0, "mod,50% reverse" }, - 10 = { 5, 1.0, "mod,70% boost" } - }, - BannerPath = { "banner.png" }, -- can be an image, video, or lua - Background = { -- background changes. - Path = "background.png", - Animation = { -- can have as many changes as needed - --[[ - startTime = { path, rate, offset, commands } - Any ommitted arguments will default to nil, except for rate, which would use 1.0 - ]] - 0 = {"path/to/bga", 1.0, 0.000, 0, cmd(rainbow) }, - 0 = {"path/to/bga2", 1.0, 0.000, 0, cmd(thump) } - }, - }, - --[[ - -- #BGCHANGES2:32.000=flash=1.000=0=0=1=====, - BackgroundChanges2 = { - 32.000 = { "flash", 1.000, 0, 0, 1, [unk], [unk], [unk], [unk], [unk] }; - }, - ]] - BPMs = { 0.000 = 280.000 }, - CDTitle = "", - DisplayBPM = { 150, 300 }, -- can be either an array of two values to cycle or 'Random' - FormatRevision = 2, - InstrumentTracks = { - -- guitar hero/rock band - Guitar = "guitar.ogg", - Rhythm = "rhythm.ogg", - Bass = "bass.ogg", - -- dj hero - LeftDeck = "left.ogg", - RightDeck = "right.ogg", - }, - Keysounds = {}, -- I forget exactly how the SM format does this, but it'll be similar here. - LeadOut = 3, - Warps = { 5 = 4, 10 = 4 }, - LyricsPath = "Dynamite Rave.lrc", - Offset = 0.014, - Overlay = {}, -- same as Background, but without path. - PreviewMusic = { 50.000, 60.000 }, - Selectable = true, - Stops = { 156.000 = 0.540 }, - TimeSignatures = { 0.000 = "4/4" } -} - -local NoteCharts = { - { - ChartRevison = 20, - BPMs = { 0.000 = 140.000 }, -- override - Description = "Z. Nard", -- usually the chart author or "Copied from *" - Difficulty = 'Hard', -- "invalid" names will be assumed to be edits. - EditName = '', -- valid for all charts, typically only shows for edits. - Meter = '100', -- value clamped between 1 and 100, scaled to whatever works theme-side. - RadarValues = { - -- may not be 100%; won't be commented/linebroken in actual file - Stream = 0.931, - Voltage = 1.000, - Air = 0.439, - Freeze = 0.174, - Chaos = 0.156, - }, - Stats = { -- will probably have more i.e. fakes, lifts. - Total = 645, - Jumps = 48, - Holds = 19, - Mines = 3, - Hands = 0, - Rolls = 0 - }, - StepsType = 'Dance_Single', - Stops = { 140.000 = 0.860 }, -- override - TimeSignatures = { 0.000 = "4/4" }, -- override - NoteData = { - { -- measure 1 - -- row level - --{ column level }, works like this: - { 0,0,0,0 }, - { 0,0,0,0 }, - { 0,0,0,0 }, - { 0,0,0,1 = { SomeFunction(), 'TNS_GreaterThan', 'TapNoteScore_W5' } } -- example of assigning a function to a note. - }, - { -- measure 2 - -- row level - --{ column level } or in other words - { 0,0,0,0 }, - { 0,0,0,0 }, - { 0,0,0,0 }, - { 0,0,0,0 } - } - } - }, - -- second example chart - { - ChartRevison = 5, - BPMs = { 0.000 = 140.000 }, - Description = "B. McLargeHuge", - Difficulty = 'Expert', - EditName = '', - Meter = '60', - RadarValues = { - Stream = 0.931, - Voltage = 1.000, - Air = 0.439, - Freeze = 0.174, - Chaos = 0.156, - }, - Stats = { - Total = 16, - Jumps = 0, - Holds = 0, - Mines = 16, - Hands = 0, - Rolls = 0 - }, - StepsType = 'Dance_Single', - NoteData = { - { { 1,0,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,0,'m' }, }, - { { 0,1,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,'m',0 }, }, - { { 0,0,1,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,'m',0,0 }, }, - { { 0,0,0,1 }, { 0,0,0,0 }, { 0,0,0,0 }, { 'm',0,0,0 }, }, - { { 0,0,0,0 }, { 1,0,0,0 }, { 0,0,0,'m' }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,1,0,0 }, { 0,0,'m',0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,0,1,0 }, { 0,'m',0,0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,0,0,1 }, { 'm',0,0,0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,0,0,'m' }, { 1,0,0,0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,0,'m',0 }, { 0,1,0,0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 0,'m',0,0 }, { 0,0,1,0 }, { 0,0,0,0 }, }, - { { 0,0,0,0 }, { 'm',0,0,0 }, { 0,0,0,1 }, { 0,0,0,0 }, }, - { { 0,0,0,'m' }, { 0,0,0,0 }, { 0,0,0,0 }, { 1,0,0,0 }, }, - { { 0,0,'m',0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,1,0,0 }, }, - { { 0,'m',0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,1,0 }, }, - { { 'm',0,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,0,1 }, } - } - } -} - -local EditCharts = { - { - -- todo: uh..... (this is the internal version of the edits.) - -- should be like NoteData but with fewer available overrides. - } -} - --- this is a work in progress format. expect things to change as better ideas come about. --- this isn't how steps currently work internally. that can be dealt with. - ---[[ - Below is a minimal example file. - Just about every value that can be calculated or defaulted to something - reasonable has been omitted, and much extra whitespace reduced. -]] -MetaTags = { - Title = {"Black Lawn Finale", "long wait FINALLY"}, - Artist = {"The Flashbulb", "teh falshbald"} -} -MetaData = { - BannerPath = { "banner.png" }, - Background = { Path = "background.png" }, - BPMs = { 0.000 = 280.000 }, - FormatRevision = 1, - Offset = 0.028 -} -NoteCharts = { - { - Description = "S. Slabrock", - Difficulty = 'Difficulty_Medium', - Meter = '50', - StepsType = 'StepsType_Dance_Single', - NoteData = { - {{0,0,0,0},{0,0,1,0},{0,0,0,0},{0,0,0,1}}, -- measure of 4ths - {{0,1,0,0},{0,0,0,0},{0,1,0,0},{0,0,0,1},{0,0,0,0},{0,0,0,1},{0,0,0,0},{0,0,0,1}} -- measure of 8ths - } - } +-- steps.lua: rough rough draft. Please don't use until finalized. +-- ver 20100116 + +-- shakesoda is going to be making this more generic for use in rhythm. + +local MetaTags = { + Title = {"Dyamite Rave","(transliteration)"}, + Subtitle = {"Down Bird Sota Mix","(transliteration)"}, + Artist = {"NAOKI","(transliteration)"}, + Genre = {"Scouse House","(transliteration)"}, + License = "CC-BY-NC", + URL = "http://shakesoda.org/" +} + +--[[ + If an int is used in a field that expects a time of some sort, it is + assumed to use beats. If it's a float, it assumes seconds instead. +]] + +local CacheData { + HasAttacks = true, + HasBanner = true, + HasBackground = true, + HasKeysounds = true, + HasLyrics = true, + HasMusic = true, + SongFileNames = "path/from/song/folder", + LongestChartLength = 220.000 -- use this to thwart the ogg length patch +} + +local MetaData = { + Attacks = { + -- start = length, startup time, mod string + 0 = { 10, 1.0, "mod,50% reverse" }, + 10 = { 5, 1.0, "mod,70% boost" } + }, + BannerPath = { "banner.png" }, -- can be an image, video, or lua + Background = { -- background changes. + Path = "background.png", + Animation = { -- can have as many changes as needed + --[[ + startTime = { path, rate, offset, commands } + Any ommitted arguments will default to nil, except for rate, which would use 1.0 + ]] + 0 = {"path/to/bga", 1.0, 0.000, 0, cmd(rainbow) }, + 0 = {"path/to/bga2", 1.0, 0.000, 0, cmd(thump) } + }, + }, + --[[ + -- #BGCHANGES2:32.000=flash=1.000=0=0=1=====, + BackgroundChanges2 = { + 32.000 = { "flash", 1.000, 0, 0, 1, [unk], [unk], [unk], [unk], [unk] }; + }, + ]] + BPMs = { 0.000 = 280.000 }, + CDTitle = "", + DisplayBPM = { 150, 300 }, -- can be either an array of two values to cycle or 'Random' + FormatRevision = 2, + InstrumentTracks = { + -- guitar hero/rock band + Guitar = "guitar.ogg", + Rhythm = "rhythm.ogg", + Bass = "bass.ogg", + -- dj hero + LeftDeck = "left.ogg", + RightDeck = "right.ogg", + }, + Keysounds = {}, -- I forget exactly how the SM format does this, but it'll be similar here. + LeadOut = 3, + Warps = { 5 = 4, 10 = 4 }, + LyricsPath = "Dynamite Rave.lrc", + Offset = 0.014, + Overlay = {}, -- same as Background, but without path. + PreviewMusic = { 50.000, 60.000 }, + Selectable = true, + Stops = { 156.000 = 0.540 }, + TimeSignatures = { 0.000 = "4/4" } +} + +local NoteCharts = { + { + ChartRevison = 20, + BPMs = { 0.000 = 140.000 }, -- override + Description = "Z. Nard", -- usually the chart author or "Copied from *" + Difficulty = 'Hard', -- "invalid" names will be assumed to be edits. + EditName = '', -- valid for all charts, typically only shows for edits. + Meter = '100', -- value clamped between 1 and 100, scaled to whatever works theme-side. + RadarValues = { + -- may not be 100%; won't be commented/linebroken in actual file + Stream = 0.931, + Voltage = 1.000, + Air = 0.439, + Freeze = 0.174, + Chaos = 0.156, + }, + Stats = { -- will probably have more i.e. fakes, lifts. + Total = 645, + Jumps = 48, + Holds = 19, + Mines = 3, + Hands = 0, + Rolls = 0 + }, + StepsType = 'Dance_Single', + Stops = { 140.000 = 0.860 }, -- override + TimeSignatures = { 0.000 = "4/4" }, -- override + NoteData = { + { -- measure 1 + -- row level + --{ column level }, works like this: + { 0,0,0,0 }, + { 0,0,0,0 }, + { 0,0,0,0 }, + { 0,0,0,1 = { SomeFunction(), 'TNS_GreaterThan', 'TapNoteScore_W5' } } -- example of assigning a function to a note. + }, + { -- measure 2 + -- row level + --{ column level } or in other words + { 0,0,0,0 }, + { 0,0,0,0 }, + { 0,0,0,0 }, + { 0,0,0,0 } + } + } + }, + -- second example chart + { + ChartRevison = 5, + BPMs = { 0.000 = 140.000 }, + Description = "B. McLargeHuge", + Difficulty = 'Expert', + EditName = '', + Meter = '60', + RadarValues = { + Stream = 0.931, + Voltage = 1.000, + Air = 0.439, + Freeze = 0.174, + Chaos = 0.156, + }, + Stats = { + Total = 16, + Jumps = 0, + Holds = 0, + Mines = 16, + Hands = 0, + Rolls = 0 + }, + StepsType = 'Dance_Single', + NoteData = { + { { 1,0,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,0,'m' }, }, + { { 0,1,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,'m',0 }, }, + { { 0,0,1,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,'m',0,0 }, }, + { { 0,0,0,1 }, { 0,0,0,0 }, { 0,0,0,0 }, { 'm',0,0,0 }, }, + { { 0,0,0,0 }, { 1,0,0,0 }, { 0,0,0,'m' }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,1,0,0 }, { 0,0,'m',0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,0,1,0 }, { 0,'m',0,0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,0,0,1 }, { 'm',0,0,0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,0,0,'m' }, { 1,0,0,0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,0,'m',0 }, { 0,1,0,0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 0,'m',0,0 }, { 0,0,1,0 }, { 0,0,0,0 }, }, + { { 0,0,0,0 }, { 'm',0,0,0 }, { 0,0,0,1 }, { 0,0,0,0 }, }, + { { 0,0,0,'m' }, { 0,0,0,0 }, { 0,0,0,0 }, { 1,0,0,0 }, }, + { { 0,0,'m',0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,1,0,0 }, }, + { { 0,'m',0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,1,0 }, }, + { { 'm',0,0,0 }, { 0,0,0,0 }, { 0,0,0,0 }, { 0,0,0,1 }, } + } + } +} + +local EditCharts = { + { + -- todo: uh..... (this is the internal version of the edits.) + -- should be like NoteData but with fewer available overrides. + } +} + +-- this is a work in progress format. expect things to change as better ideas come about. +-- this isn't how steps currently work internally. that can be dealt with. + +--[[ + Below is a minimal example file. + Just about every value that can be calculated or defaulted to something + reasonable has been omitted, and much extra whitespace reduced. +]] +MetaTags = { + Title = {"Black Lawn Finale", "long wait FINALLY"}, + Artist = {"The Flashbulb", "teh falshbald"} +} +MetaData = { + BannerPath = { "banner.png" }, + Background = { Path = "background.png" }, + BPMs = { 0.000 = 280.000 }, + FormatRevision = 1, + Offset = 0.028 +} +NoteCharts = { + { + Description = "S. Slabrock", + Difficulty = 'Difficulty_Medium', + Meter = '50', + StepsType = 'StepsType_Dance_Single', + NoteData = { + {{0,0,0,0},{0,0,1,0},{0,0,0,0},{0,0,0,1}}, -- measure of 4ths + {{0,1,0,0},{0,0,0,0},{0,1,0,0},{0,0,0,1},{0,0,0,0},{0,0,0,1},{0,0,0,0},{0,0,0,1}} -- measure of 8ths + } + } } \ No newline at end of file diff --git a/Docs/versioning.txt b/Docs/versioning.txt index e904f74181..f5c45cb41a 100644 --- a/Docs/versioning.txt +++ b/Docs/versioning.txt @@ -1,12 +1,12 @@ -[as taken from src/ProductInfo.h] (before doxygen) - -Version info displayed to the user. - -These are the 'official' version designations: - * "experimental: pre-release versions - * "private beta v0.0": hmm, think about it for a second there. - ==Public versions below this line== - * "v0.0 alpha #": Alpha versions (bug squashing, polishing until we reach beta) - * "v0.0 beta #": Beta versions (bug squashing, _focus_ is on high priority bugs) - * "v0.0 rc#": Release Candidates (if there are no problems, move on to final) - * "v0.0": Final Releases +[as taken from src/ProductInfo.h] (before doxygen) + +Version info displayed to the user. + +These are the 'official' version designations: + * "experimental: pre-release versions + * "private beta v0.0": hmm, think about it for a second there. + ==Public versions below this line== + * "v0.0 alpha #": Alpha versions (bug squashing, polishing until we reach beta) + * "v0.0 beta #": Beta versions (bug squashing, _focus_ is on high priority bugs) + * "v0.0 rc#": Release Candidates (if there are no problems, move on to final) + * "v0.0": Final Releases diff --git a/Installer/custom.ini b/Installer/custom.ini index 1c195cf19e..840b11d4f9 100644 --- a/Installer/custom.ini +++ b/Installer/custom.ini @@ -1,47 +1,47 @@ -[Settings] -NumFields=5 - -[Field 1] -Type=Button -Flags=NOTIFY -Text=&Install -Left=160 -Right=-10 -Top=50 -Bottom=70 - -[Field 2] -Type=Button -Flags=NOTIFY -Text=&Play -Left=160 -Right=-10 -Top=30 -Bottom=50 - -[Field 3] -Type=Button -Flags=NOTIFY -Text=&Re-Install -Left=160 -Right=-10 -Top=60 -Bottom=80 - -[Field 4] -Type=Link -Text=http://www.urlhere.com -State=http://www.urlhere.com -Left=160 -Right=-10 -Top=130 -Bottom=140 - -[Field 5] -Type=Bitmap -Text=custom.bmp -Flags=TRANSPARENT -Left=0 -Right=150 -Top=0 +[Settings] +NumFields=5 + +[Field 1] +Type=Button +Flags=NOTIFY +Text=&Install +Left=160 +Right=-10 +Top=50 +Bottom=70 + +[Field 2] +Type=Button +Flags=NOTIFY +Text=&Play +Left=160 +Right=-10 +Top=30 +Bottom=50 + +[Field 3] +Type=Button +Flags=NOTIFY +Text=&Re-Install +Left=160 +Right=-10 +Top=60 +Bottom=80 + +[Field 4] +Type=Link +Text=http://www.urlhere.com +State=http://www.urlhere.com +Left=160 +Right=-10 +Top=130 +Bottom=140 + +[Field 5] +Type=Bitmap +Text=custom.bmp +Flags=TRANSPARENT +Left=0 +Right=150 +Top=0 Bottom=120 \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index 8e78419726..dc643eeddf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,35 +1,35 @@ -## Need 1.7 for subdir support. (Well, 1.4 doesn't work, I don't know if anything between does.) -AUTOMAKE_OPTIONS = 1.7 foreign -SUBDIRS = src -ACLOCAL_AMFLAGS = -I autoconf/m4 - -## Black magic (read: sed) for getting the product ID as defined in code, not by the autotools. -## Quotes are making vim's highlighting of this even worse, so just escape everything, -## including the escapes. Make it lowercase to match ArchHooks::MountInitialFileSystems(). -productID := $(shell sed -nr /define\\s+PRODUCT_ID_BARE/\{s/.*define\\s+PRODUCT_ID_BARE\\s+\(.+\)/\\1/\;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/\;p\;q\} $(srcdir)/src/ProductInfo.h) - -installFiles = src/stepmania -if HAVE_GTK -installFiles += src/GtkModule.so -endif - -.PHONY: SMData -SMData: - $(srcdir)/Utils/CreatePackage.pl $(srcdir) . - -dist-hook: SMData - mkdir -p $(distdir)/Packages - cp GameData.smzip $(distdir)/Packages - mkdir -p $(distdir)/Docs - cp $(srcdir)/Docs/Licenses.txt $(distdir)/Docs - cp $(srcdir)/Utils/build.sh $(distdir) - -install-data-hook: $(top_srcdir)/Packages/GameData.smzip - mkdir -p "$(DESTDIR)$(bindir)/$(productID)/Packages" - $(INSTALL) $(installFiles) "$(DESTDIR)$(bindir)/$(productID)" - $(INSTALL_DATA) $(top_srcdir)/Packages/GameData.smzip "$(DESTDIR)$(bindir)/$(productID)/Packages" - -uninstall-hook: - rm -f "$(DESTDIR)$(bindir)/$(productID)/stepmania" - rm -f "$(DESTDIR)$(bindir)/$(productID)/GtkModule.so" - rm -f "$(DESTDIR)$(bindir)/$(productID)/Packages/GameData.smzip" +## Need 1.7 for subdir support. (Well, 1.4 doesn't work, I don't know if anything between does.) +AUTOMAKE_OPTIONS = 1.7 foreign +SUBDIRS = src +ACLOCAL_AMFLAGS = -I autoconf/m4 + +## Black magic (read: sed) for getting the product ID as defined in code, not by the autotools. +## Quotes are making vim's highlighting of this even worse, so just escape everything, +## including the escapes. Make it lowercase to match ArchHooks::MountInitialFileSystems(). +productID := $(shell sed -nr /define\\s+PRODUCT_ID_BARE/\{s/.*define\\s+PRODUCT_ID_BARE\\s+\(.+\)/\\1/\;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/\;p\;q\} $(srcdir)/src/ProductInfo.h) + +installFiles = src/stepmania +if HAVE_GTK +installFiles += src/GtkModule.so +endif + +.PHONY: SMData +SMData: + $(srcdir)/Utils/CreatePackage.pl $(srcdir) . + +dist-hook: SMData + mkdir -p $(distdir)/Packages + cp GameData.smzip $(distdir)/Packages + mkdir -p $(distdir)/Docs + cp $(srcdir)/Docs/Licenses.txt $(distdir)/Docs + cp $(srcdir)/Utils/build.sh $(distdir) + +install-data-hook: $(top_srcdir)/Packages/GameData.smzip + mkdir -p "$(DESTDIR)$(bindir)/$(productID)/Packages" + $(INSTALL) $(installFiles) "$(DESTDIR)$(bindir)/$(productID)" + $(INSTALL_DATA) $(top_srcdir)/Packages/GameData.smzip "$(DESTDIR)$(bindir)/$(productID)/Packages" + +uninstall-hook: + rm -f "$(DESTDIR)$(bindir)/$(productID)/stepmania" + rm -f "$(DESTDIR)$(bindir)/$(productID)/GtkModule.so" + rm -f "$(DESTDIR)$(bindir)/$(productID)/Packages/GameData.smzip" diff --git a/NoteSkins/Para/default/Down Receptor.lua b/NoteSkins/Para/default/Down Receptor.lua index b2ddc239c4..d9e816a726 100644 --- a/NoteSkins/Para/default/Down Receptor.lua +++ b/NoteSkins/Para/default/Down Receptor.lua @@ -1,12 +1,12 @@ -return Def.ActorFrame { - -- We want this under the noteskin, so that we it looks like a laser (?) - LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( Var "Button", "KeypressBlock" ) ) .. { - InitCommand=cmd(vertalign,top;zoomx,0); - -- Press/Lift allows this to appear and disappear - PressCommand=cmd(zoomx,0;linear,0.02;zoomx,1); - LiftCommand=cmd(zoomx,1;linear,0.14;zoomx,0); - }; - -- Overlay the receptor. - LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( Var "Button", "Go Receptor" ) ); -}; - +return Def.ActorFrame { + -- We want this under the noteskin, so that we it looks like a laser (?) + LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( Var "Button", "KeypressBlock" ) ) .. { + InitCommand=cmd(vertalign,top;zoomx,0); + -- Press/Lift allows this to appear and disappear + PressCommand=cmd(zoomx,0;linear,0.02;zoomx,1); + LiftCommand=cmd(zoomx,1;linear,0.14;zoomx,0); + }; + -- Overlay the receptor. + LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( Var "Button", "Go Receptor" ) ); +}; + diff --git a/NoteSkins/Para/default/Down Tap Note.lua b/NoteSkins/Para/default/Down Tap Note.lua index a06cab1415..6268e29266 100644 --- a/NoteSkins/Para/default/Down Tap Note.lua +++ b/NoteSkins/Para/default/Down Tap Note.lua @@ -1,7 +1,7 @@ -return Def.ActorFrame { - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); - }; - +return Def.ActorFrame { + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); + }; + }; \ No newline at end of file diff --git a/NoteSkins/Para/default/NoteSkin.lua b/NoteSkins/Para/default/NoteSkin.lua index 50e3d33466..79007d7dfd 100644 --- a/NoteSkins/Para/default/NoteSkin.lua +++ b/NoteSkins/Para/default/NoteSkin.lua @@ -1,105 +1,105 @@ -local ret = ... or {}; - -ret.RedirTable = -{ - Up = "Down", - Down = "Down", - Left = "Down", - Right = "Down", - UpLeft = "Down", - UpRight = "Down", -}; - - -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - -- Instead of separate hold heads, use the tap note graphics. - --[[if sElement == "Hold Head Inactive" or - sElement == "Hold Head Active" or - sElement == "Roll Head Inactive" or - sElement == "Roll Head Active" - then - sElement = "Tap Note"; - end -]] - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - - - --- To have separate graphics for each hold part: ---[[ -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - -- Redirect non-hold, non-roll parts. - if string.find(sElement, "hold") then - return sButton, sElement; - end - return OldRedir(sButton, sElement); -end -]] - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Roll Explosion" or - Var "Element" == "Hold Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Go Receptor"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Tap Note"] = true, - ["Hold Bottom Cap Active"] = true, - ["Hold Bottom Cap Inactive"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true, -}; -ret.Rotate = -{ - Up = 180, - Down = 0, - Left = 90, - Right = -90, - UpLeft = 135, - UpRight = 225, -}; - --- --- If a derived skin wants to have separate UpLeft graphics, --- use this: --- --- ret.RedirTable.UpLeft = "UpLeft"; --- ret.RedirTable.UpRight = "UpLeft"; --- ret.Rotate.UpLeft = 0; --- ret.Rotate.UpRight = 90; --- -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +local ret = ... or {}; + +ret.RedirTable = +{ + Up = "Down", + Down = "Down", + Left = "Down", + Right = "Down", + UpLeft = "Down", + UpRight = "Down", +}; + + +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + -- Instead of separate hold heads, use the tap note graphics. + --[[if sElement == "Hold Head Inactive" or + sElement == "Hold Head Active" or + sElement == "Roll Head Inactive" or + sElement == "Roll Head Active" + then + sElement = "Tap Note"; + end +]] + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + + + +-- To have separate graphics for each hold part: +--[[ +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + -- Redirect non-hold, non-roll parts. + if string.find(sElement, "hold") then + return sButton, sElement; + end + return OldRedir(sButton, sElement); +end +]] + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Roll Explosion" or + Var "Element" == "Hold Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Go Receptor"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Tap Note"] = true, + ["Hold Bottom Cap Active"] = true, + ["Hold Bottom Cap Inactive"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true, +}; +ret.Rotate = +{ + Up = 180, + Down = 0, + Left = 90, + Right = -90, + UpLeft = 135, + UpRight = 225, +}; + +-- +-- If a derived skin wants to have separate UpLeft graphics, +-- use this: +-- +-- ret.RedirTable.UpLeft = "UpLeft"; +-- ret.RedirTable.UpRight = "UpLeft"; +-- ret.Rotate.UpLeft = 0; +-- ret.Rotate.UpRight = 90; +-- +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/Para/default/metrics.ini b/NoteSkins/Para/default/metrics.ini index 9c9b7c462a..01860e31c1 100644 --- a/NoteSkins/Para/default/metrics.ini +++ b/NoteSkins/Para/default/metrics.ini @@ -1,77 +1,77 @@ -[Global] - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=0 - -TapNoteAnimationLength=2 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 - -HoldHeadAnimationLength=1 // doesn't matter. Only 1 frame anyway. -HoldTopCapAnimationLength=1 // doesn't matter. Only 1 frame anyway. -HoldBottomCapAnimationLength=1 // doesn't matter. Only 1 frame anyway. -HoldBodyAnimationLength=1 // doesn't matter. Only 1 frame anyway. -HoldTailAnimationLength=1 // doesn't matter. Only 1 frame anyway. - -HoldHeadAnimationIsNoteColor=0 -HoldTopCapAnimationIsNoteColor=0 -HoldBodyAnimationIsNoteColor=0 -HoldBottomCapAnimationIsNoteColor=0 -HoldTailAnimationIsNoteColor=0 - -HoldLetGoGrayPercent=0.25 -HoldHeadIsAboveWavyParts=0 -HoldTailIsAboveWavyParts=0 - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 // top of tail - -ReverseDrawOrder=1101 -TapNoteAdditionTextureCoordOffsetX=0.5 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0 -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[GhostArrowDim] -HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.2;zoom,1.5;decelerate,0.1;zoom,1.5;diffusealpha,0 -HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand= -HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -AvoidMineCommand= -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.2;zoom,1.5;decelerate,0.1;zoom,1.5;diffusealpha,0 -HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[ReceptorArrow] -InitCommand=effectclock,'beat';diffuseramp;effectcolor1,color("0.5,0.5,0.5,1");effectcolor2,color("1,1,1,1"); -NoneCommand=zoom,1.1;linear,0.06;diffusealpha,0;linear,0.06;zoom,1.0;diffuse,0.3,0.8,1.0,1 - -HitMineCommand= -AvoidMineCommand= -MissCommand= -W5Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 -W4Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 -W3Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 -W2Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 -W1Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 -PressCommand= +[Global] + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=0 + +TapNoteAnimationLength=2 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 + +HoldHeadAnimationLength=1 // doesn't matter. Only 1 frame anyway. +HoldTopCapAnimationLength=1 // doesn't matter. Only 1 frame anyway. +HoldBottomCapAnimationLength=1 // doesn't matter. Only 1 frame anyway. +HoldBodyAnimationLength=1 // doesn't matter. Only 1 frame anyway. +HoldTailAnimationLength=1 // doesn't matter. Only 1 frame anyway. + +HoldHeadAnimationIsNoteColor=0 +HoldTopCapAnimationIsNoteColor=0 +HoldBodyAnimationIsNoteColor=0 +HoldBottomCapAnimationIsNoteColor=0 +HoldTailAnimationIsNoteColor=0 + +HoldLetGoGrayPercent=0.25 +HoldHeadIsAboveWavyParts=0 +HoldTailIsAboveWavyParts=0 + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 // top of tail + +ReverseDrawOrder=1101 +TapNoteAdditionTextureCoordOffsetX=0.5 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0 +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[GhostArrowDim] +HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.2;zoom,1.5;decelerate,0.1;zoom,1.5;diffusealpha,0 +HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand= +HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +AvoidMineCommand= +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.2;zoom,1.5;decelerate,0.1;zoom,1.5;diffusealpha,0 +HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[ReceptorArrow] +InitCommand=effectclock,'beat';diffuseramp;effectcolor1,color("0.5,0.5,0.5,1");effectcolor2,color("1,1,1,1"); +NoneCommand=zoom,1.1;linear,0.06;diffusealpha,0;linear,0.06;zoom,1.0;diffuse,0.3,0.8,1.0,1 + +HitMineCommand= +AvoidMineCommand= +MissCommand= +W5Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 +W4Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 +W3Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 +W2Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 +W1Command=stoptweening;zoom,1.25;linear,0.11;zoom,1 +PressCommand= LiftCommand= \ No newline at end of file diff --git a/NoteSkins/beat/default/Common Tap Explosion Bright.redir b/NoteSkins/beat/default/Common Tap Explosion Bright.redir index 1ed0bb9c4e..23b063598c 100644 --- a/NoteSkins/beat/default/Common Tap Explosion Bright.redir +++ b/NoteSkins/beat/default/Common Tap Explosion Bright.redir @@ -1 +1 @@ -Common Tap Explosion Dim +Common Tap Explosion Dim diff --git a/NoteSkins/beat/default/Fallback Explosion.lua b/NoteSkins/beat/default/Fallback Explosion.lua index 62b835dd2b..69e8357439 100644 --- a/NoteSkins/beat/default/Fallback Explosion.lua +++ b/NoteSkins/beat/default/Fallback Explosion.lua @@ -1,54 +1,54 @@ -local t = Def.ActorFrame { }; -t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Hold Explosion" ) .. { - HoldingOnCommand=cmd(visible,true); - HoldingOffCommand=cmd(visible,false); - InitCommand=cmd(visible,false;finishtweening;blend,"BlendMode_Add"); - Frames = Sprite.LinearFrames( - NOTESKIN:GetMetricF( "GhostArrowDim", "HoldFrames" ), - NOTESKIN:GetMetricF( "GhostArrowDim", "HoldSeconds" ) ); -}; - -t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Roll Explosion" ) .. { - RollOnCommand=cmd(visible,true); - RollOffCommand=cmd(visible,false); - InitCommand=cmd(visible,false;finishtweening;blend,"BlendMode_Add"); - Frames = Sprite.LinearFrames( - NOTESKIN:GetMetricF( "GhostArrowDim", "HoldFrames" ), - NOTESKIN:GetMetricF( "GhostArrowDim", "HoldSeconds" ) ); -}; - -t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Tap Explosion Dim" ) .. { - InitCommand=cmd(diffusealpha,0;blend,"BlendMode_Add"); - HeldCommand=cmd(zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0); - ColumnJudgmentCommand=function(self, params) - if params.TapNoteScore == "TapNoteScore_HitMine" then return; end - - (cmd(finishtweening;loop,0;diffusealpha,1;setstate,0;sleep,self:GetAnimationLengthSeconds()-0.001;diffusealpha,0))(self); - end; - Frames = Sprite.LinearFrames( - NOTESKIN:GetMetricF( "GhostArrowDim", "JudgmentFrames" ), - NOTESKIN:GetMetricF( "GhostArrowDim", "JudgmentSeconds" ) ); -}; - -local mine = NOTESKIN:LoadActor( Var "Button", "HitMine Explosion" ) .. { - InitCommand=cmd(diffusealpha,0); - Frames = Sprite.LinearFrames( - NOTESKIN:GetMetricF( "GhostArrowDim", "MineFrames" ), - NOTESKIN:GetMetricF( "GhostArrowDim", "MineSeconds" ) ); -}; - -local Next = "1"; -t[#t+1] = Def.ActorFrame { - mine .. { Name="1"; }; - mine .. { Name="2"; }; - - ColumnJudgmentCommand=function(self, params) - if params.TapNoteScore ~= "TapNoteScore_HitMine" then return; end - - local c = self:GetChild(Next); - Next = Next == "1" and "2" or "1"; - (cmd(stoptweening;setstate,0;diffusealpha,1;sleep,self:GetAnimationLengthSeconds()-0.001;diffusealpha,0))(c); - end; -}; - -return t; +local t = Def.ActorFrame { }; +t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Hold Explosion" ) .. { + HoldingOnCommand=cmd(visible,true); + HoldingOffCommand=cmd(visible,false); + InitCommand=cmd(visible,false;finishtweening;blend,"BlendMode_Add"); + Frames = Sprite.LinearFrames( + NOTESKIN:GetMetricF( "GhostArrowDim", "HoldFrames" ), + NOTESKIN:GetMetricF( "GhostArrowDim", "HoldSeconds" ) ); +}; + +t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Roll Explosion" ) .. { + RollOnCommand=cmd(visible,true); + RollOffCommand=cmd(visible,false); + InitCommand=cmd(visible,false;finishtweening;blend,"BlendMode_Add"); + Frames = Sprite.LinearFrames( + NOTESKIN:GetMetricF( "GhostArrowDim", "HoldFrames" ), + NOTESKIN:GetMetricF( "GhostArrowDim", "HoldSeconds" ) ); +}; + +t[#t+1] = NOTESKIN:LoadActor( Var "Button", "Tap Explosion Dim" ) .. { + InitCommand=cmd(diffusealpha,0;blend,"BlendMode_Add"); + HeldCommand=cmd(zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0); + ColumnJudgmentCommand=function(self, params) + if params.TapNoteScore == "TapNoteScore_HitMine" then return; end + + (cmd(finishtweening;loop,0;diffusealpha,1;setstate,0;sleep,self:GetAnimationLengthSeconds()-0.001;diffusealpha,0))(self); + end; + Frames = Sprite.LinearFrames( + NOTESKIN:GetMetricF( "GhostArrowDim", "JudgmentFrames" ), + NOTESKIN:GetMetricF( "GhostArrowDim", "JudgmentSeconds" ) ); +}; + +local mine = NOTESKIN:LoadActor( Var "Button", "HitMine Explosion" ) .. { + InitCommand=cmd(diffusealpha,0); + Frames = Sprite.LinearFrames( + NOTESKIN:GetMetricF( "GhostArrowDim", "MineFrames" ), + NOTESKIN:GetMetricF( "GhostArrowDim", "MineSeconds" ) ); +}; + +local Next = "1"; +t[#t+1] = Def.ActorFrame { + mine .. { Name="1"; }; + mine .. { Name="2"; }; + + ColumnJudgmentCommand=function(self, params) + if params.TapNoteScore ~= "TapNoteScore_HitMine" then return; end + + local c = self:GetChild(Next); + Next = Next == "1" and "2" or "1"; + (cmd(stoptweening;setstate,0;diffusealpha,1;sleep,self:GetAnimationLengthSeconds()-0.001;diffusealpha,0))(c); + end; +}; + +return t; diff --git a/NoteSkins/beat/default/NoteSkin.lua b/NoteSkins/beat/default/NoteSkin.lua index ff47e04020..6368678c40 100644 --- a/NoteSkins/beat/default/NoteSkin.lua +++ b/NoteSkins/beat/default/NoteSkin.lua @@ -1,80 +1,80 @@ -local ret = ... or {}; - -ret.RedirTable = -{ - Key1 = "White", - Key2 = "Blue", - Key3 = "White", - Key4 = "Blue", - Key5 = "White", - Key6 = "Blue", - Key7 = "White", - scratch = "Red", -}; - -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - -- Instead of separate hold heads, use the tap note graphics. - if sElement == "Hold Head Inactive" or - sElement == "Hold Head Active" or - sElement == "Roll Head Inactive" or - sElement == "Roll Head Active" - then - sElement = "Tap Note"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Hold Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Go Receptor"] = false, - ["Ready Receptor"] = false, - ["Tap Explosion Bright"] = false, - ["Tap Explosion Dim"] = false, - ["Tap Note"] = false, - ["Hold Head Active"] = false, - ["Hold Head Inactive"] = false, - ["Roll Head Active"] = false, - ["Roll Head Inactive"] = false, -}; - --- --- If a derived skin wants to have separate UpLeft graphics, --- use this: --- --- ret.RedirTable.UpLeft = "UpLeft"; --- ret.RedirTable.UpRight = "UpLeft"; --- ret.Rotate.UpLeft = 0; --- ret.Rotate.UpRight = 90; --- -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +local ret = ... or {}; + +ret.RedirTable = +{ + Key1 = "White", + Key2 = "Blue", + Key3 = "White", + Key4 = "Blue", + Key5 = "White", + Key6 = "Blue", + Key7 = "White", + scratch = "Red", +}; + +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + -- Instead of separate hold heads, use the tap note graphics. + if sElement == "Hold Head Inactive" or + sElement == "Hold Head Active" or + sElement == "Roll Head Inactive" or + sElement == "Roll Head Active" + then + sElement = "Tap Note"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Hold Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Go Receptor"] = false, + ["Ready Receptor"] = false, + ["Tap Explosion Bright"] = false, + ["Tap Explosion Dim"] = false, + ["Tap Note"] = false, + ["Hold Head Active"] = false, + ["Hold Head Inactive"] = false, + ["Roll Head Active"] = false, + ["Roll Head Inactive"] = false, +}; + +-- +-- If a derived skin wants to have separate UpLeft graphics, +-- use this: +-- +-- ret.RedirTable.UpLeft = "UpLeft"; +-- ret.RedirTable.UpRight = "UpLeft"; +-- ret.Rotate.UpLeft = 0; +-- ret.Rotate.UpRight = 90; +-- +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/beat/default/_Tap Lead-in Receptor.lua b/NoteSkins/beat/default/_Tap Lead-in Receptor.lua index ff1dcf2184..c9e14e9bc3 100644 --- a/NoteSkins/beat/default/_Tap Lead-in Receptor.lua +++ b/NoteSkins/beat/default/_Tap Lead-in Receptor.lua @@ -1,21 +1,21 @@ -return Def.ActorFrame { - children = { - LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Ready Receptor") ) .. { - Frame0000=0; - Delay0000=1; - - InitCommand=cmd(playcommand, "Set"); - GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=cmd(visible,GAMESTATE:GetGameplayLeadIn()); - }; - - LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Go Receptor") ) .. { - Frame0000=0; - Delay0000=0; - - InitCommand=cmd(playcommand, "Set"); - GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=cmd(visible,not GAMESTATE:GetGameplayLeadIn()); - }; - } -} +return Def.ActorFrame { + children = { + LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Ready Receptor") ) .. { + Frame0000=0; + Delay0000=1; + + InitCommand=cmd(playcommand, "Set"); + GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=cmd(visible,GAMESTATE:GetGameplayLeadIn()); + }; + + LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Go Receptor") ) .. { + Frame0000=0; + Delay0000=0; + + InitCommand=cmd(playcommand, "Set"); + GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=cmd(visible,not GAMESTATE:GetGameplayLeadIn()); + }; + } +} diff --git a/NoteSkins/beat/default/_Tap Receptor.lua b/NoteSkins/beat/default/_Tap Receptor.lua index 73ca8b1da4..e2e850a0a6 100644 --- a/NoteSkins/beat/default/_Tap Receptor.lua +++ b/NoteSkins/beat/default/_Tap Receptor.lua @@ -1,15 +1,15 @@ -local t = ...; -assert( type(t) == "table" ); - -return t .. { - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - MissCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'MissCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - HitMineCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'HitMineCommand'); - W5Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W5Command'); - W4Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W4Command'); - W3Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W3Command'); - W2Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W2Command'); - W1Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W1Command'); -}; - +local t = ...; +assert( type(t) == "table" ); + +return t .. { + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + MissCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'MissCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + HitMineCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'HitMineCommand'); + W5Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W5Command'); + W4Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W4Command'); + W3Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W3Command'); + W2Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W2Command'); + W1Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W1Command'); +}; + diff --git a/NoteSkins/common/common/Fallback Explosion.lua b/NoteSkins/common/common/Fallback Explosion.lua index 85feedf17f..609212d64a 100644 --- a/NoteSkins/common/common/Fallback Explosion.lua +++ b/NoteSkins/common/common/Fallback Explosion.lua @@ -1,41 +1,41 @@ -local t = Def.ActorFrame { - NOTESKIN:LoadActor( Var "Button", "Hold Explosion" ) .. { - HoldingOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOnCommand"); - HoldingOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOffCommand"); - InitCommand=cmd(playcommand,"HoldingOff";finishtweening); - }; - NOTESKIN:LoadActor( Var "Button", "Roll Explosion" ) .. { - RollOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "RollOnCommand"); - RollOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "RollOffCommand"); - InitCommand=cmd(playcommand,"RollOff";finishtweening); - }; - NOTESKIN:LoadActor( Var "Button", "Tap Explosion Dim" ) .. { - InitCommand=cmd(diffusealpha,0); - W5Command=NOTESKIN:GetMetricA("GhostArrowDim", "W5Command"); - W4Command=NOTESKIN:GetMetricA("GhostArrowDim", "W4Command"); - W3Command=NOTESKIN:GetMetricA("GhostArrowDim", "W3Command"); - W2Command=NOTESKIN:GetMetricA("GhostArrowDim", "W2Command"); - W1Command=NOTESKIN:GetMetricA("GhostArrowDim", "W1Command"); - HeldCommand=NOTESKIN:GetMetricA("GhostArrowDim", "HeldCommand"); - JudgmentCommand=cmd(finishtweening); - BrightCommand=cmd(visible,false); - DimCommand=cmd(visible,true); - }; - NOTESKIN:LoadActor( Var "Button", "Tap Explosion Bright" ) .. { - InitCommand=cmd(diffusealpha,0); - W5Command=NOTESKIN:GetMetricA("GhostArrowBright", "W5Command"); - W4Command=NOTESKIN:GetMetricA("GhostArrowBright", "W4Command"); - W3Command=NOTESKIN:GetMetricA("GhostArrowBright", "W3Command"); - W2Command=NOTESKIN:GetMetricA("GhostArrowBright", "W2Command"); - W1Command=NOTESKIN:GetMetricA("GhostArrowBright", "W1Command"); - HeldCommand=NOTESKIN:GetMetricA("GhostArrowBright", "HeldCommand"); - JudgmentCommand=cmd(finishtweening); - BrightCommand=cmd(visible,true); - DimCommand=cmd(visible,false); - }; - NOTESKIN:LoadActor( Var "Button", "HitMine Explosion" ) .. { - InitCommand=cmd(blend,"BlendMode_Add";diffusealpha,0); - HitMineCommand=NOTESKIN:GetMetricA("GhostArrowBright", "HitMineCommand"); - }; -} -return t; +local t = Def.ActorFrame { + NOTESKIN:LoadActor( Var "Button", "Hold Explosion" ) .. { + HoldingOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOnCommand"); + HoldingOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOffCommand"); + InitCommand=cmd(playcommand,"HoldingOff";finishtweening); + }; + NOTESKIN:LoadActor( Var "Button", "Roll Explosion" ) .. { + RollOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "RollOnCommand"); + RollOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "RollOffCommand"); + InitCommand=cmd(playcommand,"RollOff";finishtweening); + }; + NOTESKIN:LoadActor( Var "Button", "Tap Explosion Dim" ) .. { + InitCommand=cmd(diffusealpha,0); + W5Command=NOTESKIN:GetMetricA("GhostArrowDim", "W5Command"); + W4Command=NOTESKIN:GetMetricA("GhostArrowDim", "W4Command"); + W3Command=NOTESKIN:GetMetricA("GhostArrowDim", "W3Command"); + W2Command=NOTESKIN:GetMetricA("GhostArrowDim", "W2Command"); + W1Command=NOTESKIN:GetMetricA("GhostArrowDim", "W1Command"); + HeldCommand=NOTESKIN:GetMetricA("GhostArrowDim", "HeldCommand"); + JudgmentCommand=cmd(finishtweening); + BrightCommand=cmd(visible,false); + DimCommand=cmd(visible,true); + }; + NOTESKIN:LoadActor( Var "Button", "Tap Explosion Bright" ) .. { + InitCommand=cmd(diffusealpha,0); + W5Command=NOTESKIN:GetMetricA("GhostArrowBright", "W5Command"); + W4Command=NOTESKIN:GetMetricA("GhostArrowBright", "W4Command"); + W3Command=NOTESKIN:GetMetricA("GhostArrowBright", "W3Command"); + W2Command=NOTESKIN:GetMetricA("GhostArrowBright", "W2Command"); + W1Command=NOTESKIN:GetMetricA("GhostArrowBright", "W1Command"); + HeldCommand=NOTESKIN:GetMetricA("GhostArrowBright", "HeldCommand"); + JudgmentCommand=cmd(finishtweening); + BrightCommand=cmd(visible,true); + DimCommand=cmd(visible,false); + }; + NOTESKIN:LoadActor( Var "Button", "HitMine Explosion" ) .. { + InitCommand=cmd(blend,"BlendMode_Add";diffusealpha,0); + HitMineCommand=NOTESKIN:GetMetricA("GhostArrowBright", "HitMineCommand"); + }; +} +return t; diff --git a/NoteSkins/common/common/Fallback Go Receptor.redir b/NoteSkins/common/common/Fallback Go Receptor.redir index f29beddd28..cea4fa0f78 100644 --- a/NoteSkins/common/common/Fallback Go Receptor.redir +++ b/NoteSkins/common/common/Fallback Go Receptor.redir @@ -1 +1 @@ -Fallback Ready Receptor +Fallback Ready Receptor diff --git a/NoteSkins/common/common/Fallback Hold Head Active.redir b/NoteSkins/common/common/Fallback Hold Head Active.redir index 743091aca4..efe0650099 100644 --- a/NoteSkins/common/common/Fallback Hold Head Active.redir +++ b/NoteSkins/common/common/Fallback Hold Head Active.redir @@ -1 +1 @@ -Fallback Tap Note +Fallback Tap Note diff --git a/NoteSkins/common/common/Fallback Hold Head Inactive.redir b/NoteSkins/common/common/Fallback Hold Head Inactive.redir index 743091aca4..efe0650099 100644 --- a/NoteSkins/common/common/Fallback Hold Head Inactive.redir +++ b/NoteSkins/common/common/Fallback Hold Head Inactive.redir @@ -1 +1 @@ -Fallback Tap Note +Fallback Tap Note diff --git a/NoteSkins/common/common/Fallback Hold Tail Active.redir b/NoteSkins/common/common/Fallback Hold Tail Active.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Hold Tail Active.redir +++ b/NoteSkins/common/common/Fallback Hold Tail Active.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Hold Tail Inactive.redir b/NoteSkins/common/common/Fallback Hold Tail Inactive.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Hold Tail Inactive.redir +++ b/NoteSkins/common/common/Fallback Hold Tail Inactive.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Hold TopCap Active.redir b/NoteSkins/common/common/Fallback Hold TopCap Active.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Hold TopCap Active.redir +++ b/NoteSkins/common/common/Fallback Hold TopCap Active.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Hold TopCap Inactive.redir b/NoteSkins/common/common/Fallback Hold TopCap Inactive.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Hold TopCap Inactive.redir +++ b/NoteSkins/common/common/Fallback Hold TopCap Inactive.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Receptor.lua b/NoteSkins/common/common/Fallback Receptor.lua index 8e0349cbac..f6776dc573 100644 --- a/NoteSkins/common/common/Fallback Receptor.lua +++ b/NoteSkins/common/common/Fallback Receptor.lua @@ -1 +1 @@ -return LoadActor( NOTESKIN:GetPath("", "_Tap Lead-in Receptor") ); +return LoadActor( NOTESKIN:GetPath("", "_Tap Lead-in Receptor") ); diff --git a/NoteSkins/common/common/Fallback Roll Explosion.redir b/NoteSkins/common/common/Fallback Roll Explosion.redir index aed26b92bb..141d9a154a 100644 --- a/NoteSkins/common/common/Fallback Roll Explosion.redir +++ b/NoteSkins/common/common/Fallback Roll Explosion.redir @@ -1 +1 @@ -Fallback Hold Explosion +Fallback Hold Explosion diff --git a/NoteSkins/common/common/Fallback Roll Head Active.redir b/NoteSkins/common/common/Fallback Roll Head Active.redir index 743091aca4..efe0650099 100644 --- a/NoteSkins/common/common/Fallback Roll Head Active.redir +++ b/NoteSkins/common/common/Fallback Roll Head Active.redir @@ -1 +1 @@ -Fallback Tap Note +Fallback Tap Note diff --git a/NoteSkins/common/common/Fallback Roll Head Inactive.redir b/NoteSkins/common/common/Fallback Roll Head Inactive.redir index 743091aca4..efe0650099 100644 --- a/NoteSkins/common/common/Fallback Roll Head Inactive.redir +++ b/NoteSkins/common/common/Fallback Roll Head Inactive.redir @@ -1 +1 @@ -Fallback Tap Note +Fallback Tap Note diff --git a/NoteSkins/common/common/Fallback Roll Tail Active.redir b/NoteSkins/common/common/Fallback Roll Tail Active.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Roll Tail Active.redir +++ b/NoteSkins/common/common/Fallback Roll Tail Active.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Roll Tail Inactive.redir b/NoteSkins/common/common/Fallback Roll Tail Inactive.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Roll Tail Inactive.redir +++ b/NoteSkins/common/common/Fallback Roll Tail Inactive.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Roll TopCap Active.redir b/NoteSkins/common/common/Fallback Roll TopCap Active.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Roll TopCap Active.redir +++ b/NoteSkins/common/common/Fallback Roll TopCap Active.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/Fallback Roll TopCap Inactive.redir b/NoteSkins/common/common/Fallback Roll TopCap Inactive.redir index 56cf597902..c700c90d39 100644 --- a/NoteSkins/common/common/Fallback Roll TopCap Inactive.redir +++ b/NoteSkins/common/common/Fallback Roll TopCap Inactive.redir @@ -1 +1 @@ -_blank +_blank diff --git a/NoteSkins/common/common/NoteSkin.lua b/NoteSkins/common/common/NoteSkin.lua index bd14aa6738..f222eaf948 100644 --- a/NoteSkins/common/common/NoteSkin.lua +++ b/NoteSkins/common/common/NoteSkin.lua @@ -1,63 +1,63 @@ -local ret = ... or {} - -ret.Redir = function(sButton, sElement) - -- To redirect files for Up to Down: - -- if sButton == "Up" then sButton = "Down"; end - return sButton, sElement; -end - -ret.Rotate = -{ -}; - -ret.PartsToRotate = -{ -}; - -ret.Blank = -{ --- To blank tap notes: --- ["tap note"] = true, -}; - -local function func() - local sButton = Var "Button"; - local sElement = Var "Element"; - - if ret.Blank[sElement] then - -- Return a blank element. If SpriteOnly is set, - -- we need to return a sprite; otherwise just return - -- a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end - - local sButtonToLoad, sElementToLoad = ret.Redir(sButton, sElement); - assert( sButtonToLoad ); - assert( sElementToLoad ); - - local sPath = NOTESKIN:GetPath( sButtonToLoad, sElementToLoad ); - - local t = LoadActor( sPath ); - - if ret.PartsToRotate[sElement] then - t.BaseRotationZ = ret.Rotate[sButton]; - end - - return t; -end - --- This is the only required function. -ret.Load = func; - --- Use this to override the game types' default Load() functions. -ret.CommonLoad = func; - -return ret; +local ret = ... or {} + +ret.Redir = function(sButton, sElement) + -- To redirect files for Up to Down: + -- if sButton == "Up" then sButton = "Down"; end + return sButton, sElement; +end + +ret.Rotate = +{ +}; + +ret.PartsToRotate = +{ +}; + +ret.Blank = +{ +-- To blank tap notes: +-- ["tap note"] = true, +}; + +local function func() + local sButton = Var "Button"; + local sElement = Var "Element"; + + if ret.Blank[sElement] then + -- Return a blank element. If SpriteOnly is set, + -- we need to return a sprite; otherwise just return + -- a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end + + local sButtonToLoad, sElementToLoad = ret.Redir(sButton, sElement); + assert( sButtonToLoad ); + assert( sElementToLoad ); + + local sPath = NOTESKIN:GetPath( sButtonToLoad, sElementToLoad ); + + local t = LoadActor( sPath ); + + if ret.PartsToRotate[sElement] then + t.BaseRotationZ = ret.Rotate[sButton]; + end + + return t; +end + +-- This is the only required function. +ret.Load = func; + +-- Use this to override the game types' default Load() functions. +ret.CommonLoad = func; + +return ret; diff --git a/NoteSkins/common/common/_Tap Lead-in Receptor.lua b/NoteSkins/common/common/_Tap Lead-in Receptor.lua index 7e880ad273..39724c01eb 100644 --- a/NoteSkins/common/common/_Tap Lead-in Receptor.lua +++ b/NoteSkins/common/common/_Tap Lead-in Receptor.lua @@ -1,23 +1,23 @@ -return Def.ActorFrame { - LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Ready Receptor") ) .. { - Frames = { - { Frame = 2; Delay = 1; }; - }; - - InitCommand=cmd(playcommand, "Set"); - GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=cmd(visible,GAMESTATE:GetGameplayLeadIn()); - }; - - LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Go Receptor") ) .. { - Frames = { - { Frame = 0; }; - { Frame = 1; Delay = 0.8; }; - { Frame = 2; }; - }; - - InitCommand=cmd(playcommand, "Set"); - GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=cmd(visible,not GAMESTATE:GetGameplayLeadIn()); - }; -} +return Def.ActorFrame { + LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Ready Receptor") ) .. { + Frames = { + { Frame = 2; Delay = 1; }; + }; + + InitCommand=cmd(playcommand, "Set"); + GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=cmd(visible,GAMESTATE:GetGameplayLeadIn()); + }; + + LoadActor( "_Tap Receptor", NOTESKIN:LoadActor(Var "Button", "Go Receptor") ) .. { + Frames = { + { Frame = 0; }; + { Frame = 1; Delay = 0.8; }; + { Frame = 2; }; + }; + + InitCommand=cmd(playcommand, "Set"); + GameplayLeadInChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=cmd(visible,not GAMESTATE:GetGameplayLeadIn()); + }; +} diff --git a/NoteSkins/common/common/_Tap Press.lua b/NoteSkins/common/common/_Tap Press.lua index 6d95fc5c78..8b2fc7cfa0 100644 --- a/NoteSkins/common/common/_Tap Press.lua +++ b/NoteSkins/common/common/_Tap Press.lua @@ -1,9 +1,9 @@ -local File = ...; - -return LoadActor( File ) .. { - InitCommand=cmd(playcommand,"Lift"); - ReverseOnCommand=NOTESKIN:GetMetricA("Press", "ReverseOnCommand"); - ReverseOffCommand=NOTESKIN:GetMetricA("Press", "ReverseOffCommand"); - PressCommand=NOTESKIN:GetMetricA("Press", "PressCommand"); - LiftCommand=NOTESKIN:GetMetricA("Press", "LiftCommand"); -}; +local File = ...; + +return LoadActor( File ) .. { + InitCommand=cmd(playcommand,"Lift"); + ReverseOnCommand=NOTESKIN:GetMetricA("Press", "ReverseOnCommand"); + ReverseOffCommand=NOTESKIN:GetMetricA("Press", "ReverseOffCommand"); + PressCommand=NOTESKIN:GetMetricA("Press", "PressCommand"); + LiftCommand=NOTESKIN:GetMetricA("Press", "LiftCommand"); +}; diff --git a/NoteSkins/common/common/_Tap Receptor.lua b/NoteSkins/common/common/_Tap Receptor.lua index 73ca8b1da4..e2e850a0a6 100644 --- a/NoteSkins/common/common/_Tap Receptor.lua +++ b/NoteSkins/common/common/_Tap Receptor.lua @@ -1,15 +1,15 @@ -local t = ...; -assert( type(t) == "table" ); - -return t .. { - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - MissCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'MissCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - HitMineCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'HitMineCommand'); - W5Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W5Command'); - W4Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W4Command'); - W3Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W3Command'); - W2Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W2Command'); - W1Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W1Command'); -}; - +local t = ...; +assert( type(t) == "table" ); + +return t .. { + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + MissCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'MissCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + HitMineCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'HitMineCommand'); + W5Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W5Command'); + W4Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W4Command'); + W3Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W3Command'); + W2Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W2Command'); + W1Command=NOTESKIN:GetMetricA('ReceptorArrow', 'W1Command'); +}; + diff --git a/NoteSkins/common/common/metrics.ini b/NoteSkins/common/common/metrics.ini index ed5f334704..619f75b3f6 100644 --- a/NoteSkins/common/common/metrics.ini +++ b/NoteSkins/common/common/metrics.ini @@ -1,118 +1,118 @@ -[NoteDisplay] -DrawHoldHeadForTapsOnSameRow=1 -AnimationIsBeatBased=1 -TapNoteAnimationLength=1 -TapMineAnimationLength=1 -TapLiftAnimationLength=1 -TapFakeAnimationLength=1 -HoldHeadAnimationLength=1 -HoldTopCapAnimationLength=1 -HoldBottomCapAnimationLength=1 -HoldBodyAnimationLength=4 -HoldTailAnimationLength=4 -TapNoteAnimationIsVivid=1 -TapMineAnimationIsVivid=0 -TapLiftAnimationIsVivid=0 -TapFakeAnimationIsVivid=0 -HoldHeadAnimationIsVivid=0 -HoldTopCapAnimationIsVivid=0 -HoldBodyAnimationIsVivid=0 -HoldBottomCapAnimationIsVivid=0 -HoldTailAnimationIsVivid=0 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0 -TapMineAdditionTextureCoordOffsetX=0 -TapMineAdditionTextureCoordOffsetY=0 -TapMineNoteColorTextureCoordSpacingX=0 -TapMineNoteColorTextureCoordSpacingY=0 -TapLiftAdditionTextureCoordOffsetX=0 -TapLiftAdditionTextureCoordOffsetY=0 -TapLiftNoteColorTextureCoordSpacingX=0 -TapLiftNoteColorTextureCoordSpacingY=0 -TapFakeAdditionTextureCoordOffsetX=0 -TapFakeAdditionTextureCoordOffsetY=0 -TapFakeNoteColorTextureCoordSpacingX=0 -TapFakeNoteColorTextureCoordSpacingY=0 -HoldHeadAdditionTextureCoordOffsetX=0 -HoldHeadAdditionTextureCoordOffsetY=0 -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 -HoldTopCapAdditionTextureCoordOffsetX=0 -HoldTopCapAdditionTextureCoordOffsetY=0 -HoldTopCapNoteColorTextureCoordSpacingX=0 -HoldTopCapNoteColorTextureCoordSpacingY=0 -HoldBodyAdditionTextureCoordOffsetX=0 -HoldBodyAdditionTextureCoordOffsetY=0 -HoldBodyNoteColorTextureCoordSpacingX=0 -HoldBodyNoteColorTextureCoordSpacingY=0 -HoldBottomCapAdditionTextureCoordOffsetX=0 -HoldBottomCapAdditionTextureCoordOffsetY=0 -HoldBottomCapNoteColorTextureCoordSpacingX=0 -HoldBottomCapNoteColorTextureCoordSpacingY=0 -HoldTailAdditionTextureCoordOffsetX=0 -HoldTailAdditionTextureCoordOffsetY=0 -HoldTailNoteColorTextureCoordSpacingX=0 -HoldTailNoteColorTextureCoordSpacingY=0 - - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 // top of tail -HoldLetGoGrayPercent=0.25 -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -FlipHeadAndTailWhenReverse=0 -FlipHoldBodyWhenReverse=0 -TopHoldAnchorWhenReverse=0 -HoldActiveIsAddLayer=0 - -[GhostArrowDim] -HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand= -HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -AvoidMineCommand= -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[ReceptorArrow] -InitCommand=effectclock,'beat';diffuseramp;effectcolor1,color("0.35,0.35,0.35,1");effectcolor2,color("1,1,1,1"); -# By default, always step. Individual game skins can override this. -NoneCommand=stoptweening;zoom,.75;linear,0.11;zoom,1 -HitMineCommand= -AvoidMineCommand= -MissCommand= -W5Command=stoptweening;zoom,.75;linear,0.11;zoom,1 -W4Command=stoptweening;zoom,.75;linear,0.11;zoom,1 -W3Command=stoptweening;zoom,.75;linear,0.11;zoom,1 -W2Command=stoptweening;zoom,.75;linear,0.11;zoom,1 -W1Command=stoptweening;zoom,.75;linear,0.11;zoom,1 -PressCommand= -LiftCommand= - -[HoldGhostArrow] -HoldingOnCommand=visible,true -HoldingOffCommand=visible,false -RollOnCommand=visible,true -RollOffCommand=visible,false - -[Press] -ReverseOnCommand=vertalign,bottom -ReverseOffCommand=vertalign,top -PressCommand=visible,true -LiftCommand=visible,false - +[NoteDisplay] +DrawHoldHeadForTapsOnSameRow=1 +AnimationIsBeatBased=1 +TapNoteAnimationLength=1 +TapMineAnimationLength=1 +TapLiftAnimationLength=1 +TapFakeAnimationLength=1 +HoldHeadAnimationLength=1 +HoldTopCapAnimationLength=1 +HoldBottomCapAnimationLength=1 +HoldBodyAnimationLength=4 +HoldTailAnimationLength=4 +TapNoteAnimationIsVivid=1 +TapMineAnimationIsVivid=0 +TapLiftAnimationIsVivid=0 +TapFakeAnimationIsVivid=0 +HoldHeadAnimationIsVivid=0 +HoldTopCapAnimationIsVivid=0 +HoldBodyAnimationIsVivid=0 +HoldBottomCapAnimationIsVivid=0 +HoldTailAnimationIsVivid=0 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0 +TapMineAdditionTextureCoordOffsetX=0 +TapMineAdditionTextureCoordOffsetY=0 +TapMineNoteColorTextureCoordSpacingX=0 +TapMineNoteColorTextureCoordSpacingY=0 +TapLiftAdditionTextureCoordOffsetX=0 +TapLiftAdditionTextureCoordOffsetY=0 +TapLiftNoteColorTextureCoordSpacingX=0 +TapLiftNoteColorTextureCoordSpacingY=0 +TapFakeAdditionTextureCoordOffsetX=0 +TapFakeAdditionTextureCoordOffsetY=0 +TapFakeNoteColorTextureCoordSpacingX=0 +TapFakeNoteColorTextureCoordSpacingY=0 +HoldHeadAdditionTextureCoordOffsetX=0 +HoldHeadAdditionTextureCoordOffsetY=0 +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 +HoldTopCapAdditionTextureCoordOffsetX=0 +HoldTopCapAdditionTextureCoordOffsetY=0 +HoldTopCapNoteColorTextureCoordSpacingX=0 +HoldTopCapNoteColorTextureCoordSpacingY=0 +HoldBodyAdditionTextureCoordOffsetX=0 +HoldBodyAdditionTextureCoordOffsetY=0 +HoldBodyNoteColorTextureCoordSpacingX=0 +HoldBodyNoteColorTextureCoordSpacingY=0 +HoldBottomCapAdditionTextureCoordOffsetX=0 +HoldBottomCapAdditionTextureCoordOffsetY=0 +HoldBottomCapNoteColorTextureCoordSpacingX=0 +HoldBottomCapNoteColorTextureCoordSpacingY=0 +HoldTailAdditionTextureCoordOffsetX=0 +HoldTailAdditionTextureCoordOffsetY=0 +HoldTailNoteColorTextureCoordSpacingX=0 +HoldTailNoteColorTextureCoordSpacingY=0 + + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 // top of tail +HoldLetGoGrayPercent=0.25 +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +FlipHeadAndTailWhenReverse=0 +FlipHoldBodyWhenReverse=0 +TopHoldAnchorWhenReverse=0 +HoldActiveIsAddLayer=0 + +[GhostArrowDim] +HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand= +HitMineCommand=blend,"BlendMode_Add";diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +AvoidMineCommand= +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +HeldCommand=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[ReceptorArrow] +InitCommand=effectclock,'beat';diffuseramp;effectcolor1,color("0.35,0.35,0.35,1");effectcolor2,color("1,1,1,1"); +# By default, always step. Individual game skins can override this. +NoneCommand=stoptweening;zoom,.75;linear,0.11;zoom,1 +HitMineCommand= +AvoidMineCommand= +MissCommand= +W5Command=stoptweening;zoom,.75;linear,0.11;zoom,1 +W4Command=stoptweening;zoom,.75;linear,0.11;zoom,1 +W3Command=stoptweening;zoom,.75;linear,0.11;zoom,1 +W2Command=stoptweening;zoom,.75;linear,0.11;zoom,1 +W1Command=stoptweening;zoom,.75;linear,0.11;zoom,1 +PressCommand= +LiftCommand= + +[HoldGhostArrow] +HoldingOnCommand=visible,true +HoldingOffCommand=visible,false +RollOnCommand=visible,true +RollOffCommand=visible,false + +[Press] +ReverseOnCommand=vertalign,bottom +ReverseOffCommand=vertalign,top +PressCommand=visible,true +LiftCommand=visible,false + diff --git a/NoteSkins/dance/Delta/Down Hold Explosion.lua b/NoteSkins/dance/Delta/Down Hold Explosion.lua index a9b1a42497..71748688f4 100644 --- a/NoteSkins/dance/Delta/Down Hold Explosion.lua +++ b/NoteSkins/dance/Delta/Down Hold Explosion.lua @@ -1,9 +1,9 @@ -local t = ...; -t = Def.Sprite { - Texture="Hold Explosion.png"; - HoldingOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOnCommand"); - HoldingOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOffCommand"); - InitCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "InitCommand"); -}; - +local t = ...; +t = Def.Sprite { + Texture="Hold Explosion.png"; + HoldingOnCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOnCommand"); + HoldingOffCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "HoldingOffCommand"); + InitCommand=NOTESKIN:GetMetricA("HoldGhostArrow", "InitCommand"); +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/Delta/Down Receptor.lua b/NoteSkins/dance/Delta/Down Receptor.lua index 8bd1211717..db6cbbadd7 100644 --- a/NoteSkins/dance/Delta/Down Receptor.lua +++ b/NoteSkins/dance/Delta/Down Receptor.lua @@ -1,39 +1,39 @@ -local t = ...; -t = Def.ActorFrame { - children = { - Def.Sprite { - Texture="Receptor 4x1.png"; - Frame0000=0; - Delay0000=0.95; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=0; - Delay0004=0.05; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - Def.Sprite { - Texture="Receptor 4x1.png"; - Frame0000=0; - Delay0000=0.95; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=0; - Delay0004=0.05; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - } -} - -return t; +local t = ...; +t = Def.ActorFrame { + children = { + Def.Sprite { + Texture="Receptor 4x1.png"; + Frame0000=0; + Delay0000=0.95; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=0; + Delay0004=0.05; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + Def.Sprite { + Texture="Receptor 4x1.png"; + Frame0000=0; + Delay0000=0.95; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=0; + Delay0004=0.05; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + } +} + +return t; diff --git a/NoteSkins/dance/Delta/Down Tap Note.lua b/NoteSkins/dance/Delta/Down Tap Note.lua index f4da0d29ad..0270be2eab 100644 --- a/NoteSkins/dance/Delta/Down Tap Note.lua +++ b/NoteSkins/dance/Delta/Down Tap Note.lua @@ -1,28 +1,28 @@ -local t = Def.Sprite { - Texture=NOTESKIN:GetPath('_down','tap note'); - Frame0000=0; - Delay0000=0.04; - Frame0001=1; - Delay0001=0.04; - Frame0002=2; - Delay0002=0.04; - Frame0003=3; - Delay0003=0.04; - Frame0004=4; - Delay0004=0.04; - Frame0005=5; - Delay0005=0.04; - Frame0006=6; - Delay0006=0.04; - Frame0007=7; - Delay0007=0.04; - Frame0008=8; - Delay0008=0.04; - Frame0009=9; - Delay0009=0.04; - Frame0010=10; - Delay0010=0.04; - Frame0011=11; - Delay0011=0.04; -}; -return t; +local t = Def.Sprite { + Texture=NOTESKIN:GetPath('_down','tap note'); + Frame0000=0; + Delay0000=0.04; + Frame0001=1; + Delay0001=0.04; + Frame0002=2; + Delay0002=0.04; + Frame0003=3; + Delay0003=0.04; + Frame0004=4; + Delay0004=0.04; + Frame0005=5; + Delay0005=0.04; + Frame0006=6; + Delay0006=0.04; + Frame0007=7; + Delay0007=0.04; + Frame0008=8; + Delay0008=0.04; + Frame0009=9; + Delay0009=0.04; + Frame0010=10; + Delay0010=0.04; + Frame0011=11; + Delay0011=0.04; +}; +return t; diff --git a/NoteSkins/dance/Delta/NoteSkin.lua b/NoteSkins/dance/Delta/NoteSkin.lua index 21108d0185..2d881be750 100644 --- a/NoteSkins/dance/Delta/NoteSkin.lua +++ b/NoteSkins/dance/Delta/NoteSkin.lua @@ -1,78 +1,78 @@ -local ret = ... or {}; - -ret.RedirTable = -{ - Up = "Down", - Down = "Down", - Left = "Down", - Right = "Down", - UpLeft = "Down", - UpRight = "Down", -}; - -local OldRedir = ret.Redir; - -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - --Point the head files back to the tap note - if string.find(sElement, "Head") then - sElement = "Tap Note"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Roll Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Receptor"] = true, - ["Tap Note"] = true, - ["Tap Fake"] = true, - ["Tap Lift"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Hold Explosion"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true, -}; -ret.Rotate = -{ - Up = 180, - Down = 0, - Left = 90, - Right = -90, - UpLeft = 135, - UpRight = 225, -}; - -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +local ret = ... or {}; + +ret.RedirTable = +{ + Up = "Down", + Down = "Down", + Left = "Down", + Right = "Down", + UpLeft = "Down", + UpRight = "Down", +}; + +local OldRedir = ret.Redir; + +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + --Point the head files back to the tap note + if string.find(sElement, "Head") then + sElement = "Tap Note"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Roll Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Receptor"] = true, + ["Tap Note"] = true, + ["Tap Fake"] = true, + ["Tap Lift"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Hold Explosion"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true, +}; +ret.Rotate = +{ + Up = 180, + Down = 0, + Left = 90, + Right = -90, + UpLeft = 135, + UpRight = 225, +}; + +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/dance/default/Down Receptor.lua b/NoteSkins/dance/default/Down Receptor.lua index aaeb0937e8..eda1a4c957 100644 --- a/NoteSkins/dance/default/Down Receptor.lua +++ b/NoteSkins/dance/default/Down Receptor.lua @@ -1,19 +1,19 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture="_receptor"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - Def.Sprite { - Texture="_rflash"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture="_receptor"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + Def.Sprite { + Texture="_rflash"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; +return t; diff --git a/NoteSkins/dance/default/Down Tap Lift.lua b/NoteSkins/dance/default/Down Tap Lift.lua index ac6a010454..5561cd6067 100644 --- a/NoteSkins/dance/default/Down Tap Lift.lua +++ b/NoteSkins/dance/default/Down Tap Lift.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture="_arrow"; - Frame0000=7; - Delay0000=1; - InitCommand=cmd(animate,false;pulse;effectclock,"beat";effectmagnitude,0.9,1,1); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture="_arrow"; + Frame0000=7; + Delay0000=1; + InitCommand=cmd(animate,false;pulse;effectclock,"beat";effectmagnitude,0.9,1,1); + }; +}; +return t; diff --git a/NoteSkins/dance/default/Down Tap Note.lua b/NoteSkins/dance/default/Down Tap Note.lua index f366586297..80fd6c1bbb 100644 --- a/NoteSkins/dance/default/Down Tap Note.lua +++ b/NoteSkins/dance/default/Down Tap Note.lua @@ -1,32 +1,32 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture="_arrow"; - Frame0000=0; - Delay0000=1; - }; - Def.Sprite { - Texture="_circle"; - Frame0000=0; - Delay0000=1; - InitCommand=cmd(y,15;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0); - }; - Def.Sprite { - Texture="_circle"; - Frame0000=0; - Delay0000=1; - InitCommand=cmd(y,5;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.25); - }; - Def.Sprite { - Texture="_circle"; - Frame0000=0; - Delay0000=1; - InitCommand=cmd(y,-5;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.5); - }; - Def.Sprite { - Texture="_circle"; - Frame0000=0; - Delay0000=1; - InitCommand=cmd(y,-15;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.75); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture="_arrow"; + Frame0000=0; + Delay0000=1; + }; + Def.Sprite { + Texture="_circle"; + Frame0000=0; + Delay0000=1; + InitCommand=cmd(y,15;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0); + }; + Def.Sprite { + Texture="_circle"; + Frame0000=0; + Delay0000=1; + InitCommand=cmd(y,5;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.25); + }; + Def.Sprite { + Texture="_circle"; + Frame0000=0; + Delay0000=1; + InitCommand=cmd(y,-5;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.5); + }; + Def.Sprite { + Texture="_circle"; + Frame0000=0; + Delay0000=1; + InitCommand=cmd(y,-15;effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.35");effectoffset,0.75); + }; +}; +return t; diff --git a/NoteSkins/dance/default/NoteSkin.lua b/NoteSkins/dance/default/NoteSkin.lua index 54e2176a2e..58ee28ef25 100644 --- a/NoteSkins/dance/default/NoteSkin.lua +++ b/NoteSkins/dance/default/NoteSkin.lua @@ -1,79 +1,79 @@ -local ret = ... or {}; - -ret.RedirTable = -{ - Up = "Down", - Down = "Down", - Left = "Down", - Right = "Down", - UpLeft = "Down", - UpRight = "Down", -}; - -local OldRedir = ret.Redir; - -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - --Point the head files back to the tap note - if string.find(sElement, "Head") or sElement == "Tap Fake" then - sElement = "Tap Note"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Roll Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Receptor"] = true, - ["Tap Note"] = true, - ["Tap Lift"] = true, - ["Tap Fake"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true -}; -ret.Rotate = -{ - Up = 180, - Down = 0, - Left = 90, - Right = -90, - UpLeft = 135, - UpRight = 225, -}; - -ret.Blank = -{ - ["Hold Explosion"] = true, - ["Roll Explosion"] = true, - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +local ret = ... or {}; + +ret.RedirTable = +{ + Up = "Down", + Down = "Down", + Left = "Down", + Right = "Down", + UpLeft = "Down", + UpRight = "Down", +}; + +local OldRedir = ret.Redir; + +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + --Point the head files back to the tap note + if string.find(sElement, "Head") or sElement == "Tap Fake" then + sElement = "Tap Note"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Roll Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Receptor"] = true, + ["Tap Note"] = true, + ["Tap Lift"] = true, + ["Tap Fake"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true +}; +ret.Rotate = +{ + Up = 180, + Down = 0, + Left = 90, + Right = -90, + UpLeft = 135, + UpRight = 225, +}; + +ret.Blank = +{ + ["Hold Explosion"] = true, + ["Roll Explosion"] = true, + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/dance/default/metrics.ini b/NoteSkins/dance/default/metrics.ini index eb3052f8b2..5845c92a82 100644 --- a/NoteSkins/dance/default/metrics.ini +++ b/NoteSkins/dance/default/metrics.ini @@ -1,74 +1,74 @@ -[Global] -FallbackNoteSkin=common - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=1 // none of these matter because Lua is handling the animation, not sprites. -TapAdditionAnimationLength=1 -TapMineAnimationLength=1 -TapLiftAnimationLength=1 -HoldHeadAnimationLength=1 -HoldTopCapAnimationLength=1 -HoldBottomCapAnimationLength=1 -HoldBodyAnimationLength=1 -HoldTailAnimationLength=1 - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 - -HoldLetGoGrayPercent=.25 - -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 - -ReverseDrawOrder=1101 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 - -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=.125 -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=.125 - -[GhostArrowDim] -InitCommand= -NoneCommand= -HitMineCommand=finishtweening;blend,'BlendMode_Add';diffuse,color("1,1,1,1;zoom,1;rotationz,0;decelerate,.3;rotationz,90;linear,.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=finishtweening;diffuse,color("1,.5,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -W4Command=finishtweening;diffuse,color(".5,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -W3Command=finishtweening;diffuse,color(".5,1,.75,1");sleep,.1;decelerate,.5;diffusealpha,0 -W2Command=finishtweening;diffuse,color("1,1,.85,1");sleep,.1;decelerate,.5;diffusealpha,0 -W1Command=finishtweening;diffuse,color("1,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -LetGoCommand=stoptweening;decelerate,.2;diffusealpha,0; -HeldCommand=finishtweening;diffuse,color("1,1,1,1");zoom,1;linear,.2;zoom,.9;linear,.1;diffusealpha,0 - -[GhostArrowBright] -InitCommand= -NoneCommand= -HitMineCommand=finishtweening;blend,'BlendMode_Add';diffuse,color("1,1,1,1");zoom,1;rotationz,0;decelerate,.3;rotationz,90;linear,.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=finishtweening;diffuse,color("1,.6,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -W4Command=finishtweening;diffuse,color(".6,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -W3Command=finishtweening;diffuse,color(".6,1,.8,1");sleep,.1;decelerate,.5;diffusealpha,0 -W2Command=finishtweening;diffuse,color("1,1,.9,1");sleep,.1;decelerate,.5;diffusealpha,0 -W1Command=finishtweening;diffuse,color("1,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 -LetGoCommand=stoptweening;decelerate,.2;diffusealpha,0; -HeldCommand=finishtweening;diffuse,color("1,1,1,1");zoom,1;linear,.2;zoom,.9;linear,.1;diffusealpha,0 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,1;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 -InitCommand=finishtweening;playcommand,"HoldingOff" - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +[Global] +FallbackNoteSkin=common + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=1 // none of these matter because Lua is handling the animation, not sprites. +TapAdditionAnimationLength=1 +TapMineAnimationLength=1 +TapLiftAnimationLength=1 +HoldHeadAnimationLength=1 +HoldTopCapAnimationLength=1 +HoldBottomCapAnimationLength=1 +HoldBodyAnimationLength=1 +HoldTailAnimationLength=1 + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 + +HoldLetGoGrayPercent=.25 + +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 + +ReverseDrawOrder=1101 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 + +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=.125 +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=.125 + +[GhostArrowDim] +InitCommand= +NoneCommand= +HitMineCommand=finishtweening;blend,'BlendMode_Add';diffuse,color("1,1,1,1;zoom,1;rotationz,0;decelerate,.3;rotationz,90;linear,.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=finishtweening;diffuse,color("1,.5,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +W4Command=finishtweening;diffuse,color(".5,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +W3Command=finishtweening;diffuse,color(".5,1,.75,1");sleep,.1;decelerate,.5;diffusealpha,0 +W2Command=finishtweening;diffuse,color("1,1,.85,1");sleep,.1;decelerate,.5;diffusealpha,0 +W1Command=finishtweening;diffuse,color("1,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +LetGoCommand=stoptweening;decelerate,.2;diffusealpha,0; +HeldCommand=finishtweening;diffuse,color("1,1,1,1");zoom,1;linear,.2;zoom,.9;linear,.1;diffusealpha,0 + +[GhostArrowBright] +InitCommand= +NoneCommand= +HitMineCommand=finishtweening;blend,'BlendMode_Add';diffuse,color("1,1,1,1");zoom,1;rotationz,0;decelerate,.3;rotationz,90;linear,.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=finishtweening;diffuse,color("1,.6,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +W4Command=finishtweening;diffuse,color(".6,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +W3Command=finishtweening;diffuse,color(".6,1,.8,1");sleep,.1;decelerate,.5;diffusealpha,0 +W2Command=finishtweening;diffuse,color("1,1,.9,1");sleep,.1;decelerate,.5;diffusealpha,0 +W1Command=finishtweening;diffuse,color("1,1,1,1");sleep,.1;decelerate,.5;diffusealpha,0 +LetGoCommand=stoptweening;decelerate,.2;diffusealpha,0; +HeldCommand=finishtweening;diffuse,color("1,1,1,1");zoom,1;linear,.2;zoom,.9;linear,.1;diffusealpha,0 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,1;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 +InitCommand=finishtweening;playcommand,"HoldingOff" + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/Down Hold Head Inactive.lua b/NoteSkins/dance/midi-note/Down Hold Head Inactive.lua index c4e785d34f..ce2f8a5c79 100644 --- a/NoteSkins/dance/midi-note/Down Hold Head Inactive.lua +++ b/NoteSkins/dance/midi-note/Down Hold Head Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Down','Hold Head Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Down','Hold Head Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/Down Receptor.lua b/NoteSkins/dance/midi-note/Down Receptor.lua index 5b0a792aaf..cb2ef38198 100644 --- a/NoteSkins/dance/midi-note/Down Receptor.lua +++ b/NoteSkins/dance/midi-note/Down Receptor.lua @@ -1,26 +1,26 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'NoneCommand'); - }; - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Flash' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'NoneCommand'); + }; + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Flash' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; +return t; diff --git a/NoteSkins/dance/midi-note/Down Roll Head Inactive.lua b/NoteSkins/dance/midi-note/Down Roll Head Inactive.lua index b75a782145..bceb68c82a 100644 --- a/NoteSkins/dance/midi-note/Down Roll Head Inactive.lua +++ b/NoteSkins/dance/midi-note/Down Roll Head Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Down','Roll Head Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Down','Roll Head Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/Down Tap Mine.lua b/NoteSkins/dance/midi-note/Down Tap Mine.lua index d6845c11d4..ae8d8bd24c 100644 --- a/NoteSkins/dance/midi-note/Down Tap Mine.lua +++ b/NoteSkins/dance/midi-note/Down Tap Mine.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap mine' ); - Frame0000=0; - Delay0000=1; - InitCommand=cmd(spin;effectclock,'beat';effectmagnitude,0,0,-180); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap mine' ); + Frame0000=0; + Delay0000=1; + InitCommand=cmd(spin;effectclock,'beat';effectmagnitude,0,0,-180); + }; +}; +return t; diff --git a/NoteSkins/dance/midi-note/Down Tap Note.lua b/NoteSkins/dance/midi-note/Down Tap Note.lua index aced2df5cd..9de3db7f01 100644 --- a/NoteSkins/dance/midi-note/Down Tap Note.lua +++ b/NoteSkins/dance/midi-note/Down Tap Note.lua @@ -1,8 +1,8 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap note' ); - Frames = Sprite.LinearFrames( 8, 1 ); - InitCommand=cmd(setstate,2); - DrawTapNoteMessageCommand=function(self,parent) - parent:spin(); - end; -}; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap note' ); + Frames = Sprite.LinearFrames( 8, 1 ); + InitCommand=cmd(setstate,2); + DrawTapNoteMessageCommand=function(self,parent) + parent:spin(); + end; +}; diff --git a/NoteSkins/dance/midi-note/Left Hold BottomCap Inactive.lua b/NoteSkins/dance/midi-note/Left Hold BottomCap Inactive.lua index 91d6647874..69bb142e52 100644 --- a/NoteSkins/dance/midi-note/Left Hold BottomCap Inactive.lua +++ b/NoteSkins/dance/midi-note/Left Hold BottomCap Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Left','Hold BottomCap Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Left','Hold BottomCap Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/Left Roll BottomCap Inactive.lua b/NoteSkins/dance/midi-note/Left Roll BottomCap Inactive.lua index cbe2ba94f2..16238c09b5 100644 --- a/NoteSkins/dance/midi-note/Left Roll BottomCap Inactive.lua +++ b/NoteSkins/dance/midi-note/Left Roll BottomCap Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Left','Roll BottomCap Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Left','Roll BottomCap Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/NoteSkin.lua b/NoteSkins/dance/midi-note/NoteSkin.lua index cba949fd6e..2f97fb4e72 100644 --- a/NoteSkins/dance/midi-note/NoteSkin.lua +++ b/NoteSkins/dance/midi-note/NoteSkin.lua @@ -1,128 +1,128 @@ --- Haggen Daze - -local ret = ... or {}; - -ret.RedirTable = -{ - Up = "Down", - Down = "Down", - Left = "Down", - Right = "Down", - UpLeft = "Down", - UpRight = "Down", -}; - -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - -- sButton, sElement = OldRedir(sButton, sElement); - - -- Instead of separate hold heads, use the tap note graphics. - if sElement == "Hold Head Active" or - sElement == "Roll Head Active" - then - sElement = "StreamHead Active"; - end - - -- Test - if sElement == "Hold Head Inactive" or - sElement == "Roll Head Inactive" or - then - sElement = "StreamHead Inactive"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - --- local OldRedir = ret.Redir; --- ret.Redir = function(sButton, sElement) - -- sButton = ret.RedirTable[sButton]; - -- return sButton, sElement; --- end - --- To have separate graphics for each hold part: -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - -- Redirect non-hold, non-roll parts. - if string.find(sElement, "hold") or string.find(sElement, "roll") then - return sButton, sElement; - end - return OldRedir(sButton, sElement); -end - ---[[ -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Roll Explosion" then - t.BaseRotationZ = nil; - end - return t; -end -]] - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - --Explosion should not be rotated; it calls other actors. - if Var "Element" == "Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Receptor"] = true, - ["Go Receptor"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Tap Note"] = true, - ["Tap Lift"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true, - ["Hold Explosion"] = true, - ["Roll Explosion"] = true, -}; -ret.Rotate = -{ - Up = 180, - Down = 0, - Left = 90, - Right = -90, - UpLeft = 135, - UpRight = 225, -}; - --- --- If a derived skin wants to have separate UpLeft graphics, --- use this: --- --- ret.RedirTable.UpLeft = "UpLeft"; --- ret.RedirTable.UpRight = "UpLeft"; --- ret.Rotate.UpLeft = 0; --- ret.Rotate.UpRight = 90; --- -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, - ["Roll Explosion"] = true, -}; - -return ret; +-- Haggen Daze + +local ret = ... or {}; + +ret.RedirTable = +{ + Up = "Down", + Down = "Down", + Left = "Down", + Right = "Down", + UpLeft = "Down", + UpRight = "Down", +}; + +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + -- sButton, sElement = OldRedir(sButton, sElement); + + -- Instead of separate hold heads, use the tap note graphics. + if sElement == "Hold Head Active" or + sElement == "Roll Head Active" + then + sElement = "StreamHead Active"; + end + + -- Test + if sElement == "Hold Head Inactive" or + sElement == "Roll Head Inactive" or + then + sElement = "StreamHead Inactive"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +-- local OldRedir = ret.Redir; +-- ret.Redir = function(sButton, sElement) + -- sButton = ret.RedirTable[sButton]; + -- return sButton, sElement; +-- end + +-- To have separate graphics for each hold part: +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + -- Redirect non-hold, non-roll parts. + if string.find(sElement, "hold") or string.find(sElement, "roll") then + return sButton, sElement; + end + return OldRedir(sButton, sElement); +end + +--[[ +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Roll Explosion" then + t.BaseRotationZ = nil; + end + return t; +end +]] + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + --Explosion should not be rotated; it calls other actors. + if Var "Element" == "Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Receptor"] = true, + ["Go Receptor"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Tap Note"] = true, + ["Tap Lift"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true, + ["Hold Explosion"] = true, + ["Roll Explosion"] = true, +}; +ret.Rotate = +{ + Up = 180, + Down = 0, + Left = 90, + Right = -90, + UpLeft = 135, + UpRight = 225, +}; + +-- +-- If a derived skin wants to have separate UpLeft graphics, +-- use this: +-- +-- ret.RedirTable.UpLeft = "UpLeft"; +-- ret.RedirTable.UpRight = "UpLeft"; +-- ret.Rotate.UpLeft = 0; +-- ret.Rotate.UpRight = 90; +-- +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, + ["Roll Explosion"] = true, +}; + +return ret; diff --git a/NoteSkins/dance/midi-note/Up Hold BottomCap Inactive.lua b/NoteSkins/dance/midi-note/Up Hold BottomCap Inactive.lua index 9666c41264..1c2efe09ab 100644 --- a/NoteSkins/dance/midi-note/Up Hold BottomCap Inactive.lua +++ b/NoteSkins/dance/midi-note/Up Hold BottomCap Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Up','Hold BottomCap Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Up','Hold BottomCap Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/Up Roll BottomCap Inactive.lua b/NoteSkins/dance/midi-note/Up Roll BottomCap Inactive.lua index 4b473af889..857066f572 100644 --- a/NoteSkins/dance/midi-note/Up Roll BottomCap Inactive.lua +++ b/NoteSkins/dance/midi-note/Up Roll BottomCap Inactive.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath('Up','Roll BottomCap Active'); - InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); +return Def.Sprite { + Texture=NOTESKIN:GetPath('Up','Roll BottomCap Active'); + InitCommand=cmd(diffuse,color("0.5,0.5,0.5,0.5")); }; \ No newline at end of file diff --git a/NoteSkins/dance/midi-note/metrics.ini b/NoteSkins/dance/midi-note/metrics.ini index 01e819ab51..600751263c 100644 --- a/NoteSkins/dance/midi-note/metrics.ini +++ b/NoteSkins/dance/midi-note/metrics.ini @@ -1,85 +1,85 @@ -[Global] -FallbackNoteSkin=default - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=4 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 -HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 - -HoldLetGoGrayPercent=0.125 - -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0.125 - -TapFakeNoteColorTextureCoordSpacingX=0 -TapFakeNoteColorTextureCoordSpacingY=0.125 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0.125 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand=blend,'BlendMode_Add'; -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[HoldGhostArrow] -HoldingOnCommand=visible,true -HoldingOffCommand=visible,false - -[ReceptorArrow] -W3Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -InitCommand= -NoneCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 -[ReceptorArrowOverlay] -W3Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 -InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 -[ReceptorOverlay] -InitCommand=diffusealpha,0;blend,"BlendMode_Add" -PressCommand=finishtweening;zoom,0.85;decelerate,0.12;zoom,1;diffusealpha,0.6; +[Global] +FallbackNoteSkin=default + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=4 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 +HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 + +HoldLetGoGrayPercent=0.125 + +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0.125 + +TapFakeNoteColorTextureCoordSpacingX=0 +TapFakeNoteColorTextureCoordSpacingY=0.125 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0.125 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand=blend,'BlendMode_Add'; +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[HoldGhostArrow] +HoldingOnCommand=visible,true +HoldingOffCommand=visible,false + +[ReceptorArrow] +W3Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +InitCommand= +NoneCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 +[ReceptorArrowOverlay] +W3Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,0.85;linear,0.12;zoom,1 +InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,0.85;linear,0.12;zoom,1 +[ReceptorOverlay] +InitCommand=diffusealpha,0;blend,"BlendMode_Add" +PressCommand=finishtweening;zoom,0.85;decelerate,0.12;zoom,1;diffusealpha,0.6; LiftCommand=finishtweening;accelerate,0.12;diffusealpha,0;zoom,1.2 \ No newline at end of file diff --git a/NoteSkins/dance/midi-routine-p1/metrics.ini b/NoteSkins/dance/midi-routine-p1/metrics.ini index 758fa5b64a..99a23a9403 100644 --- a/NoteSkins/dance/midi-routine-p1/metrics.ini +++ b/NoteSkins/dance/midi-routine-p1/metrics.ini @@ -1,23 +1,23 @@ -[Global] -FallbackNoteSkin=midi-note - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -HoldHeadAnimationIsVivid=1 -HoldTopCapAnimationIsVivid=0 -HoldBodyAnimationIsVivid=0 -HoldBottomCapAnimationIsVivid=0 -HoldTailAnimationIsVivid=0 -TapNoteAnimationIsNoteColor=0 -HoldHeadAnimationIsNoteColor=0 -HoldTopCapAnimationIsNoteColor=0 -HoldBodyAnimationIsNoteColor=0 -HoldBottomCapAnimationIsNoteColor=0 -HoldTailAnimationIsNoteColor=0 - -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0 -HoldHeadNoteColorTextureCoordSpacingX=0 +[Global] +FallbackNoteSkin=midi-note + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +HoldHeadAnimationIsVivid=1 +HoldTopCapAnimationIsVivid=0 +HoldBodyAnimationIsVivid=0 +HoldBottomCapAnimationIsVivid=0 +HoldTailAnimationIsVivid=0 +TapNoteAnimationIsNoteColor=0 +HoldHeadAnimationIsNoteColor=0 +HoldTopCapAnimationIsNoteColor=0 +HoldBodyAnimationIsNoteColor=0 +HoldBottomCapAnimationIsNoteColor=0 +HoldTailAnimationIsNoteColor=0 + +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0 +HoldHeadNoteColorTextureCoordSpacingX=0 HoldHeadNoteColorTextureCoordSpacingY=0 \ No newline at end of file diff --git a/NoteSkins/dance/midi-routine-p2/metrics.ini b/NoteSkins/dance/midi-routine-p2/metrics.ini index 66e1ce56b7..d48543d2ff 100644 --- a/NoteSkins/dance/midi-routine-p2/metrics.ini +++ b/NoteSkins/dance/midi-routine-p2/metrics.ini @@ -1,2 +1,2 @@ -[Global] +[Global] FallbackNoteSkin=midi-routine-p1 \ No newline at end of file diff --git a/NoteSkins/dance/midi-solo/Down Receptor.lua b/NoteSkins/dance/midi-solo/Down Receptor.lua index 5b0a792aaf..cb2ef38198 100644 --- a/NoteSkins/dance/midi-solo/Down Receptor.lua +++ b/NoteSkins/dance/midi-solo/Down Receptor.lua @@ -1,26 +1,26 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'NoneCommand'); - }; - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap Flash' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Receptor' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrowOverlay', 'NoneCommand'); + }; + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap Flash' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; +return t; diff --git a/NoteSkins/dance/midi-solo/Down Tap Mine.lua b/NoteSkins/dance/midi-solo/Down Tap Mine.lua index d6845c11d4..ae8d8bd24c 100644 --- a/NoteSkins/dance/midi-solo/Down Tap Mine.lua +++ b/NoteSkins/dance/midi-solo/Down Tap Mine.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame { - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap mine' ); - Frame0000=0; - Delay0000=1; - InitCommand=cmd(spin;effectclock,'beat';effectmagnitude,0,0,-180); - }; -}; -return t; +local t = Def.ActorFrame { + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap mine' ); + Frame0000=0; + Delay0000=1; + InitCommand=cmd(spin;effectclock,'beat';effectmagnitude,0,0,-180); + }; +}; +return t; diff --git a/NoteSkins/dance/midi-solo/Down Tap Note.lua b/NoteSkins/dance/midi-solo/Down Tap Note.lua index aced2df5cd..9de3db7f01 100644 --- a/NoteSkins/dance/midi-solo/Down Tap Note.lua +++ b/NoteSkins/dance/midi-solo/Down Tap Note.lua @@ -1,8 +1,8 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap note' ); - Frames = Sprite.LinearFrames( 8, 1 ); - InitCommand=cmd(setstate,2); - DrawTapNoteMessageCommand=function(self,parent) - parent:spin(); - end; -}; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap note' ); + Frames = Sprite.LinearFrames( 8, 1 ); + InitCommand=cmd(setstate,2); + DrawTapNoteMessageCommand=function(self,parent) + parent:spin(); + end; +}; diff --git a/NoteSkins/dance/midi-solo/metrics.ini b/NoteSkins/dance/midi-solo/metrics.ini index 3417381c3e..cc79f5539f 100644 --- a/NoteSkins/dance/midi-solo/metrics.ini +++ b/NoteSkins/dance/midi-solo/metrics.ini @@ -1,81 +1,81 @@ -[Global] -FallbackNoteSkin=default - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=4 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 -HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 - -HoldLetGoGrayPercent=0.125 - -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0.125 - -TapFakeNoteColorTextureCoordSpacingX=0 -TapFakeNoteColorTextureCoordSpacingY=0.125 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0.125 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand=blend,'BlendMode_Add'; -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[ReceptorArrow] -W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -InitCommand= -NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -[ReceptorArrowOverlay] -W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -[ReceptorOverlay] -InitCommand=diffusealpha,0;blend,"BlendMode_Add" -PressCommand=finishtweening;zoom,1.1;decelerate,0.12;zoom,1;diffusealpha,0.6; +[Global] +FallbackNoteSkin=default + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=4 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 +HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 + +HoldLetGoGrayPercent=0.125 + +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0.125 + +TapFakeNoteColorTextureCoordSpacingX=0 +TapFakeNoteColorTextureCoordSpacingY=0.125 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0.125 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand=blend,'BlendMode_Add'; +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[ReceptorArrow] +W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +InitCommand= +NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +[ReceptorArrowOverlay] +W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +[ReceptorOverlay] +InitCommand=diffusealpha,0;blend,"BlendMode_Add" +PressCommand=finishtweening;zoom,1.1;decelerate,0.12;zoom,1;diffusealpha,0.6; LiftCommand=finishtweening;accelerate,0.12;diffusealpha,0;zoom,1.2 \ No newline at end of file diff --git a/NoteSkins/dance/midi-vivid/metrics.ini b/NoteSkins/dance/midi-vivid/metrics.ini index 048ebc42b4..44b960d8b9 100644 --- a/NoteSkins/dance/midi-vivid/metrics.ini +++ b/NoteSkins/dance/midi-vivid/metrics.ini @@ -1,88 +1,88 @@ -[Global] -FallbackNoteSkin=midi-note - -[NoteDisplay] -TapNoteAnimationIsVivid=1 -TapAdditionAnimationIsVivid=1 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=4 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 -HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. - -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 - -HoldLetGoGrayPercent=0.125 - -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteNoteColorTextureCoordOffsetX=0 -TapNoteNoteColorTextureCoordOffsetY=0 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0 - -TapFakeNoteColorTextureCoordSpacingX=0 -TapFakeNoteColorTextureCoordSpacingY=0 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand=blend,'BlendMode_Add'; -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand=blend,'BlendMode_Add'; -W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand=blend,'BlendMode_Add'; -HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[HoldGhostArrow] -HoldingOnCommand=visible,true -HoldingOffCommand=visible,false - -[ReceptorArrow] -W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -InitCommand= -NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -[ReceptorArrowOverlay] -W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 -InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 -[ReceptorOverlay] -InitCommand=diffusealpha,0;blend,"BlendMode_Add" -PressCommand=finishtweening;zoom,1.1;decelerate,0.12;zoom,1;diffusealpha,0.6; -LiftCommand=finishtweening;accelerate,0.12;diffusealpha,0;zoom,1.2 +[Global] +FallbackNoteSkin=midi-note + +[NoteDisplay] +TapNoteAnimationIsVivid=1 +TapAdditionAnimationIsVivid=1 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=4 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 +HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. + +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 + +HoldLetGoGrayPercent=0.125 + +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteNoteColorTextureCoordOffsetX=0 +TapNoteNoteColorTextureCoordOffsetY=0 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0 + +TapFakeNoteColorTextureCoordSpacingX=0 +TapFakeNoteColorTextureCoordSpacingY=0 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand=blend,'BlendMode_Add'; +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,0.875;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand=blend,'BlendMode_Add'; +W5Command=blend,'BlendMode_Add';diffuse,0.8,0.0,0.6,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=blend,'BlendMode_Add';diffuse,0.3,0.8,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=blend,'BlendMode_Add';diffuse,0.0,1.0,0.4,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=blend,'BlendMode_Add';diffuse,1.0,1.0,1.0,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand=blend,'BlendMode_Add'; +HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[HoldGhostArrow] +HoldingOnCommand=visible,true +HoldingOffCommand=visible,false + +[ReceptorArrow] +W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +InitCommand= +NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +[ReceptorArrowOverlay] +W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,1.15;linear,0.12;zoom,1 +InitCommand=blend,"BlendMode_Add";effectclock,"beat";diffuseramp;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,1.15;linear,0.12;zoom,1 +[ReceptorOverlay] +InitCommand=diffusealpha,0;blend,"BlendMode_Add" +PressCommand=finishtweening;zoom,1.1;decelerate,0.12;zoom,1;diffusealpha,0.6; +LiftCommand=finishtweening;accelerate,0.12;diffusealpha,0;zoom,1.2 diff --git a/NoteSkins/dance/midi-vivid/res/_notes.txt b/NoteSkins/dance/midi-vivid/res/_notes.txt index 98a7d6377f..e41b0d6bab 100644 --- a/NoteSkins/dance/midi-vivid/res/_notes.txt +++ b/NoteSkins/dance/midi-vivid/res/_notes.txt @@ -1,103 +1,103 @@ -reference gradients -4th: #f99d1c -> #ed1c24 (orange -> red) -8th: #0066b3 -> #00bfe8 (blue -> cyan) -12th: #d70b8c -> #6f2c91 (pink -> purple) -16th: #fff200 -> #62bb46 (yellow -> green) -24th: #fdb813 -> #fff200 (gold -> yellow) -32nd: #f49ac1 -> #d70b8c (pinkish) -48th: #00ffff -> #00a9a4 (cyan -> dark cyan) -64th: # -> # (brown; skip me!) - -________________ -new order - -orange -> red -red -> pink -pink -> purple -purple -> blue -blue -> cyan -cyan -> green -green -> gold -gold -> orange - -#f99d1c orange -#f78b1f between orange and red 1 -======= -#f57920 between orange and red 2 -#ed1c24 red -------------------- -#d70b8c pinkish -#b43092 between pinkish and dark purple 1 -======= -#92278f between pinkish and dark purple 2 -#6f2c91 dark purple -------------------- -#0066b3 blue -#00a0da between blue and cyan 1 -======= -#00bfe8 between blue and cyan 2 -#66ffa3 cyan -------------------- -#a3ff66 green -#ccff66 between green and gold 1 -======= -#ebff66 between green and gold 2 -#faed00 gold - -________________ -:::old order::: - -arrow 1: -#ed1c24 <- incoming -#f99d1c -#d5fa1b <- outgoing -________ -arrow 2: -#ed1c9d -#ed1c24 -#f99d1c -________ -arrow 3: -#c31ced -#ed1c9d -#ed1c24 -________ -arrow 4: -#4a1ced -#c31ced -#ed1c9d -________ -arrow 5: -#1c69ed -#4a1ced -#c31ced -________ -arrow 6: -#1ce3ed -#1c69ed -#4a1ced -________ -arrow 7: -#1ced7e -#1ce3ed -#1c69ed -________ -arrow 8: -#35ed1c -#1ced7e -#1ce3ed -________ -arrow 9: -#afed1c -#35ed1c -#1ced7e -________ -arrow 10: -#edb21c -#afed1c -#35ed1c -________ -arrow 11: -#ed381c -#edb21c +reference gradients +4th: #f99d1c -> #ed1c24 (orange -> red) +8th: #0066b3 -> #00bfe8 (blue -> cyan) +12th: #d70b8c -> #6f2c91 (pink -> purple) +16th: #fff200 -> #62bb46 (yellow -> green) +24th: #fdb813 -> #fff200 (gold -> yellow) +32nd: #f49ac1 -> #d70b8c (pinkish) +48th: #00ffff -> #00a9a4 (cyan -> dark cyan) +64th: # -> # (brown; skip me!) + +________________ +new order + +orange -> red +red -> pink +pink -> purple +purple -> blue +blue -> cyan +cyan -> green +green -> gold +gold -> orange + +#f99d1c orange +#f78b1f between orange and red 1 +======= +#f57920 between orange and red 2 +#ed1c24 red +------------------- +#d70b8c pinkish +#b43092 between pinkish and dark purple 1 +======= +#92278f between pinkish and dark purple 2 +#6f2c91 dark purple +------------------- +#0066b3 blue +#00a0da between blue and cyan 1 +======= +#00bfe8 between blue and cyan 2 +#66ffa3 cyan +------------------- +#a3ff66 green +#ccff66 between green and gold 1 +======= +#ebff66 between green and gold 2 +#faed00 gold + +________________ +:::old order::: + +arrow 1: +#ed1c24 <- incoming +#f99d1c +#d5fa1b <- outgoing +________ +arrow 2: +#ed1c9d +#ed1c24 +#f99d1c +________ +arrow 3: +#c31ced +#ed1c9d +#ed1c24 +________ +arrow 4: +#4a1ced +#c31ced +#ed1c9d +________ +arrow 5: +#1c69ed +#4a1ced +#c31ced +________ +arrow 6: +#1ce3ed +#1c69ed +#4a1ced +________ +arrow 7: +#1ced7e +#1ce3ed +#1c69ed +________ +arrow 8: +#35ed1c +#1ced7e +#1ce3ed +________ +arrow 9: +#afed1c +#35ed1c +#1ced7e +________ +arrow 10: +#edb21c +#afed1c +#35ed1c +________ +arrow 11: +#ed381c +#edb21c #afed1c \ No newline at end of file diff --git a/NoteSkins/dance/retro/Down Hold Explosion.lua b/NoteSkins/dance/retro/Down Hold Explosion.lua index ab20f6d18d..919b907c15 100644 --- a/NoteSkins/dance/retro/Down Hold Explosion.lua +++ b/NoteSkins/dance/retro/Down Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("Down Tap Explosion Bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("Down Tap Explosion Bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retro/Down Receptor.lua b/NoteSkins/dance/retro/Down Receptor.lua index 6d7c570203..b538eb3b97 100644 --- a/NoteSkins/dance/retro/Down Receptor.lua +++ b/NoteSkins/dance/retro/Down Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_down receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_down receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/retro/Down Tap Note.lua b/NoteSkins/dance/retro/Down Tap Note.lua index 41f643d7d6..b5b0afd0b1 100644 --- a/NoteSkins/dance/retro/Down Tap Note.lua +++ b/NoteSkins/dance/retro/Down Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_down', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_down', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/dance/retro/NoteSkin.lua b/NoteSkins/dance/retro/NoteSkin.lua index 6bd1bf303b..dfb545f47e 100644 --- a/NoteSkins/dance/retro/NoteSkin.lua +++ b/NoteSkins/dance/retro/NoteSkin.lua @@ -1,97 +1,97 @@ --- HELP HOW DO I USE NOTESKINS - -local ret = ... or {}; - -ret.RedirTable = -{ - Up = "Down", - Down = "Down", - Left = "Down", - Right = "Down", - UpLeft = "Down", - UpRight = "Down", -}; - -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - -- Instead of separate roll heads (for now), use the tap note graphics. - if sElement == "Roll Head Inactive" or - sElement == "Roll Head Active" - then - sElement = "Tap Note"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - --- To have separate graphics for each hold part: -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - -- Redirect non-hold, non-roll parts. - if string.find(sElement, "hold") then - return sButton, sElement; - end - return OldRedir(sButton, sElement); -end - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors;it. - if Var "Element" == "Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Receptor"] = true, - ["Go Receptor"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Tap Note"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true, - ["Hold Explosion"] = true, - ["Roll Explosion"] = true, -}; -ret.Rotate = -{ - Up = 180, - Down = 0, - Left = 90, - Right = -90, - UpLeft = 135, - UpRight = 225, -}; - --- If a derived skin wants to have separate UpLeft graphics, --- use this: - -ret.RedirTable.UpLeft = "UpLeft"; -ret.RedirTable.UpRight = "UpLeft"; -ret.Rotate.UpLeft = 0; -ret.Rotate.UpRight = 90; - -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +-- HELP HOW DO I USE NOTESKINS + +local ret = ... or {}; + +ret.RedirTable = +{ + Up = "Down", + Down = "Down", + Left = "Down", + Right = "Down", + UpLeft = "Down", + UpRight = "Down", +}; + +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + -- Instead of separate roll heads (for now), use the tap note graphics. + if sElement == "Roll Head Inactive" or + sElement == "Roll Head Active" + then + sElement = "Tap Note"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +-- To have separate graphics for each hold part: +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + -- Redirect non-hold, non-roll parts. + if string.find(sElement, "hold") then + return sButton, sElement; + end + return OldRedir(sButton, sElement); +end + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors;it. + if Var "Element" == "Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Receptor"] = true, + ["Go Receptor"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Tap Note"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true, + ["Hold Explosion"] = true, + ["Roll Explosion"] = true, +}; +ret.Rotate = +{ + Up = 180, + Down = 0, + Left = 90, + Right = -90, + UpLeft = 135, + UpRight = 225, +}; + +-- If a derived skin wants to have separate UpLeft graphics, +-- use this: + +ret.RedirTable.UpLeft = "UpLeft"; +ret.RedirTable.UpRight = "UpLeft"; +ret.Rotate.UpLeft = 0; +ret.Rotate.UpRight = 90; + +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/dance/retro/UpLeft Hold Explosion.lua b/NoteSkins/dance/retro/UpLeft Hold Explosion.lua index 0e64ab7a22..5754ac5f54 100644 --- a/NoteSkins/dance/retro/UpLeft Hold Explosion.lua +++ b/NoteSkins/dance/retro/UpLeft Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("UpLeft Tap Explosion Bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("UpLeft Tap Explosion Bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retro/UpLeft Tap Note.lua b/NoteSkins/dance/retro/UpLeft Tap Note.lua index ea13f210a3..329652b448 100644 --- a/NoteSkins/dance/retro/UpLeft Tap Note.lua +++ b/NoteSkins/dance/retro/UpLeft Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_UpLeft', 'Tap Note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_UpLeft', 'Tap Note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/dance/retro/metrics.ini b/NoteSkins/dance/retro/metrics.ini index a355d4ec65..d2da1913a8 100644 --- a/NoteSkins/dance/retro/metrics.ini +++ b/NoteSkins/dance/retro/metrics.ini @@ -1,78 +1,78 @@ -[Global] -#FallbackNoteSkin=common - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=4 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 -HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. -HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 // top of tail -HoldLetGoGrayPercent=0.25 -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteAdditionTextureCoordOffsetX=0.5 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0.125 - -TapFakeNoteColorTextureCoordSpacingX=0 -TapFakeNoteColorTextureCoordSpacingY=0.125 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0.125 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[GhostArrowBright] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 - -[ReceptorArrow] -W3Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 -W2Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 -W1Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=stoptweening;zoom,0.75;linear,0.12;zoom,1 -PressCommand=stoptweening;zoom,0.75;linear,0.12;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.6 -LiftCommand=finishtweening;decelerate,.12;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -#HoldingOnCommand=diffusealpha,0;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOnCommand=diffusealpha,1;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[Global] +#FallbackNoteSkin=common + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=4 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 +HoldHeadAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTopCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBottomCapAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldBodyAnimationLength=4 // doesn't matter. Only 1 frame anyway. +HoldTailAnimationLength=4 // doesn't matter. Only 1 frame anyway. +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 // top of tail +HoldLetGoGrayPercent=0.25 +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteAdditionTextureCoordOffsetX=0.5 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0.125 + +TapFakeNoteColorTextureCoordSpacingX=0 +TapFakeNoteColorTextureCoordSpacingY=0.125 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0.125 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[GhostArrowBright] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0 + +[ReceptorArrow] +W3Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 +W2Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 +W1Command=stoptweening;zoom,0.75;linear,0.12;zoom,1 +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=stoptweening;zoom,0.75;linear,0.12;zoom,1 +PressCommand=stoptweening;zoom,0.75;linear,0.12;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.6 +LiftCommand=finishtweening;decelerate,.12;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +#HoldingOnCommand=diffusealpha,0;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOnCommand=diffusealpha,1;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/dance/retro/ye olde noteskins/Right Receptor.lua b/NoteSkins/dance/retro/ye olde noteskins/Right Receptor.lua index bd090f742c..fe7bc5cf77 100644 --- a/NoteSkins/dance/retro/ye olde noteskins/Right Receptor.lua +++ b/NoteSkins/dance/retro/ye olde noteskins/Right Receptor.lua @@ -1,3 +1,3 @@ -return LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( "Left", "Go Receptor" ) )..{ - InitCommand=cmd(zoomx,-1); +return LoadActor( NOTESKIN:GetPath("", "_Tap Receptor"), NOTESKIN:LoadActor( "Left", "Go Receptor" ) )..{ + InitCommand=cmd(zoomx,-1); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/Blue Tap Note.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/Blue Tap Note.lua index ed7d3170c9..36483e9909 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/Blue Tap Note.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/Blue Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/Blue receptor.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/Blue receptor.lua index 6ec0a4d6b2..6dbf729628 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/Blue receptor.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/Blue receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_blue', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_blue', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/Noteskin.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/Noteskin.lua index 4c8ecb5b13..c9e86c9ee5 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/Noteskin.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/Noteskin.lua @@ -1,94 +1,94 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; - -- Instead of separate hold heads, use the tap note graphics. - ["Hold Head Inactive"] = "Tap Note"; - ["Hold Head Active"] = "Tap Note"; - ["Roll Head Inactive"] = "Tap Note"; - ["Roll Head Active"] = "Tap Note"; -}; - --- button redirs --- this noteskin is only for solo play. --- [white][white][white] [blue][blue][blue] -Noteskin.ButtonRedirs = { - -- dance - Left = "White"; - UpLeft = "White"; - Down = "White"; - Up = "Blue"; - UpRight = "Blue"; - Right = "Blue"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; + -- Instead of separate hold heads, use the tap note graphics. + ["Hold Head Inactive"] = "Tap Note"; + ["Hold Head Active"] = "Tap Note"; + ["Roll Head Inactive"] = "Tap Note"; + ["Roll Head Active"] = "Tap Note"; +}; + +-- button redirs +-- this noteskin is only for solo play. +-- [white][white][white] [blue][blue][blue] +Noteskin.ButtonRedirs = { + -- dance + Left = "White"; + UpLeft = "White"; + Down = "White"; + Up = "Blue"; + UpRight = "Blue"; + Right = "Blue"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/White Tap Note.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/White Tap Note.lua index 653997ff60..9f84b8f9ce 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/White Tap Note.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/White Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_White', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_White', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/White receptor.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/White receptor.lua index 59dfba60c1..c45dcab2f4 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/White receptor.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/White receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_white', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_white', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/_Hold Explosion.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/_Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/_Hold Explosion.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/_Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/_Receptor.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/_Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/_Receptor.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/_Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/_Roll Explosion.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/_Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/_Roll Explosion.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/_Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/_Tap Mine.lua b/NoteSkins/dance/retrobar-splithand_whiteblue/_Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/_Tap Mine.lua +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/_Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar-splithand_whiteblue/metrics.ini b/NoteSkins/dance/retrobar-splithand_whiteblue/metrics.ini index bb74895a50..aa0ad15f26 100644 --- a/NoteSkins/dance/retrobar-splithand_whiteblue/metrics.ini +++ b/NoteSkins/dance/retrobar-splithand_whiteblue/metrics.ini @@ -1,33 +1,33 @@ -[NoteDisplay] -HoldLetGoGrayPercent=.8 -DrawHoldHeadForTapsOnSameRow=0 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0 -# control the vertical -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0.5 - -TapFakeAdditionTextureCoordOffsetX=0 -TapFakeAdditionTextureCoordOffsetY=0 -TapLiftAdditionTextureCoordOffsetX=0 -TapLiftAdditionTextureCoordOffsetY=0 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 -LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[NoteDisplay] +HoldLetGoGrayPercent=.8 +DrawHoldHeadForTapsOnSameRow=0 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0 +# control the vertical +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0.5 + +TapFakeAdditionTextureCoordOffsetX=0 +TapFakeAdditionTextureCoordOffsetY=0 +TapLiftAdditionTextureCoordOffsetX=0 +TapLiftAdditionTextureCoordOffsetY=0 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Bar Hold Explosion.lua b/NoteSkins/dance/retrobar/Bar Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/dance/retrobar/Bar Hold Explosion.lua +++ b/NoteSkins/dance/retrobar/Bar Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Bar Receptor.lua b/NoteSkins/dance/retrobar/Bar Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/dance/retrobar/Bar Receptor.lua +++ b/NoteSkins/dance/retrobar/Bar Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Bar Roll Explosion.lua b/NoteSkins/dance/retrobar/Bar Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/dance/retrobar/Bar Roll Explosion.lua +++ b/NoteSkins/dance/retrobar/Bar Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Bar Tap Mine.lua b/NoteSkins/dance/retrobar/Bar Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/dance/retrobar/Bar Tap Mine.lua +++ b/NoteSkins/dance/retrobar/Bar Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Bar Tap Note.lua b/NoteSkins/dance/retrobar/Bar Tap Note.lua index d4ed127172..ea3c40560f 100644 --- a/NoteSkins/dance/retrobar/Bar Tap Note.lua +++ b/NoteSkins/dance/retrobar/Bar Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/Noteskin.lua b/NoteSkins/dance/retrobar/Noteskin.lua index 32ee244f53..5155db3306 100644 --- a/NoteSkins/dance/retrobar/Noteskin.lua +++ b/NoteSkins/dance/retrobar/Noteskin.lua @@ -1,99 +1,99 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; -}; - --- button redirs (since this is a bar noteskin, it's all the same) -Noteskin.ButtonRedirs = { - -- dance - Left = "Bar"; - UpLeft = "Bar"; - Up = "Bar"; - Down = "Bar"; - UpRight = "Bar"; - Right = "Bar"; - -- kb7 - Key1 = "Bar"; - Key2 = "Bar"; - Key3 = "Bar"; - Key4 = "Bar"; - Key5 = "Bar"; - Key6 = "Bar"; - Key7 = "Bar"; - -- pump - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; +}; + +-- button redirs (since this is a bar noteskin, it's all the same) +Noteskin.ButtonRedirs = { + -- dance + Left = "Bar"; + UpLeft = "Bar"; + Up = "Bar"; + Down = "Bar"; + UpRight = "Bar"; + Right = "Bar"; + -- kb7 + Key1 = "Bar"; + Key2 = "Bar"; + Key3 = "Bar"; + Key4 = "Bar"; + Key5 = "Bar"; + Key6 = "Bar"; + Key7 = "Bar"; + -- pump + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/dance/retrobar/metrics.ini b/NoteSkins/dance/retrobar/metrics.ini index df26d41d03..e7de8ccadb 100644 --- a/NoteSkins/dance/retrobar/metrics.ini +++ b/NoteSkins/dance/retrobar/metrics.ini @@ -1,27 +1,27 @@ -[NoteDisplay] -DrawHoldHeadForTapsOnSameRow=0 -HoldBodyAnimationLength=1 -HoldTailAnimationLength=1 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=0 - -HoldLetGoGrayPercent=.8 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -TopHoldAnchorWhenReverse=0 - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 -LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[NoteDisplay] +DrawHoldHeadForTapsOnSameRow=0 +HoldBodyAnimationLength=1 +HoldTailAnimationLength=1 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=0 + +HoldLetGoGrayPercent=.8 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +TopHoldAnchorWhenReverse=0 + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/instructions.txt b/NoteSkins/instructions.txt index bae9c90e76..644a139b49 100644 --- a/NoteSkins/instructions.txt +++ b/NoteSkins/instructions.txt @@ -1,30 +1,30 @@ -How to Install Noteskins: - -1) Determine how the noteskins are packaged. - -path in archive | extract to -------------------------|----------------------- -NoteSkins\dance\MyDance | StepMania root folder -dance\MyDance | NoteSkins folder -MyDance | Whichever gametype folder (see Step 2) - -2) Figure out the game type if necessary. - -Valid gametypes: - -name | description ---------|------------ -beat | beatmania (5 and 7 keys) -dance | dance dance revolution (4 panels) -ds3ddx | ds3d DX -ez2 | Ez2Dancer -guitar | guitar * (5 keys, so Guitar Hero for now) -karaoke | karaoke (unimplemented) -kb7 | keyboard 7 (<del>7</del> 6 keys now?) -lights | lights (unused) -maniax | dance maniax (4 receptors) -techno | techno motion (4, 5, and 8 panels) -popn | pop'n music (5 and 9 keys) -pump | pump it up (5 panels) - +How to Install Noteskins: + +1) Determine how the noteskins are packaged. + +path in archive | extract to +------------------------|----------------------- +NoteSkins\dance\MyDance | StepMania root folder +dance\MyDance | NoteSkins folder +MyDance | Whichever gametype folder (see Step 2) + +2) Figure out the game type if necessary. + +Valid gametypes: + +name | description +--------|------------ +beat | beatmania (5 and 7 keys) +dance | dance dance revolution (4 panels) +ds3ddx | ds3d DX +ez2 | Ez2Dancer +guitar | guitar * (5 keys, so Guitar Hero for now) +karaoke | karaoke (unimplemented) +kb7 | keyboard 7 (<del>7</del> 6 keys now?) +lights | lights (unused) +maniax | dance maniax (4 receptors) +techno | techno motion (4, 5, and 8 panels) +popn | pop'n music (5 and 9 keys) +pump | pump it up (5 panels) + 3) extract based on steps 1 and 2. \ No newline at end of file diff --git a/NoteSkins/kb7/default/Key Tap Note.lua b/NoteSkins/kb7/default/Key Tap Note.lua index 9415a36c96..2adb303974 100644 --- a/NoteSkins/kb7/default/Key Tap Note.lua +++ b/NoteSkins/kb7/default/Key Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_key', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); -}; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_key', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); +}; diff --git a/NoteSkins/kb7/default/NoteSkin.lua b/NoteSkins/kb7/default/NoteSkin.lua index d82563a4be..00bb49907e 100644 --- a/NoteSkins/kb7/default/NoteSkin.lua +++ b/NoteSkins/kb7/default/NoteSkin.lua @@ -1,103 +1,103 @@ -local ret = ... or {}; - -ret.RedirTable = -{ - Key1 = "Key", - Key2 = "Key", - Key3 = "Key", - -- should work? doesn't though. - Key4 = GAMESTATE:IsSideJoined('PlayerNumber_P2') and "Space" or "Key", - Key5 = "Key", - Key6 = "Key", - Key7 = "Key", -}; - -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - sButton, sElement = OldRedir(sButton, sElement); - - -- Instead of separate hold heads, use the tap note graphics. - if sElement == "Hold Head Inactive" or - sElement == "Hold Head Active" or - sElement == "Roll Head Inactive" or - sElement == "Roll Head Active" - then - sElement = "Tap Note"; - end - - sButton = ret.RedirTable[sButton]; - - return sButton, sElement; -end - --- To have separate graphics for each hold part: ---[[ -local OldRedir = ret.Redir; -ret.Redir = function(sButton, sElement) - -- Redirect non-hold, non-roll parts. - if string.find(sElement, "hold") then - return sButton, sElement; - end - return OldRedir(sButton, sElement); -end -]] - -local OldFunc = ret.Load; -function ret.Load() - local t = OldFunc(); - - -- The main "Explosion" part just loads other actors; don't rotate - -- it. The "Hold Explosion" part should not be rotated. - if Var "Element" == "Explosion" or - Var "Element" == "Roll Explosion" or - Var "Element" == "Hold Explosion" then - t.BaseRotationZ = nil; - end - return t; -end - -ret.PartsToRotate = -{ - ["Go Receptor"] = true, - ["Ready Receptor"] = true, - ["Tap Explosion Bright"] = true, - ["Tap Explosion Dim"] = true, - ["Tap Note"] = true, - ["Hold Head Active"] = true, - ["Hold Head Inactive"] = true, - ["Roll Head Active"] = true, - ["Roll Head Inactive"] = true, -}; -ret.Rotate = -{ - Key1 = 0, - Key2 = 0, - Key3 = 0, - Key4 = 0, - Key5 = 0, - Key6 = 0, - Key7 = 0, -}; - --- --- If a derived skin wants to have separate UpLeft graphics, --- use this: --- --- ret.RedirTable.UpLeft = "UpLeft"; --- ret.RedirTable.UpRight = "UpLeft"; --- ret.Rotate.UpLeft = 0; --- ret.Rotate.UpRight = 90; --- -ret.Blank = -{ - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true, -}; - -return ret; +local ret = ... or {}; + +ret.RedirTable = +{ + Key1 = "Key", + Key2 = "Key", + Key3 = "Key", + -- should work? doesn't though. + Key4 = GAMESTATE:IsSideJoined('PlayerNumber_P2') and "Space" or "Key", + Key5 = "Key", + Key6 = "Key", + Key7 = "Key", +}; + +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + sButton, sElement = OldRedir(sButton, sElement); + + -- Instead of separate hold heads, use the tap note graphics. + if sElement == "Hold Head Inactive" or + sElement == "Hold Head Active" or + sElement == "Roll Head Inactive" or + sElement == "Roll Head Active" + then + sElement = "Tap Note"; + end + + sButton = ret.RedirTable[sButton]; + + return sButton, sElement; +end + +-- To have separate graphics for each hold part: +--[[ +local OldRedir = ret.Redir; +ret.Redir = function(sButton, sElement) + -- Redirect non-hold, non-roll parts. + if string.find(sElement, "hold") then + return sButton, sElement; + end + return OldRedir(sButton, sElement); +end +]] + +local OldFunc = ret.Load; +function ret.Load() + local t = OldFunc(); + + -- The main "Explosion" part just loads other actors; don't rotate + -- it. The "Hold Explosion" part should not be rotated. + if Var "Element" == "Explosion" or + Var "Element" == "Roll Explosion" or + Var "Element" == "Hold Explosion" then + t.BaseRotationZ = nil; + end + return t; +end + +ret.PartsToRotate = +{ + ["Go Receptor"] = true, + ["Ready Receptor"] = true, + ["Tap Explosion Bright"] = true, + ["Tap Explosion Dim"] = true, + ["Tap Note"] = true, + ["Hold Head Active"] = true, + ["Hold Head Inactive"] = true, + ["Roll Head Active"] = true, + ["Roll Head Inactive"] = true, +}; +ret.Rotate = +{ + Key1 = 0, + Key2 = 0, + Key3 = 0, + Key4 = 0, + Key5 = 0, + Key6 = 0, + Key7 = 0, +}; + +-- +-- If a derived skin wants to have separate UpLeft graphics, +-- use this: +-- +-- ret.RedirTable.UpLeft = "UpLeft"; +-- ret.RedirTable.UpRight = "UpLeft"; +-- ret.Rotate.UpLeft = 0; +-- ret.Rotate.UpRight = 90; +-- +ret.Blank = +{ + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true, +}; + +return ret; diff --git a/NoteSkins/kb7/default/Space Receptor.lua b/NoteSkins/kb7/default/Space Receptor.lua index ac83a6d2ab..b2edd4ec6c 100644 --- a/NoteSkins/kb7/default/Space Receptor.lua +++ b/NoteSkins/kb7/default/Space Receptor.lua @@ -1 +1 @@ -return Def.Actor {} +return Def.Actor {} diff --git a/NoteSkins/kb7/default/Space Tap Note.lua b/NoteSkins/kb7/default/Space Tap Note.lua index a3e5658a56..916fabe7e5 100644 --- a/NoteSkins/kb7/default/Space Tap Note.lua +++ b/NoteSkins/kb7/default/Space Tap Note.lua @@ -1,5 +1,5 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_space', 'tap note' ); - -- probably don't need this line - Frames = Sprite.LinearFrames( 1, 1 ); -}; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_space', 'tap note' ); + -- probably don't need this line + Frames = Sprite.LinearFrames( 1, 1 ); +}; diff --git a/NoteSkins/kb7/default/metrics.ini b/NoteSkins/kb7/default/metrics.ini index 84d07489b2..2215640713 100644 --- a/NoteSkins/kb7/default/metrics.ini +++ b/NoteSkins/kb7/default/metrics.ini @@ -1,68 +1,68 @@ -[Global] -#FallbackNoteSkin=common - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLength=4 -TapAdditionAnimationLength=4 -TapMineAnimationLength=1 -TapLiftAnimationLength=4 -HoldHeadAnimationLength=4 -HoldTopCapAnimationLength=4 -HoldBottomCapAnimationLength=4 -HoldBodyAnimationLength=4 -HoldTailAnimationLength=4 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 -HoldLetGoGrayPercent=0.25 -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0 -TapNoteNoteColorTextureCoordSpacingY=0.125 -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0.125 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;smooth,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -[GhostArrowBright] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -[ReceptorArrow] -W3Command= -W2Command= -W1Command= -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color("0.8,0.8,0.8,1");effectcolor2,color("1,1,1,1");effecttiming,0.2,0,0.8,0;effectoffset,0.05 -NoneCommand=zoom,0.8;linear,0.1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=blend,"BlendMode_Add";diffusealpha,0.6 +[Global] +#FallbackNoteSkin=common + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLength=4 +TapAdditionAnimationLength=4 +TapMineAnimationLength=1 +TapLiftAnimationLength=4 +HoldHeadAnimationLength=4 +HoldTopCapAnimationLength=4 +HoldBottomCapAnimationLength=4 +HoldBodyAnimationLength=4 +HoldTailAnimationLength=4 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 +HoldLetGoGrayPercent=0.25 +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0 +TapNoteNoteColorTextureCoordSpacingY=0.125 +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0.125 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;smooth,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +[GhostArrowBright] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +[ReceptorArrow] +W3Command= +W2Command= +W1Command= +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color("0.8,0.8,0.8,1");effectcolor2,color("1,1,1,1");effecttiming,0.2,0,0.8,0;effectoffset,0.05 +NoneCommand=zoom,0.8;linear,0.1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=blend,"BlendMode_Add";diffusealpha,0.6 LiftCommand=diffusealpha,0 \ No newline at end of file diff --git a/NoteSkins/kb7/orbital/Bar Receptor.lua b/NoteSkins/kb7/orbital/Bar Receptor.lua index eb9c7f6d0f..8949ca99b6 100644 --- a/NoteSkins/kb7/orbital/Bar Receptor.lua +++ b/NoteSkins/kb7/orbital/Bar Receptor.lua @@ -1,13 +1,13 @@ -local t = Def.ActorFrame { - LoadActor( "Bar Go Receptor" )..{ - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - LoadActor( "Bar Go Receptor" )..{ - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; -return t; +local t = Def.ActorFrame { + LoadActor( "Bar Go Receptor" )..{ + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + LoadActor( "Bar Go Receptor" )..{ + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; +return t; diff --git a/NoteSkins/kb7/orbital/Noteskin.lua b/NoteSkins/kb7/orbital/Noteskin.lua index cc47a8f0ed..f3ab950d60 100644 --- a/NoteSkins/kb7/orbital/Noteskin.lua +++ b/NoteSkins/kb7/orbital/Noteskin.lua @@ -1,107 +1,107 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; -}; - --- button redirs (since this is a bar noteskin, it's all the same) -Noteskin.ButtonRedirs = { - -- dance - Left = "Red"; - UpLeft = "Red"; - Up = "Red"; - Down = "Red"; - UpRight = "Red"; - Right = "Red"; - -- kb7 - Key1 = "Red"; - Key2 = "Red"; - Key3 = "Red"; - Key4 = "Yellow"; - Key5 = "Red"; - Key6 = "Red"; - Key7 = "Red"; - -- pump - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; - ["Hold Topcap Active"] = true, - ["Hold Topcap Inactive"] = true, - ["Roll Topcap Active"] = true, - ["Roll Topcap Inactive"] = true, - ["Hold Tail Active"] = true, - ["Hold Tail Inactive"] = true, - ["Roll Tail Active"] = true, - ["Roll Tail Inactive"] = true -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; +}; + +-- button redirs (since this is a bar noteskin, it's all the same) +Noteskin.ButtonRedirs = { + -- dance + Left = "Red"; + UpLeft = "Red"; + Up = "Red"; + Down = "Red"; + UpRight = "Red"; + Right = "Red"; + -- kb7 + Key1 = "Red"; + Key2 = "Red"; + Key3 = "Red"; + Key4 = "Yellow"; + Key5 = "Red"; + Key6 = "Red"; + Key7 = "Red"; + -- pump + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; + ["Hold Topcap Active"] = true, + ["Hold Topcap Inactive"] = true, + ["Roll Topcap Active"] = true, + ["Roll Topcap Inactive"] = true, + ["Hold Tail Active"] = true, + ["Hold Tail Inactive"] = true, + ["Roll Tail Active"] = true, + ["Roll Tail Inactive"] = true +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/orbital/Red Tap Note.lua b/NoteSkins/kb7/orbital/Red Tap Note.lua index ba3b12eb0e..6566bc622b 100644 --- a/NoteSkins/kb7/orbital/Red Tap Note.lua +++ b/NoteSkins/kb7/orbital/Red Tap Note.lua @@ -1,6 +1,6 @@ -local t = Def.Model { - Meshes=NOTESKIN:GetPath('','model/note.txt'); - Materials=NOTESKIN:GetPath('','model/grey.txt'); - Bones=NOTESKIN:GetPath('','model/note.txt'); -}; +local t = Def.Model { + Meshes=NOTESKIN:GetPath('','model/note.txt'); + Materials=NOTESKIN:GetPath('','model/grey.txt'); + Bones=NOTESKIN:GetPath('','model/note.txt'); +}; return t; \ No newline at end of file diff --git a/NoteSkins/kb7/orbital/Yellow Receptor.lua b/NoteSkins/kb7/orbital/Yellow Receptor.lua index aea3765cb1..9e1201f817 100644 --- a/NoteSkins/kb7/orbital/Yellow Receptor.lua +++ b/NoteSkins/kb7/orbital/Yellow Receptor.lua @@ -1,13 +1,13 @@ -local t = Def.ActorFrame { - LoadActor( "Yellow Go Receptor" )..{ - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; - LoadActor( "Yellow Go Receptor" )..{ - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; -return t; +local t = Def.ActorFrame { + LoadActor( "Yellow Go Receptor" )..{ + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; + LoadActor( "Yellow Go Receptor" )..{ + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; +return t; diff --git a/NoteSkins/kb7/orbital/Yellow Tap Note.lua b/NoteSkins/kb7/orbital/Yellow Tap Note.lua index cf1bf25680..c15e17da25 100644 --- a/NoteSkins/kb7/orbital/Yellow Tap Note.lua +++ b/NoteSkins/kb7/orbital/Yellow Tap Note.lua @@ -1,6 +1,6 @@ -local t = Def.Model { - Meshes=NOTESKIN:GetPath('','model/note-wide.txt'); - Materials=NOTESKIN:GetPath('','model/yellow.txt'); - Bones=NOTESKIN:GetPath('','model/note-wide.txt'); -}; +local t = Def.Model { + Meshes=NOTESKIN:GetPath('','model/note-wide.txt'); + Materials=NOTESKIN:GetPath('','model/yellow.txt'); + Bones=NOTESKIN:GetPath('','model/note-wide.txt'); +}; return t; \ No newline at end of file diff --git a/NoteSkins/kb7/orbital/metrics.ini b/NoteSkins/kb7/orbital/metrics.ini index 0ee1350e77..7ad5692c97 100644 --- a/NoteSkins/kb7/orbital/metrics.ini +++ b/NoteSkins/kb7/orbital/metrics.ini @@ -1,68 +1,68 @@ -[Global] -#FallbackNoteSkin=common - -[NoteDisplay] -TapNoteAnimationIsVivid=0 -DrawHoldHeadForTapsOnSameRow=1 -TapNoteAnimationLengthInBeats=4 -TapAdditionAnimationLengthInBeats=4 -TapMineAnimationLengthInBeats=1 -TapLiftAnimationLengthInBeats=4 -HoldHeadAnimationLengthInBeats=4 -HoldTopCapAnimationLengthInBeats=4 -HoldBottomCapAnimationLengthInBeats=4 -HoldBodyAnimationLengthInBeats=4 -HoldTailAnimationLengthInBeats=4 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 -HoldLetGoGrayPercent=0.25 -ReverseDrawOrder=1101 -HoldHeadIsAboveWavyParts=1 -HoldTailIsAboveWavyParts=1 -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0 -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=1 - -TapNoteNoteColorTextureCoordSpacingX=0.125 -TapNoteNoteColorTextureCoordSpacingY=0 -HoldHeadNoteColorTextureCoordSpacingX=0.125 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[GhostArrowDim] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;smooth,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -[GhostArrowBright] -NoneCommand= -HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 -MissCommand= -W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 -LetGoCommand= -HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 - -[ReceptorArrow] -W3Command= -W2Command= -W1Command= -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color("0.8,0.8,0.8,1");effectcolor2,color("1,1,1,1");effecttiming,0.2,0,0.8,0;effectoffset,0.05 -NoneCommand=zoom,0.8;linear,0.1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=blend,"BlendMode_Add";diffusealpha,0.6 +[Global] +#FallbackNoteSkin=common + +[NoteDisplay] +TapNoteAnimationIsVivid=0 +DrawHoldHeadForTapsOnSameRow=1 +TapNoteAnimationLengthInBeats=4 +TapAdditionAnimationLengthInBeats=4 +TapMineAnimationLengthInBeats=1 +TapLiftAnimationLengthInBeats=4 +HoldHeadAnimationLengthInBeats=4 +HoldTopCapAnimationLengthInBeats=4 +HoldBottomCapAnimationLengthInBeats=4 +HoldBodyAnimationLengthInBeats=4 +HoldTailAnimationLengthInBeats=4 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 +HoldLetGoGrayPercent=0.25 +ReverseDrawOrder=1101 +HoldHeadIsAboveWavyParts=1 +HoldTailIsAboveWavyParts=1 +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0 +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=1 + +TapNoteNoteColorTextureCoordSpacingX=0.125 +TapNoteNoteColorTextureCoordSpacingY=0 +HoldHeadNoteColorTextureCoordSpacingX=0.125 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[GhostArrowDim] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;smooth,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +[GhostArrowBright] +NoneCommand= +HitMineCommand=blend,'BlendMode_Add';diffuse,1,1,1,1;zoom,1;rotationz,0;linear,0.3;rotationz,90;linear,0.3;rotationz,180;diffusealpha,0 +MissCommand= +W5Command=diffuse,0.8,0.0,0.6,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W4Command=diffuse,0.3,0.8,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W3Command=diffuse,0.0,1.0,0.4,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W2Command=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +W1Command=diffuse,1.0,1.0,1.0,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 +LetGoCommand= +HeldCommand=diffuse,1.0,1.0,0.3,1;zoom,1;decelerate,0.1;zoom,1.1;decelerate,0.1;diffusealpha,0 + +[ReceptorArrow] +W3Command= +W2Command= +W1Command= +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color("0.8,0.8,0.8,1");effectcolor2,color("1,1,1,1");effecttiming,0.2,0,0.8,0;effectoffset,0.05 +NoneCommand=zoom,0.8;linear,0.1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=blend,"BlendMode_Add";diffusealpha,0.6 LiftCommand=diffusealpha,0 \ No newline at end of file diff --git a/NoteSkins/kb7/orbital/model/grey.txt b/NoteSkins/kb7/orbital/model/grey.txt index 170e5dfd75..9537f3cdb4 100644 --- a/NoteSkins/kb7/orbital/model/grey.txt +++ b/NoteSkins/kb7/orbital/model/grey.txt @@ -1,19 +1,19 @@ -Materials: 2 -"scroll" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"scroller.ini" -"" -"frame" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"_grey (no mipmaps).png" -"" +Materials: 2 +"scroll" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"scroller.ini" +"" +"frame" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"_grey (no mipmaps).png" +"" diff --git a/NoteSkins/kb7/orbital/model/note-wide.txt b/NoteSkins/kb7/orbital/model/note-wide.txt index b88aea4fdf..be213d8a14 100644 --- a/NoteSkins/kb7/orbital/model/note-wide.txt +++ b/NoteSkins/kb7/orbital/model/note-wide.txt @@ -1,316 +1,316 @@ -// MilkShape 3D ASCII - -Frames: 30 -Frame: 1 - -Meshes: 2 -"scroll" 0 0 -17 -0 28.576029 12.295176 2.879607 0.114769 0.235221 -1 -0 22.456854 18.468002 2.879607 0.103466 0.102288 -1 -0 0.000001 -0.000001 2.879607 0.061984 0.500000 -1 -0 31.867174 4.250518 2.879607 0.120849 0.408464 -1 -0 31.829239 -4.441243 2.879607 0.120779 0.595643 -1 -0 28.467997 -12.456865 2.879607 0.114570 0.768261 -1 -0 22.295166 -18.576036 2.879607 0.103167 0.900038 -1 -0 14.250505 -21.867176 2.879607 0.088308 0.970913 -1 -0 -14.441256 -21.829237 2.879607 0.035309 0.970096 -1 -0 -22.456873 -18.467987 2.879607 0.020503 0.897711 -1 -0 -28.576046 -12.295153 2.879607 0.009200 0.764778 -1 -0 -31.867182 -4.250491 2.879607 0.003120 0.591535 -1 -0 -31.829235 4.441269 2.879607 0.003190 0.404357 -1 -0 -28.467979 12.456886 2.879607 0.009399 0.231739 -1 -0 -22.295141 18.576052 2.879607 0.020802 0.099962 -1 -0 -14.250477 21.867180 2.879607 0.035661 0.029087 -1 -0 14.441284 21.829229 2.879607 0.088660 0.029904 -1 -1 -0.000000 0.000000 1.000000 -16 -0 0 1 2 0 0 0 1 -0 2 3 0 0 0 0 1 -0 2 4 3 0 0 0 1 -0 2 5 4 0 0 0 1 -0 2 6 5 0 0 0 1 -0 2 7 6 0 0 0 1 -0 2 8 7 0 0 0 1 -0 2 9 8 0 0 0 1 -0 2 10 9 0 0 0 1 -0 2 11 10 0 0 0 1 -0 2 12 11 0 0 0 1 -0 2 13 12 0 0 0 1 -0 2 14 13 0 0 0 1 -0 2 15 14 0 0 0 1 -0 2 16 15 0 0 0 1 -0 2 1 16 0 0 0 1 -"frame" 1 1 -65 -1 0.000000 -0.000000 3.321190 0.500000 0.500000 -1 -1 27.639259 11.675143 3.321190 0.856463 0.427477 -1 -1 21.828669 17.536682 3.321190 0.801575 0.296586 -1 -1 30.764435 4.036170 3.321190 0.857082 0.569410 -1 -1 30.728415 -4.217276 3.321190 0.803338 0.700776 -1 -1 27.536673 -11.828679 3.321190 0.703414 0.801575 -1 -1 21.675133 -17.639269 3.321190 0.572522 0.856463 -1 -1 14.036156 -20.764439 3.321190 0.430590 0.857082 -1 -1 -14.217289 -20.728411 3.321190 0.299224 0.803338 -1 -1 -21.828686 -17.536667 3.321190 0.198425 0.703414 -1 -1 -27.639275 -11.675121 3.321190 0.143537 0.572522 -1 -1 -30.764442 -4.036143 3.321190 0.142919 0.430589 -1 -1 -30.728407 4.217301 3.321190 0.196662 0.299224 -1 -1 -27.536659 11.828699 3.321190 0.296586 0.198425 -1 -1 -21.675112 17.639282 3.321190 0.427478 0.143538 -1 -1 -14.036130 20.764444 3.321190 0.569411 0.142919 -1 -1 14.217316 20.728405 3.321190 0.700777 0.196662 -1 -1 23.683174 20.286118 3.156490 0.848857 0.264694 -1 -1 30.404764 13.505603 3.156490 0.912349 0.416107 -1 -1 34.019917 4.668982 3.156490 0.913065 0.580292 -1 -1 33.978256 -4.878449 3.156490 0.850896 0.732254 -1 -1 30.286112 -13.683181 3.156490 0.735306 0.848857 -1 -1 23.505600 -20.404768 3.156490 0.583893 0.912349 -1 -1 14.668977 -24.019918 3.156490 0.419708 0.913065 -1 -1 -14.878452 -23.978252 3.156490 0.267746 0.850896 -1 -1 -23.683182 -20.286110 3.156490 0.151143 0.735306 -1 -1 -30.404770 -13.505592 3.156490 0.087651 0.583893 -1 -1 -34.019920 -4.668968 3.156490 0.086935 0.419708 -1 -1 -33.978249 4.878465 3.156490 0.149104 0.267746 -1 -1 -30.286102 13.683196 3.156490 0.264694 0.151143 -1 -1 -23.505577 20.404779 3.156490 0.416107 0.087651 -1 -1 -14.668951 24.019922 3.156490 0.580293 0.086935 -1 -1 14.878481 23.978243 3.156490 0.732254 0.149104 -1 -1 26.305698 24.174189 -0.301926 0.917477 0.218408 -1 -1 25.196014 22.529018 1.012907 0.887427 0.238677 -1 -1 32.660770 14.998834 1.012907 0.957940 0.406831 -1 -1 34.315567 16.094122 -0.301926 0.993459 0.399605 -1 -1 36.675629 5.185213 1.012907 0.958735 0.589169 -1 -1 38.623604 5.563864 -0.301926 0.994316 0.596085 -1 -1 36.629364 -5.417810 1.012907 0.889693 0.757932 -1 -1 38.573959 -5.813441 -0.301926 0.919919 0.777938 -1 -1 32.529015 -15.196017 1.012907 0.761323 0.887427 -1 -1 34.174187 -16.305698 -0.301926 0.781592 0.917477 -1 -1 24.998833 -22.660772 1.012907 0.593169 0.957940 -1 -1 26.094122 -24.315565 -0.301926 0.600395 0.993459 -1 -1 15.185220 -26.675629 1.012907 0.410831 0.958735 -1 -1 15.563870 -28.623604 -0.301926 0.403915 0.994316 -1 -1 -15.417803 -26.629364 1.012907 0.242068 0.889693 -1 -1 -15.813432 -28.573965 -0.301926 0.222062 0.919919 -1 -1 -25.196011 -22.529020 1.012907 0.112573 0.761323 -1 -1 -26.305689 -24.174196 -0.301926 0.082523 0.781592 -1 -1 -32.660770 -14.998836 1.012907 0.042060 0.593169 -1 -1 -34.315559 -16.094126 -0.301926 0.006541 0.600395 -1 -1 -36.675629 -5.185212 1.012907 0.041265 0.410831 -1 -1 -38.623604 -5.563865 -0.301926 0.005684 0.403915 -1 -1 -36.629356 5.417814 1.012907 0.110308 0.242068 -1 -1 -38.573959 5.813443 -0.301926 0.080082 0.222062 -1 -1 -32.529011 15.196029 1.012907 0.238677 0.112573 -1 -1 -34.174187 16.305708 -0.301926 0.218408 0.082523 -1 -1 -24.998821 22.660780 1.012907 0.406831 0.042060 -1 -1 -26.094109 24.315575 -0.301926 0.399605 0.006541 -1 -1 -15.185204 26.675629 1.012907 0.589169 0.041265 -1 -1 -15.563847 28.623608 -0.301926 0.596086 0.005684 -1 -1 15.417831 26.629356 1.012907 0.757932 0.110308 -1 -1 15.813461 28.573956 -0.301926 0.777938 0.080082 -1 -65 -0.000000 0.000000 1.000000 -0.023734 0.018076 0.999555 -0.015010 0.025783 0.999555 -0.028845 0.007618 0.999555 -0.029564 -0.004001 0.999555 -0.025783 -0.015010 0.999555 -0.018076 -0.023734 0.999555 -0.007649 -0.028839 0.999555 --0.003940 -0.029565 0.999555 --0.015010 -0.025783 0.999555 --0.023734 -0.018076 0.999555 --0.028845 -0.007618 0.999555 --0.029565 0.004001 0.999555 --0.025783 0.015010 0.999555 --0.018076 0.023734 0.999555 --0.007649 0.028839 0.999555 -0.003940 0.029565 0.999555 -0.179817 0.302000 0.936196 -0.281699 0.210198 0.936196 -0.340695 0.086397 0.936196 -0.347824 -0.050559 0.936196 -0.302000 -0.179817 0.936196 -0.210198 -0.281699 0.936196 -0.086772 -0.340640 0.936181 --0.049893 -0.347841 0.936225 --0.179817 -0.301999 0.936196 --0.281699 -0.210198 0.936196 --0.340695 -0.086396 0.936196 --0.347824 0.050559 0.936196 --0.302000 0.179817 0.936196 --0.210198 0.281699 0.936196 --0.086772 0.340641 0.936181 -0.049893 0.347841 0.936225 -0.338996 0.437135 0.833064 -0.330211 0.485536 0.809454 -0.490881 0.322210 0.809454 -0.480475 0.274131 0.833064 -0.576820 0.109832 0.809454 -0.548807 0.069395 0.833063 -0.574943 -0.119268 0.809454 -0.533588 -0.145907 0.833063 -0.485536 -0.330211 0.809454 -0.437135 -0.338996 0.833064 -0.322211 -0.490881 0.809454 -0.274132 -0.480475 0.833064 -0.110702 -0.576729 0.809400 -0.070446 -0.548768 0.833001 --0.118450 -0.575039 0.809506 --0.145397 -0.533702 0.833080 --0.330210 -0.485536 0.809454 --0.338996 -0.437135 0.833064 --0.490881 -0.322211 0.809454 --0.480475 -0.274132 0.833064 --0.576820 -0.109831 0.809454 --0.548807 -0.069395 0.833064 --0.574943 0.119268 0.809454 --0.533587 0.145907 0.833064 --0.485535 0.330210 0.809454 --0.437134 0.338996 0.833064 --0.322210 0.490881 0.809454 --0.274131 0.480475 0.833064 --0.110701 0.576729 0.809400 --0.070446 0.548768 0.833001 -0.118450 0.575039 0.809506 -0.145397 0.533702 0.833080 -112 -1 0 1 2 0 1 2 2 -1 0 3 1 0 3 1 2 -1 0 4 3 0 4 3 2 -1 0 5 4 0 5 4 2 -1 0 6 5 0 6 5 2 -1 0 7 6 0 7 6 2 -1 0 8 7 0 8 7 2 -1 0 9 8 0 9 8 2 -1 0 10 9 0 10 9 2 -1 0 11 10 0 11 10 2 -1 0 12 11 0 12 11 2 -1 0 13 12 0 13 12 2 -1 0 14 13 0 14 13 2 -1 0 15 14 0 15 14 2 -1 0 16 15 0 16 15 2 -1 0 2 16 0 2 16 2 -1 17 2 1 17 2 1 2 -1 17 1 18 17 1 18 2 -1 18 1 3 18 1 3 2 -1 18 3 19 18 3 19 2 -1 19 3 4 19 3 4 2 -1 19 4 20 19 4 20 2 -1 20 4 5 20 4 5 2 -1 20 5 21 20 5 21 2 -1 21 5 6 21 5 6 2 -1 21 6 22 21 6 22 2 -1 22 6 7 22 6 7 2 -1 22 7 23 22 7 23 2 -1 23 7 8 23 7 8 2 -1 23 8 24 23 8 24 2 -1 24 8 9 24 8 9 2 -1 24 9 25 24 9 25 2 -1 25 9 10 25 9 10 2 -1 25 10 26 25 10 26 2 -1 26 10 11 26 10 11 2 -1 26 11 27 26 11 27 2 -1 27 11 12 27 11 12 2 -1 27 12 28 27 12 28 2 -1 28 12 13 28 12 13 2 -1 28 13 29 28 13 29 2 -1 29 13 14 29 13 14 2 -1 29 14 30 29 14 30 2 -1 30 14 15 30 14 15 2 -1 30 15 31 30 15 31 2 -1 31 15 16 31 15 16 2 -1 31 16 32 31 16 32 2 -1 2 17 32 2 17 32 2 -1 2 32 16 2 32 16 2 -1 33 34 35 33 34 35 2 -1 33 35 36 33 35 36 2 -1 34 17 18 34 17 18 2 -1 34 18 35 34 18 35 2 -1 36 35 37 36 35 37 2 -1 36 37 38 36 37 38 2 -1 35 18 19 35 18 19 2 -1 35 19 37 35 19 37 2 -1 38 37 39 38 37 39 2 -1 38 39 40 38 39 40 2 -1 37 19 20 37 19 20 2 -1 37 20 39 37 20 39 2 -1 40 39 41 40 39 41 2 -1 40 41 42 40 41 42 2 -1 39 20 21 39 20 21 2 -1 39 21 41 39 21 41 2 -1 42 41 43 42 41 43 2 -1 42 43 44 42 43 44 2 -1 41 21 22 41 21 22 2 -1 41 22 43 41 22 43 2 -1 44 43 45 44 43 45 2 -1 44 45 46 44 45 46 2 -1 43 22 23 43 22 23 2 -1 43 23 45 43 23 45 2 -1 46 45 47 46 45 47 2 -1 46 47 48 46 47 48 2 -1 45 23 24 45 23 24 2 -1 45 24 47 45 24 47 2 -1 48 47 49 48 47 49 2 -1 48 49 50 48 49 50 2 -1 47 24 25 47 24 25 2 -1 47 25 49 47 25 49 2 -1 50 49 51 50 49 51 2 -1 50 51 52 50 51 52 2 -1 49 25 26 49 25 26 2 -1 49 26 51 49 26 51 2 -1 52 51 53 52 51 53 2 -1 52 53 54 52 53 54 2 -1 51 26 27 51 26 27 2 -1 51 27 53 51 27 53 2 -1 54 53 55 54 53 55 2 -1 54 55 56 54 55 56 2 -1 53 27 28 53 27 28 2 -1 53 28 55 53 28 55 2 -1 56 55 57 56 55 57 2 -1 56 57 58 56 57 58 2 -1 55 28 29 55 28 29 2 -1 55 29 57 55 29 57 2 -1 58 57 59 58 57 59 2 -1 58 59 60 58 59 60 2 -1 57 29 30 57 29 30 2 -1 57 30 59 57 30 59 2 -1 60 59 61 60 59 61 2 -1 60 61 62 60 61 62 2 -1 59 30 31 59 30 31 2 -1 59 31 61 59 31 61 2 -1 62 61 63 62 61 63 2 -1 62 63 64 62 63 64 2 -1 61 31 32 61 31 32 2 -1 61 32 63 61 32 63 2 -1 17 34 63 17 34 63 2 -1 17 63 32 17 63 32 2 -1 34 33 64 34 33 64 2 -1 34 64 63 34 64 63 2 - -Materials: 2 -"scroll" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"" -"" -"frame" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"" -"" - -Bones: 0 -GroupComments: 0 -MaterialComments: 0 -BoneComments: 0 -ModelComment: 0 +// MilkShape 3D ASCII + +Frames: 30 +Frame: 1 + +Meshes: 2 +"scroll" 0 0 +17 +0 28.576029 12.295176 2.879607 0.114769 0.235221 -1 +0 22.456854 18.468002 2.879607 0.103466 0.102288 -1 +0 0.000001 -0.000001 2.879607 0.061984 0.500000 -1 +0 31.867174 4.250518 2.879607 0.120849 0.408464 -1 +0 31.829239 -4.441243 2.879607 0.120779 0.595643 -1 +0 28.467997 -12.456865 2.879607 0.114570 0.768261 -1 +0 22.295166 -18.576036 2.879607 0.103167 0.900038 -1 +0 14.250505 -21.867176 2.879607 0.088308 0.970913 -1 +0 -14.441256 -21.829237 2.879607 0.035309 0.970096 -1 +0 -22.456873 -18.467987 2.879607 0.020503 0.897711 -1 +0 -28.576046 -12.295153 2.879607 0.009200 0.764778 -1 +0 -31.867182 -4.250491 2.879607 0.003120 0.591535 -1 +0 -31.829235 4.441269 2.879607 0.003190 0.404357 -1 +0 -28.467979 12.456886 2.879607 0.009399 0.231739 -1 +0 -22.295141 18.576052 2.879607 0.020802 0.099962 -1 +0 -14.250477 21.867180 2.879607 0.035661 0.029087 -1 +0 14.441284 21.829229 2.879607 0.088660 0.029904 -1 +1 +0.000000 0.000000 1.000000 +16 +0 0 1 2 0 0 0 1 +0 2 3 0 0 0 0 1 +0 2 4 3 0 0 0 1 +0 2 5 4 0 0 0 1 +0 2 6 5 0 0 0 1 +0 2 7 6 0 0 0 1 +0 2 8 7 0 0 0 1 +0 2 9 8 0 0 0 1 +0 2 10 9 0 0 0 1 +0 2 11 10 0 0 0 1 +0 2 12 11 0 0 0 1 +0 2 13 12 0 0 0 1 +0 2 14 13 0 0 0 1 +0 2 15 14 0 0 0 1 +0 2 16 15 0 0 0 1 +0 2 1 16 0 0 0 1 +"frame" 1 1 +65 +1 0.000000 -0.000000 3.321190 0.500000 0.500000 -1 +1 27.639259 11.675143 3.321190 0.856463 0.427477 -1 +1 21.828669 17.536682 3.321190 0.801575 0.296586 -1 +1 30.764435 4.036170 3.321190 0.857082 0.569410 -1 +1 30.728415 -4.217276 3.321190 0.803338 0.700776 -1 +1 27.536673 -11.828679 3.321190 0.703414 0.801575 -1 +1 21.675133 -17.639269 3.321190 0.572522 0.856463 -1 +1 14.036156 -20.764439 3.321190 0.430590 0.857082 -1 +1 -14.217289 -20.728411 3.321190 0.299224 0.803338 -1 +1 -21.828686 -17.536667 3.321190 0.198425 0.703414 -1 +1 -27.639275 -11.675121 3.321190 0.143537 0.572522 -1 +1 -30.764442 -4.036143 3.321190 0.142919 0.430589 -1 +1 -30.728407 4.217301 3.321190 0.196662 0.299224 -1 +1 -27.536659 11.828699 3.321190 0.296586 0.198425 -1 +1 -21.675112 17.639282 3.321190 0.427478 0.143538 -1 +1 -14.036130 20.764444 3.321190 0.569411 0.142919 -1 +1 14.217316 20.728405 3.321190 0.700777 0.196662 -1 +1 23.683174 20.286118 3.156490 0.848857 0.264694 -1 +1 30.404764 13.505603 3.156490 0.912349 0.416107 -1 +1 34.019917 4.668982 3.156490 0.913065 0.580292 -1 +1 33.978256 -4.878449 3.156490 0.850896 0.732254 -1 +1 30.286112 -13.683181 3.156490 0.735306 0.848857 -1 +1 23.505600 -20.404768 3.156490 0.583893 0.912349 -1 +1 14.668977 -24.019918 3.156490 0.419708 0.913065 -1 +1 -14.878452 -23.978252 3.156490 0.267746 0.850896 -1 +1 -23.683182 -20.286110 3.156490 0.151143 0.735306 -1 +1 -30.404770 -13.505592 3.156490 0.087651 0.583893 -1 +1 -34.019920 -4.668968 3.156490 0.086935 0.419708 -1 +1 -33.978249 4.878465 3.156490 0.149104 0.267746 -1 +1 -30.286102 13.683196 3.156490 0.264694 0.151143 -1 +1 -23.505577 20.404779 3.156490 0.416107 0.087651 -1 +1 -14.668951 24.019922 3.156490 0.580293 0.086935 -1 +1 14.878481 23.978243 3.156490 0.732254 0.149104 -1 +1 26.305698 24.174189 -0.301926 0.917477 0.218408 -1 +1 25.196014 22.529018 1.012907 0.887427 0.238677 -1 +1 32.660770 14.998834 1.012907 0.957940 0.406831 -1 +1 34.315567 16.094122 -0.301926 0.993459 0.399605 -1 +1 36.675629 5.185213 1.012907 0.958735 0.589169 -1 +1 38.623604 5.563864 -0.301926 0.994316 0.596085 -1 +1 36.629364 -5.417810 1.012907 0.889693 0.757932 -1 +1 38.573959 -5.813441 -0.301926 0.919919 0.777938 -1 +1 32.529015 -15.196017 1.012907 0.761323 0.887427 -1 +1 34.174187 -16.305698 -0.301926 0.781592 0.917477 -1 +1 24.998833 -22.660772 1.012907 0.593169 0.957940 -1 +1 26.094122 -24.315565 -0.301926 0.600395 0.993459 -1 +1 15.185220 -26.675629 1.012907 0.410831 0.958735 -1 +1 15.563870 -28.623604 -0.301926 0.403915 0.994316 -1 +1 -15.417803 -26.629364 1.012907 0.242068 0.889693 -1 +1 -15.813432 -28.573965 -0.301926 0.222062 0.919919 -1 +1 -25.196011 -22.529020 1.012907 0.112573 0.761323 -1 +1 -26.305689 -24.174196 -0.301926 0.082523 0.781592 -1 +1 -32.660770 -14.998836 1.012907 0.042060 0.593169 -1 +1 -34.315559 -16.094126 -0.301926 0.006541 0.600395 -1 +1 -36.675629 -5.185212 1.012907 0.041265 0.410831 -1 +1 -38.623604 -5.563865 -0.301926 0.005684 0.403915 -1 +1 -36.629356 5.417814 1.012907 0.110308 0.242068 -1 +1 -38.573959 5.813443 -0.301926 0.080082 0.222062 -1 +1 -32.529011 15.196029 1.012907 0.238677 0.112573 -1 +1 -34.174187 16.305708 -0.301926 0.218408 0.082523 -1 +1 -24.998821 22.660780 1.012907 0.406831 0.042060 -1 +1 -26.094109 24.315575 -0.301926 0.399605 0.006541 -1 +1 -15.185204 26.675629 1.012907 0.589169 0.041265 -1 +1 -15.563847 28.623608 -0.301926 0.596086 0.005684 -1 +1 15.417831 26.629356 1.012907 0.757932 0.110308 -1 +1 15.813461 28.573956 -0.301926 0.777938 0.080082 -1 +65 +0.000000 0.000000 1.000000 +0.023734 0.018076 0.999555 +0.015010 0.025783 0.999555 +0.028845 0.007618 0.999555 +0.029564 -0.004001 0.999555 +0.025783 -0.015010 0.999555 +0.018076 -0.023734 0.999555 +0.007649 -0.028839 0.999555 +-0.003940 -0.029565 0.999555 +-0.015010 -0.025783 0.999555 +-0.023734 -0.018076 0.999555 +-0.028845 -0.007618 0.999555 +-0.029565 0.004001 0.999555 +-0.025783 0.015010 0.999555 +-0.018076 0.023734 0.999555 +-0.007649 0.028839 0.999555 +0.003940 0.029565 0.999555 +0.179817 0.302000 0.936196 +0.281699 0.210198 0.936196 +0.340695 0.086397 0.936196 +0.347824 -0.050559 0.936196 +0.302000 -0.179817 0.936196 +0.210198 -0.281699 0.936196 +0.086772 -0.340640 0.936181 +-0.049893 -0.347841 0.936225 +-0.179817 -0.301999 0.936196 +-0.281699 -0.210198 0.936196 +-0.340695 -0.086396 0.936196 +-0.347824 0.050559 0.936196 +-0.302000 0.179817 0.936196 +-0.210198 0.281699 0.936196 +-0.086772 0.340641 0.936181 +0.049893 0.347841 0.936225 +0.338996 0.437135 0.833064 +0.330211 0.485536 0.809454 +0.490881 0.322210 0.809454 +0.480475 0.274131 0.833064 +0.576820 0.109832 0.809454 +0.548807 0.069395 0.833063 +0.574943 -0.119268 0.809454 +0.533588 -0.145907 0.833063 +0.485536 -0.330211 0.809454 +0.437135 -0.338996 0.833064 +0.322211 -0.490881 0.809454 +0.274132 -0.480475 0.833064 +0.110702 -0.576729 0.809400 +0.070446 -0.548768 0.833001 +-0.118450 -0.575039 0.809506 +-0.145397 -0.533702 0.833080 +-0.330210 -0.485536 0.809454 +-0.338996 -0.437135 0.833064 +-0.490881 -0.322211 0.809454 +-0.480475 -0.274132 0.833064 +-0.576820 -0.109831 0.809454 +-0.548807 -0.069395 0.833064 +-0.574943 0.119268 0.809454 +-0.533587 0.145907 0.833064 +-0.485535 0.330210 0.809454 +-0.437134 0.338996 0.833064 +-0.322210 0.490881 0.809454 +-0.274131 0.480475 0.833064 +-0.110701 0.576729 0.809400 +-0.070446 0.548768 0.833001 +0.118450 0.575039 0.809506 +0.145397 0.533702 0.833080 +112 +1 0 1 2 0 1 2 2 +1 0 3 1 0 3 1 2 +1 0 4 3 0 4 3 2 +1 0 5 4 0 5 4 2 +1 0 6 5 0 6 5 2 +1 0 7 6 0 7 6 2 +1 0 8 7 0 8 7 2 +1 0 9 8 0 9 8 2 +1 0 10 9 0 10 9 2 +1 0 11 10 0 11 10 2 +1 0 12 11 0 12 11 2 +1 0 13 12 0 13 12 2 +1 0 14 13 0 14 13 2 +1 0 15 14 0 15 14 2 +1 0 16 15 0 16 15 2 +1 0 2 16 0 2 16 2 +1 17 2 1 17 2 1 2 +1 17 1 18 17 1 18 2 +1 18 1 3 18 1 3 2 +1 18 3 19 18 3 19 2 +1 19 3 4 19 3 4 2 +1 19 4 20 19 4 20 2 +1 20 4 5 20 4 5 2 +1 20 5 21 20 5 21 2 +1 21 5 6 21 5 6 2 +1 21 6 22 21 6 22 2 +1 22 6 7 22 6 7 2 +1 22 7 23 22 7 23 2 +1 23 7 8 23 7 8 2 +1 23 8 24 23 8 24 2 +1 24 8 9 24 8 9 2 +1 24 9 25 24 9 25 2 +1 25 9 10 25 9 10 2 +1 25 10 26 25 10 26 2 +1 26 10 11 26 10 11 2 +1 26 11 27 26 11 27 2 +1 27 11 12 27 11 12 2 +1 27 12 28 27 12 28 2 +1 28 12 13 28 12 13 2 +1 28 13 29 28 13 29 2 +1 29 13 14 29 13 14 2 +1 29 14 30 29 14 30 2 +1 30 14 15 30 14 15 2 +1 30 15 31 30 15 31 2 +1 31 15 16 31 15 16 2 +1 31 16 32 31 16 32 2 +1 2 17 32 2 17 32 2 +1 2 32 16 2 32 16 2 +1 33 34 35 33 34 35 2 +1 33 35 36 33 35 36 2 +1 34 17 18 34 17 18 2 +1 34 18 35 34 18 35 2 +1 36 35 37 36 35 37 2 +1 36 37 38 36 37 38 2 +1 35 18 19 35 18 19 2 +1 35 19 37 35 19 37 2 +1 38 37 39 38 37 39 2 +1 38 39 40 38 39 40 2 +1 37 19 20 37 19 20 2 +1 37 20 39 37 20 39 2 +1 40 39 41 40 39 41 2 +1 40 41 42 40 41 42 2 +1 39 20 21 39 20 21 2 +1 39 21 41 39 21 41 2 +1 42 41 43 42 41 43 2 +1 42 43 44 42 43 44 2 +1 41 21 22 41 21 22 2 +1 41 22 43 41 22 43 2 +1 44 43 45 44 43 45 2 +1 44 45 46 44 45 46 2 +1 43 22 23 43 22 23 2 +1 43 23 45 43 23 45 2 +1 46 45 47 46 45 47 2 +1 46 47 48 46 47 48 2 +1 45 23 24 45 23 24 2 +1 45 24 47 45 24 47 2 +1 48 47 49 48 47 49 2 +1 48 49 50 48 49 50 2 +1 47 24 25 47 24 25 2 +1 47 25 49 47 25 49 2 +1 50 49 51 50 49 51 2 +1 50 51 52 50 51 52 2 +1 49 25 26 49 25 26 2 +1 49 26 51 49 26 51 2 +1 52 51 53 52 51 53 2 +1 52 53 54 52 53 54 2 +1 51 26 27 51 26 27 2 +1 51 27 53 51 27 53 2 +1 54 53 55 54 53 55 2 +1 54 55 56 54 55 56 2 +1 53 27 28 53 27 28 2 +1 53 28 55 53 28 55 2 +1 56 55 57 56 55 57 2 +1 56 57 58 56 57 58 2 +1 55 28 29 55 28 29 2 +1 55 29 57 55 29 57 2 +1 58 57 59 58 57 59 2 +1 58 59 60 58 59 60 2 +1 57 29 30 57 29 30 2 +1 57 30 59 57 30 59 2 +1 60 59 61 60 59 61 2 +1 60 61 62 60 61 62 2 +1 59 30 31 59 30 31 2 +1 59 31 61 59 31 61 2 +1 62 61 63 62 61 63 2 +1 62 63 64 62 63 64 2 +1 61 31 32 61 31 32 2 +1 61 32 63 61 32 63 2 +1 17 34 63 17 34 63 2 +1 17 63 32 17 63 32 2 +1 34 33 64 34 33 64 2 +1 34 64 63 34 64 63 2 + +Materials: 2 +"scroll" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"" +"" +"frame" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"" +"" + +Bones: 0 +GroupComments: 0 +MaterialComments: 0 +BoneComments: 0 +ModelComment: 0 diff --git a/NoteSkins/kb7/orbital/model/note.txt b/NoteSkins/kb7/orbital/model/note.txt index b524ceef63..cf74519852 100644 --- a/NoteSkins/kb7/orbital/model/note.txt +++ b/NoteSkins/kb7/orbital/model/note.txt @@ -1,316 +1,316 @@ -// MilkShape 3D ASCII - -Frames: 30 -Frame: 1 - -Meshes: 2 -"scroll" 0 0 -17 -0 18.576029 12.295176 2.879607 0.112493 0.233639 -1 -0 12.456854 18.468002 2.879607 0.095922 0.099912 -1 -0 0.000001 -0.000001 2.879607 0.062189 0.500000 -1 -0 21.867174 4.250518 2.879607 0.121405 0.407917 -1 -0 21.829239 -4.441243 2.879607 0.121302 0.596214 -1 -0 18.467995 -12.456865 2.879607 0.112200 0.769864 -1 -0 12.295166 -18.576036 2.879607 0.095484 0.902428 -1 -0 4.250505 -21.867176 2.879607 0.073699 0.973727 -1 -0 -4.441256 -21.829237 2.879607 0.050162 0.972905 -1 -0 -12.456874 -18.467987 2.879607 0.028456 0.900088 -1 -0 -18.576044 -12.295153 2.879607 0.011886 0.766360 -1 -0 -21.867182 -4.250491 2.879607 0.002973 0.592082 -1 -0 -21.829233 4.441269 2.879607 0.003076 0.403785 -1 -0 -18.467979 12.456886 2.879607 0.012178 0.230136 -1 -0 -12.295140 18.576052 2.879607 0.028894 0.097571 -1 -0 -4.250477 21.867180 2.879607 0.050679 0.026273 -1 -0 4.441284 21.829229 2.879607 0.074216 0.027095 -1 -1 -0.000000 0.000000 1.000000 -16 -0 0 1 2 0 0 0 1 -0 2 3 0 0 0 0 1 -0 2 4 3 0 0 0 1 -0 2 5 4 0 0 0 1 -0 2 6 5 0 0 0 1 -0 2 7 6 0 0 0 1 -0 2 8 7 0 0 0 1 -0 2 9 8 0 0 0 1 -0 2 10 9 0 0 0 1 -0 2 11 10 0 0 0 1 -0 2 12 11 0 0 0 1 -0 2 13 12 0 0 0 1 -0 2 14 13 0 0 0 1 -0 2 15 14 0 0 0 1 -0 2 16 15 0 0 0 1 -0 2 1 16 0 0 0 1 -"frame" 1 1 -65 -1 0.000000 -0.000000 3.321190 0.500000 0.500000 -1 -1 17.639259 11.675143 3.321190 0.856463 0.427477 -1 -1 11.828669 17.536682 3.321190 0.801575 0.296586 -1 -1 20.764435 4.036170 3.321190 0.857082 0.569410 -1 -1 20.728415 -4.217276 3.321190 0.803338 0.700776 -1 -1 17.536673 -11.828679 3.321190 0.703414 0.801575 -1 -1 11.675133 -17.639269 3.321190 0.572522 0.856463 -1 -1 4.036156 -20.764439 3.321190 0.430590 0.857082 -1 -1 -4.217289 -20.728411 3.321190 0.299224 0.803338 -1 -1 -11.828687 -17.536667 3.321190 0.198425 0.703414 -1 -1 -17.639275 -11.675121 3.321190 0.143537 0.572522 -1 -1 -20.764442 -4.036143 3.321190 0.142919 0.430589 -1 -1 -20.728407 4.217301 3.321190 0.196662 0.299224 -1 -1 -17.536659 11.828699 3.321190 0.296586 0.198425 -1 -1 -11.675112 17.639282 3.321190 0.427478 0.143538 -1 -1 -4.036130 20.764444 3.321190 0.569411 0.142919 -1 -1 4.217315 20.728405 3.321190 0.700777 0.196662 -1 -1 13.683175 20.286118 3.156490 0.848857 0.264694 -1 -1 20.404764 13.505603 3.156490 0.912349 0.416107 -1 -1 24.019917 4.668982 3.156490 0.913065 0.580292 -1 -1 23.978254 -4.878449 3.156490 0.850896 0.732254 -1 -1 20.286112 -13.683181 3.156490 0.735306 0.848857 -1 -1 13.505599 -20.404768 3.156490 0.583893 0.912349 -1 -1 4.668977 -24.019918 3.156490 0.419708 0.913065 -1 -1 -4.878453 -23.978252 3.156490 0.267746 0.850896 -1 -1 -13.683182 -20.286110 3.156490 0.151143 0.735306 -1 -1 -20.404770 -13.505592 3.156490 0.087651 0.583893 -1 -1 -24.019920 -4.668968 3.156490 0.086935 0.419708 -1 -1 -23.978251 4.878465 3.156490 0.149104 0.267746 -1 -1 -20.286102 13.683196 3.156490 0.264694 0.151143 -1 -1 -13.505578 20.404779 3.156490 0.416107 0.087651 -1 -1 -4.668952 24.019922 3.156490 0.580293 0.086935 -1 -1 4.878480 23.978243 3.156490 0.732254 0.149104 -1 -1 16.305698 24.174189 -0.301926 0.917477 0.218408 -1 -1 15.196015 22.529018 1.012907 0.887427 0.238677 -1 -1 22.660770 14.998834 1.012907 0.957940 0.406831 -1 -1 24.315565 16.094122 -0.301926 0.993459 0.399605 -1 -1 26.675631 5.185213 1.012907 0.958735 0.589169 -1 -1 28.623606 5.563864 -0.301926 0.994316 0.596085 -1 -1 26.629364 -5.417810 1.012907 0.889693 0.757932 -1 -1 28.573961 -5.813441 -0.301926 0.919919 0.777938 -1 -1 22.529016 -15.196017 1.012907 0.761323 0.887427 -1 -1 24.174189 -16.305698 -0.301926 0.781592 0.917477 -1 -1 14.998834 -22.660772 1.012907 0.593169 0.957940 -1 -1 16.094122 -24.315565 -0.301926 0.600395 0.993459 -1 -1 5.185220 -26.675629 1.012907 0.410831 0.958735 -1 -1 5.563870 -28.623604 -0.301926 0.403915 0.994316 -1 -1 -5.417803 -26.629364 1.012907 0.242068 0.889693 -1 -1 -5.813432 -28.573965 -0.301926 0.222062 0.919919 -1 -1 -15.196011 -22.529020 1.012907 0.112573 0.761323 -1 -1 -16.305689 -24.174196 -0.301926 0.082523 0.781592 -1 -1 -22.660770 -14.998836 1.012907 0.042060 0.593169 -1 -1 -24.315561 -16.094126 -0.301926 0.006541 0.600395 -1 -1 -26.675631 -5.185212 1.012907 0.041265 0.410831 -1 -1 -28.623606 -5.563865 -0.301926 0.005684 0.403915 -1 -1 -26.629358 5.417814 1.012907 0.110308 0.242068 -1 -1 -28.573961 5.813443 -0.301926 0.080082 0.222062 -1 -1 -22.529011 15.196029 1.012907 0.238677 0.112573 -1 -1 -24.174185 16.305708 -0.301926 0.218408 0.082523 -1 -1 -14.998822 22.660780 1.012907 0.406831 0.042060 -1 -1 -16.094109 24.315575 -0.301926 0.399605 0.006541 -1 -1 -5.185204 26.675629 1.012907 0.589169 0.041265 -1 -1 -5.563847 28.623608 -0.301926 0.596086 0.005684 -1 -1 5.417831 26.629356 1.012907 0.757932 0.110308 -1 -1 5.813461 28.573956 -0.301926 0.777938 0.080082 -1 -65 -0.000000 0.000000 1.000000 -0.023734 0.018076 0.999555 -0.015010 0.025783 0.999555 -0.028845 0.007618 0.999555 -0.029564 -0.004001 0.999555 -0.025783 -0.015010 0.999555 -0.018076 -0.023734 0.999555 -0.007618 -0.028845 0.999555 --0.004001 -0.029564 0.999555 --0.015010 -0.025783 0.999555 --0.023734 -0.018076 0.999555 --0.028845 -0.007618 0.999555 --0.029564 0.004001 0.999555 --0.025783 0.015010 0.999555 --0.018076 0.023734 0.999555 --0.007618 0.028845 0.999555 -0.004001 0.029565 0.999555 -0.179817 0.302000 0.936196 -0.281699 0.210198 0.936196 -0.340695 0.086397 0.936196 -0.347824 -0.050559 0.936196 -0.301999 -0.179816 0.936196 -0.210198 -0.281699 0.936196 -0.086396 -0.340695 0.936196 --0.050559 -0.347824 0.936196 --0.179817 -0.301999 0.936196 --0.281699 -0.210198 0.936196 --0.340695 -0.086396 0.936196 --0.347824 0.050559 0.936196 --0.301999 0.179817 0.936196 --0.210198 0.281699 0.936196 --0.086396 0.340695 0.936196 -0.050559 0.347824 0.936196 -0.338996 0.437135 0.833064 -0.330211 0.485536 0.809454 -0.490881 0.322211 0.809454 -0.480475 0.274132 0.833064 -0.576820 0.109832 0.809454 -0.548807 0.069395 0.833064 -0.574943 -0.119268 0.809454 -0.533588 -0.145907 0.833064 -0.485536 -0.330211 0.809454 -0.437135 -0.338996 0.833064 -0.322211 -0.490881 0.809454 -0.274132 -0.480475 0.833064 -0.109832 -0.576820 0.809454 -0.069395 -0.548807 0.833064 --0.119268 -0.574943 0.809454 --0.145907 -0.533588 0.833064 --0.330210 -0.485536 0.809454 --0.338996 -0.437135 0.833064 --0.490881 -0.322211 0.809454 --0.480475 -0.274132 0.833064 --0.576820 -0.109831 0.809454 --0.548807 -0.069395 0.833064 --0.574943 0.119268 0.809454 --0.533587 0.145907 0.833064 --0.485536 0.330211 0.809454 --0.437135 0.338996 0.833064 --0.322210 0.490881 0.809454 --0.274131 0.480475 0.833064 --0.109831 0.576820 0.809454 --0.069394 0.548807 0.833064 -0.119268 0.574943 0.809454 -0.145907 0.533588 0.833064 -112 -1 0 1 2 0 1 2 2 -1 0 3 1 0 3 1 2 -1 0 4 3 0 4 3 2 -1 0 5 4 0 5 4 2 -1 0 6 5 0 6 5 2 -1 0 7 6 0 7 6 2 -1 0 8 7 0 8 7 2 -1 0 9 8 0 9 8 2 -1 0 10 9 0 10 9 2 -1 0 11 10 0 11 10 2 -1 0 12 11 0 12 11 2 -1 0 13 12 0 13 12 2 -1 0 14 13 0 14 13 2 -1 0 15 14 0 15 14 2 -1 0 16 15 0 16 15 2 -1 0 2 16 0 2 16 2 -1 17 2 1 17 2 1 2 -1 17 1 18 17 1 18 2 -1 18 1 3 18 1 3 2 -1 18 3 19 18 3 19 2 -1 19 3 4 19 3 4 2 -1 19 4 20 19 4 20 2 -1 20 4 5 20 4 5 2 -1 20 5 21 20 5 21 2 -1 21 5 6 21 5 6 2 -1 21 6 22 21 6 22 2 -1 22 6 7 22 6 7 2 -1 22 7 23 22 7 23 2 -1 23 7 8 23 7 8 2 -1 23 8 24 23 8 24 2 -1 24 8 9 24 8 9 2 -1 24 9 25 24 9 25 2 -1 25 9 10 25 9 10 2 -1 25 10 26 25 10 26 2 -1 26 10 11 26 10 11 2 -1 26 11 27 26 11 27 2 -1 27 11 12 27 11 12 2 -1 27 12 28 27 12 28 2 -1 28 12 13 28 12 13 2 -1 28 13 29 28 13 29 2 -1 29 13 14 29 13 14 2 -1 29 14 30 29 14 30 2 -1 30 14 15 30 14 15 2 -1 30 15 31 30 15 31 2 -1 31 15 16 31 15 16 2 -1 31 16 32 31 16 32 2 -1 2 17 32 2 17 32 2 -1 2 32 16 2 32 16 2 -1 33 34 35 33 34 35 2 -1 33 35 36 33 35 36 2 -1 34 17 18 34 17 18 2 -1 34 18 35 34 18 35 2 -1 36 35 37 36 35 37 2 -1 36 37 38 36 37 38 2 -1 35 18 19 35 18 19 2 -1 35 19 37 35 19 37 2 -1 38 37 39 38 37 39 2 -1 38 39 40 38 39 40 2 -1 37 19 20 37 19 20 2 -1 37 20 39 37 20 39 2 -1 40 39 41 40 39 41 2 -1 40 41 42 40 41 42 2 -1 39 20 21 39 20 21 2 -1 39 21 41 39 21 41 2 -1 42 41 43 42 41 43 2 -1 42 43 44 42 43 44 2 -1 41 21 22 41 21 22 2 -1 41 22 43 41 22 43 2 -1 44 43 45 44 43 45 2 -1 44 45 46 44 45 46 2 -1 43 22 23 43 22 23 2 -1 43 23 45 43 23 45 2 -1 46 45 47 46 45 47 2 -1 46 47 48 46 47 48 2 -1 45 23 24 45 23 24 2 -1 45 24 47 45 24 47 2 -1 48 47 49 48 47 49 2 -1 48 49 50 48 49 50 2 -1 47 24 25 47 24 25 2 -1 47 25 49 47 25 49 2 -1 50 49 51 50 49 51 2 -1 50 51 52 50 51 52 2 -1 49 25 26 49 25 26 2 -1 49 26 51 49 26 51 2 -1 52 51 53 52 51 53 2 -1 52 53 54 52 53 54 2 -1 51 26 27 51 26 27 2 -1 51 27 53 51 27 53 2 -1 54 53 55 54 53 55 2 -1 54 55 56 54 55 56 2 -1 53 27 28 53 27 28 2 -1 53 28 55 53 28 55 2 -1 56 55 57 56 55 57 2 -1 56 57 58 56 57 58 2 -1 55 28 29 55 28 29 2 -1 55 29 57 55 29 57 2 -1 58 57 59 58 57 59 2 -1 58 59 60 58 59 60 2 -1 57 29 30 57 29 30 2 -1 57 30 59 57 30 59 2 -1 60 59 61 60 59 61 2 -1 60 61 62 60 61 62 2 -1 59 30 31 59 30 31 2 -1 59 31 61 59 31 61 2 -1 62 61 63 62 61 63 2 -1 62 63 64 62 63 64 2 -1 61 31 32 61 31 32 2 -1 61 32 63 61 32 63 2 -1 17 34 63 17 34 63 2 -1 17 63 32 17 63 32 2 -1 34 33 64 34 33 64 2 -1 34 64 63 34 64 63 2 - -Materials: 2 -"scroll" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"" -"" -"frame" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"" -"" - -Bones: 0 -GroupComments: 0 -MaterialComments: 0 -BoneComments: 0 -ModelComment: 0 +// MilkShape 3D ASCII + +Frames: 30 +Frame: 1 + +Meshes: 2 +"scroll" 0 0 +17 +0 18.576029 12.295176 2.879607 0.112493 0.233639 -1 +0 12.456854 18.468002 2.879607 0.095922 0.099912 -1 +0 0.000001 -0.000001 2.879607 0.062189 0.500000 -1 +0 21.867174 4.250518 2.879607 0.121405 0.407917 -1 +0 21.829239 -4.441243 2.879607 0.121302 0.596214 -1 +0 18.467995 -12.456865 2.879607 0.112200 0.769864 -1 +0 12.295166 -18.576036 2.879607 0.095484 0.902428 -1 +0 4.250505 -21.867176 2.879607 0.073699 0.973727 -1 +0 -4.441256 -21.829237 2.879607 0.050162 0.972905 -1 +0 -12.456874 -18.467987 2.879607 0.028456 0.900088 -1 +0 -18.576044 -12.295153 2.879607 0.011886 0.766360 -1 +0 -21.867182 -4.250491 2.879607 0.002973 0.592082 -1 +0 -21.829233 4.441269 2.879607 0.003076 0.403785 -1 +0 -18.467979 12.456886 2.879607 0.012178 0.230136 -1 +0 -12.295140 18.576052 2.879607 0.028894 0.097571 -1 +0 -4.250477 21.867180 2.879607 0.050679 0.026273 -1 +0 4.441284 21.829229 2.879607 0.074216 0.027095 -1 +1 +0.000000 0.000000 1.000000 +16 +0 0 1 2 0 0 0 1 +0 2 3 0 0 0 0 1 +0 2 4 3 0 0 0 1 +0 2 5 4 0 0 0 1 +0 2 6 5 0 0 0 1 +0 2 7 6 0 0 0 1 +0 2 8 7 0 0 0 1 +0 2 9 8 0 0 0 1 +0 2 10 9 0 0 0 1 +0 2 11 10 0 0 0 1 +0 2 12 11 0 0 0 1 +0 2 13 12 0 0 0 1 +0 2 14 13 0 0 0 1 +0 2 15 14 0 0 0 1 +0 2 16 15 0 0 0 1 +0 2 1 16 0 0 0 1 +"frame" 1 1 +65 +1 0.000000 -0.000000 3.321190 0.500000 0.500000 -1 +1 17.639259 11.675143 3.321190 0.856463 0.427477 -1 +1 11.828669 17.536682 3.321190 0.801575 0.296586 -1 +1 20.764435 4.036170 3.321190 0.857082 0.569410 -1 +1 20.728415 -4.217276 3.321190 0.803338 0.700776 -1 +1 17.536673 -11.828679 3.321190 0.703414 0.801575 -1 +1 11.675133 -17.639269 3.321190 0.572522 0.856463 -1 +1 4.036156 -20.764439 3.321190 0.430590 0.857082 -1 +1 -4.217289 -20.728411 3.321190 0.299224 0.803338 -1 +1 -11.828687 -17.536667 3.321190 0.198425 0.703414 -1 +1 -17.639275 -11.675121 3.321190 0.143537 0.572522 -1 +1 -20.764442 -4.036143 3.321190 0.142919 0.430589 -1 +1 -20.728407 4.217301 3.321190 0.196662 0.299224 -1 +1 -17.536659 11.828699 3.321190 0.296586 0.198425 -1 +1 -11.675112 17.639282 3.321190 0.427478 0.143538 -1 +1 -4.036130 20.764444 3.321190 0.569411 0.142919 -1 +1 4.217315 20.728405 3.321190 0.700777 0.196662 -1 +1 13.683175 20.286118 3.156490 0.848857 0.264694 -1 +1 20.404764 13.505603 3.156490 0.912349 0.416107 -1 +1 24.019917 4.668982 3.156490 0.913065 0.580292 -1 +1 23.978254 -4.878449 3.156490 0.850896 0.732254 -1 +1 20.286112 -13.683181 3.156490 0.735306 0.848857 -1 +1 13.505599 -20.404768 3.156490 0.583893 0.912349 -1 +1 4.668977 -24.019918 3.156490 0.419708 0.913065 -1 +1 -4.878453 -23.978252 3.156490 0.267746 0.850896 -1 +1 -13.683182 -20.286110 3.156490 0.151143 0.735306 -1 +1 -20.404770 -13.505592 3.156490 0.087651 0.583893 -1 +1 -24.019920 -4.668968 3.156490 0.086935 0.419708 -1 +1 -23.978251 4.878465 3.156490 0.149104 0.267746 -1 +1 -20.286102 13.683196 3.156490 0.264694 0.151143 -1 +1 -13.505578 20.404779 3.156490 0.416107 0.087651 -1 +1 -4.668952 24.019922 3.156490 0.580293 0.086935 -1 +1 4.878480 23.978243 3.156490 0.732254 0.149104 -1 +1 16.305698 24.174189 -0.301926 0.917477 0.218408 -1 +1 15.196015 22.529018 1.012907 0.887427 0.238677 -1 +1 22.660770 14.998834 1.012907 0.957940 0.406831 -1 +1 24.315565 16.094122 -0.301926 0.993459 0.399605 -1 +1 26.675631 5.185213 1.012907 0.958735 0.589169 -1 +1 28.623606 5.563864 -0.301926 0.994316 0.596085 -1 +1 26.629364 -5.417810 1.012907 0.889693 0.757932 -1 +1 28.573961 -5.813441 -0.301926 0.919919 0.777938 -1 +1 22.529016 -15.196017 1.012907 0.761323 0.887427 -1 +1 24.174189 -16.305698 -0.301926 0.781592 0.917477 -1 +1 14.998834 -22.660772 1.012907 0.593169 0.957940 -1 +1 16.094122 -24.315565 -0.301926 0.600395 0.993459 -1 +1 5.185220 -26.675629 1.012907 0.410831 0.958735 -1 +1 5.563870 -28.623604 -0.301926 0.403915 0.994316 -1 +1 -5.417803 -26.629364 1.012907 0.242068 0.889693 -1 +1 -5.813432 -28.573965 -0.301926 0.222062 0.919919 -1 +1 -15.196011 -22.529020 1.012907 0.112573 0.761323 -1 +1 -16.305689 -24.174196 -0.301926 0.082523 0.781592 -1 +1 -22.660770 -14.998836 1.012907 0.042060 0.593169 -1 +1 -24.315561 -16.094126 -0.301926 0.006541 0.600395 -1 +1 -26.675631 -5.185212 1.012907 0.041265 0.410831 -1 +1 -28.623606 -5.563865 -0.301926 0.005684 0.403915 -1 +1 -26.629358 5.417814 1.012907 0.110308 0.242068 -1 +1 -28.573961 5.813443 -0.301926 0.080082 0.222062 -1 +1 -22.529011 15.196029 1.012907 0.238677 0.112573 -1 +1 -24.174185 16.305708 -0.301926 0.218408 0.082523 -1 +1 -14.998822 22.660780 1.012907 0.406831 0.042060 -1 +1 -16.094109 24.315575 -0.301926 0.399605 0.006541 -1 +1 -5.185204 26.675629 1.012907 0.589169 0.041265 -1 +1 -5.563847 28.623608 -0.301926 0.596086 0.005684 -1 +1 5.417831 26.629356 1.012907 0.757932 0.110308 -1 +1 5.813461 28.573956 -0.301926 0.777938 0.080082 -1 +65 +0.000000 0.000000 1.000000 +0.023734 0.018076 0.999555 +0.015010 0.025783 0.999555 +0.028845 0.007618 0.999555 +0.029564 -0.004001 0.999555 +0.025783 -0.015010 0.999555 +0.018076 -0.023734 0.999555 +0.007618 -0.028845 0.999555 +-0.004001 -0.029564 0.999555 +-0.015010 -0.025783 0.999555 +-0.023734 -0.018076 0.999555 +-0.028845 -0.007618 0.999555 +-0.029564 0.004001 0.999555 +-0.025783 0.015010 0.999555 +-0.018076 0.023734 0.999555 +-0.007618 0.028845 0.999555 +0.004001 0.029565 0.999555 +0.179817 0.302000 0.936196 +0.281699 0.210198 0.936196 +0.340695 0.086397 0.936196 +0.347824 -0.050559 0.936196 +0.301999 -0.179816 0.936196 +0.210198 -0.281699 0.936196 +0.086396 -0.340695 0.936196 +-0.050559 -0.347824 0.936196 +-0.179817 -0.301999 0.936196 +-0.281699 -0.210198 0.936196 +-0.340695 -0.086396 0.936196 +-0.347824 0.050559 0.936196 +-0.301999 0.179817 0.936196 +-0.210198 0.281699 0.936196 +-0.086396 0.340695 0.936196 +0.050559 0.347824 0.936196 +0.338996 0.437135 0.833064 +0.330211 0.485536 0.809454 +0.490881 0.322211 0.809454 +0.480475 0.274132 0.833064 +0.576820 0.109832 0.809454 +0.548807 0.069395 0.833064 +0.574943 -0.119268 0.809454 +0.533588 -0.145907 0.833064 +0.485536 -0.330211 0.809454 +0.437135 -0.338996 0.833064 +0.322211 -0.490881 0.809454 +0.274132 -0.480475 0.833064 +0.109832 -0.576820 0.809454 +0.069395 -0.548807 0.833064 +-0.119268 -0.574943 0.809454 +-0.145907 -0.533588 0.833064 +-0.330210 -0.485536 0.809454 +-0.338996 -0.437135 0.833064 +-0.490881 -0.322211 0.809454 +-0.480475 -0.274132 0.833064 +-0.576820 -0.109831 0.809454 +-0.548807 -0.069395 0.833064 +-0.574943 0.119268 0.809454 +-0.533587 0.145907 0.833064 +-0.485536 0.330211 0.809454 +-0.437135 0.338996 0.833064 +-0.322210 0.490881 0.809454 +-0.274131 0.480475 0.833064 +-0.109831 0.576820 0.809454 +-0.069394 0.548807 0.833064 +0.119268 0.574943 0.809454 +0.145907 0.533588 0.833064 +112 +1 0 1 2 0 1 2 2 +1 0 3 1 0 3 1 2 +1 0 4 3 0 4 3 2 +1 0 5 4 0 5 4 2 +1 0 6 5 0 6 5 2 +1 0 7 6 0 7 6 2 +1 0 8 7 0 8 7 2 +1 0 9 8 0 9 8 2 +1 0 10 9 0 10 9 2 +1 0 11 10 0 11 10 2 +1 0 12 11 0 12 11 2 +1 0 13 12 0 13 12 2 +1 0 14 13 0 14 13 2 +1 0 15 14 0 15 14 2 +1 0 16 15 0 16 15 2 +1 0 2 16 0 2 16 2 +1 17 2 1 17 2 1 2 +1 17 1 18 17 1 18 2 +1 18 1 3 18 1 3 2 +1 18 3 19 18 3 19 2 +1 19 3 4 19 3 4 2 +1 19 4 20 19 4 20 2 +1 20 4 5 20 4 5 2 +1 20 5 21 20 5 21 2 +1 21 5 6 21 5 6 2 +1 21 6 22 21 6 22 2 +1 22 6 7 22 6 7 2 +1 22 7 23 22 7 23 2 +1 23 7 8 23 7 8 2 +1 23 8 24 23 8 24 2 +1 24 8 9 24 8 9 2 +1 24 9 25 24 9 25 2 +1 25 9 10 25 9 10 2 +1 25 10 26 25 10 26 2 +1 26 10 11 26 10 11 2 +1 26 11 27 26 11 27 2 +1 27 11 12 27 11 12 2 +1 27 12 28 27 12 28 2 +1 28 12 13 28 12 13 2 +1 28 13 29 28 13 29 2 +1 29 13 14 29 13 14 2 +1 29 14 30 29 14 30 2 +1 30 14 15 30 14 15 2 +1 30 15 31 30 15 31 2 +1 31 15 16 31 15 16 2 +1 31 16 32 31 16 32 2 +1 2 17 32 2 17 32 2 +1 2 32 16 2 32 16 2 +1 33 34 35 33 34 35 2 +1 33 35 36 33 35 36 2 +1 34 17 18 34 17 18 2 +1 34 18 35 34 18 35 2 +1 36 35 37 36 35 37 2 +1 36 37 38 36 37 38 2 +1 35 18 19 35 18 19 2 +1 35 19 37 35 19 37 2 +1 38 37 39 38 37 39 2 +1 38 39 40 38 39 40 2 +1 37 19 20 37 19 20 2 +1 37 20 39 37 20 39 2 +1 40 39 41 40 39 41 2 +1 40 41 42 40 41 42 2 +1 39 20 21 39 20 21 2 +1 39 21 41 39 21 41 2 +1 42 41 43 42 41 43 2 +1 42 43 44 42 43 44 2 +1 41 21 22 41 21 22 2 +1 41 22 43 41 22 43 2 +1 44 43 45 44 43 45 2 +1 44 45 46 44 45 46 2 +1 43 22 23 43 22 23 2 +1 43 23 45 43 23 45 2 +1 46 45 47 46 45 47 2 +1 46 47 48 46 47 48 2 +1 45 23 24 45 23 24 2 +1 45 24 47 45 24 47 2 +1 48 47 49 48 47 49 2 +1 48 49 50 48 49 50 2 +1 47 24 25 47 24 25 2 +1 47 25 49 47 25 49 2 +1 50 49 51 50 49 51 2 +1 50 51 52 50 51 52 2 +1 49 25 26 49 25 26 2 +1 49 26 51 49 26 51 2 +1 52 51 53 52 51 53 2 +1 52 53 54 52 53 54 2 +1 51 26 27 51 26 27 2 +1 51 27 53 51 27 53 2 +1 54 53 55 54 53 55 2 +1 54 55 56 54 55 56 2 +1 53 27 28 53 27 28 2 +1 53 28 55 53 28 55 2 +1 56 55 57 56 55 57 2 +1 56 57 58 56 57 58 2 +1 55 28 29 55 28 29 2 +1 55 29 57 55 29 57 2 +1 58 57 59 58 57 59 2 +1 58 59 60 58 59 60 2 +1 57 29 30 57 29 30 2 +1 57 30 59 57 30 59 2 +1 60 59 61 60 59 61 2 +1 60 61 62 60 61 62 2 +1 59 30 31 59 30 31 2 +1 59 31 61 59 31 61 2 +1 62 61 63 62 61 63 2 +1 62 63 64 62 63 64 2 +1 61 31 32 61 31 32 2 +1 61 32 63 61 32 63 2 +1 17 34 63 17 34 63 2 +1 17 63 32 17 63 32 2 +1 34 33 64 34 33 64 2 +1 34 64 63 34 64 63 2 + +Materials: 2 +"scroll" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"" +"" +"frame" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"" +"" + +Bones: 0 +GroupComments: 0 +MaterialComments: 0 +BoneComments: 0 +ModelComment: 0 diff --git a/NoteSkins/kb7/orbital/model/scroller.ini b/NoteSkins/kb7/orbital/model/scroller.ini index 853ab82d79..62119a1e81 100644 --- a/NoteSkins/kb7/orbital/model/scroller.ini +++ b/NoteSkins/kb7/orbital/model/scroller.ini @@ -1,5 +1,5 @@ -[AnimatedTexture] -TexVelocityY=1 -TexOffsetX=0 -Frame0000=scroller.png -Delay0000=1.0 +[AnimatedTexture] +TexVelocityY=1 +TexOffsetX=0 +Frame0000=scroller.png +Delay0000=1.0 diff --git a/NoteSkins/kb7/orbital/model/yellow.txt b/NoteSkins/kb7/orbital/model/yellow.txt index 2c41d89cd2..0767ba8c67 100644 --- a/NoteSkins/kb7/orbital/model/yellow.txt +++ b/NoteSkins/kb7/orbital/model/yellow.txt @@ -1,19 +1,19 @@ -Materials: 2 -"scroll" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"scroller.ini" -"" -"frame" -0.000000 0.000000 0.000000 1.000000 -0.800000 0.800000 0.800000 1.000000 -1.000000 1.000000 1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000 -0.000000 -1.000000 -"_yellow (no mipmaps).png" -"" +Materials: 2 +"scroll" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"scroller.ini" +"" +"frame" +0.000000 0.000000 0.000000 1.000000 +0.800000 0.800000 0.800000 1.000000 +1.000000 1.000000 1.000000 1.000000 +0.000000 0.000000 0.000000 1.000000 +0.000000 +1.000000 +"_yellow (no mipmaps).png" +"" diff --git a/NoteSkins/kb7/retrobar-iidx/Blue Tap Note.lua b/NoteSkins/kb7/retrobar-iidx/Blue Tap Note.lua index ed7d3170c9..36483e9909 100644 --- a/NoteSkins/kb7/retrobar-iidx/Blue Tap Note.lua +++ b/NoteSkins/kb7/retrobar-iidx/Blue Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/Noteskin.lua b/NoteSkins/kb7/retrobar-iidx/Noteskin.lua index f5e01187f3..f97108072f 100644 --- a/NoteSkins/kb7/retrobar-iidx/Noteskin.lua +++ b/NoteSkins/kb7/retrobar-iidx/Noteskin.lua @@ -1,108 +1,108 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; - -- Instead of separate hold heads, use the tap note graphics. - ["Hold Head Inactive"] = "Tap Note"; - ["Hold Head Active"] = "Tap Note"; - ["Roll Head Inactive"] = "Tap Note"; - ["Roll Head Active"] = "Tap Note"; -}; - --- button redirs --- iidx (without turntable) uses this order: --- [white][blue][white][blue][white][blue][white] -Noteskin.ButtonRedirs = { - -- dance (similar to o2jam) - Left = "White"; - UpLeft = "Blue"; - Up = "White"; - Down = "White"; - UpRight = "Blue"; - Right = "White"; - -- kb7 - Key1 = "White"; - Key2 = "Blue"; - Key3 = "White"; - Key4 = "Blue"; - Key5 = "White"; - Key6 = "Blue"; - Key7 = "White"; - -- pump - --[[ - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; - --]] -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; + -- Instead of separate hold heads, use the tap note graphics. + ["Hold Head Inactive"] = "Tap Note"; + ["Hold Head Active"] = "Tap Note"; + ["Roll Head Inactive"] = "Tap Note"; + ["Roll Head Active"] = "Tap Note"; +}; + +-- button redirs +-- iidx (without turntable) uses this order: +-- [white][blue][white][blue][white][blue][white] +Noteskin.ButtonRedirs = { + -- dance (similar to o2jam) + Left = "White"; + UpLeft = "Blue"; + Up = "White"; + Down = "White"; + UpRight = "Blue"; + Right = "White"; + -- kb7 + Key1 = "White"; + Key2 = "Blue"; + Key3 = "White"; + Key4 = "Blue"; + Key5 = "White"; + Key6 = "Blue"; + Key7 = "White"; + -- pump + --[[ + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; + --]] +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/White Tap Note.lua b/NoteSkins/kb7/retrobar-iidx/White Tap Note.lua index 653997ff60..9f84b8f9ce 100644 --- a/NoteSkins/kb7/retrobar-iidx/White Tap Note.lua +++ b/NoteSkins/kb7/retrobar-iidx/White Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_White', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_White', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/_Hold Explosion.lua b/NoteSkins/kb7/retrobar-iidx/_Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-iidx/_Hold Explosion.lua +++ b/NoteSkins/kb7/retrobar-iidx/_Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/_Receptor.lua b/NoteSkins/kb7/retrobar-iidx/_Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/kb7/retrobar-iidx/_Receptor.lua +++ b/NoteSkins/kb7/retrobar-iidx/_Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/_Roll Explosion.lua b/NoteSkins/kb7/retrobar-iidx/_Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-iidx/_Roll Explosion.lua +++ b/NoteSkins/kb7/retrobar-iidx/_Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/_Tap Mine.lua b/NoteSkins/kb7/retrobar-iidx/_Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/kb7/retrobar-iidx/_Tap Mine.lua +++ b/NoteSkins/kb7/retrobar-iidx/_Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-iidx/metrics.ini b/NoteSkins/kb7/retrobar-iidx/metrics.ini index e0f5803ae3..3e010e338c 100644 --- a/NoteSkins/kb7/retrobar-iidx/metrics.ini +++ b/NoteSkins/kb7/retrobar-iidx/metrics.ini @@ -1,31 +1,31 @@ -[NoteDisplay] -HoldLetGoGrayPercent=.8 -DrawHoldHeadForTapsOnSameRow=0 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 - -# control the vertical -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0.5 - -TapFakeAdditionTextureCoordOffsetX=0 -TapFakeAdditionTextureCoordOffsetY=0 -TapLiftAdditionTextureCoordOffsetX=0 -TapLiftAdditionTextureCoordOffsetY=0 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 -LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[NoteDisplay] +HoldLetGoGrayPercent=.8 +DrawHoldHeadForTapsOnSameRow=0 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 + +# control the vertical +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0.5 + +TapFakeAdditionTextureCoordOffsetX=0 +TapFakeAdditionTextureCoordOffsetY=0 +TapLiftAdditionTextureCoordOffsetX=0 +TapLiftAdditionTextureCoordOffsetY=0 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/Blue Tap Note.lua b/NoteSkins/kb7/retrobar-o2jam/Blue Tap Note.lua index ed7d3170c9..36483e9909 100644 --- a/NoteSkins/kb7/retrobar-o2jam/Blue Tap Note.lua +++ b/NoteSkins/kb7/retrobar-o2jam/Blue Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/Noteskin.lua b/NoteSkins/kb7/retrobar-o2jam/Noteskin.lua index 22b3c9716d..5e9d081d6a 100644 --- a/NoteSkins/kb7/retrobar-o2jam/Noteskin.lua +++ b/NoteSkins/kb7/retrobar-o2jam/Noteskin.lua @@ -1,108 +1,108 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; - -- Instead of separate hold heads, use the tap note graphics. - ["Hold Head Inactive"] = "Tap Note"; - ["Hold Head Active"] = "Tap Note"; - ["Roll Head Inactive"] = "Tap Note"; - ["Roll Head Active"] = "Tap Note"; -}; - --- button redirs --- o2jam uses this order: --- [white][blue][white][yellow][white][blue][white] -Noteskin.ButtonRedirs = { - -- dance - Left = "White"; - UpLeft = "Blue"; - Up = "White"; - Down = "White"; - UpRight = "Blue"; - Right = "White"; - -- kb7 - Key1 = "White"; - Key2 = "Blue"; - Key3 = "White"; - Key4 = "Yellow"; - Key5 = "White"; - Key6 = "Blue"; - Key7 = "White"; - -- pump - --[[ - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; - --]] -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; + -- Instead of separate hold heads, use the tap note graphics. + ["Hold Head Inactive"] = "Tap Note"; + ["Hold Head Active"] = "Tap Note"; + ["Roll Head Inactive"] = "Tap Note"; + ["Roll Head Active"] = "Tap Note"; +}; + +-- button redirs +-- o2jam uses this order: +-- [white][blue][white][yellow][white][blue][white] +Noteskin.ButtonRedirs = { + -- dance + Left = "White"; + UpLeft = "Blue"; + Up = "White"; + Down = "White"; + UpRight = "Blue"; + Right = "White"; + -- kb7 + Key1 = "White"; + Key2 = "Blue"; + Key3 = "White"; + Key4 = "Yellow"; + Key5 = "White"; + Key6 = "Blue"; + Key7 = "White"; + -- pump + --[[ + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; + --]] +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/White Tap Note.lua b/NoteSkins/kb7/retrobar-o2jam/White Tap Note.lua index 653997ff60..9f84b8f9ce 100644 --- a/NoteSkins/kb7/retrobar-o2jam/White Tap Note.lua +++ b/NoteSkins/kb7/retrobar-o2jam/White Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_White', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_White', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/Yellow Tap Note.lua b/NoteSkins/kb7/retrobar-o2jam/Yellow Tap Note.lua index 8887394c56..5bd9656863 100644 --- a/NoteSkins/kb7/retrobar-o2jam/Yellow Tap Note.lua +++ b/NoteSkins/kb7/retrobar-o2jam/Yellow Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Yellow', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Yellow', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/_Hold Explosion.lua b/NoteSkins/kb7/retrobar-o2jam/_Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-o2jam/_Hold Explosion.lua +++ b/NoteSkins/kb7/retrobar-o2jam/_Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/_Receptor.lua b/NoteSkins/kb7/retrobar-o2jam/_Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/kb7/retrobar-o2jam/_Receptor.lua +++ b/NoteSkins/kb7/retrobar-o2jam/_Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/_Roll Explosion.lua b/NoteSkins/kb7/retrobar-o2jam/_Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-o2jam/_Roll Explosion.lua +++ b/NoteSkins/kb7/retrobar-o2jam/_Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/_Tap Mine.lua b/NoteSkins/kb7/retrobar-o2jam/_Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/kb7/retrobar-o2jam/_Tap Mine.lua +++ b/NoteSkins/kb7/retrobar-o2jam/_Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-o2jam/metrics.ini b/NoteSkins/kb7/retrobar-o2jam/metrics.ini index e0f5803ae3..3e010e338c 100644 --- a/NoteSkins/kb7/retrobar-o2jam/metrics.ini +++ b/NoteSkins/kb7/retrobar-o2jam/metrics.ini @@ -1,31 +1,31 @@ -[NoteDisplay] -HoldLetGoGrayPercent=.8 -DrawHoldHeadForTapsOnSameRow=0 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 - -# control the vertical -TapNoteAdditionTextureCoordOffsetX=0 -TapNoteAdditionTextureCoordOffsetY=0.5 - -TapFakeAdditionTextureCoordOffsetX=0 -TapFakeAdditionTextureCoordOffsetY=0 -TapLiftAdditionTextureCoordOffsetX=0 -TapLiftAdditionTextureCoordOffsetY=0 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 -LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[NoteDisplay] +HoldLetGoGrayPercent=.8 +DrawHoldHeadForTapsOnSameRow=0 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 + +# control the vertical +TapNoteAdditionTextureCoordOffsetX=0 +TapNoteAdditionTextureCoordOffsetY=0.5 + +TapFakeAdditionTextureCoordOffsetX=0 +TapFakeAdditionTextureCoordOffsetY=0 +TapLiftAdditionTextureCoordOffsetX=0 +TapLiftAdditionTextureCoordOffsetY=0 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Bar Hold Explosion.lua b/NoteSkins/kb7/retrobar-razor/Bar Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-razor/Bar Hold Explosion.lua +++ b/NoteSkins/kb7/retrobar-razor/Bar Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Bar Receptor.lua b/NoteSkins/kb7/retrobar-razor/Bar Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/kb7/retrobar-razor/Bar Receptor.lua +++ b/NoteSkins/kb7/retrobar-razor/Bar Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Bar Roll Explosion.lua b/NoteSkins/kb7/retrobar-razor/Bar Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-razor/Bar Roll Explosion.lua +++ b/NoteSkins/kb7/retrobar-razor/Bar Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Bar Tap Mine.lua b/NoteSkins/kb7/retrobar-razor/Bar Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/kb7/retrobar-razor/Bar Tap Mine.lua +++ b/NoteSkins/kb7/retrobar-razor/Bar Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Bar Tap Note.lua b/NoteSkins/kb7/retrobar-razor/Bar Tap Note.lua index 33330264cb..622457be87 100644 --- a/NoteSkins/kb7/retrobar-razor/Bar Tap Note.lua +++ b/NoteSkins/kb7/retrobar-razor/Bar Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); - Frames = Sprite.LinearFrames( 1, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); + Frames = Sprite.LinearFrames( 1, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/Noteskin.lua b/NoteSkins/kb7/retrobar-razor/Noteskin.lua index ec93dfa115..8db306547c 100644 --- a/NoteSkins/kb7/retrobar-razor/Noteskin.lua +++ b/NoteSkins/kb7/retrobar-razor/Noteskin.lua @@ -1,99 +1,99 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; -}; - --- button redirs (since this is a bar noteskin, it's all the same) -Noteskin.ButtonRedirs = { - -- dance - Left = "Bar"; - UpLeft = "Bar"; - Down = "Bar"; - Up = "Bar"; - UpRight = "Bar"; - Right = "Bar"; - -- kb7 - Key1 = "Bar"; - Key2 = "Bar"; - Key3 = "Bar"; - Key4 = "Bar"; - Key5 = "Bar"; - Key6 = "Bar"; - Key7 = "Bar"; - -- pump - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; +}; + +-- button redirs (since this is a bar noteskin, it's all the same) +Noteskin.ButtonRedirs = { + -- dance + Left = "Bar"; + UpLeft = "Bar"; + Down = "Bar"; + Up = "Bar"; + UpRight = "Bar"; + Right = "Bar"; + -- kb7 + Key1 = "Bar"; + Key2 = "Bar"; + Key3 = "Bar"; + Key4 = "Bar"; + Key5 = "Bar"; + Key6 = "Bar"; + Key7 = "Bar"; + -- pump + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor/noteskin.ini b/NoteSkins/kb7/retrobar-razor/noteskin.ini index fd1981d4f4..cee2a32ca4 100644 --- a/NoteSkins/kb7/retrobar-razor/noteskin.ini +++ b/NoteSkins/kb7/retrobar-razor/noteskin.ini @@ -1,9 +1,9 @@ -[Global] -FallbackNoteSkin=retrobar - -[NoteDisplay] -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-16 +[Global] +FallbackNoteSkin=retrobar + +[NoteDisplay] +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-16 DrawHoldHeadForTapsOnSameRow=0 \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/Blue Tap Note.lua b/NoteSkins/kb7/retrobar-razor_o2/Blue Tap Note.lua index 06188b75aa..15cea8c3f2 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/Blue Tap Note.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/Blue Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); - Frames = Sprite.LinearFrames( 1, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Blue', 'tap note' ); + Frames = Sprite.LinearFrames( 1, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/Noteskin.lua b/NoteSkins/kb7/retrobar-razor_o2/Noteskin.lua index 8ab3168c52..de8752e1b3 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/Noteskin.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/Noteskin.lua @@ -1,102 +1,102 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; - -- Instead of separate hold heads, use the tap note graphics. - ["Hold Head Inactive"] = "Tap Note"; - ["Hold Head Active"] = "Tap Note"; - ["Roll Head Inactive"] = "Tap Note"; - ["Roll Head Active"] = "Tap Note"; -}; - --- button redirs --- o2jam uses this order: --- [white][blue][white][yellow][white][blue][white] -Noteskin.ButtonRedirs = { - -- dance - Left = "White"; - Up = "White"; - UpLeft = "Blue"; - Down = "White"; - UpRight = "Blue"; - Right = "White"; - -- kb7 - Key1 = "White"; - Key2 = "Blue"; - Key3 = "White"; - Key4 = "Yellow"; - Key5 = "White"; - Key6 = "Blue"; - Key7 = "White"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; + -- Instead of separate hold heads, use the tap note graphics. + ["Hold Head Inactive"] = "Tap Note"; + ["Hold Head Active"] = "Tap Note"; + ["Roll Head Inactive"] = "Tap Note"; + ["Roll Head Active"] = "Tap Note"; +}; + +-- button redirs +-- o2jam uses this order: +-- [white][blue][white][yellow][white][blue][white] +Noteskin.ButtonRedirs = { + -- dance + Left = "White"; + Up = "White"; + UpLeft = "Blue"; + Down = "White"; + UpRight = "Blue"; + Right = "White"; + -- kb7 + Key1 = "White"; + Key2 = "Blue"; + Key3 = "White"; + Key4 = "Yellow"; + Key5 = "White"; + Key6 = "Blue"; + Key7 = "White"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/White Tap Note.lua b/NoteSkins/kb7/retrobar-razor_o2/White Tap Note.lua index 25b33e40c0..5db34a5236 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/White Tap Note.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/White Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_White', 'tap note' ); - Frames = Sprite.LinearFrames( 1, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_White', 'tap note' ); + Frames = Sprite.LinearFrames( 1, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/Yellow Tap Note.lua b/NoteSkins/kb7/retrobar-razor_o2/Yellow Tap Note.lua index 75643f3338..df57c93b92 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/Yellow Tap Note.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/Yellow Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_Yellow', 'tap note' ); - Frames = Sprite.LinearFrames( 1, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_Yellow', 'tap note' ); + Frames = Sprite.LinearFrames( 1, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/_Hold Explosion.lua b/NoteSkins/kb7/retrobar-razor_o2/_Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/_Hold Explosion.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/_Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/_Receptor.lua b/NoteSkins/kb7/retrobar-razor_o2/_Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/_Receptor.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/_Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/_Roll Explosion.lua b/NoteSkins/kb7/retrobar-razor_o2/_Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/_Roll Explosion.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/_Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/_Tap Mine.lua b/NoteSkins/kb7/retrobar-razor_o2/_Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/_Tap Mine.lua +++ b/NoteSkins/kb7/retrobar-razor_o2/_Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar-razor_o2/noteskin.ini b/NoteSkins/kb7/retrobar-razor_o2/noteskin.ini index fd1981d4f4..cee2a32ca4 100644 --- a/NoteSkins/kb7/retrobar-razor_o2/noteskin.ini +++ b/NoteSkins/kb7/retrobar-razor_o2/noteskin.ini @@ -1,9 +1,9 @@ -[Global] -FallbackNoteSkin=retrobar - -[NoteDisplay] -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-16 +[Global] +FallbackNoteSkin=retrobar + +[NoteDisplay] +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-16 DrawHoldHeadForTapsOnSameRow=0 \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Bar Hold Explosion.lua b/NoteSkins/kb7/retrobar/Bar Hold Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar/Bar Hold Explosion.lua +++ b/NoteSkins/kb7/retrobar/Bar Hold Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Bar Receptor.lua b/NoteSkins/kb7/retrobar/Bar Receptor.lua index 58549bea9c..288980513e 100644 --- a/NoteSkins/kb7/retrobar/Bar Receptor.lua +++ b/NoteSkins/kb7/retrobar/Bar Receptor.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - -- normal - Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); - }; - -- flashpert - Def.Sprite { - Texture="_bar receptor tap"; - Frame0000=0; - Delay0000=1; - InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); - PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); - LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); - NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); - }; -}; - +local t = Def.ActorFrame{ + -- normal + Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'receptor base' ); + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'InitCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'PressCommand'); + }; + -- flashpert + Def.Sprite { + Texture="_bar receptor tap"; + Frame0000=0; + Delay0000=1; + InitCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'InitCommand'); + PressCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'PressCommand'); + LiftCommand=NOTESKIN:GetMetricA('ReceptorOverlay', 'LiftCommand'); + NoneCommand=NOTESKIN:GetMetricA('ReceptorArrow', 'NoneCommand'); + }; +}; + return t; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Bar Roll Explosion.lua b/NoteSkins/kb7/retrobar/Bar Roll Explosion.lua index 8872ea2286..4d2cd0cb29 100644 --- a/NoteSkins/kb7/retrobar/Bar Roll Explosion.lua +++ b/NoteSkins/kb7/retrobar/Bar Roll Explosion.lua @@ -1,3 +1,3 @@ -return LoadActor("_bar hold explosion bright")..{ - CheckpointHitCommand=cmd(diffusealpha,0); +return LoadActor("_bar hold explosion bright")..{ + CheckpointHitCommand=cmd(diffusealpha,0); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Bar Tap Mine.lua b/NoteSkins/kb7/retrobar/Bar Tap Mine.lua index face18692a..4691e40dbb 100644 --- a/NoteSkins/kb7/retrobar/Bar Tap Mine.lua +++ b/NoteSkins/kb7/retrobar/Bar Tap Mine.lua @@ -1,15 +1,15 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'mine' ); - Frame0000=0; - Delay0000=1; - Frame0001=1; - Delay0001=1; - Frame0002=2; - Delay0002=1; - Frame0003=3; - Delay0003=1; - Frame0004=2; - Delay0004=1; - Frame0005=1; - Delay0005=1; +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'mine' ); + Frame0000=0; + Delay0000=1; + Frame0001=1; + Delay0001=1; + Frame0002=2; + Delay0002=1; + Frame0003=3; + Delay0003=1; + Frame0004=2; + Delay0004=1; + Frame0005=1; + Delay0005=1; }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Bar Tap Note.lua b/NoteSkins/kb7/retrobar/Bar Tap Note.lua index d4ed127172..ea3c40560f 100644 --- a/NoteSkins/kb7/retrobar/Bar Tap Note.lua +++ b/NoteSkins/kb7/retrobar/Bar Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); - Frames = Sprite.LinearFrames( 4, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_bar', 'tap note' ); + Frames = Sprite.LinearFrames( 4, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/Noteskin.lua b/NoteSkins/kb7/retrobar/Noteskin.lua index 32ee244f53..5155db3306 100644 --- a/NoteSkins/kb7/retrobar/Noteskin.lua +++ b/NoteSkins/kb7/retrobar/Noteskin.lua @@ -1,99 +1,99 @@ --- from scratch, with various references. -local Noteskin = ... or {}; - --- element redirs -Noteskin.ElementRedirs = { - -- ["element"] = "redir_element"; -}; - --- button redirs (since this is a bar noteskin, it's all the same) -Noteskin.ButtonRedirs = { - -- dance - Left = "Bar"; - UpLeft = "Bar"; - Up = "Bar"; - Down = "Bar"; - UpRight = "Bar"; - Right = "Bar"; - -- kb7 - Key1 = "Bar"; - Key2 = "Bar"; - Key3 = "Bar"; - Key4 = "Bar"; - Key5 = "Bar"; - Key6 = "Bar"; - Key7 = "Bar"; - -- pump - DownLeft = "Bar"; - DownRight = "Bar"; - Center = "Bar"; -}; - --- things to blank out -Noteskin.Hide = { - -- ["element"] = true/false; -}; - --- rotations -Noteskin.BaseRotX = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; -Noteskin.BaseRotY = { - Left = 0; - UpLeft = 0; - Up = 0; - Down = 0; - UpRight = 0; - Right = 0; -}; - -local function NoteskinLoader() - local Button = Var "Button" - local Element = Var "Element" - - if Noteskin.Hide[Element] then - -- Return a blank element. If SpriteOnly is set, we need to return a - -- sprite; otherwise just return a dummy actor. - local t; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - else - t = Def.Actor {}; - end - return t .. { - cmd(visible,false); - }; - end; - - -- load element and button, using redirs - local LoadElement = Noteskin.ElementRedirs[Element] - if not LoadElement then - LoadElement = Element; - end; - - local LoadButton = Noteskin.ButtonRedirs[Button] - if not LoadButton then - LoadButton = Button; - end; - - -- get path to thing - local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); - - -- make actor - local t = LoadActor( sPath ); - - -- apply rotation - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - - return t; -end - -Noteskin.Load = NoteskinLoader; -Noteskin.CommonLoad = NoteskinLoader; +-- from scratch, with various references. +local Noteskin = ... or {}; + +-- element redirs +Noteskin.ElementRedirs = { + -- ["element"] = "redir_element"; +}; + +-- button redirs (since this is a bar noteskin, it's all the same) +Noteskin.ButtonRedirs = { + -- dance + Left = "Bar"; + UpLeft = "Bar"; + Up = "Bar"; + Down = "Bar"; + UpRight = "Bar"; + Right = "Bar"; + -- kb7 + Key1 = "Bar"; + Key2 = "Bar"; + Key3 = "Bar"; + Key4 = "Bar"; + Key5 = "Bar"; + Key6 = "Bar"; + Key7 = "Bar"; + -- pump + DownLeft = "Bar"; + DownRight = "Bar"; + Center = "Bar"; +}; + +-- things to blank out +Noteskin.Hide = { + -- ["element"] = true/false; +}; + +-- rotations +Noteskin.BaseRotX = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; +Noteskin.BaseRotY = { + Left = 0; + UpLeft = 0; + Up = 0; + Down = 0; + UpRight = 0; + Right = 0; +}; + +local function NoteskinLoader() + local Button = Var "Button" + local Element = Var "Element" + + if Noteskin.Hide[Element] then + -- Return a blank element. If SpriteOnly is set, we need to return a + -- sprite; otherwise just return a dummy actor. + local t; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + else + t = Def.Actor {}; + end + return t .. { + cmd(visible,false); + }; + end; + + -- load element and button, using redirs + local LoadElement = Noteskin.ElementRedirs[Element] + if not LoadElement then + LoadElement = Element; + end; + + local LoadButton = Noteskin.ButtonRedirs[Button] + if not LoadButton then + LoadButton = Button; + end; + + -- get path to thing + local sPath = NOTESKIN:GetPath( LoadButton, LoadElement ); + + -- make actor + local t = LoadActor( sPath ); + + -- apply rotation + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + + return t; +end + +Noteskin.Load = NoteskinLoader; +Noteskin.CommonLoad = NoteskinLoader; return Noteskin; \ No newline at end of file diff --git a/NoteSkins/kb7/retrobar/metrics.ini b/NoteSkins/kb7/retrobar/metrics.ini index e897be0949..822d89f31b 100644 --- a/NoteSkins/kb7/retrobar/metrics.ini +++ b/NoteSkins/kb7/retrobar/metrics.ini @@ -1,21 +1,21 @@ -[NoteDisplay] -HoldLetGoGrayPercent=.8 -StartDrawingHoldBodyOffsetFromHead=0 -StopDrawingHoldBodyOffsetFromTail=-32 - -HoldHeadNoteColorTextureCoordSpacingX=0 -HoldHeadNoteColorTextureCoordSpacingY=0 - -[ReceptorArrow] -InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 -NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 - -[ReceptorOverlay] -InitCommand=diffusealpha,0 -PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 -LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 - -[HoldGhostArrow] -HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 -HoldingOffCommand=diffusealpha,0 +[NoteDisplay] +HoldLetGoGrayPercent=.8 +StartDrawingHoldBodyOffsetFromHead=0 +StopDrawingHoldBodyOffsetFromTail=-32 + +HoldHeadNoteColorTextureCoordSpacingX=0 +HoldHeadNoteColorTextureCoordSpacingY=0 + +[ReceptorArrow] +InitCommand=effectclock,"beat";diffuseramp;effectcolor1,color(".8,.8,.8,1");effectcolor2,color("1,1,1,1");effecttiming,.2,0,.8,0;effectoffset,.05 +NoneCommand=finishtweening;zoom,.85;diffusealpha,.9;linear,.11;diffusealpha,1;zoom,1 + +[ReceptorOverlay] +InitCommand=diffusealpha,0 +PressCommand=finishtweening;zoom,1;blend,"BlendMode_Add";diffusealpha,.8;decelerate,0.2;diffusealpha,0.4 +LiftCommand=stoptweening;decelerate,.2;diffusealpha,0;zoom,1.2 + +[HoldGhostArrow] +HoldingOnCommand=diffusealpha,0.625;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,.7");effectperiod,.1 +HoldingOffCommand=diffusealpha,0 InitCommand=finishtweening;playcommand,"HoldingOff" \ No newline at end of file diff --git a/NoteSkins/pump/cmd-routine-p1/NoteSkin.lua b/NoteSkins/pump/cmd-routine-p1/NoteSkin.lua index 1bbeae06d8..3309aaba4b 100644 --- a/NoteSkins/pump/cmd-routine-p1/NoteSkin.lua +++ b/NoteSkins/pump/cmd-routine-p1/NoteSkin.lua @@ -1,11 +1,11 @@ -local Noteskin = ... or {} - -Noteskin.PartsToRotate = { - --["elemenu"] = true|false; - ["Roll Head Active"] = false; - ["Roll Head Inactive"] = false; - -- - ["Tap Note"] = false; -} - +local Noteskin = ... or {} + +Noteskin.PartsToRotate = { + --["elemenu"] = true|false; + ["Roll Head Active"] = false; + ["Roll Head Inactive"] = false; + -- + ["Tap Note"] = false; +} + return Noteskin \ No newline at end of file diff --git a/NoteSkins/pump/cmd-routine-p1/metrics.ini b/NoteSkins/pump/cmd-routine-p1/metrics.ini index 9450d5ed0c..169c86427b 100644 --- a/NoteSkins/pump/cmd-routine-p1/metrics.ini +++ b/NoteSkins/pump/cmd-routine-p1/metrics.ini @@ -1,2 +1,2 @@ -[Global] +[Global] FallbackNoteSkin=cmd \ No newline at end of file diff --git a/NoteSkins/pump/cmd-routine-p2/NoteSkin.lua b/NoteSkins/pump/cmd-routine-p2/NoteSkin.lua index 1bbeae06d8..3309aaba4b 100644 --- a/NoteSkins/pump/cmd-routine-p2/NoteSkin.lua +++ b/NoteSkins/pump/cmd-routine-p2/NoteSkin.lua @@ -1,11 +1,11 @@ -local Noteskin = ... or {} - -Noteskin.PartsToRotate = { - --["elemenu"] = true|false; - ["Roll Head Active"] = false; - ["Roll Head Inactive"] = false; - -- - ["Tap Note"] = false; -} - +local Noteskin = ... or {} + +Noteskin.PartsToRotate = { + --["elemenu"] = true|false; + ["Roll Head Active"] = false; + ["Roll Head Inactive"] = false; + -- + ["Tap Note"] = false; +} + return Noteskin \ No newline at end of file diff --git a/NoteSkins/pump/cmd-routine-p2/metrics.ini b/NoteSkins/pump/cmd-routine-p2/metrics.ini index 9450d5ed0c..169c86427b 100644 --- a/NoteSkins/pump/cmd-routine-p2/metrics.ini +++ b/NoteSkins/pump/cmd-routine-p2/metrics.ini @@ -1,2 +1,2 @@ -[Global] +[Global] FallbackNoteSkin=cmd \ No newline at end of file diff --git a/NoteSkins/pump/cmd/metrics.ini b/NoteSkins/pump/cmd/metrics.ini index 7fbb6e9abf..44c50c094d 100644 --- a/NoteSkins/pump/cmd/metrics.ini +++ b/NoteSkins/pump/cmd/metrics.ini @@ -1,5 +1,5 @@ -[UpLeft] -StartDrawingHoldBodyOffsetFromHead=-22 - -[UpRight] +[UpLeft] +StartDrawingHoldBodyOffsetFromHead=-22 + +[UpRight] StartDrawingHoldBodyOffsetFromHead=-22 \ No newline at end of file diff --git a/NoteSkins/pump/complex/metrics.ini b/NoteSkins/pump/complex/metrics.ini index 90748e0c73..302e3b9971 100644 --- a/NoteSkins/pump/complex/metrics.ini +++ b/NoteSkins/pump/complex/metrics.ini @@ -1,2 +1,2 @@ -[Center] +[Center] TapNoteAnimationLength=0.3 \ No newline at end of file diff --git a/NoteSkins/pump/default/Center Tap Lift.lua b/NoteSkins/pump/default/Center Tap Lift.lua index 6b52abbc20..3691eba751 100644 --- a/NoteSkins/pump/default/Center Tap Lift.lua +++ b/NoteSkins/pump/default/Center Tap Lift.lua @@ -1,3 +1,3 @@ -return NOTESKIN:LoadActor("Center","Tap Note")..{ - InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0); +return NOTESKIN:LoadActor("Center","Tap Note")..{ + InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0); }; \ No newline at end of file diff --git a/NoteSkins/pump/default/DownLeft Tap Lift.lua b/NoteSkins/pump/default/DownLeft Tap Lift.lua index c39c45f311..90a29250be 100644 --- a/NoteSkins/pump/default/DownLeft Tap Lift.lua +++ b/NoteSkins/pump/default/DownLeft Tap Lift.lua @@ -1,3 +1,3 @@ -return NOTESKIN:LoadActor("DownLeft","Tap Note")..{ - InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) +return NOTESKIN:LoadActor("DownLeft","Tap Note")..{ + InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) }; \ No newline at end of file diff --git a/NoteSkins/pump/default/DownRight Ready Receptor.lua b/NoteSkins/pump/default/DownRight Ready Receptor.lua index ca0aa5d395..4f49f0f032 100644 --- a/NoteSkins/pump/default/DownRight Ready Receptor.lua +++ b/NoteSkins/pump/default/DownRight Ready Receptor.lua @@ -1,7 +1,7 @@ -return NOTESKIN:LoadActor("DownLeft", "Ready Receptor")..{ - Frames = { - { Frame = 0 }; - { Frame = 1 }; - { Frame = 2 }; - }; +return NOTESKIN:LoadActor("DownLeft", "Ready Receptor")..{ + Frames = { + { Frame = 0 }; + { Frame = 1 }; + { Frame = 2 }; + }; }; \ No newline at end of file diff --git a/NoteSkins/pump/default/DownRight Tap Lift.lua b/NoteSkins/pump/default/DownRight Tap Lift.lua index e133f1c528..ee18e3364f 100644 --- a/NoteSkins/pump/default/DownRight Tap Lift.lua +++ b/NoteSkins/pump/default/DownRight Tap Lift.lua @@ -1,3 +1,3 @@ -return NOTESKIN:LoadActor("DownRight","Tap Note")..{ - InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) +return NOTESKIN:LoadActor("DownRight","Tap Note")..{ + InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) }; \ No newline at end of file diff --git a/NoteSkins/pump/default/NoteSkin.lua b/NoteSkins/pump/default/NoteSkin.lua index a0d475808f..762f083ea5 100644 --- a/NoteSkins/pump/default/NoteSkin.lua +++ b/NoteSkins/pump/default/NoteSkin.lua @@ -1,131 +1,131 @@ -local Noteskin = {} - ---bBlanks: -Noteskin.bBlanks = { - --["element"] = true|false; - ["Hold Tail Active"] = true; - ["Hold Tail Active"] = true; - ["Roll Tail Inactive"] = true; - ["Roll Tail Inactive"] = true; -} -Noteskin.PartsToRotate = { - --["elemenu"] = true|false; - ["Roll Head Active"] = false; - ["Roll Head Inactive"] = false; -} -Noteskin.ElementRedirs = { - --["element"] = "redirected_element"; - ["Hold Head Active"] = "Tap Note"; - ["Hold Head Inactive"] = "Tap Note"; - ["Roll Head Active"] = "Roll Head Active"; - ["Roll Head Inactive"] = "Roll Head Active"; - ["Tap Fake"] = "Tap Note"; - ["Tap Lift"] = "Tap Note"; - -- - ["Hold Topcap Inactive"] = "Hold Topcap Active"; - ["Hold Body Inactive"] = "Hold Body Active"; - ["Hold Bottomcap Inactive"] = "Hold Bottomcap Active"; - ["Hold Tail Inactive"] = "Hold Tail Active"; - -- - ["Roll Topcap Active"] = "Hold Topcap Active"; - ["Roll Body Active"] = "Hold Body Active"; - ["Roll Bottomcap Active"] = "Hold Bottomcap Active"; - ["Roll Tail Active"] = "Hold Tail Active"; - -- - ["Roll Topcap Inactive"] = "Hold Topcap Active"; - ["Roll Body Inactive"] = "Hold Body Active"; - ["Roll Bottomcap Inactive"] = "Hold Bottomcap Active"; - ["Roll Tail Inactive"] = "Hold Tail Active"; -} --- explicit, n/w ---[[Noteskin.ButtonRedirs = { - Center = "Center"; - UpLeft = "UpLeft"; - UpRight = "UpRight"; - DownLeft = "DownLeft"; - DownRight = "DownRight"; -}]] -Noteskin.BaseRotX = { - Center = 0; - UpLeft = 0; - UpRight = 0; - DownLeft = 0; - DownRight = 0; -} -Noteskin.BaseRotY = { - Center = 0; - UpLeft = 0; - UpRight = 180; - DownLeft = 0; - DownRight = 180; -} -Noteskin.BaseRotZ = { - Center = 0; - UpLeft = 0; - UpRight = 0; - DownLeft = 0; - DownRight = 0; -} - ---[[-------------------------------------------------------------------------- -DONT EDIT THE FUNCTION, DON'T COPY AND PASTE THE WHOLE NOTESKIN.LUA -JUST MAKE A NEW ONE AND GRAB WHATEVER IS USEFUL FOR YOUR NOTESKIN. -phew~ - -See cmd-routine-p* noteskin.lua for a simple and clear example on -how to do this properly, notice how the rest of the noteskins just -have graphics and at least a metrics.ini with few things ---]]-------------------------------------------------------------------------- -local function func() - local sButton = Var "Button" - local sElement = Var "Element" - - if Noteskin.bBlanks[sElement] then - local t = Def.Actor {}; - if Var "SpriteOnly" then - t = LoadActor( "_blank" ); - end - return t - end - - --local ButtonToLoad = Noteskin.ButtonRedirs[sButton] - local ElementToLoad = Noteskin.ElementRedirs[sElement] - if not ElementToLoad then - ElementToLoad = sElement - end - - if sElement == "Explosion" - or sElement == "Tap Mine" - or sElement == "Receptor" - then - sButton = "UpLeft" - end - local path = NOTESKIN:GetPath(sButton,ElementToLoad) - if ( string.find(sElement,"Hold") or string.find(sElement,"Roll") ) - and not ( string.find(sElement,"Head") or string.find(sElement,"Tail") ) - then - path = NOTESKIN:GetPath(sButton,ElementToLoad) - end - - local t = LoadActor(path) - - local bRotate = Noteskin.PartsToRotate[ElementToLoad] - --rotate by default - if bRotate == nil then bRotate = true end - if bRotate then - t.BaseRotationX=Noteskin.BaseRotX[sButton] - t.BaseRotationY=Noteskin.BaseRotY[sButton] - t.BaseRotationZ=Noteskin.BaseRotZ[sButton] - end - - if sElement == "Tap Lift" then - t.InitCommand=cmd(pulse;effectclock,"beat";effectmagnitude,1,0.75,0); - end - - return t -end - -Noteskin.Load = func -Noteskin.CommonLoad = func - +local Noteskin = {} + +--bBlanks: +Noteskin.bBlanks = { + --["element"] = true|false; + ["Hold Tail Active"] = true; + ["Hold Tail Active"] = true; + ["Roll Tail Inactive"] = true; + ["Roll Tail Inactive"] = true; +} +Noteskin.PartsToRotate = { + --["elemenu"] = true|false; + ["Roll Head Active"] = false; + ["Roll Head Inactive"] = false; +} +Noteskin.ElementRedirs = { + --["element"] = "redirected_element"; + ["Hold Head Active"] = "Tap Note"; + ["Hold Head Inactive"] = "Tap Note"; + ["Roll Head Active"] = "Roll Head Active"; + ["Roll Head Inactive"] = "Roll Head Active"; + ["Tap Fake"] = "Tap Note"; + ["Tap Lift"] = "Tap Note"; + -- + ["Hold Topcap Inactive"] = "Hold Topcap Active"; + ["Hold Body Inactive"] = "Hold Body Active"; + ["Hold Bottomcap Inactive"] = "Hold Bottomcap Active"; + ["Hold Tail Inactive"] = "Hold Tail Active"; + -- + ["Roll Topcap Active"] = "Hold Topcap Active"; + ["Roll Body Active"] = "Hold Body Active"; + ["Roll Bottomcap Active"] = "Hold Bottomcap Active"; + ["Roll Tail Active"] = "Hold Tail Active"; + -- + ["Roll Topcap Inactive"] = "Hold Topcap Active"; + ["Roll Body Inactive"] = "Hold Body Active"; + ["Roll Bottomcap Inactive"] = "Hold Bottomcap Active"; + ["Roll Tail Inactive"] = "Hold Tail Active"; +} +-- explicit, n/w +--[[Noteskin.ButtonRedirs = { + Center = "Center"; + UpLeft = "UpLeft"; + UpRight = "UpRight"; + DownLeft = "DownLeft"; + DownRight = "DownRight"; +}]] +Noteskin.BaseRotX = { + Center = 0; + UpLeft = 0; + UpRight = 0; + DownLeft = 0; + DownRight = 0; +} +Noteskin.BaseRotY = { + Center = 0; + UpLeft = 0; + UpRight = 180; + DownLeft = 0; + DownRight = 180; +} +Noteskin.BaseRotZ = { + Center = 0; + UpLeft = 0; + UpRight = 0; + DownLeft = 0; + DownRight = 0; +} + +--[[-------------------------------------------------------------------------- +DONT EDIT THE FUNCTION, DON'T COPY AND PASTE THE WHOLE NOTESKIN.LUA +JUST MAKE A NEW ONE AND GRAB WHATEVER IS USEFUL FOR YOUR NOTESKIN. +phew~ + +See cmd-routine-p* noteskin.lua for a simple and clear example on +how to do this properly, notice how the rest of the noteskins just +have graphics and at least a metrics.ini with few things +--]]-------------------------------------------------------------------------- +local function func() + local sButton = Var "Button" + local sElement = Var "Element" + + if Noteskin.bBlanks[sElement] then + local t = Def.Actor {}; + if Var "SpriteOnly" then + t = LoadActor( "_blank" ); + end + return t + end + + --local ButtonToLoad = Noteskin.ButtonRedirs[sButton] + local ElementToLoad = Noteskin.ElementRedirs[sElement] + if not ElementToLoad then + ElementToLoad = sElement + end + + if sElement == "Explosion" + or sElement == "Tap Mine" + or sElement == "Receptor" + then + sButton = "UpLeft" + end + local path = NOTESKIN:GetPath(sButton,ElementToLoad) + if ( string.find(sElement,"Hold") or string.find(sElement,"Roll") ) + and not ( string.find(sElement,"Head") or string.find(sElement,"Tail") ) + then + path = NOTESKIN:GetPath(sButton,ElementToLoad) + end + + local t = LoadActor(path) + + local bRotate = Noteskin.PartsToRotate[ElementToLoad] + --rotate by default + if bRotate == nil then bRotate = true end + if bRotate then + t.BaseRotationX=Noteskin.BaseRotX[sButton] + t.BaseRotationY=Noteskin.BaseRotY[sButton] + t.BaseRotationZ=Noteskin.BaseRotZ[sButton] + end + + if sElement == "Tap Lift" then + t.InitCommand=cmd(pulse;effectclock,"beat";effectmagnitude,1,0.75,0); + end + + return t +end + +Noteskin.Load = func +Noteskin.CommonLoad = func + return Noteskin \ No newline at end of file diff --git a/NoteSkins/pump/default/UpLeft Explosion.lua b/NoteSkins/pump/default/UpLeft Explosion.lua index f3d6852e9d..9127b0764b 100644 --- a/NoteSkins/pump/default/UpLeft Explosion.lua +++ b/NoteSkins/pump/default/UpLeft Explosion.lua @@ -1,44 +1,44 @@ -return Def.ActorFrame { - --note graphic - NOTESKIN:LoadActor(Var "Button", "Tap Note") .. { - InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow"); - W1Command=cmd(playcommand,"Glow"); - W2Command=cmd(playcommand,"Glow"); - W3Command=cmd(playcommand,"Glow"); - W4Command=cmd(); - W5Command=cmd(); - - HitMineCommand=cmd(playcommand,"Glow"); - GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1.0;zoom,1.0;linear,0.15;diffusealpha,0.9;zoom,1.15;linear,0.15;diffusealpha,0.0;zoom,1.3); - HeldCommand=cmd(playcommand,"Glow"); - }; - --tap - NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ - Name="Tap"; - Frames = { { Frame = 2 } }; - TapCommand=cmd(finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2); - - InitCommand=cmd(playcommand,"Tap"); - HeldCommand=cmd(playcommand,"Tap"); - ColumnJudgmentMessageCommand=cmd(playcommand,"Tap"); - --TapNoneCommand=cmd(playcommand,"Tap"); - }; - --explosion - LoadActor("_flash")..{ - InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow"); - W1Command=cmd(playcommand,"Glow"); - W2Command=cmd(playcommand,"Glow"); - W3Command=cmd(playcommand,"Glow"); - W4Command=cmd(); - W5Command=cmd(); - --HoldingOnCommand=cmd(playcommand,"Glow"); - HitMineCommand=cmd(playcommand,"Glow"); - HeldCommand=cmd(playcommand,"Glow"); - GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2); - }; - --thing... - Def.Quad { - InitCommand=cmd(zoomto,50,5000;diffusealpha,0); - HitMineCommand=cmd(finishtweening;diffusealpha,1;linear,0.3;diffusealpha,0); - }; +return Def.ActorFrame { + --note graphic + NOTESKIN:LoadActor(Var "Button", "Tap Note") .. { + InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow"); + W1Command=cmd(playcommand,"Glow"); + W2Command=cmd(playcommand,"Glow"); + W3Command=cmd(playcommand,"Glow"); + W4Command=cmd(); + W5Command=cmd(); + + HitMineCommand=cmd(playcommand,"Glow"); + GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1.0;zoom,1.0;linear,0.15;diffusealpha,0.9;zoom,1.15;linear,0.15;diffusealpha,0.0;zoom,1.3); + HeldCommand=cmd(playcommand,"Glow"); + }; + --tap + NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ + Name="Tap"; + Frames = { { Frame = 2 } }; + TapCommand=cmd(finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2); + + InitCommand=cmd(playcommand,"Tap"); + HeldCommand=cmd(playcommand,"Tap"); + ColumnJudgmentMessageCommand=cmd(playcommand,"Tap"); + --TapNoneCommand=cmd(playcommand,"Tap"); + }; + --explosion + LoadActor("_flash")..{ + InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow"); + W1Command=cmd(playcommand,"Glow"); + W2Command=cmd(playcommand,"Glow"); + W3Command=cmd(playcommand,"Glow"); + W4Command=cmd(); + W5Command=cmd(); + --HoldingOnCommand=cmd(playcommand,"Glow"); + HitMineCommand=cmd(playcommand,"Glow"); + HeldCommand=cmd(playcommand,"Glow"); + GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2); + }; + --thing... + Def.Quad { + InitCommand=cmd(zoomto,50,5000;diffusealpha,0); + HitMineCommand=cmd(finishtweening;diffusealpha,1;linear,0.3;diffusealpha,0); + }; } \ No newline at end of file diff --git a/NoteSkins/pump/default/UpLeft Receptor.lua b/NoteSkins/pump/default/UpLeft Receptor.lua index d6845a1d7d..3380a0b8ff 100644 --- a/NoteSkins/pump/default/UpLeft Receptor.lua +++ b/NoteSkins/pump/default/UpLeft Receptor.lua @@ -1,55 +1,55 @@ -local function Beat(self) - local this = self:GetChildren() - - local beat = GAMESTATE:GetSongBeat() - - local part = beat%1 - part = clamp(part,0,0.5) - local eff = scale(part,0,0.5,1,0) - if (GAMESTATE:GetSongDelay() or false) and part == 0 then eff = 0 end - if beat < 0 then - eff = 0 - end - this.Glow:diffusealpha(eff); -end - -return Def.ActorFrame { - -- COMMANDS -- - InitCommand=cmd(SetUpdateFunction,Beat); - - -- LAYERS -- - NOTESKIN:LoadActor("Center", "Outline Receptor")..{ - Name="Outline Full"; - Condition=Var "Button" == "Center" and GAMESTATE:GetCurrentStyle():GetStepsType() ~= 'StepsType_Pump_Halfdouble'; - --InitCommand=cmd(x,96); - }; - NOTESKIN:LoadActor("DownLeft", "Outline Receptor")..{ - Name="Outline Half"; - Condition=Var "Button" == "DownLeft" and GAMESTATE:GetCurrentStyle():GetStepsType() == 'StepsType_Pump_Halfdouble'; - --InitCommand=cmd(x,96); - }; - - NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ - Name="Base"; - Frames = { { Frame = 0 } }; - PressCommand=cmd(finishtweening;linear,0.05;zoom,0.9;linear,0.1;zoom,1); - }; - NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ - Name="Glow"; - Frames = { { Frame = 1 } }; - InitCommand=cmd(blend,'BlendMode_Add'); - PressCommand=cmd(finishtweening;linear,0.05;zoom,0.9;linear,0.1;zoom,1); - }; - --[[ - NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ - Name="Tap"; - Frames = { { Frame = 2 } }; - InitCommand=cmd(zoom,1;diffusealpha,0;glow,1,1,1,0); - --NOTESKIN:GetMetricA(Var "Button", "TapInitCommand"); - -- - PressCommand=cmd(finishtweening;glow,1,1,1,1;zoom,1;linear,0.2;glow,1,1,1,0;zoom,1.2); - --NOTESKIN:GetMetricA(Var "Button", "TapHeldCommand"); - -- - }; - --]] +local function Beat(self) + local this = self:GetChildren() + + local beat = GAMESTATE:GetSongBeat() + + local part = beat%1 + part = clamp(part,0,0.5) + local eff = scale(part,0,0.5,1,0) + if (GAMESTATE:GetSongDelay() or false) and part == 0 then eff = 0 end + if beat < 0 then + eff = 0 + end + this.Glow:diffusealpha(eff); +end + +return Def.ActorFrame { + -- COMMANDS -- + InitCommand=cmd(SetUpdateFunction,Beat); + + -- LAYERS -- + NOTESKIN:LoadActor("Center", "Outline Receptor")..{ + Name="Outline Full"; + Condition=Var "Button" == "Center" and GAMESTATE:GetCurrentStyle():GetStepsType() ~= 'StepsType_Pump_Halfdouble'; + --InitCommand=cmd(x,96); + }; + NOTESKIN:LoadActor("DownLeft", "Outline Receptor")..{ + Name="Outline Half"; + Condition=Var "Button" == "DownLeft" and GAMESTATE:GetCurrentStyle():GetStepsType() == 'StepsType_Pump_Halfdouble'; + --InitCommand=cmd(x,96); + }; + + NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ + Name="Base"; + Frames = { { Frame = 0 } }; + PressCommand=cmd(finishtweening;linear,0.05;zoom,0.9;linear,0.1;zoom,1); + }; + NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ + Name="Glow"; + Frames = { { Frame = 1 } }; + InitCommand=cmd(blend,'BlendMode_Add'); + PressCommand=cmd(finishtweening;linear,0.05;zoom,0.9;linear,0.1;zoom,1); + }; + --[[ + NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ + Name="Tap"; + Frames = { { Frame = 2 } }; + InitCommand=cmd(zoom,1;diffusealpha,0;glow,1,1,1,0); + --NOTESKIN:GetMetricA(Var "Button", "TapInitCommand"); + -- + PressCommand=cmd(finishtweening;glow,1,1,1,1;zoom,1;linear,0.2;glow,1,1,1,0;zoom,1.2); + --NOTESKIN:GetMetricA(Var "Button", "TapHeldCommand"); + -- + }; + --]] } \ No newline at end of file diff --git a/NoteSkins/pump/default/UpLeft Tap Lift.lua b/NoteSkins/pump/default/UpLeft Tap Lift.lua index e764dae2dc..9096d27dec 100644 --- a/NoteSkins/pump/default/UpLeft Tap Lift.lua +++ b/NoteSkins/pump/default/UpLeft Tap Lift.lua @@ -1,3 +1,3 @@ -return NOTESKIN:LoadActor("UpLeft","Tap Note")..{ - InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) +return NOTESKIN:LoadActor("UpLeft","Tap Note")..{ + InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) }; \ No newline at end of file diff --git a/NoteSkins/pump/default/UpRight Ready Receptor.lua b/NoteSkins/pump/default/UpRight Ready Receptor.lua index 367c0bada7..02f5fc7e7d 100644 --- a/NoteSkins/pump/default/UpRight Ready Receptor.lua +++ b/NoteSkins/pump/default/UpRight Ready Receptor.lua @@ -1,7 +1,7 @@ -return NOTESKIN:LoadActor("UpLeft", "Ready Receptor")..{ - Frames = { - { Frame = 0 }; - { Frame = 1 }; - { Frame = 2 }; - }; +return NOTESKIN:LoadActor("UpLeft", "Ready Receptor")..{ + Frames = { + { Frame = 0 }; + { Frame = 1 }; + { Frame = 2 }; + }; }; \ No newline at end of file diff --git a/NoteSkins/pump/default/UpRight Tap Lift.lua b/NoteSkins/pump/default/UpRight Tap Lift.lua index 415cab765e..91c4f11011 100644 --- a/NoteSkins/pump/default/UpRight Tap Lift.lua +++ b/NoteSkins/pump/default/UpRight Tap Lift.lua @@ -1,3 +1,3 @@ -return NOTESKIN:LoadActor("UpRight","Tap Note")..{ - InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) +return NOTESKIN:LoadActor("UpRight","Tap Note")..{ + InitCommand=cmd(effectclock,"beat";effectmagnitude,0.5,1,0) }; \ No newline at end of file diff --git a/NoteSkins/pump/default/metrics.ini b/NoteSkins/pump/default/metrics.ini index b2815efafd..1feb9ab498 100644 --- a/NoteSkins/pump/default/metrics.ini +++ b/NoteSkins/pump/default/metrics.ini @@ -1,29 +1,29 @@ -[NoteDisplay] -AnimationIsBeatBased=0 - -TapNoteAnimationLength=0.25 -TapMineAnimationLength=0.25 -TapLiftAnimationLength=0.25 -TapFakeAnimationLength=0.25 -HoldHeadAnimationLength=0.25 -HoldTopCapAnimationLength=0.25 -HoldBottomCapAnimationLength=0.25 -HoldBodyAnimationLength=0.25 -HoldTailAnimationLength=0.25 - -HoldLetGoGrayPercent=1 - -FlipHeadAndTailWhenReverse=1 -FlipHoldBodyWhenReverse=1 -TopHoldAnchorWhenReverse=0 -HoldActiveIsAddLayer=0 - -[Center] - -[DownLeft] - -[DownRight] - -[UpLeft] - -[UpRight] +[NoteDisplay] +AnimationIsBeatBased=0 + +TapNoteAnimationLength=0.25 +TapMineAnimationLength=0.25 +TapLiftAnimationLength=0.25 +TapFakeAnimationLength=0.25 +HoldHeadAnimationLength=0.25 +HoldTopCapAnimationLength=0.25 +HoldBottomCapAnimationLength=0.25 +HoldBodyAnimationLength=0.25 +HoldTailAnimationLength=0.25 + +HoldLetGoGrayPercent=1 + +FlipHeadAndTailWhenReverse=1 +FlipHoldBodyWhenReverse=1 +TopHoldAnchorWhenReverse=0 +HoldActiveIsAddLayer=0 + +[Center] + +[DownLeft] + +[DownRight] + +[UpLeft] + +[UpRight] diff --git a/NoteSkins/pump/frame5p/metrics.ini b/NoteSkins/pump/frame5p/metrics.ini index daf9021fa2..e82927ca40 100644 --- a/NoteSkins/pump/frame5p/metrics.ini +++ b/NoteSkins/pump/frame5p/metrics.ini @@ -1,10 +1,10 @@ -[NoteDisplay] -TapNoteAnimationLength=0.333 -TapMineAnimationLength=0.333 -TapLiftAnimationLength=0.333 -TapFakeAnimationLength=0.333 -HoldHeadAnimationLength=0.333 -HoldTopCapAnimationLength=0.333 -HoldBottomCapAnimationLength=0.333 -HoldBodyAnimationLength=0.333 -HoldTailAnimationLength=0.333 +[NoteDisplay] +TapNoteAnimationLength=0.333 +TapMineAnimationLength=0.333 +TapLiftAnimationLength=0.333 +TapFakeAnimationLength=0.333 +HoldHeadAnimationLength=0.333 +HoldTopCapAnimationLength=0.333 +HoldBottomCapAnimationLength=0.333 +HoldBodyAnimationLength=0.333 +HoldTailAnimationLength=0.333 diff --git a/NoteSkins/pump/rhythm/Center Tap Note.lua b/NoteSkins/pump/rhythm/Center Tap Note.lua index 5271c2ed97..85e5c1c3df 100644 --- a/NoteSkins/pump/rhythm/Center Tap Note.lua +++ b/NoteSkins/pump/rhythm/Center Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_center', 'tap note' ); - Frames = Sprite.LinearFrames( 6, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_center', 'tap note' ); + Frames = Sprite.LinearFrames( 6, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/pump/rhythm/DownLeft Tap Note.lua b/NoteSkins/pump/rhythm/DownLeft Tap Note.lua index 4f830b9cc4..aee5ff13dd 100644 --- a/NoteSkins/pump/rhythm/DownLeft Tap Note.lua +++ b/NoteSkins/pump/rhythm/DownLeft Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_downleft', 'tap note' ); - Frames = Sprite.LinearFrames( 6, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_downleft', 'tap note' ); + Frames = Sprite.LinearFrames( 6, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/pump/rhythm/UpLeft Tap Note.lua b/NoteSkins/pump/rhythm/UpLeft Tap Note.lua index 0e94651b2d..1e8c368c6e 100644 --- a/NoteSkins/pump/rhythm/UpLeft Tap Note.lua +++ b/NoteSkins/pump/rhythm/UpLeft Tap Note.lua @@ -1,4 +1,4 @@ -return Def.Sprite { - Texture=NOTESKIN:GetPath( '_upleft', 'tap note' ); - Frames = Sprite.LinearFrames( 6, 1 ); +return Def.Sprite { + Texture=NOTESKIN:GetPath( '_upleft', 'tap note' ); + Frames = Sprite.LinearFrames( 6, 1 ); }; \ No newline at end of file diff --git a/NoteSkins/pump/simple/metrics.ini b/NoteSkins/pump/simple/metrics.ini index daf9021fa2..e82927ca40 100644 --- a/NoteSkins/pump/simple/metrics.ini +++ b/NoteSkins/pump/simple/metrics.ini @@ -1,10 +1,10 @@ -[NoteDisplay] -TapNoteAnimationLength=0.333 -TapMineAnimationLength=0.333 -TapLiftAnimationLength=0.333 -TapFakeAnimationLength=0.333 -HoldHeadAnimationLength=0.333 -HoldTopCapAnimationLength=0.333 -HoldBottomCapAnimationLength=0.333 -HoldBodyAnimationLength=0.333 -HoldTailAnimationLength=0.333 +[NoteDisplay] +TapNoteAnimationLength=0.333 +TapMineAnimationLength=0.333 +TapLiftAnimationLength=0.333 +TapFakeAnimationLength=0.333 +HoldHeadAnimationLength=0.333 +HoldTopCapAnimationLength=0.333 +HoldBottomCapAnimationLength=0.333 +HoldBodyAnimationLength=0.333 +HoldTailAnimationLength=0.333 diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua index 8c25be1f11..ca42b0f097 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu cancel.lua @@ -1,4 +1,4 @@ -return Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(decelerate,1;diffusealpha,1); +return Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); + OnCommand=cmd(decelerate,1;diffusealpha,1); }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua index fbcd53b75f..00ce5b8edc 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu out.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(sleep,1.125;decelerate,0.875;diffusealpha,1); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); + OnCommand=cmd(sleep,1.125;decelerate,0.875;diffusealpha,1); + }; } \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua index f5e3c27de4..f859b27bb9 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenTitleMenu underlay.lua @@ -1,72 +1,72 @@ --- This file returns an ActorFrame that holds a few objects. - --- Since I like to collapse similar code, here is a simple example: -local lineWidth = SCREEN_WIDTH*0.9; --- previously, I had this set to SCREEN_WIDTH*0.8 in each of the --- Def.Quad blocks below. Now I just use lineWidth and I get two advantages: --- 1) I can change it and it takes effect in multiple places. --- 2) I get a human readable name out of it. --- It makes your code easier to read and work with. - -local lineTime = 0.625; --- same with this code. - -return Def.ActorFrame { - Def.ActorFrame{ - Name="Flourishes"; - -- it has to be 0.05 since 0.9 uses up space on both sides. - InitCommand=cmd(x,SCREEN_LEFT+(SCREEN_WIDTH*0.05);y,SCREEN_CENTER_Y;); - - Def.Quad{ - Name="Red"; - InitCommand=cmd(horizalign,left;zoomto,0,4;diffuse,color("#DA8989");diffuserightedge,color("#FFBBBB")); - OnCommand=cmd(sleep,0.1;linear,lineTime;zoomx,lineWidth); - }; - - Def.Quad{ - Name="Yellow"; - InitCommand=cmd(y,4;horizalign,left;zoomto,0,4;diffuse,color("#DAD989");diffuserightedge,color("#FFFCBB")); - OnCommand=cmd(sleep,0.05;linear,lineTime;zoomx,lineWidth); - }; - - Def.Quad{ - Name="Blue"; - InitCommand=cmd(y,8;horizalign,left;zoomto,0,4;diffuse,color("#89C6DA");diffuserightedge,color("#BBEEFF")); - OnCommand=cmd(linear,lineTime;zoomx,lineWidth); - }; - }; - - -- LoadActor() is used to automatically load objects. - -- You'll be using it a lot. - - -- THEME:GetPathG() gets a file from the Graphics folder. - -- What graphic depends on the arguments. - -- There must always be two, and there usually is a space between the - -- first and second, unless you perform a trick like this: - LoadActor( THEME:GetPathG("","_common/_logo") ) .. { - -- the InitCommand puts the logo 44 pixels above vertical center - -- and moves it 60 pixels to the left of horizontal center. - -- diffusealpha,0 makes the object invisible, - -- which is handy for transitions... - InitCommand=cmd(x,SCREEN_CENTER_X*0.8125;y,SCREEN_CENTER_Y-44;diffusealpha,0;); - -- ...as we see in the OnCommand. linear means to perform the next - -- commands over a span of time (in seconds). - -- diffusealpha,1 makes the logo fade in when applied here. - OnCommand=cmd(linear,0.5;diffusealpha,1;); - }; - - -- Creative Commons logo, using a local file in the same directory: - LoadActor( "creativecommons" )..{ - InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-48;Real); - OnCommand=cmd(addy,32;cropbottom,1;fadebottom,1;decelerate,0.8;cropbottom,0;fadebottom,0;addy,-32); - }; - -- Making a cheap reflection effect for the sake of showing off the fov and - -- vanishpoint commands on ActorFrames. - Def.ActorFrame{ - InitCommand=cmd(fov,45;vanishpoint,SCREEN_LEFT+64,SCREEN_BOTTOM-24;); - LoadActor( "creativecommons" )..{ - InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-24;valign,0;zoomy,-0.6;rotationx,-60;diffusealpha,0.6;Real;); - OnCommand=cmd(croptop,1;fadetop,0;decelerate,0.8;croptop,0;fadetop,1;); - }; - }; +-- This file returns an ActorFrame that holds a few objects. + +-- Since I like to collapse similar code, here is a simple example: +local lineWidth = SCREEN_WIDTH*0.9; +-- previously, I had this set to SCREEN_WIDTH*0.8 in each of the +-- Def.Quad blocks below. Now I just use lineWidth and I get two advantages: +-- 1) I can change it and it takes effect in multiple places. +-- 2) I get a human readable name out of it. +-- It makes your code easier to read and work with. + +local lineTime = 0.625; +-- same with this code. + +return Def.ActorFrame { + Def.ActorFrame{ + Name="Flourishes"; + -- it has to be 0.05 since 0.9 uses up space on both sides. + InitCommand=cmd(x,SCREEN_LEFT+(SCREEN_WIDTH*0.05);y,SCREEN_CENTER_Y;); + + Def.Quad{ + Name="Red"; + InitCommand=cmd(horizalign,left;zoomto,0,4;diffuse,color("#DA8989");diffuserightedge,color("#FFBBBB")); + OnCommand=cmd(sleep,0.1;linear,lineTime;zoomx,lineWidth); + }; + + Def.Quad{ + Name="Yellow"; + InitCommand=cmd(y,4;horizalign,left;zoomto,0,4;diffuse,color("#DAD989");diffuserightedge,color("#FFFCBB")); + OnCommand=cmd(sleep,0.05;linear,lineTime;zoomx,lineWidth); + }; + + Def.Quad{ + Name="Blue"; + InitCommand=cmd(y,8;horizalign,left;zoomto,0,4;diffuse,color("#89C6DA");diffuserightedge,color("#BBEEFF")); + OnCommand=cmd(linear,lineTime;zoomx,lineWidth); + }; + }; + + -- LoadActor() is used to automatically load objects. + -- You'll be using it a lot. + + -- THEME:GetPathG() gets a file from the Graphics folder. + -- What graphic depends on the arguments. + -- There must always be two, and there usually is a space between the + -- first and second, unless you perform a trick like this: + LoadActor( THEME:GetPathG("","_common/_logo") ) .. { + -- the InitCommand puts the logo 44 pixels above vertical center + -- and moves it 60 pixels to the left of horizontal center. + -- diffusealpha,0 makes the object invisible, + -- which is handy for transitions... + InitCommand=cmd(x,SCREEN_CENTER_X*0.8125;y,SCREEN_CENTER_Y-44;diffusealpha,0;); + -- ...as we see in the OnCommand. linear means to perform the next + -- commands over a span of time (in seconds). + -- diffusealpha,1 makes the logo fade in when applied here. + OnCommand=cmd(linear,0.5;diffusealpha,1;); + }; + + -- Creative Commons logo, using a local file in the same directory: + LoadActor( "creativecommons" )..{ + InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-48;Real); + OnCommand=cmd(addy,32;cropbottom,1;fadebottom,1;decelerate,0.8;cropbottom,0;fadebottom,0;addy,-32); + }; + -- Making a cheap reflection effect for the sake of showing off the fov and + -- vanishpoint commands on ActorFrames. + Def.ActorFrame{ + InitCommand=cmd(fov,45;vanishpoint,SCREEN_LEFT+64,SCREEN_BOTTOM-24;); + LoadActor( "creativecommons" )..{ + InitCommand=cmd(x,SCREEN_LEFT+64;y,SCREEN_BOTTOM-24;valign,0;zoomy,-0.6;rotationx,-60;diffusealpha,0.6;Real;); + OnCommand=cmd(croptop,1;fadetop,0;decelerate,0.8;croptop,0;fadetop,1;); + }; + }; }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua index ee69cb6ab6..924506e9d8 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements background.lua @@ -1,8 +1,8 @@ --- this file returns a single quad that represents the background of most screens in the theme. -return Def.Quad{ - -- FullScreen is defined in Themes/_fallback/Scripts/02 Actor.lua in sm-ssc. - - -- colors can either be entered as hex ("#FFFFFFFF") or 0..1 ("1.0,1.0,1.0,1.0") - -- where the values are Red, Green, Blue, and Alpha (transparency). - InitCommand=cmd(FullScreen;diffuse,color("#fffdf2")); +-- this file returns a single quad that represents the background of most screens in the theme. +return Def.Quad{ + -- FullScreen is defined in Themes/_fallback/Scripts/02 Actor.lua in sm-ssc. + + -- colors can either be entered as hex ("#FFFFFFFF") or 0..1 ("1.0,1.0,1.0,1.0") + -- where the values are Red, Green, Blue, and Alpha (transparency). + InitCommand=cmd(FullScreen;diffuse,color("#fffdf2")); }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements decorations.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements decorations.lua index ecfb1b0a2d..e4d6983db5 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements decorations.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements decorations.lua @@ -1,8 +1,8 @@ --- ScreenWithMenuElements decorations is a very important file, as it will put a --- decorations layer on pretty much every screen. -local t = Def.ActorFrame{}; - -t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); ---t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); - +-- ScreenWithMenuElements decorations is a very important file, as it will put a +-- decorations layer on pretty much every screen. +local t = Def.ActorFrame{}; + +t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); +--t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua index 904860a60c..dede3b5529 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements in.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf2FF")); - OnCommand=cmd(decelerate,0.75;diffusealpha,0); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("#fffdf2FF")); + OnCommand=cmd(decelerate,0.75;diffusealpha,0); + }; }; \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua index 0952605a35..2ab1bf156f 100644 --- a/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua +++ b/Themes/HelloWorld/BGAnimations/ScreenWithMenuElements out.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); - OnCommand=cmd(decelerate,0.875;diffusealpha,1); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("#fffdf200")); + OnCommand=cmd(decelerate,0.875;diffusealpha,1); + }; } \ No newline at end of file diff --git a/Themes/HelloWorld/BGAnimations/_wait.lua b/Themes/HelloWorld/BGAnimations/_wait.lua index 1c59852cfd..d3a544b612 100644 --- a/Themes/HelloWorld/BGAnimations/_wait.lua +++ b/Themes/HelloWorld/BGAnimations/_wait.lua @@ -1,4 +1,4 @@ -local time = ... -if not time then time = 1.0 end - +local time = ... +if not time then time = 1.0 end + return Def.Actor{ OnCommand=cmd(sleep,time); }; \ No newline at end of file diff --git a/Themes/HelloWorld/Fonts/_frutiger roman 24px.ini b/Themes/HelloWorld/Fonts/_frutiger roman 24px.ini index 7734e7e4a8..702c8cd9cd 100644 --- a/Themes/HelloWorld/Fonts/_frutiger roman 24px.ini +++ b/Themes/HelloWorld/Fonts/_frutiger roman 24px.ini @@ -1,392 +1,392 @@ -[main] -Baseline=23 -Top=6 -LineSpacing=28 -DrawExtraPixelsLeft=1 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 -0=10 -1=10 -2=10 -3=10 -4=10 -5=10 -6=10 -7=10 -8=10 -9=10 -10=10 -11=10 -12=10 -13=10 -14=10 -15=10 -16=10 -17=10 -18=10 -19=10 -20=10 -21=10 -22=10 -23=10 -24=10 -25=10 -26=10 -27=10 -28=10 -29=10 -30=10 -31=10 -32=7 -33=9 -34=13 -35=13 -36=13 -37=24 -38=17 -39=7 -40=8 -41=8 -42=13 -43=14 -44=7 -45=8 -46=7 -47=7 -48=13 -49=13 -50=13 -51=13 -52=13 -53=13 -54=13 -55=13 -56=13 -57=13 -58=7 -59=7 -60=14 -61=14 -62=14 -63=12 -64=19 -65=17 -66=15 -67=15 -68=17 -69=13 -70=12 -71=17 -72=17 -73=7 -74=9 -75=16 -76=12 -77=23 -78=17 -79=19 -80=13 -81=19 -82=15 -83=12 -84=13 -85=17 -86=16 -87=24 -88=16 -89=16 -90=13 -91=8 -92=7 -93=8 -94=14 -95=12 -96=7 -97=13 -98=15 -99=11 -100=15 -101=13 -102=9 -103=15 -104=15 -105=7 -106=7 -107=13 -108=7 -109=21 -110=15 -111=15 -112=15 -113=15 -114=9 -115=9 -116=9 -117=15 -118=12 -119=20 -120=12 -121=12 -122=12 -123=8 -124=5 -125=8 -126=14 -127=10 -128=13 -129=10 -130=7 -131=13 -132=13 -133=24 -134=13 -135=13 -136=7 -137=24 -138=12 -139=7 -140=23 -141=10 -142=13 -143=10 -144=10 -145=7 -146=7 -147=13 -148=13 -149=12 -150=12 -151=24 -152=7 -153=24 -154=9 -155=7 -156=23 -157=12 -158=10 -159=16 -160=7 -161=9 -162=13 -163=13 -164=13 -165=13 -166=5 -167=13 -168=7 -169=19 -170=9 -171=13 -172=14 -173=8 -174=19 -175=7 -176=10 -177=14 -178=9 -179=9 -180=7 -181=15 -182=14 -183=7 -184=7 -185=9 -186=10 -187=13 -188=20 -189=20 -190=20 -191=12 -192=17 -193=17 -194=17 -195=17 -196=17 -197=17 -198=23 -199=15 -200=13 -201=13 -202=13 -203=13 -204=7 -205=7 -206=7 -207=7 -208=17 -209=17 -210=19 -211=19 -212=19 -213=19 -214=19 -215=14 -216=19 -217=17 -218=17 -219=17 -220=17 -221=16 -222=13 -223=15 -224=13 -225=13 -226=13 -227=13 -228=13 -229=13 -230=21 -231=11 -232=13 -233=13 -234=13 -235=13 -236=7 -237=7 -238=7 -239=7 -240=15 -241=15 -242=15 -243=15 -244=15 -245=15 -246=15 -247=14 -248=15 -249=15 -250=15 -251=15 -252=15 -253=12 -254=15 -255=12 -[alt] -0=10 -1=10 -2=10 -3=10 -4=10 -5=10 -6=10 -7=10 -8=10 -9=10 -10=10 -11=10 -12=10 -13=10 -14=10 -15=10 -16=10 -17=10 -18=10 -19=10 -20=10 -21=10 -22=10 -23=10 -24=10 -25=10 -26=10 -27=10 -28=10 -29=10 -30=10 -31=10 -32=7 -33=12 -34=7 -35=12 -36=13 -37=10 -38=11 -39=13 -40=7 -41=12 -42=11 -43=9 -44=11 -45=8 -46=13 -47=11 -48=10 -49=11 -50=7 -51=7 -52=7 -53=7 -54=9 -55=7 -56=7 -57=9 -58=9 -59=7 -60=8 -61=7 -62=12 -63=8 -64=13 -65=17 -66=17 -67=12 -68=17 -69=10 -70=12 -71=15 -72=12 -73=13 -74=11 -75=13 -76=11 -77=7 -78=7 -79=13 -80=13 -81=13 -82=13 -83=19 -84=19 -85=13 -86=19 -87=14 -88=13 -89=12 -90=17 -91=12 -92=17 -93=16 -94=9 -95=15 -96=7 -97=13 -98=13 -99=11 -100=13 -101=5 -102=9 -103=11 -104=9 -105=13 -106=10 -107=13 -108=10 -109=7 -110=7 -111=13 -112=11 -113=11 -114=11 -115=15 -116=15 -117=11 -118=15 -119=14 -120=7 -121=11 -122=15 -123=11 -124=15 -125=12 -126=6 -127=7 +[main] +Baseline=23 +Top=6 +LineSpacing=28 +DrawExtraPixelsLeft=1 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 +0=10 +1=10 +2=10 +3=10 +4=10 +5=10 +6=10 +7=10 +8=10 +9=10 +10=10 +11=10 +12=10 +13=10 +14=10 +15=10 +16=10 +17=10 +18=10 +19=10 +20=10 +21=10 +22=10 +23=10 +24=10 +25=10 +26=10 +27=10 +28=10 +29=10 +30=10 +31=10 +32=7 +33=9 +34=13 +35=13 +36=13 +37=24 +38=17 +39=7 +40=8 +41=8 +42=13 +43=14 +44=7 +45=8 +46=7 +47=7 +48=13 +49=13 +50=13 +51=13 +52=13 +53=13 +54=13 +55=13 +56=13 +57=13 +58=7 +59=7 +60=14 +61=14 +62=14 +63=12 +64=19 +65=17 +66=15 +67=15 +68=17 +69=13 +70=12 +71=17 +72=17 +73=7 +74=9 +75=16 +76=12 +77=23 +78=17 +79=19 +80=13 +81=19 +82=15 +83=12 +84=13 +85=17 +86=16 +87=24 +88=16 +89=16 +90=13 +91=8 +92=7 +93=8 +94=14 +95=12 +96=7 +97=13 +98=15 +99=11 +100=15 +101=13 +102=9 +103=15 +104=15 +105=7 +106=7 +107=13 +108=7 +109=21 +110=15 +111=15 +112=15 +113=15 +114=9 +115=9 +116=9 +117=15 +118=12 +119=20 +120=12 +121=12 +122=12 +123=8 +124=5 +125=8 +126=14 +127=10 +128=13 +129=10 +130=7 +131=13 +132=13 +133=24 +134=13 +135=13 +136=7 +137=24 +138=12 +139=7 +140=23 +141=10 +142=13 +143=10 +144=10 +145=7 +146=7 +147=13 +148=13 +149=12 +150=12 +151=24 +152=7 +153=24 +154=9 +155=7 +156=23 +157=12 +158=10 +159=16 +160=7 +161=9 +162=13 +163=13 +164=13 +165=13 +166=5 +167=13 +168=7 +169=19 +170=9 +171=13 +172=14 +173=8 +174=19 +175=7 +176=10 +177=14 +178=9 +179=9 +180=7 +181=15 +182=14 +183=7 +184=7 +185=9 +186=10 +187=13 +188=20 +189=20 +190=20 +191=12 +192=17 +193=17 +194=17 +195=17 +196=17 +197=17 +198=23 +199=15 +200=13 +201=13 +202=13 +203=13 +204=7 +205=7 +206=7 +207=7 +208=17 +209=17 +210=19 +211=19 +212=19 +213=19 +214=19 +215=14 +216=19 +217=17 +218=17 +219=17 +220=17 +221=16 +222=13 +223=15 +224=13 +225=13 +226=13 +227=13 +228=13 +229=13 +230=21 +231=11 +232=13 +233=13 +234=13 +235=13 +236=7 +237=7 +238=7 +239=7 +240=15 +241=15 +242=15 +243=15 +244=15 +245=15 +246=15 +247=14 +248=15 +249=15 +250=15 +251=15 +252=15 +253=12 +254=15 +255=12 +[alt] +0=10 +1=10 +2=10 +3=10 +4=10 +5=10 +6=10 +7=10 +8=10 +9=10 +10=10 +11=10 +12=10 +13=10 +14=10 +15=10 +16=10 +17=10 +18=10 +19=10 +20=10 +21=10 +22=10 +23=10 +24=10 +25=10 +26=10 +27=10 +28=10 +29=10 +30=10 +31=10 +32=7 +33=12 +34=7 +35=12 +36=13 +37=10 +38=11 +39=13 +40=7 +41=12 +42=11 +43=9 +44=11 +45=8 +46=13 +47=11 +48=10 +49=11 +50=7 +51=7 +52=7 +53=7 +54=9 +55=7 +56=7 +57=9 +58=9 +59=7 +60=8 +61=7 +62=12 +63=8 +64=13 +65=17 +66=17 +67=12 +68=17 +69=10 +70=12 +71=15 +72=12 +73=13 +74=11 +75=13 +76=11 +77=7 +78=7 +79=13 +80=13 +81=13 +82=13 +83=19 +84=19 +85=13 +86=19 +87=14 +88=13 +89=12 +90=17 +91=12 +92=17 +93=16 +94=9 +95=15 +96=7 +97=13 +98=13 +99=11 +100=13 +101=5 +102=9 +103=11 +104=9 +105=13 +106=10 +107=13 +108=10 +109=7 +110=7 +111=13 +112=11 +113=11 +114=11 +115=15 +116=15 +117=11 +118=15 +119=14 +120=7 +121=11 +122=15 +123=11 +124=15 +125=12 +126=6 +127=7 diff --git a/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua b/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua index 7713dc01c6..ef507f8fc4 100644 --- a/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua +++ b/Themes/HelloWorld/Graphics/ScreenGuideMain header.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,120;diffuse,color("#EEF4FFCC")); - }; - Def.ActorFrame{ - InitCommand=cmd(y,16); - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenGuideMain","Header"); - InitCommand=cmd(x,-312;y,-50;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); - }; - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-32;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); - }; - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenGuideMain","Explanation"); - InitCommand=cmd(x,-312;y,-24;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)*1.45); - }; - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(zoomto,SCREEN_WIDTH,120;diffuse,color("#EEF4FFCC")); + }; + Def.ActorFrame{ + InitCommand=cmd(y,16); + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenGuideMain","Header"); + InitCommand=cmd(x,-312;y,-50;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); + }; + Def.Quad{ + InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-32;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); + }; + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenGuideMain","Explanation"); + InitCommand=cmd(x,-312;y,-24;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)*1.45); + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua b/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua index 9fcef3ff79..8004ca637a 100644 --- a/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenGuideMain scroll.lua @@ -1,40 +1,40 @@ -local gc = Var("GameCommand") -local itemName = gc:GetName() - -local t = Def.ActorFrame{ - -- focused frame - LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0); - }; - -- unfocused - LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - }; - - LoadActor( THEME:GetPathG("_section", "Guide") )..{ - InitCommand=cmd(x,-250;y,-24;Real;halign,0); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0.9); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.45); - }; - - Def.ActorFrame{ - LoadFont("_frutiger roman 24px")..{ - Name="SectionName"; - Text=THEME:GetString("ScreenGuideMain",itemName); - InitCommand=cmd(x,-250;y,-6;halign,0;diffuse,color("#222222FF")); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); - }; - LoadFont("_frutiger roman 24px")..{ - Name="SectionDesc"; - Text=THEME:GetString("ScreenGuideMain",itemName.."Desc"); - InitCommand=cmd(x,-248;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); - }; - }; -}; - +local gc = Var("GameCommand") +local itemName = gc:GetName() + +local t = Def.ActorFrame{ + -- focused frame + LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0); + }; + -- unfocused + LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + }; + + LoadActor( THEME:GetPathG("_section", "Guide") )..{ + InitCommand=cmd(x,-250;y,-24;Real;halign,0); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0.9); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.45); + }; + + Def.ActorFrame{ + LoadFont("_frutiger roman 24px")..{ + Name="SectionName"; + Text=THEME:GetString("ScreenGuideMain",itemName); + InitCommand=cmd(x,-250;y,-6;halign,0;diffuse,color("#222222FF")); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); + }; + LoadFont("_frutiger roman 24px")..{ + Name="SectionDesc"; + Text=THEME:GetString("ScreenGuideMain",itemName.."Desc"); + InitCommand=cmd(x,-248;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua b/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua index 9d1ecd1068..de33fdbea6 100644 --- a/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua +++ b/Themes/HelloWorld/Graphics/ScreenReferenceMain header.lua @@ -1,23 +1,23 @@ -local t = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,96;diffuse,color("#EEF4FFCC")); - }; - Def.ActorFrame{ - InitCommand=cmd(y,12); - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenReferenceMain","Header"); - InitCommand=cmd(x,-312;y,-34;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); - }; - Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-20;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); - }; - LoadFont("_frutiger roman 24px")..{ - Name="Header"; - Text=THEME:GetString("ScreenReferenceMain","Explanation"); - InitCommand=cmd(x,-312;y,-14;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)*1.45); - }; - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(zoomto,SCREEN_WIDTH,96;diffuse,color("#EEF4FFCC")); + }; + Def.ActorFrame{ + InitCommand=cmd(y,12); + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenReferenceMain","Header"); + InitCommand=cmd(x,-312;y,-34;halign,0;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44")); + }; + Def.Quad{ + InitCommand=cmd(zoomto,SCREEN_WIDTH*0.975,2;y,-20;diffuse,color("#111111FF");diffusetopedge,color("#11111188");shadowlength,-1;shadowcolor,color("#FFFFFF44");fadeleft,0.1;faderight,0.625); + }; + LoadFont("_frutiger roman 24px")..{ + Name="Header"; + Text=THEME:GetString("ScreenReferenceMain","Explanation"); + InitCommand=cmd(x,-312;y,-14;align,0,0;diffuse,color("#111111FF");zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH)*1.45); + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua b/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua index 9da67b9f01..dad4bbb0e0 100644 --- a/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenReferenceMain scroll.lua @@ -1,40 +1,40 @@ -local gc = Var("GameCommand") -local itemName = gc:GetName() - -local t = Def.ActorFrame{ - -- focused frame - LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0); - }; - -- unfocused - LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - }; - - LoadActor( THEME:GetPathG("_section", "Reference") )..{ - InitCommand=cmd(x,-250;y,-24;Real;halign,0); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0.9); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.45); - }; - - Def.ActorFrame{ - LoadFont("_frutiger roman 24px")..{ - Name="SectionName"; - Text=THEME:GetString("ScreenReferenceMain",itemName); - InitCommand=cmd(x,-250;y,-6;halign,0;diffuse,color("#222222FF")); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); - }; - LoadFont("_frutiger roman 24px")..{ - Name="SectionDesc"; - Text=THEME:GetString("ScreenReferenceMain",itemName.."Desc"); - InitCommand=cmd(x,-248;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); - GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); - }; - }; -}; - +local gc = Var("GameCommand") +local itemName = gc:GetName() + +local t = Def.ActorFrame{ + -- focused frame + LoadActor( THEME:GetPathG("SectionMenu","ItemFocused") )..{ + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0); + }; + -- unfocused + LoadActor( THEME:GetPathG("SectionMenu","ItemUnfocused") )..{ + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + }; + + LoadActor( THEME:GetPathG("_section", "Reference") )..{ + InitCommand=cmd(x,-250;y,-24;Real;halign,0); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,0.9); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.45); + }; + + Def.ActorFrame{ + LoadFont("_frutiger roman 24px")..{ + Name="SectionName"; + Text=THEME:GetString("ScreenReferenceMain",itemName); + InitCommand=cmd(x,-250;y,-6;halign,0;diffuse,color("#222222FF")); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); + }; + LoadFont("_frutiger roman 24px")..{ + Name="SectionDesc"; + Text=THEME:GetString("ScreenReferenceMain",itemName.."Desc"); + InitCommand=cmd(x,-248;y,10;align,0,0;diffuse,color("#222222FF");zoom,0.5); + GainFocusCommand=cmd(decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,0.5); + }; + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua b/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua index bff37dd9e8..5ce9182dfa 100644 --- a/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/HelloWorld/Graphics/ScreenTitleMenu scroll.lua @@ -1,35 +1,35 @@ --- This file is used to define how the items should look on ScreenTitleMenu. --- The syntax is different because I took this code from moonlight. :) - ---[[ -Concepts used: -* THEME:GetString(screen,string) -* zoom -* shadowlength -* diffuse -* halign (0 = left, 0.5 = middle, 1 = right) -* strokecolor -* stoptweening -* accelerate ---]] - --- this is used as a shorthand for GameCommand. -local gc = Var("GameCommand") - -local t = Def.ActorFrame{ - LoadFont( "_frutiger roman" ) ..{ - -- This line tries to find a corresponding line in the current language - -- ini file; If it doesn't, (and you haven't disabled error messages,) - -- then an error will pop up telling you where you need to add the - -- string. - Text=THEME:GetString( 'ScreenTitleMenu', gc:GetText() ); - InitCommand=cmd(zoom,0.85;y,-1;shadowlength,0;diffuse,color("#000000");halign,1;strokecolor,color("0,0,0,0");); - DisabledCommand=cmd( diffuse,color("0.45,0,0,1") ); - GainFocusCommand=cmd(stoptweening;accelerate,0.15;diffuse,color("#000000");strokecolor,color("0.85,0.9,1,0.75");); - LoseFocusCommand=cmd(stoptweening;accelerate,0.2;diffuse,color("#888888");strokecolor,color("0,0,0,0");); - OffFocusedCommand=cmd(sleep,1;decelerate,1;addx,-32;diffuse,color("#FF0000");); - OffUnfocusedCommand=cmd(sleep,0.2*gc:GetIndex();linear,0.5;addx,SCREEN_CENTER_X;); - }; -}; - +-- This file is used to define how the items should look on ScreenTitleMenu. +-- The syntax is different because I took this code from moonlight. :) + +--[[ +Concepts used: +* THEME:GetString(screen,string) +* zoom +* shadowlength +* diffuse +* halign (0 = left, 0.5 = middle, 1 = right) +* strokecolor +* stoptweening +* accelerate +--]] + +-- this is used as a shorthand for GameCommand. +local gc = Var("GameCommand") + +local t = Def.ActorFrame{ + LoadFont( "_frutiger roman" ) ..{ + -- This line tries to find a corresponding line in the current language + -- ini file; If it doesn't, (and you haven't disabled error messages,) + -- then an error will pop up telling you where you need to add the + -- string. + Text=THEME:GetString( 'ScreenTitleMenu', gc:GetText() ); + InitCommand=cmd(zoom,0.85;y,-1;shadowlength,0;diffuse,color("#000000");halign,1;strokecolor,color("0,0,0,0");); + DisabledCommand=cmd( diffuse,color("0.45,0,0,1") ); + GainFocusCommand=cmd(stoptweening;accelerate,0.15;diffuse,color("#000000");strokecolor,color("0.85,0.9,1,0.75");); + LoseFocusCommand=cmd(stoptweening;accelerate,0.2;diffuse,color("#888888");strokecolor,color("0,0,0,0");); + OffFocusedCommand=cmd(sleep,1;decelerate,1;addx,-32;diffuse,color("#FF0000");); + OffUnfocusedCommand=cmd(sleep,0.2*gc:GetIndex();linear,0.5;addx,SCREEN_CENTER_X;); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Graphics/ScreenWithMenuElements header.lua b/Themes/HelloWorld/Graphics/ScreenWithMenuElements header.lua index 71b91300bd..1791089a8e 100644 --- a/Themes/HelloWorld/Graphics/ScreenWithMenuElements header.lua +++ b/Themes/HelloWorld/Graphics/ScreenWithMenuElements header.lua @@ -1,4 +1,4 @@ --- temporary -local t = Def.ActorFrame{}; - +-- temporary +local t = Def.ActorFrame{}; + return t; \ No newline at end of file diff --git a/Themes/HelloWorld/Languages/en.ini b/Themes/HelloWorld/Languages/en.ini index 6bce89dec7..e565cf168a 100644 --- a/Themes/HelloWorld/Languages/en.ini +++ b/Themes/HelloWorld/Languages/en.ini @@ -1,43 +1,43 @@ -[Common] -WindowTitle=Hello World (and other sm-ssc theming examples) - -[ScreenTitleMenu] -Guide=Guide -Reference=Reference -Tutorial=Tutorials - -[ScreenGuideMain] -Header=Guide -Explanation=The Guide section is meant for beginners who may not know the ins and outs of the StepMania theming system. It is also useful for themers coming from earlier versions of StepMania, as some things have changed in sm-ssc. - -Metrics=Metrics -MetricsDesc=Metrics and Languages (since they're similar). -Fonts=Fonts -FontsDesc=Dealing with fonts. -Graphics=Graphics -GraphicsDesc=The Graphics folder and what goes in there. -BGAnims=BGAnimations -BGAnimsDesc=Bee Gees animations -Sounds=Sounds -SoundsDesc=Music and sound effects. -Scripts=Scripts -ScriptsDesc=Lua scripting. -Other=Other -OtherDesc=Things like PreferredSort and ScreenHowToPlay/ScreenGameplaySyncMachine steps. -NoteSkins=NoteSkins -NoteSkinsDesc=NoteSkin creation involves knowing the theming system, somewhat. -Announcers=Announcers -AnnouncersDesc=The lost art of announcers, and how to “properly” make one. -Characters=Characters -CharactersDesc=Three-dimensional characters dancing in Gameplay. Modeling skills not included. - -[ScreenReferenceMain] -Header=Reference -Explanation=This section contains reference material. It is meant for themers who already somewhat know what they are looking for. - -Screens=Screens -ScreensDesc=A reference of all of sm-ssc's available screens. -Managers=Managers and Singletons -ManagersDesc=Various things that end in "Manager" (and sometimes not). -Classes=Classes +[Common] +WindowTitle=Hello World (and other sm-ssc theming examples) + +[ScreenTitleMenu] +Guide=Guide +Reference=Reference +Tutorial=Tutorials + +[ScreenGuideMain] +Header=Guide +Explanation=The Guide section is meant for beginners who may not know the ins and outs of the StepMania theming system. It is also useful for themers coming from earlier versions of StepMania, as some things have changed in sm-ssc. + +Metrics=Metrics +MetricsDesc=Metrics and Languages (since they're similar). +Fonts=Fonts +FontsDesc=Dealing with fonts. +Graphics=Graphics +GraphicsDesc=The Graphics folder and what goes in there. +BGAnims=BGAnimations +BGAnimsDesc=Bee Gees animations +Sounds=Sounds +SoundsDesc=Music and sound effects. +Scripts=Scripts +ScriptsDesc=Lua scripting. +Other=Other +OtherDesc=Things like PreferredSort and ScreenHowToPlay/ScreenGameplaySyncMachine steps. +NoteSkins=NoteSkins +NoteSkinsDesc=NoteSkin creation involves knowing the theming system, somewhat. +Announcers=Announcers +AnnouncersDesc=The lost art of announcers, and how to “properly” make one. +Characters=Characters +CharactersDesc=Three-dimensional characters dancing in Gameplay. Modeling skills not included. + +[ScreenReferenceMain] +Header=Reference +Explanation=This section contains reference material. It is meant for themers who already somewhat know what they are looking for. + +Screens=Screens +ScreensDesc=A reference of all of sm-ssc's available screens. +Managers=Managers and Singletons +ManagersDesc=Various things that end in "Manager" (and sometimes not). +Classes=Classes ClassesDesc=The classes that make up some of your favorite elements. \ No newline at end of file diff --git a/Themes/HelloWorld/ThemeInfo.ini b/Themes/HelloWorld/ThemeInfo.ini index 0948fe30e1..0fad04977f 100644 --- a/Themes/HelloWorld/ThemeInfo.ini +++ b/Themes/HelloWorld/ThemeInfo.ini @@ -1,6 +1,6 @@ -# [en] ThemeInfo is used to set the theme's name (as it appears in the options -# menu), as well as the author (which shows up on ScreenInit, assuming you use it -# in your theme). -[ThemeInfo] -DisplayName=Hello World +# [en] ThemeInfo is used to set the theme's name (as it appears in the options +# menu), as well as the author (which shows up on ScreenInit, assuming you use it +# in your theme). +[ThemeInfo] +DisplayName=Hello World Author=Various Contributors \ No newline at end of file diff --git a/Themes/HelloWorld/metrics.ini b/Themes/HelloWorld/metrics.ini index 1101c2730f..ec6aa6bf85 100644 --- a/Themes/HelloWorld/metrics.ini +++ b/Themes/HelloWorld/metrics.ini @@ -1,281 +1,281 @@ -# Hello World -# (and other sm-ssc theming examples) -# A theme by various contributors. Sign your comments if you wish. - -# contributors: -# AJ Kelly of the Spinal Shark Collective (http://ssc.ajworld.net/) - -################################################################################ -# -[Common] -# InitialScreen defines the starting screen of the theme. -# It can either be a string or a Lua function that returns a string. -InitialScreen="ScreenTitleMenu" - -################################################################################ -# [base] Base Screens aren't concrete, but are referenced by concrete screens. - -# Pretty much every screen derives from this one. Adding decorations to it is -# one of the first things a themer does. -[ScreenWithMenuElements] -ShowHeader=true -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP+24 -HeaderOnCommand=draworder,100 - -ShowFooter=false -FooterX=SCREEN_CENTER_X -FooterY=SCREEN_BOTTOM-24 -FooterOnCommand=draworder,100 - -ShowCreditDisplay=false - -################################################################################ -# [overlay] Overlay screens sit on top of everything. - -################################################################################ -# [core] Core Screens; these are the concrete implementations. - -# ScreenTitleMenu is the first screen you see in this theme, thanks to the -# [Common] InitialScreen metric being changed. -[ScreenTitleMenu] -# PrevScreen is set to make sure nothing gets messed up. -PrevScreen="ScreenTitleMenu" -# These settings are used to disable the attract sequence: -IdleTimeoutSeconds=-1 -IdleTimeoutScreen="ScreenTitleMenu" - -# no header or footer here -ShowHeader=false -ShowFooter=false - -# These settings define what options appear on the menu and what commands are -# run when they are selected: -ChoiceNames="1,2,3,4,5" -Choice1="text,Guide;screen,ScreenGuideMain" -Choice2="text,Reference;screen,ScreenReferenceMain" -Choice3="text,Tutorial;" -Choice4="text,Options;screen,ScreenOptionsService;" -Choice5="text,Exit;screen,ScreenExit;" - -# These control the placement of the items, as well as the list: -ScrollerX=SCREEN_RIGHT-44 -ScrollerY=SCREEN_CENTER_Y+32 -ScrollerOnCommand=addx,SCREEN_CENTER_X;decelerate,0.8;addx,-SCREEN_CENTER_X -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(27*offset) end - -[ScreenOptionsService] -# dummying out ScreenInit -NextScreen="ScreenTitleMenu" -PrevScreen="ScreenTitleMenu" -################################################################################ -# [guide] The guide splits the elements of StepMania theming into different sections. -# It acts as an introduction to all of the concepts in modern StepMania theming. -# All guide pages aside from ScreenGuideMain MUST be prefixed with "Guide" in -# order to differentiate them from the core screens. -[ScreenGuideMain] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -PrevScreen="ScreenTitleMenu" -AllowRepeatingInput=true - -# modifying header position -HeaderY=SCREEN_TOP+72 - -ChoiceNames="Metrics,Fonts,Graphics,BGAnims,Sounds,Scripts,Other,NoteSkins,Announcers,Characters" -ChoiceMetrics="name,Metrics" -ChoiceFonts="name,Fonts" -ChoiceGraphics="name,Graphics" -ChoiceBGAnims="name,BGAnims" -ChoiceSounds="name,Sounds" -ChoiceScripts="name,Scripts" -ChoiceOther="name,Other" -ChoiceNoteSkins="name,NoteSkins" -ChoiceAnnouncers="name,Announcers" -ChoiceCharacters="name,Characters" -DefaultChoice="Metrics" - -ShowScroller=true -LoopScroller=false -PerChoiceScrollElement=false - -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y*0.775 -ScrollerNumItemsToDraw=10 -ScrollerSecondsPerItem=0.1 -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((itemIndex-(numItems/2))+offset*64) end - -# guide base screen (sets up things I don't want to retype a lot -aj) # -[GuideBase] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" - -## Metrics -[GuideMetrics] -Fallback="GuideBase" - -## Fonts -[GuideFonts] -Fallback="GuideBase" - -## Graphics -[GuideGraphics] -Fallback="GuideBase" - -## BGAnimations -[GuideBGA] -Fallback="GuideBase" -### Decorations (simpler) -### Overlay/Underlay (can be more complex) - -## Sounds -[GuideSounds] -Fallback="GuideBase" - -## Scripts -[GuideScripts] -Fallback="GuideBase" - -## the Other folder -[GuideOther] -Fallback="GuideBase" -### HowToPlay steps -### PreferredSort - -# And then there are the things that are related to theming: -## NoteSkins -[GuideNoteSkins] -Fallback="GuideBase" - -## Announcers -[GuideAnnouncers] -Fallback="GuideBase" - -## Characters -[GuideCharacters] -Fallback="GuideBase" - -################################################################################ -# [ref] The reference section contains a complete listing of commands and examples of how they work. # -# All reference pages aside from ScreenReferenceMain MUST be prefixed with "Reference" -# in order to differentiate them from the core screens. -[ScreenReferenceMain] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -PrevScreen="ScreenTitleMenu" -AllowRepeatingInput=true - -# modifying header position -HeaderY=SCREEN_TOP+72 - -ChoiceNames="Screens,Managers,Classes" -ChoiceScreens="name,Screens" -ChoiceManagers="name,Managers" -ChoiceClasses="name,Classes" -DefaultChoice="Screens" - -ShowScroller=true -LoopScroller=false -PerChoiceScrollElement=false - -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y+32 -ScrollerNumItemsToDraw=10 -ScrollerSecondsPerItem=0.1 -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((itemIndex-(numItems/2))*64) end - -# reference base screen (sets up things I don't want to retype a lot -aj) # -[ReferenceBase] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" - -## Screens -[ReferenceScreens] -Fallback="ReferenceBase" - -## Managers and other Singletons -[ReferenceManagers] -Fallback="ReferenceBase" - -#@# STEPMANIA ROBOT MASTERS -### ANNOUNCER [man] -[ReferenceAnnouncerMan] - -### CHARMAN -[ReferenceCharMan] - -### FILEMAN -[ReferenceFileMan] - -### GAMEMAN -[ReferenceGameMan] - -### GAMESOUNDMAN -[ReferenceGameSoundMan] - -### GAMESTATE -[ReferenceGameState] - -### MEMCARDMAN -[ReferenceMemCardMan] - -### MESSAGEMAN -[ReferenceMessageMan] - -### NOTESKIN [man] -[ReferenceNoteskinMan] - -### PREFSMAN -[ReferencePrefsMan] - -### PROFILEMAN -[ReferenceProfileMan] - -### SCREENMAN -[ReferenceScreenMan] - -### SONGMAN -[ReferenceSongMan] - -### STATSMAN -[ReferenceStatsMan] - -### THEME [man] -[ReferenceThemeMan] - -### UNLOCKMAN -[ReferenceUnlockMan] - -## Classes -[ReferenceClasses] -Fallback="ReferenceBase" - -### Actor -[ReferenceActor] -#### many sub-things - -### ActorFrame -[ReferenceActorFrame] - -### Banner -[ReferenceBanner] - -### Song -[ReferenceSong] - -### Steps -[ReferenceSteps] - -### Course -[ReferenceCourse] - -### Trail -[ReferenceTrail] - -### and a ton of missing stuff - -################################################################################ -# [tutor] Tutorials are guides to implementing specific things # -[ScreenTutorialMain] - +# Hello World +# (and other sm-ssc theming examples) +# A theme by various contributors. Sign your comments if you wish. + +# contributors: +# AJ Kelly of the Spinal Shark Collective (http://ssc.ajworld.net/) + +################################################################################ +# +[Common] +# InitialScreen defines the starting screen of the theme. +# It can either be a string or a Lua function that returns a string. +InitialScreen="ScreenTitleMenu" + +################################################################################ +# [base] Base Screens aren't concrete, but are referenced by concrete screens. + +# Pretty much every screen derives from this one. Adding decorations to it is +# one of the first things a themer does. +[ScreenWithMenuElements] +ShowHeader=true +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP+24 +HeaderOnCommand=draworder,100 + +ShowFooter=false +FooterX=SCREEN_CENTER_X +FooterY=SCREEN_BOTTOM-24 +FooterOnCommand=draworder,100 + +ShowCreditDisplay=false + +################################################################################ +# [overlay] Overlay screens sit on top of everything. + +################################################################################ +# [core] Core Screens; these are the concrete implementations. + +# ScreenTitleMenu is the first screen you see in this theme, thanks to the +# [Common] InitialScreen metric being changed. +[ScreenTitleMenu] +# PrevScreen is set to make sure nothing gets messed up. +PrevScreen="ScreenTitleMenu" +# These settings are used to disable the attract sequence: +IdleTimeoutSeconds=-1 +IdleTimeoutScreen="ScreenTitleMenu" + +# no header or footer here +ShowHeader=false +ShowFooter=false + +# These settings define what options appear on the menu and what commands are +# run when they are selected: +ChoiceNames="1,2,3,4,5" +Choice1="text,Guide;screen,ScreenGuideMain" +Choice2="text,Reference;screen,ScreenReferenceMain" +Choice3="text,Tutorial;" +Choice4="text,Options;screen,ScreenOptionsService;" +Choice5="text,Exit;screen,ScreenExit;" + +# These control the placement of the items, as well as the list: +ScrollerX=SCREEN_RIGHT-44 +ScrollerY=SCREEN_CENTER_Y+32 +ScrollerOnCommand=addx,SCREEN_CENTER_X;decelerate,0.8;addx,-SCREEN_CENTER_X +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(27*offset) end + +[ScreenOptionsService] +# dummying out ScreenInit +NextScreen="ScreenTitleMenu" +PrevScreen="ScreenTitleMenu" +################################################################################ +# [guide] The guide splits the elements of StepMania theming into different sections. +# It acts as an introduction to all of the concepts in modern StepMania theming. +# All guide pages aside from ScreenGuideMain MUST be prefixed with "Guide" in +# order to differentiate them from the core screens. +[ScreenGuideMain] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +PrevScreen="ScreenTitleMenu" +AllowRepeatingInput=true + +# modifying header position +HeaderY=SCREEN_TOP+72 + +ChoiceNames="Metrics,Fonts,Graphics,BGAnims,Sounds,Scripts,Other,NoteSkins,Announcers,Characters" +ChoiceMetrics="name,Metrics" +ChoiceFonts="name,Fonts" +ChoiceGraphics="name,Graphics" +ChoiceBGAnims="name,BGAnims" +ChoiceSounds="name,Sounds" +ChoiceScripts="name,Scripts" +ChoiceOther="name,Other" +ChoiceNoteSkins="name,NoteSkins" +ChoiceAnnouncers="name,Announcers" +ChoiceCharacters="name,Characters" +DefaultChoice="Metrics" + +ShowScroller=true +LoopScroller=false +PerChoiceScrollElement=false + +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y*0.775 +ScrollerNumItemsToDraw=10 +ScrollerSecondsPerItem=0.1 +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((itemIndex-(numItems/2))+offset*64) end + +# guide base screen (sets up things I don't want to retype a lot -aj) # +[GuideBase] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" + +## Metrics +[GuideMetrics] +Fallback="GuideBase" + +## Fonts +[GuideFonts] +Fallback="GuideBase" + +## Graphics +[GuideGraphics] +Fallback="GuideBase" + +## BGAnimations +[GuideBGA] +Fallback="GuideBase" +### Decorations (simpler) +### Overlay/Underlay (can be more complex) + +## Sounds +[GuideSounds] +Fallback="GuideBase" + +## Scripts +[GuideScripts] +Fallback="GuideBase" + +## the Other folder +[GuideOther] +Fallback="GuideBase" +### HowToPlay steps +### PreferredSort + +# And then there are the things that are related to theming: +## NoteSkins +[GuideNoteSkins] +Fallback="GuideBase" + +## Announcers +[GuideAnnouncers] +Fallback="GuideBase" + +## Characters +[GuideCharacters] +Fallback="GuideBase" + +################################################################################ +# [ref] The reference section contains a complete listing of commands and examples of how they work. # +# All reference pages aside from ScreenReferenceMain MUST be prefixed with "Reference" +# in order to differentiate them from the core screens. +[ScreenReferenceMain] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +PrevScreen="ScreenTitleMenu" +AllowRepeatingInput=true + +# modifying header position +HeaderY=SCREEN_TOP+72 + +ChoiceNames="Screens,Managers,Classes" +ChoiceScreens="name,Screens" +ChoiceManagers="name,Managers" +ChoiceClasses="name,Classes" +DefaultChoice="Screens" + +ShowScroller=true +LoopScroller=false +PerChoiceScrollElement=false + +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y+32 +ScrollerNumItemsToDraw=10 +ScrollerSecondsPerItem=0.1 +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((itemIndex-(numItems/2))*64) end + +# reference base screen (sets up things I don't want to retype a lot -aj) # +[ReferenceBase] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" + +## Screens +[ReferenceScreens] +Fallback="ReferenceBase" + +## Managers and other Singletons +[ReferenceManagers] +Fallback="ReferenceBase" + +#@# STEPMANIA ROBOT MASTERS +### ANNOUNCER [man] +[ReferenceAnnouncerMan] + +### CHARMAN +[ReferenceCharMan] + +### FILEMAN +[ReferenceFileMan] + +### GAMEMAN +[ReferenceGameMan] + +### GAMESOUNDMAN +[ReferenceGameSoundMan] + +### GAMESTATE +[ReferenceGameState] + +### MEMCARDMAN +[ReferenceMemCardMan] + +### MESSAGEMAN +[ReferenceMessageMan] + +### NOTESKIN [man] +[ReferenceNoteskinMan] + +### PREFSMAN +[ReferencePrefsMan] + +### PROFILEMAN +[ReferenceProfileMan] + +### SCREENMAN +[ReferenceScreenMan] + +### SONGMAN +[ReferenceSongMan] + +### STATSMAN +[ReferenceStatsMan] + +### THEME [man] +[ReferenceThemeMan] + +### UNLOCKMAN +[ReferenceUnlockMan] + +## Classes +[ReferenceClasses] +Fallback="ReferenceBase" + +### Actor +[ReferenceActor] +#### many sub-things + +### ActorFrame +[ReferenceActorFrame] + +### Banner +[ReferenceBanner] + +### Song +[ReferenceSong] + +### Steps +[ReferenceSteps] + +### Course +[ReferenceCourse] + +### Trail +[ReferenceTrail] + +### and a ton of missing stuff + +################################################################################ +# [tutor] Tutorials are guides to implementing specific things # +[ScreenTutorialMain] + # todo: figure out what tutorials \ No newline at end of file diff --git a/Themes/HelloWorld/readme.txt b/Themes/HelloWorld/readme.txt index c72d71d7b8..f2cd7eca99 100644 --- a/Themes/HelloWorld/readme.txt +++ b/Themes/HelloWorld/readme.txt @@ -1,49 +1,49 @@ -Hello World -and other sm-ssc theming examples --------------------------------------- -A theme by various contributors. --------------------------------------- - -This theme and its accompanying documentation are licensed under -the Creative Commons Attribution-Share Alike 3.0 license. - -The license text can be viewed at: -http://creativecommons.org/licenses/by-sa/3.0/us/ - -================================================================================ -Table of Contents - Introduction [intro] - Chapter List [chapt] - Guide [guide] - Metrics [g_met] - Fonts [g_fon] - Graphics [g_gfx] - BGAnims [g_bga] - Sounds [g_sfx] - Scripts [g_scr] - Other [g_oth] - NoteSkins [g_not] - Announcers [g_ann] - Characters [g_cha] - Reference [ref] - Screens [r_scr] - Managers [r_man] - Classes [r_cls] - Tutorials [tutor] -[others tba] - -================================================================================ -Introduction [intro] - -Hello, and welcome to Hello World (and other sm-ssc theming examples). -This theme and accompanying documentation are provided for people new to -theming for StepMania, using sm-ssc as a base. - -================================================================================ -The Chapters [chapt] - -The theme itself is split into three sections, encompassing various elements of -sm-ssc theming. - -The Guide is a general run-through of how Themes are constructed (along with +Hello World +and other sm-ssc theming examples +-------------------------------------- +A theme by various contributors. +-------------------------------------- + +This theme and its accompanying documentation are licensed under +the Creative Commons Attribution-Share Alike 3.0 license. + +The license text can be viewed at: +http://creativecommons.org/licenses/by-sa/3.0/us/ + +================================================================================ +Table of Contents + Introduction [intro] + Chapter List [chapt] + Guide [guide] + Metrics [g_met] + Fonts [g_fon] + Graphics [g_gfx] + BGAnims [g_bga] + Sounds [g_sfx] + Scripts [g_scr] + Other [g_oth] + NoteSkins [g_not] + Announcers [g_ann] + Characters [g_cha] + Reference [ref] + Screens [r_scr] + Managers [r_man] + Classes [r_cls] + Tutorials [tutor] +[others tba] + +================================================================================ +Introduction [intro] + +Hello, and welcome to Hello World (and other sm-ssc theming examples). +This theme and accompanying documentation are provided for people new to +theming for StepMania, using sm-ssc as a base. + +================================================================================ +The Chapters [chapt] + +The theme itself is split into three sections, encompassing various elements of +sm-ssc theming. + +The Guide is a general run-through of how Themes are constructed (along with NoteSkins, Announcers, and Characters) \ No newline at end of file diff --git a/Themes/MouseTest/BGAnimations/ScreenTitleMenu background.lua b/Themes/MouseTest/BGAnimations/ScreenTitleMenu background.lua index 4b9b2013c3..0b3a21e72a 100644 --- a/Themes/MouseTest/BGAnimations/ScreenTitleMenu background.lua +++ b/Themes/MouseTest/BGAnimations/ScreenTitleMenu background.lua @@ -1,3 +1,3 @@ -return Def.Quad{ - InitCommand=cmd(Center;FullScreen;diffuse,HSV(192,1,0.8);diffusebottomedge,HSV(192,0.625,0.25)); +return Def.Quad{ + InitCommand=cmd(Center;FullScreen;diffuse,HSV(192,1,0.8);diffusebottomedge,HSV(192,0.625,0.25)); }; \ No newline at end of file diff --git a/Themes/MouseTest/BGAnimations/ScreenTitleMenu overlay.lua b/Themes/MouseTest/BGAnimations/ScreenTitleMenu overlay.lua index 919f13545d..dedd03adcb 100644 --- a/Themes/MouseTest/BGAnimations/ScreenTitleMenu overlay.lua +++ b/Themes/MouseTest/BGAnimations/ScreenTitleMenu overlay.lua @@ -1,51 +1,51 @@ -local t = Def.ActorFrame{ - LoadActor(THEME:GetPathG("_click","target"))..{ - InitCommand=cmd(diffusealpha,0;Real); - LeftClickMessageCommand=function(self) - MESSAGEMAN:Broadcast("MouseInput", { Input = "Left" }); - end; - RightClickMessageCommand=function(self) - MESSAGEMAN:Broadcast("MouseInput", { Input = "Right" }); - end; - MiddleClickMessageCommand=function(self) - MESSAGEMAN:Broadcast("MouseInput", { Input = "Middle" }); - end; - MouseWheelUpMessageCommand=function(self) - MESSAGEMAN:Broadcast("MouseInput", { Input = "WheelUp" }); - end; - MouseWheelDownMessageCommand=function(self) - MESSAGEMAN:Broadcast("MouseInput", { Input = "WheelDown" }); - end; - MouseInputMessageCommand=function(self,param) - local cX = INPUTFILTER:GetMouseX() - local cY = INPUTFILTER:GetMouseY() - if param.Input == "Left" then - self:stoptweening() - self:x(cX) - self:y(cY) - self:diffusealpha(1) - self:sleep(1) - self:diffusealpha(0) - end - end - }; - LoadFont("common normal")..{ - Name="Coords"; - InitCommand=cmd(shadowlength,1;zoom,0.5;align,0,1); - MouseInputMessageCommand=function(self,param) - local cX = INPUTFILTER:GetMouseX() - local cY = INPUTFILTER:GetMouseY() - if param.Input == "Left" then - self:stoptweening() - self:x(cX + 8) - self:y(cY + 16) - self:settext("(".. string.format("%i",cX) ..",".. string.format("%i",cY) ..")") - self:diffusealpha(1) - self:sleep(1) - self:diffusealpha(0) - end - end - }; -}; - +local t = Def.ActorFrame{ + LoadActor(THEME:GetPathG("_click","target"))..{ + InitCommand=cmd(diffusealpha,0;Real); + LeftClickMessageCommand=function(self) + MESSAGEMAN:Broadcast("MouseInput", { Input = "Left" }); + end; + RightClickMessageCommand=function(self) + MESSAGEMAN:Broadcast("MouseInput", { Input = "Right" }); + end; + MiddleClickMessageCommand=function(self) + MESSAGEMAN:Broadcast("MouseInput", { Input = "Middle" }); + end; + MouseWheelUpMessageCommand=function(self) + MESSAGEMAN:Broadcast("MouseInput", { Input = "WheelUp" }); + end; + MouseWheelDownMessageCommand=function(self) + MESSAGEMAN:Broadcast("MouseInput", { Input = "WheelDown" }); + end; + MouseInputMessageCommand=function(self,param) + local cX = INPUTFILTER:GetMouseX() + local cY = INPUTFILTER:GetMouseY() + if param.Input == "Left" then + self:stoptweening() + self:x(cX) + self:y(cY) + self:diffusealpha(1) + self:sleep(1) + self:diffusealpha(0) + end + end + }; + LoadFont("common normal")..{ + Name="Coords"; + InitCommand=cmd(shadowlength,1;zoom,0.5;align,0,1); + MouseInputMessageCommand=function(self,param) + local cX = INPUTFILTER:GetMouseX() + local cY = INPUTFILTER:GetMouseY() + if param.Input == "Left" then + self:stoptweening() + self:x(cX + 8) + self:y(cY + 16) + self:settext("(".. string.format("%i",cX) ..",".. string.format("%i",cY) ..")") + self:diffusealpha(1) + self:sleep(1) + self:diffusealpha(0) + end + end + }; +}; + return t; \ No newline at end of file diff --git a/Themes/MouseTest/BGAnimations/ScreenTitleMenu underlay.lua b/Themes/MouseTest/BGAnimations/ScreenTitleMenu underlay.lua index f78dd28efc..d11b41a28f 100644 --- a/Themes/MouseTest/BGAnimations/ScreenTitleMenu underlay.lua +++ b/Themes/MouseTest/BGAnimations/ScreenTitleMenu underlay.lua @@ -1,32 +1,32 @@ -local t = Def.ActorFrame{}; - -local mou = Def.ActorFrame{ - LoadFont("common normal")..{ - Name="Coords"; - InitCommand=cmd(align,0,0;x,SCREEN_LEFT+8;y,SCREEN_BOTTOM-48); - }; -}; -local function UpdateMouse(self) - local coords = self:GetChild("Coords") - local mouseX = INPUTFILTER:GetMouseX() - local mouseY = INPUTFILTER:GetMouseY() - local text = "[Mouse] X: ".. mouseX .." Y: ".. mouseY; - coords:settext(text) -end -mou.InitCommand=cmd(SetUpdateFunction,UpdateMouse); -t[#t+1] = mou; - -t[#t+1] = Def.ActorFrame{ - LoadFont("Common normal")..{ - Name="Title"; - Text=THEME:GetString("MouseTest","Title"); - InitCommand=cmd(CenterX;y,SCREEN_TOP+28;diffuse,color("#333333")); - }; - LoadFont("Common normal")..{ - Name="Instructions"; - Text=THEME:GetString("MouseTest","Instructions"); - InitCommand=cmd(x,SCREEN_LEFT+12;align,0,0;y,SCREEN_TOP+42;diffuse,color("#333333");zoom,16/24;wrapwidthpixels,SCREEN_WIDTH*1.5); - }; -}; - +local t = Def.ActorFrame{}; + +local mou = Def.ActorFrame{ + LoadFont("common normal")..{ + Name="Coords"; + InitCommand=cmd(align,0,0;x,SCREEN_LEFT+8;y,SCREEN_BOTTOM-48); + }; +}; +local function UpdateMouse(self) + local coords = self:GetChild("Coords") + local mouseX = INPUTFILTER:GetMouseX() + local mouseY = INPUTFILTER:GetMouseY() + local text = "[Mouse] X: ".. mouseX .." Y: ".. mouseY; + coords:settext(text) +end +mou.InitCommand=cmd(SetUpdateFunction,UpdateMouse); +t[#t+1] = mou; + +t[#t+1] = Def.ActorFrame{ + LoadFont("Common normal")..{ + Name="Title"; + Text=THEME:GetString("MouseTest","Title"); + InitCommand=cmd(CenterX;y,SCREEN_TOP+28;diffuse,color("#333333")); + }; + LoadFont("Common normal")..{ + Name="Instructions"; + Text=THEME:GetString("MouseTest","Instructions"); + InitCommand=cmd(x,SCREEN_LEFT+12;align,0,0;y,SCREEN_TOP+42;diffuse,color("#333333");zoom,16/24;wrapwidthpixels,SCREEN_WIDTH*1.5); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/MouseTest/Graphics/ScreenTitleMenu scroll.lua b/Themes/MouseTest/Graphics/ScreenTitleMenu scroll.lua index 36fe28ff45..d11925aa82 100644 --- a/Themes/MouseTest/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/MouseTest/Graphics/ScreenTitleMenu scroll.lua @@ -1,43 +1,43 @@ -local gc = Var("GameCommand"); -local index = gc:GetIndex(); -local name = gc:GetName(); -local text = gc:GetText(); - -local itemColors = { - HSV(128, 0.6, 0.85), -- play - HSV(192, 0.6, 0.85), -- options - HSV(160, 0.6, 0.85), -- customization - HSV( 64, 0.6, 0.85), -- edit - HSV( 0, 0.6, 0.85), -- exit -}; - -local t = Def.ActorFrame{ - --[[ - Def.Actor{ - Name="TitleMenuController"; - GainFocusCommand=function(self) - MESSAGEMAN:Broadcast("TitleChange",{NewColor=itemColors[index+1]}); - end; - }; - ]] - LoadFont("Common Normal")..{ - Text=Screen.String(text); - InitCommand=cmd(diffuse,color("1,1,1,1")); - DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,0.85")); - --GainFocusCommand=cmd(stoptweening;linear,0.25;diffuse,itemColors[index+1]); - GainFocusCommand=cmd(stoptweening;linear,0.25;diffuse,color("1,0.2,0.2,1")); - LoseFocusCommand=cmd(stoptweening;linear,0.25;diffuse,color("1,1,1,1")); - }; - --[[ begin triangle ]] - Def.Quad{ - InitCommand=cmd(x,-SCREEN_WIDTH*0.105;zoomto,8,24;zwrite,true;blend,'BlendMode_NoEffect'); - }; - Def.Quad{ - InitCommand=cmd(x,-SCREEN_WIDTH*0.1;zoomto,12,12;rotationz,45;diffuselowerleft,color("0,0,0,0");ztest,true); - GainFocusCommand=cmd(stoptweening;visible,true); - LoseFocusCommand=cmd(stoptweening;visible,false); - }; - --[[ end triangle ]] -}; - +local gc = Var("GameCommand"); +local index = gc:GetIndex(); +local name = gc:GetName(); +local text = gc:GetText(); + +local itemColors = { + HSV(128, 0.6, 0.85), -- play + HSV(192, 0.6, 0.85), -- options + HSV(160, 0.6, 0.85), -- customization + HSV( 64, 0.6, 0.85), -- edit + HSV( 0, 0.6, 0.85), -- exit +}; + +local t = Def.ActorFrame{ + --[[ + Def.Actor{ + Name="TitleMenuController"; + GainFocusCommand=function(self) + MESSAGEMAN:Broadcast("TitleChange",{NewColor=itemColors[index+1]}); + end; + }; + ]] + LoadFont("Common Normal")..{ + Text=Screen.String(text); + InitCommand=cmd(diffuse,color("1,1,1,1")); + DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,0.85")); + --GainFocusCommand=cmd(stoptweening;linear,0.25;diffuse,itemColors[index+1]); + GainFocusCommand=cmd(stoptweening;linear,0.25;diffuse,color("1,0.2,0.2,1")); + LoseFocusCommand=cmd(stoptweening;linear,0.25;diffuse,color("1,1,1,1")); + }; + --[[ begin triangle ]] + Def.Quad{ + InitCommand=cmd(x,-SCREEN_WIDTH*0.105;zoomto,8,24;zwrite,true;blend,'BlendMode_NoEffect'); + }; + Def.Quad{ + InitCommand=cmd(x,-SCREEN_WIDTH*0.1;zoomto,12,12;rotationz,45;diffuselowerleft,color("0,0,0,0");ztest,true); + GainFocusCommand=cmd(stoptweening;visible,true); + LoseFocusCommand=cmd(stoptweening;visible,false); + }; + --[[ end triangle ]] +}; + return t; \ No newline at end of file diff --git a/Themes/MouseTest/Languages/en.ini b/Themes/MouseTest/Languages/en.ini index 69659b79b7..fe85b19cfa 100644 --- a/Themes/MouseTest/Languages/en.ini +++ b/Themes/MouseTest/Languages/en.ini @@ -1,6 +1,6 @@ -[Common] -WindowTitle=sm-ssc Mouse Test - -[MouseTest] -Title=sm-ssc Mouse Test +[Common] +WindowTitle=sm-ssc Mouse Test + +[MouseTest] +Title=sm-ssc Mouse Test Instructions=Move around with the mouse. You'll see some coordinates in the bottom right, and when you click, a target appears. \ No newline at end of file diff --git a/Themes/MouseTest/ThemeInfo.ini b/Themes/MouseTest/ThemeInfo.ini index a44e86304e..7e0b6bf6ce 100644 --- a/Themes/MouseTest/ThemeInfo.ini +++ b/Themes/MouseTest/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=sm-ssc Mouse Test +[ThemeInfo] +DisplayName=sm-ssc Mouse Test Author=sm-ssc Developers \ No newline at end of file diff --git a/Themes/MouseTest/metrics.ini b/Themes/MouseTest/metrics.ini index 1a707786b5..79b6aec790 100644 --- a/Themes/MouseTest/metrics.ini +++ b/Themes/MouseTest/metrics.ini @@ -1,15 +1,15 @@ -# sm-ssc Mouse Test theme -[Common] -InitialScreen="ScreenTitleMenu" - -[ScreenTitleMenu] -IdleTimeoutSeconds=-1 -IdleTimeoutScreen="ScreenTitleMenu" - -ChoiceNames="1,2" -Choice1="screen,ScreenOptionsService;text,Options" -Choice2="screen,ScreenExit;text,Exit" - -[ScreenOptionsService] -PrevScreen="ScreenTitleMenu" +# sm-ssc Mouse Test theme +[Common] +InitialScreen="ScreenTitleMenu" + +[ScreenTitleMenu] +IdleTimeoutSeconds=-1 +IdleTimeoutScreen="ScreenTitleMenu" + +ChoiceNames="1,2" +Choice1="screen,ScreenOptionsService;text,Options" +Choice2="screen,ScreenExit;text,Exit" + +[ScreenOptionsService] +PrevScreen="ScreenTitleMenu" NextScreen="ScreenTitleMenu" \ No newline at end of file diff --git a/Themes/_Installer/Languages/de.ini b/Themes/_Installer/Languages/de.ini index b90b896197..ba0f89ac54 100644 --- a/Themes/_Installer/Languages/de.ini +++ b/Themes/_Installer/Languages/de.ini @@ -1,36 +1,36 @@ -[Installer Sections] -TEXT_IO_CHECK_FOR_UPDATES=Updates zu berprfen -TEXT_IO_RUN=${PRODUCT_DISPLAY} -TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) -TEXT_IO_OPEN_PROGRAM_FOLDER=${PRODUCT_ID} Programmordner ffnen -TEXT_IO_MANUAL=${PRODUCT_ID} Dokumentation -TEXT_IO_TOOLS=${PRODUCT_ID} Werkzeug -TEXT_IO_WEB_SITE=${PRODUCT_ID} Webseite -TEXT_IO_UNINSTALL=Deinstallation von ${PRODUCT_DISPLAY} -TEXT_IO_VIEW_STATISTICS=Statistiken anschauen -TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Nur entfernen) -TEXT_IO_SMZIP_PACKAGE=SMZIP Paket -TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. -TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. -TEXT_IO_LAUNCH_THE_GAME=Spiel starten - -[Installer Functions] -TEXT_IO_TITLE=${PRODUCT_DISPLAY} -TEXT_IO_SUBTITLE= -TEXT_IO_INSTALL=Installieren -TEXT_IO_PLAY=Spielen -TEXT_IO_REINSTALL=Noch mal installieren - -[Leave Autorun] -TEXT_IO_COULD_NOT_EXECUTE=Konnte $INSTDIR\Program\${PRODUCT_FAMILY}.exe nicht ausfhren - -[PreInstall] -TEXT_IO_UNINSTALL_PREVIOUS=Die letzte Version von ${PRODUCT_ID} muss deinstalliert werden, bevor Sie weiter machen.\nWollen Sie fortfahren? -TEXT_IO_DIRECTX_VISIT_MICROSOFT=Die letzte Version von DirectX (8.1 oder hher) ist dringend zu empfehlen.\nWollen Sie die Webseite von Microsoft jetzt besuchen? -TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Deinstallation fehlgeschlagen. Trotzdem installieren? -TEXT_IO_INSTALL_DIRECTX=Die letzte Version von DirectX (8.1 oder hher) ist dringend zu empfehlen.\nWollen Sie es jetzt installieren? -TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} scheint nicht installiert zu sein.\nWollen Sie fortfahren? - -[Uninstall] -TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. - +[Installer Sections] +TEXT_IO_CHECK_FOR_UPDATES=Updates zu berprfen +TEXT_IO_RUN=${PRODUCT_DISPLAY} +TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) +TEXT_IO_OPEN_PROGRAM_FOLDER=${PRODUCT_ID} Programmordner ffnen +TEXT_IO_MANUAL=${PRODUCT_ID} Dokumentation +TEXT_IO_TOOLS=${PRODUCT_ID} Werkzeug +TEXT_IO_WEB_SITE=${PRODUCT_ID} Webseite +TEXT_IO_UNINSTALL=Deinstallation von ${PRODUCT_DISPLAY} +TEXT_IO_VIEW_STATISTICS=Statistiken anschauen +TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Nur entfernen) +TEXT_IO_SMZIP_PACKAGE=SMZIP Paket +TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. +TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. +TEXT_IO_LAUNCH_THE_GAME=Spiel starten + +[Installer Functions] +TEXT_IO_TITLE=${PRODUCT_DISPLAY} +TEXT_IO_SUBTITLE= +TEXT_IO_INSTALL=Installieren +TEXT_IO_PLAY=Spielen +TEXT_IO_REINSTALL=Noch mal installieren + +[Leave Autorun] +TEXT_IO_COULD_NOT_EXECUTE=Konnte $INSTDIR\Program\${PRODUCT_FAMILY}.exe nicht ausfhren + +[PreInstall] +TEXT_IO_UNINSTALL_PREVIOUS=Die letzte Version von ${PRODUCT_ID} muss deinstalliert werden, bevor Sie weiter machen.\nWollen Sie fortfahren? +TEXT_IO_DIRECTX_VISIT_MICROSOFT=Die letzte Version von DirectX (8.1 oder hher) ist dringend zu empfehlen.\nWollen Sie die Webseite von Microsoft jetzt besuchen? +TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Deinstallation fehlgeschlagen. Trotzdem installieren? +TEXT_IO_INSTALL_DIRECTX=Die letzte Version von DirectX (8.1 oder hher) ist dringend zu empfehlen.\nWollen Sie es jetzt installieren? +TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} scheint nicht installiert zu sein.\nWollen Sie fortfahren? + +[Uninstall] +TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. + diff --git a/Themes/_Installer/Languages/en.ini b/Themes/_Installer/Languages/en.ini index 89cb6df564..e0a3818c58 100644 --- a/Themes/_Installer/Languages/en.ini +++ b/Themes/_Installer/Languages/en.ini @@ -1,37 +1,37 @@ -[Installer Sections] -TEXT_IO_CHECK_FOR_UPDATES=Check for Updates -TEXT_IO_RUN=${PRODUCT_DISPLAY} -TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) -TEXT_IO_OPEN_PROGRAM_FOLDER=Open ${PRODUCT_ID} Program Folder -TEXT_IO_OPEN_SETTINGS_FOLDER=Open ${PRODUCT_ID} Settings Folder -TEXT_IO_MANUAL=${PRODUCT_ID} Manual -TEXT_IO_TOOLS=${PRODUCT_ID} Tools -TEXT_IO_WEB_SITE=${PRODUCT_ID} Web Site -TEXT_IO_UNINSTALL=Uninstall ${PRODUCT_DISPLAY} -TEXT_IO_VIEW_STATISTICS=View Statistics -TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (remove only) -TEXT_IO_SMZIP_PACKAGE=SMZIP package -TEXT_IO_FATAL_ERROR_COPYING_PCK =Fatal error copying pck files. -TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. -TEXT_IO_LAUNCH_THE_GAME=Launch StepMania -TEXT_IO_TEXTURE_FONT_GENERATOR=Texture Font Generator - -[Installer Functions] -TEXT_IO_TITLE=${PRODUCT_DISPLAY} -TEXT_IO_SUBTITLE= -TEXT_IO_INSTALL=Install -TEXT_IO_PLAY=Play -TEXT_IO_REINSTALL=Reinstall - -[Leave Autorun] -TEXT_IO_COULD_NOT_EXECUTE=Could not execute $INSTDIR\Program\${PRODUCT_FAMILY}.exe - -[PreInstall] -TEXT_IO_UNINSTALL_PREVIOUS=The previous version of ${PRODUCT_ID} must be uninstalled before continuing.\nDo you wish to continue? -TEXT_IO_DIRECTX_VISIT_MICROSOFT=The latest version of DirectX (8.1 or higher) is strongly recommended.\nDo you wish to visit Microsoft's site now? -TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Uninstallation failed. Install anyway? -TEXT_IO_INSTALL_DIRECTX=The latest version of DirectX (8.1 or higher) is required.\nDo you wish to install DirectX 8.1 now? -TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} does not appear to be installed.\nDo you wish to continue? - -[Uninstall] -TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. +[Installer Sections] +TEXT_IO_CHECK_FOR_UPDATES=Check for Updates +TEXT_IO_RUN=${PRODUCT_DISPLAY} +TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) +TEXT_IO_OPEN_PROGRAM_FOLDER=Open ${PRODUCT_ID} Program Folder +TEXT_IO_OPEN_SETTINGS_FOLDER=Open ${PRODUCT_ID} Settings Folder +TEXT_IO_MANUAL=${PRODUCT_ID} Manual +TEXT_IO_TOOLS=${PRODUCT_ID} Tools +TEXT_IO_WEB_SITE=${PRODUCT_ID} Web Site +TEXT_IO_UNINSTALL=Uninstall ${PRODUCT_DISPLAY} +TEXT_IO_VIEW_STATISTICS=View Statistics +TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (remove only) +TEXT_IO_SMZIP_PACKAGE=SMZIP package +TEXT_IO_FATAL_ERROR_COPYING_PCK =Fatal error copying pck files. +TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. +TEXT_IO_LAUNCH_THE_GAME=Launch StepMania +TEXT_IO_TEXTURE_FONT_GENERATOR=Texture Font Generator + +[Installer Functions] +TEXT_IO_TITLE=${PRODUCT_DISPLAY} +TEXT_IO_SUBTITLE= +TEXT_IO_INSTALL=Install +TEXT_IO_PLAY=Play +TEXT_IO_REINSTALL=Reinstall + +[Leave Autorun] +TEXT_IO_COULD_NOT_EXECUTE=Could not execute $INSTDIR\Program\${PRODUCT_FAMILY}.exe + +[PreInstall] +TEXT_IO_UNINSTALL_PREVIOUS=The previous version of ${PRODUCT_ID} must be uninstalled before continuing.\nDo you wish to continue? +TEXT_IO_DIRECTX_VISIT_MICROSOFT=The latest version of DirectX (8.1 or higher) is strongly recommended.\nDo you wish to visit Microsoft's site now? +TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Uninstallation failed. Install anyway? +TEXT_IO_INSTALL_DIRECTX=The latest version of DirectX (8.1 or higher) is required.\nDo you wish to install DirectX 8.1 now? +TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} does not appear to be installed.\nDo you wish to continue? + +[Uninstall] +TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. diff --git a/Themes/_Installer/Languages/es.ini b/Themes/_Installer/Languages/es.ini index 0363a2f033..8aaf690744 100644 --- a/Themes/_Installer/Languages/es.ini +++ b/Themes/_Installer/Languages/es.ini @@ -1,36 +1,36 @@ -[Installer Sections] -TEXT_IO_CHECK_FOR_UPDATES=Compruebe para actualizaciones -TEXT_IO_RUN=${PRODUCT_DISPLAY} -TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) -TEXT_IO_OPEN_PROGRAM_FOLDER=Abrir la carpeta de programa de ${PRODUCT_ID} -TEXT_IO_MANUAL=${PRODUCT_ID} Documentacion -TEXT_IO_TOOLS=${PRODUCT_ID} Herramientas -TEXT_IO_WEB_SITE=${PRODUCT_ID} Sitio -TEXT_IO_UNINSTALL=Desinstalando ${PRODUCT_DISPLAY} -TEXT_IO_VIEW_STATISTICS=Ver estadisticas -TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Remover solamente) -TEXT_IO_SMZIP_PACKAGE=SMZIP paquete -TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. -TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. -TEXT_IO_LAUNCH_THE_GAME=Lanzar el Juego - -[Installer Functions] -TEXT_IO_TITLE=${PRODUCT_DISPLAY} -TEXT_IO_SUBTITLE= -TEXT_IO_INSTALL=Instalar -TEXT_IO_PLAY=Jugar -TEXT_IO_REINSTALL=Reinstalar - -[Leave Autorun] -TEXT_IO_COULD_NOT_EXECUTE=No se pudo ejecutar $INSTDIR\Program\${PRODUCT_FAMILY}.exe - -[PreInstall] -TEXT_IO_UNINSTALL_PREVIOUS=La version anterior de ${PRODUCT_ID} debe ser desinstalada antes de continuar. Desea continuar? -TEXT_IO_DIRECTX_VISIT_MICROSOFT=La ultima version de DirectX (8.1 o mayor) es fuertemente recomendada. Desea visitar el sitio web de Mircosoft ahora? -TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Fallo desinstalacion. Instalar de todas maneras? -TEXT_IO_INSTALL_DIRECTX=La ultima version de DirectX (8.1 o mayor) es fuertemente recomendada. Desea instalarlo ahora? -TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} no parece hace sido instalado.\nDesea continuar? - -[Uninstall] -TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. - +[Installer Sections] +TEXT_IO_CHECK_FOR_UPDATES=Compruebe para actualizaciones +TEXT_IO_RUN=${PRODUCT_DISPLAY} +TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) +TEXT_IO_OPEN_PROGRAM_FOLDER=Abrir la carpeta de programa de ${PRODUCT_ID} +TEXT_IO_MANUAL=${PRODUCT_ID} Documentacion +TEXT_IO_TOOLS=${PRODUCT_ID} Herramientas +TEXT_IO_WEB_SITE=${PRODUCT_ID} Sitio +TEXT_IO_UNINSTALL=Desinstalando ${PRODUCT_DISPLAY} +TEXT_IO_VIEW_STATISTICS=Ver estadisticas +TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Remover solamente) +TEXT_IO_SMZIP_PACKAGE=SMZIP paquete +TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. +TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. +TEXT_IO_LAUNCH_THE_GAME=Lanzar el Juego + +[Installer Functions] +TEXT_IO_TITLE=${PRODUCT_DISPLAY} +TEXT_IO_SUBTITLE= +TEXT_IO_INSTALL=Instalar +TEXT_IO_PLAY=Jugar +TEXT_IO_REINSTALL=Reinstalar + +[Leave Autorun] +TEXT_IO_COULD_NOT_EXECUTE=No se pudo ejecutar $INSTDIR\Program\${PRODUCT_FAMILY}.exe + +[PreInstall] +TEXT_IO_UNINSTALL_PREVIOUS=La version anterior de ${PRODUCT_ID} debe ser desinstalada antes de continuar. Desea continuar? +TEXT_IO_DIRECTX_VISIT_MICROSOFT=La ultima version de DirectX (8.1 o mayor) es fuertemente recomendada. Desea visitar el sitio web de Mircosoft ahora? +TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Fallo desinstalacion. Instalar de todas maneras? +TEXT_IO_INSTALL_DIRECTX=La ultima version de DirectX (8.1 o mayor) es fuertemente recomendada. Desea instalarlo ahora? +TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} no parece hace sido instalado.\nDesea continuar? + +[Uninstall] +TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. + diff --git a/Themes/_Installer/Languages/fr.ini b/Themes/_Installer/Languages/fr.ini index 5325e804db..56106ff810 100644 --- a/Themes/_Installer/Languages/fr.ini +++ b/Themes/_Installer/Languages/fr.ini @@ -1,36 +1,36 @@ -[Installer Sections] -TEXT_IO_CHECK_FOR_UPDATES=Vrifier les mises jour -TEXT_IO_RUN=${PRODUCT_DISPLAY} -TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) -TEXT_IO_OPEN_PROGRAM_FOLDER=Ouvrir le dossier programme de ${PRODUCT_ID} -TEXT_IO_MANUAL=Documentation de ${PRODUCT_ID} -TEXT_IO_TOOLS=Outils de ${PRODUCT_ID} -TEXT_IO_WEB_SITE=Le site web de ${PRODUCT_ID} -TEXT_IO_UNINSTALL=Dsinstaller ${PRODUCT_DISPLAY} -TEXT_IO_VIEW_STATISTICS=Voir les statistiques -TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Supprimer uniquement) -TEXT_IO_SMZIP_PACKAGE=SMZIP package -TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. -TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. -TEXT_IO_LAUNCH_THE_GAME=Lancer le jeu - -[Installer Functions] -TEXT_IO_TITLE=${PRODUCT_DISPLAY} -TEXT_IO_SUBTITLE= -TEXT_IO_INSTALL=Installer -TEXT_IO_PLAY=Jouer -TEXT_IO_REINSTALL=Rinstaller - -[Leave Autorun] -TEXT_IO_COULD_NOT_EXECUTE=N'a pas pu excuter $INSTDIR\Program\${PRODUCT_FAMILY}.exe - -[PreInstall] -TEXT_IO_UNINSTALL_PREVIOUS=La version prcdente de ${PRODUCT_ID} doit tre dinstalle pour pouvoir continuer. Voulez-vous continuer ? -TEXT_IO_DIRECTX_VISIT_MICROSOFT=La dernire version de DirectX (8.1 ou suprieure) est hautement recommande. Voulez-vous visiter le site de Microsoft maintenant ? -TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Echec de la dinstallation. Voulez-vous tout de mme lancer l'installation ? -TEXT_IO_INSTALL_DIRECTX=La dernire version de DirectX (8.1 ou suprieure) est hautement recommande. Dsirez-vous l'installer maintenant ? -TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} ne semble pas install.\nVoulez-vous continuer? - -[Uninstall] -TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. - +[Installer Sections] +TEXT_IO_CHECK_FOR_UPDATES=Vrifier les mises jour +TEXT_IO_RUN=${PRODUCT_DISPLAY} +TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) +TEXT_IO_OPEN_PROGRAM_FOLDER=Ouvrir le dossier programme de ${PRODUCT_ID} +TEXT_IO_MANUAL=Documentation de ${PRODUCT_ID} +TEXT_IO_TOOLS=Outils de ${PRODUCT_ID} +TEXT_IO_WEB_SITE=Le site web de ${PRODUCT_ID} +TEXT_IO_UNINSTALL=Dsinstaller ${PRODUCT_DISPLAY} +TEXT_IO_VIEW_STATISTICS=Voir les statistiques +TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Supprimer uniquement) +TEXT_IO_SMZIP_PACKAGE=SMZIP package +TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. +TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. +TEXT_IO_LAUNCH_THE_GAME=Lancer le jeu + +[Installer Functions] +TEXT_IO_TITLE=${PRODUCT_DISPLAY} +TEXT_IO_SUBTITLE= +TEXT_IO_INSTALL=Installer +TEXT_IO_PLAY=Jouer +TEXT_IO_REINSTALL=Rinstaller + +[Leave Autorun] +TEXT_IO_COULD_NOT_EXECUTE=N'a pas pu excuter $INSTDIR\Program\${PRODUCT_FAMILY}.exe + +[PreInstall] +TEXT_IO_UNINSTALL_PREVIOUS=La version prcdente de ${PRODUCT_ID} doit tre dinstalle pour pouvoir continuer. Voulez-vous continuer ? +TEXT_IO_DIRECTX_VISIT_MICROSOFT=La dernire version de DirectX (8.1 ou suprieure) est hautement recommande. Voulez-vous visiter le site de Microsoft maintenant ? +TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Echec de la dinstallation. Voulez-vous tout de mme lancer l'installation ? +TEXT_IO_INSTALL_DIRECTX=La dernire version de DirectX (8.1 ou suprieure) est hautement recommande. Dsirez-vous l'installer maintenant ? +TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} ne semble pas install.\nVoulez-vous continuer? + +[Uninstall] +TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. + diff --git a/Themes/_Installer/Languages/it.ini b/Themes/_Installer/Languages/it.ini index 58bcc4219a..a5f80d3f69 100644 --- a/Themes/_Installer/Languages/it.ini +++ b/Themes/_Installer/Languages/it.ini @@ -1,36 +1,36 @@ -[Installer Sections] -TEXT_IO_CHECK_FOR_UPDATES=Per cercare aggiornamenti -TEXT_IO_RUN=${PRODUCT_DISPLAY} -TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) -TEXT_IO_OPEN_PROGRAM_FOLDER=Apri ${PRODUCT_ID} Cartella Programmi -TEXT_IO_MANUAL=${PRODUCT_ID} Documentazione -TEXT_IO_TOOLS=${PRODUCT_ID} Strumenti -TEXT_IO_WEB_SITE=${PRODUCT_ID} Sito Web -TEXT_IO_UNINSTALL=Disinstalla ${PRODUCT_DISPLAY} -TEXT_IO_VIEW_STATISTICS=Mostra Statistiche -TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Elimina soltanto) -TEXT_IO_SMZIP_PACKAGE=SMZIP pacchetto -TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. -TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. -TEXT_IO_LAUNCH_THE_GAME=Lancia gioco - -[Installer Functions] -TEXT_IO_TITLE=${PRODUCT_DISPLAY} -TEXT_IO_SUBTITLE= -TEXT_IO_INSTALL=Installa -TEXT_IO_PLAY=Gioca -TEXT_IO_REINSTALL=Re-installa - -[Leave Autorun] -TEXT_IO_COULD_NOT_EXECUTE=Impossibile eseguire $INSTDIR\Program\${PRODUCT_FAMILY}.exe - -[PreInstall] -TEXT_IO_UNINSTALL_PREVIOUS=Prima di continuare va installata la versione precendente di ${PRODUCT_ID}. Vuoi continuare? -TEXT_IO_DIRECTX_VISIT_MICROSOFT=Si consiglia vivamente di installare la versione pi recente di DirectX (8.1 o superiore). Vuoi visitare il sito Microsoft adesso? -TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Disinstallazione non riuscita. Vuoi installare comunque? -TEXT_IO_INSTALL_DIRECTX=Si consiglia vivamente di installare la versione pi recente di DirectX (8.1 o superiore). Vuoi installarla adesso? -TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} non sembra installato.\nVuoi continuare? - -[Uninstall] -TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. - +[Installer Sections] +TEXT_IO_CHECK_FOR_UPDATES=Per cercare aggiornamenti +TEXT_IO_RUN=${PRODUCT_DISPLAY} +TEXT_IO_RUN_WITHOUT_SSE2=${PRODUCT_DISPLAY} (non-SSE2) +TEXT_IO_OPEN_PROGRAM_FOLDER=Apri ${PRODUCT_ID} Cartella Programmi +TEXT_IO_MANUAL=${PRODUCT_ID} Documentazione +TEXT_IO_TOOLS=${PRODUCT_ID} Strumenti +TEXT_IO_WEB_SITE=${PRODUCT_ID} Sito Web +TEXT_IO_UNINSTALL=Disinstalla ${PRODUCT_DISPLAY} +TEXT_IO_VIEW_STATISTICS=Mostra Statistiche +TEXT_IO_REMOVE_ONLY=${PRODUCT_DISPLAY} (Elimina soltanto) +TEXT_IO_SMZIP_PACKAGE=SMZIP pacchetto +TEXT_IO_FATAL_ERROR_COPYING_PCK=Fatal error copying pck files. +TEXT_IO_FATAL_ERROR_INSTALL=Fatal error during install. +TEXT_IO_LAUNCH_THE_GAME=Lancia gioco + +[Installer Functions] +TEXT_IO_TITLE=${PRODUCT_DISPLAY} +TEXT_IO_SUBTITLE= +TEXT_IO_INSTALL=Installa +TEXT_IO_PLAY=Gioca +TEXT_IO_REINSTALL=Re-installa + +[Leave Autorun] +TEXT_IO_COULD_NOT_EXECUTE=Impossibile eseguire $INSTDIR\Program\${PRODUCT_FAMILY}.exe + +[PreInstall] +TEXT_IO_UNINSTALL_PREVIOUS=Prima di continuare va installata la versione precendente di ${PRODUCT_ID}. Vuoi continuare? +TEXT_IO_DIRECTX_VISIT_MICROSOFT=Si consiglia vivamente di installare la versione pi recente di DirectX (8.1 o superiore). Vuoi visitare il sito Microsoft adesso? +TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY=Disinstallazione non riuscita. Vuoi installare comunque? +TEXT_IO_INSTALL_DIRECTX=Si consiglia vivamente di installare la versione pi recente di DirectX (8.1 o superiore). Vuoi installarla adesso? +TEXT_IO_FULL_INSTALL_NOT_FOUND=${PRODUCT_ID} non sembra installato.\nVuoi continuare? + +[Uninstall] +TEXT_IO_FATAL_ERROR_UNINSTALL=Fatal error during uninstall. + diff --git a/Themes/_Installer/readme.txt b/Themes/_Installer/readme.txt index abb846eae1..59d6d9edaf 100644 --- a/Themes/_Installer/readme.txt +++ b/Themes/_Installer/readme.txt @@ -1,6 +1,6 @@ -The _Installer theme is only used for generating an installer with NSIS -(specifically, the strings used in the installer). Non-source code distributions -(aka public releases) should not contain this folder. - -kthx! :D +The _Installer theme is only used for generating an installer with NSIS +(specifically, the strings used in the installer). Non-source code distributions +(aka public releases) should not contain this folder. + +kthx! :D -aj \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua b/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua index b6a62c9868..c5746656de 100644 --- a/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua @@ -1,15 +1,15 @@ -local t = Def.ActorFrame { - Def.ActorFrame { - InitCommand=cmd(Center); - --[[ ToggleConsoleDisplayMessageCommand=function(self) - bVisible = 1 - bVisible; - bShow = (bVisible >= 1) and true or false; - self:visible(bShow); - end; --]] - Def.Quad { - InitCommand(zoomto,64,64;spin;); - ToggleConsoleDisplayMessageCommand=cmd(zoomto,345,345;visible,true); - }; - }; -}; +local t = Def.ActorFrame { + Def.ActorFrame { + InitCommand=cmd(Center); + --[[ ToggleConsoleDisplayMessageCommand=function(self) + bVisible = 1 - bVisible; + bShow = (bVisible >= 1) and true or false; + self:visible(bShow); + end; --]] + Def.Quad { + InitCommand(zoomto,64,64;spin;); + ToggleConsoleDisplayMessageCommand=cmd(zoomto,345,345;visible,true); + }; + }; +}; return t \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenInit background/default.lua b/Themes/_fallback/BGAnimations/ScreenInit background/default.lua index 170b845c07..b823b61565 100644 --- a/Themes/_fallback/BGAnimations/ScreenInit background/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenInit background/default.lua @@ -1,41 +1,41 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,1");diffusetopedge,color("0.1,0.1,0.1,1")); - }; -}; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH,128); - OnCommand=cmd(diffusealpha,1;sleep,1.5;linear,0.25); - }; - LoadActor("ssc") .. { - OnCommand=cmd(diffusealpha,0;linear,1;diffusealpha,1;sleep,0.75;linear,0.25;diffusealpha,0); - }; - }; - Def.ActorFrame { - OnCommand=cmd(playcommandonchildren,"ChildrenOn"); - ChildrenOnCommand=cmd(diffusealpha,0;sleep,2;linear,0.25;diffusealpha,1); - LoadFont("Common Normal") .. { - Text=ProductID(); - InitCommand=cmd(y,-20;zoom,0.75); - OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); - }; - LoadFont("Common Normal") .. { - Text=THEME:GetThemeDisplayName(); - OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); - }; - LoadFont("Common Normal") .. { - Text="Created by " .. THEME:GetThemeAuthor(); - InitCommand=cmd(y,24;zoom,0.75); - OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); - }; - }; -}; - +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");diffusetopedge,color("0.1,0.1,0.1,1")); + }; +}; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,128); + OnCommand=cmd(diffusealpha,1;sleep,1.5;linear,0.25); + }; + LoadActor("ssc") .. { + OnCommand=cmd(diffusealpha,0;linear,1;diffusealpha,1;sleep,0.75;linear,0.25;diffusealpha,0); + }; + }; + Def.ActorFrame { + OnCommand=cmd(playcommandonchildren,"ChildrenOn"); + ChildrenOnCommand=cmd(diffusealpha,0;sleep,2;linear,0.25;diffusealpha,1); + LoadFont("Common Normal") .. { + Text=ProductID(); + InitCommand=cmd(y,-20;zoom,0.75); + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); + }; + LoadFont("Common Normal") .. { + Text=THEME:GetThemeDisplayName(); + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); + }; + LoadFont("Common Normal") .. { + Text="Created by " .. THEME:GetThemeAuthor(); + InitCommand=cmd(y,24;zoom,0.75); + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); + }; + }; +}; + return t \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua b/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua index 6faa6b7913..5ae80360e3 100644 --- a/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua @@ -1,23 +1,23 @@ -local x = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); - OnCommand=cmd(); - OffCommand=cmd(); - }; - LoadFont("Common Normal")..{ - Text="Loading Profiles..."; ---~ Text=ScreenString("Loading Profiles..."); - InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); - OffCommand=cmd(linear,0.15;diffusealpha,0); - }; -}; - -x[#x+1] = Def.Actor { - BeginCommand=function(self) - if SCREENMAN:GetTopScreen():HaveProfileToLoad() then self:sleep(1); end; - self:queuecommand("Load"); - end; - LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; -}; - +local x = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); + OnCommand=cmd(); + OffCommand=cmd(); + }; + LoadFont("Common Normal")..{ + Text="Loading Profiles..."; +--~ Text=ScreenString("Loading Profiles..."); + InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); + OffCommand=cmd(linear,0.15;diffusealpha,0); + }; +}; + +x[#x+1] = Def.Actor { + BeginCommand=function(self) + if SCREENMAN:GetTopScreen():HaveProfileToLoad() then self:sleep(1); end; + self:queuecommand("Load"); + end; + LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; +}; + return x; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua b/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua index e29e28368b..fd9aee651b 100644 --- a/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua @@ -1,23 +1,23 @@ -local x = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); - OnCommand=cmd(); - OffCommand=cmd(); - }; - LoadFont("Common Normal")..{ - Text="Saving Profiles..."; ---~ Text=ScreenString("Loading Profiles..."); - InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); - OffCommand=cmd(linear,0.15;diffusealpha,0); - }; -}; - -x[#x+1] = Def.Actor { - BeginCommand=function(self) - if SCREENMAN:GetTopScreen():HaveProfileToSave() then self:sleep(1); end; - self:queuecommand("Load"); - end; - LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; -}; - +local x = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); + OnCommand=cmd(); + OffCommand=cmd(); + }; + LoadFont("Common Normal")..{ + Text="Saving Profiles..."; +--~ Text=ScreenString("Loading Profiles..."); + InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); + OffCommand=cmd(linear,0.15;diffusealpha,0); + }; +}; + +x[#x+1] = Def.Actor { + BeginCommand=function(self) + if SCREENMAN:GetTopScreen():HaveProfileToSave() then self:sleep(1); end; + self:queuecommand("Load"); + end; + LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; +}; + return x; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua index 2094ef1054..8355b85580 100644 --- a/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua @@ -1,299 +1,299 @@ -function GetLocalProfiles() - local ret = {}; - - for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do - local profile=PROFILEMAN:GetLocalProfileFromIndex(p); - local item = Def.ActorFrame { ---[[ Def.Quad { - InitCommand=cmd(zoomto,200,1;y,40/2); - OnCommand=cmd(diffuse,Color('Outline');); - }; --]] - LoadFont("Common Normal") .. { - Text=profile:GetDisplayName(); - InitCommand=cmd(shadowlength,1;y,-10;zoom,1;ztest,true); - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(shadowlength,1;y,8;zoom,0.5;vertspacing,-8;ztest,true); - BeginCommand=function(self) - local numSongsPlayed = profile:GetNumTotalSongsPlayed(); - local s = numSongsPlayed == 1 and "Song" or "Songs"; - -- todo: localize - self:settext( numSongsPlayed.." "..s.." Played" ); - end; - }; - }; - table.insert( ret, item ); - end; - - return ret; -end; - -function LoadCard(cColor) - local t = Def.ActorFrame { - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { - InitCommand=cmd(diffuse,cColor); - }; - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); - }; - return t -end -function LoadPlayerStuff(Player) - local ret = {}; - - local pn = (Player == PLAYER_1) and 1 or 2; - ---[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { - Name = 'BigFrame'; - }; --]] - local t = Def.ActorFrame { - Name = 'JoinFrame'; - LoadCard(Color('Orange')); ---[[ Def.Quad { - InitCommand=cmd(zoomto,200+4,230+4); - OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); - }; - Def.Quad { - InitCommand=cmd(zoomto,200,230); - OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); - }; --]] - LoadFont("Common Normal") .. { - Text="Press &START; to join."; - InitCommand=cmd(shadowlength,1); - OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); - }; - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = 'BigFrame'; - LoadCard(PlayerColor(Player)); - }; - table.insert( ret, t ); - ---[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { - Name = 'SmallFrame'; - }; --]] - t = Def.ActorFrame { - Name = 'SmallFrame'; ---[[ Def.Quad { - InitCommand=cmd(zoomto,170+4,32+4); - OnCommand=cmd(shadowlength,1); - }; --]] - InitCommand=cmd(y,-2); - Def.Quad { - InitCommand=cmd(zoomto,200-10,40+2); - OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,40); - OnCommand=cmd(diffuse,PlayerColor(Player);fadeleft,0.25;faderight,0.25;glow,color("1,1,1,0.25")); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,40;y,-40/2+20); - OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,1;y,-40/2+1); - OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); - }; - }; - table.insert( ret, t ); - - t = Def.ActorScroller{ - Name = 'Scroller'; - NumItemsToDraw=6; --- InitCommand=cmd(y,-230/2+20;); - OnCommand=cmd(y,1;SetFastCatchup,true;SetMask,200,58;SetSecondsPerItem,0.15); - TransformFunction=function(self, offset, itemIndex, numItems) - local focus = scale(math.abs(offset),0,2,1,0); - self:visible(false); - self:y(math.floor( offset*40 )); --- self:zoomy( focus ); --- self:z(-math.abs(offset)); --- self:zoom(focus); - end; - children = GetLocalProfiles(); - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = "EffectFrame"; - --[[ Def.Quad { - InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); - }; - Def.Quad { - InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); - }; --]] - }; - table.insert( ret, t ); ---[[ t = Def.BitmapText { - OnCommand = cmd(y,160); - Name = 'SelectedProfileText'; - Font = "Common Normal"; - Text = 'No profile'; - }; --]] - t = LoadFont("Common Normal") .. { - Name = 'SelectedProfileText'; - --InitCommand=cmd(y,160;shadowlength,1;diffuse,PlayerColor(Player)); - InitCommand=cmd(y,160;shadowlength,1;); - }; - table.insert( ret, t ); - - return ret; -end; - -function UpdateInternal3(self, Player) - local pn = (Player == PLAYER_1) and 1 or 2; - local frame = self:GetChild(string.format('P%uFrame', pn)); - local scroller = frame:GetChild('Scroller'); - local seltext = frame:GetChild('SelectedProfileText'); - local joinframe = frame:GetChild('JoinFrame'); - local smallframe = frame:GetChild('SmallFrame'); - local bigframe = frame:GetChild('BigFrame'); - - if GAMESTATE:IsHumanPlayer(Player) then - frame:visible(true); - if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then - --using profile if any - joinframe:visible(false); - smallframe:visible(true); - bigframe:visible(true); - seltext:visible(true); - scroller:visible(true); - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); - if ind > 0 then - scroller:SetDestinationItem(ind-1); - seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); - else - if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then - scroller:SetDestinationItem(0); - self:queuecommand('UpdateInternal2'); - else - joinframe:visible(true); - smallframe:visible(false); - bigframe:visible(false); - scroller:visible(false); - seltext:settext('No profile'); - end; - end; - else - --using card - smallframe:visible(false); - scroller:visible(false); - seltext:settext('CARD'); - SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); - end; - else - joinframe:visible(true); - scroller:visible(false); - seltext:visible(false); - smallframe:visible(false); - bigframe:visible(false); - end; -end; - -local t = Def.ActorFrame { - - StorageDevicesChangedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - CodeMessageCommand = function(self, params) - if params.Name == 'Start' or params.Name == 'Center' then - MESSAGEMAN:Broadcast("StartButton"); - if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); - else - SCREENMAN:GetTopScreen():Finish(); - end; - end; - if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 1 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 0 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Back' then - if GAMESTATE:GetNumPlayersEnabled()==0 then - SCREENMAN:GetTopScreen():Cancel(); - else - MESSAGEMAN:Broadcast("BackButton"); - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); - end; - end; - end; - - PlayerJoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - PlayerUnjoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - OnCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - UpdateInternal2Command=function(self) - UpdateInternal3(self, PLAYER_1); - UpdateInternal3(self, PLAYER_2); - end; - - children = { - Def.ActorFrame { - Name = 'P1Frame'; - InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); - OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); - OffCommand=cmd(bouncebegin,0.35;zoom,0); - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_1 then - (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); - end; - end; - children = LoadPlayerStuff(PLAYER_1); - }; - Def.ActorFrame { - Name = 'P2Frame'; - InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); - OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); - OffCommand=cmd(bouncebegin,0.35;zoom,0); - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_2 then - (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); - end; - end; - children = LoadPlayerStuff(PLAYER_2); - }; - -- sounds - LoadActor( THEME:GetPathS("Common","start") )..{ - StartButtonMessageCommand=cmd(play); - }; - LoadActor( THEME:GetPathS("Common","cancel") )..{ - BackButtonMessageCommand=cmd(play); - }; - LoadActor( THEME:GetPathS("Common","value") )..{ - DirectionButtonMessageCommand=cmd(play); - }; - }; -}; - -return t; +function GetLocalProfiles() + local ret = {}; + + for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do + local profile=PROFILEMAN:GetLocalProfileFromIndex(p); + local item = Def.ActorFrame { +--[[ Def.Quad { + InitCommand=cmd(zoomto,200,1;y,40/2); + OnCommand=cmd(diffuse,Color('Outline');); + }; --]] + LoadFont("Common Normal") .. { + Text=profile:GetDisplayName(); + InitCommand=cmd(shadowlength,1;y,-10;zoom,1;ztest,true); + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(shadowlength,1;y,8;zoom,0.5;vertspacing,-8;ztest,true); + BeginCommand=function(self) + local numSongsPlayed = profile:GetNumTotalSongsPlayed(); + local s = numSongsPlayed == 1 and "Song" or "Songs"; + -- todo: localize + self:settext( numSongsPlayed.." "..s.." Played" ); + end; + }; + }; + table.insert( ret, item ); + end; + + return ret; +end; + +function LoadCard(cColor) + local t = Def.ActorFrame { + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { + InitCommand=cmd(diffuse,cColor); + }; + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); + }; + return t +end +function LoadPlayerStuff(Player) + local ret = {}; + + local pn = (Player == PLAYER_1) and 1 or 2; + +--[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { + Name = 'BigFrame'; + }; --]] + local t = Def.ActorFrame { + Name = 'JoinFrame'; + LoadCard(Color('Orange')); +--[[ Def.Quad { + InitCommand=cmd(zoomto,200+4,230+4); + OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,230); + OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); + }; --]] + LoadFont("Common Normal") .. { + Text="Press &START; to join."; + InitCommand=cmd(shadowlength,1); + OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = 'BigFrame'; + LoadCard(PlayerColor(Player)); + }; + table.insert( ret, t ); + +--[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { + Name = 'SmallFrame'; + }; --]] + t = Def.ActorFrame { + Name = 'SmallFrame'; +--[[ Def.Quad { + InitCommand=cmd(zoomto,170+4,32+4); + OnCommand=cmd(shadowlength,1); + }; --]] + InitCommand=cmd(y,-2); + Def.Quad { + InitCommand=cmd(zoomto,200-10,40+2); + OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,40); + OnCommand=cmd(diffuse,PlayerColor(Player);fadeleft,0.25;faderight,0.25;glow,color("1,1,1,0.25")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,40;y,-40/2+20); + OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,1;y,-40/2+1); + OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorScroller{ + Name = 'Scroller'; + NumItemsToDraw=6; +-- InitCommand=cmd(y,-230/2+20;); + OnCommand=cmd(y,1;SetFastCatchup,true;SetMask,200,58;SetSecondsPerItem,0.15); + TransformFunction=function(self, offset, itemIndex, numItems) + local focus = scale(math.abs(offset),0,2,1,0); + self:visible(false); + self:y(math.floor( offset*40 )); +-- self:zoomy( focus ); +-- self:z(-math.abs(offset)); +-- self:zoom(focus); + end; + children = GetLocalProfiles(); + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = "EffectFrame"; + --[[ Def.Quad { + InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; --]] + }; + table.insert( ret, t ); +--[[ t = Def.BitmapText { + OnCommand = cmd(y,160); + Name = 'SelectedProfileText'; + Font = "Common Normal"; + Text = 'No profile'; + }; --]] + t = LoadFont("Common Normal") .. { + Name = 'SelectedProfileText'; + --InitCommand=cmd(y,160;shadowlength,1;diffuse,PlayerColor(Player)); + InitCommand=cmd(y,160;shadowlength,1;); + }; + table.insert( ret, t ); + + return ret; +end; + +function UpdateInternal3(self, Player) + local pn = (Player == PLAYER_1) and 1 or 2; + local frame = self:GetChild(string.format('P%uFrame', pn)); + local scroller = frame:GetChild('Scroller'); + local seltext = frame:GetChild('SelectedProfileText'); + local joinframe = frame:GetChild('JoinFrame'); + local smallframe = frame:GetChild('SmallFrame'); + local bigframe = frame:GetChild('BigFrame'); + + if GAMESTATE:IsHumanPlayer(Player) then + frame:visible(true); + if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then + --using profile if any + joinframe:visible(false); + smallframe:visible(true); + bigframe:visible(true); + seltext:visible(true); + scroller:visible(true); + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); + if ind > 0 then + scroller:SetDestinationItem(ind-1); + seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); + else + if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then + scroller:SetDestinationItem(0); + self:queuecommand('UpdateInternal2'); + else + joinframe:visible(true); + smallframe:visible(false); + bigframe:visible(false); + scroller:visible(false); + seltext:settext('No profile'); + end; + end; + else + --using card + smallframe:visible(false); + scroller:visible(false); + seltext:settext('CARD'); + SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); + end; + else + joinframe:visible(true); + scroller:visible(false); + seltext:visible(false); + smallframe:visible(false); + bigframe:visible(false); + end; +end; + +local t = Def.ActorFrame { + + StorageDevicesChangedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + CodeMessageCommand = function(self, params) + if params.Name == 'Start' or params.Name == 'Center' then + MESSAGEMAN:Broadcast("StartButton"); + if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); + else + SCREENMAN:GetTopScreen():Finish(); + end; + end; + if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 1 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 0 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Back' then + if GAMESTATE:GetNumPlayersEnabled()==0 then + SCREENMAN:GetTopScreen():Cancel(); + else + MESSAGEMAN:Broadcast("BackButton"); + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); + end; + end; + end; + + PlayerJoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + PlayerUnjoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + OnCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + UpdateInternal2Command=function(self) + UpdateInternal3(self, PLAYER_1); + UpdateInternal3(self, PLAYER_2); + end; + + children = { + Def.ActorFrame { + Name = 'P1Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_1 then + (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_1); + }; + Def.ActorFrame { + Name = 'P2Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_2 then + (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_2); + }; + -- sounds + LoadActor( THEME:GetPathS("Common","start") )..{ + StartButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","cancel") )..{ + BackButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","value") )..{ + DirectionButtonMessageCommand=cmd(play); + }; + }; +}; + +return t; diff --git a/Themes/_fallback/BGAnimations/ScreenSystemLayer aux.lua b/Themes/_fallback/BGAnimations/ScreenSystemLayer aux.lua index 858f45d252..18bd636e50 100644 --- a/Themes/_fallback/BGAnimations/ScreenSystemLayer aux.lua +++ b/Themes/_fallback/BGAnimations/ScreenSystemLayer aux.lua @@ -1,49 +1,49 @@ -local function CreditsText( pn ) - function update(self) - local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); - self:settext(str); - end - - function UpdateVisible(self) - local screen = SCREENMAN:GetTopScreen(); - local bShow = true; - if screen then - local sClass = screen:GetName(); - bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); - end - - self:visible( bShow ); - end - - local text = LoadFont(Var "LoadingScreen","credits") .. { - InitCommand=function(self) - self:name("Credits" .. PlayerNumberToString(pn)) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - UpdateTextCommand=function(self) - local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); - self:settext(str); - end; - UpdateVisibleCommand=function(self) - local screen = SCREENMAN:GetTopScreen(); - local bShow = true; - if screen then - local sClass = screen:GetName(); - bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); - end - - self:visible( bShow ); - end; ---[[ RefreshCreditTextMessageCommand=update; - CoinInsertedMessageCommand=update; - PlayerJoinedMessageCommand=update; - ScreenChangedMessageCommand=UpdateVisible; --]] - }; - return text; -end - -local t = Def.ActorFrame { - CreditsText( PLAYER_1 ); - CreditsText( PLAYER_2 ); -}; +local function CreditsText( pn ) + function update(self) + local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); + self:settext(str); + end + + function UpdateVisible(self) + local screen = SCREENMAN:GetTopScreen(); + local bShow = true; + if screen then + local sClass = screen:GetName(); + bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); + end + + self:visible( bShow ); + end + + local text = LoadFont(Var "LoadingScreen","credits") .. { + InitCommand=function(self) + self:name("Credits" .. PlayerNumberToString(pn)) + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + UpdateTextCommand=function(self) + local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); + self:settext(str); + end; + UpdateVisibleCommand=function(self) + local screen = SCREENMAN:GetTopScreen(); + local bShow = true; + if screen then + local sClass = screen:GetName(); + bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); + end + + self:visible( bShow ); + end; +--[[ RefreshCreditTextMessageCommand=update; + CoinInsertedMessageCommand=update; + PlayerJoinedMessageCommand=update; + ScreenChangedMessageCommand=UpdateVisible; --]] + }; + return text; +end + +local t = Def.ActorFrame { + CreditsText( PLAYER_1 ); + CreditsText( PLAYER_2 ); +}; return t; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua b/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua index 9195d3f157..2dcdf564dd 100644 --- a/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua @@ -1,26 +1,26 @@ -local t = Def.ActorFrame { - Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomtowidth,SCREEN_WIDTH;zoomtoheight,30;horizalign,left;vertalign,top;y,SCREEN_TOP;diffuse,color("0,0,0,0")); - OnCommand=cmd(finishtweening;diffusealpha,0.85;); - OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); - }; - LoadFont("Common","Normal") .. { - Name="Text"; - InitCommand=cmd(maxwidth,750;horizalign,left;vertalign,top;y,SCREEN_TOP+10;x,SCREEN_LEFT+10;shadowlength,1;diffusealpha,0;); - OnCommand=cmd(finishtweening;diffusealpha,1;zoom,0.5); - OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); - }; - SystemMessageMessageCommand = function(self, params) - self:GetChild("Text"):settext( params.Message ); - self:playcommand( "On" ); - if params.NoAnimate then - self:finishtweening(); - end - self:playcommand( "Off" ); - end; - HideSystemMessageMessageCommand = cmd(finishtweening); - }; -}; -t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux")); -return t; +local t = Def.ActorFrame { + Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomtowidth,SCREEN_WIDTH;zoomtoheight,30;horizalign,left;vertalign,top;y,SCREEN_TOP;diffuse,color("0,0,0,0")); + OnCommand=cmd(finishtweening;diffusealpha,0.85;); + OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); + }; + LoadFont("Common","Normal") .. { + Name="Text"; + InitCommand=cmd(maxwidth,750;horizalign,left;vertalign,top;y,SCREEN_TOP+10;x,SCREEN_LEFT+10;shadowlength,1;diffusealpha,0;); + OnCommand=cmd(finishtweening;diffusealpha,1;zoom,0.5); + OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); + }; + SystemMessageMessageCommand = function(self, params) + self:GetChild("Text"):settext( params.Message ); + self:playcommand( "On" ); + if params.NoAnimate then + self:finishtweening(); + end + self:playcommand( "Off" ); + end; + HideSystemMessageMessageCommand = cmd(finishtweening); + }; +}; +t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux")); +return t; diff --git a/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua b/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua index ec45917483..862f42fdb1 100644 --- a/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua @@ -1,14 +1,14 @@ -return Def.ActorFrame { - --Def.ControllerStateDisplay { - -- InitCommand=cmd(LoadGameController, - --}; - Def.DeviceList { - Font="Common normal"; - InitCommand=cmd(x,SCREEN_LEFT+20;y,SCREEN_TOP+80;zoom,0.8;halign,0); - }; - - Def.InputList { - Font="Common normal"; - InitCommand=cmd(x,SCREEN_CENTER_X-250;y,SCREEN_CENTER_Y;zoom,1;halign,0;vertspacing,8); - }; -}; +return Def.ActorFrame { + --Def.ControllerStateDisplay { + -- InitCommand=cmd(LoadGameController, + --}; + Def.DeviceList { + Font="Common normal"; + InitCommand=cmd(x,SCREEN_LEFT+20;y,SCREEN_TOP+80;zoom,0.8;halign,0); + }; + + Def.InputList { + Font="Common normal"; + InitCommand=cmd(x,SCREEN_CENTER_X-250;y,SCREEN_CENTER_Y;zoom,1;halign,0;vertspacing,8); + }; +}; diff --git a/Themes/_fallback/Fonts/Common default.ini b/Themes/_fallback/Fonts/Common default.ini index 17f6bdd1a2..c348d7669d 100644 --- a/Themes/_fallback/Fonts/Common default.ini +++ b/Themes/_fallback/Fonts/Common default.ini @@ -1,14 +1,14 @@ -# Default font. This font is loaded behind every other font. -[main] -0=24 -1=26 - -Top=3 -Bottom=29 - -map default=0 -map invalid=1 - -# Load the default 16-pixel glyphs. They can be overridden by fonts -# later. +# Default font. This font is loaded behind every other font. +[main] +0=24 +1=26 + +Top=3 +Bottom=29 + +map default=0 +map invalid=1 + +# Load the default 16-pixel glyphs. They can be overridden by fonts +# later. import=_16px fonts,_japanese 24px,_korean 24px,_misc 16px,_game chars 16px \ No newline at end of file diff --git a/Themes/_fallback/Fonts/_16px fonts.ini b/Themes/_fallback/Fonts/_16px fonts.ini index 79f5845f2f..d56c851b17 100644 --- a/Themes/_fallback/Fonts/_16px fonts.ini +++ b/Themes/_fallback/Fonts/_16px fonts.ini @@ -1,8 +1,8 @@ -# _16px fonts is a "virtual font" that assembles various fonts into a unified -# place. _16px fonts in particular is imported in Common default.ini. - -# Also, themes can create new fonts, and overload this file to -# have them pulled in for every 16-pixel font. -# xxx: we don't have 16px japanese or korean fonts -[main] -import=_Thai 16px,_misc 16px,_game chars 16px +# _16px fonts is a "virtual font" that assembles various fonts into a unified +# place. _16px fonts in particular is imported in Common default.ini. + +# Also, themes can create new fonts, and overload this file to +# have them pulled in for every 16-pixel font. +# xxx: we don't have 16px japanese or korean fonts +[main] +import=_Thai 16px,_misc 16px,_game chars 16px diff --git a/Themes/_fallback/Fonts/_20px fonts.ini b/Themes/_fallback/Fonts/_20px fonts.ini index 80a5bc177b..915647249d 100644 --- a/Themes/_fallback/Fonts/_20px fonts.ini +++ b/Themes/_fallback/Fonts/_20px fonts.ini @@ -1,13 +1,13 @@ -# This "font" just pulls in default characters for a 20-pixel -# font. Other import fonts can be created for other sizes. - -# Also, themes can create new fonts, and overload this file to -# have them pulled in for every 20-pixel font. -[main] -# We don't have a 20px Japanese font, so use the 24px one instead; -# pulling in a Kanji font that's a little too big looks fine, but -# pulling in one that's a little too small looks bad. - -# The characters in _game chars 16px are actually very large; -# they'll look fine here, too. -import=_japanese 24px,_korean 24px,_game chars 16px,_misc 16px +# This "font" just pulls in default characters for a 20-pixel +# font. Other import fonts can be created for other sizes. + +# Also, themes can create new fonts, and overload this file to +# have them pulled in for every 20-pixel font. +[main] +# We don't have a 20px Japanese font, so use the 24px one instead; +# pulling in a Kanji font that's a little too big looks fine, but +# pulling in one that's a little too small looks bad. + +# The characters in _game chars 16px are actually very large; +# they'll look fine here, too. +import=_japanese 24px,_korean 24px,_game chars 16px,_misc 16px diff --git a/Themes/_fallback/Fonts/_Thai 16px.ini b/Themes/_fallback/Fonts/_Thai 16px.ini index 57780b6132..6d0d5fb4ba 100644 --- a/Themes/_fallback/Fonts/_Thai 16px.ini +++ b/Themes/_fallback/Fonts/_Thai 16px.ini @@ -1,39 +1,39 @@ -[common] -Top=8 -Baseline=36 -LineSpacing=36 -DefaultWidth=12 -DrawExtraPixelsLeft=128 -DrawExtraPixelsRight=128 -CapitalsOnly=1 - -[PhayanChana] -line 0= กขฃคฅฆงจฉชซฌญฎฏ -line 1=ฐฑฒณดตถทธนบปผฝพฟ -line 2=ภมยรฤลฦวศษสหฬอฮ -line 3=๐๑๒๓๔๕๖๗๘๙๚๛ - -[Sara1] -line 0= ะาำฯ๚๛฿ -line 1=เแโใไๅๆ๏ - -[Sara2] -0=5 -1=0 -2=0 -3=0 -4=0 -5=0 -6=0 -7=0 -8=0 -9=0 -10=0 -11=0 -12=0 -13=0 -14=0 -15=0 - -line 0= ัิีึืุู +[common] +Top=8 +Baseline=36 +LineSpacing=36 +DefaultWidth=12 +DrawExtraPixelsLeft=128 +DrawExtraPixelsRight=128 +CapitalsOnly=1 + +[PhayanChana] +line 0= กขฃคฅฆงจฉชซฌญฎฏ +line 1=ฐฑฒณดตถทธนบปผฝพฟ +line 2=ภมยรฤลฦวศษสหฬอฮ +line 3=๐๑๒๓๔๕๖๗๘๙๚๛ + +[Sara1] +line 0= ะาำฯ๚๛฿ +line 1=เแโใไๅๆ๏ + +[Sara2] +0=5 +1=0 +2=0 +3=0 +4=0 +5=0 +6=0 +7=0 +8=0 +9=0 +10=0 +11=0 +12=0 +13=0 +14=0 +15=0 + +line 0= ัิีึืุู line 1=็่้๊๋์ํ๎ \ No newline at end of file diff --git a/Themes/_fallback/Fonts/_game chars 16px.ini b/Themes/_fallback/Fonts/_game chars 16px.ini index 351b7e141a..0f203edf1c 100644 --- a/Themes/_fallback/Fonts/_game chars 16px.ini +++ b/Themes/_fallback/Fonts/_game chars 16px.ini @@ -1,37 +1,37 @@ -# The characters in this font are actually much larger than 16 pixels. -# The "16px" indicates what size uppercase letter this font is meant -# for, not necessarily the actual size of the characters. - -[main] -0=32 -1=32 -2=32 -3=32 -4=32 -5=32 -6=32 -7=32 -8=32 -9=32 -10=32 -11=32 - - -# Don't load this font grayscale. -TextureHints=32bpp - -Top=8 -Baseline=24 - -map up=0 -map down=1 -map left=2 -map right=3 -map menuup=0 -map menudown=1 -map menuleft=2 -map menuright=3 -map start=4 -map select=5 -map back=6 +# The characters in this font are actually much larger than 16 pixels. +# The "16px" indicates what size uppercase letter this font is meant +# for, not necessarily the actual size of the characters. + +[main] +0=32 +1=32 +2=32 +3=32 +4=32 +5=32 +6=32 +7=32 +8=32 +9=32 +10=32 +11=32 + + +# Don't load this font grayscale. +TextureHints=32bpp + +Top=8 +Baseline=24 + +map up=0 +map down=1 +map left=2 +map right=3 +map menuup=0 +map menudown=1 +map menuleft=2 +map menuright=3 +map start=4 +map select=5 +map back=6 map auxwhite=7 \ No newline at end of file diff --git a/Themes/_fallback/Fonts/_japanese 24px.ini b/Themes/_fallback/Fonts/_japanese 24px.ini index f7fb2211a6..36bb0ad6aa 100644 --- a/Themes/_fallback/Fonts/_japanese 24px.ini +++ b/Themes/_fallback/Fonts/_japanese 24px.ini @@ -1,7585 +1,7585 @@ -[common] -Baseline=26 -Top=10 -LineSpacing=33 -DrawExtraPixelsLeft=3 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 - -[main] -import=_game chars 16px -range basic-japanese=0 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=9 -34=9 -35=9 -36=9 -37=9 -38=9 -39=9 -40=9 -41=9 -42=9 -43=9 -44=9 -45=9 -46=9 -47=9 -48=9 -49=9 -50=9 -51=24 -52=24 -53=24 -54=24 -55=9 -56=9 -57=9 -58=9 -59=9 -60=9 -61=9 -62=9 -63=9 -64=9 -65=24 -66=24 -67=24 -68=24 -69=24 -70=24 -71=24 -72=24 -73=24 -74=24 -75=24 -76=24 -77=24 -78=24 -79=24 -80=24 -81=24 -82=24 -83=24 -84=24 -85=24 -86=24 -87=24 -88=24 -89=24 -90=24 -91=24 -92=24 -93=24 -94=24 -95=24 -96=24 -97=24 -98=24 -99=24 -100=24 -101=24 -102=24 -103=24 -104=24 -105=24 -106=24 -107=24 -108=24 -109=24 -110=24 -111=24 -112=24 -113=24 -114=24 -115=24 -116=24 -117=24 -118=24 -119=24 -120=24 -121=24 -122=24 -123=24 -124=24 -125=24 -126=24 -127=24 -128=24 -129=24 -130=24 -131=24 -132=24 -133=24 -134=24 -135=24 -136=24 -137=24 -138=24 -139=24 -140=24 -141=24 -142=24 -143=24 -144=24 -145=24 -146=24 -147=24 -148=24 -149=24 -150=24 -151=9 -152=9 -153=0 -154=0 -155=0 -156=0 -157=24 -158=24 -159=24 -160=9 -161=24 -162=24 -163=24 -164=24 -165=24 -166=24 -167=24 -168=24 -169=24 -170=24 -171=24 -172=24 -173=24 -174=24 -175=24 -176=24 -177=24 -178=24 -179=24 -180=24 -181=24 -182=24 -183=24 -184=24 -185=24 -186=24 -187=24 -188=24 -189=24 -190=24 -191=24 -192=24 -193=24 -194=24 -195=24 -196=24 -197=24 -198=24 -199=24 -200=24 -201=24 -202=24 -203=24 -204=24 -205=24 -206=24 -207=24 -208=24 -209=24 -210=24 -211=24 -212=24 -213=24 -214=24 -215=24 -216=24 -217=24 -218=24 -219=24 -220=24 -221=24 -222=24 -223=24 -224=24 -225=24 -226=24 -227=24 -228=24 -229=24 -230=24 -231=24 -232=24 -233=24 -234=24 -235=24 -236=24 -237=24 -238=24 -239=24 -240=24 -241=24 -242=24 -243=24 -244=24 -245=24 -246=24 -247=24 -248=24 -249=24 -250=24 -251=24 -252=24 -253=24 -254=24 -255=9 - -[kanji 1] -Line 0=難易定変更押画曲 -Line 1=現在選択項目同設 -Line 2=開閉内覧表示詳細 -Line 3=及作矢印場警告可 -Line 4=能性処理速数値超 -Line 5=効使特固省略出詞 -Line 6=操全演奏進点機移 -Line 7=左右変更以外背景 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 2] -Line 0=義背景危険状態習 -Line 1=譜判減少率適増加 -Line 2=無終了関係参考他 -Line 3=言変換評価条件突 -Line 4=事追不切常除次等 -Line 5=低戻厳残基途非制 -Line 6=限配保存秒反応専 -Line 7=誤防整央隠僕援起 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 3] -Line 0=相撲屋何穴名例匂 -Line 1=心揺鼻当腹鳴痢便 -Line 2=尻拭鋼雫暗黒迷路 -Line 3=探検前員浮駐接続 -Line 4=類士諸君品物困声 -Line 5=口調食党結婚身久 -Line 6=友電話廃休酒飲引 -Line 7=篭奴学職手葉宿馬 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 4] -Line 0=京宿浪暮横巣鴨優 -Line 1=居思手線回続分然 -Line 2=取達聴最字辞書独 -Line 3=季節俺正対街町渋 -Line 4=姿笑隣病院開頂科 -Line 5=先眞弓沢氷恭国耳 -Line 6=今逝元予報分秘密 -Line 7=物罰望峰巫工業社 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 5] -Line 0=~φ∞:堂妹瀬川 -Line 1=飛巻機山條浦森員 -Line 2=同清水座勉強集合 -Line 3=急止出内則世界秒 -Line 4=数徳香百千葉紗静 -Line 5=星米尋慎吾岡竹梨 -Line 6=柴矢魍魎遊撃隊里 -Line 7=賀玲福芳 - -0=24 -1=12 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 - -[kanji 6] -Line 0=島礼戸桃麦仁智赤 -Line 1=車歌知華王先行者 -Line 2=願愛唄結婚素直陽 -Line 3=宇宙海賊冒険門外 -Line 4=早重番際通再像鮮 -Line 5=量必要種待具質消 -Line 6=去宮計算降象忘漕 -Line 7=滅問船乗旅確過壊 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 7] -Line 0=深都築鍋行脚獣登 -Line 1=雨始約束所虹彩澄 -Line 2=頃年巡交幼供年詰 -Line 3=草誓孤詩意味排溝 -Line 4=刻付良走我謳的支 -Line 5=台匹東薄味噌抜汁 -Line 6=役熊惚片持校受験 -Line 7=聞競争激為懸格白 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 8] -Line 0=余答発寂卒親孝立 -Line 1=派局縁詮滑拝喜毀 -Line 2=干懲号敗堪絶指仕 -Line 3=胆些細慢首傾己主 -Line 4=振返微妙雷塩幽霊 -Line 5=楽団遠捨苦感威散 -Line 6=賭摩李夫舞鷺須雲 -Line 7=流誰転留駄源教呼 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 - -[kanji 9] -Line 0=逆足練違照帽半距 -Line 1=離弟脇兄完璧救誘 -Line 2=拐技踏雪越緑押赫 -Line 3=染御嫌糞医療査鑑 -Line 4=賞編削領向段階殊 -Line 5=果級向腕透前復位 -Line 6=唱青顔叫描殿掃戯 -Line 7=怖底河祝匁宝暦 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 - -[symbol] -Line 0=&()?!/‥^…@$#”+=¥;<>・「」{}%* -Line 1=abcdefghijklmnopqrstyvwxyz -Line 2=ABCDEFGHIJKLMNOPQRSTYVWXYZ - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 -64=24 -65=24 -66=24 -67=24 -68=24 -69=24 -70=24 -71=24 -72=24 -73=24 -74=24 -75=24 -76=24 -77=24 - -[kanji-regular] -Line 0=亜哀愛悪握圧扱安暗案以位依偉囲委威尉意慰易為異移維緯胃衣違遺医井 -Line 1=域育一壱逸稲芋印員因姻引飲院陰隠韻右宇羽雨渦浦運雲営影映栄永泳英 -Line 2=衛詠鋭液疫益駅悦謁越閲円園宴延援沿演炎煙猿縁遠鉛塩汚凹央奥往応押 -Line 3=横欧殴王翁黄沖億屋憶乙卸恩温穏音下化仮何価佳加可夏嫁家寡科暇果架 -Line 4=歌河火禍稼箇花荷華菓課貨過蚊我画芽賀雅餓介会解回塊壊快怪悔懐戒拐 -Line 5=改械海灰界皆絵開階貝劾外害慨概涯街該垣嚇各拡格核殻獲確穫覚角較郭 -Line 6=閣隔革学岳楽額掛潟割喝括活渇滑褐轄且株刈乾冠寒刊勘勧巻喚堪完官寛 -Line 7=干幹患感慣憾換敢棺款歓汗漢環甘監看管簡緩缶肝艦観貫還鑑間閑関陥館 -Line 8=丸含岸眼岩頑顔願企危喜器基奇寄岐希幾忌揮机旗既期棋棄機帰気汽祈季 -Line 9=紀規記貴起軌輝飢騎鬼偽儀宜戯技擬欺犠疑義議菊吉喫詰却客脚虐逆丘久 -Line 10=休及吸宮弓急救朽求泣球究窮級糾給旧牛去居巨拒拠挙虚許距漁魚享京供 -Line 11=競共凶協叫境峡強恐恭挟教橋況狂狭矯胸脅興郷鏡響驚仰凝暁業局曲極玉 -Line 12=勤均斤琴禁筋緊菌襟謹近金吟銀九句区苦駆具愚虞空偶遇隅屈掘靴繰桑勲 -Line 13=君薫訓群軍郡係傾刑兄啓型契形径恵慶憩掲携敬景渓系経継茎蛍計警軽鶏 -Line 14=芸迎鯨劇撃激傑欠決潔穴結血月件倹健兼券剣圏堅嫌建憲懸検権犬献研絹 -Line 15=県肩見謙賢軒遣険顕験元原厳幻弦減源玄現言限個古呼固孤己庫弧戸故枯 -Line 16=湖誇雇顧鼓五互午呉娯後御悟碁語誤護交侯候光公功効厚口向后坑好孔孝 -Line 17=工巧幸広康恒慌抗拘控攻更校構江洪港溝甲皇硬稿紅絞綱耕考肯航荒行衡 -Line 18=講貢購郊酵鉱鋼降項香高剛号合拷豪克刻告国穀酷黒獄腰骨込今困墾婚恨 -Line 19=懇昆根混紺魂佐唆左差査砂詐鎖座債催再最妻宰彩才採栽歳済災砕祭斎細 -Line 20=菜裁載際剤在材罪財坂咲崎作削搾昨策索錯桜冊刷察撮擦札殺雑皿三傘参 -Line 21=山惨散桟産算蚕賛酸暫残仕伺使刺司史嗣四士始姉姿子市師志思指支施旨 -Line 22=枝止死氏祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時 -Line 23=次滋治璽磁示耳自辞式識軸七執失室湿漆疾質実芝舎写射捨赦斜煮社者謝 -Line 24=車遮蛇邪借勺尺爵酌釈若寂弱主取守手朱殊狩珠種趣酒首儒受寿授樹需囚 -Line 25=収周宗就州修愁拾秀秋終習臭舟衆襲週酬集醜住充十従柔汁渋獣縦重銃叔 -Line 26=宿淑祝縮粛塾熟出術述俊春瞬准循旬殉準潤盾純巡遵順処初所暑庶緒署書 -Line 27=諸助叙女序徐除傷償勝匠升召商唱奨宵将小少尚床彰承抄招掌昇昭晶松沼 -Line 28=消渉焼焦照症省硝礁祥称章笑粧紹肖衝訟証詔詳象賞鐘障上丈乗冗剰城場 -Line 29=壌嬢常情条浄状畳蒸譲醸錠嘱飾植殖織職色触食辱伸信侵唇娠寝審心慎振 -Line 30=新森浸深申真神紳臣薪親診身辛進針震人仁刃尋甚尽迅陣酢図吹垂帥推水 -Line 31=炊睡粋衰遂酔錘随髄崇数枢据杉澄寸世瀬畝是制勢姓征性成政整星晴正清 -Line 32=牲生盛精聖声製西誠誓請逝青静斉税隻席惜斥昔析石積籍績責赤跡切拙接 -Line 33=摂折設窃節説雪絶舌仙先千占宣専川戦扇栓泉浅洗染潜旋線繊船薦践選遷 -Line 34=銭銑鮮前善漸然全禅繕塑措疎礎祖租粗素組訴阻僧創双倉喪壮奏層想捜掃 -Line 35=挿操早曹巣槽燥争相窓総草荘葬藻装走送遭霜騒像増憎臓蔵贈造促側則即 -Line 36=息束測足速俗属賊族続卒存孫尊損村他多太堕妥惰打駄体対耐帯待怠態替 -Line 37=泰滞胎袋貸退逮隊代台大第題滝卓宅択拓沢濯託濁諾但達奪脱棚谷丹単嘆 -Line 38=担探淡炭短端胆誕鍛団壇弾断暖段男談値知地恥池痴稚置致遅築畜竹蓄逐 -Line 39=秩窒茶嫡着中仲宙忠抽昼柱注虫衷鋳駐著貯丁兆帳庁弔張彫徴懲挑朝潮町 -Line 40=眺聴脹腸調超跳長頂鳥勅直朕沈珍賃鎮陳津墜追痛通塚漬坪釣亭低停偵貞 -Line 41=呈堤定帝底庭廷弟抵提程締艇訂逓邸泥摘敵滴的笛適哲徹撤迭鉄典天展店 -Line 42=添転点伝殿田電吐塗徒斗渡登途都努度土奴怒倒党冬凍刀唐塔島悼投搭東 -Line 43=桃棟盗湯灯当痘等答筒糖統到討謄豆踏逃透陶頭騰闘働動同堂導洞童胴道 -Line 44=銅峠匿得徳特督篤毒独読凸突届屯豚曇鈍内縄南軟難二尼弐肉日乳入如尿 -Line 45=任妊忍認寧猫熱年念燃粘悩濃納能脳農把覇波派破婆馬俳廃拝排敗杯背肺 -Line 46=輩配倍培媒梅買売賠陪伯博拍泊白舶薄迫漠爆縛麦箱肌畑八鉢発髪伐罰抜 -Line 47=閥伴判半反帆搬板版犯班畔繁般藩販範煩頒飯晩番盤蛮卑否妃彼悲扉批披 -Line 48=比泌疲皮碑秘罷肥被費避非飛備尾微美鼻匹必筆姫百俵標氷漂票表評描病 -Line 49=秒苗品浜貧賓頻敏瓶不付夫婦富布府怖扶敷普浮父符腐膚譜負賦赴附侮武 -Line 50=舞部封風伏副復幅服福腹複覆払沸仏物分噴墳憤奮粉紛雰文聞丙併兵塀幣 -Line 51=平弊柄並閉陛米壁癖別偏変片編辺返遍便勉弁保舗捕歩補穂募墓慕暮母簿 -Line 52=倣俸包報奉宝峰崩抱放方法泡砲縫胞芳褒訪豊邦飽乏亡傍剖坊妨帽忘忙房 -Line 53=暴望某棒冒紡肪膨謀貿防北僕墨撲朴牧没堀奔本翻凡盆摩磨魔麻埋妹枚毎 -Line 54=幕膜又抹末繭万慢満漫味未魅岬密脈妙民眠務夢無矛霧婿娘名命明盟迷銘 -Line 55=鳴滅免綿面模茂妄毛猛盲網耗木黙目戻問紋門匁夜野矢厄役約薬訳躍柳愉 -Line 56=油癒諭輸唯優勇友幽悠憂有猶由裕誘遊郵雄融夕予余与誉預幼容庸揚揺擁 -Line 57=曜様洋溶用窯羊葉要謡踊陽養抑欲浴翌翼羅裸来頼雷絡落酪乱卵欄濫覧利 -Line 58=吏履理痢裏里離陸律率立略流留硫粒隆竜慮旅虜了僚両寮料涼猟療糧良量 -Line 59=陵領力緑倫厘林臨輪隣塁涙累類令例冷励礼鈴隷零霊麗齢暦歴列劣烈裂廉 -Line 60=恋練連錬炉路露労廊朗楼浪漏老郎六録論和話賄惑枠湾腕 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 -64=24 -65=24 -66=24 -67=24 -68=24 -69=24 -70=24 -71=24 -72=24 -73=24 -74=24 -75=24 -76=24 -77=24 -78=24 -79=24 -80=24 -81=24 -82=24 -83=24 -84=24 -85=24 -86=24 -87=24 -88=24 -89=24 -90=24 -91=24 -92=24 -93=24 -94=24 -95=24 -96=24 -97=24 -98=24 -99=24 -100=24 -101=24 -102=24 -103=24 -104=24 -105=24 -106=24 -107=24 -108=24 -109=24 -110=24 -111=24 -112=24 -113=24 -114=24 -115=24 -116=24 -117=24 -118=24 -119=24 -120=24 -121=24 -122=24 -123=24 -124=24 -125=24 -126=24 -127=24 -128=24 -129=24 -130=24 -131=24 -132=24 -133=24 -134=24 -135=24 -136=24 -137=24 -138=24 -139=24 -140=24 -141=24 -142=24 -143=24 -144=24 -145=24 -146=24 -147=24 -148=24 -149=24 -150=24 -151=24 -152=24 -153=24 -154=24 -155=24 -156=24 -157=24 -158=24 -159=24 -160=24 -161=24 -162=24 -163=24 -164=24 -165=24 -166=24 -167=24 -168=24 -169=24 -170=24 -171=24 -172=24 -173=24 -174=24 -175=24 -176=24 -177=24 -178=24 -179=24 -180=24 -181=24 -182=24 -183=24 -184=24 -185=24 -186=24 -187=24 -188=24 -189=24 -190=24 -191=24 -192=24 -193=24 -194=24 -195=24 -196=24 -197=24 -198=24 -199=24 -200=24 -201=24 -202=24 -203=24 -204=24 -205=24 -206=24 -207=24 -208=24 -209=24 -210=24 -211=24 -212=24 -213=24 -214=24 -215=24 -216=24 -217=24 -218=24 -219=24 -220=24 -221=24 -222=24 -223=24 -224=24 -225=24 -226=24 -227=24 -228=24 -229=24 -230=24 -231=24 -232=24 -233=24 -234=24 -235=24 -236=24 -237=24 -238=24 -239=24 -240=24 -241=24 -242=24 -243=24 -244=24 -245=24 -246=24 -247=24 -248=24 -249=24 -250=24 -251=24 -252=24 -253=24 -254=24 -255=24 -256=24 -257=24 -258=24 -259=24 -260=24 -261=24 -262=24 -263=24 -264=24 -265=24 -266=24 -267=24 -268=24 -269=24 -270=24 -271=24 -272=24 -273=24 -274=24 -275=24 -276=24 -277=24 -278=24 -279=24 -280=24 -281=24 -282=24 -283=24 -284=24 -285=24 -286=24 -287=24 -288=24 -289=24 -290=24 -291=24 -292=24 -293=24 -294=24 -295=24 -296=24 -297=24 -298=24 -299=24 -300=24 -301=24 -302=24 -303=24 -304=24 -305=24 -306=24 -307=24 -308=24 -309=24 -310=24 -311=24 -312=24 -313=24 -314=24 -315=24 -316=24 -317=24 -318=24 -319=24 -320=24 -321=24 -322=24 -323=24 -324=24 -325=24 -326=24 -327=24 -328=24 -329=24 -330=24 -331=24 -332=24 -333=24 -334=24 -335=24 -336=24 -337=24 -338=24 -339=24 -340=24 -341=24 -342=24 -343=24 -344=24 -345=24 -346=24 -347=24 -348=24 -349=24 -350=24 -351=24 -352=24 -353=24 -354=24 -355=24 -356=24 -357=24 -358=24 -359=24 -360=24 -361=24 -362=24 -363=24 -364=24 -365=24 -366=24 -367=24 -368=24 -369=24 -370=24 -371=24 -372=24 -373=24 -374=24 -375=24 -376=24 -377=24 -378=24 -379=24 -380=24 -381=24 -382=24 -383=24 -384=24 -385=24 -386=24 -387=24 -388=24 -389=24 -390=24 -391=24 -392=24 -393=24 -394=24 -395=24 -396=24 -397=24 -398=24 -399=24 -400=24 -401=24 -402=24 -403=24 -404=24 -405=24 -406=24 -407=24 -408=24 -409=24 -410=24 -411=24 -412=24 -413=24 -414=24 -415=24 -416=24 -417=24 -418=24 -419=24 -420=24 -421=24 -422=24 -423=24 -424=24 -425=24 -426=24 -427=24 -428=24 -429=24 -430=24 -431=24 -432=24 -433=24 -434=24 -435=24 -436=24 -437=24 -438=24 -439=24 -440=24 -441=24 -442=24 -443=24 -444=24 -445=24 -446=24 -447=24 -448=24 -449=24 -450=24 -451=24 -452=24 -453=24 -454=24 -455=24 -456=24 -457=24 -458=24 -459=24 -460=24 -461=24 -462=24 -463=24 -464=24 -465=24 -466=24 -467=24 -468=24 -469=24 -470=24 -471=24 -472=24 -473=24 -474=24 -475=24 -476=24 -477=24 -478=24 -479=24 -480=24 -481=24 -482=24 -483=24 -484=24 -485=24 -486=24 -487=24 -488=24 -489=24 -490=24 -491=24 -492=24 -493=24 -494=24 -495=24 -496=24 -497=24 -498=24 -499=24 -500=24 -501=24 -502=24 -503=24 -504=24 -505=24 -506=24 -507=24 -508=24 -509=24 -510=24 -511=24 -512=24 -513=24 -514=24 -515=24 -516=24 -517=24 -518=24 -519=24 -520=24 -521=24 -522=24 -523=24 -524=24 -525=24 -526=24 -527=24 -528=24 -529=24 -530=24 -531=24 -532=24 -533=24 -534=24 -535=24 -536=24 -537=24 -538=24 -539=24 -540=24 -541=24 -542=24 -543=24 -544=24 -545=24 -546=24 -547=24 -548=24 -549=24 -550=24 -551=24 -552=24 -553=24 -554=24 -555=24 -556=24 -557=24 -558=24 -559=24 -560=24 -561=24 -562=24 -563=24 -564=24 -565=24 -566=24 -567=24 -568=24 -569=24 -570=24 -571=24 -572=24 -573=24 -574=24 -575=24 -576=24 -577=24 -578=24 -579=24 -580=24 -581=24 -582=24 -583=24 -584=24 -585=24 -586=24 -587=24 -588=24 -589=24 -590=24 -591=24 -592=24 -593=24 -594=24 -595=24 -596=24 -597=24 -598=24 -599=24 -600=24 -601=24 -602=24 -603=24 -604=24 -605=24 -606=24 -607=24 -608=24 -609=24 -610=24 -611=24 -612=24 -613=24 -614=24 -615=24 -616=24 -617=24 -618=24 -619=24 -620=24 -621=24 -622=24 -623=24 -624=24 -625=24 -626=24 -627=24 -628=24 -629=24 -630=24 -631=24 -632=24 -633=24 -634=24 -635=24 -636=24 -637=24 -638=24 -639=24 -640=24 -641=24 -642=24 -643=24 -644=24 -645=24 -646=24 -647=24 -648=24 -649=24 -650=24 -651=24 -652=24 -653=24 -654=24 -655=24 -656=24 -657=24 -658=24 -659=24 -660=24 -661=24 -662=24 -663=24 -664=24 -665=24 -666=24 -667=24 -668=24 -669=24 -670=24 -671=24 -672=24 -673=24 -674=24 -675=24 -676=24 -677=24 -678=24 -679=24 -680=24 -681=24 -682=24 -683=24 -684=24 -685=24 -686=24 -687=24 -688=24 -689=24 -690=24 -691=24 -692=24 -693=24 -694=24 -695=24 -696=24 -697=24 -698=24 -699=24 -700=24 -701=24 -702=24 -703=24 -704=24 -705=24 -706=24 -707=24 -708=24 -709=24 -710=24 -711=24 -712=24 -713=24 -714=24 -715=24 -716=24 -717=24 -718=24 -719=24 -720=24 -721=24 -722=24 -723=24 -724=24 -725=24 -726=24 -727=24 -728=24 -729=24 -730=24 -731=24 -732=24 -733=24 -734=24 -735=24 -736=24 -737=24 -738=24 -739=24 -740=24 -741=24 -742=24 -743=24 -744=24 -745=24 -746=24 -747=24 -748=24 -749=24 -750=24 -751=24 -752=24 -753=24 -754=24 -755=24 -756=24 -757=24 -758=24 -759=24 -760=24 -761=24 -762=24 -763=24 -764=24 -765=24 -766=24 -767=24 -768=24 -769=24 -770=24 -771=24 -772=24 -773=24 -774=24 -775=24 -776=24 -777=24 -778=24 -779=24 -780=24 -781=24 -782=24 -783=24 -784=24 -785=24 -786=24 -787=24 -788=24 -789=24 -790=24 -791=24 -792=24 -793=24 -794=24 -795=24 -796=24 -797=24 -798=24 -799=24 -800=24 -801=24 -802=24 -803=24 -804=24 -805=24 -806=24 -807=24 -808=24 -809=24 -810=24 -811=24 -812=24 -813=24 -814=24 -815=24 -816=24 -817=24 -818=24 -819=24 -820=24 -821=24 -822=24 -823=24 -824=24 -825=24 -826=24 -827=24 -828=24 -829=24 -830=24 -831=24 -832=24 -833=24 -834=24 -835=24 -836=24 -837=24 -838=24 -839=24 -840=24 -841=24 -842=24 -843=24 -844=24 -845=24 -846=24 -847=24 -848=24 -849=24 -850=24 -851=24 -852=24 -853=24 -854=24 -855=24 -856=24 -857=24 -858=24 -859=24 -860=24 -861=24 -862=24 -863=24 -864=24 -865=24 -866=24 -867=24 -868=24 -869=24 -870=24 -871=24 -872=24 -873=24 -874=24 -875=24 -876=24 -877=24 -878=24 -879=24 -880=24 -881=24 -882=24 -883=24 -884=24 -885=24 -886=24 -887=24 -888=24 -889=24 -890=24 -891=24 -892=24 -893=24 -894=24 -895=24 -896=24 -897=24 -898=24 -899=24 -900=24 -901=24 -902=24 -903=24 -904=24 -905=24 -906=24 -907=24 -908=24 -909=24 -910=24 -911=24 -912=24 -913=24 -914=24 -915=24 -916=24 -917=24 -918=24 -919=24 -920=24 -921=24 -922=24 -923=24 -924=24 -925=24 -926=24 -927=24 -928=24 -929=24 -930=24 -931=24 -932=24 -933=24 -934=24 -935=24 -936=24 -937=24 -938=24 -939=24 -940=24 -941=24 -942=24 -943=24 -944=24 -945=24 -946=24 -947=24 -948=24 -949=24 -950=24 -951=24 -952=24 -953=24 -954=24 -955=24 -956=24 -957=24 -958=24 -959=24 -960=24 -961=24 -962=24 -963=24 -964=24 -965=24 -966=24 -967=24 -968=24 -969=24 -970=24 -971=24 -972=24 -973=24 -974=24 -975=24 -976=24 -977=24 -978=24 -979=24 -980=24 -981=24 -982=24 -983=24 -984=24 -985=24 -986=24 -987=24 -988=24 -989=24 -990=24 -991=24 -992=24 -993=24 -994=24 -995=24 -996=24 -997=24 -998=24 -999=24 -1000=24 -1001=24 -1002=24 -1003=24 -1004=24 -1005=24 -1006=24 -1007=24 -1008=24 -1009=24 -1010=24 -1011=24 -1012=24 -1013=24 -1014=24 -1015=24 -1016=24 -1017=24 -1018=24 -1019=24 -1020=24 -1021=24 -1022=24 -1023=24 -1024=24 -1025=24 -1026=24 -1027=24 -1028=24 -1029=24 -1030=24 -1031=24 -1032=24 -1033=24 -1034=24 -1035=24 -1036=24 -1037=24 -1038=24 -1039=24 -1040=24 -1041=24 -1042=24 -1043=24 -1044=24 -1045=24 -1046=24 -1047=24 -1048=24 -1049=24 -1050=24 -1051=24 -1052=24 -1053=24 -1054=24 -1055=24 -1056=24 -1057=24 -1058=24 -1059=24 -1060=24 -1061=24 -1062=24 -1063=24 -1064=24 -1065=24 -1066=24 -1067=24 -1068=24 -1069=24 -1070=24 -1071=24 -1072=24 -1073=24 -1074=24 -1075=24 -1076=24 -1077=24 -1078=24 -1079=24 -1080=24 -1081=24 -1082=24 -1083=24 -1084=24 -1085=24 -1086=24 -1087=24 -1088=24 -1089=24 -1090=24 -1091=24 -1092=24 -1093=24 -1094=24 -1095=24 -1096=24 -1097=24 -1098=24 -1099=24 -1100=24 -1101=24 -1102=24 -1103=24 -1104=24 -1105=24 -1106=24 -1107=24 -1108=24 -1109=24 -1110=24 -1111=24 -1112=24 -1113=24 -1114=24 -1115=24 -1116=24 -1117=24 -1118=24 -1119=24 -1120=24 -1121=24 -1122=24 -1123=24 -1124=24 -1125=24 -1126=24 -1127=24 -1128=24 -1129=24 -1130=24 -1131=24 -1132=24 -1133=24 -1134=24 -1135=24 -1136=24 -1137=24 -1138=24 -1139=24 -1140=24 -1141=24 -1142=24 -1143=24 -1144=24 -1145=24 -1146=24 -1147=24 -1148=24 -1149=24 -1150=24 -1151=24 -1152=24 -1153=24 -1154=24 -1155=24 -1156=24 -1157=24 -1158=24 -1159=24 -1160=24 -1161=24 -1162=24 -1163=24 -1164=24 -1165=24 -1166=24 -1167=24 -1168=24 -1169=24 -1170=24 -1171=24 -1172=24 -1173=24 -1174=24 -1175=24 -1176=24 -1177=24 -1178=24 -1179=24 -1180=24 -1181=24 -1182=24 -1183=24 -1184=24 -1185=24 -1186=24 -1187=24 -1188=24 -1189=24 -1190=24 -1191=24 -1192=24 -1193=24 -1194=24 -1195=24 -1196=24 -1197=24 -1198=24 -1199=24 -1200=24 -1201=24 -1202=24 -1203=24 -1204=24 -1205=24 -1206=24 -1207=24 -1208=24 -1209=24 -1210=24 -1211=24 -1212=24 -1213=24 -1214=24 -1215=24 -1216=24 -1217=24 -1218=24 -1219=24 -1220=24 -1221=24 -1222=24 -1223=24 -1224=24 -1225=24 -1226=24 -1227=24 -1228=24 -1229=24 -1230=24 -1231=24 -1232=24 -1233=24 -1234=24 -1235=24 -1236=24 -1237=24 -1238=24 -1239=24 -1240=24 -1241=24 -1242=24 -1243=24 -1244=24 -1245=24 -1246=24 -1247=24 -1248=24 -1249=24 -1250=24 -1251=24 -1252=24 -1253=24 -1254=24 -1255=24 -1256=24 -1257=24 -1258=24 -1259=24 -1260=24 -1261=24 -1262=24 -1263=24 -1264=24 -1265=24 -1266=24 -1267=24 -1268=24 -1269=24 -1270=24 -1271=24 -1272=24 -1273=24 -1274=24 -1275=24 -1276=24 -1277=24 -1278=24 -1279=24 -1280=24 -1281=24 -1282=24 -1283=24 -1284=24 -1285=24 -1286=24 -1287=24 -1288=24 -1289=24 -1290=24 -1291=24 -1292=24 -1293=24 -1294=24 -1295=24 -1296=24 -1297=24 -1298=24 -1299=24 -1300=24 -1301=24 -1302=24 -1303=24 -1304=24 -1305=24 -1306=24 -1307=24 -1308=24 -1309=24 -1310=24 -1311=24 -1312=24 -1313=24 -1314=24 -1315=24 -1316=24 -1317=24 -1318=24 -1319=24 -1320=24 -1321=24 -1322=24 -1323=24 -1324=24 -1325=24 -1326=24 -1327=24 -1328=24 -1329=24 -1330=24 -1331=24 -1332=24 -1333=24 -1334=24 -1335=24 -1336=24 -1337=24 -1338=24 -1339=24 -1340=24 -1341=24 -1342=24 -1343=24 -1344=24 -1345=24 -1346=24 -1347=24 -1348=24 -1349=24 -1350=24 -1351=24 -1352=24 -1353=24 -1354=24 -1355=24 -1356=24 -1357=24 -1358=24 -1359=24 -1360=24 -1361=24 -1362=24 -1363=24 -1364=24 -1365=24 -1366=24 -1367=24 -1368=24 -1369=24 -1370=24 -1371=24 -1372=24 -1373=24 -1374=24 -1375=24 -1376=24 -1377=24 -1378=24 -1379=24 -1380=24 -1381=24 -1382=24 -1383=24 -1384=24 -1385=24 -1386=24 -1387=24 -1388=24 -1389=24 -1390=24 -1391=24 -1392=24 -1393=24 -1394=24 -1395=24 -1396=24 -1397=24 -1398=24 -1399=24 -1400=24 -1401=24 -1402=24 -1403=24 -1404=24 -1405=24 -1406=24 -1407=24 -1408=24 -1409=24 -1410=24 -1411=24 -1412=24 -1413=24 -1414=24 -1415=24 -1416=24 -1417=24 -1418=24 -1419=24 -1420=24 -1421=24 -1422=24 -1423=24 -1424=24 -1425=24 -1426=24 -1427=24 -1428=24 -1429=24 -1430=24 -1431=24 -1432=24 -1433=24 -1434=24 -1435=24 -1436=24 -1437=24 -1438=24 -1439=24 -1440=24 -1441=24 -1442=24 -1443=24 -1444=24 -1445=24 -1446=24 -1447=24 -1448=24 -1449=24 -1450=24 -1451=24 -1452=24 -1453=24 -1454=24 -1455=24 -1456=24 -1457=24 -1458=24 -1459=24 -1460=24 -1461=24 -1462=24 -1463=24 -1464=24 -1465=24 -1466=24 -1467=24 -1468=24 -1469=24 -1470=24 -1471=24 -1472=24 -1473=24 -1474=24 -1475=24 -1476=24 -1477=24 -1478=24 -1479=24 -1480=24 -1481=24 -1482=24 -1483=24 -1484=24 -1485=24 -1486=24 -1487=24 -1488=24 -1489=24 -1490=24 -1491=24 -1492=24 -1493=24 -1494=24 -1495=24 -1496=24 -1497=24 -1498=24 -1499=24 -1500=24 -1501=24 -1502=24 -1503=24 -1504=24 -1505=24 -1506=24 -1507=24 -1508=24 -1509=24 -1510=24 -1511=24 -1512=24 -1513=24 -1514=24 -1515=24 -1516=24 -1517=24 -1518=24 -1519=24 -1520=24 -1521=24 -1522=24 -1523=24 -1524=24 -1525=24 -1526=24 -1527=24 -1528=24 -1529=24 -1530=24 -1531=24 -1532=24 -1533=24 -1534=24 -1535=24 -1536=24 -1537=24 -1538=24 -1539=24 -1540=24 -1541=24 -1542=24 -1543=24 -1544=24 -1545=24 -1546=24 -1547=24 -1548=24 -1549=24 -1550=24 -1551=24 -1552=24 -1553=24 -1554=24 -1555=24 -1556=24 -1557=24 -1558=24 -1559=24 -1560=24 -1561=24 -1562=24 -1563=24 -1564=24 -1565=24 -1566=24 -1567=24 -1568=24 -1569=24 -1570=24 -1571=24 -1572=24 -1573=24 -1574=24 -1575=24 -1576=24 -1577=24 -1578=24 -1579=24 -1580=24 -1581=24 -1582=24 -1583=24 -1584=24 -1585=24 -1586=24 -1587=24 -1588=24 -1589=24 -1590=24 -1591=24 -1592=24 -1593=24 -1594=24 -1595=24 -1596=24 -1597=24 -1598=24 -1599=24 -1600=24 -1601=24 -1602=24 -1603=24 -1604=24 -1605=24 -1606=24 -1607=24 -1608=24 -1609=24 -1610=24 -1611=24 -1612=24 -1613=24 -1614=24 -1615=24 -1616=24 -1617=24 -1618=24 -1619=24 -1620=24 -1621=24 -1622=24 -1623=24 -1624=24 -1625=24 -1626=24 -1627=24 -1628=24 -1629=24 -1630=24 -1631=24 -1632=24 -1633=24 -1634=24 -1635=24 -1636=24 -1637=24 -1638=24 -1639=24 -1640=24 -1641=24 -1642=24 -1643=24 -1644=24 -1645=24 -1646=24 -1647=24 -1648=24 -1649=24 -1650=24 -1651=24 -1652=24 -1653=24 -1654=24 -1655=24 -1656=24 -1657=24 -1658=24 -1659=24 -1660=24 -1661=24 -1662=24 -1663=24 -1664=24 -1665=24 -1666=24 -1667=24 -1668=24 -1669=24 -1670=24 -1671=24 -1672=24 -1673=24 -1674=24 -1675=24 -1676=24 -1677=24 -1678=24 -1679=24 -1680=24 -1681=24 -1682=24 -1683=24 -1684=24 -1685=24 -1686=24 -1687=24 -1688=24 -1689=24 -1690=24 -1691=24 -1692=24 -1693=24 -1694=24 -1695=24 -1696=24 -1697=24 -1698=24 -1699=24 -1700=24 -1701=24 -1702=24 -1703=24 -1704=24 -1705=24 -1706=24 -1707=24 -1708=24 -1709=24 -1710=24 -1711=24 -1712=24 -1713=24 -1714=24 -1715=24 -1716=24 -1717=24 -1718=24 -1719=24 -1720=24 -1721=24 -1722=24 -1723=24 -1724=24 -1725=24 -1726=24 -1727=24 -1728=24 -1729=24 -1730=24 -1731=24 -1732=24 -1733=24 -1734=24 -1735=24 -1736=24 -1737=24 -1738=24 -1739=24 -1740=24 -1741=24 -1742=24 -1743=24 -1744=24 -1745=24 -1746=24 -1747=24 -1748=24 -1749=24 -1750=24 -1751=24 -1752=24 -1753=24 -1754=24 -1755=24 -1756=24 -1757=24 -1758=24 -1759=24 -1760=24 -1761=24 -1762=24 -1763=24 -1764=24 -1765=24 -1766=24 -1767=24 -1768=24 -1769=24 -1770=24 -1771=24 -1772=24 -1773=24 -1774=24 -1775=24 -1776=24 -1777=24 -1778=24 -1779=24 -1780=24 -1781=24 -1782=24 -1783=24 -1784=24 -1785=24 -1786=24 -1787=24 -1788=24 -1789=24 -1790=24 -1791=24 -1792=24 -1793=24 -1794=24 -1795=24 -1796=24 -1797=24 -1798=24 -1799=24 -1800=24 -1801=24 -1802=24 -1803=24 -1804=24 -1805=24 -1806=24 -1807=24 -1808=24 -1809=24 -1810=24 -1811=24 -1812=24 -1813=24 -1814=24 -1815=24 -1816=24 -1817=24 -1818=24 -1819=24 -1820=24 -1821=24 -1822=24 -1823=24 -1824=24 -1825=24 -1826=24 -1827=24 -1828=24 -1829=24 -1830=24 -1831=24 -1832=24 -1833=24 -1834=24 -1835=24 -1836=24 -1837=24 -1838=24 -1839=24 -1840=24 -1841=24 -1842=24 -1843=24 -1844=24 -1845=24 -1846=24 -1847=24 -1848=24 -1849=24 -1850=24 -1851=24 -1852=24 -1853=24 -1854=24 -1855=24 -1856=24 -1857=24 -1858=24 -1859=24 -1860=24 -1861=24 -1862=24 -1863=24 -1864=24 -1865=24 -1866=24 -1867=24 -1868=24 -1869=24 -1870=24 -1871=24 -1872=24 -1873=24 -1874=24 -1875=24 -1876=24 -1877=24 -1878=24 -1879=24 -1880=24 -1881=24 -1882=24 -1883=24 -1884=24 -1885=24 -1886=24 -1887=24 -1888=24 -1889=24 -1890=24 -1891=24 -1892=24 -1893=24 -1894=24 -1895=24 -1896=24 -1897=24 -1898=24 -1899=24 -1900=24 -1901=24 -1902=24 -1903=24 -1904=24 -1905=24 -1906=24 -1907=24 -1908=24 -1909=24 -1910=24 -1911=24 -1912=24 -1913=24 -1914=24 -1915=24 -1916=24 -1917=24 -1918=24 -1919=24 -1920=24 -1921=24 -1922=24 -1923=24 -1924=24 -1925=24 -1926=24 -1927=24 -1928=24 -1929=24 -1930=24 -1931=24 -1932=24 -1933=24 -1934=24 -1935=24 -1936=24 -1937=24 -1938=24 -1939=24 -1940=24 -1941=24 -1942=24 -1943=24 -1944=24 - -[kanji-jis1] -Line 0=唖娃阿挨姶逢葵茜穐渥旭葦芦鯵梓斡宛姐虻飴絢綾鮎或粟袷庵按闇鞍杏伊 -Line 1=夷惟椅畏萎謂亥郁磯溢茨鰯允咽淫胤蔭吋烏迂卯鵜窺丑碓臼嘘唄欝蔚鰻姥 -Line 2=厩瓜閏噂云荏餌叡嬰曳洩瑛盈穎頴榎厭堰奄怨掩焔燕艶苑薗鴛於甥旺襖鴬 -Line 3=鴎岡荻臆桶牡俺伽嘉珂禾苛茄蝦嘩迦霞俄峨牙臥蛾駕廻恢魁晦芥蟹凱咳崖 -Line 4=碍蓋鎧骸浬馨蛙柿蛎鈎劃廓撹赫顎笠樫橿梶鰍恰葛鰹叶椛樺鞄兜竃蒲釜鎌 -Line 5=噛鴨栢茅萱粥苅瓦侃姦柑桓澗潅竿翰莞諌韓舘巌玩癌翫贋雁伎嬉毅畿稀徽 -Line 6=亀妓祇蟻誼掬鞠吃桔橘砧杵黍仇汲灸笈渠鋸禦亨侠僑兇匡卿喬彊怯蕎饗尭 -Line 7=桐粁僅巾錦欣欽禽芹衿倶狗玖矩躯駈駒喰寓串櫛釧屑窟沓轡窪熊隈粂栗鍬 -Line 8=卦袈祁圭珪慧桂畦稽繋罫荊詣頚戟隙桁訣倦喧拳捲牽硯鍵鹸絃舷諺乎姑狐 -Line 9=糊袴股胡菰虎跨鈷伍吾梧檎瑚醐乞鯉佼倖勾喉垢宏巷庚弘昂晃杭梗浩糠紘 -Line 10=肱腔膏砿閤鴻劫壕濠轟麹鵠漉甑忽惚狛此頃坤昏梱痕艮些叉嵯沙瑳裟坐挫 -Line 11=哉塞采犀砦冴阪堺榊肴埼碕鷺咋朔柵窄鮭笹匙拶薩皐鯖捌錆鮫晒撒燦珊纂 -Line 12=讃餐斬仔屍孜斯獅爾痔而蒔汐鹿鴫竺宍雫叱嫉悉蔀篠偲柴屡蕊縞紗杓灼錫 -Line 13=惹腫呪綬洲繍蒐讐蹴輯酋什戎夙峻竣舜駿楯淳醇曙渚薯藷恕鋤哨嘗妾娼庄 -Line 14=廠捷昌梢樟樵湘菖蒋蕉裳醤鉦鍾鞘丞擾杖穣埴拭燭蝕尻晋榛疹秦芯塵壬腎 -Line 15=訊靭笥諏須厨逗翠錐瑞嵩趨雛椙菅頗雀裾摺凄棲栖醒脆戚脊蹟碩蝉尖撰栴 -Line 16=煎煽穿箭羨腺舛詮賎閃膳糎噌岨曾曽楚狙疏蘇遡鼠叢爽宋匝惣掻槍漕痩糟 -Line 17=綜聡蒼鎗捉袖其揃遜汰詑唾柁舵楕陀騨堆岱戴腿苔黛鯛醍鷹瀧啄托琢鐸茸 -Line 18=凧蛸只叩辰巽竪辿狸鱈樽誰坦旦歎湛箪綻耽蛋檀弛智蜘馳筑註酎樗瀦猪苧 -Line 19=凋喋寵帖暢牒蝶諜銚捗椎槌鎚栂掴槻佃柘辻蔦綴鍔椿潰壷嬬紬爪吊鶴剃悌 -Line 20=挺梯汀碇禎諦蹄鄭釘鼎擢鏑溺轍填纏甜貼顛澱兎堵妬屠杜菟賭鍍砥砺塘套 -Line 21=宕嶋梼淘涛燈祷董蕩藤鐙憧撞瞳萄鴇涜禿栃橡椴鳶苫寅酉瀞噸惇敦沌遁頓 -Line 22=呑奈那乍凪薙謎灘捺鍋楢馴畷楠汝迩匂賑虹廿韮濡禰祢葱捻撚乃廼之埜嚢 -Line 23=膿覗蚤巴播杷琶罵芭盃牌楳煤狽這蝿秤矧萩剥柏箔粕曝莫駁函硲箸肇筈櫨 -Line 24=幡畠溌醗筏鳩噺塙蛤隼叛斑氾汎釆挽磐蕃匪庇斐緋誹樋簸枇毘琵眉柊稗疋 -Line 25=髭彦膝菱肘弼畢逼桧媛紐謬彪瓢豹廟錨鋲蒜蛭鰭彬斌瀕埠冨斧芙阜撫葡蕪 -Line 26=楓葺蕗淵弗鮒吻扮焚糞蔽頁僻碧瞥蔑箆篇娩鞭鋪圃甫輔戊菩呆峯庖捧朋烹 -Line 27=萌蓬蜂鋒鳳鵬貌鉾吠頬卜睦穆釦勃殆幌昧哩槙枕鮪柾鱒桝亦俣沫迄侭麿蔓 -Line 28=巳箕蜜湊蓑稔粍牟鵡椋冥姪牝棉緬麺摸孟蒙儲杢勿餅尤籾貰悶也冶爺耶弥 -Line 29=靖薮鑓愈佑宥揖柚湧涌猷祐邑輿傭妖楊熔耀蓉遥慾沃淀螺莱洛嵐藍蘭李梨 -Line 30=璃裡葎掠劉溜琉龍侶亮凌梁瞭稜諒遼淋燐琳鱗麟瑠伶嶺怜玲苓憐漣煉簾聯 -Line 31=蓮呂魯櫓賂婁弄榔牢狼篭聾蝋麓禄肋倭歪脇鷲亙亘鰐詫藁蕨椀碗 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 -64=24 -65=24 -66=24 -67=24 -68=24 -69=24 -70=24 -71=24 -72=24 -73=24 -74=24 -75=24 -76=24 -77=24 -78=24 -79=24 -80=24 -81=24 -82=24 -83=24 -84=24 -85=24 -86=24 -87=24 -88=24 -89=24 -90=24 -91=24 -92=24 -93=24 -94=24 -95=24 -96=24 -97=24 -98=24 -99=24 -100=24 -101=24 -102=24 -103=24 -104=24 -105=24 -106=24 -107=24 -108=24 -109=24 -110=24 -111=24 -112=24 -113=24 -114=24 -115=24 -116=24 -117=24 -118=24 -119=24 -120=24 -121=24 -122=24 -123=24 -124=24 -125=24 -126=24 -127=24 -128=24 -129=24 -130=24 -131=24 -132=24 -133=24 -134=24 -135=24 -136=24 -137=24 -138=24 -139=24 -140=24 -141=24 -142=24 -143=24 -144=24 -145=24 -146=24 -147=24 -148=24 -149=24 -150=24 -151=24 -152=24 -153=24 -154=24 -155=24 -156=24 -157=24 -158=24 -159=24 -160=24 -161=24 -162=24 -163=24 -164=24 -165=24 -166=24 -167=24 -168=24 -169=24 -170=24 -171=24 -172=24 -173=24 -174=24 -175=24 -176=24 -177=24 -178=24 -179=24 -180=24 -181=24 -182=24 -183=24 -184=24 -185=24 -186=24 -187=24 -188=24 -189=24 -190=24 -191=24 -192=24 -193=24 -194=24 -195=24 -196=24 -197=24 -198=24 -199=24 -200=24 -201=24 -202=24 -203=24 -204=24 -205=24 -206=24 -207=24 -208=24 -209=24 -210=24 -211=24 -212=24 -213=24 -214=24 -215=24 -216=24 -217=24 -218=24 -219=24 -220=24 -221=24 -222=24 -223=24 -224=24 -225=24 -226=24 -227=24 -228=24 -229=24 -230=24 -231=24 -232=24 -233=24 -234=24 -235=24 -236=24 -237=24 -238=24 -239=24 -240=24 -241=24 -242=24 -243=24 -244=24 -245=24 -246=24 -247=24 -248=24 -249=24 -250=24 -251=24 -252=24 -253=24 -254=24 -255=24 -256=24 -257=24 -258=24 -259=24 -260=24 -261=24 -262=24 -263=24 -264=24 -265=24 -266=24 -267=24 -268=24 -269=24 -270=24 -271=24 -272=24 -273=24 -274=24 -275=24 -276=24 -277=24 -278=24 -279=24 -280=24 -281=24 -282=24 -283=24 -284=24 -285=24 -286=24 -287=24 -288=24 -289=24 -290=24 -291=24 -292=24 -293=24 -294=24 -295=24 -296=24 -297=24 -298=24 -299=24 -300=24 -301=24 -302=24 -303=24 -304=24 -305=24 -306=24 -307=24 -308=24 -309=24 -310=24 -311=24 -312=24 -313=24 -314=24 -315=24 -316=24 -317=24 -318=24 -319=24 -320=24 -321=24 -322=24 -323=24 -324=24 -325=24 -326=24 -327=24 -328=24 -329=24 -330=24 -331=24 -332=24 -333=24 -334=24 -335=24 -336=24 -337=24 -338=24 -339=24 -340=24 -341=24 -342=24 -343=24 -344=24 -345=24 -346=24 -347=24 -348=24 -349=24 -350=24 -351=24 -352=24 -353=24 -354=24 -355=24 -356=24 -357=24 -358=24 -359=24 -360=24 -361=24 -362=24 -363=24 -364=24 -365=24 -366=24 -367=24 -368=24 -369=24 -370=24 -371=24 -372=24 -373=24 -374=24 -375=24 -376=24 -377=24 -378=24 -379=24 -380=24 -381=24 -382=24 -383=24 -384=24 -385=24 -386=24 -387=24 -388=24 -389=24 -390=24 -391=24 -392=24 -393=24 -394=24 -395=24 -396=24 -397=24 -398=24 -399=24 -400=24 -401=24 -402=24 -403=24 -404=24 -405=24 -406=24 -407=24 -408=24 -409=24 -410=24 -411=24 -412=24 -413=24 -414=24 -415=24 -416=24 -417=24 -418=24 -419=24 -420=24 -421=24 -422=24 -423=24 -424=24 -425=24 -426=24 -427=24 -428=24 -429=24 -430=24 -431=24 -432=24 -433=24 -434=24 -435=24 -436=24 -437=24 -438=24 -439=24 -440=24 -441=24 -442=24 -443=24 -444=24 -445=24 -446=24 -447=24 -448=24 -449=24 -450=24 -451=24 -452=24 -453=24 -454=24 -455=24 -456=24 -457=24 -458=24 -459=24 -460=24 -461=24 -462=24 -463=24 -464=24 -465=24 -466=24 -467=24 -468=24 -469=24 -470=24 -471=24 -472=24 -473=24 -474=24 -475=24 -476=24 -477=24 -478=24 -479=24 -480=24 -481=24 -482=24 -483=24 -484=24 -485=24 -486=24 -487=24 -488=24 -489=24 -490=24 -491=24 -492=24 -493=24 -494=24 -495=24 -496=24 -497=24 -498=24 -499=24 -500=24 -501=24 -502=24 -503=24 -504=24 -505=24 -506=24 -507=24 -508=24 -509=24 -510=24 -511=24 -512=24 -513=24 -514=24 -515=24 -516=24 -517=24 -518=24 -519=24 -520=24 -521=24 -522=24 -523=24 -524=24 -525=24 -526=24 -527=24 -528=24 -529=24 -530=24 -531=24 -532=24 -533=24 -534=24 -535=24 -536=24 -537=24 -538=24 -539=24 -540=24 -541=24 -542=24 -543=24 -544=24 -545=24 -546=24 -547=24 -548=24 -549=24 -550=24 -551=24 -552=24 -553=24 -554=24 -555=24 -556=24 -557=24 -558=24 -559=24 -560=24 -561=24 -562=24 -563=24 -564=24 -565=24 -566=24 -567=24 -568=24 -569=24 -570=24 -571=24 -572=24 -573=24 -574=24 -575=24 -576=24 -577=24 -578=24 -579=24 -580=24 -581=24 -582=24 -583=24 -584=24 -585=24 -586=24 -587=24 -588=24 -589=24 -590=24 -591=24 -592=24 -593=24 -594=24 -595=24 -596=24 -597=24 -598=24 -599=24 -600=24 -601=24 -602=24 -603=24 -604=24 -605=24 -606=24 -607=24 -608=24 -609=24 -610=24 -611=24 -612=24 -613=24 -614=24 -615=24 -616=24 -617=24 -618=24 -619=24 -620=24 -621=24 -622=24 -623=24 -624=24 -625=24 -626=24 -627=24 -628=24 -629=24 -630=24 -631=24 -632=24 -633=24 -634=24 -635=24 -636=24 -637=24 -638=24 -639=24 -640=24 -641=24 -642=24 -643=24 -644=24 -645=24 -646=24 -647=24 -648=24 -649=24 -650=24 -651=24 -652=24 -653=24 -654=24 -655=24 -656=24 -657=24 -658=24 -659=24 -660=24 -661=24 -662=24 -663=24 -664=24 -665=24 -666=24 -667=24 -668=24 -669=24 -670=24 -671=24 -672=24 -673=24 -674=24 -675=24 -676=24 -677=24 -678=24 -679=24 -680=24 -681=24 -682=24 -683=24 -684=24 -685=24 -686=24 -687=24 -688=24 -689=24 -690=24 -691=24 -692=24 -693=24 -694=24 -695=24 -696=24 -697=24 -698=24 -699=24 -700=24 -701=24 -702=24 -703=24 -704=24 -705=24 -706=24 -707=24 -708=24 -709=24 -710=24 -711=24 -712=24 -713=24 -714=24 -715=24 -716=24 -717=24 -718=24 -719=24 -720=24 -721=24 -722=24 -723=24 -724=24 -725=24 -726=24 -727=24 -728=24 -729=24 -730=24 -731=24 -732=24 -733=24 -734=24 -735=24 -736=24 -737=24 -738=24 -739=24 -740=24 -741=24 -742=24 -743=24 -744=24 -745=24 -746=24 -747=24 -748=24 -749=24 -750=24 -751=24 -752=24 -753=24 -754=24 -755=24 -756=24 -757=24 -758=24 -759=24 -760=24 -761=24 -762=24 -763=24 -764=24 -765=24 -766=24 -767=24 -768=24 -769=24 -770=24 -771=24 -772=24 -773=24 -774=24 -775=24 -776=24 -777=24 -778=24 -779=24 -780=24 -781=24 -782=24 -783=24 -784=24 -785=24 -786=24 -787=24 -788=24 -789=24 -790=24 -791=24 -792=24 -793=24 -794=24 -795=24 -796=24 -797=24 -798=24 -799=24 -800=24 -801=24 -802=24 -803=24 -804=24 -805=24 -806=24 -807=24 -808=24 -809=24 -810=24 -811=24 -812=24 -813=24 -814=24 -815=24 -816=24 -817=24 -818=24 -819=24 -820=24 -821=24 -822=24 -823=24 -824=24 -825=24 -826=24 -827=24 -828=24 -829=24 -830=24 -831=24 -832=24 -833=24 -834=24 -835=24 -836=24 -837=24 -838=24 -839=24 -840=24 -841=24 -842=24 -843=24 -844=24 -845=24 -846=24 -847=24 -848=24 -849=24 -850=24 -851=24 -852=24 -853=24 -854=24 -855=24 -856=24 -857=24 -858=24 -859=24 -860=24 -861=24 -862=24 -863=24 -864=24 -865=24 -866=24 -867=24 -868=24 -869=24 -870=24 -871=24 -872=24 -873=24 -874=24 -875=24 -876=24 -877=24 -878=24 -879=24 -880=24 -881=24 -882=24 -883=24 -884=24 -885=24 -886=24 -887=24 -888=24 -889=24 -890=24 -891=24 -892=24 -893=24 -894=24 -895=24 -896=24 -897=24 -898=24 -899=24 -900=24 -901=24 -902=24 -903=24 -904=24 -905=24 -906=24 -907=24 -908=24 -909=24 -910=24 -911=24 -912=24 -913=24 -914=24 -915=24 -916=24 -917=24 -918=24 -919=24 -920=24 -921=24 -922=24 -923=24 -924=24 -925=24 -926=24 -927=24 -928=24 -929=24 -930=24 -931=24 -932=24 -933=24 -934=24 -935=24 -936=24 -937=24 -938=24 -939=24 -940=24 -941=24 -942=24 -943=24 -944=24 -945=24 -946=24 -947=24 -948=24 -949=24 -950=24 -951=24 -952=24 -953=24 -954=24 -955=24 -956=24 -957=24 -958=24 -959=24 -960=24 -961=24 -962=24 -963=24 -964=24 -965=24 -966=24 -967=24 -968=24 -969=24 -970=24 -971=24 -972=24 -973=24 -974=24 -975=24 -976=24 -977=24 -978=24 -979=24 -980=24 -981=24 -982=24 -983=24 -984=24 -985=24 -986=24 -987=24 -988=24 -989=24 -990=24 -991=24 -992=24 -993=24 -994=24 -995=24 -996=24 -997=24 -998=24 -999=24 -1000=24 -1001=24 -1002=24 -1003=24 -1004=24 -1005=24 -1006=24 -1007=24 -1008=24 -1009=24 -1010=24 -1011=24 -1012=24 -1013=24 -1014=24 -1015=24 -1016=24 -1017=24 -1018=24 -1019=24 - -[kanji-jis2] -Line 0=弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞 -Line 1=仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥 -Line 2=倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲僉僊 -Line 3=傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮 -Line 4=冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾 -Line 5=刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼 -Line 6=劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍 -Line 7=凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮 -Line 8=吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨咫哂咤咾咼哘 -Line 9=哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼 -Line 10=喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀 -Line 11=嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜 -Line 12=圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡 -Line 13=塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽 -Line 14=夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩奸妁妝佞侫妣妲姆姨姜 -Line 15=妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖 -Line 16=嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢 -Line 17=寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛 -Line 18=岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬 -Line 19=嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀 -Line 20=幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏廖廣廝廚廛廢廡廨廩廬廱廳廰廴 -Line 21=廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇 -Line 22=從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷 -Line 23=恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵 -Line 24=惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚 -Line 25=慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣 -Line 26=懶懺懴懿懽懼懾戀戈戉戍戌戔戛戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找 -Line 27=抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍 -Line 28=搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨 -Line 29=搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺 -Line 30=攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆 -Line 31=旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈 -Line 32=暎暉暄暘暝曁暹曉暾暼曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸 -Line 33=朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆 -Line 34=柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁 -Line 35=棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔 -Line 36=楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴 -Line 37=槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢 -Line 38=檐檍檠檄檢檣檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹 -Line 39=飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓 -Line 40=毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅 -Line 41=泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕 -Line 42=渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃 -Line 43=渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯 -Line 44=漲滌漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔 -Line 45=濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋 -Line 46=烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼 -Line 47=燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎 -Line 48=狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻 -Line 49=珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱瓠瓣 -Line 50=瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭 -Line 51=畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰 -Line 52=痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發 -Line 53=皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥 -Line 54=眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮 -Line 55=矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬磧磚磽磴礇礒 -Line 56=礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙 -Line 57=稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊 -Line 58=竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥 -Line 59=筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇 -Line 60=簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫 -Line 61=粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆紂紜紕紊絅絋紮紲紿紵 -Line 62=絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤 -Line 63=緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩 -Line 64=繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨 -Line 65=罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜 -Line 66=耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚 -Line 67=肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋隋腆脾腓腑胼腱腮腥腦腴膃膈膊 -Line 68=膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂 -Line 69=舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬 -Line 70=苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪 -Line 71=莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸 -Line 72=蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡 -Line 73=蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾 -Line 74=薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋 -Line 75=蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥 -Line 76=蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯 -Line 77=蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵 -Line 78=衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪 -Line 79=褫襁襄褻褶褸襌褝襠襞襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿 -Line 80=觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦 -Line 81=誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁 -Line 82=譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸 -Line 83=豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍 -Line 84=贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐 -Line 85=踟蹂踵踰踴蹊蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡 -Line 86=躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌 -Line 87=轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧 -Line 88=逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤 -Line 89=扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟 -Line 90=釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺 -Line 91=鍄錮錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓 -Line 92=鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘 -Line 93=閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞 -Line 94=陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎 -Line 95=霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐 -Line 96=鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰顱顴 -Line 97=顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌 -Line 98=饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍 -Line 99=驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚 -Line 100=鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆 -Line 101=鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾 -Line 102=鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈鵝鵞鵤鵑鵐鵙 -Line 103=鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁 -Line 104=麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽 -Line 105=鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙 - -0=24 -1=24 -2=24 -3=24 -4=24 -5=24 -6=24 -7=24 -8=24 -9=24 -10=24 -11=24 -12=24 -13=24 -14=24 -15=24 -16=24 -17=24 -18=24 -19=24 -20=24 -21=24 -22=24 -23=24 -24=24 -25=24 -26=24 -27=24 -28=24 -29=24 -30=24 -31=24 -32=24 -33=24 -34=24 -35=24 -36=24 -37=24 -38=24 -39=24 -40=24 -41=24 -42=24 -43=24 -44=24 -45=24 -46=24 -47=24 -48=24 -49=24 -50=24 -51=24 -52=24 -53=24 -54=24 -55=24 -56=24 -57=24 -58=24 -59=24 -60=24 -61=24 -62=24 -63=24 -64=24 -65=24 -66=24 -67=24 -68=24 -69=24 -70=24 -71=24 -72=24 -73=24 -74=24 -75=24 -76=24 -77=24 -78=24 -79=24 -80=24 -81=24 -82=24 -83=24 -84=24 -85=24 -86=24 -87=24 -88=24 -89=24 -90=24 -91=24 -92=24 -93=24 -94=24 -95=24 -96=24 -97=24 -98=24 -99=24 -100=24 -101=24 -102=24 -103=24 -104=24 -105=24 -106=24 -107=24 -108=24 -109=24 -110=24 -111=24 -112=24 -113=24 -114=24 -115=24 -116=24 -117=24 -118=24 -119=24 -120=24 -121=24 -122=24 -123=24 -124=24 -125=24 -126=24 -127=24 -128=24 -129=24 -130=24 -131=24 -132=24 -133=24 -134=24 -135=24 -136=24 -137=24 -138=24 -139=24 -140=24 -141=24 -142=24 -143=24 -144=24 -145=24 -146=24 -147=24 -148=24 -149=24 -150=24 -151=24 -152=24 -153=24 -154=24 -155=24 -156=24 -157=24 -158=24 -159=24 -160=24 -161=24 -162=24 -163=24 -164=24 -165=24 -166=24 -167=24 -168=24 -169=24 -170=24 -171=24 -172=24 -173=24 -174=24 -175=24 -176=24 -177=24 -178=24 -179=24 -180=24 -181=24 -182=24 -183=24 -184=24 -185=24 -186=24 -187=24 -188=24 -189=24 -190=24 -191=24 -192=24 -193=24 -194=24 -195=24 -196=24 -197=24 -198=24 -199=24 -200=24 -201=24 -202=24 -203=24 -204=24 -205=24 -206=24 -207=24 -208=24 -209=24 -210=24 -211=24 -212=24 -213=24 -214=24 -215=24 -216=24 -217=24 -218=24 -219=24 -220=24 -221=24 -222=24 -223=24 -224=24 -225=24 -226=24 -227=24 -228=24 -229=24 -230=24 -231=24 -232=24 -233=24 -234=24 -235=24 -236=24 -237=24 -238=24 -239=24 -240=24 -241=24 -242=24 -243=24 -244=24 -245=24 -246=24 -247=24 -248=24 -249=24 -250=24 -251=24 -252=24 -253=24 -254=24 -255=24 -256=24 -257=24 -258=24 -259=24 -260=24 -261=24 -262=24 -263=24 -264=24 -265=24 -266=24 -267=24 -268=24 -269=24 -270=24 -271=24 -272=24 -273=24 -274=24 -275=24 -276=24 -277=24 -278=24 -279=24 -280=24 -281=24 -282=24 -283=24 -284=24 -285=24 -286=24 -287=24 -288=24 -289=24 -290=24 -291=24 -292=24 -293=24 -294=24 -295=24 -296=24 -297=24 -298=24 -299=24 -300=24 -301=24 -302=24 -303=24 -304=24 -305=24 -306=24 -307=24 -308=24 -309=24 -310=24 -311=24 -312=24 -313=24 -314=24 -315=24 -316=24 -317=24 -318=24 -319=24 -320=24 -321=24 -322=24 -323=24 -324=24 -325=24 -326=24 -327=24 -328=24 -329=24 -330=24 -331=24 -332=24 -333=24 -334=24 -335=24 -336=24 -337=24 -338=24 -339=24 -340=24 -341=24 -342=24 -343=24 -344=24 -345=24 -346=24 -347=24 -348=24 -349=24 -350=24 -351=24 -352=24 -353=24 -354=24 -355=24 -356=24 -357=24 -358=24 -359=24 -360=24 -361=24 -362=24 -363=24 -364=24 -365=24 -366=24 -367=24 -368=24 -369=24 -370=24 -371=24 -372=24 -373=24 -374=24 -375=24 -376=24 -377=24 -378=24 -379=24 -380=24 -381=24 -382=24 -383=24 -384=24 -385=24 -386=24 -387=24 -388=24 -389=24 -390=24 -391=24 -392=24 -393=24 -394=24 -395=24 -396=24 -397=24 -398=24 -399=24 -400=24 -401=24 -402=24 -403=24 -404=24 -405=24 -406=24 -407=24 -408=24 -409=24 -410=24 -411=24 -412=24 -413=24 -414=24 -415=24 -416=24 -417=24 -418=24 -419=24 -420=24 -421=24 -422=24 -423=24 -424=24 -425=24 -426=24 -427=24 -428=24 -429=24 -430=24 -431=24 -432=24 -433=24 -434=24 -435=24 -436=24 -437=24 -438=24 -439=24 -440=24 -441=24 -442=24 -443=24 -444=24 -445=24 -446=24 -447=24 -448=24 -449=24 -450=24 -451=24 -452=24 -453=24 -454=24 -455=24 -456=24 -457=24 -458=24 -459=24 -460=24 -461=24 -462=24 -463=24 -464=24 -465=24 -466=24 -467=24 -468=24 -469=24 -470=24 -471=24 -472=24 -473=24 -474=24 -475=24 -476=24 -477=24 -478=24 -479=24 -480=24 -481=24 -482=24 -483=24 -484=24 -485=24 -486=24 -487=24 -488=24 -489=24 -490=24 -491=24 -492=24 -493=24 -494=24 -495=24 -496=24 -497=24 -498=24 -499=24 -500=24 -501=24 -502=24 -503=24 -504=24 -505=24 -506=24 -507=24 -508=24 -509=24 -510=24 -511=24 -512=24 -513=24 -514=24 -515=24 -516=24 -517=24 -518=24 -519=24 -520=24 -521=24 -522=24 -523=24 -524=24 -525=24 -526=24 -527=24 -528=24 -529=24 -530=24 -531=24 -532=24 -533=24 -534=24 -535=24 -536=24 -537=24 -538=24 -539=24 -540=24 -541=24 -542=24 -543=24 -544=24 -545=24 -546=24 -547=24 -548=24 -549=24 -550=24 -551=24 -552=24 -553=24 -554=24 -555=24 -556=24 -557=24 -558=24 -559=24 -560=24 -561=24 -562=24 -563=24 -564=24 -565=24 -566=24 -567=24 -568=24 -569=24 -570=24 -571=24 -572=24 -573=24 -574=24 -575=24 -576=24 -577=24 -578=24 -579=24 -580=24 -581=24 -582=24 -583=24 -584=24 -585=24 -586=24 -587=24 -588=24 -589=24 -590=24 -591=24 -592=24 -593=24 -594=24 -595=24 -596=24 -597=24 -598=24 -599=24 -600=24 -601=24 -602=24 -603=24 -604=24 -605=24 -606=24 -607=24 -608=24 -609=24 -610=24 -611=24 -612=24 -613=24 -614=24 -615=24 -616=24 -617=24 -618=24 -619=24 -620=24 -621=24 -622=24 -623=24 -624=24 -625=24 -626=24 -627=24 -628=24 -629=24 -630=24 -631=24 -632=24 -633=24 -634=24 -635=24 -636=24 -637=24 -638=24 -639=24 -640=24 -641=24 -642=24 -643=24 -644=24 -645=24 -646=24 -647=24 -648=24 -649=24 -650=24 -651=24 -652=24 -653=24 -654=24 -655=24 -656=24 -657=24 -658=24 -659=24 -660=24 -661=24 -662=24 -663=24 -664=24 -665=24 -666=24 -667=24 -668=24 -669=24 -670=24 -671=24 -672=24 -673=24 -674=24 -675=24 -676=24 -677=24 -678=24 -679=24 -680=24 -681=24 -682=24 -683=24 -684=24 -685=24 -686=24 -687=24 -688=24 -689=24 -690=24 -691=24 -692=24 -693=24 -694=24 -695=24 -696=24 -697=24 -698=24 -699=24 -700=24 -701=24 -702=24 -703=24 -704=24 -705=24 -706=24 -707=24 -708=24 -709=24 -710=24 -711=24 -712=24 -713=24 -714=24 -715=24 -716=24 -717=24 -718=24 -719=24 -720=24 -721=24 -722=24 -723=24 -724=24 -725=24 -726=24 -727=24 -728=24 -729=24 -730=24 -731=24 -732=24 -733=24 -734=24 -735=24 -736=24 -737=24 -738=24 -739=24 -740=24 -741=24 -742=24 -743=24 -744=24 -745=24 -746=24 -747=24 -748=24 -749=24 -750=24 -751=24 -752=24 -753=24 -754=24 -755=24 -756=24 -757=24 -758=24 -759=24 -760=24 -761=24 -762=24 -763=24 -764=24 -765=24 -766=24 -767=24 -768=24 -769=24 -770=24 -771=24 -772=24 -773=24 -774=24 -775=24 -776=24 -777=24 -778=24 -779=24 -780=24 -781=24 -782=24 -783=24 -784=24 -785=24 -786=24 -787=24 -788=24 -789=24 -790=24 -791=24 -792=24 -793=24 -794=24 -795=24 -796=24 -797=24 -798=24 -799=24 -800=24 -801=24 -802=24 -803=24 -804=24 -805=24 -806=24 -807=24 -808=24 -809=24 -810=24 -811=24 -812=24 -813=24 -814=24 -815=24 -816=24 -817=24 -818=24 -819=24 -820=24 -821=24 -822=24 -823=24 -824=24 -825=24 -826=24 -827=24 -828=24 -829=24 -830=24 -831=24 -832=24 -833=24 -834=24 -835=24 -836=24 -837=24 -838=24 -839=24 -840=24 -841=24 -842=24 -843=24 -844=24 -845=24 -846=24 -847=24 -848=24 -849=24 -850=24 -851=24 -852=24 -853=24 -854=24 -855=24 -856=24 -857=24 -858=24 -859=24 -860=24 -861=24 -862=24 -863=24 -864=24 -865=24 -866=24 -867=24 -868=24 -869=24 -870=24 -871=24 -872=24 -873=24 -874=24 -875=24 -876=24 -877=24 -878=24 -879=24 -880=24 -881=24 -882=24 -883=24 -884=24 -885=24 -886=24 -887=24 -888=24 -889=24 -890=24 -891=24 -892=24 -893=24 -894=24 -895=24 -896=24 -897=24 -898=24 -899=24 -900=24 -901=24 -902=24 -903=24 -904=24 -905=24 -906=24 -907=24 -908=24 -909=24 -910=24 -911=24 -912=24 -913=24 -914=24 -915=24 -916=24 -917=24 -918=24 -919=24 -920=24 -921=24 -922=24 -923=24 -924=24 -925=24 -926=24 -927=24 -928=24 -929=24 -930=24 -931=24 -932=24 -933=24 -934=24 -935=24 -936=24 -937=24 -938=24 -939=24 -940=24 -941=24 -942=24 -943=24 -944=24 -945=24 -946=24 -947=24 -948=24 -949=24 -950=24 -951=24 -952=24 -953=24 -954=24 -955=24 -956=24 -957=24 -958=24 -959=24 -960=24 -961=24 -962=24 -963=24 -964=24 -965=24 -966=24 -967=24 -968=24 -969=24 -970=24 -971=24 -972=24 -973=24 -974=24 -975=24 -976=24 -977=24 -978=24 -979=24 -980=24 -981=24 -982=24 -983=24 -984=24 -985=24 -986=24 -987=24 -988=24 -989=24 -990=24 -991=24 -992=24 -993=24 -994=24 -995=24 -996=24 -997=24 -998=24 -999=24 -1000=24 -1001=24 -1002=24 -1003=24 -1004=24 -1005=24 -1006=24 -1007=24 -1008=24 -1009=24 -1010=24 -1011=24 -1012=24 -1013=24 -1014=24 -1015=24 -1016=24 -1017=24 -1018=24 -1019=24 -1020=24 -1021=24 -1022=24 -1023=24 -1024=24 -1025=24 -1026=24 -1027=24 -1028=24 -1029=24 -1030=24 -1031=24 -1032=24 -1033=24 -1034=24 -1035=24 -1036=24 -1037=24 -1038=24 -1039=24 -1040=24 -1041=24 -1042=24 -1043=24 -1044=24 -1045=24 -1046=24 -1047=24 -1048=24 -1049=24 -1050=24 -1051=24 -1052=24 -1053=24 -1054=24 -1055=24 -1056=24 -1057=24 -1058=24 -1059=24 -1060=24 -1061=24 -1062=24 -1063=24 -1064=24 -1065=24 -1066=24 -1067=24 -1068=24 -1069=24 -1070=24 -1071=24 -1072=24 -1073=24 -1074=24 -1075=24 -1076=24 -1077=24 -1078=24 -1079=24 -1080=24 -1081=24 -1082=24 -1083=24 -1084=24 -1085=24 -1086=24 -1087=24 -1088=24 -1089=24 -1090=24 -1091=24 -1092=24 -1093=24 -1094=24 -1095=24 -1096=24 -1097=24 -1098=24 -1099=24 -1100=24 -1101=24 -1102=24 -1103=24 -1104=24 -1105=24 -1106=24 -1107=24 -1108=24 -1109=24 -1110=24 -1111=24 -1112=24 -1113=24 -1114=24 -1115=24 -1116=24 -1117=24 -1118=24 -1119=24 -1120=24 -1121=24 -1122=24 -1123=24 -1124=24 -1125=24 -1126=24 -1127=24 -1128=24 -1129=24 -1130=24 -1131=24 -1132=24 -1133=24 -1134=24 -1135=24 -1136=24 -1137=24 -1138=24 -1139=24 -1140=24 -1141=24 -1142=24 -1143=24 -1144=24 -1145=24 -1146=24 -1147=24 -1148=24 -1149=24 -1150=24 -1151=24 -1152=24 -1153=24 -1154=24 -1155=24 -1156=24 -1157=24 -1158=24 -1159=24 -1160=24 -1161=24 -1162=24 -1163=24 -1164=24 -1165=24 -1166=24 -1167=24 -1168=24 -1169=24 -1170=24 -1171=24 -1172=24 -1173=24 -1174=24 -1175=24 -1176=24 -1177=24 -1178=24 -1179=24 -1180=24 -1181=24 -1182=24 -1183=24 -1184=24 -1185=24 -1186=24 -1187=24 -1188=24 -1189=24 -1190=24 -1191=24 -1192=24 -1193=24 -1194=24 -1195=24 -1196=24 -1197=24 -1198=24 -1199=24 -1200=24 -1201=24 -1202=24 -1203=24 -1204=24 -1205=24 -1206=24 -1207=24 -1208=24 -1209=24 -1210=24 -1211=24 -1212=24 -1213=24 -1214=24 -1215=24 -1216=24 -1217=24 -1218=24 -1219=24 -1220=24 -1221=24 -1222=24 -1223=24 -1224=24 -1225=24 -1226=24 -1227=24 -1228=24 -1229=24 -1230=24 -1231=24 -1232=24 -1233=24 -1234=24 -1235=24 -1236=24 -1237=24 -1238=24 -1239=24 -1240=24 -1241=24 -1242=24 -1243=24 -1244=24 -1245=24 -1246=24 -1247=24 -1248=24 -1249=24 -1250=24 -1251=24 -1252=24 -1253=24 -1254=24 -1255=24 -1256=24 -1257=24 -1258=24 -1259=24 -1260=24 -1261=24 -1262=24 -1263=24 -1264=24 -1265=24 -1266=24 -1267=24 -1268=24 -1269=24 -1270=24 -1271=24 -1272=24 -1273=24 -1274=24 -1275=24 -1276=24 -1277=24 -1278=24 -1279=24 -1280=24 -1281=24 -1282=24 -1283=24 -1284=24 -1285=24 -1286=24 -1287=24 -1288=24 -1289=24 -1290=24 -1291=24 -1292=24 -1293=24 -1294=24 -1295=24 -1296=24 -1297=24 -1298=24 -1299=24 -1300=24 -1301=24 -1302=24 -1303=24 -1304=24 -1305=24 -1306=24 -1307=24 -1308=24 -1309=24 -1310=24 -1311=24 -1312=24 -1313=24 -1314=24 -1315=24 -1316=24 -1317=24 -1318=24 -1319=24 -1320=24 -1321=24 -1322=24 -1323=24 -1324=24 -1325=24 -1326=24 -1327=24 -1328=24 -1329=24 -1330=24 -1331=24 -1332=24 -1333=24 -1334=24 -1335=24 -1336=24 -1337=24 -1338=24 -1339=24 -1340=24 -1341=24 -1342=24 -1343=24 -1344=24 -1345=24 -1346=24 -1347=24 -1348=24 -1349=24 -1350=24 -1351=24 -1352=24 -1353=24 -1354=24 -1355=24 -1356=24 -1357=24 -1358=24 -1359=24 -1360=24 -1361=24 -1362=24 -1363=24 -1364=24 -1365=24 -1366=24 -1367=24 -1368=24 -1369=24 -1370=24 -1371=24 -1372=24 -1373=24 -1374=24 -1375=24 -1376=24 -1377=24 -1378=24 -1379=24 -1380=24 -1381=24 -1382=24 -1383=24 -1384=24 -1385=24 -1386=24 -1387=24 -1388=24 -1389=24 -1390=24 -1391=24 -1392=24 -1393=24 -1394=24 -1395=24 -1396=24 -1397=24 -1398=24 -1399=24 -1400=24 -1401=24 -1402=24 -1403=24 -1404=24 -1405=24 -1406=24 -1407=24 -1408=24 -1409=24 -1410=24 -1411=24 -1412=24 -1413=24 -1414=24 -1415=24 -1416=24 -1417=24 -1418=24 -1419=24 -1420=24 -1421=24 -1422=24 -1423=24 -1424=24 -1425=24 -1426=24 -1427=24 -1428=24 -1429=24 -1430=24 -1431=24 -1432=24 -1433=24 -1434=24 -1435=24 -1436=24 -1437=24 -1438=24 -1439=24 -1440=24 -1441=24 -1442=24 -1443=24 -1444=24 -1445=24 -1446=24 -1447=24 -1448=24 -1449=24 -1450=24 -1451=24 -1452=24 -1453=24 -1454=24 -1455=24 -1456=24 -1457=24 -1458=24 -1459=24 -1460=24 -1461=24 -1462=24 -1463=24 -1464=24 -1465=24 -1466=24 -1467=24 -1468=24 -1469=24 -1470=24 -1471=24 -1472=24 -1473=24 -1474=24 -1475=24 -1476=24 -1477=24 -1478=24 -1479=24 -1480=24 -1481=24 -1482=24 -1483=24 -1484=24 -1485=24 -1486=24 -1487=24 -1488=24 -1489=24 -1490=24 -1491=24 -1492=24 -1493=24 -1494=24 -1495=24 -1496=24 -1497=24 -1498=24 -1499=24 -1500=24 -1501=24 -1502=24 -1503=24 -1504=24 -1505=24 -1506=24 -1507=24 -1508=24 -1509=24 -1510=24 -1511=24 -1512=24 -1513=24 -1514=24 -1515=24 -1516=24 -1517=24 -1518=24 -1519=24 -1520=24 -1521=24 -1522=24 -1523=24 -1524=24 -1525=24 -1526=24 -1527=24 -1528=24 -1529=24 -1530=24 -1531=24 -1532=24 -1533=24 -1534=24 -1535=24 -1536=24 -1537=24 -1538=24 -1539=24 -1540=24 -1541=24 -1542=24 -1543=24 -1544=24 -1545=24 -1546=24 -1547=24 -1548=24 -1549=24 -1550=24 -1551=24 -1552=24 -1553=24 -1554=24 -1555=24 -1556=24 -1557=24 -1558=24 -1559=24 -1560=24 -1561=24 -1562=24 -1563=24 -1564=24 -1565=24 -1566=24 -1567=24 -1568=24 -1569=24 -1570=24 -1571=24 -1572=24 -1573=24 -1574=24 -1575=24 -1576=24 -1577=24 -1578=24 -1579=24 -1580=24 -1581=24 -1582=24 -1583=24 -1584=24 -1585=24 -1586=24 -1587=24 -1588=24 -1589=24 -1590=24 -1591=24 -1592=24 -1593=24 -1594=24 -1595=24 -1596=24 -1597=24 -1598=24 -1599=24 -1600=24 -1601=24 -1602=24 -1603=24 -1604=24 -1605=24 -1606=24 -1607=24 -1608=24 -1609=24 -1610=24 -1611=24 -1612=24 -1613=24 -1614=24 -1615=24 -1616=24 -1617=24 -1618=24 -1619=24 -1620=24 -1621=24 -1622=24 -1623=24 -1624=24 -1625=24 -1626=24 -1627=24 -1628=24 -1629=24 -1630=24 -1631=24 -1632=24 -1633=24 -1634=24 -1635=24 -1636=24 -1637=24 -1638=24 -1639=24 -1640=24 -1641=24 -1642=24 -1643=24 -1644=24 -1645=24 -1646=24 -1647=24 -1648=24 -1649=24 -1650=24 -1651=24 -1652=24 -1653=24 -1654=24 -1655=24 -1656=24 -1657=24 -1658=24 -1659=24 -1660=24 -1661=24 -1662=24 -1663=24 -1664=24 -1665=24 -1666=24 -1667=24 -1668=24 -1669=24 -1670=24 -1671=24 -1672=24 -1673=24 -1674=24 -1675=24 -1676=24 -1677=24 -1678=24 -1679=24 -1680=24 -1681=24 -1682=24 -1683=24 -1684=24 -1685=24 -1686=24 -1687=24 -1688=24 -1689=24 -1690=24 -1691=24 -1692=24 -1693=24 -1694=24 -1695=24 -1696=24 -1697=24 -1698=24 -1699=24 -1700=24 -1701=24 -1702=24 -1703=24 -1704=24 -1705=24 -1706=24 -1707=24 -1708=24 -1709=24 -1710=24 -1711=24 -1712=24 -1713=24 -1714=24 -1715=24 -1716=24 -1717=24 -1718=24 -1719=24 -1720=24 -1721=24 -1722=24 -1723=24 -1724=24 -1725=24 -1726=24 -1727=24 -1728=24 -1729=24 -1730=24 -1731=24 -1732=24 -1733=24 -1734=24 -1735=24 -1736=24 -1737=24 -1738=24 -1739=24 -1740=24 -1741=24 -1742=24 -1743=24 -1744=24 -1745=24 -1746=24 -1747=24 -1748=24 -1749=24 -1750=24 -1751=24 -1752=24 -1753=24 -1754=24 -1755=24 -1756=24 -1757=24 -1758=24 -1759=24 -1760=24 -1761=24 -1762=24 -1763=24 -1764=24 -1765=24 -1766=24 -1767=24 -1768=24 -1769=24 -1770=24 -1771=24 -1772=24 -1773=24 -1774=24 -1775=24 -1776=24 -1777=24 -1778=24 -1779=24 -1780=24 -1781=24 -1782=24 -1783=24 -1784=24 -1785=24 -1786=24 -1787=24 -1788=24 -1789=24 -1790=24 -1791=24 -1792=24 -1793=24 -1794=24 -1795=24 -1796=24 -1797=24 -1798=24 -1799=24 -1800=24 -1801=24 -1802=24 -1803=24 -1804=24 -1805=24 -1806=24 -1807=24 -1808=24 -1809=24 -1810=24 -1811=24 -1812=24 -1813=24 -1814=24 -1815=24 -1816=24 -1817=24 -1818=24 -1819=24 -1820=24 -1821=24 -1822=24 -1823=24 -1824=24 -1825=24 -1826=24 -1827=24 -1828=24 -1829=24 -1830=24 -1831=24 -1832=24 -1833=24 -1834=24 -1835=24 -1836=24 -1837=24 -1838=24 -1839=24 -1840=24 -1841=24 -1842=24 -1843=24 -1844=24 -1845=24 -1846=24 -1847=24 -1848=24 -1849=24 -1850=24 -1851=24 -1852=24 -1853=24 -1854=24 -1855=24 -1856=24 -1857=24 -1858=24 -1859=24 -1860=24 -1861=24 -1862=24 -1863=24 -1864=24 -1865=24 -1866=24 -1867=24 -1868=24 -1869=24 -1870=24 -1871=24 -1872=24 -1873=24 -1874=24 -1875=24 -1876=24 -1877=24 -1878=24 -1879=24 -1880=24 -1881=24 -1882=24 -1883=24 -1884=24 -1885=24 -1886=24 -1887=24 -1888=24 -1889=24 -1890=24 -1891=24 -1892=24 -1893=24 -1894=24 -1895=24 -1896=24 -1897=24 -1898=24 -1899=24 -1900=24 -1901=24 -1902=24 -1903=24 -1904=24 -1905=24 -1906=24 -1907=24 -1908=24 -1909=24 -1910=24 -1911=24 -1912=24 -1913=24 -1914=24 -1915=24 -1916=24 -1917=24 -1918=24 -1919=24 -1920=24 -1921=24 -1922=24 -1923=24 -1924=24 -1925=24 -1926=24 -1927=24 -1928=24 -1929=24 -1930=24 -1931=24 -1932=24 -1933=24 -1934=24 -1935=24 -1936=24 -1937=24 -1938=24 -1939=24 -1940=24 -1941=24 -1942=24 -1943=24 -1944=24 -1945=24 -1946=24 -1947=24 -1948=24 -1949=24 -1950=24 -1951=24 -1952=24 -1953=24 -1954=24 -1955=24 -1956=24 -1957=24 -1958=24 -1959=24 -1960=24 -1961=24 -1962=24 -1963=24 -1964=24 -1965=24 -1966=24 -1967=24 -1968=24 -1969=24 -1970=24 -1971=24 -1972=24 -1973=24 -1974=24 -1975=24 -1976=24 -1977=24 -1978=24 -1979=24 -1980=24 -1981=24 -1982=24 -1983=24 -1984=24 -1985=24 -1986=24 -1987=24 -1988=24 -1989=24 -1990=24 -1991=24 -1992=24 -1993=24 -1994=24 -1995=24 -1996=24 -1997=24 -1998=24 -1999=24 -2000=24 -2001=24 -2002=24 -2003=24 -2004=24 -2005=24 -2006=24 -2007=24 -2008=24 -2009=24 -2010=24 -2011=24 -2012=24 -2013=24 -2014=24 -2015=24 -2016=24 -2017=24 -2018=24 -2019=24 -2020=24 -2021=24 -2022=24 -2023=24 -2024=24 -2025=24 -2026=24 -2027=24 -2028=24 -2029=24 -2030=24 -2031=24 -2032=24 -2033=24 -2034=24 -2035=24 -2036=24 -2037=24 -2038=24 -2039=24 -2040=24 -2041=24 -2042=24 -2043=24 -2044=24 -2045=24 -2046=24 -2047=24 -2048=24 -2049=24 -2050=24 -2051=24 -2052=24 -2053=24 -2054=24 -2055=24 -2056=24 -2057=24 -2058=24 -2059=24 -2060=24 -2061=24 -2062=24 -2063=24 -2064=24 -2065=24 -2066=24 -2067=24 -2068=24 -2069=24 -2070=24 -2071=24 -2072=24 -2073=24 -2074=24 -2075=24 -2076=24 -2077=24 -2078=24 -2079=24 -2080=24 -2081=24 -2082=24 -2083=24 -2084=24 -2085=24 -2086=24 -2087=24 -2088=24 -2089=24 -2090=24 -2091=24 -2092=24 -2093=24 -2094=24 -2095=24 -2096=24 -2097=24 -2098=24 -2099=24 -2100=24 -2101=24 -2102=24 -2103=24 -2104=24 -2105=24 -2106=24 -2107=24 -2108=24 -2109=24 -2110=24 -2111=24 -2112=24 -2113=24 -2114=24 -2115=24 -2116=24 -2117=24 -2118=24 -2119=24 -2120=24 -2121=24 -2122=24 -2123=24 -2124=24 -2125=24 -2126=24 -2127=24 -2128=24 -2129=24 -2130=24 -2131=24 -2132=24 -2133=24 -2134=24 -2135=24 -2136=24 -2137=24 -2138=24 -2139=24 -2140=24 -2141=24 -2142=24 -2143=24 -2144=24 -2145=24 -2146=24 -2147=24 -2148=24 -2149=24 -2150=24 -2151=24 -2152=24 -2153=24 -2154=24 -2155=24 -2156=24 -2157=24 -2158=24 -2159=24 -2160=24 -2161=24 -2162=24 -2163=24 -2164=24 -2165=24 -2166=24 -2167=24 -2168=24 -2169=24 -2170=24 -2171=24 -2172=24 -2173=24 -2174=24 -2175=24 -2176=24 -2177=24 -2178=24 -2179=24 -2180=24 -2181=24 -2182=24 -2183=24 -2184=24 -2185=24 -2186=24 -2187=24 -2188=24 -2189=24 -2190=24 -2191=24 -2192=24 -2193=24 -2194=24 -2195=24 -2196=24 -2197=24 -2198=24 -2199=24 -2200=24 -2201=24 -2202=24 -2203=24 -2204=24 -2205=24 -2206=24 -2207=24 -2208=24 -2209=24 -2210=24 -2211=24 -2212=24 -2213=24 -2214=24 -2215=24 -2216=24 -2217=24 -2218=24 -2219=24 -2220=24 -2221=24 -2222=24 -2223=24 -2224=24 -2225=24 -2226=24 -2227=24 -2228=24 -2229=24 -2230=24 -2231=24 -2232=24 -2233=24 -2234=24 -2235=24 -2236=24 -2237=24 -2238=24 -2239=24 -2240=24 -2241=24 -2242=24 -2243=24 -2244=24 -2245=24 -2246=24 -2247=24 -2248=24 -2249=24 -2250=24 -2251=24 -2252=24 -2253=24 -2254=24 -2255=24 -2256=24 -2257=24 -2258=24 -2259=24 -2260=24 -2261=24 -2262=24 -2263=24 -2264=24 -2265=24 -2266=24 -2267=24 -2268=24 -2269=24 -2270=24 -2271=24 -2272=24 -2273=24 -2274=24 -2275=24 -2276=24 -2277=24 -2278=24 -2279=24 -2280=24 -2281=24 -2282=24 -2283=24 -2284=24 -2285=24 -2286=24 -2287=24 -2288=24 -2289=24 -2290=24 -2291=24 -2292=24 -2293=24 -2294=24 -2295=24 -2296=24 -2297=24 -2298=24 -2299=24 -2300=24 -2301=24 -2302=24 -2303=24 -2304=24 -2305=24 -2306=24 -2307=24 -2308=24 -2309=24 -2310=24 -2311=24 -2312=24 -2313=24 -2314=24 -2315=24 -2316=24 -2317=24 -2318=24 -2319=24 -2320=24 -2321=24 -2322=24 -2323=24 -2324=24 -2325=24 -2326=24 -2327=24 -2328=24 -2329=24 -2330=24 -2331=24 -2332=24 -2333=24 -2334=24 -2335=24 -2336=24 -2337=24 -2338=24 -2339=24 -2340=24 -2341=24 -2342=24 -2343=24 -2344=24 -2345=24 -2346=24 -2347=24 -2348=24 -2349=24 -2350=24 -2351=24 -2352=24 -2353=24 -2354=24 -2355=24 -2356=24 -2357=24 -2358=24 -2359=24 -2360=24 -2361=24 -2362=24 -2363=24 -2364=24 -2365=24 -2366=24 -2367=24 -2368=24 -2369=24 -2370=24 -2371=24 -2372=24 -2373=24 -2374=24 -2375=24 -2376=24 -2377=24 -2378=24 -2379=24 -2380=24 -2381=24 -2382=24 -2383=24 -2384=24 -2385=24 -2386=24 -2387=24 -2388=24 -2389=24 -2390=24 -2391=24 -2392=24 -2393=24 -2394=24 -2395=24 -2396=24 -2397=24 -2398=24 -2399=24 -2400=24 -2401=24 -2402=24 -2403=24 -2404=24 -2405=24 -2406=24 -2407=24 -2408=24 -2409=24 -2410=24 -2411=24 -2412=24 -2413=24 -2414=24 -2415=24 -2416=24 -2417=24 -2418=24 -2419=24 -2420=24 -2421=24 -2422=24 -2423=24 -2424=24 -2425=24 -2426=24 -2427=24 -2428=24 -2429=24 -2430=24 -2431=24 -2432=24 -2433=24 -2434=24 -2435=24 -2436=24 -2437=24 -2438=24 -2439=24 -2440=24 -2441=24 -2442=24 -2443=24 -2444=24 -2445=24 -2446=24 -2447=24 -2448=24 -2449=24 -2450=24 -2451=24 -2452=24 -2453=24 -2454=24 -2455=24 -2456=24 -2457=24 -2458=24 -2459=24 -2460=24 -2461=24 -2462=24 -2463=24 -2464=24 -2465=24 -2466=24 -2467=24 -2468=24 -2469=24 -2470=24 -2471=24 -2472=24 -2473=24 -2474=24 -2475=24 -2476=24 -2477=24 -2478=24 -2479=24 -2480=24 -2481=24 -2482=24 -2483=24 -2484=24 -2485=24 -2486=24 -2487=24 -2488=24 -2489=24 -2490=24 -2491=24 -2492=24 -2493=24 -2494=24 -2495=24 -2496=24 -2497=24 -2498=24 -2499=24 -2500=24 -2501=24 -2502=24 -2503=24 -2504=24 -2505=24 -2506=24 -2507=24 -2508=24 -2509=24 -2510=24 -2511=24 -2512=24 -2513=24 -2514=24 -2515=24 -2516=24 -2517=24 -2518=24 -2519=24 -2520=24 -2521=24 -2522=24 -2523=24 -2524=24 -2525=24 -2526=24 -2527=24 -2528=24 -2529=24 -2530=24 -2531=24 -2532=24 -2533=24 -2534=24 -2535=24 -2536=24 -2537=24 -2538=24 -2539=24 -2540=24 -2541=24 -2542=24 -2543=24 -2544=24 -2545=24 -2546=24 -2547=24 -2548=24 -2549=24 -2550=24 -2551=24 -2552=24 -2553=24 -2554=24 -2555=24 -2556=24 -2557=24 -2558=24 -2559=24 -2560=24 -2561=24 -2562=24 -2563=24 -2564=24 -2565=24 -2566=24 -2567=24 -2568=24 -2569=24 -2570=24 -2571=24 -2572=24 -2573=24 -2574=24 -2575=24 -2576=24 -2577=24 -2578=24 -2579=24 -2580=24 -2581=24 -2582=24 -2583=24 -2584=24 -2585=24 -2586=24 -2587=24 -2588=24 -2589=24 -2590=24 -2591=24 -2592=24 -2593=24 -2594=24 -2595=24 -2596=24 -2597=24 -2598=24 -2599=24 -2600=24 -2601=24 -2602=24 -2603=24 -2604=24 -2605=24 -2606=24 -2607=24 -2608=24 -2609=24 -2610=24 -2611=24 -2612=24 -2613=24 -2614=24 -2615=24 -2616=24 -2617=24 -2618=24 -2619=24 -2620=24 -2621=24 -2622=24 -2623=24 -2624=24 -2625=24 -2626=24 -2627=24 -2628=24 -2629=24 -2630=24 -2631=24 -2632=24 -2633=24 -2634=24 -2635=24 -2636=24 -2637=24 -2638=24 -2639=24 -2640=24 -2641=24 -2642=24 -2643=24 -2644=24 -2645=24 -2646=24 -2647=24 -2648=24 -2649=24 -2650=24 -2651=24 -2652=24 -2653=24 -2654=24 -2655=24 -2656=24 -2657=24 -2658=24 -2659=24 -2660=24 -2661=24 -2662=24 -2663=24 -2664=24 -2665=24 -2666=24 -2667=24 -2668=24 -2669=24 -2670=24 -2671=24 -2672=24 -2673=24 -2674=24 -2675=24 -2676=24 -2677=24 -2678=24 -2679=24 -2680=24 -2681=24 -2682=24 -2683=24 -2684=24 -2685=24 -2686=24 -2687=24 -2688=24 -2689=24 -2690=24 -2691=24 -2692=24 -2693=24 -2694=24 -2695=24 -2696=24 -2697=24 -2698=24 -2699=24 -2700=24 -2701=24 -2702=24 -2703=24 -2704=24 -2705=24 -2706=24 -2707=24 -2708=24 -2709=24 -2710=24 -2711=24 -2712=24 -2713=24 -2714=24 -2715=24 -2716=24 -2717=24 -2718=24 -2719=24 -2720=24 -2721=24 -2722=24 -2723=24 -2724=24 -2725=24 -2726=24 -2727=24 -2728=24 -2729=24 -2730=24 -2731=24 -2732=24 -2733=24 -2734=24 -2735=24 -2736=24 -2737=24 -2738=24 -2739=24 -2740=24 -2741=24 -2742=24 -2743=24 -2744=24 -2745=24 -2746=24 -2747=24 -2748=24 -2749=24 -2750=24 -2751=24 -2752=24 -2753=24 -2754=24 -2755=24 -2756=24 -2757=24 -2758=24 -2759=24 -2760=24 -2761=24 -2762=24 -2763=24 -2764=24 -2765=24 -2766=24 -2767=24 -2768=24 -2769=24 -2770=24 -2771=24 -2772=24 -2773=24 -2774=24 -2775=24 -2776=24 -2777=24 -2778=24 -2779=24 -2780=24 -2781=24 -2782=24 -2783=24 -2784=24 -2785=24 -2786=24 -2787=24 -2788=24 -2789=24 -2790=24 -2791=24 -2792=24 -2793=24 -2794=24 -2795=24 -2796=24 -2797=24 -2798=24 -2799=24 -2800=24 -2801=24 -2802=24 -2803=24 -2804=24 -2805=24 -2806=24 -2807=24 -2808=24 -2809=24 -2810=24 -2811=24 -2812=24 -2813=24 -2814=24 -2815=24 -2816=24 -2817=24 -2818=24 -2819=24 -2820=24 -2821=24 -2822=24 -2823=24 -2824=24 -2825=24 -2826=24 -2827=24 -2828=24 -2829=24 -2830=24 -2831=24 -2832=24 -2833=24 -2834=24 -2835=24 -2836=24 -2837=24 -2838=24 -2839=24 -2840=24 -2841=24 -2842=24 -2843=24 -2844=24 -2845=24 -2846=24 -2847=24 -2848=24 -2849=24 -2850=24 -2851=24 -2852=24 -2853=24 -2854=24 -2855=24 -2856=24 -2857=24 -2858=24 -2859=24 -2860=24 -2861=24 -2862=24 -2863=24 -2864=24 -2865=24 -2866=24 -2867=24 -2868=24 -2869=24 -2870=24 -2871=24 -2872=24 -2873=24 -2874=24 -2875=24 -2876=24 -2877=24 -2878=24 -2879=24 -2880=24 -2881=24 -2882=24 -2883=24 -2884=24 -2885=24 -2886=24 -2887=24 -2888=24 -2889=24 -2890=24 -2891=24 -2892=24 -2893=24 -2894=24 -2895=24 -2896=24 -2897=24 -2898=24 -2899=24 -2900=24 -2901=24 -2902=24 -2903=24 -2904=24 -2905=24 -2906=24 -2907=24 -2908=24 -2909=24 -2910=24 -2911=24 -2912=24 -2913=24 -2914=24 -2915=24 -2916=24 -2917=24 -2918=24 -2919=24 -2920=24 -2921=24 -2922=24 -2923=24 -2924=24 -2925=24 -2926=24 -2927=24 -2928=24 -2929=24 -2930=24 -2931=24 -2932=24 -2933=24 -2934=24 -2935=24 -2936=24 -2937=24 -2938=24 -2939=24 -2940=24 -2941=24 -2942=24 -2943=24 -2944=24 -2945=24 -2946=24 -2947=24 -2948=24 -2949=24 -2950=24 -2951=24 -2952=24 -2953=24 -2954=24 -2955=24 -2956=24 -2957=24 -2958=24 -2959=24 -2960=24 -2961=24 -2962=24 -2963=24 -2964=24 -2965=24 -2966=24 -2967=24 -2968=24 -2969=24 -2970=24 -2971=24 -2972=24 -2973=24 -2974=24 -2975=24 -2976=24 -2977=24 -2978=24 -2979=24 -2980=24 -2981=24 -2982=24 -2983=24 -2984=24 -2985=24 -2986=24 -2987=24 -2988=24 -2989=24 -2990=24 -2991=24 -2992=24 -2993=24 -2994=24 -2995=24 -2996=24 -2997=24 -2998=24 -2999=24 -3000=24 -3001=24 -3002=24 -3003=24 -3004=24 -3005=24 -3006=24 -3007=24 -3008=24 -3009=24 -3010=24 -3011=24 -3012=24 -3013=24 -3014=24 -3015=24 -3016=24 -3017=24 -3018=24 -3019=24 -3020=24 -3021=24 -3022=24 -3023=24 -3024=24 -3025=24 -3026=24 -3027=24 -3028=24 -3029=24 -3030=24 -3031=24 -3032=24 -3033=24 -3034=24 -3035=24 -3036=24 -3037=24 -3038=24 -3039=24 -3040=24 -3041=24 -3042=24 -3043=24 -3044=24 -3045=24 -3046=24 -3047=24 -3048=24 -3049=24 -3050=24 -3051=24 -3052=24 -3053=24 -3054=24 -3055=24 -3056=24 -3057=24 -3058=24 -3059=24 -3060=24 -3061=24 -3062=24 -3063=24 -3064=24 -3065=24 -3066=24 -3067=24 -3068=24 -3069=24 -3070=24 -3071=24 -3072=24 -3073=24 -3074=24 -3075=24 -3076=24 -3077=24 -3078=24 -3079=24 -3080=24 -3081=24 -3082=24 -3083=24 -3084=24 -3085=24 -3086=24 -3087=24 -3088=24 -3089=24 -3090=24 -3091=24 -3092=24 -3093=24 -3094=24 -3095=24 -3096=24 -3097=24 -3098=24 -3099=24 -3100=24 -3101=24 -3102=24 -3103=24 -3104=24 -3105=24 -3106=24 -3107=24 -3108=24 -3109=24 -3110=24 -3111=24 -3112=24 -3113=24 -3114=24 -3115=24 -3116=24 -3117=24 -3118=24 -3119=24 -3120=24 -3121=24 -3122=24 -3123=24 -3124=24 -3125=24 -3126=24 -3127=24 -3128=24 -3129=24 -3130=24 -3131=24 -3132=24 -3133=24 -3134=24 -3135=24 -3136=24 -3137=24 -3138=24 -3139=24 -3140=24 -3141=24 -3142=24 -3143=24 -3144=24 -3145=24 -3146=24 -3147=24 -3148=24 -3149=24 -3150=24 -3151=24 -3152=24 -3153=24 -3154=24 -3155=24 -3156=24 -3157=24 -3158=24 -3159=24 -3160=24 -3161=24 -3162=24 -3163=24 -3164=24 -3165=24 -3166=24 -3167=24 -3168=24 -3169=24 -3170=24 -3171=24 -3172=24 -3173=24 -3174=24 -3175=24 -3176=24 -3177=24 -3178=24 -3179=24 -3180=24 -3181=24 -3182=24 -3183=24 -3184=24 -3185=24 -3186=24 -3187=24 -3188=24 -3189=24 -3190=24 -3191=24 -3192=24 -3193=24 -3194=24 -3195=24 -3196=24 -3197=24 -3198=24 -3199=24 -3200=24 -3201=24 -3202=24 -3203=24 -3204=24 -3205=24 -3206=24 -3207=24 -3208=24 -3209=24 -3210=24 -3211=24 -3212=24 -3213=24 -3214=24 -3215=24 -3216=24 -3217=24 -3218=24 -3219=24 -3220=24 -3221=24 -3222=24 -3223=24 -3224=24 -3225=24 -3226=24 -3227=24 -3228=24 -3229=24 -3230=24 -3231=24 -3232=24 -3233=24 -3234=24 -3235=24 -3236=24 -3237=24 -3238=24 -3239=24 -3240=24 -3241=24 -3242=24 -3243=24 -3244=24 -3245=24 -3246=24 -3247=24 -3248=24 -3249=24 -3250=24 -3251=24 -3252=24 -3253=24 -3254=24 -3255=24 -3256=24 -3257=24 -3258=24 -3259=24 -3260=24 -3261=24 -3262=24 -3263=24 -3264=24 -3265=24 -3266=24 -3267=24 -3268=24 -3269=24 -3270=24 -3271=24 -3272=24 -3273=24 -3274=24 -3275=24 -3276=24 -3277=24 -3278=24 -3279=24 -3280=24 -3281=24 -3282=24 -3283=24 -3284=24 -3285=24 -3286=24 -3287=24 -3288=24 -3289=24 -3290=24 -3291=24 -3292=24 -3293=24 -3294=24 -3295=24 -3296=24 -3297=24 -3298=24 -3299=24 -3300=24 -3301=24 -3302=24 -3303=24 -3304=24 -3305=24 -3306=24 -3307=24 -3308=24 -3309=24 -3310=24 -3311=24 -3312=24 -3313=24 -3314=24 -3315=24 -3316=24 -3317=24 -3318=24 -3319=24 -3320=24 -3321=24 -3322=24 -3323=24 -3324=24 -3325=24 -3326=24 -3327=24 -3328=24 -3329=24 -3330=24 -3331=24 -3332=24 -3333=24 -3334=24 -3335=24 -3336=24 -3337=24 -3338=24 -3339=24 -3340=24 -3341=24 -3342=24 -3343=24 -3344=24 -3345=24 -3346=24 -3347=24 -3348=24 -3349=24 -3350=24 -3351=24 -3352=24 -3353=24 -3354=24 -3355=24 -3356=24 -3357=24 -3358=24 -3359=24 -3360=24 -3361=24 -3362=24 -3363=24 -3364=24 -3365=24 -3366=24 -3367=24 -3368=24 -3369=24 -3370=24 -3371=24 -3372=24 -3373=24 -3374=24 -3375=24 -3376=24 -3377=24 -3378=24 -3379=24 -3380=24 -3381=24 -3382=24 -3383=24 -3384=24 -3385=24 -3386=24 -3387=24 -3388=24 -3389=24 +[common] +Baseline=26 +Top=10 +LineSpacing=33 +DrawExtraPixelsLeft=3 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 + +[main] +import=_game chars 16px +range basic-japanese=0 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=9 +34=9 +35=9 +36=9 +37=9 +38=9 +39=9 +40=9 +41=9 +42=9 +43=9 +44=9 +45=9 +46=9 +47=9 +48=9 +49=9 +50=9 +51=24 +52=24 +53=24 +54=24 +55=9 +56=9 +57=9 +58=9 +59=9 +60=9 +61=9 +62=9 +63=9 +64=9 +65=24 +66=24 +67=24 +68=24 +69=24 +70=24 +71=24 +72=24 +73=24 +74=24 +75=24 +76=24 +77=24 +78=24 +79=24 +80=24 +81=24 +82=24 +83=24 +84=24 +85=24 +86=24 +87=24 +88=24 +89=24 +90=24 +91=24 +92=24 +93=24 +94=24 +95=24 +96=24 +97=24 +98=24 +99=24 +100=24 +101=24 +102=24 +103=24 +104=24 +105=24 +106=24 +107=24 +108=24 +109=24 +110=24 +111=24 +112=24 +113=24 +114=24 +115=24 +116=24 +117=24 +118=24 +119=24 +120=24 +121=24 +122=24 +123=24 +124=24 +125=24 +126=24 +127=24 +128=24 +129=24 +130=24 +131=24 +132=24 +133=24 +134=24 +135=24 +136=24 +137=24 +138=24 +139=24 +140=24 +141=24 +142=24 +143=24 +144=24 +145=24 +146=24 +147=24 +148=24 +149=24 +150=24 +151=9 +152=9 +153=0 +154=0 +155=0 +156=0 +157=24 +158=24 +159=24 +160=9 +161=24 +162=24 +163=24 +164=24 +165=24 +166=24 +167=24 +168=24 +169=24 +170=24 +171=24 +172=24 +173=24 +174=24 +175=24 +176=24 +177=24 +178=24 +179=24 +180=24 +181=24 +182=24 +183=24 +184=24 +185=24 +186=24 +187=24 +188=24 +189=24 +190=24 +191=24 +192=24 +193=24 +194=24 +195=24 +196=24 +197=24 +198=24 +199=24 +200=24 +201=24 +202=24 +203=24 +204=24 +205=24 +206=24 +207=24 +208=24 +209=24 +210=24 +211=24 +212=24 +213=24 +214=24 +215=24 +216=24 +217=24 +218=24 +219=24 +220=24 +221=24 +222=24 +223=24 +224=24 +225=24 +226=24 +227=24 +228=24 +229=24 +230=24 +231=24 +232=24 +233=24 +234=24 +235=24 +236=24 +237=24 +238=24 +239=24 +240=24 +241=24 +242=24 +243=24 +244=24 +245=24 +246=24 +247=24 +248=24 +249=24 +250=24 +251=24 +252=24 +253=24 +254=24 +255=9 + +[kanji 1] +Line 0=難易定変更押画曲 +Line 1=現在選択項目同設 +Line 2=開閉内覧表示詳細 +Line 3=及作矢印場警告可 +Line 4=能性処理速数値超 +Line 5=効使特固省略出詞 +Line 6=操全演奏進点機移 +Line 7=左右変更以外背景 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 2] +Line 0=義背景危険状態習 +Line 1=譜判減少率適増加 +Line 2=無終了関係参考他 +Line 3=言変換評価条件突 +Line 4=事追不切常除次等 +Line 5=低戻厳残基途非制 +Line 6=限配保存秒反応専 +Line 7=誤防整央隠僕援起 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 3] +Line 0=相撲屋何穴名例匂 +Line 1=心揺鼻当腹鳴痢便 +Line 2=尻拭鋼雫暗黒迷路 +Line 3=探検前員浮駐接続 +Line 4=類士諸君品物困声 +Line 5=口調食党結婚身久 +Line 6=友電話廃休酒飲引 +Line 7=篭奴学職手葉宿馬 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 4] +Line 0=京宿浪暮横巣鴨優 +Line 1=居思手線回続分然 +Line 2=取達聴最字辞書独 +Line 3=季節俺正対街町渋 +Line 4=姿笑隣病院開頂科 +Line 5=先眞弓沢氷恭国耳 +Line 6=今逝元予報分秘密 +Line 7=物罰望峰巫工業社 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 5] +Line 0=~φ∞:堂妹瀬川 +Line 1=飛巻機山條浦森員 +Line 2=同清水座勉強集合 +Line 3=急止出内則世界秒 +Line 4=数徳香百千葉紗静 +Line 5=星米尋慎吾岡竹梨 +Line 6=柴矢魍魎遊撃隊里 +Line 7=賀玲福芳 + +0=24 +1=12 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 + +[kanji 6] +Line 0=島礼戸桃麦仁智赤 +Line 1=車歌知華王先行者 +Line 2=願愛唄結婚素直陽 +Line 3=宇宙海賊冒険門外 +Line 4=早重番際通再像鮮 +Line 5=量必要種待具質消 +Line 6=去宮計算降象忘漕 +Line 7=滅問船乗旅確過壊 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 7] +Line 0=深都築鍋行脚獣登 +Line 1=雨始約束所虹彩澄 +Line 2=頃年巡交幼供年詰 +Line 3=草誓孤詩意味排溝 +Line 4=刻付良走我謳的支 +Line 5=台匹東薄味噌抜汁 +Line 6=役熊惚片持校受験 +Line 7=聞競争激為懸格白 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 8] +Line 0=余答発寂卒親孝立 +Line 1=派局縁詮滑拝喜毀 +Line 2=干懲号敗堪絶指仕 +Line 3=胆些細慢首傾己主 +Line 4=振返微妙雷塩幽霊 +Line 5=楽団遠捨苦感威散 +Line 6=賭摩李夫舞鷺須雲 +Line 7=流誰転留駄源教呼 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 + +[kanji 9] +Line 0=逆足練違照帽半距 +Line 1=離弟脇兄完璧救誘 +Line 2=拐技踏雪越緑押赫 +Line 3=染御嫌糞医療査鑑 +Line 4=賞編削領向段階殊 +Line 5=果級向腕透前復位 +Line 6=唱青顔叫描殿掃戯 +Line 7=怖底河祝匁宝暦 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 + +[symbol] +Line 0=&()?!/‥^…@$#”+=¥;<>・「」{}%* +Line 1=abcdefghijklmnopqrstyvwxyz +Line 2=ABCDEFGHIJKLMNOPQRSTYVWXYZ + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 +64=24 +65=24 +66=24 +67=24 +68=24 +69=24 +70=24 +71=24 +72=24 +73=24 +74=24 +75=24 +76=24 +77=24 + +[kanji-regular] +Line 0=亜哀愛悪握圧扱安暗案以位依偉囲委威尉意慰易為異移維緯胃衣違遺医井 +Line 1=域育一壱逸稲芋印員因姻引飲院陰隠韻右宇羽雨渦浦運雲営影映栄永泳英 +Line 2=衛詠鋭液疫益駅悦謁越閲円園宴延援沿演炎煙猿縁遠鉛塩汚凹央奥往応押 +Line 3=横欧殴王翁黄沖億屋憶乙卸恩温穏音下化仮何価佳加可夏嫁家寡科暇果架 +Line 4=歌河火禍稼箇花荷華菓課貨過蚊我画芽賀雅餓介会解回塊壊快怪悔懐戒拐 +Line 5=改械海灰界皆絵開階貝劾外害慨概涯街該垣嚇各拡格核殻獲確穫覚角較郭 +Line 6=閣隔革学岳楽額掛潟割喝括活渇滑褐轄且株刈乾冠寒刊勘勧巻喚堪完官寛 +Line 7=干幹患感慣憾換敢棺款歓汗漢環甘監看管簡緩缶肝艦観貫還鑑間閑関陥館 +Line 8=丸含岸眼岩頑顔願企危喜器基奇寄岐希幾忌揮机旗既期棋棄機帰気汽祈季 +Line 9=紀規記貴起軌輝飢騎鬼偽儀宜戯技擬欺犠疑義議菊吉喫詰却客脚虐逆丘久 +Line 10=休及吸宮弓急救朽求泣球究窮級糾給旧牛去居巨拒拠挙虚許距漁魚享京供 +Line 11=競共凶協叫境峡強恐恭挟教橋況狂狭矯胸脅興郷鏡響驚仰凝暁業局曲極玉 +Line 12=勤均斤琴禁筋緊菌襟謹近金吟銀九句区苦駆具愚虞空偶遇隅屈掘靴繰桑勲 +Line 13=君薫訓群軍郡係傾刑兄啓型契形径恵慶憩掲携敬景渓系経継茎蛍計警軽鶏 +Line 14=芸迎鯨劇撃激傑欠決潔穴結血月件倹健兼券剣圏堅嫌建憲懸検権犬献研絹 +Line 15=県肩見謙賢軒遣険顕験元原厳幻弦減源玄現言限個古呼固孤己庫弧戸故枯 +Line 16=湖誇雇顧鼓五互午呉娯後御悟碁語誤護交侯候光公功効厚口向后坑好孔孝 +Line 17=工巧幸広康恒慌抗拘控攻更校構江洪港溝甲皇硬稿紅絞綱耕考肯航荒行衡 +Line 18=講貢購郊酵鉱鋼降項香高剛号合拷豪克刻告国穀酷黒獄腰骨込今困墾婚恨 +Line 19=懇昆根混紺魂佐唆左差査砂詐鎖座債催再最妻宰彩才採栽歳済災砕祭斎細 +Line 20=菜裁載際剤在材罪財坂咲崎作削搾昨策索錯桜冊刷察撮擦札殺雑皿三傘参 +Line 21=山惨散桟産算蚕賛酸暫残仕伺使刺司史嗣四士始姉姿子市師志思指支施旨 +Line 22=枝止死氏祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時 +Line 23=次滋治璽磁示耳自辞式識軸七執失室湿漆疾質実芝舎写射捨赦斜煮社者謝 +Line 24=車遮蛇邪借勺尺爵酌釈若寂弱主取守手朱殊狩珠種趣酒首儒受寿授樹需囚 +Line 25=収周宗就州修愁拾秀秋終習臭舟衆襲週酬集醜住充十従柔汁渋獣縦重銃叔 +Line 26=宿淑祝縮粛塾熟出術述俊春瞬准循旬殉準潤盾純巡遵順処初所暑庶緒署書 +Line 27=諸助叙女序徐除傷償勝匠升召商唱奨宵将小少尚床彰承抄招掌昇昭晶松沼 +Line 28=消渉焼焦照症省硝礁祥称章笑粧紹肖衝訟証詔詳象賞鐘障上丈乗冗剰城場 +Line 29=壌嬢常情条浄状畳蒸譲醸錠嘱飾植殖織職色触食辱伸信侵唇娠寝審心慎振 +Line 30=新森浸深申真神紳臣薪親診身辛進針震人仁刃尋甚尽迅陣酢図吹垂帥推水 +Line 31=炊睡粋衰遂酔錘随髄崇数枢据杉澄寸世瀬畝是制勢姓征性成政整星晴正清 +Line 32=牲生盛精聖声製西誠誓請逝青静斉税隻席惜斥昔析石積籍績責赤跡切拙接 +Line 33=摂折設窃節説雪絶舌仙先千占宣専川戦扇栓泉浅洗染潜旋線繊船薦践選遷 +Line 34=銭銑鮮前善漸然全禅繕塑措疎礎祖租粗素組訴阻僧創双倉喪壮奏層想捜掃 +Line 35=挿操早曹巣槽燥争相窓総草荘葬藻装走送遭霜騒像増憎臓蔵贈造促側則即 +Line 36=息束測足速俗属賊族続卒存孫尊損村他多太堕妥惰打駄体対耐帯待怠態替 +Line 37=泰滞胎袋貸退逮隊代台大第題滝卓宅択拓沢濯託濁諾但達奪脱棚谷丹単嘆 +Line 38=担探淡炭短端胆誕鍛団壇弾断暖段男談値知地恥池痴稚置致遅築畜竹蓄逐 +Line 39=秩窒茶嫡着中仲宙忠抽昼柱注虫衷鋳駐著貯丁兆帳庁弔張彫徴懲挑朝潮町 +Line 40=眺聴脹腸調超跳長頂鳥勅直朕沈珍賃鎮陳津墜追痛通塚漬坪釣亭低停偵貞 +Line 41=呈堤定帝底庭廷弟抵提程締艇訂逓邸泥摘敵滴的笛適哲徹撤迭鉄典天展店 +Line 42=添転点伝殿田電吐塗徒斗渡登途都努度土奴怒倒党冬凍刀唐塔島悼投搭東 +Line 43=桃棟盗湯灯当痘等答筒糖統到討謄豆踏逃透陶頭騰闘働動同堂導洞童胴道 +Line 44=銅峠匿得徳特督篤毒独読凸突届屯豚曇鈍内縄南軟難二尼弐肉日乳入如尿 +Line 45=任妊忍認寧猫熱年念燃粘悩濃納能脳農把覇波派破婆馬俳廃拝排敗杯背肺 +Line 46=輩配倍培媒梅買売賠陪伯博拍泊白舶薄迫漠爆縛麦箱肌畑八鉢発髪伐罰抜 +Line 47=閥伴判半反帆搬板版犯班畔繁般藩販範煩頒飯晩番盤蛮卑否妃彼悲扉批披 +Line 48=比泌疲皮碑秘罷肥被費避非飛備尾微美鼻匹必筆姫百俵標氷漂票表評描病 +Line 49=秒苗品浜貧賓頻敏瓶不付夫婦富布府怖扶敷普浮父符腐膚譜負賦赴附侮武 +Line 50=舞部封風伏副復幅服福腹複覆払沸仏物分噴墳憤奮粉紛雰文聞丙併兵塀幣 +Line 51=平弊柄並閉陛米壁癖別偏変片編辺返遍便勉弁保舗捕歩補穂募墓慕暮母簿 +Line 52=倣俸包報奉宝峰崩抱放方法泡砲縫胞芳褒訪豊邦飽乏亡傍剖坊妨帽忘忙房 +Line 53=暴望某棒冒紡肪膨謀貿防北僕墨撲朴牧没堀奔本翻凡盆摩磨魔麻埋妹枚毎 +Line 54=幕膜又抹末繭万慢満漫味未魅岬密脈妙民眠務夢無矛霧婿娘名命明盟迷銘 +Line 55=鳴滅免綿面模茂妄毛猛盲網耗木黙目戻問紋門匁夜野矢厄役約薬訳躍柳愉 +Line 56=油癒諭輸唯優勇友幽悠憂有猶由裕誘遊郵雄融夕予余与誉預幼容庸揚揺擁 +Line 57=曜様洋溶用窯羊葉要謡踊陽養抑欲浴翌翼羅裸来頼雷絡落酪乱卵欄濫覧利 +Line 58=吏履理痢裏里離陸律率立略流留硫粒隆竜慮旅虜了僚両寮料涼猟療糧良量 +Line 59=陵領力緑倫厘林臨輪隣塁涙累類令例冷励礼鈴隷零霊麗齢暦歴列劣烈裂廉 +Line 60=恋練連錬炉路露労廊朗楼浪漏老郎六録論和話賄惑枠湾腕 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 +64=24 +65=24 +66=24 +67=24 +68=24 +69=24 +70=24 +71=24 +72=24 +73=24 +74=24 +75=24 +76=24 +77=24 +78=24 +79=24 +80=24 +81=24 +82=24 +83=24 +84=24 +85=24 +86=24 +87=24 +88=24 +89=24 +90=24 +91=24 +92=24 +93=24 +94=24 +95=24 +96=24 +97=24 +98=24 +99=24 +100=24 +101=24 +102=24 +103=24 +104=24 +105=24 +106=24 +107=24 +108=24 +109=24 +110=24 +111=24 +112=24 +113=24 +114=24 +115=24 +116=24 +117=24 +118=24 +119=24 +120=24 +121=24 +122=24 +123=24 +124=24 +125=24 +126=24 +127=24 +128=24 +129=24 +130=24 +131=24 +132=24 +133=24 +134=24 +135=24 +136=24 +137=24 +138=24 +139=24 +140=24 +141=24 +142=24 +143=24 +144=24 +145=24 +146=24 +147=24 +148=24 +149=24 +150=24 +151=24 +152=24 +153=24 +154=24 +155=24 +156=24 +157=24 +158=24 +159=24 +160=24 +161=24 +162=24 +163=24 +164=24 +165=24 +166=24 +167=24 +168=24 +169=24 +170=24 +171=24 +172=24 +173=24 +174=24 +175=24 +176=24 +177=24 +178=24 +179=24 +180=24 +181=24 +182=24 +183=24 +184=24 +185=24 +186=24 +187=24 +188=24 +189=24 +190=24 +191=24 +192=24 +193=24 +194=24 +195=24 +196=24 +197=24 +198=24 +199=24 +200=24 +201=24 +202=24 +203=24 +204=24 +205=24 +206=24 +207=24 +208=24 +209=24 +210=24 +211=24 +212=24 +213=24 +214=24 +215=24 +216=24 +217=24 +218=24 +219=24 +220=24 +221=24 +222=24 +223=24 +224=24 +225=24 +226=24 +227=24 +228=24 +229=24 +230=24 +231=24 +232=24 +233=24 +234=24 +235=24 +236=24 +237=24 +238=24 +239=24 +240=24 +241=24 +242=24 +243=24 +244=24 +245=24 +246=24 +247=24 +248=24 +249=24 +250=24 +251=24 +252=24 +253=24 +254=24 +255=24 +256=24 +257=24 +258=24 +259=24 +260=24 +261=24 +262=24 +263=24 +264=24 +265=24 +266=24 +267=24 +268=24 +269=24 +270=24 +271=24 +272=24 +273=24 +274=24 +275=24 +276=24 +277=24 +278=24 +279=24 +280=24 +281=24 +282=24 +283=24 +284=24 +285=24 +286=24 +287=24 +288=24 +289=24 +290=24 +291=24 +292=24 +293=24 +294=24 +295=24 +296=24 +297=24 +298=24 +299=24 +300=24 +301=24 +302=24 +303=24 +304=24 +305=24 +306=24 +307=24 +308=24 +309=24 +310=24 +311=24 +312=24 +313=24 +314=24 +315=24 +316=24 +317=24 +318=24 +319=24 +320=24 +321=24 +322=24 +323=24 +324=24 +325=24 +326=24 +327=24 +328=24 +329=24 +330=24 +331=24 +332=24 +333=24 +334=24 +335=24 +336=24 +337=24 +338=24 +339=24 +340=24 +341=24 +342=24 +343=24 +344=24 +345=24 +346=24 +347=24 +348=24 +349=24 +350=24 +351=24 +352=24 +353=24 +354=24 +355=24 +356=24 +357=24 +358=24 +359=24 +360=24 +361=24 +362=24 +363=24 +364=24 +365=24 +366=24 +367=24 +368=24 +369=24 +370=24 +371=24 +372=24 +373=24 +374=24 +375=24 +376=24 +377=24 +378=24 +379=24 +380=24 +381=24 +382=24 +383=24 +384=24 +385=24 +386=24 +387=24 +388=24 +389=24 +390=24 +391=24 +392=24 +393=24 +394=24 +395=24 +396=24 +397=24 +398=24 +399=24 +400=24 +401=24 +402=24 +403=24 +404=24 +405=24 +406=24 +407=24 +408=24 +409=24 +410=24 +411=24 +412=24 +413=24 +414=24 +415=24 +416=24 +417=24 +418=24 +419=24 +420=24 +421=24 +422=24 +423=24 +424=24 +425=24 +426=24 +427=24 +428=24 +429=24 +430=24 +431=24 +432=24 +433=24 +434=24 +435=24 +436=24 +437=24 +438=24 +439=24 +440=24 +441=24 +442=24 +443=24 +444=24 +445=24 +446=24 +447=24 +448=24 +449=24 +450=24 +451=24 +452=24 +453=24 +454=24 +455=24 +456=24 +457=24 +458=24 +459=24 +460=24 +461=24 +462=24 +463=24 +464=24 +465=24 +466=24 +467=24 +468=24 +469=24 +470=24 +471=24 +472=24 +473=24 +474=24 +475=24 +476=24 +477=24 +478=24 +479=24 +480=24 +481=24 +482=24 +483=24 +484=24 +485=24 +486=24 +487=24 +488=24 +489=24 +490=24 +491=24 +492=24 +493=24 +494=24 +495=24 +496=24 +497=24 +498=24 +499=24 +500=24 +501=24 +502=24 +503=24 +504=24 +505=24 +506=24 +507=24 +508=24 +509=24 +510=24 +511=24 +512=24 +513=24 +514=24 +515=24 +516=24 +517=24 +518=24 +519=24 +520=24 +521=24 +522=24 +523=24 +524=24 +525=24 +526=24 +527=24 +528=24 +529=24 +530=24 +531=24 +532=24 +533=24 +534=24 +535=24 +536=24 +537=24 +538=24 +539=24 +540=24 +541=24 +542=24 +543=24 +544=24 +545=24 +546=24 +547=24 +548=24 +549=24 +550=24 +551=24 +552=24 +553=24 +554=24 +555=24 +556=24 +557=24 +558=24 +559=24 +560=24 +561=24 +562=24 +563=24 +564=24 +565=24 +566=24 +567=24 +568=24 +569=24 +570=24 +571=24 +572=24 +573=24 +574=24 +575=24 +576=24 +577=24 +578=24 +579=24 +580=24 +581=24 +582=24 +583=24 +584=24 +585=24 +586=24 +587=24 +588=24 +589=24 +590=24 +591=24 +592=24 +593=24 +594=24 +595=24 +596=24 +597=24 +598=24 +599=24 +600=24 +601=24 +602=24 +603=24 +604=24 +605=24 +606=24 +607=24 +608=24 +609=24 +610=24 +611=24 +612=24 +613=24 +614=24 +615=24 +616=24 +617=24 +618=24 +619=24 +620=24 +621=24 +622=24 +623=24 +624=24 +625=24 +626=24 +627=24 +628=24 +629=24 +630=24 +631=24 +632=24 +633=24 +634=24 +635=24 +636=24 +637=24 +638=24 +639=24 +640=24 +641=24 +642=24 +643=24 +644=24 +645=24 +646=24 +647=24 +648=24 +649=24 +650=24 +651=24 +652=24 +653=24 +654=24 +655=24 +656=24 +657=24 +658=24 +659=24 +660=24 +661=24 +662=24 +663=24 +664=24 +665=24 +666=24 +667=24 +668=24 +669=24 +670=24 +671=24 +672=24 +673=24 +674=24 +675=24 +676=24 +677=24 +678=24 +679=24 +680=24 +681=24 +682=24 +683=24 +684=24 +685=24 +686=24 +687=24 +688=24 +689=24 +690=24 +691=24 +692=24 +693=24 +694=24 +695=24 +696=24 +697=24 +698=24 +699=24 +700=24 +701=24 +702=24 +703=24 +704=24 +705=24 +706=24 +707=24 +708=24 +709=24 +710=24 +711=24 +712=24 +713=24 +714=24 +715=24 +716=24 +717=24 +718=24 +719=24 +720=24 +721=24 +722=24 +723=24 +724=24 +725=24 +726=24 +727=24 +728=24 +729=24 +730=24 +731=24 +732=24 +733=24 +734=24 +735=24 +736=24 +737=24 +738=24 +739=24 +740=24 +741=24 +742=24 +743=24 +744=24 +745=24 +746=24 +747=24 +748=24 +749=24 +750=24 +751=24 +752=24 +753=24 +754=24 +755=24 +756=24 +757=24 +758=24 +759=24 +760=24 +761=24 +762=24 +763=24 +764=24 +765=24 +766=24 +767=24 +768=24 +769=24 +770=24 +771=24 +772=24 +773=24 +774=24 +775=24 +776=24 +777=24 +778=24 +779=24 +780=24 +781=24 +782=24 +783=24 +784=24 +785=24 +786=24 +787=24 +788=24 +789=24 +790=24 +791=24 +792=24 +793=24 +794=24 +795=24 +796=24 +797=24 +798=24 +799=24 +800=24 +801=24 +802=24 +803=24 +804=24 +805=24 +806=24 +807=24 +808=24 +809=24 +810=24 +811=24 +812=24 +813=24 +814=24 +815=24 +816=24 +817=24 +818=24 +819=24 +820=24 +821=24 +822=24 +823=24 +824=24 +825=24 +826=24 +827=24 +828=24 +829=24 +830=24 +831=24 +832=24 +833=24 +834=24 +835=24 +836=24 +837=24 +838=24 +839=24 +840=24 +841=24 +842=24 +843=24 +844=24 +845=24 +846=24 +847=24 +848=24 +849=24 +850=24 +851=24 +852=24 +853=24 +854=24 +855=24 +856=24 +857=24 +858=24 +859=24 +860=24 +861=24 +862=24 +863=24 +864=24 +865=24 +866=24 +867=24 +868=24 +869=24 +870=24 +871=24 +872=24 +873=24 +874=24 +875=24 +876=24 +877=24 +878=24 +879=24 +880=24 +881=24 +882=24 +883=24 +884=24 +885=24 +886=24 +887=24 +888=24 +889=24 +890=24 +891=24 +892=24 +893=24 +894=24 +895=24 +896=24 +897=24 +898=24 +899=24 +900=24 +901=24 +902=24 +903=24 +904=24 +905=24 +906=24 +907=24 +908=24 +909=24 +910=24 +911=24 +912=24 +913=24 +914=24 +915=24 +916=24 +917=24 +918=24 +919=24 +920=24 +921=24 +922=24 +923=24 +924=24 +925=24 +926=24 +927=24 +928=24 +929=24 +930=24 +931=24 +932=24 +933=24 +934=24 +935=24 +936=24 +937=24 +938=24 +939=24 +940=24 +941=24 +942=24 +943=24 +944=24 +945=24 +946=24 +947=24 +948=24 +949=24 +950=24 +951=24 +952=24 +953=24 +954=24 +955=24 +956=24 +957=24 +958=24 +959=24 +960=24 +961=24 +962=24 +963=24 +964=24 +965=24 +966=24 +967=24 +968=24 +969=24 +970=24 +971=24 +972=24 +973=24 +974=24 +975=24 +976=24 +977=24 +978=24 +979=24 +980=24 +981=24 +982=24 +983=24 +984=24 +985=24 +986=24 +987=24 +988=24 +989=24 +990=24 +991=24 +992=24 +993=24 +994=24 +995=24 +996=24 +997=24 +998=24 +999=24 +1000=24 +1001=24 +1002=24 +1003=24 +1004=24 +1005=24 +1006=24 +1007=24 +1008=24 +1009=24 +1010=24 +1011=24 +1012=24 +1013=24 +1014=24 +1015=24 +1016=24 +1017=24 +1018=24 +1019=24 +1020=24 +1021=24 +1022=24 +1023=24 +1024=24 +1025=24 +1026=24 +1027=24 +1028=24 +1029=24 +1030=24 +1031=24 +1032=24 +1033=24 +1034=24 +1035=24 +1036=24 +1037=24 +1038=24 +1039=24 +1040=24 +1041=24 +1042=24 +1043=24 +1044=24 +1045=24 +1046=24 +1047=24 +1048=24 +1049=24 +1050=24 +1051=24 +1052=24 +1053=24 +1054=24 +1055=24 +1056=24 +1057=24 +1058=24 +1059=24 +1060=24 +1061=24 +1062=24 +1063=24 +1064=24 +1065=24 +1066=24 +1067=24 +1068=24 +1069=24 +1070=24 +1071=24 +1072=24 +1073=24 +1074=24 +1075=24 +1076=24 +1077=24 +1078=24 +1079=24 +1080=24 +1081=24 +1082=24 +1083=24 +1084=24 +1085=24 +1086=24 +1087=24 +1088=24 +1089=24 +1090=24 +1091=24 +1092=24 +1093=24 +1094=24 +1095=24 +1096=24 +1097=24 +1098=24 +1099=24 +1100=24 +1101=24 +1102=24 +1103=24 +1104=24 +1105=24 +1106=24 +1107=24 +1108=24 +1109=24 +1110=24 +1111=24 +1112=24 +1113=24 +1114=24 +1115=24 +1116=24 +1117=24 +1118=24 +1119=24 +1120=24 +1121=24 +1122=24 +1123=24 +1124=24 +1125=24 +1126=24 +1127=24 +1128=24 +1129=24 +1130=24 +1131=24 +1132=24 +1133=24 +1134=24 +1135=24 +1136=24 +1137=24 +1138=24 +1139=24 +1140=24 +1141=24 +1142=24 +1143=24 +1144=24 +1145=24 +1146=24 +1147=24 +1148=24 +1149=24 +1150=24 +1151=24 +1152=24 +1153=24 +1154=24 +1155=24 +1156=24 +1157=24 +1158=24 +1159=24 +1160=24 +1161=24 +1162=24 +1163=24 +1164=24 +1165=24 +1166=24 +1167=24 +1168=24 +1169=24 +1170=24 +1171=24 +1172=24 +1173=24 +1174=24 +1175=24 +1176=24 +1177=24 +1178=24 +1179=24 +1180=24 +1181=24 +1182=24 +1183=24 +1184=24 +1185=24 +1186=24 +1187=24 +1188=24 +1189=24 +1190=24 +1191=24 +1192=24 +1193=24 +1194=24 +1195=24 +1196=24 +1197=24 +1198=24 +1199=24 +1200=24 +1201=24 +1202=24 +1203=24 +1204=24 +1205=24 +1206=24 +1207=24 +1208=24 +1209=24 +1210=24 +1211=24 +1212=24 +1213=24 +1214=24 +1215=24 +1216=24 +1217=24 +1218=24 +1219=24 +1220=24 +1221=24 +1222=24 +1223=24 +1224=24 +1225=24 +1226=24 +1227=24 +1228=24 +1229=24 +1230=24 +1231=24 +1232=24 +1233=24 +1234=24 +1235=24 +1236=24 +1237=24 +1238=24 +1239=24 +1240=24 +1241=24 +1242=24 +1243=24 +1244=24 +1245=24 +1246=24 +1247=24 +1248=24 +1249=24 +1250=24 +1251=24 +1252=24 +1253=24 +1254=24 +1255=24 +1256=24 +1257=24 +1258=24 +1259=24 +1260=24 +1261=24 +1262=24 +1263=24 +1264=24 +1265=24 +1266=24 +1267=24 +1268=24 +1269=24 +1270=24 +1271=24 +1272=24 +1273=24 +1274=24 +1275=24 +1276=24 +1277=24 +1278=24 +1279=24 +1280=24 +1281=24 +1282=24 +1283=24 +1284=24 +1285=24 +1286=24 +1287=24 +1288=24 +1289=24 +1290=24 +1291=24 +1292=24 +1293=24 +1294=24 +1295=24 +1296=24 +1297=24 +1298=24 +1299=24 +1300=24 +1301=24 +1302=24 +1303=24 +1304=24 +1305=24 +1306=24 +1307=24 +1308=24 +1309=24 +1310=24 +1311=24 +1312=24 +1313=24 +1314=24 +1315=24 +1316=24 +1317=24 +1318=24 +1319=24 +1320=24 +1321=24 +1322=24 +1323=24 +1324=24 +1325=24 +1326=24 +1327=24 +1328=24 +1329=24 +1330=24 +1331=24 +1332=24 +1333=24 +1334=24 +1335=24 +1336=24 +1337=24 +1338=24 +1339=24 +1340=24 +1341=24 +1342=24 +1343=24 +1344=24 +1345=24 +1346=24 +1347=24 +1348=24 +1349=24 +1350=24 +1351=24 +1352=24 +1353=24 +1354=24 +1355=24 +1356=24 +1357=24 +1358=24 +1359=24 +1360=24 +1361=24 +1362=24 +1363=24 +1364=24 +1365=24 +1366=24 +1367=24 +1368=24 +1369=24 +1370=24 +1371=24 +1372=24 +1373=24 +1374=24 +1375=24 +1376=24 +1377=24 +1378=24 +1379=24 +1380=24 +1381=24 +1382=24 +1383=24 +1384=24 +1385=24 +1386=24 +1387=24 +1388=24 +1389=24 +1390=24 +1391=24 +1392=24 +1393=24 +1394=24 +1395=24 +1396=24 +1397=24 +1398=24 +1399=24 +1400=24 +1401=24 +1402=24 +1403=24 +1404=24 +1405=24 +1406=24 +1407=24 +1408=24 +1409=24 +1410=24 +1411=24 +1412=24 +1413=24 +1414=24 +1415=24 +1416=24 +1417=24 +1418=24 +1419=24 +1420=24 +1421=24 +1422=24 +1423=24 +1424=24 +1425=24 +1426=24 +1427=24 +1428=24 +1429=24 +1430=24 +1431=24 +1432=24 +1433=24 +1434=24 +1435=24 +1436=24 +1437=24 +1438=24 +1439=24 +1440=24 +1441=24 +1442=24 +1443=24 +1444=24 +1445=24 +1446=24 +1447=24 +1448=24 +1449=24 +1450=24 +1451=24 +1452=24 +1453=24 +1454=24 +1455=24 +1456=24 +1457=24 +1458=24 +1459=24 +1460=24 +1461=24 +1462=24 +1463=24 +1464=24 +1465=24 +1466=24 +1467=24 +1468=24 +1469=24 +1470=24 +1471=24 +1472=24 +1473=24 +1474=24 +1475=24 +1476=24 +1477=24 +1478=24 +1479=24 +1480=24 +1481=24 +1482=24 +1483=24 +1484=24 +1485=24 +1486=24 +1487=24 +1488=24 +1489=24 +1490=24 +1491=24 +1492=24 +1493=24 +1494=24 +1495=24 +1496=24 +1497=24 +1498=24 +1499=24 +1500=24 +1501=24 +1502=24 +1503=24 +1504=24 +1505=24 +1506=24 +1507=24 +1508=24 +1509=24 +1510=24 +1511=24 +1512=24 +1513=24 +1514=24 +1515=24 +1516=24 +1517=24 +1518=24 +1519=24 +1520=24 +1521=24 +1522=24 +1523=24 +1524=24 +1525=24 +1526=24 +1527=24 +1528=24 +1529=24 +1530=24 +1531=24 +1532=24 +1533=24 +1534=24 +1535=24 +1536=24 +1537=24 +1538=24 +1539=24 +1540=24 +1541=24 +1542=24 +1543=24 +1544=24 +1545=24 +1546=24 +1547=24 +1548=24 +1549=24 +1550=24 +1551=24 +1552=24 +1553=24 +1554=24 +1555=24 +1556=24 +1557=24 +1558=24 +1559=24 +1560=24 +1561=24 +1562=24 +1563=24 +1564=24 +1565=24 +1566=24 +1567=24 +1568=24 +1569=24 +1570=24 +1571=24 +1572=24 +1573=24 +1574=24 +1575=24 +1576=24 +1577=24 +1578=24 +1579=24 +1580=24 +1581=24 +1582=24 +1583=24 +1584=24 +1585=24 +1586=24 +1587=24 +1588=24 +1589=24 +1590=24 +1591=24 +1592=24 +1593=24 +1594=24 +1595=24 +1596=24 +1597=24 +1598=24 +1599=24 +1600=24 +1601=24 +1602=24 +1603=24 +1604=24 +1605=24 +1606=24 +1607=24 +1608=24 +1609=24 +1610=24 +1611=24 +1612=24 +1613=24 +1614=24 +1615=24 +1616=24 +1617=24 +1618=24 +1619=24 +1620=24 +1621=24 +1622=24 +1623=24 +1624=24 +1625=24 +1626=24 +1627=24 +1628=24 +1629=24 +1630=24 +1631=24 +1632=24 +1633=24 +1634=24 +1635=24 +1636=24 +1637=24 +1638=24 +1639=24 +1640=24 +1641=24 +1642=24 +1643=24 +1644=24 +1645=24 +1646=24 +1647=24 +1648=24 +1649=24 +1650=24 +1651=24 +1652=24 +1653=24 +1654=24 +1655=24 +1656=24 +1657=24 +1658=24 +1659=24 +1660=24 +1661=24 +1662=24 +1663=24 +1664=24 +1665=24 +1666=24 +1667=24 +1668=24 +1669=24 +1670=24 +1671=24 +1672=24 +1673=24 +1674=24 +1675=24 +1676=24 +1677=24 +1678=24 +1679=24 +1680=24 +1681=24 +1682=24 +1683=24 +1684=24 +1685=24 +1686=24 +1687=24 +1688=24 +1689=24 +1690=24 +1691=24 +1692=24 +1693=24 +1694=24 +1695=24 +1696=24 +1697=24 +1698=24 +1699=24 +1700=24 +1701=24 +1702=24 +1703=24 +1704=24 +1705=24 +1706=24 +1707=24 +1708=24 +1709=24 +1710=24 +1711=24 +1712=24 +1713=24 +1714=24 +1715=24 +1716=24 +1717=24 +1718=24 +1719=24 +1720=24 +1721=24 +1722=24 +1723=24 +1724=24 +1725=24 +1726=24 +1727=24 +1728=24 +1729=24 +1730=24 +1731=24 +1732=24 +1733=24 +1734=24 +1735=24 +1736=24 +1737=24 +1738=24 +1739=24 +1740=24 +1741=24 +1742=24 +1743=24 +1744=24 +1745=24 +1746=24 +1747=24 +1748=24 +1749=24 +1750=24 +1751=24 +1752=24 +1753=24 +1754=24 +1755=24 +1756=24 +1757=24 +1758=24 +1759=24 +1760=24 +1761=24 +1762=24 +1763=24 +1764=24 +1765=24 +1766=24 +1767=24 +1768=24 +1769=24 +1770=24 +1771=24 +1772=24 +1773=24 +1774=24 +1775=24 +1776=24 +1777=24 +1778=24 +1779=24 +1780=24 +1781=24 +1782=24 +1783=24 +1784=24 +1785=24 +1786=24 +1787=24 +1788=24 +1789=24 +1790=24 +1791=24 +1792=24 +1793=24 +1794=24 +1795=24 +1796=24 +1797=24 +1798=24 +1799=24 +1800=24 +1801=24 +1802=24 +1803=24 +1804=24 +1805=24 +1806=24 +1807=24 +1808=24 +1809=24 +1810=24 +1811=24 +1812=24 +1813=24 +1814=24 +1815=24 +1816=24 +1817=24 +1818=24 +1819=24 +1820=24 +1821=24 +1822=24 +1823=24 +1824=24 +1825=24 +1826=24 +1827=24 +1828=24 +1829=24 +1830=24 +1831=24 +1832=24 +1833=24 +1834=24 +1835=24 +1836=24 +1837=24 +1838=24 +1839=24 +1840=24 +1841=24 +1842=24 +1843=24 +1844=24 +1845=24 +1846=24 +1847=24 +1848=24 +1849=24 +1850=24 +1851=24 +1852=24 +1853=24 +1854=24 +1855=24 +1856=24 +1857=24 +1858=24 +1859=24 +1860=24 +1861=24 +1862=24 +1863=24 +1864=24 +1865=24 +1866=24 +1867=24 +1868=24 +1869=24 +1870=24 +1871=24 +1872=24 +1873=24 +1874=24 +1875=24 +1876=24 +1877=24 +1878=24 +1879=24 +1880=24 +1881=24 +1882=24 +1883=24 +1884=24 +1885=24 +1886=24 +1887=24 +1888=24 +1889=24 +1890=24 +1891=24 +1892=24 +1893=24 +1894=24 +1895=24 +1896=24 +1897=24 +1898=24 +1899=24 +1900=24 +1901=24 +1902=24 +1903=24 +1904=24 +1905=24 +1906=24 +1907=24 +1908=24 +1909=24 +1910=24 +1911=24 +1912=24 +1913=24 +1914=24 +1915=24 +1916=24 +1917=24 +1918=24 +1919=24 +1920=24 +1921=24 +1922=24 +1923=24 +1924=24 +1925=24 +1926=24 +1927=24 +1928=24 +1929=24 +1930=24 +1931=24 +1932=24 +1933=24 +1934=24 +1935=24 +1936=24 +1937=24 +1938=24 +1939=24 +1940=24 +1941=24 +1942=24 +1943=24 +1944=24 + +[kanji-jis1] +Line 0=唖娃阿挨姶逢葵茜穐渥旭葦芦鯵梓斡宛姐虻飴絢綾鮎或粟袷庵按闇鞍杏伊 +Line 1=夷惟椅畏萎謂亥郁磯溢茨鰯允咽淫胤蔭吋烏迂卯鵜窺丑碓臼嘘唄欝蔚鰻姥 +Line 2=厩瓜閏噂云荏餌叡嬰曳洩瑛盈穎頴榎厭堰奄怨掩焔燕艶苑薗鴛於甥旺襖鴬 +Line 3=鴎岡荻臆桶牡俺伽嘉珂禾苛茄蝦嘩迦霞俄峨牙臥蛾駕廻恢魁晦芥蟹凱咳崖 +Line 4=碍蓋鎧骸浬馨蛙柿蛎鈎劃廓撹赫顎笠樫橿梶鰍恰葛鰹叶椛樺鞄兜竃蒲釜鎌 +Line 5=噛鴨栢茅萱粥苅瓦侃姦柑桓澗潅竿翰莞諌韓舘巌玩癌翫贋雁伎嬉毅畿稀徽 +Line 6=亀妓祇蟻誼掬鞠吃桔橘砧杵黍仇汲灸笈渠鋸禦亨侠僑兇匡卿喬彊怯蕎饗尭 +Line 7=桐粁僅巾錦欣欽禽芹衿倶狗玖矩躯駈駒喰寓串櫛釧屑窟沓轡窪熊隈粂栗鍬 +Line 8=卦袈祁圭珪慧桂畦稽繋罫荊詣頚戟隙桁訣倦喧拳捲牽硯鍵鹸絃舷諺乎姑狐 +Line 9=糊袴股胡菰虎跨鈷伍吾梧檎瑚醐乞鯉佼倖勾喉垢宏巷庚弘昂晃杭梗浩糠紘 +Line 10=肱腔膏砿閤鴻劫壕濠轟麹鵠漉甑忽惚狛此頃坤昏梱痕艮些叉嵯沙瑳裟坐挫 +Line 11=哉塞采犀砦冴阪堺榊肴埼碕鷺咋朔柵窄鮭笹匙拶薩皐鯖捌錆鮫晒撒燦珊纂 +Line 12=讃餐斬仔屍孜斯獅爾痔而蒔汐鹿鴫竺宍雫叱嫉悉蔀篠偲柴屡蕊縞紗杓灼錫 +Line 13=惹腫呪綬洲繍蒐讐蹴輯酋什戎夙峻竣舜駿楯淳醇曙渚薯藷恕鋤哨嘗妾娼庄 +Line 14=廠捷昌梢樟樵湘菖蒋蕉裳醤鉦鍾鞘丞擾杖穣埴拭燭蝕尻晋榛疹秦芯塵壬腎 +Line 15=訊靭笥諏須厨逗翠錐瑞嵩趨雛椙菅頗雀裾摺凄棲栖醒脆戚脊蹟碩蝉尖撰栴 +Line 16=煎煽穿箭羨腺舛詮賎閃膳糎噌岨曾曽楚狙疏蘇遡鼠叢爽宋匝惣掻槍漕痩糟 +Line 17=綜聡蒼鎗捉袖其揃遜汰詑唾柁舵楕陀騨堆岱戴腿苔黛鯛醍鷹瀧啄托琢鐸茸 +Line 18=凧蛸只叩辰巽竪辿狸鱈樽誰坦旦歎湛箪綻耽蛋檀弛智蜘馳筑註酎樗瀦猪苧 +Line 19=凋喋寵帖暢牒蝶諜銚捗椎槌鎚栂掴槻佃柘辻蔦綴鍔椿潰壷嬬紬爪吊鶴剃悌 +Line 20=挺梯汀碇禎諦蹄鄭釘鼎擢鏑溺轍填纏甜貼顛澱兎堵妬屠杜菟賭鍍砥砺塘套 +Line 21=宕嶋梼淘涛燈祷董蕩藤鐙憧撞瞳萄鴇涜禿栃橡椴鳶苫寅酉瀞噸惇敦沌遁頓 +Line 22=呑奈那乍凪薙謎灘捺鍋楢馴畷楠汝迩匂賑虹廿韮濡禰祢葱捻撚乃廼之埜嚢 +Line 23=膿覗蚤巴播杷琶罵芭盃牌楳煤狽這蝿秤矧萩剥柏箔粕曝莫駁函硲箸肇筈櫨 +Line 24=幡畠溌醗筏鳩噺塙蛤隼叛斑氾汎釆挽磐蕃匪庇斐緋誹樋簸枇毘琵眉柊稗疋 +Line 25=髭彦膝菱肘弼畢逼桧媛紐謬彪瓢豹廟錨鋲蒜蛭鰭彬斌瀕埠冨斧芙阜撫葡蕪 +Line 26=楓葺蕗淵弗鮒吻扮焚糞蔽頁僻碧瞥蔑箆篇娩鞭鋪圃甫輔戊菩呆峯庖捧朋烹 +Line 27=萌蓬蜂鋒鳳鵬貌鉾吠頬卜睦穆釦勃殆幌昧哩槙枕鮪柾鱒桝亦俣沫迄侭麿蔓 +Line 28=巳箕蜜湊蓑稔粍牟鵡椋冥姪牝棉緬麺摸孟蒙儲杢勿餅尤籾貰悶也冶爺耶弥 +Line 29=靖薮鑓愈佑宥揖柚湧涌猷祐邑輿傭妖楊熔耀蓉遥慾沃淀螺莱洛嵐藍蘭李梨 +Line 30=璃裡葎掠劉溜琉龍侶亮凌梁瞭稜諒遼淋燐琳鱗麟瑠伶嶺怜玲苓憐漣煉簾聯 +Line 31=蓮呂魯櫓賂婁弄榔牢狼篭聾蝋麓禄肋倭歪脇鷲亙亘鰐詫藁蕨椀碗 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 +64=24 +65=24 +66=24 +67=24 +68=24 +69=24 +70=24 +71=24 +72=24 +73=24 +74=24 +75=24 +76=24 +77=24 +78=24 +79=24 +80=24 +81=24 +82=24 +83=24 +84=24 +85=24 +86=24 +87=24 +88=24 +89=24 +90=24 +91=24 +92=24 +93=24 +94=24 +95=24 +96=24 +97=24 +98=24 +99=24 +100=24 +101=24 +102=24 +103=24 +104=24 +105=24 +106=24 +107=24 +108=24 +109=24 +110=24 +111=24 +112=24 +113=24 +114=24 +115=24 +116=24 +117=24 +118=24 +119=24 +120=24 +121=24 +122=24 +123=24 +124=24 +125=24 +126=24 +127=24 +128=24 +129=24 +130=24 +131=24 +132=24 +133=24 +134=24 +135=24 +136=24 +137=24 +138=24 +139=24 +140=24 +141=24 +142=24 +143=24 +144=24 +145=24 +146=24 +147=24 +148=24 +149=24 +150=24 +151=24 +152=24 +153=24 +154=24 +155=24 +156=24 +157=24 +158=24 +159=24 +160=24 +161=24 +162=24 +163=24 +164=24 +165=24 +166=24 +167=24 +168=24 +169=24 +170=24 +171=24 +172=24 +173=24 +174=24 +175=24 +176=24 +177=24 +178=24 +179=24 +180=24 +181=24 +182=24 +183=24 +184=24 +185=24 +186=24 +187=24 +188=24 +189=24 +190=24 +191=24 +192=24 +193=24 +194=24 +195=24 +196=24 +197=24 +198=24 +199=24 +200=24 +201=24 +202=24 +203=24 +204=24 +205=24 +206=24 +207=24 +208=24 +209=24 +210=24 +211=24 +212=24 +213=24 +214=24 +215=24 +216=24 +217=24 +218=24 +219=24 +220=24 +221=24 +222=24 +223=24 +224=24 +225=24 +226=24 +227=24 +228=24 +229=24 +230=24 +231=24 +232=24 +233=24 +234=24 +235=24 +236=24 +237=24 +238=24 +239=24 +240=24 +241=24 +242=24 +243=24 +244=24 +245=24 +246=24 +247=24 +248=24 +249=24 +250=24 +251=24 +252=24 +253=24 +254=24 +255=24 +256=24 +257=24 +258=24 +259=24 +260=24 +261=24 +262=24 +263=24 +264=24 +265=24 +266=24 +267=24 +268=24 +269=24 +270=24 +271=24 +272=24 +273=24 +274=24 +275=24 +276=24 +277=24 +278=24 +279=24 +280=24 +281=24 +282=24 +283=24 +284=24 +285=24 +286=24 +287=24 +288=24 +289=24 +290=24 +291=24 +292=24 +293=24 +294=24 +295=24 +296=24 +297=24 +298=24 +299=24 +300=24 +301=24 +302=24 +303=24 +304=24 +305=24 +306=24 +307=24 +308=24 +309=24 +310=24 +311=24 +312=24 +313=24 +314=24 +315=24 +316=24 +317=24 +318=24 +319=24 +320=24 +321=24 +322=24 +323=24 +324=24 +325=24 +326=24 +327=24 +328=24 +329=24 +330=24 +331=24 +332=24 +333=24 +334=24 +335=24 +336=24 +337=24 +338=24 +339=24 +340=24 +341=24 +342=24 +343=24 +344=24 +345=24 +346=24 +347=24 +348=24 +349=24 +350=24 +351=24 +352=24 +353=24 +354=24 +355=24 +356=24 +357=24 +358=24 +359=24 +360=24 +361=24 +362=24 +363=24 +364=24 +365=24 +366=24 +367=24 +368=24 +369=24 +370=24 +371=24 +372=24 +373=24 +374=24 +375=24 +376=24 +377=24 +378=24 +379=24 +380=24 +381=24 +382=24 +383=24 +384=24 +385=24 +386=24 +387=24 +388=24 +389=24 +390=24 +391=24 +392=24 +393=24 +394=24 +395=24 +396=24 +397=24 +398=24 +399=24 +400=24 +401=24 +402=24 +403=24 +404=24 +405=24 +406=24 +407=24 +408=24 +409=24 +410=24 +411=24 +412=24 +413=24 +414=24 +415=24 +416=24 +417=24 +418=24 +419=24 +420=24 +421=24 +422=24 +423=24 +424=24 +425=24 +426=24 +427=24 +428=24 +429=24 +430=24 +431=24 +432=24 +433=24 +434=24 +435=24 +436=24 +437=24 +438=24 +439=24 +440=24 +441=24 +442=24 +443=24 +444=24 +445=24 +446=24 +447=24 +448=24 +449=24 +450=24 +451=24 +452=24 +453=24 +454=24 +455=24 +456=24 +457=24 +458=24 +459=24 +460=24 +461=24 +462=24 +463=24 +464=24 +465=24 +466=24 +467=24 +468=24 +469=24 +470=24 +471=24 +472=24 +473=24 +474=24 +475=24 +476=24 +477=24 +478=24 +479=24 +480=24 +481=24 +482=24 +483=24 +484=24 +485=24 +486=24 +487=24 +488=24 +489=24 +490=24 +491=24 +492=24 +493=24 +494=24 +495=24 +496=24 +497=24 +498=24 +499=24 +500=24 +501=24 +502=24 +503=24 +504=24 +505=24 +506=24 +507=24 +508=24 +509=24 +510=24 +511=24 +512=24 +513=24 +514=24 +515=24 +516=24 +517=24 +518=24 +519=24 +520=24 +521=24 +522=24 +523=24 +524=24 +525=24 +526=24 +527=24 +528=24 +529=24 +530=24 +531=24 +532=24 +533=24 +534=24 +535=24 +536=24 +537=24 +538=24 +539=24 +540=24 +541=24 +542=24 +543=24 +544=24 +545=24 +546=24 +547=24 +548=24 +549=24 +550=24 +551=24 +552=24 +553=24 +554=24 +555=24 +556=24 +557=24 +558=24 +559=24 +560=24 +561=24 +562=24 +563=24 +564=24 +565=24 +566=24 +567=24 +568=24 +569=24 +570=24 +571=24 +572=24 +573=24 +574=24 +575=24 +576=24 +577=24 +578=24 +579=24 +580=24 +581=24 +582=24 +583=24 +584=24 +585=24 +586=24 +587=24 +588=24 +589=24 +590=24 +591=24 +592=24 +593=24 +594=24 +595=24 +596=24 +597=24 +598=24 +599=24 +600=24 +601=24 +602=24 +603=24 +604=24 +605=24 +606=24 +607=24 +608=24 +609=24 +610=24 +611=24 +612=24 +613=24 +614=24 +615=24 +616=24 +617=24 +618=24 +619=24 +620=24 +621=24 +622=24 +623=24 +624=24 +625=24 +626=24 +627=24 +628=24 +629=24 +630=24 +631=24 +632=24 +633=24 +634=24 +635=24 +636=24 +637=24 +638=24 +639=24 +640=24 +641=24 +642=24 +643=24 +644=24 +645=24 +646=24 +647=24 +648=24 +649=24 +650=24 +651=24 +652=24 +653=24 +654=24 +655=24 +656=24 +657=24 +658=24 +659=24 +660=24 +661=24 +662=24 +663=24 +664=24 +665=24 +666=24 +667=24 +668=24 +669=24 +670=24 +671=24 +672=24 +673=24 +674=24 +675=24 +676=24 +677=24 +678=24 +679=24 +680=24 +681=24 +682=24 +683=24 +684=24 +685=24 +686=24 +687=24 +688=24 +689=24 +690=24 +691=24 +692=24 +693=24 +694=24 +695=24 +696=24 +697=24 +698=24 +699=24 +700=24 +701=24 +702=24 +703=24 +704=24 +705=24 +706=24 +707=24 +708=24 +709=24 +710=24 +711=24 +712=24 +713=24 +714=24 +715=24 +716=24 +717=24 +718=24 +719=24 +720=24 +721=24 +722=24 +723=24 +724=24 +725=24 +726=24 +727=24 +728=24 +729=24 +730=24 +731=24 +732=24 +733=24 +734=24 +735=24 +736=24 +737=24 +738=24 +739=24 +740=24 +741=24 +742=24 +743=24 +744=24 +745=24 +746=24 +747=24 +748=24 +749=24 +750=24 +751=24 +752=24 +753=24 +754=24 +755=24 +756=24 +757=24 +758=24 +759=24 +760=24 +761=24 +762=24 +763=24 +764=24 +765=24 +766=24 +767=24 +768=24 +769=24 +770=24 +771=24 +772=24 +773=24 +774=24 +775=24 +776=24 +777=24 +778=24 +779=24 +780=24 +781=24 +782=24 +783=24 +784=24 +785=24 +786=24 +787=24 +788=24 +789=24 +790=24 +791=24 +792=24 +793=24 +794=24 +795=24 +796=24 +797=24 +798=24 +799=24 +800=24 +801=24 +802=24 +803=24 +804=24 +805=24 +806=24 +807=24 +808=24 +809=24 +810=24 +811=24 +812=24 +813=24 +814=24 +815=24 +816=24 +817=24 +818=24 +819=24 +820=24 +821=24 +822=24 +823=24 +824=24 +825=24 +826=24 +827=24 +828=24 +829=24 +830=24 +831=24 +832=24 +833=24 +834=24 +835=24 +836=24 +837=24 +838=24 +839=24 +840=24 +841=24 +842=24 +843=24 +844=24 +845=24 +846=24 +847=24 +848=24 +849=24 +850=24 +851=24 +852=24 +853=24 +854=24 +855=24 +856=24 +857=24 +858=24 +859=24 +860=24 +861=24 +862=24 +863=24 +864=24 +865=24 +866=24 +867=24 +868=24 +869=24 +870=24 +871=24 +872=24 +873=24 +874=24 +875=24 +876=24 +877=24 +878=24 +879=24 +880=24 +881=24 +882=24 +883=24 +884=24 +885=24 +886=24 +887=24 +888=24 +889=24 +890=24 +891=24 +892=24 +893=24 +894=24 +895=24 +896=24 +897=24 +898=24 +899=24 +900=24 +901=24 +902=24 +903=24 +904=24 +905=24 +906=24 +907=24 +908=24 +909=24 +910=24 +911=24 +912=24 +913=24 +914=24 +915=24 +916=24 +917=24 +918=24 +919=24 +920=24 +921=24 +922=24 +923=24 +924=24 +925=24 +926=24 +927=24 +928=24 +929=24 +930=24 +931=24 +932=24 +933=24 +934=24 +935=24 +936=24 +937=24 +938=24 +939=24 +940=24 +941=24 +942=24 +943=24 +944=24 +945=24 +946=24 +947=24 +948=24 +949=24 +950=24 +951=24 +952=24 +953=24 +954=24 +955=24 +956=24 +957=24 +958=24 +959=24 +960=24 +961=24 +962=24 +963=24 +964=24 +965=24 +966=24 +967=24 +968=24 +969=24 +970=24 +971=24 +972=24 +973=24 +974=24 +975=24 +976=24 +977=24 +978=24 +979=24 +980=24 +981=24 +982=24 +983=24 +984=24 +985=24 +986=24 +987=24 +988=24 +989=24 +990=24 +991=24 +992=24 +993=24 +994=24 +995=24 +996=24 +997=24 +998=24 +999=24 +1000=24 +1001=24 +1002=24 +1003=24 +1004=24 +1005=24 +1006=24 +1007=24 +1008=24 +1009=24 +1010=24 +1011=24 +1012=24 +1013=24 +1014=24 +1015=24 +1016=24 +1017=24 +1018=24 +1019=24 + +[kanji-jis2] +Line 0=弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞 +Line 1=仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥 +Line 2=倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲僉僊 +Line 3=傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮 +Line 4=冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾 +Line 5=刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼 +Line 6=劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍 +Line 7=凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮 +Line 8=吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨咫哂咤咾咼哘 +Line 9=哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼 +Line 10=喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀 +Line 11=嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜 +Line 12=圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡 +Line 13=塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽 +Line 14=夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩奸妁妝佞侫妣妲姆姨姜 +Line 15=妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖 +Line 16=嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢 +Line 17=寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛 +Line 18=岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬 +Line 19=嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀 +Line 20=幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏廖廣廝廚廛廢廡廨廩廬廱廳廰廴 +Line 21=廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇 +Line 22=從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷 +Line 23=恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵 +Line 24=惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚 +Line 25=慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣 +Line 26=懶懺懴懿懽懼懾戀戈戉戍戌戔戛戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找 +Line 27=抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍 +Line 28=搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨 +Line 29=搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺 +Line 30=攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆 +Line 31=旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈 +Line 32=暎暉暄暘暝曁暹曉暾暼曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸 +Line 33=朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆 +Line 34=柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁 +Line 35=棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔 +Line 36=楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴 +Line 37=槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢 +Line 38=檐檍檠檄檢檣檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹 +Line 39=飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓 +Line 40=毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅 +Line 41=泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕 +Line 42=渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃 +Line 43=渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯 +Line 44=漲滌漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔 +Line 45=濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋 +Line 46=烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼 +Line 47=燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎 +Line 48=狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻 +Line 49=珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱瓠瓣 +Line 50=瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭 +Line 51=畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰 +Line 52=痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發 +Line 53=皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥 +Line 54=眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮 +Line 55=矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬磧磚磽磴礇礒 +Line 56=礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙 +Line 57=稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊 +Line 58=竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥 +Line 59=筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇 +Line 60=簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫 +Line 61=粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆紂紜紕紊絅絋紮紲紿紵 +Line 62=絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤 +Line 63=緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩 +Line 64=繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨 +Line 65=罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜 +Line 66=耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚 +Line 67=肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋隋腆脾腓腑胼腱腮腥腦腴膃膈膊 +Line 68=膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂 +Line 69=舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬 +Line 70=苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪 +Line 71=莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸 +Line 72=蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡 +Line 73=蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾 +Line 74=薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋 +Line 75=蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥 +Line 76=蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯 +Line 77=蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵 +Line 78=衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪 +Line 79=褫襁襄褻褶褸襌褝襠襞襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿 +Line 80=觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦 +Line 81=誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁 +Line 82=譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸 +Line 83=豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍 +Line 84=贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐 +Line 85=踟蹂踵踰踴蹊蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡 +Line 86=躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌 +Line 87=轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧 +Line 88=逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤 +Line 89=扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟 +Line 90=釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺 +Line 91=鍄錮錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓 +Line 92=鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘 +Line 93=閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞 +Line 94=陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎 +Line 95=霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐 +Line 96=鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰顱顴 +Line 97=顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌 +Line 98=饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍 +Line 99=驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚 +Line 100=鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆 +Line 101=鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾 +Line 102=鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈鵝鵞鵤鵑鵐鵙 +Line 103=鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁 +Line 104=麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽 +Line 105=鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙 + +0=24 +1=24 +2=24 +3=24 +4=24 +5=24 +6=24 +7=24 +8=24 +9=24 +10=24 +11=24 +12=24 +13=24 +14=24 +15=24 +16=24 +17=24 +18=24 +19=24 +20=24 +21=24 +22=24 +23=24 +24=24 +25=24 +26=24 +27=24 +28=24 +29=24 +30=24 +31=24 +32=24 +33=24 +34=24 +35=24 +36=24 +37=24 +38=24 +39=24 +40=24 +41=24 +42=24 +43=24 +44=24 +45=24 +46=24 +47=24 +48=24 +49=24 +50=24 +51=24 +52=24 +53=24 +54=24 +55=24 +56=24 +57=24 +58=24 +59=24 +60=24 +61=24 +62=24 +63=24 +64=24 +65=24 +66=24 +67=24 +68=24 +69=24 +70=24 +71=24 +72=24 +73=24 +74=24 +75=24 +76=24 +77=24 +78=24 +79=24 +80=24 +81=24 +82=24 +83=24 +84=24 +85=24 +86=24 +87=24 +88=24 +89=24 +90=24 +91=24 +92=24 +93=24 +94=24 +95=24 +96=24 +97=24 +98=24 +99=24 +100=24 +101=24 +102=24 +103=24 +104=24 +105=24 +106=24 +107=24 +108=24 +109=24 +110=24 +111=24 +112=24 +113=24 +114=24 +115=24 +116=24 +117=24 +118=24 +119=24 +120=24 +121=24 +122=24 +123=24 +124=24 +125=24 +126=24 +127=24 +128=24 +129=24 +130=24 +131=24 +132=24 +133=24 +134=24 +135=24 +136=24 +137=24 +138=24 +139=24 +140=24 +141=24 +142=24 +143=24 +144=24 +145=24 +146=24 +147=24 +148=24 +149=24 +150=24 +151=24 +152=24 +153=24 +154=24 +155=24 +156=24 +157=24 +158=24 +159=24 +160=24 +161=24 +162=24 +163=24 +164=24 +165=24 +166=24 +167=24 +168=24 +169=24 +170=24 +171=24 +172=24 +173=24 +174=24 +175=24 +176=24 +177=24 +178=24 +179=24 +180=24 +181=24 +182=24 +183=24 +184=24 +185=24 +186=24 +187=24 +188=24 +189=24 +190=24 +191=24 +192=24 +193=24 +194=24 +195=24 +196=24 +197=24 +198=24 +199=24 +200=24 +201=24 +202=24 +203=24 +204=24 +205=24 +206=24 +207=24 +208=24 +209=24 +210=24 +211=24 +212=24 +213=24 +214=24 +215=24 +216=24 +217=24 +218=24 +219=24 +220=24 +221=24 +222=24 +223=24 +224=24 +225=24 +226=24 +227=24 +228=24 +229=24 +230=24 +231=24 +232=24 +233=24 +234=24 +235=24 +236=24 +237=24 +238=24 +239=24 +240=24 +241=24 +242=24 +243=24 +244=24 +245=24 +246=24 +247=24 +248=24 +249=24 +250=24 +251=24 +252=24 +253=24 +254=24 +255=24 +256=24 +257=24 +258=24 +259=24 +260=24 +261=24 +262=24 +263=24 +264=24 +265=24 +266=24 +267=24 +268=24 +269=24 +270=24 +271=24 +272=24 +273=24 +274=24 +275=24 +276=24 +277=24 +278=24 +279=24 +280=24 +281=24 +282=24 +283=24 +284=24 +285=24 +286=24 +287=24 +288=24 +289=24 +290=24 +291=24 +292=24 +293=24 +294=24 +295=24 +296=24 +297=24 +298=24 +299=24 +300=24 +301=24 +302=24 +303=24 +304=24 +305=24 +306=24 +307=24 +308=24 +309=24 +310=24 +311=24 +312=24 +313=24 +314=24 +315=24 +316=24 +317=24 +318=24 +319=24 +320=24 +321=24 +322=24 +323=24 +324=24 +325=24 +326=24 +327=24 +328=24 +329=24 +330=24 +331=24 +332=24 +333=24 +334=24 +335=24 +336=24 +337=24 +338=24 +339=24 +340=24 +341=24 +342=24 +343=24 +344=24 +345=24 +346=24 +347=24 +348=24 +349=24 +350=24 +351=24 +352=24 +353=24 +354=24 +355=24 +356=24 +357=24 +358=24 +359=24 +360=24 +361=24 +362=24 +363=24 +364=24 +365=24 +366=24 +367=24 +368=24 +369=24 +370=24 +371=24 +372=24 +373=24 +374=24 +375=24 +376=24 +377=24 +378=24 +379=24 +380=24 +381=24 +382=24 +383=24 +384=24 +385=24 +386=24 +387=24 +388=24 +389=24 +390=24 +391=24 +392=24 +393=24 +394=24 +395=24 +396=24 +397=24 +398=24 +399=24 +400=24 +401=24 +402=24 +403=24 +404=24 +405=24 +406=24 +407=24 +408=24 +409=24 +410=24 +411=24 +412=24 +413=24 +414=24 +415=24 +416=24 +417=24 +418=24 +419=24 +420=24 +421=24 +422=24 +423=24 +424=24 +425=24 +426=24 +427=24 +428=24 +429=24 +430=24 +431=24 +432=24 +433=24 +434=24 +435=24 +436=24 +437=24 +438=24 +439=24 +440=24 +441=24 +442=24 +443=24 +444=24 +445=24 +446=24 +447=24 +448=24 +449=24 +450=24 +451=24 +452=24 +453=24 +454=24 +455=24 +456=24 +457=24 +458=24 +459=24 +460=24 +461=24 +462=24 +463=24 +464=24 +465=24 +466=24 +467=24 +468=24 +469=24 +470=24 +471=24 +472=24 +473=24 +474=24 +475=24 +476=24 +477=24 +478=24 +479=24 +480=24 +481=24 +482=24 +483=24 +484=24 +485=24 +486=24 +487=24 +488=24 +489=24 +490=24 +491=24 +492=24 +493=24 +494=24 +495=24 +496=24 +497=24 +498=24 +499=24 +500=24 +501=24 +502=24 +503=24 +504=24 +505=24 +506=24 +507=24 +508=24 +509=24 +510=24 +511=24 +512=24 +513=24 +514=24 +515=24 +516=24 +517=24 +518=24 +519=24 +520=24 +521=24 +522=24 +523=24 +524=24 +525=24 +526=24 +527=24 +528=24 +529=24 +530=24 +531=24 +532=24 +533=24 +534=24 +535=24 +536=24 +537=24 +538=24 +539=24 +540=24 +541=24 +542=24 +543=24 +544=24 +545=24 +546=24 +547=24 +548=24 +549=24 +550=24 +551=24 +552=24 +553=24 +554=24 +555=24 +556=24 +557=24 +558=24 +559=24 +560=24 +561=24 +562=24 +563=24 +564=24 +565=24 +566=24 +567=24 +568=24 +569=24 +570=24 +571=24 +572=24 +573=24 +574=24 +575=24 +576=24 +577=24 +578=24 +579=24 +580=24 +581=24 +582=24 +583=24 +584=24 +585=24 +586=24 +587=24 +588=24 +589=24 +590=24 +591=24 +592=24 +593=24 +594=24 +595=24 +596=24 +597=24 +598=24 +599=24 +600=24 +601=24 +602=24 +603=24 +604=24 +605=24 +606=24 +607=24 +608=24 +609=24 +610=24 +611=24 +612=24 +613=24 +614=24 +615=24 +616=24 +617=24 +618=24 +619=24 +620=24 +621=24 +622=24 +623=24 +624=24 +625=24 +626=24 +627=24 +628=24 +629=24 +630=24 +631=24 +632=24 +633=24 +634=24 +635=24 +636=24 +637=24 +638=24 +639=24 +640=24 +641=24 +642=24 +643=24 +644=24 +645=24 +646=24 +647=24 +648=24 +649=24 +650=24 +651=24 +652=24 +653=24 +654=24 +655=24 +656=24 +657=24 +658=24 +659=24 +660=24 +661=24 +662=24 +663=24 +664=24 +665=24 +666=24 +667=24 +668=24 +669=24 +670=24 +671=24 +672=24 +673=24 +674=24 +675=24 +676=24 +677=24 +678=24 +679=24 +680=24 +681=24 +682=24 +683=24 +684=24 +685=24 +686=24 +687=24 +688=24 +689=24 +690=24 +691=24 +692=24 +693=24 +694=24 +695=24 +696=24 +697=24 +698=24 +699=24 +700=24 +701=24 +702=24 +703=24 +704=24 +705=24 +706=24 +707=24 +708=24 +709=24 +710=24 +711=24 +712=24 +713=24 +714=24 +715=24 +716=24 +717=24 +718=24 +719=24 +720=24 +721=24 +722=24 +723=24 +724=24 +725=24 +726=24 +727=24 +728=24 +729=24 +730=24 +731=24 +732=24 +733=24 +734=24 +735=24 +736=24 +737=24 +738=24 +739=24 +740=24 +741=24 +742=24 +743=24 +744=24 +745=24 +746=24 +747=24 +748=24 +749=24 +750=24 +751=24 +752=24 +753=24 +754=24 +755=24 +756=24 +757=24 +758=24 +759=24 +760=24 +761=24 +762=24 +763=24 +764=24 +765=24 +766=24 +767=24 +768=24 +769=24 +770=24 +771=24 +772=24 +773=24 +774=24 +775=24 +776=24 +777=24 +778=24 +779=24 +780=24 +781=24 +782=24 +783=24 +784=24 +785=24 +786=24 +787=24 +788=24 +789=24 +790=24 +791=24 +792=24 +793=24 +794=24 +795=24 +796=24 +797=24 +798=24 +799=24 +800=24 +801=24 +802=24 +803=24 +804=24 +805=24 +806=24 +807=24 +808=24 +809=24 +810=24 +811=24 +812=24 +813=24 +814=24 +815=24 +816=24 +817=24 +818=24 +819=24 +820=24 +821=24 +822=24 +823=24 +824=24 +825=24 +826=24 +827=24 +828=24 +829=24 +830=24 +831=24 +832=24 +833=24 +834=24 +835=24 +836=24 +837=24 +838=24 +839=24 +840=24 +841=24 +842=24 +843=24 +844=24 +845=24 +846=24 +847=24 +848=24 +849=24 +850=24 +851=24 +852=24 +853=24 +854=24 +855=24 +856=24 +857=24 +858=24 +859=24 +860=24 +861=24 +862=24 +863=24 +864=24 +865=24 +866=24 +867=24 +868=24 +869=24 +870=24 +871=24 +872=24 +873=24 +874=24 +875=24 +876=24 +877=24 +878=24 +879=24 +880=24 +881=24 +882=24 +883=24 +884=24 +885=24 +886=24 +887=24 +888=24 +889=24 +890=24 +891=24 +892=24 +893=24 +894=24 +895=24 +896=24 +897=24 +898=24 +899=24 +900=24 +901=24 +902=24 +903=24 +904=24 +905=24 +906=24 +907=24 +908=24 +909=24 +910=24 +911=24 +912=24 +913=24 +914=24 +915=24 +916=24 +917=24 +918=24 +919=24 +920=24 +921=24 +922=24 +923=24 +924=24 +925=24 +926=24 +927=24 +928=24 +929=24 +930=24 +931=24 +932=24 +933=24 +934=24 +935=24 +936=24 +937=24 +938=24 +939=24 +940=24 +941=24 +942=24 +943=24 +944=24 +945=24 +946=24 +947=24 +948=24 +949=24 +950=24 +951=24 +952=24 +953=24 +954=24 +955=24 +956=24 +957=24 +958=24 +959=24 +960=24 +961=24 +962=24 +963=24 +964=24 +965=24 +966=24 +967=24 +968=24 +969=24 +970=24 +971=24 +972=24 +973=24 +974=24 +975=24 +976=24 +977=24 +978=24 +979=24 +980=24 +981=24 +982=24 +983=24 +984=24 +985=24 +986=24 +987=24 +988=24 +989=24 +990=24 +991=24 +992=24 +993=24 +994=24 +995=24 +996=24 +997=24 +998=24 +999=24 +1000=24 +1001=24 +1002=24 +1003=24 +1004=24 +1005=24 +1006=24 +1007=24 +1008=24 +1009=24 +1010=24 +1011=24 +1012=24 +1013=24 +1014=24 +1015=24 +1016=24 +1017=24 +1018=24 +1019=24 +1020=24 +1021=24 +1022=24 +1023=24 +1024=24 +1025=24 +1026=24 +1027=24 +1028=24 +1029=24 +1030=24 +1031=24 +1032=24 +1033=24 +1034=24 +1035=24 +1036=24 +1037=24 +1038=24 +1039=24 +1040=24 +1041=24 +1042=24 +1043=24 +1044=24 +1045=24 +1046=24 +1047=24 +1048=24 +1049=24 +1050=24 +1051=24 +1052=24 +1053=24 +1054=24 +1055=24 +1056=24 +1057=24 +1058=24 +1059=24 +1060=24 +1061=24 +1062=24 +1063=24 +1064=24 +1065=24 +1066=24 +1067=24 +1068=24 +1069=24 +1070=24 +1071=24 +1072=24 +1073=24 +1074=24 +1075=24 +1076=24 +1077=24 +1078=24 +1079=24 +1080=24 +1081=24 +1082=24 +1083=24 +1084=24 +1085=24 +1086=24 +1087=24 +1088=24 +1089=24 +1090=24 +1091=24 +1092=24 +1093=24 +1094=24 +1095=24 +1096=24 +1097=24 +1098=24 +1099=24 +1100=24 +1101=24 +1102=24 +1103=24 +1104=24 +1105=24 +1106=24 +1107=24 +1108=24 +1109=24 +1110=24 +1111=24 +1112=24 +1113=24 +1114=24 +1115=24 +1116=24 +1117=24 +1118=24 +1119=24 +1120=24 +1121=24 +1122=24 +1123=24 +1124=24 +1125=24 +1126=24 +1127=24 +1128=24 +1129=24 +1130=24 +1131=24 +1132=24 +1133=24 +1134=24 +1135=24 +1136=24 +1137=24 +1138=24 +1139=24 +1140=24 +1141=24 +1142=24 +1143=24 +1144=24 +1145=24 +1146=24 +1147=24 +1148=24 +1149=24 +1150=24 +1151=24 +1152=24 +1153=24 +1154=24 +1155=24 +1156=24 +1157=24 +1158=24 +1159=24 +1160=24 +1161=24 +1162=24 +1163=24 +1164=24 +1165=24 +1166=24 +1167=24 +1168=24 +1169=24 +1170=24 +1171=24 +1172=24 +1173=24 +1174=24 +1175=24 +1176=24 +1177=24 +1178=24 +1179=24 +1180=24 +1181=24 +1182=24 +1183=24 +1184=24 +1185=24 +1186=24 +1187=24 +1188=24 +1189=24 +1190=24 +1191=24 +1192=24 +1193=24 +1194=24 +1195=24 +1196=24 +1197=24 +1198=24 +1199=24 +1200=24 +1201=24 +1202=24 +1203=24 +1204=24 +1205=24 +1206=24 +1207=24 +1208=24 +1209=24 +1210=24 +1211=24 +1212=24 +1213=24 +1214=24 +1215=24 +1216=24 +1217=24 +1218=24 +1219=24 +1220=24 +1221=24 +1222=24 +1223=24 +1224=24 +1225=24 +1226=24 +1227=24 +1228=24 +1229=24 +1230=24 +1231=24 +1232=24 +1233=24 +1234=24 +1235=24 +1236=24 +1237=24 +1238=24 +1239=24 +1240=24 +1241=24 +1242=24 +1243=24 +1244=24 +1245=24 +1246=24 +1247=24 +1248=24 +1249=24 +1250=24 +1251=24 +1252=24 +1253=24 +1254=24 +1255=24 +1256=24 +1257=24 +1258=24 +1259=24 +1260=24 +1261=24 +1262=24 +1263=24 +1264=24 +1265=24 +1266=24 +1267=24 +1268=24 +1269=24 +1270=24 +1271=24 +1272=24 +1273=24 +1274=24 +1275=24 +1276=24 +1277=24 +1278=24 +1279=24 +1280=24 +1281=24 +1282=24 +1283=24 +1284=24 +1285=24 +1286=24 +1287=24 +1288=24 +1289=24 +1290=24 +1291=24 +1292=24 +1293=24 +1294=24 +1295=24 +1296=24 +1297=24 +1298=24 +1299=24 +1300=24 +1301=24 +1302=24 +1303=24 +1304=24 +1305=24 +1306=24 +1307=24 +1308=24 +1309=24 +1310=24 +1311=24 +1312=24 +1313=24 +1314=24 +1315=24 +1316=24 +1317=24 +1318=24 +1319=24 +1320=24 +1321=24 +1322=24 +1323=24 +1324=24 +1325=24 +1326=24 +1327=24 +1328=24 +1329=24 +1330=24 +1331=24 +1332=24 +1333=24 +1334=24 +1335=24 +1336=24 +1337=24 +1338=24 +1339=24 +1340=24 +1341=24 +1342=24 +1343=24 +1344=24 +1345=24 +1346=24 +1347=24 +1348=24 +1349=24 +1350=24 +1351=24 +1352=24 +1353=24 +1354=24 +1355=24 +1356=24 +1357=24 +1358=24 +1359=24 +1360=24 +1361=24 +1362=24 +1363=24 +1364=24 +1365=24 +1366=24 +1367=24 +1368=24 +1369=24 +1370=24 +1371=24 +1372=24 +1373=24 +1374=24 +1375=24 +1376=24 +1377=24 +1378=24 +1379=24 +1380=24 +1381=24 +1382=24 +1383=24 +1384=24 +1385=24 +1386=24 +1387=24 +1388=24 +1389=24 +1390=24 +1391=24 +1392=24 +1393=24 +1394=24 +1395=24 +1396=24 +1397=24 +1398=24 +1399=24 +1400=24 +1401=24 +1402=24 +1403=24 +1404=24 +1405=24 +1406=24 +1407=24 +1408=24 +1409=24 +1410=24 +1411=24 +1412=24 +1413=24 +1414=24 +1415=24 +1416=24 +1417=24 +1418=24 +1419=24 +1420=24 +1421=24 +1422=24 +1423=24 +1424=24 +1425=24 +1426=24 +1427=24 +1428=24 +1429=24 +1430=24 +1431=24 +1432=24 +1433=24 +1434=24 +1435=24 +1436=24 +1437=24 +1438=24 +1439=24 +1440=24 +1441=24 +1442=24 +1443=24 +1444=24 +1445=24 +1446=24 +1447=24 +1448=24 +1449=24 +1450=24 +1451=24 +1452=24 +1453=24 +1454=24 +1455=24 +1456=24 +1457=24 +1458=24 +1459=24 +1460=24 +1461=24 +1462=24 +1463=24 +1464=24 +1465=24 +1466=24 +1467=24 +1468=24 +1469=24 +1470=24 +1471=24 +1472=24 +1473=24 +1474=24 +1475=24 +1476=24 +1477=24 +1478=24 +1479=24 +1480=24 +1481=24 +1482=24 +1483=24 +1484=24 +1485=24 +1486=24 +1487=24 +1488=24 +1489=24 +1490=24 +1491=24 +1492=24 +1493=24 +1494=24 +1495=24 +1496=24 +1497=24 +1498=24 +1499=24 +1500=24 +1501=24 +1502=24 +1503=24 +1504=24 +1505=24 +1506=24 +1507=24 +1508=24 +1509=24 +1510=24 +1511=24 +1512=24 +1513=24 +1514=24 +1515=24 +1516=24 +1517=24 +1518=24 +1519=24 +1520=24 +1521=24 +1522=24 +1523=24 +1524=24 +1525=24 +1526=24 +1527=24 +1528=24 +1529=24 +1530=24 +1531=24 +1532=24 +1533=24 +1534=24 +1535=24 +1536=24 +1537=24 +1538=24 +1539=24 +1540=24 +1541=24 +1542=24 +1543=24 +1544=24 +1545=24 +1546=24 +1547=24 +1548=24 +1549=24 +1550=24 +1551=24 +1552=24 +1553=24 +1554=24 +1555=24 +1556=24 +1557=24 +1558=24 +1559=24 +1560=24 +1561=24 +1562=24 +1563=24 +1564=24 +1565=24 +1566=24 +1567=24 +1568=24 +1569=24 +1570=24 +1571=24 +1572=24 +1573=24 +1574=24 +1575=24 +1576=24 +1577=24 +1578=24 +1579=24 +1580=24 +1581=24 +1582=24 +1583=24 +1584=24 +1585=24 +1586=24 +1587=24 +1588=24 +1589=24 +1590=24 +1591=24 +1592=24 +1593=24 +1594=24 +1595=24 +1596=24 +1597=24 +1598=24 +1599=24 +1600=24 +1601=24 +1602=24 +1603=24 +1604=24 +1605=24 +1606=24 +1607=24 +1608=24 +1609=24 +1610=24 +1611=24 +1612=24 +1613=24 +1614=24 +1615=24 +1616=24 +1617=24 +1618=24 +1619=24 +1620=24 +1621=24 +1622=24 +1623=24 +1624=24 +1625=24 +1626=24 +1627=24 +1628=24 +1629=24 +1630=24 +1631=24 +1632=24 +1633=24 +1634=24 +1635=24 +1636=24 +1637=24 +1638=24 +1639=24 +1640=24 +1641=24 +1642=24 +1643=24 +1644=24 +1645=24 +1646=24 +1647=24 +1648=24 +1649=24 +1650=24 +1651=24 +1652=24 +1653=24 +1654=24 +1655=24 +1656=24 +1657=24 +1658=24 +1659=24 +1660=24 +1661=24 +1662=24 +1663=24 +1664=24 +1665=24 +1666=24 +1667=24 +1668=24 +1669=24 +1670=24 +1671=24 +1672=24 +1673=24 +1674=24 +1675=24 +1676=24 +1677=24 +1678=24 +1679=24 +1680=24 +1681=24 +1682=24 +1683=24 +1684=24 +1685=24 +1686=24 +1687=24 +1688=24 +1689=24 +1690=24 +1691=24 +1692=24 +1693=24 +1694=24 +1695=24 +1696=24 +1697=24 +1698=24 +1699=24 +1700=24 +1701=24 +1702=24 +1703=24 +1704=24 +1705=24 +1706=24 +1707=24 +1708=24 +1709=24 +1710=24 +1711=24 +1712=24 +1713=24 +1714=24 +1715=24 +1716=24 +1717=24 +1718=24 +1719=24 +1720=24 +1721=24 +1722=24 +1723=24 +1724=24 +1725=24 +1726=24 +1727=24 +1728=24 +1729=24 +1730=24 +1731=24 +1732=24 +1733=24 +1734=24 +1735=24 +1736=24 +1737=24 +1738=24 +1739=24 +1740=24 +1741=24 +1742=24 +1743=24 +1744=24 +1745=24 +1746=24 +1747=24 +1748=24 +1749=24 +1750=24 +1751=24 +1752=24 +1753=24 +1754=24 +1755=24 +1756=24 +1757=24 +1758=24 +1759=24 +1760=24 +1761=24 +1762=24 +1763=24 +1764=24 +1765=24 +1766=24 +1767=24 +1768=24 +1769=24 +1770=24 +1771=24 +1772=24 +1773=24 +1774=24 +1775=24 +1776=24 +1777=24 +1778=24 +1779=24 +1780=24 +1781=24 +1782=24 +1783=24 +1784=24 +1785=24 +1786=24 +1787=24 +1788=24 +1789=24 +1790=24 +1791=24 +1792=24 +1793=24 +1794=24 +1795=24 +1796=24 +1797=24 +1798=24 +1799=24 +1800=24 +1801=24 +1802=24 +1803=24 +1804=24 +1805=24 +1806=24 +1807=24 +1808=24 +1809=24 +1810=24 +1811=24 +1812=24 +1813=24 +1814=24 +1815=24 +1816=24 +1817=24 +1818=24 +1819=24 +1820=24 +1821=24 +1822=24 +1823=24 +1824=24 +1825=24 +1826=24 +1827=24 +1828=24 +1829=24 +1830=24 +1831=24 +1832=24 +1833=24 +1834=24 +1835=24 +1836=24 +1837=24 +1838=24 +1839=24 +1840=24 +1841=24 +1842=24 +1843=24 +1844=24 +1845=24 +1846=24 +1847=24 +1848=24 +1849=24 +1850=24 +1851=24 +1852=24 +1853=24 +1854=24 +1855=24 +1856=24 +1857=24 +1858=24 +1859=24 +1860=24 +1861=24 +1862=24 +1863=24 +1864=24 +1865=24 +1866=24 +1867=24 +1868=24 +1869=24 +1870=24 +1871=24 +1872=24 +1873=24 +1874=24 +1875=24 +1876=24 +1877=24 +1878=24 +1879=24 +1880=24 +1881=24 +1882=24 +1883=24 +1884=24 +1885=24 +1886=24 +1887=24 +1888=24 +1889=24 +1890=24 +1891=24 +1892=24 +1893=24 +1894=24 +1895=24 +1896=24 +1897=24 +1898=24 +1899=24 +1900=24 +1901=24 +1902=24 +1903=24 +1904=24 +1905=24 +1906=24 +1907=24 +1908=24 +1909=24 +1910=24 +1911=24 +1912=24 +1913=24 +1914=24 +1915=24 +1916=24 +1917=24 +1918=24 +1919=24 +1920=24 +1921=24 +1922=24 +1923=24 +1924=24 +1925=24 +1926=24 +1927=24 +1928=24 +1929=24 +1930=24 +1931=24 +1932=24 +1933=24 +1934=24 +1935=24 +1936=24 +1937=24 +1938=24 +1939=24 +1940=24 +1941=24 +1942=24 +1943=24 +1944=24 +1945=24 +1946=24 +1947=24 +1948=24 +1949=24 +1950=24 +1951=24 +1952=24 +1953=24 +1954=24 +1955=24 +1956=24 +1957=24 +1958=24 +1959=24 +1960=24 +1961=24 +1962=24 +1963=24 +1964=24 +1965=24 +1966=24 +1967=24 +1968=24 +1969=24 +1970=24 +1971=24 +1972=24 +1973=24 +1974=24 +1975=24 +1976=24 +1977=24 +1978=24 +1979=24 +1980=24 +1981=24 +1982=24 +1983=24 +1984=24 +1985=24 +1986=24 +1987=24 +1988=24 +1989=24 +1990=24 +1991=24 +1992=24 +1993=24 +1994=24 +1995=24 +1996=24 +1997=24 +1998=24 +1999=24 +2000=24 +2001=24 +2002=24 +2003=24 +2004=24 +2005=24 +2006=24 +2007=24 +2008=24 +2009=24 +2010=24 +2011=24 +2012=24 +2013=24 +2014=24 +2015=24 +2016=24 +2017=24 +2018=24 +2019=24 +2020=24 +2021=24 +2022=24 +2023=24 +2024=24 +2025=24 +2026=24 +2027=24 +2028=24 +2029=24 +2030=24 +2031=24 +2032=24 +2033=24 +2034=24 +2035=24 +2036=24 +2037=24 +2038=24 +2039=24 +2040=24 +2041=24 +2042=24 +2043=24 +2044=24 +2045=24 +2046=24 +2047=24 +2048=24 +2049=24 +2050=24 +2051=24 +2052=24 +2053=24 +2054=24 +2055=24 +2056=24 +2057=24 +2058=24 +2059=24 +2060=24 +2061=24 +2062=24 +2063=24 +2064=24 +2065=24 +2066=24 +2067=24 +2068=24 +2069=24 +2070=24 +2071=24 +2072=24 +2073=24 +2074=24 +2075=24 +2076=24 +2077=24 +2078=24 +2079=24 +2080=24 +2081=24 +2082=24 +2083=24 +2084=24 +2085=24 +2086=24 +2087=24 +2088=24 +2089=24 +2090=24 +2091=24 +2092=24 +2093=24 +2094=24 +2095=24 +2096=24 +2097=24 +2098=24 +2099=24 +2100=24 +2101=24 +2102=24 +2103=24 +2104=24 +2105=24 +2106=24 +2107=24 +2108=24 +2109=24 +2110=24 +2111=24 +2112=24 +2113=24 +2114=24 +2115=24 +2116=24 +2117=24 +2118=24 +2119=24 +2120=24 +2121=24 +2122=24 +2123=24 +2124=24 +2125=24 +2126=24 +2127=24 +2128=24 +2129=24 +2130=24 +2131=24 +2132=24 +2133=24 +2134=24 +2135=24 +2136=24 +2137=24 +2138=24 +2139=24 +2140=24 +2141=24 +2142=24 +2143=24 +2144=24 +2145=24 +2146=24 +2147=24 +2148=24 +2149=24 +2150=24 +2151=24 +2152=24 +2153=24 +2154=24 +2155=24 +2156=24 +2157=24 +2158=24 +2159=24 +2160=24 +2161=24 +2162=24 +2163=24 +2164=24 +2165=24 +2166=24 +2167=24 +2168=24 +2169=24 +2170=24 +2171=24 +2172=24 +2173=24 +2174=24 +2175=24 +2176=24 +2177=24 +2178=24 +2179=24 +2180=24 +2181=24 +2182=24 +2183=24 +2184=24 +2185=24 +2186=24 +2187=24 +2188=24 +2189=24 +2190=24 +2191=24 +2192=24 +2193=24 +2194=24 +2195=24 +2196=24 +2197=24 +2198=24 +2199=24 +2200=24 +2201=24 +2202=24 +2203=24 +2204=24 +2205=24 +2206=24 +2207=24 +2208=24 +2209=24 +2210=24 +2211=24 +2212=24 +2213=24 +2214=24 +2215=24 +2216=24 +2217=24 +2218=24 +2219=24 +2220=24 +2221=24 +2222=24 +2223=24 +2224=24 +2225=24 +2226=24 +2227=24 +2228=24 +2229=24 +2230=24 +2231=24 +2232=24 +2233=24 +2234=24 +2235=24 +2236=24 +2237=24 +2238=24 +2239=24 +2240=24 +2241=24 +2242=24 +2243=24 +2244=24 +2245=24 +2246=24 +2247=24 +2248=24 +2249=24 +2250=24 +2251=24 +2252=24 +2253=24 +2254=24 +2255=24 +2256=24 +2257=24 +2258=24 +2259=24 +2260=24 +2261=24 +2262=24 +2263=24 +2264=24 +2265=24 +2266=24 +2267=24 +2268=24 +2269=24 +2270=24 +2271=24 +2272=24 +2273=24 +2274=24 +2275=24 +2276=24 +2277=24 +2278=24 +2279=24 +2280=24 +2281=24 +2282=24 +2283=24 +2284=24 +2285=24 +2286=24 +2287=24 +2288=24 +2289=24 +2290=24 +2291=24 +2292=24 +2293=24 +2294=24 +2295=24 +2296=24 +2297=24 +2298=24 +2299=24 +2300=24 +2301=24 +2302=24 +2303=24 +2304=24 +2305=24 +2306=24 +2307=24 +2308=24 +2309=24 +2310=24 +2311=24 +2312=24 +2313=24 +2314=24 +2315=24 +2316=24 +2317=24 +2318=24 +2319=24 +2320=24 +2321=24 +2322=24 +2323=24 +2324=24 +2325=24 +2326=24 +2327=24 +2328=24 +2329=24 +2330=24 +2331=24 +2332=24 +2333=24 +2334=24 +2335=24 +2336=24 +2337=24 +2338=24 +2339=24 +2340=24 +2341=24 +2342=24 +2343=24 +2344=24 +2345=24 +2346=24 +2347=24 +2348=24 +2349=24 +2350=24 +2351=24 +2352=24 +2353=24 +2354=24 +2355=24 +2356=24 +2357=24 +2358=24 +2359=24 +2360=24 +2361=24 +2362=24 +2363=24 +2364=24 +2365=24 +2366=24 +2367=24 +2368=24 +2369=24 +2370=24 +2371=24 +2372=24 +2373=24 +2374=24 +2375=24 +2376=24 +2377=24 +2378=24 +2379=24 +2380=24 +2381=24 +2382=24 +2383=24 +2384=24 +2385=24 +2386=24 +2387=24 +2388=24 +2389=24 +2390=24 +2391=24 +2392=24 +2393=24 +2394=24 +2395=24 +2396=24 +2397=24 +2398=24 +2399=24 +2400=24 +2401=24 +2402=24 +2403=24 +2404=24 +2405=24 +2406=24 +2407=24 +2408=24 +2409=24 +2410=24 +2411=24 +2412=24 +2413=24 +2414=24 +2415=24 +2416=24 +2417=24 +2418=24 +2419=24 +2420=24 +2421=24 +2422=24 +2423=24 +2424=24 +2425=24 +2426=24 +2427=24 +2428=24 +2429=24 +2430=24 +2431=24 +2432=24 +2433=24 +2434=24 +2435=24 +2436=24 +2437=24 +2438=24 +2439=24 +2440=24 +2441=24 +2442=24 +2443=24 +2444=24 +2445=24 +2446=24 +2447=24 +2448=24 +2449=24 +2450=24 +2451=24 +2452=24 +2453=24 +2454=24 +2455=24 +2456=24 +2457=24 +2458=24 +2459=24 +2460=24 +2461=24 +2462=24 +2463=24 +2464=24 +2465=24 +2466=24 +2467=24 +2468=24 +2469=24 +2470=24 +2471=24 +2472=24 +2473=24 +2474=24 +2475=24 +2476=24 +2477=24 +2478=24 +2479=24 +2480=24 +2481=24 +2482=24 +2483=24 +2484=24 +2485=24 +2486=24 +2487=24 +2488=24 +2489=24 +2490=24 +2491=24 +2492=24 +2493=24 +2494=24 +2495=24 +2496=24 +2497=24 +2498=24 +2499=24 +2500=24 +2501=24 +2502=24 +2503=24 +2504=24 +2505=24 +2506=24 +2507=24 +2508=24 +2509=24 +2510=24 +2511=24 +2512=24 +2513=24 +2514=24 +2515=24 +2516=24 +2517=24 +2518=24 +2519=24 +2520=24 +2521=24 +2522=24 +2523=24 +2524=24 +2525=24 +2526=24 +2527=24 +2528=24 +2529=24 +2530=24 +2531=24 +2532=24 +2533=24 +2534=24 +2535=24 +2536=24 +2537=24 +2538=24 +2539=24 +2540=24 +2541=24 +2542=24 +2543=24 +2544=24 +2545=24 +2546=24 +2547=24 +2548=24 +2549=24 +2550=24 +2551=24 +2552=24 +2553=24 +2554=24 +2555=24 +2556=24 +2557=24 +2558=24 +2559=24 +2560=24 +2561=24 +2562=24 +2563=24 +2564=24 +2565=24 +2566=24 +2567=24 +2568=24 +2569=24 +2570=24 +2571=24 +2572=24 +2573=24 +2574=24 +2575=24 +2576=24 +2577=24 +2578=24 +2579=24 +2580=24 +2581=24 +2582=24 +2583=24 +2584=24 +2585=24 +2586=24 +2587=24 +2588=24 +2589=24 +2590=24 +2591=24 +2592=24 +2593=24 +2594=24 +2595=24 +2596=24 +2597=24 +2598=24 +2599=24 +2600=24 +2601=24 +2602=24 +2603=24 +2604=24 +2605=24 +2606=24 +2607=24 +2608=24 +2609=24 +2610=24 +2611=24 +2612=24 +2613=24 +2614=24 +2615=24 +2616=24 +2617=24 +2618=24 +2619=24 +2620=24 +2621=24 +2622=24 +2623=24 +2624=24 +2625=24 +2626=24 +2627=24 +2628=24 +2629=24 +2630=24 +2631=24 +2632=24 +2633=24 +2634=24 +2635=24 +2636=24 +2637=24 +2638=24 +2639=24 +2640=24 +2641=24 +2642=24 +2643=24 +2644=24 +2645=24 +2646=24 +2647=24 +2648=24 +2649=24 +2650=24 +2651=24 +2652=24 +2653=24 +2654=24 +2655=24 +2656=24 +2657=24 +2658=24 +2659=24 +2660=24 +2661=24 +2662=24 +2663=24 +2664=24 +2665=24 +2666=24 +2667=24 +2668=24 +2669=24 +2670=24 +2671=24 +2672=24 +2673=24 +2674=24 +2675=24 +2676=24 +2677=24 +2678=24 +2679=24 +2680=24 +2681=24 +2682=24 +2683=24 +2684=24 +2685=24 +2686=24 +2687=24 +2688=24 +2689=24 +2690=24 +2691=24 +2692=24 +2693=24 +2694=24 +2695=24 +2696=24 +2697=24 +2698=24 +2699=24 +2700=24 +2701=24 +2702=24 +2703=24 +2704=24 +2705=24 +2706=24 +2707=24 +2708=24 +2709=24 +2710=24 +2711=24 +2712=24 +2713=24 +2714=24 +2715=24 +2716=24 +2717=24 +2718=24 +2719=24 +2720=24 +2721=24 +2722=24 +2723=24 +2724=24 +2725=24 +2726=24 +2727=24 +2728=24 +2729=24 +2730=24 +2731=24 +2732=24 +2733=24 +2734=24 +2735=24 +2736=24 +2737=24 +2738=24 +2739=24 +2740=24 +2741=24 +2742=24 +2743=24 +2744=24 +2745=24 +2746=24 +2747=24 +2748=24 +2749=24 +2750=24 +2751=24 +2752=24 +2753=24 +2754=24 +2755=24 +2756=24 +2757=24 +2758=24 +2759=24 +2760=24 +2761=24 +2762=24 +2763=24 +2764=24 +2765=24 +2766=24 +2767=24 +2768=24 +2769=24 +2770=24 +2771=24 +2772=24 +2773=24 +2774=24 +2775=24 +2776=24 +2777=24 +2778=24 +2779=24 +2780=24 +2781=24 +2782=24 +2783=24 +2784=24 +2785=24 +2786=24 +2787=24 +2788=24 +2789=24 +2790=24 +2791=24 +2792=24 +2793=24 +2794=24 +2795=24 +2796=24 +2797=24 +2798=24 +2799=24 +2800=24 +2801=24 +2802=24 +2803=24 +2804=24 +2805=24 +2806=24 +2807=24 +2808=24 +2809=24 +2810=24 +2811=24 +2812=24 +2813=24 +2814=24 +2815=24 +2816=24 +2817=24 +2818=24 +2819=24 +2820=24 +2821=24 +2822=24 +2823=24 +2824=24 +2825=24 +2826=24 +2827=24 +2828=24 +2829=24 +2830=24 +2831=24 +2832=24 +2833=24 +2834=24 +2835=24 +2836=24 +2837=24 +2838=24 +2839=24 +2840=24 +2841=24 +2842=24 +2843=24 +2844=24 +2845=24 +2846=24 +2847=24 +2848=24 +2849=24 +2850=24 +2851=24 +2852=24 +2853=24 +2854=24 +2855=24 +2856=24 +2857=24 +2858=24 +2859=24 +2860=24 +2861=24 +2862=24 +2863=24 +2864=24 +2865=24 +2866=24 +2867=24 +2868=24 +2869=24 +2870=24 +2871=24 +2872=24 +2873=24 +2874=24 +2875=24 +2876=24 +2877=24 +2878=24 +2879=24 +2880=24 +2881=24 +2882=24 +2883=24 +2884=24 +2885=24 +2886=24 +2887=24 +2888=24 +2889=24 +2890=24 +2891=24 +2892=24 +2893=24 +2894=24 +2895=24 +2896=24 +2897=24 +2898=24 +2899=24 +2900=24 +2901=24 +2902=24 +2903=24 +2904=24 +2905=24 +2906=24 +2907=24 +2908=24 +2909=24 +2910=24 +2911=24 +2912=24 +2913=24 +2914=24 +2915=24 +2916=24 +2917=24 +2918=24 +2919=24 +2920=24 +2921=24 +2922=24 +2923=24 +2924=24 +2925=24 +2926=24 +2927=24 +2928=24 +2929=24 +2930=24 +2931=24 +2932=24 +2933=24 +2934=24 +2935=24 +2936=24 +2937=24 +2938=24 +2939=24 +2940=24 +2941=24 +2942=24 +2943=24 +2944=24 +2945=24 +2946=24 +2947=24 +2948=24 +2949=24 +2950=24 +2951=24 +2952=24 +2953=24 +2954=24 +2955=24 +2956=24 +2957=24 +2958=24 +2959=24 +2960=24 +2961=24 +2962=24 +2963=24 +2964=24 +2965=24 +2966=24 +2967=24 +2968=24 +2969=24 +2970=24 +2971=24 +2972=24 +2973=24 +2974=24 +2975=24 +2976=24 +2977=24 +2978=24 +2979=24 +2980=24 +2981=24 +2982=24 +2983=24 +2984=24 +2985=24 +2986=24 +2987=24 +2988=24 +2989=24 +2990=24 +2991=24 +2992=24 +2993=24 +2994=24 +2995=24 +2996=24 +2997=24 +2998=24 +2999=24 +3000=24 +3001=24 +3002=24 +3003=24 +3004=24 +3005=24 +3006=24 +3007=24 +3008=24 +3009=24 +3010=24 +3011=24 +3012=24 +3013=24 +3014=24 +3015=24 +3016=24 +3017=24 +3018=24 +3019=24 +3020=24 +3021=24 +3022=24 +3023=24 +3024=24 +3025=24 +3026=24 +3027=24 +3028=24 +3029=24 +3030=24 +3031=24 +3032=24 +3033=24 +3034=24 +3035=24 +3036=24 +3037=24 +3038=24 +3039=24 +3040=24 +3041=24 +3042=24 +3043=24 +3044=24 +3045=24 +3046=24 +3047=24 +3048=24 +3049=24 +3050=24 +3051=24 +3052=24 +3053=24 +3054=24 +3055=24 +3056=24 +3057=24 +3058=24 +3059=24 +3060=24 +3061=24 +3062=24 +3063=24 +3064=24 +3065=24 +3066=24 +3067=24 +3068=24 +3069=24 +3070=24 +3071=24 +3072=24 +3073=24 +3074=24 +3075=24 +3076=24 +3077=24 +3078=24 +3079=24 +3080=24 +3081=24 +3082=24 +3083=24 +3084=24 +3085=24 +3086=24 +3087=24 +3088=24 +3089=24 +3090=24 +3091=24 +3092=24 +3093=24 +3094=24 +3095=24 +3096=24 +3097=24 +3098=24 +3099=24 +3100=24 +3101=24 +3102=24 +3103=24 +3104=24 +3105=24 +3106=24 +3107=24 +3108=24 +3109=24 +3110=24 +3111=24 +3112=24 +3113=24 +3114=24 +3115=24 +3116=24 +3117=24 +3118=24 +3119=24 +3120=24 +3121=24 +3122=24 +3123=24 +3124=24 +3125=24 +3126=24 +3127=24 +3128=24 +3129=24 +3130=24 +3131=24 +3132=24 +3133=24 +3134=24 +3135=24 +3136=24 +3137=24 +3138=24 +3139=24 +3140=24 +3141=24 +3142=24 +3143=24 +3144=24 +3145=24 +3146=24 +3147=24 +3148=24 +3149=24 +3150=24 +3151=24 +3152=24 +3153=24 +3154=24 +3155=24 +3156=24 +3157=24 +3158=24 +3159=24 +3160=24 +3161=24 +3162=24 +3163=24 +3164=24 +3165=24 +3166=24 +3167=24 +3168=24 +3169=24 +3170=24 +3171=24 +3172=24 +3173=24 +3174=24 +3175=24 +3176=24 +3177=24 +3178=24 +3179=24 +3180=24 +3181=24 +3182=24 +3183=24 +3184=24 +3185=24 +3186=24 +3187=24 +3188=24 +3189=24 +3190=24 +3191=24 +3192=24 +3193=24 +3194=24 +3195=24 +3196=24 +3197=24 +3198=24 +3199=24 +3200=24 +3201=24 +3202=24 +3203=24 +3204=24 +3205=24 +3206=24 +3207=24 +3208=24 +3209=24 +3210=24 +3211=24 +3212=24 +3213=24 +3214=24 +3215=24 +3216=24 +3217=24 +3218=24 +3219=24 +3220=24 +3221=24 +3222=24 +3223=24 +3224=24 +3225=24 +3226=24 +3227=24 +3228=24 +3229=24 +3230=24 +3231=24 +3232=24 +3233=24 +3234=24 +3235=24 +3236=24 +3237=24 +3238=24 +3239=24 +3240=24 +3241=24 +3242=24 +3243=24 +3244=24 +3245=24 +3246=24 +3247=24 +3248=24 +3249=24 +3250=24 +3251=24 +3252=24 +3253=24 +3254=24 +3255=24 +3256=24 +3257=24 +3258=24 +3259=24 +3260=24 +3261=24 +3262=24 +3263=24 +3264=24 +3265=24 +3266=24 +3267=24 +3268=24 +3269=24 +3270=24 +3271=24 +3272=24 +3273=24 +3274=24 +3275=24 +3276=24 +3277=24 +3278=24 +3279=24 +3280=24 +3281=24 +3282=24 +3283=24 +3284=24 +3285=24 +3286=24 +3287=24 +3288=24 +3289=24 +3290=24 +3291=24 +3292=24 +3293=24 +3294=24 +3295=24 +3296=24 +3297=24 +3298=24 +3299=24 +3300=24 +3301=24 +3302=24 +3303=24 +3304=24 +3305=24 +3306=24 +3307=24 +3308=24 +3309=24 +3310=24 +3311=24 +3312=24 +3313=24 +3314=24 +3315=24 +3316=24 +3317=24 +3318=24 +3319=24 +3320=24 +3321=24 +3322=24 +3323=24 +3324=24 +3325=24 +3326=24 +3327=24 +3328=24 +3329=24 +3330=24 +3331=24 +3332=24 +3333=24 +3334=24 +3335=24 +3336=24 +3337=24 +3338=24 +3339=24 +3340=24 +3341=24 +3342=24 +3343=24 +3344=24 +3345=24 +3346=24 +3347=24 +3348=24 +3349=24 +3350=24 +3351=24 +3352=24 +3353=24 +3354=24 +3355=24 +3356=24 +3357=24 +3358=24 +3359=24 +3360=24 +3361=24 +3362=24 +3363=24 +3364=24 +3365=24 +3366=24 +3367=24 +3368=24 +3369=24 +3370=24 +3371=24 +3372=24 +3373=24 +3374=24 +3375=24 +3376=24 +3377=24 +3378=24 +3379=24 +3380=24 +3381=24 +3382=24 +3383=24 +3384=24 +3385=24 +3386=24 +3387=24 +3388=24 +3389=24 diff --git a/Themes/_fallback/Fonts/_korean 24px.ini b/Themes/_fallback/Fonts/_korean 24px.ini index 6516d246c4..1e8c45164f 100644 --- a/Themes/_fallback/Fonts/_korean 24px.ini +++ b/Themes/_fallback/Fonts/_korean 24px.ini @@ -1,45 +1,45 @@ -[common] -Top=5 -Baseline=26 -LineSpacing=28 -DefaultWidth=28 -TextureHints=grayscale 16bpp - -[jamo 1] -line 0=경고교굴기길나넛 -line 1=놀누는니단도듀라 -line 2=랑래랩레련로론루 -line 3=를리막매맨머몽밀 -line 4=바박배뱃뱩뱻벗브 -line 5=삐사샤서션스승신 -line 6=써쓰애야어에영옝 -line 7=와요워위유윤이잉 - -[jamo 2] -line 0=자잦잭젠준지직찾 -line 1=책초치캉커쿨크클 -line 2=키타틴파팍패플피 -line 3=하허혁현혠화정꿔 -line 4=와부담별컨츄꼬백 -line 5=호심아름다운대한 -line 6=민국성숙가감강같 -line 7=거건검게곡과구그 - -[jamo 3] -line 0=김께꼭꾸꿍난널네 -line 1=녀논눈님더돌둥드 -line 2=들따때또뛰띠렁렛 -line 3=룰른만말면모몰뫼 -line 4=뭐미발밴봐비뻐뻤 -line 5=뿌상소속수싫않알 -line 6=양억언엄업여연예 -line 7=오올우울원은을의 - -[jamo 4] -line 0=잊제젝조존좋줘증 -line 1=진집짜착찬처추칼 -line 2=큰탑터투트티펌페 -line 3=폼핑할함해행헤혀 -line 4=환회휘태난터까시 -line 5=간너샐러버문쳐달 -line 6=깡천림홍석 +[common] +Top=5 +Baseline=26 +LineSpacing=28 +DefaultWidth=28 +TextureHints=grayscale 16bpp + +[jamo 1] +line 0=경고교굴기길나넛 +line 1=놀누는니단도듀라 +line 2=랑래랩레련로론루 +line 3=를리막매맨머몽밀 +line 4=바박배뱃뱩뱻벗브 +line 5=삐사샤서션스승신 +line 6=써쓰애야어에영옝 +line 7=와요워위유윤이잉 + +[jamo 2] +line 0=자잦잭젠준지직찾 +line 1=책초치캉커쿨크클 +line 2=키타틴파팍패플피 +line 3=하허혁현혠화정꿔 +line 4=와부담별컨츄꼬백 +line 5=호심아름다운대한 +line 6=민국성숙가감강같 +line 7=거건검게곡과구그 + +[jamo 3] +line 0=김께꼭꾸꿍난널네 +line 1=녀논눈님더돌둥드 +line 2=들따때또뛰띠렁렛 +line 3=룰른만말면모몰뫼 +line 4=뭐미발밴봐비뻐뻤 +line 5=뿌상소속수싫않알 +line 6=양억언엄업여연예 +line 7=오올우울원은을의 + +[jamo 4] +line 0=잊제젝조존좋줘증 +line 1=진집짜착찬처추칼 +line 2=큰탑터투트티펌페 +line 3=폼핑할함해행헤혀 +line 4=환회휘태난터까시 +line 5=간너샐러버문쳐달 +line 6=깡천림홍석 diff --git a/Themes/_fallback/Fonts/_misc 16px.ini b/Themes/_fallback/Fonts/_misc 16px.ini index 7cea7c3a5f..2b44a545ce 100644 --- a/Themes/_fallback/Fonts/_misc 16px.ini +++ b/Themes/_fallback/Fonts/_misc 16px.ini @@ -1,35 +1,35 @@ -[main] -0=17 -1=17 -2=16 -3=14 -4=16 -5=24 -8=20 -9=4 -10=20 -11=4 -12=20 -13=15 -14=17 -15=14 -16=14 -17=18 -18=24 -19=22 -20=12 -21=12 -22=16 - - -AddToAllWidths=2 -Top=8 -Baseline=23 -LineSpacing=24 - -line 0=☆★♡♥Ω -map doublezeta=5 -map planet=6 - -line 1=←↑→↓☺Σ∠Δ -line 2=♩♪♫♬♭♮♯ +[main] +0=17 +1=17 +2=16 +3=14 +4=16 +5=24 +8=20 +9=4 +10=20 +11=4 +12=20 +13=15 +14=17 +15=14 +16=14 +17=18 +18=24 +19=22 +20=12 +21=12 +22=16 + + +AddToAllWidths=2 +Top=8 +Baseline=23 +LineSpacing=24 + +line 0=☆★♡♥Ω +map doublezeta=5 +map planet=6 + +line 1=←↑→↓☺Σ∠Δ +line 2=♩♪♫♬♭♮♯ diff --git a/Themes/_fallback/Fonts/frutiger 24px.ini b/Themes/_fallback/Fonts/frutiger 24px.ini index 7734e7e4a8..702c8cd9cd 100644 --- a/Themes/_fallback/Fonts/frutiger 24px.ini +++ b/Themes/_fallback/Fonts/frutiger 24px.ini @@ -1,392 +1,392 @@ -[main] -Baseline=23 -Top=6 -LineSpacing=28 -DrawExtraPixelsLeft=1 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 -0=10 -1=10 -2=10 -3=10 -4=10 -5=10 -6=10 -7=10 -8=10 -9=10 -10=10 -11=10 -12=10 -13=10 -14=10 -15=10 -16=10 -17=10 -18=10 -19=10 -20=10 -21=10 -22=10 -23=10 -24=10 -25=10 -26=10 -27=10 -28=10 -29=10 -30=10 -31=10 -32=7 -33=9 -34=13 -35=13 -36=13 -37=24 -38=17 -39=7 -40=8 -41=8 -42=13 -43=14 -44=7 -45=8 -46=7 -47=7 -48=13 -49=13 -50=13 -51=13 -52=13 -53=13 -54=13 -55=13 -56=13 -57=13 -58=7 -59=7 -60=14 -61=14 -62=14 -63=12 -64=19 -65=17 -66=15 -67=15 -68=17 -69=13 -70=12 -71=17 -72=17 -73=7 -74=9 -75=16 -76=12 -77=23 -78=17 -79=19 -80=13 -81=19 -82=15 -83=12 -84=13 -85=17 -86=16 -87=24 -88=16 -89=16 -90=13 -91=8 -92=7 -93=8 -94=14 -95=12 -96=7 -97=13 -98=15 -99=11 -100=15 -101=13 -102=9 -103=15 -104=15 -105=7 -106=7 -107=13 -108=7 -109=21 -110=15 -111=15 -112=15 -113=15 -114=9 -115=9 -116=9 -117=15 -118=12 -119=20 -120=12 -121=12 -122=12 -123=8 -124=5 -125=8 -126=14 -127=10 -128=13 -129=10 -130=7 -131=13 -132=13 -133=24 -134=13 -135=13 -136=7 -137=24 -138=12 -139=7 -140=23 -141=10 -142=13 -143=10 -144=10 -145=7 -146=7 -147=13 -148=13 -149=12 -150=12 -151=24 -152=7 -153=24 -154=9 -155=7 -156=23 -157=12 -158=10 -159=16 -160=7 -161=9 -162=13 -163=13 -164=13 -165=13 -166=5 -167=13 -168=7 -169=19 -170=9 -171=13 -172=14 -173=8 -174=19 -175=7 -176=10 -177=14 -178=9 -179=9 -180=7 -181=15 -182=14 -183=7 -184=7 -185=9 -186=10 -187=13 -188=20 -189=20 -190=20 -191=12 -192=17 -193=17 -194=17 -195=17 -196=17 -197=17 -198=23 -199=15 -200=13 -201=13 -202=13 -203=13 -204=7 -205=7 -206=7 -207=7 -208=17 -209=17 -210=19 -211=19 -212=19 -213=19 -214=19 -215=14 -216=19 -217=17 -218=17 -219=17 -220=17 -221=16 -222=13 -223=15 -224=13 -225=13 -226=13 -227=13 -228=13 -229=13 -230=21 -231=11 -232=13 -233=13 -234=13 -235=13 -236=7 -237=7 -238=7 -239=7 -240=15 -241=15 -242=15 -243=15 -244=15 -245=15 -246=15 -247=14 -248=15 -249=15 -250=15 -251=15 -252=15 -253=12 -254=15 -255=12 -[alt] -0=10 -1=10 -2=10 -3=10 -4=10 -5=10 -6=10 -7=10 -8=10 -9=10 -10=10 -11=10 -12=10 -13=10 -14=10 -15=10 -16=10 -17=10 -18=10 -19=10 -20=10 -21=10 -22=10 -23=10 -24=10 -25=10 -26=10 -27=10 -28=10 -29=10 -30=10 -31=10 -32=7 -33=12 -34=7 -35=12 -36=13 -37=10 -38=11 -39=13 -40=7 -41=12 -42=11 -43=9 -44=11 -45=8 -46=13 -47=11 -48=10 -49=11 -50=7 -51=7 -52=7 -53=7 -54=9 -55=7 -56=7 -57=9 -58=9 -59=7 -60=8 -61=7 -62=12 -63=8 -64=13 -65=17 -66=17 -67=12 -68=17 -69=10 -70=12 -71=15 -72=12 -73=13 -74=11 -75=13 -76=11 -77=7 -78=7 -79=13 -80=13 -81=13 -82=13 -83=19 -84=19 -85=13 -86=19 -87=14 -88=13 -89=12 -90=17 -91=12 -92=17 -93=16 -94=9 -95=15 -96=7 -97=13 -98=13 -99=11 -100=13 -101=5 -102=9 -103=11 -104=9 -105=13 -106=10 -107=13 -108=10 -109=7 -110=7 -111=13 -112=11 -113=11 -114=11 -115=15 -116=15 -117=11 -118=15 -119=14 -120=7 -121=11 -122=15 -123=11 -124=15 -125=12 -126=6 -127=7 +[main] +Baseline=23 +Top=6 +LineSpacing=28 +DrawExtraPixelsLeft=1 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 +0=10 +1=10 +2=10 +3=10 +4=10 +5=10 +6=10 +7=10 +8=10 +9=10 +10=10 +11=10 +12=10 +13=10 +14=10 +15=10 +16=10 +17=10 +18=10 +19=10 +20=10 +21=10 +22=10 +23=10 +24=10 +25=10 +26=10 +27=10 +28=10 +29=10 +30=10 +31=10 +32=7 +33=9 +34=13 +35=13 +36=13 +37=24 +38=17 +39=7 +40=8 +41=8 +42=13 +43=14 +44=7 +45=8 +46=7 +47=7 +48=13 +49=13 +50=13 +51=13 +52=13 +53=13 +54=13 +55=13 +56=13 +57=13 +58=7 +59=7 +60=14 +61=14 +62=14 +63=12 +64=19 +65=17 +66=15 +67=15 +68=17 +69=13 +70=12 +71=17 +72=17 +73=7 +74=9 +75=16 +76=12 +77=23 +78=17 +79=19 +80=13 +81=19 +82=15 +83=12 +84=13 +85=17 +86=16 +87=24 +88=16 +89=16 +90=13 +91=8 +92=7 +93=8 +94=14 +95=12 +96=7 +97=13 +98=15 +99=11 +100=15 +101=13 +102=9 +103=15 +104=15 +105=7 +106=7 +107=13 +108=7 +109=21 +110=15 +111=15 +112=15 +113=15 +114=9 +115=9 +116=9 +117=15 +118=12 +119=20 +120=12 +121=12 +122=12 +123=8 +124=5 +125=8 +126=14 +127=10 +128=13 +129=10 +130=7 +131=13 +132=13 +133=24 +134=13 +135=13 +136=7 +137=24 +138=12 +139=7 +140=23 +141=10 +142=13 +143=10 +144=10 +145=7 +146=7 +147=13 +148=13 +149=12 +150=12 +151=24 +152=7 +153=24 +154=9 +155=7 +156=23 +157=12 +158=10 +159=16 +160=7 +161=9 +162=13 +163=13 +164=13 +165=13 +166=5 +167=13 +168=7 +169=19 +170=9 +171=13 +172=14 +173=8 +174=19 +175=7 +176=10 +177=14 +178=9 +179=9 +180=7 +181=15 +182=14 +183=7 +184=7 +185=9 +186=10 +187=13 +188=20 +189=20 +190=20 +191=12 +192=17 +193=17 +194=17 +195=17 +196=17 +197=17 +198=23 +199=15 +200=13 +201=13 +202=13 +203=13 +204=7 +205=7 +206=7 +207=7 +208=17 +209=17 +210=19 +211=19 +212=19 +213=19 +214=19 +215=14 +216=19 +217=17 +218=17 +219=17 +220=17 +221=16 +222=13 +223=15 +224=13 +225=13 +226=13 +227=13 +228=13 +229=13 +230=21 +231=11 +232=13 +233=13 +234=13 +235=13 +236=7 +237=7 +238=7 +239=7 +240=15 +241=15 +242=15 +243=15 +244=15 +245=15 +246=15 +247=14 +248=15 +249=15 +250=15 +251=15 +252=15 +253=12 +254=15 +255=12 +[alt] +0=10 +1=10 +2=10 +3=10 +4=10 +5=10 +6=10 +7=10 +8=10 +9=10 +10=10 +11=10 +12=10 +13=10 +14=10 +15=10 +16=10 +17=10 +18=10 +19=10 +20=10 +21=10 +22=10 +23=10 +24=10 +25=10 +26=10 +27=10 +28=10 +29=10 +30=10 +31=10 +32=7 +33=12 +34=7 +35=12 +36=13 +37=10 +38=11 +39=13 +40=7 +41=12 +42=11 +43=9 +44=11 +45=8 +46=13 +47=11 +48=10 +49=11 +50=7 +51=7 +52=7 +53=7 +54=9 +55=7 +56=7 +57=9 +58=9 +59=7 +60=8 +61=7 +62=12 +63=8 +64=13 +65=17 +66=17 +67=12 +68=17 +69=10 +70=12 +71=15 +72=12 +73=13 +74=11 +75=13 +76=11 +77=7 +78=7 +79=13 +80=13 +81=13 +82=13 +83=19 +84=19 +85=13 +86=19 +87=14 +88=13 +89=12 +90=17 +91=12 +92=17 +93=16 +94=9 +95=15 +96=7 +97=13 +98=13 +99=11 +100=13 +101=5 +102=9 +103=11 +104=9 +105=13 +106=10 +107=13 +108=10 +109=7 +110=7 +111=13 +112=11 +113=11 +114=11 +115=15 +116=15 +117=11 +118=15 +119=14 +120=7 +121=11 +122=15 +123=11 +124=15 +125=12 +126=6 +127=7 diff --git a/Themes/_fallback/Graphics/CombinedLifeMeterTug frame.redir b/Themes/_fallback/Graphics/CombinedLifeMeterTug frame.redir index 56cf597902..c700c90d39 100644 --- a/Themes/_fallback/Graphics/CombinedLifeMeterTug frame.redir +++ b/Themes/_fallback/Graphics/CombinedLifeMeterTug frame.redir @@ -1 +1 @@ -_blank +_blank diff --git a/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua b/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua index 2891a47698..26c8a67907 100644 --- a/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua +++ b/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua @@ -1,3 +1,3 @@ -return Def.Quad{ - InitCommand=cmd(zoomto,4,22;diffuse,color("#AABBDD")); +return Def.Quad{ + InitCommand=cmd(zoomto,4,22;diffuse,color("#AABBDD")); }; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p1.redir b/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p1.redir index 56cf597902..c700c90d39 100644 --- a/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p1.redir +++ b/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p1.redir @@ -1 +1 @@ -_blank +_blank diff --git a/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p2.redir b/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p2.redir index 56cf597902..c700c90d39 100644 --- a/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p2.redir +++ b/Themes/_fallback/Graphics/CombinedLifeMeterTug tip p2.redir @@ -1 +1 @@ -_blank +_blank diff --git a/Themes/_fallback/Graphics/EditMenu left.lua b/Themes/_fallback/Graphics/EditMenu left.lua index 1235d7f7e6..41ab6ce449 100644 --- a/Themes/_fallback/Graphics/EditMenu left.lua +++ b/Themes/_fallback/Graphics/EditMenu left.lua @@ -1,8 +1,8 @@ -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,10,10;y,-5;skewx,-1); - }; - Def.Quad { - InitCommand=cmd(zoomto,10,10;y,5;skewx,1); - }; +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,10,10;y,-5;skewx,-1); + }; + Def.Quad { + InitCommand=cmd(zoomto,10,10;y,5;skewx,1); + }; } \ No newline at end of file diff --git a/Themes/_fallback/Graphics/EditMenu right.lua b/Themes/_fallback/Graphics/EditMenu right.lua index 7ebcff1ccf..3f898fc4a4 100644 --- a/Themes/_fallback/Graphics/EditMenu right.lua +++ b/Themes/_fallback/Graphics/EditMenu right.lua @@ -1,8 +1,8 @@ -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,10,10;y,-5;skewx,1); - }; - Def.Quad { - InitCommand=cmd(zoomto,10,10;y,5;skewx,-1); - }; +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,10,10;y,-5;skewx,1); + }; + Def.Quad { + InitCommand=cmd(zoomto,10,10;y,5;skewx,-1); + }; } \ No newline at end of file diff --git a/Themes/_fallback/Graphics/Player combo/default.lua b/Themes/_fallback/Graphics/Player combo/default.lua index d91994c988..8ac9b38a1d 100644 --- a/Themes/_fallback/Graphics/Player combo/default.lua +++ b/Themes/_fallback/Graphics/Player combo/default.lua @@ -1,113 +1,113 @@ -local c; -local player = Var "Player"; -local ShowComboAt = THEME:GetMetric("Combo", "ShowComboAt"); -local Pulse = THEME:GetMetric("Combo", "PulseCommand"); -local PulseLabel = THEME:GetMetric("Combo", "PulseLabelCommand"); - -local NumberMinZoom = THEME:GetMetric("Combo", "NumberMinZoom"); -local NumberMaxZoom = THEME:GetMetric("Combo", "NumberMaxZoom"); -local NumberMaxZoomAt = THEME:GetMetric("Combo", "NumberMaxZoomAt"); - -local LabelMinZoom = THEME:GetMetric("Combo", "LabelMinZoom"); -local LabelMaxZoom = THEME:GetMetric("Combo", "LabelMaxZoom"); - -local t = Def.ActorFrame { - InitCommand=cmd(vertalign,bottom); - LoadFont( "Combo", "numbers" ) .. { - Name="Number"; - OnCommand = THEME:GetMetric("Combo", "NumberOnCommand"); - }; - LoadFont("Common Normal") .. { - Name="Label"; - OnCommand = THEME:GetMetric("Combo", "LabelOnCommand"); - }; - - InitCommand = function(self) - c = self:GetChildren(); - c.Number:visible(false); - c.Label:visible(false); - end; - -- Milestones: - -- 25,50,100,250,600 Multiples; ---[[ if (iCombo % 100) == 0 then - c.OneHundredMilestone:playcommand("Milestone"); - elseif (iCombo % 250) == 0 then - -- It should really be 1000 but thats slightly unattainable, since - -- combo doesnt save over now. - c.OneThousandMilestone:playcommand("Milestone"); - else - return - end; --]] - TwentyFiveMilestoneCommand=function(self,parent) - (cmd(skewy,-0.125;decelerate,0.325;skewy,0))(self); - end; - ToastyAchievedMessageCommand=function(self,params) - if params.PlayerNumber == player then - (cmd(thump,2;effectclock,'beat'))(self); - end; - end; - ComboCommand=function(self, param) - local iCombo = param.Misses or param.Combo; - if not iCombo or iCombo < ShowComboAt then - c.Number:visible(false); - c.Label:visible(false); - return; - end - - local labeltext = ""; - if param.Combo then - labeltext = "COMBO"; --- c.Number:playcommand("Reset"); - else - labeltext = "MISSES"; --- c.Number:playcommand("Miss"); - end - c.Label:settext( labeltext ); - c.Label:visible(false); - - param.Zoom = scale( iCombo, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom ); - param.Zoom = clamp( param.Zoom, NumberMinZoom, NumberMaxZoom ); - - param.LabelZoom = scale( iCombo, 0, NumberMaxZoomAt, LabelMinZoom, LabelMaxZoom ); - param.LabelZoom = clamp( param.LabelZoom, LabelMinZoom, LabelMaxZoom ); - - c.Number:visible(true); - c.Label:visible(true); - c.Number:settext( string.format("%i", iCombo) ); - -- FullCombo Rewards - if param.FullComboW1 then - c.Number:diffuse(color("#00aeef")); - c.Number:glowshift(); - elseif param.FullComboW2 then - c.Number:diffuse(color("#fff568")); - c.Number:glowshift(); - elseif param.FullComboW3 then - c.Number:diffuse(color("#a4ff00")); - c.Number:stopeffect(); - elseif param.Combo then - c.Number:diffuse(Color("White")); --- c.Number:diffuse(PlayerColor(player)); - c.Number:stopeffect(); - (cmd(diffuse,Color("White");diffusebottomedge,color("0.5,0.5,0.5,1")))(c.Label); - else - c.Number:diffuse(color("#ff0000")); - c.Number:stopeffect(); - (cmd(diffuse,Color("Red");diffusebottomedge,color("0.5,0,0,1")))(c.Label); - end - -- Pulse - Pulse( c.Number, param ); - PulseLabel( c.Label, param ); - -- Milestone Logic - end; ---[[ ScoreChangedMessageCommand=function(self,param) - local iToastyCombo = param.ToastyCombo; - if iToastyCombo and (iToastyCombo > 0) then --- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) --- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) - else --- c.Number:stopeffect(); - end; - end; --]] -}; - -return t; +local c; +local player = Var "Player"; +local ShowComboAt = THEME:GetMetric("Combo", "ShowComboAt"); +local Pulse = THEME:GetMetric("Combo", "PulseCommand"); +local PulseLabel = THEME:GetMetric("Combo", "PulseLabelCommand"); + +local NumberMinZoom = THEME:GetMetric("Combo", "NumberMinZoom"); +local NumberMaxZoom = THEME:GetMetric("Combo", "NumberMaxZoom"); +local NumberMaxZoomAt = THEME:GetMetric("Combo", "NumberMaxZoomAt"); + +local LabelMinZoom = THEME:GetMetric("Combo", "LabelMinZoom"); +local LabelMaxZoom = THEME:GetMetric("Combo", "LabelMaxZoom"); + +local t = Def.ActorFrame { + InitCommand=cmd(vertalign,bottom); + LoadFont( "Combo", "numbers" ) .. { + Name="Number"; + OnCommand = THEME:GetMetric("Combo", "NumberOnCommand"); + }; + LoadFont("Common Normal") .. { + Name="Label"; + OnCommand = THEME:GetMetric("Combo", "LabelOnCommand"); + }; + + InitCommand = function(self) + c = self:GetChildren(); + c.Number:visible(false); + c.Label:visible(false); + end; + -- Milestones: + -- 25,50,100,250,600 Multiples; +--[[ if (iCombo % 100) == 0 then + c.OneHundredMilestone:playcommand("Milestone"); + elseif (iCombo % 250) == 0 then + -- It should really be 1000 but thats slightly unattainable, since + -- combo doesnt save over now. + c.OneThousandMilestone:playcommand("Milestone"); + else + return + end; --]] + TwentyFiveMilestoneCommand=function(self,parent) + (cmd(skewy,-0.125;decelerate,0.325;skewy,0))(self); + end; + ToastyAchievedMessageCommand=function(self,params) + if params.PlayerNumber == player then + (cmd(thump,2;effectclock,'beat'))(self); + end; + end; + ComboCommand=function(self, param) + local iCombo = param.Misses or param.Combo; + if not iCombo or iCombo < ShowComboAt then + c.Number:visible(false); + c.Label:visible(false); + return; + end + + local labeltext = ""; + if param.Combo then + labeltext = "COMBO"; +-- c.Number:playcommand("Reset"); + else + labeltext = "MISSES"; +-- c.Number:playcommand("Miss"); + end + c.Label:settext( labeltext ); + c.Label:visible(false); + + param.Zoom = scale( iCombo, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom ); + param.Zoom = clamp( param.Zoom, NumberMinZoom, NumberMaxZoom ); + + param.LabelZoom = scale( iCombo, 0, NumberMaxZoomAt, LabelMinZoom, LabelMaxZoom ); + param.LabelZoom = clamp( param.LabelZoom, LabelMinZoom, LabelMaxZoom ); + + c.Number:visible(true); + c.Label:visible(true); + c.Number:settext( string.format("%i", iCombo) ); + -- FullCombo Rewards + if param.FullComboW1 then + c.Number:diffuse(color("#00aeef")); + c.Number:glowshift(); + elseif param.FullComboW2 then + c.Number:diffuse(color("#fff568")); + c.Number:glowshift(); + elseif param.FullComboW3 then + c.Number:diffuse(color("#a4ff00")); + c.Number:stopeffect(); + elseif param.Combo then + c.Number:diffuse(Color("White")); +-- c.Number:diffuse(PlayerColor(player)); + c.Number:stopeffect(); + (cmd(diffuse,Color("White");diffusebottomedge,color("0.5,0.5,0.5,1")))(c.Label); + else + c.Number:diffuse(color("#ff0000")); + c.Number:stopeffect(); + (cmd(diffuse,Color("Red");diffusebottomedge,color("0.5,0,0,1")))(c.Label); + end + -- Pulse + Pulse( c.Number, param ); + PulseLabel( c.Label, param ); + -- Milestone Logic + end; +--[[ ScoreChangedMessageCommand=function(self,param) + local iToastyCombo = param.ToastyCombo; + if iToastyCombo and (iToastyCombo > 0) then +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) + else +-- c.Number:stopeffect(); + end; + end; --]] +}; + +return t; diff --git a/Themes/_fallback/Graphics/Player judgment/default.lua b/Themes/_fallback/Graphics/Player judgment/default.lua index 8a56b692b5..8a4ad4dfe0 100644 --- a/Themes/_fallback/Graphics/Player judgment/default.lua +++ b/Themes/_fallback/Graphics/Player judgment/default.lua @@ -1,81 +1,81 @@ -local c; -local player = Var "Player"; - -local JudgeCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); -}; - -local ProtimingCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); -}; - -local TNSFrames = { - TapNoteScore_W1 = 0; - TapNoteScore_W2 = 1; - TapNoteScore_W3 = 2; - TapNoteScore_W4 = 3; - TapNoteScore_W5 = 4; - TapNoteScore_Miss = 5; -}; -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - LoadActor(THEME:GetPathG("Judgment","Normal")) .. { - Name="Judgment"; - InitCommand=cmd(pause;visible,false); - OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - LoadFont("Common Normal") .. { - Name="ProtimingDisplay"; - Text=""; - InitCommand=cmd(visible,false); - OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - - InitCommand = function(self) - c = self:GetChildren(); - end; - - JudgmentMessageCommand=function(self, param) - if param.Player ~= player then return end; - if param.HoldNoteScore then return end; - - local iNumStates = c.Judgment:GetNumStates(); - local iFrame = TNSFrames[param.TapNoteScore]; - - local iTapNoteOffset = param.TapNoteOffset; - - if not iFrame then return end - if iNumStates == 12 then - iFrame = iFrame * 2; - if not param.Early then - iFrame = iFrame + 1; - end - end - - self:playcommand("Reset"); - - c.Judgment:visible( true ); - c.Judgment:setstate( iFrame ); - JudgeCmds[param.TapNoteScore](c.Judgment); - ---~ c.ProtimingDisplay:visible( true ); - c.ProtimingDisplay:settext( math.floor(math.abs(param.TapNoteOffset * 1000)) ); - ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); - - end; -}; - - -return t; +local c; +local player = Var "Player"; + +local JudgeCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); +}; + +local ProtimingCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); +}; + +local TNSFrames = { + TapNoteScore_W1 = 0; + TapNoteScore_W2 = 1; + TapNoteScore_W3 = 2; + TapNoteScore_W4 = 3; + TapNoteScore_W5 = 4; + TapNoteScore_Miss = 5; +}; +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + LoadActor(THEME:GetPathG("Judgment","Normal")) .. { + Name="Judgment"; + InitCommand=cmd(pause;visible,false); + OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Common Normal") .. { + Name="ProtimingDisplay"; + Text=""; + InitCommand=cmd(visible,false); + OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + + InitCommand = function(self) + c = self:GetChildren(); + end; + + JudgmentMessageCommand=function(self, param) + if param.Player ~= player then return end; + if param.HoldNoteScore then return end; + + local iNumStates = c.Judgment:GetNumStates(); + local iFrame = TNSFrames[param.TapNoteScore]; + + local iTapNoteOffset = param.TapNoteOffset; + + if not iFrame then return end + if iNumStates == 12 then + iFrame = iFrame * 2; + if not param.Early then + iFrame = iFrame + 1; + end + end + + self:playcommand("Reset"); + + c.Judgment:visible( true ); + c.Judgment:setstate( iFrame ); + JudgeCmds[param.TapNoteScore](c.Judgment); + +--~ c.ProtimingDisplay:visible( true ); + c.ProtimingDisplay:settext( math.floor(math.abs(param.TapNoteOffset * 1000)) ); + ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); + + end; +}; + + +return t; diff --git a/Themes/_fallback/Graphics/ScreenMapControllers exit.lua b/Themes/_fallback/Graphics/ScreenMapControllers exit.lua index 30d51e6f23..08c62f7eb7 100644 --- a/Themes/_fallback/Graphics/ScreenMapControllers exit.lua +++ b/Themes/_fallback/Graphics/ScreenMapControllers exit.lua @@ -1,10 +1,10 @@ -return LoadFont("Common Normal") .. { - Text="Exit"; - InitCommand=cmd(x,SCREEN_CENTER_X;zoom,0.75;shadowlength,0;diffuse,color("#808080")); - OnCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1); - OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"); - HideCommand=cmd(hidden,true); - - GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")); - LoseFocusCommand=cmd(stopeffect); -}; +return LoadFont("Common Normal") .. { + Text="Exit"; + InitCommand=cmd(x,SCREEN_CENTER_X;zoom,0.75;shadowlength,0;diffuse,color("#808080")); + OnCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1); + OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"); + HideCommand=cmd(hidden,true); + + GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")); + LoseFocusCommand=cmd(stopeffect); +}; diff --git a/Themes/_fallback/Graphics/ScreenPrompt cursor.lua b/Themes/_fallback/Graphics/ScreenPrompt cursor.lua index 499a1103cc..6dc2d32472 100644 --- a/Themes/_fallback/Graphics/ScreenPrompt cursor.lua +++ b/Themes/_fallback/Graphics/ScreenPrompt cursor.lua @@ -1,3 +1,3 @@ -return Def.Quad{ - InitCommand=cmd(setsize,96,28;diffuse,color("#44CCFFCC");); +return Def.Quad{ + InitCommand=cmd(setsize,96,28;diffuse,color("#44CCFFCC");); }; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua b/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua index e1d3b5882a..bf5b1c4711 100644 --- a/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua +++ b/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua @@ -1,11 +1,11 @@ -local gc = Var("GameCommand"); - -local t = Def.ActorFrame {}; - -t[#t+1] = LoadFont("Common Normal") .. { - Text=gc:GetName(); -}; - -t.GainFocusCommand=cmd(visible,true); -t.LoseFocusCommand=cmd(visible,false); +local gc = Var("GameCommand"); + +local t = Def.ActorFrame {}; + +t[#t+1] = LoadFont("Common Normal") .. { + Text=gc:GetName(); +}; + +t.GainFocusCommand=cmd(visible,true); +t.LoseFocusCommand=cmd(visible,false); return t; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScrollBar TickThumb.lua b/Themes/_fallback/Graphics/ScrollBar TickThumb.lua index ee3986645f..0c8ff6249f 100644 --- a/Themes/_fallback/Graphics/ScrollBar TickThumb.lua +++ b/Themes/_fallback/Graphics/ScrollBar TickThumb.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,32,32); - }; -}; - +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,32,32); + }; +}; + return t \ No newline at end of file diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 7314f129ad..44ee600478 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -1,2325 +1,2325 @@ -[Common] -WindowTitle=StepMania -StepMania=StepMania - -[Arch] -Couldn't create a movie driver.=Couldn't create a movie driver. -Input Handlers cannot be empty.=Input Handlers can not be empty. -Movie Drivers cannot be empty.=Movie Drivers can not be empty. -Sound Drivers cannot be empty.=Sound Drivers can not be empty. - -[ArchHooks_Unix] -Couldn't find 'Songs'=Couldn't find 'Songs' - -[CSMPackageInstallDlg] -Could not open file '%s'.=Could not open file '%s'. -Installing. Please wait...=Installing. Please wait... -'%s' is not a valid zip archive.='%s' is not a valid zip archive. -Error opening source file '%s': %s=Error opening source file '%s': %s -Error opening destination file '%s': %s=Error opening destination file '%s': %s -Error copying file '%s': %s=Error copying file '%s': %s -No Installations found. Exiting.=No Installations found. Exiting. -Package installed successfully!=Package installed successfully! - -[CSmpackageApp] -The file Stats.xml has not yet been created. It will be created once the game is run.=The file Stats.xml has not yet been created. It will be created once the game is run. -Failed to open '%s': %s=Failed to open '%s': %s -The file '%s' does not exist. Aborting installation.=The file '%s' does not exist. Aborting installation. - -[CSmpackageExportDlg] -No items are checked.=No items are checked. -Successfully exported package '%s' to your Desktop.=Successfully exported package '%s' to your Desktop. -The following packages failed to export:=The following packages failed to export: -The following packages were exported to your Desktop:=The following packages were exported to your Desktop: - -[CatalogXml] -Saving %s ...=Saving %s ... - -[CustomDifficulty] -Beginner=Novice -Easy=Easy -Medium=Medium -Hard=Hard -Challenge=Expert -Edit=Edit -Couple=Couple -Routine=Routine -# -Freestyle=Freestyle -Crazy=Crazy -Nightmare=Nightmare -HalfDouble=Half-Double - -[CourseDifficulty] -Beginner=Novice -Challenge=Expert -Hard=Hard -Easy=Easy -Edit=Edit -Medium=Medium - -[CourseEntryType] -Best=Players' Best -Fixed=Fixed Song -Random=Random Song -RandomWithinGroup=Random Song Within Group -Worst=Players' Worst - -[CourseType] -Endless=Endless -Nonstop=Nonstop -Oni=Oni -Survival=Survival - -[EditInstallations] -You must type a program directory before clicking Add.=You must type a program directory before clicking Add. -'%s' is not a valid installation directory.='%s' is not a valid installation directory. - -[EditMenuAction] -Create=Create New -Delete=Delete Existing -Edit=Edit Existing -Practice=Practice - -[EditMenu] -Blank=Blank - -[EditMenuRow] -Action=Action -Group=Group -Song=Song -SourceSteps=Fill Steps -SourceStepsType=Fill Type -Steps=Steps -StepsType=Type - -[GameButton] -Back=Back -Down=Down -Center=Center -DownLeft=DownLeft -DownRight=DownRight -Coin=Insert Coin -Left=Left -MenuDown=MenuDown -MenuLeft=MenuLeft -MenuRight=MenuRight -MenuUp=MenuUp -Operator=Operator -EffectUp=EffectUp -EffectDown=EffectDown -Right=Right -Select=Select -Start=Start -Up=Up -UpLeft=UpLeft -UpRight=UpRight -Key1=Key 1 -Key2=Key 2 -Key3=Key 3 -Key4=Key 4 -Key5=Key 5 -Key6=Key 6 -Key7=Key 7 -Scratch up=Scratch up -Scratch down=Scratch down -Fret1=Fret 1 -Fret2=Fret 2 -Fret3=Fret 3 -Fret4=Fret 4 -Fret5=Fret 5 -StrumUp=Strum Up -StrumDown=Strum Down -Tilt=Tilt -FootUpLeft=FootUpLeft -FootUpRight=FootUpRight -FootDown=FootDown -HandUpLeft=HandUpLeft -HandUpRight=HandUpRight -HandLrLeft=HandLrLeft -HandLrRight=HandLrRight - -[GameCommand] -Could not launch web browser.=Could not launch web browser. - -[GameState] -CPU=CPU -Player 1=Player 1 -Player 2=Player 2 - -[Headers] -Edit Courses=Edit Courses -Edit Steps=Edit Steps -Jukebox=Jukebox -Log In=Log In -Theme Options=Theme Options -Network Options=Network Options -Export Packages=Export Packages -Select Character=Select Character -Select Course=Select Course -Select Difficulty=Select Difficulty -Select Music=Select Music -Select Style=Select Style -Set Time=Set Time -Summary=Summary -Test Input=Test Input -Results=Results - -[HoldNoteScore] -Held=OK -LetGo=NG -None=None - -[InputMapper] -Connected=Connected -Disconnected=Disconnected -Auto-mapping all joysticks.=Auto-mapping all joysticks. - -[Language] -Name=English - -[LanguagesDlg] -Error parsing file '%s'.=Error parsing file '%s'. -Error reading '%s'.=Error reading '%s'. -Error reading line '%s' from '%s': Each line must have either 3 or 4 values. This row has %d values.=Error reading line '%s' from '%s': Each line must have either 3 or 4 values. This row has %d values. -Error reading file '%s'.=Error reading file '%s'. -Exported to your Desktop as '%s'.=Exported to your Desktop as '%s'. -Failed to save '%s'.=Failed to save '%s'. -Imported %d strings into '%s'.\n - %d were added.\n - %d were modified\n - %d were unchanged\n - %d empty strings were ignored=Imported %d strings into '%s'.\n - %d were added.\n - %d were modified\n - %d were unchanged\n - %d empty strings were ignored -Importing these strings will override all data in '%s'. Continue?=Importing these strings will overwrite all data in '%s'. Continue? -There are no strings to export for this language.=There are no strings to export for this language. -This will permanently delete '%s'. Continue?=This will permanently delete '%s'. Continue? - -[LowLevelWindow_X11] -Failed to establish a connection with the X server=Failed to establish a connection with the X server - -[MainMenuDlg] -'%s' cleared='%s' cleared -'%s' doesn't exist. It will be created next time you start the game.='%s' doesn't exist. It will be created next time you start the game. -'%s' is already cleared.='%s' is already cleared. -Failed to copy music file '%s' to '%s': %s=Failed to copy music file '%s' to '%s': %s -Failed to create directory '%s': %s=Failed to create directory '%s': %s -Failed to create song directory '%s': %s=Failed to create song directory '%s': %s -Failed to create the song file '%s'.=Failed to create the song file '%s'. -Failed to delete file '%s'.=Failed to delete file '%s'. -Failed to open '%s': %s=Failed to open '%s': %s -Music file=Music file -Success. Created the song '%s'.=Success. Created the song '%s'. -The song directory '%s' already exists. You cannot override an existing song.=The song directory '%s' already exists. You can not overwrite an existing song. - -[MultiPlayer] -P1=P1 -P2=P2 -P3=P3 -P4=P4 -P5=P5 -P6=P6 -P7=P7 -P8=P8 -P9=P9 -P10=P10 -P11=P11 -P12=P12 -P13=P13 -P14=P14 -P15=P15 -P16=P16 -P17=P17 -P18=P18 -P19=P19 -P20=P20 -P21=P21 -P22=P22 -P23=P23 -P24=P24 -P25=P25 -P26=P26 -P27=P27 -P28=P28 -P29=P29 -P30=P30 -P31=P31 -P32=P32 - -[MusicWheel] -ArtistText=Artist -BpmText=BPM -EasyMeterText=Easy Rank -GenreText=Genre -GroupText=Group -HardMeterText=Hard Rank -ChallengeMeterText=Challenge Rank -DoubleEasyMeterText=Easy Rank (Double) -DoubleMediumMeterText=Medium Rank (Double) -DoubleHardMeterText=Hard Rank (Double) -DoubleChallengeMeterText=Challenge Rank (Double) -LengthText=Length -MediumMeterText=Medium Rank -PopularityText=Player's Best! -Portal=Portal -PreferredText=Preferred -Random=Random -Roulette=Roulette -TitleText=Title -RecentText=Recent -TopGradesText=Top Grades -CoursesText=Courses -AllCoursesText=All Courses -NonstopText=Nonstop Courses -OniText=Oni Courses -EndlessText=Endless Courses -SurvivalText=Survival Courses -NormalModeText=Normal Mode -BattleModeText=Battle Mode (Disabled) - -[NetworkSyncManager] -Connection failed.=Connection failed. -Connection to '%s' successful.=Connection to '%s' successful. -Connection to server dropped.=Connection to server dropped. -Initializing Client Network...=Initializing Client Network... -Not Supported=Mode not supported while networked. - -[NoteType] -4th=4th -8th=8th -12th=12th -16th=16th -24th=24th -32nd=32nd -48th=48th -64th=64th -192nd=192nd - -[OptionExplanations] -Accel=Accelerate, Decelerate or otherwise adjust the arrow speed. -AllowExtraStage=When enabled (and Event Mode isn't on), allows the player to earn extra stages after completing certain requirements. -AllowW1=Enable or disable fantastic judgement. NEVER - never show Fantastic, COURSES ONLY - only during nonstop/oni modes, ALWAYS - all modes of play. -Announcer=Choose from this list of installed announcer packs. -Appearance=Appearance -Appearance Options=Change the theme, announcer, and other style options. -Theme Options=Change theme specific features and functions. -ArcadeOptionsNavigation=&oq;SM style&cq;: Start button moves to End, Up/Down switches between option lines. &oq;Arcade style&cq;: Start button moves cursor to next option line (Up/Down ignored). -Assist=Assist -Attacks=Choose whether non-course attacks will appear during gameplay. -AttractSoundFrequency=Set to ALWAYS to play sound every during the attract screens. Set to N TIMES to play sounds every N attract sequences. -AutoAdjust=AutoAdjust -AutoMapOnJoyChange=If this setting is &oq;On&cq;, the game will remap joysticks if they were not previously connected. Turning auto mapping on will override any manually defined mappings. -AutoPlay=This option is useful for those who would like to play without using a pad. However, you will not be able to set high scores or earn extra stages while this option is ON. -AutogenGroupCourses=Show group Nonstop and Endless courses that were created by Autogen. -AutogenSteps=Automatically generate steps from other game types. -BGBrightness=Controls how bright the background will appear. Turn this setting down if you have a hard time seeing the notes. -Background=Change options that control the backgrounds that play during gameplay. -BarDrain=BarDrain -BatLives=BatLives -Bookkeeping=Check coin drop statistics. -Calibrate Machine Sync=Calibrate the audio synchronization. -CelShadeModels=Choose if dancing characters are drawn with cel shading. -Center Image=Center the image on your monitor. -Characters=Characters -Clear Bookkeeping Data=Clear all coin drop data. -Clear Machine Edits=Save all step edits saved to this machine. -Clear USB edits=Clear USB edits -Clear Machine Stats=Clear all scores saved to this machine. -CoinMode=&oq;Home&cq;: Options are shown on the Title Menu. &oq;Pay&cq;: Title Menu choices are hidden; must insert coins before playing. &oq;Free Play&cq;: Title Menu choices are hidden; Play without inserting coins. -CoinModeNoHome=When set to PAY you must insert coins before joining in. When set to FREE you can join in without inserting coins. -CoinsPerCredit=The number of coins that must be inserted before a player can join. (when Coin Mode = Pay) -Connection=Connect to Server (To be specified) -CourseSortOrder=Determines how courses are sorted. -CreateNew= -Create New Course=Create a new course. -Create New Profile=Create a new player profile. -DancePointsForOni=Toggle whether the score in Oni mode displays Dance Points or the Percent Score. -DefaultFailType=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. OFF disables fail. -DefaultFailTypeNoOff=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. -DefaultNoteSkin=Choose the default noteskin to use when playing. -DelayedBack=If &oq;On&cq;, requires holding the Back button for 0.5 seconds to quit. Useful if you find yourself accidentally pressing the Back button on your controller. -DelayedTextureDelete=Set to ON hold textures in memory instead of freeing them. This will eliminate the time needed to load the texture next from disk next time this is needed. Do not set to ON unless you have 128MB of memory or more. -Delete= -Difficulty= -DisplayAspectRatio=Change the width-to-height ratio of graphics in the game. Most displays are 4:3. -DisplayColorDepth=Choose the color depth of the window. This option may not take effect in windowed mode. -DisplayResolution=Choose the output resolution. A higher resolution will show more detail, but requires a faster video card. -EasterEggs=Enable or disable some special easter eggs. -Edit Courses=Edit Courses -Edit Songs/Steps=Edit Songs/Steps -Practice Songs/Steps=Practice Songs/Steps -EditorShowBGChangesPlay=Choose whether to display song backgrounds while playing. -Effect=Effect -EnableAttackSounds=If enabled, a sound effect will play when an attack begins or ends. -EnableMineHitSound=If enabled, a sound will play when a mine is stepped on. -EventMode=When set to &oq;ON&cq;, and you can continue playing forever. Failing will also take you back to the the Select Music or Select Course screen. -Exit= -Fail=Fail -FastLoad=If enabled, don't check songs for changes on load. -Fill Machine Stats= -Game=Change the current game type with this option. -GetRankingName=Determines if name entry should never be shown, always be shown, or shown when the course is listed on the high scores screen. -Graphics/Sound Options=Change full screen, resolution, and sound options. -Group= -HiddenSongs=Some songs are only playable during Oni courses and with roulette. Leave this &oq;OFF&cq; to always display all songs. -Hide=Hide -Holds=Holds -Insert=Insert -Insert Credit=Insert Credit -Key Joy Mappings=Map keys and joystick buttons to game functions. -Language=Choose your language. -LifeDifficulty=Increase this value to cause your life meter to drain faster and refill slower. -LifeType=LifeType -Advanced Options=Change advanced options such as scoring, timing window, and life meter settings. -MasterVolume= -HighResolutionTextures=Choose whether high resolution textures (if supported by the current theme) will be used. When set to Auto, high resolution textures will be used if the display height is > 480. -MaxTextureResolution=Choose the maximum texture resolution. Setting this to anything below 1024 will cause some textures to appear blurry, but may increase your frame rate. -MenuTimer=When &oq;ON&cq;, menus have a time limit. -Mines=Mines -MoveRandomToEnd=Determines if courses with random songs should be placed at the end of the course select wheel. -MovieColorDepth=Choose the color depth of textures. 32 bit textures use more memory, but look nicer. -MusicWheelSwitchSpeed=Adjusts the speed of the music wheel. -MusicWheelUsesSections=&oq;Always&cq; means sections in group + ABC; &oq;Never&cq; means no sections; &oq;Title Only&cq; shows sections in ABC order. -Network Options=Connect to a server or change server options. -No Memory Card=No USB memory card was found. -NoteSkins=NoteSkins -NumBackgrounds=Choose the maximum number of random backgrounds to be loaded simultaneously. -OnlyDedicatedMenuButtons=Choose between allowing game buttons (dance pad, etc.) and Menu* buttons for menu movement. Be sure to map the Menu* set of buttons before setting this to &oq;Only dedicated buttons&cq;! -OptionsRandomJukebox= -OsMountPlayer1= -OsMountPlayer2= -Persp=Perspective -Player1Profile= -Player2Profile= -PlayerAutoPlay=PlayerAutoPlay -PreloadSounds=If YES, preload most sounds in advance. This increases load times, and should normally be left OFF. -Premium=Choose from various premium options. (Coin Mode = Pay) -Profile= -Export Packages=Export .smzip packages of your installed content. -Profiles=Edit the player profiles stored on this machine. -ProgressiveLifebar=Set whether the lifebar is harsher on consecutive boo/miss judgments. OFF for no effect, 8 to make each consecutive miss a multiple of the first miss. -ProgressiveNonstopLifebar=Determine whether the lifebar gets harsher as a nonstop course progresses. LifeDifficulty + this = LifeDifficulty on a final stage of a course. -ProgressiveStageLifebar=Determine whether the lifebar gets harsher on later stages. LifeDifficulty + this = LifeDifficulty on a final stage. (No effect if Event Mode). -ProTiming=ProTiming -RandomBackgroundMode=Choose background style. &oq;Animations&cq; uses random items in the BGAnimations folder; &oq;Random Movies&cq; cycles through movies in the RandomMovies folder. -More Options=Access more advanced options here. -RandomModifiers= -Rate=Rate -RefreshRate=Controls how many times per second the screen will refresh. Only has an effect when Display Mode is set to &oq;Full Screen&cq;. -Reload Songs=Reload all songs and courses. -Remove=Remove arrows to make the song easier. -Rename= -Reset To Defaults=Reset all options to default values. -SaveScores=SaveScores -SaveReplays=Enable saving replays. -SaveStats=If enabled, save Stats.xml. -ScoreDisplay=ScoreDisplay -Scoreboard=Enables scoreboard -ScoringType=Defines which scoring method to use. -Scroll=Scroll -Select Group=Toggle Songs in this Group. -Select Profile=Choose a profile -Server=Start Local Server -Servers=Servers -ShowBanners=Toggles the display of Banners. -ShowBeginnerHelper=Turn this on to enable a demonstration dancer during Beginner play. -ShowCaution=Toggle whether the Caution screen is shown. -ShowDancingCharacters=Turn this option &oq;OFF&cq; to disable the dancing characters in the background. Even if this option is &oq;ON&cq;, characters will only show if you have some installed. -ShowDanger=Turn this option &oq;OFF&cq; to disable the flashing &oq;Danger&cq; background that shows when you're about to drop to 0% health. -ShowInstructions=Toggle whether the Instructions screen is shown. -ShowLyrics=Toggle the display of song lyrics if available. (via .LRC file) -ShowNativeLanguage=Choose between displaying song titles in their native language (日本語), or transliterating them when possible. -ShowSelectGroup=Toggle whether the Select Group screen is shown. -ShowSongOptions=Toggle display of the Song Options screen. When set to ASK, it can be accessed by pressing START a second time after Player Options. -ShowStats=Display performance statistics in the upper right corner of the screen and show skips in the lower right corner. FPS = frames per second. TPF = triangles per frame. DPF = draws per frame. -SmoothLines=Toggle whether the Groove Radar is drawn with antialiased lines. -Center1Player=Turn this option &oq;ON&cq; to center the display for 1 player styles. -SongsPerPlay=The number of songs a player can play in Regular mode (if Event Mode is off). -SoundEffect= -SoundResampleQuality=Advanced: Select the resampling quality to use. -SoundVolume=Adjust the volume level during gameplay. -SoundVolumeAttract=Adjust the volume level during attract mode. -Speed=Speed -Stepmania Credits=The Stepmania Development Team -Steps=Steps -Style= -Test Input=Test the responsiveness of connected joysticks. -Test Lights=Test the responsiveness of connected lights. -TextureColorDepth=Choose the color depth of textures. 32 bit textures use more memory, but look nicer. -Theme=Choose from this list of installed theme packs. -TimingWindowScale=Increase this value to cause your steps to be judged more strictly (i.e. shrink the timing window). -Toggle Song=Toggle Song -Turn=Turn -Transfer Edits to USB=Transfer Edits to USB -Transfer Edits from USB=Transfer Edits from USB -UseUnlockSystem=Enable or disable the unlock system. -VisualDelaySeconds=Calibrate display lag. -Vsync=Cap your frame rate your display's refresh rate. This option only has an effect when the Display Mode is set to &oq;Full Screen&cq;. -WideScreen16_9=Enable widescreen display. -WideScreen16_10=Enable widescreen display. -Windowed=Choose whether you would like to run full screen, or to display in a window on your desktop. - -# -UI Options=Adjust game-wide user interface options. -Input Options=Adjust input options such as delay and speed. -Arcade Options=Adjust arcade features such as the Menu Timer. -Select Game=Select your preferred gametype. -System Direction=Change commonly-used preferences here. - -# -OnlyPreferredDifficulties=Only Preferred Difficulties -# -PercentageScoring=Choose between displaying long form score and percent score. - -# course -Select Course=Edit this course. -Max Minutes=How long the course should be at maximum. -Choose Song=Pick a song for this course slot. -Choose Steps=Choose a steps type for this song. - -Play=Play the course. -Save=Save the course. -Edit Course=Edit Course contents. -Shuffle=Shuffle the songs around. -# -GamePrefDefaultFail=Immediate fail causes a player to die when their life bar reaches 0. ImmediateContinue allows you to continue playing afterwards. -[OptionNames] -0=0 -0.25x=0.25x -0.3x=0.3x -0.4x=0.4x -0.5x=0.5x -0.6x=0.6x -0.7x=0.7x -0.75x=0.75x -0.8x=0.8x -0.9x=0.9x -1=1 -1.0x=1.0x -1.1x=1.1x -1.2x=1.2x -1.25x=1.25x -1.3x=1.3x -1.4x=1.4x -1.5x=1.5x -1.6x=1.6x -1.7x=1.7x -1.75x=1.75x -x1.75=1.75x -1.8x=1.8x -1.9x=1.9x -x2.25=2.25x -x2.5=2.5x -10=10 -11=11 -12=12 -12th=12th -13=13 -16bit=16bit -16th=16th -192nd=192nd -2=2 -2 Players for 1 Credit=2 Players for 1 Credit -2 Times=2 Times -2.0x=2.0x -24th=24th -3=3 -3 Times=3 Times -32bit=32bit -32nd=32nd -4=4 -4 Times=4 Times -48th=48th -4th=4th -5=5 -5 Times=5 Times -6=6 -64th=64th -7=7 -8=8 -8th=8th -9=9 -Add=Additive -All Music=All Music -AllDifficulties=All Difficulties -AllGroups=All Groups -Alternate=Alternate -Always=Always -Animations=Animations -Arcade Style=Arcade Style -Ask=Ask -AttackMines=AttackMines -Auto=Auto -Autogen To Fill Width=Autogen To Fill Width -AutosyncMachine=AutosyncMachine -Average=Average -Average Feet=Average Feet -Backwards=Backwards -Baked Random=Baked Random -Bar=Bar -Battery=Battery -Beat=Beat -Big=Big -Blind=Blind -Blink=Blink -BMRize=BMRize -Boomerang=Boomerang -Boost=Boost -Both=Both -Brake=Brake -Bumpy=Bumpy -C150=C150 -C300=C300 -CPU-Controlled=CPU-Controlled -Centered=Centered -Choose=Choose -Clap=Clap -Clear Left=Clear Left -Clear Right=Clear Right -Collapse Left=Collapse Left -Collapse To One=Collapse To One -Compress 2x=Compress 2x -Compress 3->2=Compress 3->2 -Compress 4->3=Compress 4->3 -Confusion=Confusion -Connect=Connect... -Copy Left To Right=Copy Left To Right -Copy Right To Left=Copy Right To Left -Courses Only=Courses Only -Create New=Create New -Cross=Cross -Custom=Custom -Dance Points=Dance Points -Dark=Dark -Default=Default -Default to Off=Default to Off -Default to Random=Default to Random -DifficultCourses=Difficult -Disconnect=Disconnect -Distant=Distant -Dizzy=Dizzy -Don'tSave=Don't Save -Double for 1 Credit=Double for 1 Credit -Drunk=Drunk -Dynamic Random=Dynamic Random -Echo=Echo -End of Song=End of Song -FailAtEnd=Fail at end -EffectSpeed=Speed -EffectPitch=Pitch -Event=Event Mode -Exit=Exit -Expand=Expand -Expand 2->3=Expand 2->3 -Expand 2x=Expand 2x -Expand 3->4=Expand 3->4 -Fast=Fast -Flat=Flat -Flip=Flip -Floored=Floored -Free Play=Free Play -Force Off=Force Off -Force On=Force On -Full Screen=Full Screen -Global BGAnimation=Global BGAnimation -Global Movie=Global Movie -Global Movie from Song Group=Global Movie from Song Group -Global Movie from Song Group and Genre=Global Movie from Song Group and Genre -HIDE=Hide -Hallway=Hallway -Haste=Haste -Hidden=Hidden -HiddenOffset=Hidden Offset -Hide=Hide -High Quality=High Quality -Hold=Hold -HoldsToRolls=Holds To Rolls -Home=Home -Immediate=Immediate -ImmediateContinue=Delayed -Incoming=Incoming -Insanity=Insanity -Insert Entry=Insert Entry -Instant=Instant -Invert=Invert -Justice=Justice -Left=Left -LifeTime=Survival -Little=Little -Metronome=Metronome -Mines=Mines -Mini=Mini -Mirror=Mirror -N/A=N/A -Native Language=Native Language -Never=Never -New=New -NewEdit=-New Edit- -No=No -NoHands=No Hands -NoHolds=No Holds -NoJumps=No Jumps -NoMines=No Mines -NoRolls=No Rolls -NoQuads=No Quads -NoRecover=No Recover -NoStretch=No Stretch -NoLifts=No Lifts -NoFakes=No Fakes -None=None -Normal=Normal -Num Songs=Num Songs -Off=Off -Old=Old -On=On -On (recommended)=On (recommended) -Only Dedicated Buttons=Only Dedicated Buttons -Overhead=Overhead -Pay=Pay -Percent=Percent -Planted=Planted -Press Start=Press Start -Quick=Quick -R.Vanish=R.Vanish -Random=Random -RandomAttacks=Random Attacks -RandomBG=Random Backgrounds -Random Movies=Random Movies -Ranking=Ranking -Ranking Songs=Ranking Songs -Really Fast=Really Fast -RegularCourses=Regular -Remove=Remove -Reverse=Reverse -Right=Right -Roll=Roll -Romanization=Transliterate -SHOW=Show -Select=Select -Servers=Servers -Shift Left=Shift Left -Shift Right=Shift Right -Show=Show -Shuffle=Shuffle -Silent=Silent -Skip=Skip -Skippy=Skippy -Slow=Slow -SN2=Supernova 2 -SongAttacks=Song Attacks -Song BGAnimation=Song BGAnimation -Song Bitmap=Song Bitmap -Song Movie=Song Movie -Space=Space -Split=Split -Standard=Standard -Start=Start -StaticBG=Static Background -Stealth=Stealth -StepMania Style=StepMania Style -Stomp=Stomp -Stop=Stop -Subtract=Subtractive -Sudden=Sudden -SuddenDeath=Sudden Death -SuddenOffset=Sudden Offset -SuperShuffle=Cement Mixer -SoftShuffle=Soft Shuffle -Swap Sides=Swap Sides -Sync Machine=Sync Machine -Sync Song=Sync Song -Sync Tempo=Sync Tempo -Tiny=Tiny -Tipsy=Tipsy -Title Only=Title Only -Tornado=Tornado -Total Feet=Total Feet -Twirl=Twirl -Twister=Twister -Use Gameplay Buttons=Use Gameplay Buttons -Visible=Visible -Wave=Wave -Wide=Wide -Windowed=Windowed -Yes=Yes -x0.25=x0.25 -x0.50=x0.50 -x0.75=x0.75 -x1=x1 -x1.5=x1.5 -x2=x2 -x3=x3 -x4=x4 -x5=x5 -x8=x8 -PercentageScoring=Percentage Scoring - -Tiny=Tiny -Bumpy=Bumpy -Beat=Beat -GKS=GKS -Cover=Cover -XMode=XMode -[OptionRowHandler] -Off=Off - -[OptionTitles] -Accel=Acceleration -Add/Edit Background Change=Add/Edit Background Change -Air=Air -AllowExtraStage=Allow Extra Stage -AllowW1=Fantastic Timing -Alter=Alter -Announcer=Announcer -Appearance=Appearance -Appearance Options=Appearance Options -Theme Options=Theme Options -ArcadeOptionsNavigation=Options Navigation -Artist=Artist -Artist transliteration=Artist transliteration -Assist=Assist -Attacks=Attacks -AttractSoundFrequency=Attract Sound Frequency -AutoAdjust=Auto Adjust -AutoMapOnJoyChange=Automap Joysticks -AutoPlay=AutoPlay -AutogenGroupCourses=Autogen Group Courses -AutogenSteps=Autogen Steps -BGBrightness=Brightness -Background=Background -BarDrain=Bar Drain -BatLives=Bat Lives -Base Difficulty=Base Difficulty -Bookkeeping=Bookkeeping -Calibrate Machine Sync=Calibrate Audio Sync -CPUSkill=CPU Skill -CelShadeModels=Cel-shaded Models -Center Image=Center Image -Chaos=Chaos -Characters=Characters -Chart Style=Chart Style -Choose=Choose -Clear Bookkeeping Data=Clear Bookkeeping Data -Clear Machine Edits=Clear Machine Edits -Clear Machine Stats=Clear Machine Scores -Clear USB edits=Clear USB edits -Clear area=Clear area -CoinMode=Coin Mode -CoinModeNoHome=Coin Mode -CoinsPerCredit=Coins Per Credit -Connection=Connection -Convert pause to beats=Convert pause to beats -Convert selection to pause=Convert selection to pause -Copy=Copy -CourseSortOrder=Course Sort -Create New=Create New -Create New Course=Create New -Create New Profile=Create Profile -Credit=Credit -Cut=Cut -DancePointsForOni=Oni Score Display -DefaultFailType=Default Fail Type -DefaultFailTypeNoOff=Default Fail Type -DefaultNoteSkin=Default NoteSkin -DelayedBack=Back Delayed -DelayedTextureDelete=Keep Textures In Memory -Delete=Delete -Delete beat and shift up=Delete beat and shift up -Description=Description -Difficulty=Difficulty -DisplayAspectRatio=Aspect Ratio -DisplayColorDepth=Display Color -DisplayResolution=Display Resolution -Duration seconds=Duration seconds -EasterEggs=Easter Eggs -Edit Songs/Steps=Edit Songs/Steps -Genre=Genre -Practice Songs/Steps=Practice Songs/Steps -Edit Courses=Edit Courses -Edit BPM change=Edit BPM change -Edit song info=Edit song info -Edit steps information=Edit steps information -Exit Edit Mode=Exit Edit Mode -Edit stop=Edit stop -Edit delay=Edit delay -Edit Timing Data=Edit Timing Data -Edit time signature=Edit time signature (not working yet) -Edit time signature (top)=Edit time signature (beats per measure) -Edit time signature (bottom)=Edit time signature (single beat note value) -Edit tickcount=Edit tickcount -Edit combo=Edit combo -Editor options=Options -EditorShowBGChangesPlay=Show Backgrounds -Effect=Effect -EnableAttackSounds=Attack Sounds -EnableMineHitSound=Mine Sounds -Entry %d=Entry %d -EventMode=Event Mode -Exit=Exit -Fail=Fail -FastLoad=Fast\nLoad -File1 Global BGAnimation=File1 Global BGAnimation -File1 Global Movie=File1 Global Movie -File1 Global Movie (Group + Genre)=File1 Global Movie (Group + Genre) -File1 Global Movie (Group)=File1 Global Movie (Group) -File1 Song BGAnimation=File1 Song BGAnimation -File1 Song Movie=File1 Song Movie -File1 Song Still=File1 Song Still -File1 Type=File1 Type -File2 Global BGAnimation=File1 Global BGAnimation -File2 Global Movie=File1 Global Movie -File2 Global Movie (Group + Genre)=File1 Global Movie (Group + Genre) -File2 Global Movie (Group)=File1 Global Movie (Group) -File2 Song BGAnimation=File1 Song BGAnimation -File2 Song Movie=File1 Song Movie -File2 Song Still=File1 Song Still -File2 Type=File1 Type -Fill Machine Stats=Fill Machine Stats -Force Color 1=Force Color 1 -Force Color 2=Force Color 2 -Force Effect=Force Effect -Force Transition=Force Transition -Freeze=Freeze -Game=Game -GetRankingName=Show Name Entry -Graphics/Sound Options=Graphics/Sound Options -Group=Group -Hands=Hands -HiddenSongs=Hidden Songs -Hide=Hide -High Meter=High Meter -HighResolutionTextures=High-Res Textures -Holds=Holds -Insert=Insert -Insert Credit=Insert Credit -Insert beat and shift down=Insert beat and shift down -Insert Entry=Insert Entry -Jumps=Jumps -Key Joy Mappings=Config Key/Joy Mappings -Language=Language -Last beat hint=Last beat hint -Layer=Layer -LifeDifficulty=Life Difficulty -LifeType=Life Type -Low Meter=Low Meter -Advanced Options=Advanced Options -Main title=Main title -Main title transliteration=Main title transliteration -MaxTextureResolution=Texture Resolution -MenuTimer=Menu Timer -Meter=Meter -Mines=Mines -MoveRandomToEnd=Random At End -More Options=More Options -MovieColorDepth=Movie Color -MusicWheelSwitchSpeed=Wheel Speed -MusicWheelUsesSections=Wheel Sections -Network Options=Network Options -No USB memory cards found=No USB memory cards found -NoteSkins=NoteSkins -NumBackgrounds=Random Backgrounds -OptionsRandomJukebox=Modifiers -OnlyDedicatedMenuButtons=Menu Buttons -OsMountPlayer1=OS Mount Player1 -OsMountPlayer2=OS Mount Player2 -Paste at begin marker=Paste at begin marker -Paste at current beat=Paste at current beat -Persp=Persp -Play current beat to end=Play current beat to end -Play preview music=Play preview music -Play whole song=Play whole song -Play mods from course=Play mods from course -Play selection=Play selection -Player1Profile=Player1 Profile -Player2Profile=Player2 Profile -PlayerAutoPlay=AutoPlay -Predicted Meter=Predicted Meter -Preferences=Preferences -PreloadSounds=Preload Sounds -Premium=Premium -Export Packages=Export Packages -Profile=Profile -Profiles=Profiles -ProgressiveLifebar=Progressive Lifebar -ProgressiveNonstopLifebar=Progressive Nonstop Lifebar -ProgressiveStageLifebar=Progressive Stage Lifebar -ProTiming=Protiming -Quads=Quads -Quantize=Quantize -RandomBackgroundMode=Mode -RandomModifiers=Modifiers -Rate=Rate -Record in selection=Record in selection -RefreshRate=Refresh Rate -Reload Songs=Reload Songs/Courses -Remove=Remove -Remove Change=Remove Change -Rename=Rename -Reset To Defaults=Reset Options To Default Values -Revert from disk=Revert from disk -Revert to last save=Revert to last save -Save=Save -SaveScores=Save Scores -SaveReplays=Save Replays -SaveStats=Save Stats -ScoreDisplay=Score Display -Scoreboard=Scoreboard -ScoringType=Scoring Type -Scroll=Scroll -Secret=Secret -Server=Server -Servers=Servers -Set P1=Set P1 -Set P2=Set P2 -Set modifiers=Set modifiers -Set Mods=Set Mods -Set selection start=Set selection start -Set selection end=Set selection end -Shift pauses and BPM changes down=Shift pauses and BPM changes down -Shift pauses and BPM changes up=Shift pauses and BPM changes up -ShowBanners=Show Banners -ShowBeginnerHelper=Beginner Helper -ShowCaution=Caution -ShowDancingCharacters=Dancing Characters -ShowDanger=Danger -ShowInstructions=Instructions -ShowLyrics=Lyrics -ShowNativeLanguage=Translations -ShowSelectGroup=Song Group -ShowSongOptions=Show Song Options -ShowStats=Show Stats -SmoothLines=SmoothLines -SoundEffect=Sound Effect -Stepmania Credits=Stepmania Credits -Center1Player=Center 1 Player -Song=Song -Song Group=Song Group -Song Options=Song Options -SongsPerPlay=Songs Per Play -Sort=Sort -SoundResampleQuality=Resampling Quality -SoundVolume=Sound Volume -SoundVolumeAttract=Attract Volume -Speed=Speed -Step Author=Step Author -Steps=Steps -Stream=Stream -Style=Style -Sub title=Sub title -Sub title transliteration=Sub title transliteration -SuperGrowth=Super Growth -Tap Steps=Tap Steps -Tempo=Tempo -Test Input=Test Input -Test Lights=Test Lights -TextureColorDepth=Texture Color -Theme=Theme -TimingWindowScale=Judge Difficulty -Transform=Transform -Transfer Edits to USB=Transfer Edits to USB -Transfer Edits from USB=Transfer Edits from USB -Type=Type -Turn=Turn -Undo=Undo -UseUnlockSystem=Unlock System -VisualDelaySeconds=Visual Delay -Voltage=Voltage -Vsync=Wait For Vsync -WideScreen16_9=Widescreen -WideScreen16_10=Widescreen -Windowed=Display Mode - -# -UI Options=UI Options -Input Options=Input Options -Arcade Options=Arcade Options -Select Game=Select Game -System Direction=System Direction - -# -OnlyPreferredDifficulties=Only Preferred Difficulties -# -PercentageScoring=Percentage Scoring - -Max Minutes=Max Minutes -Play=Play -Edit Course=Edit Course -Shuffle=Shuffle -# -GamePrefDefaultFail=Default Fail Type -[PaneDisplay] -Steps=Steps -Holds=Holds -Jumps=Jumps -Mines=Mines -Rolls=Rolls -Hands=Hands -MachineHigh=Best -EmptyMachineHighScoreName=Best -NotAvailable=N/A - -[PlayMode] -Battle=Battle -Endless=Endless -Nonstop=Nonstop -Oni=Oni -Rave=Rave -Regular=Regular - -[AdjustSync] -%s BPM from %.3f BPM to %.3f BPM.=%s BPM from %.3f BPM to %.3f BPM. -Autosync Machine=Autosync Machine -Autosync Song=Autosync Song -Autosync Tempo=Autosync Tempo -Autosync: Correction NOT applied. Deviation too high.=Autosync: Correction NOT applied. Deviation too high. -Autosync: Correction applied.=Autosync: Correction applied. -Global Offset from %+.3f to %+.3f (notes %s)=Global Offset from %+.3f to %+.3f (notes %s) -Song offset from %+.3f to %+.3f (notes %s)=Song offset from %+.3f to %+.3f (notes %s) -The stop segment #%d changed from %+.3fs to %+.3fs (change of %+.3f).=The stop segment number #%d changed from %+.3fs to %+.3fs (change of %+.3f). -earlier=earlier -later=later -Average Error %.5fs=Average Error %.5fs -Etc.=Etc. -%d taps ignored.=%d taps ignored. - -[ProfileAction] -Clear=Clear -Delete=Delete -Edit=Edit -Rename=Rename -SetDefaultP1=Set P1 -SetDefaultP2=Set P2 - -[RadarCategory] -Air=Air -Chaos=Chaos -Freeze=Freeze -Hands=Hands -Holds=Holds -Jumps=Jumps -Mines=Mines -Rolls=Rolls -Stream=Stream -Taps=Taps -TapsAndHolds=TapsAndHolds -Voltage=Voltage -MinMidiNote=MinMidiNote -MaxMidiNote=MaxMidiNote - -[RageSoundManager] -Couldn't find a sound driver that works=Couldn't find a sound driver that works - -[RageUtil] -NumNd=nd -NumPrefix= -NumRd=rd -NumSt=st -NumTh=th - -[RoomWheel] -Enter room name=Enter room name - -[RoomInfoDisplay] -Last Round Info:=Last Round Info: -Room Name:=Name: -Room Description:=Description: -Song Title:=Title: -Song Subtitle:=Subtitle: -Song Artist:=Artist: -Players=Players - -[SMPackageUtil] -Could not find '%s'.=Could not find '%s'. -[Screen] -HeaderText= -[ScreenAppearanceOptions] -HeaderText=Appearance -HeaderSubText=Customize your game - -[ScreenOptionsGraphicsSound] -HeaderText=Graphics/Sound -HeaderSubText=Get the best performance - -[ScreenOptionsAdvanced] -HeaderText=Advanced Options -HeaderSubText=These settings are for advanced users - -[ScreenBookkeeping] -All-time Coin Total:=All-time Coin Total: -Total Song Plays: %d=Total Song Plays: %d -Coin Data by Day of Week, All-Time=Coin Data by Day of Week, All-Time -Coin Data by Hour of Day, All-Time=Coin Data by Hour of Day, All-Time -Coin Data of Last %d Days=Coin Data of Last %d Days -Coin Data of Last %d Weeks=Coin Data of Last %d Weeks -HeaderText=Bookkeeping - -[ScreenCaution] -Caution=CAUTION! -CautionText=Keep the dance platform a safe distance from your monitor and furniture.\n\nBe careful that you do not injure pets, children, or spectators while dancing. - -[ScreenDebugOverlay] -%s in gameplay=%s in gameplay -Assist=Assist -AutoPlay=AutoPlay -Autosync=Autosync -CPU=CPU -Clear Profile Stats=Clear Profile Scores -CoinMode=CoinMode -Debug Menu=Debug Menu -Fill Profile Stats=Fill Profile Stats -Flush Log=Flush Log -Force Crash=Force Crash -Halt=Halt -Lights Debug=Lights Debug -Machine=Machine -Menu Timer=Menu Timer -Monkey Input=Monkey Input -Multitexture=Multitexture -Profile=Profile -Pull Back Camera=Pull Back Camera -Restart=Restart -Reload=Reload -Reload Theme and Textures=Reload Theme and Textures -Rendering Stats=Rendering Stats -Screen Test Mode=Screen Test Mode -Send Off To Screen=Send Off To Screen -Send On To Screen=Send On To Screen -Send Notes Ended=Send Notes Ended -Show Masks=Show Masks -Slow=Slow -Song=Song -Tempo=Tempo -Uptime=Uptime -Visual Delay Down=Visual Delay Down -Visual Delay Up=Visual Delay Up -Volume Down=Volume Down -Volume Up=Volume Up -Vsync=Vsync -Write Preferences=Write Preferences -Write Profiles=Write Profiles -off=off -on=on -or=or - -[ScreenEdit] -%s notes=%s notes -Can't undo - no undo data.=Can't undo - no undo data. -Do you want to revert from disk?=Do you want to revert from disk? -Do you want to revert to your last save?=Do you want to revert to your last save? -Do you want to save changes before exiting?=Do you want to save changes before exiting? -Enter a new BPM value.=Enter a new BPM value. -Enter a new Stop value.=Enter a new Stop value. -Enter a new Delay value.=Enter a new Delay value. -Enter a new Time Signature numerator value.=Enter the number of beats per measure. -Enter a new Time Signature denominator value.=Enter the note value that represents one beat. -Enter a new Tickcount value.=Enter a new Tickcount value. -Enter a new Combo value.=Enter a new Combo value. -Enter a new artist transliteration.=Enter a new artist transliteration. -Enter a new artist.=Enter a new artist. -Enter a new genre.=Enter a new genre. -Enter a new credit.=Enter a new credit. -Enter a new description.=Enter a new description. -Enter a new chart style.=Enter a new chart style (e.g. "Pad", "Keyboard"). -Enter the author who made this step pattern.=Enter the author who made this step pattern. -Enter a new last beat hint.=Enter a new last beat hint. -Enter a new main title transliteration.=Enter a new main title transliteration. -Enter a new main title.=Enter a new main title. -Enter a new sub title transliteration.=Enter a new sub title transliteration. -Enter a new sub title.=Enter a new sub title. -More than %d notes per measure is not allowed. This change has been reverted.=More than %d notes per measure is not allowed. This change has been reverted. -No backgrounds available=No backgrounds available -EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar:\n Set area\n marker\nEnter:\n Area Menu\nEscape:\n Main Menu\nF1:\n Show help\n -PlayRecordHelpText=Press START to end -Save successful.=Save successful. -Saved as SM and DWI.=Saved as SM and DWI. -Saved as SM.=Saved as SM. -Switched to=Switched to -The change has been reverted.=The change has been reverted. -This change creates more than %d notes in a measure.=This change creates more than %d notes in a measure. -This change creates notes past the end of the music and is not allowed.=This change creates notes past the end of the music and is not allowed. -This will destroy all unsaved changes.=This will destroy all unsaved changes. -Undo=Undo - -Current beat=Current beat -Current second=Current second -Snap to=Snap to -Selection beat=Selection beat -Difficulty=Difficulty -Description=Description -Chart Style=Chart Style -Main title=Main title -Subtitle=Subtitle -Tap Note=Tap Note -Tap Steps=Tap Steps -Jumps=Jumps -Hands=Hands -Holds=Holds -Mines=Mines -Rolls=Rolls -Lifts=Lifts -Fakes=Fakes -Beat 0 offset=Beat 0 offset -Preview Start=Preview Start -Preview Length=Preview Length -Help=Help -Info=Info -Routine Player=Player - -[ScreenEditMenu] -HeaderText=Edit Song/Steps -HeaderSubText=Make your songs perfect -Continue with delete?=Continue with delete? -Enter a description for this edit.=Enter a description for this edit. -ExplanationAction=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationGroup=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationSong=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationSourceSteps=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationSourceStepsType=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationSteps=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -ExplanationStepsType=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. -Profile name cannot be blank.=Profile name can not be blank. -The name you chose conflicts with another profile. Please use a different name.=The name you chose conflicts with another profile. Please use a different name. -These steps are produced by autogen. You do not need to delete them.=These steps are produced by autogen. You do not need to delete them. -These steps will be lost permanently.=These steps will be lost permanently. -This song is missing a music file and cannot be edited.=This song is missing a music file and can not be edited. -The song directory is read-only and cannot be edited.=The song directory is read-only and cannot be edited. -Blank=Blank - -[ScreenPracticeMenu] -HeaderText=Practice Songs - -ExplanationGroup=Select the song group. -ExplanationSong=Select the song you wish to practice. -ExplanationAction=Press Start to practice! -ExplanationStepsType=Select the StepsType you want to practice. -ExplanationSteps=Select a notechart. - -[ScreenEvaluation] -HeaderText=Your Results -HeaderSubText=Your dance was so great! -[ScreenEvaluationSummary] -HeaderText=Final Results -[ScreenGameplay] -GiveUpAbortedText=Don't give up! -GiveUpStartText=Continue holding &START; to give up -GiveUpBackText=Continue holding &BACK; to give up - -[ScreenGameplaySyncMachine] -Standard deviation=Standard deviation -New offset=New offset -Old offset=Old offset -Collecting sample=Collecting sample - -[ScreenInstructions] -PlayMode_Regular title=How To Play -PlayMode_Regular instructions=Two things to watch out for when you play are Hold Arrows and Mines. -PlayMode_Nonstop title=Nonstop Mode -PlayMode_Nonstop instructions=Nonstop mode allows you to play a few songs in a row (usually 4, sometimes more) using regular gameplay rules. -PlayMode_Oni title=Challenge Mode -PlayMode_Oni instructions=Challenge mode pushes players to the limit with two available rulesets.\nThe first is Battery Life in which you are limited to four lives. Any step that is lower than a Great or any NG will remove one charge of the battery.\nThe other ruleset is Life Time in which you must race against the clock. -PlayMode_Endless title=Endless Mode -PlayMode_Endless instructions=Endless mode allow you to play a group of songs until you fail or decide to quit. Hope you have a lot of time on your hands... -PlayMode_Rave title=Rave Mode -PlayMode_Rave instructions= -PlayMode_Battle title=Battle Mode -PlayMode_Battle instructions= -Hold instructions=Hold arrows are arrows that you must keep held down. A successfully held down hold arrow will give you an OK while a missed hold arrow will give you an NG. -Mine instructions=Mines are explosive and should be avoided at all costs as they will take life off of your meter. They will trigger if you keep your foot held down as they pass. - -[ScreenLegal] -Warning=Warning -BodyText=The StepMania program source code is licensed under a permissive open-source license.\n\nThe StepMania name and logos are protected by Trademark law.\n\nThe StepMania default theme SOUNDS ARE SEPARATELY OWNED BY THE AUTHORS. ALL OTHER THEME COMPONENTS ARE LICENSED UNDER THE STEPMANIA LICENSE.\n\nSee license.txt for details. - -[ScreenMapControllers] -HeaderText=Map Controllers -InvalidButton=That key can not be mapped. -%s slots=%s slots - -[ScreenNetRoom] -Enter a description for the room:=Enter a description for the room: -Enter a password for the room (blank, no password):=Enter a password for the room (blank, no password): -Enter Room's Password:=Enter Room's Password: -HeaderText=StepMania Online -HeaderSubText=Room Selection -HelpText=Ctrl+ENTER Selects &BACK; Exit &MENULEFT;&MENURIGHT; Move - -[ScreenNetSelectMusic] -HeaderText=Select Music Online -HeaderSubText=Song Selection -HelpText=Ctrl+ENTER Selects &BACK; Exit &MENULEFT;&MENURIGHT; Move::&MENUUP; Player Options &MENUDOWN; Change Difficulty - -[ScreenNetworkOptions] -Disconnected from server.=Disconnected from server. -Enter a network address.=Enter a network address. -Server failed: %s Code:%d=Server failed: %s Code:%d -Use 127.0.0.1 to connect to yourself.=Use 127.0.0.1 to connect to yourself. -Connect=Connect -Disconnect=Disconnect -ScoreOn=On -ScoreOff=Off -HeaderText=Network Options -HeaderSubText=Configure networked gameplay - -[ScreenOptionsEditCourse] -The maximum number of entries per course is %d. This course already has %d entries.=The maximum number of entries per course is %d. This course already has %d entries. -You cannot delete the last entry in a course.=You can not delete the last entry in a course. - -[ScreenOptionsEditCourseEntry] -No songs loaded.=No songs loaded. - -[ScreenOptionsManageCourses] -Continue with delete?=Continue with delete? -Enter a name for the course.=Enter a name for the course. -You have %d, the maximum number allowed.=You have %d, the maximum number allowed. -You must delete an existing before creating a new.=You must delete an existing before creating a new. -Error renaming file.=Error renaming file. -This course will be lost permanently.=This course will be lost permanently. -Error deleting the file '%s'.=Error deleting the file '%s'. -[ScreenOptionsManageEditSteps] -Enter a name for these steps.=Enter a name for these steps. -These steps will be lost permanently.=These steps will be lost permanently. -You have %d step edits, the maximum number allowed.=You have %d step edits, the maximum number allowed. -You must delete an existing steps edit before creating a new steps edit.=You must delete an existing steps edit before creating a new steps edit. -Continue with delete?=Continue with delete? - -[ScreenOptionsCourseOverview] -Error saving course.=Error saving course. -Course saved successfully.=Course saved successfully. -Enter a name for the course.=Enter a name for the course. -Error renaming file.=Error renaming file. -This course will be lost permanently.=This course will be lost permanently. -Continue with delete?=Continue with delete? -Error deleting the file '%s'.=Error deleting the file "%s". - -[NotesWriterSM] -Error renaming file. Destination file '%s' already exists.=Error renaming file. Destination file '%s' already exists. -Error writing file '%s'.=Error writing file '%s'. - -[NotesWriterSSC] -Error renaming file. Destination file '%s' already exists.=Error renaming file. Destination file '%s' already exists. -Error writing file '%s'.=Error writing file '%s'. - -[ScreenOptionsManageProfiles] -Are you sure you want to clear all data in the profile '%s'?=Are you sure you want to clear all data in the profile &oq;%s&cq;? -Are you sure you want to delete the profile '%s'?=Are you sure you want to delete the profile &oq;%s&cq;? -Enter a name for the profile.=Enter a name for the profile. -NewProfileDefaultName=New - -[ScreenOptionsMaster] -Exit=Exit - -[ScreenOptionsMasterPrefs] -Off=Off - -[ScreenOptionsMemoryCard] -Error mounting card: %s=Error mounting card: %s -(no label)=(no label) -size ???=size ??? -%dMB=%dMB - -[ScreenOptionsService] -HeaderText=Options -HeaderSubText=You can configure the game here - -[ScreenPackages] -DL @ %d KB/s=DL @ %d KB/s -Download cancelled.=Download cancelled. -Enter URL=Enter URL -Failed.=Failed. -Failed to connect.=Failed to connect. -File Already Exists=File Already Exists -Header Sent.=Header Sent. -Invalid URL.=Invalid URL. -VisitURL=--Visit URL-- -Waiting for header.=Waiting for header. - -[ScreenPrompt] -OK=OK -No=NO -Yes=YES -Cancel=CANCEL - -[ScreenRanking] - -[ScreenSMOnlineLogin] -Each player needs a unique Profile.=Each player needs a unique Profile. -Enter your password.=Enter your password. -No Styles are selectable.=No Styles are selectable. -You are logging on as:=You are logging on as: -You must define a Profile.=You must define a Profile. -HeaderText=Online Login -HeaderSubText=Select a login profile -Depending on the server you're connected to, you may have to register for an account on their website.=Depending on the server you're connected to, you may have to register for an account on their website. - -[ScreenSaveSync] -Choosing NO will discard your changes.=Choosing NO will discard your changes. -Would you like to save these changes?=Would you like to save these changes? -You have changed the timing of=You have changed the timing of - -[ScreenWithMenuElements] -; Put all help text in this one group and have metrics look up the strings here. That will help make sure -; that strings are in a consistent style and that strings aren't duplicated. -HelpTextNormal=Use &MENULEFT;&MENURIGHT; to select, then press &START; -HelpTextSelectMusic=Use &MENULEFT;&MENURIGHT; to select, then press &START; -HelpTextDifficultyPart=&UP;&UP; easier difficulty &DOWN;&DOWN; harder difficulty -HelpTextOptions=&MENUUP;&MENUDOWN; line &MENULEFT;&MENURIGHT; change &START; choose -HelpTextOptionsAndBack=&MENUUP;&MENUDOWN; line &MENULEFT;&MENURIGHT; change &START; choose &BACK; discard -HelpTextOptionsSimple=&MENUUP;&MENUDOWN; change &START; choose -HelpTextOptionsSimpleAndBack=&MENUUP;&MENUDOWN; line &START; choose &BACK; discard -HelpTextSort=&UP;&DOWN;&UP;&DOWN; to change sort -HelpTextContinue=Press any button or key. Press ESCAPE when done. -HelpTextEvaluation=Press &START; to continue -HelpTextScreenshot=Press &SELECT; to take a screenshot -HelpTextTestInput=Press any button or key. Press ESCAPE when done. -HelpTextTestLights=Press &MENULEFT;&MENURIGHT; to cycle lights. Press ESCAPE when done. -HelpTextTextEntry=Type a value using the keyboard. Press Enter to finish. -HelpTextMapControllers=Use arrow keys to move, ENTER to assign, SPACE to clear::Press ESCAPE when done -HelpTextOnline=smonline.us to connect to official Stepmania Online Server::Check out Stepmaniaonline.com for more information -HelpTextNetSelectMusic=Ctrl + Enter to enter room/select song::&UP; for Player Options -HelpTextBookkeeping=Press &MENULEFT;&MENURIGHT; to cycle data. Press ESCAPE when done. - -[ScreenSelectGame] -HeaderText=Select Game -HeaderSubText=Pick a cool gametype! - -[ScreenSelectGroup] -ALL MUSIC=ALL MUSIC - -[ScreenSelectMusic] -HeaderText=Select Music -HeaderSubText=You will pick a cool song! - -[ScreenSelectCourse] -HeaderText=Select Course - -[ScreenSelectGroup] -HeaderText=Select Group - -[ScreenSelectStyle] -HeaderText=Select Style -HeaderSubText=I can't wait to see your next moves! - -[ScreenSelectPlayMode] -NormalExplanation=CHOOSE YOUR\nFAVORITE SONGS -NonstopExplanation=PLAY SONGS\nBACK-TO-BACK -ChallengeExplanation=DON'T MISS\nMANY STEPS -SurvivalExplanation=BEAT THE CLOCK\nTO WIN -EndlessExplanation=PLAY UNTIL\nYOU DROP -HeaderText=Select Mode -HeaderSubText=Let's get started. I know you can! - -[ScreenServiceAction] -%d added=%d added -%d copied=%d copied -%d overwritten=%d overwritten -%d deleted=%d deleted -%d edits cleared, %d errors.=%d edits cleared, %d errors. -%d failed=%d failed -%d ignored=%d ignored -Bookkeeping data cleared.=Bookkeeping data cleared. -Copied from P%d card:=Copied from P%d card: -Copied to P%d card:=Copied to P%d card: -Edits not cleared - No memory cards ready.=Edits not cleared - No memory cards ready. -Edits not copied - No memory cards ready.=Edits not copied - No memory cards ready. -Error saving machine stats to P%d card.=Error saving machine stats to P%d card. -Machine stats cleared.=Machine stats cleared. -Machine stats loaded from P%d card.=Machine stats loaded from P%d card. -Machine stats saved to P%d card.=Machine stats saved to P%d card. -Preferences reset.=Preferences reset. -Stats not loaded - No memory cards ready.=Stats not loaded - No memory cards ready. -Stats not saved - No memory cards ready.=Stats not saved - No memory cards ready. -The profile on P%d card contains corrupt or tampered data.=The profile on P%d card contains corrupt or tampered data. -There is no machine profile on P%d card.=There is no machine profile on P%d card. - -[ScreenSyncOverlay] -AutoPlay=AutoPlay -AutoPlayCPU=AutoPlayCPU -AutoSync Machine=AutoSync Machine -AutoSync Song=AutoSync Song -AutoSync Tempo=AutoSync Tempo -Can't sync while playing a course.=Can't sync while playing a course. -Sync changes reverted.=Sync changes reverted. -Revert sync changes=Revert sync changes -Current BPM - smaller/larger=Current BPM - smaller/larger -Song offset - notes earlier/later=Song offset - notes earlier/later -Machine offset - notes earlier/later=Machine offset - notes earlier/later -(hold Alt for smaller increment)=(hold Alt for smaller increment) -Old offset=Old offset -New offset=New offset -Collecting sample=Collecting sample -Standard deviation=Standard deviation - -[ScreenSystemLayer] -CreditsCardChanged=CARD SWITCHED -CreditsCardChecking=CARD CHECK -CreditsCardMountFailed=CARD MOUNT ERROR -CreditsCardNoName=NoName -CreditsCardReady=READY -CreditsCardRemoved=CARD GONE -CreditsCardTestFailed=CARD WRITE ERROR -CreditsCardTooLate=CARD TOO LATE -CreditsCredits=CREDIT(S) -CreditsMax=(MAX) -CreditsFreePlay=FREE PLAY -CreditsInsertCard=INSERT CARD -CreditsLoadFailed=SIGNATURE FAILED -CreditsLoadedFromLastGoodAppend= (backup) -CreditsNotPresent=NOT PRESENT -CreditsPressStart=PRESS START - -[ScreenTestFonts] -# W is annoying: -Text1=WWWWWWWWWWWW -# Realistic excerpt: -Text2=The argument goes something like this: &oq;I refuse to prove that I exist,&cq; says God, &oq;for proof denies faith, and without faith I am nothing.&cq;::::&oq;But,&cq; says Man, &oq;The Babel fish is a dead giveaway, isn't it? It could not have evolved by chance. It proves you exist, and so therefore, by your own arguments, you don't. QED.&cq;::::&oq;Oh dear,&cq; says God, &oq;I hadn't thought of that,&cq; and promptly vanished in a puff of logic. -# Numbers test: -Text3=01234567890 ::100.00% 12345% 9:00 50/100 -# General symbol test, and test alignment against another font. -Text4=$50% (Test) "test's" &oq;test's&cq;, #1! 1+2-3*4/5.6::3:00 a; b; 5<6 6>5 2^3=8 Why? test@example.com::[Foo] {bar} Press &START; 3|4 &oq;1_2_3&cq; -Text5= - -[ScreenTestInput] -Controller=Controller -not mapped=not mapped -secondary=secondary - -[ScreenTestLights] -Auto Cycle=Auto Cycle -Manual Cycle=Manual Cycle -cabinet light=cabinet light -controller light=controller light - -[ScreenTextEntry] -Backspace=Backsp -Cancel=Cancel -Done=Done -HeaderText= -Space=Space -"%s" is an invalid floating point value.="%s" is an invalid floating point value. -AnswerCaret=_ -AnswerBlank= - -[ScreenTitleMenu] -%d songs in %d groups=%d songs in %d groups -%d courses in %d groups=%d courses in %d groups -%d unlocks=%d unlocks -Gametype:=Gametype: -Difficulty:=Difficulty: -Announcer=Announcer -Play Online=Network Play -Edit/Share=Edit/Share -Exit=Exit -Game Start=Game Start -Jukebox=Jukebox -Select Game=Select Game -Theme=Theme -Credits=Credits -Options=Options -Setup=Quick Setup - -[SmpackageExportDlg] -Error adding file '%s'.=Error adding file '%s'. - -[SongManager] -Loading courses...=Loading courses... -Loading songs...=Loading songs... -Reloading...=Reloading... -The folder "%s" appears to be a song folder. All song folders must reside in a group folder. For example, "Songs/Originals/My Song".=The folder "%s" appears to be a song folder. All song folders must reside in a group folder. For example, "Songs/Originals/My Song" will contain the music file (MP3, OGG...), the steps file (.sm, .dwi, .ksf...) and other related files. - -[SongUtil] -You must supply a name for your new edit.=You must supply a name for your new edit. -The name you chose conflicts with another edit. Please use a different name.=The name you chose conflicts with another edit. Please use a different name. -The edit name cannot contain any of the following characters: %s=The edit name can not contain any of the following characters: %s -The step author's name cannot contain any of the following characters: %s=The step author's name cannot contain any of the following characters: %s - -[SongSort] -FewestPlays=Fewest Plays -LowestGrades=Lowest Grades -MostPlays=Most Plays -Randomize=Randomize -TopGrades=Top Grades - -[Sort] -NotAvailable=N/A -Other=Other - -[SortOrder] -AllCourses=All Courses -Artist=Artist -BPM=BPM -Endless=Endless -Genre=Genre -Group=Group -ModeMenu=Mode Menu -Nonstop=Nonstop -Oni=Oni -Popularity=Players' Best -Preferred=Preferred -Title=Title -TopGrades=Top Grades -Roulette=Roulette -Length=Length -Recent=Recently Played -BeginnerMeter=Beginner Meter -EasyMeter=Easy Meter -MediumMeter=Medium Meter -HardMeter=Hard Meter -ChallengeMeter=Challenge Meter -DoubleEasyMeter=Double Easy Meter -DoubleMediumMeter=Double Medium Meter -DoubleHardMeter=Double Hard Meter -DoubleChallengeMeter=Double Challenge Meter - -[StepMania] -Announcer=Announcer -Couldn't open any loading windows.=Couldn't open any loading windows. -Fullscreen=Fullscreen -Initializing %s...=Initializing %s... -No video renderers attempted.=No video renderers attempted. -NoSmoothLines=NoSmoothLines -NoVsync=NoVsync -Please do not file this error as a bug! Use the web page below to troubleshoot this problem.=Please do not file this error as a bug! Use the web page below to troubleshoot this problem. -Service switch pressed=Service switch pressed -SmoothLines=SmoothLines -There was an error while initializing your video card.=There was an error while initializing your video card. -Unknown video renderer value: %s=Unknown video renderer value: %s -Video Driver: %s=Video Driver: %s -Vsync=Vsync -Windowed=Windowed -color=color -texture=texture - -[StepsType] -dance-couple=couple -dance-double=double -dance-single=single -dance-solo=solo -dance-threepanel=3panel -dance-routine=routine -lights-cabinet=Lights -# SSC -Dance_Single=Single -Dance_Double=Double -Dance_Threepanel=3 Panels - -[TapNoteScore] -AvoidMine=Avoid Mine -HitMine=Hit Mine -Miss=Miss -CheckpointMiss=Missed Hold Checkpoint -CheckpointHit=Hit Hold Checkpoint -None=None -W1=Flawless -W2=Perfect -W3=Great -W4=Good -W5=Boo - -[ThemeManager] -Reloaded metrics=Reloaded metrics -Reloaded metrics and textures=Reloaded metrics and textures -Reloaded scripts=Reloaded scripts -Reloaded overlay screens=Reloaded overlay screens - -[WorkoutManager] -You must supply a name for your workout.=You must supply a name for your workout. -The name you chose conflicts with another workout. Please use a different name.=The name you chose conflicts with another workout. Please use a different name. -The workout name cannot contain any of the following characters: %s=The workout name cannot contain any of the following characters: %s -%d/%d songs enabled=%d/%d songs enabled - -[Dialog-Add A Comment] -Add A Comment=Add A Comment -Cancel=Cancel -OK=OK -Package Comment=Package Comment -You can add a message to display before a user installs your package.=You can add a message to display before a user installs your package. -Show a comment=Show a comment -Don't display this dialog in the future=Don't display this dialog in the future - -[Dialog-Change Game Settings] -Cancel=Cancel -Change Game Settings=Change Game Settings -Default (recommended)=Default (recommended) -Direct3D=Direct3D -DirectSound Hardware=DirectSound Hardware -DirectSound Software=DirectSound Software -Graphics API=Graphics API -Log to Disk=Log to Disk -Other=Other -Force 60Hz Refresh=Force 60Hz Refresh -Null (no sound)=Null (no sound) -OK=OK -OpenGL=OpenGL -Show Log Window=Show Log Window -Sound API=Sound API -Tip: Change these only if you experience problems when using the default settings.=Tip: Change these only if you experience problems when using the default settings. -WaveOut=WaveOut - -[Dialog-Create Language] -Cancel=Cancel -Choose a language=Choose a language -Create Language=Create Language -OK=OK - -[Dialog-Edit Installations] -Add=Add -Add New Installation=Add New Installation -Cancel=Cancel -Current Installations=Current Installations -Current Installations (the top installation is the default)=Current Installations (the top installation is the default) -Edit Installations=Edit Installations -Enter the complete path to a StepMania or DWI installation\ne.g. "C:\Program Files\StepMania"=Enter the complete path to a StepMania or DWI installation\ne.g. "C:\Program Files\StepMania" -Make Default=Make Default -OK=OK -Remove=Remove -The top installation is the default.=The top installation is the default. - -[Dialog-Export Packages] -Close=Close -Edit Installations=Edit Installations -Export As Individual=Export As Individual -Export As One=Export As One -Export Packages=Export Packages -Installation=Installation -Launch Game=Launch Game -Open Program Folder=Open Program Folder -Select Installation:=Select Installation: -Tree2=Tree2 - -[Dialog-Language Translations] -1) Create a new language\n2) Export the theme strings to a CSV\n3) Edit the CSV using Excel or a text editor\n4) Import the CSV file back into the same language=1) Create a new language\n2) Export the theme strings to a CSV\n3) Edit the CSV using Excel or a text editor\n4) Import the CSV file back into the same language -Check Language=Check Language -Close=Close -Create Language=Create Language -Delete Language=Delete Language -Export CSV=Export CSV -Export already translated strings=Export already translated strings -Import CSV=Import CSV -Language Translations=Language Translations -Languages=Languages -Need translation:=Need translation: -Selection details=Selection details -Themes=Themes -Total Strings:=Total Strings: - -[Dialog-StepMania Tools] -Close=Close -Export As Individual=Export As Individual -Export As One=Export As One -Export Packages=Export Packages -Launch Game=Launch Game -Open Program Folder=Open Program Folder -Select Installation:=Select Installation: -StepMania Tools=StepMania Tools -Tree2=Tree2 - -[Dialog-StepMania Tools Main Menu] -Change Preferences=Change Preferences -Change the graphics API, sound API, and other settings that the game will use.=Change the graphics API, sound API, and other settings that the game will use. -Clear Mappings=Clear Mappings -Clear Preferences=Clear Preferences -Clear all preferences if you've made changes and the game won't start.=Clear all preferences if you've made changes and the game won't start. -Create .smzip package files to share with other users.=Create .smzip package files to share with other users. -Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more.=Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more. -Create Song=Create Song -Create a new or manage existing language translations.=Create a new or manage existing language translations. -Create a new song in from your favorite mp3 or ogg music file.=Create a new song in from your favorite mp3 or ogg music file. -Create and Share=Create and Share -Edit Installations=Edit Installations -Erase all of your keyboard and joystick mappings if you've made a mistake.=Erase all of your keyboard and joystick mappings if you've made a mistake. -Exit=Exit -Export Packages=Export Packages -Installation=Installation -Languages=Languages -Launch Game=Launch Game -Open Preferences=Open Preferences -Open the preferences file to make changes by hand.=Open the preferences file to make changes by hand. -StepMania Tools Main Menu=StepMania Tools Main Menu -Troubleshooting=Troubleshooting - -[ChangeGameSettings] -Error writing file '%s': %s=Error writing file '%s': %s - -[Dialog-Name Your Package] -Name Your Package=Name Your Package -Enter a name for your new package:=Enter a name for your new package: -OK=OK -Cancel=Cancel -Note: leave off the ".smzip" extention=Note: leave off the ".smzip" extention - -[Dialog-Install a package] -Finish >=Finish > -Cancel=Cancel -< Back=< Back -Install a package=Install a package -Edit Installations=Edit Installations -You have chosen to install the package:=You have chosen to install the package: -This package contains the following files:=This package contains the following files: -The package will be installed in the following program folder:=The package will be installed in the following program folder: - -[PlayerNumber] -P1=P1 -P2=P2 - -[UnlockRewardType] -Song=Song -Steps=Steps -Course=Course -Modifier=Modifier - -[RageDisplay_OGL] -Obtain an updated driver from your video card manufacturer.=Obtain an updated driver from your video card manufacturer. -GLDirect was detected. GLDirect is not compatible with this game and should be disabled.=GLDirect was detected. GLDirect is not compatible with this game and should be disabled. - -[RageDisplay_D3D] -DirectX 8.1 or greater is not installed. You can download it from:=DirectX 8.1 or greater is not installed. You can download it from: -Your system is reporting that Direct3D hardware acceleration is not available. Please obtain an updated driver from your video card manufacturer.=Your system is reporting that Direct3D hardware acceleration is not available. Please obtain an updated driver from your video card manufacturer. - -[RageDisplay] -SetVideoMode failed:=SetVideoMode failed: - -[Dialog-Prompt] -Prompt=Prompt -OK=OK -&Don't display this message again=&Don't display this message again -Error=Error - -[Dialog-Uninstall Old Packages] -Uninstall Old Packages=Uninstall Old Packages -&Yes=&Yes -&No=&No -Cancel=Cancel -The following packages are already installed. It is strongly recommended that they be deleted before installing this package.=The following packages are already installed. It is strongly recommended that they be deleted before installing this package. -Delete old packages?=Delete old packages? - -[DeviceButton] -Home=Home -End=End -Up=Up -Down=Down -Space=Space -Shift=Shift -Ctrl=Ctrl -Alt=Alt -Insert=Insert -Delete=Delete -PgUp=PgUp -PgDn=PgDn -Backslash=Backslash - -[EditHelpDescription] -Move cursor=Move cursor -Jump measure=Jump measure -Select region=Select region -Jump to first/last beat=Jump to first/last beat -Change zoom=Change zoom -Play=Play -Play current beat to end=Play current beat to end -Play whole song=Play whole song -Record=Record -Set selection=Set selection -Toggle assist tick=Toggle assist tick -Next/prev steps of same StepsType=Next/prev steps of same StepsType -Decrease/increase BPM at cur beat=Decrease/increase BPM at cur beat -Decrease/increase stop at cur beat=Decrease/increase stop at cur beat -Decrease/increase music offset=Decrease/increase music offset -Decrease/increase sample music start=Decrease/increase sample music start -Decrease/increase sample music length=Decrease/increase sample music length -Play sample music=Play sample music -Add/Edit Background Change=Add/Edit Background Change -Insert beat and shift down=Insert beat and shift down -Shift BPM changes and stops down one beat=Shift BPM changes and stops down one beat -Delete beat and shift up=Delete beat and shift up -Shift BPM changes and stops up one beat=Shift BPM changes and stops up one beat -Cycle between tap notes=Cycle between tap notes -Lay mine=Lay mine -Lay lift=Lay lift -Add to/remove from right half=Add to/remove from right half -Switch player (Routine only)=Switch player (Routine only) - -[Grade] -Tier01=AAAA -Tier02=AAA -Tier03=AA -Tier04=A -Tier05=B -Tier06=C -Tier07=D -Tier08=D -Failed=F -None= - -[ScreenOptionsEditCourse] --Empty-=-Empty- -Song=Song -Steps=Steps -minutes=minutes -You must enable at least %d songs.=You must enable at least %d songs. - -[LowLevelWindow_Win32] -OpenGL hardware acceleration is not available.=OpenGL hardware acceleration is not available. - -[Premium] -Off=Off -DoubleFor1Credit=Double For 1 Credit -2PlayersFor1Credit=2 Players For 1 Credit - -[Stage] -1st=1st -2nd=2nd -3rd=3rd -4th=4th -5th=5th -6th=6th -Next=Next -Final=Final -Extra1=Extra -Extra2=Another -Nonstop=Nonstop -Oni=Oni -Endless=Endless -Event=Event -Demo=Demo - -[JudgmentLine] -W1=Flawless -W2=Perfect -W3=Great -W4=Good -W5=Boo -Held=Held -MaxCombo=Max Combo -Miss=Miss - -[NativeLanguageNames] -Afar=Afar -Abkhazian=аҧсуа бызшәа -Afrikaans=Afrikaans -Amharic=Amharic -Arabic=العربية -Assamese=Assamese -Aymara=Aymara -Azerbaijani=azərbaycan -Bashkir=Bashkir -Byelorussian=Беларуская -Bulgarian=Български -Bihari=Bihari -Bislama=Bislama -Bengali=Bengali -Tibetan=Tibetan -Breton=Breton -Catalan=Català -Corsican=Corsican -Czech=čeština -Welsh=Cymraeg -Danish=Dansk -German=Deutsch -Bhutani=Bhutani -Greek=Ελληνικά -English=English -Esperanto=Esperanto -Spanish=Español -Estonian=Eesti -Basque=euskera -Persian=فارسی -Finnish=Suomi -Fiji=Fiji -Faeroese=Faeroese -French=Français -Frisian=Frisian -Irish=Gaeilge -Gaelic=Gaelic -Galician=Galego -Guarani=Guarani -Gujarati=Gujarati -Hausa=Hausa -Hebrew=עברית -Hindi=हिंदी -Croatian=Hrvatski -Hungarian=Magyar -Armenian=Հայերեն -Interlingua=Interlingua -Indonesian=Bahasa indonesia -Interlingue=Interlingue -Inupiak=Inupiak -Indonesian=Bahasa indonesia -Icelandic=Íslenska -Italian=Italiano -Hebrew=עברית -Japanese=日本語 -Yiddish=Yiddish -Javanese=Javanese -Georgian=Georgian -Kazakh=Қазақ -Greenlandic=Greenlandic -Cambodian=Cambodian -Kannada=ಕನ್ನಡ -Korean=한국어 -Kashmiri=Kashmiri -Kurdish=Kurdish -Kirghiz=Кыргыз -Latin=Latin -Lingala=Lingala -Laothian=Laothian -Lithuanian=Lietuviškai -Latvian=Latviešu -Malagasy=Malagasy -Maori=Maori -Macedonian=Македонски -Malayalam=Malayalam -Mongolian=Mongolian -Moldavian=Moldavian -Marathi=Marathi -Malay=Bahasa melayu -Maltese=Malti -Burmese=Burmese -Nauru=Nauru -Nepali=Nepali -Dutch=Nederlands -Norwegian=Norsk -Occitan=Occitan -Oromo=Oromo -Oriya=Oriya -Punjabi=Punjabi -Polish=Polski -Pashto=پښتو -Portuguese=português -Quechua=Quechua -Rhaeto-Romance=Rhaeto-Romance -Kirundi=Kirundi -Romanian=Română -Russian=Pyccĸий -Kinyarwanda=Kinyarwanda -Sanskrit=Sanskrit -Sindhi=Sindhi -Sangro=Sangro -Serbo-Croatian=Serbo-Croatian -Singhalese=Singhalese -Slovak=Slovenčina -Slovenian=Slovenščina -Samoan=Samoan -Shona=Shona -Somali=Somali -Albanian=Shqip -Serbian=Srpski -Siswati=Siswati -Sesotho=Sesotho -Sudanese=Sudanese -Swedish=svenska -Swahili=Kiswahili -Tamil=Tamil -Tegulu=తెలుగు -Tajik=Tajik -Thai=ภาษาไทย -Tigrinya=Tigrinya -Turkmen=Turkmen -Tagalog=Tagalog -Setswana=Setswana -Tonga=Tonga -Turkish=Tϋrkçe -Tsonga=Tsonga -Tatar=Tatar -Twi=Twi -Ukrainian=Українська -Urdu=اردو -Uzbek=o'zbek -Vietnamese=Tiếng Việt -Volapuk=Volapuk -Wolof=Wolof -Xhosa=isiXhosa -Yiddish=Yiddish -Yoruba=Yorùbá -Chinese=中文 -Zulu=isiZulu - -[ScreenPlayerOptions] -HeaderText=Select Modifiers -HeaderSubText=Challenge yourself to achieve the ultimate skill! - -[ScreenSongOptions] -HeaderText=Song Modifiers -HeaderSubText=You picked a great song. Now let's dance! - -[StageAward] -FullComboW3=Full Combo! -SingleDigitW3=Single Digit Greats! -OneW3=One Great! -FullComboW2=Full Perfect Combo!! -SingleDigitW2=Single Digit Perfects!! -OneW2=One Perfect!! -FullComboW1=Full Fantastic Combo!!! -80PercentW3=80% Greats! -90PercentW3=90% Greats!! -100PercentW3=100% Greats!!! - -[PeakComboAward] -1000=1000 Peak Combo! -2000=2000 Peak Combo! -3000=3000 Peak Combo! -4000=4000 Peak Combo! -5000=5000 Peak Combo!! -6000=6000 Peak Combo!! -7000=7000 Peak Combo!! -8000=8000 Peak Combo!! -9000=9000 Peak Combo!! -10000=10000 Peak Combo!!! - -[ScreenOptionsExportPackage] -HeaderText=Export Package -HeaderSubText=Share your creation with people - -[ScreenOptionsEdit] -HeaderText=Edit/Share -HeaderSubText=Show your creativity - -[ScreenMiniMenuEditHelp] -HeaderText=Edit Help - -[ScreenMiniMenuMainMenu] -HeaderText=Main Menu - -[ScreenMiniMenuAreaMenu] -HeaderText=Area Menu - -[ScreenMiniMenuStepsInformation] -HeaderText=Steps Information - -[ScreenMiniMenuSongInformation] -HeaderText=Song Information - -[ScreenMiniMenuBackgroundChange] -HeaderText=Background Change - -[ScreenMiniMenuInsertTapAttack] -HeaderText=Insert Tap Attack - -[ScreenMiniMenuInsertCourseAttack] -HeaderText=Insert Course Attack - -[ScreenMiniMenuCourseDisplay] -HeaderText=Course Display - -[CourseUtil] -You must supply a name for your course.=You must supply a name for your course. -The course name cannot contain any of the following characters: %s=The course name cannot contain any of the following characters: %s -The name you chose conflicts with another course. Please use a different name.=The name you chose conflicts with another course. Please use a different name. -[ScreenProfileSave] -HeaderText= -[ScreenTestInput] -HeaderText=Test Input -[ScreenMiniMenuContext] -HeaderText=! -[ScreenOptionsManageProfiles] -HeaderText=Profiles -[ScreenOptionsSystemDirection] -HeaderText=System Direction -[ScreenOptionsUI] -HeaderText=UI -[ScreenOptionsArcade] -HeaderText=Arcade -[ScreenOptionsInput] -HeaderText=Input -[ScreenOptionsTheme] -HeaderText=Theme Options -[ScreenOptionsManageCourses] -HeaderText=Courses -[ScreenEditOptions] -HeaderText= -[ScreenOptionsEditCourse] -HeaderText=Edit Course -HelpText=&MENUUP;&MENUDOWN; Move &MENULEFT;&MENURIGHT; Change Value -[ScreenOptionsCourseOverview] -HeaderText=Course Overview -[ScreenQuickSetupOverview] -HeaderText=Quick Setup - Welcome! -[ScreenQuickSetupPhaseOne] -HeaderText=Quick Setup - Page 1: Profile -[ScreenQuickSetupPhaseTwo] -HeaderText=Quick Setup - Page 2: Gameplay -[ScreenQuickSetupPhaseThree] -HeaderText=Quick Setup - Page 3: Appearance -[ScreenQuickSetupPhaseFour] -HeaderText=Quick Setup - Page 4: Extra -[ScreenQuickSetupFinished] -HeaderText=Quick Setup - Finished! -[ScreenSelectProfile] -HeaderText=Select Profile -[ScreenSelectPlayStyle] -HeaderText=Select Style -[ScreenGameInformation] -HeaderText=Info -[StepsDisplay StepsType] -Dance_Single=Single -Dance_Double=Double -Dance_Couple=Couple -Dance_Solo=Solo -Dance_Routine=Routine -Dance_Threepanel=3 Panels -Pump_Single=Single -Pump_Double=Double -Pump_Halfdouble=Half-Double -Pump_Couple=Couple -Pump_Routine=Routine -Kb7_Single=KB7 -Ez2_Single=Single -Ez2_Double=Double -Ez2_Real=Real -Para_Single=Single -Ds3ddx_Single=Single -Bm_Single5=5 Keys -Bm_Double5=10 Keys -Bm_Single7=7 Keys -Bm_Double7=14 Keys -Maniax_Single=Single -Maniax_Double=Double -Techno_Single4=Single 4 -Techno_Single5=Single 5 -Techno_Single8=Single 8 -Techno_Double4=Double 4 -Techno_Double5=Double 5 -Pnm_Five=5 Button -Pnm_Nine=9 Button -Guitar_Five=5 Frets -Karaoke=Karaoke -Lights_Cabinet=Lights -[StepsListDisplayRow StepsType] -Dance_Single=Single -Dance_Double=Double -Dance_Couple=Couple -Dance_Solo=Solo -Dance_Routine=Routine -Dance_Threepanel=3panel -Pump_Single=Single -Pump_Double=Double -Pump_Halfdouble=Half-Double -Pump_Couple=Couple -Pump_Routine=Routine -Kb7_Single=KB7 -Ez2_Single=Single -Ez2_Double=Double -Ez2_Real=Real -Para_Single=Single -Ds3ddx_Single=Single -Bm_Single5=5 Keys -Bm_Double5=10 Keys -Bm_Single7=7 Keys -Bm_Double7=14 Keys -Maniax_Single=Single -Maniax_Double=Double -Techno_Single4=Single 4 -Techno_Single5=Single 5 -Techno_Single8=Single 8 -Techno_Double4=Double 4 -Techno_Double5=Double 5 -Pnm_Five=5 Button -Pnm_Nine=9 Button -Guitar_Five=5 Frets -Karaoke=Karaoke -Lights_Cabinet=Lights - -[ScreenHowToInstallSongs] -HeaderText=Installing Songs - -[ThemePrefs] -IniFileMissing=IniFile missing. Can't read or write from disk :( -UnknownPreference=Unknown preference "%s" - -[ThemePrefsRows] -ChoicesSizeMismatch=Choices and Values have different sizes (%d, %d) -NoDefaultInValues=Preference "%s" has no values matching default -TypeMismatch=Type mismatch between default (%s) and value %d (%s) +[Common] +WindowTitle=StepMania +StepMania=StepMania + +[Arch] +Couldn't create a movie driver.=Couldn't create a movie driver. +Input Handlers cannot be empty.=Input Handlers can not be empty. +Movie Drivers cannot be empty.=Movie Drivers can not be empty. +Sound Drivers cannot be empty.=Sound Drivers can not be empty. + +[ArchHooks_Unix] +Couldn't find 'Songs'=Couldn't find 'Songs' + +[CSMPackageInstallDlg] +Could not open file '%s'.=Could not open file '%s'. +Installing. Please wait...=Installing. Please wait... +'%s' is not a valid zip archive.='%s' is not a valid zip archive. +Error opening source file '%s': %s=Error opening source file '%s': %s +Error opening destination file '%s': %s=Error opening destination file '%s': %s +Error copying file '%s': %s=Error copying file '%s': %s +No Installations found. Exiting.=No Installations found. Exiting. +Package installed successfully!=Package installed successfully! + +[CSmpackageApp] +The file Stats.xml has not yet been created. It will be created once the game is run.=The file Stats.xml has not yet been created. It will be created once the game is run. +Failed to open '%s': %s=Failed to open '%s': %s +The file '%s' does not exist. Aborting installation.=The file '%s' does not exist. Aborting installation. + +[CSmpackageExportDlg] +No items are checked.=No items are checked. +Successfully exported package '%s' to your Desktop.=Successfully exported package '%s' to your Desktop. +The following packages failed to export:=The following packages failed to export: +The following packages were exported to your Desktop:=The following packages were exported to your Desktop: + +[CatalogXml] +Saving %s ...=Saving %s ... + +[CustomDifficulty] +Beginner=Novice +Easy=Easy +Medium=Medium +Hard=Hard +Challenge=Expert +Edit=Edit +Couple=Couple +Routine=Routine +# +Freestyle=Freestyle +Crazy=Crazy +Nightmare=Nightmare +HalfDouble=Half-Double + +[CourseDifficulty] +Beginner=Novice +Challenge=Expert +Hard=Hard +Easy=Easy +Edit=Edit +Medium=Medium + +[CourseEntryType] +Best=Players' Best +Fixed=Fixed Song +Random=Random Song +RandomWithinGroup=Random Song Within Group +Worst=Players' Worst + +[CourseType] +Endless=Endless +Nonstop=Nonstop +Oni=Oni +Survival=Survival + +[EditInstallations] +You must type a program directory before clicking Add.=You must type a program directory before clicking Add. +'%s' is not a valid installation directory.='%s' is not a valid installation directory. + +[EditMenuAction] +Create=Create New +Delete=Delete Existing +Edit=Edit Existing +Practice=Practice + +[EditMenu] +Blank=Blank + +[EditMenuRow] +Action=Action +Group=Group +Song=Song +SourceSteps=Fill Steps +SourceStepsType=Fill Type +Steps=Steps +StepsType=Type + +[GameButton] +Back=Back +Down=Down +Center=Center +DownLeft=DownLeft +DownRight=DownRight +Coin=Insert Coin +Left=Left +MenuDown=MenuDown +MenuLeft=MenuLeft +MenuRight=MenuRight +MenuUp=MenuUp +Operator=Operator +EffectUp=EffectUp +EffectDown=EffectDown +Right=Right +Select=Select +Start=Start +Up=Up +UpLeft=UpLeft +UpRight=UpRight +Key1=Key 1 +Key2=Key 2 +Key3=Key 3 +Key4=Key 4 +Key5=Key 5 +Key6=Key 6 +Key7=Key 7 +Scratch up=Scratch up +Scratch down=Scratch down +Fret1=Fret 1 +Fret2=Fret 2 +Fret3=Fret 3 +Fret4=Fret 4 +Fret5=Fret 5 +StrumUp=Strum Up +StrumDown=Strum Down +Tilt=Tilt +FootUpLeft=FootUpLeft +FootUpRight=FootUpRight +FootDown=FootDown +HandUpLeft=HandUpLeft +HandUpRight=HandUpRight +HandLrLeft=HandLrLeft +HandLrRight=HandLrRight + +[GameCommand] +Could not launch web browser.=Could not launch web browser. + +[GameState] +CPU=CPU +Player 1=Player 1 +Player 2=Player 2 + +[Headers] +Edit Courses=Edit Courses +Edit Steps=Edit Steps +Jukebox=Jukebox +Log In=Log In +Theme Options=Theme Options +Network Options=Network Options +Export Packages=Export Packages +Select Character=Select Character +Select Course=Select Course +Select Difficulty=Select Difficulty +Select Music=Select Music +Select Style=Select Style +Set Time=Set Time +Summary=Summary +Test Input=Test Input +Results=Results + +[HoldNoteScore] +Held=OK +LetGo=NG +None=None + +[InputMapper] +Connected=Connected +Disconnected=Disconnected +Auto-mapping all joysticks.=Auto-mapping all joysticks. + +[Language] +Name=English + +[LanguagesDlg] +Error parsing file '%s'.=Error parsing file '%s'. +Error reading '%s'.=Error reading '%s'. +Error reading line '%s' from '%s': Each line must have either 3 or 4 values. This row has %d values.=Error reading line '%s' from '%s': Each line must have either 3 or 4 values. This row has %d values. +Error reading file '%s'.=Error reading file '%s'. +Exported to your Desktop as '%s'.=Exported to your Desktop as '%s'. +Failed to save '%s'.=Failed to save '%s'. +Imported %d strings into '%s'.\n - %d were added.\n - %d were modified\n - %d were unchanged\n - %d empty strings were ignored=Imported %d strings into '%s'.\n - %d were added.\n - %d were modified\n - %d were unchanged\n - %d empty strings were ignored +Importing these strings will override all data in '%s'. Continue?=Importing these strings will overwrite all data in '%s'. Continue? +There are no strings to export for this language.=There are no strings to export for this language. +This will permanently delete '%s'. Continue?=This will permanently delete '%s'. Continue? + +[LowLevelWindow_X11] +Failed to establish a connection with the X server=Failed to establish a connection with the X server + +[MainMenuDlg] +'%s' cleared='%s' cleared +'%s' doesn't exist. It will be created next time you start the game.='%s' doesn't exist. It will be created next time you start the game. +'%s' is already cleared.='%s' is already cleared. +Failed to copy music file '%s' to '%s': %s=Failed to copy music file '%s' to '%s': %s +Failed to create directory '%s': %s=Failed to create directory '%s': %s +Failed to create song directory '%s': %s=Failed to create song directory '%s': %s +Failed to create the song file '%s'.=Failed to create the song file '%s'. +Failed to delete file '%s'.=Failed to delete file '%s'. +Failed to open '%s': %s=Failed to open '%s': %s +Music file=Music file +Success. Created the song '%s'.=Success. Created the song '%s'. +The song directory '%s' already exists. You cannot override an existing song.=The song directory '%s' already exists. You can not overwrite an existing song. + +[MultiPlayer] +P1=P1 +P2=P2 +P3=P3 +P4=P4 +P5=P5 +P6=P6 +P7=P7 +P8=P8 +P9=P9 +P10=P10 +P11=P11 +P12=P12 +P13=P13 +P14=P14 +P15=P15 +P16=P16 +P17=P17 +P18=P18 +P19=P19 +P20=P20 +P21=P21 +P22=P22 +P23=P23 +P24=P24 +P25=P25 +P26=P26 +P27=P27 +P28=P28 +P29=P29 +P30=P30 +P31=P31 +P32=P32 + +[MusicWheel] +ArtistText=Artist +BpmText=BPM +EasyMeterText=Easy Rank +GenreText=Genre +GroupText=Group +HardMeterText=Hard Rank +ChallengeMeterText=Challenge Rank +DoubleEasyMeterText=Easy Rank (Double) +DoubleMediumMeterText=Medium Rank (Double) +DoubleHardMeterText=Hard Rank (Double) +DoubleChallengeMeterText=Challenge Rank (Double) +LengthText=Length +MediumMeterText=Medium Rank +PopularityText=Player's Best! +Portal=Portal +PreferredText=Preferred +Random=Random +Roulette=Roulette +TitleText=Title +RecentText=Recent +TopGradesText=Top Grades +CoursesText=Courses +AllCoursesText=All Courses +NonstopText=Nonstop Courses +OniText=Oni Courses +EndlessText=Endless Courses +SurvivalText=Survival Courses +NormalModeText=Normal Mode +BattleModeText=Battle Mode (Disabled) + +[NetworkSyncManager] +Connection failed.=Connection failed. +Connection to '%s' successful.=Connection to '%s' successful. +Connection to server dropped.=Connection to server dropped. +Initializing Client Network...=Initializing Client Network... +Not Supported=Mode not supported while networked. + +[NoteType] +4th=4th +8th=8th +12th=12th +16th=16th +24th=24th +32nd=32nd +48th=48th +64th=64th +192nd=192nd + +[OptionExplanations] +Accel=Accelerate, Decelerate or otherwise adjust the arrow speed. +AllowExtraStage=When enabled (and Event Mode isn't on), allows the player to earn extra stages after completing certain requirements. +AllowW1=Enable or disable fantastic judgement. NEVER - never show Fantastic, COURSES ONLY - only during nonstop/oni modes, ALWAYS - all modes of play. +Announcer=Choose from this list of installed announcer packs. +Appearance=Appearance +Appearance Options=Change the theme, announcer, and other style options. +Theme Options=Change theme specific features and functions. +ArcadeOptionsNavigation=&oq;SM style&cq;: Start button moves to End, Up/Down switches between option lines. &oq;Arcade style&cq;: Start button moves cursor to next option line (Up/Down ignored). +Assist=Assist +Attacks=Choose whether non-course attacks will appear during gameplay. +AttractSoundFrequency=Set to ALWAYS to play sound every during the attract screens. Set to N TIMES to play sounds every N attract sequences. +AutoAdjust=AutoAdjust +AutoMapOnJoyChange=If this setting is &oq;On&cq;, the game will remap joysticks if they were not previously connected. Turning auto mapping on will override any manually defined mappings. +AutoPlay=This option is useful for those who would like to play without using a pad. However, you will not be able to set high scores or earn extra stages while this option is ON. +AutogenGroupCourses=Show group Nonstop and Endless courses that were created by Autogen. +AutogenSteps=Automatically generate steps from other game types. +BGBrightness=Controls how bright the background will appear. Turn this setting down if you have a hard time seeing the notes. +Background=Change options that control the backgrounds that play during gameplay. +BarDrain=BarDrain +BatLives=BatLives +Bookkeeping=Check coin drop statistics. +Calibrate Machine Sync=Calibrate the audio synchronization. +CelShadeModels=Choose if dancing characters are drawn with cel shading. +Center Image=Center the image on your monitor. +Characters=Characters +Clear Bookkeeping Data=Clear all coin drop data. +Clear Machine Edits=Save all step edits saved to this machine. +Clear USB edits=Clear USB edits +Clear Machine Stats=Clear all scores saved to this machine. +CoinMode=&oq;Home&cq;: Options are shown on the Title Menu. &oq;Pay&cq;: Title Menu choices are hidden; must insert coins before playing. &oq;Free Play&cq;: Title Menu choices are hidden; Play without inserting coins. +CoinModeNoHome=When set to PAY you must insert coins before joining in. When set to FREE you can join in without inserting coins. +CoinsPerCredit=The number of coins that must be inserted before a player can join. (when Coin Mode = Pay) +Connection=Connect to Server (To be specified) +CourseSortOrder=Determines how courses are sorted. +CreateNew= +Create New Course=Create a new course. +Create New Profile=Create a new player profile. +DancePointsForOni=Toggle whether the score in Oni mode displays Dance Points or the Percent Score. +DefaultFailType=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. OFF disables fail. +DefaultFailTypeNoOff=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. +DefaultNoteSkin=Choose the default noteskin to use when playing. +DelayedBack=If &oq;On&cq;, requires holding the Back button for 0.5 seconds to quit. Useful if you find yourself accidentally pressing the Back button on your controller. +DelayedTextureDelete=Set to ON hold textures in memory instead of freeing them. This will eliminate the time needed to load the texture next from disk next time this is needed. Do not set to ON unless you have 128MB of memory or more. +Delete= +Difficulty= +DisplayAspectRatio=Change the width-to-height ratio of graphics in the game. Most displays are 4:3. +DisplayColorDepth=Choose the color depth of the window. This option may not take effect in windowed mode. +DisplayResolution=Choose the output resolution. A higher resolution will show more detail, but requires a faster video card. +EasterEggs=Enable or disable some special easter eggs. +Edit Courses=Edit Courses +Edit Songs/Steps=Edit Songs/Steps +Practice Songs/Steps=Practice Songs/Steps +EditorShowBGChangesPlay=Choose whether to display song backgrounds while playing. +Effect=Effect +EnableAttackSounds=If enabled, a sound effect will play when an attack begins or ends. +EnableMineHitSound=If enabled, a sound will play when a mine is stepped on. +EventMode=When set to &oq;ON&cq;, and you can continue playing forever. Failing will also take you back to the the Select Music or Select Course screen. +Exit= +Fail=Fail +FastLoad=If enabled, don't check songs for changes on load. +Fill Machine Stats= +Game=Change the current game type with this option. +GetRankingName=Determines if name entry should never be shown, always be shown, or shown when the course is listed on the high scores screen. +Graphics/Sound Options=Change full screen, resolution, and sound options. +Group= +HiddenSongs=Some songs are only playable during Oni courses and with roulette. Leave this &oq;OFF&cq; to always display all songs. +Hide=Hide +Holds=Holds +Insert=Insert +Insert Credit=Insert Credit +Key Joy Mappings=Map keys and joystick buttons to game functions. +Language=Choose your language. +LifeDifficulty=Increase this value to cause your life meter to drain faster and refill slower. +LifeType=LifeType +Advanced Options=Change advanced options such as scoring, timing window, and life meter settings. +MasterVolume= +HighResolutionTextures=Choose whether high resolution textures (if supported by the current theme) will be used. When set to Auto, high resolution textures will be used if the display height is > 480. +MaxTextureResolution=Choose the maximum texture resolution. Setting this to anything below 1024 will cause some textures to appear blurry, but may increase your frame rate. +MenuTimer=When &oq;ON&cq;, menus have a time limit. +Mines=Mines +MoveRandomToEnd=Determines if courses with random songs should be placed at the end of the course select wheel. +MovieColorDepth=Choose the color depth of textures. 32 bit textures use more memory, but look nicer. +MusicWheelSwitchSpeed=Adjusts the speed of the music wheel. +MusicWheelUsesSections=&oq;Always&cq; means sections in group + ABC; &oq;Never&cq; means no sections; &oq;Title Only&cq; shows sections in ABC order. +Network Options=Connect to a server or change server options. +No Memory Card=No USB memory card was found. +NoteSkins=NoteSkins +NumBackgrounds=Choose the maximum number of random backgrounds to be loaded simultaneously. +OnlyDedicatedMenuButtons=Choose between allowing game buttons (dance pad, etc.) and Menu* buttons for menu movement. Be sure to map the Menu* set of buttons before setting this to &oq;Only dedicated buttons&cq;! +OptionsRandomJukebox= +OsMountPlayer1= +OsMountPlayer2= +Persp=Perspective +Player1Profile= +Player2Profile= +PlayerAutoPlay=PlayerAutoPlay +PreloadSounds=If YES, preload most sounds in advance. This increases load times, and should normally be left OFF. +Premium=Choose from various premium options. (Coin Mode = Pay) +Profile= +Export Packages=Export .smzip packages of your installed content. +Profiles=Edit the player profiles stored on this machine. +ProgressiveLifebar=Set whether the lifebar is harsher on consecutive boo/miss judgments. OFF for no effect, 8 to make each consecutive miss a multiple of the first miss. +ProgressiveNonstopLifebar=Determine whether the lifebar gets harsher as a nonstop course progresses. LifeDifficulty + this = LifeDifficulty on a final stage of a course. +ProgressiveStageLifebar=Determine whether the lifebar gets harsher on later stages. LifeDifficulty + this = LifeDifficulty on a final stage. (No effect if Event Mode). +ProTiming=ProTiming +RandomBackgroundMode=Choose background style. &oq;Animations&cq; uses random items in the BGAnimations folder; &oq;Random Movies&cq; cycles through movies in the RandomMovies folder. +More Options=Access more advanced options here. +RandomModifiers= +Rate=Rate +RefreshRate=Controls how many times per second the screen will refresh. Only has an effect when Display Mode is set to &oq;Full Screen&cq;. +Reload Songs=Reload all songs and courses. +Remove=Remove arrows to make the song easier. +Rename= +Reset To Defaults=Reset all options to default values. +SaveScores=SaveScores +SaveReplays=Enable saving replays. +SaveStats=If enabled, save Stats.xml. +ScoreDisplay=ScoreDisplay +Scoreboard=Enables scoreboard +ScoringType=Defines which scoring method to use. +Scroll=Scroll +Select Group=Toggle Songs in this Group. +Select Profile=Choose a profile +Server=Start Local Server +Servers=Servers +ShowBanners=Toggles the display of Banners. +ShowBeginnerHelper=Turn this on to enable a demonstration dancer during Beginner play. +ShowCaution=Toggle whether the Caution screen is shown. +ShowDancingCharacters=Turn this option &oq;OFF&cq; to disable the dancing characters in the background. Even if this option is &oq;ON&cq;, characters will only show if you have some installed. +ShowDanger=Turn this option &oq;OFF&cq; to disable the flashing &oq;Danger&cq; background that shows when you're about to drop to 0% health. +ShowInstructions=Toggle whether the Instructions screen is shown. +ShowLyrics=Toggle the display of song lyrics if available. (via .LRC file) +ShowNativeLanguage=Choose between displaying song titles in their native language (日本語), or transliterating them when possible. +ShowSelectGroup=Toggle whether the Select Group screen is shown. +ShowSongOptions=Toggle display of the Song Options screen. When set to ASK, it can be accessed by pressing START a second time after Player Options. +ShowStats=Display performance statistics in the upper right corner of the screen and show skips in the lower right corner. FPS = frames per second. TPF = triangles per frame. DPF = draws per frame. +SmoothLines=Toggle whether the Groove Radar is drawn with antialiased lines. +Center1Player=Turn this option &oq;ON&cq; to center the display for 1 player styles. +SongsPerPlay=The number of songs a player can play in Regular mode (if Event Mode is off). +SoundEffect= +SoundResampleQuality=Advanced: Select the resampling quality to use. +SoundVolume=Adjust the volume level during gameplay. +SoundVolumeAttract=Adjust the volume level during attract mode. +Speed=Speed +Stepmania Credits=The Stepmania Development Team +Steps=Steps +Style= +Test Input=Test the responsiveness of connected joysticks. +Test Lights=Test the responsiveness of connected lights. +TextureColorDepth=Choose the color depth of textures. 32 bit textures use more memory, but look nicer. +Theme=Choose from this list of installed theme packs. +TimingWindowScale=Increase this value to cause your steps to be judged more strictly (i.e. shrink the timing window). +Toggle Song=Toggle Song +Turn=Turn +Transfer Edits to USB=Transfer Edits to USB +Transfer Edits from USB=Transfer Edits from USB +UseUnlockSystem=Enable or disable the unlock system. +VisualDelaySeconds=Calibrate display lag. +Vsync=Cap your frame rate your display's refresh rate. This option only has an effect when the Display Mode is set to &oq;Full Screen&cq;. +WideScreen16_9=Enable widescreen display. +WideScreen16_10=Enable widescreen display. +Windowed=Choose whether you would like to run full screen, or to display in a window on your desktop. + +# +UI Options=Adjust game-wide user interface options. +Input Options=Adjust input options such as delay and speed. +Arcade Options=Adjust arcade features such as the Menu Timer. +Select Game=Select your preferred gametype. +System Direction=Change commonly-used preferences here. + +# +OnlyPreferredDifficulties=Only Preferred Difficulties +# +PercentageScoring=Choose between displaying long form score and percent score. + +# course +Select Course=Edit this course. +Max Minutes=How long the course should be at maximum. +Choose Song=Pick a song for this course slot. +Choose Steps=Choose a steps type for this song. + +Play=Play the course. +Save=Save the course. +Edit Course=Edit Course contents. +Shuffle=Shuffle the songs around. +# +GamePrefDefaultFail=Immediate fail causes a player to die when their life bar reaches 0. ImmediateContinue allows you to continue playing afterwards. +[OptionNames] +0=0 +0.25x=0.25x +0.3x=0.3x +0.4x=0.4x +0.5x=0.5x +0.6x=0.6x +0.7x=0.7x +0.75x=0.75x +0.8x=0.8x +0.9x=0.9x +1=1 +1.0x=1.0x +1.1x=1.1x +1.2x=1.2x +1.25x=1.25x +1.3x=1.3x +1.4x=1.4x +1.5x=1.5x +1.6x=1.6x +1.7x=1.7x +1.75x=1.75x +x1.75=1.75x +1.8x=1.8x +1.9x=1.9x +x2.25=2.25x +x2.5=2.5x +10=10 +11=11 +12=12 +12th=12th +13=13 +16bit=16bit +16th=16th +192nd=192nd +2=2 +2 Players for 1 Credit=2 Players for 1 Credit +2 Times=2 Times +2.0x=2.0x +24th=24th +3=3 +3 Times=3 Times +32bit=32bit +32nd=32nd +4=4 +4 Times=4 Times +48th=48th +4th=4th +5=5 +5 Times=5 Times +6=6 +64th=64th +7=7 +8=8 +8th=8th +9=9 +Add=Additive +All Music=All Music +AllDifficulties=All Difficulties +AllGroups=All Groups +Alternate=Alternate +Always=Always +Animations=Animations +Arcade Style=Arcade Style +Ask=Ask +AttackMines=AttackMines +Auto=Auto +Autogen To Fill Width=Autogen To Fill Width +AutosyncMachine=AutosyncMachine +Average=Average +Average Feet=Average Feet +Backwards=Backwards +Baked Random=Baked Random +Bar=Bar +Battery=Battery +Beat=Beat +Big=Big +Blind=Blind +Blink=Blink +BMRize=BMRize +Boomerang=Boomerang +Boost=Boost +Both=Both +Brake=Brake +Bumpy=Bumpy +C150=C150 +C300=C300 +CPU-Controlled=CPU-Controlled +Centered=Centered +Choose=Choose +Clap=Clap +Clear Left=Clear Left +Clear Right=Clear Right +Collapse Left=Collapse Left +Collapse To One=Collapse To One +Compress 2x=Compress 2x +Compress 3->2=Compress 3->2 +Compress 4->3=Compress 4->3 +Confusion=Confusion +Connect=Connect... +Copy Left To Right=Copy Left To Right +Copy Right To Left=Copy Right To Left +Courses Only=Courses Only +Create New=Create New +Cross=Cross +Custom=Custom +Dance Points=Dance Points +Dark=Dark +Default=Default +Default to Off=Default to Off +Default to Random=Default to Random +DifficultCourses=Difficult +Disconnect=Disconnect +Distant=Distant +Dizzy=Dizzy +Don'tSave=Don't Save +Double for 1 Credit=Double for 1 Credit +Drunk=Drunk +Dynamic Random=Dynamic Random +Echo=Echo +End of Song=End of Song +FailAtEnd=Fail at end +EffectSpeed=Speed +EffectPitch=Pitch +Event=Event Mode +Exit=Exit +Expand=Expand +Expand 2->3=Expand 2->3 +Expand 2x=Expand 2x +Expand 3->4=Expand 3->4 +Fast=Fast +Flat=Flat +Flip=Flip +Floored=Floored +Free Play=Free Play +Force Off=Force Off +Force On=Force On +Full Screen=Full Screen +Global BGAnimation=Global BGAnimation +Global Movie=Global Movie +Global Movie from Song Group=Global Movie from Song Group +Global Movie from Song Group and Genre=Global Movie from Song Group and Genre +HIDE=Hide +Hallway=Hallway +Haste=Haste +Hidden=Hidden +HiddenOffset=Hidden Offset +Hide=Hide +High Quality=High Quality +Hold=Hold +HoldsToRolls=Holds To Rolls +Home=Home +Immediate=Immediate +ImmediateContinue=Delayed +Incoming=Incoming +Insanity=Insanity +Insert Entry=Insert Entry +Instant=Instant +Invert=Invert +Justice=Justice +Left=Left +LifeTime=Survival +Little=Little +Metronome=Metronome +Mines=Mines +Mini=Mini +Mirror=Mirror +N/A=N/A +Native Language=Native Language +Never=Never +New=New +NewEdit=-New Edit- +No=No +NoHands=No Hands +NoHolds=No Holds +NoJumps=No Jumps +NoMines=No Mines +NoRolls=No Rolls +NoQuads=No Quads +NoRecover=No Recover +NoStretch=No Stretch +NoLifts=No Lifts +NoFakes=No Fakes +None=None +Normal=Normal +Num Songs=Num Songs +Off=Off +Old=Old +On=On +On (recommended)=On (recommended) +Only Dedicated Buttons=Only Dedicated Buttons +Overhead=Overhead +Pay=Pay +Percent=Percent +Planted=Planted +Press Start=Press Start +Quick=Quick +R.Vanish=R.Vanish +Random=Random +RandomAttacks=Random Attacks +RandomBG=Random Backgrounds +Random Movies=Random Movies +Ranking=Ranking +Ranking Songs=Ranking Songs +Really Fast=Really Fast +RegularCourses=Regular +Remove=Remove +Reverse=Reverse +Right=Right +Roll=Roll +Romanization=Transliterate +SHOW=Show +Select=Select +Servers=Servers +Shift Left=Shift Left +Shift Right=Shift Right +Show=Show +Shuffle=Shuffle +Silent=Silent +Skip=Skip +Skippy=Skippy +Slow=Slow +SN2=Supernova 2 +SongAttacks=Song Attacks +Song BGAnimation=Song BGAnimation +Song Bitmap=Song Bitmap +Song Movie=Song Movie +Space=Space +Split=Split +Standard=Standard +Start=Start +StaticBG=Static Background +Stealth=Stealth +StepMania Style=StepMania Style +Stomp=Stomp +Stop=Stop +Subtract=Subtractive +Sudden=Sudden +SuddenDeath=Sudden Death +SuddenOffset=Sudden Offset +SuperShuffle=Cement Mixer +SoftShuffle=Soft Shuffle +Swap Sides=Swap Sides +Sync Machine=Sync Machine +Sync Song=Sync Song +Sync Tempo=Sync Tempo +Tiny=Tiny +Tipsy=Tipsy +Title Only=Title Only +Tornado=Tornado +Total Feet=Total Feet +Twirl=Twirl +Twister=Twister +Use Gameplay Buttons=Use Gameplay Buttons +Visible=Visible +Wave=Wave +Wide=Wide +Windowed=Windowed +Yes=Yes +x0.25=x0.25 +x0.50=x0.50 +x0.75=x0.75 +x1=x1 +x1.5=x1.5 +x2=x2 +x3=x3 +x4=x4 +x5=x5 +x8=x8 +PercentageScoring=Percentage Scoring + +Tiny=Tiny +Bumpy=Bumpy +Beat=Beat +GKS=GKS +Cover=Cover +XMode=XMode +[OptionRowHandler] +Off=Off + +[OptionTitles] +Accel=Acceleration +Add/Edit Background Change=Add/Edit Background Change +Air=Air +AllowExtraStage=Allow Extra Stage +AllowW1=Fantastic Timing +Alter=Alter +Announcer=Announcer +Appearance=Appearance +Appearance Options=Appearance Options +Theme Options=Theme Options +ArcadeOptionsNavigation=Options Navigation +Artist=Artist +Artist transliteration=Artist transliteration +Assist=Assist +Attacks=Attacks +AttractSoundFrequency=Attract Sound Frequency +AutoAdjust=Auto Adjust +AutoMapOnJoyChange=Automap Joysticks +AutoPlay=AutoPlay +AutogenGroupCourses=Autogen Group Courses +AutogenSteps=Autogen Steps +BGBrightness=Brightness +Background=Background +BarDrain=Bar Drain +BatLives=Bat Lives +Base Difficulty=Base Difficulty +Bookkeeping=Bookkeeping +Calibrate Machine Sync=Calibrate Audio Sync +CPUSkill=CPU Skill +CelShadeModels=Cel-shaded Models +Center Image=Center Image +Chaos=Chaos +Characters=Characters +Chart Style=Chart Style +Choose=Choose +Clear Bookkeeping Data=Clear Bookkeeping Data +Clear Machine Edits=Clear Machine Edits +Clear Machine Stats=Clear Machine Scores +Clear USB edits=Clear USB edits +Clear area=Clear area +CoinMode=Coin Mode +CoinModeNoHome=Coin Mode +CoinsPerCredit=Coins Per Credit +Connection=Connection +Convert pause to beats=Convert pause to beats +Convert selection to pause=Convert selection to pause +Copy=Copy +CourseSortOrder=Course Sort +Create New=Create New +Create New Course=Create New +Create New Profile=Create Profile +Credit=Credit +Cut=Cut +DancePointsForOni=Oni Score Display +DefaultFailType=Default Fail Type +DefaultFailTypeNoOff=Default Fail Type +DefaultNoteSkin=Default NoteSkin +DelayedBack=Back Delayed +DelayedTextureDelete=Keep Textures In Memory +Delete=Delete +Delete beat and shift up=Delete beat and shift up +Description=Description +Difficulty=Difficulty +DisplayAspectRatio=Aspect Ratio +DisplayColorDepth=Display Color +DisplayResolution=Display Resolution +Duration seconds=Duration seconds +EasterEggs=Easter Eggs +Edit Songs/Steps=Edit Songs/Steps +Genre=Genre +Practice Songs/Steps=Practice Songs/Steps +Edit Courses=Edit Courses +Edit BPM change=Edit BPM change +Edit song info=Edit song info +Edit steps information=Edit steps information +Exit Edit Mode=Exit Edit Mode +Edit stop=Edit stop +Edit delay=Edit delay +Edit Timing Data=Edit Timing Data +Edit time signature=Edit time signature (not working yet) +Edit time signature (top)=Edit time signature (beats per measure) +Edit time signature (bottom)=Edit time signature (single beat note value) +Edit tickcount=Edit tickcount +Edit combo=Edit combo +Editor options=Options +EditorShowBGChangesPlay=Show Backgrounds +Effect=Effect +EnableAttackSounds=Attack Sounds +EnableMineHitSound=Mine Sounds +Entry %d=Entry %d +EventMode=Event Mode +Exit=Exit +Fail=Fail +FastLoad=Fast\nLoad +File1 Global BGAnimation=File1 Global BGAnimation +File1 Global Movie=File1 Global Movie +File1 Global Movie (Group + Genre)=File1 Global Movie (Group + Genre) +File1 Global Movie (Group)=File1 Global Movie (Group) +File1 Song BGAnimation=File1 Song BGAnimation +File1 Song Movie=File1 Song Movie +File1 Song Still=File1 Song Still +File1 Type=File1 Type +File2 Global BGAnimation=File1 Global BGAnimation +File2 Global Movie=File1 Global Movie +File2 Global Movie (Group + Genre)=File1 Global Movie (Group + Genre) +File2 Global Movie (Group)=File1 Global Movie (Group) +File2 Song BGAnimation=File1 Song BGAnimation +File2 Song Movie=File1 Song Movie +File2 Song Still=File1 Song Still +File2 Type=File1 Type +Fill Machine Stats=Fill Machine Stats +Force Color 1=Force Color 1 +Force Color 2=Force Color 2 +Force Effect=Force Effect +Force Transition=Force Transition +Freeze=Freeze +Game=Game +GetRankingName=Show Name Entry +Graphics/Sound Options=Graphics/Sound Options +Group=Group +Hands=Hands +HiddenSongs=Hidden Songs +Hide=Hide +High Meter=High Meter +HighResolutionTextures=High-Res Textures +Holds=Holds +Insert=Insert +Insert Credit=Insert Credit +Insert beat and shift down=Insert beat and shift down +Insert Entry=Insert Entry +Jumps=Jumps +Key Joy Mappings=Config Key/Joy Mappings +Language=Language +Last beat hint=Last beat hint +Layer=Layer +LifeDifficulty=Life Difficulty +LifeType=Life Type +Low Meter=Low Meter +Advanced Options=Advanced Options +Main title=Main title +Main title transliteration=Main title transliteration +MaxTextureResolution=Texture Resolution +MenuTimer=Menu Timer +Meter=Meter +Mines=Mines +MoveRandomToEnd=Random At End +More Options=More Options +MovieColorDepth=Movie Color +MusicWheelSwitchSpeed=Wheel Speed +MusicWheelUsesSections=Wheel Sections +Network Options=Network Options +No USB memory cards found=No USB memory cards found +NoteSkins=NoteSkins +NumBackgrounds=Random Backgrounds +OptionsRandomJukebox=Modifiers +OnlyDedicatedMenuButtons=Menu Buttons +OsMountPlayer1=OS Mount Player1 +OsMountPlayer2=OS Mount Player2 +Paste at begin marker=Paste at begin marker +Paste at current beat=Paste at current beat +Persp=Persp +Play current beat to end=Play current beat to end +Play preview music=Play preview music +Play whole song=Play whole song +Play mods from course=Play mods from course +Play selection=Play selection +Player1Profile=Player1 Profile +Player2Profile=Player2 Profile +PlayerAutoPlay=AutoPlay +Predicted Meter=Predicted Meter +Preferences=Preferences +PreloadSounds=Preload Sounds +Premium=Premium +Export Packages=Export Packages +Profile=Profile +Profiles=Profiles +ProgressiveLifebar=Progressive Lifebar +ProgressiveNonstopLifebar=Progressive Nonstop Lifebar +ProgressiveStageLifebar=Progressive Stage Lifebar +ProTiming=Protiming +Quads=Quads +Quantize=Quantize +RandomBackgroundMode=Mode +RandomModifiers=Modifiers +Rate=Rate +Record in selection=Record in selection +RefreshRate=Refresh Rate +Reload Songs=Reload Songs/Courses +Remove=Remove +Remove Change=Remove Change +Rename=Rename +Reset To Defaults=Reset Options To Default Values +Revert from disk=Revert from disk +Revert to last save=Revert to last save +Save=Save +SaveScores=Save Scores +SaveReplays=Save Replays +SaveStats=Save Stats +ScoreDisplay=Score Display +Scoreboard=Scoreboard +ScoringType=Scoring Type +Scroll=Scroll +Secret=Secret +Server=Server +Servers=Servers +Set P1=Set P1 +Set P2=Set P2 +Set modifiers=Set modifiers +Set Mods=Set Mods +Set selection start=Set selection start +Set selection end=Set selection end +Shift pauses and BPM changes down=Shift pauses and BPM changes down +Shift pauses and BPM changes up=Shift pauses and BPM changes up +ShowBanners=Show Banners +ShowBeginnerHelper=Beginner Helper +ShowCaution=Caution +ShowDancingCharacters=Dancing Characters +ShowDanger=Danger +ShowInstructions=Instructions +ShowLyrics=Lyrics +ShowNativeLanguage=Translations +ShowSelectGroup=Song Group +ShowSongOptions=Show Song Options +ShowStats=Show Stats +SmoothLines=SmoothLines +SoundEffect=Sound Effect +Stepmania Credits=Stepmania Credits +Center1Player=Center 1 Player +Song=Song +Song Group=Song Group +Song Options=Song Options +SongsPerPlay=Songs Per Play +Sort=Sort +SoundResampleQuality=Resampling Quality +SoundVolume=Sound Volume +SoundVolumeAttract=Attract Volume +Speed=Speed +Step Author=Step Author +Steps=Steps +Stream=Stream +Style=Style +Sub title=Sub title +Sub title transliteration=Sub title transliteration +SuperGrowth=Super Growth +Tap Steps=Tap Steps +Tempo=Tempo +Test Input=Test Input +Test Lights=Test Lights +TextureColorDepth=Texture Color +Theme=Theme +TimingWindowScale=Judge Difficulty +Transform=Transform +Transfer Edits to USB=Transfer Edits to USB +Transfer Edits from USB=Transfer Edits from USB +Type=Type +Turn=Turn +Undo=Undo +UseUnlockSystem=Unlock System +VisualDelaySeconds=Visual Delay +Voltage=Voltage +Vsync=Wait For Vsync +WideScreen16_9=Widescreen +WideScreen16_10=Widescreen +Windowed=Display Mode + +# +UI Options=UI Options +Input Options=Input Options +Arcade Options=Arcade Options +Select Game=Select Game +System Direction=System Direction + +# +OnlyPreferredDifficulties=Only Preferred Difficulties +# +PercentageScoring=Percentage Scoring + +Max Minutes=Max Minutes +Play=Play +Edit Course=Edit Course +Shuffle=Shuffle +# +GamePrefDefaultFail=Default Fail Type +[PaneDisplay] +Steps=Steps +Holds=Holds +Jumps=Jumps +Mines=Mines +Rolls=Rolls +Hands=Hands +MachineHigh=Best +EmptyMachineHighScoreName=Best +NotAvailable=N/A + +[PlayMode] +Battle=Battle +Endless=Endless +Nonstop=Nonstop +Oni=Oni +Rave=Rave +Regular=Regular + +[AdjustSync] +%s BPM from %.3f BPM to %.3f BPM.=%s BPM from %.3f BPM to %.3f BPM. +Autosync Machine=Autosync Machine +Autosync Song=Autosync Song +Autosync Tempo=Autosync Tempo +Autosync: Correction NOT applied. Deviation too high.=Autosync: Correction NOT applied. Deviation too high. +Autosync: Correction applied.=Autosync: Correction applied. +Global Offset from %+.3f to %+.3f (notes %s)=Global Offset from %+.3f to %+.3f (notes %s) +Song offset from %+.3f to %+.3f (notes %s)=Song offset from %+.3f to %+.3f (notes %s) +The stop segment #%d changed from %+.3fs to %+.3fs (change of %+.3f).=The stop segment number #%d changed from %+.3fs to %+.3fs (change of %+.3f). +earlier=earlier +later=later +Average Error %.5fs=Average Error %.5fs +Etc.=Etc. +%d taps ignored.=%d taps ignored. + +[ProfileAction] +Clear=Clear +Delete=Delete +Edit=Edit +Rename=Rename +SetDefaultP1=Set P1 +SetDefaultP2=Set P2 + +[RadarCategory] +Air=Air +Chaos=Chaos +Freeze=Freeze +Hands=Hands +Holds=Holds +Jumps=Jumps +Mines=Mines +Rolls=Rolls +Stream=Stream +Taps=Taps +TapsAndHolds=TapsAndHolds +Voltage=Voltage +MinMidiNote=MinMidiNote +MaxMidiNote=MaxMidiNote + +[RageSoundManager] +Couldn't find a sound driver that works=Couldn't find a sound driver that works + +[RageUtil] +NumNd=nd +NumPrefix= +NumRd=rd +NumSt=st +NumTh=th + +[RoomWheel] +Enter room name=Enter room name + +[RoomInfoDisplay] +Last Round Info:=Last Round Info: +Room Name:=Name: +Room Description:=Description: +Song Title:=Title: +Song Subtitle:=Subtitle: +Song Artist:=Artist: +Players=Players + +[SMPackageUtil] +Could not find '%s'.=Could not find '%s'. +[Screen] +HeaderText= +[ScreenAppearanceOptions] +HeaderText=Appearance +HeaderSubText=Customize your game + +[ScreenOptionsGraphicsSound] +HeaderText=Graphics/Sound +HeaderSubText=Get the best performance + +[ScreenOptionsAdvanced] +HeaderText=Advanced Options +HeaderSubText=These settings are for advanced users + +[ScreenBookkeeping] +All-time Coin Total:=All-time Coin Total: +Total Song Plays: %d=Total Song Plays: %d +Coin Data by Day of Week, All-Time=Coin Data by Day of Week, All-Time +Coin Data by Hour of Day, All-Time=Coin Data by Hour of Day, All-Time +Coin Data of Last %d Days=Coin Data of Last %d Days +Coin Data of Last %d Weeks=Coin Data of Last %d Weeks +HeaderText=Bookkeeping + +[ScreenCaution] +Caution=CAUTION! +CautionText=Keep the dance platform a safe distance from your monitor and furniture.\n\nBe careful that you do not injure pets, children, or spectators while dancing. + +[ScreenDebugOverlay] +%s in gameplay=%s in gameplay +Assist=Assist +AutoPlay=AutoPlay +Autosync=Autosync +CPU=CPU +Clear Profile Stats=Clear Profile Scores +CoinMode=CoinMode +Debug Menu=Debug Menu +Fill Profile Stats=Fill Profile Stats +Flush Log=Flush Log +Force Crash=Force Crash +Halt=Halt +Lights Debug=Lights Debug +Machine=Machine +Menu Timer=Menu Timer +Monkey Input=Monkey Input +Multitexture=Multitexture +Profile=Profile +Pull Back Camera=Pull Back Camera +Restart=Restart +Reload=Reload +Reload Theme and Textures=Reload Theme and Textures +Rendering Stats=Rendering Stats +Screen Test Mode=Screen Test Mode +Send Off To Screen=Send Off To Screen +Send On To Screen=Send On To Screen +Send Notes Ended=Send Notes Ended +Show Masks=Show Masks +Slow=Slow +Song=Song +Tempo=Tempo +Uptime=Uptime +Visual Delay Down=Visual Delay Down +Visual Delay Up=Visual Delay Up +Volume Down=Volume Down +Volume Up=Volume Up +Vsync=Vsync +Write Preferences=Write Preferences +Write Profiles=Write Profiles +off=off +on=on +or=or + +[ScreenEdit] +%s notes=%s notes +Can't undo - no undo data.=Can't undo - no undo data. +Do you want to revert from disk?=Do you want to revert from disk? +Do you want to revert to your last save?=Do you want to revert to your last save? +Do you want to save changes before exiting?=Do you want to save changes before exiting? +Enter a new BPM value.=Enter a new BPM value. +Enter a new Stop value.=Enter a new Stop value. +Enter a new Delay value.=Enter a new Delay value. +Enter a new Time Signature numerator value.=Enter the number of beats per measure. +Enter a new Time Signature denominator value.=Enter the note value that represents one beat. +Enter a new Tickcount value.=Enter a new Tickcount value. +Enter a new Combo value.=Enter a new Combo value. +Enter a new artist transliteration.=Enter a new artist transliteration. +Enter a new artist.=Enter a new artist. +Enter a new genre.=Enter a new genre. +Enter a new credit.=Enter a new credit. +Enter a new description.=Enter a new description. +Enter a new chart style.=Enter a new chart style (e.g. "Pad", "Keyboard"). +Enter the author who made this step pattern.=Enter the author who made this step pattern. +Enter a new last beat hint.=Enter a new last beat hint. +Enter a new main title transliteration.=Enter a new main title transliteration. +Enter a new main title.=Enter a new main title. +Enter a new sub title transliteration.=Enter a new sub title transliteration. +Enter a new sub title.=Enter a new sub title. +More than %d notes per measure is not allowed. This change has been reverted.=More than %d notes per measure is not allowed. This change has been reverted. +No backgrounds available=No backgrounds available +EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar:\n Set area\n marker\nEnter:\n Area Menu\nEscape:\n Main Menu\nF1:\n Show help\n +PlayRecordHelpText=Press START to end +Save successful.=Save successful. +Saved as SM and DWI.=Saved as SM and DWI. +Saved as SM.=Saved as SM. +Switched to=Switched to +The change has been reverted.=The change has been reverted. +This change creates more than %d notes in a measure.=This change creates more than %d notes in a measure. +This change creates notes past the end of the music and is not allowed.=This change creates notes past the end of the music and is not allowed. +This will destroy all unsaved changes.=This will destroy all unsaved changes. +Undo=Undo + +Current beat=Current beat +Current second=Current second +Snap to=Snap to +Selection beat=Selection beat +Difficulty=Difficulty +Description=Description +Chart Style=Chart Style +Main title=Main title +Subtitle=Subtitle +Tap Note=Tap Note +Tap Steps=Tap Steps +Jumps=Jumps +Hands=Hands +Holds=Holds +Mines=Mines +Rolls=Rolls +Lifts=Lifts +Fakes=Fakes +Beat 0 offset=Beat 0 offset +Preview Start=Preview Start +Preview Length=Preview Length +Help=Help +Info=Info +Routine Player=Player + +[ScreenEditMenu] +HeaderText=Edit Song/Steps +HeaderSubText=Make your songs perfect +Continue with delete?=Continue with delete? +Enter a description for this edit.=Enter a description for this edit. +ExplanationAction=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationGroup=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationSong=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationSourceSteps=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationSourceStepsType=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationSteps=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +ExplanationStepsType=In this mode, you can edit existing notes patterns, create note patterns, or synchronize notes with the music. +Profile name cannot be blank.=Profile name can not be blank. +The name you chose conflicts with another profile. Please use a different name.=The name you chose conflicts with another profile. Please use a different name. +These steps are produced by autogen. You do not need to delete them.=These steps are produced by autogen. You do not need to delete them. +These steps will be lost permanently.=These steps will be lost permanently. +This song is missing a music file and cannot be edited.=This song is missing a music file and can not be edited. +The song directory is read-only and cannot be edited.=The song directory is read-only and cannot be edited. +Blank=Blank + +[ScreenPracticeMenu] +HeaderText=Practice Songs + +ExplanationGroup=Select the song group. +ExplanationSong=Select the song you wish to practice. +ExplanationAction=Press Start to practice! +ExplanationStepsType=Select the StepsType you want to practice. +ExplanationSteps=Select a notechart. + +[ScreenEvaluation] +HeaderText=Your Results +HeaderSubText=Your dance was so great! +[ScreenEvaluationSummary] +HeaderText=Final Results +[ScreenGameplay] +GiveUpAbortedText=Don't give up! +GiveUpStartText=Continue holding &START; to give up +GiveUpBackText=Continue holding &BACK; to give up + +[ScreenGameplaySyncMachine] +Standard deviation=Standard deviation +New offset=New offset +Old offset=Old offset +Collecting sample=Collecting sample + +[ScreenInstructions] +PlayMode_Regular title=How To Play +PlayMode_Regular instructions=Two things to watch out for when you play are Hold Arrows and Mines. +PlayMode_Nonstop title=Nonstop Mode +PlayMode_Nonstop instructions=Nonstop mode allows you to play a few songs in a row (usually 4, sometimes more) using regular gameplay rules. +PlayMode_Oni title=Challenge Mode +PlayMode_Oni instructions=Challenge mode pushes players to the limit with two available rulesets.\nThe first is Battery Life in which you are limited to four lives. Any step that is lower than a Great or any NG will remove one charge of the battery.\nThe other ruleset is Life Time in which you must race against the clock. +PlayMode_Endless title=Endless Mode +PlayMode_Endless instructions=Endless mode allow you to play a group of songs until you fail or decide to quit. Hope you have a lot of time on your hands... +PlayMode_Rave title=Rave Mode +PlayMode_Rave instructions= +PlayMode_Battle title=Battle Mode +PlayMode_Battle instructions= +Hold instructions=Hold arrows are arrows that you must keep held down. A successfully held down hold arrow will give you an OK while a missed hold arrow will give you an NG. +Mine instructions=Mines are explosive and should be avoided at all costs as they will take life off of your meter. They will trigger if you keep your foot held down as they pass. + +[ScreenLegal] +Warning=Warning +BodyText=The StepMania program source code is licensed under a permissive open-source license.\n\nThe StepMania name and logos are protected by Trademark law.\n\nThe StepMania default theme SOUNDS ARE SEPARATELY OWNED BY THE AUTHORS. ALL OTHER THEME COMPONENTS ARE LICENSED UNDER THE STEPMANIA LICENSE.\n\nSee license.txt for details. + +[ScreenMapControllers] +HeaderText=Map Controllers +InvalidButton=That key can not be mapped. +%s slots=%s slots + +[ScreenNetRoom] +Enter a description for the room:=Enter a description for the room: +Enter a password for the room (blank, no password):=Enter a password for the room (blank, no password): +Enter Room's Password:=Enter Room's Password: +HeaderText=StepMania Online +HeaderSubText=Room Selection +HelpText=Ctrl+ENTER Selects &BACK; Exit &MENULEFT;&MENURIGHT; Move + +[ScreenNetSelectMusic] +HeaderText=Select Music Online +HeaderSubText=Song Selection +HelpText=Ctrl+ENTER Selects &BACK; Exit &MENULEFT;&MENURIGHT; Move::&MENUUP; Player Options &MENUDOWN; Change Difficulty + +[ScreenNetworkOptions] +Disconnected from server.=Disconnected from server. +Enter a network address.=Enter a network address. +Server failed: %s Code:%d=Server failed: %s Code:%d +Use 127.0.0.1 to connect to yourself.=Use 127.0.0.1 to connect to yourself. +Connect=Connect +Disconnect=Disconnect +ScoreOn=On +ScoreOff=Off +HeaderText=Network Options +HeaderSubText=Configure networked gameplay + +[ScreenOptionsEditCourse] +The maximum number of entries per course is %d. This course already has %d entries.=The maximum number of entries per course is %d. This course already has %d entries. +You cannot delete the last entry in a course.=You can not delete the last entry in a course. + +[ScreenOptionsEditCourseEntry] +No songs loaded.=No songs loaded. + +[ScreenOptionsManageCourses] +Continue with delete?=Continue with delete? +Enter a name for the course.=Enter a name for the course. +You have %d, the maximum number allowed.=You have %d, the maximum number allowed. +You must delete an existing before creating a new.=You must delete an existing before creating a new. +Error renaming file.=Error renaming file. +This course will be lost permanently.=This course will be lost permanently. +Error deleting the file '%s'.=Error deleting the file '%s'. +[ScreenOptionsManageEditSteps] +Enter a name for these steps.=Enter a name for these steps. +These steps will be lost permanently.=These steps will be lost permanently. +You have %d step edits, the maximum number allowed.=You have %d step edits, the maximum number allowed. +You must delete an existing steps edit before creating a new steps edit.=You must delete an existing steps edit before creating a new steps edit. +Continue with delete?=Continue with delete? + +[ScreenOptionsCourseOverview] +Error saving course.=Error saving course. +Course saved successfully.=Course saved successfully. +Enter a name for the course.=Enter a name for the course. +Error renaming file.=Error renaming file. +This course will be lost permanently.=This course will be lost permanently. +Continue with delete?=Continue with delete? +Error deleting the file '%s'.=Error deleting the file "%s". + +[NotesWriterSM] +Error renaming file. Destination file '%s' already exists.=Error renaming file. Destination file '%s' already exists. +Error writing file '%s'.=Error writing file '%s'. + +[NotesWriterSSC] +Error renaming file. Destination file '%s' already exists.=Error renaming file. Destination file '%s' already exists. +Error writing file '%s'.=Error writing file '%s'. + +[ScreenOptionsManageProfiles] +Are you sure you want to clear all data in the profile '%s'?=Are you sure you want to clear all data in the profile &oq;%s&cq;? +Are you sure you want to delete the profile '%s'?=Are you sure you want to delete the profile &oq;%s&cq;? +Enter a name for the profile.=Enter a name for the profile. +NewProfileDefaultName=New + +[ScreenOptionsMaster] +Exit=Exit + +[ScreenOptionsMasterPrefs] +Off=Off + +[ScreenOptionsMemoryCard] +Error mounting card: %s=Error mounting card: %s +(no label)=(no label) +size ???=size ??? +%dMB=%dMB + +[ScreenOptionsService] +HeaderText=Options +HeaderSubText=You can configure the game here + +[ScreenPackages] +DL @ %d KB/s=DL @ %d KB/s +Download cancelled.=Download cancelled. +Enter URL=Enter URL +Failed.=Failed. +Failed to connect.=Failed to connect. +File Already Exists=File Already Exists +Header Sent.=Header Sent. +Invalid URL.=Invalid URL. +VisitURL=--Visit URL-- +Waiting for header.=Waiting for header. + +[ScreenPrompt] +OK=OK +No=NO +Yes=YES +Cancel=CANCEL + +[ScreenRanking] + +[ScreenSMOnlineLogin] +Each player needs a unique Profile.=Each player needs a unique Profile. +Enter your password.=Enter your password. +No Styles are selectable.=No Styles are selectable. +You are logging on as:=You are logging on as: +You must define a Profile.=You must define a Profile. +HeaderText=Online Login +HeaderSubText=Select a login profile +Depending on the server you're connected to, you may have to register for an account on their website.=Depending on the server you're connected to, you may have to register for an account on their website. + +[ScreenSaveSync] +Choosing NO will discard your changes.=Choosing NO will discard your changes. +Would you like to save these changes?=Would you like to save these changes? +You have changed the timing of=You have changed the timing of + +[ScreenWithMenuElements] +; Put all help text in this one group and have metrics look up the strings here. That will help make sure +; that strings are in a consistent style and that strings aren't duplicated. +HelpTextNormal=Use &MENULEFT;&MENURIGHT; to select, then press &START; +HelpTextSelectMusic=Use &MENULEFT;&MENURIGHT; to select, then press &START; +HelpTextDifficultyPart=&UP;&UP; easier difficulty &DOWN;&DOWN; harder difficulty +HelpTextOptions=&MENUUP;&MENUDOWN; line &MENULEFT;&MENURIGHT; change &START; choose +HelpTextOptionsAndBack=&MENUUP;&MENUDOWN; line &MENULEFT;&MENURIGHT; change &START; choose &BACK; discard +HelpTextOptionsSimple=&MENUUP;&MENUDOWN; change &START; choose +HelpTextOptionsSimpleAndBack=&MENUUP;&MENUDOWN; line &START; choose &BACK; discard +HelpTextSort=&UP;&DOWN;&UP;&DOWN; to change sort +HelpTextContinue=Press any button or key. Press ESCAPE when done. +HelpTextEvaluation=Press &START; to continue +HelpTextScreenshot=Press &SELECT; to take a screenshot +HelpTextTestInput=Press any button or key. Press ESCAPE when done. +HelpTextTestLights=Press &MENULEFT;&MENURIGHT; to cycle lights. Press ESCAPE when done. +HelpTextTextEntry=Type a value using the keyboard. Press Enter to finish. +HelpTextMapControllers=Use arrow keys to move, ENTER to assign, SPACE to clear::Press ESCAPE when done +HelpTextOnline=smonline.us to connect to official Stepmania Online Server::Check out Stepmaniaonline.com for more information +HelpTextNetSelectMusic=Ctrl + Enter to enter room/select song::&UP; for Player Options +HelpTextBookkeeping=Press &MENULEFT;&MENURIGHT; to cycle data. Press ESCAPE when done. + +[ScreenSelectGame] +HeaderText=Select Game +HeaderSubText=Pick a cool gametype! + +[ScreenSelectGroup] +ALL MUSIC=ALL MUSIC + +[ScreenSelectMusic] +HeaderText=Select Music +HeaderSubText=You will pick a cool song! + +[ScreenSelectCourse] +HeaderText=Select Course + +[ScreenSelectGroup] +HeaderText=Select Group + +[ScreenSelectStyle] +HeaderText=Select Style +HeaderSubText=I can't wait to see your next moves! + +[ScreenSelectPlayMode] +NormalExplanation=CHOOSE YOUR\nFAVORITE SONGS +NonstopExplanation=PLAY SONGS\nBACK-TO-BACK +ChallengeExplanation=DON'T MISS\nMANY STEPS +SurvivalExplanation=BEAT THE CLOCK\nTO WIN +EndlessExplanation=PLAY UNTIL\nYOU DROP +HeaderText=Select Mode +HeaderSubText=Let's get started. I know you can! + +[ScreenServiceAction] +%d added=%d added +%d copied=%d copied +%d overwritten=%d overwritten +%d deleted=%d deleted +%d edits cleared, %d errors.=%d edits cleared, %d errors. +%d failed=%d failed +%d ignored=%d ignored +Bookkeeping data cleared.=Bookkeeping data cleared. +Copied from P%d card:=Copied from P%d card: +Copied to P%d card:=Copied to P%d card: +Edits not cleared - No memory cards ready.=Edits not cleared - No memory cards ready. +Edits not copied - No memory cards ready.=Edits not copied - No memory cards ready. +Error saving machine stats to P%d card.=Error saving machine stats to P%d card. +Machine stats cleared.=Machine stats cleared. +Machine stats loaded from P%d card.=Machine stats loaded from P%d card. +Machine stats saved to P%d card.=Machine stats saved to P%d card. +Preferences reset.=Preferences reset. +Stats not loaded - No memory cards ready.=Stats not loaded - No memory cards ready. +Stats not saved - No memory cards ready.=Stats not saved - No memory cards ready. +The profile on P%d card contains corrupt or tampered data.=The profile on P%d card contains corrupt or tampered data. +There is no machine profile on P%d card.=There is no machine profile on P%d card. + +[ScreenSyncOverlay] +AutoPlay=AutoPlay +AutoPlayCPU=AutoPlayCPU +AutoSync Machine=AutoSync Machine +AutoSync Song=AutoSync Song +AutoSync Tempo=AutoSync Tempo +Can't sync while playing a course.=Can't sync while playing a course. +Sync changes reverted.=Sync changes reverted. +Revert sync changes=Revert sync changes +Current BPM - smaller/larger=Current BPM - smaller/larger +Song offset - notes earlier/later=Song offset - notes earlier/later +Machine offset - notes earlier/later=Machine offset - notes earlier/later +(hold Alt for smaller increment)=(hold Alt for smaller increment) +Old offset=Old offset +New offset=New offset +Collecting sample=Collecting sample +Standard deviation=Standard deviation + +[ScreenSystemLayer] +CreditsCardChanged=CARD SWITCHED +CreditsCardChecking=CARD CHECK +CreditsCardMountFailed=CARD MOUNT ERROR +CreditsCardNoName=NoName +CreditsCardReady=READY +CreditsCardRemoved=CARD GONE +CreditsCardTestFailed=CARD WRITE ERROR +CreditsCardTooLate=CARD TOO LATE +CreditsCredits=CREDIT(S) +CreditsMax=(MAX) +CreditsFreePlay=FREE PLAY +CreditsInsertCard=INSERT CARD +CreditsLoadFailed=SIGNATURE FAILED +CreditsLoadedFromLastGoodAppend= (backup) +CreditsNotPresent=NOT PRESENT +CreditsPressStart=PRESS START + +[ScreenTestFonts] +# W is annoying: +Text1=WWWWWWWWWWWW +# Realistic excerpt: +Text2=The argument goes something like this: &oq;I refuse to prove that I exist,&cq; says God, &oq;for proof denies faith, and without faith I am nothing.&cq;::::&oq;But,&cq; says Man, &oq;The Babel fish is a dead giveaway, isn't it? It could not have evolved by chance. It proves you exist, and so therefore, by your own arguments, you don't. QED.&cq;::::&oq;Oh dear,&cq; says God, &oq;I hadn't thought of that,&cq; and promptly vanished in a puff of logic. +# Numbers test: +Text3=01234567890 ::100.00% 12345% 9:00 50/100 +# General symbol test, and test alignment against another font. +Text4=$50% (Test) "test's" &oq;test's&cq;, #1! 1+2-3*4/5.6::3:00 a; b; 5<6 6>5 2^3=8 Why? test@example.com::[Foo] {bar} Press &START; 3|4 &oq;1_2_3&cq; +Text5= + +[ScreenTestInput] +Controller=Controller +not mapped=not mapped +secondary=secondary + +[ScreenTestLights] +Auto Cycle=Auto Cycle +Manual Cycle=Manual Cycle +cabinet light=cabinet light +controller light=controller light + +[ScreenTextEntry] +Backspace=Backsp +Cancel=Cancel +Done=Done +HeaderText= +Space=Space +"%s" is an invalid floating point value.="%s" is an invalid floating point value. +AnswerCaret=_ +AnswerBlank= + +[ScreenTitleMenu] +%d songs in %d groups=%d songs in %d groups +%d courses in %d groups=%d courses in %d groups +%d unlocks=%d unlocks +Gametype:=Gametype: +Difficulty:=Difficulty: +Announcer=Announcer +Play Online=Network Play +Edit/Share=Edit/Share +Exit=Exit +Game Start=Game Start +Jukebox=Jukebox +Select Game=Select Game +Theme=Theme +Credits=Credits +Options=Options +Setup=Quick Setup + +[SmpackageExportDlg] +Error adding file '%s'.=Error adding file '%s'. + +[SongManager] +Loading courses...=Loading courses... +Loading songs...=Loading songs... +Reloading...=Reloading... +The folder "%s" appears to be a song folder. All song folders must reside in a group folder. For example, "Songs/Originals/My Song".=The folder "%s" appears to be a song folder. All song folders must reside in a group folder. For example, "Songs/Originals/My Song" will contain the music file (MP3, OGG...), the steps file (.sm, .dwi, .ksf...) and other related files. + +[SongUtil] +You must supply a name for your new edit.=You must supply a name for your new edit. +The name you chose conflicts with another edit. Please use a different name.=The name you chose conflicts with another edit. Please use a different name. +The edit name cannot contain any of the following characters: %s=The edit name can not contain any of the following characters: %s +The step author's name cannot contain any of the following characters: %s=The step author's name cannot contain any of the following characters: %s + +[SongSort] +FewestPlays=Fewest Plays +LowestGrades=Lowest Grades +MostPlays=Most Plays +Randomize=Randomize +TopGrades=Top Grades + +[Sort] +NotAvailable=N/A +Other=Other + +[SortOrder] +AllCourses=All Courses +Artist=Artist +BPM=BPM +Endless=Endless +Genre=Genre +Group=Group +ModeMenu=Mode Menu +Nonstop=Nonstop +Oni=Oni +Popularity=Players' Best +Preferred=Preferred +Title=Title +TopGrades=Top Grades +Roulette=Roulette +Length=Length +Recent=Recently Played +BeginnerMeter=Beginner Meter +EasyMeter=Easy Meter +MediumMeter=Medium Meter +HardMeter=Hard Meter +ChallengeMeter=Challenge Meter +DoubleEasyMeter=Double Easy Meter +DoubleMediumMeter=Double Medium Meter +DoubleHardMeter=Double Hard Meter +DoubleChallengeMeter=Double Challenge Meter + +[StepMania] +Announcer=Announcer +Couldn't open any loading windows.=Couldn't open any loading windows. +Fullscreen=Fullscreen +Initializing %s...=Initializing %s... +No video renderers attempted.=No video renderers attempted. +NoSmoothLines=NoSmoothLines +NoVsync=NoVsync +Please do not file this error as a bug! Use the web page below to troubleshoot this problem.=Please do not file this error as a bug! Use the web page below to troubleshoot this problem. +Service switch pressed=Service switch pressed +SmoothLines=SmoothLines +There was an error while initializing your video card.=There was an error while initializing your video card. +Unknown video renderer value: %s=Unknown video renderer value: %s +Video Driver: %s=Video Driver: %s +Vsync=Vsync +Windowed=Windowed +color=color +texture=texture + +[StepsType] +dance-couple=couple +dance-double=double +dance-single=single +dance-solo=solo +dance-threepanel=3panel +dance-routine=routine +lights-cabinet=Lights +# SSC +Dance_Single=Single +Dance_Double=Double +Dance_Threepanel=3 Panels + +[TapNoteScore] +AvoidMine=Avoid Mine +HitMine=Hit Mine +Miss=Miss +CheckpointMiss=Missed Hold Checkpoint +CheckpointHit=Hit Hold Checkpoint +None=None +W1=Flawless +W2=Perfect +W3=Great +W4=Good +W5=Boo + +[ThemeManager] +Reloaded metrics=Reloaded metrics +Reloaded metrics and textures=Reloaded metrics and textures +Reloaded scripts=Reloaded scripts +Reloaded overlay screens=Reloaded overlay screens + +[WorkoutManager] +You must supply a name for your workout.=You must supply a name for your workout. +The name you chose conflicts with another workout. Please use a different name.=The name you chose conflicts with another workout. Please use a different name. +The workout name cannot contain any of the following characters: %s=The workout name cannot contain any of the following characters: %s +%d/%d songs enabled=%d/%d songs enabled + +[Dialog-Add A Comment] +Add A Comment=Add A Comment +Cancel=Cancel +OK=OK +Package Comment=Package Comment +You can add a message to display before a user installs your package.=You can add a message to display before a user installs your package. +Show a comment=Show a comment +Don't display this dialog in the future=Don't display this dialog in the future + +[Dialog-Change Game Settings] +Cancel=Cancel +Change Game Settings=Change Game Settings +Default (recommended)=Default (recommended) +Direct3D=Direct3D +DirectSound Hardware=DirectSound Hardware +DirectSound Software=DirectSound Software +Graphics API=Graphics API +Log to Disk=Log to Disk +Other=Other +Force 60Hz Refresh=Force 60Hz Refresh +Null (no sound)=Null (no sound) +OK=OK +OpenGL=OpenGL +Show Log Window=Show Log Window +Sound API=Sound API +Tip: Change these only if you experience problems when using the default settings.=Tip: Change these only if you experience problems when using the default settings. +WaveOut=WaveOut + +[Dialog-Create Language] +Cancel=Cancel +Choose a language=Choose a language +Create Language=Create Language +OK=OK + +[Dialog-Edit Installations] +Add=Add +Add New Installation=Add New Installation +Cancel=Cancel +Current Installations=Current Installations +Current Installations (the top installation is the default)=Current Installations (the top installation is the default) +Edit Installations=Edit Installations +Enter the complete path to a StepMania or DWI installation\ne.g. "C:\Program Files\StepMania"=Enter the complete path to a StepMania or DWI installation\ne.g. "C:\Program Files\StepMania" +Make Default=Make Default +OK=OK +Remove=Remove +The top installation is the default.=The top installation is the default. + +[Dialog-Export Packages] +Close=Close +Edit Installations=Edit Installations +Export As Individual=Export As Individual +Export As One=Export As One +Export Packages=Export Packages +Installation=Installation +Launch Game=Launch Game +Open Program Folder=Open Program Folder +Select Installation:=Select Installation: +Tree2=Tree2 + +[Dialog-Language Translations] +1) Create a new language\n2) Export the theme strings to a CSV\n3) Edit the CSV using Excel or a text editor\n4) Import the CSV file back into the same language=1) Create a new language\n2) Export the theme strings to a CSV\n3) Edit the CSV using Excel or a text editor\n4) Import the CSV file back into the same language +Check Language=Check Language +Close=Close +Create Language=Create Language +Delete Language=Delete Language +Export CSV=Export CSV +Export already translated strings=Export already translated strings +Import CSV=Import CSV +Language Translations=Language Translations +Languages=Languages +Need translation:=Need translation: +Selection details=Selection details +Themes=Themes +Total Strings:=Total Strings: + +[Dialog-StepMania Tools] +Close=Close +Export As Individual=Export As Individual +Export As One=Export As One +Export Packages=Export Packages +Launch Game=Launch Game +Open Program Folder=Open Program Folder +Select Installation:=Select Installation: +StepMania Tools=StepMania Tools +Tree2=Tree2 + +[Dialog-StepMania Tools Main Menu] +Change Preferences=Change Preferences +Change the graphics API, sound API, and other settings that the game will use.=Change the graphics API, sound API, and other settings that the game will use. +Clear Mappings=Clear Mappings +Clear Preferences=Clear Preferences +Clear all preferences if you've made changes and the game won't start.=Clear all preferences if you've made changes and the game won't start. +Create .smzip package files to share with other users.=Create .smzip package files to share with other users. +Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more.=Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more. +Create Song=Create Song +Create a new or manage existing language translations.=Create a new or manage existing language translations. +Create a new song in from your favorite mp3 or ogg music file.=Create a new song in from your favorite mp3 or ogg music file. +Create and Share=Create and Share +Edit Installations=Edit Installations +Erase all of your keyboard and joystick mappings if you've made a mistake.=Erase all of your keyboard and joystick mappings if you've made a mistake. +Exit=Exit +Export Packages=Export Packages +Installation=Installation +Languages=Languages +Launch Game=Launch Game +Open Preferences=Open Preferences +Open the preferences file to make changes by hand.=Open the preferences file to make changes by hand. +StepMania Tools Main Menu=StepMania Tools Main Menu +Troubleshooting=Troubleshooting + +[ChangeGameSettings] +Error writing file '%s': %s=Error writing file '%s': %s + +[Dialog-Name Your Package] +Name Your Package=Name Your Package +Enter a name for your new package:=Enter a name for your new package: +OK=OK +Cancel=Cancel +Note: leave off the ".smzip" extention=Note: leave off the ".smzip" extention + +[Dialog-Install a package] +Finish >=Finish > +Cancel=Cancel +< Back=< Back +Install a package=Install a package +Edit Installations=Edit Installations +You have chosen to install the package:=You have chosen to install the package: +This package contains the following files:=This package contains the following files: +The package will be installed in the following program folder:=The package will be installed in the following program folder: + +[PlayerNumber] +P1=P1 +P2=P2 + +[UnlockRewardType] +Song=Song +Steps=Steps +Course=Course +Modifier=Modifier + +[RageDisplay_OGL] +Obtain an updated driver from your video card manufacturer.=Obtain an updated driver from your video card manufacturer. +GLDirect was detected. GLDirect is not compatible with this game and should be disabled.=GLDirect was detected. GLDirect is not compatible with this game and should be disabled. + +[RageDisplay_D3D] +DirectX 8.1 or greater is not installed. You can download it from:=DirectX 8.1 or greater is not installed. You can download it from: +Your system is reporting that Direct3D hardware acceleration is not available. Please obtain an updated driver from your video card manufacturer.=Your system is reporting that Direct3D hardware acceleration is not available. Please obtain an updated driver from your video card manufacturer. + +[RageDisplay] +SetVideoMode failed:=SetVideoMode failed: + +[Dialog-Prompt] +Prompt=Prompt +OK=OK +&Don't display this message again=&Don't display this message again +Error=Error + +[Dialog-Uninstall Old Packages] +Uninstall Old Packages=Uninstall Old Packages +&Yes=&Yes +&No=&No +Cancel=Cancel +The following packages are already installed. It is strongly recommended that they be deleted before installing this package.=The following packages are already installed. It is strongly recommended that they be deleted before installing this package. +Delete old packages?=Delete old packages? + +[DeviceButton] +Home=Home +End=End +Up=Up +Down=Down +Space=Space +Shift=Shift +Ctrl=Ctrl +Alt=Alt +Insert=Insert +Delete=Delete +PgUp=PgUp +PgDn=PgDn +Backslash=Backslash + +[EditHelpDescription] +Move cursor=Move cursor +Jump measure=Jump measure +Select region=Select region +Jump to first/last beat=Jump to first/last beat +Change zoom=Change zoom +Play=Play +Play current beat to end=Play current beat to end +Play whole song=Play whole song +Record=Record +Set selection=Set selection +Toggle assist tick=Toggle assist tick +Next/prev steps of same StepsType=Next/prev steps of same StepsType +Decrease/increase BPM at cur beat=Decrease/increase BPM at cur beat +Decrease/increase stop at cur beat=Decrease/increase stop at cur beat +Decrease/increase music offset=Decrease/increase music offset +Decrease/increase sample music start=Decrease/increase sample music start +Decrease/increase sample music length=Decrease/increase sample music length +Play sample music=Play sample music +Add/Edit Background Change=Add/Edit Background Change +Insert beat and shift down=Insert beat and shift down +Shift BPM changes and stops down one beat=Shift BPM changes and stops down one beat +Delete beat and shift up=Delete beat and shift up +Shift BPM changes and stops up one beat=Shift BPM changes and stops up one beat +Cycle between tap notes=Cycle between tap notes +Lay mine=Lay mine +Lay lift=Lay lift +Add to/remove from right half=Add to/remove from right half +Switch player (Routine only)=Switch player (Routine only) + +[Grade] +Tier01=AAAA +Tier02=AAA +Tier03=AA +Tier04=A +Tier05=B +Tier06=C +Tier07=D +Tier08=D +Failed=F +None= + +[ScreenOptionsEditCourse] +-Empty-=-Empty- +Song=Song +Steps=Steps +minutes=minutes +You must enable at least %d songs.=You must enable at least %d songs. + +[LowLevelWindow_Win32] +OpenGL hardware acceleration is not available.=OpenGL hardware acceleration is not available. + +[Premium] +Off=Off +DoubleFor1Credit=Double For 1 Credit +2PlayersFor1Credit=2 Players For 1 Credit + +[Stage] +1st=1st +2nd=2nd +3rd=3rd +4th=4th +5th=5th +6th=6th +Next=Next +Final=Final +Extra1=Extra +Extra2=Another +Nonstop=Nonstop +Oni=Oni +Endless=Endless +Event=Event +Demo=Demo + +[JudgmentLine] +W1=Flawless +W2=Perfect +W3=Great +W4=Good +W5=Boo +Held=Held +MaxCombo=Max Combo +Miss=Miss + +[NativeLanguageNames] +Afar=Afar +Abkhazian=аҧсуа бызшәа +Afrikaans=Afrikaans +Amharic=Amharic +Arabic=العربية +Assamese=Assamese +Aymara=Aymara +Azerbaijani=azərbaycan +Bashkir=Bashkir +Byelorussian=Беларуская +Bulgarian=Български +Bihari=Bihari +Bislama=Bislama +Bengali=Bengali +Tibetan=Tibetan +Breton=Breton +Catalan=Català +Corsican=Corsican +Czech=čeština +Welsh=Cymraeg +Danish=Dansk +German=Deutsch +Bhutani=Bhutani +Greek=Ελληνικά +English=English +Esperanto=Esperanto +Spanish=Español +Estonian=Eesti +Basque=euskera +Persian=فارسی +Finnish=Suomi +Fiji=Fiji +Faeroese=Faeroese +French=Français +Frisian=Frisian +Irish=Gaeilge +Gaelic=Gaelic +Galician=Galego +Guarani=Guarani +Gujarati=Gujarati +Hausa=Hausa +Hebrew=עברית +Hindi=हिंदी +Croatian=Hrvatski +Hungarian=Magyar +Armenian=Հայերեն +Interlingua=Interlingua +Indonesian=Bahasa indonesia +Interlingue=Interlingue +Inupiak=Inupiak +Indonesian=Bahasa indonesia +Icelandic=Íslenska +Italian=Italiano +Hebrew=עברית +Japanese=日本語 +Yiddish=Yiddish +Javanese=Javanese +Georgian=Georgian +Kazakh=Қазақ +Greenlandic=Greenlandic +Cambodian=Cambodian +Kannada=ಕನ್ನಡ +Korean=한국어 +Kashmiri=Kashmiri +Kurdish=Kurdish +Kirghiz=Кыргыз +Latin=Latin +Lingala=Lingala +Laothian=Laothian +Lithuanian=Lietuviškai +Latvian=Latviešu +Malagasy=Malagasy +Maori=Maori +Macedonian=Македонски +Malayalam=Malayalam +Mongolian=Mongolian +Moldavian=Moldavian +Marathi=Marathi +Malay=Bahasa melayu +Maltese=Malti +Burmese=Burmese +Nauru=Nauru +Nepali=Nepali +Dutch=Nederlands +Norwegian=Norsk +Occitan=Occitan +Oromo=Oromo +Oriya=Oriya +Punjabi=Punjabi +Polish=Polski +Pashto=پښتو +Portuguese=português +Quechua=Quechua +Rhaeto-Romance=Rhaeto-Romance +Kirundi=Kirundi +Romanian=Română +Russian=Pyccĸий +Kinyarwanda=Kinyarwanda +Sanskrit=Sanskrit +Sindhi=Sindhi +Sangro=Sangro +Serbo-Croatian=Serbo-Croatian +Singhalese=Singhalese +Slovak=Slovenčina +Slovenian=Slovenščina +Samoan=Samoan +Shona=Shona +Somali=Somali +Albanian=Shqip +Serbian=Srpski +Siswati=Siswati +Sesotho=Sesotho +Sudanese=Sudanese +Swedish=svenska +Swahili=Kiswahili +Tamil=Tamil +Tegulu=తెలుగు +Tajik=Tajik +Thai=ภาษาไทย +Tigrinya=Tigrinya +Turkmen=Turkmen +Tagalog=Tagalog +Setswana=Setswana +Tonga=Tonga +Turkish=Tϋrkçe +Tsonga=Tsonga +Tatar=Tatar +Twi=Twi +Ukrainian=Українська +Urdu=اردو +Uzbek=o'zbek +Vietnamese=Tiếng Việt +Volapuk=Volapuk +Wolof=Wolof +Xhosa=isiXhosa +Yiddish=Yiddish +Yoruba=Yorùbá +Chinese=中文 +Zulu=isiZulu + +[ScreenPlayerOptions] +HeaderText=Select Modifiers +HeaderSubText=Challenge yourself to achieve the ultimate skill! + +[ScreenSongOptions] +HeaderText=Song Modifiers +HeaderSubText=You picked a great song. Now let's dance! + +[StageAward] +FullComboW3=Full Combo! +SingleDigitW3=Single Digit Greats! +OneW3=One Great! +FullComboW2=Full Perfect Combo!! +SingleDigitW2=Single Digit Perfects!! +OneW2=One Perfect!! +FullComboW1=Full Fantastic Combo!!! +80PercentW3=80% Greats! +90PercentW3=90% Greats!! +100PercentW3=100% Greats!!! + +[PeakComboAward] +1000=1000 Peak Combo! +2000=2000 Peak Combo! +3000=3000 Peak Combo! +4000=4000 Peak Combo! +5000=5000 Peak Combo!! +6000=6000 Peak Combo!! +7000=7000 Peak Combo!! +8000=8000 Peak Combo!! +9000=9000 Peak Combo!! +10000=10000 Peak Combo!!! + +[ScreenOptionsExportPackage] +HeaderText=Export Package +HeaderSubText=Share your creation with people + +[ScreenOptionsEdit] +HeaderText=Edit/Share +HeaderSubText=Show your creativity + +[ScreenMiniMenuEditHelp] +HeaderText=Edit Help + +[ScreenMiniMenuMainMenu] +HeaderText=Main Menu + +[ScreenMiniMenuAreaMenu] +HeaderText=Area Menu + +[ScreenMiniMenuStepsInformation] +HeaderText=Steps Information + +[ScreenMiniMenuSongInformation] +HeaderText=Song Information + +[ScreenMiniMenuBackgroundChange] +HeaderText=Background Change + +[ScreenMiniMenuInsertTapAttack] +HeaderText=Insert Tap Attack + +[ScreenMiniMenuInsertCourseAttack] +HeaderText=Insert Course Attack + +[ScreenMiniMenuCourseDisplay] +HeaderText=Course Display + +[CourseUtil] +You must supply a name for your course.=You must supply a name for your course. +The course name cannot contain any of the following characters: %s=The course name cannot contain any of the following characters: %s +The name you chose conflicts with another course. Please use a different name.=The name you chose conflicts with another course. Please use a different name. +[ScreenProfileSave] +HeaderText= +[ScreenTestInput] +HeaderText=Test Input +[ScreenMiniMenuContext] +HeaderText=! +[ScreenOptionsManageProfiles] +HeaderText=Profiles +[ScreenOptionsSystemDirection] +HeaderText=System Direction +[ScreenOptionsUI] +HeaderText=UI +[ScreenOptionsArcade] +HeaderText=Arcade +[ScreenOptionsInput] +HeaderText=Input +[ScreenOptionsTheme] +HeaderText=Theme Options +[ScreenOptionsManageCourses] +HeaderText=Courses +[ScreenEditOptions] +HeaderText= +[ScreenOptionsEditCourse] +HeaderText=Edit Course +HelpText=&MENUUP;&MENUDOWN; Move &MENULEFT;&MENURIGHT; Change Value +[ScreenOptionsCourseOverview] +HeaderText=Course Overview +[ScreenQuickSetupOverview] +HeaderText=Quick Setup - Welcome! +[ScreenQuickSetupPhaseOne] +HeaderText=Quick Setup - Page 1: Profile +[ScreenQuickSetupPhaseTwo] +HeaderText=Quick Setup - Page 2: Gameplay +[ScreenQuickSetupPhaseThree] +HeaderText=Quick Setup - Page 3: Appearance +[ScreenQuickSetupPhaseFour] +HeaderText=Quick Setup - Page 4: Extra +[ScreenQuickSetupFinished] +HeaderText=Quick Setup - Finished! +[ScreenSelectProfile] +HeaderText=Select Profile +[ScreenSelectPlayStyle] +HeaderText=Select Style +[ScreenGameInformation] +HeaderText=Info +[StepsDisplay StepsType] +Dance_Single=Single +Dance_Double=Double +Dance_Couple=Couple +Dance_Solo=Solo +Dance_Routine=Routine +Dance_Threepanel=3 Panels +Pump_Single=Single +Pump_Double=Double +Pump_Halfdouble=Half-Double +Pump_Couple=Couple +Pump_Routine=Routine +Kb7_Single=KB7 +Ez2_Single=Single +Ez2_Double=Double +Ez2_Real=Real +Para_Single=Single +Ds3ddx_Single=Single +Bm_Single5=5 Keys +Bm_Double5=10 Keys +Bm_Single7=7 Keys +Bm_Double7=14 Keys +Maniax_Single=Single +Maniax_Double=Double +Techno_Single4=Single 4 +Techno_Single5=Single 5 +Techno_Single8=Single 8 +Techno_Double4=Double 4 +Techno_Double5=Double 5 +Pnm_Five=5 Button +Pnm_Nine=9 Button +Guitar_Five=5 Frets +Karaoke=Karaoke +Lights_Cabinet=Lights +[StepsListDisplayRow StepsType] +Dance_Single=Single +Dance_Double=Double +Dance_Couple=Couple +Dance_Solo=Solo +Dance_Routine=Routine +Dance_Threepanel=3panel +Pump_Single=Single +Pump_Double=Double +Pump_Halfdouble=Half-Double +Pump_Couple=Couple +Pump_Routine=Routine +Kb7_Single=KB7 +Ez2_Single=Single +Ez2_Double=Double +Ez2_Real=Real +Para_Single=Single +Ds3ddx_Single=Single +Bm_Single5=5 Keys +Bm_Double5=10 Keys +Bm_Single7=7 Keys +Bm_Double7=14 Keys +Maniax_Single=Single +Maniax_Double=Double +Techno_Single4=Single 4 +Techno_Single5=Single 5 +Techno_Single8=Single 8 +Techno_Double4=Double 4 +Techno_Double5=Double 5 +Pnm_Five=5 Button +Pnm_Nine=9 Button +Guitar_Five=5 Frets +Karaoke=Karaoke +Lights_Cabinet=Lights + +[ScreenHowToInstallSongs] +HeaderText=Installing Songs + +[ThemePrefs] +IniFileMissing=IniFile missing. Can't read or write from disk :( +UnknownPreference=Unknown preference "%s" + +[ThemePrefsRows] +ChoicesSizeMismatch=Choices and Values have different sizes (%d, %d) +NoDefaultInValues=Preference "%s" has no values matching default +TypeMismatch=Type mismatch between default (%s) and value %d (%s) diff --git a/Themes/_fallback/Other/Profile Catalog.xsl b/Themes/_fallback/Other/Profile Catalog.xsl index 52aafed04f..8ba3b5d540 100644 --- a/Themes/_fallback/Other/Profile Catalog.xsl +++ b/Themes/_fallback/Other/Profile Catalog.xsl @@ -1,105 +1,105 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - -<xsl:import href="Common.xsl"/> - - - <!-- Main Template --> - - <xsl:template match="/Catalog"> - <xsl:call-template name="MainTemplate"> - <xsl:with-param name="FullHeader" select="0" /> - <xsl:with-param name="DocName" select="name()" /> - <xsl:with-param name="Content"> - <xsl:apply-templates select="/Catalog/Totals" /> - <xsl:apply-templates select="/Catalog/Songs" /> - <xsl:apply-templates select="/Catalog/Courses" /> - </xsl:with-param> - </xsl:call-template> - </xsl:template> - - - - <!-- Totals --> - - <xsl:template match="/Catalog/Totals"> - <xsl:call-template name="CollapsibleTopSection"> - <xsl:with-param name="title"> - Totals - </xsl:with-param> - <xsl:with-param name="text"> - - <table class="EntityTableAttr"> - <xsl:call-template name="DataTableGenerator"> - <xsl:with-param name="cols" select="2" /> - <xsl:with-param name="nodeset" select="*[text()]" /> - </xsl:call-template> - </table> - - </xsl:with-param> - </xsl:call-template> - - </xsl:template> - - - - <!-- TopScores for SongScores and CourseScores --> - - <xsl:template match="/Catalog/Songs | /Catalog/Courses"> - <xsl:variable name="Type" select="name()" /> - <xsl:variable name="SubType"> - <xsl:if test="$Type='Song'">Steps</xsl:if> - <xsl:if test="$Type='Course'">Trail</xsl:if> - </xsl:variable> - <xsl:call-template name="CollapsibleTopSection"> - <xsl:with-param name="title"> - <xsl:value-of select="$Type" /> - </xsl:with-param> - <xsl:with-param name="text"> - <xsl:apply-templates select="Song | Course" /> - </xsl:with-param> - </xsl:call-template> - </xsl:template> - - <xsl:template match="Song | Course"> - <xsl:variable name="Dir" select="@Dir" /> - <xsl:variable name="Path" select="@Path" /> - <xsl:variable name="MainTitle" select="/Catalog/*/*[@Dir=$Dir or @Path=$Path]/MainTitle" /> - <xsl:variable name="SubTitle" select="/Catalog/*/*[@Dir=$Dir or @Path=$Path]/SubTitle" /> - <xsl:call-template name="CollapsibleSubSection"> - <xsl:with-param name="title"> - <xsl:apply-templates select="@Dir | @Path" /> - </xsl:with-param> - <xsl:with-param name="text"> - <xsl:apply-templates select="Steps | Trail" /> - </xsl:with-param> - </xsl:call-template> - </xsl:template> - - <xsl:template match="Steps | Trail"> - <xsl:call-template name="SubSectionCompact"> - <xsl:with-param name="title"> - <xsl:apply-templates select="." mode="AttributeTitleGenerator" /> - </xsl:with-param> - <xsl:with-param name="text"> - - <table class="EntityTableAttr"> - <xsl:call-template name="DataTableGenerator"> - <xsl:with-param name="cols" select="1" /> - <xsl:with-param name="nodeset" select="*[text()] | ./*/*[text()]" /> - </xsl:call-template> - </table> - - </xsl:with-param> - </xsl:call-template> - </xsl:template> - - - <!-- Main Categories End - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - - - <!-- That's it --> - -</xsl:stylesheet> - +<?xml version="1.0" encoding="UTF-8" ?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:import href="Common.xsl"/> + + + <!-- Main Template --> + + <xsl:template match="/Catalog"> + <xsl:call-template name="MainTemplate"> + <xsl:with-param name="FullHeader" select="0" /> + <xsl:with-param name="DocName" select="name()" /> + <xsl:with-param name="Content"> + <xsl:apply-templates select="/Catalog/Totals" /> + <xsl:apply-templates select="/Catalog/Songs" /> + <xsl:apply-templates select="/Catalog/Courses" /> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + + + <!-- Totals --> + + <xsl:template match="/Catalog/Totals"> + <xsl:call-template name="CollapsibleTopSection"> + <xsl:with-param name="title"> + Totals + </xsl:with-param> + <xsl:with-param name="text"> + + <table class="EntityTableAttr"> + <xsl:call-template name="DataTableGenerator"> + <xsl:with-param name="cols" select="2" /> + <xsl:with-param name="nodeset" select="*[text()]" /> + </xsl:call-template> + </table> + + </xsl:with-param> + </xsl:call-template> + + </xsl:template> + + + + <!-- TopScores for SongScores and CourseScores --> + + <xsl:template match="/Catalog/Songs | /Catalog/Courses"> + <xsl:variable name="Type" select="name()" /> + <xsl:variable name="SubType"> + <xsl:if test="$Type='Song'">Steps</xsl:if> + <xsl:if test="$Type='Course'">Trail</xsl:if> + </xsl:variable> + <xsl:call-template name="CollapsibleTopSection"> + <xsl:with-param name="title"> + <xsl:value-of select="$Type" /> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:apply-templates select="Song | Course" /> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="Song | Course"> + <xsl:variable name="Dir" select="@Dir" /> + <xsl:variable name="Path" select="@Path" /> + <xsl:variable name="MainTitle" select="/Catalog/*/*[@Dir=$Dir or @Path=$Path]/MainTitle" /> + <xsl:variable name="SubTitle" select="/Catalog/*/*[@Dir=$Dir or @Path=$Path]/SubTitle" /> + <xsl:call-template name="CollapsibleSubSection"> + <xsl:with-param name="title"> + <xsl:apply-templates select="@Dir | @Path" /> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:apply-templates select="Steps | Trail" /> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="Steps | Trail"> + <xsl:call-template name="SubSectionCompact"> + <xsl:with-param name="title"> + <xsl:apply-templates select="." mode="AttributeTitleGenerator" /> + </xsl:with-param> + <xsl:with-param name="text"> + + <table class="EntityTableAttr"> + <xsl:call-template name="DataTableGenerator"> + <xsl:with-param name="cols" select="1" /> + <xsl:with-param name="nodeset" select="*[text()] | ./*/*[text()]" /> + </xsl:call-template> + </table> + + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + + <!-- Main Categories End - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + + + <!-- That's it --> + +</xsl:stylesheet> + diff --git a/Themes/_fallback/Other/Profile Common.xsl b/Themes/_fallback/Other/Profile Common.xsl index 273753d6a0..e7be81657b 100644 --- a/Themes/_fallback/Other/Profile Common.xsl +++ b/Themes/_fallback/Other/Profile Common.xsl @@ -1,831 +1,831 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - <!-- Global Definitions --> - - <xsl:output method="html" omit-xml-declaration="no" encoding="iso-8859-1" indent="no"/> - - <xsl:strip-space elements="*" /> - - <xsl:attribute-set name="ToggleLinkAttr"> - <xsl:attribute name="onClick">JavaScript: toggleLinkClicked(event);</xsl:attribute> - <xsl:attribute name="onSelectStart">JavaScript: return false;</xsl:attribute> - <xsl:attribute name="onMouseOver">JavaScript: toggleLinkOnMouseOver(event);</xsl:attribute> - <xsl:attribute name="onMouseOut">JavaScript: toggleLinkOnMouseOut(event);</xsl:attribute> - <xsl:attribute name="style">cursor: hand;</xsl:attribute> - </xsl:attribute-set> - - - - - - <!-- Global Variables --> - <xsl:variable name="Catalog" select="document('Catalog.xml')/Catalog" /> - - - - - - <!-- Main Template --> - - <xsl:template name="MainTemplate"> - <xsl:param name="FullHeader" /> - <xsl:param name="DocName" /> - <xsl:param name="Content" /> - <html> - <head> - <title><xsl:value-of select="$Catalog/ProductTitle" /><xsl:text> </xsl:text><xsl:value-of select="$DocName" /> - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - -
- - - - - - - button - Internet Ranking - navButton - JavaScript: window.location = ''; - - - - - - button - Upload Stats - navButton - JavaScript: window.location = '&stats_xml=' + window.location; - - - - - Machine: - - - Name: - -
- Last Played: -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - : - - - - - - - - - - - - true - - - false - - - - - - - - Guid= - - - _new - - - - - - - - - - - - - - - - - - - - valuename - - nowrap - - - -   - - dyndata - - nowrap - - - -     - - - - - - - - - - -
-
- - - - - - - - - - valuename - - - - - dyndata - - - -
  
- -
- - - - - - - -
- - -
-
-
- - - - - - - - - valuename - - -    - - - valuename - - - -    - - dyndata - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - -
- -
-
-
-
- - - - - - - - - main - - - - - - - -
- -
-
- - - - - - - - main - - - - - - -
- -
-
- - - - - - - - main - - - - - - - -
- -
-
- - - - - - - - - - - - - - - + + + + + + + + + + + + JavaScript: toggleLinkClicked(event); + JavaScript: return false; + JavaScript: toggleLinkOnMouseOver(event); + JavaScript: toggleLinkOnMouseOut(event); + cursor: hand; + + + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="$Catalog/ProductTitle" /><xsl:text> </xsl:text><xsl:value-of select="$DocName" /> + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + +
+ + + + + + + button + Internet Ranking + navButton + JavaScript: window.location = ''; + + + + + + button + Upload Stats + navButton + JavaScript: window.location = '&stats_xml=' + window.location; + + + + + Machine: + + + Name: + +
+ Last Played: +
+ +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + : + + + + + + + + + + + + true + + + false + + + + + + + + Guid= + + + _new + + + + + + + + + + + + + + + + + + + + valuename + + nowrap + + + +   + + dyndata + + nowrap + + + +     + + + + + + + + + + +
+
+ + + + + + + + + + valuename + + + + + dyndata + + + +
  
+ +
+ + + + + + + +
+ + +
+
+
+ + + + + + + + + valuename + + +    + + + valuename + + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + + + + + + + main + + + + + + + +
+ +
+
+ + + + + + + + main + + + + + + +
+ +
+
+ + + + + + + + main + + + + + + + +
+ +
+
+ + + + + + + + + + + + + +
+ diff --git a/Themes/_fallback/Other/Profile Stats.xsl b/Themes/_fallback/Other/Profile Stats.xsl index b6caa6aec1..da5f22a745 100644 --- a/Themes/_fallback/Other/Profile Stats.xsl +++ b/Themes/_fallback/Other/Profile Stats.xsl @@ -1,1421 +1,1421 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Instructions - - - -

Overview

- - - - -
- This section explains all the files saved to your memory card. Please read the instructions below before modifying any files on your memory card. Modifying files may result in irreversible loss of your data. -
- -
- -

Description of Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Edits/ - This directory contains edit step files that you've created yourself or downloaded from the internet. - - More Info - - You can place up to 200 .edit files in this directory. The edit file format is similar to an .sm file, except that it has only two tags: -
- #SONG:<SongDirectory>; -
- #NOTES:<StepsType>:<Description>:<Difficulty>:<Meter>:<RadarValues>:<NoteData>; -
-
-
LastGood/ - This directory contains a backup of your last Stats.xml and signatures that were successfully loaded. - - More Info - - The stats on your memory card may fail to load because: -
    -
  • The Stats.xml file or its digital signatures have become corrupt.
  • -
  • The Stats.xml file has been modified outside of the game. This will cause the digital signature check to fail.
  • -
- If your saved statistics fail to load, your can restore from from the "last good" data. Copy all 3 files in the files LastGood directory into the main profile directory (one level up from LastGood). -
-
-
Screenshots/ - All in-game screenshots that you take are saved in this directory. - - More Info - - This directory contains all screenshots that you've captured while playing the game. The Screenshots section of Stats.xml shows thumbnails score details for all screens you've captured. -
- The MD5 hash for a screenshot file can be used to verify that the screenshot has not been modified since it was first saved. -
- If your memory card is full, you can free space by deleting some of the screenshot .jpg files or moving them to another disk. -
-
-
Catalog.xmlContains game data used by Stats.xsl for displaying a report of your stats.
DontShare.sig - DontShare.sig is a digital signature that's required by the game when it loads your memory card data. This is a secret file that you shouldn't share with anyone else. - - More Info - - You can freely share Stats.xml and Stats.xml.sig with other players or submit these files for internet ranking. However, you should always keep DontShare.sig private. - Without the DontShare.sig, another player will not be able to load your saved data and pass it off as their own. - - -
Editable.ini - Holds preferences that you can edit using your home computer. You can open this file using any text editor program and save changes. -
Stats.xmlYou're looking at this file now. It contains all of your saved scores, statistics, and preferences. The game reads this data when you insert your memory card.
Stats.xml.sig - This is the digital signature for Stats.xml. - - More Info - - Digital signatures are used to verify that your data hasn't been modified outside of the game. This prevents cheaters from changing their score data and passing it off as real. -
- If any of Stats.xml, Stats.xml.sig, or DontShare.sig have been modified outside of the game, your memory card data will be ignored and overridden after the next save. It's important that you don't modify any of these three files because doing so will render your data permanently unusable. -
-
-
- -
-
-
- - - - - - - - - - - General Data - - - - - - - - -
- -
- - - Song Count by PlayMode - - - - - - - - - - - - - - - - - - - - - - Song Count by Style - - - - - - - - - - - - - - - - - - - - - - Song Count by Difficulty - - - - - - - - - - - - - - - - - - - - - - Song Count by Meter - - - - - - - - - - - - - - - - - - - - - - Stages Passed by Grade - - - - - - - - - - - - - - - - - - - - - - Stages Passed by PlayMode - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - - - - - - - - - Songs - Courses - - - Steps - Trail - - - - - - Popularity - - - - - Ranking - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Unplayed - - - - - - - - - - - - - - - - - - - - - - - Ranking - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
-
-
- -
- -
-
- -
-
-
- - - - - - - - - - Steps - Trail - - - - Top Scores - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -
-
-
-
- - - - - - - - - - - Songs - Courses - - - Steps - Trail - - - Difficulty - CourseDifficulty - - - - Completeness - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Actual - - - - - -
Possible - - - - - -
Percentage - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- -
-
-
-
-
-
- - - - - - - - - - - - Recent Scores - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Screenshots - - - - - - - - - - - - - - - - -
- - - _new - - - 160 - 120 - border-width: 0 - - - - - - - - -
- -
-
- - - - - - - - - - Coin Counts - - - - - - - - - - - - - - - - - -
- -
-
- -
- -
-
-
- - - - - - - - - - - Calories - - - - - WARNING: Weight is not set. Calorie counts may be inaccurate. -
-
- - - - - - - - - All time - - - - - - - - Per Song - - - 0 - - - - - - - - - - Per Minute of Gameplay - - - 0 - - - - - - - - - - - -
- -

By Week

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SunMonTueWedThuFriSat
- -
-
-
- - - - - - - - - Week of - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - error: - - - - - - - - - - - Sun - Mon - Tue - Wed - Thu - Fri - Sat - error: - - - - - - - - - - - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - error: - - - - - - - - - - - January - February - March - April - May - June - July - August - September - October - November - December - error: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [not implemented] - - - - - 0 - - - - - - 0 - - - - - - - 12 - 0 - - 0 - - - - - - - [not implemented] - - - - - 0 - - - - - - 0 - - - - - - - AM - PM - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [not implemented] - - - - - [not implemented] - - - - - [not implemented] - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Instructions + + + +

Overview

+ + + + +
+ This section explains all the files saved to your memory card. Please read the instructions below before modifying any files on your memory card. Modifying files may result in irreversible loss of your data. +
+ +
+ +

Description of Files

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Edits/ + This directory contains edit step files that you've created yourself or downloaded from the internet. + + More Info + + You can place up to 200 .edit files in this directory. The edit file format is similar to an .sm file, except that it has only two tags: +
+ #SONG:<SongDirectory>; +
+ #NOTES:<StepsType>:<Description>:<Difficulty>:<Meter>:<RadarValues>:<NoteData>; +
+
+
LastGood/ + This directory contains a backup of your last Stats.xml and signatures that were successfully loaded. + + More Info + + The stats on your memory card may fail to load because: +
    +
  • The Stats.xml file or its digital signatures have become corrupt.
  • +
  • The Stats.xml file has been modified outside of the game. This will cause the digital signature check to fail.
  • +
+ If your saved statistics fail to load, your can restore from from the "last good" data. Copy all 3 files in the files LastGood directory into the main profile directory (one level up from LastGood). +
+
+
Screenshots/ + All in-game screenshots that you take are saved in this directory. + + More Info + + This directory contains all screenshots that you've captured while playing the game. The Screenshots section of Stats.xml shows thumbnails score details for all screens you've captured. +
+ The MD5 hash for a screenshot file can be used to verify that the screenshot has not been modified since it was first saved. +
+ If your memory card is full, you can free space by deleting some of the screenshot .jpg files or moving them to another disk. +
+
+
Catalog.xmlContains game data used by Stats.xsl for displaying a report of your stats.
DontShare.sig + DontShare.sig is a digital signature that's required by the game when it loads your memory card data. This is a secret file that you shouldn't share with anyone else. + + More Info + + You can freely share Stats.xml and Stats.xml.sig with other players or submit these files for internet ranking. However, you should always keep DontShare.sig private. + Without the DontShare.sig, another player will not be able to load your saved data and pass it off as their own. + + +
Editable.ini + Holds preferences that you can edit using your home computer. You can open this file using any text editor program and save changes. +
Stats.xmlYou're looking at this file now. It contains all of your saved scores, statistics, and preferences. The game reads this data when you insert your memory card.
Stats.xml.sig + This is the digital signature for Stats.xml. + + More Info + + Digital signatures are used to verify that your data hasn't been modified outside of the game. This prevents cheaters from changing their score data and passing it off as real. +
+ If any of Stats.xml, Stats.xml.sig, or DontShare.sig have been modified outside of the game, your memory card data will be ignored and overridden after the next save. It's important that you don't modify any of these three files because doing so will render your data permanently unusable. +
+
+
+ +
+
+
+ + + + + + + + + + + General Data + + + + + + + + +
+ +
+ + + Song Count by PlayMode + + + + + + + + + + + + + + + + + + + + + + Song Count by Style + + + + + + + + + + + + + + + + + + + + + + Song Count by Difficulty + + + + + + + + + + + + + + + + + + + + + + Song Count by Meter + + + + + + + + + + + + + + + + + + + + + + Stages Passed by Grade + + + + + + + + + + + + + + + + + + + + + + Stages Passed by PlayMode + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + Songs + Courses + + + Steps + Trail + + + + + + Popularity + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unplayed + + + + + + + + + + + + + + + + + + + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+
+ +
+ +
+
+ +
+
+
+ + + + + + + + + + Steps + Trail + + + + Top Scores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + Songs + Courses + + + Steps + Trail + + + Difficulty + CourseDifficulty + + + + Completeness + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
Actual + + + + + +
Possible + + + + + +
Percentage + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+
+
+
+
+
+ + + + + + + + + + + + Recent Scores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Screenshots + + + + + + + + + + + + + + + + +
+ + + _new + + + 160 + 120 + border-width: 0 + + + + + + + + +
+ +
+
+ + + + + + + + + + Coin Counts + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+
+
+ + + + + + + + + + + Calories + + + + + WARNING: Weight is not set. Calorie counts may be inaccurate. +
+
+ + + + + + + + + All time + + + + + + + + Per Song + + + 0 + + + + + + + + + + Per Minute of Gameplay + + + 0 + + + + + + + + + + + +
+ +

By Week

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SunMonTueWedThuFriSat
+ +
+
+
+ + + + + + + + + Week of + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + error: + + + + + + + + + + + Sun + Mon + Tue + Wed + Thu + Fri + Sat + error: + + + + + + + + + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + error: + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + error: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + 12 + 0 + + 0 + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + AM + PM + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + [not implemented] + + + + + [not implemented] + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/Themes/_fallback/Other/ScreenGameplaySyncMachine music.ssc b/Themes/_fallback/Other/ScreenGameplaySyncMachine music.ssc index a190bf0d9d..dde55e41ae 100644 --- a/Themes/_fallback/Other/ScreenGameplaySyncMachine music.ssc +++ b/Themes/_fallback/Other/ScreenGameplaySyncMachine music.ssc @@ -1,169 +1,169 @@ -#TITLE:Sync; -#SUBTITLE:; -#ARTIST:Unknown artist; -#TITLETRANSLIT:; -#SUBTITLETRANSLIT:; -#ARTISTTRANSLIT:; -#GENRE:; -#CREDIT:; -#BANNER:; -#BACKGROUND:; -#LYRICSPATH:; -#CDTITLE:; -#MUSIC:ScreenGameplaySyncMachine music.ogg; -#OFFSET:-0.012; -#SAMPLESTART:0.000; -#SAMPLELENGTH:12.000; -#SELECTABLE:YES; -#BPMS:0.000=132.000; -#STOPS:; -#BGCHANGES:; -#KEYSOUNDS:; - -#NOTEDATA:; -#STEPSTYPE:dance-single:; -#DESCRIPTION:blank; -#DIFFICULTY:Beginner; -#METER:1; -#RADARVALUES:0.302,0.205,0.000,0.000,0.000; -#NOTES: - // measure 1 -0000 -, // measure 2 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 3 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 4 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 5 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 6 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 7 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 8 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -; - -#NOTEDATA:; -#STEPSTYPE:pump-single; -#DESCRIPTION:blank; -#DIFFICULTY:Beginner; -#METER:1; -#RADARVALUES:0.302,0.205,0.000,0.000,0.000; -#NOTES: - // measure 1 -00000 -, // measure 2 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 3 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 4 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 5 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 6 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 7 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 8 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -; +#TITLE:Sync; +#SUBTITLE:; +#ARTIST:Unknown artist; +#TITLETRANSLIT:; +#SUBTITLETRANSLIT:; +#ARTISTTRANSLIT:; +#GENRE:; +#CREDIT:; +#BANNER:; +#BACKGROUND:; +#LYRICSPATH:; +#CDTITLE:; +#MUSIC:ScreenGameplaySyncMachine music.ogg; +#OFFSET:-0.012; +#SAMPLESTART:0.000; +#SAMPLELENGTH:12.000; +#SELECTABLE:YES; +#BPMS:0.000=132.000; +#STOPS:; +#BGCHANGES:; +#KEYSOUNDS:; + +#NOTEDATA:; +#STEPSTYPE:dance-single:; +#DESCRIPTION:blank; +#DIFFICULTY:Beginner; +#METER:1; +#RADARVALUES:0.302,0.205,0.000,0.000,0.000; +#NOTES: + // measure 1 +0000 +, // measure 2 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 3 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 4 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 5 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 6 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 7 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 8 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +; + +#NOTEDATA:; +#STEPSTYPE:pump-single; +#DESCRIPTION:blank; +#DIFFICULTY:Beginner; +#METER:1; +#RADARVALUES:0.302,0.205,0.000,0.000,0.000; +#NOTES: + // measure 1 +00000 +, // measure 2 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 3 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 4 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 5 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 6 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 7 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 8 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +; diff --git a/Themes/_fallback/Other/ScreenHowToPlay steps.ssc b/Themes/_fallback/Other/ScreenHowToPlay steps.ssc index 1b43422f65..b64d877215 100644 --- a/Themes/_fallback/Other/ScreenHowToPlay steps.ssc +++ b/Themes/_fallback/Other/ScreenHowToPlay steps.ssc @@ -1,127 +1,127 @@ -// these steps are only used by the How To Play screen. -// you can use any difficuly here, as long as there is -// only one set of steps in the file. the steps start -// as soon as the screen comes up. also, the music used -// is Sounds/ScreenHowToPlay Music, so no need to specify -// a song file here. -#TITLE:ScreenHowToPlay steps; -#ARTIST:foo; -#BPMS:0.000=100.000; -#STOPS:16=2,18=2,20=2,22=2; -#NOTEDATA:; -#STEPSTYPE:dance-single; -#DESCRIPTION:BASIC; -#DIFFICULTY:easy; -#METER:1; -#RADARVALUES:0,0,0,0,0; -#NOTES: -0000 -, -0000 -, -0000 -, -0000 -, -0100 -0010 -, -1000 -1001 -, -1000 -0100 -0001 -0100 -0010 -1000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -, -0000 -, -0000 -,; - -#NOTEDATA:; -#STEPSTYPE:pump-single; -#DESCRIPTION:NORMAL; -#DIFFICULTY:easy; -#METER:1; -#RADARVALUES:0,0,0,0,0; -#NOTES: -00000 -, -00000 -, -00000 -, -00000 -, -01000 -00100 -, -10000 -10010 -, -10000 -01000 -00010 -01000 -00100 -10000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -, -00000 -, -00000 -,; +// these steps are only used by the How To Play screen. +// you can use any difficuly here, as long as there is +// only one set of steps in the file. the steps start +// as soon as the screen comes up. also, the music used +// is Sounds/ScreenHowToPlay Music, so no need to specify +// a song file here. +#TITLE:ScreenHowToPlay steps; +#ARTIST:foo; +#BPMS:0.000=100.000; +#STOPS:16=2,18=2,20=2,22=2; +#NOTEDATA:; +#STEPSTYPE:dance-single; +#DESCRIPTION:BASIC; +#DIFFICULTY:easy; +#METER:1; +#RADARVALUES:0,0,0,0,0; +#NOTES: +0000 +, +0000 +, +0000 +, +0000 +, +0100 +0010 +, +1000 +1001 +, +1000 +0100 +0001 +0100 +0010 +1000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +, +0000 +, +0000 +,; + +#NOTEDATA:; +#STEPSTYPE:pump-single; +#DESCRIPTION:NORMAL; +#DIFFICULTY:easy; +#METER:1; +#RADARVALUES:0,0,0,0,0; +#NOTES: +00000 +, +00000 +, +00000 +, +00000 +, +01000 +00100 +, +10000 +10010 +, +10000 +01000 +00010 +01000 +00100 +10000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +, +00000 +, +00000 +,; diff --git a/Themes/_fallback/Scripts/00 init.lua b/Themes/_fallback/Scripts/00 init.lua index ea82a43458..ed8bded4f4 100644 --- a/Themes/_fallback/Scripts/00 init.lua +++ b/Themes/_fallback/Scripts/00 init.lua @@ -1,51 +1,51 @@ --- This file is always executed first. - --- Override Lua's upper and lower functions with our own, which is always UTF-8. -if Uppercase then - string.upper = Uppercase - string.lower = Lowercase - Uppercase = nil -- don't use directly - Lowercase = nil -- don't use directly -end - -Trace = lua.Trace -Warn = lua.Warn -print = Trace - -PLAYER_1 = "PlayerNumber_P1" -PLAYER_2 = "PlayerNumber_P2" -NUM_PLAYERS = #PlayerNumber - -function string:find_last( text ) - local LastPos = 0 - while true do - local p = string.find( self, text, LastPos+1, true ) - if not p then - return LastPos - end - LastPos = p - end -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +-- This file is always executed first. + +-- Override Lua's upper and lower functions with our own, which is always UTF-8. +if Uppercase then + string.upper = Uppercase + string.lower = Lowercase + Uppercase = nil -- don't use directly + Lowercase = nil -- don't use directly +end + +Trace = lua.Trace +Warn = lua.Warn +print = Trace + +PLAYER_1 = "PlayerNumber_P1" +PLAYER_2 = "PlayerNumber_P2" +NUM_PLAYERS = #PlayerNumber + +function string:find_last( text ) + local LastPos = 0 + while true do + local p = string.find( self, text, LastPos+1, true ) + if not p then + return LastPos + end + LastPos = p + end +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/01 alias.lua b/Themes/_fallback/Scripts/01 alias.lua index 240872b7e9..05935425bf 100644 --- a/Themes/_fallback/Scripts/01 alias.lua +++ b/Themes/_fallback/Scripts/01 alias.lua @@ -1,23 +1,23 @@ ---[[ sm-ssc aliases (non-compatibility) -This is mainly here for making commands case-insensitive without needing to -clutter up the C++ code. It can also be used to add custom functions that -wouldn't otherwise belong somewhere else. ---]] - --- in fact, this probably belongs in Sprite.lua... -function Sprite:cropto(w,h) - self:CropTo(w,h) -end - -function Actor:SetSize(w,h) - self:setsize(w,h) -end - --- shorthand! this is tedious to type and makes things ugly so let's make it shorter. --- screen.w, screen.h, etc. -local _screen = { - w = SCREEN_WIDTH, - h = SCREEN_HEIGHT, - cx = SCREEN_CENTER_X, - cy = SCREEN_CENTER_Y +--[[ sm-ssc aliases (non-compatibility) +This is mainly here for making commands case-insensitive without needing to +clutter up the C++ code. It can also be used to add custom functions that +wouldn't otherwise belong somewhere else. +--]] + +-- in fact, this probably belongs in Sprite.lua... +function Sprite:cropto(w,h) + self:CropTo(w,h) +end + +function Actor:SetSize(w,h) + self:setsize(w,h) +end + +-- shorthand! this is tedious to type and makes things ugly so let's make it shorter. +-- screen.w, screen.h, etc. +local _screen = { + w = SCREEN_WIDTH, + h = SCREEN_HEIGHT, + cx = SCREEN_CENTER_X, + cy = SCREEN_CENTER_Y } \ No newline at end of file diff --git a/Themes/_fallback/Scripts/01 base.lua b/Themes/_fallback/Scripts/01 base.lua index 3dab0c8b35..0cad9786b4 100644 --- a/Themes/_fallback/Scripts/01 base.lua +++ b/Themes/_fallback/Scripts/01 base.lua @@ -1,68 +1,68 @@ --- Override Lua's loadfile to use lua.ReadFile. -function loadfile(file) - local data, err = lua.ReadFile(file); - if not data then - return nil, ("what " .. file) - end - - local chunk, err = load( - function() - local ret = data - data = nil - return ret - end, - "@" .. file ); - if not chunk then return nil, err end - - -- Set the environment, like loadfile does. - setfenv( chunk, getfenv(2) ); - return chunk -end - --- Override Lua's dofile to use our loadfile. -function dofile(file) - if not file then - error( "dofile(nil) unsupported", 2 ); - end - - local chunk, err = loadfile(file) - if not chunk then - error( err, 2 ); - end - - return chunk -end - --- Like ipairs(), but returns only values. -function ivalues(t) - local n = 0 - return function() - n = n + 1 - return t[n]; - end -end - -Var = lua.GetThreadVariable - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +-- Override Lua's loadfile to use lua.ReadFile. +function loadfile(file) + local data, err = lua.ReadFile(file); + if not data then + return nil, ("what " .. file) + end + + local chunk, err = load( + function() + local ret = data + data = nil + return ret + end, + "@" .. file ); + if not chunk then return nil, err end + + -- Set the environment, like loadfile does. + setfenv( chunk, getfenv(2) ); + return chunk +end + +-- Override Lua's dofile to use our loadfile. +function dofile(file) + if not file then + error( "dofile(nil) unsupported", 2 ); + end + + local chunk, err = loadfile(file) + if not chunk then + error( err, 2 ); + end + + return chunk +end + +-- Like ipairs(), but returns only values. +function ivalues(t) + local n = 0 + return function() + n = n + 1 + return t[n]; + end +end + +Var = lua.GetThreadVariable + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/01 compat.lua b/Themes/_fallback/Scripts/01 compat.lua index 903cbb7e96..c2f171e1f0 100644 --- a/Themes/_fallback/Scripts/01 compat.lua +++ b/Themes/_fallback/Scripts/01 compat.lua @@ -1,66 +1,66 @@ ---[[ sm-ssc compatibility helpers -sm-ssc changes quite a few things which would make various SM4 content break. -Also, certain things are deprecated/removed from sm-ssc (and sometimes SM4 too). ---]] - ---[[ Actor ]] -function Actor:hidden(bHide) - Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") - self:visible(not bHide) -end - --- for when horizalign and vertalign get killed by glenn: ---[[ -function Actor:horizalign(v) - local values = { - left = 0, - center = 0.5, - right = 1 - } - self:halign(values[v]) -end - -function Actor:vertalign(v) - local values = { - top = 0, - middle = 0.5, - bottom = 1 - } - self:valign(values[v]) -end ---]] - ---[[ ActorScroller: all of these got renamed, so alias the lowercase ones if -things are going to look for them. ]] -function ActorScroller:getsecondtodestination() - self:GetSecondsToDestination() -end - -function ActorScroller:setsecondsperitem(secs) - self:SetSecondsPerItem(secs) -end - -function ActorScroller:setnumsubdivisions(subs) - self:SetNumSubdivisions(subs) -end - -function ActorScroller:scrollthroughallitems() - self:ScrollThroughAllItems() -end - -function ActorScroller:scrollwithpadding(fPadStart,fPadEnd) - self:ScrollWithPadding(fPadStart,fPadEnd) -end - -function ActorScroller:setfastcatchup(bFastCatchup) - self:SetFastCatchup(bFastCatchup) -end - --- renaming various StepMania functions to sm-ssc ones: -if ScreenString then - ScreenString = Screen.String -end - -if ScreenMetric then - ScreenMetric = Screen.Metric +--[[ sm-ssc compatibility helpers +sm-ssc changes quite a few things which would make various SM4 content break. +Also, certain things are deprecated/removed from sm-ssc (and sometimes SM4 too). +--]] + +--[[ Actor ]] +function Actor:hidden(bHide) + Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") + self:visible(not bHide) +end + +-- for when horizalign and vertalign get killed by glenn: +--[[ +function Actor:horizalign(v) + local values = { + left = 0, + center = 0.5, + right = 1 + } + self:halign(values[v]) +end + +function Actor:vertalign(v) + local values = { + top = 0, + middle = 0.5, + bottom = 1 + } + self:valign(values[v]) +end +--]] + +--[[ ActorScroller: all of these got renamed, so alias the lowercase ones if +things are going to look for them. ]] +function ActorScroller:getsecondtodestination() + self:GetSecondsToDestination() +end + +function ActorScroller:setsecondsperitem(secs) + self:SetSecondsPerItem(secs) +end + +function ActorScroller:setnumsubdivisions(subs) + self:SetNumSubdivisions(subs) +end + +function ActorScroller:scrollthroughallitems() + self:ScrollThroughAllItems() +end + +function ActorScroller:scrollwithpadding(fPadStart,fPadEnd) + self:ScrollWithPadding(fPadStart,fPadEnd) +end + +function ActorScroller:setfastcatchup(bFastCatchup) + self:SetFastCatchup(bFastCatchup) +end + +-- renaming various StepMania functions to sm-ssc ones: +if ScreenString then + ScreenString = Screen.String +end + +if ScreenMetric then + ScreenMetric = Screen.Metric end \ No newline at end of file diff --git a/Themes/_fallback/Scripts/02 Actor.lua b/Themes/_fallback/Scripts/02 Actor.lua index 156a752ab2..cfded1e6a4 100644 --- a/Themes/_fallback/Scripts/02 Actor.lua +++ b/Themes/_fallback/Scripts/02 Actor.lua @@ -1,169 +1,169 @@ --- Convenience aliases: -left = "HorizAlign_Left"; -center = "HorizAlign_Center"; -right = "HorizAlign_Right"; -top = "VertAlign_Top"; -middle = "VertAlign_Middle"; -bottom = "VertAlign_Bottom"; - -function Actor:ease(t, fEase) - -- Optimizations: - -- fEase = -100 is equivalent to TweenType_Accelerate. - if fEase == -100 then - self:accelerate(t); - return; - end - - -- fEase = 0 is equivalent to TweenType_Linear. - if fEase == 0 then - self:linear(t); - return; - end - - -- fEase = +100 is equivalent to TweenType_Decelerate. - if fEase == 100 then - self:decelerate(t); - return; - end - - self:tween( t, "TweenType_Bezier", - { - 0, - scale(fEase, -100, 100, 0/3, 2/3), - scale(fEase, -100, 100, 1/3, 3/3), - 1 - } - ); -end --- Notes On Beziers -- --- They can be 1D ( Quadratic ) or 2D ( Bezier ) --- 1D: --- XA XB YC YD --- 2D: --- XA XB XC XD YA YB YC YD --- In 1D Quads, XA XB are beginning time and size, YC YD are ending time and size --- In 2D Quads, X -local BounceBeginBezier = -{ - 0, 0, - 0.42, -0.42, - 2/3, 0.3, - 1, 1 -} -function Actor:bouncebegin(t) - self:tween( t, "TweenType_Bezier", BounceBeginBezier ); -end - -local BounceEndBezier = -{ - 0,0, - 1/3, 0.7, - 0.58, 1.42, - 1, 1 -} -function Actor:bounceend(t) - self:tween( t, "TweenType_Bezier", BounceEndBezier ); -end - -local SmoothBezier = -{ - 0, 0, 1, 1 -} -function Actor:smooth(t) - self:tween( t, "TweenType_Bezier", SmoothBezier ); -end --- SSC Additions -local DropBezier = -{ - 0 , 0, - 1/3 , 1, - 2/3 , 0.5, - 1 , 1, -} -function Actor:drop(t) - self:tween( t, "TweenType_Bezier", DropBezier ); -end --- Hide if b is true, but don't unhide if b is false. -function Actor:hide_if(b) - if b then - self:visible(false) - end -end - -function Actor:player(p) - self:visible( GAMESTATE:IsHumanPlayer(p) ) -end - -function ActorFrame:propagatecommand(...) - self:propagate(1); - self:playcommand(...); - self:propagate(0); -end - --- Shortcut for alignment. --- cmd(align,0.5,0.5) -- align center --- cmd(align,0.0,0.0) -- align top-left --- cmd(align,0.5,0.0) -- align top-center -function Actor:align(h, v) - self:halign( h ); - self:valign( v ); -end - -function Actor:FullScreen() - self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); -end - ---[[ Typical background sizes: -320x240 - DDR 1st-Extreme, most NVLM_ZK songs -640x480 - most simfiles in distribution today are this big. -768x480 - 16:10 aspect ratio backgrounds -854x480 - pump it up pro -]] --- "Most backgrounds are 640x480. Some are 768x480. Stretch the 4:3 ones." -function Actor:scale_or_crop_background() - if (self:GetWidth() * 3) / 4 == self:GetHeight() then - self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); - else - self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); - end -end - -function Actor:Center() - self:x(SCREEN_CENTER_X) - self:y(SCREEN_CENTER_Y) -end - -function Actor:bezier(...) - local a = {...} - local b = {} - local c = 0 - assert((a == 9 or a == 5), "bad number of arguments for Actor:bezier()") - for i=3,c do - b[#b+1] = a[i] - end - self:tween(a[2], "TweenMode_Bezier", b) -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +-- Convenience aliases: +left = "HorizAlign_Left"; +center = "HorizAlign_Center"; +right = "HorizAlign_Right"; +top = "VertAlign_Top"; +middle = "VertAlign_Middle"; +bottom = "VertAlign_Bottom"; + +function Actor:ease(t, fEase) + -- Optimizations: + -- fEase = -100 is equivalent to TweenType_Accelerate. + if fEase == -100 then + self:accelerate(t); + return; + end + + -- fEase = 0 is equivalent to TweenType_Linear. + if fEase == 0 then + self:linear(t); + return; + end + + -- fEase = +100 is equivalent to TweenType_Decelerate. + if fEase == 100 then + self:decelerate(t); + return; + end + + self:tween( t, "TweenType_Bezier", + { + 0, + scale(fEase, -100, 100, 0/3, 2/3), + scale(fEase, -100, 100, 1/3, 3/3), + 1 + } + ); +end +-- Notes On Beziers -- +-- They can be 1D ( Quadratic ) or 2D ( Bezier ) +-- 1D: +-- XA XB YC YD +-- 2D: +-- XA XB XC XD YA YB YC YD +-- In 1D Quads, XA XB are beginning time and size, YC YD are ending time and size +-- In 2D Quads, X +local BounceBeginBezier = +{ + 0, 0, + 0.42, -0.42, + 2/3, 0.3, + 1, 1 +} +function Actor:bouncebegin(t) + self:tween( t, "TweenType_Bezier", BounceBeginBezier ); +end + +local BounceEndBezier = +{ + 0,0, + 1/3, 0.7, + 0.58, 1.42, + 1, 1 +} +function Actor:bounceend(t) + self:tween( t, "TweenType_Bezier", BounceEndBezier ); +end + +local SmoothBezier = +{ + 0, 0, 1, 1 +} +function Actor:smooth(t) + self:tween( t, "TweenType_Bezier", SmoothBezier ); +end +-- SSC Additions +local DropBezier = +{ + 0 , 0, + 1/3 , 1, + 2/3 , 0.5, + 1 , 1, +} +function Actor:drop(t) + self:tween( t, "TweenType_Bezier", DropBezier ); +end +-- Hide if b is true, but don't unhide if b is false. +function Actor:hide_if(b) + if b then + self:visible(false) + end +end + +function Actor:player(p) + self:visible( GAMESTATE:IsHumanPlayer(p) ) +end + +function ActorFrame:propagatecommand(...) + self:propagate(1); + self:playcommand(...); + self:propagate(0); +end + +-- Shortcut for alignment. +-- cmd(align,0.5,0.5) -- align center +-- cmd(align,0.0,0.0) -- align top-left +-- cmd(align,0.5,0.0) -- align top-center +function Actor:align(h, v) + self:halign( h ); + self:valign( v ); +end + +function Actor:FullScreen() + self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); +end + +--[[ Typical background sizes: +320x240 - DDR 1st-Extreme, most NVLM_ZK songs +640x480 - most simfiles in distribution today are this big. +768x480 - 16:10 aspect ratio backgrounds +854x480 - pump it up pro +]] +-- "Most backgrounds are 640x480. Some are 768x480. Stretch the 4:3 ones." +function Actor:scale_or_crop_background() + if (self:GetWidth() * 3) / 4 == self:GetHeight() then + self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); + else + self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ); + end +end + +function Actor:Center() + self:x(SCREEN_CENTER_X) + self:y(SCREEN_CENTER_Y) +end + +function Actor:bezier(...) + local a = {...} + local b = {} + local c = 0 + assert((a == 9 or a == 5), "bad number of arguments for Actor:bezier()") + for i=3,c do + b[#b+1] = a[i] + end + self:tween(a[2], "TweenMode_Bezier", b) +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 ActorDef.lua b/Themes/_fallback/Scripts/02 ActorDef.lua index 32fa7062a9..1c9d1d99a5 100644 --- a/Themes/_fallback/Scripts/02 ActorDef.lua +++ b/Themes/_fallback/Scripts/02 ActorDef.lua @@ -1,234 +1,234 @@ --- Convert "@/path/file" to "/path/". -local function DebugPathToRealPath( p ) - if not p or p:sub( 1, 1 ) ~= "@" then - return nil - end - - local Path = p:sub( 2 ) - local pos = Path:find_last( '/' ) - return string.sub( Path, 1, pos ) -end - -local function MergeTables( left, right ) - local ret = { } - for key, val in pairs(left) do - ret[key] = val - end - - for key, val in pairs(right) do - if ret[key] then - if type(val) == "function" and - type(ret[key]) == "function" then - local f1 = ret[key] - local f2 = val - val = function(...) - f1(...) - return f2(...) - end - else - Warn( string.format( "%s\n\nOverriding \"%s\": %s with %s", - debug.traceback(), key, type(ret[key]), type(val)) ) - end - end - - ret[key] = val - end - setmetatable( ret, getmetatable(left) ) - return ret -end - -DefMetatable = { - __concat = function(left, right) - return MergeTables( left, right ) - end -} - --- This is used as follows: --- --- t = Def.Class { table } -Def = {} -setmetatable( Def, { - __index = function(self, Class) - -- t is an actor definition table. name is the type - -- given to Def. Fill in standard fields. - return function(t) - if not ActorUtil.IsRegisteredClass(Class) then - error( Class .. " is not a registered actor class", 2 ) - end - - t.Class = Class - - local level = 2 - if t._Level then - level = t._Level + 1 - end - local info = debug.getinfo(level,"Sl"); - - -- Source file of caller: - local Source = info.source - t._Source = Source - - t._Dir = DebugPathToRealPath( Source ) - - -- Line number of caller: - t._Line = info.currentline - - setmetatable( t, DefMetatable ) - return t - end - end, -}) - -function ResolveRelativePath( path, level ) - if path:sub(1,1) ~= "/" then - -- "Working directory": - local sDir = DebugPathToRealPath( debug.getinfo(level+1,"S").source ) - assert( sDir ) - - path = sDir .. path - end - - path = ActorUtil.ResolvePath( path, level+1 ) - return path -end - --- Load an actor template. -function LoadActorFunc( path, level ) - level = level or 1 - - if path == "" then - error( "Passing in a blank filename is a great way to eat up RAM. Good thing we warn you about this." ) - end - - local ResolvedPath = ResolveRelativePath( path, level+1 ) - if not ResolvedPath then - error( path .. ": not found", level+1 ) - end - path = ResolvedPath - - local Type = ActorUtil.GetFileType( path ) - Trace( "Loading " .. path .. ", type " .. tostring(Type) ) - - if Type == "FileType_Lua" then - -- Load the file. - local chunk, errmsg = loadfile( path ) - if not chunk then error(errmsg) end - return chunk - end - - if Type == "FileType_Bitmap" or Type == "FileType_Movie" then - return function() - return Def.Sprite { - _Level = level+1, - Texture = path - } - end - elseif Type == "FileType_Sound" then - return function() - return Def.Sound { - _Level = level+1, - File = path - } - end - elseif Type == "FileType_Model" then - return function() - return Def.Model { - _Level = level+1, - Meshes = path, - Materials = path, - Bones = path - } - end - elseif Type == "FileType_Directory" then - return function() - return Def.BGAnimation { - _Level = level+1, - AniDir = path - } - end - end - - error( path .. ": unknown file type (" .. tostring(Type) .. ")", level+1 ) -end - --- Load and create an actor template. -function LoadActor( path, ... ) - local t = LoadActorFunc( path, 2 ) - assert(t) - return t(...) -end - -function LoadActorWithParams( path, params, ... ) - local t = LoadActorFunc( path, 2 ) - assert(t) - return lua.RunWithThreadVariables( function(...) return t(...) end, params, ... ) -end - -function LoadFont(a, b) - local sSection = b and a or "" - local sFile = b or a - if sFile == "" or not sFile then - sSection = "Common" - sFile = "normal" - end - local sPath = THEME:GetPathF(sSection, sFile) - return Def.BitmapText { - _Level = 2, - File = sPath - } -end - -function WrapInActorFrame( t ) - return Def.ActorFrame { children = t } -end - -function StandardDecorationFromTable( MetricsName, t ) - if type(t) == "table" then - t = t .. { - InitCommand=function(self) - self:name(MetricsName) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") - end - } - end - return t -end - -function StandardDecorationFromFile( MetricsName, FileName ) - local t = LoadActor( THEME:GetPathG(Var "LoadingScreen",FileName) ) - return StandardDecorationFromTable( MetricsName, t ) -end - -function StandardDecorationFromFileOptional( MetricsName, FileName ) - if ShowStandardDecoration(MetricsName) then - return StandardDecorationFromFile( MetricsName, FileName ) - end -end - -function ShowStandardDecoration( MetricsName ) - return THEME:GetMetric(Var "LoadingScreen","Show"..MetricsName) -end - - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +-- Convert "@/path/file" to "/path/". +local function DebugPathToRealPath( p ) + if not p or p:sub( 1, 1 ) ~= "@" then + return nil + end + + local Path = p:sub( 2 ) + local pos = Path:find_last( '/' ) + return string.sub( Path, 1, pos ) +end + +local function MergeTables( left, right ) + local ret = { } + for key, val in pairs(left) do + ret[key] = val + end + + for key, val in pairs(right) do + if ret[key] then + if type(val) == "function" and + type(ret[key]) == "function" then + local f1 = ret[key] + local f2 = val + val = function(...) + f1(...) + return f2(...) + end + else + Warn( string.format( "%s\n\nOverriding \"%s\": %s with %s", + debug.traceback(), key, type(ret[key]), type(val)) ) + end + end + + ret[key] = val + end + setmetatable( ret, getmetatable(left) ) + return ret +end + +DefMetatable = { + __concat = function(left, right) + return MergeTables( left, right ) + end +} + +-- This is used as follows: +-- +-- t = Def.Class { table } +Def = {} +setmetatable( Def, { + __index = function(self, Class) + -- t is an actor definition table. name is the type + -- given to Def. Fill in standard fields. + return function(t) + if not ActorUtil.IsRegisteredClass(Class) then + error( Class .. " is not a registered actor class", 2 ) + end + + t.Class = Class + + local level = 2 + if t._Level then + level = t._Level + 1 + end + local info = debug.getinfo(level,"Sl"); + + -- Source file of caller: + local Source = info.source + t._Source = Source + + t._Dir = DebugPathToRealPath( Source ) + + -- Line number of caller: + t._Line = info.currentline + + setmetatable( t, DefMetatable ) + return t + end + end, +}) + +function ResolveRelativePath( path, level ) + if path:sub(1,1) ~= "/" then + -- "Working directory": + local sDir = DebugPathToRealPath( debug.getinfo(level+1,"S").source ) + assert( sDir ) + + path = sDir .. path + end + + path = ActorUtil.ResolvePath( path, level+1 ) + return path +end + +-- Load an actor template. +function LoadActorFunc( path, level ) + level = level or 1 + + if path == "" then + error( "Passing in a blank filename is a great way to eat up RAM. Good thing we warn you about this." ) + end + + local ResolvedPath = ResolveRelativePath( path, level+1 ) + if not ResolvedPath then + error( path .. ": not found", level+1 ) + end + path = ResolvedPath + + local Type = ActorUtil.GetFileType( path ) + Trace( "Loading " .. path .. ", type " .. tostring(Type) ) + + if Type == "FileType_Lua" then + -- Load the file. + local chunk, errmsg = loadfile( path ) + if not chunk then error(errmsg) end + return chunk + end + + if Type == "FileType_Bitmap" or Type == "FileType_Movie" then + return function() + return Def.Sprite { + _Level = level+1, + Texture = path + } + end + elseif Type == "FileType_Sound" then + return function() + return Def.Sound { + _Level = level+1, + File = path + } + end + elseif Type == "FileType_Model" then + return function() + return Def.Model { + _Level = level+1, + Meshes = path, + Materials = path, + Bones = path + } + end + elseif Type == "FileType_Directory" then + return function() + return Def.BGAnimation { + _Level = level+1, + AniDir = path + } + end + end + + error( path .. ": unknown file type (" .. tostring(Type) .. ")", level+1 ) +end + +-- Load and create an actor template. +function LoadActor( path, ... ) + local t = LoadActorFunc( path, 2 ) + assert(t) + return t(...) +end + +function LoadActorWithParams( path, params, ... ) + local t = LoadActorFunc( path, 2 ) + assert(t) + return lua.RunWithThreadVariables( function(...) return t(...) end, params, ... ) +end + +function LoadFont(a, b) + local sSection = b and a or "" + local sFile = b or a + if sFile == "" or not sFile then + sSection = "Common" + sFile = "normal" + end + local sPath = THEME:GetPathF(sSection, sFile) + return Def.BitmapText { + _Level = 2, + File = sPath + } +end + +function WrapInActorFrame( t ) + return Def.ActorFrame { children = t } +end + +function StandardDecorationFromTable( MetricsName, t ) + if type(t) == "table" then + t = t .. { + InitCommand=function(self) + self:name(MetricsName) + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") + end + } + end + return t +end + +function StandardDecorationFromFile( MetricsName, FileName ) + local t = LoadActor( THEME:GetPathG(Var "LoadingScreen",FileName) ) + return StandardDecorationFromTable( MetricsName, t ) +end + +function StandardDecorationFromFileOptional( MetricsName, FileName ) + if ShowStandardDecoration(MetricsName) then + return StandardDecorationFromFile( MetricsName, FileName ) + end +end + +function ShowStandardDecoration( MetricsName ) + return THEME:GetMetric(Var "LoadingScreen","Show"..MetricsName) +end + + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/02 Branches.lua b/Themes/_fallback/Scripts/02 Branches.lua index d485fbdcb6..d57ef9d551 100644 --- a/Themes/_fallback/Scripts/02 Branches.lua +++ b/Themes/_fallback/Scripts/02 Branches.lua @@ -1,195 +1,195 @@ ---[[ -[en] The Branch table replaces the various functions used for branching in the -StepMania 4 default theme. -Lines with a single string (e.g. TitleMenu = "ScreenTitleMenu") are referenced -in the metrics as Branch.keyname. -If the line is a function, you'll have to use Branch.keyname() instead. ---]] - --- used for various SMOnline-enabled screens: -function SMOnlineScreen() - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - if not IsSMOnlineLoggedIn(pn) then - return "ScreenSMOnlineLogin" - end - end - return "ScreenNetRoom" -end - -function SelectMusicOrCourse() - if IsNetSMOnline() then - return "ScreenNetSelectMusic"; - elseif GAMESTATE:IsCourseMode() then - return "ScreenSelectCourse" - else - return "ScreenSelectMusic" - end -end - --- functions used for Routine mode -function IsRoutine() - return GAMESTATE:GetCurrentStyle() and GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_TwoPlayersSharedSides"; -end - -Branch = { - Init = function() - if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then - return "ScreenInit" - else - return "ScreenInit" - end - end, - AfterInit = function() - if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then - return Branch.TitleMenu() - else - return "ScreenLogo" - end - end, - TitleMenu = function() - -- home mode is the most assumed use of sm-ssc. - if GAMESTATE:GetCoinMode() == "CoinMode_Home" then - return "ScreenTitleMenu" - end - -- arcade junk: - if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then - -- if no credits are inserted, don't show the Join screen. SM4 has - -- this as the initial screen, but that means we'd be stuck in a - -- loop with ScreenInit. No good. - return "ScreenTitleJoin" - else - return "ScreenTitleJoin" - end - end, - StartGame = function() - -- Check to see if there are 0 songs installed. Also make sure to check - -- that the additional song count is also 0, because there is - -- a possibility someone will use their existing StepMania simfile - -- collection with sm-ssc via AdditionalFolders/AdditionalSongFolders. - if SONGMAN:GetNumSongs() == 0 and SONGMAN:GetNumAdditionalSongs() == 0 then - return "ScreenHowToInstallSongs"; - end; - return "ScreenSelectProfile"; - end, - AfterProfileLoad = function() - return "ScreenSelectProfile" - end, - AfterSelectProfile = function() - if ( THEME:GetMetric("Common","AutoSetStyle") == true ) then - if IsNetConnected() then - -- use SelectStyle in online... - return "ScreenSelectStyle" - else - return "ScreenSelectPlayMode" - end - else - return "ScreenSelectStyle" - end - end, - AfterSelectPlayMode = function() - if IsNetConnected() then - ReportStyle() - GAMESTATE:ApplyGameCommand("playmode,regular") - end - if IsNetSMOnline() then - return SMOnlineScreen() - end - if IsNetConnected() then - return "ScreenNetRoom" - end - return "ScreenSelectPlayMode" - end, - AfterSelectStyle = function() - if CHARMAN:GetAllCharacters() ~= nil then - return "ScreenSelectCharacter" - else - return "ScreenGameInformation" - end - end, - AfterProfileSave = function() - -- Might be a little too broken? -- Midiman - if GAMESTATE:IsEventMode() then - return SelectMusicOrCourse() - elseif STATSMAN:GetCurStageStats():AllFailed() then - return "ScreenGameOver" - elseif GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() == 0 then - return "ScreenEvaluationSummary" - else - return SelectMusicOrCourse() - end - end, - GetGameInformationScreen = function() - bTrue = PREFSMAN:GetPreference("ShowInstructions") - return (bTrue and GoToMusic() or "ScreenGameInformation") - end, - AfterSMOLogin = SMOnlineScreen(), - BackOutOfPlayerOptions = function() - return SelectMusicOrCourse() - end, - BackOutOfStageInformation = function() - return SelectMusicOrCourse() - end, - AfterSelectMusic = function() - if SCREENMAN:GetTopScreen():GetGoToOptions() then - return SelectFirstOptionsScreen() - else - return "ScreenStageInformation" - end - end, - PlayerOptions = function() - local pm = GAMESTATE:GetPlayMode() - local restricted = { "PlayMode_Oni", "PlayMode_Rave", - --"PlayMode_Battle" -- ?? - }; - local optionsScreen = "ScreenPlayerOptions" - for i=1,#restricted do - if restricted[i] == pm then - optionsScreen = "ScreenPlayerOptionsRestricted" - end; - end - if SCREENMAN:GetTopScreen():GetGoToOptions() then - return optionsScreen; - else - return "ScreenStageInformation"; - end - end, - SongOptions = function() - if SCREENMAN:GetTopScreen():GetGoToOptions() then - return "ScreenSongOptions" - else - return "ScreenStageInformation" - end - end, - GameplayScreen = function() - if IsRoutine() then - return "ScreenGameplayShared" - end - return "ScreenGameplay" - end, - AfterGameplay = function() - -- pick an evaluation screen based on settings. - if IsNetSMOnline() then - return "ScreenNetEvaluation" - else - -- todo: account for courses etc? - return "ScreenEvaluationNormal" - end - end, - AfterEvaluation = function() - if GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() >= 1 then - return "ScreenProfileSave" - else - return "ScreenEvaluationSummary" - end - end, - AfterSummary = "ScreenProfileSaveSummary", - Network = function() - return IsNetConnected() and "ScreenTitleMenu" or "ScreenTitleMenu" - end, - QuickSetupStart = "ScreenQuickSetupOverview", - QuickSetupA = "ScreenQuickSetupPhaseOne", - QuickSetupB = "ScreenQuickSetupPhaseTwo", - QuickSetupC = "ScreenQuickSetupPhaseThree", - QuickSetupD = "ScreenQuickSetupPhaseFour", - QuickSetupFinished = "ScreenQuickSetupFinished" -} +--[[ +[en] The Branch table replaces the various functions used for branching in the +StepMania 4 default theme. +Lines with a single string (e.g. TitleMenu = "ScreenTitleMenu") are referenced +in the metrics as Branch.keyname. +If the line is a function, you'll have to use Branch.keyname() instead. +--]] + +-- used for various SMOnline-enabled screens: +function SMOnlineScreen() + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + if not IsSMOnlineLoggedIn(pn) then + return "ScreenSMOnlineLogin" + end + end + return "ScreenNetRoom" +end + +function SelectMusicOrCourse() + if IsNetSMOnline() then + return "ScreenNetSelectMusic"; + elseif GAMESTATE:IsCourseMode() then + return "ScreenSelectCourse" + else + return "ScreenSelectMusic" + end +end + +-- functions used for Routine mode +function IsRoutine() + return GAMESTATE:GetCurrentStyle() and GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_TwoPlayersSharedSides"; +end + +Branch = { + Init = function() + if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then + return "ScreenInit" + else + return "ScreenInit" + end + end, + AfterInit = function() + if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then + return Branch.TitleMenu() + else + return "ScreenLogo" + end + end, + TitleMenu = function() + -- home mode is the most assumed use of sm-ssc. + if GAMESTATE:GetCoinMode() == "CoinMode_Home" then + return "ScreenTitleMenu" + end + -- arcade junk: + if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then + -- if no credits are inserted, don't show the Join screen. SM4 has + -- this as the initial screen, but that means we'd be stuck in a + -- loop with ScreenInit. No good. + return "ScreenTitleJoin" + else + return "ScreenTitleJoin" + end + end, + StartGame = function() + -- Check to see if there are 0 songs installed. Also make sure to check + -- that the additional song count is also 0, because there is + -- a possibility someone will use their existing StepMania simfile + -- collection with sm-ssc via AdditionalFolders/AdditionalSongFolders. + if SONGMAN:GetNumSongs() == 0 and SONGMAN:GetNumAdditionalSongs() == 0 then + return "ScreenHowToInstallSongs"; + end; + return "ScreenSelectProfile"; + end, + AfterProfileLoad = function() + return "ScreenSelectProfile" + end, + AfterSelectProfile = function() + if ( THEME:GetMetric("Common","AutoSetStyle") == true ) then + if IsNetConnected() then + -- use SelectStyle in online... + return "ScreenSelectStyle" + else + return "ScreenSelectPlayMode" + end + else + return "ScreenSelectStyle" + end + end, + AfterSelectPlayMode = function() + if IsNetConnected() then + ReportStyle() + GAMESTATE:ApplyGameCommand("playmode,regular") + end + if IsNetSMOnline() then + return SMOnlineScreen() + end + if IsNetConnected() then + return "ScreenNetRoom" + end + return "ScreenSelectPlayMode" + end, + AfterSelectStyle = function() + if CHARMAN:GetAllCharacters() ~= nil then + return "ScreenSelectCharacter" + else + return "ScreenGameInformation" + end + end, + AfterProfileSave = function() + -- Might be a little too broken? -- Midiman + if GAMESTATE:IsEventMode() then + return SelectMusicOrCourse() + elseif STATSMAN:GetCurStageStats():AllFailed() then + return "ScreenGameOver" + elseif GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() == 0 then + return "ScreenEvaluationSummary" + else + return SelectMusicOrCourse() + end + end, + GetGameInformationScreen = function() + bTrue = PREFSMAN:GetPreference("ShowInstructions") + return (bTrue and GoToMusic() or "ScreenGameInformation") + end, + AfterSMOLogin = SMOnlineScreen(), + BackOutOfPlayerOptions = function() + return SelectMusicOrCourse() + end, + BackOutOfStageInformation = function() + return SelectMusicOrCourse() + end, + AfterSelectMusic = function() + if SCREENMAN:GetTopScreen():GetGoToOptions() then + return SelectFirstOptionsScreen() + else + return "ScreenStageInformation" + end + end, + PlayerOptions = function() + local pm = GAMESTATE:GetPlayMode() + local restricted = { "PlayMode_Oni", "PlayMode_Rave", + --"PlayMode_Battle" -- ?? + }; + local optionsScreen = "ScreenPlayerOptions" + for i=1,#restricted do + if restricted[i] == pm then + optionsScreen = "ScreenPlayerOptionsRestricted" + end; + end + if SCREENMAN:GetTopScreen():GetGoToOptions() then + return optionsScreen; + else + return "ScreenStageInformation"; + end + end, + SongOptions = function() + if SCREENMAN:GetTopScreen():GetGoToOptions() then + return "ScreenSongOptions" + else + return "ScreenStageInformation" + end + end, + GameplayScreen = function() + if IsRoutine() then + return "ScreenGameplayShared" + end + return "ScreenGameplay" + end, + AfterGameplay = function() + -- pick an evaluation screen based on settings. + if IsNetSMOnline() then + return "ScreenNetEvaluation" + else + -- todo: account for courses etc? + return "ScreenEvaluationNormal" + end + end, + AfterEvaluation = function() + if GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() >= 1 then + return "ScreenProfileSave" + else + return "ScreenEvaluationSummary" + end + end, + AfterSummary = "ScreenProfileSaveSummary", + Network = function() + return IsNetConnected() and "ScreenTitleMenu" or "ScreenTitleMenu" + end, + QuickSetupStart = "ScreenQuickSetupOverview", + QuickSetupA = "ScreenQuickSetupPhaseOne", + QuickSetupB = "ScreenQuickSetupPhaseTwo", + QuickSetupC = "ScreenQuickSetupPhaseThree", + QuickSetupD = "ScreenQuickSetupPhaseFour", + QuickSetupFinished = "ScreenQuickSetupFinished" +} diff --git a/Themes/_fallback/Scripts/02 Colors.lua b/Themes/_fallback/Scripts/02 Colors.lua index 6c4a14981a..9cfe09c54c 100644 --- a/Themes/_fallback/Scripts/02 Colors.lua +++ b/Themes/_fallback/Scripts/02 Colors.lua @@ -1,180 +1,180 @@ --- SSC Color Module and Library -local nilColor = color("0,0,0,0") --- Original Color Module. -Color = { --- Color Library --- These colors are pure swatch colors and are here purely to be used --- on demand without having to type color("stuff") or dig through --- a palette to get the color you want. - Black = color("0,0,0,1"), - White = color("1,1,1,1"), - Red = color("#ed1c24"), - Blue = color("#00aeef"), - Green = color("#39b54a"), - Yellow = color("#fff200"), - Orange = color("#f7941d"), - Purple = color("#92278f"), - Outline = color("0,0,0,0.5"), - Invisible = color("1,1,1,0"), - Stealth = nilColor, --- Color Functions --- These functions alter colors in a certain way so that you can make --- new ones without having to copy a color or find a new one. ---[[ Brightness(fInput) - Hue(hInput) - Saturation(hInput) - Alpha(hInput) - HSV(iHue,fSaturation,fValue or any other overload) --]] - Alpha = function(cColor,fAlpha) - local c = cColor; - return { c[1],c[2],c[3],fAlpha }; - end -} --- Remapped Color Module, since some themes are crazy -Colors = Color; - -GameColor = { - PlayerColors = { - PLAYER_1 = color("#ef403d"), - PLAYER_2 = color("#0089cf"), - }, - Difficulty = { - --[[ These are for 'Custom' Difficulty Ranks. It can be very useful - in some cases, especially to apply new colors for stuff you - couldn't before. (huh? -aj) ]] - Beginner = color("#ff32f8"), -- light cyan - Easy = color("#2cff00"), -- green - Medium = color("#fee600"), -- yellow - Hard = color("#ff2f39"), -- red - Challenge = color("#1cd8ff"), -- light blue - Edit = color("0.8,0.8,0.8,1"), -- gray - Couple = color("#ed0972"), -- hot pink - Routine = color("#ff9a00"), -- orange - --[[ These are for courses, so let's slap them here in case someone - wanted to use Difficulty in Course and Step regions. ]] - Difficulty_Beginner = color("#ff32f8"), -- purple - Difficulty_Easy = color("#2cff00"), -- green - Difficulty_Medium = color("#fee600"), -- yellow - Difficulty_Hard = color("#ff2f39"), -- red - Difficulty_Challenge = color("#1cd8ff"), -- light blue - Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray - Difficulty_Couple = color("#ed0972"), -- hot pink - Difficulty_Routine = color("#ff9a00") -- orange - }, - Stage = { - Stage_1st = color("#00ffc7"), - Stage_2nd = color("#58ff00"), - Stage_3rd = color("#f400ff"), - Stage_4th = color("#00ffda"), - Stage_5th = color("#ed00ff"), - Stage_6th = color("#73ff00"), - Stage_Next = color("#73ff00"), - Stage_Final = color("#ff0707"), - Stage_Extra1 = color("#fafa00"), - Stage_Extra2 = color("#ff0707"), - Stage_Nonstop = color("#FFFFFF"), - Stage_Oni = color("#FFFFFF"), - Stage_Endless = color("#FFFFFF"), - Stage_Event = color("#FFFFFF"), - Stage_Demo = color("#FFFFFF") - }, - Judgment = { - JudgmentLine_W1 = color("#bfeaff"), - JudgmentLine_W2 = color("#fff568"), - JudgmentLine_W3 = color("#a4ff00"), - JudgmentLine_W4 = color("#34bfff"), - JudgmentLine_W5 = color("#e44dff"), - JudgmentLine_Held = color("#FFFFFF"), - JudgmentLine_Miss = color("#ff3c3c"), - JudgmentLine_MaxCombo = color("#ffc600") - }, -}; -GameColor.Difficulty["Crazy"] = GameColor.Difficulty["Hard"]; -GameColor.Difficulty["Freestyle"] = GameColor.Difficulty["Easy"]; -GameColor.Difficulty["Nightmare"] = GameColor.Difficulty["Challenge"]; -GameColor.Difficulty["HalfDouble"] = GameColor.Difficulty["Medium"]; - ---[[ Fallbacks ]] -function Color(c) - return Colors[c] -end - -function BoostColor( cColor, fBoost ) - local c = cColor - return { c[1]*fBoost, c[2]*fBoost, c[3]*fBoost, c[4] } -end - -function ColorLightTone(c) - return { c[1]+(c[1]/2), c[2]+(c[2]/2), c[3]+(c[3]/2), c[4] } -end - -function ColorMidTone(c) - return { c[1]/1.5, c[2]/1.5, c[3]/1.5, c[4] } -end - -function ColorDarkTone(c) - return { c[1]/2, c[2]/2, c[3]/2, c[4] } -end - -function PlayerColor( pn ) - if pn == PLAYER_1 then - return color("#ef403d") -- pink-red - end - if pn == PLAYER_2 then - return color("#0089cf") -- sea-blue - end - return color("1,1,1,1") -end -function PlayerScoreColor( pn ) - if pn == PLAYER_1 then - return color("#ef403d") -- pink-red - end - if pn == PLAYER_2 then - return color("#0089cf") -- sea-blue - end - return color("1,1,1,1") -end - -function CustomDifficultyToColor( sCustomDifficulty ) - return GameColor.Difficulty[sCustomDifficulty] -end - -function CustomDifficultyToDarkColor( sCustomDifficulty ) - local c = GameColor.Difficulty[sCustomDifficulty] - return { c[1]/2, c[2]/2, c[3]/2, c[4] } -end - -function CustomDifficultyToLightColor( sCustomDifficulty ) - local c = GameColor.Difficulty[sCustomDifficulty] - return { scale(c[1],0,1,0.5,1), scale(c[2],0,1,0.5,1), scale(c[3],0,1,0.5,1), c[4] } -end - -function StepsOrTrailToColor(StepsOrTrail) - return CustomDifficultyToColor( StepsOrTrailToCustomDifficulty(stepsOrTrail) ) -end - -function StageToColor( stage ) - local c = GameColor.Stage[stage] - if c then - return c - end - return color("#000000") -end - -function StageToStrokeColor( stage ) - local c = GameColor.Stage[stage] - return { c[1]/2, c[2]/2, c[3]/2, c[4] } -end - -function JudgmentLineToColor( i ) - local c = GameColor.Judgment[i] - if c then - return c - end - return color("#000000") -end - -function JudgmentLineToStrokeColor( i ) - local c = GameColor.Judgment[i] - return { c[1]/2, c[2]/2, c[3]/2, c[4] } +-- SSC Color Module and Library +local nilColor = color("0,0,0,0") +-- Original Color Module. +Color = { +-- Color Library +-- These colors are pure swatch colors and are here purely to be used +-- on demand without having to type color("stuff") or dig through +-- a palette to get the color you want. + Black = color("0,0,0,1"), + White = color("1,1,1,1"), + Red = color("#ed1c24"), + Blue = color("#00aeef"), + Green = color("#39b54a"), + Yellow = color("#fff200"), + Orange = color("#f7941d"), + Purple = color("#92278f"), + Outline = color("0,0,0,0.5"), + Invisible = color("1,1,1,0"), + Stealth = nilColor, +-- Color Functions +-- These functions alter colors in a certain way so that you can make +-- new ones without having to copy a color or find a new one. +--[[ Brightness(fInput) + Hue(hInput) + Saturation(hInput) + Alpha(hInput) + HSV(iHue,fSaturation,fValue or any other overload) --]] + Alpha = function(cColor,fAlpha) + local c = cColor; + return { c[1],c[2],c[3],fAlpha }; + end +} +-- Remapped Color Module, since some themes are crazy +Colors = Color; + +GameColor = { + PlayerColors = { + PLAYER_1 = color("#ef403d"), + PLAYER_2 = color("#0089cf"), + }, + Difficulty = { + --[[ These are for 'Custom' Difficulty Ranks. It can be very useful + in some cases, especially to apply new colors for stuff you + couldn't before. (huh? -aj) ]] + Beginner = color("#ff32f8"), -- light cyan + Easy = color("#2cff00"), -- green + Medium = color("#fee600"), -- yellow + Hard = color("#ff2f39"), -- red + Challenge = color("#1cd8ff"), -- light blue + Edit = color("0.8,0.8,0.8,1"), -- gray + Couple = color("#ed0972"), -- hot pink + Routine = color("#ff9a00"), -- orange + --[[ These are for courses, so let's slap them here in case someone + wanted to use Difficulty in Course and Step regions. ]] + Difficulty_Beginner = color("#ff32f8"), -- purple + Difficulty_Easy = color("#2cff00"), -- green + Difficulty_Medium = color("#fee600"), -- yellow + Difficulty_Hard = color("#ff2f39"), -- red + Difficulty_Challenge = color("#1cd8ff"), -- light blue + Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray + Difficulty_Couple = color("#ed0972"), -- hot pink + Difficulty_Routine = color("#ff9a00") -- orange + }, + Stage = { + Stage_1st = color("#00ffc7"), + Stage_2nd = color("#58ff00"), + Stage_3rd = color("#f400ff"), + Stage_4th = color("#00ffda"), + Stage_5th = color("#ed00ff"), + Stage_6th = color("#73ff00"), + Stage_Next = color("#73ff00"), + Stage_Final = color("#ff0707"), + Stage_Extra1 = color("#fafa00"), + Stage_Extra2 = color("#ff0707"), + Stage_Nonstop = color("#FFFFFF"), + Stage_Oni = color("#FFFFFF"), + Stage_Endless = color("#FFFFFF"), + Stage_Event = color("#FFFFFF"), + Stage_Demo = color("#FFFFFF") + }, + Judgment = { + JudgmentLine_W1 = color("#bfeaff"), + JudgmentLine_W2 = color("#fff568"), + JudgmentLine_W3 = color("#a4ff00"), + JudgmentLine_W4 = color("#34bfff"), + JudgmentLine_W5 = color("#e44dff"), + JudgmentLine_Held = color("#FFFFFF"), + JudgmentLine_Miss = color("#ff3c3c"), + JudgmentLine_MaxCombo = color("#ffc600") + }, +}; +GameColor.Difficulty["Crazy"] = GameColor.Difficulty["Hard"]; +GameColor.Difficulty["Freestyle"] = GameColor.Difficulty["Easy"]; +GameColor.Difficulty["Nightmare"] = GameColor.Difficulty["Challenge"]; +GameColor.Difficulty["HalfDouble"] = GameColor.Difficulty["Medium"]; + +--[[ Fallbacks ]] +function Color(c) + return Colors[c] +end + +function BoostColor( cColor, fBoost ) + local c = cColor + return { c[1]*fBoost, c[2]*fBoost, c[3]*fBoost, c[4] } +end + +function ColorLightTone(c) + return { c[1]+(c[1]/2), c[2]+(c[2]/2), c[3]+(c[3]/2), c[4] } +end + +function ColorMidTone(c) + return { c[1]/1.5, c[2]/1.5, c[3]/1.5, c[4] } +end + +function ColorDarkTone(c) + return { c[1]/2, c[2]/2, c[3]/2, c[4] } +end + +function PlayerColor( pn ) + if pn == PLAYER_1 then + return color("#ef403d") -- pink-red + end + if pn == PLAYER_2 then + return color("#0089cf") -- sea-blue + end + return color("1,1,1,1") +end +function PlayerScoreColor( pn ) + if pn == PLAYER_1 then + return color("#ef403d") -- pink-red + end + if pn == PLAYER_2 then + return color("#0089cf") -- sea-blue + end + return color("1,1,1,1") +end + +function CustomDifficultyToColor( sCustomDifficulty ) + return GameColor.Difficulty[sCustomDifficulty] +end + +function CustomDifficultyToDarkColor( sCustomDifficulty ) + local c = GameColor.Difficulty[sCustomDifficulty] + return { c[1]/2, c[2]/2, c[3]/2, c[4] } +end + +function CustomDifficultyToLightColor( sCustomDifficulty ) + local c = GameColor.Difficulty[sCustomDifficulty] + return { scale(c[1],0,1,0.5,1), scale(c[2],0,1,0.5,1), scale(c[3],0,1,0.5,1), c[4] } +end + +function StepsOrTrailToColor(StepsOrTrail) + return CustomDifficultyToColor( StepsOrTrailToCustomDifficulty(stepsOrTrail) ) +end + +function StageToColor( stage ) + local c = GameColor.Stage[stage] + if c then + return c + end + return color("#000000") +end + +function StageToStrokeColor( stage ) + local c = GameColor.Stage[stage] + return { c[1]/2, c[2]/2, c[3]/2, c[4] } +end + +function JudgmentLineToColor( i ) + local c = GameColor.Judgment[i] + if c then + return c + end + return color("#000000") +end + +function JudgmentLineToStrokeColor( i ) + local c = GameColor.Judgment[i] + return { c[1]/2, c[2]/2, c[3]/2, c[4] } end \ No newline at end of file diff --git a/Themes/_fallback/Scripts/02 Debug.lua b/Themes/_fallback/Scripts/02 Debug.lua index 97ff27ff75..80dd1d40b0 100644 --- a/Themes/_fallback/Scripts/02 Debug.lua +++ b/Themes/_fallback/Scripts/02 Debug.lua @@ -1,97 +1,97 @@ -if not debug then - -- stubs - debug = {} - debug.traceback = function() return "" end - return -end - --- Override debug.traceback. -function debug.traceback(...) - local thread = coroutine.running() - local msg = "" - local level = 1 - local args = {...} - - if type(args[1]) == "thread" then - thread = args[1] - table.remove(args) - end - if type(args[1]) == "string" then - msg = args[1] - table.remove(args) - end - if type(args[1]) == "number" then - level = args[1] - table.remove(args) - end - - if thread == coroutine.running() then - level = level + 1 -- skip this function - end - - local stack = {} - repeat - local info = debug.getinfo(level, "Sln") - table.insert( stack, info ) - level = level + 1 - until not info - - if #stack == 0 then - return "" - end - - -- The original caller is usually C; remove it. - if( stack[#stack].what == "C" ) then - table.remove( stack ) - end - local function FormatFrame(level, frame) - local sFrameInfo = "" - sFrameInfo = sFrameInfo .. "#" .. level .. " " - if( frame.what == "tail" ) then - -- sFrameInfo = sFrameInfo .. "(tail call)" - -- return sFrameInfo - elseif( frame.what == "main" ) then - sFrameInfo = sFrameInfo .. "main in " - elseif frame.name then - sFrameInfo = sFrameInfo .. frame.name .. "() in " - else - sFrameInfo = sFrameInfo .. "... in " - end - sFrameInfo = sFrameInfo .. frame.short_src - - if frame.currentline ~= -1 then - sFrameInfo = sFrameInfo .. ":" .. frame.currentline - end - - return sFrameInfo - end - - local FrameInfo = {} - for level, frame in ipairs(stack) do - FrameInfo[level] = FormatFrame(level, frame) - end - return table.concat( FrameInfo, "\n" ) -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +if not debug then + -- stubs + debug = {} + debug.traceback = function() return "" end + return +end + +-- Override debug.traceback. +function debug.traceback(...) + local thread = coroutine.running() + local msg = "" + local level = 1 + local args = {...} + + if type(args[1]) == "thread" then + thread = args[1] + table.remove(args) + end + if type(args[1]) == "string" then + msg = args[1] + table.remove(args) + end + if type(args[1]) == "number" then + level = args[1] + table.remove(args) + end + + if thread == coroutine.running() then + level = level + 1 -- skip this function + end + + local stack = {} + repeat + local info = debug.getinfo(level, "Sln") + table.insert( stack, info ) + level = level + 1 + until not info + + if #stack == 0 then + return "" + end + + -- The original caller is usually C; remove it. + if( stack[#stack].what == "C" ) then + table.remove( stack ) + end + local function FormatFrame(level, frame) + local sFrameInfo = "" + sFrameInfo = sFrameInfo .. "#" .. level .. " " + if( frame.what == "tail" ) then + -- sFrameInfo = sFrameInfo .. "(tail call)" + -- return sFrameInfo + elseif( frame.what == "main" ) then + sFrameInfo = sFrameInfo .. "main in " + elseif frame.name then + sFrameInfo = sFrameInfo .. frame.name .. "() in " + else + sFrameInfo = sFrameInfo .. "... in " + end + sFrameInfo = sFrameInfo .. frame.short_src + + if frame.currentline ~= -1 then + sFrameInfo = sFrameInfo .. ":" .. frame.currentline + end + + return sFrameInfo + end + + local FrameInfo = {} + for level, frame in ipairs(stack) do + FrameInfo[level] = FormatFrame(level, frame) + end + return table.concat( FrameInfo, "\n" ) +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/02 Enum.lua b/Themes/_fallback/Scripts/02 Enum.lua index c277529d70..3c311e50cb 100644 --- a/Themes/_fallback/Scripts/02 Enum.lua +++ b/Themes/_fallback/Scripts/02 Enum.lua @@ -1,50 +1,50 @@ -function Enum:Compare( e1, e2 ) - local Reverse = self:Reverse() - local Value1 = Reverse[e1] - local Value2 = Reverse[e2] - - assert( Value1, tostring(e1) .. " is not an enum of type " .. self:GetName() ) - assert( Value2, tostring(e2) .. " is not an enum of type " .. self:GetName() ) - - -- Nil enums correspond to "invalid". These compare greater - -- than any valid enum value, to line up with the equivalent - -- C++ code. - - -- should this be changed to math.huge()? -shake - if not e1 then - Value1 = 99999999 - end - if not e2 then - Value2 = 99999999 - end - return Value1 - Value2 -end - -function ToEnumShortString( e ) - local pos = string.find( e, '_' ) - assert( pos, "'" .. e .. "' is not an enum value" ) - return string.sub( e, pos+1 ) -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +function Enum:Compare( e1, e2 ) + local Reverse = self:Reverse() + local Value1 = Reverse[e1] + local Value2 = Reverse[e2] + + assert( Value1, tostring(e1) .. " is not an enum of type " .. self:GetName() ) + assert( Value2, tostring(e2) .. " is not an enum of type " .. self:GetName() ) + + -- Nil enums correspond to "invalid". These compare greater + -- than any valid enum value, to line up with the equivalent + -- C++ code. + + -- should this be changed to math.huge()? -shake + if not e1 then + Value1 = 99999999 + end + if not e2 then + Value2 = 99999999 + end + return Value1 - Value2 +end + +function ToEnumShortString( e ) + local pos = string.find( e, '_' ) + assert( pos, "'" .. e .. "' is not an enum value" ) + return string.sub( e, pos+1 ) +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/02 HelpDisplay.lua b/Themes/_fallback/Scripts/02 HelpDisplay.lua index d8ae376532..452389ba83 100644 --- a/Themes/_fallback/Scripts/02 HelpDisplay.lua +++ b/Themes/_fallback/Scripts/02 HelpDisplay.lua @@ -1,39 +1,39 @@ -function HelpDisplay:setfromsongorcourse() - local Artists = {} - local AltArtists = {} - - local Song = GAMESTATE:GetCurrentSong() - local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() ) - if Song then - table.insert( Artists, Song:GetDisplayArtist() ) - table.insert( AltArtists, Song:GetTranslitArtist() ) - elseif Trail then - Artists, AltArtists = Trail:GetArtists() - end - - self:settips( Artists, AltArtists ) -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +function HelpDisplay:setfromsongorcourse() + local Artists = {} + local AltArtists = {} + + local Song = GAMESTATE:GetCurrentSong() + local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() ) + if Song then + table.insert( Artists, Song:GetDisplayArtist() ) + table.insert( AltArtists, Song:GetTranslitArtist() ) + elseif Trail then + Artists, AltArtists = Trail:GetArtists() + end + + self:settips( Artists, AltArtists ) +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Lyrics.lua b/Themes/_fallback/Scripts/02 Lyrics.lua index bf324299a7..169aff9712 100644 --- a/Themes/_fallback/Scripts/02 Lyrics.lua +++ b/Themes/_fallback/Scripts/02 Lyrics.lua @@ -1,70 +1,70 @@ -function Actor:LyricCommand(side) - self:settext( Var "LyricText" ) - - self:stoptweening() - self:shadowlengthx(0) - self:shadowlengthy(5) - self:strokecolor(color("#000000")) - - local Zoom = SCREEN_WIDTH / (self:GetZoomedWidth()+1) - if( Zoom > 1 ) then - Zoom = 1 - end - self:zoomx( Zoom ) - - local lyricColor = Var "LyricColor" - local Factor = 1 - if side == "Back" then - Factor = 0.5 - elseif side == "Front" then - Factor = 0.9 - end - self:diffuse( { - lyricColor[1] * Factor, - lyricColor[2] * Factor, - lyricColor[3] * Factor, - lyricColor[4] * Factor } ) - - if side == "Front" then - self:cropright(1) - else - self:cropleft(0) - end - - self:diffusealpha(0) - self:linear(0.2) - self:diffusealpha(0.75) - self:linear( Var "LyricDuration" * 0.75) - if side == "Front" then - self:cropright(0) - else - self:cropleft(1) - end - self:sleep( Var "LyricDuration" * 0.25 ) - self:linear(0.2) - self:diffusealpha(0) -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +function Actor:LyricCommand(side) + self:settext( Var "LyricText" ) + + self:stoptweening() + self:shadowlengthx(0) + self:shadowlengthy(5) + self:strokecolor(color("#000000")) + + local Zoom = SCREEN_WIDTH / (self:GetZoomedWidth()+1) + if( Zoom > 1 ) then + Zoom = 1 + end + self:zoomx( Zoom ) + + local lyricColor = Var "LyricColor" + local Factor = 1 + if side == "Back" then + Factor = 0.5 + elseif side == "Front" then + Factor = 0.9 + end + self:diffuse( { + lyricColor[1] * Factor, + lyricColor[2] * Factor, + lyricColor[3] * Factor, + lyricColor[4] * Factor } ) + + if side == "Front" then + self:cropright(1) + else + self:cropleft(0) + end + + self:diffusealpha(0) + self:linear(0.2) + self:diffusealpha(0.75) + self:linear( Var "LyricDuration" * 0.75) + if side == "Front" then + self:cropright(0) + else + self:cropleft(1) + end + self:sleep( Var "LyricDuration" * 0.25 ) + self:linear(0.2) + self:diffusealpha(0) +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 OptionsMenu.lua b/Themes/_fallback/Scripts/02 OptionsMenu.lua index 6fa59e9cce..8e6384fc42 100644 --- a/Themes/_fallback/Scripts/02 OptionsMenu.lua +++ b/Themes/_fallback/Scripts/02 OptionsMenu.lua @@ -1,120 +1,120 @@ --- Sample options menu item. -function OptionsRowTest() - local function Set(self,list,pn) - if list[1] then - Trace("FOO: 1") - end - if list[2] then - Trace("FOO: 2") - end - end - return - { - -- Name is used to retrieve the header and explanation text. - Name = "Foo", - - -- Flags for this row. Note that as this table only defines - -- a row, not a menu, only row settings can be set here, not - -- OptionMenuFlags. - LayoutType = "ShowAllInRow", - SelectType = "SelectMultiple", - OneChoiceForAllPlayers = false, - ExportOnChange = false, - - -- Choices are not resolved as metrics, since they might - -- be dynamic. Add THEME Lua hooks if we want to translate - -- these. - Choices = { "Option1", "Option2" }, - -- Or: - -- for i = 1,20 do Choices[i] = "Option " .. i end - - -- Set list[1] to true if Option1 should be selected, and - -- list[2] if Option2 should be selected. This will be - -- called once per enabled player. - LoadSelections = function(self,list,pn) - list[1] = true - end, - SaveSelections = Set - } -end - --- This option row loads and saves the results to a table. For example, if you --- have options "fast" and "slow", and the name of the option is "run", then the --- table will be set to table["run"] = "fast" (or "slow"), and loaded appropriately. --- (This could handle SelectMultiple, by saving the result to a table, eg. --- table["run"]["fast"] = true.) - -OptionRowTable = -{ - SaveTo = nil, -- set this - Default = nil, -- set this - - LoadSelections = function(self, list, pn) - local Sort = self.SaveTo[self.Name] or self.Default - -- Find the index of the current sort. - local Index = FindValue(self.RawChoices, Sort) or 1 - list[Index] = true - end, - - SaveSelections = function(self, list, pn) - local Selection = FindSelection( list ) - self.SaveTo[self.Name] = self.RawChoices[Selection] - end -} - -function OptionsRandomJukebox() - local function AllChoices() - Trace('all choices') - local ret = { 'Off', 'Random' } - return ret - end - - local t = - { - -- Name is used to retrieve the header and explanation text. - Name = "OptionsRandomJukebox", - LayoutType = "ShowAllInRow", - SelectType = "SelectOne", - OneChoiceForAllPlayers = true, - ExportOnChange = false, - Choices = AllChoices(), - LoadSelections = function(self, list, pn) - list[1] = true - end, - SaveSelections = function(self, list, pn) - local val - if list[1] then - val = false - else - val = true - end - GAMESTATE:SetJukeboxUsesModifiers(val) - end - } - setmetatable( t, t ) - return t -end - --- (c) 2005 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +-- Sample options menu item. +function OptionsRowTest() + local function Set(self,list,pn) + if list[1] then + Trace("FOO: 1") + end + if list[2] then + Trace("FOO: 2") + end + end + return + { + -- Name is used to retrieve the header and explanation text. + Name = "Foo", + + -- Flags for this row. Note that as this table only defines + -- a row, not a menu, only row settings can be set here, not + -- OptionMenuFlags. + LayoutType = "ShowAllInRow", + SelectType = "SelectMultiple", + OneChoiceForAllPlayers = false, + ExportOnChange = false, + + -- Choices are not resolved as metrics, since they might + -- be dynamic. Add THEME Lua hooks if we want to translate + -- these. + Choices = { "Option1", "Option2" }, + -- Or: + -- for i = 1,20 do Choices[i] = "Option " .. i end + + -- Set list[1] to true if Option1 should be selected, and + -- list[2] if Option2 should be selected. This will be + -- called once per enabled player. + LoadSelections = function(self,list,pn) + list[1] = true + end, + SaveSelections = Set + } +end + +-- This option row loads and saves the results to a table. For example, if you +-- have options "fast" and "slow", and the name of the option is "run", then the +-- table will be set to table["run"] = "fast" (or "slow"), and loaded appropriately. +-- (This could handle SelectMultiple, by saving the result to a table, eg. +-- table["run"]["fast"] = true.) + +OptionRowTable = +{ + SaveTo = nil, -- set this + Default = nil, -- set this + + LoadSelections = function(self, list, pn) + local Sort = self.SaveTo[self.Name] or self.Default + -- Find the index of the current sort. + local Index = FindValue(self.RawChoices, Sort) or 1 + list[Index] = true + end, + + SaveSelections = function(self, list, pn) + local Selection = FindSelection( list ) + self.SaveTo[self.Name] = self.RawChoices[Selection] + end +} + +function OptionsRandomJukebox() + local function AllChoices() + Trace('all choices') + local ret = { 'Off', 'Random' } + return ret + end + + local t = + { + -- Name is used to retrieve the header and explanation text. + Name = "OptionsRandomJukebox", + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = true, + ExportOnChange = false, + Choices = AllChoices(), + LoadSelections = function(self, list, pn) + list[1] = true + end, + SaveSelections = function(self, list, pn) + local val + if list[1] then + val = false + else + val = true + end + GAMESTATE:SetJukeboxUsesModifiers(val) + end + } + setmetatable( t, t ) + return t +end + +-- (c) 2005 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Other.lua b/Themes/_fallback/Scripts/02 Other.lua index c696e1d1c8..f9f2532a6f 100644 --- a/Themes/_fallback/Scripts/02 Other.lua +++ b/Themes/_fallback/Scripts/02 Other.lua @@ -1,150 +1,150 @@ -local g_metrics_group = nil; -local g_element = nil; - -SSC = (ProductID() == "sm-ssc"); - -function LoadFallbackB() - -- Load the fallback BGA for the element that is currently being loaded. - -- The fallback metrics group and element name will come either from LuaThreadVars - -- (loading from C++) or from the Lua globals above (loading from Lua). - - --Warn( "g_element " .. (g_element or "") ); - --Warn( "MatchingElement " .. (Var 'MatchingElement' or "") ); - --Warn( "g_metrics_group " .. (g_metrics_group or "") ); - --Warn( "MatchingMetricsGroup " .. (Var 'MatchingMetricsGroup' or "") ); - - local metrics_group = g_metrics_group or Var 'MatchingMetricsGroup'; - local element = g_element or Var 'MatchingElement'; - local fallback = THEME:GetMetric(metrics_group,'Fallback'); - - local old_metrics_group = g_metrics_group; - local old_element = g_element; - - local path; - path, g_metrics_group, g_element = THEME:GetPathInfoB(fallback,element); - --Trace('path ' .. path ); - local t = LoadActor( path ); - - g_metrics_group = old_metrics_group; - g_element = old_element; - - return t; -end - -function FormatNumSongsPlayed( num ) - local s = num..' song'; - if s == 1 then - s = s .. ' '; - else - s = s .. 's'; - end - return s..' played'; -end - -function JudgmentTransformCommand( self, params ) - local x = 0 - local y = -30 - if params.bReverse then y = y * -1 end - -- This makes no sense and wasn't even being used due to misspelling. - -- if bCentered then y = y * 2 end - self:x( x ) - self:y( y ) -end - -function JudgmentTransformSharedCommand( self, params ) - local x = -120 - local y = -30 - if params.bReverse then y = 30 end - if params.Player == PLAYER_1 then x = 120 end - self:x( x ) - self:y( y ) -end - -function ComboTransformCommand( self, params ) - local x = 0 - local y = 30 - if params.bReverse then y = y * -1 end - - if params.bCentered then - if params.bReverse then - y = y - 30 - else - y = y + 40 - end - end - self:x( x ) - self:y( y ) -end - -function GetEditModeSubScreens() - return - "ScreenMiniMenuEditHelp," .. - "ScreenMiniMenuMainMenu," .. - "ScreenMiniMenuAreaMenu," .. - "ScreenMiniMenuStepsInformation," .. - "ScreenMiniMenuSongInformation," .. - "ScreenMiniMenuBackgroundChange," .. - "ScreenMiniMenuInsertTapAttack," .. - "ScreenMiniMenuInsertCourseAttack," .. - "ScreenMiniMenuCourseDisplay," .. - "ScreenEditOptions"; -end - -function GetCoursesToShowRanking() - local CoursesToShowRanking = PREFSMAN:GetPreference("CoursesToShowRanking") - if CoursesToShowRanking ~= "" then return CoursesToShowRanking end - return "Courses/Default/MostPlayed_01-04.crs,Courses/Default/MostPlayed_05-08.crs,Courses/Default/MostPlayed_09-12.crs" -end - --- Get a metric from the currently-loading screen. This is only valid while loading --- an actor, such as from File or InitCommand attributes; not from commands. -Screen = { - Metric = function ( sName ) - local sClass = Var "LoadingScreen" - return THEME:GetMetric( sClass, sName ) - end, - String = function ( sName ) - local sClass = Var "LoadingScreen"; - return THEME:GetString( sClass, sName ) - end -}; - -function TextBannerAfterSet(self,param) - local Title=self:GetChild("Title"); - local Subtitle=self:GetChild("Subtitle"); - --local Artist=self:GetChild("Artist"); - if Subtitle:GetText() == "" then - (cmd(maxwidth,208;y,0;zoom,1.0;))(Title); - (cmd(visible,false))(Subtitle); - --(cmd(zoom,0.66;maxwidth,300;y,7))(Artist); - else - -- subtitle below - (cmd(zoom,1;y,-6;zoom,0.9;))(Title); - (cmd(visible,true;zoom,0.6;y,7))(Subtitle); - --(cmd(zoom,0.66;maxwidth,300;y,9))(Artist); - end -end - --- (c) 2005 Chris Danford --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +local g_metrics_group = nil; +local g_element = nil; + +SSC = (ProductID() == "sm-ssc"); + +function LoadFallbackB() + -- Load the fallback BGA for the element that is currently being loaded. + -- The fallback metrics group and element name will come either from LuaThreadVars + -- (loading from C++) or from the Lua globals above (loading from Lua). + + --Warn( "g_element " .. (g_element or "") ); + --Warn( "MatchingElement " .. (Var 'MatchingElement' or "") ); + --Warn( "g_metrics_group " .. (g_metrics_group or "") ); + --Warn( "MatchingMetricsGroup " .. (Var 'MatchingMetricsGroup' or "") ); + + local metrics_group = g_metrics_group or Var 'MatchingMetricsGroup'; + local element = g_element or Var 'MatchingElement'; + local fallback = THEME:GetMetric(metrics_group,'Fallback'); + + local old_metrics_group = g_metrics_group; + local old_element = g_element; + + local path; + path, g_metrics_group, g_element = THEME:GetPathInfoB(fallback,element); + --Trace('path ' .. path ); + local t = LoadActor( path ); + + g_metrics_group = old_metrics_group; + g_element = old_element; + + return t; +end + +function FormatNumSongsPlayed( num ) + local s = num..' song'; + if s == 1 then + s = s .. ' '; + else + s = s .. 's'; + end + return s..' played'; +end + +function JudgmentTransformCommand( self, params ) + local x = 0 + local y = -30 + if params.bReverse then y = y * -1 end + -- This makes no sense and wasn't even being used due to misspelling. + -- if bCentered then y = y * 2 end + self:x( x ) + self:y( y ) +end + +function JudgmentTransformSharedCommand( self, params ) + local x = -120 + local y = -30 + if params.bReverse then y = 30 end + if params.Player == PLAYER_1 then x = 120 end + self:x( x ) + self:y( y ) +end + +function ComboTransformCommand( self, params ) + local x = 0 + local y = 30 + if params.bReverse then y = y * -1 end + + if params.bCentered then + if params.bReverse then + y = y - 30 + else + y = y + 40 + end + end + self:x( x ) + self:y( y ) +end + +function GetEditModeSubScreens() + return + "ScreenMiniMenuEditHelp," .. + "ScreenMiniMenuMainMenu," .. + "ScreenMiniMenuAreaMenu," .. + "ScreenMiniMenuStepsInformation," .. + "ScreenMiniMenuSongInformation," .. + "ScreenMiniMenuBackgroundChange," .. + "ScreenMiniMenuInsertTapAttack," .. + "ScreenMiniMenuInsertCourseAttack," .. + "ScreenMiniMenuCourseDisplay," .. + "ScreenEditOptions"; +end + +function GetCoursesToShowRanking() + local CoursesToShowRanking = PREFSMAN:GetPreference("CoursesToShowRanking") + if CoursesToShowRanking ~= "" then return CoursesToShowRanking end + return "Courses/Default/MostPlayed_01-04.crs,Courses/Default/MostPlayed_05-08.crs,Courses/Default/MostPlayed_09-12.crs" +end + +-- Get a metric from the currently-loading screen. This is only valid while loading +-- an actor, such as from File or InitCommand attributes; not from commands. +Screen = { + Metric = function ( sName ) + local sClass = Var "LoadingScreen" + return THEME:GetMetric( sClass, sName ) + end, + String = function ( sName ) + local sClass = Var "LoadingScreen"; + return THEME:GetString( sClass, sName ) + end +}; + +function TextBannerAfterSet(self,param) + local Title=self:GetChild("Title"); + local Subtitle=self:GetChild("Subtitle"); + --local Artist=self:GetChild("Artist"); + if Subtitle:GetText() == "" then + (cmd(maxwidth,208;y,0;zoom,1.0;))(Title); + (cmd(visible,false))(Subtitle); + --(cmd(zoom,0.66;maxwidth,300;y,7))(Artist); + else + -- subtitle below + (cmd(zoom,1;y,-6;zoom,0.9;))(Title); + (cmd(visible,true;zoom,0.6;y,7))(Subtitle); + --(cmd(zoom,0.66;maxwidth,300;y,9))(Artist); + end +end + +-- (c) 2005 Chris Danford +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Serialize.lua b/Themes/_fallback/Scripts/02 Serialize.lua index 1a0e7f4639..7e52170fd7 100644 --- a/Themes/_fallback/Scripts/02 Serialize.lua +++ b/Themes/_fallback/Scripts/02 Serialize.lua @@ -1,119 +1,119 @@ --- Serialize the table "t". -function Serialize(t) - local ret = "" - local queue = { } - local already_queued = { } - - -- Convert a value to an identifier. If we encounter a table that we've never seen before, - -- it's an anonymous table and we'll create a name for it; for example, in t = { [ {10} ] = 1 }, - -- "{10}" has no name. - local next_id = 1 - local function convert_to_identifier( v, name ) - -- print("convert_to_identifier: " .. (name or "nil")) - if type(v) == "string" then - return string.format("%q", v) - elseif type(v) == "nil" then - return "nil" - elseif type(v) == "boolean" then - if v then return "true" end - return "false" - elseif type(v) == "number" then - return string.format("%i", v) - elseif type(v) == "table" then - if already_queued[v] then - return already_queued[v] - end - - -- Create the table. If we have no name, give it one; be sure to make it local. - if not name then - name = "tab" .. next_id - next_id = next_id + 1 - ret = ret .. "local " .. name .. " = { }\n" - else - -- The name is probably something like "x[1][2][3]", so don't emit "local". - ret = ret .. name .. " = { }\n" - end - - for i, tab in pairs(v) do - local to_fill = { ["name"] = name .. "[" .. convert_to_identifier(i) .. "]", with = tab } - table.insert( queue, to_fill ) - end - - already_queued[v] = name - return name - else - return '"UNSUPPORTED TYPE (' .. type(v) .. ')"', true - end - end - - local top_name = convert_to_identifier( t ) - - while table.getn(queue) > 0 do - local to_fill = table.remove( queue, 1 ) - local str = convert_to_identifier( to_fill.with, to_fill.name ) - -- Assign the result. If to_fill.with is a non-anonymous table, we just created - -- it ("ret[1] = { }"); don't redundantly write "ret[1] = ret[1]". - if to_fill.name ~= str then - ret = ret .. to_fill.name .. " = " .. str .. "\n" - end - end - ret = ret .. "return " .. top_name - return ret -end - --- Recursively deep-copy a table. -function DeepCopy(From, To, already_copied) - if not To then To = {} end - - already_copied = already_copied or { } - already_copied[From] = To - - for a, b in pairs(From) do - local aCopy, bCopy - if type(a) ~= "table" then - aCopy = a - elseif already_copied[a] then - aCopy = already_copied[a] - else - aCopy = {} - DeepCopy( a, aCopy, already_copied ) - end - - if type(b) ~= "table" then - bCopy = b - elseif already_copied[b] then - bCopy = already_copied[b] - else - bCopy = {} - DeepCopy( b, bCopy, already_copied ) - end - - To[aCopy] = bCopy - end - - return To -end - --- (c) 2005 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +-- Serialize the table "t". +function Serialize(t) + local ret = "" + local queue = { } + local already_queued = { } + + -- Convert a value to an identifier. If we encounter a table that we've never seen before, + -- it's an anonymous table and we'll create a name for it; for example, in t = { [ {10} ] = 1 }, + -- "{10}" has no name. + local next_id = 1 + local function convert_to_identifier( v, name ) + -- print("convert_to_identifier: " .. (name or "nil")) + if type(v) == "string" then + return string.format("%q", v) + elseif type(v) == "nil" then + return "nil" + elseif type(v) == "boolean" then + if v then return "true" end + return "false" + elseif type(v) == "number" then + return string.format("%i", v) + elseif type(v) == "table" then + if already_queued[v] then + return already_queued[v] + end + + -- Create the table. If we have no name, give it one; be sure to make it local. + if not name then + name = "tab" .. next_id + next_id = next_id + 1 + ret = ret .. "local " .. name .. " = { }\n" + else + -- The name is probably something like "x[1][2][3]", so don't emit "local". + ret = ret .. name .. " = { }\n" + end + + for i, tab in pairs(v) do + local to_fill = { ["name"] = name .. "[" .. convert_to_identifier(i) .. "]", with = tab } + table.insert( queue, to_fill ) + end + + already_queued[v] = name + return name + else + return '"UNSUPPORTED TYPE (' .. type(v) .. ')"', true + end + end + + local top_name = convert_to_identifier( t ) + + while table.getn(queue) > 0 do + local to_fill = table.remove( queue, 1 ) + local str = convert_to_identifier( to_fill.with, to_fill.name ) + -- Assign the result. If to_fill.with is a non-anonymous table, we just created + -- it ("ret[1] = { }"); don't redundantly write "ret[1] = ret[1]". + if to_fill.name ~= str then + ret = ret .. to_fill.name .. " = " .. str .. "\n" + end + end + ret = ret .. "return " .. top_name + return ret +end + +-- Recursively deep-copy a table. +function DeepCopy(From, To, already_copied) + if not To then To = {} end + + already_copied = already_copied or { } + already_copied[From] = To + + for a, b in pairs(From) do + local aCopy, bCopy + if type(a) ~= "table" then + aCopy = a + elseif already_copied[a] then + aCopy = already_copied[a] + else + aCopy = {} + DeepCopy( a, aCopy, already_copied ) + end + + if type(b) ~= "table" then + bCopy = b + elseif already_copied[b] then + bCopy = already_copied[b] + else + bCopy = {} + DeepCopy( b, bCopy, already_copied ) + end + + To[aCopy] = bCopy + end + + return To +end + +-- (c) 2005 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Sound.lua b/Themes/_fallback/Scripts/02 Sound.lua index d685247882..a67faa5bf3 100644 --- a/Themes/_fallback/Scripts/02 Sound.lua +++ b/Themes/_fallback/Scripts/02 Sound.lua @@ -1,32 +1,32 @@ --- Can this be moved into some other file? Feels like clutter. -shake --- Play the sound on the given player's side. Must set SupportPan = true --- on load. -function ActorSound:playforplayer(pn) - local fBalance = SOUND:GetPlayerBalance(pn) - self:get():SetProperty("Pan", fBalance) - self:play() -end - --- (c) 2007 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +-- Can this be moved into some other file? Feels like clutter. -shake +-- Play the sound on the given player's side. Must set SupportPan = true +-- on load. +function ActorSound:playforplayer(pn) + local fBalance = SOUND:GetPlayerBalance(pn) + self:get():SetProperty("Pan", fBalance) + self:play() +end + +-- (c) 2007 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Sprite.lua b/Themes/_fallback/Scripts/02 Sprite.lua index e532d1c4a5..8ed0e01862 100644 --- a/Themes/_fallback/Scripts/02 Sprite.lua +++ b/Themes/_fallback/Scripts/02 Sprite.lua @@ -1,89 +1,89 @@ -function Sprite:LoadFromSongBanner(song) - if song then - local Path = song:GetBannerPath() - if not Path then - Path = THEME:GetPathG("Common","fallback banner") - end - - self:LoadBanner( Path ) - else - self:LoadBanner( THEME:GetPathG("Common","fallback banner") ) - end -end - -function Sprite:LoadFromSongBackground(song) - local Path = song:GetBackgroundPath() - if not Path then - Path = THEME:GetPathG("Common","fallback background") - end - - self:LoadBackground( Path ) -end - -function LoadSongBackground() - return Def.Sprite { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y), - BeginCommand=cmd(LoadFromSongBackground,GAMESTATE:GetCurrentSong();scale_or_crop_background) - } -end - -function Sprite:LoadFromCurrentSongBackground() - local song = GAMESTATE:GetCurrentSong(); - if not song then - local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); - local e = trail:GetEntries() - if #e > 0 then - song = e[1]:GetSong(); - end - end - - if not song then return end - - self:LoadFromSongBackground(song); -end - -function Sprite:position( f ) - self:GetTexture():position( f ) -end - -function Sprite:loop( f ) - self:GetTexture():loop( f ) -end - -function Sprite:rate( f ) - self:GetTexture():rate( f ) -end - -function Sprite.LinearFrames(NumFrames, Seconds) - local Frames = {} - for i = 0,NumFrames-1 do - Frames[#Frames+1] = { - Frame = i, - Delay = (1/NumFrames)*Seconds - } - end - return Frames -end - --- (c) 2005 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +function Sprite:LoadFromSongBanner(song) + if song then + local Path = song:GetBannerPath() + if not Path then + Path = THEME:GetPathG("Common","fallback banner") + end + + self:LoadBanner( Path ) + else + self:LoadBanner( THEME:GetPathG("Common","fallback banner") ) + end +end + +function Sprite:LoadFromSongBackground(song) + local Path = song:GetBackgroundPath() + if not Path then + Path = THEME:GetPathG("Common","fallback background") + end + + self:LoadBackground( Path ) +end + +function LoadSongBackground() + return Def.Sprite { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y), + BeginCommand=cmd(LoadFromSongBackground,GAMESTATE:GetCurrentSong();scale_or_crop_background) + } +end + +function Sprite:LoadFromCurrentSongBackground() + local song = GAMESTATE:GetCurrentSong(); + if not song then + local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); + local e = trail:GetEntries() + if #e > 0 then + song = e[1]:GetSong(); + end + end + + if not song then return end + + self:LoadFromSongBackground(song); +end + +function Sprite:position( f ) + self:GetTexture():position( f ) +end + +function Sprite:loop( f ) + self:GetTexture():loop( f ) +end + +function Sprite:rate( f ) + self:GetTexture():rate( f ) +end + +function Sprite.LinearFrames(NumFrames, Seconds) + local Frames = {} + for i = 0,NumFrames-1 do + Frames[#Frames+1] = { + Frame = i, + Delay = (1/NumFrames)*Seconds + } + end + return Frames +end + +-- (c) 2005 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/02 StageMods.lua b/Themes/_fallback/Scripts/02 StageMods.lua index 742ed2fb14..294ccf6a76 100644 --- a/Themes/_fallback/Scripts/02 StageMods.lua +++ b/Themes/_fallback/Scripts/02 StageMods.lua @@ -1,112 +1,112 @@ -function AreStagePlayerModsForced() - local bExtraStage = GAMESTATE:IsAnExtraStage() - local bOni = GAMESTATE:GetPlayMode() == "PlayMode_Oni" - return bExtraStage or bOni -end - -function AreStageSongModsForced() - local bExtraStage = GAMESTATE:IsAnExtraStage() - local pm = GAMESTATE:GetPlayMode() - local bOni = pm == "PlayMode_Oni" - local bBattle = pm == "PlayMode_Battle" - local bRave = pm == "PlayMode_Rave" - return bExtraStage or bOni or bBattle or bRave -end - -function ScreenSelectMusic:setupmusicstagemods() - Trace( "setupmusicstagemods" ) - local pm = GAMESTATE:GetPlayMode() - - if pm == "PlayMode_Battle" or pm == "PlayMode_Rave" then - -- FIX DAT BUG; - local sFail = ""; - if GetGamePref("DefaultFail") then - sFail = string.format("Fail%s", GetGamePref("DefaultFail") ); - else - sFail = "Failoff"; - end; - -- - local so = GAMESTATE:GetDefaultSongOptions() .. "," .. sFail; - GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ); - MESSAGEMAN:Broadcast( "SongOptionsChanged" ); - elseif GAMESTATE:IsAnExtraStage() then - if GAMESTATE:GetPreferredSongGroup() == "---Group All---" then - local song = GAMESTATE:GetCurrentSong() - GAMESTATE:SetPreferredSongGroup( song:GetGroupName() ) - end - - local bExtra2 = GAMESTATE:IsExtraStage2() - local style = GAMESTATE:GetCurrentStyle() - local song, steps = SONGMAN:GetExtraStageInfo( bExtra2, style ) - local po, so - if bExtra2 then - po = THEME:GetMetric("SongManager","OMESPlayerModifiers"); - so = THEME:GetMetric("SongManager","OMESStageModifiers"); - else - po = THEME:GetMetric("SongManager","ExtraStagePlayerModifiers"); - so = THEME:GetMetric("SongManager","ExtraStageStageModifiers"); - end - local difficulty = steps:GetDifficulty() - local Reverse = PlayerNumber:Reverse() - - GAMESTATE:SetCurrentSong( song ) - GAMESTATE:SetPreferredSong( song ) - - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - GAMESTATE:SetCurrentSteps( pn, steps ) - GAMESTATE:GetPlayerState(pn):SetPlayerOptions( "ModsLevel_Stage", po ) - GAMESTATE:SetPreferredDifficulty( pn, difficulty ) - MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} ) - end - - - - GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) - MESSAGEMAN:Broadcast( "SongOptionsChanged" ) - end -end - -function ScreenSelectMusic:setupcoursestagemods() - local mode = GAMESTATE:GetPlayMode() - - if mode == "PlayMode_Oni" then - local po = "clearall,default" - -- Let SSMusic set battery. - -- local so = "failimmediate,battery" - local so = "failimmediate" - local Reverse = PlayerNumber:Reverse() - - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - GAMESTATE:GetPlayerState(pn):SetPlayerOptions( "ModsLevel_Stage", po ) - MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} ) - end - - GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) - MESSAGEMAN:Broadcast( "SongOptionsChanged" ) - end -end - --- --- (c) 2006-2007 Steve Checkoway --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +function AreStagePlayerModsForced() + local bExtraStage = GAMESTATE:IsAnExtraStage() + local bOni = GAMESTATE:GetPlayMode() == "PlayMode_Oni" + return bExtraStage or bOni +end + +function AreStageSongModsForced() + local bExtraStage = GAMESTATE:IsAnExtraStage() + local pm = GAMESTATE:GetPlayMode() + local bOni = pm == "PlayMode_Oni" + local bBattle = pm == "PlayMode_Battle" + local bRave = pm == "PlayMode_Rave" + return bExtraStage or bOni or bBattle or bRave +end + +function ScreenSelectMusic:setupmusicstagemods() + Trace( "setupmusicstagemods" ) + local pm = GAMESTATE:GetPlayMode() + + if pm == "PlayMode_Battle" or pm == "PlayMode_Rave" then + -- FIX DAT BUG; + local sFail = ""; + if GetGamePref("DefaultFail") then + sFail = string.format("Fail%s", GetGamePref("DefaultFail") ); + else + sFail = "Failoff"; + end; + -- + local so = GAMESTATE:GetDefaultSongOptions() .. "," .. sFail; + GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ); + MESSAGEMAN:Broadcast( "SongOptionsChanged" ); + elseif GAMESTATE:IsAnExtraStage() then + if GAMESTATE:GetPreferredSongGroup() == "---Group All---" then + local song = GAMESTATE:GetCurrentSong() + GAMESTATE:SetPreferredSongGroup( song:GetGroupName() ) + end + + local bExtra2 = GAMESTATE:IsExtraStage2() + local style = GAMESTATE:GetCurrentStyle() + local song, steps = SONGMAN:GetExtraStageInfo( bExtra2, style ) + local po, so + if bExtra2 then + po = THEME:GetMetric("SongManager","OMESPlayerModifiers"); + so = THEME:GetMetric("SongManager","OMESStageModifiers"); + else + po = THEME:GetMetric("SongManager","ExtraStagePlayerModifiers"); + so = THEME:GetMetric("SongManager","ExtraStageStageModifiers"); + end + local difficulty = steps:GetDifficulty() + local Reverse = PlayerNumber:Reverse() + + GAMESTATE:SetCurrentSong( song ) + GAMESTATE:SetPreferredSong( song ) + + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + GAMESTATE:SetCurrentSteps( pn, steps ) + GAMESTATE:GetPlayerState(pn):SetPlayerOptions( "ModsLevel_Stage", po ) + GAMESTATE:SetPreferredDifficulty( pn, difficulty ) + MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} ) + end + + + + GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) + MESSAGEMAN:Broadcast( "SongOptionsChanged" ) + end +end + +function ScreenSelectMusic:setupcoursestagemods() + local mode = GAMESTATE:GetPlayMode() + + if mode == "PlayMode_Oni" then + local po = "clearall,default" + -- Let SSMusic set battery. + -- local so = "failimmediate,battery" + local so = "failimmediate" + local Reverse = PlayerNumber:Reverse() + + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + GAMESTATE:GetPlayerState(pn):SetPlayerOptions( "ModsLevel_Stage", po ) + MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} ) + end + + GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) + MESSAGEMAN:Broadcast( "SongOptionsChanged" ) + end +end + +-- +-- (c) 2006-2007 Steve Checkoway +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/02 Utilities.lua b/Themes/_fallback/Scripts/02 Utilities.lua index 616b14ea21..e649b68b1e 100644 --- a/Themes/_fallback/Scripts/02 Utilities.lua +++ b/Themes/_fallback/Scripts/02 Utilities.lua @@ -1,207 +1,207 @@ --- Find a key in tab with the given value. -function FindValue(tab, value) - for key, name in tab do - if value == name then - return key - end - end - - return nil -end - --- Return the index of a true value in list. -function FindSelection( list ) - for index, on in list do - if on then - return index - end - end - - return nil -end - --- Look up each value in a table, returning a table with the resulting strings. -function TableStringLookup( t, group ) - local ret = { } - for key, val in t do - Trace(val) - ret[key] = THEME:GetString(group,val) - end - return ret -end - -function split( delimiter, text ) - local list = {} - local pos = 1 - while 1 do - local first,last = string.find( text, delimiter, pos ) - if first then - table.insert( list, string.sub(text, pos, first-1) ) - pos = last+1 - else - table.insert( list, string.sub(text, pos) ) - break - end - end - return list -end - -function join( delimiter, list ) - local ret = list[1] - for i = 2,table.getn(list) do - ret = ret .. delimiter .. list[i] - end - return ret or "" -end - -function wrap(val,n) - local x = val - Trace( "wrap "..x.." "..n ) - if x<0 then - x = x + (math.ceil(-x/n)+1)*n - end - Trace( "adjusted "..x ) - local ret = math.mod(x,n) - Trace( "ret "..ret ) - return ret -end - -function fapproach( val, other_val, to_move ) - if val == other_val then - return val -- already done! - end - - local delta = other_val - val - local sign = delta / math.abs(delta) - local toMove = sign*to_move - - if math.abs(toMove) > math.abs(delta) then - toMove = delta -- snap - end - - val = val + toMove - return val -end - -function tableshuffle( t ) - local ret = { } - for i=1,table.getn(t) do - table.insert( ret, math.random(i), t[i] ) - end - return ret -end -table.shuffle = tableshuffle - -function tableslice( t, num ) - local ret = { } - for i=1,table.getn(t) do - table.insert( ret, i, t[i] ) - end - return ret -end -table.slice = tableslice - --- add together the contents of a table -function table.sum( t ) - local sum = 0 - for i=1,#t do - sum = sum + t[i] - end - return sum -end - --- average of all table values -function table.average( t ) - return table.sum( t ) / #t -end - --- furthest value from the average of a given table -function table.deviation( t ) - local offset = math.abs(table.average(t)) - for i=1,#t do - offset = math.max(math.abs(t[i]), offset) - end - return offset -end --- See if this exists -function table.search( t, sFind ) - for i=1,#t do - if t[i] == sFind then - return true - end - end -end --- Retreive the entry that has this -function table.find( t, sFind ) - for i=1,#t do - if t[i] == sFind then - return i - end - end -end - -function round(val, decimal) - if (decimal) then - return math.floor( (val * 10^decimal) + 0.5) / (10^decimal) - else - return math.floor(val+0.5) - end -end - -function GetRandomSongBackground() - for i=0,50 do - local song = SONGMAN:GetRandomSong() - if song then - local path = song:GetBackgroundPath() - if path then - return path - end - end - end - return THEME:GetPathG("", "_blank") -end - -function GetSongBackground() - local song = GAMESTATE:GetCurrentSong() - if song then - local path = song:GetBackgroundPath() - if path then - return path - end - end - return THEME:GetPathG("Common","fallback background") -end - -function StepsOrTrailToCustomDifficulty( stepsOrTrail ) - if lua.CheckType("Steps", stepsOrTrail) then - return StepsToCustomDifficulty( stepsOrTrail ) - end - if lua.CheckType("Trail", stepsOrTrail) then - return TrailToCustomDifficulty( stepsOrTrail ) - end -end - - --- (c) 2005 Glenn Maynard, Chris Danford --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +-- Find a key in tab with the given value. +function FindValue(tab, value) + for key, name in tab do + if value == name then + return key + end + end + + return nil +end + +-- Return the index of a true value in list. +function FindSelection( list ) + for index, on in list do + if on then + return index + end + end + + return nil +end + +-- Look up each value in a table, returning a table with the resulting strings. +function TableStringLookup( t, group ) + local ret = { } + for key, val in t do + Trace(val) + ret[key] = THEME:GetString(group,val) + end + return ret +end + +function split( delimiter, text ) + local list = {} + local pos = 1 + while 1 do + local first,last = string.find( text, delimiter, pos ) + if first then + table.insert( list, string.sub(text, pos, first-1) ) + pos = last+1 + else + table.insert( list, string.sub(text, pos) ) + break + end + end + return list +end + +function join( delimiter, list ) + local ret = list[1] + for i = 2,table.getn(list) do + ret = ret .. delimiter .. list[i] + end + return ret or "" +end + +function wrap(val,n) + local x = val + Trace( "wrap "..x.." "..n ) + if x<0 then + x = x + (math.ceil(-x/n)+1)*n + end + Trace( "adjusted "..x ) + local ret = math.mod(x,n) + Trace( "ret "..ret ) + return ret +end + +function fapproach( val, other_val, to_move ) + if val == other_val then + return val -- already done! + end + + local delta = other_val - val + local sign = delta / math.abs(delta) + local toMove = sign*to_move + + if math.abs(toMove) > math.abs(delta) then + toMove = delta -- snap + end + + val = val + toMove + return val +end + +function tableshuffle( t ) + local ret = { } + for i=1,table.getn(t) do + table.insert( ret, math.random(i), t[i] ) + end + return ret +end +table.shuffle = tableshuffle + +function tableslice( t, num ) + local ret = { } + for i=1,table.getn(t) do + table.insert( ret, i, t[i] ) + end + return ret +end +table.slice = tableslice + +-- add together the contents of a table +function table.sum( t ) + local sum = 0 + for i=1,#t do + sum = sum + t[i] + end + return sum +end + +-- average of all table values +function table.average( t ) + return table.sum( t ) / #t +end + +-- furthest value from the average of a given table +function table.deviation( t ) + local offset = math.abs(table.average(t)) + for i=1,#t do + offset = math.max(math.abs(t[i]), offset) + end + return offset +end +-- See if this exists +function table.search( t, sFind ) + for i=1,#t do + if t[i] == sFind then + return true + end + end +end +-- Retreive the entry that has this +function table.find( t, sFind ) + for i=1,#t do + if t[i] == sFind then + return i + end + end +end + +function round(val, decimal) + if (decimal) then + return math.floor( (val * 10^decimal) + 0.5) / (10^decimal) + else + return math.floor(val+0.5) + end +end + +function GetRandomSongBackground() + for i=0,50 do + local song = SONGMAN:GetRandomSong() + if song then + local path = song:GetBackgroundPath() + if path then + return path + end + end + end + return THEME:GetPathG("", "_blank") +end + +function GetSongBackground() + local song = GAMESTATE:GetCurrentSong() + if song then + local path = song:GetBackgroundPath() + if path then + return path + end + end + return THEME:GetPathG("Common","fallback background") +end + +function StepsOrTrailToCustomDifficulty( stepsOrTrail ) + if lua.CheckType("Steps", stepsOrTrail) then + return StepsToCustomDifficulty( stepsOrTrail ) + end + if lua.CheckType("Trail", stepsOrTrail) then + return TrailToCustomDifficulty( stepsOrTrail ) + end +end + + +-- (c) 2005 Glenn Maynard, Chris Danford +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_fallback/Scripts/03 CustomSpeedMods.lua b/Themes/_fallback/Scripts/03 CustomSpeedMods.lua index 87275c6ec2..af8806d129 100644 --- a/Themes/_fallback/Scripts/03 CustomSpeedMods.lua +++ b/Themes/_fallback/Scripts/03 CustomSpeedMods.lua @@ -1,311 +1,311 @@ ---[[ -Custom Speed Mods v2.0 (for sm-ssc) -by AJ Kelly of KKI Labs ( http://kki.ajworld.net/ ) - -changelog: - -v2.0 (for sm-ssc) -Giant rewrite of the speed mod parser. -This rewrite comes with the following changes/features: -* Speed mods are now tied to profiles. - This is arguably the biggest change, as it allows the speed mods to be - portable, as well as per-profile. - Thanks to this, we can now support reading SpeedMods from a USB stick or - other external storage. (I didn't test writing yet, but it should work.) - -* Data/SpeedMods.txt is the fallback. - Previously, all speed mods were stored in {SM4 folder}/Data/SpeedMods.txt. - For compatibility reasons, this file is still read by the script. - -This version of Custom Speed Mods will only run on sm-ssc for the time being, -DO NOT use it in themes for StepMania 4 alpha versions. --------------------------------------------------------------------------------- -v1.4 -* Try to auto-set the speed mod to 1.0 if: - 1) The player hasn't already chosen a speed mod - 2) The player's custom speed mod collection starts with a value under 1x. - Due to the way the custom speed mods were coded, it will always pick the - first value, even if it's not 1.0x. - -v1.3 -* strip whitespace out of file in case people use it. - (I don't think it really works but SM seems to think the mods are legal) -* fixed an error related to using the fallback return value. - -v1.2 -* small fixes -* more comments - -v1.1 -* Cleaned up code some, I think. -________________________________________________________________________________ -anticipated future changes: -* M-Mod support (when sm-ssc imntegrates it) -]] - --- ProfileDir(slot): gets the profile dir for slot, --- where slot is a 'ProfileSlot_*' enum value. -local function ProfileDir(slot) - local profileDir = PROFILEMAN:GetProfileDir(slot) - return profileDir or nil -end - --- Tries to parse the file at path. If successful, returns a table of mods. --- If it can't open the file, it will write a fallback set of mods. -local function ParseSpeedModFile(path) - local file = RageFileUtil.CreateRageFile() - if file:Open(path, 1) then - -- success - local contents = file:Read() - mods = split(',',contents) - - -- strip any whitespace - for i=1,#mods do - string.gsub(mods[i], "%s", "") - end - - file:destroy() - return mods - else - -- error; write a fallback mod file and return it - local fallbackString = "0.5x,0.75x,1x,1.75x,2x,2.25x,2.5x,C150,C300" - Trace("[CustomSpeedMods]: Could not read SpeedMods; writing fallback to "..path) - file:Open(path, 2) - file:Write(fallbackString) - file:destroy() - return split(',',fallbackString) - end -end - --- MarkDupes(src,parent) --- Marks duplicates in src from any matches in parent. --- the overall mods are usually used as the parent. -local function MarkDupes(src,parent) - for iPar=1,#parent do - for iSrc=1,#src do - if parent[iPar] == src[iSrc] then - src[iSrc] = "XXX" - end - end - end - return src -end - --- RemoveMarked(src) --- Removes any values marked for deletion. -local function RemoveMarked(src) - for iSrc=1,#src do - if src[iSrc] == "XXX" then - table.remove(src,iSrc) - end - end - return src -end - --- MergeTables(parent,child) --- Adds the child's contents to the parent. --- the overall mods are usually used as the parent. -local function MergeTables(parent,child) - child = RemoveMarked(child) - if #child == 0 then - return parent - end - - local addMe = true - for iC=1,#child do - --[[ - for iP=1,#parent do - if addMe then - -- check if that's the case. - -- why am I doing this anyways? - -- by the time these tables are passed in, - -- dupes should be gone. - end - end - ]] - if addMe then - table.insert(parent,child[iC]) - end - end - return parent -end - --- code in this function is based off of code in --- http://astrofra.com/weblog/files/sort.lua -local function AnonSort(t) - local index_min - for i=1,#t,1 do - index_min = i - for j=i+1,#t,1 do - if (t[j] < t[index_min]) then - index_min = j - end - end - t[i], t[index_min] = t[index_min], t[i] - end - return t -end - -local function SpeedModSort(tab) - local xMods = {} - local cMods = {} - --local mMods = {} - - -- convert to numbers so sorting works: - for i=1,#tab do - local typ,val - -- xxx: If people use a floating point CMod (e.g. C420.50), - -- it will get rounded. C420.50 gets rounded to 421, btw. -aj - if string.find(tab[i],"C%d") then - typ = cMods - val = string.gsub(tab[i], "C", "") - elseif string.find(tab[i],"M%d") then - Trace("[CustomSpeedMods] OpenITG's M-Mods are not supported yet in sm-ssc.") - --typ = mMods - --val = string.gsub(tab[i], "M", "") - else - typ = xMods - val = string.gsub(tab[i], "x", "") - end - table.insert(typ,tonumber(val)) - end - - -- sort xMods - xMods = AnonSort(xMods) - -- sort cMods - cMods = AnonSort(cMods) - -- sort mMods - --mMods = AnonSort(mMods) - local fin = {} - -- convert it back to a string since that's what it expects - for i=1,#xMods do - table.insert(fin, xMods[i].."x") - end - for i=1,#cMods do - table.insert(fin, "C"..cMods[i]) - end - --for i=1,#mMods do table.insert(fin, "M"..mMods[i]); end; - return fin -end - --- parse everything -local function GetSpeedMods() - local finalMods = {} - - local baseFilename = "SpeedMods.txt" - local profileDirs = { - Fallback = "Data/", - Machine = ProfileDir('ProfileSlot_Machine'), - PlayerNumber_P1 = ProfileDir('ProfileSlot_Player1'), - PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2') - } - - -- figure out how many players we have to deal with. - local numPlayers = GAMESTATE:GetNumPlayersEnabled() - -- load fallback - local fallbackMods = ParseSpeedModFile(profileDirs.Fallback..baseFilename) - - -- load machine - local machineMods = ParseSpeedModFile(profileDirs.Machine..baseFilename) - - local playerMods = {} - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - -- file loading logic per player; - -- only bother if it's not the machine profile though. - if PROFILEMAN:IsPersistentProfile(pn) or - MEMCARDMAN:GetCardState(pn) == 'MemoryCardState_ready' then - playerMods[#playerMods+1] = ParseSpeedModFile(profileDirs[pn]..baseFilename) - end - end - - -- with all loaded... the merging BEGINS!! - finalMods = fallbackMods - -- mine for duplicates, first pass (fallback <-> machine) - machineMods = MarkDupes(machineMods,finalMods) - for ply=1,#playerMods do - playerMods[ply] = MarkDupes(playerMods[ply],finalMods) - end - -- remove XXX, first pass - machineMods = RemoveMarked(machineMods); - for ply=1,#playerMods do - playerMods[ply] = RemoveMarked(playerMods[ply]) - end - -- mine for duplicates, second pass (machine <-> player) - for ply=1,#playerMods do - playerMods[ply] = MarkDupes(playerMods[ply],machineMods) - end - -- remove XXX, second pass - machineMods = RemoveMarked(machineMods) - for ply=1,#playerMods do - playerMods[ply] = RemoveMarked(playerMods[ply]) - end - - -- merge zone - finalMods = MergeTables(finalMods,machineMods) - for ply=1,#playerMods do - finalMods = MergeTables(finalMods,playerMods[ply]) - end - - -- final removal of XXX before sorting - finalMods = RemoveMarked(finalMods) - -- sort the mods before returning them - return SpeedModSort(finalMods) -end - -function SpeedMods() - -- here we see the option menu itself. - local t = { - Name = "Speed", - LayoutType = "ShowAllInRow", - SelectType = "SelectOne", - OneChoiceForAllPlayers = false, - ExportOnChange = false, - Choices = GetSpeedMods(), - - LoadSelections = function(self, list, pn) - local pMods = GAMESTATE:GetPlayerState(pn):GetPlayerOptionsString("ModsLevel_Preferred") - for i = 1,table.getn(self.Choices) do - if string.find(pMods, self.Choices[i]) then - list[i] = true - return - end - end - - -- if we've reached this point, try to find 1x or 1.0x instead, - -- in case the player has defined a speed mod under 1.0x - for i = 1,table.getn(self.Choices) do - if self.Choices[i] == "1x" or self.Choices[i] == "1.0x" then - list[i] = true - return - end - end - end, - SaveSelections = function(self, list, pn) - for i = 1,table.getn(self.Choices) do - if list[i] then - local PlayerState = GAMESTATE:GetPlayerState(pn) - PlayerState:SetPlayerOptions("ModsLevel_Preferred",self.Choices[i]) - return - end - end - end - } - setmetatable( t, t ) - return t -end - ---[[ -Copyright 2008-2009 AJ Kelly/KKI Labs. -Use freely, so long this notice and the above documentation remains. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--[[ +Custom Speed Mods v2.0 (for sm-ssc) +by AJ Kelly of KKI Labs ( http://kki.ajworld.net/ ) + +changelog: + +v2.0 (for sm-ssc) +Giant rewrite of the speed mod parser. +This rewrite comes with the following changes/features: +* Speed mods are now tied to profiles. + This is arguably the biggest change, as it allows the speed mods to be + portable, as well as per-profile. + Thanks to this, we can now support reading SpeedMods from a USB stick or + other external storage. (I didn't test writing yet, but it should work.) + +* Data/SpeedMods.txt is the fallback. + Previously, all speed mods were stored in {SM4 folder}/Data/SpeedMods.txt. + For compatibility reasons, this file is still read by the script. + +This version of Custom Speed Mods will only run on sm-ssc for the time being, +DO NOT use it in themes for StepMania 4 alpha versions. +-------------------------------------------------------------------------------- +v1.4 +* Try to auto-set the speed mod to 1.0 if: + 1) The player hasn't already chosen a speed mod + 2) The player's custom speed mod collection starts with a value under 1x. + Due to the way the custom speed mods were coded, it will always pick the + first value, even if it's not 1.0x. + +v1.3 +* strip whitespace out of file in case people use it. + (I don't think it really works but SM seems to think the mods are legal) +* fixed an error related to using the fallback return value. + +v1.2 +* small fixes +* more comments + +v1.1 +* Cleaned up code some, I think. +________________________________________________________________________________ +anticipated future changes: +* M-Mod support (when sm-ssc imntegrates it) +]] + +-- ProfileDir(slot): gets the profile dir for slot, +-- where slot is a 'ProfileSlot_*' enum value. +local function ProfileDir(slot) + local profileDir = PROFILEMAN:GetProfileDir(slot) + return profileDir or nil +end + +-- Tries to parse the file at path. If successful, returns a table of mods. +-- If it can't open the file, it will write a fallback set of mods. +local function ParseSpeedModFile(path) + local file = RageFileUtil.CreateRageFile() + if file:Open(path, 1) then + -- success + local contents = file:Read() + mods = split(',',contents) + + -- strip any whitespace + for i=1,#mods do + string.gsub(mods[i], "%s", "") + end + + file:destroy() + return mods + else + -- error; write a fallback mod file and return it + local fallbackString = "0.5x,0.75x,1x,1.75x,2x,2.25x,2.5x,C150,C300" + Trace("[CustomSpeedMods]: Could not read SpeedMods; writing fallback to "..path) + file:Open(path, 2) + file:Write(fallbackString) + file:destroy() + return split(',',fallbackString) + end +end + +-- MarkDupes(src,parent) +-- Marks duplicates in src from any matches in parent. +-- the overall mods are usually used as the parent. +local function MarkDupes(src,parent) + for iPar=1,#parent do + for iSrc=1,#src do + if parent[iPar] == src[iSrc] then + src[iSrc] = "XXX" + end + end + end + return src +end + +-- RemoveMarked(src) +-- Removes any values marked for deletion. +local function RemoveMarked(src) + for iSrc=1,#src do + if src[iSrc] == "XXX" then + table.remove(src,iSrc) + end + end + return src +end + +-- MergeTables(parent,child) +-- Adds the child's contents to the parent. +-- the overall mods are usually used as the parent. +local function MergeTables(parent,child) + child = RemoveMarked(child) + if #child == 0 then + return parent + end + + local addMe = true + for iC=1,#child do + --[[ + for iP=1,#parent do + if addMe then + -- check if that's the case. + -- why am I doing this anyways? + -- by the time these tables are passed in, + -- dupes should be gone. + end + end + ]] + if addMe then + table.insert(parent,child[iC]) + end + end + return parent +end + +-- code in this function is based off of code in +-- http://astrofra.com/weblog/files/sort.lua +local function AnonSort(t) + local index_min + for i=1,#t,1 do + index_min = i + for j=i+1,#t,1 do + if (t[j] < t[index_min]) then + index_min = j + end + end + t[i], t[index_min] = t[index_min], t[i] + end + return t +end + +local function SpeedModSort(tab) + local xMods = {} + local cMods = {} + --local mMods = {} + + -- convert to numbers so sorting works: + for i=1,#tab do + local typ,val + -- xxx: If people use a floating point CMod (e.g. C420.50), + -- it will get rounded. C420.50 gets rounded to 421, btw. -aj + if string.find(tab[i],"C%d") then + typ = cMods + val = string.gsub(tab[i], "C", "") + elseif string.find(tab[i],"M%d") then + Trace("[CustomSpeedMods] OpenITG's M-Mods are not supported yet in sm-ssc.") + --typ = mMods + --val = string.gsub(tab[i], "M", "") + else + typ = xMods + val = string.gsub(tab[i], "x", "") + end + table.insert(typ,tonumber(val)) + end + + -- sort xMods + xMods = AnonSort(xMods) + -- sort cMods + cMods = AnonSort(cMods) + -- sort mMods + --mMods = AnonSort(mMods) + local fin = {} + -- convert it back to a string since that's what it expects + for i=1,#xMods do + table.insert(fin, xMods[i].."x") + end + for i=1,#cMods do + table.insert(fin, "C"..cMods[i]) + end + --for i=1,#mMods do table.insert(fin, "M"..mMods[i]); end; + return fin +end + +-- parse everything +local function GetSpeedMods() + local finalMods = {} + + local baseFilename = "SpeedMods.txt" + local profileDirs = { + Fallback = "Data/", + Machine = ProfileDir('ProfileSlot_Machine'), + PlayerNumber_P1 = ProfileDir('ProfileSlot_Player1'), + PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2') + } + + -- figure out how many players we have to deal with. + local numPlayers = GAMESTATE:GetNumPlayersEnabled() + -- load fallback + local fallbackMods = ParseSpeedModFile(profileDirs.Fallback..baseFilename) + + -- load machine + local machineMods = ParseSpeedModFile(profileDirs.Machine..baseFilename) + + local playerMods = {} + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + -- file loading logic per player; + -- only bother if it's not the machine profile though. + if PROFILEMAN:IsPersistentProfile(pn) or + MEMCARDMAN:GetCardState(pn) == 'MemoryCardState_ready' then + playerMods[#playerMods+1] = ParseSpeedModFile(profileDirs[pn]..baseFilename) + end + end + + -- with all loaded... the merging BEGINS!! + finalMods = fallbackMods + -- mine for duplicates, first pass (fallback <-> machine) + machineMods = MarkDupes(machineMods,finalMods) + for ply=1,#playerMods do + playerMods[ply] = MarkDupes(playerMods[ply],finalMods) + end + -- remove XXX, first pass + machineMods = RemoveMarked(machineMods); + for ply=1,#playerMods do + playerMods[ply] = RemoveMarked(playerMods[ply]) + end + -- mine for duplicates, second pass (machine <-> player) + for ply=1,#playerMods do + playerMods[ply] = MarkDupes(playerMods[ply],machineMods) + end + -- remove XXX, second pass + machineMods = RemoveMarked(machineMods) + for ply=1,#playerMods do + playerMods[ply] = RemoveMarked(playerMods[ply]) + end + + -- merge zone + finalMods = MergeTables(finalMods,machineMods) + for ply=1,#playerMods do + finalMods = MergeTables(finalMods,playerMods[ply]) + end + + -- final removal of XXX before sorting + finalMods = RemoveMarked(finalMods) + -- sort the mods before returning them + return SpeedModSort(finalMods) +end + +function SpeedMods() + -- here we see the option menu itself. + local t = { + Name = "Speed", + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = false, + ExportOnChange = false, + Choices = GetSpeedMods(), + + LoadSelections = function(self, list, pn) + local pMods = GAMESTATE:GetPlayerState(pn):GetPlayerOptionsString("ModsLevel_Preferred") + for i = 1,table.getn(self.Choices) do + if string.find(pMods, self.Choices[i]) then + list[i] = true + return + end + end + + -- if we've reached this point, try to find 1x or 1.0x instead, + -- in case the player has defined a speed mod under 1.0x + for i = 1,table.getn(self.Choices) do + if self.Choices[i] == "1x" or self.Choices[i] == "1.0x" then + list[i] = true + return + end + end + end, + SaveSelections = function(self, list, pn) + for i = 1,table.getn(self.Choices) do + if list[i] then + local PlayerState = GAMESTATE:GetPlayerState(pn) + PlayerState:SetPlayerOptions("ModsLevel_Preferred",self.Choices[i]) + return + end + end + end + } + setmetatable( t, t ) + return t +end + +--[[ +Copyright 2008-2009 AJ Kelly/KKI Labs. +Use freely, so long this notice and the above documentation remains. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 DateTime.lua b/Themes/_fallback/Scripts/03 DateTime.lua index fd743c327f..65bd6e303c 100644 --- a/Themes/_fallback/Scripts/03 DateTime.lua +++ b/Themes/_fallback/Scripts/03 DateTime.lua @@ -1,70 +1,70 @@ --- freem, inc. DateTime for StepMania --- todo: accept format parameters for things - --- reference: http://us.php.net/manual/en/function.date.php -local dateChars = { - --[[ day ]] - 'd', -- Day of the month, 2 digits with leading zeros (01-31) - 'D', -- A textual representation of a day, three letters ("Mon"-"Sun") - 'j', -- Day of the month without leading zeros (1-31) - 'l', -- A full textual representation of the day of the week - 'N', -- ISO-8601 numeric representation of the day of the week (1=Mon,7=Sun) - 'S', -- English ordinal suffix for the day of the month, 2 characters - 'w', -- Numeric representation of the day of the week (0=Sun,6=Sat) - 'z', -- The day of the year (0-365) - --[[ week ]] - 'W', -- ISO-8601 week number of year, weeks starting on Monday - --[[ month ]] - 'F', -- A full textual representation of a month, such as January or March - 'm', -- Numeric representation of a month, with leading zeros - 'M', -- A short textual representation of a month, three letters - 'n', -- Numeric representation of a month, without leading zeros - 't', -- Number of days in the given month - --[[ year ]] - 'L', -- Whether it's a leap year (1 or 0) - 'o', -- (sux) ISO-8601 year number - 'Y', -- A full numeric representation of a year, 4 digits - 'y', -- (sux) A two digit representation of a year - --[[ time ]] - 'a', -- Lowercase Ante meridiem and Post meridiem - 'A', -- Uppercase Ante meridiem and Post meridiem - 'B', -- Swatch Beats - 'g', -- 12-hour format of an hour without leading zeros - 'G', -- 24-hour format of an hour without leading zeros - 'h', -- 12-hour format of an hour with leading zeros - 'H', -- 24-hour format of an hour with leading zeros - 'i', -- Minutes with leading zeros - 's', -- Seconds, with leading zeros - 'u', -- Microseconds - --[[ timezone ]] - 'e', -- Timezone identifier - 'I', -- Whether or not the date is in daylight saving time - 'O', -- Difference to Greenwich time (GMT) in hours - 'P', -- Difference to Greenwich time (GMT) with colon between hours and minutes - 'T', -- Timezone abbreviation - 'Z', -- Timezone offset in seconds. - --[[ full datetime ]] - 'c', -- ISO 8601 date - 'r', -- RFC 2822 formatted date - 'U' -- Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) -} - -function date(format,...) - if ... then - -- convert value - else - -- convert current time - end -end - -Date = { - Today = function() - return string.format("%i%02i%02i", Year(), (MonthOfYear()+1), DayOfMonth()) - end -} - -Time = { - Now = function() - return string.format( "%02i:%02i:%02i", Hour(), Minute(), Second() ) - end +-- freem, inc. DateTime for StepMania +-- todo: accept format parameters for things + +-- reference: http://us.php.net/manual/en/function.date.php +local dateChars = { + --[[ day ]] + 'd', -- Day of the month, 2 digits with leading zeros (01-31) + 'D', -- A textual representation of a day, three letters ("Mon"-"Sun") + 'j', -- Day of the month without leading zeros (1-31) + 'l', -- A full textual representation of the day of the week + 'N', -- ISO-8601 numeric representation of the day of the week (1=Mon,7=Sun) + 'S', -- English ordinal suffix for the day of the month, 2 characters + 'w', -- Numeric representation of the day of the week (0=Sun,6=Sat) + 'z', -- The day of the year (0-365) + --[[ week ]] + 'W', -- ISO-8601 week number of year, weeks starting on Monday + --[[ month ]] + 'F', -- A full textual representation of a month, such as January or March + 'm', -- Numeric representation of a month, with leading zeros + 'M', -- A short textual representation of a month, three letters + 'n', -- Numeric representation of a month, without leading zeros + 't', -- Number of days in the given month + --[[ year ]] + 'L', -- Whether it's a leap year (1 or 0) + 'o', -- (sux) ISO-8601 year number + 'Y', -- A full numeric representation of a year, 4 digits + 'y', -- (sux) A two digit representation of a year + --[[ time ]] + 'a', -- Lowercase Ante meridiem and Post meridiem + 'A', -- Uppercase Ante meridiem and Post meridiem + 'B', -- Swatch Beats + 'g', -- 12-hour format of an hour without leading zeros + 'G', -- 24-hour format of an hour without leading zeros + 'h', -- 12-hour format of an hour with leading zeros + 'H', -- 24-hour format of an hour with leading zeros + 'i', -- Minutes with leading zeros + 's', -- Seconds, with leading zeros + 'u', -- Microseconds + --[[ timezone ]] + 'e', -- Timezone identifier + 'I', -- Whether or not the date is in daylight saving time + 'O', -- Difference to Greenwich time (GMT) in hours + 'P', -- Difference to Greenwich time (GMT) with colon between hours and minutes + 'T', -- Timezone abbreviation + 'Z', -- Timezone offset in seconds. + --[[ full datetime ]] + 'c', -- ISO 8601 date + 'r', -- RFC 2822 formatted date + 'U' -- Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) +} + +function date(format,...) + if ... then + -- convert value + else + -- convert current time + end +end + +Date = { + Today = function() + return string.format("%i%02i%02i", Year(), (MonthOfYear()+1), DayOfMonth()) + end +} + +Time = { + Now = function() + return string.format( "%02i:%02i:%02i", Hour(), Minute(), Second() ) + end } \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 EnvUtils2.lua b/Themes/_fallback/Scripts/03 EnvUtils2.lua index 790b27e8bc..9df8fefad1 100644 --- a/Themes/_fallback/Scripts/03 EnvUtils2.lua +++ b/Themes/_fallback/Scripts/03 EnvUtils2.lua @@ -1,44 +1,44 @@ ---[[ -EnvUtils2: Environmental Variable Utilities -Written by AJ Kelly of KKI Labs / Version 2.0 - -This code is a rewrite of what typically exists in EnvUtils.lua -(as seen in dubaiOne), hereafter referred to as EnvUtils1. - -I felt it was time for a simplification of the code. -This new version should also work better and be less confusing. ---]] - --- Env table global -envTable = GAMESTATE:Env() - --- setenv(name,value) --- Sets aside an entry for /name/ and puts /value/ into it. --- Unlike EnvUtils1, this is the only setenv function available to you. --- If you need to store more than one value, you're welcome to use a --- table as /value/, it should work just fine. -function setenv(name,value) - envTable[name] = value -end - --- getenv(name) --- This will return whatever value is at envTable[name]. -function getenv(name) - return envTable[name] -end - ---[[ -Copyright 2008 AJ Kelly/KKI Labs -Use freely. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--[[ +EnvUtils2: Environmental Variable Utilities +Written by AJ Kelly of KKI Labs / Version 2.0 + +This code is a rewrite of what typically exists in EnvUtils.lua +(as seen in dubaiOne), hereafter referred to as EnvUtils1. + +I felt it was time for a simplification of the code. +This new version should also work better and be less confusing. +--]] + +-- Env table global +envTable = GAMESTATE:Env() + +-- setenv(name,value) +-- Sets aside an entry for /name/ and puts /value/ into it. +-- Unlike EnvUtils1, this is the only setenv function available to you. +-- If you need to store more than one value, you're welcome to use a +-- table as /value/, it should work just fine. +function setenv(name,value) + envTable[name] = value +end + +-- getenv(name) +-- This will return whatever value is at envTable[name]. +function getenv(name) + return envTable[name] +end + +--[[ +Copyright 2008 AJ Kelly/KKI Labs +Use freely. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 GamePreferences.lua b/Themes/_fallback/Scripts/03 GamePreferences.lua index 20464feb7f..09724eee7e 100644 --- a/Themes/_fallback/Scripts/03 GamePreferences.lua +++ b/Themes/_fallback/Scripts/03 GamePreferences.lua @@ -1,147 +1,147 @@ --- GamePreferences: Clone of AJ's User Preferences "Module" --- Written by AJ Kelly of KKI Labs / Version 2.11-ssc --- (modified slightly for Cerulean Skies 2's disregard of the name of the --- themeinfo variable lol :p) - ---[[ -the first released version was broken. -this version aims to be simpler, and therefore work. - -[changelog] - -v2.11-ssc - Remove EnvUtils references; we have it in sm-ssc. - -v2.1-ssc - sm-ssc version of UserPrefs. We can now assume players have certain - functionality, like RageFile:GetError(). - -v2.1 - Added type specific GetUserPref functions. - -[usage] -First, edit PrefPath to match your theme. -If you use ThemeInfo, then you shouldn't have to edit this. - -If you're not using ThemeInfo, then you can replace - -".. themeInfo.Name .." with the theme's folder name. - -ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua - -After that's set up, read the docs. -]] -local PrefPath = "Data/GamePrefs/" - ---[[ begin internal stuff; no need to edit below this line. ]] - --- Local internal function to write envs. ___Not for themer use.___ -local function WriteEnv(envName,envValue) - return setenv(envName,envValue) -end - -function ReadGamePrefFromFile(name) - local f = RageFileUtil.CreateRageFile() - local fullFilename = PrefPath..name..".cfg" - local option - - if f:Open(fullFilename,1) then - option = tostring( f:Read() ) - WriteEnv(name,option) - f:destroy() - return option - else - local fError = f:GetError() - Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError ) - f:ClearError() - f:destroy() - return nil - end -end - -function WriteGamePrefToFile(name,value) - local f = RageFileUtil.CreateRageFile() - local fullFilename = PrefPath..name..".cfg" - - if f:Open(fullFilename, 2) then - f:Write( tostring(value) ) - WriteEnv(name,value) - else - local fError = f:GetError() - Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError ) - f:ClearError() - f:destroy() - return false - end - - f:destroy() - return true -end - ---[[ end internal functions; still don't edit below this line ]] - -function GetGamePref(name) - return ReadGamePrefFromFile(name) -end - -function SetGamePref(name,value) - return WriteGamePrefToFile(name,value) -end - ---[[ type specific, for when you want to be lazy ]] --- XXX: make set funcs, since I hate dealing with colors and I know --- other themers would too. - --- GetUserPrefB: boolean -function GetGamePrefB(name) - -- this one is a bit trickier. - local pref = ReadGamePrefFromFile(name) - - if type(pref) == "string" then - pref = string.lower(pref) - if pref == "true" or cmp == "t" then - return true - elseif pref == "false" or cmp == "f" then - return false - else - Trace("Error in GetUserPrefB(".. name ..") converting from string" ) - return false - end - elseif type(pref) == "number" then - -- both 0 and -1 are false; if you want to change this, - -- feel free to remove "or pref == -1". - if pref == 0 or pref == -1 then - - else - return true - end - end -end - --- GetUserPrefC: color -function GetGamePrefC(name) - -- XXX: make sure it's grabbing a string that can be turned into a color - -- and also possibly handle HSV values too. - return color( ReadGamePrefFromFile(name) ) -end - --- GetUserPrefN: numbers (integers, floats) -function GetGamePrefN(name) - return tonumber( ReadGamePrefFromFile(name) ) -end - ---[[ -Copyright 2008-2009 AJ Kelly/KKI Labs -All rights reserved. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- GamePreferences: Clone of AJ's User Preferences "Module" +-- Written by AJ Kelly of KKI Labs / Version 2.11-ssc +-- (modified slightly for Cerulean Skies 2's disregard of the name of the +-- themeinfo variable lol :p) + +--[[ +the first released version was broken. +this version aims to be simpler, and therefore work. + +[changelog] + +v2.11-ssc + Remove EnvUtils references; we have it in sm-ssc. + +v2.1-ssc + sm-ssc version of UserPrefs. We can now assume players have certain + functionality, like RageFile:GetError(). + +v2.1 + Added type specific GetUserPref functions. + +[usage] +First, edit PrefPath to match your theme. +If you use ThemeInfo, then you shouldn't have to edit this. + +If you're not using ThemeInfo, then you can replace + +".. themeInfo.Name .." with the theme's folder name. + +ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua + +After that's set up, read the docs. +]] +local PrefPath = "Data/GamePrefs/" + +--[[ begin internal stuff; no need to edit below this line. ]] + +-- Local internal function to write envs. ___Not for themer use.___ +local function WriteEnv(envName,envValue) + return setenv(envName,envValue) +end + +function ReadGamePrefFromFile(name) + local f = RageFileUtil.CreateRageFile() + local fullFilename = PrefPath..name..".cfg" + local option + + if f:Open(fullFilename,1) then + option = tostring( f:Read() ) + WriteEnv(name,option) + f:destroy() + return option + else + local fError = f:GetError() + Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError ) + f:ClearError() + f:destroy() + return nil + end +end + +function WriteGamePrefToFile(name,value) + local f = RageFileUtil.CreateRageFile() + local fullFilename = PrefPath..name..".cfg" + + if f:Open(fullFilename, 2) then + f:Write( tostring(value) ) + WriteEnv(name,value) + else + local fError = f:GetError() + Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError ) + f:ClearError() + f:destroy() + return false + end + + f:destroy() + return true +end + +--[[ end internal functions; still don't edit below this line ]] + +function GetGamePref(name) + return ReadGamePrefFromFile(name) +end + +function SetGamePref(name,value) + return WriteGamePrefToFile(name,value) +end + +--[[ type specific, for when you want to be lazy ]] +-- XXX: make set funcs, since I hate dealing with colors and I know +-- other themers would too. + +-- GetUserPrefB: boolean +function GetGamePrefB(name) + -- this one is a bit trickier. + local pref = ReadGamePrefFromFile(name) + + if type(pref) == "string" then + pref = string.lower(pref) + if pref == "true" or cmp == "t" then + return true + elseif pref == "false" or cmp == "f" then + return false + else + Trace("Error in GetUserPrefB(".. name ..") converting from string" ) + return false + end + elseif type(pref) == "number" then + -- both 0 and -1 are false; if you want to change this, + -- feel free to remove "or pref == -1". + if pref == 0 or pref == -1 then + + else + return true + end + end +end + +-- GetUserPrefC: color +function GetGamePrefC(name) + -- XXX: make sure it's grabbing a string that can be turned into a color + -- and also possibly handle HSV values too. + return color( ReadGamePrefFromFile(name) ) +end + +-- GetUserPrefN: numbers (integers, floats) +function GetGamePrefN(name) + return tonumber( ReadGamePrefFromFile(name) ) +end + +--[[ +Copyright 2008-2009 AJ Kelly/KKI Labs +All rights reserved. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 Gameplay.lua b/Themes/_fallback/Scripts/03 Gameplay.lua index 86eb079cb0..c9369de85a 100644 --- a/Themes/_fallback/Scripts/03 Gameplay.lua +++ b/Themes/_fallback/Scripts/03 Gameplay.lua @@ -1,270 +1,270 @@ --- 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. - --- shakesoda calls this pump.lua - --- GetExtraColorThreshold() --- [en] returns the difficulty threshold in meter --- for songs that should be counted as boss songs. -function GetExtraColorThreshold() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Modes = { - dance = 10, - pump = 15, - beat = 12, - kb7 = 10, - para = 10, - techno = 10, - lights = 10, -- lights shouldn't be playable - } - return Modes[sGame] -end - --- 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", - techno = "Single4,Single5,Single8,Double4,Double8", - lights = "Single" -- lights shouldn't be playable - } - return Modes[sGame] -end - -function SelectProfileKeys() - local sGame = GAMESTATE:GetCurrentGame():GetName() - if sGame == "pump" then - return "Up,Down,Start,Back,Center,DownLeft,DownRight" - elseif sGame == "dance" then - return "Up,Down,Start,Back,Up2,Down2" - else - return "Up,Down,Start,Back" - end -end - --- ScoreKeeperClass: --- [en] Determines the correct ScoreKeeper class to use. -function ScoreKeeperClass() - sGame = GAMESTATE:GetCurrentGame():GetName() - local ScoreKeepers = { - -- xxx: allow for ScoreKeeperShared when needed - dance = "ScoreKeeperNormal", - pump = "ScoreKeeperNormal", - beat = "ScoreKeeperNormal", - kb7 = "ScoreKeeperNormal", - para = "ScoreKeeperNormal", - techno = "ScoreKeeperNormal", - ez2 = "ScoreKeeperNormal", - ds3ddx = "ScoreKeeperNormal", - maniax = "ScoreKeeperNormal", - guitar = "ScoreKeeperGuitar" - } - return ScoreKeepers[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_W3", - 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 - --- these need cleanup really. -function HitCombo() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Combo = { - dance = 2, - pump = 4, - beat = 2, - kb7 = 2, - para = 2, - guitar = 2 - } - return Combo[sGame] -end - -function MissCombo() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Combo = { - dance = 2, - pump = 4, - beat = 0, - kb7 = 0, - para = 0, - guitar = 0 - } - return Combo[sGame] -end - --- FailCombo: --- [en] The combo that causes game failure. -function FailCombo() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Combo = { - dance = -1, -- ITG uses 30 - pump = 51, -- Pump Pro uses 30, real Pump uses 51 - beat = -1, - kb7 = -1, - para = -1, - guitar = -1 - } - return Combo[sGame] -end - -function RoutineSkinP1() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Combo = { - dance = "midi-routine-p1", - pump = "cmd-routine-p1", - beat = "default", - kb7 = "default", - para = "default", - guitar = "default" - } - return Combo[sGame] -end - -function RoutineSkinP2() - sGame = GAMESTATE:GetCurrentGame():GetName() - local Combo = { - dance = "midi-routine-p2", - pump = "cmd-routine-p2", - beat = "default", - kb7 = "retrobar", - para = "default", - guitar = "default" - } - 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 ShowHoldJudgments() - return not GAMESTATE:GetCurrentGame():GetName() == "pump" -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() - return false ---[[ 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 - -local tNotePositions = { - -- StepMania 3.9/4.0 - Normal = { - -144, - 144, - }, - -- ITG - Lower = { - -125, - 145, - } -} - -function GetTapPosition( sType ) - bCategory = (sType == 'Standard') and 1 or 2 - -- true: Normal - -- false: Lower - bPreference = GetUserPrefB("UserPrefNotePosition") and "Normal" or "Lower" - tNotePos = tNotePositions[bPreference] - return tNotePos[bCategory] -end - -function ComboUnderField() - return GetUserPrefB("UserPrefComboUnderField") +-- 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. + +-- shakesoda calls this pump.lua + +-- GetExtraColorThreshold() +-- [en] returns the difficulty threshold in meter +-- for songs that should be counted as boss songs. +function GetExtraColorThreshold() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Modes = { + dance = 10, + pump = 15, + beat = 12, + kb7 = 10, + para = 10, + techno = 10, + lights = 10, -- lights shouldn't be playable + } + return Modes[sGame] +end + +-- 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", + techno = "Single4,Single5,Single8,Double4,Double8", + lights = "Single" -- lights shouldn't be playable + } + return Modes[sGame] +end + +function SelectProfileKeys() + local sGame = GAMESTATE:GetCurrentGame():GetName() + if sGame == "pump" then + return "Up,Down,Start,Back,Center,DownLeft,DownRight" + elseif sGame == "dance" then + return "Up,Down,Start,Back,Up2,Down2" + else + return "Up,Down,Start,Back" + end +end + +-- ScoreKeeperClass: +-- [en] Determines the correct ScoreKeeper class to use. +function ScoreKeeperClass() + sGame = GAMESTATE:GetCurrentGame():GetName() + local ScoreKeepers = { + -- xxx: allow for ScoreKeeperShared when needed + dance = "ScoreKeeperNormal", + pump = "ScoreKeeperNormal", + beat = "ScoreKeeperNormal", + kb7 = "ScoreKeeperNormal", + para = "ScoreKeeperNormal", + techno = "ScoreKeeperNormal", + ez2 = "ScoreKeeperNormal", + ds3ddx = "ScoreKeeperNormal", + maniax = "ScoreKeeperNormal", + guitar = "ScoreKeeperGuitar" + } + return ScoreKeepers[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_W3", + 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 + +-- these need cleanup really. +function HitCombo() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Combo = { + dance = 2, + pump = 4, + beat = 2, + kb7 = 2, + para = 2, + guitar = 2 + } + return Combo[sGame] +end + +function MissCombo() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Combo = { + dance = 2, + pump = 4, + beat = 0, + kb7 = 0, + para = 0, + guitar = 0 + } + return Combo[sGame] +end + +-- FailCombo: +-- [en] The combo that causes game failure. +function FailCombo() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Combo = { + dance = -1, -- ITG uses 30 + pump = 51, -- Pump Pro uses 30, real Pump uses 51 + beat = -1, + kb7 = -1, + para = -1, + guitar = -1 + } + return Combo[sGame] +end + +function RoutineSkinP1() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Combo = { + dance = "midi-routine-p1", + pump = "cmd-routine-p1", + beat = "default", + kb7 = "default", + para = "default", + guitar = "default" + } + return Combo[sGame] +end + +function RoutineSkinP2() + sGame = GAMESTATE:GetCurrentGame():GetName() + local Combo = { + dance = "midi-routine-p2", + pump = "cmd-routine-p2", + beat = "default", + kb7 = "retrobar", + para = "default", + guitar = "default" + } + 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 ShowHoldJudgments() + return not GAMESTATE:GetCurrentGame():GetName() == "pump" +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() + return false +--[[ 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 + +local tNotePositions = { + -- StepMania 3.9/4.0 + Normal = { + -144, + 144, + }, + -- ITG + Lower = { + -125, + 145, + } +} + +function GetTapPosition( sType ) + bCategory = (sType == 'Standard') and 1 or 2 + -- true: Normal + -- false: Lower + bPreference = GetUserPrefB("UserPrefNotePosition") and "Normal" or "Lower" + tNotePos = tNotePositions[bPreference] + return tNotePos[bCategory] +end + +function ComboUnderField() + return GetUserPrefB("UserPrefComboUnderField") end \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 HSV.lua b/Themes/_fallback/Scripts/03 HSV.lua index 4d1bedea76..a4b56baa5d 100644 --- a/Themes/_fallback/Scripts/03 HSV.lua +++ b/Themes/_fallback/Scripts/03 HSV.lua @@ -1,249 +1,249 @@ ---[[ -functions for using HSV colors in StepMania. -Code adapted from http://www.cs.rit.edu/~ncs/color/t_convert.html - -changelog: - -v 1 - -= v1.1 = -* Hue(color, newHue) changed to wrap around for invalid values. -* Desaturate(color, percent) renamed to Saturation(color, percent). -______________________________________________________________________________ -xxx: support HSL<->RGB (which is different) too? -http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_RGB_to_HSL_or_HSV - -HSL treats absolute brightness of a color at 0.5 in L, whereas -HSV treats absolute brightness of a color at 1.0 in V. - -Saturation is different too. -]] - --- HasAlpha(c) -function HasAlpha(c) - if c[4] then - return c[4] - else - return 1 - end -end - --- ColorToHSV(c) --- Takes in a normal color("") and returns a table with the HSV values. -function ColorToHSV(c) - local r = c[1] - local g = c[2] - local b = c[3] - -- alpha requires error checking sometimes. - local a = HasAlpha(c) - - local h = 0 - local s = 0 - local v = 0 - - local min = math.min( r, g, b ) - local max = math.max( r, g, b ) - v = max - - local delta = max - min - - -- xxx: how do we deal with complete black? - if min == 0 and max == 0 then - -- we have complete darkness; make it cheap. - return { - Hue = 0, - Sat = 0, - Value = 0, - Alpha = a - } - end - - if max ~= 0 then - s = delta / max -- rofl deltamax :| - else - -- r = g = b = 0; s = 0, v is undefined - s = 0 - h = -1 - return { - Hue = h, - Sat = s, - Value = v, - Alpha = 1 - } - end - - if r == max then - h = ( g - b ) / delta -- yellow/magenta - elseif g == max then - h = 2 + ( b - r ) / delta -- cyan/yellow - else - h = 4 + ( r - g ) / delta -- magenta/cyan - end - - h = h * 60 -- degrees - - if h < 0 then - h = h + 360 - end - - return { - Hue = h, - Sat = s, - Value = v, - Alpha = a - } -end - --- HSVToColor(hsv) --- Converts a set of HSV values to a color. hsv is a table. --- See also: HSV(h, s, v) -function HSVToColor(hsv) - local i - local f, q, p, t - local r, g, b - local h, s, v - - local a - - s = hsv.Sat - v = hsv.Value - - if hsv.Alpha then - a = hsv.Alpha - else - a = 0 - end - - if s == 0 then - return { v, v, v, a } - end - - h = hsv.Hue / 60 - - i = math.floor(h) - f = h - i - p = v * (1-s) - q = v * (1-s*f) - t = v * (1-s*(1-f)) - - if i == 0 then - return { v, t, p, a } - elseif i == 1 then - return { q, v, p, a } - elseif i == 2 then - return { p, v, t, a } - elseif i == 3 then - return { p, q, v, a } - elseif i == 4 then - return { t, p, v, a } - else - return { v, p, q, a } - end -end - --- ColorToHex(c) --- Takes in a normal color("") and returns the hex representation. --- Adapted from code in LuaBit (http://luaforge.net/projects/bit/), --- which is MIT licensed and copyright (C) 2006~2007 hanzhao. -function ColorToHex(c) - local r = c[1] - local g = c[2] - local b = c[3] - local a = HasAlpha(c) - - local function hex(value) - value = math.ceil(value) - - local hexVals = { 'A', 'B', 'C', 'D', 'E', 'F' } - local out = "" - local last = 0 - - while(value ~= 0) do - last = math.mod(value, 16) - if(last < 10) then - out = tostring(last) .. out - else - out = hexVals[(last-10)+1] .. out - end - value = math.floor(value/16) - end - - if(out == "") then - return "00" - end - - return string.format( "%02X", tonumber(out,16) ) - end - - local rX = hex( scale(r, 0, 1, 0, 255) ) - local gX = hex( scale(g, 0, 1, 0, 255) ) - local bX = hex( scale(b, 0, 1, 0, 255) ) - local aX = hex( scale(a, 0, 1, 0, 255) ) - - return rX .. gX .. bX .. aX -end - -function HSVToHex(hsv) - return ColorToHex( HSVToColor(hsv) ) -end - ---[[ you should mainly use these functions ]] - --- this is the lazy one; use this when you mean fullly visible -function HSV(h, s, v) - local t = { - Hue = h, - Sat = s, - Value = v, - Alpha = 1 - } - return HSVToColor(t) -end - --- here's the proper one -function HSVA(h, s, v, a) - local t = { - Hue = h, - Sat = s, - Value = v, - Alpha = a - } - return HSVToColor(t) -end - -function Saturation(color,percent) - local c = ColorToHSV(color) - -- error checking - if percent < 0 then - percent = 0.0 - elseif percent > 1 then - percent = 1.0 - end - c.Sat = percent - return HSVToColor(c) -end - -function Brightness(color,percent) - local c = ColorToHSV(color) - -- error checking - if percent < 0 then - percent = 0.0 - elseif percent > 1 then - percent = 1.0 - end - c.Value = percent - return HSVToColor(c) -end - -function Hue(color,newHue) - local c = ColorToHSV(color) - -- handle wrapping - if newHue < 0 then - newHue = 360 + newHue - elseif newHue > 360 then - --newHue = math.mod(newHue, 360); -- ?? untested - newHue = newHue - 360 - end - c.Hue = newHue - return HSVToColor(c) +--[[ +functions for using HSV colors in StepMania. +Code adapted from http://www.cs.rit.edu/~ncs/color/t_convert.html + +changelog: + +v 1 + += v1.1 = +* Hue(color, newHue) changed to wrap around for invalid values. +* Desaturate(color, percent) renamed to Saturation(color, percent). +______________________________________________________________________________ +xxx: support HSL<->RGB (which is different) too? +http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_RGB_to_HSL_or_HSV + +HSL treats absolute brightness of a color at 0.5 in L, whereas +HSV treats absolute brightness of a color at 1.0 in V. + +Saturation is different too. +]] + +-- HasAlpha(c) +function HasAlpha(c) + if c[4] then + return c[4] + else + return 1 + end +end + +-- ColorToHSV(c) +-- Takes in a normal color("") and returns a table with the HSV values. +function ColorToHSV(c) + local r = c[1] + local g = c[2] + local b = c[3] + -- alpha requires error checking sometimes. + local a = HasAlpha(c) + + local h = 0 + local s = 0 + local v = 0 + + local min = math.min( r, g, b ) + local max = math.max( r, g, b ) + v = max + + local delta = max - min + + -- xxx: how do we deal with complete black? + if min == 0 and max == 0 then + -- we have complete darkness; make it cheap. + return { + Hue = 0, + Sat = 0, + Value = 0, + Alpha = a + } + end + + if max ~= 0 then + s = delta / max -- rofl deltamax :| + else + -- r = g = b = 0; s = 0, v is undefined + s = 0 + h = -1 + return { + Hue = h, + Sat = s, + Value = v, + Alpha = 1 + } + end + + if r == max then + h = ( g - b ) / delta -- yellow/magenta + elseif g == max then + h = 2 + ( b - r ) / delta -- cyan/yellow + else + h = 4 + ( r - g ) / delta -- magenta/cyan + end + + h = h * 60 -- degrees + + if h < 0 then + h = h + 360 + end + + return { + Hue = h, + Sat = s, + Value = v, + Alpha = a + } +end + +-- HSVToColor(hsv) +-- Converts a set of HSV values to a color. hsv is a table. +-- See also: HSV(h, s, v) +function HSVToColor(hsv) + local i + local f, q, p, t + local r, g, b + local h, s, v + + local a + + s = hsv.Sat + v = hsv.Value + + if hsv.Alpha then + a = hsv.Alpha + else + a = 0 + end + + if s == 0 then + return { v, v, v, a } + end + + h = hsv.Hue / 60 + + i = math.floor(h) + f = h - i + p = v * (1-s) + q = v * (1-s*f) + t = v * (1-s*(1-f)) + + if i == 0 then + return { v, t, p, a } + elseif i == 1 then + return { q, v, p, a } + elseif i == 2 then + return { p, v, t, a } + elseif i == 3 then + return { p, q, v, a } + elseif i == 4 then + return { t, p, v, a } + else + return { v, p, q, a } + end +end + +-- ColorToHex(c) +-- Takes in a normal color("") and returns the hex representation. +-- Adapted from code in LuaBit (http://luaforge.net/projects/bit/), +-- which is MIT licensed and copyright (C) 2006~2007 hanzhao. +function ColorToHex(c) + local r = c[1] + local g = c[2] + local b = c[3] + local a = HasAlpha(c) + + local function hex(value) + value = math.ceil(value) + + local hexVals = { 'A', 'B', 'C', 'D', 'E', 'F' } + local out = "" + local last = 0 + + while(value ~= 0) do + last = math.mod(value, 16) + if(last < 10) then + out = tostring(last) .. out + else + out = hexVals[(last-10)+1] .. out + end + value = math.floor(value/16) + end + + if(out == "") then + return "00" + end + + return string.format( "%02X", tonumber(out,16) ) + end + + local rX = hex( scale(r, 0, 1, 0, 255) ) + local gX = hex( scale(g, 0, 1, 0, 255) ) + local bX = hex( scale(b, 0, 1, 0, 255) ) + local aX = hex( scale(a, 0, 1, 0, 255) ) + + return rX .. gX .. bX .. aX +end + +function HSVToHex(hsv) + return ColorToHex( HSVToColor(hsv) ) +end + +--[[ you should mainly use these functions ]] + +-- this is the lazy one; use this when you mean fullly visible +function HSV(h, s, v) + local t = { + Hue = h, + Sat = s, + Value = v, + Alpha = 1 + } + return HSVToColor(t) +end + +-- here's the proper one +function HSVA(h, s, v, a) + local t = { + Hue = h, + Sat = s, + Value = v, + Alpha = a + } + return HSVToColor(t) +end + +function Saturation(color,percent) + local c = ColorToHSV(color) + -- error checking + if percent < 0 then + percent = 0.0 + elseif percent > 1 then + percent = 1.0 + end + c.Sat = percent + return HSVToColor(c) +end + +function Brightness(color,percent) + local c = ColorToHSV(color) + -- error checking + if percent < 0 then + percent = 0.0 + elseif percent > 1 then + percent = 1.0 + end + c.Value = percent + return HSVToColor(c) +end + +function Hue(color,newHue) + local c = ColorToHSV(color) + -- handle wrapping + if newHue < 0 then + newHue = 360 + newHue + elseif newHue > 360 then + --newHue = math.mod(newHue, 360); -- ?? untested + newHue = newHue - 360 + end + c.Hue = newHue + return HSVToColor(c) end; \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 IniFile.lua b/Themes/_fallback/Scripts/03 IniFile.lua index 93674d6133..2bad1403db 100644 --- a/Themes/_fallback/Scripts/03 IniFile.lua +++ b/Themes/_fallback/Scripts/03 IniFile.lua @@ -1,119 +1,119 @@ ---[[ -IniFile: basically a Lua rewrite of SM's IniFile class that serves as the -basis for the sm-ssc UserPrefs and ThemePrefs configuration systems. -Note that this is a namespace, not a class per se. ---]] - --- TODO: move this into a more general section --- func takes a key and a value -function foreach_ordered( tbl, func ) - local keys = { } - for k,_ in pairs(tbl) do keys[#keys+1] = k end - - table.sort( keys ) - - -- iterate in sorted order - for _,key in ipairs(keys) do func( key, tbl[key]) end -end - --- redeclared here for my sanity's sake --- TODO: declare these as global variables -local RageFile = -{ - READ = 1, - WRITE = 2, - STREAMED = 4, - SLOW_FLUSH = 8 -} - --- IniFile namespace -IniFile = -{ - StrToKeyVal = function( str ) - local _, _, key, value = str:find( "(.+)=(.*)" ) - - -- key is always a string, but value may be num, bool, or nil. - -- do a few quick checks to see which one it is. - - -- if it's a nil, convert it to an empty string and return - if value == nil then value = ""; return key, value; end - - -- if it's a number, convert it in place and return - if tonumber(value) ~= nil then value = tonumber(value); return key, value; end - - -- not a number, so let's try a boolean value - if value == "true" then value = true; - elseif value == "false" then value = false; - end - - return key, value - end, - - ReadFile = function( file_path ) - Trace( "IniFile.ReadFile( " .. file_path .. " )" ) - local file = RageFileUtil.CreateRageFile() - - if not file:Open(file_path, RageFile.READ) then - Warn( string.format("ReadFile(%s): %s",file_path,file:GetError()) ) - file:destroy() - return { } -- return a blank table - end - - local tbl = { } - local current = tbl - - while not file:AtEOF() do - local str = file:GetLine() - - -- is this a section? - local _, _, sec = str:find( "%[(.+)%]" ) - - -- if so, set focus there; otherwise, try to - -- read a key/value pair (ignore blank lines) - if sec then - -- if this section doesn't exist, create it - tbl[sec] = tbl[sec] and tbl[sec] or { } - current = tbl[sec] - Warn( "Switching section to " .. sec ) - else - local k, v = IniFile.StrToKeyVal( str ) - if k and v then current[k] = v end - end - end - - file:Close() - file:destroy() - - return tbl - end, - - WriteFile = function( file_path, tbl ) - Trace( "IniFile.WriteFile( " .. file_path .. " )" ) - local file = RageFileUtil.CreateRageFile() - - if not file:Open(file_path, RageFile.WRITE) then - Warn( string.format("WriteFile(%s): %s",file_path.file:GetError()) ) - file:destroy() - return false - end - - -- declare functions so we can write with foreach_ordered - local function put_pair( k, v ) - file:PutLine( string.format("%s=%s", k, tostring(v)) ) - end - - local function put_section( section, pair ) - file:PutLine( "[" .. section .. "]" ) - foreach_ordered( pair, put_pair ) - file:PutLine("") -- put a blank line between sections - end - - -- each base key is a section and its value is a - -- table of key-value pairs under that section. - foreach_ordered( tbl, put_section ) - - file:Close() - file:destroy() - return true - end -}; +--[[ +IniFile: basically a Lua rewrite of SM's IniFile class that serves as the +basis for the sm-ssc UserPrefs and ThemePrefs configuration systems. +Note that this is a namespace, not a class per se. +--]] + +-- TODO: move this into a more general section +-- func takes a key and a value +function foreach_ordered( tbl, func ) + local keys = { } + for k,_ in pairs(tbl) do keys[#keys+1] = k end + + table.sort( keys ) + + -- iterate in sorted order + for _,key in ipairs(keys) do func( key, tbl[key]) end +end + +-- redeclared here for my sanity's sake +-- TODO: declare these as global variables +local RageFile = +{ + READ = 1, + WRITE = 2, + STREAMED = 4, + SLOW_FLUSH = 8 +} + +-- IniFile namespace +IniFile = +{ + StrToKeyVal = function( str ) + local _, _, key, value = str:find( "(.+)=(.*)" ) + + -- key is always a string, but value may be num, bool, or nil. + -- do a few quick checks to see which one it is. + + -- if it's a nil, convert it to an empty string and return + if value == nil then value = ""; return key, value; end + + -- if it's a number, convert it in place and return + if tonumber(value) ~= nil then value = tonumber(value); return key, value; end + + -- not a number, so let's try a boolean value + if value == "true" then value = true; + elseif value == "false" then value = false; + end + + return key, value + end, + + ReadFile = function( file_path ) + Trace( "IniFile.ReadFile( " .. file_path .. " )" ) + local file = RageFileUtil.CreateRageFile() + + if not file:Open(file_path, RageFile.READ) then + Warn( string.format("ReadFile(%s): %s",file_path,file:GetError()) ) + file:destroy() + return { } -- return a blank table + end + + local tbl = { } + local current = tbl + + while not file:AtEOF() do + local str = file:GetLine() + + -- is this a section? + local _, _, sec = str:find( "%[(.+)%]" ) + + -- if so, set focus there; otherwise, try to + -- read a key/value pair (ignore blank lines) + if sec then + -- if this section doesn't exist, create it + tbl[sec] = tbl[sec] and tbl[sec] or { } + current = tbl[sec] + Warn( "Switching section to " .. sec ) + else + local k, v = IniFile.StrToKeyVal( str ) + if k and v then current[k] = v end + end + end + + file:Close() + file:destroy() + + return tbl + end, + + WriteFile = function( file_path, tbl ) + Trace( "IniFile.WriteFile( " .. file_path .. " )" ) + local file = RageFileUtil.CreateRageFile() + + if not file:Open(file_path, RageFile.WRITE) then + Warn( string.format("WriteFile(%s): %s",file_path.file:GetError()) ) + file:destroy() + return false + end + + -- declare functions so we can write with foreach_ordered + local function put_pair( k, v ) + file:PutLine( string.format("%s=%s", k, tostring(v)) ) + end + + local function put_section( section, pair ) + file:PutLine( "[" .. section .. "]" ) + foreach_ordered( pair, put_pair ) + file:PutLine("") -- put a blank line between sections + end + + -- each base key is a section and its value is a + -- table of key-value pairs under that section. + foreach_ordered( tbl, put_section ) + + file:Close() + file:destroy() + return true + end +}; diff --git a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua index 800303f672..29f1addd20 100644 --- a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua +++ b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua @@ -1,252 +1,252 @@ --- ProductivityHelpers: A set of useful aliases for theming. --- This is the sm-ssc version. You should not be using this in themes for --- SM4 right now... We'll post an updated version soon. - ---[[ Globals ]] -function IsArcade() - local sPayMode = GAMESTATE:GetCoinMode(); - local bIsArcade = (sPayMode ~= 'CoinMode_Home'); - return bIsArcade; -end - -function IsHome() - local sPayMode = GAMESTATE:GetCoinMode(); - local bIsHome = (sPayMode == 'CoinMode_Home'); - return bIsHome; -end - -function IsFreePlay() - if IsArcade() then - return (GAMESTATE:GetCoinMode() == 'CoinMode_Free'); - else - return false - end -end - -function Center1Player() - if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerTwoSides" then - return true - elseif PREFSMAN:GetPreference("Center1Player") then - if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide" then - return true - else - return false - end - else - return false - end ---[[ return PREFSMAN:GetPreference("Center1Player") and - THEME:GetMetric("ScreenGameplay","AllowCenter1Player") and - not GAMESTATE:GetPlayMode("PlayMode_Battle") and - not GAMESTATE:GetPlayMode("PlayMode_Rave") and - GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide"; --]] -end - ---[[ 3.9 Conditionals ]] -Condition = { - Hour = function() - return Hour() - end, - IsDemonstration = function() - return GAMESTATE:IsDemonstration() - end, - CurSong = function(sSongName) - return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName - end, - DayOfMonth = function() - return DayOfMonth() - end, - MonthOfYear = function() - return MonthOfYear() - end, - UsingModifier = function(pnPlayer, sModifier) - return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); - end, -} ---[[ 3.9 Functions ]] -Game = { - GetStage = function() - - end, -} ---[[ Aliases ]] - --- Blend Modes --- Aliases for blend modes. -Blend = { - Normal = 'BlendMode_Normal', - Add = 'BlendMode_Add', - Modulate = 'BlendMode_Modulate', - Multiply = 'BlendMode_WeightedMultiply', - Invert = 'BlendMode_InvertDest', - NoEffect = 'BlendMode_NoEffect', -} - --- Health Declarations --- Used primarily for lifebars. -Health = { - Max = 'HealthState_Hot', - Alive = 'HealthState_Alive', - Danger = 'HealthState_Danger', - Dead = 'HealthState_Dead' -} - --- Make graphics their true size at any resolution. ---[[ - Note: for screens taller than wide (i.e. phones, sideways displays), - you'll need to get width rather than height (I just don't feel like - uglyfying my code just to handle rare cases). -shake ---]] - --- useful -function GetReal() - local theme = THEME:GetMetric("Common","ScreenHeight") - local res = PREFSMAN:GetPreference("DisplayHeight") - return theme/res -end - -function GetRealInverse() - local theme = THEME:GetMetric("Common","ScreenHeight") - local res = PREFSMAN:GetPreference("DisplayHeight") - return res/theme -end - -function Actor:Real() - -- scale back down to real pixels. - self:basezoom(GetReal()) - -- don't make this ugly - self:SetTextureFiltering(false) -end - --- Scale things back up after they have already been scaled down. -function Actor:RealInverse() - -- scale back up to theme resolution - self:basezoom(GetRealInverse()) - self:SetTextureFiltering(true) -end - ---[[ Actor commands ]] -function Actor:CenterX() - self:x(SCREEN_CENTER_X) -end - -function Actor:CenterY() - self:y(SCREEN_CENTER_Y) -end - --- xy(actorX,actorY) --- Sets the x and y of an actor in one command. -function Actor:xy(actorX,actorY) - self:x(actorX) - self:y(actorY) -end - --- MaskSource([clearzbuffer]) --- Sets an actor up as the source for a mask. Clears zBuffer by default. -function Actor:MaskSource(noclear) - self:clearzbuffer(noclear or true) - self:zwrite(true) - self:blend('BlendMode_NoEffect') -end - --- MaskDest() --- Sets an actor up to be masked by anything with MaskSource(). -function Actor:MaskDest() - self:ztest(true) -end - --- Thump() --- A customized version of pulse that is more appealing for on-beat --- effects; -function Actor:thump(fEffectPeriod) - self:pulse() - if fEffectPeriod ~= nil then - self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod) - else - self:effecttiming(0,0,0.75,0.25) - end - -- The default effectmagnitude will make this effect look very bad. - self:effectmagnitude(1,1.125,1) -end - --- Heartbeat() --- A customized version of pulse that is more appealing for on-beat --- effects; -function Actor:heartbeat(fEffectPeriod) - self:pulse() - if fEffectPeriod ~= nil then - self:effecttiming(0,0.125*fEffectPeriod,0.125*fEffectPeriod,0.75*fEffectPeriod); - else - self:effecttiming(0,0.125,0.125,0.75); - end - self:effecmagnitude(1,1.125,1) -end - ---[[ BitmapText commands ]] - --- PixelFont() --- An alias that turns off texture filtering. --- Named because it works best with pixel fonts. -function BitmapText:PixelFont() - self:SetTextureFiltering(false) -end - --- Stroke(color) --- Sets the text's stroke color. -function BitmapText:Stroke(c) - self:strokecolor( c ) -end - --- NoStroke() --- Removes any stroke. -function BitmapText:NoStroke() - self:strokecolor( color("0,0,0,0") ) -end - --- Set Text With Format (contributed by Daisuke Master) --- this function is my hero - shake -function BitmapText:settextf(...) - self:settext(string.format(...)) -end - --- DiffuseAndStroke(diffuse,stroke) --- Set diffuse and stroke at the same time. -function BitmapText:DiffuseAndStroke(diffuseC,strokeC) - self:diffuse(diffuseC) - self:strokecolor(strokeC) -end; ---[[ end BitmapText commands ]] - ---[[ ----------------------------------------------------------------------- ]] - ---[[ helper functions ]] -function tobool(v) - if type(v) == "string" then - local cmp = string.lower(v) - if cmp == "true" or cmp == "t" then - return true - elseif cmp == "false" or cmp == "f" then - return false - end - elseif type(v) == "number" then - if v == 0 then - return false - else - return true - end - end -end - -function pname(pn) - return ToEnumShortString(pn) -end - -function math.round(num, pre) - if pre and pre < 0 then pre = 0 end - local mult = 10^(pre or 0) - if num >= 0 then return math.floor(num*mult+.5)/mult - else return math.ceil(num*mult-.5)/mult end -end - ---[[ end helper functions ]] --- this code is in the public domain. +-- ProductivityHelpers: A set of useful aliases for theming. +-- This is the sm-ssc version. You should not be using this in themes for +-- SM4 right now... We'll post an updated version soon. + +--[[ Globals ]] +function IsArcade() + local sPayMode = GAMESTATE:GetCoinMode(); + local bIsArcade = (sPayMode ~= 'CoinMode_Home'); + return bIsArcade; +end + +function IsHome() + local sPayMode = GAMESTATE:GetCoinMode(); + local bIsHome = (sPayMode == 'CoinMode_Home'); + return bIsHome; +end + +function IsFreePlay() + if IsArcade() then + return (GAMESTATE:GetCoinMode() == 'CoinMode_Free'); + else + return false + end +end + +function Center1Player() + if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerTwoSides" then + return true + elseif PREFSMAN:GetPreference("Center1Player") then + if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide" then + return true + else + return false + end + else + return false + end +--[[ return PREFSMAN:GetPreference("Center1Player") and + THEME:GetMetric("ScreenGameplay","AllowCenter1Player") and + not GAMESTATE:GetPlayMode("PlayMode_Battle") and + not GAMESTATE:GetPlayMode("PlayMode_Rave") and + GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide"; --]] +end + +--[[ 3.9 Conditionals ]] +Condition = { + Hour = function() + return Hour() + end, + IsDemonstration = function() + return GAMESTATE:IsDemonstration() + end, + CurSong = function(sSongName) + return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName + end, + DayOfMonth = function() + return DayOfMonth() + end, + MonthOfYear = function() + return MonthOfYear() + end, + UsingModifier = function(pnPlayer, sModifier) + return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); + end, +} +--[[ 3.9 Functions ]] +Game = { + GetStage = function() + + end, +} +--[[ Aliases ]] + +-- Blend Modes +-- Aliases for blend modes. +Blend = { + Normal = 'BlendMode_Normal', + Add = 'BlendMode_Add', + Modulate = 'BlendMode_Modulate', + Multiply = 'BlendMode_WeightedMultiply', + Invert = 'BlendMode_InvertDest', + NoEffect = 'BlendMode_NoEffect', +} + +-- Health Declarations +-- Used primarily for lifebars. +Health = { + Max = 'HealthState_Hot', + Alive = 'HealthState_Alive', + Danger = 'HealthState_Danger', + Dead = 'HealthState_Dead' +} + +-- Make graphics their true size at any resolution. +--[[ + Note: for screens taller than wide (i.e. phones, sideways displays), + you'll need to get width rather than height (I just don't feel like + uglyfying my code just to handle rare cases). -shake +--]] + +-- useful +function GetReal() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return theme/res +end + +function GetRealInverse() + local theme = THEME:GetMetric("Common","ScreenHeight") + local res = PREFSMAN:GetPreference("DisplayHeight") + return res/theme +end + +function Actor:Real() + -- scale back down to real pixels. + self:basezoom(GetReal()) + -- don't make this ugly + self:SetTextureFiltering(false) +end + +-- Scale things back up after they have already been scaled down. +function Actor:RealInverse() + -- scale back up to theme resolution + self:basezoom(GetRealInverse()) + self:SetTextureFiltering(true) +end + +--[[ Actor commands ]] +function Actor:CenterX() + self:x(SCREEN_CENTER_X) +end + +function Actor:CenterY() + self:y(SCREEN_CENTER_Y) +end + +-- xy(actorX,actorY) +-- Sets the x and y of an actor in one command. +function Actor:xy(actorX,actorY) + self:x(actorX) + self:y(actorY) +end + +-- MaskSource([clearzbuffer]) +-- Sets an actor up as the source for a mask. Clears zBuffer by default. +function Actor:MaskSource(noclear) + self:clearzbuffer(noclear or true) + self:zwrite(true) + self:blend('BlendMode_NoEffect') +end + +-- MaskDest() +-- Sets an actor up to be masked by anything with MaskSource(). +function Actor:MaskDest() + self:ztest(true) +end + +-- Thump() +-- A customized version of pulse that is more appealing for on-beat +-- effects; +function Actor:thump(fEffectPeriod) + self:pulse() + if fEffectPeriod ~= nil then + self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod) + else + self:effecttiming(0,0,0.75,0.25) + end + -- The default effectmagnitude will make this effect look very bad. + self:effectmagnitude(1,1.125,1) +end + +-- Heartbeat() +-- A customized version of pulse that is more appealing for on-beat +-- effects; +function Actor:heartbeat(fEffectPeriod) + self:pulse() + if fEffectPeriod ~= nil then + self:effecttiming(0,0.125*fEffectPeriod,0.125*fEffectPeriod,0.75*fEffectPeriod); + else + self:effecttiming(0,0.125,0.125,0.75); + end + self:effecmagnitude(1,1.125,1) +end + +--[[ BitmapText commands ]] + +-- PixelFont() +-- An alias that turns off texture filtering. +-- Named because it works best with pixel fonts. +function BitmapText:PixelFont() + self:SetTextureFiltering(false) +end + +-- Stroke(color) +-- Sets the text's stroke color. +function BitmapText:Stroke(c) + self:strokecolor( c ) +end + +-- NoStroke() +-- Removes any stroke. +function BitmapText:NoStroke() + self:strokecolor( color("0,0,0,0") ) +end + +-- Set Text With Format (contributed by Daisuke Master) +-- this function is my hero - shake +function BitmapText:settextf(...) + self:settext(string.format(...)) +end + +-- DiffuseAndStroke(diffuse,stroke) +-- Set diffuse and stroke at the same time. +function BitmapText:DiffuseAndStroke(diffuseC,strokeC) + self:diffuse(diffuseC) + self:strokecolor(strokeC) +end; +--[[ end BitmapText commands ]] + +--[[ ----------------------------------------------------------------------- ]] + +--[[ helper functions ]] +function tobool(v) + if type(v) == "string" then + local cmp = string.lower(v) + if cmp == "true" or cmp == "t" then + return true + elseif cmp == "false" or cmp == "f" then + return false + end + elseif type(v) == "number" then + if v == 0 then + return false + else + return true + end + end +end + +function pname(pn) + return ToEnumShortString(pn) +end + +function math.round(num, pre) + if pre and pre < 0 then pre = 0 end + local mult = 10^(pre or 0) + if num >= 0 then return math.floor(num*mult+.5)/mult + else return math.ceil(num*mult-.5)/mult end +end + +--[[ end helper functions ]] +-- this code is in the public domain. diff --git a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua index 8d3dd70aec..c44c82147d 100644 --- a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua +++ b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua @@ -1,561 +1,561 @@ --- sm-ssc Default Theme Preferences Handler -function InitGamePrefs() - local Prefs = - { - { "DefaultFail", "Immediate" }, - }; - - local BPrefs = - { - { "AutoSetStyle", false }, - { "NotePosition", true }, - { "ComboOnRolls", false }, - { "ComboUnderField", true }, - }; - - for idx,pref in ipairs(Prefs) do - if GetGamePref( pref[1] ) == nil then - SetGamePref( pref[1], pref[2] ); - end; - end; - - for idx,pref in ipairs(BPrefs) do - if GetGamePrefB( pref[1] ) == nil then - SetGamePref( pref[1], pref[2] ); - end; - end; -end -function InitUserPrefs() - if GetUserPrefB("UserPrefShowLotsaOptions") == nil then - SetUserPref("UserPrefShowLotsaOptions", true); - end; - - local Prefs = - { - { "UserPrefGameplayShowStepsDisplay", true }, - { "UserPrefGameplayShowScore", false}, ---[[ { "ProTimingP1", false}, - { "ProTimingP2", false}, ---]] - }; - - local BPrefs = - { - { "UserPrefShowLotsaOptions", true}, - { "UserPrefLongFail", false}, - { "UserPrefProtimingP1", false}, - { "UserPrefProtimingP2", false}, - { "FlashyCombos", false}, - { "GameplayFooter", false}, - }; - - for idx,pref in ipairs(Prefs) do - if GetUserPref( pref[1] ) == nil then - SetUserPref( pref[1], pref[2] ); - end; - end; - - -- making sure I don't screw up anything yet... - for idx,pref in ipairs(BPrefs) do - if GetUserPrefB( pref[1] ) == nil then - SetUserPref( pref[1], pref[2] ); - end; - end; - -end; ---[[ theme option rows ]] --- screen cover -function GetProTiming(pn) - local pname = ToEnumShortString(pn); - if GetUserPref("ProTiming"..pname) then - return GetUserPrefB("ProTiming"..pname); - else - SetUserPref("ProTiming"..pname,false); - return false; - end; -end; -function OptionRowProTiming() - local t = { - Name = "ProTiming"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = false; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - local bShow; - if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then - bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ); - if bShow then - list[2] = true; - else - list[1] = true; - end - else - list[1] = true; - end; ---[[ local pname = ToEnumShortString(pn); - - if getenv("ProTiming"..pname) == true then - list[2] = true; - else - list[1] = true; - end; --]] - end; - SaveSelections = function(self, list, pn) - local bSave; - if list[2] then - bSave = true; - else - bSave = false; - end; - SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave); ---[[ local val; - if list[2] then - val = true; - else - val = false; - end; - local pname = ToEnumShortString(pn); - setenv("ProTiming"..pname, val); --]] - end; - }; - setmetatable( t, t ); - return t; -end; - -function UserPrefGameplayShowScore() - local t = { - Name = "UserPrefGameplayShowScore"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then - if GetUserPrefB("UserPrefGameplayShowScore") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefGameplayShowScore",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefGameplayShowScore",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefGameplayShowStepsDisplay() - local t = { - Name = "UserPrefGameplayShowStepsDisplay"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then - if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefGameplayShowStepsDisplay",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefGameplayShowStepsDisplay",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefShowLotsaOptions() - local t = { - Name = "UserPrefShowLotsaOptions"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Many','Few' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then - if GetUserPrefB("UserPrefShowLotsaOptions") then - list[1] = true; - else - list[2] = true; - end; - else - WritePrefToFile("UserPrefShowLotsaOptions",false); - list[2] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[1] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefShowLotsaOptions",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function GetDefaultOptionLines() - local LineSets = { - "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All - "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx ) - }; - local function IsExtra() - if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then - return true - else - return false - end - end - if not IsExtra() then - if GetUserPrefB("UserPrefShowLotsaOptions") then - return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2]; - else - return LineSets[2]; -- Just make sure! - end - else - return "1,8,14,2,7,13,16,17,18" -- "failsafe" list - end -end; -function UserPrefLongFail() - local t = { - Name = "UserPrefLongFail"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Short','Long' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefLongFail") ~= nil then - if GetUserPrefB("UserPrefLongFail") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefLongFail",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefLongFail",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end -function UserPrefFlashyCombo() - local t = { - Name = "UserPrefFlashyCombo"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then - if GetUserPrefB("UserPrefFlashyCombo") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefFlashyCombo",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefFlashyCombo",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefGameplayFooter() - local t = { - Name = "UserPrefGameplayFooter"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("GameplayFooter") ~= nil then - if GetUserPrefB("GameplayFooter") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("GameplayFooter",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("GameplayFooter",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end ---[[ end themeoption rows ]] - ---[[ game option rows ]] -function GamePrefComboOnRolls() - local t = { - Name = "GamePrefComboOnRolls"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("ComboOnRolls") ~= nil then - if GetGamePrefB("ComboOnRolls") then - list[2] = true; - else - list[1] = true; - end; - else - WriteGamePrefToFile("ComboOnRolls",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WriteGamePrefToFile("ComboOnRolls",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end -function GamePrefComboUnderField() - local t = { - Name = "GamePrefComboUnderField"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("ComboUnderField") ~= nil then - if GetGamePrefB("ComboUnderField") then - list[2] = true; - else - list[1] = true; - end; - else - WriteGamePrefToFile("ComboUnderField",true); - list[2] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WriteGamePrefToFile("ComboUnderField",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function GamePrefAutoSetStyle() - local t = { - Name = "GamePrefAutoSetStyle"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("AutoSetStyle") ~= nil then - if GetGamePrefB("AutoSetStyle") then - list[2] = true; - else - list[1] = true; - end; - else - WriteGamePrefToFile("AutoSetStyle",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WriteGamePrefToFile("AutoSetStyle",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end -function GamePrefNotePosition() - local t = { - Name = "GamePrefNotePosition"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Normal','Lower' }; - LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("NotePosition") ~= nil then - if GetGamePrefB("NotePosition") then - list[1] = true; - else - list[2] = true; - end; - else - WriteGamePrefToFile("NotePosition",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[1] then - val = true; - else - val = false; - end; - WriteGamePrefToFile("NotePosition",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function GamePrefDefaultFail() - local t = { - Name = "GamePrefDefaultFail"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; - LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("DefaultFail") ~= nil then - if GetGamePref("DefaultFail") then - if GetGamePref("DefaultFail") == "Immediate" then - list[1] = true; - elseif GetGamePref("DefaultFail") == "ImmediateContinue" then - list[2] = true; - elseif GetGamePref("DefaultFail") == "AtEnd" then - list[3] = true; - elseif GetGamePref("DefaultFail") == "Off" then - list[4] = true; - else - list[1] = true; - end - -- list[table.find( list, GetGamePref("DefaultFail") )] = true; - else - list[1] = true; - end; - else - WriteGamePrefToFile("DefaultFail","Immediate"); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - -- This is so stupid. - local tChoices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; - local val; - if list[1] then - val = tChoices[1]; - elseif list[2] then - val = tChoices[2]; - elseif list[3] then - val = tChoices[3]; - elseif list[4] then - val = tChoices[4]; - else - val = tChoices[1]; - end - WriteGamePrefToFile("DefaultFail",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end +-- sm-ssc Default Theme Preferences Handler +function InitGamePrefs() + local Prefs = + { + { "DefaultFail", "Immediate" }, + }; + + local BPrefs = + { + { "AutoSetStyle", false }, + { "NotePosition", true }, + { "ComboOnRolls", false }, + { "ComboUnderField", true }, + }; + + for idx,pref in ipairs(Prefs) do + if GetGamePref( pref[1] ) == nil then + SetGamePref( pref[1], pref[2] ); + end; + end; + + for idx,pref in ipairs(BPrefs) do + if GetGamePrefB( pref[1] ) == nil then + SetGamePref( pref[1], pref[2] ); + end; + end; +end +function InitUserPrefs() + if GetUserPrefB("UserPrefShowLotsaOptions") == nil then + SetUserPref("UserPrefShowLotsaOptions", true); + end; + + local Prefs = + { + { "UserPrefGameplayShowStepsDisplay", true }, + { "UserPrefGameplayShowScore", false}, +--[[ { "ProTimingP1", false}, + { "ProTimingP2", false}, +--]] + }; + + local BPrefs = + { + { "UserPrefShowLotsaOptions", true}, + { "UserPrefLongFail", false}, + { "UserPrefProtimingP1", false}, + { "UserPrefProtimingP2", false}, + { "FlashyCombos", false}, + { "GameplayFooter", false}, + }; + + for idx,pref in ipairs(Prefs) do + if GetUserPref( pref[1] ) == nil then + SetUserPref( pref[1], pref[2] ); + end; + end; + + -- making sure I don't screw up anything yet... + for idx,pref in ipairs(BPrefs) do + if GetUserPrefB( pref[1] ) == nil then + SetUserPref( pref[1], pref[2] ); + end; + end; + +end; +--[[ theme option rows ]] +-- screen cover +function GetProTiming(pn) + local pname = ToEnumShortString(pn); + if GetUserPref("ProTiming"..pname) then + return GetUserPrefB("ProTiming"..pname); + else + SetUserPref("ProTiming"..pname,false); + return false; + end; +end; +function OptionRowProTiming() + local t = { + Name = "ProTiming"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = false; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + local bShow; + if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then + bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ); + if bShow then + list[2] = true; + else + list[1] = true; + end + else + list[1] = true; + end; +--[[ local pname = ToEnumShortString(pn); + + if getenv("ProTiming"..pname) == true then + list[2] = true; + else + list[1] = true; + end; --]] + end; + SaveSelections = function(self, list, pn) + local bSave; + if list[2] then + bSave = true; + else + bSave = false; + end; + SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave); +--[[ local val; + if list[2] then + val = true; + else + val = false; + end; + local pname = ToEnumShortString(pn); + setenv("ProTiming"..pname, val); --]] + end; + }; + setmetatable( t, t ); + return t; +end; + +function UserPrefGameplayShowScore() + local t = { + Name = "UserPrefGameplayShowScore"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then + if GetUserPrefB("UserPrefGameplayShowScore") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefGameplayShowScore",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefGameplayShowScore",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefGameplayShowStepsDisplay() + local t = { + Name = "UserPrefGameplayShowStepsDisplay"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then + if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefGameplayShowStepsDisplay",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefGameplayShowStepsDisplay",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefShowLotsaOptions() + local t = { + Name = "UserPrefShowLotsaOptions"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Many','Few' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then + if GetUserPrefB("UserPrefShowLotsaOptions") then + list[1] = true; + else + list[2] = true; + end; + else + WritePrefToFile("UserPrefShowLotsaOptions",false); + list[2] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[1] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefShowLotsaOptions",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function GetDefaultOptionLines() + local LineSets = { + "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All + "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx ) + }; + local function IsExtra() + if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then + return true + else + return false + end + end + if not IsExtra() then + if GetUserPrefB("UserPrefShowLotsaOptions") then + return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2]; + else + return LineSets[2]; -- Just make sure! + end + else + return "1,8,14,2,7,13,16,17,18" -- "failsafe" list + end +end; +function UserPrefLongFail() + local t = { + Name = "UserPrefLongFail"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Short','Long' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefLongFail") ~= nil then + if GetUserPrefB("UserPrefLongFail") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefLongFail",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefLongFail",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end +function UserPrefFlashyCombo() + local t = { + Name = "UserPrefFlashyCombo"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then + if GetUserPrefB("UserPrefFlashyCombo") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefFlashyCombo",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefFlashyCombo",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefGameplayFooter() + local t = { + Name = "UserPrefGameplayFooter"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("GameplayFooter") ~= nil then + if GetUserPrefB("GameplayFooter") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("GameplayFooter",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("GameplayFooter",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end +--[[ end themeoption rows ]] + +--[[ game option rows ]] +function GamePrefComboOnRolls() + local t = { + Name = "GamePrefComboOnRolls"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("ComboOnRolls") ~= nil then + if GetGamePrefB("ComboOnRolls") then + list[2] = true; + else + list[1] = true; + end; + else + WriteGamePrefToFile("ComboOnRolls",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WriteGamePrefToFile("ComboOnRolls",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end +function GamePrefComboUnderField() + local t = { + Name = "GamePrefComboUnderField"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("ComboUnderField") ~= nil then + if GetGamePrefB("ComboUnderField") then + list[2] = true; + else + list[1] = true; + end; + else + WriteGamePrefToFile("ComboUnderField",true); + list[2] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WriteGamePrefToFile("ComboUnderField",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function GamePrefAutoSetStyle() + local t = { + Name = "GamePrefAutoSetStyle"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("AutoSetStyle") ~= nil then + if GetGamePrefB("AutoSetStyle") then + list[2] = true; + else + list[1] = true; + end; + else + WriteGamePrefToFile("AutoSetStyle",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WriteGamePrefToFile("AutoSetStyle",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end +function GamePrefNotePosition() + local t = { + Name = "GamePrefNotePosition"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Normal','Lower' }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("NotePosition") ~= nil then + if GetGamePrefB("NotePosition") then + list[1] = true; + else + list[2] = true; + end; + else + WriteGamePrefToFile("NotePosition",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[1] then + val = true; + else + val = false; + end; + WriteGamePrefToFile("NotePosition",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function GamePrefDefaultFail() + local t = { + Name = "GamePrefDefaultFail"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("DefaultFail") ~= nil then + if GetGamePref("DefaultFail") then + if GetGamePref("DefaultFail") == "Immediate" then + list[1] = true; + elseif GetGamePref("DefaultFail") == "ImmediateContinue" then + list[2] = true; + elseif GetGamePref("DefaultFail") == "AtEnd" then + list[3] = true; + elseif GetGamePref("DefaultFail") == "Off" then + list[4] = true; + else + list[1] = true; + end + -- list[table.find( list, GetGamePref("DefaultFail") )] = true; + else + list[1] = true; + end; + else + WriteGamePrefToFile("DefaultFail","Immediate"); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + -- This is so stupid. + local tChoices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; + local val; + if list[1] then + val = tChoices[1]; + elseif list[2] then + val = tChoices[2]; + elseif list[3] then + val = tChoices[3]; + elseif list[4] then + val = tChoices[4]; + else + val = tChoices[1]; + end + WriteGamePrefToFile("DefaultFail",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end diff --git a/Themes/_fallback/Scripts/03 ThemeLibrary.lua b/Themes/_fallback/Scripts/03 ThemeLibrary.lua index c1974c4479..242ae03a56 100644 --- a/Themes/_fallback/Scripts/03 ThemeLibrary.lua +++ b/Themes/_fallback/Scripts/03 ThemeLibrary.lua @@ -1,42 +1,42 @@ --- theme library: juicy library that returns lua objects on demand. - -Library = { - GrooveRadar = function(self) - local function radarSet(self,player) - local selection = nil; - if GAMESTATE:IsCourseMode() then - if GAMESTATE:GetCurrentCourse() then - selection = GAMESTATE:GetCurrentTrail(player); - end; - else - if GAMESTATE:GetCurrentSong() then - selection = GAMESTATE:GetCurrentSteps(player); - end; - end; - if selection then - self:SetFromRadarValues(player, selection:GetRadarValues(player)); - else - self:SetEmpty(player); - end; - end - -- - local t = Def.ActorFrame { - Name="Radar"; - Def.GrooveRadar { - OnCommand=cmd(zoom,0;sleep,0.583;decelerate,0.150;zoom,1); - OffCommand=cmd(sleep,0.183;decelerate,0.167;zoom,0); - CurrentSongChangedMessageCommand=function(self) - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - radarSet(self, pn); - end; - end; - CurrentStepsP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end; - CurrentStepsP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end; - CurrentTrailP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end; - CurrentTrailP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end; - }; - }; - - return t; - end; +-- theme library: juicy library that returns lua objects on demand. + +Library = { + GrooveRadar = function(self) + local function radarSet(self,player) + local selection = nil; + if GAMESTATE:IsCourseMode() then + if GAMESTATE:GetCurrentCourse() then + selection = GAMESTATE:GetCurrentTrail(player); + end; + else + if GAMESTATE:GetCurrentSong() then + selection = GAMESTATE:GetCurrentSteps(player); + end; + end; + if selection then + self:SetFromRadarValues(player, selection:GetRadarValues(player)); + else + self:SetEmpty(player); + end; + end + -- + local t = Def.ActorFrame { + Name="Radar"; + Def.GrooveRadar { + OnCommand=cmd(zoom,0;sleep,0.583;decelerate,0.150;zoom,1); + OffCommand=cmd(sleep,0.183;decelerate,0.167;zoom,0); + CurrentSongChangedMessageCommand=function(self) + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + radarSet(self, pn); + end; + end; + CurrentStepsP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end; + CurrentStepsP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end; + CurrentTrailP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end; + CurrentTrailP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end; + }; + }; + + return t; + end; } \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 ThemePrefs.lua b/Themes/_fallback/Scripts/03 ThemePrefs.lua index aeca8f7a04..0a61da5741 100644 --- a/Themes/_fallback/Scripts/03 ThemePrefs.lua +++ b/Themes/_fallback/Scripts/03 ThemePrefs.lua @@ -1,141 +1,141 @@ ---[[ -ThemePrefs: handles the underlying structure for ThemePrefs, so any themes -built off of this can simply declare their prefs and default values, and -access them through this system. - -v0.7.1: Dec. 28, 2010. Added language support. -v0.7.0: Dec. 15, 2010. Initial version. - -vyhd wrote this for sm-ssc. <3 you guys ---]] - --- local function to handle themed error strings --- (and to ensure we're getting all of them from the same section) -local function GetString( name ) - return THEME:GetString( "ThemePrefs", name ) -end - -function PrintTable( tbl ) - Trace( "Printing table" ) - for k,v in pairs(tbl) do - Trace( ("[%s] -> %s"):format(tostring(k),tostring(v)) ) - end -end - -local ThemePrefsPath = "Save/ThemePrefs.ini"; -local FallbackTheme = "_fallback"; - --- This will be set on load. -local PrefsTable = nil; - --- Gets the name of the current theme using themeInfo --- if available and the ThemeManager name otherwise. -local function GetThemeName() - return themeInfo and themeInfo.Name or THEME:GetThemeDisplayName() -end - --- Given a preference name, returns the table it's in. Checks the current --- theme first, then _fallback, then all other sections, in that order. -local function ResolveTable( pref ) - -- check the section for this theme - local name = GetThemeName() - local val = PrefsTable[name][pref] - - if val ~= nil then - Trace( ("ResolveTable(%s): found in %s"):format(pref,name) ) - return PrefsTable[name] - end - - -- not in the current theme; check the fallback if it exists - if PrefsTable[FallbackTheme] then - val = PrefsTable[FallbackTheme][pref] - if val ~= nil then - Trace( ("ResolveTable(%s): found in fallback"):format(pref) ) - return PrefsTable[FallbackTheme] - end - end - - -- not there either. check every section. - -- XXX: we should do this less redundantly. - for section, _ in pairs(PrefsTable) do - val = PrefsTable[section][pref] - if val ~= nil then - Trace( ("ResolveTable(%s): found in section %s"):format(pref,section) ) - return PrefsTable[section] end - end - - -- not found at all - Trace( ("ResolveTable(%s): pref not found"):format(pref) ) - return nil -end - -ThemePrefs = -{ - NeedsSaved = false, - - -- Loads preferences from Save/ThemePrefs.ini, then adds theme - -- preferences (and default values if applicable) to PrefsTable. - -- Only read from disk once, when _fallback calls this; we just - -- need the base set once to add prefs onto. - Init = function( prefs, bLoadFromDisk ) - -- If we don't have IniFile, we can't read/write from/to disk - if not IniFile then Warn( GetString("IniFileMissing") ) end - - Trace( ("ThemePrefs.Init(prefs, %s)"):format(tostring(bLoadFromDisk)) ) - if bLoadFromDisk then - Trace( "ThemePrefs.Init: loading from disk" ) - if not ThemePrefs.Load() then return false end - end - - Trace( "ThemePrefs.Init: not loading from disk" ) - - -- create the section if it doesn't exist - local section = GetThemeName() - PrefsTable[section] = PrefsTable[section] and PrefsTable[section] or { } - - Trace( "Using section " .. section ) - - -- if the key doesn't exist, add it with our default value - for k, tbl in pairs(prefs) do - if not PrefsTable[section][k] then - Trace( k .. " doesn't exist, creating" ) - PrefsTable[section][k] = tbl.Default - end - end - - PrintTable( PrefsTable[section] ) - end, - - Load = function() - if not IniFile then return false end - PrefsTable = IniFile.ReadFile( ThemePrefsPath ) - return true - end, - - Save = function() - Trace( "ThemePrefs.Save" ) - if not IniFile then return false end - if not NeedsSaved then return end - NeedsSaved = false - IniFile.WriteFile( ThemePrefsPath, PrefsTable ) - end, - - Get = function( name ) - Trace( ("ThemePrefs.Get(%s)"):format(name) ) - local tbl = ResolveTable(name) - if tbl then return tbl[name] end - Warn( "Get: "..GetString("UnknownPreference"):format(name) ) - return nil - end, - - Set = function( name, value ) - Trace( ("ThemePrefs.Set(%s, %s)"):format(name, tostring(value)) ) - local tbl = ResolveTable(name) - if tbl then tbl[name] = value; NeedsSaved = true; return end - Warn( "Set: "..GetString("UnknownPreference"):format(name) ) - end, -}; - --- global aliases -GetThemePref = ThemePrefs.Get -SetThemePref = ThemePrefs.Set +--[[ +ThemePrefs: handles the underlying structure for ThemePrefs, so any themes +built off of this can simply declare their prefs and default values, and +access them through this system. + +v0.7.1: Dec. 28, 2010. Added language support. +v0.7.0: Dec. 15, 2010. Initial version. + +vyhd wrote this for sm-ssc. <3 you guys +--]] + +-- local function to handle themed error strings +-- (and to ensure we're getting all of them from the same section) +local function GetString( name ) + return THEME:GetString( "ThemePrefs", name ) +end + +function PrintTable( tbl ) + Trace( "Printing table" ) + for k,v in pairs(tbl) do + Trace( ("[%s] -> %s"):format(tostring(k),tostring(v)) ) + end +end + +local ThemePrefsPath = "Save/ThemePrefs.ini"; +local FallbackTheme = "_fallback"; + +-- This will be set on load. +local PrefsTable = nil; + +-- Gets the name of the current theme using themeInfo +-- if available and the ThemeManager name otherwise. +local function GetThemeName() + return themeInfo and themeInfo.Name or THEME:GetThemeDisplayName() +end + +-- Given a preference name, returns the table it's in. Checks the current +-- theme first, then _fallback, then all other sections, in that order. +local function ResolveTable( pref ) + -- check the section for this theme + local name = GetThemeName() + local val = PrefsTable[name][pref] + + if val ~= nil then + Trace( ("ResolveTable(%s): found in %s"):format(pref,name) ) + return PrefsTable[name] + end + + -- not in the current theme; check the fallback if it exists + if PrefsTable[FallbackTheme] then + val = PrefsTable[FallbackTheme][pref] + if val ~= nil then + Trace( ("ResolveTable(%s): found in fallback"):format(pref) ) + return PrefsTable[FallbackTheme] + end + end + + -- not there either. check every section. + -- XXX: we should do this less redundantly. + for section, _ in pairs(PrefsTable) do + val = PrefsTable[section][pref] + if val ~= nil then + Trace( ("ResolveTable(%s): found in section %s"):format(pref,section) ) + return PrefsTable[section] end + end + + -- not found at all + Trace( ("ResolveTable(%s): pref not found"):format(pref) ) + return nil +end + +ThemePrefs = +{ + NeedsSaved = false, + + -- Loads preferences from Save/ThemePrefs.ini, then adds theme + -- preferences (and default values if applicable) to PrefsTable. + -- Only read from disk once, when _fallback calls this; we just + -- need the base set once to add prefs onto. + Init = function( prefs, bLoadFromDisk ) + -- If we don't have IniFile, we can't read/write from/to disk + if not IniFile then Warn( GetString("IniFileMissing") ) end + + Trace( ("ThemePrefs.Init(prefs, %s)"):format(tostring(bLoadFromDisk)) ) + if bLoadFromDisk then + Trace( "ThemePrefs.Init: loading from disk" ) + if not ThemePrefs.Load() then return false end + end + + Trace( "ThemePrefs.Init: not loading from disk" ) + + -- create the section if it doesn't exist + local section = GetThemeName() + PrefsTable[section] = PrefsTable[section] and PrefsTable[section] or { } + + Trace( "Using section " .. section ) + + -- if the key doesn't exist, add it with our default value + for k, tbl in pairs(prefs) do + if not PrefsTable[section][k] then + Trace( k .. " doesn't exist, creating" ) + PrefsTable[section][k] = tbl.Default + end + end + + PrintTable( PrefsTable[section] ) + end, + + Load = function() + if not IniFile then return false end + PrefsTable = IniFile.ReadFile( ThemePrefsPath ) + return true + end, + + Save = function() + Trace( "ThemePrefs.Save" ) + if not IniFile then return false end + if not NeedsSaved then return end + NeedsSaved = false + IniFile.WriteFile( ThemePrefsPath, PrefsTable ) + end, + + Get = function( name ) + Trace( ("ThemePrefs.Get(%s)"):format(name) ) + local tbl = ResolveTable(name) + if tbl then return tbl[name] end + Warn( "Get: "..GetString("UnknownPreference"):format(name) ) + return nil + end, + + Set = function( name, value ) + Trace( ("ThemePrefs.Set(%s, %s)"):format(name, tostring(value)) ) + local tbl = ResolveTable(name) + if tbl then tbl[name] = value; NeedsSaved = true; return end + Warn( "Set: "..GetString("UnknownPreference"):format(name) ) + end, +}; + +-- global aliases +GetThemePref = ThemePrefs.Get +SetThemePref = ThemePrefs.Set diff --git a/Themes/_fallback/Scripts/03 ThemePrefsRows.lua b/Themes/_fallback/Scripts/03 ThemePrefsRows.lua index 3938c922e3..21ad8973c2 100644 --- a/Themes/_fallback/Scripts/03 ThemePrefsRows.lua +++ b/Themes/_fallback/Scripts/03 ThemePrefsRows.lua @@ -1,164 +1,164 @@ ---[[ -ThemePrefsRows: you give it the choices, values, and params, and it'll -generate the rest; quirky behavior to be outlined below. Documentation -will be provided once this system is stabilized. - -v0.5.2: Dec. 28, 2010. Throw an error for default/value type mismatches. -v0.5.1: Dec. 27, 2010. Fix Choices not necessarily being strings. -v0.5.0: Dec. 15, 2010. Initial version. Not very well tested. - -vyhd wrote this for sm-ssc ---]] - --- unless overridden, these parameters will be used for the OptionsRow -local DefaultParams = -{ - LayoutType = "ShowAllInRow", - SelectType = "SelectOne", - OneChoiceForAllPlayers = true, - ExportOnChange = false, - EnabledForPlayers = nil, - ReloadRowMessages = nil, - - -- takes a function(self, list, pn); - -- if not used, we use the default - LoadSelections = nil, - SaveSelections = nil, -} - --- local alias to simplify error reporting -local function GetString( name ) - return THEME:GetString( "ThemePrefsRows", name ) -end - -local function DefaultLoad( pref, default, choices, values ) - return function(self, list, pn) - local val = ThemePrefs.Get( pref ) - - -- if our current value is here, set focus to that - for i=1, #choices do - if values[i] == val then list[i] = true return end - end - - -- try the default value - for i=1, #choices do - if values[i] == default then list[i] = true return end - end - - -- set to the first value and output a warning - Warn( GetString("NoDefaultInValues"):format(pref) ) - list[1] = true - end -end - -local function DefaultSave( pref, choices, values ) - local msg = "ThemePrefChanged" - local params = { Name = pref } - - return function(self, list, pn) - for i=1, #choices do - if list[i] then ThemePrefs.Set( pref, values[i] ) break end - MESSAGEMAN:Broadcast( msg, params ) - end - end -end - --- This function checks for mismatches between the default value and the --- values table passed to the ThemePrefRow, e.g. it will return false if --- you have a boolean default and an integer value. I'm somewhat stricter --- about types than Lua is because I don't like the unpredictability and --- complexity of coercing values transparently in a bunch of places. -local function TypesMatch( Values, Default ) - local DefaultType = type(Default) - - for i, value in ipairs(Values) do - local ValueType = type(value) - if ValueType ~= DefaultType then - Warn( GetString("TypeMismatch"):format(DefaultType, i, ValueType) ) - return false - end - end - - return true -end - -local function CreateThemePrefRow( pref, tbl ) - -- can't make an option handler without options - if not tbl.Choices then return nil end - - local Choices = tbl.Choices - local Default = tbl.Default - local Values = tbl.Values and tbl.Values or Choices - local Params = tbl.Params and tbl.Params or { } - - -- if the choices aren't strings, make them strings now - for i, str in ipairs(Choices) do - Choices[i] = tostring( Choices[i] ) - end - - -- check to see that Values and Choices have the same length - if #Choices ~= #Values then - Warn( GetString("ChoicesSizeMismatch") ) - return nil - end - - -- check to see that everything in Values matches the type of Default - if not TypesMatch( Values, Default ) then return nil end - - -- set the name and choices here; we'll do the rest below - local Handler = { Name = pref, Choices = Choices } - - -- add all the keys in DefaultParams, get the value from - -- Params if it exists and DefaultParams otherwise - -- (note that we explicitly check for nil, due to bools.) - for k, _ in pairs(DefaultParams) do - Handler[k] = Params[k] ~= nil and Params[k] or DefaultParams[k] - end - - -- if we don't have LoadSelections and SaveSelections, make them - if not Handler.LoadSelections then - Handler.LoadSelections = DefaultLoad( pref, Default, Choices, Values ) - end - - if not Handler.SaveSelections then - Handler.SaveSelections = DefaultSave( pref, Choices, Values ) - end - - return Handler -end - --- All OptionsRows for preferences are stuck in this table, accessible --- through GetRow('name') in the namespace or ThemePrefRow('name') in --- the global namespace. (I like to keep pollution to a minimum.) -local Rows = { } - -ThemePrefsRows = -{ - IsInitted = false, - - Init = function( prefs ) - for pref, tbl in pairs(prefs) do - Rows[pref] = CreateThemePrefRow( pref, tbl ) - end - end, - - GetRow = function( pref ) - Trace( ("GetRow(%s), type %s"):format(pref, type(Rows[pref])) ) - return Rows[pref] - end, - -} - --- Global namespace alias -ThemePrefRow = ThemePrefsRows.GetRow - --- UGLY: declare this here, even though it's in the previous namespace, --- so we can have one call to initialize both systems (ThemePrefsRow is --- declared after ThemePrefs, so it can't actually be in that file...) - -ThemePrefs.InitAll = function( prefs ) - Trace( "ThemePrefs.InitAll( prefs )" ) - - ThemePrefs.Init( prefs, true ) - ThemePrefsRows.Init( prefs ) -end +--[[ +ThemePrefsRows: you give it the choices, values, and params, and it'll +generate the rest; quirky behavior to be outlined below. Documentation +will be provided once this system is stabilized. + +v0.5.2: Dec. 28, 2010. Throw an error for default/value type mismatches. +v0.5.1: Dec. 27, 2010. Fix Choices not necessarily being strings. +v0.5.0: Dec. 15, 2010. Initial version. Not very well tested. + +vyhd wrote this for sm-ssc +--]] + +-- unless overridden, these parameters will be used for the OptionsRow +local DefaultParams = +{ + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = true, + ExportOnChange = false, + EnabledForPlayers = nil, + ReloadRowMessages = nil, + + -- takes a function(self, list, pn); + -- if not used, we use the default + LoadSelections = nil, + SaveSelections = nil, +} + +-- local alias to simplify error reporting +local function GetString( name ) + return THEME:GetString( "ThemePrefsRows", name ) +end + +local function DefaultLoad( pref, default, choices, values ) + return function(self, list, pn) + local val = ThemePrefs.Get( pref ) + + -- if our current value is here, set focus to that + for i=1, #choices do + if values[i] == val then list[i] = true return end + end + + -- try the default value + for i=1, #choices do + if values[i] == default then list[i] = true return end + end + + -- set to the first value and output a warning + Warn( GetString("NoDefaultInValues"):format(pref) ) + list[1] = true + end +end + +local function DefaultSave( pref, choices, values ) + local msg = "ThemePrefChanged" + local params = { Name = pref } + + return function(self, list, pn) + for i=1, #choices do + if list[i] then ThemePrefs.Set( pref, values[i] ) break end + MESSAGEMAN:Broadcast( msg, params ) + end + end +end + +-- This function checks for mismatches between the default value and the +-- values table passed to the ThemePrefRow, e.g. it will return false if +-- you have a boolean default and an integer value. I'm somewhat stricter +-- about types than Lua is because I don't like the unpredictability and +-- complexity of coercing values transparently in a bunch of places. +local function TypesMatch( Values, Default ) + local DefaultType = type(Default) + + for i, value in ipairs(Values) do + local ValueType = type(value) + if ValueType ~= DefaultType then + Warn( GetString("TypeMismatch"):format(DefaultType, i, ValueType) ) + return false + end + end + + return true +end + +local function CreateThemePrefRow( pref, tbl ) + -- can't make an option handler without options + if not tbl.Choices then return nil end + + local Choices = tbl.Choices + local Default = tbl.Default + local Values = tbl.Values and tbl.Values or Choices + local Params = tbl.Params and tbl.Params or { } + + -- if the choices aren't strings, make them strings now + for i, str in ipairs(Choices) do + Choices[i] = tostring( Choices[i] ) + end + + -- check to see that Values and Choices have the same length + if #Choices ~= #Values then + Warn( GetString("ChoicesSizeMismatch") ) + return nil + end + + -- check to see that everything in Values matches the type of Default + if not TypesMatch( Values, Default ) then return nil end + + -- set the name and choices here; we'll do the rest below + local Handler = { Name = pref, Choices = Choices } + + -- add all the keys in DefaultParams, get the value from + -- Params if it exists and DefaultParams otherwise + -- (note that we explicitly check for nil, due to bools.) + for k, _ in pairs(DefaultParams) do + Handler[k] = Params[k] ~= nil and Params[k] or DefaultParams[k] + end + + -- if we don't have LoadSelections and SaveSelections, make them + if not Handler.LoadSelections then + Handler.LoadSelections = DefaultLoad( pref, Default, Choices, Values ) + end + + if not Handler.SaveSelections then + Handler.SaveSelections = DefaultSave( pref, Choices, Values ) + end + + return Handler +end + +-- All OptionsRows for preferences are stuck in this table, accessible +-- through GetRow('name') in the namespace or ThemePrefRow('name') in +-- the global namespace. (I like to keep pollution to a minimum.) +local Rows = { } + +ThemePrefsRows = +{ + IsInitted = false, + + Init = function( prefs ) + for pref, tbl in pairs(prefs) do + Rows[pref] = CreateThemePrefRow( pref, tbl ) + end + end, + + GetRow = function( pref ) + Trace( ("GetRow(%s), type %s"):format(pref, type(Rows[pref])) ) + return Rows[pref] + end, + +} + +-- Global namespace alias +ThemePrefRow = ThemePrefsRows.GetRow + +-- UGLY: declare this here, even though it's in the previous namespace, +-- so we can have one call to initialize both systems (ThemePrefsRow is +-- declared after ThemePrefs, so it can't actually be in that file...) + +ThemePrefs.InitAll = function( prefs ) + Trace( "ThemePrefs.InitAll( prefs )" ) + + ThemePrefs.Init( prefs, true ) + ThemePrefsRows.Init( prefs ) +end diff --git a/Themes/_fallback/Scripts/03 UserPreferences2.lua b/Themes/_fallback/Scripts/03 UserPreferences2.lua index eed6d16823..644eecbb78 100644 --- a/Themes/_fallback/Scripts/03 UserPreferences2.lua +++ b/Themes/_fallback/Scripts/03 UserPreferences2.lua @@ -1,147 +1,147 @@ --- UserPreferences: User Preferences "Module" --- Written by AJ Kelly of KKI Labs / Version 2.11-ssc --- (modified slightly for Cerulean Skies 2's disregard of the name of the --- themeinfo variable lol :p) - ---[[ -the first released version was broken. -this version aims to be simpler, and therefore work. - -[changelog] - -v2.11-ssc - Remove EnvUtils references; we have it in sm-ssc. - -v2.1-ssc - sm-ssc version of UserPrefs. We can now assume players have certain - functionality, like RageFile:GetError(). - -v2.1 - Added type specific GetUserPref functions. - -[usage] -First, edit PrefPath to match your theme. -If you use ThemeInfo, then you shouldn't have to edit this. - -If you're not using ThemeInfo, then you can replace - -".. themeInfo.Name .." with the theme's folder name. - -ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua - -After that's set up, read the docs. -]] -local PrefPath = "Data/UserPrefs/".. THEME:GetThemeDisplayName() .."/" - ---[[ begin internal stuff; no need to edit below this line. ]] - --- Local internal function to write envs. ___Not for themer use.___ -local function WriteEnv(envName,envValue) - return setenv(envName,envValue) -end - -function ReadPrefFromFile(name) - local f = RageFileUtil.CreateRageFile() - local fullFilename = PrefPath..name..".cfg" - local option - - if f:Open(fullFilename,1) then - option = tostring( f:Read() ) - WriteEnv(name,option) - f:destroy() - return option - else - local fError = f:GetError() - Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError ) - f:ClearError() - f:destroy() - return nil - end -end - -function WritePrefToFile(name,value) - local f = RageFileUtil.CreateRageFile() - local fullFilename = PrefPath..name..".cfg" - - if f:Open(fullFilename, 2) then - f:Write( tostring(value) ) - WriteEnv(name,value) - else - local fError = f:GetError() - Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError ) - f:ClearError() - f:destroy() - return false - end - - f:destroy() - return true -end - ---[[ end internal functions; still don't edit below this line ]] - -function GetUserPref(name) - return ReadPrefFromFile(name) -end - -function SetUserPref(name,value) - return WritePrefToFile(name,value) -end - ---[[ type specific, for when you want to be lazy ]] --- XXX: make set funcs, since I hate dealing with colors and I know --- other themers would too. - --- GetUserPrefB: boolean -function GetUserPrefB(name) - -- this one is a bit trickier. - local pref = ReadPrefFromFile(name) - - if type(pref) == "string" then - pref = string.lower(pref) - if pref == "true" or cmp == "t" then - return true - elseif pref == "false" or cmp == "f" then - return false - else - Trace("Error in GetUserPrefB(".. name ..") converting from string" ) - return false - end - elseif type(pref) == "number" then - -- both 0 and -1 are false; if you want to change this, - -- feel free to remove "or pref == -1". - if pref == 0 or pref == -1 then - - else - return true - end - end -end - --- GetUserPrefC: color -function GetUserPrefC(name) - -- XXX: make sure it's grabbing a string that can be turned into a color - -- and also possibly handle HSV values too. - return color( ReadPrefFromFile(name) ) -end - --- GetUserPrefN: numbers (integers, floats) -function GetUserPrefN(name) - return tonumber( ReadPrefFromFile(name) ) -end - ---[[ -Copyright 2008-2009 AJ Kelly/KKI Labs -All rights reserved. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- UserPreferences: User Preferences "Module" +-- Written by AJ Kelly of KKI Labs / Version 2.11-ssc +-- (modified slightly for Cerulean Skies 2's disregard of the name of the +-- themeinfo variable lol :p) + +--[[ +the first released version was broken. +this version aims to be simpler, and therefore work. + +[changelog] + +v2.11-ssc + Remove EnvUtils references; we have it in sm-ssc. + +v2.1-ssc + sm-ssc version of UserPrefs. We can now assume players have certain + functionality, like RageFile:GetError(). + +v2.1 + Added type specific GetUserPref functions. + +[usage] +First, edit PrefPath to match your theme. +If you use ThemeInfo, then you shouldn't have to edit this. + +If you're not using ThemeInfo, then you can replace + +".. themeInfo.Name .." with the theme's folder name. + +ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua + +After that's set up, read the docs. +]] +local PrefPath = "Data/UserPrefs/".. THEME:GetThemeDisplayName() .."/" + +--[[ begin internal stuff; no need to edit below this line. ]] + +-- Local internal function to write envs. ___Not for themer use.___ +local function WriteEnv(envName,envValue) + return setenv(envName,envValue) +end + +function ReadPrefFromFile(name) + local f = RageFileUtil.CreateRageFile() + local fullFilename = PrefPath..name..".cfg" + local option + + if f:Open(fullFilename,1) then + option = tostring( f:Read() ) + WriteEnv(name,option) + f:destroy() + return option + else + local fError = f:GetError() + Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError ) + f:ClearError() + f:destroy() + return nil + end +end + +function WritePrefToFile(name,value) + local f = RageFileUtil.CreateRageFile() + local fullFilename = PrefPath..name..".cfg" + + if f:Open(fullFilename, 2) then + f:Write( tostring(value) ) + WriteEnv(name,value) + else + local fError = f:GetError() + Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError ) + f:ClearError() + f:destroy() + return false + end + + f:destroy() + return true +end + +--[[ end internal functions; still don't edit below this line ]] + +function GetUserPref(name) + return ReadPrefFromFile(name) +end + +function SetUserPref(name,value) + return WritePrefToFile(name,value) +end + +--[[ type specific, for when you want to be lazy ]] +-- XXX: make set funcs, since I hate dealing with colors and I know +-- other themers would too. + +-- GetUserPrefB: boolean +function GetUserPrefB(name) + -- this one is a bit trickier. + local pref = ReadPrefFromFile(name) + + if type(pref) == "string" then + pref = string.lower(pref) + if pref == "true" or cmp == "t" then + return true + elseif pref == "false" or cmp == "f" then + return false + else + Trace("Error in GetUserPrefB(".. name ..") converting from string" ) + return false + end + elseif type(pref) == "number" then + -- both 0 and -1 are false; if you want to change this, + -- feel free to remove "or pref == -1". + if pref == 0 or pref == -1 then + + else + return true + end + end +end + +-- GetUserPrefC: color +function GetUserPrefC(name) + -- XXX: make sure it's grabbing a string that can be turned into a color + -- and also possibly handle HSV values too. + return color( ReadPrefFromFile(name) ) +end + +-- GetUserPrefN: numbers (integers, floats) +function GetUserPrefN(name) + return tonumber( ReadPrefFromFile(name) ) +end + +--[[ +Copyright 2008-2009 AJ Kelly/KKI Labs +All rights reserved. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] \ No newline at end of file diff --git a/Themes/_fallback/Scripts/04 FileUtils.lua b/Themes/_fallback/Scripts/04 FileUtils.lua index dbac909328..5aed0fa97b 100644 --- a/Themes/_fallback/Scripts/04 FileUtils.lua +++ b/Themes/_fallback/Scripts/04 FileUtils.lua @@ -1,32 +1,32 @@ --- fileutils: quick and dirty, not user prefs oriented file io -File = { - Write = function(path,buf) - local f = RageFileUtil.CreateRageFile() - if f:Open(path, 2) then - f:Write( tostring(buf) ) - f:destroy() - return true - else - Trace( "[FileUtils] Error writing to ".. path ..": ".. f:GetError() ) - f:ClearError() - f:destroy() - return false - end - end, - Read = function(path) - local f = RageFileUtil.CreateRageFile() - local ret = "" - if f:Open(path, 1) then - ret = tostring( f:Read() ) - f:destroy() - return ret - else - Trace( "[FileUtils] Error reading from ".. path ..": ".. f:GetError() ) - f:ClearError() - f:destroy() - return nil - end - end -} --- this code if public domain and/or has no copyright, depending on your +-- fileutils: quick and dirty, not user prefs oriented file io +File = { + Write = function(path,buf) + local f = RageFileUtil.CreateRageFile() + if f:Open(path, 2) then + f:Write( tostring(buf) ) + f:destroy() + return true + else + Trace( "[FileUtils] Error writing to ".. path ..": ".. f:GetError() ) + f:ClearError() + f:destroy() + return false + end + end, + Read = function(path) + local f = RageFileUtil.CreateRageFile() + local ret = "" + if f:Open(path, 1) then + ret = tostring( f:Read() ) + f:destroy() + return ret + else + Trace( "[FileUtils] Error reading from ".. path ..": ".. f:GetError() ) + f:ClearError() + f:destroy() + return nil + end + end +} +-- this code if public domain and/or has no copyright, depending on your -- country's laws. I wish for you to use this code freely, without restriction. \ No newline at end of file diff --git a/Themes/_fallback/Scripts/04 WidescreenHelpers.lua b/Themes/_fallback/Scripts/04 WidescreenHelpers.lua index 87c97bf49f..5d15401ff1 100644 --- a/Themes/_fallback/Scripts/04 WidescreenHelpers.lua +++ b/Themes/_fallback/Scripts/04 WidescreenHelpers.lua @@ -1,26 +1,26 @@ --- supported aspect ratios; some of which I will ignore --- only really pay attention to any ratio marked with a star; --- I don't think anyone uses 3:4, 1:1, or 8:3. --- (Archer added 5:4 later and I didn't account for it yet.) -AspectRatios = { - ThreeFour = 0.75, -- (576x760 at 1024x768) - OneOne = 1.0, -- 480x480 (uses Y) - FiveFour = 1.25, -- 600x480 (1280x1024 is a real use case) - FourThree = 1.33333, --* 640x480 - SixteenTen = 1.6, --* 720x480 - SixteenNine = 1.77778, --* 853x480 - EightThree = 2.66666 -- 1280x480 -} - -function IsUsingWideScreen() - return GetScreenAspectRatio() >= 1.6 -end - --- take and use it as you like, I don't care -aj --- (although I should mention this file was specific to moonlight and was pretty --- bad before some editing. -aj) - --- this one is good though: -function WideScale(AR4_3, AR16_9) - return scale( SCREEN_WIDTH, 640, 854, AR4_3, AR16_9 ) +-- supported aspect ratios; some of which I will ignore +-- only really pay attention to any ratio marked with a star; +-- I don't think anyone uses 3:4, 1:1, or 8:3. +-- (Archer added 5:4 later and I didn't account for it yet.) +AspectRatios = { + ThreeFour = 0.75, -- (576x760 at 1024x768) + OneOne = 1.0, -- 480x480 (uses Y) + FiveFour = 1.25, -- 600x480 (1280x1024 is a real use case) + FourThree = 1.33333, --* 640x480 + SixteenTen = 1.6, --* 720x480 + SixteenNine = 1.77778, --* 853x480 + EightThree = 2.66666 -- 1280x480 +} + +function IsUsingWideScreen() + return GetScreenAspectRatio() >= 1.6 +end + +-- take and use it as you like, I don't care -aj +-- (although I should mention this file was specific to moonlight and was pretty +-- bad before some editing. -aj) + +-- this one is good though: +function WideScale(AR4_3, AR16_9) + return scale( SCREEN_WIDTH, 640, 854, AR4_3, AR16_9 ) end \ No newline at end of file diff --git a/Themes/_fallback/Scripts/hierarchy.txt b/Themes/_fallback/Scripts/hierarchy.txt index 0f754486c4..a4fb7e51cc 100644 --- a/Themes/_fallback/Scripts/hierarchy.txt +++ b/Themes/_fallback/Scripts/hierarchy.txt @@ -1,92 +1,92 @@ -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. It's also important -to know that StepMania 4 (as of alpha 5) will not read scripts in subdirectories. - -In sm-ssc, there are five rings of script execution: - -00 - Initialization -________________________________________________________________________________ -01 - Base -There are three base scripts. "01 base.lua" is taken from StepMania 4's default -theme and sets up very important function overrides and the "Var" alias (for -lua.GetThreadVariable). The other two base scripts are sm-ssc specific. - -"01 alias.lua" contains non-compatibility aliases. To quote the file itself: -"This is mainly here for making commands case-insensitive without needing to -clutter up the C++ code. It can also be used to add custom functions that -wouldn't otherwise belong somewhere else." - -"01 compat.lua" sets up compatibility aliases for some commands. Some commands -were deprecated in sm-ssc (e.g. hidden), while others were renamed. If a problem -was solved differently in sm-ssc, the corresponding StepMania 4 functions should -live in here, and not the C++ code. (The prime example of this being -PlayerStageStats:IsFullComboW* from SM4, whereas we have -PlayerStageStats:FullComboOfScore, with the tap note score being passed in.) -________________________________________________________________________________ -02 - Defaults -The "02" scripts are pretty much the same scripts you'd find in StepMania 4's -default theme. Some scripts do exhibit differences, however. The most notable -of these changes is to "02 Color.lua", which adds a color library to the old -StepMania 4 Colors script. -________________________________________________________________________________ -03 - Extensions -Scripts that extend normal (StepMania 4 default theme) functionality belong -in the fourth ring. A number of these scripts come from KKI Labs (EnvUtils2, -CustomSpeedMods, UserPreferences2), while others are from other themes (HSV) -or written for sm-ssc (DateTime, Gameplay). -________________________________________________________________________________ -04 - ? -FileUtils and WidescreenHelpers are in the fifth ring. To be honest, I don't -know why they were moved out here. -aj - -================================================================================ -previously: -SMOKE WEED '98 Scripts Directory Organization, -or "An applied case of application of prefixes to control order of execution". - -Based on the original document for NCRX by Synikal, updated for SW98 by various -members of the NAKET Team. -------------------------------------------------------------------------------- -The general idea is that the order of execution in some scripts does matter. -We can use filenames in order to load certain files before others. - -It is important to note that you do not always need to follow this order, -especially if certain scripts do not require any dependencies. Typically, -most scripts do not require hierarchy setup, only certain situations -require it. - -Here is how we see the general hierarchy at NAKET HQ: - -00 = Initialization. Things that get called at the beginning of a theme. -This is good for things that are required by everything. It's considered bad -form to execute your own code before init, but there are ways around it if you -do need to go around it. - -Examples include 00 init.lua (SM4 default) and 00 themeInfo.lua (various themes). - -01 = Base. After the initialization, the base layer goes on top and adds more -core functionality to StepMania themes. - -Examples include 01 base.lua (SM4 default) and various 01 files in sm-ssc's -fallback theme. In sm-ssc, these are treated differently than in normal SM4; -01 files are used for aliasing/compatibility commands, which are just as -important as 01 base.lua. ----- -From here on out, these aren't officially used by the normal StepMania -developers; they were invented by other themers. - -02 = Extensions. Generally, these are third party extensions, such as the KKI -Labs stuff or vyhd's Genre Generator. - -03 = Theme-specific. This layer came into existence with dubaiOne/moonlight. - -It should be noted that this is still talking about StepMania 4 alphas, as -sm-ssc introduces loading Scripts/folderA, Scripts/folderB, etc. (just not +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. It's also important +to know that StepMania 4 (as of alpha 5) will not read scripts in subdirectories. + +In sm-ssc, there are five rings of script execution: + +00 - Initialization +________________________________________________________________________________ +01 - Base +There are three base scripts. "01 base.lua" is taken from StepMania 4's default +theme and sets up very important function overrides and the "Var" alias (for +lua.GetThreadVariable). The other two base scripts are sm-ssc specific. + +"01 alias.lua" contains non-compatibility aliases. To quote the file itself: +"This is mainly here for making commands case-insensitive without needing to +clutter up the C++ code. It can also be used to add custom functions that +wouldn't otherwise belong somewhere else." + +"01 compat.lua" sets up compatibility aliases for some commands. Some commands +were deprecated in sm-ssc (e.g. hidden), while others were renamed. If a problem +was solved differently in sm-ssc, the corresponding StepMania 4 functions should +live in here, and not the C++ code. (The prime example of this being +PlayerStageStats:IsFullComboW* from SM4, whereas we have +PlayerStageStats:FullComboOfScore, with the tap note score being passed in.) +________________________________________________________________________________ +02 - Defaults +The "02" scripts are pretty much the same scripts you'd find in StepMania 4's +default theme. Some scripts do exhibit differences, however. The most notable +of these changes is to "02 Color.lua", which adds a color library to the old +StepMania 4 Colors script. +________________________________________________________________________________ +03 - Extensions +Scripts that extend normal (StepMania 4 default theme) functionality belong +in the fourth ring. A number of these scripts come from KKI Labs (EnvUtils2, +CustomSpeedMods, UserPreferences2), while others are from other themes (HSV) +or written for sm-ssc (DateTime, Gameplay). +________________________________________________________________________________ +04 - ? +FileUtils and WidescreenHelpers are in the fifth ring. To be honest, I don't +know why they were moved out here. -aj + +================================================================================ +previously: +SMOKE WEED '98 Scripts Directory Organization, +or "An applied case of application of prefixes to control order of execution". + +Based on the original document for NCRX by Synikal, updated for SW98 by various +members of the NAKET Team. +------------------------------------------------------------------------------- +The general idea is that the order of execution in some scripts does matter. +We can use filenames in order to load certain files before others. + +It is important to note that you do not always need to follow this order, +especially if certain scripts do not require any dependencies. Typically, +most scripts do not require hierarchy setup, only certain situations +require it. + +Here is how we see the general hierarchy at NAKET HQ: + +00 = Initialization. Things that get called at the beginning of a theme. +This is good for things that are required by everything. It's considered bad +form to execute your own code before init, but there are ways around it if you +do need to go around it. + +Examples include 00 init.lua (SM4 default) and 00 themeInfo.lua (various themes). + +01 = Base. After the initialization, the base layer goes on top and adds more +core functionality to StepMania themes. + +Examples include 01 base.lua (SM4 default) and various 01 files in sm-ssc's +fallback theme. In sm-ssc, these are treated differently than in normal SM4; +01 files are used for aliasing/compatibility commands, which are just as +important as 01 base.lua. +---- +From here on out, these aren't officially used by the normal StepMania +developers; they were invented by other themers. + +02 = Extensions. Generally, these are third party extensions, such as the KKI +Labs stuff or vyhd's Genre Generator. + +03 = Theme-specific. This layer came into existence with dubaiOne/moonlight. + +It should be noted that this is still talking about StepMania 4 alphas, as +sm-ssc introduces loading Scripts/folderA, Scripts/folderB, etc. (just not Scripts/folderA/folderB/ although why would you need that?) \ No newline at end of file diff --git a/Themes/_fallback/Sounds/ScreenEdit AddNote.redir b/Themes/_fallback/Sounds/ScreenEdit AddNote.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_fallback/Sounds/ScreenEdit AddNote.redir +++ b/Themes/_fallback/Sounds/ScreenEdit AddNote.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_fallback/Sounds/ScreenEdit RemoveNote.redir b/Themes/_fallback/Sounds/ScreenEdit RemoveNote.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_fallback/Sounds/ScreenEdit RemoveNote.redir +++ b/Themes/_fallback/Sounds/ScreenEdit RemoveNote.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_fallback/Sounds/ScreenEdit line.redir b/Themes/_fallback/Sounds/ScreenEdit line.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_fallback/Sounds/ScreenEdit line.redir +++ b/Themes/_fallback/Sounds/ScreenEdit line.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_fallback/Sounds/ScreenEdit marker.redir b/Themes/_fallback/Sounds/ScreenEdit marker.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_fallback/Sounds/ScreenEdit marker.redir +++ b/Themes/_fallback/Sounds/ScreenEdit marker.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_fallback/Sounds/ScreenEdit music.redir b/Themes/_fallback/Sounds/ScreenEdit music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_fallback/Sounds/ScreenEdit music.redir +++ b/Themes/_fallback/Sounds/ScreenEdit music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_fallback/Sounds/ScreenEdit snap.redir b/Themes/_fallback/Sounds/ScreenEdit snap.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_fallback/Sounds/ScreenEdit snap.redir +++ b/Themes/_fallback/Sounds/ScreenEdit snap.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_fallback/Sounds/ScreenEdit switch steps.redir b/Themes/_fallback/Sounds/ScreenEdit switch steps.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_fallback/Sounds/ScreenEdit switch steps.redir +++ b/Themes/_fallback/Sounds/ScreenEdit switch steps.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_fallback/Sounds/ScreenEdit value decrease.redir b/Themes/_fallback/Sounds/ScreenEdit value decrease.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_fallback/Sounds/ScreenEdit value decrease.redir +++ b/Themes/_fallback/Sounds/ScreenEdit value decrease.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_fallback/Sounds/ScreenEdit value increase.redir b/Themes/_fallback/Sounds/ScreenEdit value increase.redir index fd4a9c9c68..ea37451d46 100644 --- a/Themes/_fallback/Sounds/ScreenEdit value increase.redir +++ b/Themes/_fallback/Sounds/ScreenEdit value increase.redir @@ -1 +1 @@ -_switch up +_switch up diff --git a/Themes/_fallback/Sounds/ScreenEditCourseSubmenu difficulty changed.redir b/Themes/_fallback/Sounds/ScreenEditCourseSubmenu difficulty changed.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_fallback/Sounds/ScreenEditCourseSubmenu difficulty changed.redir +++ b/Themes/_fallback/Sounds/ScreenEditCourseSubmenu difficulty changed.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_fallback/Sounds/ScreenNetSelectBase change opt.redir b/Themes/_fallback/Sounds/ScreenNetSelectBase change opt.redir index 16e4182dfe..5c93a18f43 100644 --- a/Themes/_fallback/Sounds/ScreenNetSelectBase change opt.redir +++ b/Themes/_fallback/Sounds/ScreenNetSelectBase change opt.redir @@ -1 +1 @@ -Common value +Common value diff --git a/Themes/_fallback/Sounds/ScreenNetSelectBase change sel.redir b/Themes/_fallback/Sounds/ScreenNetSelectBase change sel.redir index 16e4182dfe..5c93a18f43 100644 --- a/Themes/_fallback/Sounds/ScreenNetSelectBase change sel.redir +++ b/Themes/_fallback/Sounds/ScreenNetSelectBase change sel.redir @@ -1 +1 @@ -Common value +Common value diff --git a/Themes/_fallback/Sounds/ScreenPrompt change.redir b/Themes/_fallback/Sounds/ScreenPrompt change.redir index 16e4182dfe..5c93a18f43 100644 --- a/Themes/_fallback/Sounds/ScreenPrompt change.redir +++ b/Themes/_fallback/Sounds/ScreenPrompt change.redir @@ -1 +1 @@ -Common value +Common value diff --git a/Themes/_fallback/Sounds/ScreenSMOnlineSelectMusic change sel.redir b/Themes/_fallback/Sounds/ScreenSMOnlineSelectMusic change sel.redir index 16e4182dfe..5c93a18f43 100644 --- a/Themes/_fallback/Sounds/ScreenSMOnlineSelectMusic change sel.redir +++ b/Themes/_fallback/Sounds/ScreenSMOnlineSelectMusic change sel.redir @@ -1 +1 @@ -Common value +Common value diff --git a/Themes/_fallback/Sounds/_Music title (loop).sm b/Themes/_fallback/Sounds/_Music title (loop).sm index 0c6a1d3c72..847227b480 100644 --- a/Themes/_fallback/Sounds/_Music title (loop).sm +++ b/Themes/_fallback/Sounds/_Music title (loop).sm @@ -1,5 +1,5 @@ -#TITLE:Love Is Eternity A; -#OFFSET:0.000; -#BPMS:0.000=140.000; -#STOPS:; - +#TITLE:Love Is Eternity A; +#OFFSET:0.000; +#BPMS:0.000=140.000; +#STOPS:; + diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index a630a60fc3..cd1040325c 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -1,4234 +1,4234 @@ -# This probably is hard to understand from the way it was made in the first -# place, so instead just pay attention to each group, which has tons of -# notes - -# 01 # Global -# 02 # Managers -# 03 # Singletons -# 04 # Global Screen -# 05 # Base Screens -# 06 # Derivative Screens -# 07 # Etc - -# 01 # -[Global] -# This basically means that all other themes get information from this theme. -# It's really awesome for making mods n stuff -IsBaseTheme=1 - -[Common] -# How big the design of the theme is. for example, if a theme was designed for -# 1080p, it would be shrunken for 640x480, as well as that, if it was designed -# for 480p, it would be enlarged for bigger screens! -ScreenWidth=1 -ScreenHeight=480 - -# Allows you to pick all available game modes for your gametype: for example, -# inserting enough coins for 1p would let you choose between solo, single -# and double before each game -AutoSetStyle=GetGamePrefB("AutoSetStyle") - -# Default modifiers and noteskin. -DefaultModifiers="default;1.5x;" -DefaultNoteSkinName="default" - -# Difficulties to show. Useful for custom games where you want to hide these. -DifficultiesToShow="beginner,easy,medium,hard,challenge" -# Same as above, but for courses. -CourseDifficultiesToShow="easy,medium,hard" -# Things to hide. You couldn't play cabinet anyways. -StepsTypesToHide="lights-cabinet" -#~ StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet" - -# The number of entries before "Various" is shown on the BPMDisplay, etc. -MaxCourseEntriesBeforeShowVarious=10 - -# The screen that appears when pressing the operator button. -OperatorMenuScreen="ScreenOptionsService" - -# The first screen in the attract cycle. -FirstAttractScreen="ScreenDemonstration" - -# First screen that pops up when you start the game. ScreenInit in particular -# shows the theme information before going to the title screen. -InitialScreen="ScreenInit" - -# Music selection screen used after downloading files. -SelectMusicScreen="ScreenSelectMusic" - -# Screens that show over everything else. -# Only mess with this if you know what you're doing. -OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay,ScreenConsoleOverlay,ScreenInstallOverlay" - -# Legacy metric: Percentage Scoring shows this many decimals ( 00.00% ). -PercentScoreDecimalPlaces=2 - -# 02 # -[LightsManager] -# Mostly useless since it doesn't work, as well as that barely anyone has -# lights to play around with. -GameButtonsToShow="" -LightEffectRiseSeconds=0.075 -LightEffectFallOffSeconds=0.35 -LightEffectPulseTime=0.100 - -[ProfileManager] -# I wouldn't change this either. -FixedProfiles=false -NumFixedProfiles=1 - -[SongManager] -# SSC: Determine what the ES/OMES Modifiers are -ExtraStagePlayerModifiers="default,1.5x,reverse" -ExtraStageStageModifiers="failimmediatecontinue,norecover" -OMESPlayerModifiers="default,1.5x,reverse" -OMESStageModifiers="failimmediate,suddendeath" - -# How many different colors you can have in the MusicWheel -NumSongGroupColors=10 -NumCourseGroupColors=1 -# Legacy metric: how difficult a song has to be for it to glow. -ExtraColorMeter=GetExtraColorThreshold() -# The maximum difficulty a OMES stage can be. -ExtraStage2DifficultyMax=8 -# Allow special colors for unlocks and 'preffered' sort -UseUnlockColor=false -UsePreferredSortColor=false -# Unlocks go at the end so they're easy to find. -MoveUnlocksToBottomOfPreferredSort=false -# Lots of themes want more than one group color, so let them have this. -SongGroupColor1=color("#00aeef") -- blue -SongGroupColor2=color("#00aeef") -- blue -SongGroupColor3=color("#00aeef") -- blue -SongGroupColor4=color("#00aeef") -- blue -SongGroupColor5=color("#00aeef") -- blue -SongGroupColor6=color("#00aeef") -- blue -SongGroupColor7=color("#00aeef") -- blue -SongGroupColor8=color("#00aeef") -- blue -SongGroupColor9=color("#00aeef") -- blue -SongGroupColor10=color("#00aeef") -- blue -# Lots of themes want more than one course color, too -CourseGroupColor1=color("1,1,1,1") -- white -CourseGroupColor2=color("1,1,1,1") -- white -CourseGroupColor3=color("1,1,1,1") -- white -CourseGroupColor4=color("1,1,1,1") -- white -CourseGroupColor5=color("1,1,1,1") -- white -CourseGroupColor6=color("1,1,1,1") -- white -CourseGroupColor7=color("1,1,1,1") -- white -CourseGroupColor8=color("1,1,1,1") -- white -CourseGroupColor9=color("1,1,1,1") -- white -CourseGroupColor10=color("1,1,1,1") -- white -UnlockColor=color("1,0.5,0,1") -ExtraColor=color("#ff0000") -- red - -[UnlockManager] -# Unlock specific things. we'll go in-depth with this one day, but it really -# isnt what sm-ssc was designed for. -AutoLockChallengeSteps=false -UnlockNames="" - -# 03 # -[ArrowEffects] -# Complicated stuff you probably shouldn't ever mess with or else you'll -# destroy mods completely! -FrameWidthEffectsPixelsPerSecond=400 -FrameWidthEffectsMinMultiplier=0.5 -FrameWidthEffectsMaxMultiplier=1.2 -FrameWidthLockEffectsToOverlapping=false -FrameWidthLockEffectsTweenPixels=25 -ArrowSpacing=64 -DrawHiddenNotesAfterReceptor=true -BlinkModFrequency=0.3333 -BoostModMinClamp=-400 -BoostModMaxClamp=400 -BrakeModMinClamp=-400 -BrakeModMaxClamp=400 -WaveModMagnitude=20 -WaveModHeight=38 -BoomerangPeakPercentage=0.75 -ExpandMultiplierFrequency=3 -ExpandMultiplierScaleFromLow=-1 -ExpandMultiplierScaleFromHigh=1 -ExpandMultiplierScaleToLow=0.75 -ExpandMultiplierScaleToHigh=1.75 -ExpandSpeedScaleFromLow=0 -ExpandSpeedScaleFromHigh=1 -ExpandSpeedScaleToLow=1 -# No need for the high here: that is already calculated in code. -TipsyTimerFrequency=1.2 -TipsyColumnFrequency=1.8 -TipsyArrowMagnitude=0.4 -TipsyOffsetTimerFrequency=1.2 -TipsyOffsetColumnFrequency=2 -TipsyOffsetArrowMagnitude=0.4 -TornadoPositionScaleToLow=-1 -TornadoPositionScaleToHigh=1 -TornadoOffsetFrequency=6 -TornadoOffsetScaleFromLow=-1 -TornadoOffsetScaleFromHigh=1 -DrunkColumnFrequency=0.2 -DrunkOffsetFrequency=10 -DrunkArrowMagnitude=0.5 -BeatOffsetHeight=15 -BeatPIHeight=2 -MiniPercentBase=0.5 -MiniPercentGate=1 -DizzyHoldHeads=false -QuantizeArrowYPosition=false - -[Background] -# Background stuff. again, its usually a better idea to leave this alone -# unless you truly need to change it, in which case you'd know what it does. -ShowDancingCharacters=true -UseStaticBackground=true -# -ClampOutputPercent=0.0 -# -LeftEdge=SCREEN_LEFT -RightEdge=SCREEN_RIGHT -TopEdge=SCREEN_TOP -BottomEdge=SCREEN_BOTTOM - -[Banner] -# Scroll stuff when you roll over it, DDR Extreme style. -ScrollRandom=false -ScrollRoulette=false - -[BitmapText] -# The colors in the 'roulette' text. you can have alot! -NumRainbowColors=7 -RainbowColor1=color("1.0,0.0,0.4,1") -- red -RainbowColor2=color("0.8,0.2,0.6,1") -- pink -RainbowColor3=color("0.4,0.3,0.5,1") -- purple -RainbowColor4=color("0.2,0.6,1.0,1") -- sky blue -RainbowColor5=color("0.2,0.8,0.8,1") -- sea green -RainbowColor6=color("0.2,0.8,0.4,1") -- green -RainbowColor7=color("1.0,0.8,0.2,1") -- orange - -[BPMDisplay] -# Various commands for the BPMDisplay, ranging from no bpm, a non changing bpm, -# a bpm that changes, one that is 'random' ( boss songs ) and when a song is -# an es/omes! -SetNoBpmCommand=diffusetopedge,color("#777777");diffusebottomedge,color("#666666") -SetNormalCommand=diffusetopedge,color("#fbfb57");diffusebottomedge,color("#fb9c57") -SetChangeCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") -SetRandomCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") -SetExtraCommand=diffusetopedge,color("#fb5757");diffusebottomedge,color("#9c4242") -# Determines if it shows both bpms ( 000-100 ) or cycles between the min and -# max. -Cycle=true -# Text when there is no BPM -NoBpmText="000" -# How fast it cycles, smaller is faster -RandomCycleSpeed=0.1 -# Seperator between both bpms ( 100-200 ). -Separator="-" -# ??? when it cycles. -ShowQMarksInRandomCycle=true -QuestionMarksText="???" -RandomText="!!!" -# xxx: localize me -aj -VariousText="000" -FormatString="%03.0f" - -[CodeDetector] -# Codes on the MusicWheel that change stuff! -PrevSteps1="Up,Up" -PrevSteps2="MenuUp,MenuUp" -NextSteps1="Down,Down" -NextSteps2="MenuDown,MenuDown" -NextSort1="@MenuLeft-@MenuRight-Start" -NextSort2="MenuLeft-MenuRight" -NextSort3="@Left-@Right-Start" -NextSort4="Left-Right" -ModeMenu1="Up,Down,Up,Down" -ModeMenu2="MenuUp,MenuDown,MenuUp,MenuDown" -Mirror="Up,Left,Right,Left,Right" -Left="Up,Down,Right,Left" -Right="Up,Down,Left,Right" -Shuffle="Down,Up,Down,Up" -SuperShuffle="Down,Up,Left,Right" -NextTransform="" -NextScrollSpeed="Up,Left,Down,Left,Up" -PreviousScrollSpeed="Down,Right,Up,Right,Down" -NextAccel="Left,Right,Down,Up" -NextEffect="Left,Down,Right" -NextAppearance="Left,Up,Right" -NextTurn="" -Reverse="Down,Left,Right,Left,Right" -HoldNotes="Right,Left,Down,Up" -Mines="" -Dark="" -CancelAll="Left,Right,Left,Right,Left,Right,Left,Right" -NextGroup="MenuUp,MenuRight,MenuRight" -PrevGroup="MenuUp,MenuDown,MenuUp,MenuDown" -CloseCurrentFolder="MenuUp-MenuDown" -# Codes on the title screen. -NextTheme="" -NextTheme2="" -NextAnnouncer="" -NextAnnouncer2="" -# NextTheme="Left,Left,Left,Right,Right,Right,Left,Right" -# NextTheme2="MenuLeft,MenuLeft,MenuLeft,MenuRight,MenuRight,MenuRight,MenuLeft,MenuRight" -# NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right" -# NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight" -# Various. -Hidden="" -RandomVanish="" -SaveScreenshot1="MenuLeft-MenuRight" -SaveScreenshot2="" -CancelAllPlayerOptions="Left,Right,Left,Right,Left,Right" -BackInEventMode="" -[CodeDetectorOnline] -Fallback="CodeDetector" -PrevSteps1="MenuUp,MenuUp" -PrevSteps2="" -NextSteps1="MenuDown,MenuDown" -NextSteps2="" -NextSort3="" -NextSort4="" -ModeMenu1="" -Mirror="" -Left="" -Right="" -Shuffle="" -SuperShuffle="" -NextScrollSpeed="" -PreviousScrollSpeed="" -NextAccel="" -NextEffect="" -NextAppearance="" -Reverse="" -HoldNotes="" -CancelAll="" - -[CombinedLifeMeterTug] -# We don't use it. -MeterWidth=0.0 -MeterHeight=0.0 - -[Combo] -# System Direction -ShowComboAt=HitCombo() -ShowMissesAt=MissCombo() -# Shrink and Grow the combo, DDR Style -NumberMinZoom=0.8 -NumberMaxZoom=1 -NumberMaxZoomAt=100 -# -LabelMinZoom=0.75*0.75 -LabelMaxZoom=0.75*0.75 -# Things the combo does when you bang on it, and what the text does -PulseCommand=%function(self,param) self:stoptweening(); self:zoom(1.125*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); end -PulseLabelCommand=%function(self,param) self:stoptweening(); self:zoom(param.LabelZoom); self:linear(0.05); self:zoom(param.LabelZoom); end -NumberOnCommand=y,240-216-1.5;shadowlength,1;halign,1;valign,1;skewx,-0.125; -LabelOnCommand=x,6;y,22.5;shadowlength,1;zoom,0.75;diffusebottomedge,color("0.75,0.75,0.75,1");halign,0;valign,1 - -[HoldJudgment] -# System Direction -HoldJudgmentLetGoCommand=finishtweening;visible,ShowHoldJudgments();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 -HoldJudgmentHeldCommand=finishtweening;visible,ShowHoldJudgments();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 - -[HelpDisplay] -# The help display on the menus, and what it does. -# How fast it changes between texts (seconds) -TipShowTime=4 -# How long each switch takes (seconds) -TipSwitchTime=1 -# The Command when its made -TipOnCommand=shadowlength,0;diffuseblink -[Judgment] -# New # -JudgmentOnCommand= - -# Things the judgment does when you bang on it. -JudgmentW1Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,1,1,1,0;effectcolor2,1,1,1,0.8 -JudgmentW2Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentW3Command=shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW4Command=shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW5Command=shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentMissCommand=shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 - -[Protiming] -# Protiming isn't implemented yet. -ProtimingOnCommand=y,24 -ProtimingW1Command= -ProtimingW2Command= -ProtimingW3Command= -ProtimingW4Command= -ProtimingW5Command= -ProtimingMissCommand= - -[Course] -# What.. are these anyways? -SortPreferredColor=color("1,1,1,1") -- Preferred is both for when courses are in preferred sort, or are autogen -SortLevel1Color=color("1,0,0,1") -SortLevel2Color=color("1,1,0,1") -SortLevel3Color=color("1,0.5,0,1") -SortLevel4Color=color("1,1,0,1") -SortLevel5Color=color("0,1,0,1") - -[CustomDifficulty] -# Custom system that lets you rename certain classes of difficulties to -# something else. Mostly for custom games and game emulation, PIU for example. - -# The names of which -Names="PumpHard,PumpFreestyle,PumpNightmare,PumpHalfDouble,PumpRoutine" - -# Names="DanceCoupleBeginner,DanceCoupleEasy,DanceCoupleMedium,DanceCoupleHard,DanceCoupleExpert,PumpHard" -# That get remapped to -DanceCoupleBeginnerStepsType="StepsType_Dance_Couple" -DanceCoupleBeginnerDifficulty="Difficulty_Beginner" -DanceCoupleBeginnerCourseType=nil -DanceCoupleBeginnerString="Beginner" -#--# -DanceCoupleEasyStepsType="StepsType_Dance_Couple" -DanceCoupleEasyDifficulty="Difficulty_Easy" -DanceCoupleEasyCourseType=nil -DanceCoupleEasyString="Easy" -#--# -DanceCoupleMediumStepsType="StepsType_Dance_Couple" -DanceCoupleMediumDifficulty="Difficulty_Medium" -DanceCoupleMediumCourseType=nil -DanceCoupleMediumString="Medium" -#--# -DanceCoupleHardStepsType="StepsType_Dance_Couple" -DanceCoupleHardDifficulty="Difficulty_Hard" -DanceCoupleHardCourseType=nil -DanceCoupleHardString="Hard" -#--# -DanceCoupleExpertStepsType="StepsType_Dance_Couple" -DanceCoupleExpertDifficulty="Difficulty_Expert" -DanceCoupleExpertCourseType=nil -DanceCoupleExpertString="Expert" -#===# -PumpHardStepsType="StepsType_Pump_Single" -PumpHardDifficulty="Difficulty_Hard" -PumpHardCourseType=nil -PumpHardString="Crazy" -#--# -PumpFreestyleStepsType="StepsType_Pump_Double" -PumpFreestyleDifficulty="Difficulty_Medium" -PumpFreestyleCourseType=nil -PumpFreestyleString="Freestyle" -#--# -PumpNightmareStepsType="StepsType_Pump_Double" -PumpNightmareDifficulty="Difficulty_Hard" -PumpNightmareCourseType=nil -PumpNightmareString="Nightmare" -#--# -PumpHalfDoubleStepsType="StepsType_Pump_Halfdouble" -PumpHalfDoubleDifficulty="Difficulty_Medium" -PumpHalfDoubleCourseType=nil -PumpHalfDoubleString="HalfDouble" -#--# -PumpRoutineStepsType="StepsType_Pump_Routine" -PumpRoutineDifficulty="Difficulty_Medium" -PumpRoutineCourseType=nil -PumpRoutineString="Routine" -# -# Difficulty_Beginner-StepsType_Pump_Single=Easy -# Difficulty_Easy-StepsType_Pump_Single=Normal -# Difficulty_Medium-StepsType_Pump_Single=Hard -# Difficulty_Hard-StepsType_Pump_Single=Crazy -# Difficulty_Medium-StepsType_Pump_Halfdouble=Half-Double -# Difficulty_Medium-StepsType_Pump_Double=Freestyle -# Difficulty_Hard-StepsType_Pump_Double=Nightmare -# Difficulty_Edit-StepsType_Pump_Single=Edit -# Difficulty_Edit-StepsType_Pump_Halfdouble=Edit -# Difficulty_Edit-StepsType_Pump_Double=Edit -# Course=Progressive -[CustomScoring] -# Custom scoring, usually good for custom games. - -# Various tweakers -ComboAboveThresholdAddsToScoreBonus=0 -ComboScoreBonusThreshold=50 -ComboScoreBonusValue=+1000 - -ComboMultiplier=0.0 - -DoubleNoteScoreMultiplier=2.0 -TripleNoteScoreMultiplier=3.0 -QuadOrHigherNoteScoreMultiplier=4.0 -# And what they award you -PointsW1=+50 -PointsW2=+20 -PointsW3=+10 -PointsW4=+5 -PointsW5=0 -PointsMiss=-5 -PointsHitMine=-5 -PointsCheckpointHit=+5 -PointsCheckpointMiss=-5 -PointsNone=0 -PointsHoldHeld=+5 -PointsHoldLetGo=-5 -[DifficultyList] -# A list that shows difficulties in a song. -CapitalizeDifficultyNames=false -# How far away and how many items there are -ItemsSpacingY=40 -NumShownItems=5 -# -MoveCommand=decelerate,0.3 - -[FadingBanner] -# The banner on MusicWheel. -BannerOnCommand= -# When it loads -BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 -# When it loads into clarity -BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 -# ? -BannerResetFadeCommand=diffusealpha,1 - -[Gameplay] -# System Direction -ComboIsPerRow=ComboPerRow() -MinScoreToContinueCombo=ComboContinue() -MinScoreToMaintainCombo=ComboMaintain() -MaxScoreToIncrementMissCombo='TapNoteScore_Miss' -MineHitIncrementsMissCombo=false -AvoidMineIncrementsCombo=false -# When you hit it, you know. -ToastyTriggersAt=250 - -[GameState] -# Default song and sort. these don't really matter -DefaultSong="" -DefaultSort="Group" -# How good of a grade you have to get to get an ES/OMES. Locked to an 'AA' -GradeTierForExtra1="Grade_Tier03" -GradeTierForExtra2="Grade_Tier03" -# and how difficult that song you go thas to be -MinDifficultyForExtra="Difficulty_Hard" -# System Direction -AreStagePlayerModsForced=AreStagePlayerModsForced -AreStageSongModsForced=AreStageSongModsForced -# Let players join while you play if they put in some coins -AllowLateJoin=true -# Various feats that you can earn -ProfileRecordFeats=true -CategoryRecordFeats=true -# Disallow bad names -UseNameBlacklist=false -# Alow OMES -AllowExtra2=true -# Don't let the player change difficulties on an ES/OMES -LockExtraStageSelection=true -# [sm-ssc] Normally, in event mode, the premium value is ignored. Set this -# metric to true to re-gain that behavior. -DisablePremiumInEventMode=false - -[GrooveRadar] -# Polar graph that shows difficulty stuff in depth -# how thick the line is -EdgeWidth=2 -# How visible the middle is -CenterAlpha=0.25 -# what to do with each player's part of the graph -RadarValueMapP1OnCommand=diffuse,PlayerColor(PLAYER_1) -RadarValueMapP2OnCommand=diffuse,PlayerColor(PLAYER_2) - -[GroupList] -# Legacy Class. -SpacingX=0 -SpacingY=0 -StartX=0 -StartY=0 - -[HighScore] -# Default highscore name for no entries ( like how street fighter has ' CAP ' ) -EmptyName="SSC!" - -[Inventory] -# ? -ItemUseRateSeconds=0.0 - -[LifeMeterBar] -# The default life bar you see in gameplay - -# Percentage in which the game starts yelling at you to stop sucking -DangerThreshold=0.2 -# And how much it starts up at. -InitialValue=0.5 -# And how much it takes to get ravin' -HotValue=1.0 -# And how much there is to fill up ( only for debug ) -LifeMultiplier=1.0 -# How good you gotta hit it to keep it alive. ( W3 is 'Great' ); -MinStayAlive="TapNoteScore_W3" -# Freiza Hack. Ugh -# FlashHotOnNoteHit=false -# MinScoreToFlash="TapNoteScore_W3" - -# How much it changes -LifePercentChangeW1=0.008 -LifePercentChangeW2=0.008 -LifePercentChangeW3=0.004 -LifePercentChangeW4=0.000 -LifePercentChangeW5=-0.040 -LifePercentChangeMiss=-0.080 -LifePercentChangeHitMine=-0.160 -LifePercentChangeHeld=0.008 -LifePercentChangeLetGo=-0.080 -LifePercentChangeCheckpointMiss=-0.002 -LifePercentChangeCheckpointHit=0.002 - -# And various positionings -UnderX=0 -UnderY=0 -DangerX=0 -DangerY=0 -StreamX=0 -StreamY=0 -OverX=0 -OverY=0 -[LifeMeterBattery] -# The bar that shows up in Oni mode. - -# How long it flashes when you lose a life. -BatteryBlinkTime=1.2 -# Where the batteries are -BatteryP1X=-92 -BatteryP1Y=2 -BatteryP2X=92 -BatteryP2Y=2 -# Where your live count is -NumLivesP1X=-92 -NumLivesP1Y=0 -NumLivesP2X=92 -NumLivesP2Y=0 - -[LifeMeterBattery Percent] -# The percentage on the bar. I wouldn't even bother changing this, because I -# havent and I *made* this theme :\ -Format=FormatPercentScore -PercentUseRemainder=false -ApplyScoreDisplayOptions=true -DancePointsDigits=5 -# -PercentP1X=0 -PercentP1Y=0 -PercentP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP1OffCommand= -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP2OffCommand= -# -DancePointsP1X=0 -DancePointsP1Y=0 -DancePointsP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) -DancePointsP1OffCommand= -DancePointsP2X=0 -DancePointsP2Y=0 -DancePointsP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -DancePointsP2OffCommand= - - -[LifeMeterTime] -# The Lifemeter that shows up when you're playing survival. - -# When it starts telling you to stop sucking. -DangerThreshold=0.3 -# How good it's filled up when you start -InitialValue=0.5 -MeterWidth=0.0 -MeterHeight=0.0 -# How little there is to fill? -MinLifeTime=15 - -[LyricDisplay] -LyricFrontChangedCommand=LyricCommand,"Front" -LyricBackChangedCommand=LyricCommand,"Back" - -InLength=0 -OutLength=0 - -[NotesWriterSM] -DescriptionUsesCreditField=false - -[OptionRow] -ShowModIcons=false -ShowUnderlines=true -ShowBpmInSpeedTitle=false -ModIconP1X=SCREEN_CENTER_X-280 -ModIconP2X=SCREEN_CENTER_X+280 -ModIconOnCommand=x,-30 -FrameX=SCREEN_CENTER_X-222 -FrameY=0 -FrameOnCommand= -TitleX=SCREEN_CENTER_X-222 -TitleY=0 -TitleOnCommand=shadowlength,0;uppercase,true;wrapwidthpixels,SCREEN_WIDTH*0.2;zoom,0.6 -TitleGainFocusCommand=diffuse,color("1,1,1,1");strokecolor,color("0,0,0,1") -TitleLoseFocusCommand=diffuse,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,1") -ItemsStartX=SCREEN_CENTER_X-140 -ItemsEndX=SCREEN_CENTER_X+280 -ItemsGapX=14 -ItemsMinBaseZoom=0.65 -ItemsLongRowP1X=SCREEN_CENTER_X-60 -ItemsLongRowP2X=SCREEN_CENTER_X+100 -ItemsLongRowSharedX=SCREEN_CENTER_X -ItemOnCommand=shadowlength,0;zoom,0.5 -ItemGainFocusCommand= -ItemLoseFocusCommand= -TweenSeconds=0.2 -ModIconMetricsGroup="ModIcon" -ColorSelected=color("1,1,1,1") -ColorNotSelected=color("0.9,0.9,0.9,1") -ColorDisabled=color("0.5,0.5,0.5,1") - -[OptionRowService] -Fallback="OptionRow" -# Service Titles are all that are shown. -ShowUnderlines=false -ShowCursors=false -# -TitleX=SCREEN_CENTER_X -TitleY= -TitleOnCommand=shadowlength,0;uppercase,true;maxwidth,600;zoom,0.75 -TitleGainFocusCommand=diffuse,color("1,1,1,1");strokecolor,color("0,0,0,1") -TitleLoseFocusCommand=diffuse,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,1") - -[OptionRowExit] -Fallback="OptionRow" -FrameOnCommand=visible,false -TitleOnCommand=visible,false - -[OptionsCursor] -LeftX= -LeftY= -LeftOnCommand=halign,1; -MiddleX= -MiddleY= -MiddleOnCommand= -RightX= -RightY= -RightOnCommand=halign,0; -CanGoLeftX= -CanGoLeftY= -CanGoLeftOnCommand=halign,1; -CanGoRightX= -CanGoRightY= -CanGoRightOnCommand=halign,0; - -[OptionsCursorP1] -Fallback="OptionsCursor" -LeftX=-2 -MiddleX=-2 -RightX=-2 -LeftY=-2 -MiddleY=-2 -RightY=-2 - -[OptionsCursorP2] -Fallback="OptionsCursor" -LeftX=2 -MiddleX=2 -RightX=2 -LeftY=2 -MiddleY=2 -RightY=2 - -[OptionsUnderline] -Fallback="OptionsCursor" - -[OptionsUnderlineP1] -Fallback="OptionsUnderline" -LeftX=-4 -MiddleX=-4 -RightX=-4 -LeftY=10 -MiddleY=10 -RightY=10 - -[OptionsUnderlineP2] -Fallback="OptionsUnderline" -LeftX=4 -MiddleX=4 -RightX=4 -LeftY=12 -MiddleY=12 -RightY=12 - -[MenuTimer] -WarningStart=10 -WarningBeepStart=10 -# I don't like it -# -- Midiman -# MaxStallSeconds=7.5 -MaxStallSeconds=0 -# -HurryUpTransition=5.5 -Text1OnCommand=stopeffect;stoptweening;shadowlength,0; -Text1FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.floor(fSeconds); return ""..digit end -Text2OnCommand=stopeffect;stoptweening;shadowlength,0;visible,false -Text2FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.mod(fSeconds,10); return ""..digit end -# -FrameX=0 -FrameY=0 -FrameOnCommand= -# -Warning10Command= -Warning9Command= -Warning8Command= -Warning7Command= -Warning6Command= -Warning5Command= -Warning4Command= -Warning3Command= -Warning2Command= -Warning1Command= -Warning0Command= - -[MenuTimerNoSound] -Fallback="MenuTimer" -# -WarningBeepStart=0 - -[MusicList] -SpacingX=0 -SpacingY=0 -StartY=0 -StartX=0 -# -CropWidth=0 -NumRows=0 -NumColumns=0 - -[MusicWheel] -FadeSeconds=1 -SwitchSeconds=0.10 -RandomPicksLockedSongs=true -UseSectionsWithPreferredGroup=false -OnlyShowActiveSection=false -RemindWheelPositions=false -# -RouletteSwitchSeconds=0.05 -RouletteSlowDownSwitches=5 -LockedInitialVelocity=15 - -ScrollBarHeight=300 -ScrollBarOnCommand=visible,false -# -ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*38 ); end -NumWheelItems=11 -MusicWheelSortOnCommand= -MusicWheelSortOffCommand= -MusicWheelItemSortOnCommand= -MusicWheelItemSortOffCommand= -HighlightOnCommand= -HighlightOffCommand= -HighlightSortOnCommand= -HighlightSortOffCommand= -WheelItemLockedColor=color("0,0,0,0.5") -# -NumSectionColors=1 -SectionColor1=color("1,1,1,1") -# -SongRealExtraColor=color("1,0,0,1") -SortMenuColor=color("1,1,1,1") -# -RouletteColor=color("1,0,0,1") -RandomColor=color("1,0,0,1") -PortalColor=color("1,0,0,1") - -SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Artist", "SortOrder_Genre" } -# SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Popularity", "SortOrder_Artist", "SortOrder_Genre" } -# -ShowRoulette=true -ShowRandom=false -ShowPortal=false -# -MostPlayedSongsToShow=30 -RecentSongsToShow=30 -# -UseEasyMarkerFlag=false -# -ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent" -# ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent,NormalMode,BattleMode" -ChoicePreferred="sort,Preferred" -ChoiceGroup="sort,Group" -ChoiceTitle="sort,Title" -ChoiceBpm="sort,BPM" -ChoicePopularity="sort,Popularity" -ChoiceTopGrades="sort,TopGrades" -ChoiceArtist="sort,Artist" -ChoiceGenre="sort,Genre" -ChoiceEasyMeter="sort,EasyMeter" -ChoiceMediumMeter="sort,MediumMeter" -ChoiceHardMeter="sort,HardMeter" -ChoiceChallengeMeter="sort,ChallengeMeter" -ChoiceDoubleEasyMeter="sort,DoubleEasyMeter" -ChoiceDoubleMediumMeter="sort,DoubleMediumMeter" -ChoiceDoubleHardMeter="sort,DoubleHardMeter" -ChoiceDoubleChallengeMeter="sort,DoubleChallengeMeter" -ChoiceLength="sort,Length" -ChoiceRecent="sort,Recent" -ChoiceNormalMode="playmode,regular" -ChoiceBattleMode="playmode,battle" -# -CustomWheelItemNames="" - -[CourseWheel] -Fallback="MusicWheel" -# -ModeMenuChoiceNames="AllCourses,Nonstop,Oni,Endless,Survival" -# xxx: force nonstop on all courses? sounds lame but meh -ChoiceAllCourses="sort,AllCourses;playmode,nonstop;mod,bar" -ChoiceNonstop="sort,Nonstop;playmode,nonstop;mod,bar" -ChoiceOni="sort,Oni;playmode,oni;mod,battery" -ChoiceEndless="sort,Endless;playmode,endless;mod,bar" -ChoiceSurvival="sort,Oni;playmode,oni;mod,lifetime" - -[OnlineMusicWheel] -Fallback="MusicWheel" -# roulette + online causes a sorting issue that should be hammered out first. -aj -ShowRoulette=false -ShowRandom=false -ShowPortal=false - -[MusicWheelItem] -WheelNotifyIconX=106 -WheelNotifyIconY=0 -WheelNotifyIconOnCommand=visible,false -# -SongNameX=0 -SongNameY=0 -SongNameOnCommand= -# -CourseX=0 -CourseY=0 -CourseOnCommand= -# -SectionExpandedX=0 -SectionExpandedY=0 -SectionExpandedOnCommand= -# -SectionCollapsedX=0 -SectionCollapsedY=0 -SectionCollapsedOnCommand= -SectionCountX=0 -SectionCountY=0 -SectionCountOnCommand= -# -RouletteX=0 -RouletteY=0 -RouletteOnCommand= -# -RandomX=0 -RandomY=0 -RandomOnCommand= -# -PortalX=0 -PortalY=0 -PortalOnCommand= -# -SortX=0 -SortY=0 -SortOnCommand= -# -ModeX=0 -ModeY=0 -ModeOnCommand= -# -CustomX=0 -CustomY=0 -CustomOnCommand= -# -GradeP1X=0 -GradeP1Y=0 -GradeP2X=0 -GradeP2Y=0 -GradesShowMachine=true - -[NoteField] -ShowBoard=false -ShowBeatBars=false -# -FadeBeforeTargetsPercent=0 -FadeFailTime=1.5 -# -BarMeasureAlpha=1 -Bar4thAlpha=1 -Bar8thAlpha=1 -Bar16thAlpha=1 -# -RoutineNoteSkinP1=RoutineSkinP1() -RoutineNoteSkinP2=RoutineSkinP2() -# -BPMColor=color("1,0,0,1") -StopColor=color("0.8,0.8,0,1") -DelayColor=color("0,0.8,0.8,1") -TimeSignatureColor=color("1,0.55,0,1") -TickcountColor=color("0,1,0,1") -ComboColor=color("0.55,1,0,1") -# -BPMIsLeftSide=true -StopIsLeftSide=true -DelayIsLeftSide=true -TimeSignatureIsLeftSide=true -TickcountIsLeftSide=false -ComboIsLeftSide=false -# -BPMOffsetX=60 -StopOffsetX=10 -DelayOffsetX=10 -TimeSignatureOffsetX=30 -TickcountOffsetX=10 -ComboOffsetX=30 - -[PlayerStageStats] -# Original CVS Grading -GradePercentTier01=1.000000 -GradePercentTier02=1.000000 -GradePercentTier03=0.930000 -GradePercentTier04=0.800000 -GradePercentTier05=0.650000 -GradePercentTier06=0.450000 -GradePercentTier07=-99999.000000 -GradeTier01IsAllW2s=false -GradeTier02IsAllW2s=true -GradeTier02IsFullCombo=false -NumGradeTiersUsed=7 - -[Player] -# In The Groove -# ReceptorArrowsYStandard=-125 -# ReceptorArrowsYReverse=145 -# StepMania Alpha 4 -# ~ ReceptorArrowsYStandard=-144 -# ~ ReceptorArrowsYReverse=144 -# sm-ssc uses a UserPreference for this. -ReceptorArrowsYStandard=GetTapPosition('Standard') -ReceptorArrowsYReverse=GetTapPosition('Reverse') -ReceptorNoSinkScoreCutoff=4 -JudgmentTransformCommand=%JudgmentTransformCommand -JudgmentOnCommand= -ComboTransformCommand=%ComboTransformCommand -AttackDisplayXOffsetOneSideP1=0 -AttackDisplayXOffsetOneSideP2=0 -AttackDisplayXOffsetBothSides=0 -AttackDisplayY=-70 -AttackDisplayYReverse=70 -HoldJudgmentYStandard=-90 -HoldJudgmentYReverse=90 -BrightGhostComboThreshold=100 -DrawDistanceBeforeTargetsPixels=SCREEN_HEIGHT -DrawDistanceAfterTargetsPixels=-128 -TapJudgmentsUnderField=false -HoldJudgmentsUnderField=false -ComboUnderField=ComboUnderField() -PenalizeTapScoreNone=false -JudgeHoldNotesOnSameRowTogether=false -HoldCheckpoints=(GAMESTATE:GetCurrentGame():GetName() == "pump") -CheckpointsUseTickcounts=(GAMESTATE:GetCurrentGame():GetName() == "pump") -; deprecated? -CheckpointsUseTimeSignatures=false -CheckpointsTapsSeparateJudgment=CheckpointsTapsSeparateJudgment() -CheckpointsFlashOnHold=false -ImmediateHoldLetGo=ImmediateHoldLetGo() -RequireStepOnHoldHeads=HoldHeadStep() -RequireStepOnMines=false -InitialHoldLife=InitialHoldLife() -MaxHoldLife=MaxHoldLife() -# RollBodyIncrementsCombo=RollBodyIncrementsCombo() -RollBodyIncrementsCombo=GetGamePrefB("UserPrefComboOnRolls") -ScoreMissedHoldsAndRolls=ScoreMissedHoldsAndRolls() -PercentUntilColorCombo=0.25 -ComboStoppedAt=50 -AttackRunTimeRandom=6 -AttackRunTimeMine=7 - -[PlayerOptions] -RandomSpeedChance=0.2 -RandomReverseChance=0.2 -RandomDarkChance=0.1 -RandomAccelChance=0.333 -RandomEffectChance=0.667 -RandomHiddenChance=0.05 -RandomSuddenChance=0.1 - -[PlayerShared] -Fallback="Player" -ComboXOffsetOneSideP1=-120 -ComboXOffsetOneSideP2=120 -JudgmentTransformCommand=%JudgmentTransformSharedCommand - -[Profile] -ShowCoinData=true -UnlockAuthString="" - -[RadarValues] -# -WriteComplexValues=true -WriteSimpleValues=true - -[RollingNumbers] -TextFormat="%09.0f" -ApproachSeconds=0.2 -Commify=true -LeadingZeroMultiplyColor=color("#777777FF") - -[RollingNumbersEvaluation] -Fallback="RollingNumbers" -ApproachSeconds=1 - -[RollingNumbersJudgment] -Fallback="RollingNumbers" -TextFormat="%04.0f" -ApproachSeconds=1 -Commify=false - -[ScoreDisplayNormal] -FrameX= -FrameY= -FrameOnCommand= -FrameOffCommand= -TextX= -TextY= -TextOnCommand= -TextOffCommand= - -[ScoreDisplayOni] - - -[ScoreDisplayLifeTime] -FrameX= -FrameY= -FrameOnCommand= -FrameOffCommand= -# -TextX= -TextY= -TextOnCommand= -TextOffCommand= -# -TimeRemainingX= -TimeRemainingY= -TimeRemainingOnCommand= -TimeRemainingOffCommand= -# -DeltaSecondsOnCommand= -DeltaSecondsNoneCommand= -DeltaSecondsHitMineCommand= -DeltaSecondsAvoidMineCommand= -DeltaSecondsCheckpointMissCommand= -DeltaSecondsCheckpointHitCommand= -DeltaSecondsMissCommand= -DeltaSecondsW5Command= -DeltaSecondsW4Command= -DeltaSecondsW3Command= -DeltaSecondsW2Command= -DeltaSecondsW1Command= -DeltaSecondsLetGoCommand= -DeltaSecondsHeldCommand= -DeltaSecondsGainLifeCommand= - -[ScoreDisplayPercentage Percent] -PercentP1X=0 -PercentP1Y=0 -PercentP1OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP1OffCommand= -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP2OffCommand= -DancePointsDigits=5 -PercentUseRemainder=false -ApplyScoreDisplayOptions=true -Format=FormatPercentScore -PercentDecimalPlaces=2 -PercentTotalSize=5 - -PercentP3X=0 -PercentP3Y=0 -PercentP3OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP3OffCommand= -PercentP4X=0 -PercentP4Y=0 -PercentP4OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP4OffCommand= -PercentP5X=0 -PercentP5Y=0 -PercentP5OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP5OffCommand= -PercentP6X=0 -PercentP6Y=0 -PercentP6OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP6OffCommand= -PercentP7X=0 -PercentP7Y=0 -PercentP7OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP7OffCommand= -PercentP8X=0 -PercentP8Y=0 -PercentP8OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP8OffCommand= - -[ScoreDisplayRave] -MeterP1X= -MeterP1Y= -MeterP1OnCommand= -MeterP1OffCommand= -MeterP2X= -MeterP2Y= -MeterP2OnCommand=zoomx,-1 -MeterP2OffCommand= - -LevelP1X= -LevelP1Y= -LevelP1OnCommand= -LevelP1OffCommand= -LevelP2X= -LevelP2Y= -LevelP2OnCommand= -LevelP2OffCommand= - -[ScoreKeeperRave] -AttackDurationSeconds=3.0 - -[ScreenEvaluation Percent] -PercentP1X=0 -PercentP1Y=0 -PercentP1OnCommand=horizalign,right;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 -PercentP1OffCommand= -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=horizalign,right;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 -PercentP2OffCommand= -PercentRemainderP1X=0 -PercentRemainderP1Y=0 -PercentRemainderP1OnCommand=horizalign,left;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 -PercentRemainderP1OffCommand= -PercentRemainderP2X=0 -PercentRemainderP2Y=0 -PercentRemainderP2OnCommand=horizalign,left;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 -PercentRemainderP2OffCommand= -DancePointsP1X=-26 -DancePointsP1Y=-32 -DancePointsP1OnCommand=glowshift;effectperiod,2;shadowlength,0 -DancePointsP1OffCommand=sleep,0.8;accelerate,0.3 -DancePointsP2X=-26 -DancePointsP2Y=-32 -DancePointsP2OnCommand=glowshift;effectperiod,2;shadowlength,0 -DancePointsP2OffCommand=sleep,0.8;accelerate,0.3 -DancePointsDigits=1 -PercentUseRemainder=true -ApplyScoreDisplayOptions=false -FormatPercentScore=FormatPercentScore -Format= - -[SoundEffectControl] -LockToHold=false - -[SoundEffectControl_Off] -Fallback="SoundEffectControl" -SoundProperty="" -PropertyMin=1.0 -PropertyCenter=1.0 -PropertyMax=1.0 - -[SoundEffectControl_Speed] -Fallback="SoundEffectControl" -SoundProperty="Speed" -PropertyMin=4/8 -PropertyCenter=1.0 -PropertyMax=16/8 - -[SoundEffectControl_Pitch] -Fallback="SoundEffectControl" -SoundProperty="Pitch" -PropertyMin=7/8 -PropertyCenter=1.0 -PropertyMax=9/8 -[StepsDisplayListRow] -FrameX=0 -FrameY=0 -FrameOnCommand= -FrameOffCommand= -FrameSetCommand= -# -ShowTicks=false -NumTicks=0 -MaxTicks=0 -TicksSetCommand= -# -ShowMeter=false -ZeroMeterString="0" -MeterX=0 -MeterY=0 -MeterOnCommand= -MeterOffCommand= -MeterSetCommand= -# -ShowDescription=false -DescriptionX=0 -DescriptionY=0 -DescriptionOnCommand= -DescriptionOffCommand= -DescriptionSetCommand= -# -ShowCredit=false -CreditX=0 -CreditY=0 -CreditOnCommand= -CreditOffCommand= -CreditSetCommand= -# -ShowAutogen=false -AutogenSetCommand= -# -ShowStepsType=false -StepsTypeSetCommand= - -[StreamDisplay] -; a simple bar life meter: -; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end -PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - local zoomed_width=28; \ - local zoomed_height=8; \ - local spacing_x=11.3; \ - self:zoomtoheight(zoomed_height); \ - self:x((itemIndex-(numItems/2))*spacing_x); \ - local zoomed_width=0; \ - if (itemIndex % 2) == 0 then \ - self:zoomtowidth(24); \ - self:rotationz(90); \ - else \ - self:zoomtowidth(31); \ - self:rotationz(-58); \ - end; \ -end -TextureCoordScaleX=10 -NumPills=20 -UseThreePartMethod=false -ThreePartWidth=128 -AlwaysBounceNormalBar=false - -[TextBanner] -TitleOnCommand= -SubtitleOnCommand= -ArtistOnCommand=visible,false -ArtistPrependString="/" -AfterSetCommand=%TextBannerAfterSet - -[WheelNotifyIcon] -ShowTraining=false -BlinkPlayersBest=true - -# 04 # -[Screen] -ScreenInitCommand= -ScreenOnCommand= -AllowOperatorMenuButton=true -# This metric is only for people who know what they are doing. If you set this -# to false, you are expected to know how to cancel screens in Lua. (coincidentally, -# that would be SCREENMAN:GetTopScreen():Cancel(), for people who aren't AJ ;) ) -HandleBackButton=true -RepeatRate=-1 -RepeatDelay=-1 -PrepareScreens= -PersistScreens= -GroupedScreens= -CodeNames="" -CancelCancelCommand= -LightsMode="LightsMode_MenuStartAndDirections" -ShowCreditDisplay=false - -[ScreenDebugOverlay] -Class="ScreenDebugOverlay" -Fallback="Screen" - -LineOnColor=color("1,1,1,1") -LineOffColor=color("0.6,0.6,0.6,1") -LineStartY=SCREEN_TOP+50 -LineSpacing=16 -LineButtonX=SCREEN_CENTER_X-50 -LineFunctionX=SCREEN_CENTER_X-30 - -ButtonTextOnCommand=NoStroke;zoom,0.8 -FunctionTextOnCommand=NoStroke;zoom,0.8 - -PageStartX=SCREEN_CENTER_X-100 -PageSpacingX=120 -PageTextOnCommand=NoStroke;zoom,0.75 -PageTextGainFocusCommand=diffuse,color("1,1,1,1") -PageTextLoseFocusCommand=diffuse,color("0.6,0.6,0.6,1") - -DebugMenuHeaderX=SCREEN_LEFT+80 -DebugMenuHeaderY=SCREEN_TOP+18 -DebugMenuHeaderOnCommand=diffusebottomedge,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,0.5") -DebugMenuHeaderOffCommand= - -HeaderTextX=SCREEN_LEFT+80 -HeaderTextY=SCREEN_TOP+18 -HeaderTextOnCommand=diffusebottomedge,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,0.5") -HeaderTextOffCommand= - -LineOnCommand=zoom,0.75 -# -[ScreenSystemLayer] -Class="ScreenSystemLayer" -Fallback="Screen" -# -ShowCreditDisplay=true -CreditsJoinOnly=false -# -CreditsP1X=SCREEN_LEFT+4 -CreditsP1Y=SCREEN_BOTTOM-4 -CreditsP1RefreshCreditTextMessageCommand=playcommand,"UpdateText"; -CreditsP1CoinInsertedMessageCommand=playcommand,"UpdateText"; -CreditsP1CoinInsertedMessageCommand=playcommand,"UpdateText"; -CreditsP1PlayerJoinedMessageCommand=playcommand,"UpdateText"; -CreditsP1ScreenChangedMessageCommand=playcommand,"UpdateVisible";queuecommand,"On" -CreditsP1OnCommand=horizalign,left;vertalign,bottom;zoom,0.675;shadowlength,1; -CreditsP1OffCommand= -# -CreditsP2X=SCREEN_RIGHT-4 -CreditsP2Y=SCREEN_BOTTOM-4 -CreditsP2RefreshCreditTextMessageCommand=playcommand,"UpdateText"; -CreditsP2CoinInsertedMessageCommand=playcommand,"UpdateText"; -CreditsP2PlayerJoinedMessageCommand=playcommand,"UpdateText"; -CreditsP2ScreenChangedMessageCommand=playcommand,"UpdateVisible";queuecommand,"On" -CreditsP2OnCommand=horizalign,right;vertalign,bottom;zoom,0.675;shadowlength,1; -CreditsP2OffCommand= - -[ScreenConsoleOverlay] -Class="ScreenSystemLayer" -Fallback="ScreenSystemLayer" -# -CreditsInitCommand=visible,false;zoom,0 -CreditsP1X=-9999 -CreditsP2X=-9999 -CreditsP1Y=-9999 -CreditsP2Y=-9999 - -[ScreenInstallOverlay] -Class="ScreenInstallOverlay" -Fallback="Screen" - -StatusX=SCREEN_LEFT+40 -StatusY=SCREEN_BOTTOM-32 -StatusOnCommand=align,0,1 - -[ScreenSyncOverlay] -Class="ScreenSyncOverlay" -Fallback="Screen" -StatusOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+150;shadowlength,2;strokecolor,color("#000000"); -AdjustmentsOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y; -# -[ScreenStatsOverlay] -Class="ScreenStatsOverlay" -Fallback="Screen" -StatsX=SCREEN_RIGHT-8 -StatsY=SCREEN_TOP+10 -StatsOnCommand=halign,1;valign,0;shadowlength,1;zoom,0.5 -ShowSkips=true -SkipX=SCREEN_RIGHT-100 -SkipY=SCREEN_BOTTOM-100 -SkipOnCommand=zoom,0.5 -SkipWidth=190 -SkipSpacingY=14 -# -[ScreenWithMenuElements] -Class="ScreenWithMenuElements" -Fallback="Screen" -# -TimerSeconds=-1 -# -FirstUpdateCommand= -PlayMusic=true -MusicAlignBeat=true -StopMusicOnBack=false -WaitForChildrenBeforeTweeningOut=false -CancelTransitionsOut=false -# -ShowCreditDisplay=true -AllowDisabledPlayerInput=false -MemoryCardIcons=false -# -MemoryCardDisplayP1X= -MemoryCardDisplayP1Y= -MemoryCardDisplayP1OnCommand= -MemoryCardDisplayP1OffCommand= -MemoryCardDisplayP2X= -MemoryCardDisplayP2Y= -MemoryCardDisplayP2OnCommand= -MemoryCardDisplayP2OffCommand= -# -TimerStealth=false -ForceTimer=false -TimerMetricsGroup="MenuTimer" -TimerX= -TimerY= -TimerOnCommand= -TimerOffCommand= - -[ScreenWithMenuElementsBlank] -Fallback="ScreenWithMenuElements" -UpdateOnMessage="" -ShowHelp=false - -[ScreenSelectMaster] -Class="ScreenSelectMaster" -Fallback="ScreenWithMenuElements" -# -DoSwitchAnyways=false -WrapCursor=false -AllowRepeatingInput=false -PreSwitchPageSeconds=0 -PostSwitchPageSeconds=0 -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=1024 -ScrollerTransform=function(self,offset,itemIndex,numItems) end -ScrollerSubdivisions=1 -OverrideSleepAfterTweenOffSeconds=false -SleepAfterTweenOffSeconds=0 -NumCodes=0 -OptionOrderUp= -OptionOrderDown= -OptionOrderLeft= -OptionOrderRight= -OptionOrderAuto= -# !! -OptionOrderBUp="" -OptionOrderBDown="" -OptionOrderBLeft="" -OptionOrderBRight="" -OptionOrderBAuto="" -# !! -ShowIcon=false -ShowCursor=false -ShowScroller=false -WrapScroller=false -LoopScroller=false -# -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y -PerChoiceIconElement=true -PerChoiceScrollElement=true -# All on page 1 by default. -NumChoicesOnPage1=1024 -SharedSelection=true -UseIconMetrics=false -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -DisabledColor=color("#606060") -DoublePressToSelect=false - -# Blank defaults for a few options. -IconChoice1SwitchToPage1Command= -IconChoice1SwitchToPage2Command= -IconChoice1OnCommand= -IconChoice1OffCommand= -IconChoice1OffFocusedCommand= -IconChoice1OffUnfocusedCommand= - -IconChoice2SwitchToPage1Command= -IconChoice2SwitchToPage2Command= -IconChoice2OnCommand= -IconChoice2OffCommand= -IconChoice2OffFocusedCommand= -IconChoice2OffUnfocusedCommand= - -IconChoice3SwitchToPage1Command= -IconChoice3SwitchToPage2Command= -IconChoice3OnCommand= -IconChoice3OffCommand= -IconChoice3OffFocusedCommand= -IconChoice3OffUnfocusedCommand= - -IconChoice4SwitchToPage1Command= -IconChoice4SwitchToPage2Command= -IconChoice4OnCommand= -IconChoice4OffCommand= -IconChoice4OffFocusedCommand= -IconChoice4OffUnfocusedCommand= - -ExplanationPage1X=0 -ExplanationPage1Y=0 -ExplanationPage1SwitchToPage1Command= -ExplanationPage1SwitchToPage2Command= -ExplanationPage1OnCommand=visible,false -ExplanationPage1OffCommand= -ExplanationPage2X=0 -ExplanationPage2Y=0 -ExplanationPage2SwitchToPage1Command= -ExplanationPage2SwitchToPage2Command= -ExplanationPage2OnCommand=visible,false -ExplanationPage2OffCommand= - -MorePage1X=0 -MorePage1Y=0 -MorePage1SwitchToPage1Command= -MorePage1SwitchToPage2Command= -MorePage1OnCommand=visible,false -MorePage1OffCommand= -MorePage2X=0 -MorePage2Y=0 -MorePage2SwitchToPage1Command= -MorePage2SwitchToPage2Command= -MorePage2OnCommand=visible,false -MorePage2OffCommand= -IdleCommentSeconds=0 -IdleTimeoutSeconds=0 -# xxx: apparently this isn't needed, according to Chris Danford, but it makes -# things work, so we're keeping it in until the problem is fixed. -UpdateOnMessage="PlayerJoined" -UseTwoLists=false - -[ScreenSelectMasterBlank] -Fallback="ScreenSelectMaster" - -[ScreenTextEntry] -Class="ScreenTextEntry" -Fallback="ScreenWithMenuElements" -PrevScreen= -HelpText= -TimerSeconds=-1 -ShowStyleIcon=false -RowStartX=SCREEN_LEFT+100 -RowStartY=SCREEN_CENTER_Y-30 -RowEndX=SCREEN_RIGHT-100 -RowEndY=SCREEN_BOTTOM-96 -QuestionX=SCREEN_CENTER_X -QuestionY=SCREEN_CENTER_Y-40 -QuestionOnCommand=wrapwidthpixels,600 -QuestionOffCommand= -AnswerX=SCREEN_CENTER_X -AnswerY=SCREEN_CENTER_Y+20 -AnswerOnCommand=zoom,1.5;shadowlength,0 -AnswerOffCommand= -CursorOnCommand= -CursorOffCommand= -KeysInitCommand=zoom,0.8;shadowlength,0 - -[ScreenInit] -Class="ScreenAttract" -Fallback="ScreenAttract" -# -PrevScreen="ScreenInit" -NextScreen=Branch.AfterInit() -StartScreen=Branch.TitleMenu() -# -ForceTimer=true -TimerSeconds=5 -# -PlayMusic=false -# -TimerMetricsGroup="MenuTimerNoSound" -TimerOnCommand=visible,false - -[ScreenTitleMenu] -Class="ScreenTitleMenu" -Fallback="ScreenSelectMaster" -# -PrevScreen="ScreenInit" -NextScreen="ScreenInit" -# -StopMusicOnBack=true -# -CoinModeChangeScreen=Branch.TitleMenu() -# -ScreenOnCommand=lockinput,0 -LightsMode="LightsMode_Joining" -TimerSeconds=-1 -# -SharedSelection=true -AllowDisabledPlayerInput=true -OverrideSleepAfterTweenOffSeconds=false -DoSwitchAnyways=false -# -SleepAfterTweenOffSeconds=0 -# -UpdateOnMessage="" -# -NumChoicesOnPage1=100 -ChoiceNames="1,4,5,7" -#~ ChoiceNames="1,2,3,4,5,6,7" -DefaultChoice="1" -Choice1="applydefaultoptions;text,Game Start;screen,"..Branch.StartGame() -Choice2="screen,ScreenNetworkOptions;text,Play Online" -Choice3="screen,ScreenSelectGame;text,Select Game" -Choice4="screen,ScreenOptionsService;text,Options" -Choice5="screen,ScreenOptionsEdit;text,Edit/Share" -Choice6="screen,ScreenJukeboxMenu;text,Jukebox" -Choice7="screen,ScreenExit;text,Exit" -Choice8="screen,ScreenTest;text,Sandbox" -Choice9="screen,ScreenQuickSetupOverview;text,Setup" -# Aliases for the future. -ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" -ChoiceGameStart="applydefaultoptions;screen,ScreenSelectProfile;text,Game Start" -ChoiceOnline="screen,ScreenNetworkOptions;text,Play Online" -ChoiceGameSelect="screen,ScreenSelectGame;text,Select Game" -ChoiceOptions="screen,ScreenOptionsSystemDirection;text,Options" -ChoiceEdit="screen,ScreenOptionsEdit;text,Edit/Share" -ChoiceJukebox="screen,ScreenJukeboxMenu;text,Jukebox" -ChoiceSandbox="screen,ScreenTest;text,Sandbox" -ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" -ChoiceExit="screen,ScreenExit;text,Exit" -# -AllowRepeatingInput=true -ShowCursor=false -WrapCursor=true -WrapScroller=false -LoopScroller=false -ScrollerSubdivisions=1 -ShowIcon=false -UseIconMetrics=false -ShowScroller=true -PerChoiceScrollElement=false -PerChoiceIconElement=false -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(32*(itemIndex-(numItems-1)/2)); end -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=20 -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y -ScrollerOnCommand= -ScrollerOffCommand= -IdleCommentSeconds=-1 -IdleTimeoutSeconds=-1 -IdleTimeoutScreen=Branch.AfterInit() -DoublePressToSelect=false -UseTwoLists=false -OptionOrderUp="" -OptionOrderDown="" -OptionOrderLeft="" -OptionOrderRight="" -OptionOrderAuto="" -OptionOrderBUp="" -OptionOrderBDown="" -OptionOrderBLeft="" -OptionOrderBRight="" -OptionOrderBAuto="" -# -PreSwitchPageSeconds= -PostSwitchPageSeconds= -# -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -# -LogoX=SCREEN_CENTER_X -LogoY=SCREEN_CENTER_Y-80 -LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,8,0;zoom,0;bounceend,0.35;zoom,1 -LogoOffCommand= -[ScreenQuickSetupOverview] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -# -NextScreen=Branch.QuickSetupA -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=-1 -# -DefaultChoice="Start" -ChoiceNames="Start,Back" -# -ChoiceStart="name,Start;screen,".. Branch.QuickSetupA -ChoiceBack="name,Back;screen,".. Branch.TitleMenu -# -PerChoiceScrollElement=false -PerChoiceIconElement=false -# -ShowScroller=true -WrapScroller=false -ShowIcon=true -[ScreenQuickSetupPhaseOne] -Class="ScreenSelectMaster" -Fallback="ScreenQuickSetupOverview" -# -NextScreen=Branch.QuickSetupBl -PrevScreen=Branch.QuickSetupStart -# -DefaultChoice="Set" -ChoiceNames="Set,Back" -# -ChoiceSet="name,Set;screen,".. Branch.QuickSetupB -ChoiceBack="name,Back;screen,".. Branch.QuickSetupStart -[ScreenQuickSetupPhaseTwo] -Class="ScreenSelectMaster" -Fallback="ScreenQuickSetupOverview" -# -NextScreen=Branch.QuickSetupC -PrevScreen=Branch.QuickSetupA -# -DefaultChoice="Set" -ChoiceNames="Set,Back" -# -ChoiceSet="name,Set;screen,".. Branch.QuickSetupC -ChoiceBack="name,Back;screen,".. Branch.QuickSetupA -[ScreenQuickSetupPhaseThree] -Class="ScreenSelectMaster" -Fallback="ScreenQuickSetupOverview" -# -NextScreen=Branch.QuickSetupD -PrevScreen=Branch.QuickSetupB -# -DefaultChoice="Set" -ChoiceNames="Set,Back" -# -ChoiceSet="name,Set;screen,".. Branch.QuickSetupD -ChoiceBack="name,Back;screen,".. Branch.QuickSetupB -[ScreenQuickSetupPhaseFour] -Class="ScreenSelectMaster" -Fallback="ScreenQuickSetupOverview" -# -NextScreen=Branch.QuickSetupFinished -PrevScreen=Branch.QuickSetupC -# -DefaultChoice="Set" -ChoiceNames="Set,Back" -# -ChoiceSet="name,Set;screen,".. Branch.QuickSetupFinished -ChoiceBack="name,Back;screen,".. Branch.QuickSetupC -[ScreenQuickSetupFinished] -Class="ScreenSelectMaster" -Fallback="ScreenQuickSetupOverview" -# -NextScreen=Branch.TitleMenu() -PrevScreen=Branch.QuickSetupD -# -DefaultChoice="Set" -ChoiceNames="Set,Back" -# -ChoiceSet="name,Set;screen,".. Branch.TitleMenu -ChoiceBack="name,Back;screen,".. Branch.QuickSetupD -[ScreenProfileLoad] -Class="ScreenProfileLoad" -Fallback="ScreenWithMenuElementsBlank" -# -NextScreen=Branch.AfterProfileLoad() -#~ NextScreen="ScreenSelectProfile" -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=-1 -# -LoadEdits=true - -[ScreenSelectProfile] -Fallback="ScreenWithMenuElements" -Class="ScreenSelectProfile" -# -ScreenOnCommand=lockinput,1 -# -NextScreen=Branch.AfterSelectProfile() -PrevScreen=Branch.TitleMenu() -StartScreen=Branch.AfterSelectProfile() -# -TimerSeconds=40 -# -CodeNames=SelectProfileKeys() -CodeUp="+MenuUp" -CodeUp2="+Up" -CodeDown="+MenuDown" -CodeDown2="+Down" -CodeStart="Start" -CodeBack="Back" -CodeCenter="Center" -CodeDownLeft="DownLeft" -CodeDownRight="DownRight" - -[ScreenSelectStyle] -# (formerly known as ScreenSelectPlayMode before sm-ssc v1.0 beta 3) -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -# -NextScreen=Branch.AfterSelectPlayMode() -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=40 -# -DefaultChoice="Single" -ChoiceNames=GameCompatibleModes() -# -OptionOrderAuto="1:2,2:1" -ChoiceSingle="name,Single;style,single;screen,"..Branch.AfterSelectPlayMode() -ChoiceDouble="name,Double;style,double;screen,"..Branch.AfterSelectPlayMode() -ChoiceSolo="name,Solo;style,solo;screen,"..Branch.AfterSelectPlayMode() -ChoiceVersus="name,Versus;style,versus;screen,"..Branch.AfterSelectPlayMode() -ChoiceCouple="name,Couple;style,couple;screen,"..Branch.AfterSelectPlayMode() -ChoiceHalfDouble="name,HalfDouble;style,halfdouble;screen,"..Branch.AfterSelectPlayMode() -Choice5Keys="name,5Keys;style,single5;;screen,"..Branch.AfterSelectPlayMode() -Choice7Keys="name,7Keys;style,single7;screen,"..Branch.AfterSelectPlayMode() -Choice10Keys="name,10Keys;style,double10;screen,"..Branch.AfterSelectPlayMode() -Choice14Keys="name,14Keys;style,double14;screen,"..Branch.AfterSelectPlayMode() -ChoiceKB7="name,kb7;style,single;screen,"..Branch.AfterSelectPlayMode() -# -PerChoiceScrollElement=false -PerChoiceIconElement=false -# -ShowScroller=true -WrapScroller=true -ShowIcon=false -# - -[ScreenSelectPlayMode] -# (formerly known as ScreenSelectPlayStyle before sm-ssc v1.0 beta 3) -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -# -NextScreen=Branch.GetGameInformationScreen -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=40 -# -DefaultChoice="Easy" -ChoiceNames="Normal,Rave,Extended,Oni,Endless" -# -PerChoiceScrollElement=false -PerChoiceIconElement=false -# -ShowScroller=true -WrapScroller=true -ShowIcon=false -# -ChoiceEasy="applydefaultoptions;name,Easy;playmode,regular;difficulty,easy;screen,ScreenSelectMusic;setenv,sMode,Normal" -ChoiceNormal="applydefaultoptions;name,Normal;playmode,regular;difficulty,easy;screen,ScreenSelectMusic;setenv,sMode,Normal" -ChoiceHard="applydefaultoptions;name,Hard;playmode,regular;difficulty,hard;screen,ScreenSelectMusic;setenv,sMode,Normal" -ChoiceRave="applydefaultoptions;name,Rave;playmode,rave;screen,ScreenSelectMusic;setenv,sMode,Rave" -ChoiceExtended="applydefaultoptions;name,Extended;playmode,nonstop;screen,ScreenSelectCourse;setenv,sMode,Extended" -ChoiceOni="applydefaultoptions;name,Oni;playmode,oni;screen,ScreenSelectCourse;setenv,sMode,Oni" -ChoiceEndless="applydefaultoptions;name,Endless;playmode,endless;screen,ScreenSelectCourse;setenv,sMode,Endless" - -[ScreenSelectCharacter] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -# -NextScreen=Branch.GetGameInformationScreen -PrevScreen=Branch.TitleMenu() -# -PerChoiceScrollElement=false -PerChoiceIconElement=false -# -ShowScroller=true -WrapScroller=true -ShowIcon=false -[ScreenGameInformation] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -# -#~ NextScreen="ScreenSelectMusic" -NextScreen=GAMESTATE:IsCourseMode() and "ScreenSelectCourse" or "ScreenSelectMusic" -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=15 -# -DefaultChoice="Delay" -ChoiceNames="Delay" -# -TimerSeconds=15 -# -ChoiceDelay="screen,ScreenSelectMusic" -# -ShowScroller=false -ShowIcon=false -# - -[ScreenSelectMusic] -Class="ScreenSelectMusic" -Fallback="ScreenWithMenuElements" -# -NextScreen=Branch.PlayerOptions() -PrevScreen=Branch.TitleMenu() -# -MusicWheelType="MusicWheel" -Codes="" -# -TimerSeconds=60 -DoRouletteOnMenuTimer=true -RouletteTimerSeconds=15 -# -DefaultSort=GAMESTATE:IsCourseMode() and "Group" or "AllCourses" -# -SampleMusicPreviewMode='SampleMusicPreviewMode_Normal' -SampleMusicLoops=true -SampleMusicFallbackFadeInSeconds=0 -# -UseOptionsList=false -OptionsListTimeout=0.25 -# -UsePlayerSelectMenu=false -SelectMenuScreenName="ScreenPlayerOptions" -OptionsMenuAvailable=true -SelectMenuAvailable=false -ModeMenuAvailable=true -# -ShowOptionsMessageSeconds=1.5 -# -ScreenModsCommand=setupmusicstagemods -# -PreviousSongButton="MenuLeft" -NextSongButton="MenuRight" -# -ChangeStepsWithGameButtons=false -PreviousDifficultyButton="MenuUp" -NextDifficultyButton="MenuDown" -# -ChangeGroupsWithGameButtons=false -PreviousGroupButton="MenuUp" -NextGroupButton="MenuDown" -# -TwoPartSelection=false -TwoPartConfirmsOnly=false -TwoPartTimerSeconds=15 -# -SampleMusicDelay=0.25 -SampleMusicDelayInit=0 -AlignMusicBeat=false -SelectMenuChangesDifficulty=true -WrapChangeSteps=false -# -MusicWheelX=SCREEN_CENTER_X+160 -MusicWheelY=SCREEN_CENTER_Y -MusicWheelOnCommand= -MusicWheelOffCommand= -# -BannerX=SCREEN_CENTER_X-160 -BannerY=SCREEN_TOP+160-36 -BannerOnCommand=scaletoclipped,256,80 -BannerOffCommand= -# -CDTitleX=SCREEN_CENTER_X-160+90 -CDTitleY=SCREEN_TOP+160+(36/2)+8 -CDTitleFrontCommand= -CDTitleBackCommand= -CDTitleOnCommand=visible,false -CDTitleOffCommand= -# -ScoreFrameP1X= -ScoreFrameP1Y= -ScoreFrameP1OnCommand=visible,false -ScoreFrameP1OffCommand= -ScoreP1X= -ScoreP1Y= -ScoreP1OnCommand=visible,false -ScoreP1OffCommand= -# -ScoreP2X= -ScoreP2Y= -ScoreP2OnCommand=visible,false -ScoreP2OffCommand= -ScoreFrameP2X= -ScoreFrameP2Y= -ScoreFrameP2OnCommand=visible,false -ScoreFrameP2OffCommand= -# -ScoreP1SortChangeCommand=stoptweening; -ScoreP2SortChangeCommand=stoptweening; -ScoreFrameP1SortChangeCommand=stoptweening; -ScoreFrameP2SortChangeCommand=stoptweening; - -[ScreenSelectCourse] -Class="ScreenSelectMusic" -Fallback="ScreenSelectMusic" -# -DefaultSort="Nonstop" -ScreenModsCommand=setupcoursestagemods -# -MusicWheelType="CourseWheel" -Codes="CourseCodeDetector" -[CourseCodeDetector] -Fallback="CodeDetector" -NextSort1= -NextSort2= -NextSort3= -NextSort4= - - -[StepsDisplay] -FrameX=0 -FrameY=0 -FrameOnCommand= -FrameLoadCommand=%function(self,param) local bFlip = param.PlayerState and param.PlayerState:GetPlayerNumber() ~= PLAYER_1; self:zoomx(bFlip and -1 or 1); end -FrameSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) end end -NumTicks=10 -MaxTicks=14 -TicksX=0 -TicksY=0 -TicksOnCommand=shadowlength,0; -TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end -ShowTicks=false -ShowMeter=true -ZeroMeterString="?" -MeterX=30 -MeterY=0 -MeterOnCommand=shadowlength,0 -MeterSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowDescription=true -DescriptionX=-10 -DescriptionY=0 -DescriptionOnCommand=shadowlength,0;uppercase,true; -DescriptionSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowCredit=false -CreditX=0 -CreditY=0 -CreditOnCommand= -CreditSetCommand= -ShowAutogen=true -AutogenX=40 -AutogenY=0 -AutogenOnCommand= -AutogenSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowStepsType=false -StepsTypeX=0 -StepsTypeY=0 -StepsTypeOnCommand= -# - -[StepsDisplayGameplay] -Fallback="StepsDisplay" - -[ScreenStageInformation] -Class="ScreenSplash" -Fallback="ScreenSplash" -# -NextScreen=Branch.GameplayScreen() -PrevScreen=Branch.BackOutOfStageInformation() -PrepareScreen="ScreenGameplay" -# -ForceTimer=true -TimerMetricsGroup="MenuTimerNoSound" -TimerSeconds=5 -# - -[ScreenOptions] -Fallback="ScreenWithMenuElements" -NavigationMode="normal" -InputMode="individual" -ForceAllPlayers=false -RepeatRate=12 -RepeatDelay=0.25 -NumRowsShown=8 -RowInitCommand= -RowOnCommand= -RowOffCommand= -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-146+36*offsetFromCenter) end -ExplanationP1X=SCREEN_CENTER_X-240 -ExplanationP1Y=SCREEN_CENTER_Y+174 -ExplanationP1OnCommand=shadowlength,0;wrapwidthpixels,(SCREEN_WIDTH*0.78)*1.5;zoom,0.5;halign,0;cropright,1;linear,0.5;cropright,0 -ExplanationP1OffCommand= -ExplanationP2X=SCREEN_CENTER_X+240 -ExplanationP2Y=SCREEN_CENTER_Y+174 -ExplanationP2OnCommand=shadowlength,0;wrapwidthpixels,(SCREEN_WIDTH*0.78)*1.5;zoom,0.5;halign,1;cropright,1;linear,0.5;cropright,0 -ExplanationP2OffCommand= -ExplanationTogetherX=SCREEN_CENTER_X -ExplanationTogetherY=SCREEN_CENTER_Y+184 -ExplanationTogetherOnCommand=shadowlength,0;zoom,0.75;wrapwidthpixels,(SCREEN_WIDTH*0.9375)*1.25;cropright,1;linear,0.5;cropright,0 -ExplanationTogetherOffCommand= -DisqualifyP1X= -DisqualifyP1Y= -DisqualifyP1OnCommand=visible,false -DisqualifyP1OffCommand= -DisqualifyP2X= -DisqualifyP2Y= -DisqualifyP2OnCommand=visible,false -DisqualifyP2OffCommand= -PageX=SCREEN_CENTER_X -PageY=SCREEN_CENTER_Y -PageOnCommand= -ContainerOnCommand= -ContainerOffCommand= -CursorOnCommand= -LineHighlightOnCommand= -LineHighlightChangeCommand= -LineHighlightChangeToExitCommand= -ShowScrollBar=false -ScrollBarHeight=0 -ScrollBarTime=0 -LineHighlightX=SCREEN_CENTER_X -ShowExitRow=true -SeparateExitRow=true -SeparateExitRowY=SCREEN_CENTER_Y+140 -MoreX= -MoreY= -MoreOnCommand=visible,false -MoreExitSelectedP1Command= -MoreExitSelectedP2Command= -MoreExitUnselectedP1Command= -MoreExitUnselectedP2Command= -ShowExplanations=true -AllowRepeatingChangeValueInput=false -CursorTweenSeconds=0.3 -WrapValueInRow=true -OptionRowNormalMetricsGroup="OptionRow" -OptionRowExitMetricsGroup="OptionRowExit" - -[ScreenOptionsMaster] -Fallback="ScreenOptions" -Class="ScreenOptionsMaster" -NoteSkinSortOrder="" - -# ExitItem is an exit row with the "Exit" text as a menu item; ExitTitle -# uses the menu title. -ExitItem="1;together;SelectNone;showoneinrow" -ExitItemDefault="" -ExitItem,1="screen," .. Screen.Metric("NextScreen") .. ";name,ExitItem" -ExitTitle="1;together;SelectNone;showoneinrow" -ExitTitleDefault="" -ExitTitle,1="screen," .. Screen.Metric("NextScreen") .. ";name,ExitTitle" - -# Player options -Speed="12;" -SpeedDefault="mod,1x,no randomspeed" -Speed,1="mod,0.25x;name,x0.25" -Speed,2="mod,0.50x;name,x0.50" -Speed,3="mod,0.75x;name,x0.75" -Speed,4="mod,1x;name,x1" -Speed,5="mod,1.5x;name,x1.5" -Speed,6="mod,2x;name,x1.75" -Speed,7="mod,3x;name,x2" -Speed,8="mod,4x;name,x2.25" -Speed,9="mod,8x;name,x2.5" -Speed,10="mod,C150;name,C150" -Speed,11="mod,C300;name,C300" -Speed,12="mod,1x,200% randomspeed;name,Random" - -Accel="5;selectmultiple" -AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" -Accel,1="mod,boost;name,Boost" -Accel,2="mod,brake;name,Brake" -Accel,3="mod,wave;name,Wave" -Accel,4="mod,expand;name,Expand" -Accel,5="mod,boomerang;name,Boomerang" - -# Accel="6" -# AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" -# Accel,1="name,Off" -# Accel,2="mod,boost;name,Boost" -# Accel,3="mod,brake;name,Brake" -# Accel,4="mod,wave;name,Wave" -# Accel,5="mod,expand;name,Expand" -# Accel,6="mod,boomerang;name,Boomerang" - -Effect="14;selectmultiple" -EffectDefault="mod,no drunk,no dizzy,,no twirl,no roll,no confusion,no mini,no tiny,no flip,no invert,no tornado,no tipsy,no bumpy,no beat,no xmode" -Effect,1="mod,drunk;name,Drunk" -Effect,2="mod,dizzy;name,Dizzy" -Effect,3="mod,twirl;name,Twirl" -Effect,4="mod,roll;name,Roll" -Effect,5="mod,confusion;name,Confusion" -Effect,6="mod,tiny;name,Tiny" -Effect,7="mod,-100% mini;name,Big" -Effect,8="mod,flip;name,Flip" -Effect,9="mod,invert;name,Invert" -Effect,10="mod,tornado;name,Tornado" -Effect,11="mod,tipsy;name,Tipsy" -Effect,12="mod,bumpy;name,Bumpy" -Effect,13="mod,beat;name,Beat" -Effect,14="mod,45% xmode;name,XMode" - -EffectsReceptor="selectmultiple" -EffectsReceptorDefault="" -EffectsReceptor,1="mod,confusion;name,Confusion" -EffectsReceptor,2="mod,invert;name,Invert" -EffectsReceptor,3="mod,Flip;name,Flip" -EffectsReceptor,4="mod,mini;name,Mini" -EffectsReceptor,5="mod,-100% mini;name,Big" -EffectsReceptor,6="mod,45% xmode;name,XMode" - -EffectsArrow="selectmultiple" -EffectsArrowDefault="" -EffectsArrow,1="mod,drunk;name,Drunk" -EffectsArrow,2="mod,dizzy;name,Dizzy" -EffectsArrow,3="mod,twirl;name,Twirl" -EffectsArrow,4="mod,roll;name,Roll" -EffectsArrow,5="mod,beat;name,Beat" -EffectsArrow,6="mod,tispy;name,Tipsy" -EffectsArrow,7="mod,50% tornado;name,Tornado" -EffectsArrow,8="mod,drunk;name,Bumpy" - -# Effect="9" -# EffectDefault="mod,no drunk,no dizzy,no confusion,no mini,no flip,no tornado,no tipsy" -# Effect,1="name,Off" -# Effect,2="mod,drunk;name,Drunk" -# Effect,3="mod,dizzy;name,Dizzy" -# Effect,4="mod,confusion;name,Confusion" -# Effect,5="mod,mini;name,Mini" -# Effect,6="mod,-100% mini;name,Big" -# Effect,7="mod,flip;name,Flip" -# Effect,8="mod,tornado;name,Tornado" -# Effect,9="mod,tipsy;name,Tipsy" - -# XXX: what of hiddenoffset and suddenoffset? -Appearance="4;selectmultiple" -AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" -Appearance,1="mod,hidden;name,Hidden" -Appearance,2="mod,sudden;name,Sudden" -Appearance,3="mod,stealth;name,Stealth" -Appearance,4="mod,blink;name,Blink" -# Random Vanish causes crashes [going into sm-ssc v1.0 beta 4] -aj -#Appearance,5="mod,randomvanish;name,R.Vanish" - -# Appearance="6" -# AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" -# Appearance,1="name,Visible" -# Appearance,2="mod,hidden;name,Hidden" -# Appearance,3="mod,sudden;name,Sudden" -# Appearance,4="mod,stealth;name,Stealth" -# Appearance,5="mod,blink;name,Blink" -# Appearance,6="mod,randomvanish;name,R.Vanish" - -Turn="6;selectmultiple" -TurnDefault="mod,no turn" -Turn,1="mod,mirror;name,Mirror" -Turn,2="mod,left;name,Left" -Turn,3="mod,right;name,Right" -Turn,4="mod,shuffle;name,Shuffle" -Turn,5="mod,supershuffle;name,SuperShuffle" -Turn,6="mod,softshuffle;name,SoftShuffle" - -# Turn="6" -# TurnDefault="mod,no turn" -# Turn,1="name,Off" -# Turn,2="mod,mirror;name,Mirror" -# Turn,3="mod,left;name,Left" -# Turn,4="mod,right;name,Right" -# Turn,5="mod,shuffle;name,Shuffle" -# Turn,6="mod,supershuffle;name,SuperShuffle" - -Insert="7;selectmultiple" -InsertDefault="mod,no wide,no big,no quick,no skippy,no echo,no stomp" -Insert,1="mod,wide;name,Wide" -Insert,2="mod,big;name,Big" -Insert,3="mod,quick;name,Quick" -Insert,4="mod,bmrize;name,BMRize" -Insert,5="mod,skippy;name,Skippy" -Insert,6="mod,echo;name,Echo" -Insert,7="mod,stomp;name,Stomp" - -Remove="8;selectmultiple" -RemoveDefault="mod,no little,no nojumps,no nohands,no noquads,no nostretch,no norolls,no nolifts,no nofakes" -Remove,1="mod,little;name,Little" -Remove,2="mod,nojumps;name,NoJumps" -Remove,3="mod,nohands;name,NoHands" -Remove,4="mod,noquads;name,NoQuads" -Remove,5="mod,nostretch;name,NoStretch" -Remove,6="mod,norolls;name,NoRolls" -Remove,7="mod,nolifts;name,NoLifts" -Remove,8="mod,nofakes;name,NoFakes" - -# Insert="8" -# InsertDefault="mod,no little,no wide,no big,no quick,no skippy,no echo,no stomp" -# Insert,1="name,Off" -# Insert,2="mod,little;name,Little" -# Insert,3="mod,wide;name,Wide" -# Insert,4="mod,big;name,Big" -# Insert,5="mod,quick;name,Quick" -# Insert,6="mod,skippy;name,Skippy" -# Insert,7="mod,echo;name,Echo" -# Insert,8="mod,stomp;name,Stomp" - -Scroll="5;selectmultiple" -ScrollDefault="mod,no reverse,no split,no alternate,no cross,no centered" -Scroll,1="mod,reverse;name,Reverse" -Scroll,2="mod,split;name,Split" -Scroll,3="mod,alternate;name,Alternate" -Scroll,4="mod,cross;name,Cross" -Scroll,5="mod,centered;name,Centered" - -# Scroll="5" -# ScrollDefault="mod,no reverse,no split,no alternate,no cross" -# Scroll,1="name,Standard" -# Scroll,2="mod,reverse;name,Reverse" -# Scroll,3="mod,split;name,Split" -# Scroll,4="mod,alternate;name,Alternate" -# Scroll,5="mod,cross;name,Cross" - -Holds="4;selectmultiple" -HoldsDefault="mod,no noholds,no planted,no twister,no holdstorolls" -Holds,1="mod,noholds;name,NoHolds" -Holds,2="mod,planted;name,Planted" -Holds,3="mod,twister;name,Twister" -Holds,4="mod,holdrolls;name,HoldsToRolls" - -# Holds="7" -# HoldsDefault="mod,no noholds,no planted,no twister,no nojumps,no nohands, no holdstorolls" -# Holds,1="mod,noholds;name,Off" -# Holds,2="name,On" -# Holds,3="mod,planted;name,Planted" -# Holds,4="mod,twister;name,Twister" -# Holds,5="mod,holdstorolls;name,HoldsToRolls" -# Holds,6="mod,nojumps;name,NoJumps" -# Holds,7="mod,nohands;name,NoHands" - -Mines="4" -MinesDefault="mod,no nomines,no mines,no attackmines" -Mines,1="mod,nomines;name,Off" -Mines,2="name,On" -Mines,3="mod,mines;name,Add" -Mines,4="mod,attackmines;name,AttackMines" - -# Mines="4" -# MinesDefault="mod,no nomines,no mines, no attackmines" -# Mines,1="mod,nomines;name,Off" -# Mines,2="name,On" -# Mines,3="mod,mines;name,Add" -# Mines,4="mod,attackmines;name,AttackMines" - -Attacks="3" -AttacksDefault="mod,no randomattacks,no songattacks" -Attacks,1="name,Off" -Attacks,2="mod,randomattacks;name,RandomAttacks" -Attacks,3="mod,songattacks;name,SongAttacks" - -PlayerAutoPlay="2" -PlayerAutoPlayDefault="mod,no playerautoplay" -PlayerAutoPlay,1="name,Off" -PlayerAutoPlay,2="mod,playerautoplay;name,On" - -Hide="3;selectmultiple" -HideDefault="mod,no dark,no blind,no cover" -Hide,1="mod,dark;name,Dark" -Hide,2="mod,blind;name,Blind" -Hide,3="mod,60% cover;name,Cover" - -# Hide="3" -# HideDefault="mod,no dark,no blind" -# Hide,1="name,Off" -# Hide,2="mod,dark;name,Dark" -# Hide,3="mod,blind;name,Blind" - -Persp="5" -PerspDefault="mod,overhead" -Persp,1="mod,incoming;name,Incoming" -Persp,2="mod,overhead;name,Overhead" -Persp,3="mod,space;name,Space" -Persp,4="mod,hallway;name,Hallway" -Persp,5="mod,distant;name,Distant" - -ScoreDisplay="3" -ScoreDisplayDefault="mod,addscore" -ScoreDisplay,1="mod,addscore;name,Add" -ScoreDisplay,2="mod,subtractscore;name,Subtract" -ScoreDisplay,3="mod,averagescore;name,Average" - -# Song options -# LifeType="3;together" -LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together" -LifeTypeDefault="" -LifeType,1="mod,bar;name,Bar" -LifeType,2="mod,battery;name,Battery" -LifeType,3="mod,lifetime;name,LifeTime" -BarDrain="3;together" -BarDrainDefault="" -BarDrain,1="mod,normal-drain;name,Normal" -BarDrain,2="mod,norecover;name,NoRecover" -BarDrain,3="mod,suddendeath;name,SuddenDeath" -BatLives="10;together" -BatLivesDefault="" -BatLives,1="mod,1 life;name,1" -BatLives,2="mod,2 lives;name,2" -BatLives,3="mod,3 lives;name,3" -BatLives,4="mod,4 lives;name,4" -BatLives,5="mod,5 lives;name,5" -BatLives,6="mod,6 lives;name,6" -BatLives,7="mod,7 lives;name,7" -BatLives,8="mod,8 lives;name,8" -BatLives,9="mod,9 lives;name,9" -BatLives,10="mod,10 lives;name,10" -Fail="4;together" -FailDefault="mod,faildefault" -Fail,1="mod,failimmediate;name,Immediate" -Fail,2="mod,failimmediatecontinue;name,ImmediateContinue" -Fail,3="mod,failatend;name,FailAtEnd" -Fail,4="mod,failoff;name,Off" -Assist="4;together" -AssistDefault="" -Assist,1="mod,no clap,no metronome;name,Off" -Assist,2="mod,clap,no metronome;name,Clap" -Assist,3="mod,no clap,metronome;name,Metronome" -Assist,4="mod,clap,metronome;name,Both" -Rate="13;together" -RateDefault="mod,1.0xmusic;mod,no haste" -Rate,1="mod,0.25xmusic;name,0.25x" -Rate,2="mod,0.50xmusic;name,0.5x" -Rate,3="mod,0.75xmusic;name,0.75x" -Rate,4="mod,0.8xmusic;name,0.8x" -Rate,5="mod,0.9xmusic;name,0.9x" -Rate,6="mod,1.0xmusic;name,1.0x" -Rate,7="mod,haste;name,Haste" -Rate,8="mod,1.1xmusic;name,1.1x" -Rate,9="mod,1.2xmusic;name,1.2x" -Rate,10="mod,1.25xmusic;name,1.25x" -Rate,11="mod,1.3xmusic;name,1.3x" -Rate,12="mod,1.5xmusic;name,1.5x" -Rate,13="mod,1.75xmusic;name,1.75x" -Rate,14="mod,2.0xmusic;name,2.0x" -AutoAdjust="4;together" -AutoAdjustDefault="" -AutoAdjust,1="mod,no autosync;name,Off" -AutoAdjust,2="mod,autosyncsong;name,Sync Song" -AutoAdjust,3="mod,autosyncmachine;name,Sync Machine" -AutoAdjust,4="mod,autosynctempo;name,Sync Tempo" -SoundEffect="3;together" -SoundEffectDefault="" -SoundEffect,1="mod,no effect;name,Off" -SoundEffect,2="mod,EffectSpeed;name,EffectSpeed" -SoundEffect,3="mod,EffectPitch;name,EffectPitch" -Background="3;together" -BackgroundDefault="" -Background,1="mod,no effect;name,Default" -Background,2="mod,staticbg;name,StaticBG" -Background,3="mod,randombg;name,RandomBG" -SaveScores="2;together" -SaveScoresDefault="" -SaveScores,1="mod,no savescore;name,Off" -SaveScores,2="mod,savescore;name,On" -SaveReplays="2;together" -SaveReplaysDefault="" -SaveReplays,1="mod,no savereplay;name,Off" -SaveReplays,2="mod,savereplay;name,On" - -#ScreenJukeboxMenu -RandomModifiers="2;together" -RandomModifiersDefault="mod,clear" -RandomModifiers,1="name,Off" -RandomModifiers,2="mod,random;name,Random" - -# ScreenOptionsEditMode -Edit Steps="1;together;SelectNone" -Edit StepsDefault="" -Edit Steps,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" -Transfer To USB Drive="1;together;SelectNone" -Transfer To USB DriveDefault="" -Transfer To USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" -Transfer From USB Drive="1;together;SelectNone" -Transfer From USB DriveDefault="" -Transfer From USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer From USB Drive" - -[ScreenOptionsSimple] -# more work on this needs to be done; bug me about it -aj -Fallback="ScreenOptionsMaster" -NavigationMode="menu" -InputMode="together" -ForceAllPlayers=true - -NumRowsShown=11 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-154+28*offsetFromCenter) end -ShowExitRow=true -SeparateExitRow=false -SeparateExitRowY=SCREEN_CENTER_Y+180 - -ExplanationTogetherX=SCREEN_CENTER_X -ExplanationTogetherY=SCREEN_CENTER_Y+174 -ExplanationTogetherOnCommand=zoom,0.75;shadowlength,0;wrapwidthpixels,600/0.75;cropright,1;linear,0.5;cropright,0 -ExplanationTogetherOffCommand= - -[ScreenOptionsSimpleService] -Fallback="ScreenOptionsSimple" - -OptionRowNormalMetricsGroup="OptionRowService" - -LineHighlightOnCommand=visible,false -LineHighlightChangeCommand= -LineHighlightChangeToExitCommand= - -CursorOnCommand=visible,false - -[ScreenOptionsService] -Class="ScreenOptionsMaster" -Fallback="ScreenOptionsSimpleService" -# -NextScreen=Branch.Init() -PrevScreen=Branch.Init() - -LineNames="SystemDirection,KeyConfig,GameType,6,8,Reload,MoreOptions" -# LineNames="SystemDirection,1,2,Sync,13,3,10,11,4,12,6,5,Theme,8,9" -Line1="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" -Line2="gamecommand;screen,ScreenTestInput;name,Test Input" -Line13="gamecommand;screen,ScreenSelectGame;name,Select Game" -Line3="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options" -Line4="gamecommand;screen,ScreenOptionsGraphicsSound;name,Graphics/Sound Options" -Line5="gamecommand;screen,ScreenOptionsAdvanced;name,Advanced Options" -Line10="gamecommand;screen,ScreenOptionsUI;name,UI Options" -Line11="gamecommand;screen,ScreenOptionsInput;name,Input Options" -Line12="gamecommand;screen,ScreenOptionsArcade;name,Arcade Options" -Line6="gamecommand;screen,ScreenNetworkOptions;name,Network Options" -Line8="gamecommand;screen,ScreenOptionsManageProfiles;name,Profiles" -Line9="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" - -LineTheme="gamecommand;screen,ScreenOptionsTheme;name,Theme Options" -LineSystemDirection="gamecommand;screen,ScreenOptionsSystemDirection;name,System Direction" -LineKeyConfig="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" -LineGameType="gamecommand;screen,ScreenSelectGame;name,Select Game" -LineSync="gamecommand;screen,ScreenGameplaySyncMachine;name,Calibrate Machine Sync" -LineReload="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" -LineMoreOptions="gamecommand;screen,ScreenOptionsExtended;name,More Options" - -[ScreenOptionsExtended] -Fallback="ScreenOptionsService" -# -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" -# -LineNames="2,Sync,3,10,11,4,12,5,Theme" - -[ScreenOptionsServiceChild] -Fallback="ScreenOptionsMaster" -LightsMode="LightsMode_MenuStartAndDirections" -NavigationMode="normal" -InputMode="together" -TimerOnCommand=visible,false -ShowStyleIcon=false -TimerSeconds=-1 -AllowOperatorMenuButton=false -ForceAllPlayers=true -PrevScreen="ScreenOptionsService" -NextScreen="ScreenOptionsService" -HelpText=Screen.String("HelpTextOptionsAndBack") - -LineHighlightOnCommand=visible,false -LineHighlightChangeCommand= -LineHighlightChangeToExitCommand= -# -ExplanationTogetherX=SCREEN_CENTER_X -ExplanationTogetherY=SCREEN_CENTER_Y+174 -ExplanationTogetherOnCommand=zoom,0.625;shadowlength,0;wrapwidthpixels,600/0.665;cropright,1;linear,0.5;cropright,0 -ExplanationTogetherOffCommand= - -[ScreenOptionsServiceExtendedChild] -Fallback="ScreenOptionsServiceChild" -[ScreenMiniMenu] -Class="ScreenMiniMenu" -Fallback="ScreenOptions" -PrevScreen= -ShowHelp=false -TimerSeconds=-1 -ShowExplanations=false -ShowExitRow=false -ContainerOnCommand= -ContainerOffCommand= -NumRowsShown=30 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local indexOffset = itemIndex-(numItems-1)/2; self:y( SCREEN_CENTER_Y + indexOffset * 20 ); end -ShowStyleIcon=false -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP+40 -HeaderOnCommand= -HeaderOffCommand= -AllowRepeatingChangeValueInput=true -CursorOnCommand=visible,false -OptionRowNormalMetricsGroup="OptionRowMiniMenu" -ColorDisabled=color("0.8,0.8,0.8,0.975") - -[OptionRowMiniMenu] -Fallback="OptionRow" -IconsP1X=SCREEN_CENTER_X-280 -IconsP2X=SCREEN_CENTER_X+280 -IconsOnCommand=x,-30 -FrameX=SCREEN_CENTER_X-232 -TitleX=SCREEN_CENTER_X-150 -TitleOnCommand=halign,0;shadowlength,2; -ItemsStartX=SCREEN_CENTER_X-150 -ItemsEndX=SCREEN_CENTER_X+280 -ItemsGapX=14 -ItemsLongRowP1X=SCREEN_CENTER_X-60 -ItemsLongRowP2X=SCREEN_CENTER_X+100 -ItemsLongRowSharedX=SCREEN_CENTER_X+150 -ItemOnCommand= -ColorSelected=color("0.5,1,0.5,1") -ColorNotSelected=color("1,1,1,1") -ColorDisabled=color("0.5,0.5,0.5,1") -TweenSeconds=0 - -[ScreenMiniMenuContext] -Fallback="ScreenMiniMenu" -NumRowsShown=10 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(24*(offsetFromCenter-(numItems-1)/2)) end -LineHighlightX=0 -ShowHelp=false -OptionRowNormalMetricsGroup="OptionRowMiniMenuContext" - -[OptionRowMiniMenuContext] -Fallback="OptionRowMiniMenu" -TitleX=-54 - -[ScreenMapControllers] -Class="ScreenMapControllers" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -# -DevicesX=SCREEN_CENTER_X -DevicesY=SCREEN_TOP+24 -DevicesOnCommand=zoom,0.75;draworder,5;strokecolor,color("0,0,0,1") -DevicesOffCommand= -# -ButtonsToMap="" -MappedToP1S1Command=x,SCREEN_CENTER_X-270 -MappedToP1S2Command=x,SCREEN_CENTER_X-195 -MappedToP1S3Command=x,SCREEN_CENTER_X-120 -MappedToP2S1Command=x,SCREEN_CENTER_X+120 -MappedToP2S2Command=x,SCREEN_CENTER_X+195 -MappedToP2S3Command=x,SCREEN_CENTER_X+270 -# -MappedToOnCommand=diffuse,color("#808080");shadowlength,0;maxwidth,150;zoom,0.75 -MappedToWaitingCommand=diffuse,color("#FF8080");pulse;effectperiod,0.5;effectmagnitude,0.8,1.3,0 -MappedToMappedInputCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") -MappedToGainFocusCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") -MappedToLoseFocusCommand=diffuse,color("#808080");stopeffect -# -LineScrollerOnCommand=%function(self) self:draworder(-1); self:y(64) self:setsecondsperitem(0.1) self:SetTransformFromHeight(24) end -LineScrollerOffCommand= -LineHideCommand=visible,false -LineOnCommand=%function(self) self:y(0); self:visible(true); local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:addx(-SCREEN_WIDTH * LeftToRight); end -LineOffCommand=%function(self) local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:stoptweening() self:accelerate(0.3); self:addx(SCREEN_WIDTH * LeftToRight); self:queuecommand('Hide') end -# -ErrorX=SCREEN_CENTER_X -ErrorY=SCREEN_CENTER_Y -ErrorOnCommand=diffuse,color("#00FF00");zoom,0.8 -LabelP1OnCommand=x,SCREEN_CENTER_X*0.4;zoom,0.7;shadowlength,1 -LabelP1OffCommand=linear,0.5;diffusealpha,0 -LabelP2OnCommand=x,SCREEN_CENTER_X*1.6;zoom,0.7;shadowlength,1 -LabelP2OffCommand=linear,0.5;diffusealpha,0 -PrimaryOnCommand=x,SCREEN_CENTER_X;y,-6;zoom,0.7;shadowlength,1;ztest,true -SecondaryOnCommand=x,SCREEN_CENTER_X;y,6;shadowlength,1;ztest,true -ShowExitRow=true - -[ScreenTestInput] -Class="ScreenTestInput" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" - -[ScreenOptionsSystemDirection] -Fallback="ScreenOptionsServiceChild" -PrevScreen="ScreenOptionsService" -NextScreen="ScreenOptionsService" -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22" -Line1="conf,Windowed" -Line2="conf,DisplayResolution" -Line3="conf,DisplayAspectRatio" -Line4="conf,HighResolutionTextures" -Line5="conf,Vsync" -Line6="conf,SoundVolume" -Line7="conf,TimingWindowScale" -Line8="conf,LifeDifficulty" -Line9="conf,AllowW1" -Line10="conf,AutogenSteps" -Line11="conf,ShowBanners" -Line12="conf,ShowCaution" -Line13="conf,ShowInstructions" -Line14="conf,ShowDanger" -Line15="conf,ShowSongOptions" -Line16="conf,EasterEggs" -Line17="conf,Theme" -Line18="conf,DefaultNoteskin" -Line19="conf,PercentageScoring" -Line20="conf,BGBrightness" -Line21="conf,Center1Player" -Line22="conf,EventMode" - -[ScreenOptionsGraphicsSound] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20" -Line1="conf,Windowed" -Line2="conf,DisplayResolution" -Line3="conf,DisplayAspectRatio" -Line4="conf,DisplayColorDepth" -Line5="conf,HighResolutionTextures" -Line6="conf,MaxTextureResolution" -Line7="conf,TextureColorDepth" -Line8="conf,MovieColorDepth" -Line9="conf,SmoothLines" -Line10="conf,CelShadeModels" -Line11="conf,DelayedTextureDelete" -Line12="conf,RefreshRate" -Line13="conf,Vsync" -Line14="conf,ShowStats" -Line15="conf,ShowBanners" -Line16="conf,AttractSoundFrequency" -Line17="conf,SoundVolume" -Line18="conf,EnableAttackSounds" -Line19="conf,EnableMineHitSound" -Line20="conf,VisualDelaySeconds" - -[ScreenOptionsAdvanced] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="2,3,4,8,11,13,14,15,16,28,29,30" -Line2="conf,ScoringType" -Line3="conf,TimingWindowScale" -Line4="conf,LifeDifficulty" -Line8="lua,GamePrefDefaultFail()" -# Line8="conf,DefaultFailType" -Line11="conf,AllowW1" -Line13="conf,HiddenSongs" -Line14="conf,EasterEggs" -Line15="conf,AllowExtraStage" -Line16="conf,UseUnlockSystem" -Line28="conf,AutogenSteps" -Line29="conf,AutogenGroupCourses" -Line30="conf,FastLoad" - -# unused options -#Line5="conf,ProgressiveLifebar" -#Line6="conf,ProgressiveStageLifebar" -#Line7="conf,ProgressiveNonstopLifebar" -#Line24="conf,AutoPlay" -#Line31="conf,OnlyPreferredDifficulties" - -[ScreenAppearanceOptions] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="1,2,3,4,5,14,15,17,18,19" -Line1="conf,Language" -Line2="conf,Announcer" -Line3="conf,Theme" -Line4="conf,DefaultNoteSkin" -Line5="conf,PercentageScoring" -Line14="conf,RandomBackgroundMode" -Line15="conf,BGBrightness" -Line17="conf,ShowDancingCharacters" -Line18="conf,ShowBeginnerHelper" -Line19="conf,NumBackgrounds" - -[ScreenOptionsUI] -# user interface options that aren't related to themes, etc. -# (some don't get used/modified too often) -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="1,3,4,6,7,9,10,11,12,14" -Line1="conf,Center1Player" -Line3="conf,DancePointsForOni" -Line4="conf,MenuTimer" -Line6="conf,MusicWheelUsesSections" -Line7="conf,ShowBanners" -Line8="conf,ShowCaution" -Line9="conf,ShowDanger" -Line10="conf,ShowInstructions" -Line11="conf,ShowLyrics" -Line12="conf,ShowNativeLanguage" -Line14="conf,ShowSongOptions" - -# unused options -#Line2="conf,CourseSortOrder" -#Line5="conf,MoveRandomToEnd" - -[ScreenOptionsInput] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="1,2,3,4,5" -Line1="conf,AutoMapOnJoyChange" -Line2="conf,OnlyDedicatedMenuButtons" -Line3="conf,DelayedBack" -Line4="conf,ArcadeOptionsNavigation" -Line5="conf,MusicWheelSwitchSpeed" - -[ScreenOptionsArcade] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -# stuff tied to arcade features -LineNames="1,2,3,4,5,6" -Line1="conf,GetRankingName" -Line2="conf,CoinMode" -Line3="conf,SongsPerPlay" -Line4="conf,CoinsPerCredit" -Line5="conf,Premium" -Line6="conf,EventMode" - -[ScreenOptionsTheme] -Fallback="ScreenOptionsServiceChild" - -[ScreenSelectGame] -Fallback="ScreenOptionsServiceChild" -PrevScreen=Branch.TitleMenu() -NextScreen=Branch.TitleMenu() -LineNames="1" -Line1="conf,Game" - -[ScreenNetworkOptions] -Class="ScreenNetworkOptions" -Fallback="ScreenOptionsServiceChild" -NextScreen=Branch.Network() -PrevScreen=Branch.Network() - -[ScreenOptionsManageProfiles] -Class="ScreenOptionsManageProfiles" -Fallback="ScreenOptionsSimpleService" -PrevScreen="ScreenOptionsService" -NextScreen="ScreenOptionsService" -PrepareScreens="ScreenMiniMenuContext" -GroupedScreens="ScreenMiniMenuContext" -PersistScreens="ScreenMiniMenuContext" - -TimerSeconds=-1 - -[ScreenOptionsEditProfile] -PageOnCommand=visible,false - -[ScreenReloadSongs] -Class="ScreenReloadSongs" -Fallback="Screen" -NextScreen=Branch.TitleMenu() - -[ScreenSelectGame] -Fallback="ScreenOptionsServiceChild" -PrevScreen="ScreenOptionsService" -NextScreen=Branch.TitleMenu() -LineNames="1" -Line1="conf,Game" - -[ScreenPlayerOptions] -Fallback="ScreenOptions" -Class="ScreenPlayerOptions" -# -PrevScreen=Branch.BackOutOfPlayerOptions() -NextScreen=Branch.SongOptions() -# -PlayMusic=false -# -TimerSeconds=30 -# -LineNames="1,2,3,4,5,6,R,7,8,9,10,11,12,13,14,15,16,17" -Line1="lua,SpeedMods()" -# Line1="list,Speed" -Line2="list,Accel" -Line3="list,Effect" -Line4="list,Appearance" -Line5="list,Turn" -Line6="list,Insert" -LineR="list,Remove" -Line7="list,Scroll" -Line8="list,NoteSkins" -Line9="list,Holds" -Line10="list,Mines" -Line11="list,Attacks" -Line12="list,PlayerAutoPlay" -Line13="list,Hide" -Line14="list,Persp" -Line15="list,ScoreDisplay" -Line16="list,Steps" -Line17="list,Characters" - -# -[ScreenPlayerOptionsRestricted] -Fallback="ScreenPlayerOptions" -NextScreen="ScreenStageInformation" -LineNames="1,8,16,17" - -# funny -[ScreenSongOptions] -Fallback="ScreenOptions" -Class="ScreenSongOptions" -# -PrevScreen="ScreenPlayerOptions" -NextScreen="ScreenStageInformation" -# -PlayMusic=false -# -TimerSeconds=30 -# -LineNames="1,2,3,4,5,6,7,8,9,10" -#,11 -Line1="list,LifeType" -Line2="list,BarDrain" -Line3="list,BatLives" -Line4="list,Fail" -Line5="list,Assist" -Line6="list,Rate" -Line7="list,SoundEffect" -Line8="list,AutoAdjust" -Line9="list,Background" -Line10="list,SaveScores" -Line11="list,SaveReplays" -StopMusicOnBack=false - -[ScreenSplash] -Class="ScreenSplash" -Fallback="ScreenWithMenuElementsBlank" -MinimumScreenPrepareDelaySeconds=0 -AllowStartToSkip=false -PrepareScreen= - -# 05 # A -[ScreenExit] -# Midiman: -# Fun fact, if you don't enable this screen, Force Crashing will hang -# StepMania, and leave it there to eat up time. -Class="ScreenExit" -Fallback="ScreenWithMenuElements" -AllowOperatorMenuButton=false - -[ScreenAttract] -Class="ScreenAttract" -Fallback="ScreenWithMenuElementsBlank" -StartScreen=Branch.TitleMenu() -CancelScreen=Branch.TitleMenu() -# -LightsMode="LightsMode_Attract" -# -PlayMusic=false -# -ResetGameState=true -BackGoesToStartScreen=true -# -AttractVolume=true -# -TimerMetricsGroup="MenuTimerNoSound" - -[ScreenRanking] -Class="ScreenRanking" -Fallback="ScreenAttract" -# -TimerSeconds=-1 -# -ResetGameState=true -StepsTypesToHide="dance-couple,dance-solo,dance-routine,pump-halfdouble,pump-couple" -PageFadeSeconds=1.0 -CoursesToShow=GetCoursesToShowRanking() -SecondsPerPage=5 -# -RankingType="Category" -# -RowSpacingX=0 -RowSpacingY=60 -ColSpacingX=0 -ColSpacingY=0 -# -StepsTypeColor1=color("1.0,1.0,1.0,1.0") -StepsTypeColor2=color("1.0,1.0,1.0,1.0") -StepsTypeColor3=color("1.0,1.0,1.0,1.0") -StepsTypeColor4=color("1.0,1.0,1.0,1.0") -StepsTypeColor5=color("1.0,1.0,1.0,1.0") -# -SongScoreSecondsPerRow=0.4 -ShowSurvivalTime=false -# -BannerOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-196;diffusealpha,1;scaletoclipped,220,58;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -BannerOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -CategoryOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -CategoryOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -CourseTitleOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;maxwidth,230;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -CourseTitleOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -StepsTypeOnCommand=x,SCREEN_CENTER_X+200;y,SCREEN_CENTER_Y-180;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -StepsTypeOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -# -BulletStartX=SCREEN_CENTER_X-220 -BulletStartY=SCREEN_CENTER_Y-100 -Bullet1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Bullet2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Bullet3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Bullet4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Bullet5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Bullet1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Bullet2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Bullet3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Bullet4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Bullet5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -NameStartX=SCREEN_CENTER_X-140 -NameStartY=SCREEN_CENTER_Y-100 -Name1OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Name2OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Name3OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Name4OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Name5OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Name1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Name2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Name3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Name4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Name5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -ScoreStartX=SCREEN_CENTER_X+200 -ScoreStartY=SCREEN_CENTER_Y-100 -Score1OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Score2OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Score3OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Score4OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Score5OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Score1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Score2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Score3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Score4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Score5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -PointsStartX=SCREEN_CENTER_X+60 -PointsStartY=SCREEN_CENTER_Y-100 -Points1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Points2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Points3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Points4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Points5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Points1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Points2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Points3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Points4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Points5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -TimeStartX=SCREEN_CENTER_X+240 -TimeStartY=SCREEN_CENTER_Y-100 -Time1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Time2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Time3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Time4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Time5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Time1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Time2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Time3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Time4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Time5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -DifficultyStartX=SCREEN_CENTER_X-154 -DifficultyY=SCREEN_CENTER_Y-209 -DifficultyBeginnerOnCommand= -DifficultyEasyOnCommand= -DifficultyMediumOnCommand= -DifficultyHardOnCommand= -DifficultyChallengeOnCommand= -DifficultyBeginnerOffCommand= -DifficultyEasyOffCommand= -DifficultyMediumOffCommand= -DifficultyHardOffCommand= -DifficultyChallengeOffCommand= -TitleOnCommand=x,-210;ztest,1;diffuse,0,0,0,1;maxwidth,160 -TitleOffCommand= -FrameOnCommand=ztest,1 -FrameOffCommand= -ScoreOffsetStartX=-154 -ScoreOffsetY=0 -ScoreOnCommand=zoom,0.7;ztest,1 -ScoreOffCommand= -# 05 # B - -# 05 # C -[ScreenGameplay] -# -Fallback="ScreenWithMenuElementsBlank" -Class="ScreenGameplayNormal" -# -NextScreen=Branch.AfterGameplay() -PrevScreen=Branch.BackOutOfStageInformation() -# -ShowLifeMeterForDisabledPlayers=false -StopCourseEarly=false -ShowEvaluationOnFail=true -ShowScoreInRave=false -# -UnpauseWithStart=true -# -InitialBackgroundBrightness=1.0 -TimerSeconds=-1 -# -SecondsBetweenComments=10.0 -ScoreKeeperClass=ScoreKeeperClass() -# -TickEarlySeconds=0 -# -LightsMode="LightsMode_Gameplay" -# -PlayerType="Player" -# useful in some obscure situations where the theme resolution has been increased. -PlayerInitCommand=y,SCREEN_CENTER_Y;zoom,(THEME:GetMetric("Common","ScreenHeight")/480) -StartGivesUp=true -BackGivesUp=false -# -FailOnMissCombo=FailCombo() -GivingUpGoesToPrevScreen=false -GivingUpGoesToNextScreen=false -# -MinSecondsToStep=6.0 -MinSecondsToMusic=2.0 -MinSecondsToStepNextSong=2.0 -MusicFadeOutSeconds=0.5 -OutTransitionLength=5 -CourseTransitionLength=0.5 -BeginFailedDelay=1.0 -# -AllowCenter1Player=true -# -PlayerP1OnePlayerOneSideX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP2OnePlayerOneSideX=math.floor(scale((2.15/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP1TwoPlayersTwoSidesX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP2TwoPlayersTwoSidesX=math.floor(scale((2.15/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP1TwoPlayersSharedSidesX=SCREEN_CENTER_X -PlayerP2TwoPlayersSharedSidesX=SCREEN_CENTER_X -# -LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+160 -LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-140 -# This is used if one player is in reverse and the other isn't. -LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-205 -LyricDisplayDefaultColor=color("0,1,0,1"); -# -OniGameOverP1X= -OniGameOverP1Y= -OniGameOverP1OnCommand= -OniGameOverP1OffCommand= -# -OniGameOverP2X= -OniGameOverP2Y= -OniGameOverP2OnCommand= -OniGameOverP2OffCommand= -# -ActiveAttackListP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ActiveAttackListP1Y= -ActiveAttackListP1OnCommand=visible,false -ActiveAttackListP1OffCommand= -ActiveAttackListP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ActiveAttackListP2Y= -ActiveAttackListP2OnCommand=visible,false -ActiveAttackListP2OffCommand= -# -CombinedLifeX=SCREEN_CENTER_X -CombinedLifeY=SCREEN_CENTER_Y -CombinedLifeOnCommand=visible,false -CombinedLifeOffCommand= -# -LifeP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -LifeP1Y=SCREEN_TOP+24 -LifeP1OnCommand= -LifeP1OffCommand= -LifeP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -LifeP2Y=SCREEN_TOP+24 -LifeP2OnCommand= -LifeP2OffCommand= -# -ScoreP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ScoreP1Y=SCREEN_BOTTOM-28 -ScoreP1OnCommand= -ScoreP1OffCommand= -ScoreP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -ScoreP2Y=SCREEN_BOTTOM-28 -ScoreP2OnCommand= -ScoreP2OffCommand= -# -SecondaryScoreP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -SecondaryScoreP1Y=SCREEN_BOTTOM-56 -SecondaryScoreP1OnCommand= -SecondaryScoreP1OffCommand= -SecondaryScoreP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -SecondaryScoreP2Y=SCREEN_BOTTOM-56 -SecondaryScoreP2OnCommand= -SecondaryScoreP2OffCommand= -# -StepsDescriptionP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -StepsDescriptionP1Y=SCREEN_CENTER_Y-24 -StepsDescriptionP1OnCommand=visible,false -StepsDescriptionP1OffCommand= -StepsDescriptionP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -StepsDescriptionP2Y=SCREEN_CENTER_Y-24 -StepsDescriptionP2OnCommand=visible,false -StepsDescriptionP2OffCommand= -# -PlayerOptionsP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -PlayerOptionsP1Y=SCREEN_CENTER_Y+24 -PlayerOptionsP1OnCommand=visible,false -PlayerOptionsP1OffCommand= -PlayerOptionsP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -PlayerOptionsP2Y=SCREEN_CENTER_Y+24 -PlayerOptionsP2OnCommand=visible,false -PlayerOptionsP2OffCommand= -# -StepsDisplayP1X=SCREEN_CENTER_X-160 -StepsDisplayP1Y=SCREEN_BOTTOM-60 -StepsDisplayP1OnCommand=visible,false -StepsDisplayP1OffCommand= -# -StepsDisplayP2X=SCREEN_CENTER_X+160 -StepsDisplayP2Y=SCREEN_BOTTOM-60 -StepsDisplayP2OnCommand=visible,false -StepsDisplayP2OffCommand= -# -SongOptionsX=SCREEN_CENTER_X -SongOptionsY=SCREEN_BOTTOM-32 -SongOptionsOnCommand=visible,false -SongOptionsOffCommand= -# -DebugX=SCREEN_CENTER_X -DebugY=SCREEN_BOTTOM-72 -DebugOnCommand=zoom,0.75 -# -SongNumberP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") - 60 -SongNumberP1Y=SCREEN_TOP+24+7 -SongNumberP1OnCommand=visible,false -SongNumberP1OffCommand= -SongNumberP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 60 -SongNumberP2Y=SCREEN_TOP+24+7 -SongNumberP2OnCommand=visible,false -SongNumberP2OffCommand= -# online scoreboard -# P1 is used when the only player is P2 -ScoreboardC1P1X=SCREEN_CENTER_X*0.25 -ScoreboardC1P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC1P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P1X=SCREEN_CENTER_X*0.5 -ScoreboardC2P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC2P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P1X=SCREEN_CENTER_X*0.75 -ScoreboardC3P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC3P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -# P2 is used when the only player is P1 -ScoreboardC1P2X=SCREEN_CENTER_X*1.25 -ScoreboardC1P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC1P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P2X=SCREEN_CENTER_X*1.5 -ScoreboardC2P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC2P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P2X=SCREEN_CENTER_X*1.75 -ScoreboardC3P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC3P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 - -[ScreenGameplayShared] -Class="ScreenGameplayShared" -Fallback="ScreenGameplay" -PlayerType="PlayerShared" - -[ScreenEvaluation] -Class="ScreenEvaluation" -Fallback="ScreenWithMenuElements" -# -LightsMode="LightsMode_MenuStartOnly" -# -Summary=false -CheckpointsWithJudgments=false -# -TimerSeconds=20 -# -PlayerOptionsSeparator="," -PlayerOptionsHideFailType=false -MaxComboNumDigits=4 -# -ShowBannerArea=true -ShowSharedJudgmentLineLabels=false -ShowJudgmentLineW1=false -ShowJudgmentLineW2=false -ShowJudgmentLineW3=false -ShowJudgmentLineW4=false -ShowJudgmentLineW5=false -ShowJudgmentLineHeld=false -ShowJudgmentLineMiss=false -ShowJudgmentLineMaxCombo=false -ShowPeakComboAward=false -ShowTimingDifficulty=false -ShowStageDisplay=false -ShowStageFrame=false -ShowGraphDisplay=false -ShowComboGraph=false -ShowStepsDisplay=false -ShowGradeArea=false -ShowPointsArea=false -ShowDetailArea=false -ShowBonusArea=false -ShowSurvivedArea=false -ShowWinArea=false -ShowScoreArea=false -ShowTimeArea=false -ShowItsARecord=false -ShowStageAward=false -# -FailedSoundTime=0 -PassedSoundTime=0 -CheerDelaySeconds=2.5 -# -BannerWidth=256 -BannerHeight=80 -# -LargeBannerX= -LargeBannerY= -LargeBannerOnCommand=visible,false -LargeBannerOffCommand= -LargeBannerFrameX= -LargeBannerFrameY= -LargeBannerFrameOnCommand=visible,false -LargeBannerFrameOffCommand= -# -PlayerOptionsP1X= -PlayerOptionsP1Y= -PlayerOptionsP1OnCommand=visible,false -PlayerOptionsP1OffCommand= -PlayerOptionsP2X= -PlayerOptionsP2Y= -PlayerOptionsP2OnCommand=visible,false -PlayerOptionsP2OffCommand= -# -SongOptionsX= -SongOptionsY= -SongOptionsOnCommand=visible,false -SongOptionsOffCommand= -# -DisqualifiedP1X= -DisqualifiedP1Y= -DisqualifiedP1OnCommand=visible,false -DisqualifiedP1OffCommand= -DisqualifiedP2X= -DisqualifiedP2Y= -DisqualifiedP2OnCommand=visible,false -DisqualifiedP2OffCommand= -# -DetailLineFormat="%3d/%3d" -# -[ScreenEvaluationNormal] -Fallback="ScreenEvaluation" -# -NextScreen="ScreenProfileSave" - -[ScreenEvaluationSummary] -Fallback="ScreenEvaluation" -# -NextScreen="ScreenSelectMusic" -# -Summary=true -# - -[ScreenNameEntry] -# !!! # -Class="ScreenNameEntry" -Fallback="ScreenWithMenuElementsBlank" -TimerX=SCREEN_CENTER_X+0 -TimerY=SCREEN_CENTER_Y-210 -CategoryY=SCREEN_CENTER_Y+190 -CategoryZoom=0.7 -CharsZoomSmall=1.0 -CharsZoomLarge=1.5 -CharsSpacingY=40 -CharsChoices=" ABCDEFGHIJKLMNOPQRSTUVWXYZ" -ScrollingCharsCommand=diffuse,0.6,0.8,0.8,1 -SelectedCharsCommand=diffuse,0.8,1,1,1 -ReceptorArrowsY=SCREEN_CENTER_Y-140 -NumCharsToDrawBehind=2 -NumCharsToDrawTotal=10 -FakeBeatsPerSec=2.5 -ForceTimer=true -TimerSeconds=24 -TimerStealth=false -ShowStyleIcon=false -MaxRankingNameLength=4 -NextScreen="ScreenProfileSave" -PlayerP1OnePlayerOneSideX=SCREEN_CENTER_X-160 -PlayerP2OnePlayerOneSideX=SCREEN_CENTER_X+160 -PlayerP1TwoPlayersTwoSidesX=SCREEN_CENTER_X-160 -PlayerP2TwoPlayersTwoSidesX=SCREEN_CENTER_X+160 -PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X - -[ScreenProfileSave] -Class="ScreenProfileSave" -Fallback="ScreenWithMenuElementsBlank" -# -NextScreen=Branch.AfterProfileSave() -PrevScreen=Branch.TitleMenu() -# -TimerSeconds=-1 -[ScreenProfileSaveSummary] -Fallback="ScreenProfileSave" -# -NextScreen="ScreenGameOver" -PrevScreen="ScreenGameOver" -[ScreenGameOver] -Class="ScreenEnding" -Fallback="ScreenAttract" -# -PrevScreen=Branch.TitleMenu() -NextScreen=Branch.TitleMenu() -StartScreen=Branch.TitleMenu() -# -TimerSeconds=10 -# -ResetGameState=true -# -RemoveCardP1X=SCREEN_WIDTH*0.1 -RemoveCardP1Y=SCREEN_CENTER_Y -RemoveCardP1OnCommand= -RemoveCardP1OffCommand= - -RemoveCardP2X=SCREEN_WIDTH*0.9 -RemoveCardP2Y=SCREEN_CENTER_Y -RemoveCardP2OnCommand= -RemoveCardP2OffCommand= - -[ScreenPrompt] -Class="ScreenPrompt" -Fallback="ScreenWithMenuElementsBlank" -PrevScreen="ScreenEdit" -TimerSeconds=-1 - -QuestionX=SCREEN_CENTER_X -QuestionY=SCREEN_CENTER_Y-60 -QuestionOnCommand=zoom,0.7;wrapwidthpixels,600 -QuestionOffCommand= -CursorOnCommand= -CursorOffCommand= -Answer1Of1X=SCREEN_CENTER_X -Answer1Of1Y=SCREEN_CENTER_Y+120 -Answer1Of1OnCommand=maxwidth,100 -Answer1Of1OffCommand= -Answer1Of2X=SCREEN_CENTER_X-50 -Answer1Of2Y=SCREEN_CENTER_Y+120 -Answer1Of2OnCommand=maxwidth,100 -Answer1Of2OffCommand= -Answer2Of2X=SCREEN_CENTER_X+50 -Answer2Of2Y=SCREEN_CENTER_Y+120 -Answer2Of2OnCommand=maxwidth,100 -Answer2Of2OffCommand= -Answer1Of3X=SCREEN_CENTER_X-170 -Answer1Of3Y=SCREEN_CENTER_Y+120 -Answer1Of3OnCommand=maxwidth,100 -Answer1Of3OffCommand= -Answer2Of3X=SCREEN_CENTER_X-20 -Answer2Of3Y=SCREEN_CENTER_Y+120 -Answer2Of3OnCommand=maxwidth,100 -Answer2Of3OffCommand= -Answer3Of3X=SCREEN_CENTER_X+150 -Answer3Of3Y=SCREEN_CENTER_Y+120 -Answer3Of3OnCommand=maxwidth,100 -Answer3Of3OffCommand= - -# -# stuff for edit mode: -# -[ScreenOptionsEdit] -Class="ScreenOptionsMaster" -Fallback="ScreenOptionsSimpleService" -; This NextScreen is only used for the "exit" choice. -NextScreen=Branch.TitleMenu() -PrevScreen=Branch.TitleMenu() -#LineNames="1,2,3,4,5,6" -LineNames="1,2,3,4" -Line1="gamecommand;screen,ScreenEditMenu;name,Edit Songs/Steps" -Line2="gamecommand;screen,ScreenPracticeMenu;name,Practice Songs/Steps" -Line3="gamecommand;screen,ScreenOptionsExportPackage;name,Export Packages" -Line4="gamecommand;screen,ScreenOptionsManageCourses;name,Edit Courses" -# Line4="gamecommand;screen,ScreenServiceActionCopyEditsMachineToMemoryCard;name,Transfer Edits to USB" -# Line5="gamecommand;screen,ScreenOptionsGraphicsSound;name,Transfer Edits from USB" -# Line6="gamecommand;screen,ScreenOptionsAdvanced;name,Clear USB edits" - -[EditMenu] -EditMode="EditMode_Full" -ShowGroups=true - -Arrows1X=SCREEN_CENTER_X-176 -Arrows2X=SCREEN_CENTER_X+270 -ArrowsEnabledCommand=diffuse,color("1,1,1,1");shadowlengthy,1;shadowcolor,color("#002740"); -ArrowsDisabledCommand=diffuse,color("0.45,0.45,0.45,1");shadowlengthy,1;shadowcolor,color("#002740"); - -GroupBannerX=SCREEN_CENTER_X+170 -GroupBannerY=SCREEN_CENTER_Y-140 -GroupBannerOnCommand=scaletoclipped,128,40 - -SongBannerX=SCREEN_CENTER_X+170 -SongBannerY=SCREEN_CENTER_Y-90 -SongBannerOnCommand=scaletoclipped,128,40 - -TextBannerType="TextBannerEditMode" -SongTextBannerX=SCREEN_CENTER_X-128 -SongTextBannerY=SCREEN_CENTER_Y-90 - -StepsDisplayX=SCREEN_CENTER_X+150 -StepsDisplayY=SCREEN_CENTER_Y-0 -StepsDisplaySourceX=SCREEN_CENTER_X+150 -StepsDisplaySourceY=SCREEN_CENTER_Y+80 - -Row1Y=SCREEN_CENTER_Y-140 -Row2Y=SCREEN_CENTER_Y-90 -Row3Y=SCREEN_CENTER_Y-40 -Row4Y=SCREEN_CENTER_Y-0 -Row5Y=SCREEN_CENTER_Y+40 -Row6Y=SCREEN_CENTER_Y+80 -Row7Y=SCREEN_CENTER_Y+120 - -Label1X=SCREEN_CENTER_X-250 -Label1Y=THEME:GetMetric("EditMenu","Row1Y") -Label1OnCommand=shadowlength,1;zoom,0.75 -Label1OffCommand= -Label2X=SCREEN_CENTER_X-250 -Label2Y=THEME:GetMetric("EditMenu","Row2Y") -Label2OnCommand=shadowlength,1;zoom,0.75 -Label2OffCommand= -Label3X=SCREEN_CENTER_X-250 -Label3Y=THEME:GetMetric("EditMenu","Row3Y") -Label3OnCommand=shadowlength,1;zoom,0.75 -Label3OffCommand= -Label4X=SCREEN_CENTER_X-250 -Label4Y=THEME:GetMetric("EditMenu","Row4Y") -Label4OnCommand=shadowlength,1;zoom,0.75 -Label4OffCommand= -Label5X=SCREEN_CENTER_X-250 -Label5Y=THEME:GetMetric("EditMenu","Row5Y") -Label5OnCommand=shadowlength,1;zoom,0.75 -Label5OffCommand= -Label6X=SCREEN_CENTER_X-250 -Label6Y=THEME:GetMetric("EditMenu","Row6Y") -Label6OnCommand=shadowlength,1;zoom,0.75 -Label6OffCommand= -Label7X=SCREEN_CENTER_X-250 -Label7Y=THEME:GetMetric("EditMenu","Row7Y") -Label7OnCommand=shadowlength,1;zoom,0.75 -Label7OffCommand= - -Value1X=SCREEN_CENTER_X-24 -Value1Y=THEME:GetMetric("EditMenu","Row1Y") -Value1OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value1OffCommand= -Value2X=SCREEN_CENTER_X+60 -Value2Y=THEME:GetMetric("EditMenu","Row2Y") -Value2OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value2OffCommand= -Value3X=SCREEN_CENTER_X+60 -Value3Y=THEME:GetMetric("EditMenu","Row3Y") -Value3OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value3OffCommand= -Value4X=SCREEN_CENTER_X -Value4Y=THEME:GetMetric("EditMenu","Row4Y") -Value4OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value4OffCommand= -Value5X=SCREEN_CENTER_X+60 -Value5Y=THEME:GetMetric("EditMenu","Row5Y") -Value5OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value5OffCommand= -Value6X=SCREEN_CENTER_X -Value6Y=THEME:GetMetric("EditMenu","Row6Y") -Value6OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value6OffCommand= -Value7X=SCREEN_CENTER_X+60 -Value7Y=THEME:GetMetric("EditMenu","Row7Y") -Value7OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 -Value7OffCommand= - -[TextBannerEditMode] -Fallback="TextBanner" - -[ScreenEditMenu] -Fallback="ScreenWithMenuElements" -Class="ScreenEditMenu" -NextScreen="ScreenEdit" -PrevScreen="ScreenOptionsEdit" -EditMenuType="EditMenu" -ExplanationX=SCREEN_CENTER_X -ExplanationY=SCREEN_BOTTOM-56 -ExplanationOnCommand=wrapwidthpixels,SCREEN_WIDTH*0.9375/0.675;shadowlength,1;zoom,0.675 -NumStepsLoadedFromProfileX=SCREEN_RIGHT-180 -NumStepsLoadedFromProfileY=SCREEN_TOP+42 -NumStepsLoadedFromProfileOnCommand=visible,false -ShowStyleIcon=false -TimerSeconds=-1 -HelpText=Screen.String("HelpTextOptionsAndBack") - -# could use a redo but whatever -[ScreenEdit] -Class="ScreenEdit" -Fallback="ScreenWithMenuElementsBlank" -PrepareScreens=GetEditModeSubScreens() -GroupedScreens=GetEditModeSubScreens() -PersistScreens=GetEditModeSubScreens() - -EditMode="EditMode_Full" -NextScreen="ScreenEditMenu" -PrevScreen="ScreenEditMenu" -ShowHelp=false -AllowOperatorMenuButton=false -ShowCreditDisplay=false -ShowStyleIcon=false -TimerSeconds=-1 -EditModifiers="no reverse" -EditHelpX=SCREEN_LEFT+4 -EditHelpY=SCREEN_TOP+16 -EditHelpOnCommand=halign,0;valign,0;zoom,0.675;shadowlength,1 -InfoX=SCREEN_RIGHT-128 -InfoY=SCREEN_TOP+16 -InfoOnCommand=halign,0;valign,0;zoom,0.5;shadowlength,1 -PlayRecordHelpX=SCREEN_LEFT+20 -PlayRecordHelpY=SCREEN_BOTTOM-20 -PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,1 - -CurrentBeatFormat="%s:\n %.5f\n" -CurrentSecondFormat="%s:\n %.5f\n" -SnapToFormat="%s:\n %s\n" -SelectionBeatBeginFormat="%s:\n %.5f" -SelectionBeatUnfinishedFormat=" ...\n" -SelectionBeatEndFormat="-%.5f\n" -DifficultyFormat="%s:\n %s\n" -RoutinePlayerFormat="%s:\n %d\n" -DescriptionFormat="%s:\n %s\n" -ChartStyleFormat="%s:\n %s\n" -MainTitleFormat="%s:\n %s\n" -SubtitleFormat="%s:\n %s\n" -TapNoteTypeFormat="%s: %s\n" -NumStepsFormat="%s: %d\n" -NumJumpsFormat="%s: %d\n" -NumHoldsFormat="%s: %d\n" -NumMinesFormat="%s: %d\n" -NumHandsFormat="%s: %d\n" -NumRollsFormat="%s: %d\n" -NumLiftsFormat="%s: %d\n" -NumFakesFormat="%s: %d\n" -Beat0OffsetFormat="%s:\n %.5f secs\n" -PreviewStartFormat="%s:\n %.5f secs\n" -PreviewLengthFormat="%s:\n %.5f secs\n" - -[ScreenPracticeMenu] -Fallback="ScreenEditMenu" -Class="ScreenEditMenu" -# -NextScreen="ScreenPractice" -PrevScreen="ScreenOptionsEdit" -EditMenuType="PracticeMenu" - -[PracticeMenu] -Fallback="EditMenu" -EditMode="EditMode_Practice" - -[ScreenPractice] -Fallback="ScreenEdit" -Class="ScreenEdit" -NextScreen="ScreenOptionsEdit" -PrevScreen="ScreenOptionsEdit" -# -EditMode="EditMode_Practice" - -[ScreenEditOptions] -Fallback="ScreenOptions" -Class="ScreenOptionsMaster" -NextScreen="none" -PrevScreen="none" -CancelTransitionsOut=true -PlayMusic=false -TimerSeconds=-1 -ShowStyleIcon=false -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" -Line1="list,Speed" -Line2="list,Accel" -Line3="list,Effect" -Line4="list,Appearance" -Line5="list,Turn" -Line6="list,Insert" -Line7="list,Scroll" -Line8="list,NoteSkins" -Line9="list,Holds" -Line10="list,Mines" -Line11="list,Hide" -Line12="list,Persp" -Line13="list,Assist" -Line14="list,Rate" -Line15="list,AutoAdjust" -Line16="conf,EditorShowBGChangesPlay" -OutCancelCommand= - -[StepsDisplayEdit] -Fallback="StepsDisplay" - -# oh, right, minimenus. -[ScreenMiniMenuEditHelp] -Fallback="ScreenMiniMenu" -ShowFooter=false -ColorDisabled=color("1,1,1,1") -RowInitCommand=halign,0.5;valign,0.5;zoom,0.8;x,75;y,45;shadowlength,1 -OptionRowNormalMetricsGroup="OptionRowMiniMenuEditHelp" - -[OptionRowMiniMenuEditHelp] -Fallback="OptionRowMiniMenu" - -TitleX=SCREEN_CENTER_X-312 -TitleOnCommand=halign,0;strokecolor,color("#222222CC");shadowlength,1;zoom,0.9 - -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - local indexOffset = itemIndex-(numItems-1)/2; \ - self:y(SCREEN_CENTER_Y + indexOffset * 20); \ -end - -ItemsStartX=SCREEN_CENTER_X+260 -ItemsEndX=SCREEN_CENTER_X+260 -ItemsLongRowP1X=SCREEN_CENTER_X+260 -ItemsLongRowP2X=SCREEN_CENTER_X+260 - -ItemOnCommand=x,SCREEN_CENTER_X+176;halign,0;strokecolor,color("#222222CC");shadowlength,1;zoom,0.9 -ColorDisabled=color("1,1,1,1") - -[ScreenMiniMenuMainMenu] -Fallback="ScreenMiniMenu" -TitleX=SCREEN_CENTER_X-80 - -[ScreenMiniMenuAreaMenu] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuStepsInformation] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuSongInformation] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuTimingDataInformation] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuBackgroundChange] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuPreferences] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuInsertTapAttack] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuInsertCourseAttack] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuCourseDisplay] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuCourseOptions] -Fallback="ScreenMiniMenu" - -# Export Packages -[ScreenOptionsExportPackage] -Class="ScreenOptionsExportPackage" -Fallback="ScreenOptionsSimpleService" -PrevScreen="ScreenOptionsEdit" -NextScreen="ScreenOptionsEdit" - -[ScreenOptionsManage] -Fallback="ScreenOptionsSimpleService" -TimerSeconds=-1 -AllowRepeatingChangeValueInput=true -OptionRowNormalMetricsGroup="OptionRowManage" - -[OptionRowManage] -Fallback="OptionRowService" -TitleX=SCREEN_CENTER_X-150 - -# Manage Courses -[OptionRowCourseOverview] -Fallback="OptionRowService" -ItemsLongRowSharedX=SCREEN_CENTER_X-100 -ColorSelected=color("1,1,1,1") -ColorNotSelected=color("0.9,0.9,0.9,1") -ColorDisabled=color("0.5,0.5,0.5,1") - -[ScreenOptionsManageCourses] -Class="ScreenOptionsManageCourses" -Fallback="ScreenOptionsManage" -PrevScreen="ScreenOptionsEdit" -NextScreen="ScreenOptionsEditCourse" -GroupedScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt,ScreenOptionsEditCourseMods" -PersistScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt" -PrepareScreens="ScreenTextEntry,ScreenPrompt" - -EditMode="EditMode_Full" -CreateNewScreen="ScreenOptionsEditCourse" - -OptionRowNormalMetricsGroup="OptionRowCourse" - -[OptionRowCourse] -Fallback="OptionRowService" -TitleX=SCREEN_CENTER_X - -[ScreenOptionsEditCourse] -Class="ScreenOptionsEditCourse" -Fallback="ScreenOptionsSimpleService" -PrevScreen="ScreenOptionsCourseOverview" -NextScreen="ScreenOptionsCourseOverview" -OptionRowNormalMetricsGroup="OptionRowEditCourse" - -[OptionRowEditCourse] -Fallback="OptionRowService" -TitleX=SCREEN_CENTER_X-200 -ItemsLongRowSharedX=SCREEN_CENTER_X - -[ScreenOptionsCourseOverview] -Class="ScreenOptionsCourseOverview" -Fallback="ScreenOptionsSimpleService" -PrevScreen="ScreenOptionsManageCourses" -NextScreen="ScreenOptionsManageCourses" -# huh -PlayScreen="" -EditScreen="ScreenOptionsEditCourse" -OptionRowNormalMetricsGroup="OptionRowCourseOverview" - -# visual/interactive syncing -[ScreenGameplaySyncMachine] -Class="ScreenGameplaySyncMachine" -Fallback="ScreenGameplay" -PrevScreen="ScreenOptionsExtended" -NextScreen="ScreenOptionsExtended" -PlayerType="PlayerSyncMachine" - -AllowCenter1Player=false -SyncInfoOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y;zoom,0;decelerate,0.5;zoom,0.6 - -# hidden by default: -LifeP1OnCommand=visible,false -LifeP2OnCommand=visible,false -ScoreP1OnCommand=visible,false -ScoreP2OnCommand=visible,false -StageOnCommand=visible,false -ScoreFrameOnCommand=visible,false -LifeFrameOnCommand=visible,false -DifficultyP1OnCommand=visible,false -DifficultyP1ReverseOnCommand=visible,false -DifficultyP2OnCommand=visible,false -DifficultyP2ReverseOnCommand=visible,false -SongOptionsOnCommand=visible,false - -[PlayerSyncMachine] -Fallback="Player" -ComboOnCommand=visible,false - -# sm-ssc helper screens -[ScreenHowToInstallSongs] -Class="ScreenSplash" -Fallback="ScreenSplash" -NextScreen=Branch.TitleMenu() -PrevScreen=Branch.TitleMenu() -ShowStyleIcon=false -TimerSeconds=-1 -ShowHelp=false - -# stuff for online mode: -[ScreenSMOnlineLogin] -Class="ScreenSMOnlineLogin" -Fallback="ScreenOptionsServiceChild" -NextScreen=Branch.AfterSMOLogin -PrevScreen=Branch.TitleMenu() -ShowStyleIcon=false -TimerSeconds=-1 -ShowHelp=false - -[ScreenNetSelectBase] -Class="ScreenNetSelectBase" -Fallback="ScreenWithMenuElements" - -ChatInputBoxX=SCREEN_CENTER_X*0.5 -ChatInputBoxY=SCREEN_CENTER_Y+112 -ChatInputBoxOnCommand=bounceend,0.5;diffusealpha,1; -ChatInputBoxOffCommand=bouncebegin,0.5;zoomy,0 -ChatInputBoxWidth=SCREEN_CENTER_X*0.9 -ChatInputBoxHeight=64 -#--# -ChatInputX=(SCREEN_CENTER_X*0.5)*0.125 -ChatInputY=SCREEN_CENTER_Y+90 -ChatTextInputWidth=SCREEN_CENTER_X*1.8 -ChatInputOnCommand=halign,0;valign,0;zoom,0.5;diffusealpha,0;linear,0.55;diffusealpha,1 -ChatInputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 -#====# -ChatOutputBoxX=SCREEN_CENTER_X*0.5 -ChatOutputBoxY=SCREEN_CENTER_Y-36 -ChatOutputBoxOnCommand=bounceend,0.5;diffusealpha,1; -ChatOutputBoxOffCommand=bouncebegin,0.5;zoomy,0 -ChatOutputBoxWidth=SCREEN_CENTER_X*0.9 -ChatOutputBoxHeight=SCREEN_CENTER_Y*0.875 -#--# -ChatOutputX=(SCREEN_CENTER_X*0.5)*0.125 -ChatOutputY=SCREEN_CENTER_Y+64 -ChatTextOutputWidth=SCREEN_CENTER_X*1.8 -ChatOutputLines=14 -ChatOutputOnCommand=halign,0;valign,1;zoom,0.5;diffusealpha,0;linear,0.55;diffusealpha,1 -ChatOutputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 - -UsersX=SCREEN_CENTER_X-265 -UsersY=SCREEN_CENTER_Y+172 -UserSpacingX=64 -UserLine2Y=16 -UsersOnCommand=draworder,2;zoom,1 -UsersOffCommand=linear,0.5;zoom,0 -Users0Command=draworder,2;diffuse,color("1.0,0.4,0.4,1.0") -Users1Command=draworder,2;diffuse,color("1.0,1.0,1.0,1.0") -Users2Command=draworder,2;diffuse,color("0.5,0.5,1.0,1.0") -Users3Command=draworder,2;diffuse,color("0.5,1.0,0.5,1.0") -Users4Command=draworder,2;diffuse,color("1.0,0.5,0.5,1.0") - -[ScreenNetSelectMusic] -Class="ScreenNetSelectMusic" -Fallback="ScreenNetSelectBase" -PrevScreen="ScreenNetRoom" -NextScreen="ScreenStageInformation" -NoSongsScreen=Branch.TitleMenu() -RoomSelectScreen="ScreenNetRoom" -Codes="CodeDetectorOnline" - -ShowStyleIcon=false -TimerSeconds= -TimerStealth=true - -SampleMusicPreviewMode='SampleMusicPreviewMode_Normal' - -MusicWheelType="OnlineMusicWheel" -MusicWheelX=SCREEN_CENTER_X+160 -MusicWheelY=SCREEN_CENTER_Y -MusicWheelOnCommand= -MusicWheelOffCommand= - -# todo: move these to Lua bganim -BPMDisplayX=SCREEN_CENTER_X-160-90+2 -BPMDisplayY=SCREEN_TOP+160+(36/2)+8 -BPMDisplayOnCommand= -BPMDisplayOffCommand= - -# todo: move these to Lua bganim -ModIconsP1X=SCREEN_CENTER_X+144 -ModIconsP1Y=SCREEN_CENTER_Y-165 -ModIconsP1OnCommand=zoomy,0;linear,0.5;zoomy,1 -ModIconsP1OffCommand=linear,0.5;zoomy,0 -ModIconsP2X=SCREEN_CENTER_X+144 -ModIconsP2Y=SCREEN_CENTER_Y-164 -ModIconsP2OnCommand=zoomy,0;linear,0.5;zoomy,1 -ModIconsP2OffCommand=linear,0.5;zoomy,0 - -# are these used? -optionsX=SCREEN_CENTER_X-240 -optionsY=SCREEN_CENTER_Y-170 -optionsOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,0.7;zoomx,0.7 -optionsOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 - -# uses StepsDisplayNet -StepsDisplayP1X=SCREEN_CENTER_X-223 -StepsDisplayP1Y=SCREEN_CENTER_Y+150 -StepsDisplayP1OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -StepsDisplayP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 - -StepsDisplayP2X=SCREEN_CENTER_X-110 -StepsDisplayP2Y=SCREEN_CENTER_Y+150 -StepsDisplayP2OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -StepsDisplayP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 - -[StepsDisplayNet] -Fallback="StepsDisplay" - -[ScreenNetRoom] -Class="ScreenNetRoom" -Fallback="ScreenNetSelectBase" -PrevScreen=Branch.TitleMenu() -# XXX -NextScreen="ScreenGameplayBranch" -MusicSelectScreen="ScreenNetSelectMusic" - -RoomWheelX=SCREEN_CENTER_X+160 -RoomWheelY=SCREEN_CENTER_Y -RoomWheelOnCommand= -RoomWheelOffCommand= - -RoomInfoDisplayX=SCREEN_CENTER_X-160 -RoomInfoDisplayY=SCREEN_CENTER_Y - -OpenRoomColor=color("1.0,1.0,1.0,1.0") -PasswdRoomColor=color("1.0,0.5,0.5,1.0") -InGameRoomColor=color("1.0,0.1,0.1,1.0") - -[RoomWheel] -Fallback="MusicWheel" -RoomWheelItemStartOnCommand= -RoomWheelItemFinishOnCommand= -CreateRoomColor=color("0.0,0.9,0.25,1.0") -ScrollBarOnCommand=visible,false - -[RoomWheelItem] -TextX=-110 -TextY=-8 -TextOnCommand=halign,0;zoom,0.6;maxwidth,200;strokecolor,color("#000000FF"); - -DescriptionX=-100 -DescriptionY=6 -DescriptionOnCommand=halign,0;zoom,0.4;maxwidth,400;strokecolor,color("#000000FF") - -[RoomInfoDisplay] -RoomInfoDisplayOnCommand=diffuse,color("1.0,1.0,1.0,1");x,SCREEN_WIDTH+130;y,250;bounceend,0.5;x,SCREEN_WIDTH-160 -RoomInfoDisplayOffCommand=x,SCREEN_WIDTH-160;y,250;bouncebegin,0.5;x,SCREEN_WIDTH+130 -DeployDelay=1.5 -RetractDelay=5 -RoomTitleOnCommand=x,-120;y,-140;zoom,0.75 -RoomDescOnCommand=x,-120;y,-129;zoom,0.75 -LastRoundOnCommand=x,-120;y,-107;zoom,0.75 -SongTitleOnCommand=x,-110;y,-96;zoom,0.75 -SongSubTitleOnCommand=x,-110;y,-85;zoom,0.75 -SongArtistOnCommand=x,-110;y,-74;zoom,0.75 -PlayersOnCommand=x,-120;y,-52;zoom,0.75 -PlayerListElementX=-110 -PlayerListElementY=-41 -PlayerListElementOffsetX=0 -PlayerListElementOffsetY=11 -PlayerListElementOnCommand=zoom,0.75 - -[ScreenSMOnlineSelectMusic] -PrevScreen="ScreenNetRoom" -Class="ScreenNetSelectMusic" -RoomSelectScreen="ScreenNetRoom" -Fallback="ScreenNetSelectMusic" - -[ModIcon] -TextX=0 -TextY=0 -TextOnCommand=maxwidth,40;uppercase,true;shadowlength,0;diffuse,color("#f6ff00") -CropTextToWidth=50 - -[ModIconSelectMusic] -Fallback="ModIcon" -TextY=-1 -TextOnCommand=maxwidth,38;uppercase,true;shadowlength,0 - -[ModIconRow] -NumModIcons=6 -ModIconOnCommand= -SpacingX=0 -SpacingY=52 -ModIconMetricsGroup="ModIcon" - -[ModIconRowSelectMusic] -Fallback="ModIconRow" -SpacingX=46 -SpacingY=0 -ModIconMetricsGroup="ModIconSelectMusic" - -[GraphDisplay] -BodyWidth=140 -BodyHeight=38 - -[ComboGraph] -BodyWidth=140 - -[ScreenNetEvaluation] -Class="ScreenNetEvaluation" -Fallback="ScreenEvaluationNormal" -NextScreen="ScreenProfileSave" - -# these three commands are deprecated: -UsersBGWidth=SCREEN_CENTER_X*0.6 -UsersBGHeight=SCREEN_HEIGHT*0.6 -UsersBGCommand=diffuse,color("0,0,0,0.25") - -UsersBGOnCommand=finishtweening;zoom,1.25 -UsersBGOffCommand=finishtweening;zoom,1 - -User1X=SCREEN_CENTER_X*0.35 -User1Y=SCREEN_CENTER_Y -User1OnCommand= -User1OffCommand= -#--# -UsersBG1X=SCREEN_CENTER_X*0.35 -UsersBG1Y=SCREEN_CENTER_Y*0.975 -UsersBG1OnCommand= -UsersBG1OffCommand= -#====# -User2X=SCREEN_CENTER_X*1.65 -User2Y=SCREEN_CENTER_Y -User2OnCommand= -User2OffCommand= -#--# -UsersBG2X=SCREEN_CENTER_X*1.65 -UsersBG2Y=SCREEN_CENTER_Y*0.975 -UsersBG2OnCommand= -UsersBG2OffCommand= - -UserDeSelCommand=finishtweening;linear,0.1;zoom,0.75 -UserSelCommand=finishtweening;linear,0.1;zoom,1.0 - -UserTier02OrBetterCommand=rainbowscroll,true - -UserDX=0 -UserDY=24 -UserOnCommand= -UserOffCommand= - -# Arcade -[ScreenLogo] -Fallback="ScreenAttract" -# -PrevScreen=Branch.Init() -NextScreen="ScreenHowToPlay" -StartScreen=Branch.TitleMenu() -# -ForceTimer=true -TimerSeconds=5 -# -TimerMetricsGroup="MenuTimerNoSound" -TimerOnCommand=visible,false - -[ScreenHowToPlay] -Class="ScreenHowToPlay" -Fallback="ScreenAttract" -# -ForceTimer=true -TimerSeconds=25 -# -PrevScreen="ScreenLogo" -NextScreen="ScreenDemonstration" -StartScreen=Branch.TitleMenu() -# -ResetGameState=false -SecondsToShow=25 -# -PlayMusic=true -# -UseLifeMeterBar=true -LifeMeterBarX=SCREEN_CENTER_X+160 -LifeMeterBarY=SCREEN_TOP+40 -LifeMeterBarOnCommand=addy,-60;sleep,2.4;linear,0.2;addy,60 -# -UseCharacter=true -CharacterName="" -CharacterX=SCREEN_CENTER_X-200 -CharacterY=SCREEN_CENTER_Y+160 -CharacterOnCommand=zoom,20;addy,-SCREEN_WIDTH;sleep,3.0;decelerate,0.4;addy,SCREEN_WIDTH -# -UsePad=true -PadX=SCREEN_CENTER_X-280 -PadY=SCREEN_CENTER_Y+70 -PadOnCommand=zoom,15;rotationy,180;sleep,2.0;linear,1.0;rotationy,360;zoom,20;addx,190;addy,80 -# -UsePlayer=true -PlayerX=SCREEN_CENTER_X+160 -PlayerY=SCREEN_CENTER_Y -PlayerOnCommand= -# -SongBPM=100 -NumW2s=4 -NumMisses=6 - -[ScreenTitleJoin] -Fallback="ScreenTitleMenu" -ChoiceNames="1" - -# ScrollerOnCommand=visible,false -# -IdleCommentSeconds=-1 -IdleTimeoutSeconds=-1 -IdleTimeoutScreen=Branch.AfterInit() -[ScreenDemonstration] -Fallback="ScreenGameplay" -Class="ScreenDemonstration" -# -NextScreen="ScreenInit" -StartScreen=Branch.TitleMenu() -PlayMusic=false -SecondsToShow=60 - -LightsMode="LightsMode_Demonstration" -DifficultiesToShow="easy,medium" -ShowCourseModifiersProbability=0 -AllowAdvancedModifiers=false -AllowStyleTypes="TwoPlayersTwoSides" - -MinSecondsToStep=0 -MinSecondsToMusic=0 - -[ScreenJukeboxMenu] -Class="ScreenOptionsMaster" -Fallback="ScreenPlayerOptions" -NextScreen="ScreenJukebox" -PrevScreen="ScreenTitleMenu" -TimerSeconds=-1 -ShowStyleIcon=false - -InputMode="together" -ForceAllPlayers=true - -LineNames="1,2,3,4" -Line1="list,Styles" -Line2="list,Groups" -Line3="list,Difficulties" -Line4="lua,OptionsRandomJukebox()" - -[ScreenJukebox] -Class="ScreenJukebox" -Fallback="ScreenGameplay" -NextScreen="ScreenJukebox" -StartScreen="ScreenTitleMenu" -LightsMode="LightsMode_Demonstration" -ShowCourseModifiersProbability=0 -AllowAdvancedModifiers=true +# This probably is hard to understand from the way it was made in the first +# place, so instead just pay attention to each group, which has tons of +# notes + +# 01 # Global +# 02 # Managers +# 03 # Singletons +# 04 # Global Screen +# 05 # Base Screens +# 06 # Derivative Screens +# 07 # Etc + +# 01 # +[Global] +# This basically means that all other themes get information from this theme. +# It's really awesome for making mods n stuff +IsBaseTheme=1 + +[Common] +# How big the design of the theme is. for example, if a theme was designed for +# 1080p, it would be shrunken for 640x480, as well as that, if it was designed +# for 480p, it would be enlarged for bigger screens! +ScreenWidth=1 +ScreenHeight=480 + +# Allows you to pick all available game modes for your gametype: for example, +# inserting enough coins for 1p would let you choose between solo, single +# and double before each game +AutoSetStyle=GetGamePrefB("AutoSetStyle") + +# Default modifiers and noteskin. +DefaultModifiers="default;1.5x;" +DefaultNoteSkinName="default" + +# Difficulties to show. Useful for custom games where you want to hide these. +DifficultiesToShow="beginner,easy,medium,hard,challenge" +# Same as above, but for courses. +CourseDifficultiesToShow="easy,medium,hard" +# Things to hide. You couldn't play cabinet anyways. +StepsTypesToHide="lights-cabinet" +#~ StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet" + +# The number of entries before "Various" is shown on the BPMDisplay, etc. +MaxCourseEntriesBeforeShowVarious=10 + +# The screen that appears when pressing the operator button. +OperatorMenuScreen="ScreenOptionsService" + +# The first screen in the attract cycle. +FirstAttractScreen="ScreenDemonstration" + +# First screen that pops up when you start the game. ScreenInit in particular +# shows the theme information before going to the title screen. +InitialScreen="ScreenInit" + +# Music selection screen used after downloading files. +SelectMusicScreen="ScreenSelectMusic" + +# Screens that show over everything else. +# Only mess with this if you know what you're doing. +OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay,ScreenConsoleOverlay,ScreenInstallOverlay" + +# Legacy metric: Percentage Scoring shows this many decimals ( 00.00% ). +PercentScoreDecimalPlaces=2 + +# 02 # +[LightsManager] +# Mostly useless since it doesn't work, as well as that barely anyone has +# lights to play around with. +GameButtonsToShow="" +LightEffectRiseSeconds=0.075 +LightEffectFallOffSeconds=0.35 +LightEffectPulseTime=0.100 + +[ProfileManager] +# I wouldn't change this either. +FixedProfiles=false +NumFixedProfiles=1 + +[SongManager] +# SSC: Determine what the ES/OMES Modifiers are +ExtraStagePlayerModifiers="default,1.5x,reverse" +ExtraStageStageModifiers="failimmediatecontinue,norecover" +OMESPlayerModifiers="default,1.5x,reverse" +OMESStageModifiers="failimmediate,suddendeath" + +# How many different colors you can have in the MusicWheel +NumSongGroupColors=10 +NumCourseGroupColors=1 +# Legacy metric: how difficult a song has to be for it to glow. +ExtraColorMeter=GetExtraColorThreshold() +# The maximum difficulty a OMES stage can be. +ExtraStage2DifficultyMax=8 +# Allow special colors for unlocks and 'preffered' sort +UseUnlockColor=false +UsePreferredSortColor=false +# Unlocks go at the end so they're easy to find. +MoveUnlocksToBottomOfPreferredSort=false +# Lots of themes want more than one group color, so let them have this. +SongGroupColor1=color("#00aeef") -- blue +SongGroupColor2=color("#00aeef") -- blue +SongGroupColor3=color("#00aeef") -- blue +SongGroupColor4=color("#00aeef") -- blue +SongGroupColor5=color("#00aeef") -- blue +SongGroupColor6=color("#00aeef") -- blue +SongGroupColor7=color("#00aeef") -- blue +SongGroupColor8=color("#00aeef") -- blue +SongGroupColor9=color("#00aeef") -- blue +SongGroupColor10=color("#00aeef") -- blue +# Lots of themes want more than one course color, too +CourseGroupColor1=color("1,1,1,1") -- white +CourseGroupColor2=color("1,1,1,1") -- white +CourseGroupColor3=color("1,1,1,1") -- white +CourseGroupColor4=color("1,1,1,1") -- white +CourseGroupColor5=color("1,1,1,1") -- white +CourseGroupColor6=color("1,1,1,1") -- white +CourseGroupColor7=color("1,1,1,1") -- white +CourseGroupColor8=color("1,1,1,1") -- white +CourseGroupColor9=color("1,1,1,1") -- white +CourseGroupColor10=color("1,1,1,1") -- white +UnlockColor=color("1,0.5,0,1") +ExtraColor=color("#ff0000") -- red + +[UnlockManager] +# Unlock specific things. we'll go in-depth with this one day, but it really +# isnt what sm-ssc was designed for. +AutoLockChallengeSteps=false +UnlockNames="" + +# 03 # +[ArrowEffects] +# Complicated stuff you probably shouldn't ever mess with or else you'll +# destroy mods completely! +FrameWidthEffectsPixelsPerSecond=400 +FrameWidthEffectsMinMultiplier=0.5 +FrameWidthEffectsMaxMultiplier=1.2 +FrameWidthLockEffectsToOverlapping=false +FrameWidthLockEffectsTweenPixels=25 +ArrowSpacing=64 +DrawHiddenNotesAfterReceptor=true +BlinkModFrequency=0.3333 +BoostModMinClamp=-400 +BoostModMaxClamp=400 +BrakeModMinClamp=-400 +BrakeModMaxClamp=400 +WaveModMagnitude=20 +WaveModHeight=38 +BoomerangPeakPercentage=0.75 +ExpandMultiplierFrequency=3 +ExpandMultiplierScaleFromLow=-1 +ExpandMultiplierScaleFromHigh=1 +ExpandMultiplierScaleToLow=0.75 +ExpandMultiplierScaleToHigh=1.75 +ExpandSpeedScaleFromLow=0 +ExpandSpeedScaleFromHigh=1 +ExpandSpeedScaleToLow=1 +# No need for the high here: that is already calculated in code. +TipsyTimerFrequency=1.2 +TipsyColumnFrequency=1.8 +TipsyArrowMagnitude=0.4 +TipsyOffsetTimerFrequency=1.2 +TipsyOffsetColumnFrequency=2 +TipsyOffsetArrowMagnitude=0.4 +TornadoPositionScaleToLow=-1 +TornadoPositionScaleToHigh=1 +TornadoOffsetFrequency=6 +TornadoOffsetScaleFromLow=-1 +TornadoOffsetScaleFromHigh=1 +DrunkColumnFrequency=0.2 +DrunkOffsetFrequency=10 +DrunkArrowMagnitude=0.5 +BeatOffsetHeight=15 +BeatPIHeight=2 +MiniPercentBase=0.5 +MiniPercentGate=1 +DizzyHoldHeads=false +QuantizeArrowYPosition=false + +[Background] +# Background stuff. again, its usually a better idea to leave this alone +# unless you truly need to change it, in which case you'd know what it does. +ShowDancingCharacters=true +UseStaticBackground=true +# +ClampOutputPercent=0.0 +# +LeftEdge=SCREEN_LEFT +RightEdge=SCREEN_RIGHT +TopEdge=SCREEN_TOP +BottomEdge=SCREEN_BOTTOM + +[Banner] +# Scroll stuff when you roll over it, DDR Extreme style. +ScrollRandom=false +ScrollRoulette=false + +[BitmapText] +# The colors in the 'roulette' text. you can have alot! +NumRainbowColors=7 +RainbowColor1=color("1.0,0.0,0.4,1") -- red +RainbowColor2=color("0.8,0.2,0.6,1") -- pink +RainbowColor3=color("0.4,0.3,0.5,1") -- purple +RainbowColor4=color("0.2,0.6,1.0,1") -- sky blue +RainbowColor5=color("0.2,0.8,0.8,1") -- sea green +RainbowColor6=color("0.2,0.8,0.4,1") -- green +RainbowColor7=color("1.0,0.8,0.2,1") -- orange + +[BPMDisplay] +# Various commands for the BPMDisplay, ranging from no bpm, a non changing bpm, +# a bpm that changes, one that is 'random' ( boss songs ) and when a song is +# an es/omes! +SetNoBpmCommand=diffusetopedge,color("#777777");diffusebottomedge,color("#666666") +SetNormalCommand=diffusetopedge,color("#fbfb57");diffusebottomedge,color("#fb9c57") +SetChangeCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") +SetRandomCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") +SetExtraCommand=diffusetopedge,color("#fb5757");diffusebottomedge,color("#9c4242") +# Determines if it shows both bpms ( 000-100 ) or cycles between the min and +# max. +Cycle=true +# Text when there is no BPM +NoBpmText="000" +# How fast it cycles, smaller is faster +RandomCycleSpeed=0.1 +# Seperator between both bpms ( 100-200 ). +Separator="-" +# ??? when it cycles. +ShowQMarksInRandomCycle=true +QuestionMarksText="???" +RandomText="!!!" +# xxx: localize me -aj +VariousText="000" +FormatString="%03.0f" + +[CodeDetector] +# Codes on the MusicWheel that change stuff! +PrevSteps1="Up,Up" +PrevSteps2="MenuUp,MenuUp" +NextSteps1="Down,Down" +NextSteps2="MenuDown,MenuDown" +NextSort1="@MenuLeft-@MenuRight-Start" +NextSort2="MenuLeft-MenuRight" +NextSort3="@Left-@Right-Start" +NextSort4="Left-Right" +ModeMenu1="Up,Down,Up,Down" +ModeMenu2="MenuUp,MenuDown,MenuUp,MenuDown" +Mirror="Up,Left,Right,Left,Right" +Left="Up,Down,Right,Left" +Right="Up,Down,Left,Right" +Shuffle="Down,Up,Down,Up" +SuperShuffle="Down,Up,Left,Right" +NextTransform="" +NextScrollSpeed="Up,Left,Down,Left,Up" +PreviousScrollSpeed="Down,Right,Up,Right,Down" +NextAccel="Left,Right,Down,Up" +NextEffect="Left,Down,Right" +NextAppearance="Left,Up,Right" +NextTurn="" +Reverse="Down,Left,Right,Left,Right" +HoldNotes="Right,Left,Down,Up" +Mines="" +Dark="" +CancelAll="Left,Right,Left,Right,Left,Right,Left,Right" +NextGroup="MenuUp,MenuRight,MenuRight" +PrevGroup="MenuUp,MenuDown,MenuUp,MenuDown" +CloseCurrentFolder="MenuUp-MenuDown" +# Codes on the title screen. +NextTheme="" +NextTheme2="" +NextAnnouncer="" +NextAnnouncer2="" +# NextTheme="Left,Left,Left,Right,Right,Right,Left,Right" +# NextTheme2="MenuLeft,MenuLeft,MenuLeft,MenuRight,MenuRight,MenuRight,MenuLeft,MenuRight" +# NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right" +# NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight" +# Various. +Hidden="" +RandomVanish="" +SaveScreenshot1="MenuLeft-MenuRight" +SaveScreenshot2="" +CancelAllPlayerOptions="Left,Right,Left,Right,Left,Right" +BackInEventMode="" +[CodeDetectorOnline] +Fallback="CodeDetector" +PrevSteps1="MenuUp,MenuUp" +PrevSteps2="" +NextSteps1="MenuDown,MenuDown" +NextSteps2="" +NextSort3="" +NextSort4="" +ModeMenu1="" +Mirror="" +Left="" +Right="" +Shuffle="" +SuperShuffle="" +NextScrollSpeed="" +PreviousScrollSpeed="" +NextAccel="" +NextEffect="" +NextAppearance="" +Reverse="" +HoldNotes="" +CancelAll="" + +[CombinedLifeMeterTug] +# We don't use it. +MeterWidth=0.0 +MeterHeight=0.0 + +[Combo] +# System Direction +ShowComboAt=HitCombo() +ShowMissesAt=MissCombo() +# Shrink and Grow the combo, DDR Style +NumberMinZoom=0.8 +NumberMaxZoom=1 +NumberMaxZoomAt=100 +# +LabelMinZoom=0.75*0.75 +LabelMaxZoom=0.75*0.75 +# Things the combo does when you bang on it, and what the text does +PulseCommand=%function(self,param) self:stoptweening(); self:zoom(1.125*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); end +PulseLabelCommand=%function(self,param) self:stoptweening(); self:zoom(param.LabelZoom); self:linear(0.05); self:zoom(param.LabelZoom); end +NumberOnCommand=y,240-216-1.5;shadowlength,1;halign,1;valign,1;skewx,-0.125; +LabelOnCommand=x,6;y,22.5;shadowlength,1;zoom,0.75;diffusebottomedge,color("0.75,0.75,0.75,1");halign,0;valign,1 + +[HoldJudgment] +# System Direction +HoldJudgmentLetGoCommand=finishtweening;visible,ShowHoldJudgments();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 +HoldJudgmentHeldCommand=finishtweening;visible,ShowHoldJudgments();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 + +[HelpDisplay] +# The help display on the menus, and what it does. +# How fast it changes between texts (seconds) +TipShowTime=4 +# How long each switch takes (seconds) +TipSwitchTime=1 +# The Command when its made +TipOnCommand=shadowlength,0;diffuseblink +[Judgment] +# New # +JudgmentOnCommand= + +# Things the judgment does when you bang on it. +JudgmentW1Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,1,1,1,0;effectcolor2,1,1,1,0.8 +JudgmentW2Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentW3Command=shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW4Command=shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW5Command=shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentMissCommand=shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 + +[Protiming] +# Protiming isn't implemented yet. +ProtimingOnCommand=y,24 +ProtimingW1Command= +ProtimingW2Command= +ProtimingW3Command= +ProtimingW4Command= +ProtimingW5Command= +ProtimingMissCommand= + +[Course] +# What.. are these anyways? +SortPreferredColor=color("1,1,1,1") -- Preferred is both for when courses are in preferred sort, or are autogen +SortLevel1Color=color("1,0,0,1") +SortLevel2Color=color("1,1,0,1") +SortLevel3Color=color("1,0.5,0,1") +SortLevel4Color=color("1,1,0,1") +SortLevel5Color=color("0,1,0,1") + +[CustomDifficulty] +# Custom system that lets you rename certain classes of difficulties to +# something else. Mostly for custom games and game emulation, PIU for example. + +# The names of which +Names="PumpHard,PumpFreestyle,PumpNightmare,PumpHalfDouble,PumpRoutine" + +# Names="DanceCoupleBeginner,DanceCoupleEasy,DanceCoupleMedium,DanceCoupleHard,DanceCoupleExpert,PumpHard" +# That get remapped to +DanceCoupleBeginnerStepsType="StepsType_Dance_Couple" +DanceCoupleBeginnerDifficulty="Difficulty_Beginner" +DanceCoupleBeginnerCourseType=nil +DanceCoupleBeginnerString="Beginner" +#--# +DanceCoupleEasyStepsType="StepsType_Dance_Couple" +DanceCoupleEasyDifficulty="Difficulty_Easy" +DanceCoupleEasyCourseType=nil +DanceCoupleEasyString="Easy" +#--# +DanceCoupleMediumStepsType="StepsType_Dance_Couple" +DanceCoupleMediumDifficulty="Difficulty_Medium" +DanceCoupleMediumCourseType=nil +DanceCoupleMediumString="Medium" +#--# +DanceCoupleHardStepsType="StepsType_Dance_Couple" +DanceCoupleHardDifficulty="Difficulty_Hard" +DanceCoupleHardCourseType=nil +DanceCoupleHardString="Hard" +#--# +DanceCoupleExpertStepsType="StepsType_Dance_Couple" +DanceCoupleExpertDifficulty="Difficulty_Expert" +DanceCoupleExpertCourseType=nil +DanceCoupleExpertString="Expert" +#===# +PumpHardStepsType="StepsType_Pump_Single" +PumpHardDifficulty="Difficulty_Hard" +PumpHardCourseType=nil +PumpHardString="Crazy" +#--# +PumpFreestyleStepsType="StepsType_Pump_Double" +PumpFreestyleDifficulty="Difficulty_Medium" +PumpFreestyleCourseType=nil +PumpFreestyleString="Freestyle" +#--# +PumpNightmareStepsType="StepsType_Pump_Double" +PumpNightmareDifficulty="Difficulty_Hard" +PumpNightmareCourseType=nil +PumpNightmareString="Nightmare" +#--# +PumpHalfDoubleStepsType="StepsType_Pump_Halfdouble" +PumpHalfDoubleDifficulty="Difficulty_Medium" +PumpHalfDoubleCourseType=nil +PumpHalfDoubleString="HalfDouble" +#--# +PumpRoutineStepsType="StepsType_Pump_Routine" +PumpRoutineDifficulty="Difficulty_Medium" +PumpRoutineCourseType=nil +PumpRoutineString="Routine" +# +# Difficulty_Beginner-StepsType_Pump_Single=Easy +# Difficulty_Easy-StepsType_Pump_Single=Normal +# Difficulty_Medium-StepsType_Pump_Single=Hard +# Difficulty_Hard-StepsType_Pump_Single=Crazy +# Difficulty_Medium-StepsType_Pump_Halfdouble=Half-Double +# Difficulty_Medium-StepsType_Pump_Double=Freestyle +# Difficulty_Hard-StepsType_Pump_Double=Nightmare +# Difficulty_Edit-StepsType_Pump_Single=Edit +# Difficulty_Edit-StepsType_Pump_Halfdouble=Edit +# Difficulty_Edit-StepsType_Pump_Double=Edit +# Course=Progressive +[CustomScoring] +# Custom scoring, usually good for custom games. + +# Various tweakers +ComboAboveThresholdAddsToScoreBonus=0 +ComboScoreBonusThreshold=50 +ComboScoreBonusValue=+1000 + +ComboMultiplier=0.0 + +DoubleNoteScoreMultiplier=2.0 +TripleNoteScoreMultiplier=3.0 +QuadOrHigherNoteScoreMultiplier=4.0 +# And what they award you +PointsW1=+50 +PointsW2=+20 +PointsW3=+10 +PointsW4=+5 +PointsW5=0 +PointsMiss=-5 +PointsHitMine=-5 +PointsCheckpointHit=+5 +PointsCheckpointMiss=-5 +PointsNone=0 +PointsHoldHeld=+5 +PointsHoldLetGo=-5 +[DifficultyList] +# A list that shows difficulties in a song. +CapitalizeDifficultyNames=false +# How far away and how many items there are +ItemsSpacingY=40 +NumShownItems=5 +# +MoveCommand=decelerate,0.3 + +[FadingBanner] +# The banner on MusicWheel. +BannerOnCommand= +# When it loads +BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 +# When it loads into clarity +BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 +# ? +BannerResetFadeCommand=diffusealpha,1 + +[Gameplay] +# System Direction +ComboIsPerRow=ComboPerRow() +MinScoreToContinueCombo=ComboContinue() +MinScoreToMaintainCombo=ComboMaintain() +MaxScoreToIncrementMissCombo='TapNoteScore_Miss' +MineHitIncrementsMissCombo=false +AvoidMineIncrementsCombo=false +# When you hit it, you know. +ToastyTriggersAt=250 + +[GameState] +# Default song and sort. these don't really matter +DefaultSong="" +DefaultSort="Group" +# How good of a grade you have to get to get an ES/OMES. Locked to an 'AA' +GradeTierForExtra1="Grade_Tier03" +GradeTierForExtra2="Grade_Tier03" +# and how difficult that song you go thas to be +MinDifficultyForExtra="Difficulty_Hard" +# System Direction +AreStagePlayerModsForced=AreStagePlayerModsForced +AreStageSongModsForced=AreStageSongModsForced +# Let players join while you play if they put in some coins +AllowLateJoin=true +# Various feats that you can earn +ProfileRecordFeats=true +CategoryRecordFeats=true +# Disallow bad names +UseNameBlacklist=false +# Alow OMES +AllowExtra2=true +# Don't let the player change difficulties on an ES/OMES +LockExtraStageSelection=true +# [sm-ssc] Normally, in event mode, the premium value is ignored. Set this +# metric to true to re-gain that behavior. +DisablePremiumInEventMode=false + +[GrooveRadar] +# Polar graph that shows difficulty stuff in depth +# how thick the line is +EdgeWidth=2 +# How visible the middle is +CenterAlpha=0.25 +# what to do with each player's part of the graph +RadarValueMapP1OnCommand=diffuse,PlayerColor(PLAYER_1) +RadarValueMapP2OnCommand=diffuse,PlayerColor(PLAYER_2) + +[GroupList] +# Legacy Class. +SpacingX=0 +SpacingY=0 +StartX=0 +StartY=0 + +[HighScore] +# Default highscore name for no entries ( like how street fighter has ' CAP ' ) +EmptyName="SSC!" + +[Inventory] +# ? +ItemUseRateSeconds=0.0 + +[LifeMeterBar] +# The default life bar you see in gameplay + +# Percentage in which the game starts yelling at you to stop sucking +DangerThreshold=0.2 +# And how much it starts up at. +InitialValue=0.5 +# And how much it takes to get ravin' +HotValue=1.0 +# And how much there is to fill up ( only for debug ) +LifeMultiplier=1.0 +# How good you gotta hit it to keep it alive. ( W3 is 'Great' ); +MinStayAlive="TapNoteScore_W3" +# Freiza Hack. Ugh +# FlashHotOnNoteHit=false +# MinScoreToFlash="TapNoteScore_W3" + +# How much it changes +LifePercentChangeW1=0.008 +LifePercentChangeW2=0.008 +LifePercentChangeW3=0.004 +LifePercentChangeW4=0.000 +LifePercentChangeW5=-0.040 +LifePercentChangeMiss=-0.080 +LifePercentChangeHitMine=-0.160 +LifePercentChangeHeld=0.008 +LifePercentChangeLetGo=-0.080 +LifePercentChangeCheckpointMiss=-0.002 +LifePercentChangeCheckpointHit=0.002 + +# And various positionings +UnderX=0 +UnderY=0 +DangerX=0 +DangerY=0 +StreamX=0 +StreamY=0 +OverX=0 +OverY=0 +[LifeMeterBattery] +# The bar that shows up in Oni mode. + +# How long it flashes when you lose a life. +BatteryBlinkTime=1.2 +# Where the batteries are +BatteryP1X=-92 +BatteryP1Y=2 +BatteryP2X=92 +BatteryP2Y=2 +# Where your live count is +NumLivesP1X=-92 +NumLivesP1Y=0 +NumLivesP2X=92 +NumLivesP2Y=0 + +[LifeMeterBattery Percent] +# The percentage on the bar. I wouldn't even bother changing this, because I +# havent and I *made* this theme :\ +Format=FormatPercentScore +PercentUseRemainder=false +ApplyScoreDisplayOptions=true +DancePointsDigits=5 +# +PercentP1X=0 +PercentP1Y=0 +PercentP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP1OffCommand= +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP2OffCommand= +# +DancePointsP1X=0 +DancePointsP1Y=0 +DancePointsP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) +DancePointsP1OffCommand= +DancePointsP2X=0 +DancePointsP2Y=0 +DancePointsP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +DancePointsP2OffCommand= + + +[LifeMeterTime] +# The Lifemeter that shows up when you're playing survival. + +# When it starts telling you to stop sucking. +DangerThreshold=0.3 +# How good it's filled up when you start +InitialValue=0.5 +MeterWidth=0.0 +MeterHeight=0.0 +# How little there is to fill? +MinLifeTime=15 + +[LyricDisplay] +LyricFrontChangedCommand=LyricCommand,"Front" +LyricBackChangedCommand=LyricCommand,"Back" + +InLength=0 +OutLength=0 + +[NotesWriterSM] +DescriptionUsesCreditField=false + +[OptionRow] +ShowModIcons=false +ShowUnderlines=true +ShowBpmInSpeedTitle=false +ModIconP1X=SCREEN_CENTER_X-280 +ModIconP2X=SCREEN_CENTER_X+280 +ModIconOnCommand=x,-30 +FrameX=SCREEN_CENTER_X-222 +FrameY=0 +FrameOnCommand= +TitleX=SCREEN_CENTER_X-222 +TitleY=0 +TitleOnCommand=shadowlength,0;uppercase,true;wrapwidthpixels,SCREEN_WIDTH*0.2;zoom,0.6 +TitleGainFocusCommand=diffuse,color("1,1,1,1");strokecolor,color("0,0,0,1") +TitleLoseFocusCommand=diffuse,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,1") +ItemsStartX=SCREEN_CENTER_X-140 +ItemsEndX=SCREEN_CENTER_X+280 +ItemsGapX=14 +ItemsMinBaseZoom=0.65 +ItemsLongRowP1X=SCREEN_CENTER_X-60 +ItemsLongRowP2X=SCREEN_CENTER_X+100 +ItemsLongRowSharedX=SCREEN_CENTER_X +ItemOnCommand=shadowlength,0;zoom,0.5 +ItemGainFocusCommand= +ItemLoseFocusCommand= +TweenSeconds=0.2 +ModIconMetricsGroup="ModIcon" +ColorSelected=color("1,1,1,1") +ColorNotSelected=color("0.9,0.9,0.9,1") +ColorDisabled=color("0.5,0.5,0.5,1") + +[OptionRowService] +Fallback="OptionRow" +# Service Titles are all that are shown. +ShowUnderlines=false +ShowCursors=false +# +TitleX=SCREEN_CENTER_X +TitleY= +TitleOnCommand=shadowlength,0;uppercase,true;maxwidth,600;zoom,0.75 +TitleGainFocusCommand=diffuse,color("1,1,1,1");strokecolor,color("0,0,0,1") +TitleLoseFocusCommand=diffuse,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,1") + +[OptionRowExit] +Fallback="OptionRow" +FrameOnCommand=visible,false +TitleOnCommand=visible,false + +[OptionsCursor] +LeftX= +LeftY= +LeftOnCommand=halign,1; +MiddleX= +MiddleY= +MiddleOnCommand= +RightX= +RightY= +RightOnCommand=halign,0; +CanGoLeftX= +CanGoLeftY= +CanGoLeftOnCommand=halign,1; +CanGoRightX= +CanGoRightY= +CanGoRightOnCommand=halign,0; + +[OptionsCursorP1] +Fallback="OptionsCursor" +LeftX=-2 +MiddleX=-2 +RightX=-2 +LeftY=-2 +MiddleY=-2 +RightY=-2 + +[OptionsCursorP2] +Fallback="OptionsCursor" +LeftX=2 +MiddleX=2 +RightX=2 +LeftY=2 +MiddleY=2 +RightY=2 + +[OptionsUnderline] +Fallback="OptionsCursor" + +[OptionsUnderlineP1] +Fallback="OptionsUnderline" +LeftX=-4 +MiddleX=-4 +RightX=-4 +LeftY=10 +MiddleY=10 +RightY=10 + +[OptionsUnderlineP2] +Fallback="OptionsUnderline" +LeftX=4 +MiddleX=4 +RightX=4 +LeftY=12 +MiddleY=12 +RightY=12 + +[MenuTimer] +WarningStart=10 +WarningBeepStart=10 +# I don't like it +# -- Midiman +# MaxStallSeconds=7.5 +MaxStallSeconds=0 +# +HurryUpTransition=5.5 +Text1OnCommand=stopeffect;stoptweening;shadowlength,0; +Text1FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.floor(fSeconds); return ""..digit end +Text2OnCommand=stopeffect;stoptweening;shadowlength,0;visible,false +Text2FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.mod(fSeconds,10); return ""..digit end +# +FrameX=0 +FrameY=0 +FrameOnCommand= +# +Warning10Command= +Warning9Command= +Warning8Command= +Warning7Command= +Warning6Command= +Warning5Command= +Warning4Command= +Warning3Command= +Warning2Command= +Warning1Command= +Warning0Command= + +[MenuTimerNoSound] +Fallback="MenuTimer" +# +WarningBeepStart=0 + +[MusicList] +SpacingX=0 +SpacingY=0 +StartY=0 +StartX=0 +# +CropWidth=0 +NumRows=0 +NumColumns=0 + +[MusicWheel] +FadeSeconds=1 +SwitchSeconds=0.10 +RandomPicksLockedSongs=true +UseSectionsWithPreferredGroup=false +OnlyShowActiveSection=false +RemindWheelPositions=false +# +RouletteSwitchSeconds=0.05 +RouletteSlowDownSwitches=5 +LockedInitialVelocity=15 + +ScrollBarHeight=300 +ScrollBarOnCommand=visible,false +# +ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*38 ); end +NumWheelItems=11 +MusicWheelSortOnCommand= +MusicWheelSortOffCommand= +MusicWheelItemSortOnCommand= +MusicWheelItemSortOffCommand= +HighlightOnCommand= +HighlightOffCommand= +HighlightSortOnCommand= +HighlightSortOffCommand= +WheelItemLockedColor=color("0,0,0,0.5") +# +NumSectionColors=1 +SectionColor1=color("1,1,1,1") +# +SongRealExtraColor=color("1,0,0,1") +SortMenuColor=color("1,1,1,1") +# +RouletteColor=color("1,0,0,1") +RandomColor=color("1,0,0,1") +PortalColor=color("1,0,0,1") + +SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Artist", "SortOrder_Genre" } +# SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Popularity", "SortOrder_Artist", "SortOrder_Genre" } +# +ShowRoulette=true +ShowRandom=false +ShowPortal=false +# +MostPlayedSongsToShow=30 +RecentSongsToShow=30 +# +UseEasyMarkerFlag=false +# +ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent" +# ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent,NormalMode,BattleMode" +ChoicePreferred="sort,Preferred" +ChoiceGroup="sort,Group" +ChoiceTitle="sort,Title" +ChoiceBpm="sort,BPM" +ChoicePopularity="sort,Popularity" +ChoiceTopGrades="sort,TopGrades" +ChoiceArtist="sort,Artist" +ChoiceGenre="sort,Genre" +ChoiceEasyMeter="sort,EasyMeter" +ChoiceMediumMeter="sort,MediumMeter" +ChoiceHardMeter="sort,HardMeter" +ChoiceChallengeMeter="sort,ChallengeMeter" +ChoiceDoubleEasyMeter="sort,DoubleEasyMeter" +ChoiceDoubleMediumMeter="sort,DoubleMediumMeter" +ChoiceDoubleHardMeter="sort,DoubleHardMeter" +ChoiceDoubleChallengeMeter="sort,DoubleChallengeMeter" +ChoiceLength="sort,Length" +ChoiceRecent="sort,Recent" +ChoiceNormalMode="playmode,regular" +ChoiceBattleMode="playmode,battle" +# +CustomWheelItemNames="" + +[CourseWheel] +Fallback="MusicWheel" +# +ModeMenuChoiceNames="AllCourses,Nonstop,Oni,Endless,Survival" +# xxx: force nonstop on all courses? sounds lame but meh +ChoiceAllCourses="sort,AllCourses;playmode,nonstop;mod,bar" +ChoiceNonstop="sort,Nonstop;playmode,nonstop;mod,bar" +ChoiceOni="sort,Oni;playmode,oni;mod,battery" +ChoiceEndless="sort,Endless;playmode,endless;mod,bar" +ChoiceSurvival="sort,Oni;playmode,oni;mod,lifetime" + +[OnlineMusicWheel] +Fallback="MusicWheel" +# roulette + online causes a sorting issue that should be hammered out first. -aj +ShowRoulette=false +ShowRandom=false +ShowPortal=false + +[MusicWheelItem] +WheelNotifyIconX=106 +WheelNotifyIconY=0 +WheelNotifyIconOnCommand=visible,false +# +SongNameX=0 +SongNameY=0 +SongNameOnCommand= +# +CourseX=0 +CourseY=0 +CourseOnCommand= +# +SectionExpandedX=0 +SectionExpandedY=0 +SectionExpandedOnCommand= +# +SectionCollapsedX=0 +SectionCollapsedY=0 +SectionCollapsedOnCommand= +SectionCountX=0 +SectionCountY=0 +SectionCountOnCommand= +# +RouletteX=0 +RouletteY=0 +RouletteOnCommand= +# +RandomX=0 +RandomY=0 +RandomOnCommand= +# +PortalX=0 +PortalY=0 +PortalOnCommand= +# +SortX=0 +SortY=0 +SortOnCommand= +# +ModeX=0 +ModeY=0 +ModeOnCommand= +# +CustomX=0 +CustomY=0 +CustomOnCommand= +# +GradeP1X=0 +GradeP1Y=0 +GradeP2X=0 +GradeP2Y=0 +GradesShowMachine=true + +[NoteField] +ShowBoard=false +ShowBeatBars=false +# +FadeBeforeTargetsPercent=0 +FadeFailTime=1.5 +# +BarMeasureAlpha=1 +Bar4thAlpha=1 +Bar8thAlpha=1 +Bar16thAlpha=1 +# +RoutineNoteSkinP1=RoutineSkinP1() +RoutineNoteSkinP2=RoutineSkinP2() +# +BPMColor=color("1,0,0,1") +StopColor=color("0.8,0.8,0,1") +DelayColor=color("0,0.8,0.8,1") +TimeSignatureColor=color("1,0.55,0,1") +TickcountColor=color("0,1,0,1") +ComboColor=color("0.55,1,0,1") +# +BPMIsLeftSide=true +StopIsLeftSide=true +DelayIsLeftSide=true +TimeSignatureIsLeftSide=true +TickcountIsLeftSide=false +ComboIsLeftSide=false +# +BPMOffsetX=60 +StopOffsetX=10 +DelayOffsetX=10 +TimeSignatureOffsetX=30 +TickcountOffsetX=10 +ComboOffsetX=30 + +[PlayerStageStats] +# Original CVS Grading +GradePercentTier01=1.000000 +GradePercentTier02=1.000000 +GradePercentTier03=0.930000 +GradePercentTier04=0.800000 +GradePercentTier05=0.650000 +GradePercentTier06=0.450000 +GradePercentTier07=-99999.000000 +GradeTier01IsAllW2s=false +GradeTier02IsAllW2s=true +GradeTier02IsFullCombo=false +NumGradeTiersUsed=7 + +[Player] +# In The Groove +# ReceptorArrowsYStandard=-125 +# ReceptorArrowsYReverse=145 +# StepMania Alpha 4 +# ~ ReceptorArrowsYStandard=-144 +# ~ ReceptorArrowsYReverse=144 +# sm-ssc uses a UserPreference for this. +ReceptorArrowsYStandard=GetTapPosition('Standard') +ReceptorArrowsYReverse=GetTapPosition('Reverse') +ReceptorNoSinkScoreCutoff=4 +JudgmentTransformCommand=%JudgmentTransformCommand +JudgmentOnCommand= +ComboTransformCommand=%ComboTransformCommand +AttackDisplayXOffsetOneSideP1=0 +AttackDisplayXOffsetOneSideP2=0 +AttackDisplayXOffsetBothSides=0 +AttackDisplayY=-70 +AttackDisplayYReverse=70 +HoldJudgmentYStandard=-90 +HoldJudgmentYReverse=90 +BrightGhostComboThreshold=100 +DrawDistanceBeforeTargetsPixels=SCREEN_HEIGHT +DrawDistanceAfterTargetsPixels=-128 +TapJudgmentsUnderField=false +HoldJudgmentsUnderField=false +ComboUnderField=ComboUnderField() +PenalizeTapScoreNone=false +JudgeHoldNotesOnSameRowTogether=false +HoldCheckpoints=(GAMESTATE:GetCurrentGame():GetName() == "pump") +CheckpointsUseTickcounts=(GAMESTATE:GetCurrentGame():GetName() == "pump") +; deprecated? +CheckpointsUseTimeSignatures=false +CheckpointsTapsSeparateJudgment=CheckpointsTapsSeparateJudgment() +CheckpointsFlashOnHold=false +ImmediateHoldLetGo=ImmediateHoldLetGo() +RequireStepOnHoldHeads=HoldHeadStep() +RequireStepOnMines=false +InitialHoldLife=InitialHoldLife() +MaxHoldLife=MaxHoldLife() +# RollBodyIncrementsCombo=RollBodyIncrementsCombo() +RollBodyIncrementsCombo=GetGamePrefB("UserPrefComboOnRolls") +ScoreMissedHoldsAndRolls=ScoreMissedHoldsAndRolls() +PercentUntilColorCombo=0.25 +ComboStoppedAt=50 +AttackRunTimeRandom=6 +AttackRunTimeMine=7 + +[PlayerOptions] +RandomSpeedChance=0.2 +RandomReverseChance=0.2 +RandomDarkChance=0.1 +RandomAccelChance=0.333 +RandomEffectChance=0.667 +RandomHiddenChance=0.05 +RandomSuddenChance=0.1 + +[PlayerShared] +Fallback="Player" +ComboXOffsetOneSideP1=-120 +ComboXOffsetOneSideP2=120 +JudgmentTransformCommand=%JudgmentTransformSharedCommand + +[Profile] +ShowCoinData=true +UnlockAuthString="" + +[RadarValues] +# +WriteComplexValues=true +WriteSimpleValues=true + +[RollingNumbers] +TextFormat="%09.0f" +ApproachSeconds=0.2 +Commify=true +LeadingZeroMultiplyColor=color("#777777FF") + +[RollingNumbersEvaluation] +Fallback="RollingNumbers" +ApproachSeconds=1 + +[RollingNumbersJudgment] +Fallback="RollingNumbers" +TextFormat="%04.0f" +ApproachSeconds=1 +Commify=false + +[ScoreDisplayNormal] +FrameX= +FrameY= +FrameOnCommand= +FrameOffCommand= +TextX= +TextY= +TextOnCommand= +TextOffCommand= + +[ScoreDisplayOni] + + +[ScoreDisplayLifeTime] +FrameX= +FrameY= +FrameOnCommand= +FrameOffCommand= +# +TextX= +TextY= +TextOnCommand= +TextOffCommand= +# +TimeRemainingX= +TimeRemainingY= +TimeRemainingOnCommand= +TimeRemainingOffCommand= +# +DeltaSecondsOnCommand= +DeltaSecondsNoneCommand= +DeltaSecondsHitMineCommand= +DeltaSecondsAvoidMineCommand= +DeltaSecondsCheckpointMissCommand= +DeltaSecondsCheckpointHitCommand= +DeltaSecondsMissCommand= +DeltaSecondsW5Command= +DeltaSecondsW4Command= +DeltaSecondsW3Command= +DeltaSecondsW2Command= +DeltaSecondsW1Command= +DeltaSecondsLetGoCommand= +DeltaSecondsHeldCommand= +DeltaSecondsGainLifeCommand= + +[ScoreDisplayPercentage Percent] +PercentP1X=0 +PercentP1Y=0 +PercentP1OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP1OffCommand= +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP2OffCommand= +DancePointsDigits=5 +PercentUseRemainder=false +ApplyScoreDisplayOptions=true +Format=FormatPercentScore +PercentDecimalPlaces=2 +PercentTotalSize=5 + +PercentP3X=0 +PercentP3Y=0 +PercentP3OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP3OffCommand= +PercentP4X=0 +PercentP4Y=0 +PercentP4OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP4OffCommand= +PercentP5X=0 +PercentP5Y=0 +PercentP5OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP5OffCommand= +PercentP6X=0 +PercentP6Y=0 +PercentP6OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP6OffCommand= +PercentP7X=0 +PercentP7Y=0 +PercentP7OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP7OffCommand= +PercentP8X=0 +PercentP8Y=0 +PercentP8OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP8OffCommand= + +[ScoreDisplayRave] +MeterP1X= +MeterP1Y= +MeterP1OnCommand= +MeterP1OffCommand= +MeterP2X= +MeterP2Y= +MeterP2OnCommand=zoomx,-1 +MeterP2OffCommand= + +LevelP1X= +LevelP1Y= +LevelP1OnCommand= +LevelP1OffCommand= +LevelP2X= +LevelP2Y= +LevelP2OnCommand= +LevelP2OffCommand= + +[ScoreKeeperRave] +AttackDurationSeconds=3.0 + +[ScreenEvaluation Percent] +PercentP1X=0 +PercentP1Y=0 +PercentP1OnCommand=horizalign,right;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 +PercentP1OffCommand= +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=horizalign,right;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 +PercentP2OffCommand= +PercentRemainderP1X=0 +PercentRemainderP1Y=0 +PercentRemainderP1OnCommand=horizalign,left;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 +PercentRemainderP1OffCommand= +PercentRemainderP2X=0 +PercentRemainderP2Y=0 +PercentRemainderP2OnCommand=horizalign,left;vertalign,bottom;glowshift;effectperiod,2;shadowlength,0 +PercentRemainderP2OffCommand= +DancePointsP1X=-26 +DancePointsP1Y=-32 +DancePointsP1OnCommand=glowshift;effectperiod,2;shadowlength,0 +DancePointsP1OffCommand=sleep,0.8;accelerate,0.3 +DancePointsP2X=-26 +DancePointsP2Y=-32 +DancePointsP2OnCommand=glowshift;effectperiod,2;shadowlength,0 +DancePointsP2OffCommand=sleep,0.8;accelerate,0.3 +DancePointsDigits=1 +PercentUseRemainder=true +ApplyScoreDisplayOptions=false +FormatPercentScore=FormatPercentScore +Format= + +[SoundEffectControl] +LockToHold=false + +[SoundEffectControl_Off] +Fallback="SoundEffectControl" +SoundProperty="" +PropertyMin=1.0 +PropertyCenter=1.0 +PropertyMax=1.0 + +[SoundEffectControl_Speed] +Fallback="SoundEffectControl" +SoundProperty="Speed" +PropertyMin=4/8 +PropertyCenter=1.0 +PropertyMax=16/8 + +[SoundEffectControl_Pitch] +Fallback="SoundEffectControl" +SoundProperty="Pitch" +PropertyMin=7/8 +PropertyCenter=1.0 +PropertyMax=9/8 +[StepsDisplayListRow] +FrameX=0 +FrameY=0 +FrameOnCommand= +FrameOffCommand= +FrameSetCommand= +# +ShowTicks=false +NumTicks=0 +MaxTicks=0 +TicksSetCommand= +# +ShowMeter=false +ZeroMeterString="0" +MeterX=0 +MeterY=0 +MeterOnCommand= +MeterOffCommand= +MeterSetCommand= +# +ShowDescription=false +DescriptionX=0 +DescriptionY=0 +DescriptionOnCommand= +DescriptionOffCommand= +DescriptionSetCommand= +# +ShowCredit=false +CreditX=0 +CreditY=0 +CreditOnCommand= +CreditOffCommand= +CreditSetCommand= +# +ShowAutogen=false +AutogenSetCommand= +# +ShowStepsType=false +StepsTypeSetCommand= + +[StreamDisplay] +; a simple bar life meter: +; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end +PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + local zoomed_width=28; \ + local zoomed_height=8; \ + local spacing_x=11.3; \ + self:zoomtoheight(zoomed_height); \ + self:x((itemIndex-(numItems/2))*spacing_x); \ + local zoomed_width=0; \ + if (itemIndex % 2) == 0 then \ + self:zoomtowidth(24); \ + self:rotationz(90); \ + else \ + self:zoomtowidth(31); \ + self:rotationz(-58); \ + end; \ +end +TextureCoordScaleX=10 +NumPills=20 +UseThreePartMethod=false +ThreePartWidth=128 +AlwaysBounceNormalBar=false + +[TextBanner] +TitleOnCommand= +SubtitleOnCommand= +ArtistOnCommand=visible,false +ArtistPrependString="/" +AfterSetCommand=%TextBannerAfterSet + +[WheelNotifyIcon] +ShowTraining=false +BlinkPlayersBest=true + +# 04 # +[Screen] +ScreenInitCommand= +ScreenOnCommand= +AllowOperatorMenuButton=true +# This metric is only for people who know what they are doing. If you set this +# to false, you are expected to know how to cancel screens in Lua. (coincidentally, +# that would be SCREENMAN:GetTopScreen():Cancel(), for people who aren't AJ ;) ) +HandleBackButton=true +RepeatRate=-1 +RepeatDelay=-1 +PrepareScreens= +PersistScreens= +GroupedScreens= +CodeNames="" +CancelCancelCommand= +LightsMode="LightsMode_MenuStartAndDirections" +ShowCreditDisplay=false + +[ScreenDebugOverlay] +Class="ScreenDebugOverlay" +Fallback="Screen" + +LineOnColor=color("1,1,1,1") +LineOffColor=color("0.6,0.6,0.6,1") +LineStartY=SCREEN_TOP+50 +LineSpacing=16 +LineButtonX=SCREEN_CENTER_X-50 +LineFunctionX=SCREEN_CENTER_X-30 + +ButtonTextOnCommand=NoStroke;zoom,0.8 +FunctionTextOnCommand=NoStroke;zoom,0.8 + +PageStartX=SCREEN_CENTER_X-100 +PageSpacingX=120 +PageTextOnCommand=NoStroke;zoom,0.75 +PageTextGainFocusCommand=diffuse,color("1,1,1,1") +PageTextLoseFocusCommand=diffuse,color("0.6,0.6,0.6,1") + +DebugMenuHeaderX=SCREEN_LEFT+80 +DebugMenuHeaderY=SCREEN_TOP+18 +DebugMenuHeaderOnCommand=diffusebottomedge,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,0.5") +DebugMenuHeaderOffCommand= + +HeaderTextX=SCREEN_LEFT+80 +HeaderTextY=SCREEN_TOP+18 +HeaderTextOnCommand=diffusebottomedge,color("0.5,0.5,0.5,1");strokecolor,color("0,0,0,0.5") +HeaderTextOffCommand= + +LineOnCommand=zoom,0.75 +# +[ScreenSystemLayer] +Class="ScreenSystemLayer" +Fallback="Screen" +# +ShowCreditDisplay=true +CreditsJoinOnly=false +# +CreditsP1X=SCREEN_LEFT+4 +CreditsP1Y=SCREEN_BOTTOM-4 +CreditsP1RefreshCreditTextMessageCommand=playcommand,"UpdateText"; +CreditsP1CoinInsertedMessageCommand=playcommand,"UpdateText"; +CreditsP1CoinInsertedMessageCommand=playcommand,"UpdateText"; +CreditsP1PlayerJoinedMessageCommand=playcommand,"UpdateText"; +CreditsP1ScreenChangedMessageCommand=playcommand,"UpdateVisible";queuecommand,"On" +CreditsP1OnCommand=horizalign,left;vertalign,bottom;zoom,0.675;shadowlength,1; +CreditsP1OffCommand= +# +CreditsP2X=SCREEN_RIGHT-4 +CreditsP2Y=SCREEN_BOTTOM-4 +CreditsP2RefreshCreditTextMessageCommand=playcommand,"UpdateText"; +CreditsP2CoinInsertedMessageCommand=playcommand,"UpdateText"; +CreditsP2PlayerJoinedMessageCommand=playcommand,"UpdateText"; +CreditsP2ScreenChangedMessageCommand=playcommand,"UpdateVisible";queuecommand,"On" +CreditsP2OnCommand=horizalign,right;vertalign,bottom;zoom,0.675;shadowlength,1; +CreditsP2OffCommand= + +[ScreenConsoleOverlay] +Class="ScreenSystemLayer" +Fallback="ScreenSystemLayer" +# +CreditsInitCommand=visible,false;zoom,0 +CreditsP1X=-9999 +CreditsP2X=-9999 +CreditsP1Y=-9999 +CreditsP2Y=-9999 + +[ScreenInstallOverlay] +Class="ScreenInstallOverlay" +Fallback="Screen" + +StatusX=SCREEN_LEFT+40 +StatusY=SCREEN_BOTTOM-32 +StatusOnCommand=align,0,1 + +[ScreenSyncOverlay] +Class="ScreenSyncOverlay" +Fallback="Screen" +StatusOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+150;shadowlength,2;strokecolor,color("#000000"); +AdjustmentsOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y; +# +[ScreenStatsOverlay] +Class="ScreenStatsOverlay" +Fallback="Screen" +StatsX=SCREEN_RIGHT-8 +StatsY=SCREEN_TOP+10 +StatsOnCommand=halign,1;valign,0;shadowlength,1;zoom,0.5 +ShowSkips=true +SkipX=SCREEN_RIGHT-100 +SkipY=SCREEN_BOTTOM-100 +SkipOnCommand=zoom,0.5 +SkipWidth=190 +SkipSpacingY=14 +# +[ScreenWithMenuElements] +Class="ScreenWithMenuElements" +Fallback="Screen" +# +TimerSeconds=-1 +# +FirstUpdateCommand= +PlayMusic=true +MusicAlignBeat=true +StopMusicOnBack=false +WaitForChildrenBeforeTweeningOut=false +CancelTransitionsOut=false +# +ShowCreditDisplay=true +AllowDisabledPlayerInput=false +MemoryCardIcons=false +# +MemoryCardDisplayP1X= +MemoryCardDisplayP1Y= +MemoryCardDisplayP1OnCommand= +MemoryCardDisplayP1OffCommand= +MemoryCardDisplayP2X= +MemoryCardDisplayP2Y= +MemoryCardDisplayP2OnCommand= +MemoryCardDisplayP2OffCommand= +# +TimerStealth=false +ForceTimer=false +TimerMetricsGroup="MenuTimer" +TimerX= +TimerY= +TimerOnCommand= +TimerOffCommand= + +[ScreenWithMenuElementsBlank] +Fallback="ScreenWithMenuElements" +UpdateOnMessage="" +ShowHelp=false + +[ScreenSelectMaster] +Class="ScreenSelectMaster" +Fallback="ScreenWithMenuElements" +# +DoSwitchAnyways=false +WrapCursor=false +AllowRepeatingInput=false +PreSwitchPageSeconds=0 +PostSwitchPageSeconds=0 +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=1024 +ScrollerTransform=function(self,offset,itemIndex,numItems) end +ScrollerSubdivisions=1 +OverrideSleepAfterTweenOffSeconds=false +SleepAfterTweenOffSeconds=0 +NumCodes=0 +OptionOrderUp= +OptionOrderDown= +OptionOrderLeft= +OptionOrderRight= +OptionOrderAuto= +# !! +OptionOrderBUp="" +OptionOrderBDown="" +OptionOrderBLeft="" +OptionOrderBRight="" +OptionOrderBAuto="" +# !! +ShowIcon=false +ShowCursor=false +ShowScroller=false +WrapScroller=false +LoopScroller=false +# +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y +PerChoiceIconElement=true +PerChoiceScrollElement=true +# All on page 1 by default. +NumChoicesOnPage1=1024 +SharedSelection=true +UseIconMetrics=false +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +DisabledColor=color("#606060") +DoublePressToSelect=false + +# Blank defaults for a few options. +IconChoice1SwitchToPage1Command= +IconChoice1SwitchToPage2Command= +IconChoice1OnCommand= +IconChoice1OffCommand= +IconChoice1OffFocusedCommand= +IconChoice1OffUnfocusedCommand= + +IconChoice2SwitchToPage1Command= +IconChoice2SwitchToPage2Command= +IconChoice2OnCommand= +IconChoice2OffCommand= +IconChoice2OffFocusedCommand= +IconChoice2OffUnfocusedCommand= + +IconChoice3SwitchToPage1Command= +IconChoice3SwitchToPage2Command= +IconChoice3OnCommand= +IconChoice3OffCommand= +IconChoice3OffFocusedCommand= +IconChoice3OffUnfocusedCommand= + +IconChoice4SwitchToPage1Command= +IconChoice4SwitchToPage2Command= +IconChoice4OnCommand= +IconChoice4OffCommand= +IconChoice4OffFocusedCommand= +IconChoice4OffUnfocusedCommand= + +ExplanationPage1X=0 +ExplanationPage1Y=0 +ExplanationPage1SwitchToPage1Command= +ExplanationPage1SwitchToPage2Command= +ExplanationPage1OnCommand=visible,false +ExplanationPage1OffCommand= +ExplanationPage2X=0 +ExplanationPage2Y=0 +ExplanationPage2SwitchToPage1Command= +ExplanationPage2SwitchToPage2Command= +ExplanationPage2OnCommand=visible,false +ExplanationPage2OffCommand= + +MorePage1X=0 +MorePage1Y=0 +MorePage1SwitchToPage1Command= +MorePage1SwitchToPage2Command= +MorePage1OnCommand=visible,false +MorePage1OffCommand= +MorePage2X=0 +MorePage2Y=0 +MorePage2SwitchToPage1Command= +MorePage2SwitchToPage2Command= +MorePage2OnCommand=visible,false +MorePage2OffCommand= +IdleCommentSeconds=0 +IdleTimeoutSeconds=0 +# xxx: apparently this isn't needed, according to Chris Danford, but it makes +# things work, so we're keeping it in until the problem is fixed. +UpdateOnMessage="PlayerJoined" +UseTwoLists=false + +[ScreenSelectMasterBlank] +Fallback="ScreenSelectMaster" + +[ScreenTextEntry] +Class="ScreenTextEntry" +Fallback="ScreenWithMenuElements" +PrevScreen= +HelpText= +TimerSeconds=-1 +ShowStyleIcon=false +RowStartX=SCREEN_LEFT+100 +RowStartY=SCREEN_CENTER_Y-30 +RowEndX=SCREEN_RIGHT-100 +RowEndY=SCREEN_BOTTOM-96 +QuestionX=SCREEN_CENTER_X +QuestionY=SCREEN_CENTER_Y-40 +QuestionOnCommand=wrapwidthpixels,600 +QuestionOffCommand= +AnswerX=SCREEN_CENTER_X +AnswerY=SCREEN_CENTER_Y+20 +AnswerOnCommand=zoom,1.5;shadowlength,0 +AnswerOffCommand= +CursorOnCommand= +CursorOffCommand= +KeysInitCommand=zoom,0.8;shadowlength,0 + +[ScreenInit] +Class="ScreenAttract" +Fallback="ScreenAttract" +# +PrevScreen="ScreenInit" +NextScreen=Branch.AfterInit() +StartScreen=Branch.TitleMenu() +# +ForceTimer=true +TimerSeconds=5 +# +PlayMusic=false +# +TimerMetricsGroup="MenuTimerNoSound" +TimerOnCommand=visible,false + +[ScreenTitleMenu] +Class="ScreenTitleMenu" +Fallback="ScreenSelectMaster" +# +PrevScreen="ScreenInit" +NextScreen="ScreenInit" +# +StopMusicOnBack=true +# +CoinModeChangeScreen=Branch.TitleMenu() +# +ScreenOnCommand=lockinput,0 +LightsMode="LightsMode_Joining" +TimerSeconds=-1 +# +SharedSelection=true +AllowDisabledPlayerInput=true +OverrideSleepAfterTweenOffSeconds=false +DoSwitchAnyways=false +# +SleepAfterTweenOffSeconds=0 +# +UpdateOnMessage="" +# +NumChoicesOnPage1=100 +ChoiceNames="1,4,5,7" +#~ ChoiceNames="1,2,3,4,5,6,7" +DefaultChoice="1" +Choice1="applydefaultoptions;text,Game Start;screen,"..Branch.StartGame() +Choice2="screen,ScreenNetworkOptions;text,Play Online" +Choice3="screen,ScreenSelectGame;text,Select Game" +Choice4="screen,ScreenOptionsService;text,Options" +Choice5="screen,ScreenOptionsEdit;text,Edit/Share" +Choice6="screen,ScreenJukeboxMenu;text,Jukebox" +Choice7="screen,ScreenExit;text,Exit" +Choice8="screen,ScreenTest;text,Sandbox" +Choice9="screen,ScreenQuickSetupOverview;text,Setup" +# Aliases for the future. +ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" +ChoiceGameStart="applydefaultoptions;screen,ScreenSelectProfile;text,Game Start" +ChoiceOnline="screen,ScreenNetworkOptions;text,Play Online" +ChoiceGameSelect="screen,ScreenSelectGame;text,Select Game" +ChoiceOptions="screen,ScreenOptionsSystemDirection;text,Options" +ChoiceEdit="screen,ScreenOptionsEdit;text,Edit/Share" +ChoiceJukebox="screen,ScreenJukeboxMenu;text,Jukebox" +ChoiceSandbox="screen,ScreenTest;text,Sandbox" +ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" +ChoiceExit="screen,ScreenExit;text,Exit" +# +AllowRepeatingInput=true +ShowCursor=false +WrapCursor=true +WrapScroller=false +LoopScroller=false +ScrollerSubdivisions=1 +ShowIcon=false +UseIconMetrics=false +ShowScroller=true +PerChoiceScrollElement=false +PerChoiceIconElement=false +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(32*(itemIndex-(numItems-1)/2)); end +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=20 +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y +ScrollerOnCommand= +ScrollerOffCommand= +IdleCommentSeconds=-1 +IdleTimeoutSeconds=-1 +IdleTimeoutScreen=Branch.AfterInit() +DoublePressToSelect=false +UseTwoLists=false +OptionOrderUp="" +OptionOrderDown="" +OptionOrderLeft="" +OptionOrderRight="" +OptionOrderAuto="" +OptionOrderBUp="" +OptionOrderBDown="" +OptionOrderBLeft="" +OptionOrderBRight="" +OptionOrderBAuto="" +# +PreSwitchPageSeconds= +PostSwitchPageSeconds= +# +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +# +LogoX=SCREEN_CENTER_X +LogoY=SCREEN_CENTER_Y-80 +LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,8,0;zoom,0;bounceend,0.35;zoom,1 +LogoOffCommand= +[ScreenQuickSetupOverview] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +# +NextScreen=Branch.QuickSetupA +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=-1 +# +DefaultChoice="Start" +ChoiceNames="Start,Back" +# +ChoiceStart="name,Start;screen,".. Branch.QuickSetupA +ChoiceBack="name,Back;screen,".. Branch.TitleMenu +# +PerChoiceScrollElement=false +PerChoiceIconElement=false +# +ShowScroller=true +WrapScroller=false +ShowIcon=true +[ScreenQuickSetupPhaseOne] +Class="ScreenSelectMaster" +Fallback="ScreenQuickSetupOverview" +# +NextScreen=Branch.QuickSetupBl +PrevScreen=Branch.QuickSetupStart +# +DefaultChoice="Set" +ChoiceNames="Set,Back" +# +ChoiceSet="name,Set;screen,".. Branch.QuickSetupB +ChoiceBack="name,Back;screen,".. Branch.QuickSetupStart +[ScreenQuickSetupPhaseTwo] +Class="ScreenSelectMaster" +Fallback="ScreenQuickSetupOverview" +# +NextScreen=Branch.QuickSetupC +PrevScreen=Branch.QuickSetupA +# +DefaultChoice="Set" +ChoiceNames="Set,Back" +# +ChoiceSet="name,Set;screen,".. Branch.QuickSetupC +ChoiceBack="name,Back;screen,".. Branch.QuickSetupA +[ScreenQuickSetupPhaseThree] +Class="ScreenSelectMaster" +Fallback="ScreenQuickSetupOverview" +# +NextScreen=Branch.QuickSetupD +PrevScreen=Branch.QuickSetupB +# +DefaultChoice="Set" +ChoiceNames="Set,Back" +# +ChoiceSet="name,Set;screen,".. Branch.QuickSetupD +ChoiceBack="name,Back;screen,".. Branch.QuickSetupB +[ScreenQuickSetupPhaseFour] +Class="ScreenSelectMaster" +Fallback="ScreenQuickSetupOverview" +# +NextScreen=Branch.QuickSetupFinished +PrevScreen=Branch.QuickSetupC +# +DefaultChoice="Set" +ChoiceNames="Set,Back" +# +ChoiceSet="name,Set;screen,".. Branch.QuickSetupFinished +ChoiceBack="name,Back;screen,".. Branch.QuickSetupC +[ScreenQuickSetupFinished] +Class="ScreenSelectMaster" +Fallback="ScreenQuickSetupOverview" +# +NextScreen=Branch.TitleMenu() +PrevScreen=Branch.QuickSetupD +# +DefaultChoice="Set" +ChoiceNames="Set,Back" +# +ChoiceSet="name,Set;screen,".. Branch.TitleMenu +ChoiceBack="name,Back;screen,".. Branch.QuickSetupD +[ScreenProfileLoad] +Class="ScreenProfileLoad" +Fallback="ScreenWithMenuElementsBlank" +# +NextScreen=Branch.AfterProfileLoad() +#~ NextScreen="ScreenSelectProfile" +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=-1 +# +LoadEdits=true + +[ScreenSelectProfile] +Fallback="ScreenWithMenuElements" +Class="ScreenSelectProfile" +# +ScreenOnCommand=lockinput,1 +# +NextScreen=Branch.AfterSelectProfile() +PrevScreen=Branch.TitleMenu() +StartScreen=Branch.AfterSelectProfile() +# +TimerSeconds=40 +# +CodeNames=SelectProfileKeys() +CodeUp="+MenuUp" +CodeUp2="+Up" +CodeDown="+MenuDown" +CodeDown2="+Down" +CodeStart="Start" +CodeBack="Back" +CodeCenter="Center" +CodeDownLeft="DownLeft" +CodeDownRight="DownRight" + +[ScreenSelectStyle] +# (formerly known as ScreenSelectPlayMode before sm-ssc v1.0 beta 3) +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +# +NextScreen=Branch.AfterSelectPlayMode() +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=40 +# +DefaultChoice="Single" +ChoiceNames=GameCompatibleModes() +# +OptionOrderAuto="1:2,2:1" +ChoiceSingle="name,Single;style,single;screen,"..Branch.AfterSelectPlayMode() +ChoiceDouble="name,Double;style,double;screen,"..Branch.AfterSelectPlayMode() +ChoiceSolo="name,Solo;style,solo;screen,"..Branch.AfterSelectPlayMode() +ChoiceVersus="name,Versus;style,versus;screen,"..Branch.AfterSelectPlayMode() +ChoiceCouple="name,Couple;style,couple;screen,"..Branch.AfterSelectPlayMode() +ChoiceHalfDouble="name,HalfDouble;style,halfdouble;screen,"..Branch.AfterSelectPlayMode() +Choice5Keys="name,5Keys;style,single5;;screen,"..Branch.AfterSelectPlayMode() +Choice7Keys="name,7Keys;style,single7;screen,"..Branch.AfterSelectPlayMode() +Choice10Keys="name,10Keys;style,double10;screen,"..Branch.AfterSelectPlayMode() +Choice14Keys="name,14Keys;style,double14;screen,"..Branch.AfterSelectPlayMode() +ChoiceKB7="name,kb7;style,single;screen,"..Branch.AfterSelectPlayMode() +# +PerChoiceScrollElement=false +PerChoiceIconElement=false +# +ShowScroller=true +WrapScroller=true +ShowIcon=false +# + +[ScreenSelectPlayMode] +# (formerly known as ScreenSelectPlayStyle before sm-ssc v1.0 beta 3) +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +# +NextScreen=Branch.GetGameInformationScreen +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=40 +# +DefaultChoice="Easy" +ChoiceNames="Normal,Rave,Extended,Oni,Endless" +# +PerChoiceScrollElement=false +PerChoiceIconElement=false +# +ShowScroller=true +WrapScroller=true +ShowIcon=false +# +ChoiceEasy="applydefaultoptions;name,Easy;playmode,regular;difficulty,easy;screen,ScreenSelectMusic;setenv,sMode,Normal" +ChoiceNormal="applydefaultoptions;name,Normal;playmode,regular;difficulty,easy;screen,ScreenSelectMusic;setenv,sMode,Normal" +ChoiceHard="applydefaultoptions;name,Hard;playmode,regular;difficulty,hard;screen,ScreenSelectMusic;setenv,sMode,Normal" +ChoiceRave="applydefaultoptions;name,Rave;playmode,rave;screen,ScreenSelectMusic;setenv,sMode,Rave" +ChoiceExtended="applydefaultoptions;name,Extended;playmode,nonstop;screen,ScreenSelectCourse;setenv,sMode,Extended" +ChoiceOni="applydefaultoptions;name,Oni;playmode,oni;screen,ScreenSelectCourse;setenv,sMode,Oni" +ChoiceEndless="applydefaultoptions;name,Endless;playmode,endless;screen,ScreenSelectCourse;setenv,sMode,Endless" + +[ScreenSelectCharacter] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +# +NextScreen=Branch.GetGameInformationScreen +PrevScreen=Branch.TitleMenu() +# +PerChoiceScrollElement=false +PerChoiceIconElement=false +# +ShowScroller=true +WrapScroller=true +ShowIcon=false +[ScreenGameInformation] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +# +#~ NextScreen="ScreenSelectMusic" +NextScreen=GAMESTATE:IsCourseMode() and "ScreenSelectCourse" or "ScreenSelectMusic" +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=15 +# +DefaultChoice="Delay" +ChoiceNames="Delay" +# +TimerSeconds=15 +# +ChoiceDelay="screen,ScreenSelectMusic" +# +ShowScroller=false +ShowIcon=false +# + +[ScreenSelectMusic] +Class="ScreenSelectMusic" +Fallback="ScreenWithMenuElements" +# +NextScreen=Branch.PlayerOptions() +PrevScreen=Branch.TitleMenu() +# +MusicWheelType="MusicWheel" +Codes="" +# +TimerSeconds=60 +DoRouletteOnMenuTimer=true +RouletteTimerSeconds=15 +# +DefaultSort=GAMESTATE:IsCourseMode() and "Group" or "AllCourses" +# +SampleMusicPreviewMode='SampleMusicPreviewMode_Normal' +SampleMusicLoops=true +SampleMusicFallbackFadeInSeconds=0 +# +UseOptionsList=false +OptionsListTimeout=0.25 +# +UsePlayerSelectMenu=false +SelectMenuScreenName="ScreenPlayerOptions" +OptionsMenuAvailable=true +SelectMenuAvailable=false +ModeMenuAvailable=true +# +ShowOptionsMessageSeconds=1.5 +# +ScreenModsCommand=setupmusicstagemods +# +PreviousSongButton="MenuLeft" +NextSongButton="MenuRight" +# +ChangeStepsWithGameButtons=false +PreviousDifficultyButton="MenuUp" +NextDifficultyButton="MenuDown" +# +ChangeGroupsWithGameButtons=false +PreviousGroupButton="MenuUp" +NextGroupButton="MenuDown" +# +TwoPartSelection=false +TwoPartConfirmsOnly=false +TwoPartTimerSeconds=15 +# +SampleMusicDelay=0.25 +SampleMusicDelayInit=0 +AlignMusicBeat=false +SelectMenuChangesDifficulty=true +WrapChangeSteps=false +# +MusicWheelX=SCREEN_CENTER_X+160 +MusicWheelY=SCREEN_CENTER_Y +MusicWheelOnCommand= +MusicWheelOffCommand= +# +BannerX=SCREEN_CENTER_X-160 +BannerY=SCREEN_TOP+160-36 +BannerOnCommand=scaletoclipped,256,80 +BannerOffCommand= +# +CDTitleX=SCREEN_CENTER_X-160+90 +CDTitleY=SCREEN_TOP+160+(36/2)+8 +CDTitleFrontCommand= +CDTitleBackCommand= +CDTitleOnCommand=visible,false +CDTitleOffCommand= +# +ScoreFrameP1X= +ScoreFrameP1Y= +ScoreFrameP1OnCommand=visible,false +ScoreFrameP1OffCommand= +ScoreP1X= +ScoreP1Y= +ScoreP1OnCommand=visible,false +ScoreP1OffCommand= +# +ScoreP2X= +ScoreP2Y= +ScoreP2OnCommand=visible,false +ScoreP2OffCommand= +ScoreFrameP2X= +ScoreFrameP2Y= +ScoreFrameP2OnCommand=visible,false +ScoreFrameP2OffCommand= +# +ScoreP1SortChangeCommand=stoptweening; +ScoreP2SortChangeCommand=stoptweening; +ScoreFrameP1SortChangeCommand=stoptweening; +ScoreFrameP2SortChangeCommand=stoptweening; + +[ScreenSelectCourse] +Class="ScreenSelectMusic" +Fallback="ScreenSelectMusic" +# +DefaultSort="Nonstop" +ScreenModsCommand=setupcoursestagemods +# +MusicWheelType="CourseWheel" +Codes="CourseCodeDetector" +[CourseCodeDetector] +Fallback="CodeDetector" +NextSort1= +NextSort2= +NextSort3= +NextSort4= + + +[StepsDisplay] +FrameX=0 +FrameY=0 +FrameOnCommand= +FrameLoadCommand=%function(self,param) local bFlip = param.PlayerState and param.PlayerState:GetPlayerNumber() ~= PLAYER_1; self:zoomx(bFlip and -1 or 1); end +FrameSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) end end +NumTicks=10 +MaxTicks=14 +TicksX=0 +TicksY=0 +TicksOnCommand=shadowlength,0; +TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end +ShowTicks=false +ShowMeter=true +ZeroMeterString="?" +MeterX=30 +MeterY=0 +MeterOnCommand=shadowlength,0 +MeterSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowDescription=true +DescriptionX=-10 +DescriptionY=0 +DescriptionOnCommand=shadowlength,0;uppercase,true; +DescriptionSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowCredit=false +CreditX=0 +CreditY=0 +CreditOnCommand= +CreditSetCommand= +ShowAutogen=true +AutogenX=40 +AutogenY=0 +AutogenOnCommand= +AutogenSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowStepsType=false +StepsTypeX=0 +StepsTypeY=0 +StepsTypeOnCommand= +# + +[StepsDisplayGameplay] +Fallback="StepsDisplay" + +[ScreenStageInformation] +Class="ScreenSplash" +Fallback="ScreenSplash" +# +NextScreen=Branch.GameplayScreen() +PrevScreen=Branch.BackOutOfStageInformation() +PrepareScreen="ScreenGameplay" +# +ForceTimer=true +TimerMetricsGroup="MenuTimerNoSound" +TimerSeconds=5 +# + +[ScreenOptions] +Fallback="ScreenWithMenuElements" +NavigationMode="normal" +InputMode="individual" +ForceAllPlayers=false +RepeatRate=12 +RepeatDelay=0.25 +NumRowsShown=8 +RowInitCommand= +RowOnCommand= +RowOffCommand= +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-146+36*offsetFromCenter) end +ExplanationP1X=SCREEN_CENTER_X-240 +ExplanationP1Y=SCREEN_CENTER_Y+174 +ExplanationP1OnCommand=shadowlength,0;wrapwidthpixels,(SCREEN_WIDTH*0.78)*1.5;zoom,0.5;halign,0;cropright,1;linear,0.5;cropright,0 +ExplanationP1OffCommand= +ExplanationP2X=SCREEN_CENTER_X+240 +ExplanationP2Y=SCREEN_CENTER_Y+174 +ExplanationP2OnCommand=shadowlength,0;wrapwidthpixels,(SCREEN_WIDTH*0.78)*1.5;zoom,0.5;halign,1;cropright,1;linear,0.5;cropright,0 +ExplanationP2OffCommand= +ExplanationTogetherX=SCREEN_CENTER_X +ExplanationTogetherY=SCREEN_CENTER_Y+184 +ExplanationTogetherOnCommand=shadowlength,0;zoom,0.75;wrapwidthpixels,(SCREEN_WIDTH*0.9375)*1.25;cropright,1;linear,0.5;cropright,0 +ExplanationTogetherOffCommand= +DisqualifyP1X= +DisqualifyP1Y= +DisqualifyP1OnCommand=visible,false +DisqualifyP1OffCommand= +DisqualifyP2X= +DisqualifyP2Y= +DisqualifyP2OnCommand=visible,false +DisqualifyP2OffCommand= +PageX=SCREEN_CENTER_X +PageY=SCREEN_CENTER_Y +PageOnCommand= +ContainerOnCommand= +ContainerOffCommand= +CursorOnCommand= +LineHighlightOnCommand= +LineHighlightChangeCommand= +LineHighlightChangeToExitCommand= +ShowScrollBar=false +ScrollBarHeight=0 +ScrollBarTime=0 +LineHighlightX=SCREEN_CENTER_X +ShowExitRow=true +SeparateExitRow=true +SeparateExitRowY=SCREEN_CENTER_Y+140 +MoreX= +MoreY= +MoreOnCommand=visible,false +MoreExitSelectedP1Command= +MoreExitSelectedP2Command= +MoreExitUnselectedP1Command= +MoreExitUnselectedP2Command= +ShowExplanations=true +AllowRepeatingChangeValueInput=false +CursorTweenSeconds=0.3 +WrapValueInRow=true +OptionRowNormalMetricsGroup="OptionRow" +OptionRowExitMetricsGroup="OptionRowExit" + +[ScreenOptionsMaster] +Fallback="ScreenOptions" +Class="ScreenOptionsMaster" +NoteSkinSortOrder="" + +# ExitItem is an exit row with the "Exit" text as a menu item; ExitTitle +# uses the menu title. +ExitItem="1;together;SelectNone;showoneinrow" +ExitItemDefault="" +ExitItem,1="screen," .. Screen.Metric("NextScreen") .. ";name,ExitItem" +ExitTitle="1;together;SelectNone;showoneinrow" +ExitTitleDefault="" +ExitTitle,1="screen," .. Screen.Metric("NextScreen") .. ";name,ExitTitle" + +# Player options +Speed="12;" +SpeedDefault="mod,1x,no randomspeed" +Speed,1="mod,0.25x;name,x0.25" +Speed,2="mod,0.50x;name,x0.50" +Speed,3="mod,0.75x;name,x0.75" +Speed,4="mod,1x;name,x1" +Speed,5="mod,1.5x;name,x1.5" +Speed,6="mod,2x;name,x1.75" +Speed,7="mod,3x;name,x2" +Speed,8="mod,4x;name,x2.25" +Speed,9="mod,8x;name,x2.5" +Speed,10="mod,C150;name,C150" +Speed,11="mod,C300;name,C300" +Speed,12="mod,1x,200% randomspeed;name,Random" + +Accel="5;selectmultiple" +AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" +Accel,1="mod,boost;name,Boost" +Accel,2="mod,brake;name,Brake" +Accel,3="mod,wave;name,Wave" +Accel,4="mod,expand;name,Expand" +Accel,5="mod,boomerang;name,Boomerang" + +# Accel="6" +# AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" +# Accel,1="name,Off" +# Accel,2="mod,boost;name,Boost" +# Accel,3="mod,brake;name,Brake" +# Accel,4="mod,wave;name,Wave" +# Accel,5="mod,expand;name,Expand" +# Accel,6="mod,boomerang;name,Boomerang" + +Effect="14;selectmultiple" +EffectDefault="mod,no drunk,no dizzy,,no twirl,no roll,no confusion,no mini,no tiny,no flip,no invert,no tornado,no tipsy,no bumpy,no beat,no xmode" +Effect,1="mod,drunk;name,Drunk" +Effect,2="mod,dizzy;name,Dizzy" +Effect,3="mod,twirl;name,Twirl" +Effect,4="mod,roll;name,Roll" +Effect,5="mod,confusion;name,Confusion" +Effect,6="mod,tiny;name,Tiny" +Effect,7="mod,-100% mini;name,Big" +Effect,8="mod,flip;name,Flip" +Effect,9="mod,invert;name,Invert" +Effect,10="mod,tornado;name,Tornado" +Effect,11="mod,tipsy;name,Tipsy" +Effect,12="mod,bumpy;name,Bumpy" +Effect,13="mod,beat;name,Beat" +Effect,14="mod,45% xmode;name,XMode" + +EffectsReceptor="selectmultiple" +EffectsReceptorDefault="" +EffectsReceptor,1="mod,confusion;name,Confusion" +EffectsReceptor,2="mod,invert;name,Invert" +EffectsReceptor,3="mod,Flip;name,Flip" +EffectsReceptor,4="mod,mini;name,Mini" +EffectsReceptor,5="mod,-100% mini;name,Big" +EffectsReceptor,6="mod,45% xmode;name,XMode" + +EffectsArrow="selectmultiple" +EffectsArrowDefault="" +EffectsArrow,1="mod,drunk;name,Drunk" +EffectsArrow,2="mod,dizzy;name,Dizzy" +EffectsArrow,3="mod,twirl;name,Twirl" +EffectsArrow,4="mod,roll;name,Roll" +EffectsArrow,5="mod,beat;name,Beat" +EffectsArrow,6="mod,tispy;name,Tipsy" +EffectsArrow,7="mod,50% tornado;name,Tornado" +EffectsArrow,8="mod,drunk;name,Bumpy" + +# Effect="9" +# EffectDefault="mod,no drunk,no dizzy,no confusion,no mini,no flip,no tornado,no tipsy" +# Effect,1="name,Off" +# Effect,2="mod,drunk;name,Drunk" +# Effect,3="mod,dizzy;name,Dizzy" +# Effect,4="mod,confusion;name,Confusion" +# Effect,5="mod,mini;name,Mini" +# Effect,6="mod,-100% mini;name,Big" +# Effect,7="mod,flip;name,Flip" +# Effect,8="mod,tornado;name,Tornado" +# Effect,9="mod,tipsy;name,Tipsy" + +# XXX: what of hiddenoffset and suddenoffset? +Appearance="4;selectmultiple" +AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" +Appearance,1="mod,hidden;name,Hidden" +Appearance,2="mod,sudden;name,Sudden" +Appearance,3="mod,stealth;name,Stealth" +Appearance,4="mod,blink;name,Blink" +# Random Vanish causes crashes [going into sm-ssc v1.0 beta 4] -aj +#Appearance,5="mod,randomvanish;name,R.Vanish" + +# Appearance="6" +# AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" +# Appearance,1="name,Visible" +# Appearance,2="mod,hidden;name,Hidden" +# Appearance,3="mod,sudden;name,Sudden" +# Appearance,4="mod,stealth;name,Stealth" +# Appearance,5="mod,blink;name,Blink" +# Appearance,6="mod,randomvanish;name,R.Vanish" + +Turn="6;selectmultiple" +TurnDefault="mod,no turn" +Turn,1="mod,mirror;name,Mirror" +Turn,2="mod,left;name,Left" +Turn,3="mod,right;name,Right" +Turn,4="mod,shuffle;name,Shuffle" +Turn,5="mod,supershuffle;name,SuperShuffle" +Turn,6="mod,softshuffle;name,SoftShuffle" + +# Turn="6" +# TurnDefault="mod,no turn" +# Turn,1="name,Off" +# Turn,2="mod,mirror;name,Mirror" +# Turn,3="mod,left;name,Left" +# Turn,4="mod,right;name,Right" +# Turn,5="mod,shuffle;name,Shuffle" +# Turn,6="mod,supershuffle;name,SuperShuffle" + +Insert="7;selectmultiple" +InsertDefault="mod,no wide,no big,no quick,no skippy,no echo,no stomp" +Insert,1="mod,wide;name,Wide" +Insert,2="mod,big;name,Big" +Insert,3="mod,quick;name,Quick" +Insert,4="mod,bmrize;name,BMRize" +Insert,5="mod,skippy;name,Skippy" +Insert,6="mod,echo;name,Echo" +Insert,7="mod,stomp;name,Stomp" + +Remove="8;selectmultiple" +RemoveDefault="mod,no little,no nojumps,no nohands,no noquads,no nostretch,no norolls,no nolifts,no nofakes" +Remove,1="mod,little;name,Little" +Remove,2="mod,nojumps;name,NoJumps" +Remove,3="mod,nohands;name,NoHands" +Remove,4="mod,noquads;name,NoQuads" +Remove,5="mod,nostretch;name,NoStretch" +Remove,6="mod,norolls;name,NoRolls" +Remove,7="mod,nolifts;name,NoLifts" +Remove,8="mod,nofakes;name,NoFakes" + +# Insert="8" +# InsertDefault="mod,no little,no wide,no big,no quick,no skippy,no echo,no stomp" +# Insert,1="name,Off" +# Insert,2="mod,little;name,Little" +# Insert,3="mod,wide;name,Wide" +# Insert,4="mod,big;name,Big" +# Insert,5="mod,quick;name,Quick" +# Insert,6="mod,skippy;name,Skippy" +# Insert,7="mod,echo;name,Echo" +# Insert,8="mod,stomp;name,Stomp" + +Scroll="5;selectmultiple" +ScrollDefault="mod,no reverse,no split,no alternate,no cross,no centered" +Scroll,1="mod,reverse;name,Reverse" +Scroll,2="mod,split;name,Split" +Scroll,3="mod,alternate;name,Alternate" +Scroll,4="mod,cross;name,Cross" +Scroll,5="mod,centered;name,Centered" + +# Scroll="5" +# ScrollDefault="mod,no reverse,no split,no alternate,no cross" +# Scroll,1="name,Standard" +# Scroll,2="mod,reverse;name,Reverse" +# Scroll,3="mod,split;name,Split" +# Scroll,4="mod,alternate;name,Alternate" +# Scroll,5="mod,cross;name,Cross" + +Holds="4;selectmultiple" +HoldsDefault="mod,no noholds,no planted,no twister,no holdstorolls" +Holds,1="mod,noholds;name,NoHolds" +Holds,2="mod,planted;name,Planted" +Holds,3="mod,twister;name,Twister" +Holds,4="mod,holdrolls;name,HoldsToRolls" + +# Holds="7" +# HoldsDefault="mod,no noholds,no planted,no twister,no nojumps,no nohands, no holdstorolls" +# Holds,1="mod,noholds;name,Off" +# Holds,2="name,On" +# Holds,3="mod,planted;name,Planted" +# Holds,4="mod,twister;name,Twister" +# Holds,5="mod,holdstorolls;name,HoldsToRolls" +# Holds,6="mod,nojumps;name,NoJumps" +# Holds,7="mod,nohands;name,NoHands" + +Mines="4" +MinesDefault="mod,no nomines,no mines,no attackmines" +Mines,1="mod,nomines;name,Off" +Mines,2="name,On" +Mines,3="mod,mines;name,Add" +Mines,4="mod,attackmines;name,AttackMines" + +# Mines="4" +# MinesDefault="mod,no nomines,no mines, no attackmines" +# Mines,1="mod,nomines;name,Off" +# Mines,2="name,On" +# Mines,3="mod,mines;name,Add" +# Mines,4="mod,attackmines;name,AttackMines" + +Attacks="3" +AttacksDefault="mod,no randomattacks,no songattacks" +Attacks,1="name,Off" +Attacks,2="mod,randomattacks;name,RandomAttacks" +Attacks,3="mod,songattacks;name,SongAttacks" + +PlayerAutoPlay="2" +PlayerAutoPlayDefault="mod,no playerautoplay" +PlayerAutoPlay,1="name,Off" +PlayerAutoPlay,2="mod,playerautoplay;name,On" + +Hide="3;selectmultiple" +HideDefault="mod,no dark,no blind,no cover" +Hide,1="mod,dark;name,Dark" +Hide,2="mod,blind;name,Blind" +Hide,3="mod,60% cover;name,Cover" + +# Hide="3" +# HideDefault="mod,no dark,no blind" +# Hide,1="name,Off" +# Hide,2="mod,dark;name,Dark" +# Hide,3="mod,blind;name,Blind" + +Persp="5" +PerspDefault="mod,overhead" +Persp,1="mod,incoming;name,Incoming" +Persp,2="mod,overhead;name,Overhead" +Persp,3="mod,space;name,Space" +Persp,4="mod,hallway;name,Hallway" +Persp,5="mod,distant;name,Distant" + +ScoreDisplay="3" +ScoreDisplayDefault="mod,addscore" +ScoreDisplay,1="mod,addscore;name,Add" +ScoreDisplay,2="mod,subtractscore;name,Subtract" +ScoreDisplay,3="mod,averagescore;name,Average" + +# Song options +# LifeType="3;together" +LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together" +LifeTypeDefault="" +LifeType,1="mod,bar;name,Bar" +LifeType,2="mod,battery;name,Battery" +LifeType,3="mod,lifetime;name,LifeTime" +BarDrain="3;together" +BarDrainDefault="" +BarDrain,1="mod,normal-drain;name,Normal" +BarDrain,2="mod,norecover;name,NoRecover" +BarDrain,3="mod,suddendeath;name,SuddenDeath" +BatLives="10;together" +BatLivesDefault="" +BatLives,1="mod,1 life;name,1" +BatLives,2="mod,2 lives;name,2" +BatLives,3="mod,3 lives;name,3" +BatLives,4="mod,4 lives;name,4" +BatLives,5="mod,5 lives;name,5" +BatLives,6="mod,6 lives;name,6" +BatLives,7="mod,7 lives;name,7" +BatLives,8="mod,8 lives;name,8" +BatLives,9="mod,9 lives;name,9" +BatLives,10="mod,10 lives;name,10" +Fail="4;together" +FailDefault="mod,faildefault" +Fail,1="mod,failimmediate;name,Immediate" +Fail,2="mod,failimmediatecontinue;name,ImmediateContinue" +Fail,3="mod,failatend;name,FailAtEnd" +Fail,4="mod,failoff;name,Off" +Assist="4;together" +AssistDefault="" +Assist,1="mod,no clap,no metronome;name,Off" +Assist,2="mod,clap,no metronome;name,Clap" +Assist,3="mod,no clap,metronome;name,Metronome" +Assist,4="mod,clap,metronome;name,Both" +Rate="13;together" +RateDefault="mod,1.0xmusic;mod,no haste" +Rate,1="mod,0.25xmusic;name,0.25x" +Rate,2="mod,0.50xmusic;name,0.5x" +Rate,3="mod,0.75xmusic;name,0.75x" +Rate,4="mod,0.8xmusic;name,0.8x" +Rate,5="mod,0.9xmusic;name,0.9x" +Rate,6="mod,1.0xmusic;name,1.0x" +Rate,7="mod,haste;name,Haste" +Rate,8="mod,1.1xmusic;name,1.1x" +Rate,9="mod,1.2xmusic;name,1.2x" +Rate,10="mod,1.25xmusic;name,1.25x" +Rate,11="mod,1.3xmusic;name,1.3x" +Rate,12="mod,1.5xmusic;name,1.5x" +Rate,13="mod,1.75xmusic;name,1.75x" +Rate,14="mod,2.0xmusic;name,2.0x" +AutoAdjust="4;together" +AutoAdjustDefault="" +AutoAdjust,1="mod,no autosync;name,Off" +AutoAdjust,2="mod,autosyncsong;name,Sync Song" +AutoAdjust,3="mod,autosyncmachine;name,Sync Machine" +AutoAdjust,4="mod,autosynctempo;name,Sync Tempo" +SoundEffect="3;together" +SoundEffectDefault="" +SoundEffect,1="mod,no effect;name,Off" +SoundEffect,2="mod,EffectSpeed;name,EffectSpeed" +SoundEffect,3="mod,EffectPitch;name,EffectPitch" +Background="3;together" +BackgroundDefault="" +Background,1="mod,no effect;name,Default" +Background,2="mod,staticbg;name,StaticBG" +Background,3="mod,randombg;name,RandomBG" +SaveScores="2;together" +SaveScoresDefault="" +SaveScores,1="mod,no savescore;name,Off" +SaveScores,2="mod,savescore;name,On" +SaveReplays="2;together" +SaveReplaysDefault="" +SaveReplays,1="mod,no savereplay;name,Off" +SaveReplays,2="mod,savereplay;name,On" + +#ScreenJukeboxMenu +RandomModifiers="2;together" +RandomModifiersDefault="mod,clear" +RandomModifiers,1="name,Off" +RandomModifiers,2="mod,random;name,Random" + +# ScreenOptionsEditMode +Edit Steps="1;together;SelectNone" +Edit StepsDefault="" +Edit Steps,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" +Transfer To USB Drive="1;together;SelectNone" +Transfer To USB DriveDefault="" +Transfer To USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" +Transfer From USB Drive="1;together;SelectNone" +Transfer From USB DriveDefault="" +Transfer From USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer From USB Drive" + +[ScreenOptionsSimple] +# more work on this needs to be done; bug me about it -aj +Fallback="ScreenOptionsMaster" +NavigationMode="menu" +InputMode="together" +ForceAllPlayers=true + +NumRowsShown=11 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-154+28*offsetFromCenter) end +ShowExitRow=true +SeparateExitRow=false +SeparateExitRowY=SCREEN_CENTER_Y+180 + +ExplanationTogetherX=SCREEN_CENTER_X +ExplanationTogetherY=SCREEN_CENTER_Y+174 +ExplanationTogetherOnCommand=zoom,0.75;shadowlength,0;wrapwidthpixels,600/0.75;cropright,1;linear,0.5;cropright,0 +ExplanationTogetherOffCommand= + +[ScreenOptionsSimpleService] +Fallback="ScreenOptionsSimple" + +OptionRowNormalMetricsGroup="OptionRowService" + +LineHighlightOnCommand=visible,false +LineHighlightChangeCommand= +LineHighlightChangeToExitCommand= + +CursorOnCommand=visible,false + +[ScreenOptionsService] +Class="ScreenOptionsMaster" +Fallback="ScreenOptionsSimpleService" +# +NextScreen=Branch.Init() +PrevScreen=Branch.Init() + +LineNames="SystemDirection,KeyConfig,GameType,6,8,Reload,MoreOptions" +# LineNames="SystemDirection,1,2,Sync,13,3,10,11,4,12,6,5,Theme,8,9" +Line1="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" +Line2="gamecommand;screen,ScreenTestInput;name,Test Input" +Line13="gamecommand;screen,ScreenSelectGame;name,Select Game" +Line3="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options" +Line4="gamecommand;screen,ScreenOptionsGraphicsSound;name,Graphics/Sound Options" +Line5="gamecommand;screen,ScreenOptionsAdvanced;name,Advanced Options" +Line10="gamecommand;screen,ScreenOptionsUI;name,UI Options" +Line11="gamecommand;screen,ScreenOptionsInput;name,Input Options" +Line12="gamecommand;screen,ScreenOptionsArcade;name,Arcade Options" +Line6="gamecommand;screen,ScreenNetworkOptions;name,Network Options" +Line8="gamecommand;screen,ScreenOptionsManageProfiles;name,Profiles" +Line9="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" + +LineTheme="gamecommand;screen,ScreenOptionsTheme;name,Theme Options" +LineSystemDirection="gamecommand;screen,ScreenOptionsSystemDirection;name,System Direction" +LineKeyConfig="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" +LineGameType="gamecommand;screen,ScreenSelectGame;name,Select Game" +LineSync="gamecommand;screen,ScreenGameplaySyncMachine;name,Calibrate Machine Sync" +LineReload="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" +LineMoreOptions="gamecommand;screen,ScreenOptionsExtended;name,More Options" + +[ScreenOptionsExtended] +Fallback="ScreenOptionsService" +# +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" +# +LineNames="2,Sync,3,10,11,4,12,5,Theme" + +[ScreenOptionsServiceChild] +Fallback="ScreenOptionsMaster" +LightsMode="LightsMode_MenuStartAndDirections" +NavigationMode="normal" +InputMode="together" +TimerOnCommand=visible,false +ShowStyleIcon=false +TimerSeconds=-1 +AllowOperatorMenuButton=false +ForceAllPlayers=true +PrevScreen="ScreenOptionsService" +NextScreen="ScreenOptionsService" +HelpText=Screen.String("HelpTextOptionsAndBack") + +LineHighlightOnCommand=visible,false +LineHighlightChangeCommand= +LineHighlightChangeToExitCommand= +# +ExplanationTogetherX=SCREEN_CENTER_X +ExplanationTogetherY=SCREEN_CENTER_Y+174 +ExplanationTogetherOnCommand=zoom,0.625;shadowlength,0;wrapwidthpixels,600/0.665;cropright,1;linear,0.5;cropright,0 +ExplanationTogetherOffCommand= + +[ScreenOptionsServiceExtendedChild] +Fallback="ScreenOptionsServiceChild" +[ScreenMiniMenu] +Class="ScreenMiniMenu" +Fallback="ScreenOptions" +PrevScreen= +ShowHelp=false +TimerSeconds=-1 +ShowExplanations=false +ShowExitRow=false +ContainerOnCommand= +ContainerOffCommand= +NumRowsShown=30 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local indexOffset = itemIndex-(numItems-1)/2; self:y( SCREEN_CENTER_Y + indexOffset * 20 ); end +ShowStyleIcon=false +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP+40 +HeaderOnCommand= +HeaderOffCommand= +AllowRepeatingChangeValueInput=true +CursorOnCommand=visible,false +OptionRowNormalMetricsGroup="OptionRowMiniMenu" +ColorDisabled=color("0.8,0.8,0.8,0.975") + +[OptionRowMiniMenu] +Fallback="OptionRow" +IconsP1X=SCREEN_CENTER_X-280 +IconsP2X=SCREEN_CENTER_X+280 +IconsOnCommand=x,-30 +FrameX=SCREEN_CENTER_X-232 +TitleX=SCREEN_CENTER_X-150 +TitleOnCommand=halign,0;shadowlength,2; +ItemsStartX=SCREEN_CENTER_X-150 +ItemsEndX=SCREEN_CENTER_X+280 +ItemsGapX=14 +ItemsLongRowP1X=SCREEN_CENTER_X-60 +ItemsLongRowP2X=SCREEN_CENTER_X+100 +ItemsLongRowSharedX=SCREEN_CENTER_X+150 +ItemOnCommand= +ColorSelected=color("0.5,1,0.5,1") +ColorNotSelected=color("1,1,1,1") +ColorDisabled=color("0.5,0.5,0.5,1") +TweenSeconds=0 + +[ScreenMiniMenuContext] +Fallback="ScreenMiniMenu" +NumRowsShown=10 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(24*(offsetFromCenter-(numItems-1)/2)) end +LineHighlightX=0 +ShowHelp=false +OptionRowNormalMetricsGroup="OptionRowMiniMenuContext" + +[OptionRowMiniMenuContext] +Fallback="OptionRowMiniMenu" +TitleX=-54 + +[ScreenMapControllers] +Class="ScreenMapControllers" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +# +DevicesX=SCREEN_CENTER_X +DevicesY=SCREEN_TOP+24 +DevicesOnCommand=zoom,0.75;draworder,5;strokecolor,color("0,0,0,1") +DevicesOffCommand= +# +ButtonsToMap="" +MappedToP1S1Command=x,SCREEN_CENTER_X-270 +MappedToP1S2Command=x,SCREEN_CENTER_X-195 +MappedToP1S3Command=x,SCREEN_CENTER_X-120 +MappedToP2S1Command=x,SCREEN_CENTER_X+120 +MappedToP2S2Command=x,SCREEN_CENTER_X+195 +MappedToP2S3Command=x,SCREEN_CENTER_X+270 +# +MappedToOnCommand=diffuse,color("#808080");shadowlength,0;maxwidth,150;zoom,0.75 +MappedToWaitingCommand=diffuse,color("#FF8080");pulse;effectperiod,0.5;effectmagnitude,0.8,1.3,0 +MappedToMappedInputCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") +MappedToGainFocusCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") +MappedToLoseFocusCommand=diffuse,color("#808080");stopeffect +# +LineScrollerOnCommand=%function(self) self:draworder(-1); self:y(64) self:setsecondsperitem(0.1) self:SetTransformFromHeight(24) end +LineScrollerOffCommand= +LineHideCommand=visible,false +LineOnCommand=%function(self) self:y(0); self:visible(true); local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:addx(-SCREEN_WIDTH * LeftToRight); end +LineOffCommand=%function(self) local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:stoptweening() self:accelerate(0.3); self:addx(SCREEN_WIDTH * LeftToRight); self:queuecommand('Hide') end +# +ErrorX=SCREEN_CENTER_X +ErrorY=SCREEN_CENTER_Y +ErrorOnCommand=diffuse,color("#00FF00");zoom,0.8 +LabelP1OnCommand=x,SCREEN_CENTER_X*0.4;zoom,0.7;shadowlength,1 +LabelP1OffCommand=linear,0.5;diffusealpha,0 +LabelP2OnCommand=x,SCREEN_CENTER_X*1.6;zoom,0.7;shadowlength,1 +LabelP2OffCommand=linear,0.5;diffusealpha,0 +PrimaryOnCommand=x,SCREEN_CENTER_X;y,-6;zoom,0.7;shadowlength,1;ztest,true +SecondaryOnCommand=x,SCREEN_CENTER_X;y,6;shadowlength,1;ztest,true +ShowExitRow=true + +[ScreenTestInput] +Class="ScreenTestInput" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" + +[ScreenOptionsSystemDirection] +Fallback="ScreenOptionsServiceChild" +PrevScreen="ScreenOptionsService" +NextScreen="ScreenOptionsService" +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22" +Line1="conf,Windowed" +Line2="conf,DisplayResolution" +Line3="conf,DisplayAspectRatio" +Line4="conf,HighResolutionTextures" +Line5="conf,Vsync" +Line6="conf,SoundVolume" +Line7="conf,TimingWindowScale" +Line8="conf,LifeDifficulty" +Line9="conf,AllowW1" +Line10="conf,AutogenSteps" +Line11="conf,ShowBanners" +Line12="conf,ShowCaution" +Line13="conf,ShowInstructions" +Line14="conf,ShowDanger" +Line15="conf,ShowSongOptions" +Line16="conf,EasterEggs" +Line17="conf,Theme" +Line18="conf,DefaultNoteskin" +Line19="conf,PercentageScoring" +Line20="conf,BGBrightness" +Line21="conf,Center1Player" +Line22="conf,EventMode" + +[ScreenOptionsGraphicsSound] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20" +Line1="conf,Windowed" +Line2="conf,DisplayResolution" +Line3="conf,DisplayAspectRatio" +Line4="conf,DisplayColorDepth" +Line5="conf,HighResolutionTextures" +Line6="conf,MaxTextureResolution" +Line7="conf,TextureColorDepth" +Line8="conf,MovieColorDepth" +Line9="conf,SmoothLines" +Line10="conf,CelShadeModels" +Line11="conf,DelayedTextureDelete" +Line12="conf,RefreshRate" +Line13="conf,Vsync" +Line14="conf,ShowStats" +Line15="conf,ShowBanners" +Line16="conf,AttractSoundFrequency" +Line17="conf,SoundVolume" +Line18="conf,EnableAttackSounds" +Line19="conf,EnableMineHitSound" +Line20="conf,VisualDelaySeconds" + +[ScreenOptionsAdvanced] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="2,3,4,8,11,13,14,15,16,28,29,30" +Line2="conf,ScoringType" +Line3="conf,TimingWindowScale" +Line4="conf,LifeDifficulty" +Line8="lua,GamePrefDefaultFail()" +# Line8="conf,DefaultFailType" +Line11="conf,AllowW1" +Line13="conf,HiddenSongs" +Line14="conf,EasterEggs" +Line15="conf,AllowExtraStage" +Line16="conf,UseUnlockSystem" +Line28="conf,AutogenSteps" +Line29="conf,AutogenGroupCourses" +Line30="conf,FastLoad" + +# unused options +#Line5="conf,ProgressiveLifebar" +#Line6="conf,ProgressiveStageLifebar" +#Line7="conf,ProgressiveNonstopLifebar" +#Line24="conf,AutoPlay" +#Line31="conf,OnlyPreferredDifficulties" + +[ScreenAppearanceOptions] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="1,2,3,4,5,14,15,17,18,19" +Line1="conf,Language" +Line2="conf,Announcer" +Line3="conf,Theme" +Line4="conf,DefaultNoteSkin" +Line5="conf,PercentageScoring" +Line14="conf,RandomBackgroundMode" +Line15="conf,BGBrightness" +Line17="conf,ShowDancingCharacters" +Line18="conf,ShowBeginnerHelper" +Line19="conf,NumBackgrounds" + +[ScreenOptionsUI] +# user interface options that aren't related to themes, etc. +# (some don't get used/modified too often) +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="1,3,4,6,7,9,10,11,12,14" +Line1="conf,Center1Player" +Line3="conf,DancePointsForOni" +Line4="conf,MenuTimer" +Line6="conf,MusicWheelUsesSections" +Line7="conf,ShowBanners" +Line8="conf,ShowCaution" +Line9="conf,ShowDanger" +Line10="conf,ShowInstructions" +Line11="conf,ShowLyrics" +Line12="conf,ShowNativeLanguage" +Line14="conf,ShowSongOptions" + +# unused options +#Line2="conf,CourseSortOrder" +#Line5="conf,MoveRandomToEnd" + +[ScreenOptionsInput] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="1,2,3,4,5" +Line1="conf,AutoMapOnJoyChange" +Line2="conf,OnlyDedicatedMenuButtons" +Line3="conf,DelayedBack" +Line4="conf,ArcadeOptionsNavigation" +Line5="conf,MusicWheelSwitchSpeed" + +[ScreenOptionsArcade] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +# stuff tied to arcade features +LineNames="1,2,3,4,5,6" +Line1="conf,GetRankingName" +Line2="conf,CoinMode" +Line3="conf,SongsPerPlay" +Line4="conf,CoinsPerCredit" +Line5="conf,Premium" +Line6="conf,EventMode" + +[ScreenOptionsTheme] +Fallback="ScreenOptionsServiceChild" + +[ScreenSelectGame] +Fallback="ScreenOptionsServiceChild" +PrevScreen=Branch.TitleMenu() +NextScreen=Branch.TitleMenu() +LineNames="1" +Line1="conf,Game" + +[ScreenNetworkOptions] +Class="ScreenNetworkOptions" +Fallback="ScreenOptionsServiceChild" +NextScreen=Branch.Network() +PrevScreen=Branch.Network() + +[ScreenOptionsManageProfiles] +Class="ScreenOptionsManageProfiles" +Fallback="ScreenOptionsSimpleService" +PrevScreen="ScreenOptionsService" +NextScreen="ScreenOptionsService" +PrepareScreens="ScreenMiniMenuContext" +GroupedScreens="ScreenMiniMenuContext" +PersistScreens="ScreenMiniMenuContext" + +TimerSeconds=-1 + +[ScreenOptionsEditProfile] +PageOnCommand=visible,false + +[ScreenReloadSongs] +Class="ScreenReloadSongs" +Fallback="Screen" +NextScreen=Branch.TitleMenu() + +[ScreenSelectGame] +Fallback="ScreenOptionsServiceChild" +PrevScreen="ScreenOptionsService" +NextScreen=Branch.TitleMenu() +LineNames="1" +Line1="conf,Game" + +[ScreenPlayerOptions] +Fallback="ScreenOptions" +Class="ScreenPlayerOptions" +# +PrevScreen=Branch.BackOutOfPlayerOptions() +NextScreen=Branch.SongOptions() +# +PlayMusic=false +# +TimerSeconds=30 +# +LineNames="1,2,3,4,5,6,R,7,8,9,10,11,12,13,14,15,16,17" +Line1="lua,SpeedMods()" +# Line1="list,Speed" +Line2="list,Accel" +Line3="list,Effect" +Line4="list,Appearance" +Line5="list,Turn" +Line6="list,Insert" +LineR="list,Remove" +Line7="list,Scroll" +Line8="list,NoteSkins" +Line9="list,Holds" +Line10="list,Mines" +Line11="list,Attacks" +Line12="list,PlayerAutoPlay" +Line13="list,Hide" +Line14="list,Persp" +Line15="list,ScoreDisplay" +Line16="list,Steps" +Line17="list,Characters" + +# +[ScreenPlayerOptionsRestricted] +Fallback="ScreenPlayerOptions" +NextScreen="ScreenStageInformation" +LineNames="1,8,16,17" + +# funny +[ScreenSongOptions] +Fallback="ScreenOptions" +Class="ScreenSongOptions" +# +PrevScreen="ScreenPlayerOptions" +NextScreen="ScreenStageInformation" +# +PlayMusic=false +# +TimerSeconds=30 +# +LineNames="1,2,3,4,5,6,7,8,9,10" +#,11 +Line1="list,LifeType" +Line2="list,BarDrain" +Line3="list,BatLives" +Line4="list,Fail" +Line5="list,Assist" +Line6="list,Rate" +Line7="list,SoundEffect" +Line8="list,AutoAdjust" +Line9="list,Background" +Line10="list,SaveScores" +Line11="list,SaveReplays" +StopMusicOnBack=false + +[ScreenSplash] +Class="ScreenSplash" +Fallback="ScreenWithMenuElementsBlank" +MinimumScreenPrepareDelaySeconds=0 +AllowStartToSkip=false +PrepareScreen= + +# 05 # A +[ScreenExit] +# Midiman: +# Fun fact, if you don't enable this screen, Force Crashing will hang +# StepMania, and leave it there to eat up time. +Class="ScreenExit" +Fallback="ScreenWithMenuElements" +AllowOperatorMenuButton=false + +[ScreenAttract] +Class="ScreenAttract" +Fallback="ScreenWithMenuElementsBlank" +StartScreen=Branch.TitleMenu() +CancelScreen=Branch.TitleMenu() +# +LightsMode="LightsMode_Attract" +# +PlayMusic=false +# +ResetGameState=true +BackGoesToStartScreen=true +# +AttractVolume=true +# +TimerMetricsGroup="MenuTimerNoSound" + +[ScreenRanking] +Class="ScreenRanking" +Fallback="ScreenAttract" +# +TimerSeconds=-1 +# +ResetGameState=true +StepsTypesToHide="dance-couple,dance-solo,dance-routine,pump-halfdouble,pump-couple" +PageFadeSeconds=1.0 +CoursesToShow=GetCoursesToShowRanking() +SecondsPerPage=5 +# +RankingType="Category" +# +RowSpacingX=0 +RowSpacingY=60 +ColSpacingX=0 +ColSpacingY=0 +# +StepsTypeColor1=color("1.0,1.0,1.0,1.0") +StepsTypeColor2=color("1.0,1.0,1.0,1.0") +StepsTypeColor3=color("1.0,1.0,1.0,1.0") +StepsTypeColor4=color("1.0,1.0,1.0,1.0") +StepsTypeColor5=color("1.0,1.0,1.0,1.0") +# +SongScoreSecondsPerRow=0.4 +ShowSurvivalTime=false +# +BannerOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-196;diffusealpha,1;scaletoclipped,220,58;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +BannerOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +CategoryOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +CategoryOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +CourseTitleOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;maxwidth,230;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +CourseTitleOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +StepsTypeOnCommand=x,SCREEN_CENTER_X+200;y,SCREEN_CENTER_Y-180;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +StepsTypeOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +# +BulletStartX=SCREEN_CENTER_X-220 +BulletStartY=SCREEN_CENTER_Y-100 +Bullet1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Bullet2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Bullet3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Bullet4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Bullet5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Bullet1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Bullet2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Bullet3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Bullet4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Bullet5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +NameStartX=SCREEN_CENTER_X-140 +NameStartY=SCREEN_CENTER_Y-100 +Name1OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Name2OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Name3OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Name4OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Name5OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Name1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Name2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Name3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Name4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Name5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +ScoreStartX=SCREEN_CENTER_X+200 +ScoreStartY=SCREEN_CENTER_Y-100 +Score1OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Score2OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Score3OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Score4OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Score5OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Score1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Score2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Score3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Score4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Score5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +PointsStartX=SCREEN_CENTER_X+60 +PointsStartY=SCREEN_CENTER_Y-100 +Points1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Points2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Points3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Points4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Points5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Points1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Points2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Points3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Points4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Points5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +TimeStartX=SCREEN_CENTER_X+240 +TimeStartY=SCREEN_CENTER_Y-100 +Time1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Time2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Time3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Time4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Time5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Time1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Time2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Time3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Time4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Time5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +DifficultyStartX=SCREEN_CENTER_X-154 +DifficultyY=SCREEN_CENTER_Y-209 +DifficultyBeginnerOnCommand= +DifficultyEasyOnCommand= +DifficultyMediumOnCommand= +DifficultyHardOnCommand= +DifficultyChallengeOnCommand= +DifficultyBeginnerOffCommand= +DifficultyEasyOffCommand= +DifficultyMediumOffCommand= +DifficultyHardOffCommand= +DifficultyChallengeOffCommand= +TitleOnCommand=x,-210;ztest,1;diffuse,0,0,0,1;maxwidth,160 +TitleOffCommand= +FrameOnCommand=ztest,1 +FrameOffCommand= +ScoreOffsetStartX=-154 +ScoreOffsetY=0 +ScoreOnCommand=zoom,0.7;ztest,1 +ScoreOffCommand= +# 05 # B + +# 05 # C +[ScreenGameplay] +# +Fallback="ScreenWithMenuElementsBlank" +Class="ScreenGameplayNormal" +# +NextScreen=Branch.AfterGameplay() +PrevScreen=Branch.BackOutOfStageInformation() +# +ShowLifeMeterForDisabledPlayers=false +StopCourseEarly=false +ShowEvaluationOnFail=true +ShowScoreInRave=false +# +UnpauseWithStart=true +# +InitialBackgroundBrightness=1.0 +TimerSeconds=-1 +# +SecondsBetweenComments=10.0 +ScoreKeeperClass=ScoreKeeperClass() +# +TickEarlySeconds=0 +# +LightsMode="LightsMode_Gameplay" +# +PlayerType="Player" +# useful in some obscure situations where the theme resolution has been increased. +PlayerInitCommand=y,SCREEN_CENTER_Y;zoom,(THEME:GetMetric("Common","ScreenHeight")/480) +StartGivesUp=true +BackGivesUp=false +# +FailOnMissCombo=FailCombo() +GivingUpGoesToPrevScreen=false +GivingUpGoesToNextScreen=false +# +MinSecondsToStep=6.0 +MinSecondsToMusic=2.0 +MinSecondsToStepNextSong=2.0 +MusicFadeOutSeconds=0.5 +OutTransitionLength=5 +CourseTransitionLength=0.5 +BeginFailedDelay=1.0 +# +AllowCenter1Player=true +# +PlayerP1OnePlayerOneSideX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP2OnePlayerOneSideX=math.floor(scale((2.15/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP1TwoPlayersTwoSidesX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP2TwoPlayersTwoSidesX=math.floor(scale((2.15/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP1TwoPlayersSharedSidesX=SCREEN_CENTER_X +PlayerP2TwoPlayersSharedSidesX=SCREEN_CENTER_X +# +LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+160 +LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-140 +# This is used if one player is in reverse and the other isn't. +LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-205 +LyricDisplayDefaultColor=color("0,1,0,1"); +# +OniGameOverP1X= +OniGameOverP1Y= +OniGameOverP1OnCommand= +OniGameOverP1OffCommand= +# +OniGameOverP2X= +OniGameOverP2Y= +OniGameOverP2OnCommand= +OniGameOverP2OffCommand= +# +ActiveAttackListP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ActiveAttackListP1Y= +ActiveAttackListP1OnCommand=visible,false +ActiveAttackListP1OffCommand= +ActiveAttackListP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ActiveAttackListP2Y= +ActiveAttackListP2OnCommand=visible,false +ActiveAttackListP2OffCommand= +# +CombinedLifeX=SCREEN_CENTER_X +CombinedLifeY=SCREEN_CENTER_Y +CombinedLifeOnCommand=visible,false +CombinedLifeOffCommand= +# +LifeP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +LifeP1Y=SCREEN_TOP+24 +LifeP1OnCommand= +LifeP1OffCommand= +LifeP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +LifeP2Y=SCREEN_TOP+24 +LifeP2OnCommand= +LifeP2OffCommand= +# +ScoreP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ScoreP1Y=SCREEN_BOTTOM-28 +ScoreP1OnCommand= +ScoreP1OffCommand= +ScoreP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +ScoreP2Y=SCREEN_BOTTOM-28 +ScoreP2OnCommand= +ScoreP2OffCommand= +# +SecondaryScoreP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +SecondaryScoreP1Y=SCREEN_BOTTOM-56 +SecondaryScoreP1OnCommand= +SecondaryScoreP1OffCommand= +SecondaryScoreP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +SecondaryScoreP2Y=SCREEN_BOTTOM-56 +SecondaryScoreP2OnCommand= +SecondaryScoreP2OffCommand= +# +StepsDescriptionP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +StepsDescriptionP1Y=SCREEN_CENTER_Y-24 +StepsDescriptionP1OnCommand=visible,false +StepsDescriptionP1OffCommand= +StepsDescriptionP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +StepsDescriptionP2Y=SCREEN_CENTER_Y-24 +StepsDescriptionP2OnCommand=visible,false +StepsDescriptionP2OffCommand= +# +PlayerOptionsP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +PlayerOptionsP1Y=SCREEN_CENTER_Y+24 +PlayerOptionsP1OnCommand=visible,false +PlayerOptionsP1OffCommand= +PlayerOptionsP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +PlayerOptionsP2Y=SCREEN_CENTER_Y+24 +PlayerOptionsP2OnCommand=visible,false +PlayerOptionsP2OffCommand= +# +StepsDisplayP1X=SCREEN_CENTER_X-160 +StepsDisplayP1Y=SCREEN_BOTTOM-60 +StepsDisplayP1OnCommand=visible,false +StepsDisplayP1OffCommand= +# +StepsDisplayP2X=SCREEN_CENTER_X+160 +StepsDisplayP2Y=SCREEN_BOTTOM-60 +StepsDisplayP2OnCommand=visible,false +StepsDisplayP2OffCommand= +# +SongOptionsX=SCREEN_CENTER_X +SongOptionsY=SCREEN_BOTTOM-32 +SongOptionsOnCommand=visible,false +SongOptionsOffCommand= +# +DebugX=SCREEN_CENTER_X +DebugY=SCREEN_BOTTOM-72 +DebugOnCommand=zoom,0.75 +# +SongNumberP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") - 60 +SongNumberP1Y=SCREEN_TOP+24+7 +SongNumberP1OnCommand=visible,false +SongNumberP1OffCommand= +SongNumberP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 60 +SongNumberP2Y=SCREEN_TOP+24+7 +SongNumberP2OnCommand=visible,false +SongNumberP2OffCommand= +# online scoreboard +# P1 is used when the only player is P2 +ScoreboardC1P1X=SCREEN_CENTER_X*0.25 +ScoreboardC1P1Y=SCREEN_CENTER_Y*0.45 +ScoreboardC1P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 +ScoreboardC2P1X=SCREEN_CENTER_X*0.5 +ScoreboardC2P1Y=SCREEN_CENTER_Y*0.45 +ScoreboardC2P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 +ScoreboardC3P1X=SCREEN_CENTER_X*0.75 +ScoreboardC3P1Y=SCREEN_CENTER_Y*0.45 +ScoreboardC3P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 +# P2 is used when the only player is P1 +ScoreboardC1P2X=SCREEN_CENTER_X*1.25 +ScoreboardC1P2Y=SCREEN_CENTER_Y*0.45 +ScoreboardC1P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 +ScoreboardC2P2X=SCREEN_CENTER_X*1.5 +ScoreboardC2P2Y=SCREEN_CENTER_Y*0.45 +ScoreboardC2P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 +ScoreboardC3P2X=SCREEN_CENTER_X*1.75 +ScoreboardC3P2Y=SCREEN_CENTER_Y*0.45 +ScoreboardC3P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 + +[ScreenGameplayShared] +Class="ScreenGameplayShared" +Fallback="ScreenGameplay" +PlayerType="PlayerShared" + +[ScreenEvaluation] +Class="ScreenEvaluation" +Fallback="ScreenWithMenuElements" +# +LightsMode="LightsMode_MenuStartOnly" +# +Summary=false +CheckpointsWithJudgments=false +# +TimerSeconds=20 +# +PlayerOptionsSeparator="," +PlayerOptionsHideFailType=false +MaxComboNumDigits=4 +# +ShowBannerArea=true +ShowSharedJudgmentLineLabels=false +ShowJudgmentLineW1=false +ShowJudgmentLineW2=false +ShowJudgmentLineW3=false +ShowJudgmentLineW4=false +ShowJudgmentLineW5=false +ShowJudgmentLineHeld=false +ShowJudgmentLineMiss=false +ShowJudgmentLineMaxCombo=false +ShowPeakComboAward=false +ShowTimingDifficulty=false +ShowStageDisplay=false +ShowStageFrame=false +ShowGraphDisplay=false +ShowComboGraph=false +ShowStepsDisplay=false +ShowGradeArea=false +ShowPointsArea=false +ShowDetailArea=false +ShowBonusArea=false +ShowSurvivedArea=false +ShowWinArea=false +ShowScoreArea=false +ShowTimeArea=false +ShowItsARecord=false +ShowStageAward=false +# +FailedSoundTime=0 +PassedSoundTime=0 +CheerDelaySeconds=2.5 +# +BannerWidth=256 +BannerHeight=80 +# +LargeBannerX= +LargeBannerY= +LargeBannerOnCommand=visible,false +LargeBannerOffCommand= +LargeBannerFrameX= +LargeBannerFrameY= +LargeBannerFrameOnCommand=visible,false +LargeBannerFrameOffCommand= +# +PlayerOptionsP1X= +PlayerOptionsP1Y= +PlayerOptionsP1OnCommand=visible,false +PlayerOptionsP1OffCommand= +PlayerOptionsP2X= +PlayerOptionsP2Y= +PlayerOptionsP2OnCommand=visible,false +PlayerOptionsP2OffCommand= +# +SongOptionsX= +SongOptionsY= +SongOptionsOnCommand=visible,false +SongOptionsOffCommand= +# +DisqualifiedP1X= +DisqualifiedP1Y= +DisqualifiedP1OnCommand=visible,false +DisqualifiedP1OffCommand= +DisqualifiedP2X= +DisqualifiedP2Y= +DisqualifiedP2OnCommand=visible,false +DisqualifiedP2OffCommand= +# +DetailLineFormat="%3d/%3d" +# +[ScreenEvaluationNormal] +Fallback="ScreenEvaluation" +# +NextScreen="ScreenProfileSave" + +[ScreenEvaluationSummary] +Fallback="ScreenEvaluation" +# +NextScreen="ScreenSelectMusic" +# +Summary=true +# + +[ScreenNameEntry] +# !!! # +Class="ScreenNameEntry" +Fallback="ScreenWithMenuElementsBlank" +TimerX=SCREEN_CENTER_X+0 +TimerY=SCREEN_CENTER_Y-210 +CategoryY=SCREEN_CENTER_Y+190 +CategoryZoom=0.7 +CharsZoomSmall=1.0 +CharsZoomLarge=1.5 +CharsSpacingY=40 +CharsChoices=" ABCDEFGHIJKLMNOPQRSTUVWXYZ" +ScrollingCharsCommand=diffuse,0.6,0.8,0.8,1 +SelectedCharsCommand=diffuse,0.8,1,1,1 +ReceptorArrowsY=SCREEN_CENTER_Y-140 +NumCharsToDrawBehind=2 +NumCharsToDrawTotal=10 +FakeBeatsPerSec=2.5 +ForceTimer=true +TimerSeconds=24 +TimerStealth=false +ShowStyleIcon=false +MaxRankingNameLength=4 +NextScreen="ScreenProfileSave" +PlayerP1OnePlayerOneSideX=SCREEN_CENTER_X-160 +PlayerP2OnePlayerOneSideX=SCREEN_CENTER_X+160 +PlayerP1TwoPlayersTwoSidesX=SCREEN_CENTER_X-160 +PlayerP2TwoPlayersTwoSidesX=SCREEN_CENTER_X+160 +PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X + +[ScreenProfileSave] +Class="ScreenProfileSave" +Fallback="ScreenWithMenuElementsBlank" +# +NextScreen=Branch.AfterProfileSave() +PrevScreen=Branch.TitleMenu() +# +TimerSeconds=-1 +[ScreenProfileSaveSummary] +Fallback="ScreenProfileSave" +# +NextScreen="ScreenGameOver" +PrevScreen="ScreenGameOver" +[ScreenGameOver] +Class="ScreenEnding" +Fallback="ScreenAttract" +# +PrevScreen=Branch.TitleMenu() +NextScreen=Branch.TitleMenu() +StartScreen=Branch.TitleMenu() +# +TimerSeconds=10 +# +ResetGameState=true +# +RemoveCardP1X=SCREEN_WIDTH*0.1 +RemoveCardP1Y=SCREEN_CENTER_Y +RemoveCardP1OnCommand= +RemoveCardP1OffCommand= + +RemoveCardP2X=SCREEN_WIDTH*0.9 +RemoveCardP2Y=SCREEN_CENTER_Y +RemoveCardP2OnCommand= +RemoveCardP2OffCommand= + +[ScreenPrompt] +Class="ScreenPrompt" +Fallback="ScreenWithMenuElementsBlank" +PrevScreen="ScreenEdit" +TimerSeconds=-1 + +QuestionX=SCREEN_CENTER_X +QuestionY=SCREEN_CENTER_Y-60 +QuestionOnCommand=zoom,0.7;wrapwidthpixels,600 +QuestionOffCommand= +CursorOnCommand= +CursorOffCommand= +Answer1Of1X=SCREEN_CENTER_X +Answer1Of1Y=SCREEN_CENTER_Y+120 +Answer1Of1OnCommand=maxwidth,100 +Answer1Of1OffCommand= +Answer1Of2X=SCREEN_CENTER_X-50 +Answer1Of2Y=SCREEN_CENTER_Y+120 +Answer1Of2OnCommand=maxwidth,100 +Answer1Of2OffCommand= +Answer2Of2X=SCREEN_CENTER_X+50 +Answer2Of2Y=SCREEN_CENTER_Y+120 +Answer2Of2OnCommand=maxwidth,100 +Answer2Of2OffCommand= +Answer1Of3X=SCREEN_CENTER_X-170 +Answer1Of3Y=SCREEN_CENTER_Y+120 +Answer1Of3OnCommand=maxwidth,100 +Answer1Of3OffCommand= +Answer2Of3X=SCREEN_CENTER_X-20 +Answer2Of3Y=SCREEN_CENTER_Y+120 +Answer2Of3OnCommand=maxwidth,100 +Answer2Of3OffCommand= +Answer3Of3X=SCREEN_CENTER_X+150 +Answer3Of3Y=SCREEN_CENTER_Y+120 +Answer3Of3OnCommand=maxwidth,100 +Answer3Of3OffCommand= + +# +# stuff for edit mode: +# +[ScreenOptionsEdit] +Class="ScreenOptionsMaster" +Fallback="ScreenOptionsSimpleService" +; This NextScreen is only used for the "exit" choice. +NextScreen=Branch.TitleMenu() +PrevScreen=Branch.TitleMenu() +#LineNames="1,2,3,4,5,6" +LineNames="1,2,3,4" +Line1="gamecommand;screen,ScreenEditMenu;name,Edit Songs/Steps" +Line2="gamecommand;screen,ScreenPracticeMenu;name,Practice Songs/Steps" +Line3="gamecommand;screen,ScreenOptionsExportPackage;name,Export Packages" +Line4="gamecommand;screen,ScreenOptionsManageCourses;name,Edit Courses" +# Line4="gamecommand;screen,ScreenServiceActionCopyEditsMachineToMemoryCard;name,Transfer Edits to USB" +# Line5="gamecommand;screen,ScreenOptionsGraphicsSound;name,Transfer Edits from USB" +# Line6="gamecommand;screen,ScreenOptionsAdvanced;name,Clear USB edits" + +[EditMenu] +EditMode="EditMode_Full" +ShowGroups=true + +Arrows1X=SCREEN_CENTER_X-176 +Arrows2X=SCREEN_CENTER_X+270 +ArrowsEnabledCommand=diffuse,color("1,1,1,1");shadowlengthy,1;shadowcolor,color("#002740"); +ArrowsDisabledCommand=diffuse,color("0.45,0.45,0.45,1");shadowlengthy,1;shadowcolor,color("#002740"); + +GroupBannerX=SCREEN_CENTER_X+170 +GroupBannerY=SCREEN_CENTER_Y-140 +GroupBannerOnCommand=scaletoclipped,128,40 + +SongBannerX=SCREEN_CENTER_X+170 +SongBannerY=SCREEN_CENTER_Y-90 +SongBannerOnCommand=scaletoclipped,128,40 + +TextBannerType="TextBannerEditMode" +SongTextBannerX=SCREEN_CENTER_X-128 +SongTextBannerY=SCREEN_CENTER_Y-90 + +StepsDisplayX=SCREEN_CENTER_X+150 +StepsDisplayY=SCREEN_CENTER_Y-0 +StepsDisplaySourceX=SCREEN_CENTER_X+150 +StepsDisplaySourceY=SCREEN_CENTER_Y+80 + +Row1Y=SCREEN_CENTER_Y-140 +Row2Y=SCREEN_CENTER_Y-90 +Row3Y=SCREEN_CENTER_Y-40 +Row4Y=SCREEN_CENTER_Y-0 +Row5Y=SCREEN_CENTER_Y+40 +Row6Y=SCREEN_CENTER_Y+80 +Row7Y=SCREEN_CENTER_Y+120 + +Label1X=SCREEN_CENTER_X-250 +Label1Y=THEME:GetMetric("EditMenu","Row1Y") +Label1OnCommand=shadowlength,1;zoom,0.75 +Label1OffCommand= +Label2X=SCREEN_CENTER_X-250 +Label2Y=THEME:GetMetric("EditMenu","Row2Y") +Label2OnCommand=shadowlength,1;zoom,0.75 +Label2OffCommand= +Label3X=SCREEN_CENTER_X-250 +Label3Y=THEME:GetMetric("EditMenu","Row3Y") +Label3OnCommand=shadowlength,1;zoom,0.75 +Label3OffCommand= +Label4X=SCREEN_CENTER_X-250 +Label4Y=THEME:GetMetric("EditMenu","Row4Y") +Label4OnCommand=shadowlength,1;zoom,0.75 +Label4OffCommand= +Label5X=SCREEN_CENTER_X-250 +Label5Y=THEME:GetMetric("EditMenu","Row5Y") +Label5OnCommand=shadowlength,1;zoom,0.75 +Label5OffCommand= +Label6X=SCREEN_CENTER_X-250 +Label6Y=THEME:GetMetric("EditMenu","Row6Y") +Label6OnCommand=shadowlength,1;zoom,0.75 +Label6OffCommand= +Label7X=SCREEN_CENTER_X-250 +Label7Y=THEME:GetMetric("EditMenu","Row7Y") +Label7OnCommand=shadowlength,1;zoom,0.75 +Label7OffCommand= + +Value1X=SCREEN_CENTER_X-24 +Value1Y=THEME:GetMetric("EditMenu","Row1Y") +Value1OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value1OffCommand= +Value2X=SCREEN_CENTER_X+60 +Value2Y=THEME:GetMetric("EditMenu","Row2Y") +Value2OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value2OffCommand= +Value3X=SCREEN_CENTER_X+60 +Value3Y=THEME:GetMetric("EditMenu","Row3Y") +Value3OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value3OffCommand= +Value4X=SCREEN_CENTER_X +Value4Y=THEME:GetMetric("EditMenu","Row4Y") +Value4OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value4OffCommand= +Value5X=SCREEN_CENTER_X+60 +Value5Y=THEME:GetMetric("EditMenu","Row5Y") +Value5OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value5OffCommand= +Value6X=SCREEN_CENTER_X +Value6Y=THEME:GetMetric("EditMenu","Row6Y") +Value6OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value6OffCommand= +Value7X=SCREEN_CENTER_X+60 +Value7Y=THEME:GetMetric("EditMenu","Row7Y") +Value7OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65 +Value7OffCommand= + +[TextBannerEditMode] +Fallback="TextBanner" + +[ScreenEditMenu] +Fallback="ScreenWithMenuElements" +Class="ScreenEditMenu" +NextScreen="ScreenEdit" +PrevScreen="ScreenOptionsEdit" +EditMenuType="EditMenu" +ExplanationX=SCREEN_CENTER_X +ExplanationY=SCREEN_BOTTOM-56 +ExplanationOnCommand=wrapwidthpixels,SCREEN_WIDTH*0.9375/0.675;shadowlength,1;zoom,0.675 +NumStepsLoadedFromProfileX=SCREEN_RIGHT-180 +NumStepsLoadedFromProfileY=SCREEN_TOP+42 +NumStepsLoadedFromProfileOnCommand=visible,false +ShowStyleIcon=false +TimerSeconds=-1 +HelpText=Screen.String("HelpTextOptionsAndBack") + +# could use a redo but whatever +[ScreenEdit] +Class="ScreenEdit" +Fallback="ScreenWithMenuElementsBlank" +PrepareScreens=GetEditModeSubScreens() +GroupedScreens=GetEditModeSubScreens() +PersistScreens=GetEditModeSubScreens() + +EditMode="EditMode_Full" +NextScreen="ScreenEditMenu" +PrevScreen="ScreenEditMenu" +ShowHelp=false +AllowOperatorMenuButton=false +ShowCreditDisplay=false +ShowStyleIcon=false +TimerSeconds=-1 +EditModifiers="no reverse" +EditHelpX=SCREEN_LEFT+4 +EditHelpY=SCREEN_TOP+16 +EditHelpOnCommand=halign,0;valign,0;zoom,0.675;shadowlength,1 +InfoX=SCREEN_RIGHT-128 +InfoY=SCREEN_TOP+16 +InfoOnCommand=halign,0;valign,0;zoom,0.5;shadowlength,1 +PlayRecordHelpX=SCREEN_LEFT+20 +PlayRecordHelpY=SCREEN_BOTTOM-20 +PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,1 + +CurrentBeatFormat="%s:\n %.5f\n" +CurrentSecondFormat="%s:\n %.5f\n" +SnapToFormat="%s:\n %s\n" +SelectionBeatBeginFormat="%s:\n %.5f" +SelectionBeatUnfinishedFormat=" ...\n" +SelectionBeatEndFormat="-%.5f\n" +DifficultyFormat="%s:\n %s\n" +RoutinePlayerFormat="%s:\n %d\n" +DescriptionFormat="%s:\n %s\n" +ChartStyleFormat="%s:\n %s\n" +MainTitleFormat="%s:\n %s\n" +SubtitleFormat="%s:\n %s\n" +TapNoteTypeFormat="%s: %s\n" +NumStepsFormat="%s: %d\n" +NumJumpsFormat="%s: %d\n" +NumHoldsFormat="%s: %d\n" +NumMinesFormat="%s: %d\n" +NumHandsFormat="%s: %d\n" +NumRollsFormat="%s: %d\n" +NumLiftsFormat="%s: %d\n" +NumFakesFormat="%s: %d\n" +Beat0OffsetFormat="%s:\n %.5f secs\n" +PreviewStartFormat="%s:\n %.5f secs\n" +PreviewLengthFormat="%s:\n %.5f secs\n" + +[ScreenPracticeMenu] +Fallback="ScreenEditMenu" +Class="ScreenEditMenu" +# +NextScreen="ScreenPractice" +PrevScreen="ScreenOptionsEdit" +EditMenuType="PracticeMenu" + +[PracticeMenu] +Fallback="EditMenu" +EditMode="EditMode_Practice" + +[ScreenPractice] +Fallback="ScreenEdit" +Class="ScreenEdit" +NextScreen="ScreenOptionsEdit" +PrevScreen="ScreenOptionsEdit" +# +EditMode="EditMode_Practice" + +[ScreenEditOptions] +Fallback="ScreenOptions" +Class="ScreenOptionsMaster" +NextScreen="none" +PrevScreen="none" +CancelTransitionsOut=true +PlayMusic=false +TimerSeconds=-1 +ShowStyleIcon=false +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" +Line1="list,Speed" +Line2="list,Accel" +Line3="list,Effect" +Line4="list,Appearance" +Line5="list,Turn" +Line6="list,Insert" +Line7="list,Scroll" +Line8="list,NoteSkins" +Line9="list,Holds" +Line10="list,Mines" +Line11="list,Hide" +Line12="list,Persp" +Line13="list,Assist" +Line14="list,Rate" +Line15="list,AutoAdjust" +Line16="conf,EditorShowBGChangesPlay" +OutCancelCommand= + +[StepsDisplayEdit] +Fallback="StepsDisplay" + +# oh, right, minimenus. +[ScreenMiniMenuEditHelp] +Fallback="ScreenMiniMenu" +ShowFooter=false +ColorDisabled=color("1,1,1,1") +RowInitCommand=halign,0.5;valign,0.5;zoom,0.8;x,75;y,45;shadowlength,1 +OptionRowNormalMetricsGroup="OptionRowMiniMenuEditHelp" + +[OptionRowMiniMenuEditHelp] +Fallback="OptionRowMiniMenu" + +TitleX=SCREEN_CENTER_X-312 +TitleOnCommand=halign,0;strokecolor,color("#222222CC");shadowlength,1;zoom,0.9 + +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + local indexOffset = itemIndex-(numItems-1)/2; \ + self:y(SCREEN_CENTER_Y + indexOffset * 20); \ +end + +ItemsStartX=SCREEN_CENTER_X+260 +ItemsEndX=SCREEN_CENTER_X+260 +ItemsLongRowP1X=SCREEN_CENTER_X+260 +ItemsLongRowP2X=SCREEN_CENTER_X+260 + +ItemOnCommand=x,SCREEN_CENTER_X+176;halign,0;strokecolor,color("#222222CC");shadowlength,1;zoom,0.9 +ColorDisabled=color("1,1,1,1") + +[ScreenMiniMenuMainMenu] +Fallback="ScreenMiniMenu" +TitleX=SCREEN_CENTER_X-80 + +[ScreenMiniMenuAreaMenu] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuStepsInformation] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuSongInformation] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuTimingDataInformation] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuBackgroundChange] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuPreferences] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuInsertTapAttack] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuInsertCourseAttack] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuCourseDisplay] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuCourseOptions] +Fallback="ScreenMiniMenu" + +# Export Packages +[ScreenOptionsExportPackage] +Class="ScreenOptionsExportPackage" +Fallback="ScreenOptionsSimpleService" +PrevScreen="ScreenOptionsEdit" +NextScreen="ScreenOptionsEdit" + +[ScreenOptionsManage] +Fallback="ScreenOptionsSimpleService" +TimerSeconds=-1 +AllowRepeatingChangeValueInput=true +OptionRowNormalMetricsGroup="OptionRowManage" + +[OptionRowManage] +Fallback="OptionRowService" +TitleX=SCREEN_CENTER_X-150 + +# Manage Courses +[OptionRowCourseOverview] +Fallback="OptionRowService" +ItemsLongRowSharedX=SCREEN_CENTER_X-100 +ColorSelected=color("1,1,1,1") +ColorNotSelected=color("0.9,0.9,0.9,1") +ColorDisabled=color("0.5,0.5,0.5,1") + +[ScreenOptionsManageCourses] +Class="ScreenOptionsManageCourses" +Fallback="ScreenOptionsManage" +PrevScreen="ScreenOptionsEdit" +NextScreen="ScreenOptionsEditCourse" +GroupedScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt,ScreenOptionsEditCourseMods" +PersistScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt" +PrepareScreens="ScreenTextEntry,ScreenPrompt" + +EditMode="EditMode_Full" +CreateNewScreen="ScreenOptionsEditCourse" + +OptionRowNormalMetricsGroup="OptionRowCourse" + +[OptionRowCourse] +Fallback="OptionRowService" +TitleX=SCREEN_CENTER_X + +[ScreenOptionsEditCourse] +Class="ScreenOptionsEditCourse" +Fallback="ScreenOptionsSimpleService" +PrevScreen="ScreenOptionsCourseOverview" +NextScreen="ScreenOptionsCourseOverview" +OptionRowNormalMetricsGroup="OptionRowEditCourse" + +[OptionRowEditCourse] +Fallback="OptionRowService" +TitleX=SCREEN_CENTER_X-200 +ItemsLongRowSharedX=SCREEN_CENTER_X + +[ScreenOptionsCourseOverview] +Class="ScreenOptionsCourseOverview" +Fallback="ScreenOptionsSimpleService" +PrevScreen="ScreenOptionsManageCourses" +NextScreen="ScreenOptionsManageCourses" +# huh +PlayScreen="" +EditScreen="ScreenOptionsEditCourse" +OptionRowNormalMetricsGroup="OptionRowCourseOverview" + +# visual/interactive syncing +[ScreenGameplaySyncMachine] +Class="ScreenGameplaySyncMachine" +Fallback="ScreenGameplay" +PrevScreen="ScreenOptionsExtended" +NextScreen="ScreenOptionsExtended" +PlayerType="PlayerSyncMachine" + +AllowCenter1Player=false +SyncInfoOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y;zoom,0;decelerate,0.5;zoom,0.6 + +# hidden by default: +LifeP1OnCommand=visible,false +LifeP2OnCommand=visible,false +ScoreP1OnCommand=visible,false +ScoreP2OnCommand=visible,false +StageOnCommand=visible,false +ScoreFrameOnCommand=visible,false +LifeFrameOnCommand=visible,false +DifficultyP1OnCommand=visible,false +DifficultyP1ReverseOnCommand=visible,false +DifficultyP2OnCommand=visible,false +DifficultyP2ReverseOnCommand=visible,false +SongOptionsOnCommand=visible,false + +[PlayerSyncMachine] +Fallback="Player" +ComboOnCommand=visible,false + +# sm-ssc helper screens +[ScreenHowToInstallSongs] +Class="ScreenSplash" +Fallback="ScreenSplash" +NextScreen=Branch.TitleMenu() +PrevScreen=Branch.TitleMenu() +ShowStyleIcon=false +TimerSeconds=-1 +ShowHelp=false + +# stuff for online mode: +[ScreenSMOnlineLogin] +Class="ScreenSMOnlineLogin" +Fallback="ScreenOptionsServiceChild" +NextScreen=Branch.AfterSMOLogin +PrevScreen=Branch.TitleMenu() +ShowStyleIcon=false +TimerSeconds=-1 +ShowHelp=false + +[ScreenNetSelectBase] +Class="ScreenNetSelectBase" +Fallback="ScreenWithMenuElements" + +ChatInputBoxX=SCREEN_CENTER_X*0.5 +ChatInputBoxY=SCREEN_CENTER_Y+112 +ChatInputBoxOnCommand=bounceend,0.5;diffusealpha,1; +ChatInputBoxOffCommand=bouncebegin,0.5;zoomy,0 +ChatInputBoxWidth=SCREEN_CENTER_X*0.9 +ChatInputBoxHeight=64 +#--# +ChatInputX=(SCREEN_CENTER_X*0.5)*0.125 +ChatInputY=SCREEN_CENTER_Y+90 +ChatTextInputWidth=SCREEN_CENTER_X*1.8 +ChatInputOnCommand=halign,0;valign,0;zoom,0.5;diffusealpha,0;linear,0.55;diffusealpha,1 +ChatInputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 +#====# +ChatOutputBoxX=SCREEN_CENTER_X*0.5 +ChatOutputBoxY=SCREEN_CENTER_Y-36 +ChatOutputBoxOnCommand=bounceend,0.5;diffusealpha,1; +ChatOutputBoxOffCommand=bouncebegin,0.5;zoomy,0 +ChatOutputBoxWidth=SCREEN_CENTER_X*0.9 +ChatOutputBoxHeight=SCREEN_CENTER_Y*0.875 +#--# +ChatOutputX=(SCREEN_CENTER_X*0.5)*0.125 +ChatOutputY=SCREEN_CENTER_Y+64 +ChatTextOutputWidth=SCREEN_CENTER_X*1.8 +ChatOutputLines=14 +ChatOutputOnCommand=halign,0;valign,1;zoom,0.5;diffusealpha,0;linear,0.55;diffusealpha,1 +ChatOutputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 + +UsersX=SCREEN_CENTER_X-265 +UsersY=SCREEN_CENTER_Y+172 +UserSpacingX=64 +UserLine2Y=16 +UsersOnCommand=draworder,2;zoom,1 +UsersOffCommand=linear,0.5;zoom,0 +Users0Command=draworder,2;diffuse,color("1.0,0.4,0.4,1.0") +Users1Command=draworder,2;diffuse,color("1.0,1.0,1.0,1.0") +Users2Command=draworder,2;diffuse,color("0.5,0.5,1.0,1.0") +Users3Command=draworder,2;diffuse,color("0.5,1.0,0.5,1.0") +Users4Command=draworder,2;diffuse,color("1.0,0.5,0.5,1.0") + +[ScreenNetSelectMusic] +Class="ScreenNetSelectMusic" +Fallback="ScreenNetSelectBase" +PrevScreen="ScreenNetRoom" +NextScreen="ScreenStageInformation" +NoSongsScreen=Branch.TitleMenu() +RoomSelectScreen="ScreenNetRoom" +Codes="CodeDetectorOnline" + +ShowStyleIcon=false +TimerSeconds= +TimerStealth=true + +SampleMusicPreviewMode='SampleMusicPreviewMode_Normal' + +MusicWheelType="OnlineMusicWheel" +MusicWheelX=SCREEN_CENTER_X+160 +MusicWheelY=SCREEN_CENTER_Y +MusicWheelOnCommand= +MusicWheelOffCommand= + +# todo: move these to Lua bganim +BPMDisplayX=SCREEN_CENTER_X-160-90+2 +BPMDisplayY=SCREEN_TOP+160+(36/2)+8 +BPMDisplayOnCommand= +BPMDisplayOffCommand= + +# todo: move these to Lua bganim +ModIconsP1X=SCREEN_CENTER_X+144 +ModIconsP1Y=SCREEN_CENTER_Y-165 +ModIconsP1OnCommand=zoomy,0;linear,0.5;zoomy,1 +ModIconsP1OffCommand=linear,0.5;zoomy,0 +ModIconsP2X=SCREEN_CENTER_X+144 +ModIconsP2Y=SCREEN_CENTER_Y-164 +ModIconsP2OnCommand=zoomy,0;linear,0.5;zoomy,1 +ModIconsP2OffCommand=linear,0.5;zoomy,0 + +# are these used? +optionsX=SCREEN_CENTER_X-240 +optionsY=SCREEN_CENTER_Y-170 +optionsOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,0.7;zoomx,0.7 +optionsOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 + +# uses StepsDisplayNet +StepsDisplayP1X=SCREEN_CENTER_X-223 +StepsDisplayP1Y=SCREEN_CENTER_Y+150 +StepsDisplayP1OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +StepsDisplayP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 + +StepsDisplayP2X=SCREEN_CENTER_X-110 +StepsDisplayP2Y=SCREEN_CENTER_Y+150 +StepsDisplayP2OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +StepsDisplayP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 + +[StepsDisplayNet] +Fallback="StepsDisplay" + +[ScreenNetRoom] +Class="ScreenNetRoom" +Fallback="ScreenNetSelectBase" +PrevScreen=Branch.TitleMenu() +# XXX +NextScreen="ScreenGameplayBranch" +MusicSelectScreen="ScreenNetSelectMusic" + +RoomWheelX=SCREEN_CENTER_X+160 +RoomWheelY=SCREEN_CENTER_Y +RoomWheelOnCommand= +RoomWheelOffCommand= + +RoomInfoDisplayX=SCREEN_CENTER_X-160 +RoomInfoDisplayY=SCREEN_CENTER_Y + +OpenRoomColor=color("1.0,1.0,1.0,1.0") +PasswdRoomColor=color("1.0,0.5,0.5,1.0") +InGameRoomColor=color("1.0,0.1,0.1,1.0") + +[RoomWheel] +Fallback="MusicWheel" +RoomWheelItemStartOnCommand= +RoomWheelItemFinishOnCommand= +CreateRoomColor=color("0.0,0.9,0.25,1.0") +ScrollBarOnCommand=visible,false + +[RoomWheelItem] +TextX=-110 +TextY=-8 +TextOnCommand=halign,0;zoom,0.6;maxwidth,200;strokecolor,color("#000000FF"); + +DescriptionX=-100 +DescriptionY=6 +DescriptionOnCommand=halign,0;zoom,0.4;maxwidth,400;strokecolor,color("#000000FF") + +[RoomInfoDisplay] +RoomInfoDisplayOnCommand=diffuse,color("1.0,1.0,1.0,1");x,SCREEN_WIDTH+130;y,250;bounceend,0.5;x,SCREEN_WIDTH-160 +RoomInfoDisplayOffCommand=x,SCREEN_WIDTH-160;y,250;bouncebegin,0.5;x,SCREEN_WIDTH+130 +DeployDelay=1.5 +RetractDelay=5 +RoomTitleOnCommand=x,-120;y,-140;zoom,0.75 +RoomDescOnCommand=x,-120;y,-129;zoom,0.75 +LastRoundOnCommand=x,-120;y,-107;zoom,0.75 +SongTitleOnCommand=x,-110;y,-96;zoom,0.75 +SongSubTitleOnCommand=x,-110;y,-85;zoom,0.75 +SongArtistOnCommand=x,-110;y,-74;zoom,0.75 +PlayersOnCommand=x,-120;y,-52;zoom,0.75 +PlayerListElementX=-110 +PlayerListElementY=-41 +PlayerListElementOffsetX=0 +PlayerListElementOffsetY=11 +PlayerListElementOnCommand=zoom,0.75 + +[ScreenSMOnlineSelectMusic] +PrevScreen="ScreenNetRoom" +Class="ScreenNetSelectMusic" +RoomSelectScreen="ScreenNetRoom" +Fallback="ScreenNetSelectMusic" + +[ModIcon] +TextX=0 +TextY=0 +TextOnCommand=maxwidth,40;uppercase,true;shadowlength,0;diffuse,color("#f6ff00") +CropTextToWidth=50 + +[ModIconSelectMusic] +Fallback="ModIcon" +TextY=-1 +TextOnCommand=maxwidth,38;uppercase,true;shadowlength,0 + +[ModIconRow] +NumModIcons=6 +ModIconOnCommand= +SpacingX=0 +SpacingY=52 +ModIconMetricsGroup="ModIcon" + +[ModIconRowSelectMusic] +Fallback="ModIconRow" +SpacingX=46 +SpacingY=0 +ModIconMetricsGroup="ModIconSelectMusic" + +[GraphDisplay] +BodyWidth=140 +BodyHeight=38 + +[ComboGraph] +BodyWidth=140 + +[ScreenNetEvaluation] +Class="ScreenNetEvaluation" +Fallback="ScreenEvaluationNormal" +NextScreen="ScreenProfileSave" + +# these three commands are deprecated: +UsersBGWidth=SCREEN_CENTER_X*0.6 +UsersBGHeight=SCREEN_HEIGHT*0.6 +UsersBGCommand=diffuse,color("0,0,0,0.25") + +UsersBGOnCommand=finishtweening;zoom,1.25 +UsersBGOffCommand=finishtweening;zoom,1 + +User1X=SCREEN_CENTER_X*0.35 +User1Y=SCREEN_CENTER_Y +User1OnCommand= +User1OffCommand= +#--# +UsersBG1X=SCREEN_CENTER_X*0.35 +UsersBG1Y=SCREEN_CENTER_Y*0.975 +UsersBG1OnCommand= +UsersBG1OffCommand= +#====# +User2X=SCREEN_CENTER_X*1.65 +User2Y=SCREEN_CENTER_Y +User2OnCommand= +User2OffCommand= +#--# +UsersBG2X=SCREEN_CENTER_X*1.65 +UsersBG2Y=SCREEN_CENTER_Y*0.975 +UsersBG2OnCommand= +UsersBG2OffCommand= + +UserDeSelCommand=finishtweening;linear,0.1;zoom,0.75 +UserSelCommand=finishtweening;linear,0.1;zoom,1.0 + +UserTier02OrBetterCommand=rainbowscroll,true + +UserDX=0 +UserDY=24 +UserOnCommand= +UserOffCommand= + +# Arcade +[ScreenLogo] +Fallback="ScreenAttract" +# +PrevScreen=Branch.Init() +NextScreen="ScreenHowToPlay" +StartScreen=Branch.TitleMenu() +# +ForceTimer=true +TimerSeconds=5 +# +TimerMetricsGroup="MenuTimerNoSound" +TimerOnCommand=visible,false + +[ScreenHowToPlay] +Class="ScreenHowToPlay" +Fallback="ScreenAttract" +# +ForceTimer=true +TimerSeconds=25 +# +PrevScreen="ScreenLogo" +NextScreen="ScreenDemonstration" +StartScreen=Branch.TitleMenu() +# +ResetGameState=false +SecondsToShow=25 +# +PlayMusic=true +# +UseLifeMeterBar=true +LifeMeterBarX=SCREEN_CENTER_X+160 +LifeMeterBarY=SCREEN_TOP+40 +LifeMeterBarOnCommand=addy,-60;sleep,2.4;linear,0.2;addy,60 +# +UseCharacter=true +CharacterName="" +CharacterX=SCREEN_CENTER_X-200 +CharacterY=SCREEN_CENTER_Y+160 +CharacterOnCommand=zoom,20;addy,-SCREEN_WIDTH;sleep,3.0;decelerate,0.4;addy,SCREEN_WIDTH +# +UsePad=true +PadX=SCREEN_CENTER_X-280 +PadY=SCREEN_CENTER_Y+70 +PadOnCommand=zoom,15;rotationy,180;sleep,2.0;linear,1.0;rotationy,360;zoom,20;addx,190;addy,80 +# +UsePlayer=true +PlayerX=SCREEN_CENTER_X+160 +PlayerY=SCREEN_CENTER_Y +PlayerOnCommand= +# +SongBPM=100 +NumW2s=4 +NumMisses=6 + +[ScreenTitleJoin] +Fallback="ScreenTitleMenu" +ChoiceNames="1" + +# ScrollerOnCommand=visible,false +# +IdleCommentSeconds=-1 +IdleTimeoutSeconds=-1 +IdleTimeoutScreen=Branch.AfterInit() +[ScreenDemonstration] +Fallback="ScreenGameplay" +Class="ScreenDemonstration" +# +NextScreen="ScreenInit" +StartScreen=Branch.TitleMenu() +PlayMusic=false +SecondsToShow=60 + +LightsMode="LightsMode_Demonstration" +DifficultiesToShow="easy,medium" +ShowCourseModifiersProbability=0 +AllowAdvancedModifiers=false +AllowStyleTypes="TwoPlayersTwoSides" + +MinSecondsToStep=0 +MinSecondsToMusic=0 + +[ScreenJukeboxMenu] +Class="ScreenOptionsMaster" +Fallback="ScreenPlayerOptions" +NextScreen="ScreenJukebox" +PrevScreen="ScreenTitleMenu" +TimerSeconds=-1 +ShowStyleIcon=false + +InputMode="together" +ForceAllPlayers=true + +LineNames="1,2,3,4" +Line1="list,Styles" +Line2="list,Groups" +Line3="list,Difficulties" +Line4="lua,OptionsRandomJukebox()" + +[ScreenJukebox] +Class="ScreenJukebox" +Fallback="ScreenGameplay" +NextScreen="ScreenJukebox" +StartScreen="ScreenTitleMenu" +LightsMode="LightsMode_Demonstration" +ShowCourseModifiersProbability=0 +AllowAdvancedModifiers=true diff --git a/Themes/_portKit-sm4/BGAnimations/_BLANK/default.lua b/Themes/_portKit-sm4/BGAnimations/_BLANK/default.lua index 4db94d96b7..d9ee45e348 100644 --- a/Themes/_portKit-sm4/BGAnimations/_BLANK/default.lua +++ b/Themes/_portKit-sm4/BGAnimations/_BLANK/default.lua @@ -1 +1 @@ -return Def.Actor { } +return Def.Actor { } diff --git a/Themes/_portKit-sm4/BGAnimations/_fade in normal.lua b/Themes/_portKit-sm4/BGAnimations/_fade in normal.lua index 32d9116dc7..bb49e9f421 100644 --- a/Themes/_portKit-sm4/BGAnimations/_fade in normal.lua +++ b/Themes/_portKit-sm4/BGAnimations/_fade in normal.lua @@ -1,4 +1,4 @@ -return Def.Quad { - InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM); - StartTransitioningCommand=cmd(diffusealpha,1;linear,0.3;diffusealpha,0); -}; +return Def.Quad { + InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM); + StartTransitioningCommand=cmd(diffusealpha,1;linear,0.3;diffusealpha,0); +}; diff --git a/Themes/_portKit-sm4/BGAnimations/_fade out normal.lua b/Themes/_portKit-sm4/BGAnimations/_fade out normal.lua index 78ef5a035f..97cf2139a7 100644 --- a/Themes/_portKit-sm4/BGAnimations/_fade out normal.lua +++ b/Themes/_portKit-sm4/BGAnimations/_fade out normal.lua @@ -1,5 +1,5 @@ -local t = Def.Quad { - InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM); - StartTransitioningCommand=cmd(diffusealpha,0;linear,0.3;diffusealpha,1); -}; -return t; +local t = Def.Quad { + InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM); + StartTransitioningCommand=cmd(diffusealpha,0;linear,0.3;diffusealpha,1); +}; +return t; diff --git a/Themes/_portKit-sm4/BGAnimations/_frame 3x1/default.lua b/Themes/_portKit-sm4/BGAnimations/_frame 3x1/default.lua index 72cc1cd50c..9673efba02 100644 --- a/Themes/_portKit-sm4/BGAnimations/_frame 3x1/default.lua +++ b/Themes/_portKit-sm4/BGAnimations/_frame 3x1/default.lua @@ -1,12 +1,12 @@ -local File, Width = ... -assert( File ); -assert( Width ); - -local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) -local Frame = LoadActor( FullFile ) - -return Def.ActorFrame { - Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; - Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; - Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; -}; +local File, Width = ... +assert( File ); +assert( Width ); + +local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) +local Frame = LoadActor( FullFile ) + +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; +}; diff --git a/Themes/_portKit-sm4/BGAnimations/_frame 3x3/default.lua b/Themes/_portKit-sm4/BGAnimations/_frame 3x3/default.lua index e5e403448c..be645fc354 100644 --- a/Themes/_portKit-sm4/BGAnimations/_frame 3x3/default.lua +++ b/Themes/_portKit-sm4/BGAnimations/_frame 3x3/default.lua @@ -1,18 +1,18 @@ -local File, Width, Height = ... -assert( File ); -assert( Width ); -assert( Height ); - -local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) -local Frame = LoadActor( FullFile ) -return Def.ActorFrame { - Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; - Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; - Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; -}; +local File, Width, Height = ... +assert( File ); +assert( Width ); +assert( Height ); + +local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) +local Frame = LoadActor( FullFile ) +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; +}; diff --git a/Themes/_portKit-sm4/BGAnimations/_menu in.lua b/Themes/_portKit-sm4/BGAnimations/_menu in.lua index 90e8da4bfe..5688d29bed 100644 --- a/Themes/_portKit-sm4/BGAnimations/_menu in.lua +++ b/Themes/_portKit-sm4/BGAnimations/_menu in.lua @@ -1,8 +1,8 @@ -return Def.ActorFrame { - LoadActor( THEME:GetPathS("", "_swoosh normal") ) .. { - --StartTransitioningCommand=cmd(play); - }; - LoadActor("_moveon") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,1;linear,0.2;diffusealpha,0;zoomx,1;zoomy,0;); - }; -}; +return Def.ActorFrame { + LoadActor( THEME:GetPathS("", "_swoosh normal") ) .. { + --StartTransitioningCommand=cmd(play); + }; + LoadActor("_moveon") .. { + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,1;linear,0.2;diffusealpha,0;zoomx,1;zoomy,0;); + }; +}; diff --git a/Themes/_portKit-sm4/BGAnimations/_menu out.lua b/Themes/_portKit-sm4/BGAnimations/_menu out.lua index 077d4c9bc0..b3c5e7ce9c 100644 --- a/Themes/_portKit-sm4/BGAnimations/_menu out.lua +++ b/Themes/_portKit-sm4/BGAnimations/_menu out.lua @@ -1,8 +1,8 @@ -return Def.ActorFrame { - LoadActor( THEME:GetPathS("", "_swoosh normal") ) .. { - --StartTransitioningCommand=cmd(play); - }; - LoadActor("_moveon") .. { - OnCommand=cmd(hibernate,0.1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomx,1;zoomy,0;diffusealpha,0;linear,0.35;diffusealpha,1;zoom,1); - }; -}; +return Def.ActorFrame { + LoadActor( THEME:GetPathS("", "_swoosh normal") ) .. { + --StartTransitioningCommand=cmd(play); + }; + LoadActor("_moveon") .. { + OnCommand=cmd(hibernate,0.1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomx,1;zoomy,0;diffusealpha,0;linear,0.35;diffusealpha,1;zoom,1); + }; +}; diff --git a/Themes/_portKit-sm4/BGAnimations/_shared background fade in.lua b/Themes/_portKit-sm4/BGAnimations/_shared background fade in.lua index d0edb11f59..faca8e44b5 100644 --- a/Themes/_portKit-sm4/BGAnimations/_shared background fade in.lua +++ b/Themes/_portKit-sm4/BGAnimations/_shared background fade in.lua @@ -1,8 +1,8 @@ -local t = Def.ActorFrame { }; - -t[#t+1] = LoadActor( THEME:GetPathB("","_shared background normal") ); -t[#t+1] = LoadActor( THEME:GetPathB("","_fade in normal") ) .. { - OnCommand=cmd(playcommand,"StartTransitioning"); -}; - -return t; +local t = Def.ActorFrame { }; + +t[#t+1] = LoadActor( THEME:GetPathB("","_shared background normal") ); +t[#t+1] = LoadActor( THEME:GetPathB("","_fade in normal") ) .. { + OnCommand=cmd(playcommand,"StartTransitioning"); +}; + +return t; diff --git a/Themes/_portKit-sm4/Fonts/_16px fonts.ini b/Themes/_portKit-sm4/Fonts/_16px fonts.ini index daa2812e48..5cf748e2c5 100644 --- a/Themes/_portKit-sm4/Fonts/_16px fonts.ini +++ b/Themes/_portKit-sm4/Fonts/_16px fonts.ini @@ -1,7 +1,7 @@ -# This "font" just pulls in default characters for a 16-pixel -# font. Other import fonts can be created for other sizes. - -# Also, themes can create new fonts, and overload this file to -# have them pulled in for every 16-pixel font. -[main] -import=_meiryo Bold 16px,_korean 16px,_misc 16px,_game chars 16px +# This "font" just pulls in default characters for a 16-pixel +# font. Other import fonts can be created for other sizes. + +# Also, themes can create new fonts, and overload this file to +# have them pulled in for every 16-pixel font. +[main] +import=_meiryo Bold 16px,_korean 16px,_misc 16px,_game chars 16px diff --git a/Themes/_portKit-sm4/Fonts/_20px fonts.ini b/Themes/_portKit-sm4/Fonts/_20px fonts.ini index 10783d1c44..ec67bd3685 100644 --- a/Themes/_portKit-sm4/Fonts/_20px fonts.ini +++ b/Themes/_portKit-sm4/Fonts/_20px fonts.ini @@ -1,15 +1,15 @@ -# This "font" just pulls in default characters for a 20-pixel -# font. Other import fonts can be created for other sizes. - -# Also, themes can create new fonts, and overload this file to -# have them pulled in for every 20-pixel font. -[main] -# We don't have a 20px Japanese font, so use the 24px one instead; -# pulling in a Kanji font that's a little too big looks fine, but -# pulling in one that's a little too small looks bad. - -# The characters in _game chars 16px are actually very large; they'll -# look fine here, too. - -import=_japanese 24px,_korean 24px,_game chars 16px -# XXX ,_misc 16px +# This "font" just pulls in default characters for a 20-pixel +# font. Other import fonts can be created for other sizes. + +# Also, themes can create new fonts, and overload this file to +# have them pulled in for every 20-pixel font. +[main] +# We don't have a 20px Japanese font, so use the 24px one instead; +# pulling in a Kanji font that's a little too big looks fine, but +# pulling in one that's a little too small looks bad. + +# The characters in _game chars 16px are actually very large; they'll +# look fine here, too. + +import=_japanese 24px,_korean 24px,_game chars 16px +# XXX ,_misc 16px diff --git a/Themes/_portKit-sm4/Fonts/_korean 16px.ini b/Themes/_portKit-sm4/Fonts/_korean 16px.ini index 4131570c84..8e4867e424 100644 --- a/Themes/_portKit-sm4/Fonts/_korean 16px.ini +++ b/Themes/_portKit-sm4/Fonts/_korean 16px.ini @@ -1,46 +1,46 @@ -[common] -Top=8 -Baseline=23 -LineSpacing=20 -DefaultWidth=20 -TextureHints=grayscale 16bpp - -[jamo 1] -line 0=경고교굴기길나넛 -line 1=놀누는니단도듀라 -line 2=랑래랩레련로론루 -line 3=를리막매맨머몽밀 -line 4=바박배뱃뱩뱻벗브 -line 5=삐사샤서션스승신 -line 6=써쓰애야어에영옝 -line 7=와요워위유윤이잉 - -[jamo 2] -line 0=자잦잭젠준지직찾 -line 1=책초치캉커쿨크클 -line 2=키타틴파팍패플피 -line 3=하허혁현혠화정꿔 -line 4=와부담별컨츄꼬백 -line 5=호심아름다운대한 -line 6=민국성숙가감강같 -line 7=거건검게곡과구그 - -[jamo 3] -line 0=김께꼭꾸꿍난널네 -line 1=녀논눈님더돌둥드 -line 2=들따때또뛰띠렁렛 -line 3=룰른만말면모몰뫼 -line 4=뭐미발밴봐비뻐뻤 -line 5=뿌상소속수싫않알 -line 6=양억언엄업여연예 -line 7=오올우울원은을의 - - -[jamo 4] -line 0=잊제젝조존좋줘증 -line 1=진집짜착찬처추칼 -line 2=큰탑터투트티펌페 -line 3=폼핑할함해행헤혀 -line 4=환회휘태난터까시 -line 5=간너샐러버문쳐달 -line 6=깡천림홍석 +[common] +Top=8 +Baseline=23 +LineSpacing=20 +DefaultWidth=20 +TextureHints=grayscale 16bpp + +[jamo 1] +line 0=경고교굴기길나넛 +line 1=놀누는니단도듀라 +line 2=랑래랩레련로론루 +line 3=를리막매맨머몽밀 +line 4=바박배뱃뱩뱻벗브 +line 5=삐사샤서션스승신 +line 6=써쓰애야어에영옝 +line 7=와요워위유윤이잉 + +[jamo 2] +line 0=자잦잭젠준지직찾 +line 1=책초치캉커쿨크클 +line 2=키타틴파팍패플피 +line 3=하허혁현혠화정꿔 +line 4=와부담별컨츄꼬백 +line 5=호심아름다운대한 +line 6=민국성숙가감강같 +line 7=거건검게곡과구그 + +[jamo 3] +line 0=김께꼭꾸꿍난널네 +line 1=녀논눈님더돌둥드 +line 2=들따때또뛰띠렁렛 +line 3=룰른만말면모몰뫼 +line 4=뭐미발밴봐비뻐뻤 +line 5=뿌상소속수싫않알 +line 6=양억언엄업여연예 +line 7=오올우울원은을의 + + +[jamo 4] +line 0=잊제젝조존좋줘증 +line 1=진집짜착찬처추칼 +line 2=큰탑터투트티펌페 +line 3=폼핑할함해행헤혀 +line 4=환회휘태난터까시 +line 5=간너샐러버문쳐달 +line 6=깡천림홍석 diff --git a/Themes/_portKit-sm4/Fonts/_korean 24px.ini b/Themes/_portKit-sm4/Fonts/_korean 24px.ini index 6516d246c4..1e8c45164f 100644 --- a/Themes/_portKit-sm4/Fonts/_korean 24px.ini +++ b/Themes/_portKit-sm4/Fonts/_korean 24px.ini @@ -1,45 +1,45 @@ -[common] -Top=5 -Baseline=26 -LineSpacing=28 -DefaultWidth=28 -TextureHints=grayscale 16bpp - -[jamo 1] -line 0=경고교굴기길나넛 -line 1=놀누는니단도듀라 -line 2=랑래랩레련로론루 -line 3=를리막매맨머몽밀 -line 4=바박배뱃뱩뱻벗브 -line 5=삐사샤서션스승신 -line 6=써쓰애야어에영옝 -line 7=와요워위유윤이잉 - -[jamo 2] -line 0=자잦잭젠준지직찾 -line 1=책초치캉커쿨크클 -line 2=키타틴파팍패플피 -line 3=하허혁현혠화정꿔 -line 4=와부담별컨츄꼬백 -line 5=호심아름다운대한 -line 6=민국성숙가감강같 -line 7=거건검게곡과구그 - -[jamo 3] -line 0=김께꼭꾸꿍난널네 -line 1=녀논눈님더돌둥드 -line 2=들따때또뛰띠렁렛 -line 3=룰른만말면모몰뫼 -line 4=뭐미발밴봐비뻐뻤 -line 5=뿌상소속수싫않알 -line 6=양억언엄업여연예 -line 7=오올우울원은을의 - -[jamo 4] -line 0=잊제젝조존좋줘증 -line 1=진집짜착찬처추칼 -line 2=큰탑터투트티펌페 -line 3=폼핑할함해행헤혀 -line 4=환회휘태난터까시 -line 5=간너샐러버문쳐달 -line 6=깡천림홍석 +[common] +Top=5 +Baseline=26 +LineSpacing=28 +DefaultWidth=28 +TextureHints=grayscale 16bpp + +[jamo 1] +line 0=경고교굴기길나넛 +line 1=놀누는니단도듀라 +line 2=랑래랩레련로론루 +line 3=를리막매맨머몽밀 +line 4=바박배뱃뱩뱻벗브 +line 5=삐사샤서션스승신 +line 6=써쓰애야어에영옝 +line 7=와요워위유윤이잉 + +[jamo 2] +line 0=자잦잭젠준지직찾 +line 1=책초치캉커쿨크클 +line 2=키타틴파팍패플피 +line 3=하허혁현혠화정꿔 +line 4=와부담별컨츄꼬백 +line 5=호심아름다운대한 +line 6=민국성숙가감강같 +line 7=거건검게곡과구그 + +[jamo 3] +line 0=김께꼭꾸꿍난널네 +line 1=녀논눈님더돌둥드 +line 2=들따때또뛰띠렁렛 +line 3=룰른만말면모몰뫼 +line 4=뭐미발밴봐비뻐뻤 +line 5=뿌상소속수싫않알 +line 6=양억언엄업여연예 +line 7=오올우울원은을의 + +[jamo 4] +line 0=잊제젝조존좋줘증 +line 1=진집짜착찬처추칼 +line 2=큰탑터투트티펌페 +line 3=폼핑할함해행헤혀 +line 4=환회휘태난터까시 +line 5=간너샐러버문쳐달 +line 6=깡천림홍석 diff --git a/Themes/_portKit-sm4/Fonts/_meiryo Bold 16px.ini b/Themes/_portKit-sm4/Fonts/_meiryo Bold 16px.ini index 51ca324bb6..d23a307721 100644 --- a/Themes/_portKit-sm4/Fonts/_meiryo Bold 16px.ini +++ b/Themes/_portKit-sm4/Fonts/_meiryo Bold 16px.ini @@ -1,7584 +1,7584 @@ -[common] -Baseline=18 -Top=9 -LineSpacing=24 -DrawExtraPixelsLeft=1 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 - -[main] -range basic-japanese=0 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=7 -31=16 -32=16 -33=20 -34=20 -35=20 -36=20 -37=20 -38=20 -39=20 -40=20 -41=20 -42=20 -43=20 -44=20 -45=20 -46=20 -47=20 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=20 -57=20 -58=20 -59=16 -60=16 -61=16 -62=20 -63=20 -64=20 -65=16 -66=16 -67=16 -68=16 -69=16 -70=16 -71=16 -72=16 -73=16 -74=16 -75=16 -76=16 -77=16 -78=16 -79=16 -80=16 -81=16 -82=16 -83=16 -84=16 -85=16 -86=16 -87=16 -88=16 -89=16 -90=16 -91=16 -92=16 -93=16 -94=16 -95=16 -96=16 -97=16 -98=16 -99=16 -100=16 -101=16 -102=16 -103=16 -104=16 -105=16 -106=16 -107=16 -108=16 -109=16 -110=16 -111=16 -112=16 -113=16 -114=16 -115=16 -116=16 -117=16 -118=16 -119=16 -120=16 -121=16 -122=16 -123=16 -124=16 -125=16 -126=16 -127=16 -128=16 -129=16 -130=16 -131=16 -132=16 -133=16 -134=16 -135=16 -136=16 -137=16 -138=16 -139=16 -140=16 -141=16 -142=16 -143=16 -144=16 -145=16 -146=16 -147=16 -148=16 -149=16 -150=16 -151=20 -152=20 -153=16 -154=16 -155=16 -156=16 -157=16 -158=16 -159=16 -160=16 -161=16 -162=16 -163=16 -164=16 -165=16 -166=16 -167=16 -168=16 -169=16 -170=16 -171=16 -172=16 -173=16 -174=16 -175=16 -176=16 -177=16 -178=16 -179=16 -180=16 -181=16 -182=16 -183=16 -184=16 -185=16 -186=16 -187=16 -188=16 -189=16 -190=16 -191=16 -192=16 -193=16 -194=16 -195=16 -196=16 -197=16 -198=16 -199=16 -200=16 -201=16 -202=16 -203=16 -204=16 -205=16 -206=16 -207=16 -208=16 -209=16 -210=16 -211=16 -212=16 -213=16 -214=16 -215=16 -216=16 -217=16 -218=16 -219=16 -220=16 -221=16 -222=16 -223=16 -224=16 -225=16 -226=16 -227=16 -228=16 -229=16 -230=16 -231=16 -232=16 -233=16 -234=16 -235=16 -236=16 -237=16 -238=16 -239=16 -240=16 -241=16 -242=16 -243=16 -244=16 -245=16 -246=16 -247=16 -248=16 -249=16 -250=16 -251=16 -252=16 -253=16 -254=16 -255=16 - -[kanji 1] -Line 0=難易定変更押画曲 -Line 1=現在選択項目同設 -Line 2=開閉内覧表示詳細 -Line 3=及作矢印場警告可 -Line 4=能性処理速数値超 -Line 5=効使特固省略出詞 -Line 6=操全演奏進点機移 -Line 7=左右変更以外背景 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 2] -Line 0=義背景危険状態習 -Line 1=譜判減少率適増加 -Line 2=無終了関係参考他 -Line 3=言変換評価条件突 -Line 4=事追不切常除次等 -Line 5=低戻厳残基途非制 -Line 6=限配保存秒反応専 -Line 7=誤防整央隠僕援起 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 3] -Line 0=相撲屋何穴名例匂 -Line 1=心揺鼻当腹鳴痢便 -Line 2=尻拭鋼雫暗黒迷路 -Line 3=探検前員浮駐接続 -Line 4=類士諸君品物困声 -Line 5=口調食党結婚身久 -Line 6=友電話廃休酒飲引 -Line 7=篭奴学職手葉宿馬 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 4] -Line 0=京宿浪暮横巣鴨優 -Line 1=居思手線回続分然 -Line 2=取達聴最字辞書独 -Line 3=季節俺正対街町渋 -Line 4=姿笑隣病院開頂科 -Line 5=先眞弓沢氷恭国耳 -Line 6=今逝元予報分秘密 -Line 7=物罰望峰巫工業社 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 5] -Line 0=~φ∞:堂妹瀬川 -Line 1=飛巻機山條浦森員 -Line 2=同清水座勉強集合 -Line 3=急止出内則世界秒 -Line 4=数徳香百千葉紗静 -Line 5=星米尋慎吾岡竹梨 -Line 6=柴矢魍魎遊撃隊里 -Line 7=賀玲福芳 - -0=16 -1=14 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 - -[kanji 6] -Line 0=島礼戸桃麦仁智赤 -Line 1=車歌知華王先行者 -Line 2=願愛唄結婚素直陽 -Line 3=宇宙海賊冒険門外 -Line 4=早重番際通再像鮮 -Line 5=量必要種待具質消 -Line 6=去宮計算降象忘漕 -Line 7=滅問船乗旅確過壊 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 7] -Line 0=深都築鍋行脚獣登 -Line 1=雨始約束所虹彩澄 -Line 2=頃年巡交幼供年詰 -Line 3=草誓孤詩意味排溝 -Line 4=刻付良走我謳的支 -Line 5=台匹東薄味噌抜汁 -Line 6=役熊惚片持校受験 -Line 7=聞競争激為懸格白 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 8] -Line 0=余答発寂卒親孝立 -Line 1=派局縁詮滑拝喜毀 -Line 2=干懲号敗堪絶指仕 -Line 3=胆些細慢首傾己主 -Line 4=振返微妙雷塩幽霊 -Line 5=楽団遠捨苦感威散 -Line 6=賭摩李夫舞鷺須雲 -Line 7=流誰転留駄源教呼 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 - -[kanji 9] -Line 0=逆足練違照帽半距 -Line 1=離弟脇兄完璧救誘 -Line 2=拐技踏雪越緑押赫 -Line 3=染御嫌糞医療査鑑 -Line 4=賞編削領向段階殊 -Line 5=果級向腕透前復位 -Line 6=唱青顔叫描殿掃戯 -Line 7=怖底河祝匁宝暦 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 - -[symbol] -Line 0=&()?!/‥^…@$#”+=¥;<>・「」{}%* -Line 1=abcdefghijklmnopqrstyvwxyz -Line 2=ABCDEFGHIJKLMNOPQRSTYVWXYZ - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=9 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 -64=16 -65=16 -66=16 -67=16 -68=16 -69=16 -70=16 -71=16 -72=16 -73=16 -74=16 -75=16 -76=16 -77=16 - -[kanji-regular] -Line 0=亜哀愛悪握圧扱安暗案以位依偉囲委威尉意慰易為異移維緯胃衣違遺医井 -Line 1=域育一壱逸稲芋印員因姻引飲院陰隠韻右宇羽雨渦浦運雲営影映栄永泳英 -Line 2=衛詠鋭液疫益駅悦謁越閲円園宴延援沿演炎煙猿縁遠鉛塩汚凹央奥往応押 -Line 3=横欧殴王翁黄沖億屋憶乙卸恩温穏音下化仮何価佳加可夏嫁家寡科暇果架 -Line 4=歌河火禍稼箇花荷華菓課貨過蚊我画芽賀雅餓介会解回塊壊快怪悔懐戒拐 -Line 5=改械海灰界皆絵開階貝劾外害慨概涯街該垣嚇各拡格核殻獲確穫覚角較郭 -Line 6=閣隔革学岳楽額掛潟割喝括活渇滑褐轄且株刈乾冠寒刊勘勧巻喚堪完官寛 -Line 7=干幹患感慣憾換敢棺款歓汗漢環甘監看管簡緩缶肝艦観貫還鑑間閑関陥館 -Line 8=丸含岸眼岩頑顔願企危喜器基奇寄岐希幾忌揮机旗既期棋棄機帰気汽祈季 -Line 9=紀規記貴起軌輝飢騎鬼偽儀宜戯技擬欺犠疑義議菊吉喫詰却客脚虐逆丘久 -Line 10=休及吸宮弓急救朽求泣球究窮級糾給旧牛去居巨拒拠挙虚許距漁魚享京供 -Line 11=競共凶協叫境峡強恐恭挟教橋況狂狭矯胸脅興郷鏡響驚仰凝暁業局曲極玉 -Line 12=勤均斤琴禁筋緊菌襟謹近金吟銀九句区苦駆具愚虞空偶遇隅屈掘靴繰桑勲 -Line 13=君薫訓群軍郡係傾刑兄啓型契形径恵慶憩掲携敬景渓系経継茎蛍計警軽鶏 -Line 14=芸迎鯨劇撃激傑欠決潔穴結血月件倹健兼券剣圏堅嫌建憲懸検権犬献研絹 -Line 15=県肩見謙賢軒遣険顕験元原厳幻弦減源玄現言限個古呼固孤己庫弧戸故枯 -Line 16=湖誇雇顧鼓五互午呉娯後御悟碁語誤護交侯候光公功効厚口向后坑好孔孝 -Line 17=工巧幸広康恒慌抗拘控攻更校構江洪港溝甲皇硬稿紅絞綱耕考肯航荒行衡 -Line 18=講貢購郊酵鉱鋼降項香高剛号合拷豪克刻告国穀酷黒獄腰骨込今困墾婚恨 -Line 19=懇昆根混紺魂佐唆左差査砂詐鎖座債催再最妻宰彩才採栽歳済災砕祭斎細 -Line 20=菜裁載際剤在材罪財坂咲崎作削搾昨策索錯桜冊刷察撮擦札殺雑皿三傘参 -Line 21=山惨散桟産算蚕賛酸暫残仕伺使刺司史嗣四士始姉姿子市師志思指支施旨 -Line 22=枝止死氏祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時 -Line 23=次滋治璽磁示耳自辞式識軸七執失室湿漆疾質実芝舎写射捨赦斜煮社者謝 -Line 24=車遮蛇邪借勺尺爵酌釈若寂弱主取守手朱殊狩珠種趣酒首儒受寿授樹需囚 -Line 25=収周宗就州修愁拾秀秋終習臭舟衆襲週酬集醜住充十従柔汁渋獣縦重銃叔 -Line 26=宿淑祝縮粛塾熟出術述俊春瞬准循旬殉準潤盾純巡遵順処初所暑庶緒署書 -Line 27=諸助叙女序徐除傷償勝匠升召商唱奨宵将小少尚床彰承抄招掌昇昭晶松沼 -Line 28=消渉焼焦照症省硝礁祥称章笑粧紹肖衝訟証詔詳象賞鐘障上丈乗冗剰城場 -Line 29=壌嬢常情条浄状畳蒸譲醸錠嘱飾植殖織職色触食辱伸信侵唇娠寝審心慎振 -Line 30=新森浸深申真神紳臣薪親診身辛進針震人仁刃尋甚尽迅陣酢図吹垂帥推水 -Line 31=炊睡粋衰遂酔錘随髄崇数枢据杉澄寸世瀬畝是制勢姓征性成政整星晴正清 -Line 32=牲生盛精聖声製西誠誓請逝青静斉税隻席惜斥昔析石積籍績責赤跡切拙接 -Line 33=摂折設窃節説雪絶舌仙先千占宣専川戦扇栓泉浅洗染潜旋線繊船薦践選遷 -Line 34=銭銑鮮前善漸然全禅繕塑措疎礎祖租粗素組訴阻僧創双倉喪壮奏層想捜掃 -Line 35=挿操早曹巣槽燥争相窓総草荘葬藻装走送遭霜騒像増憎臓蔵贈造促側則即 -Line 36=息束測足速俗属賊族続卒存孫尊損村他多太堕妥惰打駄体対耐帯待怠態替 -Line 37=泰滞胎袋貸退逮隊代台大第題滝卓宅択拓沢濯託濁諾但達奪脱棚谷丹単嘆 -Line 38=担探淡炭短端胆誕鍛団壇弾断暖段男談値知地恥池痴稚置致遅築畜竹蓄逐 -Line 39=秩窒茶嫡着中仲宙忠抽昼柱注虫衷鋳駐著貯丁兆帳庁弔張彫徴懲挑朝潮町 -Line 40=眺聴脹腸調超跳長頂鳥勅直朕沈珍賃鎮陳津墜追痛通塚漬坪釣亭低停偵貞 -Line 41=呈堤定帝底庭廷弟抵提程締艇訂逓邸泥摘敵滴的笛適哲徹撤迭鉄典天展店 -Line 42=添転点伝殿田電吐塗徒斗渡登途都努度土奴怒倒党冬凍刀唐塔島悼投搭東 -Line 43=桃棟盗湯灯当痘等答筒糖統到討謄豆踏逃透陶頭騰闘働動同堂導洞童胴道 -Line 44=銅峠匿得徳特督篤毒独読凸突届屯豚曇鈍内縄南軟難二尼弐肉日乳入如尿 -Line 45=任妊忍認寧猫熱年念燃粘悩濃納能脳農把覇波派破婆馬俳廃拝排敗杯背肺 -Line 46=輩配倍培媒梅買売賠陪伯博拍泊白舶薄迫漠爆縛麦箱肌畑八鉢発髪伐罰抜 -Line 47=閥伴判半反帆搬板版犯班畔繁般藩販範煩頒飯晩番盤蛮卑否妃彼悲扉批披 -Line 48=比泌疲皮碑秘罷肥被費避非飛備尾微美鼻匹必筆姫百俵標氷漂票表評描病 -Line 49=秒苗品浜貧賓頻敏瓶不付夫婦富布府怖扶敷普浮父符腐膚譜負賦赴附侮武 -Line 50=舞部封風伏副復幅服福腹複覆払沸仏物分噴墳憤奮粉紛雰文聞丙併兵塀幣 -Line 51=平弊柄並閉陛米壁癖別偏変片編辺返遍便勉弁保舗捕歩補穂募墓慕暮母簿 -Line 52=倣俸包報奉宝峰崩抱放方法泡砲縫胞芳褒訪豊邦飽乏亡傍剖坊妨帽忘忙房 -Line 53=暴望某棒冒紡肪膨謀貿防北僕墨撲朴牧没堀奔本翻凡盆摩磨魔麻埋妹枚毎 -Line 54=幕膜又抹末繭万慢満漫味未魅岬密脈妙民眠務夢無矛霧婿娘名命明盟迷銘 -Line 55=鳴滅免綿面模茂妄毛猛盲網耗木黙目戻問紋門匁夜野矢厄役約薬訳躍柳愉 -Line 56=油癒諭輸唯優勇友幽悠憂有猶由裕誘遊郵雄融夕予余与誉預幼容庸揚揺擁 -Line 57=曜様洋溶用窯羊葉要謡踊陽養抑欲浴翌翼羅裸来頼雷絡落酪乱卵欄濫覧利 -Line 58=吏履理痢裏里離陸律率立略流留硫粒隆竜慮旅虜了僚両寮料涼猟療糧良量 -Line 59=陵領力緑倫厘林臨輪隣塁涙累類令例冷励礼鈴隷零霊麗齢暦歴列劣烈裂廉 -Line 60=恋練連錬炉路露労廊朗楼浪漏老郎六録論和話賄惑枠湾腕 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 -64=16 -65=16 -66=16 -67=16 -68=16 -69=16 -70=16 -71=16 -72=16 -73=16 -74=16 -75=16 -76=16 -77=16 -78=16 -79=16 -80=16 -81=16 -82=16 -83=16 -84=16 -85=16 -86=16 -87=16 -88=16 -89=16 -90=16 -91=16 -92=16 -93=16 -94=16 -95=16 -96=16 -97=16 -98=16 -99=16 -100=16 -101=16 -102=16 -103=16 -104=16 -105=16 -106=16 -107=16 -108=16 -109=16 -110=16 -111=16 -112=16 -113=16 -114=16 -115=16 -116=16 -117=16 -118=16 -119=16 -120=16 -121=16 -122=16 -123=16 -124=16 -125=16 -126=16 -127=16 -128=16 -129=16 -130=16 -131=16 -132=16 -133=16 -134=16 -135=16 -136=16 -137=16 -138=16 -139=16 -140=16 -141=16 -142=16 -143=16 -144=16 -145=16 -146=16 -147=16 -148=16 -149=16 -150=16 -151=16 -152=16 -153=16 -154=16 -155=16 -156=16 -157=16 -158=16 -159=16 -160=16 -161=16 -162=16 -163=16 -164=16 -165=16 -166=16 -167=16 -168=16 -169=16 -170=16 -171=16 -172=16 -173=16 -174=16 -175=16 -176=16 -177=16 -178=16 -179=16 -180=16 -181=16 -182=16 -183=16 -184=16 -185=16 -186=16 -187=16 -188=16 -189=16 -190=16 -191=16 -192=16 -193=16 -194=16 -195=16 -196=16 -197=16 -198=16 -199=16 -200=16 -201=16 -202=16 -203=16 -204=16 -205=16 -206=16 -207=16 -208=16 -209=16 -210=16 -211=16 -212=16 -213=16 -214=16 -215=16 -216=16 -217=16 -218=16 -219=16 -220=16 -221=16 -222=16 -223=16 -224=16 -225=16 -226=16 -227=16 -228=16 -229=16 -230=16 -231=16 -232=16 -233=16 -234=16 -235=16 -236=16 -237=16 -238=16 -239=16 -240=16 -241=16 -242=16 -243=16 -244=16 -245=16 -246=16 -247=16 -248=16 -249=16 -250=16 -251=16 -252=16 -253=16 -254=16 -255=16 -256=16 -257=16 -258=16 -259=16 -260=16 -261=16 -262=16 -263=16 -264=16 -265=16 -266=16 -267=16 -268=16 -269=16 -270=16 -271=16 -272=16 -273=16 -274=16 -275=16 -276=16 -277=16 -278=16 -279=16 -280=16 -281=16 -282=16 -283=16 -284=16 -285=16 -286=16 -287=16 -288=16 -289=16 -290=16 -291=16 -292=16 -293=16 -294=16 -295=16 -296=16 -297=16 -298=16 -299=16 -300=16 -301=16 -302=16 -303=16 -304=16 -305=16 -306=16 -307=16 -308=16 -309=16 -310=16 -311=16 -312=16 -313=16 -314=16 -315=16 -316=16 -317=16 -318=16 -319=16 -320=16 -321=16 -322=16 -323=16 -324=16 -325=16 -326=16 -327=16 -328=16 -329=16 -330=16 -331=16 -332=16 -333=16 -334=16 -335=16 -336=16 -337=16 -338=16 -339=16 -340=16 -341=16 -342=16 -343=16 -344=16 -345=16 -346=16 -347=16 -348=16 -349=16 -350=16 -351=16 -352=16 -353=16 -354=16 -355=16 -356=16 -357=16 -358=16 -359=16 -360=16 -361=16 -362=16 -363=16 -364=16 -365=16 -366=16 -367=16 -368=16 -369=16 -370=16 -371=16 -372=16 -373=16 -374=16 -375=16 -376=16 -377=16 -378=16 -379=16 -380=16 -381=16 -382=16 -383=16 -384=16 -385=16 -386=16 -387=16 -388=16 -389=16 -390=16 -391=16 -392=16 -393=16 -394=16 -395=16 -396=16 -397=16 -398=16 -399=16 -400=16 -401=16 -402=16 -403=16 -404=16 -405=16 -406=16 -407=16 -408=16 -409=16 -410=16 -411=16 -412=16 -413=16 -414=16 -415=16 -416=16 -417=16 -418=16 -419=16 -420=16 -421=16 -422=16 -423=16 -424=16 -425=16 -426=16 -427=16 -428=16 -429=16 -430=16 -431=16 -432=16 -433=16 -434=16 -435=16 -436=16 -437=16 -438=16 -439=16 -440=16 -441=16 -442=16 -443=16 -444=16 -445=16 -446=16 -447=16 -448=16 -449=16 -450=16 -451=16 -452=16 -453=16 -454=16 -455=16 -456=16 -457=16 -458=16 -459=16 -460=16 -461=16 -462=16 -463=16 -464=16 -465=16 -466=16 -467=16 -468=16 -469=16 -470=16 -471=16 -472=16 -473=16 -474=16 -475=16 -476=16 -477=16 -478=16 -479=16 -480=16 -481=16 -482=16 -483=16 -484=16 -485=16 -486=16 -487=16 -488=16 -489=16 -490=16 -491=16 -492=16 -493=16 -494=16 -495=16 -496=16 -497=16 -498=16 -499=16 -500=16 -501=16 -502=16 -503=16 -504=16 -505=16 -506=16 -507=16 -508=16 -509=16 -510=16 -511=16 -512=16 -513=16 -514=16 -515=16 -516=16 -517=16 -518=16 -519=16 -520=16 -521=16 -522=16 -523=16 -524=16 -525=16 -526=16 -527=16 -528=16 -529=16 -530=16 -531=16 -532=16 -533=16 -534=16 -535=16 -536=16 -537=16 -538=16 -539=16 -540=16 -541=16 -542=16 -543=16 -544=16 -545=16 -546=16 -547=16 -548=16 -549=16 -550=16 -551=16 -552=16 -553=16 -554=16 -555=16 -556=16 -557=16 -558=16 -559=16 -560=16 -561=16 -562=16 -563=16 -564=16 -565=16 -566=16 -567=16 -568=16 -569=16 -570=16 -571=16 -572=16 -573=16 -574=16 -575=16 -576=16 -577=16 -578=16 -579=16 -580=16 -581=16 -582=16 -583=16 -584=16 -585=16 -586=16 -587=16 -588=16 -589=16 -590=16 -591=16 -592=16 -593=16 -594=16 -595=16 -596=16 -597=16 -598=16 -599=16 -600=16 -601=16 -602=16 -603=16 -604=16 -605=16 -606=16 -607=16 -608=16 -609=16 -610=16 -611=16 -612=16 -613=16 -614=16 -615=16 -616=16 -617=16 -618=16 -619=16 -620=16 -621=16 -622=16 -623=16 -624=16 -625=16 -626=16 -627=16 -628=16 -629=16 -630=16 -631=16 -632=16 -633=16 -634=16 -635=16 -636=16 -637=16 -638=16 -639=16 -640=16 -641=16 -642=16 -643=16 -644=16 -645=16 -646=16 -647=16 -648=16 -649=16 -650=16 -651=16 -652=16 -653=16 -654=16 -655=16 -656=16 -657=16 -658=16 -659=16 -660=16 -661=16 -662=16 -663=16 -664=16 -665=16 -666=16 -667=16 -668=16 -669=16 -670=16 -671=16 -672=16 -673=16 -674=16 -675=16 -676=16 -677=16 -678=16 -679=16 -680=16 -681=16 -682=16 -683=16 -684=16 -685=16 -686=16 -687=16 -688=16 -689=16 -690=16 -691=16 -692=16 -693=16 -694=16 -695=16 -696=16 -697=16 -698=16 -699=16 -700=16 -701=16 -702=16 -703=16 -704=16 -705=16 -706=16 -707=16 -708=16 -709=16 -710=16 -711=16 -712=16 -713=16 -714=16 -715=16 -716=16 -717=16 -718=16 -719=16 -720=16 -721=16 -722=16 -723=16 -724=16 -725=16 -726=16 -727=16 -728=16 -729=16 -730=16 -731=16 -732=16 -733=16 -734=16 -735=16 -736=16 -737=16 -738=16 -739=16 -740=16 -741=16 -742=16 -743=16 -744=16 -745=16 -746=16 -747=16 -748=16 -749=16 -750=16 -751=16 -752=16 -753=16 -754=16 -755=16 -756=16 -757=16 -758=16 -759=16 -760=16 -761=16 -762=16 -763=16 -764=16 -765=16 -766=16 -767=16 -768=16 -769=16 -770=16 -771=16 -772=16 -773=16 -774=16 -775=16 -776=16 -777=16 -778=16 -779=16 -780=16 -781=16 -782=16 -783=16 -784=16 -785=16 -786=16 -787=16 -788=16 -789=16 -790=16 -791=16 -792=16 -793=16 -794=16 -795=16 -796=16 -797=16 -798=16 -799=16 -800=16 -801=16 -802=16 -803=16 -804=16 -805=16 -806=16 -807=16 -808=16 -809=16 -810=16 -811=16 -812=16 -813=16 -814=16 -815=16 -816=16 -817=16 -818=16 -819=16 -820=16 -821=16 -822=16 -823=16 -824=16 -825=16 -826=16 -827=16 -828=16 -829=16 -830=16 -831=16 -832=16 -833=16 -834=16 -835=16 -836=16 -837=16 -838=16 -839=16 -840=16 -841=16 -842=16 -843=16 -844=16 -845=16 -846=16 -847=16 -848=16 -849=16 -850=16 -851=16 -852=16 -853=16 -854=16 -855=16 -856=16 -857=16 -858=16 -859=16 -860=16 -861=16 -862=16 -863=16 -864=16 -865=16 -866=16 -867=16 -868=16 -869=16 -870=16 -871=16 -872=16 -873=16 -874=16 -875=16 -876=16 -877=16 -878=16 -879=16 -880=16 -881=16 -882=16 -883=16 -884=16 -885=16 -886=16 -887=16 -888=16 -889=16 -890=16 -891=16 -892=16 -893=16 -894=16 -895=16 -896=16 -897=16 -898=16 -899=16 -900=16 -901=16 -902=16 -903=16 -904=16 -905=16 -906=16 -907=16 -908=16 -909=16 -910=16 -911=16 -912=16 -913=16 -914=16 -915=16 -916=16 -917=16 -918=16 -919=16 -920=16 -921=16 -922=16 -923=16 -924=16 -925=16 -926=16 -927=16 -928=16 -929=16 -930=16 -931=16 -932=16 -933=16 -934=16 -935=16 -936=16 -937=16 -938=16 -939=16 -940=16 -941=16 -942=16 -943=16 -944=16 -945=16 -946=16 -947=16 -948=16 -949=16 -950=16 -951=16 -952=16 -953=16 -954=16 -955=16 -956=16 -957=16 -958=16 -959=16 -960=16 -961=16 -962=16 -963=16 -964=16 -965=16 -966=16 -967=16 -968=16 -969=16 -970=16 -971=16 -972=16 -973=16 -974=16 -975=16 -976=16 -977=16 -978=16 -979=16 -980=16 -981=16 -982=16 -983=16 -984=16 -985=16 -986=16 -987=16 -988=16 -989=16 -990=16 -991=16 -992=16 -993=16 -994=16 -995=16 -996=16 -997=16 -998=16 -999=16 -1000=16 -1001=16 -1002=16 -1003=16 -1004=16 -1005=16 -1006=16 -1007=16 -1008=16 -1009=16 -1010=16 -1011=16 -1012=16 -1013=16 -1014=16 -1015=16 -1016=16 -1017=16 -1018=16 -1019=16 -1020=16 -1021=16 -1022=16 -1023=16 -1024=16 -1025=16 -1026=16 -1027=16 -1028=16 -1029=16 -1030=16 -1031=16 -1032=16 -1033=16 -1034=16 -1035=16 -1036=16 -1037=16 -1038=16 -1039=16 -1040=16 -1041=16 -1042=16 -1043=16 -1044=16 -1045=16 -1046=16 -1047=16 -1048=16 -1049=16 -1050=16 -1051=16 -1052=16 -1053=16 -1054=16 -1055=16 -1056=16 -1057=16 -1058=16 -1059=16 -1060=16 -1061=16 -1062=16 -1063=16 -1064=16 -1065=16 -1066=16 -1067=16 -1068=16 -1069=16 -1070=16 -1071=16 -1072=16 -1073=16 -1074=16 -1075=16 -1076=16 -1077=16 -1078=16 -1079=16 -1080=16 -1081=16 -1082=16 -1083=16 -1084=16 -1085=16 -1086=16 -1087=16 -1088=16 -1089=16 -1090=16 -1091=16 -1092=16 -1093=16 -1094=16 -1095=16 -1096=16 -1097=16 -1098=16 -1099=16 -1100=16 -1101=16 -1102=16 -1103=16 -1104=16 -1105=16 -1106=16 -1107=16 -1108=16 -1109=16 -1110=16 -1111=16 -1112=16 -1113=16 -1114=16 -1115=16 -1116=16 -1117=16 -1118=16 -1119=16 -1120=16 -1121=16 -1122=16 -1123=16 -1124=16 -1125=16 -1126=16 -1127=16 -1128=16 -1129=16 -1130=16 -1131=16 -1132=16 -1133=16 -1134=16 -1135=16 -1136=16 -1137=16 -1138=16 -1139=16 -1140=16 -1141=16 -1142=16 -1143=16 -1144=16 -1145=16 -1146=16 -1147=16 -1148=16 -1149=16 -1150=16 -1151=16 -1152=16 -1153=16 -1154=16 -1155=16 -1156=16 -1157=16 -1158=16 -1159=16 -1160=16 -1161=16 -1162=16 -1163=16 -1164=16 -1165=16 -1166=16 -1167=16 -1168=16 -1169=16 -1170=16 -1171=16 -1172=16 -1173=16 -1174=16 -1175=16 -1176=16 -1177=16 -1178=16 -1179=16 -1180=16 -1181=16 -1182=16 -1183=16 -1184=16 -1185=16 -1186=16 -1187=16 -1188=16 -1189=16 -1190=16 -1191=16 -1192=16 -1193=16 -1194=16 -1195=16 -1196=16 -1197=16 -1198=16 -1199=16 -1200=16 -1201=16 -1202=16 -1203=16 -1204=16 -1205=16 -1206=16 -1207=16 -1208=16 -1209=16 -1210=16 -1211=16 -1212=16 -1213=16 -1214=16 -1215=16 -1216=16 -1217=16 -1218=16 -1219=16 -1220=16 -1221=16 -1222=16 -1223=16 -1224=16 -1225=16 -1226=16 -1227=16 -1228=16 -1229=16 -1230=16 -1231=16 -1232=16 -1233=16 -1234=16 -1235=16 -1236=16 -1237=16 -1238=16 -1239=16 -1240=16 -1241=16 -1242=16 -1243=16 -1244=16 -1245=16 -1246=16 -1247=16 -1248=16 -1249=16 -1250=16 -1251=16 -1252=16 -1253=16 -1254=16 -1255=16 -1256=16 -1257=16 -1258=16 -1259=16 -1260=16 -1261=16 -1262=16 -1263=16 -1264=16 -1265=16 -1266=16 -1267=16 -1268=16 -1269=16 -1270=16 -1271=16 -1272=16 -1273=16 -1274=16 -1275=16 -1276=16 -1277=16 -1278=16 -1279=16 -1280=16 -1281=16 -1282=16 -1283=16 -1284=16 -1285=16 -1286=16 -1287=16 -1288=16 -1289=16 -1290=16 -1291=16 -1292=16 -1293=16 -1294=16 -1295=16 -1296=16 -1297=16 -1298=16 -1299=16 -1300=16 -1301=16 -1302=16 -1303=16 -1304=16 -1305=16 -1306=16 -1307=16 -1308=16 -1309=16 -1310=16 -1311=16 -1312=16 -1313=16 -1314=16 -1315=16 -1316=16 -1317=16 -1318=16 -1319=16 -1320=16 -1321=16 -1322=16 -1323=16 -1324=16 -1325=16 -1326=16 -1327=16 -1328=16 -1329=16 -1330=16 -1331=16 -1332=16 -1333=16 -1334=16 -1335=16 -1336=16 -1337=16 -1338=16 -1339=16 -1340=16 -1341=16 -1342=16 -1343=16 -1344=16 -1345=16 -1346=16 -1347=16 -1348=16 -1349=16 -1350=16 -1351=16 -1352=16 -1353=16 -1354=16 -1355=16 -1356=16 -1357=16 -1358=16 -1359=16 -1360=16 -1361=16 -1362=16 -1363=16 -1364=16 -1365=16 -1366=16 -1367=16 -1368=16 -1369=16 -1370=16 -1371=16 -1372=16 -1373=16 -1374=16 -1375=16 -1376=16 -1377=16 -1378=16 -1379=16 -1380=16 -1381=16 -1382=16 -1383=16 -1384=16 -1385=16 -1386=16 -1387=16 -1388=16 -1389=16 -1390=16 -1391=16 -1392=16 -1393=16 -1394=16 -1395=16 -1396=16 -1397=16 -1398=16 -1399=16 -1400=16 -1401=16 -1402=16 -1403=16 -1404=16 -1405=16 -1406=16 -1407=16 -1408=16 -1409=16 -1410=16 -1411=16 -1412=16 -1413=16 -1414=16 -1415=16 -1416=16 -1417=16 -1418=16 -1419=16 -1420=16 -1421=16 -1422=16 -1423=16 -1424=16 -1425=16 -1426=16 -1427=16 -1428=16 -1429=16 -1430=16 -1431=16 -1432=16 -1433=16 -1434=16 -1435=16 -1436=16 -1437=16 -1438=16 -1439=16 -1440=16 -1441=16 -1442=16 -1443=16 -1444=16 -1445=16 -1446=16 -1447=16 -1448=16 -1449=16 -1450=16 -1451=16 -1452=16 -1453=16 -1454=16 -1455=16 -1456=16 -1457=16 -1458=16 -1459=16 -1460=16 -1461=16 -1462=16 -1463=16 -1464=16 -1465=16 -1466=16 -1467=16 -1468=16 -1469=16 -1470=16 -1471=16 -1472=16 -1473=16 -1474=16 -1475=16 -1476=16 -1477=16 -1478=16 -1479=16 -1480=16 -1481=16 -1482=16 -1483=16 -1484=16 -1485=16 -1486=16 -1487=16 -1488=16 -1489=16 -1490=16 -1491=16 -1492=16 -1493=16 -1494=16 -1495=16 -1496=16 -1497=16 -1498=16 -1499=16 -1500=16 -1501=16 -1502=16 -1503=16 -1504=16 -1505=16 -1506=16 -1507=16 -1508=16 -1509=16 -1510=16 -1511=16 -1512=16 -1513=16 -1514=16 -1515=16 -1516=16 -1517=16 -1518=16 -1519=16 -1520=16 -1521=16 -1522=16 -1523=16 -1524=16 -1525=16 -1526=16 -1527=16 -1528=16 -1529=16 -1530=16 -1531=16 -1532=16 -1533=16 -1534=16 -1535=16 -1536=16 -1537=16 -1538=16 -1539=16 -1540=16 -1541=16 -1542=16 -1543=16 -1544=16 -1545=16 -1546=16 -1547=16 -1548=16 -1549=16 -1550=16 -1551=16 -1552=16 -1553=16 -1554=16 -1555=16 -1556=16 -1557=16 -1558=16 -1559=16 -1560=16 -1561=16 -1562=16 -1563=16 -1564=16 -1565=16 -1566=16 -1567=16 -1568=16 -1569=16 -1570=16 -1571=16 -1572=16 -1573=16 -1574=16 -1575=16 -1576=16 -1577=16 -1578=16 -1579=16 -1580=16 -1581=16 -1582=16 -1583=16 -1584=16 -1585=16 -1586=16 -1587=16 -1588=16 -1589=16 -1590=16 -1591=16 -1592=16 -1593=16 -1594=16 -1595=16 -1596=16 -1597=16 -1598=16 -1599=16 -1600=16 -1601=16 -1602=16 -1603=16 -1604=16 -1605=16 -1606=16 -1607=16 -1608=16 -1609=16 -1610=16 -1611=16 -1612=16 -1613=16 -1614=16 -1615=16 -1616=16 -1617=16 -1618=16 -1619=16 -1620=16 -1621=16 -1622=16 -1623=16 -1624=16 -1625=16 -1626=16 -1627=16 -1628=16 -1629=16 -1630=16 -1631=16 -1632=16 -1633=16 -1634=16 -1635=16 -1636=16 -1637=16 -1638=16 -1639=16 -1640=16 -1641=16 -1642=16 -1643=16 -1644=16 -1645=16 -1646=16 -1647=16 -1648=16 -1649=16 -1650=16 -1651=16 -1652=16 -1653=16 -1654=16 -1655=16 -1656=16 -1657=16 -1658=16 -1659=16 -1660=16 -1661=16 -1662=16 -1663=16 -1664=16 -1665=16 -1666=16 -1667=16 -1668=16 -1669=16 -1670=16 -1671=16 -1672=16 -1673=16 -1674=16 -1675=16 -1676=16 -1677=16 -1678=16 -1679=16 -1680=16 -1681=16 -1682=16 -1683=16 -1684=16 -1685=16 -1686=16 -1687=16 -1688=16 -1689=16 -1690=16 -1691=16 -1692=16 -1693=16 -1694=16 -1695=16 -1696=16 -1697=16 -1698=16 -1699=16 -1700=16 -1701=16 -1702=16 -1703=16 -1704=16 -1705=16 -1706=16 -1707=16 -1708=16 -1709=16 -1710=16 -1711=16 -1712=16 -1713=16 -1714=16 -1715=16 -1716=16 -1717=16 -1718=16 -1719=16 -1720=16 -1721=16 -1722=16 -1723=16 -1724=16 -1725=16 -1726=16 -1727=16 -1728=16 -1729=16 -1730=16 -1731=16 -1732=16 -1733=16 -1734=16 -1735=16 -1736=16 -1737=16 -1738=16 -1739=16 -1740=16 -1741=16 -1742=16 -1743=16 -1744=16 -1745=16 -1746=16 -1747=16 -1748=16 -1749=16 -1750=16 -1751=16 -1752=16 -1753=16 -1754=16 -1755=16 -1756=16 -1757=16 -1758=16 -1759=16 -1760=16 -1761=16 -1762=16 -1763=16 -1764=16 -1765=16 -1766=16 -1767=16 -1768=16 -1769=16 -1770=16 -1771=16 -1772=16 -1773=16 -1774=16 -1775=16 -1776=16 -1777=16 -1778=16 -1779=16 -1780=16 -1781=16 -1782=16 -1783=16 -1784=16 -1785=16 -1786=16 -1787=16 -1788=16 -1789=16 -1790=16 -1791=16 -1792=16 -1793=16 -1794=16 -1795=16 -1796=16 -1797=16 -1798=16 -1799=16 -1800=16 -1801=16 -1802=16 -1803=16 -1804=16 -1805=16 -1806=16 -1807=16 -1808=16 -1809=16 -1810=16 -1811=16 -1812=16 -1813=16 -1814=16 -1815=16 -1816=16 -1817=16 -1818=16 -1819=16 -1820=16 -1821=16 -1822=16 -1823=16 -1824=16 -1825=16 -1826=16 -1827=16 -1828=16 -1829=16 -1830=16 -1831=16 -1832=16 -1833=16 -1834=16 -1835=16 -1836=16 -1837=16 -1838=16 -1839=16 -1840=16 -1841=16 -1842=16 -1843=16 -1844=16 -1845=16 -1846=16 -1847=16 -1848=16 -1849=16 -1850=16 -1851=16 -1852=16 -1853=16 -1854=16 -1855=16 -1856=16 -1857=16 -1858=16 -1859=16 -1860=16 -1861=16 -1862=16 -1863=16 -1864=16 -1865=16 -1866=16 -1867=16 -1868=16 -1869=16 -1870=16 -1871=16 -1872=16 -1873=16 -1874=16 -1875=16 -1876=16 -1877=16 -1878=16 -1879=16 -1880=16 -1881=16 -1882=16 -1883=16 -1884=16 -1885=16 -1886=16 -1887=16 -1888=16 -1889=16 -1890=16 -1891=16 -1892=16 -1893=16 -1894=16 -1895=16 -1896=16 -1897=16 -1898=16 -1899=16 -1900=16 -1901=16 -1902=16 -1903=16 -1904=16 -1905=16 -1906=16 -1907=16 -1908=16 -1909=16 -1910=16 -1911=16 -1912=16 -1913=16 -1914=16 -1915=16 -1916=16 -1917=16 -1918=16 -1919=16 -1920=16 -1921=16 -1922=16 -1923=16 -1924=16 -1925=16 -1926=16 -1927=16 -1928=16 -1929=16 -1930=16 -1931=16 -1932=16 -1933=16 -1934=16 -1935=16 -1936=16 -1937=16 -1938=16 -1939=16 -1940=16 -1941=16 -1942=16 -1943=16 -1944=16 - -[kanji-jis1] -Line 0=唖娃阿挨姶逢葵茜穐渥旭葦芦鯵梓斡宛姐虻飴絢綾鮎或粟袷庵按闇鞍杏伊 -Line 1=夷惟椅畏萎謂亥郁磯溢茨鰯允咽淫胤蔭吋烏迂卯鵜窺丑碓臼嘘唄欝蔚鰻姥 -Line 2=厩瓜閏噂云荏餌叡嬰曳洩瑛盈穎頴榎厭堰奄怨掩焔燕艶苑薗鴛於甥旺襖鴬 -Line 3=鴎岡荻臆桶牡俺伽嘉珂禾苛茄蝦嘩迦霞俄峨牙臥蛾駕廻恢魁晦芥蟹凱咳崖 -Line 4=碍蓋鎧骸浬馨蛙柿蛎鈎劃廓撹赫顎笠樫橿梶鰍恰葛鰹叶椛樺鞄兜竃蒲釜鎌 -Line 5=噛鴨栢茅萱粥苅瓦侃姦柑桓澗潅竿翰莞諌韓舘巌玩癌翫贋雁伎嬉毅畿稀徽 -Line 6=亀妓祇蟻誼掬鞠吃桔橘砧杵黍仇汲灸笈渠鋸禦亨侠僑兇匡卿喬彊怯蕎饗尭 -Line 7=桐粁僅巾錦欣欽禽芹衿倶狗玖矩躯駈駒喰寓串櫛釧屑窟沓轡窪熊隈粂栗鍬 -Line 8=卦袈祁圭珪慧桂畦稽繋罫荊詣頚戟隙桁訣倦喧拳捲牽硯鍵鹸絃舷諺乎姑狐 -Line 9=糊袴股胡菰虎跨鈷伍吾梧檎瑚醐乞鯉佼倖勾喉垢宏巷庚弘昂晃杭梗浩糠紘 -Line 10=肱腔膏砿閤鴻劫壕濠轟麹鵠漉甑忽惚狛此頃坤昏梱痕艮些叉嵯沙瑳裟坐挫 -Line 11=哉塞采犀砦冴阪堺榊肴埼碕鷺咋朔柵窄鮭笹匙拶薩皐鯖捌錆鮫晒撒燦珊纂 -Line 12=讃餐斬仔屍孜斯獅爾痔而蒔汐鹿鴫竺宍雫叱嫉悉蔀篠偲柴屡蕊縞紗杓灼錫 -Line 13=惹腫呪綬洲繍蒐讐蹴輯酋什戎夙峻竣舜駿楯淳醇曙渚薯藷恕鋤哨嘗妾娼庄 -Line 14=廠捷昌梢樟樵湘菖蒋蕉裳醤鉦鍾鞘丞擾杖穣埴拭燭蝕尻晋榛疹秦芯塵壬腎 -Line 15=訊靭笥諏須厨逗翠錐瑞嵩趨雛椙菅頗雀裾摺凄棲栖醒脆戚脊蹟碩蝉尖撰栴 -Line 16=煎煽穿箭羨腺舛詮賎閃膳糎噌岨曾曽楚狙疏蘇遡鼠叢爽宋匝惣掻槍漕痩糟 -Line 17=綜聡蒼鎗捉袖其揃遜汰詑唾柁舵楕陀騨堆岱戴腿苔黛鯛醍鷹瀧啄托琢鐸茸 -Line 18=凧蛸只叩辰巽竪辿狸鱈樽誰坦旦歎湛箪綻耽蛋檀弛智蜘馳筑註酎樗瀦猪苧 -Line 19=凋喋寵帖暢牒蝶諜銚捗椎槌鎚栂掴槻佃柘辻蔦綴鍔椿潰壷嬬紬爪吊鶴剃悌 -Line 20=挺梯汀碇禎諦蹄鄭釘鼎擢鏑溺轍填纏甜貼顛澱兎堵妬屠杜菟賭鍍砥砺塘套 -Line 21=宕嶋梼淘涛燈祷董蕩藤鐙憧撞瞳萄鴇涜禿栃橡椴鳶苫寅酉瀞噸惇敦沌遁頓 -Line 22=呑奈那乍凪薙謎灘捺鍋楢馴畷楠汝迩匂賑虹廿韮濡禰祢葱捻撚乃廼之埜嚢 -Line 23=膿覗蚤巴播杷琶罵芭盃牌楳煤狽這蝿秤矧萩剥柏箔粕曝莫駁函硲箸肇筈櫨 -Line 24=幡畠溌醗筏鳩噺塙蛤隼叛斑氾汎釆挽磐蕃匪庇斐緋誹樋簸枇毘琵眉柊稗疋 -Line 25=髭彦膝菱肘弼畢逼桧媛紐謬彪瓢豹廟錨鋲蒜蛭鰭彬斌瀕埠冨斧芙阜撫葡蕪 -Line 26=楓葺蕗淵弗鮒吻扮焚糞蔽頁僻碧瞥蔑箆篇娩鞭鋪圃甫輔戊菩呆峯庖捧朋烹 -Line 27=萌蓬蜂鋒鳳鵬貌鉾吠頬卜睦穆釦勃殆幌昧哩槙枕鮪柾鱒桝亦俣沫迄侭麿蔓 -Line 28=巳箕蜜湊蓑稔粍牟鵡椋冥姪牝棉緬麺摸孟蒙儲杢勿餅尤籾貰悶也冶爺耶弥 -Line 29=靖薮鑓愈佑宥揖柚湧涌猷祐邑輿傭妖楊熔耀蓉遥慾沃淀螺莱洛嵐藍蘭李梨 -Line 30=璃裡葎掠劉溜琉龍侶亮凌梁瞭稜諒遼淋燐琳鱗麟瑠伶嶺怜玲苓憐漣煉簾聯 -Line 31=蓮呂魯櫓賂婁弄榔牢狼篭聾蝋麓禄肋倭歪脇鷲亙亘鰐詫藁蕨椀碗 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 -64=16 -65=16 -66=16 -67=16 -68=16 -69=16 -70=16 -71=16 -72=16 -73=16 -74=16 -75=16 -76=16 -77=16 -78=16 -79=16 -80=16 -81=16 -82=16 -83=16 -84=16 -85=16 -86=16 -87=16 -88=16 -89=16 -90=16 -91=16 -92=16 -93=16 -94=16 -95=16 -96=16 -97=16 -98=16 -99=16 -100=16 -101=16 -102=16 -103=16 -104=16 -105=16 -106=16 -107=16 -108=16 -109=16 -110=16 -111=16 -112=16 -113=16 -114=16 -115=16 -116=16 -117=16 -118=16 -119=16 -120=16 -121=16 -122=16 -123=16 -124=16 -125=16 -126=16 -127=16 -128=16 -129=16 -130=16 -131=16 -132=16 -133=16 -134=16 -135=16 -136=16 -137=16 -138=16 -139=16 -140=16 -141=16 -142=16 -143=16 -144=16 -145=16 -146=16 -147=16 -148=16 -149=16 -150=16 -151=16 -152=16 -153=16 -154=16 -155=16 -156=16 -157=16 -158=16 -159=16 -160=16 -161=16 -162=16 -163=16 -164=16 -165=16 -166=16 -167=16 -168=16 -169=16 -170=16 -171=16 -172=16 -173=16 -174=16 -175=16 -176=16 -177=16 -178=16 -179=16 -180=16 -181=16 -182=16 -183=16 -184=16 -185=16 -186=16 -187=16 -188=16 -189=16 -190=16 -191=16 -192=16 -193=16 -194=16 -195=16 -196=16 -197=16 -198=16 -199=16 -200=16 -201=16 -202=16 -203=16 -204=16 -205=16 -206=16 -207=16 -208=16 -209=16 -210=16 -211=16 -212=16 -213=16 -214=16 -215=16 -216=16 -217=16 -218=16 -219=16 -220=16 -221=16 -222=16 -223=16 -224=16 -225=16 -226=16 -227=16 -228=16 -229=16 -230=16 -231=16 -232=16 -233=16 -234=16 -235=16 -236=16 -237=16 -238=16 -239=16 -240=16 -241=16 -242=16 -243=16 -244=16 -245=16 -246=16 -247=16 -248=16 -249=16 -250=16 -251=16 -252=16 -253=16 -254=16 -255=16 -256=16 -257=16 -258=16 -259=16 -260=16 -261=16 -262=16 -263=16 -264=16 -265=16 -266=16 -267=16 -268=16 -269=16 -270=16 -271=16 -272=16 -273=16 -274=16 -275=16 -276=16 -277=16 -278=16 -279=16 -280=16 -281=16 -282=16 -283=16 -284=16 -285=16 -286=16 -287=16 -288=16 -289=16 -290=16 -291=16 -292=16 -293=16 -294=16 -295=16 -296=16 -297=16 -298=16 -299=16 -300=16 -301=16 -302=16 -303=16 -304=16 -305=16 -306=16 -307=16 -308=16 -309=16 -310=16 -311=16 -312=16 -313=16 -314=16 -315=16 -316=16 -317=16 -318=16 -319=16 -320=16 -321=16 -322=16 -323=16 -324=16 -325=16 -326=16 -327=16 -328=16 -329=16 -330=16 -331=16 -332=16 -333=16 -334=16 -335=16 -336=16 -337=16 -338=16 -339=16 -340=16 -341=16 -342=16 -343=16 -344=16 -345=16 -346=16 -347=16 -348=16 -349=16 -350=16 -351=16 -352=16 -353=16 -354=16 -355=16 -356=16 -357=16 -358=16 -359=16 -360=16 -361=16 -362=16 -363=16 -364=16 -365=16 -366=16 -367=16 -368=16 -369=16 -370=16 -371=16 -372=16 -373=16 -374=16 -375=16 -376=16 -377=16 -378=16 -379=16 -380=16 -381=16 -382=16 -383=16 -384=16 -385=16 -386=16 -387=16 -388=16 -389=16 -390=16 -391=16 -392=16 -393=16 -394=16 -395=16 -396=16 -397=16 -398=16 -399=16 -400=16 -401=16 -402=16 -403=16 -404=16 -405=16 -406=16 -407=16 -408=16 -409=16 -410=16 -411=16 -412=16 -413=16 -414=16 -415=16 -416=16 -417=16 -418=16 -419=16 -420=16 -421=16 -422=16 -423=16 -424=16 -425=16 -426=16 -427=16 -428=16 -429=16 -430=16 -431=16 -432=16 -433=16 -434=16 -435=16 -436=16 -437=16 -438=16 -439=16 -440=16 -441=16 -442=16 -443=16 -444=16 -445=16 -446=16 -447=16 -448=16 -449=16 -450=16 -451=16 -452=16 -453=16 -454=16 -455=16 -456=16 -457=16 -458=16 -459=16 -460=16 -461=16 -462=16 -463=16 -464=16 -465=16 -466=16 -467=16 -468=16 -469=16 -470=16 -471=16 -472=16 -473=16 -474=16 -475=16 -476=16 -477=16 -478=16 -479=16 -480=16 -481=16 -482=16 -483=16 -484=16 -485=16 -486=16 -487=16 -488=16 -489=16 -490=16 -491=16 -492=16 -493=16 -494=16 -495=16 -496=16 -497=16 -498=16 -499=16 -500=16 -501=16 -502=16 -503=16 -504=16 -505=16 -506=16 -507=16 -508=16 -509=16 -510=16 -511=16 -512=16 -513=16 -514=16 -515=16 -516=16 -517=16 -518=16 -519=16 -520=16 -521=16 -522=16 -523=16 -524=16 -525=16 -526=16 -527=16 -528=16 -529=16 -530=16 -531=16 -532=16 -533=16 -534=16 -535=16 -536=16 -537=16 -538=16 -539=16 -540=16 -541=16 -542=16 -543=16 -544=16 -545=16 -546=16 -547=16 -548=16 -549=16 -550=16 -551=16 -552=16 -553=16 -554=16 -555=16 -556=16 -557=16 -558=16 -559=16 -560=16 -561=16 -562=16 -563=16 -564=16 -565=16 -566=16 -567=16 -568=16 -569=16 -570=16 -571=16 -572=16 -573=16 -574=16 -575=16 -576=16 -577=16 -578=16 -579=16 -580=16 -581=16 -582=16 -583=16 -584=16 -585=16 -586=16 -587=16 -588=16 -589=16 -590=16 -591=16 -592=16 -593=16 -594=16 -595=16 -596=16 -597=16 -598=16 -599=16 -600=16 -601=16 -602=16 -603=16 -604=16 -605=16 -606=16 -607=16 -608=16 -609=16 -610=16 -611=16 -612=16 -613=16 -614=16 -615=16 -616=16 -617=16 -618=16 -619=16 -620=16 -621=16 -622=16 -623=16 -624=16 -625=16 -626=16 -627=16 -628=16 -629=16 -630=16 -631=16 -632=16 -633=16 -634=16 -635=16 -636=16 -637=16 -638=16 -639=16 -640=16 -641=16 -642=16 -643=16 -644=16 -645=16 -646=16 -647=16 -648=16 -649=16 -650=16 -651=16 -652=16 -653=16 -654=16 -655=16 -656=16 -657=16 -658=16 -659=16 -660=16 -661=16 -662=16 -663=16 -664=16 -665=16 -666=16 -667=16 -668=16 -669=16 -670=16 -671=16 -672=16 -673=16 -674=16 -675=16 -676=16 -677=16 -678=16 -679=16 -680=16 -681=16 -682=16 -683=16 -684=16 -685=16 -686=16 -687=16 -688=16 -689=16 -690=16 -691=16 -692=16 -693=16 -694=16 -695=16 -696=16 -697=16 -698=16 -699=16 -700=16 -701=16 -702=16 -703=16 -704=16 -705=16 -706=16 -707=16 -708=16 -709=16 -710=16 -711=16 -712=16 -713=16 -714=16 -715=16 -716=16 -717=16 -718=16 -719=16 -720=16 -721=16 -722=16 -723=16 -724=16 -725=16 -726=16 -727=16 -728=16 -729=16 -730=16 -731=16 -732=16 -733=16 -734=16 -735=16 -736=16 -737=16 -738=16 -739=16 -740=16 -741=16 -742=16 -743=16 -744=16 -745=16 -746=16 -747=16 -748=16 -749=16 -750=16 -751=16 -752=16 -753=16 -754=16 -755=16 -756=16 -757=16 -758=16 -759=16 -760=16 -761=16 -762=16 -763=16 -764=16 -765=16 -766=16 -767=16 -768=16 -769=16 -770=16 -771=16 -772=16 -773=16 -774=16 -775=16 -776=16 -777=16 -778=16 -779=16 -780=16 -781=16 -782=16 -783=16 -784=16 -785=16 -786=16 -787=16 -788=16 -789=16 -790=16 -791=16 -792=16 -793=16 -794=16 -795=16 -796=16 -797=16 -798=16 -799=16 -800=16 -801=16 -802=16 -803=16 -804=16 -805=16 -806=16 -807=16 -808=16 -809=16 -810=16 -811=16 -812=16 -813=16 -814=16 -815=16 -816=16 -817=16 -818=16 -819=16 -820=16 -821=16 -822=16 -823=16 -824=16 -825=16 -826=16 -827=16 -828=16 -829=16 -830=16 -831=16 -832=16 -833=16 -834=16 -835=16 -836=16 -837=16 -838=16 -839=16 -840=16 -841=16 -842=16 -843=16 -844=16 -845=16 -846=16 -847=16 -848=16 -849=16 -850=16 -851=16 -852=16 -853=16 -854=16 -855=16 -856=16 -857=16 -858=16 -859=16 -860=16 -861=16 -862=16 -863=16 -864=16 -865=16 -866=16 -867=16 -868=16 -869=16 -870=16 -871=16 -872=16 -873=16 -874=16 -875=16 -876=16 -877=16 -878=16 -879=16 -880=16 -881=16 -882=16 -883=16 -884=16 -885=16 -886=16 -887=16 -888=16 -889=16 -890=16 -891=16 -892=16 -893=16 -894=16 -895=16 -896=16 -897=16 -898=16 -899=16 -900=16 -901=16 -902=16 -903=16 -904=16 -905=16 -906=16 -907=16 -908=16 -909=16 -910=16 -911=16 -912=16 -913=16 -914=16 -915=16 -916=16 -917=16 -918=16 -919=16 -920=16 -921=16 -922=16 -923=16 -924=16 -925=16 -926=16 -927=16 -928=16 -929=16 -930=16 -931=16 -932=16 -933=16 -934=16 -935=16 -936=16 -937=16 -938=16 -939=16 -940=16 -941=16 -942=16 -943=16 -944=16 -945=16 -946=16 -947=16 -948=16 -949=16 -950=16 -951=16 -952=16 -953=16 -954=16 -955=16 -956=16 -957=16 -958=16 -959=16 -960=16 -961=16 -962=16 -963=16 -964=16 -965=16 -966=16 -967=16 -968=16 -969=16 -970=16 -971=16 -972=16 -973=16 -974=16 -975=16 -976=16 -977=16 -978=16 -979=16 -980=16 -981=16 -982=16 -983=16 -984=16 -985=16 -986=16 -987=16 -988=16 -989=16 -990=16 -991=16 -992=16 -993=16 -994=16 -995=16 -996=16 -997=16 -998=16 -999=16 -1000=16 -1001=16 -1002=16 -1003=16 -1004=16 -1005=16 -1006=16 -1007=16 -1008=16 -1009=16 -1010=16 -1011=16 -1012=16 -1013=16 -1014=16 -1015=16 -1016=16 -1017=16 -1018=16 -1019=16 - -[kanji-jis2] -Line 0=弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞 -Line 1=仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥 -Line 2=倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲僉僊 -Line 3=傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮 -Line 4=冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾 -Line 5=刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼 -Line 6=劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍 -Line 7=凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮 -Line 8=吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨咫哂咤咾咼哘 -Line 9=哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼 -Line 10=喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀 -Line 11=嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜 -Line 12=圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡 -Line 13=塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽 -Line 14=夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩奸妁妝佞侫妣妲姆姨姜 -Line 15=妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖 -Line 16=嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢 -Line 17=寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛 -Line 18=岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬 -Line 19=嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀 -Line 20=幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏廖廣廝廚廛廢廡廨廩廬廱廳廰廴 -Line 21=廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇 -Line 22=從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷 -Line 23=恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵 -Line 24=惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚 -Line 25=慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣 -Line 26=懶懺懴懿懽懼懾戀戈戉戍戌戔戛戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找 -Line 27=抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍 -Line 28=搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨 -Line 29=搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺 -Line 30=攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆 -Line 31=旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈 -Line 32=暎暉暄暘暝曁暹曉暾暼曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸 -Line 33=朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆 -Line 34=柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁 -Line 35=棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔 -Line 36=楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴 -Line 37=槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢 -Line 38=檐檍檠檄檢檣檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹 -Line 39=飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓 -Line 40=毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅 -Line 41=泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕 -Line 42=渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃 -Line 43=渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯 -Line 44=漲滌漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔 -Line 45=濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋 -Line 46=烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼 -Line 47=燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎 -Line 48=狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻 -Line 49=珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱瓠瓣 -Line 50=瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭 -Line 51=畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰 -Line 52=痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發 -Line 53=皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥 -Line 54=眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮 -Line 55=矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬磧磚磽磴礇礒 -Line 56=礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙 -Line 57=稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊 -Line 58=竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥 -Line 59=筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇 -Line 60=簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫 -Line 61=粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆紂紜紕紊絅絋紮紲紿紵 -Line 62=絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤 -Line 63=緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩 -Line 64=繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨 -Line 65=罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜 -Line 66=耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚 -Line 67=肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋隋腆脾腓腑胼腱腮腥腦腴膃膈膊 -Line 68=膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂 -Line 69=舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬 -Line 70=苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪 -Line 71=莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸 -Line 72=蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡 -Line 73=蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾 -Line 74=薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋 -Line 75=蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥 -Line 76=蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯 -Line 77=蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵 -Line 78=衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪 -Line 79=褫襁襄褻褶褸襌褝襠襞襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿 -Line 80=觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦 -Line 81=誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁 -Line 82=譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸 -Line 83=豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍 -Line 84=贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐 -Line 85=踟蹂踵踰踴蹊蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡 -Line 86=躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌 -Line 87=轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧 -Line 88=逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤 -Line 89=扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟 -Line 90=釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺 -Line 91=鍄錮錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓 -Line 92=鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘 -Line 93=閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞 -Line 94=陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎 -Line 95=霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐 -Line 96=鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰顱顴 -Line 97=顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌 -Line 98=饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍 -Line 99=驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚 -Line 100=鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆 -Line 101=鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾 -Line 102=鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈鵝鵞鵤鵑鵐鵙 -Line 103=鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁 -Line 104=麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽 -Line 105=鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙 - -0=16 -1=16 -2=16 -3=16 -4=16 -5=16 -6=16 -7=16 -8=16 -9=16 -10=16 -11=16 -12=16 -13=16 -14=16 -15=16 -16=16 -17=16 -18=16 -19=16 -20=16 -21=16 -22=16 -23=16 -24=16 -25=16 -26=16 -27=16 -28=16 -29=16 -30=16 -31=16 -32=16 -33=16 -34=16 -35=16 -36=16 -37=16 -38=16 -39=16 -40=16 -41=16 -42=16 -43=16 -44=16 -45=16 -46=16 -47=16 -48=16 -49=16 -50=16 -51=16 -52=16 -53=16 -54=16 -55=16 -56=16 -57=16 -58=16 -59=16 -60=16 -61=16 -62=16 -63=16 -64=16 -65=16 -66=16 -67=16 -68=16 -69=16 -70=16 -71=16 -72=16 -73=16 -74=16 -75=16 -76=16 -77=16 -78=16 -79=16 -80=16 -81=16 -82=16 -83=16 -84=16 -85=16 -86=16 -87=16 -88=16 -89=16 -90=16 -91=16 -92=16 -93=16 -94=16 -95=16 -96=16 -97=16 -98=16 -99=16 -100=16 -101=16 -102=16 -103=16 -104=16 -105=16 -106=16 -107=16 -108=16 -109=16 -110=16 -111=16 -112=16 -113=16 -114=16 -115=16 -116=16 -117=16 -118=16 -119=16 -120=16 -121=16 -122=16 -123=16 -124=16 -125=16 -126=16 -127=16 -128=16 -129=16 -130=16 -131=16 -132=16 -133=16 -134=16 -135=16 -136=16 -137=16 -138=16 -139=16 -140=16 -141=16 -142=16 -143=16 -144=16 -145=16 -146=16 -147=16 -148=16 -149=16 -150=16 -151=16 -152=16 -153=16 -154=16 -155=16 -156=16 -157=16 -158=16 -159=16 -160=16 -161=16 -162=16 -163=16 -164=16 -165=16 -166=16 -167=16 -168=16 -169=16 -170=16 -171=16 -172=16 -173=16 -174=16 -175=16 -176=16 -177=16 -178=16 -179=16 -180=16 -181=16 -182=16 -183=16 -184=16 -185=16 -186=16 -187=16 -188=16 -189=16 -190=16 -191=16 -192=16 -193=16 -194=16 -195=16 -196=16 -197=16 -198=16 -199=16 -200=16 -201=16 -202=16 -203=16 -204=16 -205=16 -206=16 -207=16 -208=16 -209=16 -210=16 -211=16 -212=16 -213=16 -214=16 -215=16 -216=16 -217=16 -218=16 -219=16 -220=16 -221=16 -222=16 -223=16 -224=16 -225=16 -226=16 -227=16 -228=16 -229=16 -230=16 -231=16 -232=16 -233=16 -234=16 -235=16 -236=16 -237=16 -238=16 -239=16 -240=16 -241=16 -242=16 -243=16 -244=16 -245=16 -246=16 -247=16 -248=16 -249=16 -250=16 -251=16 -252=16 -253=16 -254=16 -255=16 -256=16 -257=16 -258=16 -259=16 -260=16 -261=16 -262=16 -263=16 -264=16 -265=16 -266=16 -267=16 -268=16 -269=16 -270=16 -271=16 -272=16 -273=16 -274=16 -275=16 -276=16 -277=16 -278=16 -279=16 -280=16 -281=16 -282=16 -283=16 -284=16 -285=16 -286=16 -287=16 -288=16 -289=16 -290=16 -291=16 -292=16 -293=16 -294=16 -295=16 -296=16 -297=16 -298=16 -299=16 -300=16 -301=16 -302=16 -303=16 -304=16 -305=16 -306=16 -307=16 -308=16 -309=16 -310=16 -311=16 -312=16 -313=16 -314=16 -315=16 -316=16 -317=16 -318=16 -319=16 -320=16 -321=16 -322=16 -323=16 -324=16 -325=16 -326=16 -327=16 -328=16 -329=16 -330=16 -331=16 -332=16 -333=16 -334=16 -335=16 -336=16 -337=16 -338=16 -339=16 -340=16 -341=16 -342=16 -343=16 -344=16 -345=16 -346=16 -347=16 -348=16 -349=16 -350=16 -351=16 -352=16 -353=16 -354=16 -355=16 -356=16 -357=16 -358=16 -359=16 -360=16 -361=16 -362=16 -363=16 -364=16 -365=16 -366=16 -367=16 -368=16 -369=16 -370=16 -371=16 -372=16 -373=16 -374=16 -375=16 -376=16 -377=16 -378=16 -379=16 -380=16 -381=16 -382=16 -383=16 -384=16 -385=16 -386=16 -387=16 -388=16 -389=16 -390=16 -391=16 -392=16 -393=16 -394=16 -395=16 -396=16 -397=16 -398=16 -399=16 -400=16 -401=16 -402=16 -403=16 -404=16 -405=16 -406=16 -407=16 -408=16 -409=16 -410=16 -411=16 -412=16 -413=16 -414=16 -415=16 -416=16 -417=16 -418=16 -419=16 -420=16 -421=16 -422=16 -423=16 -424=16 -425=16 -426=16 -427=16 -428=16 -429=16 -430=16 -431=16 -432=16 -433=16 -434=16 -435=16 -436=16 -437=16 -438=16 -439=16 -440=16 -441=16 -442=16 -443=16 -444=16 -445=16 -446=16 -447=16 -448=16 -449=16 -450=16 -451=16 -452=16 -453=16 -454=16 -455=16 -456=16 -457=16 -458=16 -459=16 -460=16 -461=16 -462=16 -463=16 -464=16 -465=16 -466=16 -467=16 -468=16 -469=16 -470=16 -471=16 -472=16 -473=16 -474=16 -475=16 -476=16 -477=16 -478=16 -479=16 -480=16 -481=16 -482=16 -483=16 -484=16 -485=16 -486=16 -487=16 -488=16 -489=16 -490=16 -491=16 -492=16 -493=16 -494=16 -495=16 -496=16 -497=16 -498=16 -499=16 -500=16 -501=16 -502=16 -503=16 -504=16 -505=16 -506=16 -507=16 -508=16 -509=16 -510=16 -511=16 -512=16 -513=16 -514=16 -515=16 -516=16 -517=16 -518=16 -519=16 -520=16 -521=16 -522=16 -523=16 -524=16 -525=16 -526=16 -527=16 -528=16 -529=16 -530=16 -531=16 -532=16 -533=16 -534=16 -535=16 -536=16 -537=16 -538=16 -539=16 -540=16 -541=16 -542=16 -543=16 -544=16 -545=16 -546=16 -547=16 -548=16 -549=16 -550=16 -551=16 -552=16 -553=16 -554=16 -555=16 -556=16 -557=16 -558=16 -559=16 -560=16 -561=16 -562=16 -563=16 -564=16 -565=16 -566=16 -567=16 -568=16 -569=16 -570=16 -571=16 -572=16 -573=16 -574=16 -575=16 -576=16 -577=16 -578=16 -579=16 -580=16 -581=16 -582=16 -583=16 -584=16 -585=16 -586=16 -587=16 -588=16 -589=16 -590=16 -591=16 -592=16 -593=16 -594=16 -595=16 -596=16 -597=16 -598=16 -599=16 -600=16 -601=16 -602=16 -603=16 -604=16 -605=16 -606=16 -607=16 -608=16 -609=16 -610=16 -611=16 -612=16 -613=16 -614=16 -615=16 -616=16 -617=16 -618=16 -619=16 -620=16 -621=16 -622=16 -623=16 -624=16 -625=16 -626=16 -627=16 -628=16 -629=16 -630=16 -631=16 -632=16 -633=16 -634=16 -635=16 -636=16 -637=16 -638=16 -639=16 -640=16 -641=16 -642=16 -643=16 -644=16 -645=16 -646=16 -647=16 -648=16 -649=16 -650=16 -651=16 -652=16 -653=16 -654=16 -655=16 -656=16 -657=16 -658=16 -659=16 -660=16 -661=16 -662=16 -663=16 -664=16 -665=16 -666=16 -667=16 -668=16 -669=16 -670=16 -671=16 -672=16 -673=16 -674=16 -675=16 -676=16 -677=16 -678=16 -679=16 -680=16 -681=16 -682=16 -683=16 -684=16 -685=16 -686=16 -687=16 -688=16 -689=16 -690=16 -691=16 -692=16 -693=16 -694=16 -695=16 -696=16 -697=16 -698=16 -699=16 -700=16 -701=16 -702=16 -703=16 -704=16 -705=16 -706=16 -707=16 -708=16 -709=16 -710=16 -711=16 -712=16 -713=16 -714=16 -715=16 -716=16 -717=16 -718=16 -719=16 -720=16 -721=16 -722=16 -723=16 -724=16 -725=16 -726=16 -727=16 -728=16 -729=16 -730=16 -731=16 -732=16 -733=16 -734=16 -735=16 -736=16 -737=16 -738=16 -739=16 -740=16 -741=16 -742=16 -743=16 -744=16 -745=16 -746=16 -747=16 -748=16 -749=16 -750=16 -751=16 -752=16 -753=16 -754=16 -755=16 -756=16 -757=16 -758=16 -759=16 -760=16 -761=16 -762=16 -763=16 -764=16 -765=16 -766=16 -767=16 -768=16 -769=16 -770=16 -771=16 -772=16 -773=16 -774=16 -775=16 -776=16 -777=16 -778=16 -779=16 -780=16 -781=16 -782=16 -783=16 -784=16 -785=16 -786=16 -787=16 -788=16 -789=16 -790=16 -791=16 -792=16 -793=16 -794=16 -795=16 -796=16 -797=16 -798=16 -799=16 -800=16 -801=16 -802=16 -803=16 -804=16 -805=16 -806=16 -807=16 -808=16 -809=16 -810=16 -811=16 -812=16 -813=16 -814=16 -815=16 -816=16 -817=16 -818=16 -819=16 -820=16 -821=16 -822=16 -823=16 -824=16 -825=16 -826=16 -827=16 -828=16 -829=16 -830=16 -831=16 -832=16 -833=16 -834=16 -835=16 -836=16 -837=16 -838=16 -839=16 -840=16 -841=16 -842=16 -843=16 -844=16 -845=16 -846=16 -847=16 -848=16 -849=16 -850=16 -851=16 -852=16 -853=16 -854=16 -855=16 -856=16 -857=16 -858=16 -859=16 -860=16 -861=16 -862=16 -863=16 -864=16 -865=16 -866=16 -867=16 -868=16 -869=16 -870=16 -871=16 -872=16 -873=16 -874=16 -875=16 -876=16 -877=16 -878=16 -879=16 -880=16 -881=16 -882=16 -883=16 -884=16 -885=16 -886=16 -887=16 -888=16 -889=16 -890=16 -891=16 -892=16 -893=16 -894=16 -895=16 -896=16 -897=16 -898=16 -899=16 -900=16 -901=16 -902=16 -903=16 -904=16 -905=16 -906=16 -907=16 -908=16 -909=16 -910=16 -911=16 -912=16 -913=16 -914=16 -915=16 -916=16 -917=16 -918=16 -919=16 -920=16 -921=16 -922=16 -923=16 -924=16 -925=16 -926=16 -927=16 -928=16 -929=16 -930=16 -931=16 -932=16 -933=16 -934=16 -935=16 -936=16 -937=16 -938=16 -939=16 -940=16 -941=16 -942=16 -943=16 -944=16 -945=16 -946=16 -947=16 -948=16 -949=16 -950=16 -951=16 -952=16 -953=16 -954=16 -955=16 -956=16 -957=16 -958=16 -959=16 -960=16 -961=16 -962=16 -963=16 -964=16 -965=16 -966=16 -967=16 -968=16 -969=16 -970=16 -971=16 -972=16 -973=16 -974=16 -975=16 -976=16 -977=16 -978=16 -979=16 -980=16 -981=16 -982=16 -983=16 -984=16 -985=16 -986=16 -987=16 -988=16 -989=16 -990=16 -991=16 -992=16 -993=16 -994=16 -995=16 -996=16 -997=16 -998=16 -999=16 -1000=16 -1001=16 -1002=16 -1003=16 -1004=16 -1005=16 -1006=16 -1007=16 -1008=16 -1009=16 -1010=16 -1011=16 -1012=16 -1013=16 -1014=16 -1015=16 -1016=16 -1017=16 -1018=16 -1019=16 -1020=16 -1021=16 -1022=16 -1023=16 -1024=16 -1025=16 -1026=16 -1027=16 -1028=16 -1029=16 -1030=16 -1031=16 -1032=16 -1033=16 -1034=16 -1035=16 -1036=16 -1037=16 -1038=16 -1039=16 -1040=16 -1041=16 -1042=16 -1043=16 -1044=16 -1045=16 -1046=16 -1047=16 -1048=16 -1049=16 -1050=16 -1051=16 -1052=16 -1053=16 -1054=16 -1055=16 -1056=16 -1057=16 -1058=16 -1059=16 -1060=16 -1061=16 -1062=16 -1063=16 -1064=16 -1065=16 -1066=16 -1067=16 -1068=16 -1069=16 -1070=16 -1071=16 -1072=16 -1073=16 -1074=16 -1075=16 -1076=16 -1077=16 -1078=16 -1079=16 -1080=16 -1081=16 -1082=16 -1083=16 -1084=16 -1085=16 -1086=16 -1087=16 -1088=16 -1089=16 -1090=16 -1091=16 -1092=16 -1093=16 -1094=16 -1095=16 -1096=16 -1097=16 -1098=16 -1099=16 -1100=16 -1101=16 -1102=16 -1103=16 -1104=16 -1105=16 -1106=16 -1107=16 -1108=16 -1109=16 -1110=16 -1111=16 -1112=16 -1113=16 -1114=16 -1115=16 -1116=16 -1117=16 -1118=16 -1119=16 -1120=16 -1121=16 -1122=16 -1123=16 -1124=16 -1125=16 -1126=16 -1127=16 -1128=16 -1129=16 -1130=16 -1131=16 -1132=16 -1133=16 -1134=16 -1135=16 -1136=16 -1137=16 -1138=16 -1139=16 -1140=16 -1141=16 -1142=16 -1143=16 -1144=16 -1145=16 -1146=16 -1147=16 -1148=16 -1149=16 -1150=16 -1151=16 -1152=16 -1153=16 -1154=16 -1155=16 -1156=16 -1157=16 -1158=16 -1159=16 -1160=16 -1161=16 -1162=16 -1163=16 -1164=16 -1165=16 -1166=16 -1167=16 -1168=16 -1169=16 -1170=16 -1171=16 -1172=16 -1173=16 -1174=16 -1175=16 -1176=16 -1177=16 -1178=16 -1179=16 -1180=16 -1181=16 -1182=16 -1183=16 -1184=16 -1185=16 -1186=16 -1187=16 -1188=16 -1189=16 -1190=16 -1191=16 -1192=16 -1193=16 -1194=16 -1195=16 -1196=16 -1197=16 -1198=16 -1199=16 -1200=16 -1201=16 -1202=16 -1203=16 -1204=16 -1205=16 -1206=16 -1207=16 -1208=16 -1209=16 -1210=16 -1211=16 -1212=16 -1213=16 -1214=16 -1215=16 -1216=16 -1217=16 -1218=16 -1219=16 -1220=16 -1221=16 -1222=16 -1223=16 -1224=16 -1225=16 -1226=16 -1227=16 -1228=16 -1229=16 -1230=16 -1231=16 -1232=16 -1233=16 -1234=16 -1235=16 -1236=16 -1237=16 -1238=16 -1239=16 -1240=16 -1241=16 -1242=16 -1243=16 -1244=16 -1245=16 -1246=16 -1247=16 -1248=16 -1249=16 -1250=16 -1251=16 -1252=16 -1253=16 -1254=16 -1255=16 -1256=16 -1257=16 -1258=16 -1259=16 -1260=16 -1261=16 -1262=16 -1263=16 -1264=16 -1265=16 -1266=16 -1267=16 -1268=16 -1269=16 -1270=16 -1271=16 -1272=16 -1273=16 -1274=16 -1275=16 -1276=16 -1277=16 -1278=16 -1279=16 -1280=16 -1281=16 -1282=16 -1283=16 -1284=16 -1285=16 -1286=16 -1287=16 -1288=16 -1289=16 -1290=16 -1291=16 -1292=16 -1293=16 -1294=16 -1295=16 -1296=16 -1297=16 -1298=16 -1299=16 -1300=16 -1301=16 -1302=16 -1303=16 -1304=16 -1305=16 -1306=16 -1307=16 -1308=16 -1309=16 -1310=16 -1311=16 -1312=16 -1313=16 -1314=16 -1315=16 -1316=16 -1317=16 -1318=16 -1319=16 -1320=16 -1321=16 -1322=16 -1323=16 -1324=16 -1325=16 -1326=16 -1327=16 -1328=16 -1329=16 -1330=16 -1331=16 -1332=16 -1333=16 -1334=16 -1335=16 -1336=16 -1337=16 -1338=16 -1339=16 -1340=16 -1341=16 -1342=16 -1343=16 -1344=16 -1345=16 -1346=16 -1347=16 -1348=16 -1349=16 -1350=16 -1351=16 -1352=16 -1353=16 -1354=16 -1355=16 -1356=16 -1357=16 -1358=16 -1359=16 -1360=16 -1361=16 -1362=16 -1363=16 -1364=16 -1365=16 -1366=16 -1367=16 -1368=16 -1369=16 -1370=16 -1371=16 -1372=16 -1373=16 -1374=16 -1375=16 -1376=16 -1377=16 -1378=16 -1379=16 -1380=16 -1381=16 -1382=16 -1383=16 -1384=16 -1385=16 -1386=16 -1387=16 -1388=16 -1389=16 -1390=16 -1391=16 -1392=16 -1393=16 -1394=16 -1395=16 -1396=16 -1397=16 -1398=16 -1399=16 -1400=16 -1401=16 -1402=16 -1403=16 -1404=16 -1405=16 -1406=16 -1407=16 -1408=16 -1409=16 -1410=16 -1411=16 -1412=16 -1413=16 -1414=16 -1415=16 -1416=16 -1417=16 -1418=16 -1419=16 -1420=16 -1421=16 -1422=16 -1423=16 -1424=16 -1425=16 -1426=16 -1427=16 -1428=16 -1429=16 -1430=16 -1431=16 -1432=16 -1433=16 -1434=16 -1435=16 -1436=16 -1437=16 -1438=16 -1439=16 -1440=16 -1441=16 -1442=16 -1443=16 -1444=16 -1445=16 -1446=16 -1447=16 -1448=16 -1449=16 -1450=16 -1451=16 -1452=16 -1453=16 -1454=16 -1455=16 -1456=16 -1457=16 -1458=16 -1459=16 -1460=16 -1461=16 -1462=16 -1463=16 -1464=16 -1465=16 -1466=16 -1467=16 -1468=16 -1469=16 -1470=16 -1471=16 -1472=16 -1473=16 -1474=16 -1475=16 -1476=16 -1477=16 -1478=16 -1479=16 -1480=16 -1481=16 -1482=16 -1483=16 -1484=16 -1485=16 -1486=16 -1487=16 -1488=16 -1489=16 -1490=16 -1491=16 -1492=16 -1493=16 -1494=16 -1495=16 -1496=16 -1497=16 -1498=16 -1499=16 -1500=16 -1501=16 -1502=16 -1503=16 -1504=16 -1505=16 -1506=16 -1507=16 -1508=16 -1509=16 -1510=16 -1511=16 -1512=16 -1513=16 -1514=16 -1515=16 -1516=16 -1517=16 -1518=16 -1519=16 -1520=16 -1521=16 -1522=16 -1523=16 -1524=16 -1525=16 -1526=16 -1527=16 -1528=16 -1529=16 -1530=16 -1531=16 -1532=16 -1533=16 -1534=16 -1535=16 -1536=16 -1537=16 -1538=16 -1539=16 -1540=16 -1541=16 -1542=16 -1543=16 -1544=16 -1545=16 -1546=16 -1547=16 -1548=16 -1549=16 -1550=16 -1551=16 -1552=16 -1553=16 -1554=16 -1555=16 -1556=16 -1557=16 -1558=16 -1559=16 -1560=16 -1561=16 -1562=16 -1563=16 -1564=16 -1565=16 -1566=16 -1567=16 -1568=16 -1569=16 -1570=16 -1571=16 -1572=16 -1573=16 -1574=16 -1575=16 -1576=16 -1577=16 -1578=16 -1579=16 -1580=16 -1581=16 -1582=16 -1583=16 -1584=16 -1585=16 -1586=16 -1587=16 -1588=16 -1589=16 -1590=16 -1591=16 -1592=16 -1593=16 -1594=16 -1595=16 -1596=16 -1597=16 -1598=16 -1599=16 -1600=16 -1601=16 -1602=16 -1603=16 -1604=16 -1605=16 -1606=16 -1607=16 -1608=16 -1609=16 -1610=16 -1611=16 -1612=16 -1613=16 -1614=16 -1615=16 -1616=16 -1617=16 -1618=16 -1619=16 -1620=16 -1621=16 -1622=16 -1623=16 -1624=16 -1625=16 -1626=16 -1627=16 -1628=16 -1629=16 -1630=16 -1631=16 -1632=16 -1633=16 -1634=16 -1635=16 -1636=16 -1637=16 -1638=16 -1639=16 -1640=16 -1641=16 -1642=16 -1643=16 -1644=16 -1645=16 -1646=16 -1647=16 -1648=16 -1649=16 -1650=16 -1651=16 -1652=16 -1653=16 -1654=16 -1655=16 -1656=16 -1657=16 -1658=16 -1659=16 -1660=16 -1661=16 -1662=16 -1663=16 -1664=16 -1665=16 -1666=16 -1667=16 -1668=16 -1669=16 -1670=16 -1671=16 -1672=16 -1673=16 -1674=16 -1675=16 -1676=16 -1677=16 -1678=16 -1679=16 -1680=16 -1681=16 -1682=16 -1683=16 -1684=16 -1685=16 -1686=16 -1687=16 -1688=16 -1689=16 -1690=16 -1691=16 -1692=16 -1693=16 -1694=16 -1695=16 -1696=16 -1697=16 -1698=16 -1699=16 -1700=16 -1701=16 -1702=16 -1703=16 -1704=16 -1705=16 -1706=16 -1707=16 -1708=16 -1709=16 -1710=16 -1711=16 -1712=16 -1713=16 -1714=16 -1715=16 -1716=16 -1717=16 -1718=16 -1719=16 -1720=16 -1721=16 -1722=16 -1723=16 -1724=16 -1725=16 -1726=16 -1727=16 -1728=16 -1729=16 -1730=16 -1731=16 -1732=16 -1733=16 -1734=16 -1735=16 -1736=16 -1737=16 -1738=16 -1739=16 -1740=16 -1741=16 -1742=16 -1743=16 -1744=16 -1745=16 -1746=16 -1747=16 -1748=16 -1749=16 -1750=16 -1751=16 -1752=16 -1753=16 -1754=16 -1755=16 -1756=16 -1757=16 -1758=16 -1759=16 -1760=16 -1761=16 -1762=16 -1763=16 -1764=16 -1765=16 -1766=16 -1767=16 -1768=16 -1769=16 -1770=16 -1771=16 -1772=16 -1773=16 -1774=16 -1775=16 -1776=16 -1777=16 -1778=16 -1779=16 -1780=16 -1781=16 -1782=16 -1783=16 -1784=16 -1785=16 -1786=16 -1787=16 -1788=16 -1789=16 -1790=16 -1791=16 -1792=16 -1793=16 -1794=16 -1795=16 -1796=16 -1797=16 -1798=16 -1799=16 -1800=16 -1801=16 -1802=16 -1803=16 -1804=16 -1805=16 -1806=16 -1807=16 -1808=16 -1809=16 -1810=16 -1811=16 -1812=16 -1813=16 -1814=16 -1815=16 -1816=16 -1817=16 -1818=16 -1819=16 -1820=16 -1821=16 -1822=16 -1823=16 -1824=16 -1825=16 -1826=16 -1827=16 -1828=16 -1829=16 -1830=16 -1831=16 -1832=16 -1833=16 -1834=16 -1835=16 -1836=16 -1837=16 -1838=16 -1839=16 -1840=16 -1841=16 -1842=16 -1843=16 -1844=16 -1845=16 -1846=16 -1847=16 -1848=16 -1849=16 -1850=16 -1851=16 -1852=16 -1853=16 -1854=16 -1855=16 -1856=16 -1857=16 -1858=16 -1859=16 -1860=16 -1861=16 -1862=16 -1863=16 -1864=16 -1865=16 -1866=16 -1867=16 -1868=16 -1869=16 -1870=16 -1871=16 -1872=16 -1873=16 -1874=16 -1875=16 -1876=16 -1877=16 -1878=16 -1879=16 -1880=16 -1881=16 -1882=16 -1883=16 -1884=16 -1885=16 -1886=16 -1887=16 -1888=16 -1889=16 -1890=16 -1891=16 -1892=16 -1893=16 -1894=16 -1895=16 -1896=16 -1897=16 -1898=16 -1899=16 -1900=16 -1901=16 -1902=16 -1903=16 -1904=16 -1905=16 -1906=16 -1907=16 -1908=16 -1909=16 -1910=16 -1911=16 -1912=16 -1913=16 -1914=16 -1915=16 -1916=16 -1917=16 -1918=16 -1919=16 -1920=16 -1921=16 -1922=16 -1923=16 -1924=16 -1925=16 -1926=16 -1927=16 -1928=16 -1929=16 -1930=16 -1931=16 -1932=16 -1933=16 -1934=16 -1935=16 -1936=16 -1937=16 -1938=16 -1939=16 -1940=16 -1941=16 -1942=16 -1943=16 -1944=16 -1945=16 -1946=16 -1947=16 -1948=16 -1949=16 -1950=16 -1951=16 -1952=16 -1953=16 -1954=16 -1955=16 -1956=16 -1957=16 -1958=16 -1959=16 -1960=16 -1961=16 -1962=16 -1963=16 -1964=16 -1965=16 -1966=16 -1967=16 -1968=16 -1969=16 -1970=16 -1971=16 -1972=16 -1973=16 -1974=16 -1975=16 -1976=16 -1977=16 -1978=16 -1979=16 -1980=16 -1981=16 -1982=16 -1983=16 -1984=16 -1985=16 -1986=16 -1987=16 -1988=16 -1989=16 -1990=16 -1991=16 -1992=16 -1993=16 -1994=16 -1995=16 -1996=16 -1997=16 -1998=16 -1999=16 -2000=16 -2001=16 -2002=16 -2003=16 -2004=16 -2005=16 -2006=16 -2007=16 -2008=16 -2009=16 -2010=16 -2011=16 -2012=16 -2013=16 -2014=16 -2015=16 -2016=16 -2017=16 -2018=16 -2019=16 -2020=16 -2021=16 -2022=16 -2023=16 -2024=16 -2025=16 -2026=16 -2027=16 -2028=16 -2029=16 -2030=16 -2031=16 -2032=16 -2033=16 -2034=16 -2035=16 -2036=16 -2037=16 -2038=16 -2039=16 -2040=16 -2041=16 -2042=16 -2043=16 -2044=16 -2045=16 -2046=16 -2047=16 -2048=16 -2049=16 -2050=16 -2051=16 -2052=16 -2053=16 -2054=16 -2055=16 -2056=16 -2057=16 -2058=16 -2059=16 -2060=16 -2061=16 -2062=16 -2063=16 -2064=16 -2065=16 -2066=16 -2067=16 -2068=16 -2069=16 -2070=16 -2071=16 -2072=16 -2073=16 -2074=16 -2075=16 -2076=16 -2077=16 -2078=16 -2079=16 -2080=16 -2081=16 -2082=16 -2083=16 -2084=16 -2085=16 -2086=16 -2087=16 -2088=16 -2089=16 -2090=16 -2091=16 -2092=16 -2093=16 -2094=16 -2095=16 -2096=16 -2097=16 -2098=16 -2099=16 -2100=16 -2101=16 -2102=16 -2103=16 -2104=16 -2105=16 -2106=16 -2107=16 -2108=16 -2109=16 -2110=16 -2111=16 -2112=16 -2113=16 -2114=16 -2115=16 -2116=16 -2117=16 -2118=16 -2119=16 -2120=16 -2121=16 -2122=16 -2123=16 -2124=16 -2125=16 -2126=16 -2127=16 -2128=16 -2129=16 -2130=16 -2131=16 -2132=16 -2133=16 -2134=16 -2135=16 -2136=16 -2137=16 -2138=16 -2139=16 -2140=16 -2141=16 -2142=16 -2143=16 -2144=16 -2145=16 -2146=16 -2147=16 -2148=16 -2149=16 -2150=16 -2151=16 -2152=16 -2153=16 -2154=16 -2155=16 -2156=16 -2157=16 -2158=16 -2159=16 -2160=16 -2161=16 -2162=16 -2163=16 -2164=16 -2165=16 -2166=16 -2167=16 -2168=16 -2169=16 -2170=16 -2171=16 -2172=16 -2173=16 -2174=16 -2175=16 -2176=16 -2177=16 -2178=16 -2179=16 -2180=16 -2181=16 -2182=16 -2183=16 -2184=16 -2185=16 -2186=16 -2187=16 -2188=16 -2189=16 -2190=16 -2191=16 -2192=16 -2193=16 -2194=16 -2195=16 -2196=16 -2197=16 -2198=16 -2199=16 -2200=16 -2201=16 -2202=16 -2203=16 -2204=16 -2205=16 -2206=16 -2207=16 -2208=16 -2209=16 -2210=16 -2211=16 -2212=16 -2213=16 -2214=16 -2215=16 -2216=16 -2217=16 -2218=16 -2219=16 -2220=16 -2221=16 -2222=16 -2223=16 -2224=16 -2225=16 -2226=16 -2227=16 -2228=16 -2229=16 -2230=16 -2231=16 -2232=16 -2233=16 -2234=16 -2235=16 -2236=16 -2237=16 -2238=16 -2239=16 -2240=16 -2241=16 -2242=16 -2243=16 -2244=16 -2245=16 -2246=16 -2247=16 -2248=16 -2249=16 -2250=16 -2251=16 -2252=16 -2253=16 -2254=16 -2255=16 -2256=16 -2257=16 -2258=16 -2259=16 -2260=16 -2261=16 -2262=16 -2263=16 -2264=16 -2265=16 -2266=16 -2267=16 -2268=16 -2269=16 -2270=16 -2271=16 -2272=16 -2273=16 -2274=16 -2275=16 -2276=16 -2277=16 -2278=16 -2279=16 -2280=16 -2281=16 -2282=16 -2283=16 -2284=16 -2285=16 -2286=16 -2287=16 -2288=16 -2289=16 -2290=16 -2291=16 -2292=16 -2293=16 -2294=16 -2295=16 -2296=16 -2297=16 -2298=16 -2299=16 -2300=16 -2301=16 -2302=16 -2303=16 -2304=16 -2305=16 -2306=16 -2307=16 -2308=16 -2309=16 -2310=16 -2311=16 -2312=16 -2313=16 -2314=16 -2315=16 -2316=16 -2317=16 -2318=16 -2319=16 -2320=16 -2321=16 -2322=16 -2323=16 -2324=16 -2325=16 -2326=16 -2327=16 -2328=16 -2329=16 -2330=16 -2331=16 -2332=16 -2333=16 -2334=16 -2335=16 -2336=16 -2337=16 -2338=16 -2339=16 -2340=16 -2341=16 -2342=16 -2343=16 -2344=16 -2345=16 -2346=16 -2347=16 -2348=16 -2349=16 -2350=16 -2351=16 -2352=16 -2353=16 -2354=16 -2355=16 -2356=16 -2357=16 -2358=16 -2359=16 -2360=16 -2361=16 -2362=16 -2363=16 -2364=16 -2365=16 -2366=16 -2367=16 -2368=16 -2369=16 -2370=16 -2371=16 -2372=16 -2373=16 -2374=16 -2375=16 -2376=16 -2377=16 -2378=16 -2379=16 -2380=16 -2381=16 -2382=16 -2383=16 -2384=16 -2385=16 -2386=16 -2387=16 -2388=16 -2389=16 -2390=16 -2391=16 -2392=16 -2393=16 -2394=16 -2395=16 -2396=16 -2397=16 -2398=16 -2399=16 -2400=16 -2401=16 -2402=16 -2403=16 -2404=16 -2405=16 -2406=16 -2407=16 -2408=16 -2409=16 -2410=16 -2411=16 -2412=16 -2413=16 -2414=16 -2415=16 -2416=16 -2417=16 -2418=16 -2419=16 -2420=16 -2421=16 -2422=16 -2423=16 -2424=16 -2425=16 -2426=16 -2427=16 -2428=16 -2429=16 -2430=16 -2431=16 -2432=16 -2433=16 -2434=16 -2435=16 -2436=16 -2437=16 -2438=16 -2439=16 -2440=16 -2441=16 -2442=16 -2443=16 -2444=16 -2445=16 -2446=16 -2447=16 -2448=16 -2449=16 -2450=16 -2451=16 -2452=16 -2453=16 -2454=16 -2455=16 -2456=16 -2457=16 -2458=16 -2459=16 -2460=16 -2461=16 -2462=16 -2463=16 -2464=16 -2465=16 -2466=16 -2467=16 -2468=16 -2469=16 -2470=16 -2471=16 -2472=16 -2473=16 -2474=16 -2475=16 -2476=16 -2477=16 -2478=16 -2479=16 -2480=16 -2481=16 -2482=16 -2483=16 -2484=16 -2485=16 -2486=16 -2487=16 -2488=16 -2489=16 -2490=16 -2491=16 -2492=16 -2493=16 -2494=16 -2495=16 -2496=16 -2497=16 -2498=16 -2499=16 -2500=16 -2501=16 -2502=16 -2503=16 -2504=16 -2505=16 -2506=16 -2507=16 -2508=16 -2509=16 -2510=16 -2511=16 -2512=16 -2513=16 -2514=16 -2515=16 -2516=16 -2517=16 -2518=16 -2519=16 -2520=16 -2521=16 -2522=16 -2523=16 -2524=16 -2525=16 -2526=16 -2527=16 -2528=16 -2529=16 -2530=16 -2531=16 -2532=16 -2533=16 -2534=16 -2535=16 -2536=16 -2537=16 -2538=16 -2539=16 -2540=16 -2541=16 -2542=16 -2543=16 -2544=16 -2545=16 -2546=16 -2547=16 -2548=16 -2549=16 -2550=16 -2551=16 -2552=16 -2553=16 -2554=16 -2555=16 -2556=16 -2557=16 -2558=16 -2559=16 -2560=16 -2561=16 -2562=16 -2563=16 -2564=16 -2565=16 -2566=16 -2567=16 -2568=16 -2569=16 -2570=16 -2571=16 -2572=16 -2573=16 -2574=16 -2575=16 -2576=16 -2577=16 -2578=16 -2579=16 -2580=16 -2581=16 -2582=16 -2583=16 -2584=16 -2585=16 -2586=16 -2587=16 -2588=16 -2589=16 -2590=16 -2591=16 -2592=16 -2593=16 -2594=16 -2595=16 -2596=16 -2597=16 -2598=16 -2599=16 -2600=16 -2601=16 -2602=16 -2603=16 -2604=16 -2605=16 -2606=16 -2607=16 -2608=16 -2609=16 -2610=16 -2611=16 -2612=16 -2613=16 -2614=16 -2615=16 -2616=16 -2617=16 -2618=16 -2619=16 -2620=16 -2621=16 -2622=16 -2623=16 -2624=16 -2625=16 -2626=16 -2627=16 -2628=16 -2629=16 -2630=16 -2631=16 -2632=16 -2633=16 -2634=16 -2635=16 -2636=16 -2637=16 -2638=16 -2639=16 -2640=16 -2641=16 -2642=16 -2643=16 -2644=16 -2645=16 -2646=16 -2647=16 -2648=16 -2649=16 -2650=16 -2651=16 -2652=16 -2653=16 -2654=16 -2655=16 -2656=16 -2657=16 -2658=16 -2659=16 -2660=16 -2661=16 -2662=16 -2663=16 -2664=16 -2665=16 -2666=16 -2667=16 -2668=16 -2669=16 -2670=16 -2671=16 -2672=16 -2673=16 -2674=16 -2675=16 -2676=16 -2677=16 -2678=16 -2679=16 -2680=16 -2681=16 -2682=16 -2683=16 -2684=16 -2685=16 -2686=16 -2687=16 -2688=16 -2689=16 -2690=16 -2691=16 -2692=16 -2693=16 -2694=16 -2695=16 -2696=16 -2697=16 -2698=16 -2699=16 -2700=16 -2701=16 -2702=16 -2703=16 -2704=16 -2705=16 -2706=16 -2707=16 -2708=16 -2709=16 -2710=16 -2711=16 -2712=16 -2713=16 -2714=16 -2715=16 -2716=16 -2717=16 -2718=16 -2719=16 -2720=16 -2721=16 -2722=16 -2723=16 -2724=16 -2725=16 -2726=16 -2727=16 -2728=16 -2729=16 -2730=16 -2731=16 -2732=16 -2733=16 -2734=16 -2735=16 -2736=16 -2737=16 -2738=16 -2739=16 -2740=16 -2741=16 -2742=16 -2743=16 -2744=16 -2745=16 -2746=16 -2747=16 -2748=16 -2749=16 -2750=16 -2751=16 -2752=16 -2753=16 -2754=16 -2755=16 -2756=16 -2757=16 -2758=16 -2759=16 -2760=16 -2761=16 -2762=16 -2763=16 -2764=16 -2765=16 -2766=16 -2767=16 -2768=16 -2769=16 -2770=16 -2771=16 -2772=16 -2773=16 -2774=16 -2775=16 -2776=16 -2777=16 -2778=16 -2779=16 -2780=16 -2781=16 -2782=16 -2783=16 -2784=16 -2785=16 -2786=16 -2787=16 -2788=16 -2789=16 -2790=16 -2791=16 -2792=16 -2793=16 -2794=16 -2795=16 -2796=16 -2797=16 -2798=16 -2799=16 -2800=16 -2801=16 -2802=16 -2803=16 -2804=16 -2805=16 -2806=16 -2807=16 -2808=16 -2809=16 -2810=16 -2811=16 -2812=16 -2813=16 -2814=16 -2815=16 -2816=16 -2817=16 -2818=16 -2819=16 -2820=16 -2821=16 -2822=16 -2823=16 -2824=16 -2825=16 -2826=16 -2827=16 -2828=16 -2829=16 -2830=16 -2831=16 -2832=16 -2833=16 -2834=16 -2835=16 -2836=16 -2837=16 -2838=16 -2839=16 -2840=16 -2841=16 -2842=16 -2843=16 -2844=16 -2845=16 -2846=16 -2847=16 -2848=16 -2849=16 -2850=16 -2851=16 -2852=16 -2853=16 -2854=16 -2855=16 -2856=16 -2857=16 -2858=16 -2859=16 -2860=16 -2861=16 -2862=16 -2863=16 -2864=16 -2865=16 -2866=16 -2867=16 -2868=16 -2869=16 -2870=16 -2871=16 -2872=16 -2873=16 -2874=16 -2875=16 -2876=16 -2877=16 -2878=16 -2879=16 -2880=16 -2881=16 -2882=16 -2883=16 -2884=16 -2885=16 -2886=16 -2887=16 -2888=16 -2889=16 -2890=16 -2891=16 -2892=16 -2893=16 -2894=16 -2895=16 -2896=16 -2897=16 -2898=16 -2899=16 -2900=16 -2901=16 -2902=16 -2903=16 -2904=16 -2905=16 -2906=16 -2907=16 -2908=16 -2909=16 -2910=16 -2911=16 -2912=16 -2913=16 -2914=16 -2915=16 -2916=16 -2917=16 -2918=16 -2919=16 -2920=16 -2921=16 -2922=16 -2923=16 -2924=16 -2925=16 -2926=16 -2927=16 -2928=16 -2929=16 -2930=16 -2931=16 -2932=16 -2933=16 -2934=16 -2935=16 -2936=16 -2937=16 -2938=16 -2939=16 -2940=16 -2941=16 -2942=16 -2943=16 -2944=16 -2945=16 -2946=16 -2947=16 -2948=16 -2949=16 -2950=16 -2951=16 -2952=16 -2953=16 -2954=16 -2955=16 -2956=16 -2957=16 -2958=16 -2959=16 -2960=16 -2961=16 -2962=16 -2963=16 -2964=16 -2965=16 -2966=16 -2967=16 -2968=16 -2969=16 -2970=16 -2971=16 -2972=16 -2973=16 -2974=16 -2975=16 -2976=16 -2977=16 -2978=16 -2979=16 -2980=16 -2981=16 -2982=16 -2983=16 -2984=16 -2985=16 -2986=16 -2987=16 -2988=16 -2989=16 -2990=16 -2991=16 -2992=16 -2993=16 -2994=16 -2995=16 -2996=16 -2997=16 -2998=16 -2999=16 -3000=16 -3001=16 -3002=16 -3003=16 -3004=16 -3005=16 -3006=16 -3007=16 -3008=16 -3009=16 -3010=16 -3011=16 -3012=16 -3013=16 -3014=16 -3015=16 -3016=16 -3017=16 -3018=16 -3019=16 -3020=16 -3021=16 -3022=16 -3023=16 -3024=16 -3025=16 -3026=16 -3027=16 -3028=16 -3029=16 -3030=16 -3031=16 -3032=16 -3033=16 -3034=16 -3035=16 -3036=16 -3037=16 -3038=16 -3039=16 -3040=16 -3041=16 -3042=16 -3043=16 -3044=16 -3045=16 -3046=16 -3047=16 -3048=16 -3049=16 -3050=16 -3051=16 -3052=16 -3053=16 -3054=16 -3055=16 -3056=16 -3057=16 -3058=16 -3059=16 -3060=16 -3061=16 -3062=16 -3063=16 -3064=16 -3065=16 -3066=16 -3067=16 -3068=16 -3069=16 -3070=16 -3071=16 -3072=16 -3073=16 -3074=16 -3075=16 -3076=16 -3077=16 -3078=16 -3079=16 -3080=16 -3081=16 -3082=16 -3083=16 -3084=16 -3085=16 -3086=16 -3087=16 -3088=16 -3089=16 -3090=16 -3091=16 -3092=16 -3093=16 -3094=16 -3095=16 -3096=16 -3097=16 -3098=16 -3099=16 -3100=16 -3101=16 -3102=16 -3103=16 -3104=16 -3105=16 -3106=16 -3107=16 -3108=16 -3109=16 -3110=16 -3111=16 -3112=16 -3113=16 -3114=16 -3115=16 -3116=16 -3117=16 -3118=16 -3119=16 -3120=16 -3121=16 -3122=16 -3123=16 -3124=16 -3125=16 -3126=16 -3127=16 -3128=16 -3129=16 -3130=16 -3131=16 -3132=16 -3133=16 -3134=16 -3135=16 -3136=16 -3137=16 -3138=16 -3139=16 -3140=16 -3141=16 -3142=16 -3143=16 -3144=16 -3145=16 -3146=16 -3147=16 -3148=16 -3149=16 -3150=16 -3151=16 -3152=16 -3153=16 -3154=16 -3155=16 -3156=16 -3157=16 -3158=16 -3159=16 -3160=16 -3161=16 -3162=16 -3163=16 -3164=16 -3165=16 -3166=16 -3167=16 -3168=16 -3169=16 -3170=16 -3171=16 -3172=16 -3173=16 -3174=16 -3175=16 -3176=16 -3177=16 -3178=16 -3179=16 -3180=16 -3181=16 -3182=16 -3183=16 -3184=16 -3185=16 -3186=16 -3187=16 -3188=16 -3189=16 -3190=16 -3191=16 -3192=16 -3193=16 -3194=16 -3195=16 -3196=16 -3197=16 -3198=16 -3199=16 -3200=16 -3201=16 -3202=16 -3203=16 -3204=16 -3205=16 -3206=16 -3207=16 -3208=16 -3209=16 -3210=16 -3211=16 -3212=16 -3213=16 -3214=16 -3215=16 -3216=16 -3217=16 -3218=16 -3219=16 -3220=16 -3221=16 -3222=16 -3223=16 -3224=16 -3225=16 -3226=16 -3227=16 -3228=16 -3229=16 -3230=16 -3231=16 -3232=16 -3233=16 -3234=16 -3235=16 -3236=16 -3237=16 -3238=16 -3239=16 -3240=16 -3241=16 -3242=16 -3243=16 -3244=16 -3245=16 -3246=16 -3247=16 -3248=16 -3249=16 -3250=16 -3251=16 -3252=16 -3253=16 -3254=16 -3255=16 -3256=16 -3257=16 -3258=16 -3259=16 -3260=16 -3261=16 -3262=16 -3263=16 -3264=16 -3265=16 -3266=16 -3267=16 -3268=16 -3269=16 -3270=16 -3271=16 -3272=16 -3273=16 -3274=16 -3275=16 -3276=16 -3277=16 -3278=16 -3279=16 -3280=16 -3281=16 -3282=16 -3283=16 -3284=16 -3285=16 -3286=16 -3287=16 -3288=16 -3289=16 -3290=16 -3291=16 -3292=16 -3293=16 -3294=16 -3295=16 -3296=16 -3297=16 -3298=16 -3299=16 -3300=16 -3301=16 -3302=16 -3303=16 -3304=16 -3305=16 -3306=16 -3307=16 -3308=16 -3309=16 -3310=16 -3311=16 -3312=16 -3313=16 -3314=16 -3315=16 -3316=16 -3317=16 -3318=16 -3319=16 -3320=16 -3321=16 -3322=16 -3323=16 -3324=16 -3325=16 -3326=16 -3327=16 -3328=16 -3329=16 -3330=16 -3331=16 -3332=16 -3333=16 -3334=16 -3335=16 -3336=16 -3337=16 -3338=16 -3339=16 -3340=16 -3341=16 -3342=16 -3343=16 -3344=16 -3345=16 -3346=16 -3347=16 -3348=16 -3349=16 -3350=16 -3351=16 -3352=16 -3353=16 -3354=16 -3355=16 -3356=16 -3357=16 -3358=16 -3359=16 -3360=16 -3361=16 -3362=16 -3363=16 -3364=16 -3365=16 -3366=16 -3367=16 -3368=16 -3369=16 -3370=16 -3371=16 -3372=16 -3373=16 -3374=16 -3375=16 -3376=16 -3377=16 -3378=16 -3379=16 -3380=16 -3381=16 -3382=16 -3383=16 -3384=16 -3385=16 -3386=16 -3387=16 -3388=16 -3389=16 +[common] +Baseline=18 +Top=9 +LineSpacing=24 +DrawExtraPixelsLeft=1 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 + +[main] +range basic-japanese=0 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=7 +31=16 +32=16 +33=20 +34=20 +35=20 +36=20 +37=20 +38=20 +39=20 +40=20 +41=20 +42=20 +43=20 +44=20 +45=20 +46=20 +47=20 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=20 +57=20 +58=20 +59=16 +60=16 +61=16 +62=20 +63=20 +64=20 +65=16 +66=16 +67=16 +68=16 +69=16 +70=16 +71=16 +72=16 +73=16 +74=16 +75=16 +76=16 +77=16 +78=16 +79=16 +80=16 +81=16 +82=16 +83=16 +84=16 +85=16 +86=16 +87=16 +88=16 +89=16 +90=16 +91=16 +92=16 +93=16 +94=16 +95=16 +96=16 +97=16 +98=16 +99=16 +100=16 +101=16 +102=16 +103=16 +104=16 +105=16 +106=16 +107=16 +108=16 +109=16 +110=16 +111=16 +112=16 +113=16 +114=16 +115=16 +116=16 +117=16 +118=16 +119=16 +120=16 +121=16 +122=16 +123=16 +124=16 +125=16 +126=16 +127=16 +128=16 +129=16 +130=16 +131=16 +132=16 +133=16 +134=16 +135=16 +136=16 +137=16 +138=16 +139=16 +140=16 +141=16 +142=16 +143=16 +144=16 +145=16 +146=16 +147=16 +148=16 +149=16 +150=16 +151=20 +152=20 +153=16 +154=16 +155=16 +156=16 +157=16 +158=16 +159=16 +160=16 +161=16 +162=16 +163=16 +164=16 +165=16 +166=16 +167=16 +168=16 +169=16 +170=16 +171=16 +172=16 +173=16 +174=16 +175=16 +176=16 +177=16 +178=16 +179=16 +180=16 +181=16 +182=16 +183=16 +184=16 +185=16 +186=16 +187=16 +188=16 +189=16 +190=16 +191=16 +192=16 +193=16 +194=16 +195=16 +196=16 +197=16 +198=16 +199=16 +200=16 +201=16 +202=16 +203=16 +204=16 +205=16 +206=16 +207=16 +208=16 +209=16 +210=16 +211=16 +212=16 +213=16 +214=16 +215=16 +216=16 +217=16 +218=16 +219=16 +220=16 +221=16 +222=16 +223=16 +224=16 +225=16 +226=16 +227=16 +228=16 +229=16 +230=16 +231=16 +232=16 +233=16 +234=16 +235=16 +236=16 +237=16 +238=16 +239=16 +240=16 +241=16 +242=16 +243=16 +244=16 +245=16 +246=16 +247=16 +248=16 +249=16 +250=16 +251=16 +252=16 +253=16 +254=16 +255=16 + +[kanji 1] +Line 0=難易定変更押画曲 +Line 1=現在選択項目同設 +Line 2=開閉内覧表示詳細 +Line 3=及作矢印場警告可 +Line 4=能性処理速数値超 +Line 5=効使特固省略出詞 +Line 6=操全演奏進点機移 +Line 7=左右変更以外背景 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 2] +Line 0=義背景危険状態習 +Line 1=譜判減少率適増加 +Line 2=無終了関係参考他 +Line 3=言変換評価条件突 +Line 4=事追不切常除次等 +Line 5=低戻厳残基途非制 +Line 6=限配保存秒反応専 +Line 7=誤防整央隠僕援起 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 3] +Line 0=相撲屋何穴名例匂 +Line 1=心揺鼻当腹鳴痢便 +Line 2=尻拭鋼雫暗黒迷路 +Line 3=探検前員浮駐接続 +Line 4=類士諸君品物困声 +Line 5=口調食党結婚身久 +Line 6=友電話廃休酒飲引 +Line 7=篭奴学職手葉宿馬 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 4] +Line 0=京宿浪暮横巣鴨優 +Line 1=居思手線回続分然 +Line 2=取達聴最字辞書独 +Line 3=季節俺正対街町渋 +Line 4=姿笑隣病院開頂科 +Line 5=先眞弓沢氷恭国耳 +Line 6=今逝元予報分秘密 +Line 7=物罰望峰巫工業社 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 5] +Line 0=~φ∞:堂妹瀬川 +Line 1=飛巻機山條浦森員 +Line 2=同清水座勉強集合 +Line 3=急止出内則世界秒 +Line 4=数徳香百千葉紗静 +Line 5=星米尋慎吾岡竹梨 +Line 6=柴矢魍魎遊撃隊里 +Line 7=賀玲福芳 + +0=16 +1=14 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 + +[kanji 6] +Line 0=島礼戸桃麦仁智赤 +Line 1=車歌知華王先行者 +Line 2=願愛唄結婚素直陽 +Line 3=宇宙海賊冒険門外 +Line 4=早重番際通再像鮮 +Line 5=量必要種待具質消 +Line 6=去宮計算降象忘漕 +Line 7=滅問船乗旅確過壊 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 7] +Line 0=深都築鍋行脚獣登 +Line 1=雨始約束所虹彩澄 +Line 2=頃年巡交幼供年詰 +Line 3=草誓孤詩意味排溝 +Line 4=刻付良走我謳的支 +Line 5=台匹東薄味噌抜汁 +Line 6=役熊惚片持校受験 +Line 7=聞競争激為懸格白 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 8] +Line 0=余答発寂卒親孝立 +Line 1=派局縁詮滑拝喜毀 +Line 2=干懲号敗堪絶指仕 +Line 3=胆些細慢首傾己主 +Line 4=振返微妙雷塩幽霊 +Line 5=楽団遠捨苦感威散 +Line 6=賭摩李夫舞鷺須雲 +Line 7=流誰転留駄源教呼 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 + +[kanji 9] +Line 0=逆足練違照帽半距 +Line 1=離弟脇兄完璧救誘 +Line 2=拐技踏雪越緑押赫 +Line 3=染御嫌糞医療査鑑 +Line 4=賞編削領向段階殊 +Line 5=果級向腕透前復位 +Line 6=唱青顔叫描殿掃戯 +Line 7=怖底河祝匁宝暦 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 + +[symbol] +Line 0=&()?!/‥^…@$#”+=¥;<>・「」{}%* +Line 1=abcdefghijklmnopqrstyvwxyz +Line 2=ABCDEFGHIJKLMNOPQRSTYVWXYZ + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=9 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 +64=16 +65=16 +66=16 +67=16 +68=16 +69=16 +70=16 +71=16 +72=16 +73=16 +74=16 +75=16 +76=16 +77=16 + +[kanji-regular] +Line 0=亜哀愛悪握圧扱安暗案以位依偉囲委威尉意慰易為異移維緯胃衣違遺医井 +Line 1=域育一壱逸稲芋印員因姻引飲院陰隠韻右宇羽雨渦浦運雲営影映栄永泳英 +Line 2=衛詠鋭液疫益駅悦謁越閲円園宴延援沿演炎煙猿縁遠鉛塩汚凹央奥往応押 +Line 3=横欧殴王翁黄沖億屋憶乙卸恩温穏音下化仮何価佳加可夏嫁家寡科暇果架 +Line 4=歌河火禍稼箇花荷華菓課貨過蚊我画芽賀雅餓介会解回塊壊快怪悔懐戒拐 +Line 5=改械海灰界皆絵開階貝劾外害慨概涯街該垣嚇各拡格核殻獲確穫覚角較郭 +Line 6=閣隔革学岳楽額掛潟割喝括活渇滑褐轄且株刈乾冠寒刊勘勧巻喚堪完官寛 +Line 7=干幹患感慣憾換敢棺款歓汗漢環甘監看管簡緩缶肝艦観貫還鑑間閑関陥館 +Line 8=丸含岸眼岩頑顔願企危喜器基奇寄岐希幾忌揮机旗既期棋棄機帰気汽祈季 +Line 9=紀規記貴起軌輝飢騎鬼偽儀宜戯技擬欺犠疑義議菊吉喫詰却客脚虐逆丘久 +Line 10=休及吸宮弓急救朽求泣球究窮級糾給旧牛去居巨拒拠挙虚許距漁魚享京供 +Line 11=競共凶協叫境峡強恐恭挟教橋況狂狭矯胸脅興郷鏡響驚仰凝暁業局曲極玉 +Line 12=勤均斤琴禁筋緊菌襟謹近金吟銀九句区苦駆具愚虞空偶遇隅屈掘靴繰桑勲 +Line 13=君薫訓群軍郡係傾刑兄啓型契形径恵慶憩掲携敬景渓系経継茎蛍計警軽鶏 +Line 14=芸迎鯨劇撃激傑欠決潔穴結血月件倹健兼券剣圏堅嫌建憲懸検権犬献研絹 +Line 15=県肩見謙賢軒遣険顕験元原厳幻弦減源玄現言限個古呼固孤己庫弧戸故枯 +Line 16=湖誇雇顧鼓五互午呉娯後御悟碁語誤護交侯候光公功効厚口向后坑好孔孝 +Line 17=工巧幸広康恒慌抗拘控攻更校構江洪港溝甲皇硬稿紅絞綱耕考肯航荒行衡 +Line 18=講貢購郊酵鉱鋼降項香高剛号合拷豪克刻告国穀酷黒獄腰骨込今困墾婚恨 +Line 19=懇昆根混紺魂佐唆左差査砂詐鎖座債催再最妻宰彩才採栽歳済災砕祭斎細 +Line 20=菜裁載際剤在材罪財坂咲崎作削搾昨策索錯桜冊刷察撮擦札殺雑皿三傘参 +Line 21=山惨散桟産算蚕賛酸暫残仕伺使刺司史嗣四士始姉姿子市師志思指支施旨 +Line 22=枝止死氏祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時 +Line 23=次滋治璽磁示耳自辞式識軸七執失室湿漆疾質実芝舎写射捨赦斜煮社者謝 +Line 24=車遮蛇邪借勺尺爵酌釈若寂弱主取守手朱殊狩珠種趣酒首儒受寿授樹需囚 +Line 25=収周宗就州修愁拾秀秋終習臭舟衆襲週酬集醜住充十従柔汁渋獣縦重銃叔 +Line 26=宿淑祝縮粛塾熟出術述俊春瞬准循旬殉準潤盾純巡遵順処初所暑庶緒署書 +Line 27=諸助叙女序徐除傷償勝匠升召商唱奨宵将小少尚床彰承抄招掌昇昭晶松沼 +Line 28=消渉焼焦照症省硝礁祥称章笑粧紹肖衝訟証詔詳象賞鐘障上丈乗冗剰城場 +Line 29=壌嬢常情条浄状畳蒸譲醸錠嘱飾植殖織職色触食辱伸信侵唇娠寝審心慎振 +Line 30=新森浸深申真神紳臣薪親診身辛進針震人仁刃尋甚尽迅陣酢図吹垂帥推水 +Line 31=炊睡粋衰遂酔錘随髄崇数枢据杉澄寸世瀬畝是制勢姓征性成政整星晴正清 +Line 32=牲生盛精聖声製西誠誓請逝青静斉税隻席惜斥昔析石積籍績責赤跡切拙接 +Line 33=摂折設窃節説雪絶舌仙先千占宣専川戦扇栓泉浅洗染潜旋線繊船薦践選遷 +Line 34=銭銑鮮前善漸然全禅繕塑措疎礎祖租粗素組訴阻僧創双倉喪壮奏層想捜掃 +Line 35=挿操早曹巣槽燥争相窓総草荘葬藻装走送遭霜騒像増憎臓蔵贈造促側則即 +Line 36=息束測足速俗属賊族続卒存孫尊損村他多太堕妥惰打駄体対耐帯待怠態替 +Line 37=泰滞胎袋貸退逮隊代台大第題滝卓宅択拓沢濯託濁諾但達奪脱棚谷丹単嘆 +Line 38=担探淡炭短端胆誕鍛団壇弾断暖段男談値知地恥池痴稚置致遅築畜竹蓄逐 +Line 39=秩窒茶嫡着中仲宙忠抽昼柱注虫衷鋳駐著貯丁兆帳庁弔張彫徴懲挑朝潮町 +Line 40=眺聴脹腸調超跳長頂鳥勅直朕沈珍賃鎮陳津墜追痛通塚漬坪釣亭低停偵貞 +Line 41=呈堤定帝底庭廷弟抵提程締艇訂逓邸泥摘敵滴的笛適哲徹撤迭鉄典天展店 +Line 42=添転点伝殿田電吐塗徒斗渡登途都努度土奴怒倒党冬凍刀唐塔島悼投搭東 +Line 43=桃棟盗湯灯当痘等答筒糖統到討謄豆踏逃透陶頭騰闘働動同堂導洞童胴道 +Line 44=銅峠匿得徳特督篤毒独読凸突届屯豚曇鈍内縄南軟難二尼弐肉日乳入如尿 +Line 45=任妊忍認寧猫熱年念燃粘悩濃納能脳農把覇波派破婆馬俳廃拝排敗杯背肺 +Line 46=輩配倍培媒梅買売賠陪伯博拍泊白舶薄迫漠爆縛麦箱肌畑八鉢発髪伐罰抜 +Line 47=閥伴判半反帆搬板版犯班畔繁般藩販範煩頒飯晩番盤蛮卑否妃彼悲扉批披 +Line 48=比泌疲皮碑秘罷肥被費避非飛備尾微美鼻匹必筆姫百俵標氷漂票表評描病 +Line 49=秒苗品浜貧賓頻敏瓶不付夫婦富布府怖扶敷普浮父符腐膚譜負賦赴附侮武 +Line 50=舞部封風伏副復幅服福腹複覆払沸仏物分噴墳憤奮粉紛雰文聞丙併兵塀幣 +Line 51=平弊柄並閉陛米壁癖別偏変片編辺返遍便勉弁保舗捕歩補穂募墓慕暮母簿 +Line 52=倣俸包報奉宝峰崩抱放方法泡砲縫胞芳褒訪豊邦飽乏亡傍剖坊妨帽忘忙房 +Line 53=暴望某棒冒紡肪膨謀貿防北僕墨撲朴牧没堀奔本翻凡盆摩磨魔麻埋妹枚毎 +Line 54=幕膜又抹末繭万慢満漫味未魅岬密脈妙民眠務夢無矛霧婿娘名命明盟迷銘 +Line 55=鳴滅免綿面模茂妄毛猛盲網耗木黙目戻問紋門匁夜野矢厄役約薬訳躍柳愉 +Line 56=油癒諭輸唯優勇友幽悠憂有猶由裕誘遊郵雄融夕予余与誉預幼容庸揚揺擁 +Line 57=曜様洋溶用窯羊葉要謡踊陽養抑欲浴翌翼羅裸来頼雷絡落酪乱卵欄濫覧利 +Line 58=吏履理痢裏里離陸律率立略流留硫粒隆竜慮旅虜了僚両寮料涼猟療糧良量 +Line 59=陵領力緑倫厘林臨輪隣塁涙累類令例冷励礼鈴隷零霊麗齢暦歴列劣烈裂廉 +Line 60=恋練連錬炉路露労廊朗楼浪漏老郎六録論和話賄惑枠湾腕 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 +64=16 +65=16 +66=16 +67=16 +68=16 +69=16 +70=16 +71=16 +72=16 +73=16 +74=16 +75=16 +76=16 +77=16 +78=16 +79=16 +80=16 +81=16 +82=16 +83=16 +84=16 +85=16 +86=16 +87=16 +88=16 +89=16 +90=16 +91=16 +92=16 +93=16 +94=16 +95=16 +96=16 +97=16 +98=16 +99=16 +100=16 +101=16 +102=16 +103=16 +104=16 +105=16 +106=16 +107=16 +108=16 +109=16 +110=16 +111=16 +112=16 +113=16 +114=16 +115=16 +116=16 +117=16 +118=16 +119=16 +120=16 +121=16 +122=16 +123=16 +124=16 +125=16 +126=16 +127=16 +128=16 +129=16 +130=16 +131=16 +132=16 +133=16 +134=16 +135=16 +136=16 +137=16 +138=16 +139=16 +140=16 +141=16 +142=16 +143=16 +144=16 +145=16 +146=16 +147=16 +148=16 +149=16 +150=16 +151=16 +152=16 +153=16 +154=16 +155=16 +156=16 +157=16 +158=16 +159=16 +160=16 +161=16 +162=16 +163=16 +164=16 +165=16 +166=16 +167=16 +168=16 +169=16 +170=16 +171=16 +172=16 +173=16 +174=16 +175=16 +176=16 +177=16 +178=16 +179=16 +180=16 +181=16 +182=16 +183=16 +184=16 +185=16 +186=16 +187=16 +188=16 +189=16 +190=16 +191=16 +192=16 +193=16 +194=16 +195=16 +196=16 +197=16 +198=16 +199=16 +200=16 +201=16 +202=16 +203=16 +204=16 +205=16 +206=16 +207=16 +208=16 +209=16 +210=16 +211=16 +212=16 +213=16 +214=16 +215=16 +216=16 +217=16 +218=16 +219=16 +220=16 +221=16 +222=16 +223=16 +224=16 +225=16 +226=16 +227=16 +228=16 +229=16 +230=16 +231=16 +232=16 +233=16 +234=16 +235=16 +236=16 +237=16 +238=16 +239=16 +240=16 +241=16 +242=16 +243=16 +244=16 +245=16 +246=16 +247=16 +248=16 +249=16 +250=16 +251=16 +252=16 +253=16 +254=16 +255=16 +256=16 +257=16 +258=16 +259=16 +260=16 +261=16 +262=16 +263=16 +264=16 +265=16 +266=16 +267=16 +268=16 +269=16 +270=16 +271=16 +272=16 +273=16 +274=16 +275=16 +276=16 +277=16 +278=16 +279=16 +280=16 +281=16 +282=16 +283=16 +284=16 +285=16 +286=16 +287=16 +288=16 +289=16 +290=16 +291=16 +292=16 +293=16 +294=16 +295=16 +296=16 +297=16 +298=16 +299=16 +300=16 +301=16 +302=16 +303=16 +304=16 +305=16 +306=16 +307=16 +308=16 +309=16 +310=16 +311=16 +312=16 +313=16 +314=16 +315=16 +316=16 +317=16 +318=16 +319=16 +320=16 +321=16 +322=16 +323=16 +324=16 +325=16 +326=16 +327=16 +328=16 +329=16 +330=16 +331=16 +332=16 +333=16 +334=16 +335=16 +336=16 +337=16 +338=16 +339=16 +340=16 +341=16 +342=16 +343=16 +344=16 +345=16 +346=16 +347=16 +348=16 +349=16 +350=16 +351=16 +352=16 +353=16 +354=16 +355=16 +356=16 +357=16 +358=16 +359=16 +360=16 +361=16 +362=16 +363=16 +364=16 +365=16 +366=16 +367=16 +368=16 +369=16 +370=16 +371=16 +372=16 +373=16 +374=16 +375=16 +376=16 +377=16 +378=16 +379=16 +380=16 +381=16 +382=16 +383=16 +384=16 +385=16 +386=16 +387=16 +388=16 +389=16 +390=16 +391=16 +392=16 +393=16 +394=16 +395=16 +396=16 +397=16 +398=16 +399=16 +400=16 +401=16 +402=16 +403=16 +404=16 +405=16 +406=16 +407=16 +408=16 +409=16 +410=16 +411=16 +412=16 +413=16 +414=16 +415=16 +416=16 +417=16 +418=16 +419=16 +420=16 +421=16 +422=16 +423=16 +424=16 +425=16 +426=16 +427=16 +428=16 +429=16 +430=16 +431=16 +432=16 +433=16 +434=16 +435=16 +436=16 +437=16 +438=16 +439=16 +440=16 +441=16 +442=16 +443=16 +444=16 +445=16 +446=16 +447=16 +448=16 +449=16 +450=16 +451=16 +452=16 +453=16 +454=16 +455=16 +456=16 +457=16 +458=16 +459=16 +460=16 +461=16 +462=16 +463=16 +464=16 +465=16 +466=16 +467=16 +468=16 +469=16 +470=16 +471=16 +472=16 +473=16 +474=16 +475=16 +476=16 +477=16 +478=16 +479=16 +480=16 +481=16 +482=16 +483=16 +484=16 +485=16 +486=16 +487=16 +488=16 +489=16 +490=16 +491=16 +492=16 +493=16 +494=16 +495=16 +496=16 +497=16 +498=16 +499=16 +500=16 +501=16 +502=16 +503=16 +504=16 +505=16 +506=16 +507=16 +508=16 +509=16 +510=16 +511=16 +512=16 +513=16 +514=16 +515=16 +516=16 +517=16 +518=16 +519=16 +520=16 +521=16 +522=16 +523=16 +524=16 +525=16 +526=16 +527=16 +528=16 +529=16 +530=16 +531=16 +532=16 +533=16 +534=16 +535=16 +536=16 +537=16 +538=16 +539=16 +540=16 +541=16 +542=16 +543=16 +544=16 +545=16 +546=16 +547=16 +548=16 +549=16 +550=16 +551=16 +552=16 +553=16 +554=16 +555=16 +556=16 +557=16 +558=16 +559=16 +560=16 +561=16 +562=16 +563=16 +564=16 +565=16 +566=16 +567=16 +568=16 +569=16 +570=16 +571=16 +572=16 +573=16 +574=16 +575=16 +576=16 +577=16 +578=16 +579=16 +580=16 +581=16 +582=16 +583=16 +584=16 +585=16 +586=16 +587=16 +588=16 +589=16 +590=16 +591=16 +592=16 +593=16 +594=16 +595=16 +596=16 +597=16 +598=16 +599=16 +600=16 +601=16 +602=16 +603=16 +604=16 +605=16 +606=16 +607=16 +608=16 +609=16 +610=16 +611=16 +612=16 +613=16 +614=16 +615=16 +616=16 +617=16 +618=16 +619=16 +620=16 +621=16 +622=16 +623=16 +624=16 +625=16 +626=16 +627=16 +628=16 +629=16 +630=16 +631=16 +632=16 +633=16 +634=16 +635=16 +636=16 +637=16 +638=16 +639=16 +640=16 +641=16 +642=16 +643=16 +644=16 +645=16 +646=16 +647=16 +648=16 +649=16 +650=16 +651=16 +652=16 +653=16 +654=16 +655=16 +656=16 +657=16 +658=16 +659=16 +660=16 +661=16 +662=16 +663=16 +664=16 +665=16 +666=16 +667=16 +668=16 +669=16 +670=16 +671=16 +672=16 +673=16 +674=16 +675=16 +676=16 +677=16 +678=16 +679=16 +680=16 +681=16 +682=16 +683=16 +684=16 +685=16 +686=16 +687=16 +688=16 +689=16 +690=16 +691=16 +692=16 +693=16 +694=16 +695=16 +696=16 +697=16 +698=16 +699=16 +700=16 +701=16 +702=16 +703=16 +704=16 +705=16 +706=16 +707=16 +708=16 +709=16 +710=16 +711=16 +712=16 +713=16 +714=16 +715=16 +716=16 +717=16 +718=16 +719=16 +720=16 +721=16 +722=16 +723=16 +724=16 +725=16 +726=16 +727=16 +728=16 +729=16 +730=16 +731=16 +732=16 +733=16 +734=16 +735=16 +736=16 +737=16 +738=16 +739=16 +740=16 +741=16 +742=16 +743=16 +744=16 +745=16 +746=16 +747=16 +748=16 +749=16 +750=16 +751=16 +752=16 +753=16 +754=16 +755=16 +756=16 +757=16 +758=16 +759=16 +760=16 +761=16 +762=16 +763=16 +764=16 +765=16 +766=16 +767=16 +768=16 +769=16 +770=16 +771=16 +772=16 +773=16 +774=16 +775=16 +776=16 +777=16 +778=16 +779=16 +780=16 +781=16 +782=16 +783=16 +784=16 +785=16 +786=16 +787=16 +788=16 +789=16 +790=16 +791=16 +792=16 +793=16 +794=16 +795=16 +796=16 +797=16 +798=16 +799=16 +800=16 +801=16 +802=16 +803=16 +804=16 +805=16 +806=16 +807=16 +808=16 +809=16 +810=16 +811=16 +812=16 +813=16 +814=16 +815=16 +816=16 +817=16 +818=16 +819=16 +820=16 +821=16 +822=16 +823=16 +824=16 +825=16 +826=16 +827=16 +828=16 +829=16 +830=16 +831=16 +832=16 +833=16 +834=16 +835=16 +836=16 +837=16 +838=16 +839=16 +840=16 +841=16 +842=16 +843=16 +844=16 +845=16 +846=16 +847=16 +848=16 +849=16 +850=16 +851=16 +852=16 +853=16 +854=16 +855=16 +856=16 +857=16 +858=16 +859=16 +860=16 +861=16 +862=16 +863=16 +864=16 +865=16 +866=16 +867=16 +868=16 +869=16 +870=16 +871=16 +872=16 +873=16 +874=16 +875=16 +876=16 +877=16 +878=16 +879=16 +880=16 +881=16 +882=16 +883=16 +884=16 +885=16 +886=16 +887=16 +888=16 +889=16 +890=16 +891=16 +892=16 +893=16 +894=16 +895=16 +896=16 +897=16 +898=16 +899=16 +900=16 +901=16 +902=16 +903=16 +904=16 +905=16 +906=16 +907=16 +908=16 +909=16 +910=16 +911=16 +912=16 +913=16 +914=16 +915=16 +916=16 +917=16 +918=16 +919=16 +920=16 +921=16 +922=16 +923=16 +924=16 +925=16 +926=16 +927=16 +928=16 +929=16 +930=16 +931=16 +932=16 +933=16 +934=16 +935=16 +936=16 +937=16 +938=16 +939=16 +940=16 +941=16 +942=16 +943=16 +944=16 +945=16 +946=16 +947=16 +948=16 +949=16 +950=16 +951=16 +952=16 +953=16 +954=16 +955=16 +956=16 +957=16 +958=16 +959=16 +960=16 +961=16 +962=16 +963=16 +964=16 +965=16 +966=16 +967=16 +968=16 +969=16 +970=16 +971=16 +972=16 +973=16 +974=16 +975=16 +976=16 +977=16 +978=16 +979=16 +980=16 +981=16 +982=16 +983=16 +984=16 +985=16 +986=16 +987=16 +988=16 +989=16 +990=16 +991=16 +992=16 +993=16 +994=16 +995=16 +996=16 +997=16 +998=16 +999=16 +1000=16 +1001=16 +1002=16 +1003=16 +1004=16 +1005=16 +1006=16 +1007=16 +1008=16 +1009=16 +1010=16 +1011=16 +1012=16 +1013=16 +1014=16 +1015=16 +1016=16 +1017=16 +1018=16 +1019=16 +1020=16 +1021=16 +1022=16 +1023=16 +1024=16 +1025=16 +1026=16 +1027=16 +1028=16 +1029=16 +1030=16 +1031=16 +1032=16 +1033=16 +1034=16 +1035=16 +1036=16 +1037=16 +1038=16 +1039=16 +1040=16 +1041=16 +1042=16 +1043=16 +1044=16 +1045=16 +1046=16 +1047=16 +1048=16 +1049=16 +1050=16 +1051=16 +1052=16 +1053=16 +1054=16 +1055=16 +1056=16 +1057=16 +1058=16 +1059=16 +1060=16 +1061=16 +1062=16 +1063=16 +1064=16 +1065=16 +1066=16 +1067=16 +1068=16 +1069=16 +1070=16 +1071=16 +1072=16 +1073=16 +1074=16 +1075=16 +1076=16 +1077=16 +1078=16 +1079=16 +1080=16 +1081=16 +1082=16 +1083=16 +1084=16 +1085=16 +1086=16 +1087=16 +1088=16 +1089=16 +1090=16 +1091=16 +1092=16 +1093=16 +1094=16 +1095=16 +1096=16 +1097=16 +1098=16 +1099=16 +1100=16 +1101=16 +1102=16 +1103=16 +1104=16 +1105=16 +1106=16 +1107=16 +1108=16 +1109=16 +1110=16 +1111=16 +1112=16 +1113=16 +1114=16 +1115=16 +1116=16 +1117=16 +1118=16 +1119=16 +1120=16 +1121=16 +1122=16 +1123=16 +1124=16 +1125=16 +1126=16 +1127=16 +1128=16 +1129=16 +1130=16 +1131=16 +1132=16 +1133=16 +1134=16 +1135=16 +1136=16 +1137=16 +1138=16 +1139=16 +1140=16 +1141=16 +1142=16 +1143=16 +1144=16 +1145=16 +1146=16 +1147=16 +1148=16 +1149=16 +1150=16 +1151=16 +1152=16 +1153=16 +1154=16 +1155=16 +1156=16 +1157=16 +1158=16 +1159=16 +1160=16 +1161=16 +1162=16 +1163=16 +1164=16 +1165=16 +1166=16 +1167=16 +1168=16 +1169=16 +1170=16 +1171=16 +1172=16 +1173=16 +1174=16 +1175=16 +1176=16 +1177=16 +1178=16 +1179=16 +1180=16 +1181=16 +1182=16 +1183=16 +1184=16 +1185=16 +1186=16 +1187=16 +1188=16 +1189=16 +1190=16 +1191=16 +1192=16 +1193=16 +1194=16 +1195=16 +1196=16 +1197=16 +1198=16 +1199=16 +1200=16 +1201=16 +1202=16 +1203=16 +1204=16 +1205=16 +1206=16 +1207=16 +1208=16 +1209=16 +1210=16 +1211=16 +1212=16 +1213=16 +1214=16 +1215=16 +1216=16 +1217=16 +1218=16 +1219=16 +1220=16 +1221=16 +1222=16 +1223=16 +1224=16 +1225=16 +1226=16 +1227=16 +1228=16 +1229=16 +1230=16 +1231=16 +1232=16 +1233=16 +1234=16 +1235=16 +1236=16 +1237=16 +1238=16 +1239=16 +1240=16 +1241=16 +1242=16 +1243=16 +1244=16 +1245=16 +1246=16 +1247=16 +1248=16 +1249=16 +1250=16 +1251=16 +1252=16 +1253=16 +1254=16 +1255=16 +1256=16 +1257=16 +1258=16 +1259=16 +1260=16 +1261=16 +1262=16 +1263=16 +1264=16 +1265=16 +1266=16 +1267=16 +1268=16 +1269=16 +1270=16 +1271=16 +1272=16 +1273=16 +1274=16 +1275=16 +1276=16 +1277=16 +1278=16 +1279=16 +1280=16 +1281=16 +1282=16 +1283=16 +1284=16 +1285=16 +1286=16 +1287=16 +1288=16 +1289=16 +1290=16 +1291=16 +1292=16 +1293=16 +1294=16 +1295=16 +1296=16 +1297=16 +1298=16 +1299=16 +1300=16 +1301=16 +1302=16 +1303=16 +1304=16 +1305=16 +1306=16 +1307=16 +1308=16 +1309=16 +1310=16 +1311=16 +1312=16 +1313=16 +1314=16 +1315=16 +1316=16 +1317=16 +1318=16 +1319=16 +1320=16 +1321=16 +1322=16 +1323=16 +1324=16 +1325=16 +1326=16 +1327=16 +1328=16 +1329=16 +1330=16 +1331=16 +1332=16 +1333=16 +1334=16 +1335=16 +1336=16 +1337=16 +1338=16 +1339=16 +1340=16 +1341=16 +1342=16 +1343=16 +1344=16 +1345=16 +1346=16 +1347=16 +1348=16 +1349=16 +1350=16 +1351=16 +1352=16 +1353=16 +1354=16 +1355=16 +1356=16 +1357=16 +1358=16 +1359=16 +1360=16 +1361=16 +1362=16 +1363=16 +1364=16 +1365=16 +1366=16 +1367=16 +1368=16 +1369=16 +1370=16 +1371=16 +1372=16 +1373=16 +1374=16 +1375=16 +1376=16 +1377=16 +1378=16 +1379=16 +1380=16 +1381=16 +1382=16 +1383=16 +1384=16 +1385=16 +1386=16 +1387=16 +1388=16 +1389=16 +1390=16 +1391=16 +1392=16 +1393=16 +1394=16 +1395=16 +1396=16 +1397=16 +1398=16 +1399=16 +1400=16 +1401=16 +1402=16 +1403=16 +1404=16 +1405=16 +1406=16 +1407=16 +1408=16 +1409=16 +1410=16 +1411=16 +1412=16 +1413=16 +1414=16 +1415=16 +1416=16 +1417=16 +1418=16 +1419=16 +1420=16 +1421=16 +1422=16 +1423=16 +1424=16 +1425=16 +1426=16 +1427=16 +1428=16 +1429=16 +1430=16 +1431=16 +1432=16 +1433=16 +1434=16 +1435=16 +1436=16 +1437=16 +1438=16 +1439=16 +1440=16 +1441=16 +1442=16 +1443=16 +1444=16 +1445=16 +1446=16 +1447=16 +1448=16 +1449=16 +1450=16 +1451=16 +1452=16 +1453=16 +1454=16 +1455=16 +1456=16 +1457=16 +1458=16 +1459=16 +1460=16 +1461=16 +1462=16 +1463=16 +1464=16 +1465=16 +1466=16 +1467=16 +1468=16 +1469=16 +1470=16 +1471=16 +1472=16 +1473=16 +1474=16 +1475=16 +1476=16 +1477=16 +1478=16 +1479=16 +1480=16 +1481=16 +1482=16 +1483=16 +1484=16 +1485=16 +1486=16 +1487=16 +1488=16 +1489=16 +1490=16 +1491=16 +1492=16 +1493=16 +1494=16 +1495=16 +1496=16 +1497=16 +1498=16 +1499=16 +1500=16 +1501=16 +1502=16 +1503=16 +1504=16 +1505=16 +1506=16 +1507=16 +1508=16 +1509=16 +1510=16 +1511=16 +1512=16 +1513=16 +1514=16 +1515=16 +1516=16 +1517=16 +1518=16 +1519=16 +1520=16 +1521=16 +1522=16 +1523=16 +1524=16 +1525=16 +1526=16 +1527=16 +1528=16 +1529=16 +1530=16 +1531=16 +1532=16 +1533=16 +1534=16 +1535=16 +1536=16 +1537=16 +1538=16 +1539=16 +1540=16 +1541=16 +1542=16 +1543=16 +1544=16 +1545=16 +1546=16 +1547=16 +1548=16 +1549=16 +1550=16 +1551=16 +1552=16 +1553=16 +1554=16 +1555=16 +1556=16 +1557=16 +1558=16 +1559=16 +1560=16 +1561=16 +1562=16 +1563=16 +1564=16 +1565=16 +1566=16 +1567=16 +1568=16 +1569=16 +1570=16 +1571=16 +1572=16 +1573=16 +1574=16 +1575=16 +1576=16 +1577=16 +1578=16 +1579=16 +1580=16 +1581=16 +1582=16 +1583=16 +1584=16 +1585=16 +1586=16 +1587=16 +1588=16 +1589=16 +1590=16 +1591=16 +1592=16 +1593=16 +1594=16 +1595=16 +1596=16 +1597=16 +1598=16 +1599=16 +1600=16 +1601=16 +1602=16 +1603=16 +1604=16 +1605=16 +1606=16 +1607=16 +1608=16 +1609=16 +1610=16 +1611=16 +1612=16 +1613=16 +1614=16 +1615=16 +1616=16 +1617=16 +1618=16 +1619=16 +1620=16 +1621=16 +1622=16 +1623=16 +1624=16 +1625=16 +1626=16 +1627=16 +1628=16 +1629=16 +1630=16 +1631=16 +1632=16 +1633=16 +1634=16 +1635=16 +1636=16 +1637=16 +1638=16 +1639=16 +1640=16 +1641=16 +1642=16 +1643=16 +1644=16 +1645=16 +1646=16 +1647=16 +1648=16 +1649=16 +1650=16 +1651=16 +1652=16 +1653=16 +1654=16 +1655=16 +1656=16 +1657=16 +1658=16 +1659=16 +1660=16 +1661=16 +1662=16 +1663=16 +1664=16 +1665=16 +1666=16 +1667=16 +1668=16 +1669=16 +1670=16 +1671=16 +1672=16 +1673=16 +1674=16 +1675=16 +1676=16 +1677=16 +1678=16 +1679=16 +1680=16 +1681=16 +1682=16 +1683=16 +1684=16 +1685=16 +1686=16 +1687=16 +1688=16 +1689=16 +1690=16 +1691=16 +1692=16 +1693=16 +1694=16 +1695=16 +1696=16 +1697=16 +1698=16 +1699=16 +1700=16 +1701=16 +1702=16 +1703=16 +1704=16 +1705=16 +1706=16 +1707=16 +1708=16 +1709=16 +1710=16 +1711=16 +1712=16 +1713=16 +1714=16 +1715=16 +1716=16 +1717=16 +1718=16 +1719=16 +1720=16 +1721=16 +1722=16 +1723=16 +1724=16 +1725=16 +1726=16 +1727=16 +1728=16 +1729=16 +1730=16 +1731=16 +1732=16 +1733=16 +1734=16 +1735=16 +1736=16 +1737=16 +1738=16 +1739=16 +1740=16 +1741=16 +1742=16 +1743=16 +1744=16 +1745=16 +1746=16 +1747=16 +1748=16 +1749=16 +1750=16 +1751=16 +1752=16 +1753=16 +1754=16 +1755=16 +1756=16 +1757=16 +1758=16 +1759=16 +1760=16 +1761=16 +1762=16 +1763=16 +1764=16 +1765=16 +1766=16 +1767=16 +1768=16 +1769=16 +1770=16 +1771=16 +1772=16 +1773=16 +1774=16 +1775=16 +1776=16 +1777=16 +1778=16 +1779=16 +1780=16 +1781=16 +1782=16 +1783=16 +1784=16 +1785=16 +1786=16 +1787=16 +1788=16 +1789=16 +1790=16 +1791=16 +1792=16 +1793=16 +1794=16 +1795=16 +1796=16 +1797=16 +1798=16 +1799=16 +1800=16 +1801=16 +1802=16 +1803=16 +1804=16 +1805=16 +1806=16 +1807=16 +1808=16 +1809=16 +1810=16 +1811=16 +1812=16 +1813=16 +1814=16 +1815=16 +1816=16 +1817=16 +1818=16 +1819=16 +1820=16 +1821=16 +1822=16 +1823=16 +1824=16 +1825=16 +1826=16 +1827=16 +1828=16 +1829=16 +1830=16 +1831=16 +1832=16 +1833=16 +1834=16 +1835=16 +1836=16 +1837=16 +1838=16 +1839=16 +1840=16 +1841=16 +1842=16 +1843=16 +1844=16 +1845=16 +1846=16 +1847=16 +1848=16 +1849=16 +1850=16 +1851=16 +1852=16 +1853=16 +1854=16 +1855=16 +1856=16 +1857=16 +1858=16 +1859=16 +1860=16 +1861=16 +1862=16 +1863=16 +1864=16 +1865=16 +1866=16 +1867=16 +1868=16 +1869=16 +1870=16 +1871=16 +1872=16 +1873=16 +1874=16 +1875=16 +1876=16 +1877=16 +1878=16 +1879=16 +1880=16 +1881=16 +1882=16 +1883=16 +1884=16 +1885=16 +1886=16 +1887=16 +1888=16 +1889=16 +1890=16 +1891=16 +1892=16 +1893=16 +1894=16 +1895=16 +1896=16 +1897=16 +1898=16 +1899=16 +1900=16 +1901=16 +1902=16 +1903=16 +1904=16 +1905=16 +1906=16 +1907=16 +1908=16 +1909=16 +1910=16 +1911=16 +1912=16 +1913=16 +1914=16 +1915=16 +1916=16 +1917=16 +1918=16 +1919=16 +1920=16 +1921=16 +1922=16 +1923=16 +1924=16 +1925=16 +1926=16 +1927=16 +1928=16 +1929=16 +1930=16 +1931=16 +1932=16 +1933=16 +1934=16 +1935=16 +1936=16 +1937=16 +1938=16 +1939=16 +1940=16 +1941=16 +1942=16 +1943=16 +1944=16 + +[kanji-jis1] +Line 0=唖娃阿挨姶逢葵茜穐渥旭葦芦鯵梓斡宛姐虻飴絢綾鮎或粟袷庵按闇鞍杏伊 +Line 1=夷惟椅畏萎謂亥郁磯溢茨鰯允咽淫胤蔭吋烏迂卯鵜窺丑碓臼嘘唄欝蔚鰻姥 +Line 2=厩瓜閏噂云荏餌叡嬰曳洩瑛盈穎頴榎厭堰奄怨掩焔燕艶苑薗鴛於甥旺襖鴬 +Line 3=鴎岡荻臆桶牡俺伽嘉珂禾苛茄蝦嘩迦霞俄峨牙臥蛾駕廻恢魁晦芥蟹凱咳崖 +Line 4=碍蓋鎧骸浬馨蛙柿蛎鈎劃廓撹赫顎笠樫橿梶鰍恰葛鰹叶椛樺鞄兜竃蒲釜鎌 +Line 5=噛鴨栢茅萱粥苅瓦侃姦柑桓澗潅竿翰莞諌韓舘巌玩癌翫贋雁伎嬉毅畿稀徽 +Line 6=亀妓祇蟻誼掬鞠吃桔橘砧杵黍仇汲灸笈渠鋸禦亨侠僑兇匡卿喬彊怯蕎饗尭 +Line 7=桐粁僅巾錦欣欽禽芹衿倶狗玖矩躯駈駒喰寓串櫛釧屑窟沓轡窪熊隈粂栗鍬 +Line 8=卦袈祁圭珪慧桂畦稽繋罫荊詣頚戟隙桁訣倦喧拳捲牽硯鍵鹸絃舷諺乎姑狐 +Line 9=糊袴股胡菰虎跨鈷伍吾梧檎瑚醐乞鯉佼倖勾喉垢宏巷庚弘昂晃杭梗浩糠紘 +Line 10=肱腔膏砿閤鴻劫壕濠轟麹鵠漉甑忽惚狛此頃坤昏梱痕艮些叉嵯沙瑳裟坐挫 +Line 11=哉塞采犀砦冴阪堺榊肴埼碕鷺咋朔柵窄鮭笹匙拶薩皐鯖捌錆鮫晒撒燦珊纂 +Line 12=讃餐斬仔屍孜斯獅爾痔而蒔汐鹿鴫竺宍雫叱嫉悉蔀篠偲柴屡蕊縞紗杓灼錫 +Line 13=惹腫呪綬洲繍蒐讐蹴輯酋什戎夙峻竣舜駿楯淳醇曙渚薯藷恕鋤哨嘗妾娼庄 +Line 14=廠捷昌梢樟樵湘菖蒋蕉裳醤鉦鍾鞘丞擾杖穣埴拭燭蝕尻晋榛疹秦芯塵壬腎 +Line 15=訊靭笥諏須厨逗翠錐瑞嵩趨雛椙菅頗雀裾摺凄棲栖醒脆戚脊蹟碩蝉尖撰栴 +Line 16=煎煽穿箭羨腺舛詮賎閃膳糎噌岨曾曽楚狙疏蘇遡鼠叢爽宋匝惣掻槍漕痩糟 +Line 17=綜聡蒼鎗捉袖其揃遜汰詑唾柁舵楕陀騨堆岱戴腿苔黛鯛醍鷹瀧啄托琢鐸茸 +Line 18=凧蛸只叩辰巽竪辿狸鱈樽誰坦旦歎湛箪綻耽蛋檀弛智蜘馳筑註酎樗瀦猪苧 +Line 19=凋喋寵帖暢牒蝶諜銚捗椎槌鎚栂掴槻佃柘辻蔦綴鍔椿潰壷嬬紬爪吊鶴剃悌 +Line 20=挺梯汀碇禎諦蹄鄭釘鼎擢鏑溺轍填纏甜貼顛澱兎堵妬屠杜菟賭鍍砥砺塘套 +Line 21=宕嶋梼淘涛燈祷董蕩藤鐙憧撞瞳萄鴇涜禿栃橡椴鳶苫寅酉瀞噸惇敦沌遁頓 +Line 22=呑奈那乍凪薙謎灘捺鍋楢馴畷楠汝迩匂賑虹廿韮濡禰祢葱捻撚乃廼之埜嚢 +Line 23=膿覗蚤巴播杷琶罵芭盃牌楳煤狽這蝿秤矧萩剥柏箔粕曝莫駁函硲箸肇筈櫨 +Line 24=幡畠溌醗筏鳩噺塙蛤隼叛斑氾汎釆挽磐蕃匪庇斐緋誹樋簸枇毘琵眉柊稗疋 +Line 25=髭彦膝菱肘弼畢逼桧媛紐謬彪瓢豹廟錨鋲蒜蛭鰭彬斌瀕埠冨斧芙阜撫葡蕪 +Line 26=楓葺蕗淵弗鮒吻扮焚糞蔽頁僻碧瞥蔑箆篇娩鞭鋪圃甫輔戊菩呆峯庖捧朋烹 +Line 27=萌蓬蜂鋒鳳鵬貌鉾吠頬卜睦穆釦勃殆幌昧哩槙枕鮪柾鱒桝亦俣沫迄侭麿蔓 +Line 28=巳箕蜜湊蓑稔粍牟鵡椋冥姪牝棉緬麺摸孟蒙儲杢勿餅尤籾貰悶也冶爺耶弥 +Line 29=靖薮鑓愈佑宥揖柚湧涌猷祐邑輿傭妖楊熔耀蓉遥慾沃淀螺莱洛嵐藍蘭李梨 +Line 30=璃裡葎掠劉溜琉龍侶亮凌梁瞭稜諒遼淋燐琳鱗麟瑠伶嶺怜玲苓憐漣煉簾聯 +Line 31=蓮呂魯櫓賂婁弄榔牢狼篭聾蝋麓禄肋倭歪脇鷲亙亘鰐詫藁蕨椀碗 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 +64=16 +65=16 +66=16 +67=16 +68=16 +69=16 +70=16 +71=16 +72=16 +73=16 +74=16 +75=16 +76=16 +77=16 +78=16 +79=16 +80=16 +81=16 +82=16 +83=16 +84=16 +85=16 +86=16 +87=16 +88=16 +89=16 +90=16 +91=16 +92=16 +93=16 +94=16 +95=16 +96=16 +97=16 +98=16 +99=16 +100=16 +101=16 +102=16 +103=16 +104=16 +105=16 +106=16 +107=16 +108=16 +109=16 +110=16 +111=16 +112=16 +113=16 +114=16 +115=16 +116=16 +117=16 +118=16 +119=16 +120=16 +121=16 +122=16 +123=16 +124=16 +125=16 +126=16 +127=16 +128=16 +129=16 +130=16 +131=16 +132=16 +133=16 +134=16 +135=16 +136=16 +137=16 +138=16 +139=16 +140=16 +141=16 +142=16 +143=16 +144=16 +145=16 +146=16 +147=16 +148=16 +149=16 +150=16 +151=16 +152=16 +153=16 +154=16 +155=16 +156=16 +157=16 +158=16 +159=16 +160=16 +161=16 +162=16 +163=16 +164=16 +165=16 +166=16 +167=16 +168=16 +169=16 +170=16 +171=16 +172=16 +173=16 +174=16 +175=16 +176=16 +177=16 +178=16 +179=16 +180=16 +181=16 +182=16 +183=16 +184=16 +185=16 +186=16 +187=16 +188=16 +189=16 +190=16 +191=16 +192=16 +193=16 +194=16 +195=16 +196=16 +197=16 +198=16 +199=16 +200=16 +201=16 +202=16 +203=16 +204=16 +205=16 +206=16 +207=16 +208=16 +209=16 +210=16 +211=16 +212=16 +213=16 +214=16 +215=16 +216=16 +217=16 +218=16 +219=16 +220=16 +221=16 +222=16 +223=16 +224=16 +225=16 +226=16 +227=16 +228=16 +229=16 +230=16 +231=16 +232=16 +233=16 +234=16 +235=16 +236=16 +237=16 +238=16 +239=16 +240=16 +241=16 +242=16 +243=16 +244=16 +245=16 +246=16 +247=16 +248=16 +249=16 +250=16 +251=16 +252=16 +253=16 +254=16 +255=16 +256=16 +257=16 +258=16 +259=16 +260=16 +261=16 +262=16 +263=16 +264=16 +265=16 +266=16 +267=16 +268=16 +269=16 +270=16 +271=16 +272=16 +273=16 +274=16 +275=16 +276=16 +277=16 +278=16 +279=16 +280=16 +281=16 +282=16 +283=16 +284=16 +285=16 +286=16 +287=16 +288=16 +289=16 +290=16 +291=16 +292=16 +293=16 +294=16 +295=16 +296=16 +297=16 +298=16 +299=16 +300=16 +301=16 +302=16 +303=16 +304=16 +305=16 +306=16 +307=16 +308=16 +309=16 +310=16 +311=16 +312=16 +313=16 +314=16 +315=16 +316=16 +317=16 +318=16 +319=16 +320=16 +321=16 +322=16 +323=16 +324=16 +325=16 +326=16 +327=16 +328=16 +329=16 +330=16 +331=16 +332=16 +333=16 +334=16 +335=16 +336=16 +337=16 +338=16 +339=16 +340=16 +341=16 +342=16 +343=16 +344=16 +345=16 +346=16 +347=16 +348=16 +349=16 +350=16 +351=16 +352=16 +353=16 +354=16 +355=16 +356=16 +357=16 +358=16 +359=16 +360=16 +361=16 +362=16 +363=16 +364=16 +365=16 +366=16 +367=16 +368=16 +369=16 +370=16 +371=16 +372=16 +373=16 +374=16 +375=16 +376=16 +377=16 +378=16 +379=16 +380=16 +381=16 +382=16 +383=16 +384=16 +385=16 +386=16 +387=16 +388=16 +389=16 +390=16 +391=16 +392=16 +393=16 +394=16 +395=16 +396=16 +397=16 +398=16 +399=16 +400=16 +401=16 +402=16 +403=16 +404=16 +405=16 +406=16 +407=16 +408=16 +409=16 +410=16 +411=16 +412=16 +413=16 +414=16 +415=16 +416=16 +417=16 +418=16 +419=16 +420=16 +421=16 +422=16 +423=16 +424=16 +425=16 +426=16 +427=16 +428=16 +429=16 +430=16 +431=16 +432=16 +433=16 +434=16 +435=16 +436=16 +437=16 +438=16 +439=16 +440=16 +441=16 +442=16 +443=16 +444=16 +445=16 +446=16 +447=16 +448=16 +449=16 +450=16 +451=16 +452=16 +453=16 +454=16 +455=16 +456=16 +457=16 +458=16 +459=16 +460=16 +461=16 +462=16 +463=16 +464=16 +465=16 +466=16 +467=16 +468=16 +469=16 +470=16 +471=16 +472=16 +473=16 +474=16 +475=16 +476=16 +477=16 +478=16 +479=16 +480=16 +481=16 +482=16 +483=16 +484=16 +485=16 +486=16 +487=16 +488=16 +489=16 +490=16 +491=16 +492=16 +493=16 +494=16 +495=16 +496=16 +497=16 +498=16 +499=16 +500=16 +501=16 +502=16 +503=16 +504=16 +505=16 +506=16 +507=16 +508=16 +509=16 +510=16 +511=16 +512=16 +513=16 +514=16 +515=16 +516=16 +517=16 +518=16 +519=16 +520=16 +521=16 +522=16 +523=16 +524=16 +525=16 +526=16 +527=16 +528=16 +529=16 +530=16 +531=16 +532=16 +533=16 +534=16 +535=16 +536=16 +537=16 +538=16 +539=16 +540=16 +541=16 +542=16 +543=16 +544=16 +545=16 +546=16 +547=16 +548=16 +549=16 +550=16 +551=16 +552=16 +553=16 +554=16 +555=16 +556=16 +557=16 +558=16 +559=16 +560=16 +561=16 +562=16 +563=16 +564=16 +565=16 +566=16 +567=16 +568=16 +569=16 +570=16 +571=16 +572=16 +573=16 +574=16 +575=16 +576=16 +577=16 +578=16 +579=16 +580=16 +581=16 +582=16 +583=16 +584=16 +585=16 +586=16 +587=16 +588=16 +589=16 +590=16 +591=16 +592=16 +593=16 +594=16 +595=16 +596=16 +597=16 +598=16 +599=16 +600=16 +601=16 +602=16 +603=16 +604=16 +605=16 +606=16 +607=16 +608=16 +609=16 +610=16 +611=16 +612=16 +613=16 +614=16 +615=16 +616=16 +617=16 +618=16 +619=16 +620=16 +621=16 +622=16 +623=16 +624=16 +625=16 +626=16 +627=16 +628=16 +629=16 +630=16 +631=16 +632=16 +633=16 +634=16 +635=16 +636=16 +637=16 +638=16 +639=16 +640=16 +641=16 +642=16 +643=16 +644=16 +645=16 +646=16 +647=16 +648=16 +649=16 +650=16 +651=16 +652=16 +653=16 +654=16 +655=16 +656=16 +657=16 +658=16 +659=16 +660=16 +661=16 +662=16 +663=16 +664=16 +665=16 +666=16 +667=16 +668=16 +669=16 +670=16 +671=16 +672=16 +673=16 +674=16 +675=16 +676=16 +677=16 +678=16 +679=16 +680=16 +681=16 +682=16 +683=16 +684=16 +685=16 +686=16 +687=16 +688=16 +689=16 +690=16 +691=16 +692=16 +693=16 +694=16 +695=16 +696=16 +697=16 +698=16 +699=16 +700=16 +701=16 +702=16 +703=16 +704=16 +705=16 +706=16 +707=16 +708=16 +709=16 +710=16 +711=16 +712=16 +713=16 +714=16 +715=16 +716=16 +717=16 +718=16 +719=16 +720=16 +721=16 +722=16 +723=16 +724=16 +725=16 +726=16 +727=16 +728=16 +729=16 +730=16 +731=16 +732=16 +733=16 +734=16 +735=16 +736=16 +737=16 +738=16 +739=16 +740=16 +741=16 +742=16 +743=16 +744=16 +745=16 +746=16 +747=16 +748=16 +749=16 +750=16 +751=16 +752=16 +753=16 +754=16 +755=16 +756=16 +757=16 +758=16 +759=16 +760=16 +761=16 +762=16 +763=16 +764=16 +765=16 +766=16 +767=16 +768=16 +769=16 +770=16 +771=16 +772=16 +773=16 +774=16 +775=16 +776=16 +777=16 +778=16 +779=16 +780=16 +781=16 +782=16 +783=16 +784=16 +785=16 +786=16 +787=16 +788=16 +789=16 +790=16 +791=16 +792=16 +793=16 +794=16 +795=16 +796=16 +797=16 +798=16 +799=16 +800=16 +801=16 +802=16 +803=16 +804=16 +805=16 +806=16 +807=16 +808=16 +809=16 +810=16 +811=16 +812=16 +813=16 +814=16 +815=16 +816=16 +817=16 +818=16 +819=16 +820=16 +821=16 +822=16 +823=16 +824=16 +825=16 +826=16 +827=16 +828=16 +829=16 +830=16 +831=16 +832=16 +833=16 +834=16 +835=16 +836=16 +837=16 +838=16 +839=16 +840=16 +841=16 +842=16 +843=16 +844=16 +845=16 +846=16 +847=16 +848=16 +849=16 +850=16 +851=16 +852=16 +853=16 +854=16 +855=16 +856=16 +857=16 +858=16 +859=16 +860=16 +861=16 +862=16 +863=16 +864=16 +865=16 +866=16 +867=16 +868=16 +869=16 +870=16 +871=16 +872=16 +873=16 +874=16 +875=16 +876=16 +877=16 +878=16 +879=16 +880=16 +881=16 +882=16 +883=16 +884=16 +885=16 +886=16 +887=16 +888=16 +889=16 +890=16 +891=16 +892=16 +893=16 +894=16 +895=16 +896=16 +897=16 +898=16 +899=16 +900=16 +901=16 +902=16 +903=16 +904=16 +905=16 +906=16 +907=16 +908=16 +909=16 +910=16 +911=16 +912=16 +913=16 +914=16 +915=16 +916=16 +917=16 +918=16 +919=16 +920=16 +921=16 +922=16 +923=16 +924=16 +925=16 +926=16 +927=16 +928=16 +929=16 +930=16 +931=16 +932=16 +933=16 +934=16 +935=16 +936=16 +937=16 +938=16 +939=16 +940=16 +941=16 +942=16 +943=16 +944=16 +945=16 +946=16 +947=16 +948=16 +949=16 +950=16 +951=16 +952=16 +953=16 +954=16 +955=16 +956=16 +957=16 +958=16 +959=16 +960=16 +961=16 +962=16 +963=16 +964=16 +965=16 +966=16 +967=16 +968=16 +969=16 +970=16 +971=16 +972=16 +973=16 +974=16 +975=16 +976=16 +977=16 +978=16 +979=16 +980=16 +981=16 +982=16 +983=16 +984=16 +985=16 +986=16 +987=16 +988=16 +989=16 +990=16 +991=16 +992=16 +993=16 +994=16 +995=16 +996=16 +997=16 +998=16 +999=16 +1000=16 +1001=16 +1002=16 +1003=16 +1004=16 +1005=16 +1006=16 +1007=16 +1008=16 +1009=16 +1010=16 +1011=16 +1012=16 +1013=16 +1014=16 +1015=16 +1016=16 +1017=16 +1018=16 +1019=16 + +[kanji-jis2] +Line 0=弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞 +Line 1=仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥 +Line 2=倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲僉僊 +Line 3=傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮 +Line 4=冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾 +Line 5=刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼 +Line 6=劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍 +Line 7=凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮 +Line 8=吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨咫哂咤咾咼哘 +Line 9=哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼 +Line 10=喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀 +Line 11=嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜 +Line 12=圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡 +Line 13=塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽 +Line 14=夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩奸妁妝佞侫妣妲姆姨姜 +Line 15=妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖 +Line 16=嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢 +Line 17=寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛 +Line 18=岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬 +Line 19=嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀 +Line 20=幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏廖廣廝廚廛廢廡廨廩廬廱廳廰廴 +Line 21=廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇 +Line 22=從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷 +Line 23=恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵 +Line 24=惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚 +Line 25=慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣 +Line 26=懶懺懴懿懽懼懾戀戈戉戍戌戔戛戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找 +Line 27=抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍 +Line 28=搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨 +Line 29=搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺 +Line 30=攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆 +Line 31=旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈 +Line 32=暎暉暄暘暝曁暹曉暾暼曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸 +Line 33=朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆 +Line 34=柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁 +Line 35=棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔 +Line 36=楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴 +Line 37=槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢 +Line 38=檐檍檠檄檢檣檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹 +Line 39=飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓 +Line 40=毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅 +Line 41=泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕 +Line 42=渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃 +Line 43=渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯 +Line 44=漲滌漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔 +Line 45=濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋 +Line 46=烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼 +Line 47=燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎 +Line 48=狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻 +Line 49=珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱瓠瓣 +Line 50=瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭 +Line 51=畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰 +Line 52=痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發 +Line 53=皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥 +Line 54=眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮 +Line 55=矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬磧磚磽磴礇礒 +Line 56=礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙 +Line 57=稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊 +Line 58=竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥 +Line 59=筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇 +Line 60=簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫 +Line 61=粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆紂紜紕紊絅絋紮紲紿紵 +Line 62=絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤 +Line 63=緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩 +Line 64=繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨 +Line 65=罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜 +Line 66=耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚 +Line 67=肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋隋腆脾腓腑胼腱腮腥腦腴膃膈膊 +Line 68=膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂 +Line 69=舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬 +Line 70=苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪 +Line 71=莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸 +Line 72=蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡 +Line 73=蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾 +Line 74=薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋 +Line 75=蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥 +Line 76=蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯 +Line 77=蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵 +Line 78=衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪 +Line 79=褫襁襄褻褶褸襌褝襠襞襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿 +Line 80=觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦 +Line 81=誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁 +Line 82=譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸 +Line 83=豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍 +Line 84=贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐 +Line 85=踟蹂踵踰踴蹊蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡 +Line 86=躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌 +Line 87=轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧 +Line 88=逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤 +Line 89=扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟 +Line 90=釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺 +Line 91=鍄錮錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓 +Line 92=鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘 +Line 93=閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞 +Line 94=陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎 +Line 95=霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐 +Line 96=鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰顱顴 +Line 97=顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌 +Line 98=饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍 +Line 99=驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚 +Line 100=鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆 +Line 101=鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾 +Line 102=鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈鵝鵞鵤鵑鵐鵙 +Line 103=鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁 +Line 104=麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽 +Line 105=鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙 + +0=16 +1=16 +2=16 +3=16 +4=16 +5=16 +6=16 +7=16 +8=16 +9=16 +10=16 +11=16 +12=16 +13=16 +14=16 +15=16 +16=16 +17=16 +18=16 +19=16 +20=16 +21=16 +22=16 +23=16 +24=16 +25=16 +26=16 +27=16 +28=16 +29=16 +30=16 +31=16 +32=16 +33=16 +34=16 +35=16 +36=16 +37=16 +38=16 +39=16 +40=16 +41=16 +42=16 +43=16 +44=16 +45=16 +46=16 +47=16 +48=16 +49=16 +50=16 +51=16 +52=16 +53=16 +54=16 +55=16 +56=16 +57=16 +58=16 +59=16 +60=16 +61=16 +62=16 +63=16 +64=16 +65=16 +66=16 +67=16 +68=16 +69=16 +70=16 +71=16 +72=16 +73=16 +74=16 +75=16 +76=16 +77=16 +78=16 +79=16 +80=16 +81=16 +82=16 +83=16 +84=16 +85=16 +86=16 +87=16 +88=16 +89=16 +90=16 +91=16 +92=16 +93=16 +94=16 +95=16 +96=16 +97=16 +98=16 +99=16 +100=16 +101=16 +102=16 +103=16 +104=16 +105=16 +106=16 +107=16 +108=16 +109=16 +110=16 +111=16 +112=16 +113=16 +114=16 +115=16 +116=16 +117=16 +118=16 +119=16 +120=16 +121=16 +122=16 +123=16 +124=16 +125=16 +126=16 +127=16 +128=16 +129=16 +130=16 +131=16 +132=16 +133=16 +134=16 +135=16 +136=16 +137=16 +138=16 +139=16 +140=16 +141=16 +142=16 +143=16 +144=16 +145=16 +146=16 +147=16 +148=16 +149=16 +150=16 +151=16 +152=16 +153=16 +154=16 +155=16 +156=16 +157=16 +158=16 +159=16 +160=16 +161=16 +162=16 +163=16 +164=16 +165=16 +166=16 +167=16 +168=16 +169=16 +170=16 +171=16 +172=16 +173=16 +174=16 +175=16 +176=16 +177=16 +178=16 +179=16 +180=16 +181=16 +182=16 +183=16 +184=16 +185=16 +186=16 +187=16 +188=16 +189=16 +190=16 +191=16 +192=16 +193=16 +194=16 +195=16 +196=16 +197=16 +198=16 +199=16 +200=16 +201=16 +202=16 +203=16 +204=16 +205=16 +206=16 +207=16 +208=16 +209=16 +210=16 +211=16 +212=16 +213=16 +214=16 +215=16 +216=16 +217=16 +218=16 +219=16 +220=16 +221=16 +222=16 +223=16 +224=16 +225=16 +226=16 +227=16 +228=16 +229=16 +230=16 +231=16 +232=16 +233=16 +234=16 +235=16 +236=16 +237=16 +238=16 +239=16 +240=16 +241=16 +242=16 +243=16 +244=16 +245=16 +246=16 +247=16 +248=16 +249=16 +250=16 +251=16 +252=16 +253=16 +254=16 +255=16 +256=16 +257=16 +258=16 +259=16 +260=16 +261=16 +262=16 +263=16 +264=16 +265=16 +266=16 +267=16 +268=16 +269=16 +270=16 +271=16 +272=16 +273=16 +274=16 +275=16 +276=16 +277=16 +278=16 +279=16 +280=16 +281=16 +282=16 +283=16 +284=16 +285=16 +286=16 +287=16 +288=16 +289=16 +290=16 +291=16 +292=16 +293=16 +294=16 +295=16 +296=16 +297=16 +298=16 +299=16 +300=16 +301=16 +302=16 +303=16 +304=16 +305=16 +306=16 +307=16 +308=16 +309=16 +310=16 +311=16 +312=16 +313=16 +314=16 +315=16 +316=16 +317=16 +318=16 +319=16 +320=16 +321=16 +322=16 +323=16 +324=16 +325=16 +326=16 +327=16 +328=16 +329=16 +330=16 +331=16 +332=16 +333=16 +334=16 +335=16 +336=16 +337=16 +338=16 +339=16 +340=16 +341=16 +342=16 +343=16 +344=16 +345=16 +346=16 +347=16 +348=16 +349=16 +350=16 +351=16 +352=16 +353=16 +354=16 +355=16 +356=16 +357=16 +358=16 +359=16 +360=16 +361=16 +362=16 +363=16 +364=16 +365=16 +366=16 +367=16 +368=16 +369=16 +370=16 +371=16 +372=16 +373=16 +374=16 +375=16 +376=16 +377=16 +378=16 +379=16 +380=16 +381=16 +382=16 +383=16 +384=16 +385=16 +386=16 +387=16 +388=16 +389=16 +390=16 +391=16 +392=16 +393=16 +394=16 +395=16 +396=16 +397=16 +398=16 +399=16 +400=16 +401=16 +402=16 +403=16 +404=16 +405=16 +406=16 +407=16 +408=16 +409=16 +410=16 +411=16 +412=16 +413=16 +414=16 +415=16 +416=16 +417=16 +418=16 +419=16 +420=16 +421=16 +422=16 +423=16 +424=16 +425=16 +426=16 +427=16 +428=16 +429=16 +430=16 +431=16 +432=16 +433=16 +434=16 +435=16 +436=16 +437=16 +438=16 +439=16 +440=16 +441=16 +442=16 +443=16 +444=16 +445=16 +446=16 +447=16 +448=16 +449=16 +450=16 +451=16 +452=16 +453=16 +454=16 +455=16 +456=16 +457=16 +458=16 +459=16 +460=16 +461=16 +462=16 +463=16 +464=16 +465=16 +466=16 +467=16 +468=16 +469=16 +470=16 +471=16 +472=16 +473=16 +474=16 +475=16 +476=16 +477=16 +478=16 +479=16 +480=16 +481=16 +482=16 +483=16 +484=16 +485=16 +486=16 +487=16 +488=16 +489=16 +490=16 +491=16 +492=16 +493=16 +494=16 +495=16 +496=16 +497=16 +498=16 +499=16 +500=16 +501=16 +502=16 +503=16 +504=16 +505=16 +506=16 +507=16 +508=16 +509=16 +510=16 +511=16 +512=16 +513=16 +514=16 +515=16 +516=16 +517=16 +518=16 +519=16 +520=16 +521=16 +522=16 +523=16 +524=16 +525=16 +526=16 +527=16 +528=16 +529=16 +530=16 +531=16 +532=16 +533=16 +534=16 +535=16 +536=16 +537=16 +538=16 +539=16 +540=16 +541=16 +542=16 +543=16 +544=16 +545=16 +546=16 +547=16 +548=16 +549=16 +550=16 +551=16 +552=16 +553=16 +554=16 +555=16 +556=16 +557=16 +558=16 +559=16 +560=16 +561=16 +562=16 +563=16 +564=16 +565=16 +566=16 +567=16 +568=16 +569=16 +570=16 +571=16 +572=16 +573=16 +574=16 +575=16 +576=16 +577=16 +578=16 +579=16 +580=16 +581=16 +582=16 +583=16 +584=16 +585=16 +586=16 +587=16 +588=16 +589=16 +590=16 +591=16 +592=16 +593=16 +594=16 +595=16 +596=16 +597=16 +598=16 +599=16 +600=16 +601=16 +602=16 +603=16 +604=16 +605=16 +606=16 +607=16 +608=16 +609=16 +610=16 +611=16 +612=16 +613=16 +614=16 +615=16 +616=16 +617=16 +618=16 +619=16 +620=16 +621=16 +622=16 +623=16 +624=16 +625=16 +626=16 +627=16 +628=16 +629=16 +630=16 +631=16 +632=16 +633=16 +634=16 +635=16 +636=16 +637=16 +638=16 +639=16 +640=16 +641=16 +642=16 +643=16 +644=16 +645=16 +646=16 +647=16 +648=16 +649=16 +650=16 +651=16 +652=16 +653=16 +654=16 +655=16 +656=16 +657=16 +658=16 +659=16 +660=16 +661=16 +662=16 +663=16 +664=16 +665=16 +666=16 +667=16 +668=16 +669=16 +670=16 +671=16 +672=16 +673=16 +674=16 +675=16 +676=16 +677=16 +678=16 +679=16 +680=16 +681=16 +682=16 +683=16 +684=16 +685=16 +686=16 +687=16 +688=16 +689=16 +690=16 +691=16 +692=16 +693=16 +694=16 +695=16 +696=16 +697=16 +698=16 +699=16 +700=16 +701=16 +702=16 +703=16 +704=16 +705=16 +706=16 +707=16 +708=16 +709=16 +710=16 +711=16 +712=16 +713=16 +714=16 +715=16 +716=16 +717=16 +718=16 +719=16 +720=16 +721=16 +722=16 +723=16 +724=16 +725=16 +726=16 +727=16 +728=16 +729=16 +730=16 +731=16 +732=16 +733=16 +734=16 +735=16 +736=16 +737=16 +738=16 +739=16 +740=16 +741=16 +742=16 +743=16 +744=16 +745=16 +746=16 +747=16 +748=16 +749=16 +750=16 +751=16 +752=16 +753=16 +754=16 +755=16 +756=16 +757=16 +758=16 +759=16 +760=16 +761=16 +762=16 +763=16 +764=16 +765=16 +766=16 +767=16 +768=16 +769=16 +770=16 +771=16 +772=16 +773=16 +774=16 +775=16 +776=16 +777=16 +778=16 +779=16 +780=16 +781=16 +782=16 +783=16 +784=16 +785=16 +786=16 +787=16 +788=16 +789=16 +790=16 +791=16 +792=16 +793=16 +794=16 +795=16 +796=16 +797=16 +798=16 +799=16 +800=16 +801=16 +802=16 +803=16 +804=16 +805=16 +806=16 +807=16 +808=16 +809=16 +810=16 +811=16 +812=16 +813=16 +814=16 +815=16 +816=16 +817=16 +818=16 +819=16 +820=16 +821=16 +822=16 +823=16 +824=16 +825=16 +826=16 +827=16 +828=16 +829=16 +830=16 +831=16 +832=16 +833=16 +834=16 +835=16 +836=16 +837=16 +838=16 +839=16 +840=16 +841=16 +842=16 +843=16 +844=16 +845=16 +846=16 +847=16 +848=16 +849=16 +850=16 +851=16 +852=16 +853=16 +854=16 +855=16 +856=16 +857=16 +858=16 +859=16 +860=16 +861=16 +862=16 +863=16 +864=16 +865=16 +866=16 +867=16 +868=16 +869=16 +870=16 +871=16 +872=16 +873=16 +874=16 +875=16 +876=16 +877=16 +878=16 +879=16 +880=16 +881=16 +882=16 +883=16 +884=16 +885=16 +886=16 +887=16 +888=16 +889=16 +890=16 +891=16 +892=16 +893=16 +894=16 +895=16 +896=16 +897=16 +898=16 +899=16 +900=16 +901=16 +902=16 +903=16 +904=16 +905=16 +906=16 +907=16 +908=16 +909=16 +910=16 +911=16 +912=16 +913=16 +914=16 +915=16 +916=16 +917=16 +918=16 +919=16 +920=16 +921=16 +922=16 +923=16 +924=16 +925=16 +926=16 +927=16 +928=16 +929=16 +930=16 +931=16 +932=16 +933=16 +934=16 +935=16 +936=16 +937=16 +938=16 +939=16 +940=16 +941=16 +942=16 +943=16 +944=16 +945=16 +946=16 +947=16 +948=16 +949=16 +950=16 +951=16 +952=16 +953=16 +954=16 +955=16 +956=16 +957=16 +958=16 +959=16 +960=16 +961=16 +962=16 +963=16 +964=16 +965=16 +966=16 +967=16 +968=16 +969=16 +970=16 +971=16 +972=16 +973=16 +974=16 +975=16 +976=16 +977=16 +978=16 +979=16 +980=16 +981=16 +982=16 +983=16 +984=16 +985=16 +986=16 +987=16 +988=16 +989=16 +990=16 +991=16 +992=16 +993=16 +994=16 +995=16 +996=16 +997=16 +998=16 +999=16 +1000=16 +1001=16 +1002=16 +1003=16 +1004=16 +1005=16 +1006=16 +1007=16 +1008=16 +1009=16 +1010=16 +1011=16 +1012=16 +1013=16 +1014=16 +1015=16 +1016=16 +1017=16 +1018=16 +1019=16 +1020=16 +1021=16 +1022=16 +1023=16 +1024=16 +1025=16 +1026=16 +1027=16 +1028=16 +1029=16 +1030=16 +1031=16 +1032=16 +1033=16 +1034=16 +1035=16 +1036=16 +1037=16 +1038=16 +1039=16 +1040=16 +1041=16 +1042=16 +1043=16 +1044=16 +1045=16 +1046=16 +1047=16 +1048=16 +1049=16 +1050=16 +1051=16 +1052=16 +1053=16 +1054=16 +1055=16 +1056=16 +1057=16 +1058=16 +1059=16 +1060=16 +1061=16 +1062=16 +1063=16 +1064=16 +1065=16 +1066=16 +1067=16 +1068=16 +1069=16 +1070=16 +1071=16 +1072=16 +1073=16 +1074=16 +1075=16 +1076=16 +1077=16 +1078=16 +1079=16 +1080=16 +1081=16 +1082=16 +1083=16 +1084=16 +1085=16 +1086=16 +1087=16 +1088=16 +1089=16 +1090=16 +1091=16 +1092=16 +1093=16 +1094=16 +1095=16 +1096=16 +1097=16 +1098=16 +1099=16 +1100=16 +1101=16 +1102=16 +1103=16 +1104=16 +1105=16 +1106=16 +1107=16 +1108=16 +1109=16 +1110=16 +1111=16 +1112=16 +1113=16 +1114=16 +1115=16 +1116=16 +1117=16 +1118=16 +1119=16 +1120=16 +1121=16 +1122=16 +1123=16 +1124=16 +1125=16 +1126=16 +1127=16 +1128=16 +1129=16 +1130=16 +1131=16 +1132=16 +1133=16 +1134=16 +1135=16 +1136=16 +1137=16 +1138=16 +1139=16 +1140=16 +1141=16 +1142=16 +1143=16 +1144=16 +1145=16 +1146=16 +1147=16 +1148=16 +1149=16 +1150=16 +1151=16 +1152=16 +1153=16 +1154=16 +1155=16 +1156=16 +1157=16 +1158=16 +1159=16 +1160=16 +1161=16 +1162=16 +1163=16 +1164=16 +1165=16 +1166=16 +1167=16 +1168=16 +1169=16 +1170=16 +1171=16 +1172=16 +1173=16 +1174=16 +1175=16 +1176=16 +1177=16 +1178=16 +1179=16 +1180=16 +1181=16 +1182=16 +1183=16 +1184=16 +1185=16 +1186=16 +1187=16 +1188=16 +1189=16 +1190=16 +1191=16 +1192=16 +1193=16 +1194=16 +1195=16 +1196=16 +1197=16 +1198=16 +1199=16 +1200=16 +1201=16 +1202=16 +1203=16 +1204=16 +1205=16 +1206=16 +1207=16 +1208=16 +1209=16 +1210=16 +1211=16 +1212=16 +1213=16 +1214=16 +1215=16 +1216=16 +1217=16 +1218=16 +1219=16 +1220=16 +1221=16 +1222=16 +1223=16 +1224=16 +1225=16 +1226=16 +1227=16 +1228=16 +1229=16 +1230=16 +1231=16 +1232=16 +1233=16 +1234=16 +1235=16 +1236=16 +1237=16 +1238=16 +1239=16 +1240=16 +1241=16 +1242=16 +1243=16 +1244=16 +1245=16 +1246=16 +1247=16 +1248=16 +1249=16 +1250=16 +1251=16 +1252=16 +1253=16 +1254=16 +1255=16 +1256=16 +1257=16 +1258=16 +1259=16 +1260=16 +1261=16 +1262=16 +1263=16 +1264=16 +1265=16 +1266=16 +1267=16 +1268=16 +1269=16 +1270=16 +1271=16 +1272=16 +1273=16 +1274=16 +1275=16 +1276=16 +1277=16 +1278=16 +1279=16 +1280=16 +1281=16 +1282=16 +1283=16 +1284=16 +1285=16 +1286=16 +1287=16 +1288=16 +1289=16 +1290=16 +1291=16 +1292=16 +1293=16 +1294=16 +1295=16 +1296=16 +1297=16 +1298=16 +1299=16 +1300=16 +1301=16 +1302=16 +1303=16 +1304=16 +1305=16 +1306=16 +1307=16 +1308=16 +1309=16 +1310=16 +1311=16 +1312=16 +1313=16 +1314=16 +1315=16 +1316=16 +1317=16 +1318=16 +1319=16 +1320=16 +1321=16 +1322=16 +1323=16 +1324=16 +1325=16 +1326=16 +1327=16 +1328=16 +1329=16 +1330=16 +1331=16 +1332=16 +1333=16 +1334=16 +1335=16 +1336=16 +1337=16 +1338=16 +1339=16 +1340=16 +1341=16 +1342=16 +1343=16 +1344=16 +1345=16 +1346=16 +1347=16 +1348=16 +1349=16 +1350=16 +1351=16 +1352=16 +1353=16 +1354=16 +1355=16 +1356=16 +1357=16 +1358=16 +1359=16 +1360=16 +1361=16 +1362=16 +1363=16 +1364=16 +1365=16 +1366=16 +1367=16 +1368=16 +1369=16 +1370=16 +1371=16 +1372=16 +1373=16 +1374=16 +1375=16 +1376=16 +1377=16 +1378=16 +1379=16 +1380=16 +1381=16 +1382=16 +1383=16 +1384=16 +1385=16 +1386=16 +1387=16 +1388=16 +1389=16 +1390=16 +1391=16 +1392=16 +1393=16 +1394=16 +1395=16 +1396=16 +1397=16 +1398=16 +1399=16 +1400=16 +1401=16 +1402=16 +1403=16 +1404=16 +1405=16 +1406=16 +1407=16 +1408=16 +1409=16 +1410=16 +1411=16 +1412=16 +1413=16 +1414=16 +1415=16 +1416=16 +1417=16 +1418=16 +1419=16 +1420=16 +1421=16 +1422=16 +1423=16 +1424=16 +1425=16 +1426=16 +1427=16 +1428=16 +1429=16 +1430=16 +1431=16 +1432=16 +1433=16 +1434=16 +1435=16 +1436=16 +1437=16 +1438=16 +1439=16 +1440=16 +1441=16 +1442=16 +1443=16 +1444=16 +1445=16 +1446=16 +1447=16 +1448=16 +1449=16 +1450=16 +1451=16 +1452=16 +1453=16 +1454=16 +1455=16 +1456=16 +1457=16 +1458=16 +1459=16 +1460=16 +1461=16 +1462=16 +1463=16 +1464=16 +1465=16 +1466=16 +1467=16 +1468=16 +1469=16 +1470=16 +1471=16 +1472=16 +1473=16 +1474=16 +1475=16 +1476=16 +1477=16 +1478=16 +1479=16 +1480=16 +1481=16 +1482=16 +1483=16 +1484=16 +1485=16 +1486=16 +1487=16 +1488=16 +1489=16 +1490=16 +1491=16 +1492=16 +1493=16 +1494=16 +1495=16 +1496=16 +1497=16 +1498=16 +1499=16 +1500=16 +1501=16 +1502=16 +1503=16 +1504=16 +1505=16 +1506=16 +1507=16 +1508=16 +1509=16 +1510=16 +1511=16 +1512=16 +1513=16 +1514=16 +1515=16 +1516=16 +1517=16 +1518=16 +1519=16 +1520=16 +1521=16 +1522=16 +1523=16 +1524=16 +1525=16 +1526=16 +1527=16 +1528=16 +1529=16 +1530=16 +1531=16 +1532=16 +1533=16 +1534=16 +1535=16 +1536=16 +1537=16 +1538=16 +1539=16 +1540=16 +1541=16 +1542=16 +1543=16 +1544=16 +1545=16 +1546=16 +1547=16 +1548=16 +1549=16 +1550=16 +1551=16 +1552=16 +1553=16 +1554=16 +1555=16 +1556=16 +1557=16 +1558=16 +1559=16 +1560=16 +1561=16 +1562=16 +1563=16 +1564=16 +1565=16 +1566=16 +1567=16 +1568=16 +1569=16 +1570=16 +1571=16 +1572=16 +1573=16 +1574=16 +1575=16 +1576=16 +1577=16 +1578=16 +1579=16 +1580=16 +1581=16 +1582=16 +1583=16 +1584=16 +1585=16 +1586=16 +1587=16 +1588=16 +1589=16 +1590=16 +1591=16 +1592=16 +1593=16 +1594=16 +1595=16 +1596=16 +1597=16 +1598=16 +1599=16 +1600=16 +1601=16 +1602=16 +1603=16 +1604=16 +1605=16 +1606=16 +1607=16 +1608=16 +1609=16 +1610=16 +1611=16 +1612=16 +1613=16 +1614=16 +1615=16 +1616=16 +1617=16 +1618=16 +1619=16 +1620=16 +1621=16 +1622=16 +1623=16 +1624=16 +1625=16 +1626=16 +1627=16 +1628=16 +1629=16 +1630=16 +1631=16 +1632=16 +1633=16 +1634=16 +1635=16 +1636=16 +1637=16 +1638=16 +1639=16 +1640=16 +1641=16 +1642=16 +1643=16 +1644=16 +1645=16 +1646=16 +1647=16 +1648=16 +1649=16 +1650=16 +1651=16 +1652=16 +1653=16 +1654=16 +1655=16 +1656=16 +1657=16 +1658=16 +1659=16 +1660=16 +1661=16 +1662=16 +1663=16 +1664=16 +1665=16 +1666=16 +1667=16 +1668=16 +1669=16 +1670=16 +1671=16 +1672=16 +1673=16 +1674=16 +1675=16 +1676=16 +1677=16 +1678=16 +1679=16 +1680=16 +1681=16 +1682=16 +1683=16 +1684=16 +1685=16 +1686=16 +1687=16 +1688=16 +1689=16 +1690=16 +1691=16 +1692=16 +1693=16 +1694=16 +1695=16 +1696=16 +1697=16 +1698=16 +1699=16 +1700=16 +1701=16 +1702=16 +1703=16 +1704=16 +1705=16 +1706=16 +1707=16 +1708=16 +1709=16 +1710=16 +1711=16 +1712=16 +1713=16 +1714=16 +1715=16 +1716=16 +1717=16 +1718=16 +1719=16 +1720=16 +1721=16 +1722=16 +1723=16 +1724=16 +1725=16 +1726=16 +1727=16 +1728=16 +1729=16 +1730=16 +1731=16 +1732=16 +1733=16 +1734=16 +1735=16 +1736=16 +1737=16 +1738=16 +1739=16 +1740=16 +1741=16 +1742=16 +1743=16 +1744=16 +1745=16 +1746=16 +1747=16 +1748=16 +1749=16 +1750=16 +1751=16 +1752=16 +1753=16 +1754=16 +1755=16 +1756=16 +1757=16 +1758=16 +1759=16 +1760=16 +1761=16 +1762=16 +1763=16 +1764=16 +1765=16 +1766=16 +1767=16 +1768=16 +1769=16 +1770=16 +1771=16 +1772=16 +1773=16 +1774=16 +1775=16 +1776=16 +1777=16 +1778=16 +1779=16 +1780=16 +1781=16 +1782=16 +1783=16 +1784=16 +1785=16 +1786=16 +1787=16 +1788=16 +1789=16 +1790=16 +1791=16 +1792=16 +1793=16 +1794=16 +1795=16 +1796=16 +1797=16 +1798=16 +1799=16 +1800=16 +1801=16 +1802=16 +1803=16 +1804=16 +1805=16 +1806=16 +1807=16 +1808=16 +1809=16 +1810=16 +1811=16 +1812=16 +1813=16 +1814=16 +1815=16 +1816=16 +1817=16 +1818=16 +1819=16 +1820=16 +1821=16 +1822=16 +1823=16 +1824=16 +1825=16 +1826=16 +1827=16 +1828=16 +1829=16 +1830=16 +1831=16 +1832=16 +1833=16 +1834=16 +1835=16 +1836=16 +1837=16 +1838=16 +1839=16 +1840=16 +1841=16 +1842=16 +1843=16 +1844=16 +1845=16 +1846=16 +1847=16 +1848=16 +1849=16 +1850=16 +1851=16 +1852=16 +1853=16 +1854=16 +1855=16 +1856=16 +1857=16 +1858=16 +1859=16 +1860=16 +1861=16 +1862=16 +1863=16 +1864=16 +1865=16 +1866=16 +1867=16 +1868=16 +1869=16 +1870=16 +1871=16 +1872=16 +1873=16 +1874=16 +1875=16 +1876=16 +1877=16 +1878=16 +1879=16 +1880=16 +1881=16 +1882=16 +1883=16 +1884=16 +1885=16 +1886=16 +1887=16 +1888=16 +1889=16 +1890=16 +1891=16 +1892=16 +1893=16 +1894=16 +1895=16 +1896=16 +1897=16 +1898=16 +1899=16 +1900=16 +1901=16 +1902=16 +1903=16 +1904=16 +1905=16 +1906=16 +1907=16 +1908=16 +1909=16 +1910=16 +1911=16 +1912=16 +1913=16 +1914=16 +1915=16 +1916=16 +1917=16 +1918=16 +1919=16 +1920=16 +1921=16 +1922=16 +1923=16 +1924=16 +1925=16 +1926=16 +1927=16 +1928=16 +1929=16 +1930=16 +1931=16 +1932=16 +1933=16 +1934=16 +1935=16 +1936=16 +1937=16 +1938=16 +1939=16 +1940=16 +1941=16 +1942=16 +1943=16 +1944=16 +1945=16 +1946=16 +1947=16 +1948=16 +1949=16 +1950=16 +1951=16 +1952=16 +1953=16 +1954=16 +1955=16 +1956=16 +1957=16 +1958=16 +1959=16 +1960=16 +1961=16 +1962=16 +1963=16 +1964=16 +1965=16 +1966=16 +1967=16 +1968=16 +1969=16 +1970=16 +1971=16 +1972=16 +1973=16 +1974=16 +1975=16 +1976=16 +1977=16 +1978=16 +1979=16 +1980=16 +1981=16 +1982=16 +1983=16 +1984=16 +1985=16 +1986=16 +1987=16 +1988=16 +1989=16 +1990=16 +1991=16 +1992=16 +1993=16 +1994=16 +1995=16 +1996=16 +1997=16 +1998=16 +1999=16 +2000=16 +2001=16 +2002=16 +2003=16 +2004=16 +2005=16 +2006=16 +2007=16 +2008=16 +2009=16 +2010=16 +2011=16 +2012=16 +2013=16 +2014=16 +2015=16 +2016=16 +2017=16 +2018=16 +2019=16 +2020=16 +2021=16 +2022=16 +2023=16 +2024=16 +2025=16 +2026=16 +2027=16 +2028=16 +2029=16 +2030=16 +2031=16 +2032=16 +2033=16 +2034=16 +2035=16 +2036=16 +2037=16 +2038=16 +2039=16 +2040=16 +2041=16 +2042=16 +2043=16 +2044=16 +2045=16 +2046=16 +2047=16 +2048=16 +2049=16 +2050=16 +2051=16 +2052=16 +2053=16 +2054=16 +2055=16 +2056=16 +2057=16 +2058=16 +2059=16 +2060=16 +2061=16 +2062=16 +2063=16 +2064=16 +2065=16 +2066=16 +2067=16 +2068=16 +2069=16 +2070=16 +2071=16 +2072=16 +2073=16 +2074=16 +2075=16 +2076=16 +2077=16 +2078=16 +2079=16 +2080=16 +2081=16 +2082=16 +2083=16 +2084=16 +2085=16 +2086=16 +2087=16 +2088=16 +2089=16 +2090=16 +2091=16 +2092=16 +2093=16 +2094=16 +2095=16 +2096=16 +2097=16 +2098=16 +2099=16 +2100=16 +2101=16 +2102=16 +2103=16 +2104=16 +2105=16 +2106=16 +2107=16 +2108=16 +2109=16 +2110=16 +2111=16 +2112=16 +2113=16 +2114=16 +2115=16 +2116=16 +2117=16 +2118=16 +2119=16 +2120=16 +2121=16 +2122=16 +2123=16 +2124=16 +2125=16 +2126=16 +2127=16 +2128=16 +2129=16 +2130=16 +2131=16 +2132=16 +2133=16 +2134=16 +2135=16 +2136=16 +2137=16 +2138=16 +2139=16 +2140=16 +2141=16 +2142=16 +2143=16 +2144=16 +2145=16 +2146=16 +2147=16 +2148=16 +2149=16 +2150=16 +2151=16 +2152=16 +2153=16 +2154=16 +2155=16 +2156=16 +2157=16 +2158=16 +2159=16 +2160=16 +2161=16 +2162=16 +2163=16 +2164=16 +2165=16 +2166=16 +2167=16 +2168=16 +2169=16 +2170=16 +2171=16 +2172=16 +2173=16 +2174=16 +2175=16 +2176=16 +2177=16 +2178=16 +2179=16 +2180=16 +2181=16 +2182=16 +2183=16 +2184=16 +2185=16 +2186=16 +2187=16 +2188=16 +2189=16 +2190=16 +2191=16 +2192=16 +2193=16 +2194=16 +2195=16 +2196=16 +2197=16 +2198=16 +2199=16 +2200=16 +2201=16 +2202=16 +2203=16 +2204=16 +2205=16 +2206=16 +2207=16 +2208=16 +2209=16 +2210=16 +2211=16 +2212=16 +2213=16 +2214=16 +2215=16 +2216=16 +2217=16 +2218=16 +2219=16 +2220=16 +2221=16 +2222=16 +2223=16 +2224=16 +2225=16 +2226=16 +2227=16 +2228=16 +2229=16 +2230=16 +2231=16 +2232=16 +2233=16 +2234=16 +2235=16 +2236=16 +2237=16 +2238=16 +2239=16 +2240=16 +2241=16 +2242=16 +2243=16 +2244=16 +2245=16 +2246=16 +2247=16 +2248=16 +2249=16 +2250=16 +2251=16 +2252=16 +2253=16 +2254=16 +2255=16 +2256=16 +2257=16 +2258=16 +2259=16 +2260=16 +2261=16 +2262=16 +2263=16 +2264=16 +2265=16 +2266=16 +2267=16 +2268=16 +2269=16 +2270=16 +2271=16 +2272=16 +2273=16 +2274=16 +2275=16 +2276=16 +2277=16 +2278=16 +2279=16 +2280=16 +2281=16 +2282=16 +2283=16 +2284=16 +2285=16 +2286=16 +2287=16 +2288=16 +2289=16 +2290=16 +2291=16 +2292=16 +2293=16 +2294=16 +2295=16 +2296=16 +2297=16 +2298=16 +2299=16 +2300=16 +2301=16 +2302=16 +2303=16 +2304=16 +2305=16 +2306=16 +2307=16 +2308=16 +2309=16 +2310=16 +2311=16 +2312=16 +2313=16 +2314=16 +2315=16 +2316=16 +2317=16 +2318=16 +2319=16 +2320=16 +2321=16 +2322=16 +2323=16 +2324=16 +2325=16 +2326=16 +2327=16 +2328=16 +2329=16 +2330=16 +2331=16 +2332=16 +2333=16 +2334=16 +2335=16 +2336=16 +2337=16 +2338=16 +2339=16 +2340=16 +2341=16 +2342=16 +2343=16 +2344=16 +2345=16 +2346=16 +2347=16 +2348=16 +2349=16 +2350=16 +2351=16 +2352=16 +2353=16 +2354=16 +2355=16 +2356=16 +2357=16 +2358=16 +2359=16 +2360=16 +2361=16 +2362=16 +2363=16 +2364=16 +2365=16 +2366=16 +2367=16 +2368=16 +2369=16 +2370=16 +2371=16 +2372=16 +2373=16 +2374=16 +2375=16 +2376=16 +2377=16 +2378=16 +2379=16 +2380=16 +2381=16 +2382=16 +2383=16 +2384=16 +2385=16 +2386=16 +2387=16 +2388=16 +2389=16 +2390=16 +2391=16 +2392=16 +2393=16 +2394=16 +2395=16 +2396=16 +2397=16 +2398=16 +2399=16 +2400=16 +2401=16 +2402=16 +2403=16 +2404=16 +2405=16 +2406=16 +2407=16 +2408=16 +2409=16 +2410=16 +2411=16 +2412=16 +2413=16 +2414=16 +2415=16 +2416=16 +2417=16 +2418=16 +2419=16 +2420=16 +2421=16 +2422=16 +2423=16 +2424=16 +2425=16 +2426=16 +2427=16 +2428=16 +2429=16 +2430=16 +2431=16 +2432=16 +2433=16 +2434=16 +2435=16 +2436=16 +2437=16 +2438=16 +2439=16 +2440=16 +2441=16 +2442=16 +2443=16 +2444=16 +2445=16 +2446=16 +2447=16 +2448=16 +2449=16 +2450=16 +2451=16 +2452=16 +2453=16 +2454=16 +2455=16 +2456=16 +2457=16 +2458=16 +2459=16 +2460=16 +2461=16 +2462=16 +2463=16 +2464=16 +2465=16 +2466=16 +2467=16 +2468=16 +2469=16 +2470=16 +2471=16 +2472=16 +2473=16 +2474=16 +2475=16 +2476=16 +2477=16 +2478=16 +2479=16 +2480=16 +2481=16 +2482=16 +2483=16 +2484=16 +2485=16 +2486=16 +2487=16 +2488=16 +2489=16 +2490=16 +2491=16 +2492=16 +2493=16 +2494=16 +2495=16 +2496=16 +2497=16 +2498=16 +2499=16 +2500=16 +2501=16 +2502=16 +2503=16 +2504=16 +2505=16 +2506=16 +2507=16 +2508=16 +2509=16 +2510=16 +2511=16 +2512=16 +2513=16 +2514=16 +2515=16 +2516=16 +2517=16 +2518=16 +2519=16 +2520=16 +2521=16 +2522=16 +2523=16 +2524=16 +2525=16 +2526=16 +2527=16 +2528=16 +2529=16 +2530=16 +2531=16 +2532=16 +2533=16 +2534=16 +2535=16 +2536=16 +2537=16 +2538=16 +2539=16 +2540=16 +2541=16 +2542=16 +2543=16 +2544=16 +2545=16 +2546=16 +2547=16 +2548=16 +2549=16 +2550=16 +2551=16 +2552=16 +2553=16 +2554=16 +2555=16 +2556=16 +2557=16 +2558=16 +2559=16 +2560=16 +2561=16 +2562=16 +2563=16 +2564=16 +2565=16 +2566=16 +2567=16 +2568=16 +2569=16 +2570=16 +2571=16 +2572=16 +2573=16 +2574=16 +2575=16 +2576=16 +2577=16 +2578=16 +2579=16 +2580=16 +2581=16 +2582=16 +2583=16 +2584=16 +2585=16 +2586=16 +2587=16 +2588=16 +2589=16 +2590=16 +2591=16 +2592=16 +2593=16 +2594=16 +2595=16 +2596=16 +2597=16 +2598=16 +2599=16 +2600=16 +2601=16 +2602=16 +2603=16 +2604=16 +2605=16 +2606=16 +2607=16 +2608=16 +2609=16 +2610=16 +2611=16 +2612=16 +2613=16 +2614=16 +2615=16 +2616=16 +2617=16 +2618=16 +2619=16 +2620=16 +2621=16 +2622=16 +2623=16 +2624=16 +2625=16 +2626=16 +2627=16 +2628=16 +2629=16 +2630=16 +2631=16 +2632=16 +2633=16 +2634=16 +2635=16 +2636=16 +2637=16 +2638=16 +2639=16 +2640=16 +2641=16 +2642=16 +2643=16 +2644=16 +2645=16 +2646=16 +2647=16 +2648=16 +2649=16 +2650=16 +2651=16 +2652=16 +2653=16 +2654=16 +2655=16 +2656=16 +2657=16 +2658=16 +2659=16 +2660=16 +2661=16 +2662=16 +2663=16 +2664=16 +2665=16 +2666=16 +2667=16 +2668=16 +2669=16 +2670=16 +2671=16 +2672=16 +2673=16 +2674=16 +2675=16 +2676=16 +2677=16 +2678=16 +2679=16 +2680=16 +2681=16 +2682=16 +2683=16 +2684=16 +2685=16 +2686=16 +2687=16 +2688=16 +2689=16 +2690=16 +2691=16 +2692=16 +2693=16 +2694=16 +2695=16 +2696=16 +2697=16 +2698=16 +2699=16 +2700=16 +2701=16 +2702=16 +2703=16 +2704=16 +2705=16 +2706=16 +2707=16 +2708=16 +2709=16 +2710=16 +2711=16 +2712=16 +2713=16 +2714=16 +2715=16 +2716=16 +2717=16 +2718=16 +2719=16 +2720=16 +2721=16 +2722=16 +2723=16 +2724=16 +2725=16 +2726=16 +2727=16 +2728=16 +2729=16 +2730=16 +2731=16 +2732=16 +2733=16 +2734=16 +2735=16 +2736=16 +2737=16 +2738=16 +2739=16 +2740=16 +2741=16 +2742=16 +2743=16 +2744=16 +2745=16 +2746=16 +2747=16 +2748=16 +2749=16 +2750=16 +2751=16 +2752=16 +2753=16 +2754=16 +2755=16 +2756=16 +2757=16 +2758=16 +2759=16 +2760=16 +2761=16 +2762=16 +2763=16 +2764=16 +2765=16 +2766=16 +2767=16 +2768=16 +2769=16 +2770=16 +2771=16 +2772=16 +2773=16 +2774=16 +2775=16 +2776=16 +2777=16 +2778=16 +2779=16 +2780=16 +2781=16 +2782=16 +2783=16 +2784=16 +2785=16 +2786=16 +2787=16 +2788=16 +2789=16 +2790=16 +2791=16 +2792=16 +2793=16 +2794=16 +2795=16 +2796=16 +2797=16 +2798=16 +2799=16 +2800=16 +2801=16 +2802=16 +2803=16 +2804=16 +2805=16 +2806=16 +2807=16 +2808=16 +2809=16 +2810=16 +2811=16 +2812=16 +2813=16 +2814=16 +2815=16 +2816=16 +2817=16 +2818=16 +2819=16 +2820=16 +2821=16 +2822=16 +2823=16 +2824=16 +2825=16 +2826=16 +2827=16 +2828=16 +2829=16 +2830=16 +2831=16 +2832=16 +2833=16 +2834=16 +2835=16 +2836=16 +2837=16 +2838=16 +2839=16 +2840=16 +2841=16 +2842=16 +2843=16 +2844=16 +2845=16 +2846=16 +2847=16 +2848=16 +2849=16 +2850=16 +2851=16 +2852=16 +2853=16 +2854=16 +2855=16 +2856=16 +2857=16 +2858=16 +2859=16 +2860=16 +2861=16 +2862=16 +2863=16 +2864=16 +2865=16 +2866=16 +2867=16 +2868=16 +2869=16 +2870=16 +2871=16 +2872=16 +2873=16 +2874=16 +2875=16 +2876=16 +2877=16 +2878=16 +2879=16 +2880=16 +2881=16 +2882=16 +2883=16 +2884=16 +2885=16 +2886=16 +2887=16 +2888=16 +2889=16 +2890=16 +2891=16 +2892=16 +2893=16 +2894=16 +2895=16 +2896=16 +2897=16 +2898=16 +2899=16 +2900=16 +2901=16 +2902=16 +2903=16 +2904=16 +2905=16 +2906=16 +2907=16 +2908=16 +2909=16 +2910=16 +2911=16 +2912=16 +2913=16 +2914=16 +2915=16 +2916=16 +2917=16 +2918=16 +2919=16 +2920=16 +2921=16 +2922=16 +2923=16 +2924=16 +2925=16 +2926=16 +2927=16 +2928=16 +2929=16 +2930=16 +2931=16 +2932=16 +2933=16 +2934=16 +2935=16 +2936=16 +2937=16 +2938=16 +2939=16 +2940=16 +2941=16 +2942=16 +2943=16 +2944=16 +2945=16 +2946=16 +2947=16 +2948=16 +2949=16 +2950=16 +2951=16 +2952=16 +2953=16 +2954=16 +2955=16 +2956=16 +2957=16 +2958=16 +2959=16 +2960=16 +2961=16 +2962=16 +2963=16 +2964=16 +2965=16 +2966=16 +2967=16 +2968=16 +2969=16 +2970=16 +2971=16 +2972=16 +2973=16 +2974=16 +2975=16 +2976=16 +2977=16 +2978=16 +2979=16 +2980=16 +2981=16 +2982=16 +2983=16 +2984=16 +2985=16 +2986=16 +2987=16 +2988=16 +2989=16 +2990=16 +2991=16 +2992=16 +2993=16 +2994=16 +2995=16 +2996=16 +2997=16 +2998=16 +2999=16 +3000=16 +3001=16 +3002=16 +3003=16 +3004=16 +3005=16 +3006=16 +3007=16 +3008=16 +3009=16 +3010=16 +3011=16 +3012=16 +3013=16 +3014=16 +3015=16 +3016=16 +3017=16 +3018=16 +3019=16 +3020=16 +3021=16 +3022=16 +3023=16 +3024=16 +3025=16 +3026=16 +3027=16 +3028=16 +3029=16 +3030=16 +3031=16 +3032=16 +3033=16 +3034=16 +3035=16 +3036=16 +3037=16 +3038=16 +3039=16 +3040=16 +3041=16 +3042=16 +3043=16 +3044=16 +3045=16 +3046=16 +3047=16 +3048=16 +3049=16 +3050=16 +3051=16 +3052=16 +3053=16 +3054=16 +3055=16 +3056=16 +3057=16 +3058=16 +3059=16 +3060=16 +3061=16 +3062=16 +3063=16 +3064=16 +3065=16 +3066=16 +3067=16 +3068=16 +3069=16 +3070=16 +3071=16 +3072=16 +3073=16 +3074=16 +3075=16 +3076=16 +3077=16 +3078=16 +3079=16 +3080=16 +3081=16 +3082=16 +3083=16 +3084=16 +3085=16 +3086=16 +3087=16 +3088=16 +3089=16 +3090=16 +3091=16 +3092=16 +3093=16 +3094=16 +3095=16 +3096=16 +3097=16 +3098=16 +3099=16 +3100=16 +3101=16 +3102=16 +3103=16 +3104=16 +3105=16 +3106=16 +3107=16 +3108=16 +3109=16 +3110=16 +3111=16 +3112=16 +3113=16 +3114=16 +3115=16 +3116=16 +3117=16 +3118=16 +3119=16 +3120=16 +3121=16 +3122=16 +3123=16 +3124=16 +3125=16 +3126=16 +3127=16 +3128=16 +3129=16 +3130=16 +3131=16 +3132=16 +3133=16 +3134=16 +3135=16 +3136=16 +3137=16 +3138=16 +3139=16 +3140=16 +3141=16 +3142=16 +3143=16 +3144=16 +3145=16 +3146=16 +3147=16 +3148=16 +3149=16 +3150=16 +3151=16 +3152=16 +3153=16 +3154=16 +3155=16 +3156=16 +3157=16 +3158=16 +3159=16 +3160=16 +3161=16 +3162=16 +3163=16 +3164=16 +3165=16 +3166=16 +3167=16 +3168=16 +3169=16 +3170=16 +3171=16 +3172=16 +3173=16 +3174=16 +3175=16 +3176=16 +3177=16 +3178=16 +3179=16 +3180=16 +3181=16 +3182=16 +3183=16 +3184=16 +3185=16 +3186=16 +3187=16 +3188=16 +3189=16 +3190=16 +3191=16 +3192=16 +3193=16 +3194=16 +3195=16 +3196=16 +3197=16 +3198=16 +3199=16 +3200=16 +3201=16 +3202=16 +3203=16 +3204=16 +3205=16 +3206=16 +3207=16 +3208=16 +3209=16 +3210=16 +3211=16 +3212=16 +3213=16 +3214=16 +3215=16 +3216=16 +3217=16 +3218=16 +3219=16 +3220=16 +3221=16 +3222=16 +3223=16 +3224=16 +3225=16 +3226=16 +3227=16 +3228=16 +3229=16 +3230=16 +3231=16 +3232=16 +3233=16 +3234=16 +3235=16 +3236=16 +3237=16 +3238=16 +3239=16 +3240=16 +3241=16 +3242=16 +3243=16 +3244=16 +3245=16 +3246=16 +3247=16 +3248=16 +3249=16 +3250=16 +3251=16 +3252=16 +3253=16 +3254=16 +3255=16 +3256=16 +3257=16 +3258=16 +3259=16 +3260=16 +3261=16 +3262=16 +3263=16 +3264=16 +3265=16 +3266=16 +3267=16 +3268=16 +3269=16 +3270=16 +3271=16 +3272=16 +3273=16 +3274=16 +3275=16 +3276=16 +3277=16 +3278=16 +3279=16 +3280=16 +3281=16 +3282=16 +3283=16 +3284=16 +3285=16 +3286=16 +3287=16 +3288=16 +3289=16 +3290=16 +3291=16 +3292=16 +3293=16 +3294=16 +3295=16 +3296=16 +3297=16 +3298=16 +3299=16 +3300=16 +3301=16 +3302=16 +3303=16 +3304=16 +3305=16 +3306=16 +3307=16 +3308=16 +3309=16 +3310=16 +3311=16 +3312=16 +3313=16 +3314=16 +3315=16 +3316=16 +3317=16 +3318=16 +3319=16 +3320=16 +3321=16 +3322=16 +3323=16 +3324=16 +3325=16 +3326=16 +3327=16 +3328=16 +3329=16 +3330=16 +3331=16 +3332=16 +3333=16 +3334=16 +3335=16 +3336=16 +3337=16 +3338=16 +3339=16 +3340=16 +3341=16 +3342=16 +3343=16 +3344=16 +3345=16 +3346=16 +3347=16 +3348=16 +3349=16 +3350=16 +3351=16 +3352=16 +3353=16 +3354=16 +3355=16 +3356=16 +3357=16 +3358=16 +3359=16 +3360=16 +3361=16 +3362=16 +3363=16 +3364=16 +3365=16 +3366=16 +3367=16 +3368=16 +3369=16 +3370=16 +3371=16 +3372=16 +3373=16 +3374=16 +3375=16 +3376=16 +3377=16 +3378=16 +3379=16 +3380=16 +3381=16 +3382=16 +3383=16 +3384=16 +3385=16 +3386=16 +3387=16 +3388=16 +3389=16 diff --git a/Themes/_portKit-sm4/Fonts/_venacti Bold 13px.ini b/Themes/_portKit-sm4/Fonts/_venacti Bold 13px.ini index bc4af8d872..579b156fee 100644 --- a/Themes/_portKit-sm4/Fonts/_venacti Bold 13px.ini +++ b/Themes/_portKit-sm4/Fonts/_venacti Bold 13px.ini @@ -1,353 +1,353 @@ -[common] -Baseline=15 -Top=5 -LineSpacing=16 -DrawExtraPixelsLeft=1 -DrawExtraPixelsRight=1 -AdvanceExtraPixels=0 -DefaultStrokeColor=#FFFFFF00 - -[main] -Line 0= !"#$%&'()*+,-. -Line 1=/0123456789:;<= -Line 2=>?@ABCDEFGHIJKL -Line 3=MNOPQRSTUVWXYZ[ -Line 4=\]^_`abcdefghij -Line 5=klmnopqrstuvwxy -Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š -Line 7=‹ŒŽ‘’“”•–—˜™š›œ -Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ -Line 9=­®¯°±²³´µ¶·¸¹º» -Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ -Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ -Line 12=ÚÛÜÝÞßàáâãäåæçè -Line 13=éêëìíîïðñòóôõö÷ -Line 14=øùúûüýþÿ - -0=3 -1=4 -2=5 -3=8 -4=7 -5=10 -6=10 -7=3 -8=6 -9=6 -10=6 -11=8 -12=4 -13=6 -14=4 -15=6 -16=9 -17=4 -18=8 -19=7 -20=7 -21=8 -22=9 -23=7 -24=9 -25=9 -26=4 -27=4 -28=8 -29=8 -30=8 -31=7 -32=10 -33=8 -34=9 -35=8 -36=9 -37=8 -38=8 -39=9 -40=9 -41=4 -42=7 -43=9 -44=8 -45=11 -46=9 -47=9 -48=8 -49=9 -50=9 -51=8 -52=7 -53=9 -54=8 -55=12 -56=9 -57=8 -58=8 -59=6 -60=6 -61=6 -62=7 -63=8 -64=4 -65=7 -66=7 -67=7 -68=7 -69=7 -70=4 -71=7 -72=8 -73=3 -74=3 -75=7 -76=3 -77=11 -78=8 -79=8 -80=7 -81=7 -82=5 -83=7 -84=4 -85=7 -86=7 -87=9 -88=8 -89=7 -90=7 -91=6 -92=3 -93=6 -94=8 -95=8 -96=3 -97=15 -98=6 -99=12 -100=8 -101=8 -102=6 -103=14 -104=8 -105=8 -106=14 -107=8 -108=3 -109=3 -110=6 -111=6 -112=6 -113=8 -114=10 -115=4 -116=13 -117=7 -118=8 -119=12 -120=7 -121=8 -122=8 -123=4 -124=7 -125=7 -126=15 -127=8 -128=3 -129=15 -130=5 -131=11 -132=5 -133=7 -134=20 -135=20 -136=9 -137=20 -138=7 -139=15 -140=5 -141=5 -142=4 -143=15 -144=9 -145=4 -146=5 -147=4 -148=6 -149=7 -150=4 -151=4 -152=4 -153=7 -154=8 -155=8 -156=8 -157=8 -158=8 -159=8 -160=12 -161=8 -162=8 -163=8 -164=8 -165=8 -166=3 -167=3 -168=3 -169=3 -170=9 -171=9 -172=9 -173=9 -174=9 -175=9 -176=9 -177=7 -178=9 -179=9 -180=9 -181=9 -182=9 -183=8 -184=8 -185=8 -186=7 -187=7 -188=7 -189=7 -190=7 -191=7 -192=12 -193=7 -194=7 -195=7 -196=7 -197=7 -198=3 -199=3 -200=4 -201=3 -202=7 -203=8 -204=8 -205=8 -206=8 -207=8 -208=8 -209=7 -210=8 -211=7 -212=7 -213=7 -214=7 -215=7 -216=7 -217=7 - -[alt] -Line 0= Ą˘Ł¤ĽŚ§¨Š -Line 1=ŞŤŹ­ŽŻ°ą˛ł -Line 2=´ľśˇ¸šşťź˝ -Line 3=žżŔÁÂĂÄĹĆÇ -Line 4=ČÉĘËĚÍÎĎĐŃ -Line 5=ŇÓÔŐÖ×ŘŮÚŰ -Line 6=ÜÝŢßŕáâăäĺ -Line 7=ćçčéęëěíîď -Line 8=đńňóôőö÷řů -Line 9=úűüýţ˙ - -0=8 -1=20 -2=15 -3=8 -4=15 -5=20 -6=20 -7=15 -8=5 -9=8 -10=20 -11=20 -12=20 -13=20 -14=8 -15=20 -16=7 -17=20 -18=15 -19=4 -20=4 -21=20 -22=20 -23=6 -24=5 -25=7 -26=20 -27=20 -28=20 -29=13 -30=7 -31=20 -32=20 -33=8 -34=8 -35=20 -36=8 -37=20 -38=20 -39=8 -40=20 -41=8 -42=20 -43=8 -44=20 -45=3 -46=3 -47=20 -48=20 -49=20 -50=20 -51=9 -52=9 -53=20 -54=9 -55=7 -56=20 -57=20 -58=9 -59=20 -60=9 -61=8 -62=20 -63=8 -64=20 -65=7 -66=7 -67=20 -68=7 -69=20 -70=20 -71=7 -72=20 -73=7 -74=20 -75=7 -76=20 -77=3 -78=4 -79=20 -80=20 -81=20 -82=20 -83=8 -84=8 -85=20 -86=8 -87=7 -88=20 -89=20 -90=7 -91=20 -92=7 -93=7 -94=20 -95=15 +[common] +Baseline=15 +Top=5 +LineSpacing=16 +DrawExtraPixelsLeft=1 +DrawExtraPixelsRight=1 +AdvanceExtraPixels=0 +DefaultStrokeColor=#FFFFFF00 + +[main] +Line 0= !"#$%&'()*+,-. +Line 1=/0123456789:;<= +Line 2=>?@ABCDEFGHIJKL +Line 3=MNOPQRSTUVWXYZ[ +Line 4=\]^_`abcdefghij +Line 5=klmnopqrstuvwxy +Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š +Line 7=‹ŒŽ‘’“”•–—˜™š›œ +Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ +Line 9=­®¯°±²³´µ¶·¸¹º» +Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ +Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ +Line 12=ÚÛÜÝÞßàáâãäåæçè +Line 13=éêëìíîïðñòóôõö÷ +Line 14=øùúûüýþÿ + +0=3 +1=4 +2=5 +3=8 +4=7 +5=10 +6=10 +7=3 +8=6 +9=6 +10=6 +11=8 +12=4 +13=6 +14=4 +15=6 +16=9 +17=4 +18=8 +19=7 +20=7 +21=8 +22=9 +23=7 +24=9 +25=9 +26=4 +27=4 +28=8 +29=8 +30=8 +31=7 +32=10 +33=8 +34=9 +35=8 +36=9 +37=8 +38=8 +39=9 +40=9 +41=4 +42=7 +43=9 +44=8 +45=11 +46=9 +47=9 +48=8 +49=9 +50=9 +51=8 +52=7 +53=9 +54=8 +55=12 +56=9 +57=8 +58=8 +59=6 +60=6 +61=6 +62=7 +63=8 +64=4 +65=7 +66=7 +67=7 +68=7 +69=7 +70=4 +71=7 +72=8 +73=3 +74=3 +75=7 +76=3 +77=11 +78=8 +79=8 +80=7 +81=7 +82=5 +83=7 +84=4 +85=7 +86=7 +87=9 +88=8 +89=7 +90=7 +91=6 +92=3 +93=6 +94=8 +95=8 +96=3 +97=15 +98=6 +99=12 +100=8 +101=8 +102=6 +103=14 +104=8 +105=8 +106=14 +107=8 +108=3 +109=3 +110=6 +111=6 +112=6 +113=8 +114=10 +115=4 +116=13 +117=7 +118=8 +119=12 +120=7 +121=8 +122=8 +123=4 +124=7 +125=7 +126=15 +127=8 +128=3 +129=15 +130=5 +131=11 +132=5 +133=7 +134=20 +135=20 +136=9 +137=20 +138=7 +139=15 +140=5 +141=5 +142=4 +143=15 +144=9 +145=4 +146=5 +147=4 +148=6 +149=7 +150=4 +151=4 +152=4 +153=7 +154=8 +155=8 +156=8 +157=8 +158=8 +159=8 +160=12 +161=8 +162=8 +163=8 +164=8 +165=8 +166=3 +167=3 +168=3 +169=3 +170=9 +171=9 +172=9 +173=9 +174=9 +175=9 +176=9 +177=7 +178=9 +179=9 +180=9 +181=9 +182=9 +183=8 +184=8 +185=8 +186=7 +187=7 +188=7 +189=7 +190=7 +191=7 +192=12 +193=7 +194=7 +195=7 +196=7 +197=7 +198=3 +199=3 +200=4 +201=3 +202=7 +203=8 +204=8 +205=8 +206=8 +207=8 +208=8 +209=7 +210=8 +211=7 +212=7 +213=7 +214=7 +215=7 +216=7 +217=7 + +[alt] +Line 0= Ą˘Ł¤ĽŚ§¨Š +Line 1=ŞŤŹ­ŽŻ°ą˛ł +Line 2=´ľśˇ¸šşťź˝ +Line 3=žżŔÁÂĂÄĹĆÇ +Line 4=ČÉĘËĚÍÎĎĐŃ +Line 5=ŇÓÔŐÖ×ŘŮÚŰ +Line 6=ÜÝŢßŕáâăäĺ +Line 7=ćçčéęëěíîď +Line 8=đńňóôőö÷řů +Line 9=úűüýţ˙ + +0=8 +1=20 +2=15 +3=8 +4=15 +5=20 +6=20 +7=15 +8=5 +9=8 +10=20 +11=20 +12=20 +13=20 +14=8 +15=20 +16=7 +17=20 +18=15 +19=4 +20=4 +21=20 +22=20 +23=6 +24=5 +25=7 +26=20 +27=20 +28=20 +29=13 +30=7 +31=20 +32=20 +33=8 +34=8 +35=20 +36=8 +37=20 +38=20 +39=8 +40=20 +41=8 +42=20 +43=8 +44=20 +45=3 +46=3 +47=20 +48=20 +49=20 +50=20 +51=9 +52=9 +53=20 +54=9 +55=7 +56=20 +57=20 +58=9 +59=20 +60=9 +61=8 +62=20 +63=8 +64=20 +65=7 +66=7 +67=20 +68=7 +69=20 +70=20 +71=7 +72=20 +73=7 +74=20 +75=7 +76=20 +77=3 +78=4 +79=20 +80=20 +81=20 +82=20 +83=8 +84=8 +85=20 +86=8 +87=7 +88=20 +89=20 +90=7 +91=20 +92=7 +93=7 +94=20 +95=15 diff --git a/Themes/_portKit-sm4/Fonts/_venacti Bold 15px.ini b/Themes/_portKit-sm4/Fonts/_venacti Bold 15px.ini index 5be68aad8a..864773b400 100644 --- a/Themes/_portKit-sm4/Fonts/_venacti Bold 15px.ini +++ b/Themes/_portKit-sm4/Fonts/_venacti Bold 15px.ini @@ -1,353 +1,353 @@ -[common] -Baseline=17 -Top=5 -LineSpacing=18 -DrawExtraPixelsLeft=7 -DrawExtraPixelsRight=6 -AdvanceExtraPixels=0 -DefaultStrokeColor=#FFFFFF00 - -[main] -Line 0= !"#$%&'()*+,-. -Line 1=/0123456789:;<= -Line 2=>?@ABCDEFGHIJKL -Line 3=MNOPQRSTUVWXYZ[ -Line 4=\]^_`abcdefghij -Line 5=klmnopqrstuvwxy -Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š -Line 7=‹ŒŽ‘’“”•–—˜™š›œ -Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ -Line 9=­®¯°±²³´µ¶·¸¹º» -Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ -Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ -Line 12=ÚÛÜÝÞßàáâãäåæçè -Line 13=éêëìíîïðñòóôõö÷ -Line 14=øùúûüýþÿ - -0=4 -1=4 -2=6 -3=9 -4=8 -5=12 -6=12 -7=4 -8=6 -9=7 -10=7 -11=9 -12=4 -13=6 -14=4 -15=6 -16=10 -17=4 -18=9 -19=9 -20=9 -21=9 -22=10 -23=8 -24=10 -25=10 -26=4 -27=4 -28=9 -29=9 -30=9 -31=8 -32=11 -33=10 -34=10 -35=9 -36=10 -37=9 -38=9 -39=10 -40=10 -41=4 -42=8 -43=10 -44=9 -45=13 -46=10 -47=10 -48=9 -49=10 -50=10 -51=9 -52=9 -53=10 -54=10 -55=13 -56=10 -57=9 -58=9 -59=7 -60=6 -61=7 -62=9 -63=9 -64=5 -65=8 -66=8 -67=8 -68=8 -69=8 -70=5 -71=9 -72=9 -73=4 -74=4 -75=8 -76=4 -77=13 -78=9 -79=9 -80=8 -81=9 -82=6 -83=8 -84=5 -85=9 -86=8 -87=11 -88=9 -89=8 -90=8 -91=6 -92=4 -93=7 -94=9 -95=9 -96=3 -97=15 -98=6 -99=14 -100=9 -101=9 -102=7 -103=16 -104=9 -105=9 -106=16 -107=9 -108=3 -109=3 -110=6 -111=6 -112=7 -113=9 -114=12 -115=5 -116=15 -117=8 -118=9 -119=14 -120=8 -121=9 -122=10 -123=4 -124=8 -125=9 -126=15 -127=9 -128=4 -129=15 -130=6 -131=13 -132=6 -133=8 -134=20 -135=20 -136=10 -137=20 -138=8 -139=15 -140=6 -141=6 -142=5 -143=15 -144=10 -145=4 -146=5 -147=4 -148=6 -149=9 -150=5 -151=5 -152=5 -153=8 -154=10 -155=10 -156=10 -157=10 -158=10 -159=10 -160=13 -161=9 -162=9 -163=9 -164=9 -165=9 -166=4 -167=4 -168=4 -169=3 -170=10 -171=10 -172=10 -173=10 -174=10 -175=10 -176=10 -177=8 -178=10 -179=10 -180=10 -181=10 -182=10 -183=9 -184=9 -185=9 -186=8 -187=8 -188=8 -189=8 -190=8 -191=8 -192=13 -193=8 -194=8 -195=8 -196=8 -197=8 -198=4 -199=4 -200=4 -201=4 -202=8 -203=9 -204=9 -205=9 -206=9 -207=9 -208=9 -209=8 -210=9 -211=9 -212=9 -213=9 -214=9 -215=8 -216=8 -217=8 - -[alt] -Line 0= Ą˘Ł¤ĽŚ§¨Š -Line 1=ŞŤŹ­ŽŻ°ą˛ł -Line 2=´ľśˇ¸šşťź˝ -Line 3=žżŔÁÂĂÄĹĆÇ -Line 4=ČÉĘËĚÍÎĎĐŃ -Line 5=ŇÓÔŐÖ×ŘŮÚŰ -Line 6=ÜÝŢßŕáâăäĺ -Line 7=ćçčéęëěíîď -Line 8=đńňóôőö÷řů -Line 9=úűüýţ˙ - -0=10 -1=20 -2=15 -3=9 -4=15 -5=20 -6=20 -7=15 -8=6 -9=9 -10=20 -11=20 -12=20 -13=20 -14=9 -15=20 -16=8 -17=20 -18=15 -19=4 -20=5 -21=20 -22=20 -23=7 -24=5 -25=8 -26=20 -27=20 -28=20 -29=13 -30=8 -31=20 -32=20 -33=10 -34=10 -35=20 -36=10 -37=20 -38=20 -39=9 -40=20 -41=9 -42=20 -43=9 -44=20 -45=4 -46=4 -47=20 -48=20 -49=20 -50=20 -51=10 -52=10 -53=20 -54=10 -55=8 -56=20 -57=20 -58=10 -59=20 -60=10 -61=9 -62=20 -63=9 -64=20 -65=8 -66=8 -67=20 -68=8 -69=20 -70=20 -71=8 -72=20 -73=8 -74=20 -75=8 -76=20 -77=4 -78=4 -79=20 -80=20 -81=20 -82=20 -83=9 -84=9 -85=20 -86=9 -87=8 -88=20 -89=20 -90=9 -91=20 -92=9 -93=8 -94=20 -95=15 +[common] +Baseline=17 +Top=5 +LineSpacing=18 +DrawExtraPixelsLeft=7 +DrawExtraPixelsRight=6 +AdvanceExtraPixels=0 +DefaultStrokeColor=#FFFFFF00 + +[main] +Line 0= !"#$%&'()*+,-. +Line 1=/0123456789:;<= +Line 2=>?@ABCDEFGHIJKL +Line 3=MNOPQRSTUVWXYZ[ +Line 4=\]^_`abcdefghij +Line 5=klmnopqrstuvwxy +Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š +Line 7=‹ŒŽ‘’“”•–—˜™š›œ +Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ +Line 9=­®¯°±²³´µ¶·¸¹º» +Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ +Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ +Line 12=ÚÛÜÝÞßàáâãäåæçè +Line 13=éêëìíîïðñòóôõö÷ +Line 14=øùúûüýþÿ + +0=4 +1=4 +2=6 +3=9 +4=8 +5=12 +6=12 +7=4 +8=6 +9=7 +10=7 +11=9 +12=4 +13=6 +14=4 +15=6 +16=10 +17=4 +18=9 +19=9 +20=9 +21=9 +22=10 +23=8 +24=10 +25=10 +26=4 +27=4 +28=9 +29=9 +30=9 +31=8 +32=11 +33=10 +34=10 +35=9 +36=10 +37=9 +38=9 +39=10 +40=10 +41=4 +42=8 +43=10 +44=9 +45=13 +46=10 +47=10 +48=9 +49=10 +50=10 +51=9 +52=9 +53=10 +54=10 +55=13 +56=10 +57=9 +58=9 +59=7 +60=6 +61=7 +62=9 +63=9 +64=5 +65=8 +66=8 +67=8 +68=8 +69=8 +70=5 +71=9 +72=9 +73=4 +74=4 +75=8 +76=4 +77=13 +78=9 +79=9 +80=8 +81=9 +82=6 +83=8 +84=5 +85=9 +86=8 +87=11 +88=9 +89=8 +90=8 +91=6 +92=4 +93=7 +94=9 +95=9 +96=3 +97=15 +98=6 +99=14 +100=9 +101=9 +102=7 +103=16 +104=9 +105=9 +106=16 +107=9 +108=3 +109=3 +110=6 +111=6 +112=7 +113=9 +114=12 +115=5 +116=15 +117=8 +118=9 +119=14 +120=8 +121=9 +122=10 +123=4 +124=8 +125=9 +126=15 +127=9 +128=4 +129=15 +130=6 +131=13 +132=6 +133=8 +134=20 +135=20 +136=10 +137=20 +138=8 +139=15 +140=6 +141=6 +142=5 +143=15 +144=10 +145=4 +146=5 +147=4 +148=6 +149=9 +150=5 +151=5 +152=5 +153=8 +154=10 +155=10 +156=10 +157=10 +158=10 +159=10 +160=13 +161=9 +162=9 +163=9 +164=9 +165=9 +166=4 +167=4 +168=4 +169=3 +170=10 +171=10 +172=10 +173=10 +174=10 +175=10 +176=10 +177=8 +178=10 +179=10 +180=10 +181=10 +182=10 +183=9 +184=9 +185=9 +186=8 +187=8 +188=8 +189=8 +190=8 +191=8 +192=13 +193=8 +194=8 +195=8 +196=8 +197=8 +198=4 +199=4 +200=4 +201=4 +202=8 +203=9 +204=9 +205=9 +206=9 +207=9 +208=9 +209=8 +210=9 +211=9 +212=9 +213=9 +214=9 +215=8 +216=8 +217=8 + +[alt] +Line 0= Ą˘Ł¤ĽŚ§¨Š +Line 1=ŞŤŹ­ŽŻ°ą˛ł +Line 2=´ľśˇ¸šşťź˝ +Line 3=žżŔÁÂĂÄĹĆÇ +Line 4=ČÉĘËĚÍÎĎĐŃ +Line 5=ŇÓÔŐÖ×ŘŮÚŰ +Line 6=ÜÝŢßŕáâăäĺ +Line 7=ćçčéęëěíîď +Line 8=đńňóôőö÷řů +Line 9=úűüýţ˙ + +0=10 +1=20 +2=15 +3=9 +4=15 +5=20 +6=20 +7=15 +8=6 +9=9 +10=20 +11=20 +12=20 +13=20 +14=9 +15=20 +16=8 +17=20 +18=15 +19=4 +20=5 +21=20 +22=20 +23=7 +24=5 +25=8 +26=20 +27=20 +28=20 +29=13 +30=8 +31=20 +32=20 +33=10 +34=10 +35=20 +36=10 +37=20 +38=20 +39=9 +40=20 +41=9 +42=20 +43=9 +44=20 +45=4 +46=4 +47=20 +48=20 +49=20 +50=20 +51=10 +52=10 +53=20 +54=10 +55=8 +56=20 +57=20 +58=10 +59=20 +60=10 +61=9 +62=20 +63=9 +64=20 +65=8 +66=8 +67=20 +68=8 +69=20 +70=20 +71=8 +72=20 +73=8 +74=20 +75=8 +76=20 +77=4 +78=4 +79=20 +80=20 +81=20 +82=20 +83=9 +84=9 +85=20 +86=9 +87=8 +88=20 +89=20 +90=9 +91=20 +92=9 +93=8 +94=20 +95=15 diff --git a/Themes/_portKit-sm4/Fonts/_venacti Bold 24px.ini b/Themes/_portKit-sm4/Fonts/_venacti Bold 24px.ini index b0886a34fb..771021c055 100644 --- a/Themes/_portKit-sm4/Fonts/_venacti Bold 24px.ini +++ b/Themes/_portKit-sm4/Fonts/_venacti Bold 24px.ini @@ -1,353 +1,353 @@ -[common] -Baseline=26 -Top=7 -LineSpacing=29 -DrawExtraPixelsLeft=2 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 -DefaultStrokeColor=#FFFFFF00 - -[main] -Line 0= !"#$%&'()*+,-. -Line 1=/0123456789:;<= -Line 2=>?@ABCDEFGHIJKL -Line 3=MNOPQRSTUVWXYZ[ -Line 4=\]^_`abcdefghij -Line 5=klmnopqrstuvwxy -Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š -Line 7=‹ŒŽ‘’“”•–—˜™š›œ -Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ -Line 9=­®¯°±²³´µ¶·¸¹º» -Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ -Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ -Line 12=ÚÛÜÝÞßàáâãäåæçè -Line 13=éêëìíîïðñòóôõö÷ -Line 14=øùúûüýþÿ - -0=6 -1=7 -2=9 -3=15 -4=12 -5=18 -6=19 -7=6 -8=10 -9=10 -10=12 -11=15 -12=7 -13=10 -14=7 -15=10 -16=16 -17=7 -18=15 -19=14 -20=14 -21=15 -22=16 -23=13 -24=16 -25=16 -26=7 -27=7 -28=15 -29=14 -30=15 -31=13 -32=18 -33=15 -34=16 -35=15 -36=16 -37=15 -38=14 -39=16 -40=16 -41=7 -42=12 -43=16 -44=14 -45=21 -46=16 -47=16 -48=15 -49=16 -50=16 -51=15 -52=14 -53=16 -54=15 -55=22 -56=17 -57=15 -58=15 -59=11 -60=10 -61=11 -62=14 -63=14 -64=8 -65=13 -66=13 -67=13 -68=13 -69=13 -70=8 -71=14 -72=14 -73=6 -74=6 -75=13 -76=6 -77=21 -78=14 -79=14 -80=14 -81=14 -82=9 -83=13 -84=8 -85=14 -86=12 -87=17 -88=14 -89=13 -90=13 -91=10 -92=6 -93=10 -94=15 -95=14 -96=5 -97=10 -98=10 -99=22 -100=15 -101=15 -102=12 -103=26 -104=15 -105=15 -106=25 -107=15 -108=5 -109=5 -110=10 -111=10 -112=11 -113=15 -114=19 -115=8 -116=24 -117=13 -118=15 -119=22 -120=13 -121=15 -122=16 -123=7 -124=12 -125=14 -126=10 -127=15 -128=6 -129=10 -130=10 -131=21 -132=10 -133=13 -134=10 -135=4 -136=16 -137=10 -138=12 -139=10 -140=10 -141=9 -142=8 -143=10 -144=16 -145=7 -146=8 -147=7 -148=10 -149=14 -150=8 -151=8 -152=8 -153=13 -154=15 -155=15 -156=15 -157=15 -158=15 -159=15 -160=21 -161=15 -162=15 -163=15 -164=15 -165=15 -166=6 -167=6 -168=6 -169=6 -170=16 -171=16 -172=16 -173=16 -174=16 -175=16 -176=16 -177=14 -178=16 -179=16 -180=16 -181=16 -182=16 -183=15 -184=14 -185=14 -186=13 -187=13 -188=13 -189=13 -190=13 -191=13 -192=21 -193=13 -194=13 -195=13 -196=13 -197=13 -198=6 -199=6 -200=7 -201=6 -202=13 -203=14 -204=14 -205=14 -206=14 -207=14 -208=14 -209=12 -210=14 -211=14 -212=14 -213=14 -214=14 -215=13 -216=14 -217=13 - -[alt] -Line 0= Ą˘Ł¤ĽŚ§¨Š -Line 1=ŞŤŹ­ŽŻ°ą˛ł -Line 2=´ľśˇ¸šşťź˝ -Line 3=žżŔÁÂĂÄĹĆÇ -Line 4=ČÉĘËĚÍÎĎĐŃ -Line 5=ŇÓÔŐÖ×ŘŮÚŰ -Line 6=ÜÝŢßŕáâăäĺ -Line 7=ćçčéęëěíîď -Line 8=đńňóôőö÷řů -Line 9=úűüýţ˙ - -0=16 -1=12 -2=12 -3=14 -4=10 -5=12 -6=12 -7=10 -8=10 -9=15 -10=12 -11=12 -12=12 -13=4 -14=15 -15=12 -16=12 -17=12 -18=12 -19=7 -20=8 -21=12 -22=12 -23=11 -24=8 -25=13 -26=12 -27=12 -28=12 -29=12 -30=13 -31=12 -32=12 -33=15 -34=15 -35=12 -36=15 -37=12 -38=12 -39=15 -40=12 -41=15 -42=12 -43=15 -44=12 -45=6 -46=6 -47=12 -48=12 -49=12 -50=12 -51=16 -52=16 -53=12 -54=16 -55=14 -56=12 -57=12 -58=16 -59=12 -60=16 -61=15 -62=12 -63=14 -64=12 -65=13 -66=13 -67=12 -68=13 -69=12 -70=12 -71=13 -72=12 -73=13 -74=12 -75=13 -76=12 -77=6 -78=7 -79=12 -80=12 -81=12 -82=12 -83=14 -84=14 -85=12 -86=14 -87=12 -88=12 -89=12 -90=14 -91=12 -92=14 -93=13 -94=12 -95=12 +[common] +Baseline=26 +Top=7 +LineSpacing=29 +DrawExtraPixelsLeft=2 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 +DefaultStrokeColor=#FFFFFF00 + +[main] +Line 0= !"#$%&'()*+,-. +Line 1=/0123456789:;<= +Line 2=>?@ABCDEFGHIJKL +Line 3=MNOPQRSTUVWXYZ[ +Line 4=\]^_`abcdefghij +Line 5=klmnopqrstuvwxy +Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š +Line 7=‹ŒŽ‘’“”•–—˜™š›œ +Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ +Line 9=­®¯°±²³´µ¶·¸¹º» +Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ +Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ +Line 12=ÚÛÜÝÞßàáâãäåæçè +Line 13=éêëìíîïðñòóôõö÷ +Line 14=øùúûüýþÿ + +0=6 +1=7 +2=9 +3=15 +4=12 +5=18 +6=19 +7=6 +8=10 +9=10 +10=12 +11=15 +12=7 +13=10 +14=7 +15=10 +16=16 +17=7 +18=15 +19=14 +20=14 +21=15 +22=16 +23=13 +24=16 +25=16 +26=7 +27=7 +28=15 +29=14 +30=15 +31=13 +32=18 +33=15 +34=16 +35=15 +36=16 +37=15 +38=14 +39=16 +40=16 +41=7 +42=12 +43=16 +44=14 +45=21 +46=16 +47=16 +48=15 +49=16 +50=16 +51=15 +52=14 +53=16 +54=15 +55=22 +56=17 +57=15 +58=15 +59=11 +60=10 +61=11 +62=14 +63=14 +64=8 +65=13 +66=13 +67=13 +68=13 +69=13 +70=8 +71=14 +72=14 +73=6 +74=6 +75=13 +76=6 +77=21 +78=14 +79=14 +80=14 +81=14 +82=9 +83=13 +84=8 +85=14 +86=12 +87=17 +88=14 +89=13 +90=13 +91=10 +92=6 +93=10 +94=15 +95=14 +96=5 +97=10 +98=10 +99=22 +100=15 +101=15 +102=12 +103=26 +104=15 +105=15 +106=25 +107=15 +108=5 +109=5 +110=10 +111=10 +112=11 +113=15 +114=19 +115=8 +116=24 +117=13 +118=15 +119=22 +120=13 +121=15 +122=16 +123=7 +124=12 +125=14 +126=10 +127=15 +128=6 +129=10 +130=10 +131=21 +132=10 +133=13 +134=10 +135=4 +136=16 +137=10 +138=12 +139=10 +140=10 +141=9 +142=8 +143=10 +144=16 +145=7 +146=8 +147=7 +148=10 +149=14 +150=8 +151=8 +152=8 +153=13 +154=15 +155=15 +156=15 +157=15 +158=15 +159=15 +160=21 +161=15 +162=15 +163=15 +164=15 +165=15 +166=6 +167=6 +168=6 +169=6 +170=16 +171=16 +172=16 +173=16 +174=16 +175=16 +176=16 +177=14 +178=16 +179=16 +180=16 +181=16 +182=16 +183=15 +184=14 +185=14 +186=13 +187=13 +188=13 +189=13 +190=13 +191=13 +192=21 +193=13 +194=13 +195=13 +196=13 +197=13 +198=6 +199=6 +200=7 +201=6 +202=13 +203=14 +204=14 +205=14 +206=14 +207=14 +208=14 +209=12 +210=14 +211=14 +212=14 +213=14 +214=14 +215=13 +216=14 +217=13 + +[alt] +Line 0= Ą˘Ł¤ĽŚ§¨Š +Line 1=ŞŤŹ­ŽŻ°ą˛ł +Line 2=´ľśˇ¸šşťź˝ +Line 3=žżŔÁÂĂÄĹĆÇ +Line 4=ČÉĘËĚÍÎĎĐŃ +Line 5=ŇÓÔŐÖ×ŘŮÚŰ +Line 6=ÜÝŢßŕáâăäĺ +Line 7=ćçčéęëěíîď +Line 8=đńňóôőö÷řů +Line 9=úűüýţ˙ + +0=16 +1=12 +2=12 +3=14 +4=10 +5=12 +6=12 +7=10 +8=10 +9=15 +10=12 +11=12 +12=12 +13=4 +14=15 +15=12 +16=12 +17=12 +18=12 +19=7 +20=8 +21=12 +22=12 +23=11 +24=8 +25=13 +26=12 +27=12 +28=12 +29=12 +30=13 +31=12 +32=12 +33=15 +34=15 +35=12 +36=15 +37=12 +38=12 +39=15 +40=12 +41=15 +42=12 +43=15 +44=12 +45=6 +46=6 +47=12 +48=12 +49=12 +50=12 +51=16 +52=16 +53=12 +54=16 +55=14 +56=12 +57=12 +58=16 +59=12 +60=16 +61=15 +62=12 +63=14 +64=12 +65=13 +66=13 +67=12 +68=13 +69=12 +70=12 +71=13 +72=12 +73=13 +74=12 +75=13 +76=12 +77=6 +78=7 +79=12 +80=12 +81=12 +82=12 +83=14 +84=14 +85=12 +86=14 +87=12 +88=12 +89=12 +90=14 +91=12 +92=14 +93=13 +94=12 +95=12 diff --git a/Themes/_portKit-sm4/Graphics/ScreenMapControllers exit.lua b/Themes/_portKit-sm4/Graphics/ScreenMapControllers exit.lua index 30d51e6f23..08c62f7eb7 100644 --- a/Themes/_portKit-sm4/Graphics/ScreenMapControllers exit.lua +++ b/Themes/_portKit-sm4/Graphics/ScreenMapControllers exit.lua @@ -1,10 +1,10 @@ -return LoadFont("Common Normal") .. { - Text="Exit"; - InitCommand=cmd(x,SCREEN_CENTER_X;zoom,0.75;shadowlength,0;diffuse,color("#808080")); - OnCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1); - OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"); - HideCommand=cmd(hidden,true); - - GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")); - LoseFocusCommand=cmd(stopeffect); -}; +return LoadFont("Common Normal") .. { + Text="Exit"; + InitCommand=cmd(x,SCREEN_CENTER_X;zoom,0.75;shadowlength,0;diffuse,color("#808080")); + OnCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1); + OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"); + HideCommand=cmd(hidden,true); + + GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")); + LoseFocusCommand=cmd(stopeffect); +}; diff --git a/Themes/_portKit-sm4/Graphics/ScreenWithMenuElements Help.lua b/Themes/_portKit-sm4/Graphics/ScreenWithMenuElements Help.lua index 9d4fd1de7a..213e763d42 100644 --- a/Themes/_portKit-sm4/Graphics/ScreenWithMenuElements Help.lua +++ b/Themes/_portKit-sm4/Graphics/ScreenWithMenuElements Help.lua @@ -1,10 +1,10 @@ -return Def.HelpDisplay { - File = THEME:GetPathF("HelpDisplay", "text"); - InitCommand=function(self) - local s = THEME:GetMetric(Var "LoadingScreen","HelpText"); - self:SetTipsColonSeparated(s); - end; - SetHelpTextCommand=function(self, params) - self:SetTipsColonSeparated( params.Text ); - end; +return Def.HelpDisplay { + File = THEME:GetPathF("HelpDisplay", "text"); + InitCommand=function(self) + local s = THEME:GetMetric(Var "LoadingScreen","HelpText"); + self:SetTipsColonSeparated(s); + end; + SetHelpTextCommand=function(self, params) + self:SetTipsColonSeparated( params.Text ); + end; }; \ No newline at end of file diff --git a/Themes/_portKit-sm4/Graphics/_frame 1d.lua b/Themes/_portKit-sm4/Graphics/_frame 1d.lua index 8cfcee91cd..ffd95ec281 100644 --- a/Themes/_portKit-sm4/Graphics/_frame 1d.lua +++ b/Themes/_portKit-sm4/Graphics/_frame 1d.lua @@ -1,167 +1,167 @@ --- --- Load a resizable 1-d frame. p contains an odd number of parts. --- Even parts are resized; odd parts are not (unless the requested --- width is too small). The frame is centered on the midway part --- of p; parts to the left and right are anchored on the inside. --- --- A 3-part frame; the center third is dynamic, expanding outwards --- in both directions: --- p = { 1/3, 1/3, 1/3 }; --- --oo-- --- --oooooooooo-- --- --- A 2-part frame. The left half is static, the right side dynamic; --- the left part stays in place as the right half expands to the right, --- with the frame centered on the boundary: --- <<-- --- <<----------- --- p = { 1/2, 0, 0, 1/2, 0 }; --- --- A 5-part frame, with an anchored center and static caps on each --- end, expanding outwards: --- <<--oo-->> --- <<----------oo---------->> --- p = { 1/5, 1/5, 1/10, 0, 1/10, 1/5, 1/5 }; --- - -local p, a = ... -assert( (#p%2) == 1 ); - -local t = Def.ActorFrame { -}; -local Widths = { } - -local TextureXPos = 0 -for i = 1,#p do - t[i] = a .. { - Name = tostring(i); - InitCommand = function(self) - if i < math.ceil(#p/2) then self:horizalign("HorizAlign_Right"); - elseif i == math.ceil(#p/2) then self:horizalign("HorizAlign_Center"); - else self:horizalign("HorizAlign_Left"); - end - - Widths[i] = self:GetWidth(); - end; - - SetPartSizeCommand = function(self, params) - self:x( params.XPos[i] ); - self:zoomtowidth( params.Zooms[i] ); - end; - }; - - local Width = p[i]; - t[i].Frames = - { - { -- state 0 - { x=TextureXPos, y=0 }, -- top-left - { x=(TextureXPos+Width), y=1 } -- bottom-right - } - }; - - TextureXPos = TextureXPos + Width; -end - -t.InitCommand = function(self, params) - local Child = self:GetChild("1"); - local Height = Child:GetHeight(); - self:SetHeight(Height); -end - -t.SetPartSizeCommand = function(self, params) - self:zoomx( params.FrameZoom ); -end - -t.SetSizeCommand = function(self, params) - local Width = params.Width; - assert( Width ); - - self:SetWidth( Width ); - - if params.tween then - params.tween(self); - self:RunCommandsOnChildren( params.tween ); - end; - - local UnscaledPartWidth = 0; - local ScaledPartWidth = 0; - for i = 1,#p do - if(i%2)==0 then - ScaledPartWidth = ScaledPartWidth + Widths[i]; - else - UnscaledPartWidth = UnscaledPartWidth + Widths[i]; - end - end - - local WidthToScale = Width - UnscaledPartWidth; - local CurrentScaledPartWidth = math.max( WidthToScale, 0 ); - - params.Zooms = {}; - params.XPos = {}; - local pos = 0; - for i = math.ceil(#p/2),1,-1 do - local ThisScaledPartWidth = Widths[i]; - if (i % 2) == 0 then - ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); - end - - params.XPos[i] = pos; - - if i == math.ceil(#p/2) then - pos = pos - ThisScaledPartWidth/2; - else - pos = pos - ThisScaledPartWidth; - end - - params.Zooms[i] = ThisScaledPartWidth; - end - pos = 0; - for i = math.ceil(#p/2),#p do - local ThisScaledPartWidth = Widths[i]; - if (i % 2) == 0 then - ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); - end - - params.XPos[i] = pos; - - if i == math.ceil(#p/2) then - pos = pos + ThisScaledPartWidth/2; - else - pos = pos + ThisScaledPartWidth; - end - - params.Zooms[i] = ThisScaledPartWidth; - end - - params.FrameZoom = math.min(Width / UnscaledPartWidth, 1); - - self:playcommand("SetPartSize", params); -end - -return t; - --- --- (c) 2007 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. --- - +-- +-- Load a resizable 1-d frame. p contains an odd number of parts. +-- Even parts are resized; odd parts are not (unless the requested +-- width is too small). The frame is centered on the midway part +-- of p; parts to the left and right are anchored on the inside. +-- +-- A 3-part frame; the center third is dynamic, expanding outwards +-- in both directions: +-- p = { 1/3, 1/3, 1/3 }; +-- --oo-- +-- --oooooooooo-- +-- +-- A 2-part frame. The left half is static, the right side dynamic; +-- the left part stays in place as the right half expands to the right, +-- with the frame centered on the boundary: +-- <<-- +-- <<----------- +-- p = { 1/2, 0, 0, 1/2, 0 }; +-- +-- A 5-part frame, with an anchored center and static caps on each +-- end, expanding outwards: +-- <<--oo-->> +-- <<----------oo---------->> +-- p = { 1/5, 1/5, 1/10, 0, 1/10, 1/5, 1/5 }; +-- + +local p, a = ... +assert( (#p%2) == 1 ); + +local t = Def.ActorFrame { +}; +local Widths = { } + +local TextureXPos = 0 +for i = 1,#p do + t[i] = a .. { + Name = tostring(i); + InitCommand = function(self) + if i < math.ceil(#p/2) then self:horizalign("HorizAlign_Right"); + elseif i == math.ceil(#p/2) then self:horizalign("HorizAlign_Center"); + else self:horizalign("HorizAlign_Left"); + end + + Widths[i] = self:GetWidth(); + end; + + SetPartSizeCommand = function(self, params) + self:x( params.XPos[i] ); + self:zoomtowidth( params.Zooms[i] ); + end; + }; + + local Width = p[i]; + t[i].Frames = + { + { -- state 0 + { x=TextureXPos, y=0 }, -- top-left + { x=(TextureXPos+Width), y=1 } -- bottom-right + } + }; + + TextureXPos = TextureXPos + Width; +end + +t.InitCommand = function(self, params) + local Child = self:GetChild("1"); + local Height = Child:GetHeight(); + self:SetHeight(Height); +end + +t.SetPartSizeCommand = function(self, params) + self:zoomx( params.FrameZoom ); +end + +t.SetSizeCommand = function(self, params) + local Width = params.Width; + assert( Width ); + + self:SetWidth( Width ); + + if params.tween then + params.tween(self); + self:RunCommandsOnChildren( params.tween ); + end; + + local UnscaledPartWidth = 0; + local ScaledPartWidth = 0; + for i = 1,#p do + if(i%2)==0 then + ScaledPartWidth = ScaledPartWidth + Widths[i]; + else + UnscaledPartWidth = UnscaledPartWidth + Widths[i]; + end + end + + local WidthToScale = Width - UnscaledPartWidth; + local CurrentScaledPartWidth = math.max( WidthToScale, 0 ); + + params.Zooms = {}; + params.XPos = {}; + local pos = 0; + for i = math.ceil(#p/2),1,-1 do + local ThisScaledPartWidth = Widths[i]; + if (i % 2) == 0 then + ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); + end + + params.XPos[i] = pos; + + if i == math.ceil(#p/2) then + pos = pos - ThisScaledPartWidth/2; + else + pos = pos - ThisScaledPartWidth; + end + + params.Zooms[i] = ThisScaledPartWidth; + end + pos = 0; + for i = math.ceil(#p/2),#p do + local ThisScaledPartWidth = Widths[i]; + if (i % 2) == 0 then + ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); + end + + params.XPos[i] = pos; + + if i == math.ceil(#p/2) then + pos = pos + ThisScaledPartWidth/2; + else + pos = pos + ThisScaledPartWidth; + end + + params.Zooms[i] = ThisScaledPartWidth; + end + + params.FrameZoom = math.min(Width / UnscaledPartWidth, 1); + + self:playcommand("SetPartSize", params); +end + +return t; + +-- +-- (c) 2007 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. +-- + diff --git a/Themes/_portKit-sm4/Scripts/00 alias.lua b/Themes/_portKit-sm4/Scripts/00 alias.lua index 246e469d68..9185b7c787 100644 --- a/Themes/_portKit-sm4/Scripts/00 alias.lua +++ b/Themes/_portKit-sm4/Scripts/00 alias.lua @@ -1,3 +1,3 @@ --- sm-ssc _fallback to StepMania 4 default compatibility layer. -if not ScreenString then ScreenString = Screen.String; end; +-- sm-ssc _fallback to StepMania 4 default compatibility layer. +if not ScreenString then ScreenString = Screen.String; end; if not ScreenMetric then ScreenMetric = Screen.Metric; end; \ No newline at end of file diff --git a/Themes/_portKit-sm4/Scripts/Branches.lua b/Themes/_portKit-sm4/Scripts/Branches.lua index d3ac1a6a2d..5a6ce46b2d 100644 --- a/Themes/_portKit-sm4/Scripts/Branches.lua +++ b/Themes/_portKit-sm4/Scripts/Branches.lua @@ -1,286 +1,286 @@ -function ScreenTitleBranch() - -- Don't show the title menu (says "Press Start") if there are 0 credits - -- inserted and CoinMode is pay. - if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then - return THEME:GetMetric( "Common", "InitialScreen" ) - end - - if GAMESTATE:GetCoinMode() == "CoinMode_Home" then return "ScreenTitleMenu" end - return "ScreenTitleJoin" -end - -function ScreenCautionBranch() - if PREFSMAN:GetPreference("ShowCaution") then return "ScreenCaution" end - return "ScreenSelectStyle" -end - -function ScreenSelectGroupBranch() - if PREFSMAN:GetPreference("ShowSelectGroup") then return "ScreenSelectGroup" end - return GetScreenInstructions() -end - -function SongSelectionScreen() - local pm = GAMESTATE:GetPlayMode() - - if pm ~= "PlayMode_Regular" and IsNetConnected() then - SCREENMAN:SystemMessage( THEME:GetString("NetworkSyncManager","Not Supported") ) - return "ScreenSelectDifficulty" - end - - if pm == "PlayMode_Nonstop" then return "ScreenSelectCourseNonstop" end - if pm == "PlayMode_Oni" then return "ScreenSelectCourseOni" end - if pm == "PlayMode_Endless" then return "ScreenSelectCourseEndless" end - if IsNetConnected() then ReportStyle() end - if IsNetSMOnline() then return SMOnlineScreen() end - if IsNetConnected() then return "ScreenNetSelectMusic" end - return "ScreenSelectMusic" -end - -function ScreenSelectMusicBranch() - if IsNetConnected() then ReportStyle() end - if IsNetSMOnline() then return SMOnlineScreen() end - if IsNetConnected() then return "ScreenNetSelectMusic" end - return "ScreenSelectMusic" -end - -function NextNetworkScreen() - if IsNetConnected() then return "ScreenCaution" end - return "ScreenTitleMenu" -end - -function SMOnlineScreen() - if not IsSMOnlineLoggedIn(PLAYER_1) and GAMESTATE:IsPlayerEnabled(PLAYER_1) then return "ScreenSMOnlineLogin" end - if not IsSMOnlineLoggedIn(PLAYER_2) and GAMESTATE:IsPlayerEnabled(PLAYER_2) then return "ScreenSMOnlineLogin" end - return "ScreenNetRoom" -end - -function GetSelectMusicNext() - if SCREENMAN:GetTopScreen():GetGoToOptions() then - return SelectFirstOptionsScreen() - else - return "ScreenStage" - end -end - -function SelectFirstOptionsScreen() - if GAMESTATE:GetPlayMode() == "PlayMode_Rave" then return "ScreenRaveOptions" end - return "ScreenPlayerOptions" -end - -function ScreenPlayerOptionsNext() - if SCREENMAN:GetTopScreen():GetGoToOptions() then - return "ScreenSongOptions" - else - return "ScreenStage" - end -end - -function GetGameplayScreen() - local st = GAMESTATE:GetCurrentStyle():GetStyleType() - if st == "StyleType_TwoPlayersSharedSides" then return "ScreenGameplayShared" end - return "ScreenGameplay" -end - -function SelectEvaluationScreen() - if IsNetConnected() then return "ScreenNetEvaluation" end - local pm = GAMESTATE:GetPlayMode() - if( GAMESTATE:GetMultiplayer() ) then return "ScreenEvaluationMultiplayer" end - if( pm == "PlayMode_Regular" ) then return "ScreenEvaluationStage" end - if( pm == "PlayMode_Nonstop" ) then return "ScreenEvaluationNonstop" end - if( pm == "PlayMode_Oni" ) then return "ScreenEvaluationOni" end - if( pm == "PlayMode_Endless" ) then return "ScreenEvaluationEndless" end - if( pm == "PlayMode_Rave" ) then return "ScreenEvaluationRave" end - if( pm == "PlayMode_Battle" ) then return "ScreenEvaluationBattle" end -end - -function GetTopScreenMetric( sElement ) - local sClass = SCREENMAN:GetTopScreen():GetName(); - return THEME:GetMetric( sClass, sElement ) -end - -local function GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen ) - Trace( "GetEvaluationNextScreen: " .. sNextScreen .. ", " .. sFailedScreen .. ", " .. sEndScreen ) - - if GAMESTATE:IsEventMode() then - Trace( "IsEventMode" ) - return sNextScreen - end - - local bIsExtraStage = GAMESTATE:IsAnExtraStage() - -- Not in event mode. If failed, go to the game over screen. - if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then - Trace( "Failed" ) - return sFailedScreen - end - - local sIsStage = not GetTopScreenMetric( "Summary" ) and not GAMESTATE:IsCourseMode() - if sIsStage then - local bLastStage = GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() <= 0 - if not bLastStage then - Trace( "Another" ) - return sNextScreen - end - end - - Trace( "End" ) - return sEndScreen -end - -function GetEvaluationSummaryNextScreen() - return GetEvaluationNextScreenInternal( "ScreenNameEntry", "ScreenProfileSave", "ScreenNameEntry" ); -end - -function GetEvaluationNextScreen() - if IsEventMode() then - return "ScreenProfileSave"; - end - local sFailedScreen; - local sEndScreen; - local pm = GAMESTATE:GetPlayMode(); - if pm == "PlayMode_Regular" or - pm == "PlayMode_Rave" then - sFailedScreen = "ScreenProfileSave"; - sEndScreen = "ScreenEvaluationSummary"; - elseif pm == "PlayMode_Nonstop" or - pm == "PlayMode_Oni" or - pm == "PlayMode_Endless" then - sFailedScreen = "ScreenNameEntry"; - sEndScreen = "ScreenNameEntry"; - else - assert(false); - end - - local sNextScreen; - if IsNetSMOnline() then sNextScreen = "ScreenNetRoom" - elseif( IsNetConnected() ) then sNextScreen = "ScreenNetSelectMusic" - else sNextScreen = SongSelectionScreen(); end - - return GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen ); -end - -function ScreenBranchNetAfterEval() - if IsNetSMOnline() then return "ScreenSMOnlineSelectMusic" end - if IsNetConnected() then return "ScreenNetSelectMusic" end - return "ScreenSelectMusic" -end - -function SelectEndingScreen() - local bIsExtraStage = GAMESTATE:IsAnExtraStage() - if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then - return "ScreenGameOver" - end - - local grade = STATSMAN:GetBestFinalGrade() - if Grade:Compare( grade, "Grade_Tier03" ) >= 0 then return "ScreenEnding3" end - if Grade:Compare( grade, "Grade_Tier05" ) >= 0 then return "ScreenEnding2" end - return "ScreenEnding1" -end - -function ScreenProfileSaveNextScreen() - if IsEventMode() then - return SongSelectionScreen(); - end - return SelectEndingScreen(); -end - -function IsEventMode() - return PREFSMAN:GetPreference( "EventMode" ) -end - --- For "EvalOnFail", do: --- function GetGameplayNextScreen() return SelectEvaluationScreen() end - -function GetGameplayNextScreen() - Trace( "GetGameplayNextScreen: " ) - local Passed = not STATSMAN:GetCurStageStats():AllFailed() - Trace( " Passed = "..tostring(Passed) ) - Trace( " IsCourseMode = "..tostring(GAMESTATE:IsCourseMode()) ) - Trace( " IsExtraStage = "..tostring(GAMESTATE:IsExtraStage()) ) - Trace( " IsExtraStage2 = "..tostring(GAMESTATE:IsExtraStage2()) ) - Trace( " Event mode = "..tostring(IsEventMode()) ) - - return SelectEvaluationScreen() --- if Passed or GAMESTATE:IsCourseMode() or --- GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() --- then --- Trace( "Go to evaluation screen" ) --- return SelectEvaluationScreen() --- end --- --- if IsEventMode() then --- Trace( "Go to song selection screen" ) --- -- DeletePreparedScreens() --- return SongSelectionScreen() --- end --- --- Trace( "ScreenGameOver" ) --- return "ScreenGameOver" -end - -local function ShowScreenInstructions() - if not PREFSMAN:GetPreference("ShowInstructions") then - return false - end - - if not GAMESTATE:GetPlayMode() then - Trace( "ShowScreenInstructions: called without PlayMode set" ) - return true - end - - if GAMESTATE:GetPlayMode() ~= "PlayMode_Regular" then - return true - end - - for pn in ivalues(PlayerNumber) do - if Difficulty:Compare( GAMESTATE:GetPreferredDifficulty(pn), "Difficulty_Easy" ) <= 0 then - return true - end - end - - return false -end - -function GetScreenInstructions() - if not ShowScreenInstructions() then - return THEME:GetMetric("ScreenInstructions","NextScreen") - else - return "ScreenInstructions" - end -end - -function OptionsMenuAvailable() - if GAMESTATE:IsAnExtraStage() then return false end - if GAMESTATE:GetPlayMode() == "PlayMode_Oni" then return false end - return true -end - -function ModeMenuAvailable() - if GAMESTATE:IsAnExtraStage() then - return false - end - return true -end - --- (c) 2005 Glenn Maynard, Chris Danford --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +function ScreenTitleBranch() + -- Don't show the title menu (says "Press Start") if there are 0 credits + -- inserted and CoinMode is pay. + if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then + return THEME:GetMetric( "Common", "InitialScreen" ) + end + + if GAMESTATE:GetCoinMode() == "CoinMode_Home" then return "ScreenTitleMenu" end + return "ScreenTitleJoin" +end + +function ScreenCautionBranch() + if PREFSMAN:GetPreference("ShowCaution") then return "ScreenCaution" end + return "ScreenSelectStyle" +end + +function ScreenSelectGroupBranch() + if PREFSMAN:GetPreference("ShowSelectGroup") then return "ScreenSelectGroup" end + return GetScreenInstructions() +end + +function SongSelectionScreen() + local pm = GAMESTATE:GetPlayMode() + + if pm ~= "PlayMode_Regular" and IsNetConnected() then + SCREENMAN:SystemMessage( THEME:GetString("NetworkSyncManager","Not Supported") ) + return "ScreenSelectDifficulty" + end + + if pm == "PlayMode_Nonstop" then return "ScreenSelectCourseNonstop" end + if pm == "PlayMode_Oni" then return "ScreenSelectCourseOni" end + if pm == "PlayMode_Endless" then return "ScreenSelectCourseEndless" end + if IsNetConnected() then ReportStyle() end + if IsNetSMOnline() then return SMOnlineScreen() end + if IsNetConnected() then return "ScreenNetSelectMusic" end + return "ScreenSelectMusic" +end + +function ScreenSelectMusicBranch() + if IsNetConnected() then ReportStyle() end + if IsNetSMOnline() then return SMOnlineScreen() end + if IsNetConnected() then return "ScreenNetSelectMusic" end + return "ScreenSelectMusic" +end + +function NextNetworkScreen() + if IsNetConnected() then return "ScreenCaution" end + return "ScreenTitleMenu" +end + +function SMOnlineScreen() + if not IsSMOnlineLoggedIn(PLAYER_1) and GAMESTATE:IsPlayerEnabled(PLAYER_1) then return "ScreenSMOnlineLogin" end + if not IsSMOnlineLoggedIn(PLAYER_2) and GAMESTATE:IsPlayerEnabled(PLAYER_2) then return "ScreenSMOnlineLogin" end + return "ScreenNetRoom" +end + +function GetSelectMusicNext() + if SCREENMAN:GetTopScreen():GetGoToOptions() then + return SelectFirstOptionsScreen() + else + return "ScreenStage" + end +end + +function SelectFirstOptionsScreen() + if GAMESTATE:GetPlayMode() == "PlayMode_Rave" then return "ScreenRaveOptions" end + return "ScreenPlayerOptions" +end + +function ScreenPlayerOptionsNext() + if SCREENMAN:GetTopScreen():GetGoToOptions() then + return "ScreenSongOptions" + else + return "ScreenStage" + end +end + +function GetGameplayScreen() + local st = GAMESTATE:GetCurrentStyle():GetStyleType() + if st == "StyleType_TwoPlayersSharedSides" then return "ScreenGameplayShared" end + return "ScreenGameplay" +end + +function SelectEvaluationScreen() + if IsNetConnected() then return "ScreenNetEvaluation" end + local pm = GAMESTATE:GetPlayMode() + if( GAMESTATE:GetMultiplayer() ) then return "ScreenEvaluationMultiplayer" end + if( pm == "PlayMode_Regular" ) then return "ScreenEvaluationStage" end + if( pm == "PlayMode_Nonstop" ) then return "ScreenEvaluationNonstop" end + if( pm == "PlayMode_Oni" ) then return "ScreenEvaluationOni" end + if( pm == "PlayMode_Endless" ) then return "ScreenEvaluationEndless" end + if( pm == "PlayMode_Rave" ) then return "ScreenEvaluationRave" end + if( pm == "PlayMode_Battle" ) then return "ScreenEvaluationBattle" end +end + +function GetTopScreenMetric( sElement ) + local sClass = SCREENMAN:GetTopScreen():GetName(); + return THEME:GetMetric( sClass, sElement ) +end + +local function GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen ) + Trace( "GetEvaluationNextScreen: " .. sNextScreen .. ", " .. sFailedScreen .. ", " .. sEndScreen ) + + if GAMESTATE:IsEventMode() then + Trace( "IsEventMode" ) + return sNextScreen + end + + local bIsExtraStage = GAMESTATE:IsAnExtraStage() + -- Not in event mode. If failed, go to the game over screen. + if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then + Trace( "Failed" ) + return sFailedScreen + end + + local sIsStage = not GetTopScreenMetric( "Summary" ) and not GAMESTATE:IsCourseMode() + if sIsStage then + local bLastStage = GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() <= 0 + if not bLastStage then + Trace( "Another" ) + return sNextScreen + end + end + + Trace( "End" ) + return sEndScreen +end + +function GetEvaluationSummaryNextScreen() + return GetEvaluationNextScreenInternal( "ScreenNameEntry", "ScreenProfileSave", "ScreenNameEntry" ); +end + +function GetEvaluationNextScreen() + if IsEventMode() then + return "ScreenProfileSave"; + end + local sFailedScreen; + local sEndScreen; + local pm = GAMESTATE:GetPlayMode(); + if pm == "PlayMode_Regular" or + pm == "PlayMode_Rave" then + sFailedScreen = "ScreenProfileSave"; + sEndScreen = "ScreenEvaluationSummary"; + elseif pm == "PlayMode_Nonstop" or + pm == "PlayMode_Oni" or + pm == "PlayMode_Endless" then + sFailedScreen = "ScreenNameEntry"; + sEndScreen = "ScreenNameEntry"; + else + assert(false); + end + + local sNextScreen; + if IsNetSMOnline() then sNextScreen = "ScreenNetRoom" + elseif( IsNetConnected() ) then sNextScreen = "ScreenNetSelectMusic" + else sNextScreen = SongSelectionScreen(); end + + return GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen ); +end + +function ScreenBranchNetAfterEval() + if IsNetSMOnline() then return "ScreenSMOnlineSelectMusic" end + if IsNetConnected() then return "ScreenNetSelectMusic" end + return "ScreenSelectMusic" +end + +function SelectEndingScreen() + local bIsExtraStage = GAMESTATE:IsAnExtraStage() + if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then + return "ScreenGameOver" + end + + local grade = STATSMAN:GetBestFinalGrade() + if Grade:Compare( grade, "Grade_Tier03" ) >= 0 then return "ScreenEnding3" end + if Grade:Compare( grade, "Grade_Tier05" ) >= 0 then return "ScreenEnding2" end + return "ScreenEnding1" +end + +function ScreenProfileSaveNextScreen() + if IsEventMode() then + return SongSelectionScreen(); + end + return SelectEndingScreen(); +end + +function IsEventMode() + return PREFSMAN:GetPreference( "EventMode" ) +end + +-- For "EvalOnFail", do: +-- function GetGameplayNextScreen() return SelectEvaluationScreen() end + +function GetGameplayNextScreen() + Trace( "GetGameplayNextScreen: " ) + local Passed = not STATSMAN:GetCurStageStats():AllFailed() + Trace( " Passed = "..tostring(Passed) ) + Trace( " IsCourseMode = "..tostring(GAMESTATE:IsCourseMode()) ) + Trace( " IsExtraStage = "..tostring(GAMESTATE:IsExtraStage()) ) + Trace( " IsExtraStage2 = "..tostring(GAMESTATE:IsExtraStage2()) ) + Trace( " Event mode = "..tostring(IsEventMode()) ) + + return SelectEvaluationScreen() +-- if Passed or GAMESTATE:IsCourseMode() or +-- GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() +-- then +-- Trace( "Go to evaluation screen" ) +-- return SelectEvaluationScreen() +-- end +-- +-- if IsEventMode() then +-- Trace( "Go to song selection screen" ) +-- -- DeletePreparedScreens() +-- return SongSelectionScreen() +-- end +-- +-- Trace( "ScreenGameOver" ) +-- return "ScreenGameOver" +end + +local function ShowScreenInstructions() + if not PREFSMAN:GetPreference("ShowInstructions") then + return false + end + + if not GAMESTATE:GetPlayMode() then + Trace( "ShowScreenInstructions: called without PlayMode set" ) + return true + end + + if GAMESTATE:GetPlayMode() ~= "PlayMode_Regular" then + return true + end + + for pn in ivalues(PlayerNumber) do + if Difficulty:Compare( GAMESTATE:GetPreferredDifficulty(pn), "Difficulty_Easy" ) <= 0 then + return true + end + end + + return false +end + +function GetScreenInstructions() + if not ShowScreenInstructions() then + return THEME:GetMetric("ScreenInstructions","NextScreen") + else + return "ScreenInstructions" + end +end + +function OptionsMenuAvailable() + if GAMESTATE:IsAnExtraStage() then return false end + if GAMESTATE:GetPlayMode() == "PlayMode_Oni" then return false end + return true +end + +function ModeMenuAvailable() + if GAMESTATE:IsAnExtraStage() then + return false + end + return true +end + +-- (c) 2005 Glenn Maynard, Chris Danford +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/_portKit-sm4/Sounds/Common cancel.redir b/Themes/_portKit-sm4/Sounds/Common cancel.redir index df63471ad3..c0b13cc769 100644 --- a/Themes/_portKit-sm4/Sounds/Common cancel.redir +++ b/Themes/_portKit-sm4/Sounds/Common cancel.redir @@ -1 +1 @@ -_cancel +_cancel diff --git a/Themes/_portKit-sm4/Sounds/Common coin.redir b/Themes/_portKit-sm4/Sounds/Common coin.redir index f58047e7fc..76ff6c6306 100644 --- a/Themes/_portKit-sm4/Sounds/Common coin.redir +++ b/Themes/_portKit-sm4/Sounds/Common coin.redir @@ -1 +1 @@ -Common start +Common start diff --git a/Themes/_portKit-sm4/Sounds/EditCoursesMenu row.redir b/Themes/_portKit-sm4/Sounds/EditCoursesMenu row.redir index b5d88c85aa..2d211773e6 100644 --- a/Themes/_portKit-sm4/Sounds/EditCoursesMenu row.redir +++ b/Themes/_portKit-sm4/Sounds/EditCoursesMenu row.redir @@ -1 +1 @@ -EditMenu row +EditMenu row diff --git a/Themes/_portKit-sm4/Sounds/EditCoursesMenu save.redir b/Themes/_portKit-sm4/Sounds/EditCoursesMenu save.redir index 883ab5beee..affd522e70 100644 --- a/Themes/_portKit-sm4/Sounds/EditCoursesMenu save.redir +++ b/Themes/_portKit-sm4/Sounds/EditCoursesMenu save.redir @@ -1 +1 @@ -ScreenEdit save +ScreenEdit save diff --git a/Themes/_portKit-sm4/Sounds/EditCoursesMenu value.redir b/Themes/_portKit-sm4/Sounds/EditCoursesMenu value.redir index aad02a7a48..30ee5f98ef 100644 --- a/Themes/_portKit-sm4/Sounds/EditCoursesMenu value.redir +++ b/Themes/_portKit-sm4/Sounds/EditCoursesMenu value.redir @@ -1 +1 @@ -EditMenu value +EditMenu value diff --git a/Themes/_portKit-sm4/Sounds/EditMenu row.redir b/Themes/_portKit-sm4/Sounds/EditMenu row.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/EditMenu row.redir +++ b/Themes/_portKit-sm4/Sounds/EditMenu row.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/EditMenu value.redir b/Themes/_portKit-sm4/Sounds/EditMenu value.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/EditMenu value.redir +++ b/Themes/_portKit-sm4/Sounds/EditMenu value.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/JukeboxMenu row.redir b/Themes/_portKit-sm4/Sounds/JukeboxMenu row.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/JukeboxMenu row.redir +++ b/Themes/_portKit-sm4/Sounds/JukeboxMenu row.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/JukeboxMenu value.redir b/Themes/_portKit-sm4/Sounds/JukeboxMenu value.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/JukeboxMenu value.redir +++ b/Themes/_portKit-sm4/Sounds/JukeboxMenu value.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/MusicWheel expand.redir b/Themes/_portKit-sm4/Sounds/MusicWheel expand.redir index 65a3cf43f6..a46b83d1ef 100644 --- a/Themes/_portKit-sm4/Sounds/MusicWheel expand.redir +++ b/Themes/_portKit-sm4/Sounds/MusicWheel expand.redir @@ -1 +1 @@ -_prompt +_prompt diff --git a/Themes/_portKit-sm4/Sounds/Player course attack ending.redir b/Themes/_portKit-sm4/Sounds/Player course attack ending.redir index 2cf152cd10..10d5d3c9ec 100644 --- a/Themes/_portKit-sm4/Sounds/Player course attack ending.redir +++ b/Themes/_portKit-sm4/Sounds/Player course attack ending.redir @@ -1 +1 @@ -Player battle attack ending +Player battle attack ending diff --git a/Themes/_portKit-sm4/Sounds/Player course attack launch.redir b/Themes/_portKit-sm4/Sounds/Player course attack launch.redir index 3a391f46d8..48a7a3215b 100644 --- a/Themes/_portKit-sm4/Sounds/Player course attack launch.redir +++ b/Themes/_portKit-sm4/Sounds/Player course attack launch.redir @@ -1 +1 @@ -Player battle attack launch +Player battle attack launch diff --git a/Themes/_portKit-sm4/Sounds/ScreenCaution change.redir b/Themes/_portKit-sm4/Sounds/ScreenCaution change.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenCaution change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenCaution change.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenCaution start.redir b/Themes/_portKit-sm4/Sounds/ScreenCaution start.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenCaution start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenCaution start.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit AddNote.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit AddNote.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit AddNote.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit AddNote.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit RemoveNote.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit RemoveNote.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit RemoveNote.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit RemoveNote.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit line.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit line.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit line.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit line.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit music.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit switch steps.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit switch steps.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit switch steps.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit switch steps.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit value decrease.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit value decrease.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit value decrease.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit value decrease.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_portKit-sm4/Sounds/ScreenEdit value increase.redir b/Themes/_portKit-sm4/Sounds/ScreenEdit value increase.redir index fd4a9c9c68..ea37451d46 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEdit value increase.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEdit value increase.redir @@ -1 +1 @@ -_switch up +_switch up diff --git a/Themes/_portKit-sm4/Sounds/ScreenEditCourseSubmenu difficulty changed.redir b/Themes/_portKit-sm4/Sounds/ScreenEditCourseSubmenu difficulty changed.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEditCourseSubmenu difficulty changed.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEditCourseSubmenu difficulty changed.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_portKit-sm4/Sounds/ScreenEvaluation failed.redir b/Themes/_portKit-sm4/Sounds/ScreenEvaluation failed.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEvaluation failed.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEvaluation failed.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEvaluation start.redir b/Themes/_portKit-sm4/Sounds/ScreenEvaluation start.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEvaluation start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEvaluation start.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenEvaluation try extra2.redir b/Themes/_portKit-sm4/Sounds/ScreenEvaluation try extra2.redir index f2741a9f2d..812761475b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenEvaluation try extra2.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenEvaluation try extra2.redir @@ -1 +1 @@ -ScreenEvaluation try extra1 +ScreenEvaluation try extra1 diff --git a/Themes/_portKit-sm4/Sounds/ScreenGameOver music.redir b/Themes/_portKit-sm4/Sounds/ScreenGameOver music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenGameOver music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenGameOver music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenInstructions music.redir b/Themes/_portKit-sm4/Sounds/ScreenInstructions music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenInstructions music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenInstructions music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenJukeboxMenu music.redir b/Themes/_portKit-sm4/Sounds/ScreenJukeboxMenu music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenJukeboxMenu music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenJukeboxMenu music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenMapControllers change.redir b/Themes/_portKit-sm4/Sounds/ScreenMapControllers change.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMapControllers change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMapControllers change.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenMapControllers delete.redir b/Themes/_portKit-sm4/Sounds/ScreenMapControllers delete.redir index 8561d7b853..6f735d4f15 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMapControllers delete.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMapControllers delete.redir @@ -1 +1 @@ -MusicWheel expand +MusicWheel expand diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu change.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu change.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu change.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu music.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu next.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu next.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu next.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu next.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu prev.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu prev.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu prev.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu prev.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu row.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu row.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu row.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu row.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu value.redir b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu value.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenMiniMenu value.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenMiniMenu value.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenNameEntry step.redir b/Themes/_portKit-sm4/Sounds/ScreenNameEntry step.redir index f58047e7fc..76ff6c6306 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenNameEntry step.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenNameEntry step.redir @@ -1 +1 @@ -Common start +Common start diff --git a/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change opt.redir b/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change opt.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change opt.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change opt.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change sel.redir b/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change sel.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change sel.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenNetSelectMusic change sel.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenOptions change.redir b/Themes/_portKit-sm4/Sounds/ScreenOptions change.redir index ffd6f837e3..5bb896bf54 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenOptions change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenOptions change.redir @@ -1 +1 @@ -_common value +_common value diff --git a/Themes/_portKit-sm4/Sounds/ScreenOptions next.redir b/Themes/_portKit-sm4/Sounds/ScreenOptions next.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenOptions next.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenOptions next.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenOptions prev.redir b/Themes/_portKit-sm4/Sounds/ScreenOptions prev.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenOptions prev.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenOptions prev.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenOptions toggle off.redir b/Themes/_portKit-sm4/Sounds/ScreenOptions toggle off.redir index 8561d7b853..6f735d4f15 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenOptions toggle off.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenOptions toggle off.redir @@ -1 +1 @@ -MusicWheel expand +MusicWheel expand diff --git a/Themes/_portKit-sm4/Sounds/ScreenPrompt change.redir b/Themes/_portKit-sm4/Sounds/ScreenPrompt change.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenPrompt change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenPrompt change.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectCharacter music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectCharacter music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectCharacter music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectCharacter music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic course music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic course music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic course music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic course music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty easier.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty easier.redir index fd4a9c9c68..ea37451d46 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty easier.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty easier.redir @@ -1 +1 @@ -_switch up +_switch up diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty harder.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty harder.redir index 76983e4f38..79774d5c65 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty harder.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic difficulty harder.redir @@ -1 +1 @@ -_switch down +_switch down diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic locked.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic locked.redir index 57b74b0d09..f54033f244 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic locked.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic locked.redir @@ -1 +1 @@ -MusicWheel locked +MusicWheel locked diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic loop music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic loop music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic loop music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic loop music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic options.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic options.redir index 883ab5beee..affd522e70 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic options.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic options.redir @@ -1 +1 @@ -ScreenEdit save +ScreenEdit save diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic random music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic random music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic random music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic random music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic roulette music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic roulette music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic roulette music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic roulette music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic start.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic start.redir index 14b06ba956..38275831fb 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectMusic start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectMusic start.redir @@ -1 +1 @@ -common start +common start diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode change.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode change.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode change.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode start.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode start.redir index f58047e7fc..76ff6c6306 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectPlayMode start.redir @@ -1 +1 @@ -Common start +Common start diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle change.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle change.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle change.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle music.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle music.redir index 0f057e9297..0bff0de1a5 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle music.redir @@ -1 +1 @@ -_common menu music +_common menu music diff --git a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle start.redir b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle start.redir index f58047e7fc..76ff6c6306 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenSelectStyle start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenSelectStyle start.redir @@ -1 +1 @@ -Common start +Common start diff --git a/Themes/_portKit-sm4/Sounds/ScreenTextEntry backspace.redir b/Themes/_portKit-sm4/Sounds/ScreenTextEntry backspace.redir index 2f5aa07dfe..dfad7a9665 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenTextEntry backspace.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenTextEntry backspace.redir @@ -1 +1 @@ -LifeMeterBattery lose +LifeMeterBattery lose diff --git a/Themes/_portKit-sm4/Sounds/ScreenTextEntry change.redir b/Themes/_portKit-sm4/Sounds/ScreenTextEntry change.redir index b5d88c85aa..2d211773e6 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenTextEntry change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenTextEntry change.redir @@ -1 +1 @@ -EditMenu row +EditMenu row diff --git a/Themes/_portKit-sm4/Sounds/ScreenTextEntry type.redir b/Themes/_portKit-sm4/Sounds/ScreenTextEntry type.redir index 0806dc0cef..32b8c0f336 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenTextEntry type.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenTextEntry type.redir @@ -1 +1 @@ -LifeMeterBattery gain +LifeMeterBattery gain diff --git a/Themes/_portKit-sm4/Sounds/ScreenTitleMenu change.redir b/Themes/_portKit-sm4/Sounds/ScreenTitleMenu change.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenTitleMenu change.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenTitleMenu change.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/ScreenTitleMenu start.redir b/Themes/_portKit-sm4/Sounds/ScreenTitleMenu start.redir index f58047e7fc..76ff6c6306 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenTitleMenu start.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenTitleMenu start.redir @@ -1 +1 @@ -Common start +Common start diff --git a/Themes/_portKit-sm4/Sounds/ScreenUnlock music.redir b/Themes/_portKit-sm4/Sounds/ScreenUnlock music.redir index a3fa317573..e8a638a791 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenUnlock music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenUnlock music.redir @@ -1 +1 @@ -_silent +_silent diff --git a/Themes/_portKit-sm4/Sounds/ScreenWithMenuElements music.redir b/Themes/_portKit-sm4/Sounds/ScreenWithMenuElements music.redir index dcd6b93e4d..6b155b5b19 100644 --- a/Themes/_portKit-sm4/Sounds/ScreenWithMenuElements music.redir +++ b/Themes/_portKit-sm4/Sounds/ScreenWithMenuElements music.redir @@ -1 +1 @@ -_silent.ogg +_silent.ogg diff --git a/Themes/_portKit-sm4/Sounds/_edit marker.redir b/Themes/_portKit-sm4/Sounds/_edit marker.redir index fe2a713fc4..6e1d92da8b 100644 --- a/Themes/_portKit-sm4/Sounds/_edit marker.redir +++ b/Themes/_portKit-sm4/Sounds/_edit marker.redir @@ -1 +1 @@ -_common row +_common row diff --git a/Themes/_portKit-sm4/Sounds/_extra2.redir b/Themes/_portKit-sm4/Sounds/_extra2.redir index dce4ae7dfc..d4579c1423 100644 --- a/Themes/_portKit-sm4/Sounds/_extra2.redir +++ b/Themes/_portKit-sm4/Sounds/_extra2.redir @@ -1 +1 @@ -_extra1 +_extra1 diff --git a/Themes/_portKit-sm4/ThemeInfo.ini b/Themes/_portKit-sm4/ThemeInfo.ini index 97331cd21d..2412cd556c 100644 --- a/Themes/_portKit-sm4/ThemeInfo.ini +++ b/Themes/_portKit-sm4/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=PortKit: StepMania 4 +[ThemeInfo] +DisplayName=PortKit: StepMania 4 Author=StepMania Team \ No newline at end of file diff --git a/Themes/_portKit-sm4/metrics.ini b/Themes/_portKit-sm4/metrics.ini index ae18d3f908..d8f9ca94c6 100644 --- a/Themes/_portKit-sm4/metrics.ini +++ b/Themes/_portKit-sm4/metrics.ini @@ -1,4472 +1,4472 @@ -# portkit-SM4: based on the StepMania 4 theme, mainly by Chris Danford. -[Global] -IsBaseTheme=0 - -[Common] -AutoSetStyle=false -ColorP1Command=diffuse,PlayerColor(PLAYER_1) -ColorP2Command=diffuse,PlayerColor(PLAYER_2) -InitialScreen="ScreenCompany" -FirstAttractScreen="ScreenCompany" -DefaultModifiers="default;1.5x" -DefaultCpuModifiers="" -DefaultNoteSkinName="default" -DifficultiesToShow="beginner,easy,medium,hard,challenge" -CourseDifficultiesToShow="easy,medium,hard" -StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet" -ScreenWidth=640 -ScreenHeight=480 -OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay" -MaxCourseEntriesBeforeShowVarious=6 -AllStepsTypeInOneList=false -PercentScoreDecimalPlaces=2 -NoScoreName="STEP" - -[Gameplay] -ComboIsPerRow=GAMESTATE:GetPlayMode() == "PlayMode_Oni" -MinScoreToContinueCombo=GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3" -MinScoreToMaintainCombo="TapNoteScore_W3" - -[Screen] -ScreenInitCommand= -ScreenOnCommand= -AllowOperatorMenuButton=true -RepeatRate=-1 -RepeatDelay=-1 -PrepareScreens= -PersistScreens= -GroupedScreens= -CodeNames="" -CancelCancelCommand= -ShowCoinsAndCredits=true -LightsMode="LightsMode_MenuStartAndDirections" - -[ModeSwitcher] -PrevModeX=-200 -PrevModeY=-170 -PrevIconX=-200 -PrevIconY=-120 -PrevModeZoom=0.8 -NextModeX=200 -NextModeY=-170 -NextIconX=200 -NextIconY=-120 -NextModeZoom=0.8 -CurrentModeX=0 -CurrentModeY=0 -CurrentModeZoom=1 - -[UnlockManager] -AutoLockChallengeSteps=false -UnlockNames="" -# UnlockNames="1,2" -# The song "Pledge" requires 500 AP. -# Unlock1Command=song,"Pledge";require,"UnlockRequirement_ArcadePoints",500 - -# The song "ABC" can be unlocked via roulette; pick an arbitrary code -# to use to store the unlock. -# Unlock2Command=song,"ABC";code,"59183751";roulette - -[LightsManager] -GameButtonsToShow="" - -[ScreenSelect] -Fallback="ScreenWithMenuElements" -UpdateOnMessage="" - -[ScreenTitleMenu] -# Note that we don't use the "name" parameter to Choices here. Name1 is -# the displayed text, which might be translated or otherwise changed. The "name,foo" -# parameter to ModeChoices is an asset name, which is used in filenames. -Class="ScreenTitleMenu" -Fallback="ScreenSelectMasterBlank" -PrevScreen=THEME:GetMetric("Common","FirstAttractScreen"); -LightsMode="LightsMode_Joining" -ScreenOnCommand=lockinput,0 -CoinModeChangeScreen=ScreenTitleBranch() -SharedSelection=true -AllowDisabledPlayerInput=true -OverrideSleepAfterTweenOffSeconds=true -SleepAfterTweenOffSeconds=0 -NumChoicesOnPage1=100 -WrapCursor=true -AllowRepeatingInput=true -ChoiceNames="1,2,3,4,5,6,7" -DefaultChoice="1" -Choice1="applydefaultoptions;screen,ScreenProfileLoad;text,Game Start" -Choice2="screen,ScreenNetworkOptions;text,Play Online" -Choice3="screen,ScreenSelectGame;text,Select Game" -Choice4="screen,ScreenOptionsService;text,Options" -Choice5="screen,ScreenOptionsEdit;text,Edit/Share" -Choice6="screen,ScreenJukeboxMenu;text,Jukebox" -Choice7="screen,ScreenExit;text,Exit" -Choice8="screen,ScreenTest;text,Sandbox" -ShowIcon=false -ShowScroller=true -PerChoiceScrollElement=false -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(32*(itemIndex-(numItems-1)/2)); end -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=20 -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y+30 -ScrollerOnCommand= -ScrollerOffCommand= -TimerSeconds=-1 -ShowStyleIcon=false -ShowHelp=true -HelpText=ScreenString("HelpTextOptionsSimple") -HelpOnCommand=%function(self,param) local fn = THEME:GetMetric("ScreenWithMenuElements","HelpOnCommand"); fn(self); self:finishtweening(); end -IdleCommentSeconds=12 -IdleTimeoutSeconds=30 -IdleTimeoutScreen=THEME:GetMetric("Common","FirstAttractScreen") -OutDelay=.2 -# frieza hax -DoublePressToSelect=false -# this one sucks though -UseTwoLists=false -OptionOrderBUp="" -OptionOrderBDown="" -OptionOrderBLeft="" -OptionOrderBRight="" -OptionOrderBAuto="" - -[ScreenExit] -Class="ScreenExit" -Fallback="Screen" -AllowOperatorMenuButton=false - -[ScreenTitleJoin] -Class="ScreenTitleMenu" -Fallback="ScreenTitleMenu" -ChoiceNames="1" -# frieza hax -ChoiceNamesB="" -OptionOrderBUp="" -OptionOrderBDown="" -OptionOrderBLeft="" -OptionOrderBRight="" -OptionOrderBAuto="" - -[ScreenCaution] -Fallback="ScreenSplash" -PrepareScreen="ScreenSelectStyle" -NextScreen="ScreenSelectStyle" -PrevScreen=ScreenTitleBranch() -TimerSeconds=3 -AllowStartToSkip=true - -[ScreenProfileLoad] -Class="ScreenProfileLoad" -Fallback="ScreenWithMenuElementsBlank" -NextScreen=ScreenCautionBranch() -PrevScreen=ScreenTitleBranch() -TimerSeconds=-1 -LoadEdits=true -ShowHelp=false - -[ScreenProfileSave] -Class="ScreenProfileSave" -Fallback="ScreenWithMenuElements" -NextScreen=ScreenProfileSaveNextScreen() -PrevScreen=ScreenTitleBranch() -TimerSeconds=-1 -ShowHelp=false - -[ScreenSelectStyle] -Fallback="ScreenWithMenuElements" -Class="ScreenSelectMaster" -HelpText=ScreenString("HelpTextNormal") -IdleCommentSeconds=0 -IdleTimeoutSeconds=0 -TimerSeconds=30 -UpdateOnMessage="" -PrevScreen="ScreenTitleMenu" -ChoiceNames="1,2,3" -# The "name" here affects the announcer, eg. "ScreenSelectStyle comment single". -Choice1="style,single;name,1Player;text,1 Player;screen,ScreenSelectPlayMode" -Choice2="style,versus;name,2Players;text,2 Players;screen,ScreenSelectPlayMode" -Choice3="style,double;name,Double;text,Double;screen,ScreenSelectPlayMode" -ShowIcon=true -PerChoiceIconElement=false -ShowScroller=false -ShowCursor=false -SharedSelection=true -UseIconMetrics=false -NumChoicesOnPage1=3 -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -PreSwitchPageSeconds=0 -PostSwitchPageSeconds=0 -OptionOrderUp= -OptionOrderDown= -OptionOrderLeft= -OptionOrderRight= -OptionOrderAuto= -WrapCursor=false -WrapScroller=false -LoopScroller=false -PerChoiceScrollElement=false -AllowRepeatingInput=false -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=1 -ScrollerTransform=function() end; -ScrollerSubdivisions=1 -DefaultChoice="1" -MorePage1X=0 -MorePage1Y=0 -MorePage2X=0 -MorePage2Y=0 -ExplanationPage1X=0 -ExplanationPage1Y=0 -ExplanationPage2X=0 -ExplanationPage2Y=0 -HeaderOnCommand= -HeaderOffCommand= -# frieza hax -DoublePressToSelect=false -# this one sucks -UseTwoLists=false -ChoiceNamesB="" -OptionOrderBUp="" -OptionOrderBDown="" -OptionOrderBLeft="" -OptionOrderBRight="" -OptionOrderBAuto="" - -[ScreenSelectPlayMode] -Fallback="ScreenWithMenuElements" -Class="ScreenSelectMaster" -HelpText=ScreenString("HelpTextNormal") -IdleCommentSeconds=0 -IdleTimeoutSeconds=0 -TimerSeconds=30 -UpdateOnMessage="" -PrevScreen="ScreenTitleMenu" -ChoiceNames="1,2,3,4,5" -# The "name" here affects the announcer, eg. "ScreenSelectStyle comment single". -#Choice1="playmode,regular;name,Normal;text,Normal;screen,ScreenSelectMusic" -Choice1="playmode,regular;name,Normal;text,Normal;screen,"..ScreenSelectMusicBranch() -Choice2="playmode,nonstop;name,Nonstop;text,Nonstop;screen,ScreenSelectMusic" -Choice3="playmode,oni;name,Challenge;text,Challenge;screen,ScreenSelectMusic" -Choice4="playmode,oni;name,Survival;text,Survival;screen,ScreenSelectMusic" -Choice5="playmode,endless;name,Endless;text,Endless;screen,ScreenSelectMusic" -ShowIcon=true -PerChoiceIconElement=false -ShowScroller=false -ShowCursor=false -SharedSelection=true -UseIconMetrics=false -NumChoicesOnPage1=5 -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -PreSwitchPageSeconds=0 -PostSwitchPageSeconds=0 -OptionOrderUp= -OptionOrderDown= -OptionOrderLeft= -OptionOrderRight= -OptionOrderAuto= -WrapCursor=false -WrapScroller=false -LoopScroller=false -PerChoiceScrollElement=false -AllowRepeatingInput=false -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=1 -ScrollerTransform=function() end; -ScrollerSubdivisions=1 -DefaultChoice="1" -MorePage1X=0 -MorePage1Y=0 -MorePage2X=0 -MorePage2Y=0 -ExplanationPage1X=0 -ExplanationPage1Y=0 -ExplanationPage2X=0 -ExplanationPage2Y=0 -HeaderOnCommand= -HeaderOffCommand= -# frieza hax -DoublePressToSelect=false -# this one sucks -UseTwoLists= -OptionOrderBUp= -OptionOrderBDown= -OptionOrderBLeft= -OptionOrderBRight= -OptionOrderBAuto= - -[ScreenSelectMode] -Fallback="ScreenSelect" -JoinFrameP1X=SCREEN_CENTER_X-200 -JoinFrameP1Y=SCREEN_CENTER_Y+110 -JoinFrameP2X=SCREEN_CENTER_X+200 -JoinFrameP2Y=SCREEN_CENTER_Y+110 -JoinMessageP1X=SCREEN_CENTER_X-200 -JoinMessageP1Y=SCREEN_CENTER_Y+96 -JoinMessageP2X=SCREEN_CENTER_X+200 -JoinMessageP2Y=SCREEN_CENTER_Y+96 -GuideX=SCREEN_CENTER_X+0 -GuideY=SCREEN_CENTER_Y+134 -TimerSeconds=30 -TimerStealth=false -ShowStyleIcon=true -NextScreen=ScreenSelectGroupBranch() -ScrollingListX=SCREEN_CENTER_X+0 -ScrollingListY=SCREEN_CENTER_Y+10 -UseSelectionBGAnimations=0 -SelectionSpecificBGAnimations=0 -BounceJoinMessage=true -FoldOnJoin=true -ScrollingListOffCommand=bouncebegin,0.5;zoomy,0 -GuideOffCommand=bouncebegin,0.5;addy,400 -ChoiceListHighlightOffCommand=linear,0.5;diffusealpha,0;glow,1,1,1,0 -ChoiceListFrameOffCommand=linear,0.5;diffusealpha,0;glow,1,1,1,0 -UseModeSpecificBGAnims=false -EnableCharSelect=false -Only2DChars=false -CharacterIconP1Y=SCREEN_CENTER_Y+0 -CharacterIconP1X=SCREEN_CENTER_X+0 -CharacterIconP2Y=SCREEN_CENTER_Y+0 -CharacterIconP2X=SCREEN_CENTER_X+0 -CharacterIconP1OffCommand=linear,0.3;diffusealpha,0;sleep,10 -CharacterIconP2OffCommand=linear,0.3;diffusealpha,0;sleep,10 - -[GroupList] -StartX=0 -StartY=-136 -SpacingX=0 -SpacingY=28 -ButtonFrameGainFocusCommand=stoptweening;linear,0.2;x,-40 -ButtonFrameLoseFocusCommand=stoptweening;linear,0.2;x,0 - -ButtonGainFocusCommand=glowshift;effectperiod,0.5 -ButtonLoseFocusCommand=stopeffect -LabelGainFocusCommand=glowshift;effectperiod,0.5 -LabelLoseFocusCommand=stopeffect -ButtonHideItemCommand=linear,0.2;diffusealpha,0 -ButtonShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; -LabelHideItemCommand=linear,0.2;diffusealpha,0 -LabelShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; -# This just selects the type of tweening used for scrolling the list; it shouldn't actually -# queue any commands. -FrameScrollTweenCommand=stoptweening;linear,0.2; - -[MusicList] -NumColumns=4 -NumRows=10 -StartX=0 -StartY=0 -SpacingX=150 -CropWidth=146 -TitleInitCommand=halign,0;valign,0;shadowlength,2; - -[ScreenInstructions] -Class="ScreenInstructions" -Fallback="ScreenWithMenuElements" -NextScreen="ScreenSelectCharacter" -PrevScreen=ScreenTitleBranch() -TimerSeconds=15 -ShowStyleIcon=true - -[ScreenSelectMusic] -Class="ScreenSelectMusic" -Fallback="ScreenWithMenuElements" -NextScreen=GetSelectMusicNext() -PrevScreen=ScreenTitleBranch() -MusicWheelType="MusicWheel" -HelpText=ScreenString("HelpTextSelectMusic") -SampleMusicLoops=true -SampleMusicFallbackFadeInSeconds=0 -ShowOptionsMessageSeconds=1.5 -BannerX=0 -BannerY=0 -BannerOnCommand=scaletoclipped,322,120;visible,false;ztest,1 -BannerOffCommand= -ShowStageDisplay=true -ShowStageFrame=true -CDTitleX=SCREEN_CENTER_X+240 -CDTitleY=SCREEN_CENTER_Y-50 -CDTitleFrontCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Back"; -CDTitleBackCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Front";diffuse,color("#606060"); -CDTitleOnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6;draworder,101 -CDTitleOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -ScoreFrameP1X= -ScoreFrameP1Y= -ScoreFrameP1OnCommand=visible,false -ScoreFrameP1OffCommand= -ScoreFrameP2X= -ScoreFrameP2Y= -ScoreFrameP2OnCommand=visible,false -ScoreFrameP2OffCommand= -ScoreP1X= -ScoreP1Y= -ScoreP1OnCommand=visible,false -ScoreP1OffCommand= -ScoreP2X= -ScoreP2Y= -ScoreP2OnCommand= -ScoreP2OffCommand= -# Don't use relative motion here. It's usually possible to change the -# sort again while this command is still executing. -ScoreP1SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,58 -ScoreP2SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,269 -ScoreFrameP1SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,58 -ScoreFrameP2SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,269 -MusicWheelX=SCREEN_CENTER_X-178 -MusicWheelY=SCREEN_CENTER_Y-10 -MusicWheelOnCommand=draworder,-100 -MusicWheelOffCommand= -TimerSeconds=60 -ShowStyleIcon=true -SampleMusicDelay=0.25 -SampleMusicDelayInit=0 -DoRouletteOnMenuTimer=true -AlignMusicBeat=false -Codes="" -OptionsMenuAvailable=OptionsMenuAvailable() -SelectMenuAvailable=false -ModeMenuAvailable=ModeMenuAvailable() -ScreenModsCommand=setupmusicstagemods -PreviousSongButton="MenuLeft" -NextSongButton="MenuRight" -UseOptionsList=false -TwoPartSelection=false -# this metric is not supported in regular sm4 anymore: -TwoPartConfirmsOnly=false -UsePlayerSelectMenu=false -StepsDisplayP1X= -StepsDisplayP1Y= -StepsDisplayP1OnCommand=visible,false -StepsDisplayP1OffCommand= -StepsDisplayP2X= -StepsDisplayP2Y= -StepsDisplayP2OnCommand=visible,false -StepsDisplayP2OffCommand= -PaneDisplayP1X=SCREEN_CENTER_X-180 -PaneDisplayP1Y=SCREEN_CENTER_Y+194 -PaneDisplayP1OnCommand= -PaneDisplayP1OffCommand= -PaneDisplayP2X=SCREEN_CENTER_X+180 -PaneDisplayP2Y=SCREEN_CENTER_Y+194 -PaneDisplayP2OnCommand= -PaneDisplayP2OffCommand= -OptionsAreaP1X=SCREEN_CENTER_X+166 -OptionsAreaP1Y=SCREEN_CENTER_Y+128 -OptionsAreaP1OnCommand= -OptionsAreaP1OffCommand= -OptionsAreaP2X=SCREEN_CENTER_X+166 -OptionsAreaP2Y=SCREEN_CENTER_Y+148 -OptionsAreaP2OnCommand= -OptionsAreaP2OffCommand= -SelectMenuChangesDifficulty=true -SelectMenuScreenName="ScreenPlayerOptions" -OptionsListTimeout=0.5 -WrapChangeSteps=false - -[ScreenSelectCourse] -Class="ScreenSelectMusic" -Fallback="ScreenSelectMusic" -BPMDisplayOnCommand=visible,false -CDTitleOnCommand=visible,false -ExplanationX=SCREEN_CENTER_X-188 -ExplanationY=SCREEN_CENTER_Y-172 -ExplanationOnCommand=addx,-SCREEN_WIDTH;sleep,0.5;bounceend,0.5;addx,SCREEN_WIDTH -ExplanationOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH -Codes="CourseCodeDetector" -DoRouletteOnMenuTimer=false -ScreenModsCommand=setupcoursestagemods - -[ScreenSelectCourseNonstop] -Fallback="ScreenSelectCourse" -DefaultSort="Nonstop" - -[ScreenSelectCourseOni] -Fallback="ScreenSelectCourse" -DefaultSort="Oni" -ScoreP1OnCommand=visible,false -ScoreP2OnCommand=visible,false -ScoreFrameP1OnCommand=visible,false -ScoreFrameP2OnCommand=visible,false - -[ScreenSelectCourseEndless] -Fallback="ScreenSelectCourse" -DefaultSort="Endless" - -[ScreenSMOnlineLogin] -Class="ScreenSMOnlineLogin" -Fallback="ScreenOptionsServiceChild" -NextScreen=SMOnlineScreen() -PrevScreen=ScreenTitleBranch() -ShowStyleIcon=false -TimerSeconds=-1 -ShowHelp=false - -[ScreenNetRoom] -MusicSelectScreen="ScreenSMOnlineSelectMusic" -PrevScreen=ScreenTitleBranch() -NextScreen="ScreenGameplayBranch" -Fallback="ScreenNetSelectMusic" -Class="ScreenNetRoom" -HelpText="" -OpenRoomColor=color("1.0,1.0,1.0,1.0") -PasswdRoomColor=color("1.0,0.5,0.5,1.0") -InGameRoomColor=color("1.0,0.1,0.1,1.0") -RoomWheelX=SCREEN_CENTER_X-178 -RoomWheelY=SCREEN_CENTER_Y-10 -RoomWheelOnCommand=draworder,-100 -RoomInfoDisplayX=SCREEN_CENTER_X -RoomInfoDisplayY=SCREEN_CENTER_Y - -[ScreenSMOnlineSelectMusic] -PrevScreen="ScreenNetRoom" -Class="ScreenNetSelectMusic" -RoomSelectScreen="ScreenNetRoom" -Fallback="ScreenNetSelectMusic" - -[ScreenNetSelectMusic] -Fallback="ScreenWithMenuElements" -Class="ScreenNetSelectMusic" -BannerWidth=0 -BannerHeight=0 -MusicWheelX=SCREEN_CENTER_X-178 -MusicWheelY=SCREEN_CENTER_Y-10 -MusicWheelOnCommand=draworder,-100 -MusicWheelOffCommand= -TimerStealth=true -BPMDisplayX=SCREEN_CENTER_X*0.3 -BPMDisplayY=SCREEN_CENTER_Y+120 -BPMDisplayOnCommand=halign,1;shadowlength,1;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -BPMDisplayOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -ModIconsP1X=SCREEN_CENTER_X+144 -ModIconsP1Y=SCREEN_CENTER_Y-165 -ModIconsP1OnCommand=zoomy,0;linear,0.5;zoomy,1 -ModIconsP1OffCommand=linear,0.5;zoomy,0 -ModIconsP2X=SCREEN_CENTER_X+144 -ModIconsP2Y=SCREEN_CENTER_Y-164 -ModIconsP2OnCommand=zoomy,0;linear,0.5;zoomy,1 -ModIconsP2OffCommand=linear,0.5;zoomy,0 -ChatInputBoxX=SCREEN_CENTER_X+144 -ChatInputBoxY=SCREEN_CENTER_Y+112 -ChatInputBoxOnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -ChatInputBoxOffCommand=bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -ChatInputBoxWidth=310 -ChatInputBoxHeight=60 -ChatInputBoxColor=color("0.5,0.5,1.0,0.7") -ChatOutputBoxX=SCREEN_CENTER_X+144 -ChatOutputBoxY=SCREEN_CENTER_Y-37 -ChatOutputBoxOnCommand=zoomy,1.1;addx,SCREEN_WIDTH*0.6;bounceend,0.5;diffusealpha,1;addx,-SCREEN_WIDTH*0.6 -ChatOutputBoxOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0;zoom,0; -ChatOutputBoxWidth=310 -ChatOutputBoxHeight=210 -ChatOutputBoxColor=color("1.0,0.5,0.5,0.7") -ChatInputX=SCREEN_CENTER_X-2 -ChatInputY=SCREEN_CENTER_Y+90 -ChatInputOnCommand=diffusealpha,0;linear,0.55;diffusealpha,1 -ChatInputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 -ChatOutputX=SCREEN_CENTER_X-2 -ChatOutputY=SCREEN_CENTER_Y+68 -ChatOutputOnCommand=diffusealpha,0;linear,0.55;diffusealpha,1 -ChatOutputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 -UsersX=SCREEN_CENTER_X-265 -UsersY=SCREEN_CENTER_Y+172 -UsersDX=40 -UsersAY=16 -UsersOnCommand=draworder,2;zoom,1 -UsersOffCommand=linear,0.5;zoom,0 -Users0Command=draworder,2;diffuse,1.0,0.4,0.4,1.0 -Users1Command=draworder,2;diffuse,1.0,1.0,1.0,1.0 -Users2Command=draworder,2;diffuse,0.5,0.5,1.0,1.0 -Users3Command=draworder,2;diffuse,0.5,1.0,0.5,1.0 -Users4Command=draworder,2;diffuse,1.0,0.5,0.5,1.0 -optionsY=SCREEN_CENTER_Y-170 -optionsX=SCREEN_CENTER_X-240 -optionsOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,0.7;zoomx,0.7 -optionsOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -MeterP1Y=SCREEN_CENTER_Y+150 -MeterP1X=SCREEN_CENTER_X-223 -MeterP1OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -MeterP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -MeterP2Y=SCREEN_CENTER_Y+150 -MeterP2X=SCREEN_CENTER_X-110 -MeterP2OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -MeterP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -DiffBGColor=color("0.7,0.7,0.7,0.7") -DiffBGWidth=0 -DiffBGHeight=0 -DiffBGY=SCREEN_CENTER_Y+160 -DiffBGX=SCREEN_CENTER_X-60 -DiffBGOnCommand=zoomz,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -DiffBGOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -ChatOutputLines=14 -ChatTextOutputWidth=304 -ChatTextInputWidth=304 -NumStylesShow=1 -NumSongsShow=4 -NumGroupsShow=3 -ShowStyleIcon=false -TimerSeconds= -PrevScreen=ScreenTitleBranch() -NextScreen="ScreenStage" -NoSongsScreen=ScreenTitleBranch() -DifficultyIconP1OnCommand=visible,false -DifficultyIconP1OffCommand= -DifficultyIconP2OnCommand=visible,false -DifficultyIconP2OffCommand= -DifficultyIconP1X=SCREEN_CENTER_X+50 -DifficultyIconP1Y=SCREEN_BOTTOM-54 -DifficultyIconP2X=SCREEN_CENTER_X+80 -DifficultyIconP2Y=SCREEN_BOTTOM-50 -HelpText=ScreenString("HelpTextNetSelectMusic"); - -[ScreenSplash] -Class="ScreenSplash" -Fallback="ScreenWithMenuElementsBlank" -MinimumScreenPrepareDelaySeconds=0 -AllowStartToSkip=false -PrepareScreen= - -[ScreenStage] -Fallback="ScreenSplash" -PrepareScreen=GetGameplayScreen() -NextScreen=GetGameplayScreen() -PrevScreen=SongSelectionScreen() -LightsMode="LightsMode_Stage" -TimerSeconds=3 - -[ScreenGameplay] -Class="ScreenGameplayNormal" -Fallback="ScreenWithMenuElementsBlank" -PrevScreen=SongSelectionScreen() -NextScreen=GetGameplayNextScreen() -LightsMode="LightsMode_Gameplay" -TimerSeconds=-1 -# this metric is not supported in regular sm4 anymore: -UseAlternativeInput=false -PlayerType="Player" -PlayerInitCommand=y,SCREEN_CENTER_Y -StartGivesUp=true -BackGivesUp=false -FailOnMissCombo=-1 -GivingUpGoesToPrevScreen=false -GivingUpGoesToNextScreen=false -InitialBackgroundBrightness=1 -MinSecondsToStep=6.0 -MinSecondsToMusic=1.0 -MinSecondsToStepNextSong=2.0 -MusicFadeOutSeconds=0.5 -OutTransitionLength=1.5 -CourseTransitionLength=0.5 -BeginFailedDelay=1.0 -AllowCenter1Player=true -ScoreKeeperClass="ScoreKeeperNormal" -SongBackgroundOnCommand= -SongForegroundOnCommand= -OniGameOverP1X=SCREEN_CENTER_X-160 -OniGameOverP1Y=SCREEN_TOP-200 -OniGameOverP1OnCommand=diffusealpha,0 -OniGameOverP1OffCommand= -OniGameOverP1DieCommand=diffusealpha,1;bounceend,0.5;y,SCREEN_CENTER_Y;bob;effectperiod,4;effectmagnitude,0,6,0 -OniGameOverP2X=SCREEN_CENTER_X+160 -OniGameOverP2Y=SCREEN_TOP-200 -OniGameOverP2OnCommand=diffusealpha,0 -OniGameOverP2OffCommand= -OniGameOverP2DieCommand=diffusealpha,1;bounceend,0.5;y,SCREEN_CENTER_Y;bob;effectperiod,4;effectmagnitude,0,6,0 -LifeFrameX=SCREEN_CENTER_X+0 -LifeFrameY=SCREEN_TOP -LifeFrameOnCommand=valign,0;addy,-100;linear,0.5;addy,100 -LifeFrameOffCommand=linear,0.5;addy,-100 -LifeP1X=SCREEN_CENTER_X-184 -LifeP1Y=SCREEN_CENTER_Y-212 -LifeP1OnCommand=addy,-100;linear,0.5;addy,100 -LifeP1OffCommand=linear,0.5;addy,-100 -LifeP2X=SCREEN_CENTER_X+184 -LifeP2Y=SCREEN_CENTER_Y-212 -LifeP2OnCommand=rotationy,180;addy,-100;linear,0.5;addy,100 -LifeP2OffCommand=linear,1;addy,-100 -CombinedLifeX=SCREEN_CENTER_X+0 -CombinedLifeY=SCREEN_CENTER_Y-212 -CombinedLifeOnCommand=addy,-100;linear,0.5;addy,100 -CombinedLifeOffCommand=linear,0.5;addy,-100 -ShowStageDisplay=not GAMESTATE:IsCourseMode() -ShowStageFrame=true -StageDisplayX=SCREEN_CENTER_X+0 -StageDisplayY=SCREEN_CENTER_Y-206 -StageDisplayOnCommand=draworder,-1;addy,-100;linear,0.5;addy,100 -StageDisplayOffCommand=linear,0.5;addy,-100 -StageFrameX=SCREEN_CENTER_X -StageFrameY=SCREEN_CENTER_Y-202 -StageFrameOnCommand=draworder,-2;addy,-100;linear,0.5;addy,100 -StageFrameOffCommand= -SongNumberP1X=SCREEN_CENTER_X-25 -SongNumberP1Y=SCREEN_CENTER_Y-206 -SongNumberP1OnCommand=addy,-100;linear,0.5;addy,100 -SongNumberP1OffCommand=linear,0.5;addy,-100 -SongNumberP2X=SCREEN_CENTER_X+25 -SongNumberP2Y=SCREEN_CENTER_Y-206 -SongNumberP2OnCommand=addy,-100;linear,0.5;addy,100 -SongNumberP2OffCommand=linear,0.5;addy,-100 -ShowScoreInRave=true -ScoreFrameX=SCREEN_CENTER_X -ScoreFrameY=SCREEN_BOTTOM -ScoreFrameOnCommand=valign,1;addy,100;linear,0.5;addy,-100;draworder,2 -ScoreFrameOffCommand=linear,0.5;addy,100 -ScoreP1X=SCREEN_CENTER_X-220 -ScoreP1Y=SCREEN_CENTER_Y+200 -ScoreP1OnCommand=addy,100;linear,1;addy,-100;draworder,109; -ScoreP1OffCommand=linear,1;addy,100; -ScoreP2X=SCREEN_CENTER_X+220 -ScoreP2Y=SCREEN_CENTER_Y+200 -ScoreP2OnCommand=addy,100;linear,1;addy,-100;draworder,109; -ScoreP2OffCommand=linear,1;addy,100; -SecondaryScoreP1X=SCREEN_CENTER_X-20 -SecondaryScoreP1Y=SCREEN_CENTER_Y+0 -SecondaryScoreP1OnCommand= -SecondaryScoreP1OffCommand= -SecondaryScoreP2X=SCREEN_CENTER_X+20 -SecondaryScoreP2Y=SCREEN_CENTER_Y+0 -SecondaryScoreP2OnCommand= -SecondaryScoreP2OffCommand= -PlayerOptionsP1X=SCREEN_CENTER_X+0 -PlayerOptionsP1Y=SCREEN_CENTER_Y+194 -PlayerOptionsP1OnCommand=visible,false -PlayerOptionsP1OffCommand= -PlayerOptionsP2X=SCREEN_CENTER_X+0 -PlayerOptionsP2Y=SCREEN_CENTER_Y+210 -PlayerOptionsP2OnCommand=visible,false -PlayerOptionsP2OffCommand= -ScoreboardC1P1X=SCREEN_CENTER_X-260 -ScoreboardC1P1Y=SCREEN_CENTER_Y-160 -ScoreboardC1P1OnCommand=zoom,1 -ScoreboardC1P1OffCommand=zoom,1 -ScoreboardC2P1X=SCREEN_CENTER_X-140 -ScoreboardC2P1Y=SCREEN_CENTER_Y-160 -ScoreboardC2P1OnCommand=zoom,1 -ScoreboardC2P1OffCommand=zoom,1 -ScoreboardC3P1X=SCREEN_CENTER_X-30 -ScoreboardC3P1Y=SCREEN_CENTER_Y-160 -ScoreboardC3P1OnCommand=zoom,1 -ScoreboardC3P1OffCommand=zoom,1 -ScoreboardC1P2X=SCREEN_CENTER_X+40 -ScoreboardC1P2Y=SCREEN_CENTER_Y-160 -ScoreboardC1P2OnCommand=zoom,1 -ScoreboardC1P2OffCommand=zoom,1 -ScoreboardC2P2X=SCREEN_CENTER_X+160 -ScoreboardC2P2Y=SCREEN_CENTER_Y-160 -ScoreboardC2P2OnCommand=zoom,1 -ScoreboardC2P2OffCommand=zoom,1 -ScoreboardC3P2X=SCREEN_CENTER_X+270 -ScoreboardC3P2Y=SCREEN_CENTER_Y-160 -ScoreboardC3P2OnCommand=zoom,1 -ScoreboardC3P2OffCommand=zoom,1 -StepsDescriptionP1X= -StepsDescriptionP1Y= -StepsDescriptionP1OnCommand=visible,false -StepsDescriptionP1OffCommand= -StepsDescriptionP2X= -StepsDescriptionP2Y= -StepsDescriptionP2OnCommand=visible,false -StepsDescriptionP2OffCommand= -SongOptionsX=SCREEN_CENTER_X+0 -SongOptionsY=SCREEN_CENTER_Y+230 -SongOptionsOnCommand=addy,100;linear,0.5;addy,-100 -SongOptionsOffCommand=linear,0.5;addy,100 -StepsDisplayP1X=SCREEN_CENTER_X-240 -StepsDisplayP1Y= -StepsDisplayP1OnCommand= -StepsDisplayP1OffCommand=linear,0.5;addx,-200 -StepsDisplayP1SetReverseCommand=y,SCREEN_CENTER_Y-196;addy,-100;linear,1;addy,100 -StepsDisplayP1SetNoReverseCommand=y,SCREEN_CENTER_Y+174;addy,100;linear,1;addy,-100 -StepsDisplayP2X=SCREEN_CENTER_X+240 -StepsDisplayP2Y= -StepsDisplayP2OnCommand= -StepsDisplayP2OffCommand=linear,0.5;addx,200 -StepsDisplayP2SetReverseCommand=y,SCREEN_CENTER_Y-196;addy,-100;linear,1;addy,100 -StepsDisplayP2SetNoReverseCommand=y,SCREEN_CENTER_Y+174;addy,100;linear,1;addy,-100 -LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+160 -LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-140 -# This is used if one player is in reverse and the other isn't. -LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-205 -LyricDisplayDefaultColor=color("0,1,0,1") - -ActiveAttackListP1X= -ActiveAttackListP1Y= -ActiveAttackListP1OnCommand=visible,false -ActiveAttackListP1OffCommand= -ActiveAttackListP2X= -ActiveAttackListP2Y= -ActiveAttackListP2OnCommand=visible,false -ActiveAttackListP2OffCommand= -SurviveTimeX=SCREEN_CENTER_X+0 -SurviveTimeY=SCREEN_CENTER_Y+100 -SurviveTimeOnCommand=sleep,0.3;linear,0.3;diffusealpha,1;sleep,3.5;linear,0.5;diffusealpha,0 -DebugX=SCREEN_CENTER_X -DebugY=SCREEN_CENTER_Y -DebugOnCommand=wrapwidthpixels,SCREEN_WIDTH-50;strokecolor,color("#000000"); -DebugOffCommand=stoptweening;linear,1/8;diffusealpha,0 -SecondsBetweenComments=10 -TickEarlySeconds=0.05 -ShowLifeMeterForDisabledPlayers=false -PlayerP1OnCommand= -PlayerP1OffCommand= -PlayerP2OnCommand= -PlayerP2OffCommand= -PlayerP1OnePlayerOneSideX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP2OnePlayerOneSideX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP1TwoPlayersTwoSidesX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP2TwoPlayersTwoSidesX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT)) -PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP1TwoPlayersSharedSidesX=SCREEN_CENTER_X -PlayerP2TwoPlayersSharedSidesX=SCREEN_CENTER_X -LeftFrameX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT))-160 -LeftFrameY=SCREEN_CENTER_Y -LeftFrameOnCommand=addx,-200;linear,0.5;addx,200 -LeftFrameOffCommand=linear,0.5;addx,-200 -RightFrameX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT))+160 -RightFrameY=SCREEN_CENTER_Y -RightFrameOnCommand=addx,200;linear,0.5;addx,-200 -RightFrameOffCommand=linear,0.5;addx,200 -ShowModIconRows=true -ModIconRowP1X=THEME:GetMetric(Var "LoadingScreen","LeftFrameX")+6 -ModIconRowP1Y=SCREEN_CENTER_Y -ModIconRowP1OnCommand=player,"PlayerNumber_P1";addx,-200;linear,0.5;addx,200 -ModIconRowP1OffCommand=linear,0.5;addx,-200 -ModIconRowP2X=THEME:GetMetric(Var "LoadingScreen","RightFrameX")-6 -ModIconRowP2Y=SCREEN_CENTER_Y -ModIconRowP2OnCommand=player,"PlayerNumber_P2";addx,200;linear,0.5;addx,-200 -ModIconRowP2OffCommand=linear,0.5;addx,200 - -StopCourseEarly=false -ShowEvaluationOnFail=true - -[ScreenGameplayExtra] -Fallback="ScreenGameplay" -LifeFrameX=SCREEN_CENTER_X+0 -LifeFrameY=SCREEN_CENTER_Y+202 -LifeFrameOnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -LifeFrameOffCommand=linear,1;addy,100 -LifeP1X=SCREEN_CENTER_X-180 -LifeP1Y=SCREEN_CENTER_Y+210 -LifeP1OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -LifeP1OffCommand=linear,1;addy,100 -LifeP2X=SCREEN_CENTER_X+180 -LifeP2Y=SCREEN_CENTER_Y+210 -LifeP2OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -LifeP2OffCommand=linear,1;addy,100 -StageDisplayX=SCREEN_CENTER_X+0 -StageDisplayY=SCREEN_CENTER_Y+182 -StageDisplayOnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -StageDisplayOffCommand=linear,1;addy,100 -SongNumberP1X=SCREEN_CENTER_X-30 -SongNumberP1Y=SCREEN_CENTER_Y+200 -SongNumberP1OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -SongNumberP1OffCommand=linear,1;addy,100 -SongNumberP2X=SCREEN_CENTER_X+30 -SongNumberP2Y=SCREEN_CENTER_Y+200 -SongNumberP2OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 -SongNumberP2OffCommand=linear,1;addy,100 -ScoreP1X=SCREEN_CENTER_X-214 -ScoreP1Y=SCREEN_CENTER_Y-202 -ScoreP1OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 -ScoreP1OffCommand=linear,1;addy,-100 -ScoreP2X=SCREEN_CENTER_X+214 -ScoreP2Y=SCREEN_CENTER_Y-202 -ScoreP2OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 -ScoreP2OffCommand=linear,1;addy,-100 -SecondaryScoreP1X=SCREEN_CENTER_X-20 -SecondaryScoreP1Y=SCREEN_CENTER_Y+0 -SecondaryScoreP1OnCommand= -SecondaryScoreP1OffCommand= -SecondaryScoreP2X=SCREEN_CENTER_X+20 -SecondaryScoreP2Y=SCREEN_CENTER_Y+0 -SecondaryScoreP2OnCommand= -SecondaryScoreP2OffCommand= -PlayerOptionsP1X=SCREEN_CENTER_X+0 -PlayerOptionsP1Y=SCREEN_CENTER_Y-194 -PlayerOptionsP1OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 -PlayerOptionsP1OffCommand=linear,1;addy,-100 -PlayerOptionsP2X=SCREEN_CENTER_X+0 -PlayerOptionsP2Y=SCREEN_CENTER_Y-210 -PlayerOptionsP2OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 -PlayerOptionsP2OffCommand=linear,1;addy,-100 -SongOptionsX=SCREEN_CENTER_X+0 -SongOptionsY=SCREEN_CENTER_Y-230 -SongOptionsOnCommand=addy,-100;sleep,0.5;linear,1;addy,100 -SongOptionsOffCommand=linear,1;addy,-100 -DifficultyP1X=SCREEN_CENTER_X-260 -DifficultyP1Y=SCREEN_CENTER_Y+180 -DifficultyP1OnCommand=addx,-200;sleep,0.5;linear,1;addx,200 -DifficultyP1OffCommand=linear,1;addx,-200 -DifficultyP1ReverseX=SCREEN_CENTER_X-260 -DifficultyP1ReverseY=SCREEN_CENTER_Y-170 -DifficultyP1ReverseOnCommand=addx,-200;sleep,0.5;linear,1;addx,200 -DifficultyP1ReverseOffCommand=linear,1;addx,-200 -DifficultyP2X=SCREEN_CENTER_X+260 -DifficultyP2Y=SCREEN_CENTER_Y+180 -DifficultyP2OnCommand=addx,200;sleep,0.5;linear,1;addx,-200 -DifficultyP2OffCommand=linear,1;addx,200 -DifficultyP2ReverseX=SCREEN_CENTER_X+260 -DifficultyP2ReverseY=SCREEN_CENTER_Y-170 -DifficultyP2ReverseOnCommand=addx,200;sleep,0.5;linear,1;addx,-200 -DifficultyP2ReverseOffCommand=linear,1;addx,200 - -[ScreenGameplayShared] -Class="ScreenGameplayShared" -Fallback="ScreenGameplay" -PlayerType="PlayerShared" - -[ScreenEvaluation] -Fallback="ScreenWithMenuElements" -Class="ScreenEvaluation" -LightsMode="LightsMode_MenuStartOnly" -HelpText=ScreenString("HelpTextEvaluation") -Summary=false -CheckpointsWithJudgments=false -TimerSeconds=15 -DisqualifiedP1X= -DisqualifiedP1Y= -DisqualifiedP2X= -DisqualifiedP2Y= -PlayerOptionsSeparator="," -PlayerOptionsHideFailType=false -MaxComboNumDigits=4 -ShowStyleIcon=true -ShowBannerArea=true -ShowSharedJudgmentLineLabels=true -ShowJudgmentLineW1=true -ShowJudgmentLineW2=true -ShowJudgmentLineW3=true -ShowJudgmentLineW4=true -ShowJudgmentLineW5=true -ShowJudgmentLineHeld=false -ShowJudgmentLineMiss=true -ShowJudgmentLineMaxCombo=true -ShowPeakComboAward=false -ShowTimingDifficulty=true - -BannerWidth=268 -BannerHeight=98 - -GradeP1X=SCREEN_CENTER_X-222 -GradeP1Y=SCREEN_CENTER_Y-104 -GradeP1OnCommand=glowshift;effectperiod,2;addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 -GradeP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 -GradeP2X=SCREEN_CENTER_X+222 -GradeP2Y=SCREEN_CENTER_Y-104 -GradeP2OnCommand=glowshift;effectperiod,2;addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -GradeP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 -GradeFrameP1X=SCREEN_CENTER_X-222 -GradeFrameP1Y=SCREEN_CENTER_Y-104 -GradeFrameP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 -GradeFrameP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 -GradeFrameP2X=SCREEN_CENTER_X+222 -GradeFrameP2Y=SCREEN_CENTER_Y-104 -GradeFrameP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -GradeFrameP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 - -W1LabelX=SCREEN_CENTER_X+0 -W1LabelY=SCREEN_CENTER_Y-36+29*0 -W1LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*0;decelerate,0.3;addy,-SCREEN_HEIGHT -W1LabelOffCommand=sleep,0.7-0.1*0;accelerate,0.3;addy,SCREEN_HEIGHT - -W1NumberP1X=SCREEN_CENTER_X-100 -W1NumberP1Y=SCREEN_CENTER_Y-36+29*0 -W1NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 -W1NumberP1OffCommand=sleep,0.7;accelerate,0.3;addx,-SCREEN_WIDTH/2 -W1NumberP2X=SCREEN_CENTER_X+100 -W1NumberP2Y=SCREEN_CENTER_Y-36+29*0 -W1NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -W1NumberP2OffCommand=sleep,0.7-0.1*0;accelerate,0.3;addx,SCREEN_WIDTH/2 - -W2LabelX=SCREEN_CENTER_X+0 -W2LabelY=SCREEN_CENTER_Y-36+29*1 -W2LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*1;decelerate,0.3;addy,-SCREEN_HEIGHT -W2LabelOffCommand=sleep,0.7-0.1*1;accelerate,0.3;addy,SCREEN_HEIGHT - -W2NumberP1X=SCREEN_CENTER_X-100 -W2NumberP1Y=SCREEN_CENTER_Y-36+29*1 -W2NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,SCREEN_WIDTH/2 -W2NumberP1OffCommand=sleep,0.7-0.1*1;accelerate,0.3;addx,-SCREEN_WIDTH/2 -W2NumberP2X=SCREEN_CENTER_X+100 -W2NumberP2Y=SCREEN_CENTER_Y-36+29*1 -W2NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,-SCREEN_WIDTH/2 -W2NumberP2OffCommand=sleep,0.7-0.1*1;accelerate,0.3;addx,SCREEN_WIDTH/2 - -W3LabelX=SCREEN_CENTER_X+0 -W3LabelY=SCREEN_CENTER_Y-36+29*2 -W3LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*2;decelerate,0.3;addy,-SCREEN_HEIGHT -W3LabelOffCommand=sleep,0.7-0.1*2;accelerate,0.3;addy,SCREEN_HEIGHT - -W3NumberP1X=SCREEN_CENTER_X-100 -W3NumberP1Y=SCREEN_CENTER_Y-36+29*2 -W3NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,SCREEN_WIDTH/2 -W3NumberP1OffCommand=sleep,0.7-0.1*2;accelerate,0.3;addx,-SCREEN_WIDTH/2 -W3NumberP2X=SCREEN_CENTER_X+100 -W3NumberP2Y=SCREEN_CENTER_Y-36+29*2 -W3NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,-SCREEN_WIDTH/2 -W3NumberP2OffCommand=sleep,0.7-0.1*2;accelerate,0.3;addx,SCREEN_WIDTH/2 - -W4LabelX=SCREEN_CENTER_X+0 -W4LabelY=SCREEN_CENTER_Y-36+29*3 -W4LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*3;decelerate,0.3;addy,-SCREEN_HEIGHT -W4LabelOffCommand=sleep,0.7-0.1*3;accelerate,0.3;addy,SCREEN_HEIGHT - -W4NumberP1X=SCREEN_CENTER_X-100 -W4NumberP1Y=SCREEN_CENTER_Y-36+29*3 -W4NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,SCREEN_WIDTH/2 -W4NumberP1OffCommand=sleep,0.7-0.1*3;accelerate,0.3;addx,-SCREEN_WIDTH/2 -W4NumberP2X=SCREEN_CENTER_X+100 -W4NumberP2Y=SCREEN_CENTER_Y-36+29*3 -W4NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,-SCREEN_WIDTH/2 -W4NumberP2OffCommand=sleep,0.7-0.1*3;accelerate,0.3;addx,SCREEN_WIDTH/2 - -W5LabelX=SCREEN_CENTER_X -W5LabelY=SCREEN_CENTER_Y-36+29*4 -W5LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*4;decelerate,0.3;addy,-SCREEN_HEIGHT -W5LabelOffCommand=sleep,0.7-0.1*4;accelerate,0.3;addy,SCREEN_HEIGHT - -W5NumberP1X=SCREEN_CENTER_X-100 -W5NumberP1Y=SCREEN_CENTER_Y-36+29*4 -W5NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,SCREEN_WIDTH/2 -W5NumberP1OffCommand=sleep,0.7-0.1*4;accelerate,0.3;addx,-SCREEN_WIDTH/2 -W5NumberP2X=SCREEN_CENTER_X+100 -W5NumberP2Y=SCREEN_CENTER_Y-36+29*4 -W5NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,-SCREEN_WIDTH/2 -W5NumberP2OffCommand=sleep,0.7-0.1*4;accelerate,0.3;addx,SCREEN_WIDTH/2 - -HeldLabelX= -HeldLabelY= -HeldLabelOnCommand= -HeldLabelOffCommand= - -HeldNumberP1X= -HeldNumberP1Y= -HeldNumberP1OnCommand= -HeldNumberP1OffCommand= -HeldNumberP2X= -HeldNumberP2Y= -HeldNumberP2OnCommand= -HeldNumberP2OffCommand= - -MissLabelX=SCREEN_CENTER_X+0 -MissLabelY=SCREEN_CENTER_Y-36+29*5 -MissLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*5;decelerate,0.3;addy,-SCREEN_HEIGHT -MissLabelOffCommand=sleep,0.7-0.1*5;accelerate,0.3;addy,SCREEN_HEIGHT - -MissNumberP1X=SCREEN_CENTER_X-100 -MissNumberP1Y=SCREEN_CENTER_Y-36+29*5 -MissNumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*5;decelerate,0.3;addx,SCREEN_WIDTH/2 -MissNumberP1OffCommand=sleep,0.7-0.1*5;accelerate,0.3;addx,-SCREEN_WIDTH/2 -MissNumberP2X=SCREEN_CENTER_X+100 -MissNumberP2Y=SCREEN_CENTER_Y-36+29*5 -MissNumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*5;decelerate,0.3;addx,-SCREEN_WIDTH/2 -MissNumberP2OffCommand=sleep,0.7-0.1*5;accelerate,0.3;addx,SCREEN_WIDTH/2 - -MaxComboMaxDigits=5 -MaxComboLabelX=SCREEN_CENTER_X+0 -MaxComboLabelY=SCREEN_CENTER_Y-36+29*6 -MaxComboLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*6;decelerate,0.3;addy,-SCREEN_HEIGHT -MaxComboLabelOffCommand=sleep,0.7-0.1*6;accelerate,0.3;addy,SCREEN_HEIGHT - -MaxComboNumberP1X=SCREEN_CENTER_X-100 -MaxComboNumberP1Y=SCREEN_CENTER_Y-36+29*6 -MaxComboNumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*6;decelerate,0.3;addx,SCREEN_WIDTH/2 -MaxComboNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -MaxComboNumberP2X=SCREEN_CENTER_X+100 -MaxComboNumberP2Y=SCREEN_CENTER_Y-36+29*6 -MaxComboNumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*6;decelerate,0.3;addx,-SCREEN_WIDTH/2 -MaxComboNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -ScoreLabelX=SCREEN_CENTER_X+0 -ScoreLabelY=SCREEN_CENTER_Y+178 -ScoreLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.8;decelerate,0.3;addy,-SCREEN_HEIGHT -ScoreLabelOffCommand=sleep,0.0;accelerate,0.3;addy,SCREEN_HEIGHT -ScoreNumberP1X=SCREEN_CENTER_X-212 -ScoreNumberP1Y=SCREEN_CENTER_Y+178 -ScoreNumberP1OnCommand=shadowlength,0;diffuse,PlayerScoreColor("PlayerNumber_P1");addx,-SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,SCREEN_WIDTH/2 -ScoreNumberP1OffCommand=sleep,0.0;accelerate,0.3;addx,-SCREEN_WIDTH/2 -ScoreNumberP2X=SCREEN_CENTER_X+212 -ScoreNumberP2Y=SCREEN_CENTER_Y+178 -ScoreNumberP2OnCommand=shadowlength,0;diffuse,PlayerScoreColor("PlayerNumber_P2");addx,SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,-SCREEN_WIDTH/2 -ScoreNumberP2OffCommand=sleep,0.0;accelerate,0.3;addx,SCREEN_WIDTH/2 - -LargeBannerX=SCREEN_CENTER_X-1 -LargeBannerY=SCREEN_CENTER_Y-106-3 -LargeBannerOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -LargeBannerOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -LargeBannerFrameX=SCREEN_CENTER_X+0 -LargeBannerFrameY=SCREEN_CENTER_Y-106 -LargeBannerFrameOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -LargeBannerFrameOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT - -PlayerOptionsP1X=SCREEN_CENTER_X-70 -PlayerOptionsP1Y=SCREEN_CENTER_Y-182 -PlayerOptionsP1OnCommand=visible,false;halign,0;valign,1;shadowlength,2;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -PlayerOptionsP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -PlayerOptionsP2X=SCREEN_CENTER_X+70 -PlayerOptionsP2Y=SCREEN_CENTER_Y-90 -PlayerOptionsP2OnCommand=visible,false;halign,1;valign,1;shadowlength,2;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -PlayerOptionsP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT - -SurvivedFrameP1X=SCREEN_CENTER_X-224 -SurvivedFrameP1Y=SCREEN_CENTER_Y+16 -SurvivedFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -SurvivedFrameP1OffCommand=linear,0.7;diffusealpha,0 -SurvivedFrameP2X=SCREEN_CENTER_X+224 -SurvivedFrameP2Y=SCREEN_CENTER_Y+16 -SurvivedFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -SurvivedFrameP2OffCommand=linear,0.7;diffusealpha,0 -SurvivedNumberP1X=SCREEN_CENTER_X-224 -SurvivedNumberP1Y=SCREEN_CENTER_Y+0 -SurvivedNumberP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -SurvivedNumberP1OffCommand=linear,0.7;diffusealpha,0 -SurvivedNumberP2X=SCREEN_CENTER_X+224 -SurvivedNumberP2Y=SCREEN_CENTER_Y+0 -SurvivedNumberP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -SurvivedNumberP2OffCommand=linear,0.7;diffusealpha,0 - -TimingDifficultyNumberX=SCREEN_CENTER_X+116 -TimingDifficultyNumberY=SCREEN_CENTER_Y-205 -TimingDifficultyNumberOnCommand=draworder,2;shadowlength,0 -TimingDifficultyNumberOffCommand= -TimingDifficultyFrameX=SCREEN_CENTER_X+114+3 -TimingDifficultyFrameY=SCREEN_CENTER_Y-204+3 -TimingDifficultyFrameOnCommand=draworder,2 -TimingDifficultyFrameOffCommand= - -NumStepsNumberP1X=SCREEN_CENTER_X-204 -NumStepsNumberP1Y=SCREEN_CENTER_Y+52+16*-1 -NumStepsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 -NumStepsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -NumStepsNumberP2X=SCREEN_CENTER_X+240 -NumStepsNumberP2Y=SCREEN_CENTER_Y+52+16*-1 -NumStepsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -NumStepsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -JumpsNumberP1X=SCREEN_CENTER_X-204 -JumpsNumberP1Y=SCREEN_CENTER_Y+52+16*0 -JumpsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 -JumpsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -JumpsNumberP2X=SCREEN_CENTER_X+240 -JumpsNumberP2Y=SCREEN_CENTER_Y+52+16*0 -JumpsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -JumpsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -HoldsNumberP1X=SCREEN_CENTER_X-204 -HoldsNumberP1Y=SCREEN_CENTER_Y+52+16*1 -HoldsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,SCREEN_WIDTH/2 -HoldsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -HoldsNumberP2X=SCREEN_CENTER_X+240 -HoldsNumberP2Y=SCREEN_CENTER_Y+52+16*1 -HoldsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,-SCREEN_WIDTH/2 -HoldsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -MinesNumberP1X=SCREEN_CENTER_X-204 -MinesNumberP1Y=SCREEN_CENTER_Y+52+16*2 -MinesNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,SCREEN_WIDTH/2 -MinesNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -MinesNumberP2X=SCREEN_CENTER_X+240 -MinesNumberP2Y=SCREEN_CENTER_Y+52+16*2 -MinesNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,-SCREEN_WIDTH/2 -MinesNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -HandsNumberP1X=SCREEN_CENTER_X-204 -HandsNumberP1Y=SCREEN_CENTER_Y+52+16*3 -HandsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,SCREEN_WIDTH/2 -HandsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -HandsNumberP2X=SCREEN_CENTER_X+240 -HandsNumberP2Y=SCREEN_CENTER_Y+52+16*3 -HandsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,-SCREEN_WIDTH/2 -HandsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -RollsNumberP1X=SCREEN_CENTER_X-204 -RollsNumberP1Y=SCREEN_CENTER_Y+52+16*4 -RollsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,SCREEN_WIDTH/2 -RollsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 -RollsNumberP2X=SCREEN_CENTER_X+240 -RollsNumberP2Y=SCREEN_CENTER_Y+52+16*4 -RollsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,-SCREEN_WIDTH/2 -RollsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 - -StepsDisplayP1X=SCREEN_CENTER_X-230 -StepsDisplayP1Y=SCREEN_CENTER_Y+150 -StepsDisplayP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT;draworder,100; -StepsDisplayP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -StepsDisplayP2X=SCREEN_CENTER_X+230 -StepsDisplayP2Y=SCREEN_CENTER_Y+150 -StepsDisplayP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT;draworder,100; -StepsDisplayP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT - -DetailFrameP1X=SCREEN_CENTER_X-222 -DetailFrameP1Y=SCREEN_CENTER_Y+50 -DetailFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -DetailFrameP1OffCommand=linear,0.7;diffusealpha,0 -DetailFrameP2X=SCREEN_CENTER_X+222 -DetailFrameP2Y=SCREEN_CENTER_Y+50 -DetailFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -DetailFrameP2OffCommand=linear,0.7;diffusealpha,0 - -BonusFrameP1X=SCREEN_CENTER_X-222 -BonusFrameP1Y=SCREEN_CENTER_Y+50 -BonusFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -BonusFrameP1OffCommand=linear,0.7;diffusealpha,0 -BonusFrameP2X=SCREEN_CENTER_X+222 -BonusFrameP2Y=SCREEN_CENTER_Y+50 -BonusFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -BonusFrameP2OffCommand=linear,0.7;diffusealpha,0 - -BarPossible1P1X=SCREEN_CENTER_X-142 -BarPossible1P1Y=SCREEN_CENTER_Y-55 -BarPossible1P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.2;linear,1.0;zoomx,1 -BarPossible1P1OffCommand=linear,0.7;diffusealpha,0 -BarPossible1P2X=SCREEN_CENTER_X+148 -BarPossible1P2Y=SCREEN_CENTER_Y-55 -BarPossible1P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.2;linear,1.0;zoomx,1 -BarPossible1P2OffCommand=linear,0.7;diffusealpha,0 - -BarPossible2P1X=SCREEN_CENTER_X-142 -BarPossible2P1Y=SCREEN_CENTER_Y-33 -BarPossible2P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.3;linear,1.0;zoomx,1 -BarPossible2P1OffCommand=linear,0.7;diffusealpha,0 -BarPossible2P2X=SCREEN_CENTER_X+148 -BarPossible2P2Y=SCREEN_CENTER_Y-33 -BarPossible2P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.3;linear,1.0;zoomx,1 -BarPossible2P2OffCommand=linear,0.7;diffusealpha,0 - -BarPossible3P1X=SCREEN_CENTER_X-142 -BarPossible3P1Y=SCREEN_CENTER_Y-8 -BarPossible3P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.4;linear,1.0;zoomx,1 -BarPossible3P1OffCommand=linear,0.7;diffusealpha,0 -BarPossible3P2X=SCREEN_CENTER_X+148 -BarPossible3P2Y=SCREEN_CENTER_Y-8 -BarPossible3P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.4;linear,1.0;zoomx,1 -BarPossible3P2OffCommand=linear,0.7;diffusealpha,0 - -BarPossible4P1X=SCREEN_CENTER_X-142 -BarPossible4P1Y=SCREEN_CENTER_Y+14 -BarPossible4P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 -BarPossible4P1OffCommand=linear,0.7;diffusealpha,0 -BarPossible4P2X=SCREEN_CENTER_X+148 -BarPossible4P2Y=SCREEN_CENTER_Y+14 -BarPossible4P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 -BarPossible4P2OffCommand=linear,0.7;diffusealpha,0 - -BarPossible5P1X=SCREEN_CENTER_X-142 -BarPossible5P1Y=SCREEN_CENTER_Y+36 -BarPossible5P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.6;linear,1.0;zoomx,1 -BarPossible5P1OffCommand=linear,0.7;diffusealpha,0 -BarPossible5P2X=SCREEN_CENTER_X+148 -BarPossible5P2Y=SCREEN_CENTER_Y+36 -BarPossible5P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.6;linear,1.0;zoomx,1 -BarPossible5P2OffCommand=linear,0.7;diffusealpha,0 - -BarActual1P1X=SCREEN_CENTER_X-142 -BarActual1P1Y=SCREEN_CENTER_Y-55 -BarActual1P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.7;linear,1.0;zoomx,1 -BarActual1P1OffCommand=linear,0.7;diffusealpha,0 -BarActual1P2X=SCREEN_CENTER_X+148 -BarActual1P2Y=SCREEN_CENTER_Y-55 -BarActual1P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.7;linear,1.0;zoomx,1 -BarActual1P2OffCommand=linear,0.7;diffusealpha,0 - -BarActual2P1X=SCREEN_CENTER_X-142 -BarActual2P1Y=SCREEN_CENTER_Y-33 -BarActual2P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.8;linear,1.0;zoomx,1 -BarActual2P1OffCommand=linear,0.7;diffusealpha,0 -BarActual2P2X=SCREEN_CENTER_X+148 -BarActual2P2Y=SCREEN_CENTER_Y-33 -BarActual2P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.8;linear,1.0;zoomx,1 -BarActual2P2OffCommand=linear,0.7;diffusealpha,0 - -BarActual3P1X=SCREEN_CENTER_X-142 -BarActual3P1Y=SCREEN_CENTER_Y-8 -BarActual3P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.9;linear,1.0;zoomx,1 -BarActual3P1OffCommand=linear,0.7;diffusealpha,0 -BarActual3P2X=SCREEN_CENTER_X+148 -BarActual3P2Y=SCREEN_CENTER_Y-8 -BarActual3P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.9;linear,1.0;zoomx,1 -BarActual3P2OffCommand=linear,0.7;diffusealpha,0 - -BarActual4P1X=SCREEN_CENTER_X-142 -BarActual4P1Y=SCREEN_CENTER_Y+14 -BarActual4P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 -BarActual4P1OffCommand=linear,0.7;diffusealpha,0 -BarActual4P2X=SCREEN_CENTER_X+148 -BarActual4P2Y=SCREEN_CENTER_Y+14 -BarActual4P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 -BarActual4P2OffCommand=linear,0.7;diffusealpha,0 - -BarActual5P1X=SCREEN_CENTER_X-142 -BarActual5P1Y=SCREEN_CENTER_Y+36 -BarActual5P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.1;linear,1.0;zoomx,1 -BarActual5P1OffCommand=linear,0.7;diffusealpha,0 -BarActual5P2X=SCREEN_CENTER_X+148 -BarActual5P2Y=SCREEN_CENTER_Y+36 -BarActual5P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.1;linear,1.0;zoomx,1 -BarActual5P2OffCommand=linear,0.7;diffusealpha,0 - -ShowGraphDisplay=true -GraphDisplayP1X=SCREEN_CENTER_X-222 -GraphDisplayP1Y=SCREEN_CENTER_Y-16 -GraphDisplayP1OnCommand=draworder,1 -GraphDisplayP1OffCommand=linear,0.7;addx,-400 -GraphDisplayP2X=SCREEN_CENTER_X+222 -GraphDisplayP2Y=SCREEN_CENTER_Y-16 -GraphDisplayP2OnCommand=draworder,1 -GraphDisplayP2OffCommand=linear,0.7;addx,400 - -ShowComboGraph=true -ComboGraphP1X=SCREEN_CENTER_X-222 -ComboGraphP1Y=SCREEN_CENTER_Y+10 -ComboGraphP1OnCommand=draworder,1 -ComboGraphP1OffCommand=linear,0.7;addx,-400 -ComboGraphP2X=SCREEN_CENTER_X+222 -ComboGraphP2Y=SCREEN_CENTER_Y+10 -ComboGraphP2OnCommand=draworder,1 -ComboGraphP2OffCommand=linear,0.7;addx,400 - -StageAwardP1X=SCREEN_CENTER_X-222 -StageAwardP1Y=SCREEN_CENTER_Y-32 -StageAwardP1OnCommand=draworder,1 -StageAwardP1OffCommand=linear,0.7;addx,-400 -StageAwardP2X=SCREEN_CENTER_X+222 -StageAwardP2Y=SCREEN_CENTER_Y-32 -StageAwardP2OnCommand=draworder,1 -StageAwardP2OffCommand=linear,0.7;addx,400 - -ModIconRowP1X=SCREEN_CENTER_X-316 -ModIconRowP1Y=SCREEN_CENTER_Y -ModIconRowP1OnCommand=draworder,1;player,"PlayerNumber_P1";addx,-200;linear,0.5;addx,200 -ModIconRowP1OffCommand=linear,0.5;addx,-200 -ModIconRowP2X=SCREEN_CENTER_X+316 -ModIconRowP2Y=SCREEN_CENTER_Y -ModIconRowP2OnCommand=draworder,1;player,"PlayerNumber_P2";addx,200;linear,0.5;addx,-200 -ModIconRowP2OffCommand=linear,0.5;addx,200 - -ItsARecordP1X=SCREEN_CENTER_X-72 -ItsARecordP1Y=SCREEN_CENTER_Y+185 -ItsARecordP1OnCommand=shadowlength,0;diffusealpha,0;zoom,3;linear,0.5;diffusealpha,1;zoom,1 -ItsARecordP1OffCommand=linear,0.5;diffusealpha,0 -ItsARecordP2X=SCREEN_CENTER_X+72 -ItsARecordP2Y=SCREEN_CENTER_Y+185 -ItsARecordP2OnCommand=shadowlength,0;diffusealpha,0;zoom,3;linear,0.5;diffusealpha,1;zoom,1 -ItsARecordP2OffCommand=linear,0.5;diffusealpha,1 - -TryExtraStageX=SCREEN_CENTER_X+0 -TryExtraStageY=SCREEN_CENTER_Y-164 -TryExtraStageOnCommand=draworder,1;diffusealpha,0;linear,0.7;diffusealpha,1;glowshift -TryExtraStageOffCommand=linear,0.7;diffusealpha,0 - -BarActualMaxCommand=glowshift;effectperiod,0.5 - -CheerDelaySeconds=2.5 - -[ScreenNetEvaluation] -Class="ScreenNetEvaluation" -Fallback="ScreenEvaluationStage" -NextScreen=ScreenBranchNetAfterEval() -# Players background -UsersBG1Y=SCREEN_CENTER_Y+0 -UsersBG1X=SCREEN_CENTER_X-180 -UsersBG2Y=SCREEN_CENTER_Y+0 -UsersBG2X=SCREEN_CENTER_X+180 -UsersBGWidth=260 -UsersBGHeight=400 -UsersBGCommand=diffuse,0.4,0.1,0.4,0.5 -UsersBGOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomx,1.0;zoomy,1.0 -UsersBGOffCommand=zoomx,1.0;zoomy,1.0;linear,0.5;zoomx,0.0;zoomy,0.0 -# Players list -User1Y=SCREEN_CENTER_Y-160 -User1X=SCREEN_CENTER_X-180 -User2Y=SCREEN_CENTER_Y-160 -User2X=SCREEN_CENTER_X+180 -UserDX=0 -UserDY=SCREEN_CENTER_Y-208 -UserOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomx,1.0;zoomy,1.0 -UserOffCommand=zoomx,1.0;zoomy,1.0;linear,0.5;zoomx,0.0;zoomy,0.0 -UserDeSelCommand=zoomx,1.4;zoomy,1.4;linear,0.1;zoomx,1.0;zoomy,1.0 -UserSelCommand=zoomx,1.0;zoomy,1.0;linear,0.1;zoomx,1.4;zoomy,1.4 - -[ScreenEvaluationStage] -Fallback="ScreenEvaluation" -NextScreen=GetEvaluationNextScreen() -ShowGradeArea=true -ShowPointsArea=false -ShowDetailArea=true -ShowBonusArea=false -ShowSurvivedArea=false -ShowWinArea=false -ShowScoreArea=true -ShowTimeArea=false -ShowStageDisplay=true -ShowStageFrame=true -ShowModIconRows=true -ShowStepsDisplay=true -ShowItsARecord=true -ShowStageAward=true - -[ScreenEvaluationSummary] -Fallback="ScreenEvaluationStage" -NextScreen=GetEvaluationSummaryNextScreen() -Summary=true -ShowTimeArea=false - -SmallBanner1X=SCREEN_CENTER_X-60 -SmallBanner1Y=SCREEN_CENTER_Y-160 -SmallBanner1OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -SmallBanner1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -SmallBanner2X=SCREEN_CENTER_X-30 -SmallBanner2Y=SCREEN_CENTER_Y-150 -SmallBanner2OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -SmallBanner2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -SmallBanner3X=SCREEN_CENTER_X+0 -SmallBanner3Y=SCREEN_CENTER_Y-140 -SmallBanner3OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -SmallBanner3OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -SmallBanner4X=SCREEN_CENTER_X+30 -SmallBanner4Y=SCREEN_CENTER_Y-130 -SmallBanner4OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -SmallBanner4OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -SmallBanner5X=SCREEN_CENTER_X+60 -SmallBanner5Y=SCREEN_CENTER_Y-120 -SmallBanner5OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -SmallBanner5OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -CategoryRecordP1X=SCREEN_CENTER_X-186 -CategoryRecordP1Y=SCREEN_CENTER_Y+158 -CategoryRecordP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1;glowshift -CategoryRecordP1OffCommand=linear,0.7;diffusealpha,0 -CategoryRecordP2X=SCREEN_CENTER_X+186 -CategoryRecordP2Y=SCREEN_CENTER_Y+158 -CategoryRecordP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1;glowshift -CategoryRecordP2OffCommand=linear,0.7;diffusealpha,0 - -[ScreenEvaluationNonstop] -Fallback="ScreenEvaluation" -NextScreen=GetEvaluationNextScreen() -ShowGradeArea=true -ShowPointsArea=false -ShowBonusArea=false -ShowDetailArea=false -ShowSurvivedArea=true -ShowWinArea=false -ShowScoreArea=true -ShowTimeArea=false -ShowStageDisplay=false -ShowStageFrame=false - -[ScreenEvaluationOni] -Fallback="ScreenEvaluation" -NextScreen=GetEvaluationNextScreen() -ShowGradeArea=false -ShowPointsArea=true -ShowBonusArea=false -ShowDetailArea=false -ShowSurvivedArea=true -ShowWinArea=false -ShowScoreArea=false -ShowTimeArea=true -ShowStageDisplay=false -ShowStageFrame=false -PercentFrameP1X=SCREEN_CENTER_X-226 -PercentFrameP1Y=SCREEN_CENTER_Y-140 -PercentFrameP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 -PercentFrameP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 -PercentFrameP2X=SCREEN_CENTER_X+226 -PercentFrameP2Y=SCREEN_CENTER_Y-140 -PercentFrameP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -PercentFrameP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 -PercentP1X=SCREEN_CENTER_X-200 -PercentP1Y=SCREEN_CENTER_Y-108 -PercentP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 -PercentP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 -PercentP2X=SCREEN_CENTER_X+252 -PercentP2Y=SCREEN_CENTER_Y-108 -PercentP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 -PercentP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 -TimeLabelX=SCREEN_CENTER_X+0 -TimeLabelY=SCREEN_CENTER_Y+140 -TimeLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.8;decelerate,0.3;addy,-SCREEN_HEIGHT -TimeLabelOffCommand=sleep,0.0;accelerate,0.3;addy,SCREEN_HEIGHT -TimeNumberP1X=SCREEN_CENTER_X-160 -TimeNumberP1Y=SCREEN_CENTER_Y+140 -TimeNumberP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,SCREEN_WIDTH/2 -TimeNumberP1OffCommand=sleep,0.0;accelerate,0.3;addx,-SCREEN_WIDTH/2 -TimeNumberP2X=SCREEN_CENTER_X+160 -TimeNumberP2Y=SCREEN_CENTER_Y+140 -TimeNumberP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,-SCREEN_WIDTH/2 -TimeNumberP2OffCommand=sleep,0.0;accelerate,0.3;addx,SCREEN_WIDTH/2 - -[ScreenEvaluationEndless] -Fallback="ScreenEvaluationOni" -NextScreen=GetEvaluationNextScreen() - -[ScreenEvaluationRave] -Fallback="ScreenEvaluation" -NextScreen=GetEvaluationNextScreen() -ShowGradeArea=true -ShowPointsArea=false -ShowBonusArea=false -ShowDetailArea=false -ShowSurvivedArea=false -ShowWinArea=true -ShowScoreArea=true -ShowTimeArea=false -FailedSoundTime=0 -PassedSoundTime=0 -ShowStageDisplay=true -ShowStageFrame=true -StageDisplayX=SCREEN_CENTER_X+0 -StageDisplayY=SCREEN_CENTER_Y-168 -StageDisplayOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -StageDisplayOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -DifficultyIconP1X=SCREEN_CENTER_X-106 -DifficultyIconP1Y=SCREEN_CENTER_Y-160 -DifficultyIconP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -DifficultyIconP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -DifficultyIconP2X=SCREEN_CENTER_X+106 -DifficultyIconP2Y=SCREEN_CENTER_Y-160 -DifficultyIconP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -DifficultyIconP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -StepsDisplayP1X=SCREEN_CENTER_X-106 -StepsDisplayP1Y=SCREEN_CENTER_Y-160 -StepsDisplayP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -StepsDisplayP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -StepsDisplayP2X=SCREEN_CENTER_X+106 -StepsDisplayP2Y=SCREEN_CENTER_Y-160 -StepsDisplayP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT -StepsDisplayP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT -WinFrameP1X=SCREEN_CENTER_X-224 -WinFrameP1Y=SCREEN_CENTER_Y+16 -WinFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -WinFrameP1OffCommand=linear,0.7;diffusealpha,0 -WinFrameP2X=SCREEN_CENTER_X+224 -WinFrameP2Y=SCREEN_CENTER_Y+16 -WinFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -WinFrameP2OffCommand=linear,0.7;diffusealpha,0 -WinP1X=SCREEN_CENTER_X-224 -WinP1Y=SCREEN_CENTER_Y+16 -WinP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -WinP1OffCommand=linear,0.7;diffusealpha,0 -WinP2X=SCREEN_CENTER_X+224 -WinP2Y=SCREEN_CENTER_Y+16 -WinP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 -WinP2OffCommand=linear,0.7;diffusealpha,0 - -[MultiplayerEvalScoreRow] -NumberOnCommandFunction= - -[EditMenu] -EditMode="EditMode_Full" -ShowGroups=true -Arrows1X=SCREEN_CENTER_X-130 -Arrows2X=SCREEN_CENTER_X+270 -ArrowsEnabledCommand=diffuse,1,1,1,1 -ArrowsDisabledCommand=diffuse,0.2,0.2,0.2,1 -SongBannerX=SCREEN_CENTER_X+170 -SongBannerY=SCREEN_CENTER_Y-90 -SongBannerWidth=130 -SongBannerHeight=40 -SongTextBannerX=SCREEN_CENTER_X-30 -SongTextBannerY=SCREEN_CENTER_Y-90 -GroupBannerX=SCREEN_CENTER_X+170 -GroupBannerY=SCREEN_CENTER_Y-140 -GroupBannerWidth=130 -GroupBannerHeight=40 -StepsDisplayX=SCREEN_CENTER_X+170 -StepsDisplayY=SCREEN_CENTER_Y-0 -StepsDisplaySourceX=SCREEN_CENTER_X+170 -StepsDisplaySourceY=SCREEN_CENTER_Y+80 -RowLabelsX=SCREEN_CENTER_X-250 -RowLabelOnCommand=shadowlength,2; -RowValue1X=SCREEN_CENTER_X -RowValue2X=SCREEN_CENTER_X+60 -RowValue3X=SCREEN_CENTER_X+60 -RowValue4X=SCREEN_CENTER_X -RowValue5X=SCREEN_CENTER_X+60 -RowValue6X=SCREEN_CENTER_X -RowValue7X=SCREEN_CENTER_X+60 -RowValueOnCommand=shadowlength,2; -Row1Y=SCREEN_CENTER_Y-140 -Row2Y=SCREEN_CENTER_Y-90 -Row3Y=SCREEN_CENTER_Y-40 -Row4Y=SCREEN_CENTER_Y-0 -Row5Y=SCREEN_CENTER_Y+40 -Row6Y=SCREEN_CENTER_Y+80 -Row7Y=SCREEN_CENTER_Y+120 - -[ScreenEditMenu] -Fallback="ScreenWithMenuElements" -Class="ScreenEditMenu" -NextScreen="ScreenEdit" -PrevScreen="ScreenOptionsEdit" -EditMenuType="EditMenu" -ExplanationX=SCREEN_CENTER_X -ExplanationY=SCREEN_BOTTOM-56 -ExplanationOnCommand=wrapwidthpixels,600;shadowlength,0; -NumStepsLoadedFromProfileX=SCREEN_RIGHT-180 -NumStepsLoadedFromProfileY=SCREEN_TOP+42 -NumStepsLoadedFromProfileOnCommand=visible,false -ShowStyleIcon=false -TimerSeconds=-1 -HelpText=ScreenString("HelpTextOptionsAndBack") - -[ScreenJukeboxMenu] -Class="ScreenOptionsMaster" -Fallback="ScreenOptions" -NextScreen="ScreenJukebox" -PrevScreen=ScreenTitleBranch() -ShowStyleIcon=false -TimerSeconds=-1 -InputMode="together" -ForceAllPlayers=true -LineNames="1,2,3,4" -Line1="list,Styles" -Line2="list,Groups" -Line3="list,Difficulties" -Line4="lua,OptionsRandomJukebox()" -Line4Old="list,RandomModifiers" - -[ScreenSystemLayer] -Fallback="Screen" -Class="ScreenSystemLayer" -CreditsJoinOnly=false -CreditsP1X=SCREEN_CENTER_X-230 -CreditsP1Y=SCREEN_BOTTOM-10 -CreditsP2X=SCREEN_CENTER_X+230 -CreditsP2Y=SCREEN_BOTTOM-10 -CreditsInitCommand=shadowlength,0;strokecolor,color("#000000AA"); - -[ScreenDebugOverlay] -Class="ScreenDebugOverlay" -Fallback="Screen" - -############################################ REMOVE ME ######################### -DebugMenuHeaderX=SCREEN_LEFT+20 -DebugMenuHeaderY=SCREEN_TOP+20 -DebugMenuHeaderOnCommand=halign,0 - -LineOnColor=color("1,1,1,1") -LineOffColor=color("0.6,0.6,0.6,1") - -PageTextGainFocusCommand=diffuse,color("1,1,1,1") -PageTextLoseFocusCommand=diffuse,color("0.6,0.6,0.6,1") -############################################ REMOVE ME ######################### - -[ScreenSyncOverlay] -Class="ScreenSyncOverlay" -Fallback="Screen" -StatusOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+150;shadowlength,2;strokecolor,color("#000000"); -AdjustmentsOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y; - -[ScreenStatsOverlay] -Class="ScreenStatsOverlay" -Fallback="Screen" -StatsX=SCREEN_RIGHT-8 -StatsY=SCREEN_TOP+10 -StatsOnCommand=halign,1;valign,0;shadowlength,1 -ShowSkips=true -SkipX=SCREEN_RIGHT-100 -SkipY=SCREEN_BOTTOM-100 -SkipWidth=190 -SkipSpacingY=14 - -[MusicWheelItem] -WheelNotifyIconX=106 -WheelNotifyIconY=0 -WheelNotifyIconOnCommand= -SongNameX=-30 -SongNameY=0 -SongNameOnCommand= -SectionExpandedX=-18 -SectionExpandedY=-2 -SectionExpandedOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 -SectionCollapsedX=-18 -SectionCollapsedY=-2 -SectionCollapsedOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 -SectionCountX=105 -SectionCountY=0 -SectionCountOnCommand=diffuse,color("#8e8b3f");shadowlength,0 -RouletteX=-0 -RouletteY=-2 -RouletteOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 -CourseX=0 -CourseY=-2 -CourseOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 -SortX=0 -SortY=-2 -SortOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 -ModeX=0 -ModeY=-2 -ModeOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 -GradeP1X=106 -GradeP1Y=-5 -GradeP2X=110 -GradeP2Y=5 -GradesShowMachine=true -# added for sm-ssc: -RandomX=-0 -RandomY=-2 -RandomOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 -PortalX=-0 -PortalY=-2 -PortalOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 - -[WheelNotifyIcon] -ShowTraining=true - -[MusicWheel] -FadeSeconds=1 -SwitchSeconds=0.10 -RandomPicksLockedSongs=true -RouletteSwitchSeconds=0.05 -RouletteSlowDownSwitches=5 -LockedInitialVelocity=7 -ScrollBarHeight=300 -ScrollBarOnCommand=x,-142;y,10 -; linear wheel example: -; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ -; self:y(offsetFromCenter*38); \ -; end; -; 3D wheel example: -; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ -; local curve = math.pi; \ -; local WHEEL_3D_RADIUS = 245; \ -; local rotationx_radians = scale(offsetFromCenter,-numItems/2,numItems/2,-curve/2,curve/2); \ -; self:x( 0 - math.cos(offsetFromCenter/math.pi) ); \ -; self:y( WHEEL_3D_RADIUS * math.sin(rotationx_radians) ); \ -; self:z( -100 + WHEEL_3D_RADIUS * math.cos(rotationx_radians) ); \ -; self:rotationx( rotationx_radians * 180/math.pi ); --[[ to degrees end]] \ -; end; -ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*38 ); end -NumWheelItems=11 -MusicWheelSortOnCommand= -MusicWheelSortOffCommand= -MusicWheelItemSortOnCommand=addx,-SCREEN_WIDTH/2;accelerate,0.2;addx,SCREEN_WIDTH/2 -MusicWheelItemSortOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 -HighlightOnCommand=glowshift;effectcolor1,color("#00C0FF00");effectcolor2,color("#00C0FF7F");effectclock,"bgm";addx,-SCREEN_WIDTH/2;sleep,0.05;accelerate,0.4;addx,SCREEN_WIDTH/2 -HighlightOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 -HighlightSortOnCommand=accelerate,0.2;addx,SCREEN_WIDTH/2 -HighlightSortOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 -WheelItemOnDelayOffset=0.04 -WheelItemOffDelayOffset=0.04 -WheelItemLockedColor=color("0,0,0,0.5") -NumSectionColors=7 -SectionColor1=color("0.8,0.1,0.6,1") -- pink -SectionColor2=color("0.6,0.4,0.8,1") -- purple -SectionColor3=color("0.0,0.4,0.8,1") -- sky blue -SectionColor4=color("0.0,0.6,0.6,1") -- sea green -SectionColor5=color("0.1,0.7,0.3,1") -- green -SectionColor6=color("0.8,0.6,0.0,1") -- orange -SectionColor7=color("1.0,0.3,0.3,1") -- light red -SongRealExtraColor=color("0.9,0.9,0,1") -- yellow -SortMenuColor=color("1,1,0,1") -SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Popularity", "SortOrder_Artist", "SortOrder_Genre" } -ShowRoulette=true -ShowRandom=false -ShowPortal=false -MostPlayedSongsToShow=30 -ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,Genre,Length" -ChoicePreferred="sort,Preferred" -ChoiceGroup="sort,Group" -ChoiceTitle="sort,Title" -ChoiceBpm="sort,BPM" -ChoicePopularity="sort,Popularity" -ChoiceTopGrades="sort,TopGrades" -ChoiceArtist="sort,Artist" -ChoiceGenre="sort,Genre" -ChoiceEasyMeter="sort,EasyMeter" -ChoiceMediumMeter="sort,MediumMeter" -ChoiceHardMeter="sort,HardMeter" -ChoiceLength="sort,Length" -UseEasyMarkerFlag=false -# added for sm-ssc -UseSectionsWithPreferredGroup=false - -[RoomWheel] -Fallback="MusicWheel" -RoomWheelItemStartOnCommand= -RoomWheelItemFinishOnCommand= -CreateRoomColor=color("0.0,0.9,0.25,1.0") -ScrollBarOnCommand=visible,false - -[RoomInfoDisplay] -RoomInfoDisplayOnCommand=diffuse,1.0,1.0,1.0,1.0;x,SCREEN_WIDTH+130;y,250;bounceend,0.5;x,SCREEN_WIDTH-160 -RoomInfoDisplayOffCommand=x,SCREEN_WIDTH-160;y,250;bouncebegin,0.5;x,SCREEN_WIDTH+130 -DeployDelay=1.5 -RetractDelay=5 -RoomTitleOnCommand=x,-120;y,-140;zoom,0.75 -RoomDescOnCommand=x,-120;y,-129;zoom,0.75 -LastRoundOnCommand=x,-120;y,-107;zoom,0.75 -SongTitleOnCommand=x,-110;y,-96;zoom,0.75 -SongSubTitleOnCommand=x,-110;y,-85;zoom,0.75 -SongArtistOnCommand=x,-110;y,-74;zoom,0.75 -PlayersOnCommand=x,-120;y,-52;zoom,0.75 -PlayerListElementX=-110 -PlayerListElementY=-41 -PlayerListElementOffsetX=0 -PlayerListElementOffsetY=11 -PlayerListElementOnCommand=zoom,0.75 - -[RoomWheelItem] -TextOnCommand=zoom,0.6;strokecolor,color("#000000FF") -TextX=-110 -TextY=-8 -TextWidth=200 -DescX=-100 -DescY=6 -DescOnCommand=zoom,0.4;strokecolor,color("#000000FF") -DescWidth=400 - -[LifeMeterBar] -DangerThreshold=0.2 -InitialValue=0.5 -HotValue=1.0 -LifeMultiplier=1.0 -MinStayAlive="TapNoteScore_W3" -LifePercentChangeW1=0.008 -LifePercentChangeW2=0.008 -LifePercentChangeW3=0.004 -LifePercentChangeW4=0.000 -LifePercentChangeW5=-0.040 -LifePercentChangeMiss=-0.080 -LifePercentChangeHitMine=-0.160 -LifePercentChangeHeld=0.008 -LifePercentChangeLetGo=-0.080 -LifePercentChangeCheckpointMiss=-0.002 -LifePercentChangeCheckpointHit=0.002 -UnderX=0 -UnderY=0 -DangerX=0 -DangerY=0 -StreamX=0 -StreamY=0 -OverX=0 -OverY=0 - -[LifeMeterTime] -MeterWidth=232 -MeterHeight=24 -Fallback="LifeMeterBar" - -[StepsDisplay] -FrameX=0 -FrameY=0 -FrameOnCommand= -FrameLoadCommand=%function(self,param) local bFlip = param.PlayerState and param.PlayerState:GetPlayerNumber() ~= PLAYER_1; self:zoomx(bFlip and -1 or 1); end -FrameSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) end end -NumTicks=10 -MaxTicks=14 -TicksX=0 -TicksY=0 -TicksOnCommand=shadowlength,0;stroke -TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end -ShowTicks=false -ShowMeter=true -ZeroMeterString="?" -MeterX=30 -MeterY=0 -MeterOnCommand=shadowlength,0 -MeterSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowDescription=true -DescriptionX=-10 -DescriptionY=0 -DescriptionOnCommand=shadowlength,0;uppercase,true; -DescriptionSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowAutogen=true -AutogenX=40 -AutogenY=0 -AutogenOnCommand= -AutogenSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end -ShowStepsType=false -StepsTypeX=0 -StepsTypeY=0 -StepsTypeOnCommand= - -[StepsDisplayEdit] -Fallback="StepsDisplay" - -[StepsDisplayListRow] -Fallback="StepsDisplay" -FrameX=0 -FrameY=0 -FrameOnCommand= -ShowTicks=true -NumTicks=13 -MaxTicks=13 -TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end -TicksX=0 -TicksY=0 -TicksOnCommand=shadowlength,0;shadowcolor,color("#FFFFFF"); -ShowMeter=1 -ZeroMeterString="?" -MeterX=92 -MeterY=-1 -MeterOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); -MeterSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end -ShowDescription=true -DescriptionX=-110 -DescriptionY=-1 -DescriptionOnCommand=uppercase,true;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");maxwidth,150; -DescriptionSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end -AutogenX=102 -AutogenOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); -AutogenSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end - -[StepsDisplayGameplay] -Fallback="StepsDisplay" -MeterOnCommand=shadowlength,0; -FrameOnCommand= -ShowAutogen=false -ShowStepsType=false - -[StepsDisplayEvaluation] -Fallback="StepsDisplayGameplay" - -[ScreenWithMenuElements] -Fallback="Screen" -Class="ScreenWithMenuElements" -AllowDisabledPlayerInput=false -ShowStyleIcon=true -ShowStageDisplay=false -StageDisplayX=SCREEN_CENTER_X+234 -StageDisplayY=SCREEN_CENTER_Y-172 -StageDisplayOnCommand=draworder,-2;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -StageDisplayOffCommand=linear,0.5;addx,SCREEN_WIDTH*0.6 -ShowStageFrame=false -StageFrameX=SCREEN_CENTER_X+234 -StageFrameY=SCREEN_CENTER_Y-172 -StageFrameOnCommand=draworder,-2;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -StageFrameOffCommand=linear,0.5;addx,SCREEN_WIDTH*0.6 -MemoryCardIcons=true -CancelTransitionsOut=false -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP+35 -HeaderOnCommand= -HeaderOffCommand= -FooterX=SCREEN_CENTER_X -FooterY=SCREEN_BOTTOM -FooterOnCommand=draworder,-1;valign,1 -FooterOffCommand= -ShowHelp=true -HelpX=SCREEN_CENTER_X -HelpY=SCREEN_BOTTOM-20 -HelpOnCommand=shadowlength,0;strokecolor,color("#4e4e4e");draworder,1;zoomy,0;linear,0.5;zoomy,1;diffuseblink; -HelpOffCommand=linear,0.5;zoomy,0 -MemoryCardDisplayP1X=SCREEN_LEFT+10; -MemoryCardDisplayP1Y=SCREEN_CENTER_Y+220 -MemoryCardDisplayP1OnCommand=draworder,97; -MemoryCardDisplayP1OffCommand= -//MemoryCardDisplayP1OffCommand=bouncebegin,0.5;addx,-25; -MemoryCardDisplayP2X=SCREEN_RIGHT-10; -MemoryCardDisplayP2Y=SCREEN_CENTER_Y+220 -MemoryCardDisplayP2OnCommand=draworder,97; -MemoryCardDisplayP2OffCommand= -//MemoryCardDisplayP2OffCommand=bouncebegin,0.5;addx,25; -TimerMetricsGroup="MenuTimer" -TimerX=SCREEN_CENTER_X+273 -TimerY=SCREEN_TOP+26 -TimerOnCommand=draworder,2;addy,-40;linear,0.25;addy,40 -TimerOffCommand=linear,0.25;addy,-70; -TimerStealth=false -ForceTimer=false -FirstUpdateCommand= -PlayMusic=true -MusicAlignBeat=true -StopMusicOnBack=true -WaitForChildrenBeforeTweeningOut=false -LeftFrameX=SCREEN_CENTER_X-320 -LeftFrameY=SCREEN_CENTER_Y -LeftFrameOnCommand= -LeftFrameOffCommand= -RightFrameX=SCREEN_CENTER_X+320 -RightFrameY=SCREEN_CENTER_Y -RightFrameOnCommand= -RightFrameOffCommand= -StyleIconX=SCREEN_CENTER_X+170 -StyleIconY=SCREEN_CENTER_Y-202 -StyleIconOnCommand=draworder,1 -StyleIconOffCommand= - -[MenuTimer] -WarningStart=6 -WarningBeepStart=5 -MaxStallSeconds=30 -Text1OnCommand=stopeffect;stoptweening;shadowlength,0;zoomx,1;x,-13;y,2 -Text1FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.floor(fSeconds/10); return ""..digit end -Text2OnCommand=stopeffect;stoptweening;shadowlength,0;zoomx,1;x,13;y,2 -Text2FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.mod(fSeconds,10); return ""..digit end -Warning6Command=stoptweening;sleep,0.8;linear,0.2;zoomx,0 -Warning5Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0;glowshift;effectperiod,0.15;effectcolor1,color("1,0,0,0");effectcolor2,color("1,0,0,1") -Warning4Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 -Warning3Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 -Warning2Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 -Warning1Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 -Warning0Command=stoptweening;stopeffect;linear,0.2;zoomx,1 -FrameX=-20 -FrameY=6 -FrameOnCommand= - -[ScreenOptions] -Fallback="ScreenWithMenuElements" -NavigationMode="normal" -InputMode="individual" -ForceAllPlayers=false -RepeatRate=12 -RepeatDelay=0.25 -NumRowsShown=8 -RowInitCommand= -RowOnCommand= -RowOffCommand= -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-146+36*offsetFromCenter) end -ExplanationP1X=SCREEN_CENTER_X-300 -ExplanationP1Y=SCREEN_CENTER_Y+184 -ExplanationP1OnCommand=shadowlength,0;wrapwidthpixels,500;halign,0;cropright,1;linear,0.5;cropright,0 -ExplanationP1OffCommand= -ExplanationP2X=SCREEN_CENTER_X+250 -ExplanationP2Y=SCREEN_CENTER_Y+184 -ExplanationP2OnCommand=shadowlength,0;wrapwidthpixels,500;halign,1;cropright,1;linear,0.5;cropright,0 -ExplanationP2OffCommand= -ExplanationTogetherX=SCREEN_CENTER_X-302 -ExplanationTogetherY=SCREEN_CENTER_Y+184 -ExplanationTogetherOnCommand=shadowlength,0;wrapwidthpixels,600;halign,0;cropright,1;linear,0.5;cropright,0 -ExplanationTogetherOffCommand= -DisqualifyP1X= -DisqualifyP1Y= -DisqualifyP1OnCommand=visible,false -DisqualifyP1OffCommand= -DisqualifyP2X= -DisqualifyP2Y= -DisqualifyP2OnCommand=visible,false -DisqualifyP2OffCommand= -PageX=SCREEN_CENTER_X -PageY=SCREEN_CENTER_Y-2 -PageOnCommand= -ContainerOnCommand=draworder,-1;x,-SCREEN_WIDTH;decelerate,0.5;addx,SCREEN_WIDTH; -ContainerOffCommand=accelerate,0.5;addx,SCREEN_WIDTH; -CursorOnCommand= -LineHighlightOnCommand= -LineHighlightChangeCommand= -LineHighlightChangeToExitCommand= -ShowScrollBar=false -ScrollBarHeight=0 -ScrollBarTime=0 -LineHighlightX=SCREEN_CENTER_X -ShowExitRow=true -SeparateExitRow=true -SeparateExitRowY=SCREEN_CENTER_Y+140 -MoreX= -MoreY= -MoreOnCommand=visible,false -MoreExitSelectedP1Command= -MoreExitSelectedP2Command= -MoreExitUnselectedP1Command= -MoreExitUnselectedP2Command= -ShowExplanations=true -AllowRepeatingChangeValueInput=false -CursorTweenSeconds=0.3 -WrapValueInRow=true -OptionRowNormalMetricsGroup="OptionRow" -OptionRowExitMetricsGroup="OptionRowExit" -HelpText=ScreenString("HelpTextOptions") - -[OptionRow] -ShowModIcons=false -ShowUnderlines=true -ShowBpmInSpeedTitle=false -ModIconP1X=SCREEN_CENTER_X-280 -ModIconP2X=SCREEN_CENTER_X+280 -ModIconOnCommand=x,-30 -FrameX=SCREEN_CENTER_X-222 -FrameY=0 -FrameOnCommand= -TitleX=SCREEN_CENTER_X-222 -TitleY=-2 -TitleOnCommand=shadowlength,0;uppercase,true;wrapwidthpixels,120; -TitleGainFocusCommand=diffuse,color("#fff600");strokecolor,color("#7f6739"); -TitleLoseFocusCommand=diffuse,color("#ffffff");strokecolor,color("#37537d"); -ItemsStartX=SCREEN_CENTER_X-140 -ItemsEndX=SCREEN_CENTER_X+280 -ItemsGapX=14 -ItemsMinBaseZoom=0.6 -ItemsLongRowP1X=SCREEN_CENTER_X-60 -ItemsLongRowP2X=SCREEN_CENTER_X+100 -ItemsLongRowSharedX=SCREEN_CENTER_X+20 -ItemOnCommand=shadowlength,0; -ItemGainFocusCommand= -ItemLoseFocusCommand= -TweenSeconds=0.2 -ModIconMetricsGroup="ModIcon" -ColorSelected=color("1,1,1,1") -ColorNotSelected=color("0.9,0.9,0.9,1") -ColorDisabled=color("0.5,0.5,0.5,1") - -[OptionRowExit] -Fallback="OptionRow" -FrameOnCommand=visible,false -TitleOnCommand=visible,false - -[OptionsCursor] -LeftX= -LeftY= -LeftOnCommand=halign,1; -MiddleX= -MiddleY= -MiddleOnCommand= -RightX= -RightY= -RightOnCommand=halign,0; -CanGoLeftX= -CanGoLeftY= -CanGoLeftOnCommand=halign,1; -CanGoRightX= -CanGoRightY= -CanGoRightOnCommand=halign,0; - -[OptionsCursorP1] -Fallback="OptionsCursor" -LeftX=-4 -MiddleX=-4 -RightX=-4 -LeftY=-4 -MiddleY=-4 -RightY=-4 - -[OptionsCursorP2] -Fallback="OptionsCursor" -LeftX=4 -MiddleX=4 -RightX=4 -LeftY=4 -MiddleY=4 -RightY=4 - -[OptionsUnderline] -Fallback="OptionsCursor" - -[OptionsUnderlineP1] -Fallback="OptionsUnderline" -LeftX=-2 -MiddleX=-2 -RightX=-2 -LeftY=12-2 -MiddleY=12-2 -RightY=12-2 - -[OptionsUnderlineP2] -Fallback="OptionsUnderline" -LeftX=2 -MiddleX=2 -RightX=2 -LeftY=12+2 -MiddleY=12+2 -RightY=12+2 - -[ScreenMapControllers] -Class="ScreenMapControllers" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -HelpText=ScreenString("HelpTextMapControllers") -ButtonsToMap="" -LineScrollerOnCommand=%function(self) self:y(50) self:setsecondsperitem(0.1) self:SetTransformFromHeight(24) end -LineScrollerOffCommand= -LineHideCommand=visible,false -LineOnCommand=%function(self) self:y(0); self:visible(true); local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:addx(SCREEN_WIDTH * LeftToRight); self:decelerate(0.5); self:addx(-SCREEN_WIDTH * LeftToRight); end -LineOffCommand=%function(self) local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:stoptweening() self:accelerate(0.3); self:addx(SCREEN_WIDTH * LeftToRight); self:queuecommand('Hide') end -ErrorX=SCREEN_CENTER_X -ErrorY=SCREEN_CENTER_Y -ErrorOnCommand=diffuse,color("#00FF00");zoom,0.8 -LabelP1OnCommand=x,SCREEN_CENTER_X-195;zoom,0.7;shadowlength,2;diffusealpha,0;linear,0.5;diffusealpha,1 -LabelP1OffCommand=linear,0.5;diffusealpha,0 -LabelP2OnCommand=x,SCREEN_CENTER_X+195;zoom,0.7;shadowlength,2;diffusealpha,0;linear,0.5;diffusealpha,1 -LabelP2OffCommand=linear,0.5;diffusealpha,0 -PrimaryOnCommand=x,SCREEN_CENTER_X;y,-6;zoom,0.7;shadowlength,2 -SecondaryOnCommand=x,SCREEN_CENTER_X;y,6;shadowlength,2 -MappedToP1S1Command=x,SCREEN_CENTER_X-270 -MappedToP1S2Command=x,SCREEN_CENTER_X-195 -MappedToP1S3Command=x,SCREEN_CENTER_X-120 -MappedToP2S1Command=x,SCREEN_CENTER_X+120 -MappedToP2S2Command=x,SCREEN_CENTER_X+195 -MappedToP2S3Command=x,SCREEN_CENTER_X+270 -MappedToOnCommand=diffuse,color("#808080");shadowlength,0;maxwidth,150 -MappedToWaitingCommand=diffuse,color("#FF8080");pulse;effectperiod,0.5;effectmagnitude,0.8,1.3,0 -MappedToMappedInputCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") -MappedToGainFocusCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") -MappedToLoseFocusCommand=diffuse,color("#808080");stopeffect -DevicesX=SCREEN_CENTER_X -DevicesY=SCREEN_TOP+30 -DevicesOnCommand=diffusealpha,0;linear,0.5;diffusealpha,1 -DevicesOffCommand=linear,0.5;diffusealpha,0 - -[ScreenTest] -Fallback="ScreenWithMenuElementsBlank" - -[ScreenTestFonts] -Class="ScreenTestFonts" -Fallback="ScreenTest" -Font1="Common normal" -Font2="_shared1" -Font3="_shared2" -Font4="_numbers1" -Font5="_Arial 14 shadow" - -TextX=SCREEN_CENTER_X -TextY=SCREEN_CENTER_Y -TextOnCommand=wrapwidthpixels,SCREEN_WIDTH - -[ScreenTestFonts] -Class="ScreenTestFonts" -Fallback="ScreenTest" - -[ScreenTestInput] -Class="ScreenTestInput" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" -HelpText=ScreenString("HelpTextTestInput") - -[ScreenTestLights] -Class="ScreenTestLights" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" -HelpText=ScreenString("HelpTextTestLights") -TextX=SCREEN_CENTER_X-200 -TextY=SCREEN_CENTER_Y -TextOnCommand= -TextOffCommand= - -[ScreenTestSound] -Class="ScreenTestSound" -Fallback="ScreenOptionsServiceChild" - -[ScreenNetworkOptions] -Class="ScreenNetworkOptions" -Fallback="ScreenOptionsServiceChild" -NextScreen=NextNetworkScreen() -PrevScreen=NextNetworkScreen() - -[ScreenBookkeeping] -Class="ScreenBookkeeping" -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" -HelpText=ScreenString("HelpTextBookkeeping") -ShowSongPlays=true -ShowLastDays=true -ShowLastWeeks=true -ShowDayOfWeek=true -ShowHourOfDay=true -AllTimeX=SCREEN_CENTER_X -AllTimeY=110 -AllTimeOnCommand=zoom,0.7;diffuseshift;effectcolor1,color("0.5,0.5,0.5,1") -TitleX=SCREEN_CENTER_X -TitleY=140 -TitleOnCommand=zoom,0.8 -DataX=0 -DataY=SCREEN_CENTER_Y+16 -DataOnCommand= - -[ScreenPackages] -Class="ScreenPackages" -PackagesBGY=SCREEN_CENTER_Y -PackagesBGX=SCREEN_WIDTH/4 -PackagesBGWidth=SCREEN_WIDTH/3 -PackagesBGOnCommand=diffusealpha,0.0;linear,0.9;diffusealpha,1.0 -PackagesBGOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -PackagesBGBackCommand=linear,0.2;diffuse,color("#CCCCCC");diffusealpha,0.9 -PackagesBGAwayCommand=linear,0.2;diffuse,color("#020101");diffusealpha,0.9 -WebBGY=SCREEN_CENTER_Y -WebBGX=SCREEN_WIDTH*3.0/4.0 -WebBGWidth=SCREEN_WIDTH/3 -WebBGOnCommand=diffusealpha,0.0;linear,0.9;diffusealpha,1.0 -WebBGOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -WebBGAwayCommand=linear,0.2;diffuse,color("#020101");diffusealpha,0.9 -WebBGBackCommand=linear,0.2;diffuse,color("#CCCCCC");diffusealpha,0.9 -PackagesY=SCREEN_CENTER_Y+10 -PackagesX=SCREEN_WIDTH/4 -PackagesOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 -PackagesOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -NumPackagesShow=8 -WebY=SCREEN_CENTER_Y+10 -WebX=SCREEN_WIDTH*3.0/4.0 -WebOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 -WebOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -NumLinksShow=8 -WebSelY=SCREEN_CENTER_Y+10 -WebSelX=SCREEN_WIDTH*3.0/4.0 -WebSelColor=color("0.9,0.9,0.9,0.4") -WebSelOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 -WebSelOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -WebURLY=SCREEN_HEIGHT-40 -WebURLX=SCREEN_WIDTH*2.0/3.0 -WebURLOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0;zoomx,0.4;zoomy,0.5 -WebURLOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -DownloadY=22 -DownloadX=SCREEN_WIDTH*4.0/7.0 -DownloadProgressCommand=diffuse,0.1,0.1,0.9,0.8 -DownloadOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 -DownloadOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -DownloadStatusY=22 -DownloadStatusX=SCREEN_WIDTH*4.0/7.0 -DownloadStatusOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 -DownloadStatusOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 -CanDL=true -ShowStyleIcon=false -TimerSeconds= -PrevScreen=ScreenTitleBranch() -NextScreen="ScreenStage" -NoSongsScreen=ScreenTitleBranch() -Fallback="ScreenWithMenuElements" - -[HoldGhostArrow] -WarmUpSeconds=0.25 - -[BitmapText] -NumRainbowColors=7 -RainbowColor1=color("1.0,0.0,0.4,1") -- red -RainbowColor2=color("0.8,0.2,0.6,1") -- pink -RainbowColor3=color("0.4,0.3,0.5,1") -- purple -RainbowColor4=color("0.2,0.6,1.0,1") -- sky blue -RainbowColor5=color("0.2,0.8,0.8,1") -- sea green -RainbowColor6=color("0.2,0.8,0.4,1") -- green -RainbowColor7=color("1.0,0.8,0.2,1") -- orange - -[SongManager] -NumSongGroupColors=7 -SongGroupColor1=color("#ffba00") -SongGroupColor2=color("#ffec00") -SongGroupColor3=color("#00ff00") -SongGroupColor4=color("#00f6ff") -SongGroupColor5=color("#4896ff") -SongGroupColor6=color("#b87fff") -SongGroupColor7=color("#ff7fc7") -NumCourseGroupColors=1 -UseUnlockColor=false -UnlockColor=color("1,0.5,0,1") -CourseGroupColor1=color("1,1,1,1") -ExtraColor=color("#ff0000") -- red -ExtraColorMeter=10 -UsePreferredSortColor=false -MoveUnlocksToBottomOfPreferredSort=false -Loading songs...= -Loading courses...= -Reloading...= -ExtraStage2DifficultyMax=8 - -[Background] -LeftEdge=SCREEN_LEFT -TopEdge=SCREEN_TOP -RightEdge=SCREEN_RIGHT -BottomEdge=SCREEN_BOTTOM -BrightnessOverlayFadeCommand= -ClampOutputPercent=0 -ShowDancingCharacters=true -DontUseStaticBackground=false - -[Judgment] -JudgmentW1Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.8") -JudgmentW2Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentW3Command=shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW4Command=shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW5Command=shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentMissCommand=shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 - -[HoldJudgment] -HoldJudgmentLetGoCommand=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 -HoldJudgmentHeldCommand=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 - -[Combo] -ShowComboAt=5 -ShowMissesAt=0 -ComboLabelOnCommand=x,6;y,22;halign,0;valign,1 -MissesLabelOnCommand=x,6;y,22;halign,0;valign,1 -ComboNumberOnCommand=y,240-216;shadowlength,0;halign,1;valign,1 -MissesNumberOnCommand=y,240-216;shadowlength,0;halign,1;valign,1 -NumberMinZoom=0.4 -NumberMaxZoom=0.6 -NumberMaxZoomAt=150 -PulseCommand=%function(self,param) self:stoptweening(); self:zoom(1.2*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); end - -[Player] -ReceptorArrowsYStandard=-144 -ReceptorArrowsYReverse=144 -ReceptorNoSinkScoreCutoff=4 -JudgmentTransformCommand=%JudgmentTransformCommand -JudgmentOnCommand= -ComboTransformCommand=%ComboTransformCommand -AttackDisplayXOffsetOneSideP1=0 -AttackDisplayXOffsetOneSideP2=0 -AttackDisplayXOffsetBothSides=0 -AttackDisplayY=-70 -AttackDisplayYReverse=70 -HoldJudgmentYStandard=-90 -HoldJudgmentYReverse=90 -BrightGhostComboThreshold=100 -DrawDistanceBeforeTargetsPixels=400 -DrawDistanceAfterTargetsPixels=-60 -TapJudgmentsUnderField=false -HoldJudgmentsUnderField=false -PenalizeTapScoreNone=false -JudgeHoldNotesOnSameRowTogether=false -HoldCheckpoints=false -ImmediateHoldLetGo=true -RequireStepOnHoldHeads=true -CheckpointsUseTimeSignatures=false -InitialHoldLife=1 -RollBodyIncrementsCombo=true -CheckpointsTapsSeparateJudgment=true - -[PlayerShared] -Fallback="Player" -ComboXOffsetOneSideP1=-120 -ComboXOffsetOneSideP2=120 -# this was removed in SM4 -#JudgmentTransformCommand=%JudgmentTransformSharedCommand - -[ProTimingDisplay] -W1Command=shadowlength,4;diffuse,1,1,0,1;zoom,2.6;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.8") -W2Command=shadowlength,4;diffuse,1,.8,0,1;zoom,2.6;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 -W3Command=shadowlength,4;diffuse,.6,.9,0,1;zoom,2.4;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 -W4Command=shadowlength,4;diffuse,0,1,1,1;zoom,2.2;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 -W5Command=shadowlength,4;diffuse,1,.1,1,1;zoom,2.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0;diffusealpha,0 -MissCommand=shadowlength,4;diffuse,1,.3,0,1;zoom,2.0;y,-20;linear,0.8;y,20;sleep,0.8;linear,0;diffusealpha,0 -AvoidMineCommand= -HitMineCommand= - -[BPMDisplay] -SetNoBpmCommand=diffusetopedge,color("#777777");diffusebottomedge,color("#666666") -SetNormalCommand=diffusetopedge,color("#fbfb57");diffusebottomedge,color("#fb9c57") -SetChangeCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") -SetRandomCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") -SetExtraCommand=diffusetopedge,color("#fb5757");diffusebottomedge,color("#9c4242") -Cycle=true -NoBpmText="000" -RandomCycleSpeed=0.2 -- smaller numbers mean the bpm cycles faster -Separator="-" -ShowQMarksInRandomCycle=true - -[CodeDetector] -PrevSteps1="Up,Up" -PrevSteps2="MenuUp,MenuUp" -NextSteps1="Down,Down" -NextSteps2="MenuDown,MenuDown" -NextSort1="@MenuLeft-@MenuRight-Start" -NextSort2="MenuLeft-MenuRight" -NextSort3="@Left-@Right-Start" -NextSort4="Left-Right" -ModeMenu1="Up,Down,Up,Down" -ModeMenu2="MenuUp,MenuDown,MenuUp,MenuDown" -Mirror="Up,Left,Right,Left,Right" -Left="Up,Down,Right,Left" -Right="Up,Down,Left,Right" -Shuffle="Down,Up,Down,Up" -SuperShuffle="Down,Up,Left,Right" -NextTransform="" -NextScrollSpeed="Up,Left,Down,Left,Up" -PreviousScrollSpeed="Down,Right,Up,Right,Down" -NextAccel="Left,Right,Down,Up" -NextEffect="Left,Down,Right" -NextAppearance="Left,Up,Right" -NextTurn="" -Reverse="Down,Left,Right,Left,Right" -HoldNotes="Right,Left,Down,Up" -Mines="" -Dark="" -CancelAll="Left,Right,Left,Right,Left,Right,Left,Right" -NextTheme="Left,Left,Left,Right,Right,Right,Left,Right" -NextTheme2="MenuLeft,MenuLeft,MenuLeft,MenuRight,MenuRight,MenuRight,MenuLeft,MenuRight" -NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right" -NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight" -NextBannerGroup="MenuUp,MenuRight,MenuRight" -NextBannerGroup2="MenuUp,MenuDown,MenuUp,MenuDown" -Hidden="" -RandomVanish="" -SaveScreenshot1="MenuLeft-MenuRight" -SaveScreenshot2="" -CancelAllPlayerOptions="" -BackInEventMode="" - -[CourseCodeDetector] -Fallback="CodeDetector" -NextSort1= -NextSort2= -NextSort3= -NextSort4= -ModeMenu1= -ModeMenu2= - -[GrooveRadar] -Label1OffsetX=0 -- stream -Label1OffsetY=-78 -Label2OffsetX=-100 -- voltage -Label2OffsetY=-20 -Label3OffsetX=-70 -- air -Label3OffsetY=SCREEN_CENTER_Y-174 -Label4OffsetX=70 -- freeze -Label4OffsetY=SCREEN_CENTER_Y-174 -Label5OffsetX=100 -- chaos -Label5OffsetY=-20 -LabelPreDelayOnCommand=finishtweening;zoom,1.5;diffuse,1,1,1,0;sleep,0.3 -LabelOnDelay=0.2 -// fade on to screen -LabelPostDelayOnCommand=linear,0.1;glow,1,1,1,1;accelerate,0.3;zoom,1;diffuse,1,1,1,1;glow,1,1,1,0 -EdgeWidth=1 - -[GrooveGraph] -EdgeWidth= -BeginnerColor=color("0,0,0,0") -EasyColor=color("0,0,0,0") -MediumColor=color("0,0,0,0") -HardColor=color("0,0,0,0") -ChallengeColor=color("0,0,0,0") -EditColor=color("0,0,0,0") -ShowStream= -ShowVoltage= -ShowAir= -ShowFreeze= -ShowChaos= -StreamX= -VoltageX= -AirX= -FreezeX= -ChaosX= -MountainsBaseY= -MountainWidth= -MountainHeight= - -[ModIcon] -TextX=0 -TextY=0 -TextOnCommand=maxwidth,40;uppercase,true;shadowlength,0;diffuse,color("#f6ff00") -CropTextToWidth=50 - -[ModIconSelectMusic] -Fallback="ModIcon" -TextY=-1 -TextOnCommand=maxwidth,38;uppercase,true;shadowlength,0 - -[ModIconRow] -NumModIcons=6 -ModIconOnCommand= -SpacingX=0 -SpacingY=52 -ModIconMetricsGroup="ModIcon" - -[ModIconRowSelectMusic] -Fallback="ModIconRow" -SpacingX=46 -SpacingY=0 -ModIconMetricsGroup="ModIconSelectMusic" - -[ModIconRowGameplay] -Fallback="ModIconRow" - -[ModIconRowGameplayP1] -Fallback="ModIconRowGameplay" -ModIconOnCommand=rotationz,-90; - -[ModIconRowGameplayP2] -Fallback="ModIconRowGameplay" -ModIconOnCommand=rotationz,90; - -[ModIconRowEvaluationP1] -Fallback="ModIconRowGameplayP1" - -[ModIconRowEvaluationP2] -Fallback="ModIconRowGameplayP2" - -[TransitionOniFade] -BannerWidth=512 -BannerHeight=160 - -[LyricDisplay] -LyricFrontChangedCommand=LyricCommand,"Front" -LyricBackChangedCommand=LyricCommand,"Back" -InLength= -OutLength= - -[LifeMeterBattery Percent] -Format=FormatPercentScore -PercentP1X=20 -PercentP1Y=0 -PercentP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP1OffCommand= -PercentP2X=-20 -PercentP2Y=0 -PercentP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP2OffCommand= -DancePointsP1X=20 -DancePointsP1Y=0 -DancePointsP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) -DancePointsP1OffCommand= -DancePointsP2X=-20 -DancePointsP2Y=0 -DancePointsP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -DancePointsP2OffCommand= -DancePointsDigits=5 -PercentUseRemainder=false -ApplyScoreDisplayOptions=true - -[ScreenEvaluation Percent] -PercentP1X=0 -PercentP1Y=0 -PercentP1OnCommand=halign,1;valign,1;glowshift;effectperiod,2;shadowlength,0 -PercentP1OffCommand= -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=halign,1;valign,1;glowshift;effectperiod,2;shadowlength,0 -PercentP2OffCommand= -PercentRemainderP1X=0 -PercentRemainderP1Y=0 -PercentRemainderP1OnCommand=halign,0;valign,1;glowshift;effectperiod,2;shadowlength,0 -PercentRemainderP1OffCommand= -PercentRemainderP2X=0 -PercentRemainderP2Y=0 -PercentRemainderP2OnCommand=halign,0;valign,1;glowshift;effectperiod,2;shadowlength,0 -PercentRemainderP2OffCommand= -DancePointsP1X=-26 -DancePointsP1Y=-32 -DancePointsP1OnCommand=glowshift;effectperiod,2;shadowlength,0 -DancePointsP1OffCommand=sleep,0.8;accelerate,0.3 -DancePointsP2X=-26 -DancePointsP2Y=-32 -DancePointsP2OnCommand=glowshift;effectperiod,2;shadowlength,0 -DancePointsP2OffCommand=sleep,0.8;accelerate,0.3 -DancePointsDigits=1 -PercentUseRemainder=true -ApplyScoreDisplayOptions=false -Format=FormatPercentScore - -[ScoreDisplayPercentage Percent] -PercentP1X=20 -PercentP1Y=0 -PercentP1OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP1OffCommand= -PercentP2X=-20 -PercentP2Y=0 -PercentP2OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP2OffCommand= -DancePointsDigits=5 -PercentUseRemainder=false -ApplyScoreDisplayOptions=true -Format=FormatPercentScore -PercentDecimalPlaces=2 -PercentTotalSize=5 - -PercentP3X=20 -PercentP3Y=0 -PercentP3OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP3OffCommand= -PercentP4X=-20 -PercentP4Y=0 -PercentP4OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP4OffCommand= -PercentP5X=20 -PercentP5Y=0 -PercentP5OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP5OffCommand= -PercentP6X=-20 -PercentP6Y=0 -PercentP6OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP6OffCommand= -PercentP7X=20 -PercentP7Y=0 -PercentP7OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) -PercentP7OffCommand= -PercentP8X=-20 -PercentP8Y=0 -PercentP8OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP8OffCommand= - -[ScoreKeeperRave] -AttackDurationSeconds=10 - -[ScreenSelectMaster] -Fallback="ScreenSelect" -Class="ScreenSelectMaster" -WrapCursor=false -AllowRepeatingInput=false -PreSwitchPageSeconds=0 -PostSwitchPageSeconds=0 -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=20 -ScrollerTransform=function(self,offset,itemIndex,numItems) end -ScrollerSubdivisions=1 -OverrideSleepAfterTweenOffSeconds=false -SleepAfterTweenOffSeconds=0 -NumCodes=0 -OptionOrderUp= -OptionOrderDown= -OptionOrderLeft= -OptionOrderRight= -OptionOrderAuto= -ShowIcon=false -ShowCursor=false -ShowScroller=false -WrapScroller=false -LoopScroller=false -PerChoiceIconElement=true -PerChoiceScrollElement=true -# huh what's that -DoSwitchAnyways=false -# All on page 1 by default. -NumChoicesOnPage1=999 -SharedSelection=true -UseIconMetrics=true -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -DisabledColor=#606060 -# removed in SM4 -DoublePressToSelect=false - -# Blank defaults for a few options. -IconChoice1SwitchToPage1Command= -IconChoice1SwitchToPage2Command= -IconChoice1OnCommand= -IconChoice1OffCommand= -IconChoice1OffFocusedCommand= -IconChoice1OffUnfocusedCommand= - -IconChoice2SwitchToPage1Command= -IconChoice2SwitchToPage2Command= -IconChoice2OnCommand= -IconChoice2OffCommand= -IconChoice2OffFocusedCommand= -IconChoice2OffUnfocusedCommand= - -IconChoice3SwitchToPage1Command= -IconChoice3SwitchToPage2Command= -IconChoice3OnCommand= -IconChoice3OffCommand= -IconChoice3OffFocusedCommand= -IconChoice3OffUnfocusedCommand= - -IconChoice4SwitchToPage1Command= -IconChoice4SwitchToPage2Command= -IconChoice4OnCommand= -IconChoice4OffCommand= -IconChoice4OffFocusedCommand= -IconChoice4OffUnfocusedCommand= - -ExplanationPage1X=0 -ExplanationPage1Y=0 -ExplanationPage1SwitchToPage1Command= -ExplanationPage1SwitchToPage2Command= -ExplanationPage1OnCommand=visible,false -ExplanationPage1OffCommand= -ExplanationPage2X=0 -ExplanationPage2Y=0 -ExplanationPage2SwitchToPage1Command= -ExplanationPage2SwitchToPage2Command= -ExplanationPage2OnCommand=visible,false -ExplanationPage2OffCommand= - -MorePage1X=0 -MorePage1Y=0 -MorePage1SwitchToPage1Command= -MorePage1SwitchToPage2Command= -MorePage1OnCommand=visible,false -MorePage1OffCommand= -MorePage2X=0 -MorePage2Y=0 -MorePage2SwitchToPage1Command= -MorePage2SwitchToPage2Command= -MorePage2OnCommand=visible,false -MorePage2OffCommand= -IdleCommentSeconds=0 -IdleTimeoutSeconds=0 - -[ScreenOptionsAdvanced] -Fallback="ScreenOptionsServiceChild" -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30" -Line1="conf,MenuTimer" -Line2="conf,ScoringType" -Line3="conf,TimingWindowScale" -Line4="conf,LifeDifficulty" -Line5="conf,ProgressiveLifebar" -Line6="conf,ProgressiveStageLifebar" -Line7="conf,ProgressiveNonstopLifebar" -Line8="conf,DefaultFailType" -Line9="conf,ShowSongOptions" -Line10="conf,GetRankingName" -Line11="conf,AllowW1" -Line12="conf,Center1Player" -Line13="conf,HiddenSongs" -Line14="conf,EasterEggs" -Line15="conf,AllowExtraStage" -Line16="conf,UseUnlockSystem" -Line17="conf,CoinMode" -Line18="conf,SongsPerPlay" -Line19="conf,CoinsPerCredit" -Line20="conf,Premium" -Line21="conf,EventMode" -Line22="conf,AutoMapOnJoyChange" -Line23="conf,OnlyDedicatedMenuButtons" -Line24="conf,AutoPlay" -Line25="conf,DelayedBack" -Line26="conf,ArcadeOptionsNavigation" -Line27="conf,MusicWheelSwitchSpeed" -Line28="conf,AutogenSteps" -Line29="conf,AutogenGroupCourses" -Line30="conf,FastLoad" -# removed in sm4 -#Line31="conf,OnlyPreferredDifficulties" - -[ScreenOptionsGraphicsSound] -Fallback="ScreenOptionsServiceChild" -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19" -Line1="conf,Windowed" -Line2="conf,DisplayResolution" -Line3="conf,DisplayAspectRatio" -Line4="conf,DisplayColorDepth" -Line5="conf,HighResolutionTextures" -Line6="conf,MaxTextureResolution" -Line7="conf,TextureColorDepth" -Line8="conf,MovieColorDepth" -Line9="conf,SmoothLines" -Line10="conf,CelShadeModels" -Line11="conf,DelayedTextureDelete" -Line12="conf,RefreshRate" -Line13="conf,Vsync" -Line14="conf,ShowStats" -Line15="conf,ShowBanners" -Line16="conf,AttractSoundFrequency" -Line17="conf,SoundVolume" -Line18="conf,EnableAttackSounds" -Line19="conf,EnableMineHitSound" - -[ScreenAppearanceOptions] -Fallback="ScreenOptionsServiceChild" -LineNames="1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19" -#,8 -Line1="conf,Language" -Line2="conf,Announcer" -Line3="conf,Theme" -Line4="conf,DefaultNoteSkin" -Line5="conf,ShowInstructions" -Line6="conf,ShowCaution" -Line7="conf,DancePointsForOni" -#Line8="conf,ShowSelectGroup" -Line9="conf,MusicWheelUsesSections" -Line10="conf,CourseSortOrder" -Line11="conf,MoveRandomToEnd" -Line12="conf,ShowNativeLanguage" -Line13="conf,ShowLyrics" -Line14="conf,RandomBackgroundMode" -Line15="conf,BGBrightness" -Line16="conf,ShowDanger" -Line17="conf,ShowDancingCharacters" -Line18="conf,ShowBeginnerHelper" -Line19="conf,NumBackgrounds" - -[ScreenAttract] -ResetGameState=true -StartScreen=ScreenTitleBranch() -Class="ScreenAttract" -Fallback="ScreenWithMenuElementsBlank" -BackGoesToStartScreen=true -PrevScreen= -AttractVolume=true -LightsMode="LightsMode_Attract" - -[ScreenWithMenuElementsBlank] -Fallback="ScreenWithMenuElements" -# removed in sm4; remove here? -#ShowHeader=false -HeaderX= -HeaderY= -HeaderOnCommand=visible,false -HeaderOffCommand= -# removed in sm4; remove here? -#ShowFooter=false -FooterX= -FooterY= -FooterOnCommand=visible,false -FooterOffCommand= -ShowStyleIcon=false -TimerSeconds=6 -TimerStealth=true -ForceTimer=true -TimerX= -TimerY= -TimerOnCommand=visible,false -TimerOffCommand= -ShowHelp=false - -[ScreenSelectBlank] -Fallback="ScreenWithMenuElementsBlank" -UpdateOnMessage="" - -[ScreenSelectMasterBlank] -Fallback="ScreenSelectBlank" -Class="ScreenSelectMaster" -AllowRepeatingInput=false -ChoiceNames="1" -Choice1= -DefaultChoice="1" -WrapCursor=false -PreSwitchPageSeconds=0 -PostSwitchPageSeconds=0 -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=20 -ScrollerTransform=function(self,offset,itemIndex,numItems) end -ScrollerSubdivisions=1 -ShowStyleIcon=true -OverrideSleepAfterTweenOffSeconds=false -SleepAfterTweenOffSeconds=0 -NumCodes=0 -OptionOrderUp= -OptionOrderDown= -OptionOrderLeft= -OptionOrderRight= -OptionOrderAuto= -ShowIcon=false -ShowCursor=false -ShowScroller=false -WrapScroller=false -LoopScroller=false -PerChoiceIconElement=true -PerChoiceScrollElement=true -# All on page 1 by default. -NumChoicesOnPage1=999 -SharedSelection=true -UseIconMetrics=true -CursorP1OffsetXFromIcon=0 -CursorP1OffsetYFromIcon=0 -CursorP2OffsetXFromIcon=0 -CursorP2OffsetYFromIcon=0 -DisabledColor=#606060 - -ExplanationPage1X= -ExplanationPage1Y= -ExplanationPage1OnCommand=visible,false -ExplanationPage1OffCommand= -ExplanationPage2X= -ExplanationPage2Y= -ExplanationPage2OnCommand=visible,false -ExplanationPage2OffCommand= -MorePage1X= -MorePage1Y= -MorePage1OnCommand=visible,false -MorePage1OffCommand= -MorePage2X= -MorePage2Y= -MorePage2OnCommand=visible,false -MorePage2OffCommand= -IdleCommentSeconds=15 -IdleTimeoutSeconds=0 - -[ScreenUnlockStatus] -Class="ScreenUnlockStatus" -Fallback="ScreenAttract" -TypeOfPointsToDisplay="DP" -TimeToDisplay=10 -PointsDisplayX=SCREEN_CENTER_X-220 -PointsDisplayY=SCREEN_CENTER_Y+170 -PointsZoom=2 -UnlockTextScroll=3 -UnlockTextScrollRows=7 -UnlockTextScrollZoom=1 -UnlockTextScrollIconX=SCREEN_CENTER_X+30 -UnlockTextScrollIconSize=40 -UnlockTextScrollMaxWidth=265 -UnlockTextScrollX=SCREEN_CENTER_X+55 -UnlockTextScrollStartY=SCREEN_CENTER_Y+200 -UnlockTextScrollEndY=SCREEN_CENTER_Y-200 -NextScreen="ScreenCompany" -UnlockIconCommand=zoom,0;linear,0.3;zoom,1;linear,0.2;zoom,0.8;sleep,9;linear,0.5;diffusealpha,0 -Unlock0001X=SCREEN_CENTER_X-220 -Unlock0001Y=SCREEN_CENTER_Y-115 -Unlock0002X=SCREEN_CENTER_X-170 -Unlock0002Y=SCREEN_CENTER_Y-115 -Unlock0003X=SCREEN_CENTER_X-120 -Unlock0003Y=SCREEN_CENTER_Y-115 -Unlock0004X=SCREEN_CENTER_X-70 -Unlock0004Y=SCREEN_CENTER_Y-115 -Unlock0005X=SCREEN_CENTER_X-220 -Unlock0005Y=SCREEN_CENTER_Y-65 -Unlock0006X=SCREEN_CENTER_X-170 -Unlock0006Y=SCREEN_CENTER_Y-65 -Unlock0007X=SCREEN_CENTER_X-120 -Unlock0007Y=SCREEN_CENTER_Y-65 -Unlock0008X=SCREEN_CENTER_X-70 -Unlock0008Y=SCREEN_CENTER_Y-65 -Unlock0009X=SCREEN_CENTER_X-220 -Unlock0009Y=SCREEN_CENTER_Y-15 -Unlock0010X=SCREEN_CENTER_X-170 -Unlock0010Y=SCREEN_CENTER_Y-15 -Unlock0011X=SCREEN_CENTER_X-120 -Unlock0011Y=SCREEN_CENTER_Y-15 -Unlock0012X=SCREEN_CENTER_X-70 -Unlock0012Y=SCREEN_CENTER_Y-15 -Unlock0013X=SCREEN_CENTER_X-220 -Unlock0013Y=SCREEN_CENTER_Y+35 -Unlock0014X=SCREEN_CENTER_X-170 -Unlock0014Y=SCREEN_CENTER_Y+35 -Unlock0015X=SCREEN_CENTER_X-120 -Unlock0015Y=SCREEN_CENTER_Y+35 -Unlock0016X=SCREEN_CENTER_X-70 -Unlock0016Y=SCREEN_CENTER_Y+35 -Unlock0017X=SCREEN_CENTER_X-220 -Unlock0017Y=SCREEN_CENTER_Y+85 -Unlock0018X=SCREEN_CENTER_X-170 -Unlock0018Y=SCREEN_CENTER_Y+85 -Unlock0019X=SCREEN_CENTER_X-120 -Unlock0019Y=SCREEN_CENTER_Y+85 -Unlock0020X=SCREEN_CENTER_X-70 -Unlock0020Y=SCREEN_CENTER_Y+85 -DancePointsZoom=2 - -[ScreenHighScores] -Fallback="ScreenAttract" -Class="ScreenHighScores" -TimerSeconds=-1 -NextScreen="ScreenUnlockStatus" -PrevScreen="ScreenHowToPlay" -HighScoresType="HighScoresType_AllSteps" -MaxItemsToShow=50 -NumColumns=5 -ColumnDifficulty1="Difficulty_Beginner" -ColumnDifficulty2="Difficulty_Easy" -ColumnDifficulty3="Difficulty_Medium" -ColumnDifficulty4="Difficulty_Hard" -ColumnDifficulty5="Difficulty_Challenge" -ColumnStepsType1=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) -ColumnStepsType2=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) -ColumnStepsType3=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) -ColumnStepsType4=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) -ColumnStepsType5=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) -ScrollerItemsToDraw=7 -ScrollerSecondsPerItem=0.4 -ManualScrolling=false -ScrollerOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+36;SetMask,608,40 -ScrollerItemTransformFunction=function(self,offset,itemIndex,numItems) self:y(46.1*offset) end - -[ScreenRanking] -Fallback="ScreenAttract" -Class="ScreenRanking" -TimerSeconds=-1 -StepsTypesToHide="dance-couple,dance-solo,dance-routine,pump-halfdouble,pump-couple" -PageFadeSeconds=1.0 -CoursesToShow=GetCoursesToShowRanking() -SecondsPerPage=5 - -RowSpacingX=0 -RowSpacingY=60 -ColSpacingX=0 -ColSpacingY=0 -StepsTypeColor1=color("0.6,0.6,1,1") -StepsTypeColor2=color("1,0.3,0.3,1") -StepsTypeColor3=color("0.3,1,0.3,1") -StepsTypeColor4=color("1.0,1,1.0,1") -StepsTypeColor5=color("1.0,1,1.0,1") -SongScoreSecondsPerRow=0.4 -ShowSurvivalTime=false - -BannerOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-196;diffusealpha,1;scaletoclipped,220,58;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -BannerOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -CategoryOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -CategoryOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -CourseTitleOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;maxwidth,230;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -CourseTitleOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 -StepsTypeOnCommand=x,SCREEN_CENTER_X+200;y,SCREEN_CENTER_Y-180;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH -StepsTypeOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 - -BulletStartX=SCREEN_CENTER_X-220 -BulletStartY=SCREEN_CENTER_Y-100 -Bullet1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Bullet2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Bullet3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Bullet4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Bullet5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Bullet1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Bullet2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Bullet3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Bullet4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Bullet5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -NameStartX=SCREEN_CENTER_X-140 -NameStartY=SCREEN_CENTER_Y-100 -Name1OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Name2OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Name3OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Name4OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Name5OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Name1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Name2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Name3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Name4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Name5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -ScoreStartX=SCREEN_CENTER_X+200 -ScoreStartY=SCREEN_CENTER_Y-100 -Score1OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Score2OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Score3OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Score4OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Score5OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Score1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Score2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Score3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Score4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Score5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -PointsStartX=SCREEN_CENTER_X+60 -PointsStartY=SCREEN_CENTER_Y-100 -Points1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Points2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Points3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Points4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Points5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Points1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Points2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Points3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Points4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Points5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -TimeStartX=SCREEN_CENTER_X+240 -TimeStartY=SCREEN_CENTER_Y-100 -Time1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH -Time2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH -Time3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH -Time4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH -Time5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH -Time1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 -Time2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 -Time3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 -Time4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 -Time5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 -DifficultyStartX=SCREEN_CENTER_X-154 -DifficultyY=SCREEN_CENTER_Y-209 -DifficultyBeginnerOnCommand= -DifficultyEasyOnCommand= -DifficultyMediumOnCommand= -DifficultyHardOnCommand= -DifficultyChallengeOnCommand= -DifficultyBeginnerOffCommand= -DifficultyEasyOffCommand= -DifficultyMediumOffCommand= -DifficultyHardOffCommand= -DifficultyChallengeOffCommand= -TitleOnCommand=x,-210;ztest,1;diffuse,0,0,0,1;maxwidth,160 -TitleOffCommand= -FrameOnCommand=ztest,1 -FrameOffCommand= -ScoreOffsetStartX=-154 -ScoreOffsetY=0 -ScoreOnCommand=zoom,0.7;ztest,1 -ScoreOffCommand= - -[ScreenCompany] -Class="ScreenAttract" -Fallback="ScreenAttract" -NextScreen="ScreenLegal" -PrevScreen="" -TimerSeconds=6 - -[ScreenLegal] -Class="ScreenAttract" -Fallback="ScreenAttract" -NextScreen="ScreenLogo" -PrevScreen="" -TimerSeconds=12 - -[ScreenLogo] -Class="ScreenAttract" -Fallback="ScreenAttract" -NextScreen="ScreenHowToPlay" -PrevScreen="ScreenCompany" - -[ScreenHowToPlay] -Class="ScreenHowToPlay" -Fallback="ScreenAttract" -TimerSeconds=25 -NextScreen="ScreenDemonstration" -PrevScreen="ScreenLogo" -ResetGameState=false -LifeMeterBarX=SCREEN_CENTER_X-160 -LifeMeterBarY=SCREEN_TOP+56 -LifeMeterBarOnCommand=addy,-90;sleep,1.4;linear,0.4;addy,90 -UseCharacter=true -CharacterX=SCREEN_CENTER_X-160 -CharacterY=SCREEN_CENTER_Y+160 -CharacterOnCommand=zoom,15;draworder,2 -UsePad=true -PadX=SCREEN_CENTER_X-80 -PadY=SCREEN_CENTER_Y+160 -PadOnCommand=zoom,15;draworder,1;rotationx,5 -UsePlayer=true -PlayerX=SCREEN_CENTER_X-160 -PlayerY=SCREEN_CENTER_Y+20 -PlayerOnCommand=draworder,10 -NumW2s=4 -NumMisses=6 - -[ScreenDemonstration] -Fallback="ScreenGameplay" -Class="ScreenDemonstration" -SecondsToShow=30 -NextScreen="ScreenHighScores" -LightsMode="LightsMode_Demonstration" -DifficultiesToShow="easy,medium" -StartScreen=ScreenTitleBranch() -PlayMusic=false -MinSecondsToStep=0 -MinSecondsToMusic=0 -ShowCourseModifiersProbability=0 -AllowAdvancedModifiers=false -AllowStyleTypes="TwoPlayersTwoSides" - -[ScreenJukebox] -ShowCourseModifiersProbability=0 -Class="ScreenJukebox" -Fallback="ScreenGameplay" -NextScreen="ScreenJukebox" -StartScreen=ScreenTitleBranch() -LightsMode="LightsMode_Demonstration" -AllowAdvancedModifiers=true - -[ScreenNameEntry] -Class="ScreenNameEntry" -Fallback="ScreenWithMenuElementsBlank" -TimerX=SCREEN_CENTER_X+0 -TimerY=SCREEN_CENTER_Y-210 -CategoryY=SCREEN_CENTER_Y+190 -CategoryZoom=0.7 -CharsZoomSmall=1.0 -CharsZoomLarge=1.5 -CharsSpacingY=40 -ScrollingCharsCommand=diffuse,0.6,0.8,0.8,1 -SelectedCharsCommand=diffuse,0.8,1,1,1 -ReceptorArrowsY=SCREEN_CENTER_Y-140 -NumCharsToDrawBehind=2 -NumCharsToDrawTotal=10 -FakeBeatsPerSec=2.5 -ForceTimer=true -TimerSeconds=24 -TimerStealth=false -ShowStyleIcon=false -MaxRankingNameLength=4 -NextScreen="ScreenProfileSave" -PlayerP1OnePlayerOneSideX=SCREEN_CENTER_X-160 -PlayerP2OnePlayerOneSideX=SCREEN_CENTER_X+160 -PlayerP1TwoPlayersTwoSidesX=SCREEN_CENTER_X-160 -PlayerP2TwoPlayersTwoSidesX=SCREEN_CENTER_X+160 -PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X -PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X - -[EditCoursesMenu] -Arrows1X=SCREEN_CENTER_X-130 -Arrows2X=SCREEN_CENTER_X+270 -EntryBannerX=SCREEN_CENTER_X+170 -EntryBannerY=SCREEN_CENTER_Y-130 -EntryBannerWidth=130 -EntryBannerHeight=40 -EntryTextBannerX=SCREEN_CENTER_X+0 -EntryTextBannerY=SCREEN_CENTER_Y-130 -CourseBannerX=SCREEN_CENTER_X+170 -CourseBannerY=SCREEN_CENTER_Y-170 -CourseBannerWidth=130 -CourseBannerHeight=40 -RowLabelsX=SCREEN_CENTER_X-300 -RowValue1X=SCREEN_CENTER_X+0 -RowValue2X=SCREEN_CENTER_X+60 -RowValue3X=SCREEN_CENTER_X+60 -RowValue4X=SCREEN_CENTER_X+60 -RowValue5X=SCREEN_CENTER_X+60 -RowValue6X=SCREEN_CENTER_X+60 -RowValue7X=SCREEN_CENTER_X+60 -RowValue8X=SCREEN_CENTER_X+60 -Row1Y=SCREEN_CENTER_Y-170 -Row2Y=SCREEN_CENTER_Y-120 -Row3Y=SCREEN_CENTER_Y-80 -Row4Y=SCREEN_CENTER_Y-40 -Row5Y=SCREEN_CENTER_Y+0 -Row6Y=SCREEN_CENTER_Y+40 -Row7Y=SCREEN_CENTER_Y+80 -Row8Y=SCREEN_CENTER_Y+120 - -[EditCoursesSongMenu] -Fallback="EditCoursesMenu" - -; A simple list screen used outside of game mode -[ScreenOptionsSimple] -Fallback="ScreenOptionsMaster" -NumRowsShown=9 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-154+33*offsetFromCenter) end -NavigationMode="menu" -ForceAllPlayers=true -InputMode="together" -ShowStyleIcon=false -CursorOnCommand=visible,false -OptionRowNormalMetricsGroup="OptionRowSimple" -OptionRowExitMetricsGroup="OptionRowSimpleExit" -SeparateExitRowY=SCREEN_CENTER_Y+142 -LightsMode="LightsMode_MenuStartAndDirections" -TimerOnCommand=visible,false -ShowStyleIcon=false -TimerSeconds=-1 -AllowOperatorMenuButton=false -HelpText=ScreenString("HelpTextOptionsSimpleAndBack") - -[OptionRowSimple] -Fallback="OptionRow" -FrameX=SCREEN_CENTER_X -FrameY=2 -TitleX=SCREEN_CENTER_X -TitleY=-2 -TitleOnCommand=shadowlength,0;uppercase,true;maxwidth,300 -FrameGainFocusCommand=diffuse,1,1,1,1;glowshift;effectcolor2,color("#fffdd4"); -FrameLoseFocusCommand=diffuse,1,1,1,1;stopeffect -ShowUnderlines=false - -[OptionRowSimpleExit] -Fallback="OptionRowSimple" -ItemOnCommand=visible,false - -[ScreenOptionsService] -Class="ScreenOptionsMaster" -Fallback="ScreenOptionsSimple" -; This NextScreen is only used for the "exit" choice. -NextScreen=ScreenTitleBranch() -PrevScreen=ScreenTitleBranch() -LineNames="1,2,3,4,5,6,8,9" -Line1="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" -Line2="gamecommand;screen,ScreenTestInput;name,Test Input" -Line3="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options" -Line4="gamecommand;screen,ScreenOptionsGraphicsSound;name,Graphics/Sound Options" -Line5="gamecommand;screen,ScreenOptionsAdvanced;name,Advanced Options" -Line6="gamecommand;screen,ScreenNetworkOptions;name,Network Options" -Line8="gamecommand;screen,ScreenOptionsManageProfiles;name,Profiles" -Line9="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" -GroupedScreens="ScreenOptionsService,ScreenAppearanceOptions,ScreenMapControllers,ScreenOptionsGraphicsSound,ScreenOptionsAdvanced,ScreenOptionsManageProfiles,ScreenNetworkOptions,ScreenReloadSongs,ScreenTestInput" -PersistScreens="ScreenOptionsService,ScreenAppearanceOptions,ScreenMapControllers,ScreenOptionsGraphicsSound,ScreenOptionsAdvanced,ScreenOptionsManageProfiles,ScreenNetworkOptions,ScreenReloadSongs,ScreenTestInput" - -[ScreenOptionsServiceChild] -Fallback="ScreenOptionsMaster" -LightsMode="LightsMode_MenuStartAndDirections" -NavigationMode="normal" -InputMode="together" -TimerOnCommand=visible,false -ShowStyleIcon=false -TimerSeconds=-1 -AllowOperatorMenuButton=false -ForceAllPlayers=true -PrevScreen="ScreenOptionsService" -NextScreen="ScreenOptionsService" -HelpText=ScreenString("HelpTextOptionsAndBack") - -[ScreenOptionsTestMenu] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" -LineNames="1" -Line1="lua,OptionsRowTest()" - -[TextBanner] -TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");halign,1;x,120;skewx,-0.1;maxwidth,208; -SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");halign,1;x,120;skewx,-0.1; -ArtistOnCommand=visible,false -ArtistPrependString="/" -AfterSetCommand=%TextBannerAfterSet - -[TextBannerHighScores] -Fallback="TextBanner" -TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");halign,0.5; -SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");halign,0.5; - -[TextBannerCourseEntry] -Fallback="TextBanner" -TitleX=-90 -SubtitleX=-90 -ArtistX=-90 - -[ArtistDisplay] -TipShowTime=1 -TipOnCommand= - -[ScreenSelectGame] -Fallback="ScreenOptionsServiceChild" -PrevScreen=ScreenTitleBranch() -NextScreen=ScreenTitleBranch() -LineNames="1" -Line1="conf,Game" - -[ScreenPlayerOptions] -Fallback="ScreenOptions" -Class="ScreenPlayerOptions" -PrevScreen=SongSelectionScreen() -NextScreen=ScreenPlayerOptionsNext() -PlayMusic=false -TimerSeconds=30 -ShowStyleIcon=false -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" -Line1="list,Speed" -Line2="list,Accel" -Line3="list,Effect" -Line4="list,Appearance" -Line5="list,Turn" -Line6="list,Insert" -Line7="list,Scroll" -Line8="list,NoteSkins" -Line9="list,Holds" -Line10="list,Mines" -Line11="list,Attacks" -Line12="list,PlayerAutoPlay" -Line13="list,Hide" -Line14="list,Persp" -Line15="list,ScoreDisplay" -Line16="list,Steps" -Line17="list,Characters" - -[ScreenRaveOptions] -Fallback="ScreenOptions" -Class="ScreenOptionsMaster" -PrevScreen="ScreenSelectMusic" -NextScreen="ScreenStage" -TimerSeconds=30 -ShowStyleIcon=false -LineNames="1,2,3,4,5" -Line1="list,Speed" -Line2="list,Scroll" -Line3="list,NoteSkins" -Line4="list,Persp" -Line5="list,Steps" - -[ScreenSongOptions] -Class="ScreenSongOptions" -Fallback="ScreenOptions" -PrevScreen=SelectFirstOptionsScreen() -NextScreen="ScreenStage" -TimerSeconds=30 -ShowStyleIcon=false -PlayMusic=false -LineNames="1,2,3,4,5,6,7,8,9,10" -Line1="list,LifeType" -Line2="list,BarDrain" -Line3="list,BatLives" -Line4="list,Fail" -Line5="list,Assist" -Line6="list,Rate" -Line7="list,SoundEffect" -Line8="list,AutoAdjust" -Line9="list,Background" -Line10="list,SaveScores" -StopMusicOnBack=false - -[ScreenEnding] -Fallback="ScreenAttract" -Class="ScreenEnding" -NextScreen="ScreenHighScores" - -RemoveCardP1X=SCREEN_WIDTH*0.1 -RemoveCardP1Y=SCREEN_CENTER_Y -RemoveCardP1OnCommand= -RemoveCardP1OffCommand= - -RemoveCardP2X=SCREEN_WIDTH*0.9 -RemoveCardP2Y=SCREEN_CENTER_Y -RemoveCardP2OnCommand= -RemoveCardP2OffCommand= - -[ScreenGameOver] -Fallback="ScreenEnding" -TimerSeconds=10 - -[ScreenEnding1] -Fallback="ScreenEnding" -; decorations send "SM_BeginFadingOut", so timer is disabled -TimerSeconds=0 - -[ScreenEnding2] -Fallback="ScreenEnding" -; decorations send "SM_BeginFadingOut", so timer is disabled -TimerSeconds=0 - -[ScreenEnding3] -Fallback="ScreenEnding" -; decorations send "SM_BeginFadingOut", so timer is disabled -TimerSeconds=0 - -[ScreenSelectCharacter] -Class="ScreenSelectCharacter" -Fallback="ScreenWithMenuElements" -WaitForChildrenBeforeTweeningOut=true -TitleP1OnCommand=x,140;y,80;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -TitleP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -TitleP2OnCommand=x,500;y,80;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -TitleP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -CardP1OnCommand=x,140;y,180;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -CardP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -CardP2OnCommand=x,500;y,180;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -CardP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -CardArrowsP1OnCommand=x,140;y,180;diffusealpha,0;linear,0.3;diffusealpha,1 -CardArrowsP1OffCommand=linear,0.3;diffusealpha,0 -CardArrowsP2OnCommand=x,500;y,180;diffusealpha,0;linear,0.3;diffusealpha,1 -CardArrowsP2OffCommand=linear,0.3;diffusealpha,0 -ExplanationOnCommand=x,SCREEN_CENTER_X;y,140;diffusealpha,0;linear,0.3;diffusealpha,1 -ExplanationOffCommand=linear,0.3;diffusealpha,0 -AttackFrameP1OnCommand=x,140;y,380;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -AttackFrameP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -AttackFrameP2OnCommand=x,500;y,380;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -AttackFrameP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -AttackIconWidth=40 -AttackIconHeight=40 -AttackIconsP1StartX=SCREEN_CENTER_X-192 -AttackIconsP1StartY=SCREEN_CENTER_Y+116 -AttackIconsP2StartX=SCREEN_CENTER_X+168 -AttackIconsP2StartY=SCREEN_CENTER_Y+116 -AttackIconsSpacingX=42 -AttackIconsSpacingY=32 -AttackIconsP1OnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -AttackIconsP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -AttackIconsP2OnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -AttackIconsP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -IconWidth=40 -IconHeight=40 -IconsP1OnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 -IconsP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 -IconsP2OnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 -IconsP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 -SleepAfterTweenOffSeconds=0.8 -TimerSeconds=40 -ShowStyleIcon=true -PrevScreen=ScreenTitleBranch() -NextScreen=SongSelectionScreen() - -[BeginnerHelper] -# All X,Y coordinates are relative to the HelperX,Y -Player1_X=-125 -Player2_X=SCREEN_CENTER_X-195 -PlayerAngle=40 -DancePadAngle=36 -# HelperX,Y are set to SCREEN_CENTER_X and SCREEN_CENTER_Y in code... -HelperX=SCREEN_LEFT -HelperY=SCREEN_CENTER_Y/2 - -[ScreenOptionsMaster] -Fallback="ScreenOptions" -Class="ScreenOptionsMaster" -NoteSkinSortOrder="" - -# ExitItem is an exit row with the "Exit" text as a menu item; ExitTitle -# uses the menu title. -ExitItem="1;together;SelectNone;showoneinrow" -ExitItemDefault="" -ExitItem,1="screen," .. ScreenMetric("NextScreen") .. ";name,ExitItem" -ExitTitle="1;together;SelectNone;showoneinrow" -ExitTitleDefault="" -ExitTitle,1="screen," .. ScreenMetric("NextScreen") .. ";name,ExitTitle" - -# Player options -Speed="12" -SpeedDefault="mod,1x,no randomspeed" -Speed,1="mod,0.25x;name,x0.25" -Speed,2="mod,0.50x;name,x0.50" -Speed,3="mod,0.75x;name,x0.75" -Speed,4="mod,1x;name,x1" -Speed,5="mod,1.5x;name,x1.5" -Speed,6="mod,2x;name,x2" -Speed,7="mod,3x;name,x3" -Speed,8="mod,4x;name,x4" -Speed,9="mod,8x;name,x8" -Speed,10="mod,C200;name,C200" -Speed,11="mod,C400;name,C400" -Speed,12="mod,1x,200% randomspeed;name,Random" -Accel="6" -AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" -Accel,1="name,Off" -Accel,2="mod,boost;name,Boost" -Accel,3="mod,brake;name,Brake" -Accel,4="mod,wave;name,Wave" -Accel,5="mod,expand;name,Expand" -Accel,6="mod,boomerang;name,Boomerang" -Effect="9" -EffectDefault="mod,no drunk,no dizzy,no confusion,no mini,no flip,no tornado,no tipsy" -Effect,1="name,Off" -Effect,2="mod,drunk;name,Drunk" -Effect,3="mod,dizzy;name,Dizzy" -Effect,4="mod,confusion;name,Confusion" -Effect,5="mod,mini;name,Mini" -Effect,6="mod,-100% mini;name,Big" -Effect,7="mod,flip;name,Flip" -Effect,8="mod,tornado;name,Tornado" -Effect,9="mod,tipsy;name,Tipsy" -Appearance="6" -AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" -Appearance,1="name,Visible" -Appearance,2="mod,hidden;name,Hidden" -Appearance,3="mod,sudden;name,Sudden" -Appearance,4="mod,stealth;name,Stealth" -Appearance,5="mod,blink;name,Blink" -Appearance,6="mod,randomvanish;name,R.Vanish" -Turn="6" -TurnDefault="mod,no turn" -Turn,1="name,Off" -Turn,2="mod,mirror;name,Mirror" -Turn,3="mod,left;name,Left" -Turn,4="mod,right;name,Right" -Turn,5="mod,shuffle;name,Shuffle" -Turn,6="mod,supershuffle;name,SuperShuffle" -Insert="8" -InsertDefault="mod,no little,no wide,no big,no quick,no skippy,no echo,no stomp" -Insert,1="name,Off" -Insert,2="mod,little;name,Little" -Insert,3="mod,wide;name,Wide" -Insert,4="mod,big;name,Big" -Insert,5="mod,quick;name,Quick" -Insert,6="mod,skippy;name,Skippy" -Insert,7="mod,echo;name,Echo" -Insert,8="mod,stomp;name,Stomp" -Scroll="5" -ScrollDefault="mod,no reverse,no split,no alternate,no cross" -Scroll,1="name,Standard" -Scroll,2="mod,reverse;name,Reverse" -Scroll,3="mod,split;name,Split" -Scroll,4="mod,alternate;name,Alternate" -Scroll,5="mod,cross;name,Cross" -Holds="6" -HoldsDefault="mod,no noholds,no planted,no twister,no nojumps,no nohands" -Holds,1="mod,noholds;name,Off" -Holds,2="name,On" -Holds,3="mod,planted;name,Planted" -Holds,4="mod,twister;name,Twister" -Holds,5="mod,nojumps;name,NoJumps" -Holds,6="mod,nohands;name,NoHands" -Mines="4" -MinesDefault="mod,no nomines,no mines, no attackmines" -Mines,1="mod,nomines;name,Off" -Mines,2="name,On" -Mines,3="mod,mines;name,Add" -Mines,4="mod,attackmines;name,AttackMines" -Attacks="3" -AttacksDefault="mod,no randomattacks,no songattacks" -Attacks,1="name,Off" -Attacks,2="mod,randomattacks;name,RandomAttacks" -Attacks,3="mod,songattacks;name,SongAttacks" -PlayerAutoPlay="2" -PlayerAutoPlayDefault="mod,no playerautoplay" -PlayerAutoPlay,1="name,Off" -PlayerAutoPlay,2="mod,playerautoplay;name,On" -Hide="3" -HideDefault="mod,no dark,no blind" -Hide,1="name,Off" -Hide,2="mod,dark;name,Dark" -Hide,3="mod,blind;name,Blind" -Persp="5" -PerspDefault="mod,overhead" -Persp,1="mod,incoming;name,Incoming" -Persp,2="mod,overhead;name,Overhead" -Persp,3="mod,space;name,Space" -Persp,4="mod,hallway;name,Hallway" -Persp,5="mod,distant;name,Distant" -ScoreDisplay="3" -ScoreDisplayDefault="mod,addscore" -ScoreDisplay,1="mod,addscore;name,Add" -ScoreDisplay,2="mod,subtractscore;name,Subtract" -ScoreDisplay,3="mod,averagescore;name,Average" - -# Song options -LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together" -LifeTypeDefault="" -LifeType,1="mod,bar;name,Bar" -LifeType,2="mod,battery;name,Battery" -LifeType,3="mod,lifetime;name,LifeTime" -BarDrain="3;together" -BarDrainDefault="" -BarDrain,1="mod,normal-drain;name,Normal" -BarDrain,2="mod,norecover;name,NoRecover" -BarDrain,3="mod,suddendeath;name,SuddenDeath" -BatLives="10;together" -BatLivesDefault="" -BatLives,1="mod,1 life;name,1" -BatLives,2="mod,2 lives;name,2" -BatLives,3="mod,3 lives;name,3" -BatLives,4="mod,4 lives;name,4" -BatLives,5="mod,5 lives;name,5" -BatLives,6="mod,6 lives;name,6" -BatLives,7="mod,7 lives;name,7" -BatLives,8="mod,8 lives;name,8" -BatLives,9="mod,9 lives;name,9" -BatLives,10="mod,10 lives;name,10" -Fail="4;together" -FailDefault="" -Fail,1="mod,failImmediate;name,Immediate" -Fail,2="mod,FailImmediateContinue;name,ImmediateContinue" -Fail,3="mod,FailAtEnd;name,FailAtEnd" -Fail,4="mod,failoff;name,Off" -Assist="4;together" -AssistDefault="" -Assist,1="mod,no clap,no metronome;name,Off" -Assist,2="mod,clap,no metronome;name,Clap" -Assist,3="mod,no clap,metronome;name,Metronome" -Assist,4="mod,clap,metronome;name,Both" -Rate="13;together" -RateDefault="mod,1.0xmusic;mod,no haste" -Rate,1="mod,0.25xmusic;name,0.25x" -Rate,2="mod,0.50xmusic;name,0.5x" -Rate,3="mod,0.75xmusic;name,0.75x" -Rate,4="mod,0.8xmusic;name,0.8x" -Rate,5="mod,0.9xmusic;name,0.9x" -Rate,6="mod,1.0xmusic;name,1.0x" -Rate,7="mod,haste;name,Haste" -Rate,8="mod,1.1xmusic;name,1.1x" -Rate,9="mod,1.2xmusic;name,1.2x" -Rate,10="mod,1.3xmusic;name,1.3x" -Rate,11="mod,1.5xmusic;name,1.5x" -Rate,12="mod,1.75xmusic;name,1.75x" -Rate,13="mod,2.0xmusic;name,2.0x" -AutoAdjust="4;together" -AutoAdjustDefault="" -AutoAdjust,1="mod,no autosync;name,Off" -AutoAdjust,2="mod,autosyncsong;name,Sync Song" -AutoAdjust,3="mod,autosyncmachine;name,Sync Machine" -AutoAdjust,4="mod,autosynctempo;name,Sync Tempo" -SoundEffect="3;together" -SoundEffectDefault="" -SoundEffect,1="mod,no effect;name,Off" -SoundEffect,2="mod,EffectSpeed;name,EffectSpeed" -SoundEffect,3="mod,EffectPitch;name,EffectPitch" -Background="3;together" -BackgroundDefault="" -Background,1="mod,no effect;name,Default" -Background,2="mod,staticbg;name,StaticBG" -Background,3="mod,randombg;name,RandomBG" -SaveScores="2;together" -SaveScoresDefault="" -SaveScores,1="mod,no savescore;name,Off" -SaveScores,2="mod,savescore;name,On" - -#ScreenJukeboxMenu -RandomModifiers="2;together" -RandomModifiersDefault="mod,clear" -RandomModifiers,1="name,Off" -RandomModifiers,2="mod,random;name,Random" - -# ScreenOptionsEditMode -Edit Steps="1;together;SelectNone" -Edit StepsDefault="" -Edit Steps,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" -Transfer To USB Drive="1;together;SelectNone" -Transfer To USB DriveDefault="" -Transfer To USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" -Transfer From USB Drive="1;together;SelectNone" -Transfer From USB DriveDefault="" -Transfer From USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer From USB Drive" - -[ScreenReloadSongs] -Class="ScreenReloadSongs" -Fallback="Screen" -NextScreen=ScreenTitleBranch() - -[DancingCharacters] -#2D Character X/Y positions in relation to the center -#of the screen -2DCharacterXP1=-220 -2DCharacterYP1=0 -2DCharacterXP2=220 -2DCharacterYP2=0 - -[FadingBanner] -BannerOnCommand= -BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 -BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 -BannerResetFadeCommand=diffusealpha,1 - -[HelpDisplay] -TipShowTime=3.5 -TipOnCommand=shadowlength,0;diffuseblink - -[CombinedLifeMeterTug] -MeterWidth=550 - -[ScoreDisplayRave] -MeterP1OnCommand=rotationz,-90 -MeterP2OnCommand=rotationz,-90 -LevelP1OnCommand=addy,-140 -LevelP2OnCommand=addy,-140 - -[ScoreDisplayLifeTime] -FrameOnCommand= -TimeRemainingOnCommand= -DeltaSecondsOnCommand=addx,50;zoom,0.75; -DeltaSecondsNoneCommand=visible,false; -DeltaSecondsHitMineCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsAvoidMineCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsCheckpointMissCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsCheckpointHitCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsMissCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsW5Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsW4Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsW3Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsW2Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsW1Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsLetGoCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsHeldCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 -DeltaSecondsGainLifeCommand= - -[PlayerStageStats] -NumGradeTiersUsed=8 -GradePercentTier01=1.00 -GradePercentTier02=0.99 -GradePercentTier03=0.97 -GradePercentTier04=0.93 -GradePercentTier05=0.80 -GradePercentTier06=0.65 -GradePercentTier07=0.45 -GradePercentTier08=-99999.000000 -GradeTier01IsAllW2s=false -GradeTier02IsAllW2s=false -GradeTier02IsFullCombo=false - -[HighScore] -EmptyName="STEP" - -[ScreenSetTime] -Class="ScreenSetTime" -ShowStyleIcon=false -TimerSeconds=-1 -TimerOnCommand=visible,false -Fallback="ScreenWithMenuElements" -NextScreen="ScreenOptionsService" -PrevScreen="ScreenOptionsService" - -[Banner] -ScrollRandom=false -ScrollRoulette=false - -[ScreenEdit] -Class="ScreenEdit" -Fallback="ScreenWithMenuElementsBlank" -PrepareScreens=GetEditModeSubScreens() -GroupedScreens=GetEditModeSubScreens() -PersistScreens=GetEditModeSubScreens() -EditMode="EditMode_Full" -NextScreen="ScreenEditMenu" -PrevScreen="ScreenEditMenu" -ShowHelp=false -AllowOperatorMenuButton=false -ShowCoinsAndCredits=false -ShowStyleIcon=false -TimerSeconds=-1 -EditModifiers="" -EditHelpX=SCREEN_LEFT+4 -EditHelpY=SCREEN_TOP+40 -EditHelpOnCommand=halign,0;valign,0;shadowlength,0 -InfoX=SCREEN_RIGHT-114 -InfoY=SCREEN_TOP+40 -InfoOnCommand=halign,0;valign,0;shadowlength,0; -PlayRecordHelpX=SCREEN_LEFT+20 -PlayRecordHelpY=SCREEN_BOTTOM-20 -PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,0 - -[ScreenEditOptions] -Fallback="ScreenOptions" -Class="ScreenOptionsMaster" -NextScreen="none" -PrevScreen="none" -CancelTransitionsOut=true -PlayMusic=false -TimerSeconds=-1 -ShowStyleIcon=false -LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" -Line1="list,Speed" -Line2="list,Accel" -Line3="list,Effect" -Line4="list,Appearance" -Line5="list,Turn" -Line6="list,Insert" -Line7="list,Scroll" -Line8="list,NoteSkins" -Line9="list,Holds" -Line10="list,Mines" -Line11="list,Hide" -Line12="list,Persp" -Line13="list,Assist" -Line14="list,Rate" -Line15="list,AutoAdjust" -Line16="conf,EditorShowBGChangesPlay" -OutCancelCommand= - -[RadarValues] -WriteComplexValues=true -WriteSimpleValues=true - -[RadarCategory] -TapsAndHolds=true - -[Course] -SortPreferredColor=color("1,1,1,1") -- Preferred is both for when courses are in preferred sort, or are autogen -SortLevel1Color=color("1,0,0,1") -SortLevel2Color=color("1,1,0,1") -SortLevel3Color=color("1,0.5,0,1") -SortLevel4Color=color("1,1,0,1") -SortLevel5Color=color("0,1,0,1") - -[Inventory] -ItemUseRateSeconds=0 - -[ScreenMemcardSaveEditsAfterDeleteSteps] - -[ScreenMemcardSaveEditsAfterSave] - -[ScreenMemcardSaveEditsAfterExit] - -[ScreenMiniMenu] -Class="ScreenMiniMenu" -Fallback="ScreenOptions" -PrevScreen= -ShowHelp=false -TimerSeconds=-1 -ShowExplanations=false -ShowExitRow=false -ContainerOnCommand= -ContainerOffCommand= -NumRowsShown=30 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local indexOffset = itemIndex-(numItems-1)/2; self:y( SCREEN_CENTER_Y + indexOffset * 20 ); end -ShowStyleIcon=false -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP+40 -HeaderOnCommand= -HeaderOffCommand= -AllowRepeatingChangeValueInput=true -CursorOnCommand=visible,false -OptionRowNormalMetricsGroup="OptionRowMiniMenu" - -[OptionRowMiniMenu] -Fallback="OptionRow" -IconsP1X=SCREEN_CENTER_X-280 -IconsP2X=SCREEN_CENTER_X+280 -IconsOnCommand=x,-30 -FrameX=SCREEN_CENTER_X-232 -TitleX=SCREEN_CENTER_X-150 -TitleOnCommand=halign,0;shadowlength,2 -ItemsStartX=SCREEN_CENTER_X-150 -ItemsEndX=SCREEN_CENTER_X+280 -ItemsGapX=14 -ItemsLongRowP1X=SCREEN_CENTER_X-60 -ItemsLongRowP2X=SCREEN_CENTER_X+100 -ItemsLongRowSharedX=SCREEN_CENTER_X+150 -ItemOnCommand= -ColorSelected=color("0.5,1,0.5,1") -ColorNotSelected=color("1,1,1,1") -ColorDisabled=color("0.5,0.5,0.5,1") -TweenSeconds=0 - -[ScreenMiniMenuContext] -Fallback="ScreenMiniMenu" -NumRowsShown=10 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(24*(offsetFromCenter-(numItems-1)/2)) end -LineHighlightX=0 -ShowHelp=false -OptionRowNormalMetricsGroup="OptionRowMiniMenuContext" - -[OptionRowMiniMenuContext] -Fallback="OptionRowMiniMenu" -TitleX=-54 - -[ScreenMiniMenuEditHelp] -Fallback="ScreenMiniMenu" -ColorDisabled=color("1,1,1,1") - -[ScreenMiniMenuMainMenu] -Fallback="ScreenMiniMenu" - -TitleX=SCREEN_CENTER_X-80 - -[ScreenMiniMenuAreaMenu] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuStepsInformation] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuSongInformation] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuBackgroundChange] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuPreferences] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuInsertTapAttack] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuInsertCourseAttack] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuCourseDisplay] -Fallback="ScreenMiniMenu" - -[ScreenMiniMenuCourseOptions] -Fallback="ScreenMiniMenu" - -[ScreenTextEntry] -Class="ScreenTextEntry" -Fallback="ScreenWithMenuElements" -PrevScreen= -HelpText= -TimerSeconds=-1 -ShowStyleIcon=false -RowStartX=SCREEN_LEFT+100 -RowStartY=SCREEN_CENTER_Y-30 -RowEndX=SCREEN_RIGHT-100 -RowEndY=SCREEN_BOTTOM-96 -QuestionX=SCREEN_CENTER_X -QuestionY=SCREEN_CENTER_Y-40 -QuestionOnCommand=zoom,1.5;wrapwidthpixels,600 -QuestionOffCommand= -AnswerX=SCREEN_CENTER_X -AnswerY=SCREEN_CENTER_Y+20 -AnswerOnCommand=zoom,1.5;shadowlength,0 -AnswerOffCommand= -CursorOnCommand= -CursorOffCommand= -KeysInitCommand=zoom,0.8;shadowlength,0 - -[ScreenPrompt] -Class="ScreenPrompt" -Fallback="ScreenWithMenuElementsBlank" -TimerSeconds=-1 - -QuestionX=SCREEN_CENTER_X -QuestionY=SCREEN_CENTER_Y-60 -QuestionOnCommand=zoom,0.7;wrapwidthpixels,600 -QuestionOffCommand= -CursorOnCommand= -CursorOffCommand= -Answer1Of1X=SCREEN_CENTER_X -Answer1Of1Y=SCREEN_CENTER_Y+120 -Answer1Of1OnCommand=maxwidth,100 -Answer1Of1OffCommand= -Answer1Of2X=SCREEN_CENTER_X-50 -Answer1Of2Y=SCREEN_CENTER_Y+120 -Answer1Of2OnCommand=maxwidth,100 -Answer1Of2OffCommand= -Answer2Of2X=SCREEN_CENTER_X+50 -Answer2Of2Y=SCREEN_CENTER_Y+120 -Answer2Of2OnCommand=maxwidth,100 -Answer2Of2OffCommand= -Answer1Of3X=SCREEN_CENTER_X-170 -Answer1Of3Y=SCREEN_CENTER_Y+120 -Answer1Of3OnCommand=maxwidth,100 -Answer1Of3OffCommand= -Answer2Of3X=SCREEN_CENTER_X-20 -Answer2Of3Y=SCREEN_CENTER_Y+120 -Answer2Of3OnCommand=maxwidth,100 -Answer2Of3OffCommand= -Answer3Of3X=SCREEN_CENTER_X+150 -Answer3Of3Y=SCREEN_CENTER_Y+120 -Answer3Of3OnCommand=maxwidth,100 -Answer3Of3OffCommand= - -[GameState] -UseNameBlacklist=false -DefaultSort="Group" -DefaultSong="" -AreStagePlayerModsForced=AreStagePlayerModsForced -AreStageSongModsForced=AreStageSongModsForced -GradeTierForExtra1="Grade_Tier03" -AllowExtra2=true -GradeTierForExtra2="Grade_Tier03" -AllowLateJoin=false -ProfileRecordFeats=true -CategoryRecordFeats=true -MinDifficultyForExtra="Difficulty_Hard" -LockExtraStageSelection=true - -[ScreenOptionsManage] -Fallback="ScreenOptionsSimple" -TimerSeconds=-1 -AllowRepeatingChangeValueInput=true -OptionRowNormalMetricsGroup="OptionRowManage" - -[OptionRowManage] -Fallback="OptionRowSimple" -TitleX=SCREEN_CENTER_X-150 - -[ScreenOptionsManageEditSteps] -Class="ScreenOptionsManageEditSteps" -Fallback="ScreenOptionsManage" -CreateNewScreen="ScreenEditMenu" -EditMode="EditMode_Full" -PrevScreen="ScreenSelectEditMode" -NextScreen="ScreenOptionsEditCourse" -PrepareScreens="ScreenMiniMenuContext" -GroupedScreens="ScreenMiniMenuContext" -PersistScreens="ScreenMiniMenuContext" - -[ScreenOptionsManageCourses] -Class="ScreenOptionsManageCourses" -Fallback="ScreenOptionsManage" -PrevScreen=ScreenTitleBranch() -NextScreen="ScreenOptionsEditCourse" -GroupedScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt,ScreenOptionsEditCourseMods" -PersistScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt" -PrepareScreens="ScreenTextEntry,ScreenPrompt" -CreateNewScreen="ScreenOptionsEditCourse" -EditMode="EditMode_Full" - -[ScreenOptionsEditCourse] -Class="ScreenOptionsEditCourse" -Fallback="ScreenOptionsSimple" -PrevScreen="ScreenOptionsCourseOverview" -NextScreen="ScreenOptionsCourseOverview" -OptionRowNormalMetricsGroup="OptionRowEditCourse" -LineHighlightOnCommand=x,-100 - -[OptionRowEditCourse] -Fallback="OptionRowSimple" -TitleX=SCREEN_CENTER_X-250 -ItemsLongRowSharedX=SCREEN_CENTER_X-100 - -[ScreenOptionsCourseOverview] -Class="ScreenOptionsCourseOverview" -Fallback="ScreenOptionsSimple" -PrevScreen="ScreenOptionsManageCourses" -NextScreen="ScreenOptionsManageCourses" -PlayScreen="ScreenJoinMultiplayer" -EditScreen="ScreenOptionsEditCourse" -OptionRowNormalMetricsGroup="OptionRowCourseOverview" - -[OptionRowCourseOverview] -Fallback="OptionRowSimple" -TitleX=SCREEN_CENTER_X-250 -ItemsLongRowSharedX=SCREEN_CENTER_X-100 - -[ScreenEditCourseMods] -Class="ScreenEdit" -Fallback="ScreenEdit" -EditMode="EditMode_CourseMods" -NextScreen="ScreenOptionsEditCourseEntry" -PrevScreen="ScreenOptionsEditCourseEntry" - -[ScreenOptionsManageProfiles] -Class="ScreenOptionsManageProfiles" -Fallback="ScreenOptionsSimple" -PrevScreen="ScreenOptionsService" -NextScreen="ScreenOptionsService" -PrepareScreens="ScreenMiniMenuContext" -GroupedScreens="ScreenMiniMenuContext" -PersistScreens="ScreenMiniMenuContext" -ShowStyleIcon=false -TimerSeconds=-1 - -[ScreenOptionsEditProfile] -Class="ScreenOptionsEditProfile" -Fallback="ScreenOptionsServiceChild" -PrevScreen="ScreenOptionsManageProfiles" -NextScreen="ScreenOptionsManageProfiles" -TimerSeconds=-1 -ShowExplanations=false -AllowRepeatingChangeValueInput=true -WrapValueInRow=0 - -[ProfileManager] -FixedProfiles=false -NumFixedProfiles=1 - -[ScreenJoinMultiplayer] -Class="ScreenJoinMultiplayer" -Fallback="ScreenWithMenuElements" -TimerSeconds=-1 - -[PaneDisplay] -ShiftP1X=-40 -ShiftP1Y=0 -ShiftP2X=-70 -ShiftP2Y=0 -CountFormat="%3.0f" -NumStepsTextX=-18+64*-0.5 -NumStepsTextY=16*-1 -NumStepsTextOnCommand=shadowlength,0; -NumStepsTextOffCommand=linear,0.1;diffusealpha,0; -NumStepsLabelX=-34-4+64*-0.5 -NumStepsLabelY=16*-1 -NumStepsLabelOnCommand=halign,1 -NumStepsLabelOffCommand=linear,0.1;diffusealpha,0; - -JumpsTextX=-18+64*-0.5 -JumpsTextY=16*0 -JumpsTextOnCommand=shadowlength,0; -JumpsTextOffCommand=linear,0.1;diffusealpha,0; -JumpsLabelX=-34+64*-0.5 -JumpsLabelY=16*0 -JumpsLabelOnCommand=halign,1 -JumpsLabelOffCommand=linear,0.1;diffusealpha,0; - -HoldsTextX=-18+64*1.5 -HoldsTextY=16*-1 -HoldsTextOnCommand=shadowlength,0; -HoldsTextOffCommand=linear,0.1;diffusealpha,0; -HoldsLabelX=-34+64*1.5 -HoldsLabelY=16*-1 -HoldsLabelOnCommand=halign,1 -HoldsLabelOffCommand=linear,0.1;diffusealpha,0; - -MinesTextX=-18+64*0.5 -MinesTextY=16*-1 -MinesTextOnCommand=shadowlength,0; -MinesTextOffCommand=linear,0.1;diffusealpha,0; -MinesLabelX=-34+64*0.5 -MinesLabelY=16*-1 -MinesLabelOnCommand=halign,1 -MinesLabelOffCommand=linear,0.1;diffusealpha,0; - -HandsTextX=-18+64*0.5 -HandsTextY=16*0 -HandsTextOnCommand=shadowlength,0; -HandsTextOffCommand=linear,0.1;diffusealpha,0; -HandsLabelX=-34+64*0.5 -HandsLabelY=16*0 -HandsLabelOnCommand=halign,1 -HandsLabelOffCommand=linear,0.1;diffusealpha,0; - -RollsTextX=-18+64*1.5 -RollsTextY=16*0 -RollsTextOnCommand=shadowlength,0; -RollsTextOffCommand=linear,0.1;diffusealpha,0; -RollsLabelX=-34+64*1.5 -RollsLabelY=16*0 -RollsLabelOnCommand=halign,1 -RollsLabelOffCommand=linear,0.1;diffusealpha,0; - -# lifts were added in sm-ssc. (hiding them for now though, since SM4 doesn't have 'em.) -LiftsTextX=-18+64*1.5 -LiftsTextY=16*0 -LiftsTextOnCommand=shadowlength,0;visible,false -LiftsTextOffCommand=linear,0.1;diffusealpha,0; -LiftsLabelX=-34+64*1.5 -LiftsLabelY=16*0 -LiftsLabelOnCommand=halign,1;visible,false -LiftsLabelOffCommand=linear,0.1;diffusealpha,0; - -MachineHighScoreTextX=170 -MachineHighScoreTextY=16*-1 -MachineHighScoreTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); -MachineHighScoreTextOffCommand=linear,0.1;diffusealpha,0; -MachineHighScoreLabelX= -MachineHighScoreLabelY= -MachineHighScoreLabelOnCommand=visible,false; - -MachineHighNameTextX=120 -MachineHighNameTextY=16*-1 -MachineHighNameTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); -MachineHighNameTextOffCommand=linear,0.1;diffusealpha,0; -MachineHighNameLabelX= -MachineHighNameLabelY= -MachineHighNameLabelOnCommand=visible,false; -MachineHighNameLabelOffCommand= - -ProfileHighScoreTextX=145 -ProfileHighScoreTextY=16*0 -ProfileHighScoreTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); -ProfileHighScoreTextOffCommand= -ProfileHighScoreLabelX= -ProfileHighScoreLabelY= -ProfileHighScoreLabelOnCommand=visible,false; -ProfileHighScoreLabelOffCommand= - -[ScreenSandbox] -Class="ScreenSandbox" -Fallback="Screen" - -[PlayerSyncMachine] -Fallback="Player" -ComboOnCommand=visible,false - -[Profile] -ShowCoinData=true -UnlockAuthString= - -[NoteField] -ShowBoard=false -ShowBeatBars=false -FadeBeforeTargetsPercent=0 -BarMeasureAlpha=1 -Bar4thAlpha=1 -Bar8thAlpha=1 -Bar16thAlpha=1 -RoutineNoteSkinP1=default -RoutineNoteSkinP2=default - -[ArrowEffects] -FrameWidthEffectsPixelsPerSecond=400 -FrameWidthEffectsMinMultiplier=0.5 -FrameWidthEffectsMaxMultiplier=1.2 -FrameWidthLockEffectsToOverlapping=false -FrameWidthLockEffectsTweenPixels=25 -ArrowSpacing=64 - -[SoundEffectControl] -LockToHold=false - -[SoundEffectControl_Off] -Fallback="SoundEffectControl" -SoundProperty="" -PropertyMin=1.0 -PropertyCenter=1.0 -PropertyMax=1.0 - -[SoundEffectControl_Speed] -Fallback="SoundEffectControl" -SoundProperty="Speed" -PropertyMin=4/8 -PropertyCenter=1.0 -PropertyMax=16/8 - -[SoundEffectControl_Pitch] -Fallback="SoundEffectControl" -SoundProperty="Pitch" -PropertyMin=7/8 -PropertyCenter=1.0 -PropertyMax=9/8 - -[StepsDisplayList] -ItemsSpacingY=20 -NumShownItems=5 -CapitalizeDifficultyNames=1 -CursorP1OnCommand= -CursorP1OffCommand= -CursorP1TweenOnCommand=linear,0.5;diffusealpha,1 -CursorP1ChangeCommand=finishtweening;decelerate,0.15 -CursorP2OnCommand= -CursorP2OffCommand= -CursorP2TweenOnCommand=linear,0.5;diffusealpha,1 -CursorP2ChangeCommand=finishtweening;decelerate,0.15 -RowOnCommand= -RowOffCommand= -MoveCommand=finishtweening;linear,0.3 -CursorP1ShowCommand=sleep,.3;linear,.3;diffusealpha,1 -CursorP2ShowCommand=sleep,.3;linear,.3;diffusealpha,1 -CursorP1HideCommand=linear,.3;diffusealpha,0 -CursorP2HideCommand=linear,.3;diffusealpha,0 - -[StreamDisplay] -; a simple bar life meter: -; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end -# this was moved to a file in scripts -PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - local zoomed_width=28; \ - local zoomed_height=8; \ - local spacing_x=11.3; \ - self:zoomtoheight(zoomed_height); \ - self:x((itemIndex-(numItems/2))*spacing_x); \ - local zoomed_width=0; \ - if (itemIndex % 2) == 0 then \ - self:zoomtowidth(24); \ - self:rotationz(90); \ - else \ - self:zoomtowidth(31); \ - self:rotationz(-58); \ - end; \ -end -TextureCoordScaleX=10 -NumPills=20 -# if these metrics aren't used, nuke 'em -UseThreePartMethod=false -ThreePartWidth=128 -AlwaysBounceNormalBar=false - -[StreamDisplayExtra] -Fallback="StreamDisplay" - -[ScoreDisplayNormal] -FrameX=0 -FrameY=0 -TextX=0 -TextY=0 -TextOnCommand=shadowlength,0; -TextLoadCommand=%function(self,param) self:diffuse(PlayerScoreColor(param.PlayerState:GetPlayerNumber())); end - -[RollingNumbers] -TextFormat="%09.0f" -ApproachSeconds=0.2 -Commify=true -LeadingZeroMultiplyColor=color("#777777FF") - -[RollingNumbersEvaluation] -Fallback="RollingNumbers" -ApproachSeconds=2 - -[RollingNumbersJudgment] -TextFormat="%04.0f" -ApproachSeconds=0.2 -Commify=false -Fallback="RollingNumbers" -ApproachSeconds=1 - -[GraphDisplay] -BodyWidth=140 -BodyHeight=38 - -[ComboGraph] -BodyWidth=140 - -[CustomScoring] -ComboAboveThresholdAddsToScoreBonus=0 -ComboScoreBonusThreshold=50 -ComboScoreBonusValue=1000 -# this was removed in SM4 -ComboMultiplier=0.0 - -DoubleNoteScoreMultiplier=1.0 -TripleNoteScoreMultiplier=1.0 -QuadOrHigherNoteScoreMultiplier=1.0 - -PointsW1=1000 -PointsW2=1000 -PointsW3=500 -PointsW4=100 -PointsW5=-200 -PointsMiss=-500 -PointsHitMine=-500 -PointsCheckpointHit=1000 -PointsCheckpointMiss=-200 -PointsNone=0 -PointsHoldHeld=1000 -PointsHoldLetGo=-500 - -[CustomDifficulty] -#See pump theme for an example -Names="" - -[ScreenOptionsEdit] -Class="ScreenOptionsMaster" -Fallback="ScreenOptionsSimple" -; This NextScreen is only used for the "exit" choice. -NextScreen=ScreenTitleBranch() -PrevScreen=ScreenTitleBranch() -LineNames="1,2,3,4,5,6" -Line1="gamecommand;screen,ScreenEditMenu;name,Edit Songs/Steps" -Line2="gamecommand;screen,ScreenOptionsExportPackage;name,Export Packages" -Line3="gamecommand;screen,ScreenOptionsManageCourses;name,Edit Courses" -Line4="gamecommand;screen,ScreenServiceActionCopyEditsMachineToMemoryCard;name,Transfer Edits to USB" -Line5="gamecommand;screen,ScreenOptionsGraphicsSound;name,Transfer Edits from USB" -Line6="gamecommand;screen,ScreenOptionsAdvanced;name,Clear USB edits" - -[ScreenOptionsExportPackage] -Class="ScreenOptionsExportPackage" -Fallback="ScreenOptionsSimple" -PrevScreen="ScreenOptionsEdit" -NextScreen="ScreenOptionsEdit" - -[ScreenOptionsEditChild] -Fallback="ScreenOptionsServiceChild" -PrevScreen="ScreenOptionsEdit" -NextScreen="ScreenOptionsEdit" - -[ScreenServiceAction] -Class="ScreenServiceAction" -Fallback="ScreenOptionsEditChild" - -[ScreenServiceActionCopyEditsMachineToMemoryCard] -Fallback="ScreenServiceAction" -Actions="CopyEditsMachineToMemoryCard" - -[ScreenServiceActionCopyEditsMemoryCardToMachine] -Fallback="ScreenServiceAction" -Actions="CopyEditsMemoryCardToMachine" +# portkit-SM4: based on the StepMania 4 theme, mainly by Chris Danford. +[Global] +IsBaseTheme=0 + +[Common] +AutoSetStyle=false +ColorP1Command=diffuse,PlayerColor(PLAYER_1) +ColorP2Command=diffuse,PlayerColor(PLAYER_2) +InitialScreen="ScreenCompany" +FirstAttractScreen="ScreenCompany" +DefaultModifiers="default;1.5x" +DefaultCpuModifiers="" +DefaultNoteSkinName="default" +DifficultiesToShow="beginner,easy,medium,hard,challenge" +CourseDifficultiesToShow="easy,medium,hard" +StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet" +ScreenWidth=640 +ScreenHeight=480 +OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay" +MaxCourseEntriesBeforeShowVarious=6 +AllStepsTypeInOneList=false +PercentScoreDecimalPlaces=2 +NoScoreName="STEP" + +[Gameplay] +ComboIsPerRow=GAMESTATE:GetPlayMode() == "PlayMode_Oni" +MinScoreToContinueCombo=GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3" +MinScoreToMaintainCombo="TapNoteScore_W3" + +[Screen] +ScreenInitCommand= +ScreenOnCommand= +AllowOperatorMenuButton=true +RepeatRate=-1 +RepeatDelay=-1 +PrepareScreens= +PersistScreens= +GroupedScreens= +CodeNames="" +CancelCancelCommand= +ShowCoinsAndCredits=true +LightsMode="LightsMode_MenuStartAndDirections" + +[ModeSwitcher] +PrevModeX=-200 +PrevModeY=-170 +PrevIconX=-200 +PrevIconY=-120 +PrevModeZoom=0.8 +NextModeX=200 +NextModeY=-170 +NextIconX=200 +NextIconY=-120 +NextModeZoom=0.8 +CurrentModeX=0 +CurrentModeY=0 +CurrentModeZoom=1 + +[UnlockManager] +AutoLockChallengeSteps=false +UnlockNames="" +# UnlockNames="1,2" +# The song "Pledge" requires 500 AP. +# Unlock1Command=song,"Pledge";require,"UnlockRequirement_ArcadePoints",500 + +# The song "ABC" can be unlocked via roulette; pick an arbitrary code +# to use to store the unlock. +# Unlock2Command=song,"ABC";code,"59183751";roulette + +[LightsManager] +GameButtonsToShow="" + +[ScreenSelect] +Fallback="ScreenWithMenuElements" +UpdateOnMessage="" + +[ScreenTitleMenu] +# Note that we don't use the "name" parameter to Choices here. Name1 is +# the displayed text, which might be translated or otherwise changed. The "name,foo" +# parameter to ModeChoices is an asset name, which is used in filenames. +Class="ScreenTitleMenu" +Fallback="ScreenSelectMasterBlank" +PrevScreen=THEME:GetMetric("Common","FirstAttractScreen"); +LightsMode="LightsMode_Joining" +ScreenOnCommand=lockinput,0 +CoinModeChangeScreen=ScreenTitleBranch() +SharedSelection=true +AllowDisabledPlayerInput=true +OverrideSleepAfterTweenOffSeconds=true +SleepAfterTweenOffSeconds=0 +NumChoicesOnPage1=100 +WrapCursor=true +AllowRepeatingInput=true +ChoiceNames="1,2,3,4,5,6,7" +DefaultChoice="1" +Choice1="applydefaultoptions;screen,ScreenProfileLoad;text,Game Start" +Choice2="screen,ScreenNetworkOptions;text,Play Online" +Choice3="screen,ScreenSelectGame;text,Select Game" +Choice4="screen,ScreenOptionsService;text,Options" +Choice5="screen,ScreenOptionsEdit;text,Edit/Share" +Choice6="screen,ScreenJukeboxMenu;text,Jukebox" +Choice7="screen,ScreenExit;text,Exit" +Choice8="screen,ScreenTest;text,Sandbox" +ShowIcon=false +ShowScroller=true +PerChoiceScrollElement=false +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(32*(itemIndex-(numItems-1)/2)); end +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=20 +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y+30 +ScrollerOnCommand= +ScrollerOffCommand= +TimerSeconds=-1 +ShowStyleIcon=false +ShowHelp=true +HelpText=ScreenString("HelpTextOptionsSimple") +HelpOnCommand=%function(self,param) local fn = THEME:GetMetric("ScreenWithMenuElements","HelpOnCommand"); fn(self); self:finishtweening(); end +IdleCommentSeconds=12 +IdleTimeoutSeconds=30 +IdleTimeoutScreen=THEME:GetMetric("Common","FirstAttractScreen") +OutDelay=.2 +# frieza hax +DoublePressToSelect=false +# this one sucks though +UseTwoLists=false +OptionOrderBUp="" +OptionOrderBDown="" +OptionOrderBLeft="" +OptionOrderBRight="" +OptionOrderBAuto="" + +[ScreenExit] +Class="ScreenExit" +Fallback="Screen" +AllowOperatorMenuButton=false + +[ScreenTitleJoin] +Class="ScreenTitleMenu" +Fallback="ScreenTitleMenu" +ChoiceNames="1" +# frieza hax +ChoiceNamesB="" +OptionOrderBUp="" +OptionOrderBDown="" +OptionOrderBLeft="" +OptionOrderBRight="" +OptionOrderBAuto="" + +[ScreenCaution] +Fallback="ScreenSplash" +PrepareScreen="ScreenSelectStyle" +NextScreen="ScreenSelectStyle" +PrevScreen=ScreenTitleBranch() +TimerSeconds=3 +AllowStartToSkip=true + +[ScreenProfileLoad] +Class="ScreenProfileLoad" +Fallback="ScreenWithMenuElementsBlank" +NextScreen=ScreenCautionBranch() +PrevScreen=ScreenTitleBranch() +TimerSeconds=-1 +LoadEdits=true +ShowHelp=false + +[ScreenProfileSave] +Class="ScreenProfileSave" +Fallback="ScreenWithMenuElements" +NextScreen=ScreenProfileSaveNextScreen() +PrevScreen=ScreenTitleBranch() +TimerSeconds=-1 +ShowHelp=false + +[ScreenSelectStyle] +Fallback="ScreenWithMenuElements" +Class="ScreenSelectMaster" +HelpText=ScreenString("HelpTextNormal") +IdleCommentSeconds=0 +IdleTimeoutSeconds=0 +TimerSeconds=30 +UpdateOnMessage="" +PrevScreen="ScreenTitleMenu" +ChoiceNames="1,2,3" +# The "name" here affects the announcer, eg. "ScreenSelectStyle comment single". +Choice1="style,single;name,1Player;text,1 Player;screen,ScreenSelectPlayMode" +Choice2="style,versus;name,2Players;text,2 Players;screen,ScreenSelectPlayMode" +Choice3="style,double;name,Double;text,Double;screen,ScreenSelectPlayMode" +ShowIcon=true +PerChoiceIconElement=false +ShowScroller=false +ShowCursor=false +SharedSelection=true +UseIconMetrics=false +NumChoicesOnPage1=3 +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +PreSwitchPageSeconds=0 +PostSwitchPageSeconds=0 +OptionOrderUp= +OptionOrderDown= +OptionOrderLeft= +OptionOrderRight= +OptionOrderAuto= +WrapCursor=false +WrapScroller=false +LoopScroller=false +PerChoiceScrollElement=false +AllowRepeatingInput=false +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=1 +ScrollerTransform=function() end; +ScrollerSubdivisions=1 +DefaultChoice="1" +MorePage1X=0 +MorePage1Y=0 +MorePage2X=0 +MorePage2Y=0 +ExplanationPage1X=0 +ExplanationPage1Y=0 +ExplanationPage2X=0 +ExplanationPage2Y=0 +HeaderOnCommand= +HeaderOffCommand= +# frieza hax +DoublePressToSelect=false +# this one sucks +UseTwoLists=false +ChoiceNamesB="" +OptionOrderBUp="" +OptionOrderBDown="" +OptionOrderBLeft="" +OptionOrderBRight="" +OptionOrderBAuto="" + +[ScreenSelectPlayMode] +Fallback="ScreenWithMenuElements" +Class="ScreenSelectMaster" +HelpText=ScreenString("HelpTextNormal") +IdleCommentSeconds=0 +IdleTimeoutSeconds=0 +TimerSeconds=30 +UpdateOnMessage="" +PrevScreen="ScreenTitleMenu" +ChoiceNames="1,2,3,4,5" +# The "name" here affects the announcer, eg. "ScreenSelectStyle comment single". +#Choice1="playmode,regular;name,Normal;text,Normal;screen,ScreenSelectMusic" +Choice1="playmode,regular;name,Normal;text,Normal;screen,"..ScreenSelectMusicBranch() +Choice2="playmode,nonstop;name,Nonstop;text,Nonstop;screen,ScreenSelectMusic" +Choice3="playmode,oni;name,Challenge;text,Challenge;screen,ScreenSelectMusic" +Choice4="playmode,oni;name,Survival;text,Survival;screen,ScreenSelectMusic" +Choice5="playmode,endless;name,Endless;text,Endless;screen,ScreenSelectMusic" +ShowIcon=true +PerChoiceIconElement=false +ShowScroller=false +ShowCursor=false +SharedSelection=true +UseIconMetrics=false +NumChoicesOnPage1=5 +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +PreSwitchPageSeconds=0 +PostSwitchPageSeconds=0 +OptionOrderUp= +OptionOrderDown= +OptionOrderLeft= +OptionOrderRight= +OptionOrderAuto= +WrapCursor=false +WrapScroller=false +LoopScroller=false +PerChoiceScrollElement=false +AllowRepeatingInput=false +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=1 +ScrollerTransform=function() end; +ScrollerSubdivisions=1 +DefaultChoice="1" +MorePage1X=0 +MorePage1Y=0 +MorePage2X=0 +MorePage2Y=0 +ExplanationPage1X=0 +ExplanationPage1Y=0 +ExplanationPage2X=0 +ExplanationPage2Y=0 +HeaderOnCommand= +HeaderOffCommand= +# frieza hax +DoublePressToSelect=false +# this one sucks +UseTwoLists= +OptionOrderBUp= +OptionOrderBDown= +OptionOrderBLeft= +OptionOrderBRight= +OptionOrderBAuto= + +[ScreenSelectMode] +Fallback="ScreenSelect" +JoinFrameP1X=SCREEN_CENTER_X-200 +JoinFrameP1Y=SCREEN_CENTER_Y+110 +JoinFrameP2X=SCREEN_CENTER_X+200 +JoinFrameP2Y=SCREEN_CENTER_Y+110 +JoinMessageP1X=SCREEN_CENTER_X-200 +JoinMessageP1Y=SCREEN_CENTER_Y+96 +JoinMessageP2X=SCREEN_CENTER_X+200 +JoinMessageP2Y=SCREEN_CENTER_Y+96 +GuideX=SCREEN_CENTER_X+0 +GuideY=SCREEN_CENTER_Y+134 +TimerSeconds=30 +TimerStealth=false +ShowStyleIcon=true +NextScreen=ScreenSelectGroupBranch() +ScrollingListX=SCREEN_CENTER_X+0 +ScrollingListY=SCREEN_CENTER_Y+10 +UseSelectionBGAnimations=0 +SelectionSpecificBGAnimations=0 +BounceJoinMessage=true +FoldOnJoin=true +ScrollingListOffCommand=bouncebegin,0.5;zoomy,0 +GuideOffCommand=bouncebegin,0.5;addy,400 +ChoiceListHighlightOffCommand=linear,0.5;diffusealpha,0;glow,1,1,1,0 +ChoiceListFrameOffCommand=linear,0.5;diffusealpha,0;glow,1,1,1,0 +UseModeSpecificBGAnims=false +EnableCharSelect=false +Only2DChars=false +CharacterIconP1Y=SCREEN_CENTER_Y+0 +CharacterIconP1X=SCREEN_CENTER_X+0 +CharacterIconP2Y=SCREEN_CENTER_Y+0 +CharacterIconP2X=SCREEN_CENTER_X+0 +CharacterIconP1OffCommand=linear,0.3;diffusealpha,0;sleep,10 +CharacterIconP2OffCommand=linear,0.3;diffusealpha,0;sleep,10 + +[GroupList] +StartX=0 +StartY=-136 +SpacingX=0 +SpacingY=28 +ButtonFrameGainFocusCommand=stoptweening;linear,0.2;x,-40 +ButtonFrameLoseFocusCommand=stoptweening;linear,0.2;x,0 + +ButtonGainFocusCommand=glowshift;effectperiod,0.5 +ButtonLoseFocusCommand=stopeffect +LabelGainFocusCommand=glowshift;effectperiod,0.5 +LabelLoseFocusCommand=stopeffect +ButtonHideItemCommand=linear,0.2;diffusealpha,0 +ButtonShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; +LabelHideItemCommand=linear,0.2;diffusealpha,0 +LabelShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; +# This just selects the type of tweening used for scrolling the list; it shouldn't actually +# queue any commands. +FrameScrollTweenCommand=stoptweening;linear,0.2; + +[MusicList] +NumColumns=4 +NumRows=10 +StartX=0 +StartY=0 +SpacingX=150 +CropWidth=146 +TitleInitCommand=halign,0;valign,0;shadowlength,2; + +[ScreenInstructions] +Class="ScreenInstructions" +Fallback="ScreenWithMenuElements" +NextScreen="ScreenSelectCharacter" +PrevScreen=ScreenTitleBranch() +TimerSeconds=15 +ShowStyleIcon=true + +[ScreenSelectMusic] +Class="ScreenSelectMusic" +Fallback="ScreenWithMenuElements" +NextScreen=GetSelectMusicNext() +PrevScreen=ScreenTitleBranch() +MusicWheelType="MusicWheel" +HelpText=ScreenString("HelpTextSelectMusic") +SampleMusicLoops=true +SampleMusicFallbackFadeInSeconds=0 +ShowOptionsMessageSeconds=1.5 +BannerX=0 +BannerY=0 +BannerOnCommand=scaletoclipped,322,120;visible,false;ztest,1 +BannerOffCommand= +ShowStageDisplay=true +ShowStageFrame=true +CDTitleX=SCREEN_CENTER_X+240 +CDTitleY=SCREEN_CENTER_Y-50 +CDTitleFrontCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Back"; +CDTitleBackCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Front";diffuse,color("#606060"); +CDTitleOnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6;draworder,101 +CDTitleOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +ScoreFrameP1X= +ScoreFrameP1Y= +ScoreFrameP1OnCommand=visible,false +ScoreFrameP1OffCommand= +ScoreFrameP2X= +ScoreFrameP2Y= +ScoreFrameP2OnCommand=visible,false +ScoreFrameP2OffCommand= +ScoreP1X= +ScoreP1Y= +ScoreP1OnCommand=visible,false +ScoreP1OffCommand= +ScoreP2X= +ScoreP2Y= +ScoreP2OnCommand= +ScoreP2OffCommand= +# Don't use relative motion here. It's usually possible to change the +# sort again while this command is still executing. +ScoreP1SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,58 +ScoreP2SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,269 +ScoreFrameP1SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,58 +ScoreFrameP2SortChangeCommand=stoptweening;decelerate,0.128;x,920;sleep,0.128;accelerate,0.25;x,269 +MusicWheelX=SCREEN_CENTER_X-178 +MusicWheelY=SCREEN_CENTER_Y-10 +MusicWheelOnCommand=draworder,-100 +MusicWheelOffCommand= +TimerSeconds=60 +ShowStyleIcon=true +SampleMusicDelay=0.25 +SampleMusicDelayInit=0 +DoRouletteOnMenuTimer=true +AlignMusicBeat=false +Codes="" +OptionsMenuAvailable=OptionsMenuAvailable() +SelectMenuAvailable=false +ModeMenuAvailable=ModeMenuAvailable() +ScreenModsCommand=setupmusicstagemods +PreviousSongButton="MenuLeft" +NextSongButton="MenuRight" +UseOptionsList=false +TwoPartSelection=false +# this metric is not supported in regular sm4 anymore: +TwoPartConfirmsOnly=false +UsePlayerSelectMenu=false +StepsDisplayP1X= +StepsDisplayP1Y= +StepsDisplayP1OnCommand=visible,false +StepsDisplayP1OffCommand= +StepsDisplayP2X= +StepsDisplayP2Y= +StepsDisplayP2OnCommand=visible,false +StepsDisplayP2OffCommand= +PaneDisplayP1X=SCREEN_CENTER_X-180 +PaneDisplayP1Y=SCREEN_CENTER_Y+194 +PaneDisplayP1OnCommand= +PaneDisplayP1OffCommand= +PaneDisplayP2X=SCREEN_CENTER_X+180 +PaneDisplayP2Y=SCREEN_CENTER_Y+194 +PaneDisplayP2OnCommand= +PaneDisplayP2OffCommand= +OptionsAreaP1X=SCREEN_CENTER_X+166 +OptionsAreaP1Y=SCREEN_CENTER_Y+128 +OptionsAreaP1OnCommand= +OptionsAreaP1OffCommand= +OptionsAreaP2X=SCREEN_CENTER_X+166 +OptionsAreaP2Y=SCREEN_CENTER_Y+148 +OptionsAreaP2OnCommand= +OptionsAreaP2OffCommand= +SelectMenuChangesDifficulty=true +SelectMenuScreenName="ScreenPlayerOptions" +OptionsListTimeout=0.5 +WrapChangeSteps=false + +[ScreenSelectCourse] +Class="ScreenSelectMusic" +Fallback="ScreenSelectMusic" +BPMDisplayOnCommand=visible,false +CDTitleOnCommand=visible,false +ExplanationX=SCREEN_CENTER_X-188 +ExplanationY=SCREEN_CENTER_Y-172 +ExplanationOnCommand=addx,-SCREEN_WIDTH;sleep,0.5;bounceend,0.5;addx,SCREEN_WIDTH +ExplanationOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH +Codes="CourseCodeDetector" +DoRouletteOnMenuTimer=false +ScreenModsCommand=setupcoursestagemods + +[ScreenSelectCourseNonstop] +Fallback="ScreenSelectCourse" +DefaultSort="Nonstop" + +[ScreenSelectCourseOni] +Fallback="ScreenSelectCourse" +DefaultSort="Oni" +ScoreP1OnCommand=visible,false +ScoreP2OnCommand=visible,false +ScoreFrameP1OnCommand=visible,false +ScoreFrameP2OnCommand=visible,false + +[ScreenSelectCourseEndless] +Fallback="ScreenSelectCourse" +DefaultSort="Endless" + +[ScreenSMOnlineLogin] +Class="ScreenSMOnlineLogin" +Fallback="ScreenOptionsServiceChild" +NextScreen=SMOnlineScreen() +PrevScreen=ScreenTitleBranch() +ShowStyleIcon=false +TimerSeconds=-1 +ShowHelp=false + +[ScreenNetRoom] +MusicSelectScreen="ScreenSMOnlineSelectMusic" +PrevScreen=ScreenTitleBranch() +NextScreen="ScreenGameplayBranch" +Fallback="ScreenNetSelectMusic" +Class="ScreenNetRoom" +HelpText="" +OpenRoomColor=color("1.0,1.0,1.0,1.0") +PasswdRoomColor=color("1.0,0.5,0.5,1.0") +InGameRoomColor=color("1.0,0.1,0.1,1.0") +RoomWheelX=SCREEN_CENTER_X-178 +RoomWheelY=SCREEN_CENTER_Y-10 +RoomWheelOnCommand=draworder,-100 +RoomInfoDisplayX=SCREEN_CENTER_X +RoomInfoDisplayY=SCREEN_CENTER_Y + +[ScreenSMOnlineSelectMusic] +PrevScreen="ScreenNetRoom" +Class="ScreenNetSelectMusic" +RoomSelectScreen="ScreenNetRoom" +Fallback="ScreenNetSelectMusic" + +[ScreenNetSelectMusic] +Fallback="ScreenWithMenuElements" +Class="ScreenNetSelectMusic" +BannerWidth=0 +BannerHeight=0 +MusicWheelX=SCREEN_CENTER_X-178 +MusicWheelY=SCREEN_CENTER_Y-10 +MusicWheelOnCommand=draworder,-100 +MusicWheelOffCommand= +TimerStealth=true +BPMDisplayX=SCREEN_CENTER_X*0.3 +BPMDisplayY=SCREEN_CENTER_Y+120 +BPMDisplayOnCommand=halign,1;shadowlength,1;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +BPMDisplayOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +ModIconsP1X=SCREEN_CENTER_X+144 +ModIconsP1Y=SCREEN_CENTER_Y-165 +ModIconsP1OnCommand=zoomy,0;linear,0.5;zoomy,1 +ModIconsP1OffCommand=linear,0.5;zoomy,0 +ModIconsP2X=SCREEN_CENTER_X+144 +ModIconsP2Y=SCREEN_CENTER_Y-164 +ModIconsP2OnCommand=zoomy,0;linear,0.5;zoomy,1 +ModIconsP2OffCommand=linear,0.5;zoomy,0 +ChatInputBoxX=SCREEN_CENTER_X+144 +ChatInputBoxY=SCREEN_CENTER_Y+112 +ChatInputBoxOnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +ChatInputBoxOffCommand=bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +ChatInputBoxWidth=310 +ChatInputBoxHeight=60 +ChatInputBoxColor=color("0.5,0.5,1.0,0.7") +ChatOutputBoxX=SCREEN_CENTER_X+144 +ChatOutputBoxY=SCREEN_CENTER_Y-37 +ChatOutputBoxOnCommand=zoomy,1.1;addx,SCREEN_WIDTH*0.6;bounceend,0.5;diffusealpha,1;addx,-SCREEN_WIDTH*0.6 +ChatOutputBoxOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0;zoom,0; +ChatOutputBoxWidth=310 +ChatOutputBoxHeight=210 +ChatOutputBoxColor=color("1.0,0.5,0.5,0.7") +ChatInputX=SCREEN_CENTER_X-2 +ChatInputY=SCREEN_CENTER_Y+90 +ChatInputOnCommand=diffusealpha,0;linear,0.55;diffusealpha,1 +ChatInputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 +ChatOutputX=SCREEN_CENTER_X-2 +ChatOutputY=SCREEN_CENTER_Y+68 +ChatOutputOnCommand=diffusealpha,0;linear,0.55;diffusealpha,1 +ChatOutputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0 +UsersX=SCREEN_CENTER_X-265 +UsersY=SCREEN_CENTER_Y+172 +UsersDX=40 +UsersAY=16 +UsersOnCommand=draworder,2;zoom,1 +UsersOffCommand=linear,0.5;zoom,0 +Users0Command=draworder,2;diffuse,1.0,0.4,0.4,1.0 +Users1Command=draworder,2;diffuse,1.0,1.0,1.0,1.0 +Users2Command=draworder,2;diffuse,0.5,0.5,1.0,1.0 +Users3Command=draworder,2;diffuse,0.5,1.0,0.5,1.0 +Users4Command=draworder,2;diffuse,1.0,0.5,0.5,1.0 +optionsY=SCREEN_CENTER_Y-170 +optionsX=SCREEN_CENTER_X-240 +optionsOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,0.7;zoomx,0.7 +optionsOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +MeterP1Y=SCREEN_CENTER_Y+150 +MeterP1X=SCREEN_CENTER_X-223 +MeterP1OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +MeterP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +MeterP2Y=SCREEN_CENTER_Y+150 +MeterP2X=SCREEN_CENTER_X-110 +MeterP2OnCommand=halign,1;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +MeterP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +DiffBGColor=color("0.7,0.7,0.7,0.7") +DiffBGWidth=0 +DiffBGHeight=0 +DiffBGY=SCREEN_CENTER_Y+160 +DiffBGX=SCREEN_CENTER_X-60 +DiffBGOnCommand=zoomz,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +DiffBGOffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +ChatOutputLines=14 +ChatTextOutputWidth=304 +ChatTextInputWidth=304 +NumStylesShow=1 +NumSongsShow=4 +NumGroupsShow=3 +ShowStyleIcon=false +TimerSeconds= +PrevScreen=ScreenTitleBranch() +NextScreen="ScreenStage" +NoSongsScreen=ScreenTitleBranch() +DifficultyIconP1OnCommand=visible,false +DifficultyIconP1OffCommand= +DifficultyIconP2OnCommand=visible,false +DifficultyIconP2OffCommand= +DifficultyIconP1X=SCREEN_CENTER_X+50 +DifficultyIconP1Y=SCREEN_BOTTOM-54 +DifficultyIconP2X=SCREEN_CENTER_X+80 +DifficultyIconP2Y=SCREEN_BOTTOM-50 +HelpText=ScreenString("HelpTextNetSelectMusic"); + +[ScreenSplash] +Class="ScreenSplash" +Fallback="ScreenWithMenuElementsBlank" +MinimumScreenPrepareDelaySeconds=0 +AllowStartToSkip=false +PrepareScreen= + +[ScreenStage] +Fallback="ScreenSplash" +PrepareScreen=GetGameplayScreen() +NextScreen=GetGameplayScreen() +PrevScreen=SongSelectionScreen() +LightsMode="LightsMode_Stage" +TimerSeconds=3 + +[ScreenGameplay] +Class="ScreenGameplayNormal" +Fallback="ScreenWithMenuElementsBlank" +PrevScreen=SongSelectionScreen() +NextScreen=GetGameplayNextScreen() +LightsMode="LightsMode_Gameplay" +TimerSeconds=-1 +# this metric is not supported in regular sm4 anymore: +UseAlternativeInput=false +PlayerType="Player" +PlayerInitCommand=y,SCREEN_CENTER_Y +StartGivesUp=true +BackGivesUp=false +FailOnMissCombo=-1 +GivingUpGoesToPrevScreen=false +GivingUpGoesToNextScreen=false +InitialBackgroundBrightness=1 +MinSecondsToStep=6.0 +MinSecondsToMusic=1.0 +MinSecondsToStepNextSong=2.0 +MusicFadeOutSeconds=0.5 +OutTransitionLength=1.5 +CourseTransitionLength=0.5 +BeginFailedDelay=1.0 +AllowCenter1Player=true +ScoreKeeperClass="ScoreKeeperNormal" +SongBackgroundOnCommand= +SongForegroundOnCommand= +OniGameOverP1X=SCREEN_CENTER_X-160 +OniGameOverP1Y=SCREEN_TOP-200 +OniGameOverP1OnCommand=diffusealpha,0 +OniGameOverP1OffCommand= +OniGameOverP1DieCommand=diffusealpha,1;bounceend,0.5;y,SCREEN_CENTER_Y;bob;effectperiod,4;effectmagnitude,0,6,0 +OniGameOverP2X=SCREEN_CENTER_X+160 +OniGameOverP2Y=SCREEN_TOP-200 +OniGameOverP2OnCommand=diffusealpha,0 +OniGameOverP2OffCommand= +OniGameOverP2DieCommand=diffusealpha,1;bounceend,0.5;y,SCREEN_CENTER_Y;bob;effectperiod,4;effectmagnitude,0,6,0 +LifeFrameX=SCREEN_CENTER_X+0 +LifeFrameY=SCREEN_TOP +LifeFrameOnCommand=valign,0;addy,-100;linear,0.5;addy,100 +LifeFrameOffCommand=linear,0.5;addy,-100 +LifeP1X=SCREEN_CENTER_X-184 +LifeP1Y=SCREEN_CENTER_Y-212 +LifeP1OnCommand=addy,-100;linear,0.5;addy,100 +LifeP1OffCommand=linear,0.5;addy,-100 +LifeP2X=SCREEN_CENTER_X+184 +LifeP2Y=SCREEN_CENTER_Y-212 +LifeP2OnCommand=rotationy,180;addy,-100;linear,0.5;addy,100 +LifeP2OffCommand=linear,1;addy,-100 +CombinedLifeX=SCREEN_CENTER_X+0 +CombinedLifeY=SCREEN_CENTER_Y-212 +CombinedLifeOnCommand=addy,-100;linear,0.5;addy,100 +CombinedLifeOffCommand=linear,0.5;addy,-100 +ShowStageDisplay=not GAMESTATE:IsCourseMode() +ShowStageFrame=true +StageDisplayX=SCREEN_CENTER_X+0 +StageDisplayY=SCREEN_CENTER_Y-206 +StageDisplayOnCommand=draworder,-1;addy,-100;linear,0.5;addy,100 +StageDisplayOffCommand=linear,0.5;addy,-100 +StageFrameX=SCREEN_CENTER_X +StageFrameY=SCREEN_CENTER_Y-202 +StageFrameOnCommand=draworder,-2;addy,-100;linear,0.5;addy,100 +StageFrameOffCommand= +SongNumberP1X=SCREEN_CENTER_X-25 +SongNumberP1Y=SCREEN_CENTER_Y-206 +SongNumberP1OnCommand=addy,-100;linear,0.5;addy,100 +SongNumberP1OffCommand=linear,0.5;addy,-100 +SongNumberP2X=SCREEN_CENTER_X+25 +SongNumberP2Y=SCREEN_CENTER_Y-206 +SongNumberP2OnCommand=addy,-100;linear,0.5;addy,100 +SongNumberP2OffCommand=linear,0.5;addy,-100 +ShowScoreInRave=true +ScoreFrameX=SCREEN_CENTER_X +ScoreFrameY=SCREEN_BOTTOM +ScoreFrameOnCommand=valign,1;addy,100;linear,0.5;addy,-100;draworder,2 +ScoreFrameOffCommand=linear,0.5;addy,100 +ScoreP1X=SCREEN_CENTER_X-220 +ScoreP1Y=SCREEN_CENTER_Y+200 +ScoreP1OnCommand=addy,100;linear,1;addy,-100;draworder,109; +ScoreP1OffCommand=linear,1;addy,100; +ScoreP2X=SCREEN_CENTER_X+220 +ScoreP2Y=SCREEN_CENTER_Y+200 +ScoreP2OnCommand=addy,100;linear,1;addy,-100;draworder,109; +ScoreP2OffCommand=linear,1;addy,100; +SecondaryScoreP1X=SCREEN_CENTER_X-20 +SecondaryScoreP1Y=SCREEN_CENTER_Y+0 +SecondaryScoreP1OnCommand= +SecondaryScoreP1OffCommand= +SecondaryScoreP2X=SCREEN_CENTER_X+20 +SecondaryScoreP2Y=SCREEN_CENTER_Y+0 +SecondaryScoreP2OnCommand= +SecondaryScoreP2OffCommand= +PlayerOptionsP1X=SCREEN_CENTER_X+0 +PlayerOptionsP1Y=SCREEN_CENTER_Y+194 +PlayerOptionsP1OnCommand=visible,false +PlayerOptionsP1OffCommand= +PlayerOptionsP2X=SCREEN_CENTER_X+0 +PlayerOptionsP2Y=SCREEN_CENTER_Y+210 +PlayerOptionsP2OnCommand=visible,false +PlayerOptionsP2OffCommand= +ScoreboardC1P1X=SCREEN_CENTER_X-260 +ScoreboardC1P1Y=SCREEN_CENTER_Y-160 +ScoreboardC1P1OnCommand=zoom,1 +ScoreboardC1P1OffCommand=zoom,1 +ScoreboardC2P1X=SCREEN_CENTER_X-140 +ScoreboardC2P1Y=SCREEN_CENTER_Y-160 +ScoreboardC2P1OnCommand=zoom,1 +ScoreboardC2P1OffCommand=zoom,1 +ScoreboardC3P1X=SCREEN_CENTER_X-30 +ScoreboardC3P1Y=SCREEN_CENTER_Y-160 +ScoreboardC3P1OnCommand=zoom,1 +ScoreboardC3P1OffCommand=zoom,1 +ScoreboardC1P2X=SCREEN_CENTER_X+40 +ScoreboardC1P2Y=SCREEN_CENTER_Y-160 +ScoreboardC1P2OnCommand=zoom,1 +ScoreboardC1P2OffCommand=zoom,1 +ScoreboardC2P2X=SCREEN_CENTER_X+160 +ScoreboardC2P2Y=SCREEN_CENTER_Y-160 +ScoreboardC2P2OnCommand=zoom,1 +ScoreboardC2P2OffCommand=zoom,1 +ScoreboardC3P2X=SCREEN_CENTER_X+270 +ScoreboardC3P2Y=SCREEN_CENTER_Y-160 +ScoreboardC3P2OnCommand=zoom,1 +ScoreboardC3P2OffCommand=zoom,1 +StepsDescriptionP1X= +StepsDescriptionP1Y= +StepsDescriptionP1OnCommand=visible,false +StepsDescriptionP1OffCommand= +StepsDescriptionP2X= +StepsDescriptionP2Y= +StepsDescriptionP2OnCommand=visible,false +StepsDescriptionP2OffCommand= +SongOptionsX=SCREEN_CENTER_X+0 +SongOptionsY=SCREEN_CENTER_Y+230 +SongOptionsOnCommand=addy,100;linear,0.5;addy,-100 +SongOptionsOffCommand=linear,0.5;addy,100 +StepsDisplayP1X=SCREEN_CENTER_X-240 +StepsDisplayP1Y= +StepsDisplayP1OnCommand= +StepsDisplayP1OffCommand=linear,0.5;addx,-200 +StepsDisplayP1SetReverseCommand=y,SCREEN_CENTER_Y-196;addy,-100;linear,1;addy,100 +StepsDisplayP1SetNoReverseCommand=y,SCREEN_CENTER_Y+174;addy,100;linear,1;addy,-100 +StepsDisplayP2X=SCREEN_CENTER_X+240 +StepsDisplayP2Y= +StepsDisplayP2OnCommand= +StepsDisplayP2OffCommand=linear,0.5;addx,200 +StepsDisplayP2SetReverseCommand=y,SCREEN_CENTER_Y-196;addy,-100;linear,1;addy,100 +StepsDisplayP2SetNoReverseCommand=y,SCREEN_CENTER_Y+174;addy,100;linear,1;addy,-100 +LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+160 +LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-140 +# This is used if one player is in reverse and the other isn't. +LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-205 +LyricDisplayDefaultColor=color("0,1,0,1") + +ActiveAttackListP1X= +ActiveAttackListP1Y= +ActiveAttackListP1OnCommand=visible,false +ActiveAttackListP1OffCommand= +ActiveAttackListP2X= +ActiveAttackListP2Y= +ActiveAttackListP2OnCommand=visible,false +ActiveAttackListP2OffCommand= +SurviveTimeX=SCREEN_CENTER_X+0 +SurviveTimeY=SCREEN_CENTER_Y+100 +SurviveTimeOnCommand=sleep,0.3;linear,0.3;diffusealpha,1;sleep,3.5;linear,0.5;diffusealpha,0 +DebugX=SCREEN_CENTER_X +DebugY=SCREEN_CENTER_Y +DebugOnCommand=wrapwidthpixels,SCREEN_WIDTH-50;strokecolor,color("#000000"); +DebugOffCommand=stoptweening;linear,1/8;diffusealpha,0 +SecondsBetweenComments=10 +TickEarlySeconds=0.05 +ShowLifeMeterForDisabledPlayers=false +PlayerP1OnCommand= +PlayerP1OffCommand= +PlayerP2OnCommand= +PlayerP2OffCommand= +PlayerP1OnePlayerOneSideX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP2OnePlayerOneSideX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP1TwoPlayersTwoSidesX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP2TwoPlayersTwoSidesX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT)) +PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP1TwoPlayersSharedSidesX=SCREEN_CENTER_X +PlayerP2TwoPlayersSharedSidesX=SCREEN_CENTER_X +LeftFrameX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT))-160 +LeftFrameY=SCREEN_CENTER_Y +LeftFrameOnCommand=addx,-200;linear,0.5;addx,200 +LeftFrameOffCommand=linear,0.5;addx,-200 +RightFrameX=math.floor(scale(0.75,0,1,SCREEN_LEFT,SCREEN_RIGHT))+160 +RightFrameY=SCREEN_CENTER_Y +RightFrameOnCommand=addx,200;linear,0.5;addx,-200 +RightFrameOffCommand=linear,0.5;addx,200 +ShowModIconRows=true +ModIconRowP1X=THEME:GetMetric(Var "LoadingScreen","LeftFrameX")+6 +ModIconRowP1Y=SCREEN_CENTER_Y +ModIconRowP1OnCommand=player,"PlayerNumber_P1";addx,-200;linear,0.5;addx,200 +ModIconRowP1OffCommand=linear,0.5;addx,-200 +ModIconRowP2X=THEME:GetMetric(Var "LoadingScreen","RightFrameX")-6 +ModIconRowP2Y=SCREEN_CENTER_Y +ModIconRowP2OnCommand=player,"PlayerNumber_P2";addx,200;linear,0.5;addx,-200 +ModIconRowP2OffCommand=linear,0.5;addx,200 + +StopCourseEarly=false +ShowEvaluationOnFail=true + +[ScreenGameplayExtra] +Fallback="ScreenGameplay" +LifeFrameX=SCREEN_CENTER_X+0 +LifeFrameY=SCREEN_CENTER_Y+202 +LifeFrameOnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +LifeFrameOffCommand=linear,1;addy,100 +LifeP1X=SCREEN_CENTER_X-180 +LifeP1Y=SCREEN_CENTER_Y+210 +LifeP1OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +LifeP1OffCommand=linear,1;addy,100 +LifeP2X=SCREEN_CENTER_X+180 +LifeP2Y=SCREEN_CENTER_Y+210 +LifeP2OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +LifeP2OffCommand=linear,1;addy,100 +StageDisplayX=SCREEN_CENTER_X+0 +StageDisplayY=SCREEN_CENTER_Y+182 +StageDisplayOnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +StageDisplayOffCommand=linear,1;addy,100 +SongNumberP1X=SCREEN_CENTER_X-30 +SongNumberP1Y=SCREEN_CENTER_Y+200 +SongNumberP1OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +SongNumberP1OffCommand=linear,1;addy,100 +SongNumberP2X=SCREEN_CENTER_X+30 +SongNumberP2Y=SCREEN_CENTER_Y+200 +SongNumberP2OnCommand=addy,100;sleep,0.5;linear,1;addy,-100 +SongNumberP2OffCommand=linear,1;addy,100 +ScoreP1X=SCREEN_CENTER_X-214 +ScoreP1Y=SCREEN_CENTER_Y-202 +ScoreP1OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 +ScoreP1OffCommand=linear,1;addy,-100 +ScoreP2X=SCREEN_CENTER_X+214 +ScoreP2Y=SCREEN_CENTER_Y-202 +ScoreP2OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 +ScoreP2OffCommand=linear,1;addy,-100 +SecondaryScoreP1X=SCREEN_CENTER_X-20 +SecondaryScoreP1Y=SCREEN_CENTER_Y+0 +SecondaryScoreP1OnCommand= +SecondaryScoreP1OffCommand= +SecondaryScoreP2X=SCREEN_CENTER_X+20 +SecondaryScoreP2Y=SCREEN_CENTER_Y+0 +SecondaryScoreP2OnCommand= +SecondaryScoreP2OffCommand= +PlayerOptionsP1X=SCREEN_CENTER_X+0 +PlayerOptionsP1Y=SCREEN_CENTER_Y-194 +PlayerOptionsP1OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 +PlayerOptionsP1OffCommand=linear,1;addy,-100 +PlayerOptionsP2X=SCREEN_CENTER_X+0 +PlayerOptionsP2Y=SCREEN_CENTER_Y-210 +PlayerOptionsP2OnCommand=addy,-100;sleep,0.5;linear,1;addy,100 +PlayerOptionsP2OffCommand=linear,1;addy,-100 +SongOptionsX=SCREEN_CENTER_X+0 +SongOptionsY=SCREEN_CENTER_Y-230 +SongOptionsOnCommand=addy,-100;sleep,0.5;linear,1;addy,100 +SongOptionsOffCommand=linear,1;addy,-100 +DifficultyP1X=SCREEN_CENTER_X-260 +DifficultyP1Y=SCREEN_CENTER_Y+180 +DifficultyP1OnCommand=addx,-200;sleep,0.5;linear,1;addx,200 +DifficultyP1OffCommand=linear,1;addx,-200 +DifficultyP1ReverseX=SCREEN_CENTER_X-260 +DifficultyP1ReverseY=SCREEN_CENTER_Y-170 +DifficultyP1ReverseOnCommand=addx,-200;sleep,0.5;linear,1;addx,200 +DifficultyP1ReverseOffCommand=linear,1;addx,-200 +DifficultyP2X=SCREEN_CENTER_X+260 +DifficultyP2Y=SCREEN_CENTER_Y+180 +DifficultyP2OnCommand=addx,200;sleep,0.5;linear,1;addx,-200 +DifficultyP2OffCommand=linear,1;addx,200 +DifficultyP2ReverseX=SCREEN_CENTER_X+260 +DifficultyP2ReverseY=SCREEN_CENTER_Y-170 +DifficultyP2ReverseOnCommand=addx,200;sleep,0.5;linear,1;addx,-200 +DifficultyP2ReverseOffCommand=linear,1;addx,200 + +[ScreenGameplayShared] +Class="ScreenGameplayShared" +Fallback="ScreenGameplay" +PlayerType="PlayerShared" + +[ScreenEvaluation] +Fallback="ScreenWithMenuElements" +Class="ScreenEvaluation" +LightsMode="LightsMode_MenuStartOnly" +HelpText=ScreenString("HelpTextEvaluation") +Summary=false +CheckpointsWithJudgments=false +TimerSeconds=15 +DisqualifiedP1X= +DisqualifiedP1Y= +DisqualifiedP2X= +DisqualifiedP2Y= +PlayerOptionsSeparator="," +PlayerOptionsHideFailType=false +MaxComboNumDigits=4 +ShowStyleIcon=true +ShowBannerArea=true +ShowSharedJudgmentLineLabels=true +ShowJudgmentLineW1=true +ShowJudgmentLineW2=true +ShowJudgmentLineW3=true +ShowJudgmentLineW4=true +ShowJudgmentLineW5=true +ShowJudgmentLineHeld=false +ShowJudgmentLineMiss=true +ShowJudgmentLineMaxCombo=true +ShowPeakComboAward=false +ShowTimingDifficulty=true + +BannerWidth=268 +BannerHeight=98 + +GradeP1X=SCREEN_CENTER_X-222 +GradeP1Y=SCREEN_CENTER_Y-104 +GradeP1OnCommand=glowshift;effectperiod,2;addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 +GradeP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 +GradeP2X=SCREEN_CENTER_X+222 +GradeP2Y=SCREEN_CENTER_Y-104 +GradeP2OnCommand=glowshift;effectperiod,2;addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +GradeP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 +GradeFrameP1X=SCREEN_CENTER_X-222 +GradeFrameP1Y=SCREEN_CENTER_Y-104 +GradeFrameP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 +GradeFrameP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 +GradeFrameP2X=SCREEN_CENTER_X+222 +GradeFrameP2Y=SCREEN_CENTER_Y-104 +GradeFrameP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +GradeFrameP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 + +W1LabelX=SCREEN_CENTER_X+0 +W1LabelY=SCREEN_CENTER_Y-36+29*0 +W1LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*0;decelerate,0.3;addy,-SCREEN_HEIGHT +W1LabelOffCommand=sleep,0.7-0.1*0;accelerate,0.3;addy,SCREEN_HEIGHT + +W1NumberP1X=SCREEN_CENTER_X-100 +W1NumberP1Y=SCREEN_CENTER_Y-36+29*0 +W1NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 +W1NumberP1OffCommand=sleep,0.7;accelerate,0.3;addx,-SCREEN_WIDTH/2 +W1NumberP2X=SCREEN_CENTER_X+100 +W1NumberP2Y=SCREEN_CENTER_Y-36+29*0 +W1NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +W1NumberP2OffCommand=sleep,0.7-0.1*0;accelerate,0.3;addx,SCREEN_WIDTH/2 + +W2LabelX=SCREEN_CENTER_X+0 +W2LabelY=SCREEN_CENTER_Y-36+29*1 +W2LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*1;decelerate,0.3;addy,-SCREEN_HEIGHT +W2LabelOffCommand=sleep,0.7-0.1*1;accelerate,0.3;addy,SCREEN_HEIGHT + +W2NumberP1X=SCREEN_CENTER_X-100 +W2NumberP1Y=SCREEN_CENTER_Y-36+29*1 +W2NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,SCREEN_WIDTH/2 +W2NumberP1OffCommand=sleep,0.7-0.1*1;accelerate,0.3;addx,-SCREEN_WIDTH/2 +W2NumberP2X=SCREEN_CENTER_X+100 +W2NumberP2Y=SCREEN_CENTER_Y-36+29*1 +W2NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,-SCREEN_WIDTH/2 +W2NumberP2OffCommand=sleep,0.7-0.1*1;accelerate,0.3;addx,SCREEN_WIDTH/2 + +W3LabelX=SCREEN_CENTER_X+0 +W3LabelY=SCREEN_CENTER_Y-36+29*2 +W3LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*2;decelerate,0.3;addy,-SCREEN_HEIGHT +W3LabelOffCommand=sleep,0.7-0.1*2;accelerate,0.3;addy,SCREEN_HEIGHT + +W3NumberP1X=SCREEN_CENTER_X-100 +W3NumberP1Y=SCREEN_CENTER_Y-36+29*2 +W3NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,SCREEN_WIDTH/2 +W3NumberP1OffCommand=sleep,0.7-0.1*2;accelerate,0.3;addx,-SCREEN_WIDTH/2 +W3NumberP2X=SCREEN_CENTER_X+100 +W3NumberP2Y=SCREEN_CENTER_Y-36+29*2 +W3NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,-SCREEN_WIDTH/2 +W3NumberP2OffCommand=sleep,0.7-0.1*2;accelerate,0.3;addx,SCREEN_WIDTH/2 + +W4LabelX=SCREEN_CENTER_X+0 +W4LabelY=SCREEN_CENTER_Y-36+29*3 +W4LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*3;decelerate,0.3;addy,-SCREEN_HEIGHT +W4LabelOffCommand=sleep,0.7-0.1*3;accelerate,0.3;addy,SCREEN_HEIGHT + +W4NumberP1X=SCREEN_CENTER_X-100 +W4NumberP1Y=SCREEN_CENTER_Y-36+29*3 +W4NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,SCREEN_WIDTH/2 +W4NumberP1OffCommand=sleep,0.7-0.1*3;accelerate,0.3;addx,-SCREEN_WIDTH/2 +W4NumberP2X=SCREEN_CENTER_X+100 +W4NumberP2Y=SCREEN_CENTER_Y-36+29*3 +W4NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,-SCREEN_WIDTH/2 +W4NumberP2OffCommand=sleep,0.7-0.1*3;accelerate,0.3;addx,SCREEN_WIDTH/2 + +W5LabelX=SCREEN_CENTER_X +W5LabelY=SCREEN_CENTER_Y-36+29*4 +W5LabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*4;decelerate,0.3;addy,-SCREEN_HEIGHT +W5LabelOffCommand=sleep,0.7-0.1*4;accelerate,0.3;addy,SCREEN_HEIGHT + +W5NumberP1X=SCREEN_CENTER_X-100 +W5NumberP1Y=SCREEN_CENTER_Y-36+29*4 +W5NumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,SCREEN_WIDTH/2 +W5NumberP1OffCommand=sleep,0.7-0.1*4;accelerate,0.3;addx,-SCREEN_WIDTH/2 +W5NumberP2X=SCREEN_CENTER_X+100 +W5NumberP2Y=SCREEN_CENTER_Y-36+29*4 +W5NumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,-SCREEN_WIDTH/2 +W5NumberP2OffCommand=sleep,0.7-0.1*4;accelerate,0.3;addx,SCREEN_WIDTH/2 + +HeldLabelX= +HeldLabelY= +HeldLabelOnCommand= +HeldLabelOffCommand= + +HeldNumberP1X= +HeldNumberP1Y= +HeldNumberP1OnCommand= +HeldNumberP1OffCommand= +HeldNumberP2X= +HeldNumberP2Y= +HeldNumberP2OnCommand= +HeldNumberP2OffCommand= + +MissLabelX=SCREEN_CENTER_X+0 +MissLabelY=SCREEN_CENTER_Y-36+29*5 +MissLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*5;decelerate,0.3;addy,-SCREEN_HEIGHT +MissLabelOffCommand=sleep,0.7-0.1*5;accelerate,0.3;addy,SCREEN_HEIGHT + +MissNumberP1X=SCREEN_CENTER_X-100 +MissNumberP1Y=SCREEN_CENTER_Y-36+29*5 +MissNumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*5;decelerate,0.3;addx,SCREEN_WIDTH/2 +MissNumberP1OffCommand=sleep,0.7-0.1*5;accelerate,0.3;addx,-SCREEN_WIDTH/2 +MissNumberP2X=SCREEN_CENTER_X+100 +MissNumberP2Y=SCREEN_CENTER_Y-36+29*5 +MissNumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*5;decelerate,0.3;addx,-SCREEN_WIDTH/2 +MissNumberP2OffCommand=sleep,0.7-0.1*5;accelerate,0.3;addx,SCREEN_WIDTH/2 + +MaxComboMaxDigits=5 +MaxComboLabelX=SCREEN_CENTER_X+0 +MaxComboLabelY=SCREEN_CENTER_Y-36+29*6 +MaxComboLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.1+0.1*6;decelerate,0.3;addy,-SCREEN_HEIGHT +MaxComboLabelOffCommand=sleep,0.7-0.1*6;accelerate,0.3;addy,SCREEN_HEIGHT + +MaxComboNumberP1X=SCREEN_CENTER_X-100 +MaxComboNumberP1Y=SCREEN_CENTER_Y-36+29*6 +MaxComboNumberP1OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#ffd900");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*6;decelerate,0.3;addx,SCREEN_WIDTH/2 +MaxComboNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +MaxComboNumberP2X=SCREEN_CENTER_X+100 +MaxComboNumberP2Y=SCREEN_CENTER_Y-36+29*6 +MaxComboNumberP2OnCommand=shadowlength,0;shadowcolor,color("#000000AA");diffuse,color("#5bff00");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*6;decelerate,0.3;addx,-SCREEN_WIDTH/2 +MaxComboNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +ScoreLabelX=SCREEN_CENTER_X+0 +ScoreLabelY=SCREEN_CENTER_Y+178 +ScoreLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.8;decelerate,0.3;addy,-SCREEN_HEIGHT +ScoreLabelOffCommand=sleep,0.0;accelerate,0.3;addy,SCREEN_HEIGHT +ScoreNumberP1X=SCREEN_CENTER_X-212 +ScoreNumberP1Y=SCREEN_CENTER_Y+178 +ScoreNumberP1OnCommand=shadowlength,0;diffuse,PlayerScoreColor("PlayerNumber_P1");addx,-SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,SCREEN_WIDTH/2 +ScoreNumberP1OffCommand=sleep,0.0;accelerate,0.3;addx,-SCREEN_WIDTH/2 +ScoreNumberP2X=SCREEN_CENTER_X+212 +ScoreNumberP2Y=SCREEN_CENTER_Y+178 +ScoreNumberP2OnCommand=shadowlength,0;diffuse,PlayerScoreColor("PlayerNumber_P2");addx,SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,-SCREEN_WIDTH/2 +ScoreNumberP2OffCommand=sleep,0.0;accelerate,0.3;addx,SCREEN_WIDTH/2 + +LargeBannerX=SCREEN_CENTER_X-1 +LargeBannerY=SCREEN_CENTER_Y-106-3 +LargeBannerOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +LargeBannerOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +LargeBannerFrameX=SCREEN_CENTER_X+0 +LargeBannerFrameY=SCREEN_CENTER_Y-106 +LargeBannerFrameOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +LargeBannerFrameOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT + +PlayerOptionsP1X=SCREEN_CENTER_X-70 +PlayerOptionsP1Y=SCREEN_CENTER_Y-182 +PlayerOptionsP1OnCommand=visible,false;halign,0;valign,1;shadowlength,2;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +PlayerOptionsP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +PlayerOptionsP2X=SCREEN_CENTER_X+70 +PlayerOptionsP2Y=SCREEN_CENTER_Y-90 +PlayerOptionsP2OnCommand=visible,false;halign,1;valign,1;shadowlength,2;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +PlayerOptionsP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT + +SurvivedFrameP1X=SCREEN_CENTER_X-224 +SurvivedFrameP1Y=SCREEN_CENTER_Y+16 +SurvivedFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +SurvivedFrameP1OffCommand=linear,0.7;diffusealpha,0 +SurvivedFrameP2X=SCREEN_CENTER_X+224 +SurvivedFrameP2Y=SCREEN_CENTER_Y+16 +SurvivedFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +SurvivedFrameP2OffCommand=linear,0.7;diffusealpha,0 +SurvivedNumberP1X=SCREEN_CENTER_X-224 +SurvivedNumberP1Y=SCREEN_CENTER_Y+0 +SurvivedNumberP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +SurvivedNumberP1OffCommand=linear,0.7;diffusealpha,0 +SurvivedNumberP2X=SCREEN_CENTER_X+224 +SurvivedNumberP2Y=SCREEN_CENTER_Y+0 +SurvivedNumberP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +SurvivedNumberP2OffCommand=linear,0.7;diffusealpha,0 + +TimingDifficultyNumberX=SCREEN_CENTER_X+116 +TimingDifficultyNumberY=SCREEN_CENTER_Y-205 +TimingDifficultyNumberOnCommand=draworder,2;shadowlength,0 +TimingDifficultyNumberOffCommand= +TimingDifficultyFrameX=SCREEN_CENTER_X+114+3 +TimingDifficultyFrameY=SCREEN_CENTER_Y-204+3 +TimingDifficultyFrameOnCommand=draworder,2 +TimingDifficultyFrameOffCommand= + +NumStepsNumberP1X=SCREEN_CENTER_X-204 +NumStepsNumberP1Y=SCREEN_CENTER_Y+52+16*-1 +NumStepsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 +NumStepsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +NumStepsNumberP2X=SCREEN_CENTER_X+240 +NumStepsNumberP2Y=SCREEN_CENTER_Y+52+16*-1 +NumStepsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +NumStepsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +JumpsNumberP1X=SCREEN_CENTER_X-204 +JumpsNumberP1Y=SCREEN_CENTER_Y+52+16*0 +JumpsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,SCREEN_WIDTH/2 +JumpsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +JumpsNumberP2X=SCREEN_CENTER_X+240 +JumpsNumberP2Y=SCREEN_CENTER_Y+52+16*0 +JumpsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +JumpsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +HoldsNumberP1X=SCREEN_CENTER_X-204 +HoldsNumberP1Y=SCREEN_CENTER_Y+52+16*1 +HoldsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,SCREEN_WIDTH/2 +HoldsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +HoldsNumberP2X=SCREEN_CENTER_X+240 +HoldsNumberP2Y=SCREEN_CENTER_Y+52+16*1 +HoldsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*1;decelerate,0.3;addx,-SCREEN_WIDTH/2 +HoldsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +MinesNumberP1X=SCREEN_CENTER_X-204 +MinesNumberP1Y=SCREEN_CENTER_Y+52+16*2 +MinesNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,SCREEN_WIDTH/2 +MinesNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +MinesNumberP2X=SCREEN_CENTER_X+240 +MinesNumberP2Y=SCREEN_CENTER_Y+52+16*2 +MinesNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*2;decelerate,0.3;addx,-SCREEN_WIDTH/2 +MinesNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +HandsNumberP1X=SCREEN_CENTER_X-204 +HandsNumberP1Y=SCREEN_CENTER_Y+52+16*3 +HandsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,SCREEN_WIDTH/2 +HandsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +HandsNumberP2X=SCREEN_CENTER_X+240 +HandsNumberP2Y=SCREEN_CENTER_Y+52+16*3 +HandsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*3;decelerate,0.3;addx,-SCREEN_WIDTH/2 +HandsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +RollsNumberP1X=SCREEN_CENTER_X-204 +RollsNumberP1Y=SCREEN_CENTER_Y+52+16*4 +RollsNumberP1OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,-SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,SCREEN_WIDTH/2 +RollsNumberP1OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,-SCREEN_WIDTH/2 +RollsNumberP2X=SCREEN_CENTER_X+240 +RollsNumberP2Y=SCREEN_CENTER_Y+52+16*4 +RollsNumberP2OnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000AA");diffuse,color("#FFFFFF");addx,SCREEN_WIDTH/2;sleep,0.1+0.1*4;decelerate,0.3;addx,-SCREEN_WIDTH/2 +RollsNumberP2OffCommand=sleep,0.7-0.1*6;accelerate,0.3;addx,SCREEN_WIDTH/2 + +StepsDisplayP1X=SCREEN_CENTER_X-230 +StepsDisplayP1Y=SCREEN_CENTER_Y+150 +StepsDisplayP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT;draworder,100; +StepsDisplayP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +StepsDisplayP2X=SCREEN_CENTER_X+230 +StepsDisplayP2Y=SCREEN_CENTER_Y+150 +StepsDisplayP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT;draworder,100; +StepsDisplayP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT + +DetailFrameP1X=SCREEN_CENTER_X-222 +DetailFrameP1Y=SCREEN_CENTER_Y+50 +DetailFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +DetailFrameP1OffCommand=linear,0.7;diffusealpha,0 +DetailFrameP2X=SCREEN_CENTER_X+222 +DetailFrameP2Y=SCREEN_CENTER_Y+50 +DetailFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +DetailFrameP2OffCommand=linear,0.7;diffusealpha,0 + +BonusFrameP1X=SCREEN_CENTER_X-222 +BonusFrameP1Y=SCREEN_CENTER_Y+50 +BonusFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +BonusFrameP1OffCommand=linear,0.7;diffusealpha,0 +BonusFrameP2X=SCREEN_CENTER_X+222 +BonusFrameP2Y=SCREEN_CENTER_Y+50 +BonusFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +BonusFrameP2OffCommand=linear,0.7;diffusealpha,0 + +BarPossible1P1X=SCREEN_CENTER_X-142 +BarPossible1P1Y=SCREEN_CENTER_Y-55 +BarPossible1P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.2;linear,1.0;zoomx,1 +BarPossible1P1OffCommand=linear,0.7;diffusealpha,0 +BarPossible1P2X=SCREEN_CENTER_X+148 +BarPossible1P2Y=SCREEN_CENTER_Y-55 +BarPossible1P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.2;linear,1.0;zoomx,1 +BarPossible1P2OffCommand=linear,0.7;diffusealpha,0 + +BarPossible2P1X=SCREEN_CENTER_X-142 +BarPossible2P1Y=SCREEN_CENTER_Y-33 +BarPossible2P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.3;linear,1.0;zoomx,1 +BarPossible2P1OffCommand=linear,0.7;diffusealpha,0 +BarPossible2P2X=SCREEN_CENTER_X+148 +BarPossible2P2Y=SCREEN_CENTER_Y-33 +BarPossible2P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.3;linear,1.0;zoomx,1 +BarPossible2P2OffCommand=linear,0.7;diffusealpha,0 + +BarPossible3P1X=SCREEN_CENTER_X-142 +BarPossible3P1Y=SCREEN_CENTER_Y-8 +BarPossible3P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.4;linear,1.0;zoomx,1 +BarPossible3P1OffCommand=linear,0.7;diffusealpha,0 +BarPossible3P2X=SCREEN_CENTER_X+148 +BarPossible3P2Y=SCREEN_CENTER_Y-8 +BarPossible3P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.4;linear,1.0;zoomx,1 +BarPossible3P2OffCommand=linear,0.7;diffusealpha,0 + +BarPossible4P1X=SCREEN_CENTER_X-142 +BarPossible4P1Y=SCREEN_CENTER_Y+14 +BarPossible4P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 +BarPossible4P1OffCommand=linear,0.7;diffusealpha,0 +BarPossible4P2X=SCREEN_CENTER_X+148 +BarPossible4P2Y=SCREEN_CENTER_Y+14 +BarPossible4P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 +BarPossible4P2OffCommand=linear,0.7;diffusealpha,0 + +BarPossible5P1X=SCREEN_CENTER_X-142 +BarPossible5P1Y=SCREEN_CENTER_Y+36 +BarPossible5P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.6;linear,1.0;zoomx,1 +BarPossible5P1OffCommand=linear,0.7;diffusealpha,0 +BarPossible5P2X=SCREEN_CENTER_X+148 +BarPossible5P2Y=SCREEN_CENTER_Y+36 +BarPossible5P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.6;linear,1.0;zoomx,1 +BarPossible5P2OffCommand=linear,0.7;diffusealpha,0 + +BarActual1P1X=SCREEN_CENTER_X-142 +BarActual1P1Y=SCREEN_CENTER_Y-55 +BarActual1P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.7;linear,1.0;zoomx,1 +BarActual1P1OffCommand=linear,0.7;diffusealpha,0 +BarActual1P2X=SCREEN_CENTER_X+148 +BarActual1P2Y=SCREEN_CENTER_Y-55 +BarActual1P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.7;linear,1.0;zoomx,1 +BarActual1P2OffCommand=linear,0.7;diffusealpha,0 + +BarActual2P1X=SCREEN_CENTER_X-142 +BarActual2P1Y=SCREEN_CENTER_Y-33 +BarActual2P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.8;linear,1.0;zoomx,1 +BarActual2P1OffCommand=linear,0.7;diffusealpha,0 +BarActual2P2X=SCREEN_CENTER_X+148 +BarActual2P2Y=SCREEN_CENTER_Y-33 +BarActual2P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.8;linear,1.0;zoomx,1 +BarActual2P2OffCommand=linear,0.7;diffusealpha,0 + +BarActual3P1X=SCREEN_CENTER_X-142 +BarActual3P1Y=SCREEN_CENTER_Y-8 +BarActual3P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,0.9;linear,1.0;zoomx,1 +BarActual3P1OffCommand=linear,0.7;diffusealpha,0 +BarActual3P2X=SCREEN_CENTER_X+148 +BarActual3P2Y=SCREEN_CENTER_Y-8 +BarActual3P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,0.9;linear,1.0;zoomx,1 +BarActual3P2OffCommand=linear,0.7;diffusealpha,0 + +BarActual4P1X=SCREEN_CENTER_X-142 +BarActual4P1Y=SCREEN_CENTER_Y+14 +BarActual4P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 +BarActual4P1OffCommand=linear,0.7;diffusealpha,0 +BarActual4P2X=SCREEN_CENTER_X+148 +BarActual4P2Y=SCREEN_CENTER_Y+14 +BarActual4P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.0;linear,1.0;zoomx,1 +BarActual4P2OffCommand=linear,0.7;diffusealpha,0 + +BarActual5P1X=SCREEN_CENTER_X-142 +BarActual5P1Y=SCREEN_CENTER_Y+36 +BarActual5P1OnCommand=halign,0;rotationz,180;zoomx,0;sleep,1.1;linear,1.0;zoomx,1 +BarActual5P1OffCommand=linear,0.7;diffusealpha,0 +BarActual5P2X=SCREEN_CENTER_X+148 +BarActual5P2Y=SCREEN_CENTER_Y+36 +BarActual5P2OnCommand=halign,0;rotationz,0;zoomx,0;sleep,1.1;linear,1.0;zoomx,1 +BarActual5P2OffCommand=linear,0.7;diffusealpha,0 + +ShowGraphDisplay=true +GraphDisplayP1X=SCREEN_CENTER_X-222 +GraphDisplayP1Y=SCREEN_CENTER_Y-16 +GraphDisplayP1OnCommand=draworder,1 +GraphDisplayP1OffCommand=linear,0.7;addx,-400 +GraphDisplayP2X=SCREEN_CENTER_X+222 +GraphDisplayP2Y=SCREEN_CENTER_Y-16 +GraphDisplayP2OnCommand=draworder,1 +GraphDisplayP2OffCommand=linear,0.7;addx,400 + +ShowComboGraph=true +ComboGraphP1X=SCREEN_CENTER_X-222 +ComboGraphP1Y=SCREEN_CENTER_Y+10 +ComboGraphP1OnCommand=draworder,1 +ComboGraphP1OffCommand=linear,0.7;addx,-400 +ComboGraphP2X=SCREEN_CENTER_X+222 +ComboGraphP2Y=SCREEN_CENTER_Y+10 +ComboGraphP2OnCommand=draworder,1 +ComboGraphP2OffCommand=linear,0.7;addx,400 + +StageAwardP1X=SCREEN_CENTER_X-222 +StageAwardP1Y=SCREEN_CENTER_Y-32 +StageAwardP1OnCommand=draworder,1 +StageAwardP1OffCommand=linear,0.7;addx,-400 +StageAwardP2X=SCREEN_CENTER_X+222 +StageAwardP2Y=SCREEN_CENTER_Y-32 +StageAwardP2OnCommand=draworder,1 +StageAwardP2OffCommand=linear,0.7;addx,400 + +ModIconRowP1X=SCREEN_CENTER_X-316 +ModIconRowP1Y=SCREEN_CENTER_Y +ModIconRowP1OnCommand=draworder,1;player,"PlayerNumber_P1";addx,-200;linear,0.5;addx,200 +ModIconRowP1OffCommand=linear,0.5;addx,-200 +ModIconRowP2X=SCREEN_CENTER_X+316 +ModIconRowP2Y=SCREEN_CENTER_Y +ModIconRowP2OnCommand=draworder,1;player,"PlayerNumber_P2";addx,200;linear,0.5;addx,-200 +ModIconRowP2OffCommand=linear,0.5;addx,200 + +ItsARecordP1X=SCREEN_CENTER_X-72 +ItsARecordP1Y=SCREEN_CENTER_Y+185 +ItsARecordP1OnCommand=shadowlength,0;diffusealpha,0;zoom,3;linear,0.5;diffusealpha,1;zoom,1 +ItsARecordP1OffCommand=linear,0.5;diffusealpha,0 +ItsARecordP2X=SCREEN_CENTER_X+72 +ItsARecordP2Y=SCREEN_CENTER_Y+185 +ItsARecordP2OnCommand=shadowlength,0;diffusealpha,0;zoom,3;linear,0.5;diffusealpha,1;zoom,1 +ItsARecordP2OffCommand=linear,0.5;diffusealpha,1 + +TryExtraStageX=SCREEN_CENTER_X+0 +TryExtraStageY=SCREEN_CENTER_Y-164 +TryExtraStageOnCommand=draworder,1;diffusealpha,0;linear,0.7;diffusealpha,1;glowshift +TryExtraStageOffCommand=linear,0.7;diffusealpha,0 + +BarActualMaxCommand=glowshift;effectperiod,0.5 + +CheerDelaySeconds=2.5 + +[ScreenNetEvaluation] +Class="ScreenNetEvaluation" +Fallback="ScreenEvaluationStage" +NextScreen=ScreenBranchNetAfterEval() +# Players background +UsersBG1Y=SCREEN_CENTER_Y+0 +UsersBG1X=SCREEN_CENTER_X-180 +UsersBG2Y=SCREEN_CENTER_Y+0 +UsersBG2X=SCREEN_CENTER_X+180 +UsersBGWidth=260 +UsersBGHeight=400 +UsersBGCommand=diffuse,0.4,0.1,0.4,0.5 +UsersBGOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomx,1.0;zoomy,1.0 +UsersBGOffCommand=zoomx,1.0;zoomy,1.0;linear,0.5;zoomx,0.0;zoomy,0.0 +# Players list +User1Y=SCREEN_CENTER_Y-160 +User1X=SCREEN_CENTER_X-180 +User2Y=SCREEN_CENTER_Y-160 +User2X=SCREEN_CENTER_X+180 +UserDX=0 +UserDY=SCREEN_CENTER_Y-208 +UserOnCommand=zoomx,0.0;zoomy,0.0;linear,0.5;zoomx,1.0;zoomy,1.0 +UserOffCommand=zoomx,1.0;zoomy,1.0;linear,0.5;zoomx,0.0;zoomy,0.0 +UserDeSelCommand=zoomx,1.4;zoomy,1.4;linear,0.1;zoomx,1.0;zoomy,1.0 +UserSelCommand=zoomx,1.0;zoomy,1.0;linear,0.1;zoomx,1.4;zoomy,1.4 + +[ScreenEvaluationStage] +Fallback="ScreenEvaluation" +NextScreen=GetEvaluationNextScreen() +ShowGradeArea=true +ShowPointsArea=false +ShowDetailArea=true +ShowBonusArea=false +ShowSurvivedArea=false +ShowWinArea=false +ShowScoreArea=true +ShowTimeArea=false +ShowStageDisplay=true +ShowStageFrame=true +ShowModIconRows=true +ShowStepsDisplay=true +ShowItsARecord=true +ShowStageAward=true + +[ScreenEvaluationSummary] +Fallback="ScreenEvaluationStage" +NextScreen=GetEvaluationSummaryNextScreen() +Summary=true +ShowTimeArea=false + +SmallBanner1X=SCREEN_CENTER_X-60 +SmallBanner1Y=SCREEN_CENTER_Y-160 +SmallBanner1OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +SmallBanner1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +SmallBanner2X=SCREEN_CENTER_X-30 +SmallBanner2Y=SCREEN_CENTER_Y-150 +SmallBanner2OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +SmallBanner2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +SmallBanner3X=SCREEN_CENTER_X+0 +SmallBanner3Y=SCREEN_CENTER_Y-140 +SmallBanner3OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +SmallBanner3OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +SmallBanner4X=SCREEN_CENTER_X+30 +SmallBanner4Y=SCREEN_CENTER_Y-130 +SmallBanner4OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +SmallBanner4OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +SmallBanner5X=SCREEN_CENTER_X+60 +SmallBanner5Y=SCREEN_CENTER_Y-120 +SmallBanner5OnCommand=zoom,0.5;addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +SmallBanner5OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +CategoryRecordP1X=SCREEN_CENTER_X-186 +CategoryRecordP1Y=SCREEN_CENTER_Y+158 +CategoryRecordP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1;glowshift +CategoryRecordP1OffCommand=linear,0.7;diffusealpha,0 +CategoryRecordP2X=SCREEN_CENTER_X+186 +CategoryRecordP2Y=SCREEN_CENTER_Y+158 +CategoryRecordP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1;glowshift +CategoryRecordP2OffCommand=linear,0.7;diffusealpha,0 + +[ScreenEvaluationNonstop] +Fallback="ScreenEvaluation" +NextScreen=GetEvaluationNextScreen() +ShowGradeArea=true +ShowPointsArea=false +ShowBonusArea=false +ShowDetailArea=false +ShowSurvivedArea=true +ShowWinArea=false +ShowScoreArea=true +ShowTimeArea=false +ShowStageDisplay=false +ShowStageFrame=false + +[ScreenEvaluationOni] +Fallback="ScreenEvaluation" +NextScreen=GetEvaluationNextScreen() +ShowGradeArea=false +ShowPointsArea=true +ShowBonusArea=false +ShowDetailArea=false +ShowSurvivedArea=true +ShowWinArea=false +ShowScoreArea=false +ShowTimeArea=true +ShowStageDisplay=false +ShowStageFrame=false +PercentFrameP1X=SCREEN_CENTER_X-226 +PercentFrameP1Y=SCREEN_CENTER_Y-140 +PercentFrameP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 +PercentFrameP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 +PercentFrameP2X=SCREEN_CENTER_X+226 +PercentFrameP2Y=SCREEN_CENTER_Y-140 +PercentFrameP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +PercentFrameP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 +PercentP1X=SCREEN_CENTER_X-200 +PercentP1Y=SCREEN_CENTER_Y-108 +PercentP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,SCREEN_WIDTH/2 +PercentP1OffCommand=sleep,0.8;accelerate,0.3;addx,-SCREEN_WIDTH/2 +PercentP2X=SCREEN_CENTER_X+252 +PercentP2Y=SCREEN_CENTER_Y-108 +PercentP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.0;decelerate,0.3;addx,-SCREEN_WIDTH/2 +PercentP2OffCommand=sleep,0.8;accelerate,0.3;addx,SCREEN_WIDTH/2 +TimeLabelX=SCREEN_CENTER_X+0 +TimeLabelY=SCREEN_CENTER_Y+140 +TimeLabelOnCommand=addy,SCREEN_HEIGHT;sleep,0.8;decelerate,0.3;addy,-SCREEN_HEIGHT +TimeLabelOffCommand=sleep,0.0;accelerate,0.3;addy,SCREEN_HEIGHT +TimeNumberP1X=SCREEN_CENTER_X-160 +TimeNumberP1Y=SCREEN_CENTER_Y+140 +TimeNumberP1OnCommand=addx,-SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,SCREEN_WIDTH/2 +TimeNumberP1OffCommand=sleep,0.0;accelerate,0.3;addx,-SCREEN_WIDTH/2 +TimeNumberP2X=SCREEN_CENTER_X+160 +TimeNumberP2Y=SCREEN_CENTER_Y+140 +TimeNumberP2OnCommand=addx,SCREEN_WIDTH/2;sleep,0.8;decelerate,0.3;addx,-SCREEN_WIDTH/2 +TimeNumberP2OffCommand=sleep,0.0;accelerate,0.3;addx,SCREEN_WIDTH/2 + +[ScreenEvaluationEndless] +Fallback="ScreenEvaluationOni" +NextScreen=GetEvaluationNextScreen() + +[ScreenEvaluationRave] +Fallback="ScreenEvaluation" +NextScreen=GetEvaluationNextScreen() +ShowGradeArea=true +ShowPointsArea=false +ShowBonusArea=false +ShowDetailArea=false +ShowSurvivedArea=false +ShowWinArea=true +ShowScoreArea=true +ShowTimeArea=false +FailedSoundTime=0 +PassedSoundTime=0 +ShowStageDisplay=true +ShowStageFrame=true +StageDisplayX=SCREEN_CENTER_X+0 +StageDisplayY=SCREEN_CENTER_Y-168 +StageDisplayOnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +StageDisplayOffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +DifficultyIconP1X=SCREEN_CENTER_X-106 +DifficultyIconP1Y=SCREEN_CENTER_Y-160 +DifficultyIconP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +DifficultyIconP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +DifficultyIconP2X=SCREEN_CENTER_X+106 +DifficultyIconP2Y=SCREEN_CENTER_Y-160 +DifficultyIconP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +DifficultyIconP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +StepsDisplayP1X=SCREEN_CENTER_X-106 +StepsDisplayP1Y=SCREEN_CENTER_Y-160 +StepsDisplayP1OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +StepsDisplayP1OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +StepsDisplayP2X=SCREEN_CENTER_X+106 +StepsDisplayP2Y=SCREEN_CENTER_Y-160 +StepsDisplayP2OnCommand=addy,SCREEN_HEIGHT;sleep,0.0;decelerate,0.3;addy,-SCREEN_HEIGHT +StepsDisplayP2OffCommand=sleep,0.8;accelerate,0.3;addy,SCREEN_HEIGHT +WinFrameP1X=SCREEN_CENTER_X-224 +WinFrameP1Y=SCREEN_CENTER_Y+16 +WinFrameP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +WinFrameP1OffCommand=linear,0.7;diffusealpha,0 +WinFrameP2X=SCREEN_CENTER_X+224 +WinFrameP2Y=SCREEN_CENTER_Y+16 +WinFrameP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +WinFrameP2OffCommand=linear,0.7;diffusealpha,0 +WinP1X=SCREEN_CENTER_X-224 +WinP1Y=SCREEN_CENTER_Y+16 +WinP1OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +WinP1OffCommand=linear,0.7;diffusealpha,0 +WinP2X=SCREEN_CENTER_X+224 +WinP2Y=SCREEN_CENTER_Y+16 +WinP2OnCommand=diffusealpha,0;linear,0.7;diffusealpha,1 +WinP2OffCommand=linear,0.7;diffusealpha,0 + +[MultiplayerEvalScoreRow] +NumberOnCommandFunction= + +[EditMenu] +EditMode="EditMode_Full" +ShowGroups=true +Arrows1X=SCREEN_CENTER_X-130 +Arrows2X=SCREEN_CENTER_X+270 +ArrowsEnabledCommand=diffuse,1,1,1,1 +ArrowsDisabledCommand=diffuse,0.2,0.2,0.2,1 +SongBannerX=SCREEN_CENTER_X+170 +SongBannerY=SCREEN_CENTER_Y-90 +SongBannerWidth=130 +SongBannerHeight=40 +SongTextBannerX=SCREEN_CENTER_X-30 +SongTextBannerY=SCREEN_CENTER_Y-90 +GroupBannerX=SCREEN_CENTER_X+170 +GroupBannerY=SCREEN_CENTER_Y-140 +GroupBannerWidth=130 +GroupBannerHeight=40 +StepsDisplayX=SCREEN_CENTER_X+170 +StepsDisplayY=SCREEN_CENTER_Y-0 +StepsDisplaySourceX=SCREEN_CENTER_X+170 +StepsDisplaySourceY=SCREEN_CENTER_Y+80 +RowLabelsX=SCREEN_CENTER_X-250 +RowLabelOnCommand=shadowlength,2; +RowValue1X=SCREEN_CENTER_X +RowValue2X=SCREEN_CENTER_X+60 +RowValue3X=SCREEN_CENTER_X+60 +RowValue4X=SCREEN_CENTER_X +RowValue5X=SCREEN_CENTER_X+60 +RowValue6X=SCREEN_CENTER_X +RowValue7X=SCREEN_CENTER_X+60 +RowValueOnCommand=shadowlength,2; +Row1Y=SCREEN_CENTER_Y-140 +Row2Y=SCREEN_CENTER_Y-90 +Row3Y=SCREEN_CENTER_Y-40 +Row4Y=SCREEN_CENTER_Y-0 +Row5Y=SCREEN_CENTER_Y+40 +Row6Y=SCREEN_CENTER_Y+80 +Row7Y=SCREEN_CENTER_Y+120 + +[ScreenEditMenu] +Fallback="ScreenWithMenuElements" +Class="ScreenEditMenu" +NextScreen="ScreenEdit" +PrevScreen="ScreenOptionsEdit" +EditMenuType="EditMenu" +ExplanationX=SCREEN_CENTER_X +ExplanationY=SCREEN_BOTTOM-56 +ExplanationOnCommand=wrapwidthpixels,600;shadowlength,0; +NumStepsLoadedFromProfileX=SCREEN_RIGHT-180 +NumStepsLoadedFromProfileY=SCREEN_TOP+42 +NumStepsLoadedFromProfileOnCommand=visible,false +ShowStyleIcon=false +TimerSeconds=-1 +HelpText=ScreenString("HelpTextOptionsAndBack") + +[ScreenJukeboxMenu] +Class="ScreenOptionsMaster" +Fallback="ScreenOptions" +NextScreen="ScreenJukebox" +PrevScreen=ScreenTitleBranch() +ShowStyleIcon=false +TimerSeconds=-1 +InputMode="together" +ForceAllPlayers=true +LineNames="1,2,3,4" +Line1="list,Styles" +Line2="list,Groups" +Line3="list,Difficulties" +Line4="lua,OptionsRandomJukebox()" +Line4Old="list,RandomModifiers" + +[ScreenSystemLayer] +Fallback="Screen" +Class="ScreenSystemLayer" +CreditsJoinOnly=false +CreditsP1X=SCREEN_CENTER_X-230 +CreditsP1Y=SCREEN_BOTTOM-10 +CreditsP2X=SCREEN_CENTER_X+230 +CreditsP2Y=SCREEN_BOTTOM-10 +CreditsInitCommand=shadowlength,0;strokecolor,color("#000000AA"); + +[ScreenDebugOverlay] +Class="ScreenDebugOverlay" +Fallback="Screen" + +############################################ REMOVE ME ######################### +DebugMenuHeaderX=SCREEN_LEFT+20 +DebugMenuHeaderY=SCREEN_TOP+20 +DebugMenuHeaderOnCommand=halign,0 + +LineOnColor=color("1,1,1,1") +LineOffColor=color("0.6,0.6,0.6,1") + +PageTextGainFocusCommand=diffuse,color("1,1,1,1") +PageTextLoseFocusCommand=diffuse,color("0.6,0.6,0.6,1") +############################################ REMOVE ME ######################### + +[ScreenSyncOverlay] +Class="ScreenSyncOverlay" +Fallback="Screen" +StatusOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+150;shadowlength,2;strokecolor,color("#000000"); +AdjustmentsOnCommand=x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y; + +[ScreenStatsOverlay] +Class="ScreenStatsOverlay" +Fallback="Screen" +StatsX=SCREEN_RIGHT-8 +StatsY=SCREEN_TOP+10 +StatsOnCommand=halign,1;valign,0;shadowlength,1 +ShowSkips=true +SkipX=SCREEN_RIGHT-100 +SkipY=SCREEN_BOTTOM-100 +SkipWidth=190 +SkipSpacingY=14 + +[MusicWheelItem] +WheelNotifyIconX=106 +WheelNotifyIconY=0 +WheelNotifyIconOnCommand= +SongNameX=-30 +SongNameY=0 +SongNameOnCommand= +SectionExpandedX=-18 +SectionExpandedY=-2 +SectionExpandedOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 +SectionCollapsedX=-18 +SectionCollapsedY=-2 +SectionCollapsedOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 +SectionCountX=105 +SectionCountY=0 +SectionCountOnCommand=diffuse,color("#8e8b3f");shadowlength,0 +RouletteX=-0 +RouletteY=-2 +RouletteOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 +CourseX=0 +CourseY=-2 +CourseOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 +SortX=0 +SortY=-2 +SortOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 +ModeX=0 +ModeY=-2 +ModeOnCommand=maxwidth,208;strokecolor,color("#00000077");shadowlength,0 +GradeP1X=106 +GradeP1Y=-5 +GradeP2X=110 +GradeP2Y=5 +GradesShowMachine=true +# added for sm-ssc: +RandomX=-0 +RandomY=-2 +RandomOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 +PortalX=-0 +PortalY=-2 +PortalOnCommand=maxwidth,400;rainbowscroll,true;strokecolor,color("#00000077");shadowlength,0 + +[WheelNotifyIcon] +ShowTraining=true + +[MusicWheel] +FadeSeconds=1 +SwitchSeconds=0.10 +RandomPicksLockedSongs=true +RouletteSwitchSeconds=0.05 +RouletteSlowDownSwitches=5 +LockedInitialVelocity=7 +ScrollBarHeight=300 +ScrollBarOnCommand=x,-142;y,10 +; linear wheel example: +; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ +; self:y(offsetFromCenter*38); \ +; end; +; 3D wheel example: +; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ +; local curve = math.pi; \ +; local WHEEL_3D_RADIUS = 245; \ +; local rotationx_radians = scale(offsetFromCenter,-numItems/2,numItems/2,-curve/2,curve/2); \ +; self:x( 0 - math.cos(offsetFromCenter/math.pi) ); \ +; self:y( WHEEL_3D_RADIUS * math.sin(rotationx_radians) ); \ +; self:z( -100 + WHEEL_3D_RADIUS * math.cos(rotationx_radians) ); \ +; self:rotationx( rotationx_radians * 180/math.pi ); --[[ to degrees end]] \ +; end; +ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*38 ); end +NumWheelItems=11 +MusicWheelSortOnCommand= +MusicWheelSortOffCommand= +MusicWheelItemSortOnCommand=addx,-SCREEN_WIDTH/2;accelerate,0.2;addx,SCREEN_WIDTH/2 +MusicWheelItemSortOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 +HighlightOnCommand=glowshift;effectcolor1,color("#00C0FF00");effectcolor2,color("#00C0FF7F");effectclock,"bgm";addx,-SCREEN_WIDTH/2;sleep,0.05;accelerate,0.4;addx,SCREEN_WIDTH/2 +HighlightOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 +HighlightSortOnCommand=accelerate,0.2;addx,SCREEN_WIDTH/2 +HighlightSortOffCommand=decelerate,0.2;addx,-SCREEN_WIDTH/2 +WheelItemOnDelayOffset=0.04 +WheelItemOffDelayOffset=0.04 +WheelItemLockedColor=color("0,0,0,0.5") +NumSectionColors=7 +SectionColor1=color("0.8,0.1,0.6,1") -- pink +SectionColor2=color("0.6,0.4,0.8,1") -- purple +SectionColor3=color("0.0,0.4,0.8,1") -- sky blue +SectionColor4=color("0.0,0.6,0.6,1") -- sea green +SectionColor5=color("0.1,0.7,0.3,1") -- green +SectionColor6=color("0.8,0.6,0.0,1") -- orange +SectionColor7=color("1.0,0.3,0.3,1") -- light red +SongRealExtraColor=color("0.9,0.9,0,1") -- yellow +SortMenuColor=color("1,1,0,1") +SortOrders={ "SortOrder_Preferred", "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_Popularity", "SortOrder_Artist", "SortOrder_Genre" } +ShowRoulette=true +ShowRandom=false +ShowPortal=false +MostPlayedSongsToShow=30 +ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,Genre,Length" +ChoicePreferred="sort,Preferred" +ChoiceGroup="sort,Group" +ChoiceTitle="sort,Title" +ChoiceBpm="sort,BPM" +ChoicePopularity="sort,Popularity" +ChoiceTopGrades="sort,TopGrades" +ChoiceArtist="sort,Artist" +ChoiceGenre="sort,Genre" +ChoiceEasyMeter="sort,EasyMeter" +ChoiceMediumMeter="sort,MediumMeter" +ChoiceHardMeter="sort,HardMeter" +ChoiceLength="sort,Length" +UseEasyMarkerFlag=false +# added for sm-ssc +UseSectionsWithPreferredGroup=false + +[RoomWheel] +Fallback="MusicWheel" +RoomWheelItemStartOnCommand= +RoomWheelItemFinishOnCommand= +CreateRoomColor=color("0.0,0.9,0.25,1.0") +ScrollBarOnCommand=visible,false + +[RoomInfoDisplay] +RoomInfoDisplayOnCommand=diffuse,1.0,1.0,1.0,1.0;x,SCREEN_WIDTH+130;y,250;bounceend,0.5;x,SCREEN_WIDTH-160 +RoomInfoDisplayOffCommand=x,SCREEN_WIDTH-160;y,250;bouncebegin,0.5;x,SCREEN_WIDTH+130 +DeployDelay=1.5 +RetractDelay=5 +RoomTitleOnCommand=x,-120;y,-140;zoom,0.75 +RoomDescOnCommand=x,-120;y,-129;zoom,0.75 +LastRoundOnCommand=x,-120;y,-107;zoom,0.75 +SongTitleOnCommand=x,-110;y,-96;zoom,0.75 +SongSubTitleOnCommand=x,-110;y,-85;zoom,0.75 +SongArtistOnCommand=x,-110;y,-74;zoom,0.75 +PlayersOnCommand=x,-120;y,-52;zoom,0.75 +PlayerListElementX=-110 +PlayerListElementY=-41 +PlayerListElementOffsetX=0 +PlayerListElementOffsetY=11 +PlayerListElementOnCommand=zoom,0.75 + +[RoomWheelItem] +TextOnCommand=zoom,0.6;strokecolor,color("#000000FF") +TextX=-110 +TextY=-8 +TextWidth=200 +DescX=-100 +DescY=6 +DescOnCommand=zoom,0.4;strokecolor,color("#000000FF") +DescWidth=400 + +[LifeMeterBar] +DangerThreshold=0.2 +InitialValue=0.5 +HotValue=1.0 +LifeMultiplier=1.0 +MinStayAlive="TapNoteScore_W3" +LifePercentChangeW1=0.008 +LifePercentChangeW2=0.008 +LifePercentChangeW3=0.004 +LifePercentChangeW4=0.000 +LifePercentChangeW5=-0.040 +LifePercentChangeMiss=-0.080 +LifePercentChangeHitMine=-0.160 +LifePercentChangeHeld=0.008 +LifePercentChangeLetGo=-0.080 +LifePercentChangeCheckpointMiss=-0.002 +LifePercentChangeCheckpointHit=0.002 +UnderX=0 +UnderY=0 +DangerX=0 +DangerY=0 +StreamX=0 +StreamY=0 +OverX=0 +OverY=0 + +[LifeMeterTime] +MeterWidth=232 +MeterHeight=24 +Fallback="LifeMeterBar" + +[StepsDisplay] +FrameX=0 +FrameY=0 +FrameOnCommand= +FrameLoadCommand=%function(self,param) local bFlip = param.PlayerState and param.PlayerState:GetPlayerNumber() ~= PLAYER_1; self:zoomx(bFlip and -1 or 1); end +FrameSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) end end +NumTicks=10 +MaxTicks=14 +TicksX=0 +TicksY=0 +TicksOnCommand=shadowlength,0;stroke +TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end +ShowTicks=false +ShowMeter=true +ZeroMeterString="?" +MeterX=30 +MeterY=0 +MeterOnCommand=shadowlength,0 +MeterSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowDescription=true +DescriptionX=-10 +DescriptionY=0 +DescriptionOnCommand=shadowlength,0;uppercase,true; +DescriptionSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowAutogen=true +AutogenX=40 +AutogenY=0 +AutogenOnCommand= +AutogenSetCommand=%function(self,param) if param.CustomDifficulty then self:diffuse(CustomDifficultyToLightColor(param.CustomDifficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); end end +ShowStepsType=false +StepsTypeX=0 +StepsTypeY=0 +StepsTypeOnCommand= + +[StepsDisplayEdit] +Fallback="StepsDisplay" + +[StepsDisplayListRow] +Fallback="StepsDisplay" +FrameX=0 +FrameY=0 +FrameOnCommand= +ShowTicks=true +NumTicks=13 +MaxTicks=13 +TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end +TicksX=0 +TicksY=0 +TicksOnCommand=shadowlength,0;shadowcolor,color("#FFFFFF"); +ShowMeter=1 +ZeroMeterString="?" +MeterX=92 +MeterY=-1 +MeterOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); +MeterSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end +ShowDescription=true +DescriptionX=-110 +DescriptionY=-1 +DescriptionOnCommand=uppercase,true;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");maxwidth,150; +DescriptionSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end +AutogenX=102 +AutogenOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); +AutogenSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end + +[StepsDisplayGameplay] +Fallback="StepsDisplay" +MeterOnCommand=shadowlength,0; +FrameOnCommand= +ShowAutogen=false +ShowStepsType=false + +[StepsDisplayEvaluation] +Fallback="StepsDisplayGameplay" + +[ScreenWithMenuElements] +Fallback="Screen" +Class="ScreenWithMenuElements" +AllowDisabledPlayerInput=false +ShowStyleIcon=true +ShowStageDisplay=false +StageDisplayX=SCREEN_CENTER_X+234 +StageDisplayY=SCREEN_CENTER_Y-172 +StageDisplayOnCommand=draworder,-2;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +StageDisplayOffCommand=linear,0.5;addx,SCREEN_WIDTH*0.6 +ShowStageFrame=false +StageFrameX=SCREEN_CENTER_X+234 +StageFrameY=SCREEN_CENTER_Y-172 +StageFrameOnCommand=draworder,-2;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +StageFrameOffCommand=linear,0.5;addx,SCREEN_WIDTH*0.6 +MemoryCardIcons=true +CancelTransitionsOut=false +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP+35 +HeaderOnCommand= +HeaderOffCommand= +FooterX=SCREEN_CENTER_X +FooterY=SCREEN_BOTTOM +FooterOnCommand=draworder,-1;valign,1 +FooterOffCommand= +ShowHelp=true +HelpX=SCREEN_CENTER_X +HelpY=SCREEN_BOTTOM-20 +HelpOnCommand=shadowlength,0;strokecolor,color("#4e4e4e");draworder,1;zoomy,0;linear,0.5;zoomy,1;diffuseblink; +HelpOffCommand=linear,0.5;zoomy,0 +MemoryCardDisplayP1X=SCREEN_LEFT+10; +MemoryCardDisplayP1Y=SCREEN_CENTER_Y+220 +MemoryCardDisplayP1OnCommand=draworder,97; +MemoryCardDisplayP1OffCommand= +//MemoryCardDisplayP1OffCommand=bouncebegin,0.5;addx,-25; +MemoryCardDisplayP2X=SCREEN_RIGHT-10; +MemoryCardDisplayP2Y=SCREEN_CENTER_Y+220 +MemoryCardDisplayP2OnCommand=draworder,97; +MemoryCardDisplayP2OffCommand= +//MemoryCardDisplayP2OffCommand=bouncebegin,0.5;addx,25; +TimerMetricsGroup="MenuTimer" +TimerX=SCREEN_CENTER_X+273 +TimerY=SCREEN_TOP+26 +TimerOnCommand=draworder,2;addy,-40;linear,0.25;addy,40 +TimerOffCommand=linear,0.25;addy,-70; +TimerStealth=false +ForceTimer=false +FirstUpdateCommand= +PlayMusic=true +MusicAlignBeat=true +StopMusicOnBack=true +WaitForChildrenBeforeTweeningOut=false +LeftFrameX=SCREEN_CENTER_X-320 +LeftFrameY=SCREEN_CENTER_Y +LeftFrameOnCommand= +LeftFrameOffCommand= +RightFrameX=SCREEN_CENTER_X+320 +RightFrameY=SCREEN_CENTER_Y +RightFrameOnCommand= +RightFrameOffCommand= +StyleIconX=SCREEN_CENTER_X+170 +StyleIconY=SCREEN_CENTER_Y-202 +StyleIconOnCommand=draworder,1 +StyleIconOffCommand= + +[MenuTimer] +WarningStart=6 +WarningBeepStart=5 +MaxStallSeconds=30 +Text1OnCommand=stopeffect;stoptweening;shadowlength,0;zoomx,1;x,-13;y,2 +Text1FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.floor(fSeconds/10); return ""..digit end +Text2OnCommand=stopeffect;stoptweening;shadowlength,0;zoomx,1;x,13;y,2 +Text2FormatFunction=function(fSeconds) fSeconds=math.min( 99, math.ceil(fSeconds) ); local digit = math.mod(fSeconds,10); return ""..digit end +Warning6Command=stoptweening;sleep,0.8;linear,0.2;zoomx,0 +Warning5Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0;glowshift;effectperiod,0.15;effectcolor1,color("1,0,0,0");effectcolor2,color("1,0,0,1") +Warning4Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 +Warning3Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 +Warning2Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 +Warning1Command=stoptweening;linear,0.2;zoomx,1;sleep,0.6;linear,0.2;zoomx,0 +Warning0Command=stoptweening;stopeffect;linear,0.2;zoomx,1 +FrameX=-20 +FrameY=6 +FrameOnCommand= + +[ScreenOptions] +Fallback="ScreenWithMenuElements" +NavigationMode="normal" +InputMode="individual" +ForceAllPlayers=false +RepeatRate=12 +RepeatDelay=0.25 +NumRowsShown=8 +RowInitCommand= +RowOnCommand= +RowOffCommand= +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-146+36*offsetFromCenter) end +ExplanationP1X=SCREEN_CENTER_X-300 +ExplanationP1Y=SCREEN_CENTER_Y+184 +ExplanationP1OnCommand=shadowlength,0;wrapwidthpixels,500;halign,0;cropright,1;linear,0.5;cropright,0 +ExplanationP1OffCommand= +ExplanationP2X=SCREEN_CENTER_X+250 +ExplanationP2Y=SCREEN_CENTER_Y+184 +ExplanationP2OnCommand=shadowlength,0;wrapwidthpixels,500;halign,1;cropright,1;linear,0.5;cropright,0 +ExplanationP2OffCommand= +ExplanationTogetherX=SCREEN_CENTER_X-302 +ExplanationTogetherY=SCREEN_CENTER_Y+184 +ExplanationTogetherOnCommand=shadowlength,0;wrapwidthpixels,600;halign,0;cropright,1;linear,0.5;cropright,0 +ExplanationTogetherOffCommand= +DisqualifyP1X= +DisqualifyP1Y= +DisqualifyP1OnCommand=visible,false +DisqualifyP1OffCommand= +DisqualifyP2X= +DisqualifyP2Y= +DisqualifyP2OnCommand=visible,false +DisqualifyP2OffCommand= +PageX=SCREEN_CENTER_X +PageY=SCREEN_CENTER_Y-2 +PageOnCommand= +ContainerOnCommand=draworder,-1;x,-SCREEN_WIDTH;decelerate,0.5;addx,SCREEN_WIDTH; +ContainerOffCommand=accelerate,0.5;addx,SCREEN_WIDTH; +CursorOnCommand= +LineHighlightOnCommand= +LineHighlightChangeCommand= +LineHighlightChangeToExitCommand= +ShowScrollBar=false +ScrollBarHeight=0 +ScrollBarTime=0 +LineHighlightX=SCREEN_CENTER_X +ShowExitRow=true +SeparateExitRow=true +SeparateExitRowY=SCREEN_CENTER_Y+140 +MoreX= +MoreY= +MoreOnCommand=visible,false +MoreExitSelectedP1Command= +MoreExitSelectedP2Command= +MoreExitUnselectedP1Command= +MoreExitUnselectedP2Command= +ShowExplanations=true +AllowRepeatingChangeValueInput=false +CursorTweenSeconds=0.3 +WrapValueInRow=true +OptionRowNormalMetricsGroup="OptionRow" +OptionRowExitMetricsGroup="OptionRowExit" +HelpText=ScreenString("HelpTextOptions") + +[OptionRow] +ShowModIcons=false +ShowUnderlines=true +ShowBpmInSpeedTitle=false +ModIconP1X=SCREEN_CENTER_X-280 +ModIconP2X=SCREEN_CENTER_X+280 +ModIconOnCommand=x,-30 +FrameX=SCREEN_CENTER_X-222 +FrameY=0 +FrameOnCommand= +TitleX=SCREEN_CENTER_X-222 +TitleY=-2 +TitleOnCommand=shadowlength,0;uppercase,true;wrapwidthpixels,120; +TitleGainFocusCommand=diffuse,color("#fff600");strokecolor,color("#7f6739"); +TitleLoseFocusCommand=diffuse,color("#ffffff");strokecolor,color("#37537d"); +ItemsStartX=SCREEN_CENTER_X-140 +ItemsEndX=SCREEN_CENTER_X+280 +ItemsGapX=14 +ItemsMinBaseZoom=0.6 +ItemsLongRowP1X=SCREEN_CENTER_X-60 +ItemsLongRowP2X=SCREEN_CENTER_X+100 +ItemsLongRowSharedX=SCREEN_CENTER_X+20 +ItemOnCommand=shadowlength,0; +ItemGainFocusCommand= +ItemLoseFocusCommand= +TweenSeconds=0.2 +ModIconMetricsGroup="ModIcon" +ColorSelected=color("1,1,1,1") +ColorNotSelected=color("0.9,0.9,0.9,1") +ColorDisabled=color("0.5,0.5,0.5,1") + +[OptionRowExit] +Fallback="OptionRow" +FrameOnCommand=visible,false +TitleOnCommand=visible,false + +[OptionsCursor] +LeftX= +LeftY= +LeftOnCommand=halign,1; +MiddleX= +MiddleY= +MiddleOnCommand= +RightX= +RightY= +RightOnCommand=halign,0; +CanGoLeftX= +CanGoLeftY= +CanGoLeftOnCommand=halign,1; +CanGoRightX= +CanGoRightY= +CanGoRightOnCommand=halign,0; + +[OptionsCursorP1] +Fallback="OptionsCursor" +LeftX=-4 +MiddleX=-4 +RightX=-4 +LeftY=-4 +MiddleY=-4 +RightY=-4 + +[OptionsCursorP2] +Fallback="OptionsCursor" +LeftX=4 +MiddleX=4 +RightX=4 +LeftY=4 +MiddleY=4 +RightY=4 + +[OptionsUnderline] +Fallback="OptionsCursor" + +[OptionsUnderlineP1] +Fallback="OptionsUnderline" +LeftX=-2 +MiddleX=-2 +RightX=-2 +LeftY=12-2 +MiddleY=12-2 +RightY=12-2 + +[OptionsUnderlineP2] +Fallback="OptionsUnderline" +LeftX=2 +MiddleX=2 +RightX=2 +LeftY=12+2 +MiddleY=12+2 +RightY=12+2 + +[ScreenMapControllers] +Class="ScreenMapControllers" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +HelpText=ScreenString("HelpTextMapControllers") +ButtonsToMap="" +LineScrollerOnCommand=%function(self) self:y(50) self:setsecondsperitem(0.1) self:SetTransformFromHeight(24) end +LineScrollerOffCommand= +LineHideCommand=visible,false +LineOnCommand=%function(self) self:y(0); self:visible(true); local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:addx(SCREEN_WIDTH * LeftToRight); self:decelerate(0.5); self:addx(-SCREEN_WIDTH * LeftToRight); end +LineOffCommand=%function(self) local LeftToRight = math.mod(self.ItemIndex, 2) == 0 and 1 or -1; self:stoptweening() self:accelerate(0.3); self:addx(SCREEN_WIDTH * LeftToRight); self:queuecommand('Hide') end +ErrorX=SCREEN_CENTER_X +ErrorY=SCREEN_CENTER_Y +ErrorOnCommand=diffuse,color("#00FF00");zoom,0.8 +LabelP1OnCommand=x,SCREEN_CENTER_X-195;zoom,0.7;shadowlength,2;diffusealpha,0;linear,0.5;diffusealpha,1 +LabelP1OffCommand=linear,0.5;diffusealpha,0 +LabelP2OnCommand=x,SCREEN_CENTER_X+195;zoom,0.7;shadowlength,2;diffusealpha,0;linear,0.5;diffusealpha,1 +LabelP2OffCommand=linear,0.5;diffusealpha,0 +PrimaryOnCommand=x,SCREEN_CENTER_X;y,-6;zoom,0.7;shadowlength,2 +SecondaryOnCommand=x,SCREEN_CENTER_X;y,6;shadowlength,2 +MappedToP1S1Command=x,SCREEN_CENTER_X-270 +MappedToP1S2Command=x,SCREEN_CENTER_X-195 +MappedToP1S3Command=x,SCREEN_CENTER_X-120 +MappedToP2S1Command=x,SCREEN_CENTER_X+120 +MappedToP2S2Command=x,SCREEN_CENTER_X+195 +MappedToP2S3Command=x,SCREEN_CENTER_X+270 +MappedToOnCommand=diffuse,color("#808080");shadowlength,0;maxwidth,150 +MappedToWaitingCommand=diffuse,color("#FF8080");pulse;effectperiod,0.5;effectmagnitude,0.8,1.3,0 +MappedToMappedInputCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") +MappedToGainFocusCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF") +MappedToLoseFocusCommand=diffuse,color("#808080");stopeffect +DevicesX=SCREEN_CENTER_X +DevicesY=SCREEN_TOP+30 +DevicesOnCommand=diffusealpha,0;linear,0.5;diffusealpha,1 +DevicesOffCommand=linear,0.5;diffusealpha,0 + +[ScreenTest] +Fallback="ScreenWithMenuElementsBlank" + +[ScreenTestFonts] +Class="ScreenTestFonts" +Fallback="ScreenTest" +Font1="Common normal" +Font2="_shared1" +Font3="_shared2" +Font4="_numbers1" +Font5="_Arial 14 shadow" + +TextX=SCREEN_CENTER_X +TextY=SCREEN_CENTER_Y +TextOnCommand=wrapwidthpixels,SCREEN_WIDTH + +[ScreenTestFonts] +Class="ScreenTestFonts" +Fallback="ScreenTest" + +[ScreenTestInput] +Class="ScreenTestInput" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" +HelpText=ScreenString("HelpTextTestInput") + +[ScreenTestLights] +Class="ScreenTestLights" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" +HelpText=ScreenString("HelpTextTestLights") +TextX=SCREEN_CENTER_X-200 +TextY=SCREEN_CENTER_Y +TextOnCommand= +TextOffCommand= + +[ScreenTestSound] +Class="ScreenTestSound" +Fallback="ScreenOptionsServiceChild" + +[ScreenNetworkOptions] +Class="ScreenNetworkOptions" +Fallback="ScreenOptionsServiceChild" +NextScreen=NextNetworkScreen() +PrevScreen=NextNetworkScreen() + +[ScreenBookkeeping] +Class="ScreenBookkeeping" +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" +HelpText=ScreenString("HelpTextBookkeeping") +ShowSongPlays=true +ShowLastDays=true +ShowLastWeeks=true +ShowDayOfWeek=true +ShowHourOfDay=true +AllTimeX=SCREEN_CENTER_X +AllTimeY=110 +AllTimeOnCommand=zoom,0.7;diffuseshift;effectcolor1,color("0.5,0.5,0.5,1") +TitleX=SCREEN_CENTER_X +TitleY=140 +TitleOnCommand=zoom,0.8 +DataX=0 +DataY=SCREEN_CENTER_Y+16 +DataOnCommand= + +[ScreenPackages] +Class="ScreenPackages" +PackagesBGY=SCREEN_CENTER_Y +PackagesBGX=SCREEN_WIDTH/4 +PackagesBGWidth=SCREEN_WIDTH/3 +PackagesBGOnCommand=diffusealpha,0.0;linear,0.9;diffusealpha,1.0 +PackagesBGOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +PackagesBGBackCommand=linear,0.2;diffuse,color("#CCCCCC");diffusealpha,0.9 +PackagesBGAwayCommand=linear,0.2;diffuse,color("#020101");diffusealpha,0.9 +WebBGY=SCREEN_CENTER_Y +WebBGX=SCREEN_WIDTH*3.0/4.0 +WebBGWidth=SCREEN_WIDTH/3 +WebBGOnCommand=diffusealpha,0.0;linear,0.9;diffusealpha,1.0 +WebBGOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +WebBGAwayCommand=linear,0.2;diffuse,color("#020101");diffusealpha,0.9 +WebBGBackCommand=linear,0.2;diffuse,color("#CCCCCC");diffusealpha,0.9 +PackagesY=SCREEN_CENTER_Y+10 +PackagesX=SCREEN_WIDTH/4 +PackagesOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 +PackagesOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +NumPackagesShow=8 +WebY=SCREEN_CENTER_Y+10 +WebX=SCREEN_WIDTH*3.0/4.0 +WebOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 +WebOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +NumLinksShow=8 +WebSelY=SCREEN_CENTER_Y+10 +WebSelX=SCREEN_WIDTH*3.0/4.0 +WebSelColor=color("0.9,0.9,0.9,0.4") +WebSelOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 +WebSelOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +WebURLY=SCREEN_HEIGHT-40 +WebURLX=SCREEN_WIDTH*2.0/3.0 +WebURLOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0;zoomx,0.4;zoomy,0.5 +WebURLOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +DownloadY=22 +DownloadX=SCREEN_WIDTH*4.0/7.0 +DownloadProgressCommand=diffuse,0.1,0.1,0.9,0.8 +DownloadOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 +DownloadOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +DownloadStatusY=22 +DownloadStatusX=SCREEN_WIDTH*4.0/7.0 +DownloadStatusOnCommand=diffusealpha,0.0;linear,1.0;diffusealpha,1.0 +DownloadStatusOffCommand=diffusealpha,1.0;linear,0.6;diffusealpha,0.0 +CanDL=true +ShowStyleIcon=false +TimerSeconds= +PrevScreen=ScreenTitleBranch() +NextScreen="ScreenStage" +NoSongsScreen=ScreenTitleBranch() +Fallback="ScreenWithMenuElements" + +[HoldGhostArrow] +WarmUpSeconds=0.25 + +[BitmapText] +NumRainbowColors=7 +RainbowColor1=color("1.0,0.0,0.4,1") -- red +RainbowColor2=color("0.8,0.2,0.6,1") -- pink +RainbowColor3=color("0.4,0.3,0.5,1") -- purple +RainbowColor4=color("0.2,0.6,1.0,1") -- sky blue +RainbowColor5=color("0.2,0.8,0.8,1") -- sea green +RainbowColor6=color("0.2,0.8,0.4,1") -- green +RainbowColor7=color("1.0,0.8,0.2,1") -- orange + +[SongManager] +NumSongGroupColors=7 +SongGroupColor1=color("#ffba00") +SongGroupColor2=color("#ffec00") +SongGroupColor3=color("#00ff00") +SongGroupColor4=color("#00f6ff") +SongGroupColor5=color("#4896ff") +SongGroupColor6=color("#b87fff") +SongGroupColor7=color("#ff7fc7") +NumCourseGroupColors=1 +UseUnlockColor=false +UnlockColor=color("1,0.5,0,1") +CourseGroupColor1=color("1,1,1,1") +ExtraColor=color("#ff0000") -- red +ExtraColorMeter=10 +UsePreferredSortColor=false +MoveUnlocksToBottomOfPreferredSort=false +Loading songs...= +Loading courses...= +Reloading...= +ExtraStage2DifficultyMax=8 + +[Background] +LeftEdge=SCREEN_LEFT +TopEdge=SCREEN_TOP +RightEdge=SCREEN_RIGHT +BottomEdge=SCREEN_BOTTOM +BrightnessOverlayFadeCommand= +ClampOutputPercent=0 +ShowDancingCharacters=true +DontUseStaticBackground=false + +[Judgment] +JudgmentW1Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.8") +JudgmentW2Command=shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentW3Command=shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW4Command=shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW5Command=shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentMissCommand=shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 + +[HoldJudgment] +HoldJudgmentLetGoCommand=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 +HoldJudgmentHeldCommand=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 + +[Combo] +ShowComboAt=5 +ShowMissesAt=0 +ComboLabelOnCommand=x,6;y,22;halign,0;valign,1 +MissesLabelOnCommand=x,6;y,22;halign,0;valign,1 +ComboNumberOnCommand=y,240-216;shadowlength,0;halign,1;valign,1 +MissesNumberOnCommand=y,240-216;shadowlength,0;halign,1;valign,1 +NumberMinZoom=0.4 +NumberMaxZoom=0.6 +NumberMaxZoomAt=150 +PulseCommand=%function(self,param) self:stoptweening(); self:zoom(1.2*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); end + +[Player] +ReceptorArrowsYStandard=-144 +ReceptorArrowsYReverse=144 +ReceptorNoSinkScoreCutoff=4 +JudgmentTransformCommand=%JudgmentTransformCommand +JudgmentOnCommand= +ComboTransformCommand=%ComboTransformCommand +AttackDisplayXOffsetOneSideP1=0 +AttackDisplayXOffsetOneSideP2=0 +AttackDisplayXOffsetBothSides=0 +AttackDisplayY=-70 +AttackDisplayYReverse=70 +HoldJudgmentYStandard=-90 +HoldJudgmentYReverse=90 +BrightGhostComboThreshold=100 +DrawDistanceBeforeTargetsPixels=400 +DrawDistanceAfterTargetsPixels=-60 +TapJudgmentsUnderField=false +HoldJudgmentsUnderField=false +PenalizeTapScoreNone=false +JudgeHoldNotesOnSameRowTogether=false +HoldCheckpoints=false +ImmediateHoldLetGo=true +RequireStepOnHoldHeads=true +CheckpointsUseTimeSignatures=false +InitialHoldLife=1 +RollBodyIncrementsCombo=true +CheckpointsTapsSeparateJudgment=true + +[PlayerShared] +Fallback="Player" +ComboXOffsetOneSideP1=-120 +ComboXOffsetOneSideP2=120 +# this was removed in SM4 +#JudgmentTransformCommand=%JudgmentTransformSharedCommand + +[ProTimingDisplay] +W1Command=shadowlength,4;diffuse,1,1,0,1;zoom,2.6;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.8") +W2Command=shadowlength,4;diffuse,1,.8,0,1;zoom,2.6;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 +W3Command=shadowlength,4;diffuse,.6,.9,0,1;zoom,2.4;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 +W4Command=shadowlength,4;diffuse,0,1,1,1;zoom,2.2;linear,0.05;zoom,2;sleep,0.8;linear,0;diffusealpha,0 +W5Command=shadowlength,4;diffuse,1,.1,1,1;zoom,2.0;vibrate;effectmagnitude,4,8,8;sleep,0.8;linear,0;diffusealpha,0 +MissCommand=shadowlength,4;diffuse,1,.3,0,1;zoom,2.0;y,-20;linear,0.8;y,20;sleep,0.8;linear,0;diffusealpha,0 +AvoidMineCommand= +HitMineCommand= + +[BPMDisplay] +SetNoBpmCommand=diffusetopedge,color("#777777");diffusebottomedge,color("#666666") +SetNormalCommand=diffusetopedge,color("#fbfb57");diffusebottomedge,color("#fb9c57") +SetChangeCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") +SetRandomCommand=diffusetopedge,color("#fb9c57");diffusebottomedge,color("#fb5757") +SetExtraCommand=diffusetopedge,color("#fb5757");diffusebottomedge,color("#9c4242") +Cycle=true +NoBpmText="000" +RandomCycleSpeed=0.2 -- smaller numbers mean the bpm cycles faster +Separator="-" +ShowQMarksInRandomCycle=true + +[CodeDetector] +PrevSteps1="Up,Up" +PrevSteps2="MenuUp,MenuUp" +NextSteps1="Down,Down" +NextSteps2="MenuDown,MenuDown" +NextSort1="@MenuLeft-@MenuRight-Start" +NextSort2="MenuLeft-MenuRight" +NextSort3="@Left-@Right-Start" +NextSort4="Left-Right" +ModeMenu1="Up,Down,Up,Down" +ModeMenu2="MenuUp,MenuDown,MenuUp,MenuDown" +Mirror="Up,Left,Right,Left,Right" +Left="Up,Down,Right,Left" +Right="Up,Down,Left,Right" +Shuffle="Down,Up,Down,Up" +SuperShuffle="Down,Up,Left,Right" +NextTransform="" +NextScrollSpeed="Up,Left,Down,Left,Up" +PreviousScrollSpeed="Down,Right,Up,Right,Down" +NextAccel="Left,Right,Down,Up" +NextEffect="Left,Down,Right" +NextAppearance="Left,Up,Right" +NextTurn="" +Reverse="Down,Left,Right,Left,Right" +HoldNotes="Right,Left,Down,Up" +Mines="" +Dark="" +CancelAll="Left,Right,Left,Right,Left,Right,Left,Right" +NextTheme="Left,Left,Left,Right,Right,Right,Left,Right" +NextTheme2="MenuLeft,MenuLeft,MenuLeft,MenuRight,MenuRight,MenuRight,MenuLeft,MenuRight" +NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right" +NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight" +NextBannerGroup="MenuUp,MenuRight,MenuRight" +NextBannerGroup2="MenuUp,MenuDown,MenuUp,MenuDown" +Hidden="" +RandomVanish="" +SaveScreenshot1="MenuLeft-MenuRight" +SaveScreenshot2="" +CancelAllPlayerOptions="" +BackInEventMode="" + +[CourseCodeDetector] +Fallback="CodeDetector" +NextSort1= +NextSort2= +NextSort3= +NextSort4= +ModeMenu1= +ModeMenu2= + +[GrooveRadar] +Label1OffsetX=0 -- stream +Label1OffsetY=-78 +Label2OffsetX=-100 -- voltage +Label2OffsetY=-20 +Label3OffsetX=-70 -- air +Label3OffsetY=SCREEN_CENTER_Y-174 +Label4OffsetX=70 -- freeze +Label4OffsetY=SCREEN_CENTER_Y-174 +Label5OffsetX=100 -- chaos +Label5OffsetY=-20 +LabelPreDelayOnCommand=finishtweening;zoom,1.5;diffuse,1,1,1,0;sleep,0.3 +LabelOnDelay=0.2 +// fade on to screen +LabelPostDelayOnCommand=linear,0.1;glow,1,1,1,1;accelerate,0.3;zoom,1;diffuse,1,1,1,1;glow,1,1,1,0 +EdgeWidth=1 + +[GrooveGraph] +EdgeWidth= +BeginnerColor=color("0,0,0,0") +EasyColor=color("0,0,0,0") +MediumColor=color("0,0,0,0") +HardColor=color("0,0,0,0") +ChallengeColor=color("0,0,0,0") +EditColor=color("0,0,0,0") +ShowStream= +ShowVoltage= +ShowAir= +ShowFreeze= +ShowChaos= +StreamX= +VoltageX= +AirX= +FreezeX= +ChaosX= +MountainsBaseY= +MountainWidth= +MountainHeight= + +[ModIcon] +TextX=0 +TextY=0 +TextOnCommand=maxwidth,40;uppercase,true;shadowlength,0;diffuse,color("#f6ff00") +CropTextToWidth=50 + +[ModIconSelectMusic] +Fallback="ModIcon" +TextY=-1 +TextOnCommand=maxwidth,38;uppercase,true;shadowlength,0 + +[ModIconRow] +NumModIcons=6 +ModIconOnCommand= +SpacingX=0 +SpacingY=52 +ModIconMetricsGroup="ModIcon" + +[ModIconRowSelectMusic] +Fallback="ModIconRow" +SpacingX=46 +SpacingY=0 +ModIconMetricsGroup="ModIconSelectMusic" + +[ModIconRowGameplay] +Fallback="ModIconRow" + +[ModIconRowGameplayP1] +Fallback="ModIconRowGameplay" +ModIconOnCommand=rotationz,-90; + +[ModIconRowGameplayP2] +Fallback="ModIconRowGameplay" +ModIconOnCommand=rotationz,90; + +[ModIconRowEvaluationP1] +Fallback="ModIconRowGameplayP1" + +[ModIconRowEvaluationP2] +Fallback="ModIconRowGameplayP2" + +[TransitionOniFade] +BannerWidth=512 +BannerHeight=160 + +[LyricDisplay] +LyricFrontChangedCommand=LyricCommand,"Front" +LyricBackChangedCommand=LyricCommand,"Back" +InLength= +OutLength= + +[LifeMeterBattery Percent] +Format=FormatPercentScore +PercentP1X=20 +PercentP1Y=0 +PercentP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP1OffCommand= +PercentP2X=-20 +PercentP2Y=0 +PercentP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP2OffCommand= +DancePointsP1X=20 +DancePointsP1Y=0 +DancePointsP1OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_1) +DancePointsP1OffCommand= +DancePointsP2X=-20 +DancePointsP2Y=0 +DancePointsP2OnCommand=zoom,0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +DancePointsP2OffCommand= +DancePointsDigits=5 +PercentUseRemainder=false +ApplyScoreDisplayOptions=true + +[ScreenEvaluation Percent] +PercentP1X=0 +PercentP1Y=0 +PercentP1OnCommand=halign,1;valign,1;glowshift;effectperiod,2;shadowlength,0 +PercentP1OffCommand= +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=halign,1;valign,1;glowshift;effectperiod,2;shadowlength,0 +PercentP2OffCommand= +PercentRemainderP1X=0 +PercentRemainderP1Y=0 +PercentRemainderP1OnCommand=halign,0;valign,1;glowshift;effectperiod,2;shadowlength,0 +PercentRemainderP1OffCommand= +PercentRemainderP2X=0 +PercentRemainderP2Y=0 +PercentRemainderP2OnCommand=halign,0;valign,1;glowshift;effectperiod,2;shadowlength,0 +PercentRemainderP2OffCommand= +DancePointsP1X=-26 +DancePointsP1Y=-32 +DancePointsP1OnCommand=glowshift;effectperiod,2;shadowlength,0 +DancePointsP1OffCommand=sleep,0.8;accelerate,0.3 +DancePointsP2X=-26 +DancePointsP2Y=-32 +DancePointsP2OnCommand=glowshift;effectperiod,2;shadowlength,0 +DancePointsP2OffCommand=sleep,0.8;accelerate,0.3 +DancePointsDigits=1 +PercentUseRemainder=true +ApplyScoreDisplayOptions=false +Format=FormatPercentScore + +[ScoreDisplayPercentage Percent] +PercentP1X=20 +PercentP1Y=0 +PercentP1OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP1OffCommand= +PercentP2X=-20 +PercentP2Y=0 +PercentP2OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP2OffCommand= +DancePointsDigits=5 +PercentUseRemainder=false +ApplyScoreDisplayOptions=true +Format=FormatPercentScore +PercentDecimalPlaces=2 +PercentTotalSize=5 + +PercentP3X=20 +PercentP3Y=0 +PercentP3OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP3OffCommand= +PercentP4X=-20 +PercentP4Y=0 +PercentP4OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP4OffCommand= +PercentP5X=20 +PercentP5Y=0 +PercentP5OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP5OffCommand= +PercentP6X=-20 +PercentP6Y=0 +PercentP6OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP6OffCommand= +PercentP7X=20 +PercentP7Y=0 +PercentP7OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_1) +PercentP7OffCommand= +PercentP8X=-20 +PercentP8Y=0 +PercentP8OnCommand=shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP8OffCommand= + +[ScoreKeeperRave] +AttackDurationSeconds=10 + +[ScreenSelectMaster] +Fallback="ScreenSelect" +Class="ScreenSelectMaster" +WrapCursor=false +AllowRepeatingInput=false +PreSwitchPageSeconds=0 +PostSwitchPageSeconds=0 +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=20 +ScrollerTransform=function(self,offset,itemIndex,numItems) end +ScrollerSubdivisions=1 +OverrideSleepAfterTweenOffSeconds=false +SleepAfterTweenOffSeconds=0 +NumCodes=0 +OptionOrderUp= +OptionOrderDown= +OptionOrderLeft= +OptionOrderRight= +OptionOrderAuto= +ShowIcon=false +ShowCursor=false +ShowScroller=false +WrapScroller=false +LoopScroller=false +PerChoiceIconElement=true +PerChoiceScrollElement=true +# huh what's that +DoSwitchAnyways=false +# All on page 1 by default. +NumChoicesOnPage1=999 +SharedSelection=true +UseIconMetrics=true +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +DisabledColor=#606060 +# removed in SM4 +DoublePressToSelect=false + +# Blank defaults for a few options. +IconChoice1SwitchToPage1Command= +IconChoice1SwitchToPage2Command= +IconChoice1OnCommand= +IconChoice1OffCommand= +IconChoice1OffFocusedCommand= +IconChoice1OffUnfocusedCommand= + +IconChoice2SwitchToPage1Command= +IconChoice2SwitchToPage2Command= +IconChoice2OnCommand= +IconChoice2OffCommand= +IconChoice2OffFocusedCommand= +IconChoice2OffUnfocusedCommand= + +IconChoice3SwitchToPage1Command= +IconChoice3SwitchToPage2Command= +IconChoice3OnCommand= +IconChoice3OffCommand= +IconChoice3OffFocusedCommand= +IconChoice3OffUnfocusedCommand= + +IconChoice4SwitchToPage1Command= +IconChoice4SwitchToPage2Command= +IconChoice4OnCommand= +IconChoice4OffCommand= +IconChoice4OffFocusedCommand= +IconChoice4OffUnfocusedCommand= + +ExplanationPage1X=0 +ExplanationPage1Y=0 +ExplanationPage1SwitchToPage1Command= +ExplanationPage1SwitchToPage2Command= +ExplanationPage1OnCommand=visible,false +ExplanationPage1OffCommand= +ExplanationPage2X=0 +ExplanationPage2Y=0 +ExplanationPage2SwitchToPage1Command= +ExplanationPage2SwitchToPage2Command= +ExplanationPage2OnCommand=visible,false +ExplanationPage2OffCommand= + +MorePage1X=0 +MorePage1Y=0 +MorePage1SwitchToPage1Command= +MorePage1SwitchToPage2Command= +MorePage1OnCommand=visible,false +MorePage1OffCommand= +MorePage2X=0 +MorePage2Y=0 +MorePage2SwitchToPage1Command= +MorePage2SwitchToPage2Command= +MorePage2OnCommand=visible,false +MorePage2OffCommand= +IdleCommentSeconds=0 +IdleTimeoutSeconds=0 + +[ScreenOptionsAdvanced] +Fallback="ScreenOptionsServiceChild" +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30" +Line1="conf,MenuTimer" +Line2="conf,ScoringType" +Line3="conf,TimingWindowScale" +Line4="conf,LifeDifficulty" +Line5="conf,ProgressiveLifebar" +Line6="conf,ProgressiveStageLifebar" +Line7="conf,ProgressiveNonstopLifebar" +Line8="conf,DefaultFailType" +Line9="conf,ShowSongOptions" +Line10="conf,GetRankingName" +Line11="conf,AllowW1" +Line12="conf,Center1Player" +Line13="conf,HiddenSongs" +Line14="conf,EasterEggs" +Line15="conf,AllowExtraStage" +Line16="conf,UseUnlockSystem" +Line17="conf,CoinMode" +Line18="conf,SongsPerPlay" +Line19="conf,CoinsPerCredit" +Line20="conf,Premium" +Line21="conf,EventMode" +Line22="conf,AutoMapOnJoyChange" +Line23="conf,OnlyDedicatedMenuButtons" +Line24="conf,AutoPlay" +Line25="conf,DelayedBack" +Line26="conf,ArcadeOptionsNavigation" +Line27="conf,MusicWheelSwitchSpeed" +Line28="conf,AutogenSteps" +Line29="conf,AutogenGroupCourses" +Line30="conf,FastLoad" +# removed in sm4 +#Line31="conf,OnlyPreferredDifficulties" + +[ScreenOptionsGraphicsSound] +Fallback="ScreenOptionsServiceChild" +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19" +Line1="conf,Windowed" +Line2="conf,DisplayResolution" +Line3="conf,DisplayAspectRatio" +Line4="conf,DisplayColorDepth" +Line5="conf,HighResolutionTextures" +Line6="conf,MaxTextureResolution" +Line7="conf,TextureColorDepth" +Line8="conf,MovieColorDepth" +Line9="conf,SmoothLines" +Line10="conf,CelShadeModels" +Line11="conf,DelayedTextureDelete" +Line12="conf,RefreshRate" +Line13="conf,Vsync" +Line14="conf,ShowStats" +Line15="conf,ShowBanners" +Line16="conf,AttractSoundFrequency" +Line17="conf,SoundVolume" +Line18="conf,EnableAttackSounds" +Line19="conf,EnableMineHitSound" + +[ScreenAppearanceOptions] +Fallback="ScreenOptionsServiceChild" +LineNames="1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19" +#,8 +Line1="conf,Language" +Line2="conf,Announcer" +Line3="conf,Theme" +Line4="conf,DefaultNoteSkin" +Line5="conf,ShowInstructions" +Line6="conf,ShowCaution" +Line7="conf,DancePointsForOni" +#Line8="conf,ShowSelectGroup" +Line9="conf,MusicWheelUsesSections" +Line10="conf,CourseSortOrder" +Line11="conf,MoveRandomToEnd" +Line12="conf,ShowNativeLanguage" +Line13="conf,ShowLyrics" +Line14="conf,RandomBackgroundMode" +Line15="conf,BGBrightness" +Line16="conf,ShowDanger" +Line17="conf,ShowDancingCharacters" +Line18="conf,ShowBeginnerHelper" +Line19="conf,NumBackgrounds" + +[ScreenAttract] +ResetGameState=true +StartScreen=ScreenTitleBranch() +Class="ScreenAttract" +Fallback="ScreenWithMenuElementsBlank" +BackGoesToStartScreen=true +PrevScreen= +AttractVolume=true +LightsMode="LightsMode_Attract" + +[ScreenWithMenuElementsBlank] +Fallback="ScreenWithMenuElements" +# removed in sm4; remove here? +#ShowHeader=false +HeaderX= +HeaderY= +HeaderOnCommand=visible,false +HeaderOffCommand= +# removed in sm4; remove here? +#ShowFooter=false +FooterX= +FooterY= +FooterOnCommand=visible,false +FooterOffCommand= +ShowStyleIcon=false +TimerSeconds=6 +TimerStealth=true +ForceTimer=true +TimerX= +TimerY= +TimerOnCommand=visible,false +TimerOffCommand= +ShowHelp=false + +[ScreenSelectBlank] +Fallback="ScreenWithMenuElementsBlank" +UpdateOnMessage="" + +[ScreenSelectMasterBlank] +Fallback="ScreenSelectBlank" +Class="ScreenSelectMaster" +AllowRepeatingInput=false +ChoiceNames="1" +Choice1= +DefaultChoice="1" +WrapCursor=false +PreSwitchPageSeconds=0 +PostSwitchPageSeconds=0 +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=20 +ScrollerTransform=function(self,offset,itemIndex,numItems) end +ScrollerSubdivisions=1 +ShowStyleIcon=true +OverrideSleepAfterTweenOffSeconds=false +SleepAfterTweenOffSeconds=0 +NumCodes=0 +OptionOrderUp= +OptionOrderDown= +OptionOrderLeft= +OptionOrderRight= +OptionOrderAuto= +ShowIcon=false +ShowCursor=false +ShowScroller=false +WrapScroller=false +LoopScroller=false +PerChoiceIconElement=true +PerChoiceScrollElement=true +# All on page 1 by default. +NumChoicesOnPage1=999 +SharedSelection=true +UseIconMetrics=true +CursorP1OffsetXFromIcon=0 +CursorP1OffsetYFromIcon=0 +CursorP2OffsetXFromIcon=0 +CursorP2OffsetYFromIcon=0 +DisabledColor=#606060 + +ExplanationPage1X= +ExplanationPage1Y= +ExplanationPage1OnCommand=visible,false +ExplanationPage1OffCommand= +ExplanationPage2X= +ExplanationPage2Y= +ExplanationPage2OnCommand=visible,false +ExplanationPage2OffCommand= +MorePage1X= +MorePage1Y= +MorePage1OnCommand=visible,false +MorePage1OffCommand= +MorePage2X= +MorePage2Y= +MorePage2OnCommand=visible,false +MorePage2OffCommand= +IdleCommentSeconds=15 +IdleTimeoutSeconds=0 + +[ScreenUnlockStatus] +Class="ScreenUnlockStatus" +Fallback="ScreenAttract" +TypeOfPointsToDisplay="DP" +TimeToDisplay=10 +PointsDisplayX=SCREEN_CENTER_X-220 +PointsDisplayY=SCREEN_CENTER_Y+170 +PointsZoom=2 +UnlockTextScroll=3 +UnlockTextScrollRows=7 +UnlockTextScrollZoom=1 +UnlockTextScrollIconX=SCREEN_CENTER_X+30 +UnlockTextScrollIconSize=40 +UnlockTextScrollMaxWidth=265 +UnlockTextScrollX=SCREEN_CENTER_X+55 +UnlockTextScrollStartY=SCREEN_CENTER_Y+200 +UnlockTextScrollEndY=SCREEN_CENTER_Y-200 +NextScreen="ScreenCompany" +UnlockIconCommand=zoom,0;linear,0.3;zoom,1;linear,0.2;zoom,0.8;sleep,9;linear,0.5;diffusealpha,0 +Unlock0001X=SCREEN_CENTER_X-220 +Unlock0001Y=SCREEN_CENTER_Y-115 +Unlock0002X=SCREEN_CENTER_X-170 +Unlock0002Y=SCREEN_CENTER_Y-115 +Unlock0003X=SCREEN_CENTER_X-120 +Unlock0003Y=SCREEN_CENTER_Y-115 +Unlock0004X=SCREEN_CENTER_X-70 +Unlock0004Y=SCREEN_CENTER_Y-115 +Unlock0005X=SCREEN_CENTER_X-220 +Unlock0005Y=SCREEN_CENTER_Y-65 +Unlock0006X=SCREEN_CENTER_X-170 +Unlock0006Y=SCREEN_CENTER_Y-65 +Unlock0007X=SCREEN_CENTER_X-120 +Unlock0007Y=SCREEN_CENTER_Y-65 +Unlock0008X=SCREEN_CENTER_X-70 +Unlock0008Y=SCREEN_CENTER_Y-65 +Unlock0009X=SCREEN_CENTER_X-220 +Unlock0009Y=SCREEN_CENTER_Y-15 +Unlock0010X=SCREEN_CENTER_X-170 +Unlock0010Y=SCREEN_CENTER_Y-15 +Unlock0011X=SCREEN_CENTER_X-120 +Unlock0011Y=SCREEN_CENTER_Y-15 +Unlock0012X=SCREEN_CENTER_X-70 +Unlock0012Y=SCREEN_CENTER_Y-15 +Unlock0013X=SCREEN_CENTER_X-220 +Unlock0013Y=SCREEN_CENTER_Y+35 +Unlock0014X=SCREEN_CENTER_X-170 +Unlock0014Y=SCREEN_CENTER_Y+35 +Unlock0015X=SCREEN_CENTER_X-120 +Unlock0015Y=SCREEN_CENTER_Y+35 +Unlock0016X=SCREEN_CENTER_X-70 +Unlock0016Y=SCREEN_CENTER_Y+35 +Unlock0017X=SCREEN_CENTER_X-220 +Unlock0017Y=SCREEN_CENTER_Y+85 +Unlock0018X=SCREEN_CENTER_X-170 +Unlock0018Y=SCREEN_CENTER_Y+85 +Unlock0019X=SCREEN_CENTER_X-120 +Unlock0019Y=SCREEN_CENTER_Y+85 +Unlock0020X=SCREEN_CENTER_X-70 +Unlock0020Y=SCREEN_CENTER_Y+85 +DancePointsZoom=2 + +[ScreenHighScores] +Fallback="ScreenAttract" +Class="ScreenHighScores" +TimerSeconds=-1 +NextScreen="ScreenUnlockStatus" +PrevScreen="ScreenHowToPlay" +HighScoresType="HighScoresType_AllSteps" +MaxItemsToShow=50 +NumColumns=5 +ColumnDifficulty1="Difficulty_Beginner" +ColumnDifficulty2="Difficulty_Easy" +ColumnDifficulty3="Difficulty_Medium" +ColumnDifficulty4="Difficulty_Hard" +ColumnDifficulty5="Difficulty_Challenge" +ColumnStepsType1=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) +ColumnStepsType2=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) +ColumnStepsType3=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) +ColumnStepsType4=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) +ColumnStepsType5=GAMEMAN:GetFirstStepsTypeForGame(GAMESTATE:GetCurrentGame()) +ScrollerItemsToDraw=7 +ScrollerSecondsPerItem=0.4 +ManualScrolling=false +ScrollerOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+36;SetMask,608,40 +ScrollerItemTransformFunction=function(self,offset,itemIndex,numItems) self:y(46.1*offset) end + +[ScreenRanking] +Fallback="ScreenAttract" +Class="ScreenRanking" +TimerSeconds=-1 +StepsTypesToHide="dance-couple,dance-solo,dance-routine,pump-halfdouble,pump-couple" +PageFadeSeconds=1.0 +CoursesToShow=GetCoursesToShowRanking() +SecondsPerPage=5 + +RowSpacingX=0 +RowSpacingY=60 +ColSpacingX=0 +ColSpacingY=0 +StepsTypeColor1=color("0.6,0.6,1,1") +StepsTypeColor2=color("1,0.3,0.3,1") +StepsTypeColor3=color("0.3,1,0.3,1") +StepsTypeColor4=color("1.0,1,1.0,1") +StepsTypeColor5=color("1.0,1,1.0,1") +SongScoreSecondsPerRow=0.4 +ShowSurvivalTime=false + +BannerOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-196;diffusealpha,1;scaletoclipped,220,58;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +BannerOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +CategoryOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +CategoryOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +CourseTitleOnCommand=x,SCREEN_CENTER_X+197;y,SCREEN_CENTER_Y-208;diffusealpha,1;maxwidth,230;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +CourseTitleOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 +StepsTypeOnCommand=x,SCREEN_CENTER_X+200;y,SCREEN_CENTER_Y-180;diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.0;bounceend,1;addx,-SCREEN_WIDTH +StepsTypeOffCommand=sleep,0.0;linear,0.5;diffusealpha,0 + +BulletStartX=SCREEN_CENTER_X-220 +BulletStartY=SCREEN_CENTER_Y-100 +Bullet1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Bullet2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Bullet3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Bullet4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Bullet5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Bullet1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Bullet2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Bullet3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Bullet4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Bullet5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +NameStartX=SCREEN_CENTER_X-140 +NameStartY=SCREEN_CENTER_Y-100 +Name1OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Name2OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Name3OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Name4OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Name5OnCommand=diffusealpha,1;halign,0;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Name1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Name2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Name3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Name4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Name5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +ScoreStartX=SCREEN_CENTER_X+200 +ScoreStartY=SCREEN_CENTER_Y-100 +Score1OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Score2OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Score3OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Score4OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Score5OnCommand=diffusealpha,1;halign,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Score1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Score2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Score3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Score4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Score5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +PointsStartX=SCREEN_CENTER_X+60 +PointsStartY=SCREEN_CENTER_Y-100 +Points1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Points2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Points3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Points4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Points5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Points1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Points2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Points3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Points4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Points5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +TimeStartX=SCREEN_CENTER_X+240 +TimeStartY=SCREEN_CENTER_Y-100 +Time1OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.2;bounceend,1;addx,-SCREEN_WIDTH +Time2OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.3;bounceend,1;addx,-SCREEN_WIDTH +Time3OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.4;bounceend,1;addx,-SCREEN_WIDTH +Time4OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.5;bounceend,1;addx,-SCREEN_WIDTH +Time5OnCommand=diffusealpha,1;addx,SCREEN_WIDTH;sleep,0.6;bounceend,1;addx,-SCREEN_WIDTH +Time1OffCommand=sleep,0.2;linear,0.5;diffusealpha,0 +Time2OffCommand=sleep,0.3;linear,0.5;diffusealpha,0 +Time3OffCommand=sleep,0.4;linear,0.5;diffusealpha,0 +Time4OffCommand=sleep,0.5;linear,0.5;diffusealpha,0 +Time5OffCommand=sleep,0.6;linear,0.5;diffusealpha,0 +DifficultyStartX=SCREEN_CENTER_X-154 +DifficultyY=SCREEN_CENTER_Y-209 +DifficultyBeginnerOnCommand= +DifficultyEasyOnCommand= +DifficultyMediumOnCommand= +DifficultyHardOnCommand= +DifficultyChallengeOnCommand= +DifficultyBeginnerOffCommand= +DifficultyEasyOffCommand= +DifficultyMediumOffCommand= +DifficultyHardOffCommand= +DifficultyChallengeOffCommand= +TitleOnCommand=x,-210;ztest,1;diffuse,0,0,0,1;maxwidth,160 +TitleOffCommand= +FrameOnCommand=ztest,1 +FrameOffCommand= +ScoreOffsetStartX=-154 +ScoreOffsetY=0 +ScoreOnCommand=zoom,0.7;ztest,1 +ScoreOffCommand= + +[ScreenCompany] +Class="ScreenAttract" +Fallback="ScreenAttract" +NextScreen="ScreenLegal" +PrevScreen="" +TimerSeconds=6 + +[ScreenLegal] +Class="ScreenAttract" +Fallback="ScreenAttract" +NextScreen="ScreenLogo" +PrevScreen="" +TimerSeconds=12 + +[ScreenLogo] +Class="ScreenAttract" +Fallback="ScreenAttract" +NextScreen="ScreenHowToPlay" +PrevScreen="ScreenCompany" + +[ScreenHowToPlay] +Class="ScreenHowToPlay" +Fallback="ScreenAttract" +TimerSeconds=25 +NextScreen="ScreenDemonstration" +PrevScreen="ScreenLogo" +ResetGameState=false +LifeMeterBarX=SCREEN_CENTER_X-160 +LifeMeterBarY=SCREEN_TOP+56 +LifeMeterBarOnCommand=addy,-90;sleep,1.4;linear,0.4;addy,90 +UseCharacter=true +CharacterX=SCREEN_CENTER_X-160 +CharacterY=SCREEN_CENTER_Y+160 +CharacterOnCommand=zoom,15;draworder,2 +UsePad=true +PadX=SCREEN_CENTER_X-80 +PadY=SCREEN_CENTER_Y+160 +PadOnCommand=zoom,15;draworder,1;rotationx,5 +UsePlayer=true +PlayerX=SCREEN_CENTER_X-160 +PlayerY=SCREEN_CENTER_Y+20 +PlayerOnCommand=draworder,10 +NumW2s=4 +NumMisses=6 + +[ScreenDemonstration] +Fallback="ScreenGameplay" +Class="ScreenDemonstration" +SecondsToShow=30 +NextScreen="ScreenHighScores" +LightsMode="LightsMode_Demonstration" +DifficultiesToShow="easy,medium" +StartScreen=ScreenTitleBranch() +PlayMusic=false +MinSecondsToStep=0 +MinSecondsToMusic=0 +ShowCourseModifiersProbability=0 +AllowAdvancedModifiers=false +AllowStyleTypes="TwoPlayersTwoSides" + +[ScreenJukebox] +ShowCourseModifiersProbability=0 +Class="ScreenJukebox" +Fallback="ScreenGameplay" +NextScreen="ScreenJukebox" +StartScreen=ScreenTitleBranch() +LightsMode="LightsMode_Demonstration" +AllowAdvancedModifiers=true + +[ScreenNameEntry] +Class="ScreenNameEntry" +Fallback="ScreenWithMenuElementsBlank" +TimerX=SCREEN_CENTER_X+0 +TimerY=SCREEN_CENTER_Y-210 +CategoryY=SCREEN_CENTER_Y+190 +CategoryZoom=0.7 +CharsZoomSmall=1.0 +CharsZoomLarge=1.5 +CharsSpacingY=40 +ScrollingCharsCommand=diffuse,0.6,0.8,0.8,1 +SelectedCharsCommand=diffuse,0.8,1,1,1 +ReceptorArrowsY=SCREEN_CENTER_Y-140 +NumCharsToDrawBehind=2 +NumCharsToDrawTotal=10 +FakeBeatsPerSec=2.5 +ForceTimer=true +TimerSeconds=24 +TimerStealth=false +ShowStyleIcon=false +MaxRankingNameLength=4 +NextScreen="ScreenProfileSave" +PlayerP1OnePlayerOneSideX=SCREEN_CENTER_X-160 +PlayerP2OnePlayerOneSideX=SCREEN_CENTER_X+160 +PlayerP1TwoPlayersTwoSidesX=SCREEN_CENTER_X-160 +PlayerP2TwoPlayersTwoSidesX=SCREEN_CENTER_X+160 +PlayerP1OnePlayerTwoSidesX=SCREEN_CENTER_X +PlayerP2OnePlayerTwoSidesX=SCREEN_CENTER_X + +[EditCoursesMenu] +Arrows1X=SCREEN_CENTER_X-130 +Arrows2X=SCREEN_CENTER_X+270 +EntryBannerX=SCREEN_CENTER_X+170 +EntryBannerY=SCREEN_CENTER_Y-130 +EntryBannerWidth=130 +EntryBannerHeight=40 +EntryTextBannerX=SCREEN_CENTER_X+0 +EntryTextBannerY=SCREEN_CENTER_Y-130 +CourseBannerX=SCREEN_CENTER_X+170 +CourseBannerY=SCREEN_CENTER_Y-170 +CourseBannerWidth=130 +CourseBannerHeight=40 +RowLabelsX=SCREEN_CENTER_X-300 +RowValue1X=SCREEN_CENTER_X+0 +RowValue2X=SCREEN_CENTER_X+60 +RowValue3X=SCREEN_CENTER_X+60 +RowValue4X=SCREEN_CENTER_X+60 +RowValue5X=SCREEN_CENTER_X+60 +RowValue6X=SCREEN_CENTER_X+60 +RowValue7X=SCREEN_CENTER_X+60 +RowValue8X=SCREEN_CENTER_X+60 +Row1Y=SCREEN_CENTER_Y-170 +Row2Y=SCREEN_CENTER_Y-120 +Row3Y=SCREEN_CENTER_Y-80 +Row4Y=SCREEN_CENTER_Y-40 +Row5Y=SCREEN_CENTER_Y+0 +Row6Y=SCREEN_CENTER_Y+40 +Row7Y=SCREEN_CENTER_Y+80 +Row8Y=SCREEN_CENTER_Y+120 + +[EditCoursesSongMenu] +Fallback="EditCoursesMenu" + +; A simple list screen used outside of game mode +[ScreenOptionsSimple] +Fallback="ScreenOptionsMaster" +NumRowsShown=9 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-154+33*offsetFromCenter) end +NavigationMode="menu" +ForceAllPlayers=true +InputMode="together" +ShowStyleIcon=false +CursorOnCommand=visible,false +OptionRowNormalMetricsGroup="OptionRowSimple" +OptionRowExitMetricsGroup="OptionRowSimpleExit" +SeparateExitRowY=SCREEN_CENTER_Y+142 +LightsMode="LightsMode_MenuStartAndDirections" +TimerOnCommand=visible,false +ShowStyleIcon=false +TimerSeconds=-1 +AllowOperatorMenuButton=false +HelpText=ScreenString("HelpTextOptionsSimpleAndBack") + +[OptionRowSimple] +Fallback="OptionRow" +FrameX=SCREEN_CENTER_X +FrameY=2 +TitleX=SCREEN_CENTER_X +TitleY=-2 +TitleOnCommand=shadowlength,0;uppercase,true;maxwidth,300 +FrameGainFocusCommand=diffuse,1,1,1,1;glowshift;effectcolor2,color("#fffdd4"); +FrameLoseFocusCommand=diffuse,1,1,1,1;stopeffect +ShowUnderlines=false + +[OptionRowSimpleExit] +Fallback="OptionRowSimple" +ItemOnCommand=visible,false + +[ScreenOptionsService] +Class="ScreenOptionsMaster" +Fallback="ScreenOptionsSimple" +; This NextScreen is only used for the "exit" choice. +NextScreen=ScreenTitleBranch() +PrevScreen=ScreenTitleBranch() +LineNames="1,2,3,4,5,6,8,9" +Line1="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" +Line2="gamecommand;screen,ScreenTestInput;name,Test Input" +Line3="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options" +Line4="gamecommand;screen,ScreenOptionsGraphicsSound;name,Graphics/Sound Options" +Line5="gamecommand;screen,ScreenOptionsAdvanced;name,Advanced Options" +Line6="gamecommand;screen,ScreenNetworkOptions;name,Network Options" +Line8="gamecommand;screen,ScreenOptionsManageProfiles;name,Profiles" +Line9="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" +GroupedScreens="ScreenOptionsService,ScreenAppearanceOptions,ScreenMapControllers,ScreenOptionsGraphicsSound,ScreenOptionsAdvanced,ScreenOptionsManageProfiles,ScreenNetworkOptions,ScreenReloadSongs,ScreenTestInput" +PersistScreens="ScreenOptionsService,ScreenAppearanceOptions,ScreenMapControllers,ScreenOptionsGraphicsSound,ScreenOptionsAdvanced,ScreenOptionsManageProfiles,ScreenNetworkOptions,ScreenReloadSongs,ScreenTestInput" + +[ScreenOptionsServiceChild] +Fallback="ScreenOptionsMaster" +LightsMode="LightsMode_MenuStartAndDirections" +NavigationMode="normal" +InputMode="together" +TimerOnCommand=visible,false +ShowStyleIcon=false +TimerSeconds=-1 +AllowOperatorMenuButton=false +ForceAllPlayers=true +PrevScreen="ScreenOptionsService" +NextScreen="ScreenOptionsService" +HelpText=ScreenString("HelpTextOptionsAndBack") + +[ScreenOptionsTestMenu] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" +LineNames="1" +Line1="lua,OptionsRowTest()" + +[TextBanner] +TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");halign,1;x,120;skewx,-0.1;maxwidth,208; +SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");halign,1;x,120;skewx,-0.1; +ArtistOnCommand=visible,false +ArtistPrependString="/" +AfterSetCommand=%TextBannerAfterSet + +[TextBannerHighScores] +Fallback="TextBanner" +TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");halign,0.5; +SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");halign,0.5; + +[TextBannerCourseEntry] +Fallback="TextBanner" +TitleX=-90 +SubtitleX=-90 +ArtistX=-90 + +[ArtistDisplay] +TipShowTime=1 +TipOnCommand= + +[ScreenSelectGame] +Fallback="ScreenOptionsServiceChild" +PrevScreen=ScreenTitleBranch() +NextScreen=ScreenTitleBranch() +LineNames="1" +Line1="conf,Game" + +[ScreenPlayerOptions] +Fallback="ScreenOptions" +Class="ScreenPlayerOptions" +PrevScreen=SongSelectionScreen() +NextScreen=ScreenPlayerOptionsNext() +PlayMusic=false +TimerSeconds=30 +ShowStyleIcon=false +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" +Line1="list,Speed" +Line2="list,Accel" +Line3="list,Effect" +Line4="list,Appearance" +Line5="list,Turn" +Line6="list,Insert" +Line7="list,Scroll" +Line8="list,NoteSkins" +Line9="list,Holds" +Line10="list,Mines" +Line11="list,Attacks" +Line12="list,PlayerAutoPlay" +Line13="list,Hide" +Line14="list,Persp" +Line15="list,ScoreDisplay" +Line16="list,Steps" +Line17="list,Characters" + +[ScreenRaveOptions] +Fallback="ScreenOptions" +Class="ScreenOptionsMaster" +PrevScreen="ScreenSelectMusic" +NextScreen="ScreenStage" +TimerSeconds=30 +ShowStyleIcon=false +LineNames="1,2,3,4,5" +Line1="list,Speed" +Line2="list,Scroll" +Line3="list,NoteSkins" +Line4="list,Persp" +Line5="list,Steps" + +[ScreenSongOptions] +Class="ScreenSongOptions" +Fallback="ScreenOptions" +PrevScreen=SelectFirstOptionsScreen() +NextScreen="ScreenStage" +TimerSeconds=30 +ShowStyleIcon=false +PlayMusic=false +LineNames="1,2,3,4,5,6,7,8,9,10" +Line1="list,LifeType" +Line2="list,BarDrain" +Line3="list,BatLives" +Line4="list,Fail" +Line5="list,Assist" +Line6="list,Rate" +Line7="list,SoundEffect" +Line8="list,AutoAdjust" +Line9="list,Background" +Line10="list,SaveScores" +StopMusicOnBack=false + +[ScreenEnding] +Fallback="ScreenAttract" +Class="ScreenEnding" +NextScreen="ScreenHighScores" + +RemoveCardP1X=SCREEN_WIDTH*0.1 +RemoveCardP1Y=SCREEN_CENTER_Y +RemoveCardP1OnCommand= +RemoveCardP1OffCommand= + +RemoveCardP2X=SCREEN_WIDTH*0.9 +RemoveCardP2Y=SCREEN_CENTER_Y +RemoveCardP2OnCommand= +RemoveCardP2OffCommand= + +[ScreenGameOver] +Fallback="ScreenEnding" +TimerSeconds=10 + +[ScreenEnding1] +Fallback="ScreenEnding" +; decorations send "SM_BeginFadingOut", so timer is disabled +TimerSeconds=0 + +[ScreenEnding2] +Fallback="ScreenEnding" +; decorations send "SM_BeginFadingOut", so timer is disabled +TimerSeconds=0 + +[ScreenEnding3] +Fallback="ScreenEnding" +; decorations send "SM_BeginFadingOut", so timer is disabled +TimerSeconds=0 + +[ScreenSelectCharacter] +Class="ScreenSelectCharacter" +Fallback="ScreenWithMenuElements" +WaitForChildrenBeforeTweeningOut=true +TitleP1OnCommand=x,140;y,80;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +TitleP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +TitleP2OnCommand=x,500;y,80;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +TitleP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +CardP1OnCommand=x,140;y,180;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +CardP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +CardP2OnCommand=x,500;y,180;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +CardP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +CardArrowsP1OnCommand=x,140;y,180;diffusealpha,0;linear,0.3;diffusealpha,1 +CardArrowsP1OffCommand=linear,0.3;diffusealpha,0 +CardArrowsP2OnCommand=x,500;y,180;diffusealpha,0;linear,0.3;diffusealpha,1 +CardArrowsP2OffCommand=linear,0.3;diffusealpha,0 +ExplanationOnCommand=x,SCREEN_CENTER_X;y,140;diffusealpha,0;linear,0.3;diffusealpha,1 +ExplanationOffCommand=linear,0.3;diffusealpha,0 +AttackFrameP1OnCommand=x,140;y,380;addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +AttackFrameP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +AttackFrameP2OnCommand=x,500;y,380;addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +AttackFrameP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +AttackIconWidth=40 +AttackIconHeight=40 +AttackIconsP1StartX=SCREEN_CENTER_X-192 +AttackIconsP1StartY=SCREEN_CENTER_Y+116 +AttackIconsP2StartX=SCREEN_CENTER_X+168 +AttackIconsP2StartY=SCREEN_CENTER_Y+116 +AttackIconsSpacingX=42 +AttackIconsSpacingY=32 +AttackIconsP1OnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +AttackIconsP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +AttackIconsP2OnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +AttackIconsP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +IconWidth=40 +IconHeight=40 +IconsP1OnCommand=addx,-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6 +IconsP1OffCommand=sleep,0.2;bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 +IconsP2OnCommand=addx,SCREEN_WIDTH*0.6;bounceend,0.5;addx,-SCREEN_WIDTH*0.6 +IconsP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,SCREEN_WIDTH*0.6 +SleepAfterTweenOffSeconds=0.8 +TimerSeconds=40 +ShowStyleIcon=true +PrevScreen=ScreenTitleBranch() +NextScreen=SongSelectionScreen() + +[BeginnerHelper] +# All X,Y coordinates are relative to the HelperX,Y +Player1_X=-125 +Player2_X=SCREEN_CENTER_X-195 +PlayerAngle=40 +DancePadAngle=36 +# HelperX,Y are set to SCREEN_CENTER_X and SCREEN_CENTER_Y in code... +HelperX=SCREEN_LEFT +HelperY=SCREEN_CENTER_Y/2 + +[ScreenOptionsMaster] +Fallback="ScreenOptions" +Class="ScreenOptionsMaster" +NoteSkinSortOrder="" + +# ExitItem is an exit row with the "Exit" text as a menu item; ExitTitle +# uses the menu title. +ExitItem="1;together;SelectNone;showoneinrow" +ExitItemDefault="" +ExitItem,1="screen," .. ScreenMetric("NextScreen") .. ";name,ExitItem" +ExitTitle="1;together;SelectNone;showoneinrow" +ExitTitleDefault="" +ExitTitle,1="screen," .. ScreenMetric("NextScreen") .. ";name,ExitTitle" + +# Player options +Speed="12" +SpeedDefault="mod,1x,no randomspeed" +Speed,1="mod,0.25x;name,x0.25" +Speed,2="mod,0.50x;name,x0.50" +Speed,3="mod,0.75x;name,x0.75" +Speed,4="mod,1x;name,x1" +Speed,5="mod,1.5x;name,x1.5" +Speed,6="mod,2x;name,x2" +Speed,7="mod,3x;name,x3" +Speed,8="mod,4x;name,x4" +Speed,9="mod,8x;name,x8" +Speed,10="mod,C200;name,C200" +Speed,11="mod,C400;name,C400" +Speed,12="mod,1x,200% randomspeed;name,Random" +Accel="6" +AccelDefault="mod,no boost,no brake,no wave,no expand,no boomerang" +Accel,1="name,Off" +Accel,2="mod,boost;name,Boost" +Accel,3="mod,brake;name,Brake" +Accel,4="mod,wave;name,Wave" +Accel,5="mod,expand;name,Expand" +Accel,6="mod,boomerang;name,Boomerang" +Effect="9" +EffectDefault="mod,no drunk,no dizzy,no confusion,no mini,no flip,no tornado,no tipsy" +Effect,1="name,Off" +Effect,2="mod,drunk;name,Drunk" +Effect,3="mod,dizzy;name,Dizzy" +Effect,4="mod,confusion;name,Confusion" +Effect,5="mod,mini;name,Mini" +Effect,6="mod,-100% mini;name,Big" +Effect,7="mod,flip;name,Flip" +Effect,8="mod,tornado;name,Tornado" +Effect,9="mod,tipsy;name,Tipsy" +Appearance="6" +AppearanceDefault="mod,no hidden,no sudden,no stealth,no blink,no randomvanish" +Appearance,1="name,Visible" +Appearance,2="mod,hidden;name,Hidden" +Appearance,3="mod,sudden;name,Sudden" +Appearance,4="mod,stealth;name,Stealth" +Appearance,5="mod,blink;name,Blink" +Appearance,6="mod,randomvanish;name,R.Vanish" +Turn="6" +TurnDefault="mod,no turn" +Turn,1="name,Off" +Turn,2="mod,mirror;name,Mirror" +Turn,3="mod,left;name,Left" +Turn,4="mod,right;name,Right" +Turn,5="mod,shuffle;name,Shuffle" +Turn,6="mod,supershuffle;name,SuperShuffle" +Insert="8" +InsertDefault="mod,no little,no wide,no big,no quick,no skippy,no echo,no stomp" +Insert,1="name,Off" +Insert,2="mod,little;name,Little" +Insert,3="mod,wide;name,Wide" +Insert,4="mod,big;name,Big" +Insert,5="mod,quick;name,Quick" +Insert,6="mod,skippy;name,Skippy" +Insert,7="mod,echo;name,Echo" +Insert,8="mod,stomp;name,Stomp" +Scroll="5" +ScrollDefault="mod,no reverse,no split,no alternate,no cross" +Scroll,1="name,Standard" +Scroll,2="mod,reverse;name,Reverse" +Scroll,3="mod,split;name,Split" +Scroll,4="mod,alternate;name,Alternate" +Scroll,5="mod,cross;name,Cross" +Holds="6" +HoldsDefault="mod,no noholds,no planted,no twister,no nojumps,no nohands" +Holds,1="mod,noholds;name,Off" +Holds,2="name,On" +Holds,3="mod,planted;name,Planted" +Holds,4="mod,twister;name,Twister" +Holds,5="mod,nojumps;name,NoJumps" +Holds,6="mod,nohands;name,NoHands" +Mines="4" +MinesDefault="mod,no nomines,no mines, no attackmines" +Mines,1="mod,nomines;name,Off" +Mines,2="name,On" +Mines,3="mod,mines;name,Add" +Mines,4="mod,attackmines;name,AttackMines" +Attacks="3" +AttacksDefault="mod,no randomattacks,no songattacks" +Attacks,1="name,Off" +Attacks,2="mod,randomattacks;name,RandomAttacks" +Attacks,3="mod,songattacks;name,SongAttacks" +PlayerAutoPlay="2" +PlayerAutoPlayDefault="mod,no playerautoplay" +PlayerAutoPlay,1="name,Off" +PlayerAutoPlay,2="mod,playerautoplay;name,On" +Hide="3" +HideDefault="mod,no dark,no blind" +Hide,1="name,Off" +Hide,2="mod,dark;name,Dark" +Hide,3="mod,blind;name,Blind" +Persp="5" +PerspDefault="mod,overhead" +Persp,1="mod,incoming;name,Incoming" +Persp,2="mod,overhead;name,Overhead" +Persp,3="mod,space;name,Space" +Persp,4="mod,hallway;name,Hallway" +Persp,5="mod,distant;name,Distant" +ScoreDisplay="3" +ScoreDisplayDefault="mod,addscore" +ScoreDisplay,1="mod,addscore;name,Add" +ScoreDisplay,2="mod,subtractscore;name,Subtract" +ScoreDisplay,3="mod,averagescore;name,Average" + +# Song options +LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together" +LifeTypeDefault="" +LifeType,1="mod,bar;name,Bar" +LifeType,2="mod,battery;name,Battery" +LifeType,3="mod,lifetime;name,LifeTime" +BarDrain="3;together" +BarDrainDefault="" +BarDrain,1="mod,normal-drain;name,Normal" +BarDrain,2="mod,norecover;name,NoRecover" +BarDrain,3="mod,suddendeath;name,SuddenDeath" +BatLives="10;together" +BatLivesDefault="" +BatLives,1="mod,1 life;name,1" +BatLives,2="mod,2 lives;name,2" +BatLives,3="mod,3 lives;name,3" +BatLives,4="mod,4 lives;name,4" +BatLives,5="mod,5 lives;name,5" +BatLives,6="mod,6 lives;name,6" +BatLives,7="mod,7 lives;name,7" +BatLives,8="mod,8 lives;name,8" +BatLives,9="mod,9 lives;name,9" +BatLives,10="mod,10 lives;name,10" +Fail="4;together" +FailDefault="" +Fail,1="mod,failImmediate;name,Immediate" +Fail,2="mod,FailImmediateContinue;name,ImmediateContinue" +Fail,3="mod,FailAtEnd;name,FailAtEnd" +Fail,4="mod,failoff;name,Off" +Assist="4;together" +AssistDefault="" +Assist,1="mod,no clap,no metronome;name,Off" +Assist,2="mod,clap,no metronome;name,Clap" +Assist,3="mod,no clap,metronome;name,Metronome" +Assist,4="mod,clap,metronome;name,Both" +Rate="13;together" +RateDefault="mod,1.0xmusic;mod,no haste" +Rate,1="mod,0.25xmusic;name,0.25x" +Rate,2="mod,0.50xmusic;name,0.5x" +Rate,3="mod,0.75xmusic;name,0.75x" +Rate,4="mod,0.8xmusic;name,0.8x" +Rate,5="mod,0.9xmusic;name,0.9x" +Rate,6="mod,1.0xmusic;name,1.0x" +Rate,7="mod,haste;name,Haste" +Rate,8="mod,1.1xmusic;name,1.1x" +Rate,9="mod,1.2xmusic;name,1.2x" +Rate,10="mod,1.3xmusic;name,1.3x" +Rate,11="mod,1.5xmusic;name,1.5x" +Rate,12="mod,1.75xmusic;name,1.75x" +Rate,13="mod,2.0xmusic;name,2.0x" +AutoAdjust="4;together" +AutoAdjustDefault="" +AutoAdjust,1="mod,no autosync;name,Off" +AutoAdjust,2="mod,autosyncsong;name,Sync Song" +AutoAdjust,3="mod,autosyncmachine;name,Sync Machine" +AutoAdjust,4="mod,autosynctempo;name,Sync Tempo" +SoundEffect="3;together" +SoundEffectDefault="" +SoundEffect,1="mod,no effect;name,Off" +SoundEffect,2="mod,EffectSpeed;name,EffectSpeed" +SoundEffect,3="mod,EffectPitch;name,EffectPitch" +Background="3;together" +BackgroundDefault="" +Background,1="mod,no effect;name,Default" +Background,2="mod,staticbg;name,StaticBG" +Background,3="mod,randombg;name,RandomBG" +SaveScores="2;together" +SaveScoresDefault="" +SaveScores,1="mod,no savescore;name,Off" +SaveScores,2="mod,savescore;name,On" + +#ScreenJukeboxMenu +RandomModifiers="2;together" +RandomModifiersDefault="mod,clear" +RandomModifiers,1="name,Off" +RandomModifiers,2="mod,random;name,Random" + +# ScreenOptionsEditMode +Edit Steps="1;together;SelectNone" +Edit StepsDefault="" +Edit Steps,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" +Transfer To USB Drive="1;together;SelectNone" +Transfer To USB DriveDefault="" +Transfer To USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer To USB Drive" +Transfer From USB Drive="1;together;SelectNone" +Transfer From USB DriveDefault="" +Transfer From USB Drive,1="screen,ScreenOptionsManageEditSteps;name,Transfer From USB Drive" + +[ScreenReloadSongs] +Class="ScreenReloadSongs" +Fallback="Screen" +NextScreen=ScreenTitleBranch() + +[DancingCharacters] +#2D Character X/Y positions in relation to the center +#of the screen +2DCharacterXP1=-220 +2DCharacterYP1=0 +2DCharacterXP2=220 +2DCharacterYP2=0 + +[FadingBanner] +BannerOnCommand= +BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 +BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 +BannerResetFadeCommand=diffusealpha,1 + +[HelpDisplay] +TipShowTime=3.5 +TipOnCommand=shadowlength,0;diffuseblink + +[CombinedLifeMeterTug] +MeterWidth=550 + +[ScoreDisplayRave] +MeterP1OnCommand=rotationz,-90 +MeterP2OnCommand=rotationz,-90 +LevelP1OnCommand=addy,-140 +LevelP2OnCommand=addy,-140 + +[ScoreDisplayLifeTime] +FrameOnCommand= +TimeRemainingOnCommand= +DeltaSecondsOnCommand=addx,50;zoom,0.75; +DeltaSecondsNoneCommand=visible,false; +DeltaSecondsHitMineCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsAvoidMineCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsCheckpointMissCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsCheckpointHitCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsMissCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsW5Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsW4Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsW3Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsW2Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsW1Command=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsLetGoCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsHeldCommand=shadowlength,4;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0;diffusealpha,0 +DeltaSecondsGainLifeCommand= + +[PlayerStageStats] +NumGradeTiersUsed=8 +GradePercentTier01=1.00 +GradePercentTier02=0.99 +GradePercentTier03=0.97 +GradePercentTier04=0.93 +GradePercentTier05=0.80 +GradePercentTier06=0.65 +GradePercentTier07=0.45 +GradePercentTier08=-99999.000000 +GradeTier01IsAllW2s=false +GradeTier02IsAllW2s=false +GradeTier02IsFullCombo=false + +[HighScore] +EmptyName="STEP" + +[ScreenSetTime] +Class="ScreenSetTime" +ShowStyleIcon=false +TimerSeconds=-1 +TimerOnCommand=visible,false +Fallback="ScreenWithMenuElements" +NextScreen="ScreenOptionsService" +PrevScreen="ScreenOptionsService" + +[Banner] +ScrollRandom=false +ScrollRoulette=false + +[ScreenEdit] +Class="ScreenEdit" +Fallback="ScreenWithMenuElementsBlank" +PrepareScreens=GetEditModeSubScreens() +GroupedScreens=GetEditModeSubScreens() +PersistScreens=GetEditModeSubScreens() +EditMode="EditMode_Full" +NextScreen="ScreenEditMenu" +PrevScreen="ScreenEditMenu" +ShowHelp=false +AllowOperatorMenuButton=false +ShowCoinsAndCredits=false +ShowStyleIcon=false +TimerSeconds=-1 +EditModifiers="" +EditHelpX=SCREEN_LEFT+4 +EditHelpY=SCREEN_TOP+40 +EditHelpOnCommand=halign,0;valign,0;shadowlength,0 +InfoX=SCREEN_RIGHT-114 +InfoY=SCREEN_TOP+40 +InfoOnCommand=halign,0;valign,0;shadowlength,0; +PlayRecordHelpX=SCREEN_LEFT+20 +PlayRecordHelpY=SCREEN_BOTTOM-20 +PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,0 + +[ScreenEditOptions] +Fallback="ScreenOptions" +Class="ScreenOptionsMaster" +NextScreen="none" +PrevScreen="none" +CancelTransitionsOut=true +PlayMusic=false +TimerSeconds=-1 +ShowStyleIcon=false +LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" +Line1="list,Speed" +Line2="list,Accel" +Line3="list,Effect" +Line4="list,Appearance" +Line5="list,Turn" +Line6="list,Insert" +Line7="list,Scroll" +Line8="list,NoteSkins" +Line9="list,Holds" +Line10="list,Mines" +Line11="list,Hide" +Line12="list,Persp" +Line13="list,Assist" +Line14="list,Rate" +Line15="list,AutoAdjust" +Line16="conf,EditorShowBGChangesPlay" +OutCancelCommand= + +[RadarValues] +WriteComplexValues=true +WriteSimpleValues=true + +[RadarCategory] +TapsAndHolds=true + +[Course] +SortPreferredColor=color("1,1,1,1") -- Preferred is both for when courses are in preferred sort, or are autogen +SortLevel1Color=color("1,0,0,1") +SortLevel2Color=color("1,1,0,1") +SortLevel3Color=color("1,0.5,0,1") +SortLevel4Color=color("1,1,0,1") +SortLevel5Color=color("0,1,0,1") + +[Inventory] +ItemUseRateSeconds=0 + +[ScreenMemcardSaveEditsAfterDeleteSteps] + +[ScreenMemcardSaveEditsAfterSave] + +[ScreenMemcardSaveEditsAfterExit] + +[ScreenMiniMenu] +Class="ScreenMiniMenu" +Fallback="ScreenOptions" +PrevScreen= +ShowHelp=false +TimerSeconds=-1 +ShowExplanations=false +ShowExitRow=false +ContainerOnCommand= +ContainerOffCommand= +NumRowsShown=30 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local indexOffset = itemIndex-(numItems-1)/2; self:y( SCREEN_CENTER_Y + indexOffset * 20 ); end +ShowStyleIcon=false +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP+40 +HeaderOnCommand= +HeaderOffCommand= +AllowRepeatingChangeValueInput=true +CursorOnCommand=visible,false +OptionRowNormalMetricsGroup="OptionRowMiniMenu" + +[OptionRowMiniMenu] +Fallback="OptionRow" +IconsP1X=SCREEN_CENTER_X-280 +IconsP2X=SCREEN_CENTER_X+280 +IconsOnCommand=x,-30 +FrameX=SCREEN_CENTER_X-232 +TitleX=SCREEN_CENTER_X-150 +TitleOnCommand=halign,0;shadowlength,2 +ItemsStartX=SCREEN_CENTER_X-150 +ItemsEndX=SCREEN_CENTER_X+280 +ItemsGapX=14 +ItemsLongRowP1X=SCREEN_CENTER_X-60 +ItemsLongRowP2X=SCREEN_CENTER_X+100 +ItemsLongRowSharedX=SCREEN_CENTER_X+150 +ItemOnCommand= +ColorSelected=color("0.5,1,0.5,1") +ColorNotSelected=color("1,1,1,1") +ColorDisabled=color("0.5,0.5,0.5,1") +TweenSeconds=0 + +[ScreenMiniMenuContext] +Fallback="ScreenMiniMenu" +NumRowsShown=10 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(24*(offsetFromCenter-(numItems-1)/2)) end +LineHighlightX=0 +ShowHelp=false +OptionRowNormalMetricsGroup="OptionRowMiniMenuContext" + +[OptionRowMiniMenuContext] +Fallback="OptionRowMiniMenu" +TitleX=-54 + +[ScreenMiniMenuEditHelp] +Fallback="ScreenMiniMenu" +ColorDisabled=color("1,1,1,1") + +[ScreenMiniMenuMainMenu] +Fallback="ScreenMiniMenu" + +TitleX=SCREEN_CENTER_X-80 + +[ScreenMiniMenuAreaMenu] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuStepsInformation] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuSongInformation] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuBackgroundChange] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuPreferences] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuInsertTapAttack] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuInsertCourseAttack] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuCourseDisplay] +Fallback="ScreenMiniMenu" + +[ScreenMiniMenuCourseOptions] +Fallback="ScreenMiniMenu" + +[ScreenTextEntry] +Class="ScreenTextEntry" +Fallback="ScreenWithMenuElements" +PrevScreen= +HelpText= +TimerSeconds=-1 +ShowStyleIcon=false +RowStartX=SCREEN_LEFT+100 +RowStartY=SCREEN_CENTER_Y-30 +RowEndX=SCREEN_RIGHT-100 +RowEndY=SCREEN_BOTTOM-96 +QuestionX=SCREEN_CENTER_X +QuestionY=SCREEN_CENTER_Y-40 +QuestionOnCommand=zoom,1.5;wrapwidthpixels,600 +QuestionOffCommand= +AnswerX=SCREEN_CENTER_X +AnswerY=SCREEN_CENTER_Y+20 +AnswerOnCommand=zoom,1.5;shadowlength,0 +AnswerOffCommand= +CursorOnCommand= +CursorOffCommand= +KeysInitCommand=zoom,0.8;shadowlength,0 + +[ScreenPrompt] +Class="ScreenPrompt" +Fallback="ScreenWithMenuElementsBlank" +TimerSeconds=-1 + +QuestionX=SCREEN_CENTER_X +QuestionY=SCREEN_CENTER_Y-60 +QuestionOnCommand=zoom,0.7;wrapwidthpixels,600 +QuestionOffCommand= +CursorOnCommand= +CursorOffCommand= +Answer1Of1X=SCREEN_CENTER_X +Answer1Of1Y=SCREEN_CENTER_Y+120 +Answer1Of1OnCommand=maxwidth,100 +Answer1Of1OffCommand= +Answer1Of2X=SCREEN_CENTER_X-50 +Answer1Of2Y=SCREEN_CENTER_Y+120 +Answer1Of2OnCommand=maxwidth,100 +Answer1Of2OffCommand= +Answer2Of2X=SCREEN_CENTER_X+50 +Answer2Of2Y=SCREEN_CENTER_Y+120 +Answer2Of2OnCommand=maxwidth,100 +Answer2Of2OffCommand= +Answer1Of3X=SCREEN_CENTER_X-170 +Answer1Of3Y=SCREEN_CENTER_Y+120 +Answer1Of3OnCommand=maxwidth,100 +Answer1Of3OffCommand= +Answer2Of3X=SCREEN_CENTER_X-20 +Answer2Of3Y=SCREEN_CENTER_Y+120 +Answer2Of3OnCommand=maxwidth,100 +Answer2Of3OffCommand= +Answer3Of3X=SCREEN_CENTER_X+150 +Answer3Of3Y=SCREEN_CENTER_Y+120 +Answer3Of3OnCommand=maxwidth,100 +Answer3Of3OffCommand= + +[GameState] +UseNameBlacklist=false +DefaultSort="Group" +DefaultSong="" +AreStagePlayerModsForced=AreStagePlayerModsForced +AreStageSongModsForced=AreStageSongModsForced +GradeTierForExtra1="Grade_Tier03" +AllowExtra2=true +GradeTierForExtra2="Grade_Tier03" +AllowLateJoin=false +ProfileRecordFeats=true +CategoryRecordFeats=true +MinDifficultyForExtra="Difficulty_Hard" +LockExtraStageSelection=true + +[ScreenOptionsManage] +Fallback="ScreenOptionsSimple" +TimerSeconds=-1 +AllowRepeatingChangeValueInput=true +OptionRowNormalMetricsGroup="OptionRowManage" + +[OptionRowManage] +Fallback="OptionRowSimple" +TitleX=SCREEN_CENTER_X-150 + +[ScreenOptionsManageEditSteps] +Class="ScreenOptionsManageEditSteps" +Fallback="ScreenOptionsManage" +CreateNewScreen="ScreenEditMenu" +EditMode="EditMode_Full" +PrevScreen="ScreenSelectEditMode" +NextScreen="ScreenOptionsEditCourse" +PrepareScreens="ScreenMiniMenuContext" +GroupedScreens="ScreenMiniMenuContext" +PersistScreens="ScreenMiniMenuContext" + +[ScreenOptionsManageCourses] +Class="ScreenOptionsManageCourses" +Fallback="ScreenOptionsManage" +PrevScreen=ScreenTitleBranch() +NextScreen="ScreenOptionsEditCourse" +GroupedScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt,ScreenOptionsEditCourseMods" +PersistScreens="ScreenOptionsManageCourses,ScreenTextEntry,ScreenPrompt" +PrepareScreens="ScreenTextEntry,ScreenPrompt" +CreateNewScreen="ScreenOptionsEditCourse" +EditMode="EditMode_Full" + +[ScreenOptionsEditCourse] +Class="ScreenOptionsEditCourse" +Fallback="ScreenOptionsSimple" +PrevScreen="ScreenOptionsCourseOverview" +NextScreen="ScreenOptionsCourseOverview" +OptionRowNormalMetricsGroup="OptionRowEditCourse" +LineHighlightOnCommand=x,-100 + +[OptionRowEditCourse] +Fallback="OptionRowSimple" +TitleX=SCREEN_CENTER_X-250 +ItemsLongRowSharedX=SCREEN_CENTER_X-100 + +[ScreenOptionsCourseOverview] +Class="ScreenOptionsCourseOverview" +Fallback="ScreenOptionsSimple" +PrevScreen="ScreenOptionsManageCourses" +NextScreen="ScreenOptionsManageCourses" +PlayScreen="ScreenJoinMultiplayer" +EditScreen="ScreenOptionsEditCourse" +OptionRowNormalMetricsGroup="OptionRowCourseOverview" + +[OptionRowCourseOverview] +Fallback="OptionRowSimple" +TitleX=SCREEN_CENTER_X-250 +ItemsLongRowSharedX=SCREEN_CENTER_X-100 + +[ScreenEditCourseMods] +Class="ScreenEdit" +Fallback="ScreenEdit" +EditMode="EditMode_CourseMods" +NextScreen="ScreenOptionsEditCourseEntry" +PrevScreen="ScreenOptionsEditCourseEntry" + +[ScreenOptionsManageProfiles] +Class="ScreenOptionsManageProfiles" +Fallback="ScreenOptionsSimple" +PrevScreen="ScreenOptionsService" +NextScreen="ScreenOptionsService" +PrepareScreens="ScreenMiniMenuContext" +GroupedScreens="ScreenMiniMenuContext" +PersistScreens="ScreenMiniMenuContext" +ShowStyleIcon=false +TimerSeconds=-1 + +[ScreenOptionsEditProfile] +Class="ScreenOptionsEditProfile" +Fallback="ScreenOptionsServiceChild" +PrevScreen="ScreenOptionsManageProfiles" +NextScreen="ScreenOptionsManageProfiles" +TimerSeconds=-1 +ShowExplanations=false +AllowRepeatingChangeValueInput=true +WrapValueInRow=0 + +[ProfileManager] +FixedProfiles=false +NumFixedProfiles=1 + +[ScreenJoinMultiplayer] +Class="ScreenJoinMultiplayer" +Fallback="ScreenWithMenuElements" +TimerSeconds=-1 + +[PaneDisplay] +ShiftP1X=-40 +ShiftP1Y=0 +ShiftP2X=-70 +ShiftP2Y=0 +CountFormat="%3.0f" +NumStepsTextX=-18+64*-0.5 +NumStepsTextY=16*-1 +NumStepsTextOnCommand=shadowlength,0; +NumStepsTextOffCommand=linear,0.1;diffusealpha,0; +NumStepsLabelX=-34-4+64*-0.5 +NumStepsLabelY=16*-1 +NumStepsLabelOnCommand=halign,1 +NumStepsLabelOffCommand=linear,0.1;diffusealpha,0; + +JumpsTextX=-18+64*-0.5 +JumpsTextY=16*0 +JumpsTextOnCommand=shadowlength,0; +JumpsTextOffCommand=linear,0.1;diffusealpha,0; +JumpsLabelX=-34+64*-0.5 +JumpsLabelY=16*0 +JumpsLabelOnCommand=halign,1 +JumpsLabelOffCommand=linear,0.1;diffusealpha,0; + +HoldsTextX=-18+64*1.5 +HoldsTextY=16*-1 +HoldsTextOnCommand=shadowlength,0; +HoldsTextOffCommand=linear,0.1;diffusealpha,0; +HoldsLabelX=-34+64*1.5 +HoldsLabelY=16*-1 +HoldsLabelOnCommand=halign,1 +HoldsLabelOffCommand=linear,0.1;diffusealpha,0; + +MinesTextX=-18+64*0.5 +MinesTextY=16*-1 +MinesTextOnCommand=shadowlength,0; +MinesTextOffCommand=linear,0.1;diffusealpha,0; +MinesLabelX=-34+64*0.5 +MinesLabelY=16*-1 +MinesLabelOnCommand=halign,1 +MinesLabelOffCommand=linear,0.1;diffusealpha,0; + +HandsTextX=-18+64*0.5 +HandsTextY=16*0 +HandsTextOnCommand=shadowlength,0; +HandsTextOffCommand=linear,0.1;diffusealpha,0; +HandsLabelX=-34+64*0.5 +HandsLabelY=16*0 +HandsLabelOnCommand=halign,1 +HandsLabelOffCommand=linear,0.1;diffusealpha,0; + +RollsTextX=-18+64*1.5 +RollsTextY=16*0 +RollsTextOnCommand=shadowlength,0; +RollsTextOffCommand=linear,0.1;diffusealpha,0; +RollsLabelX=-34+64*1.5 +RollsLabelY=16*0 +RollsLabelOnCommand=halign,1 +RollsLabelOffCommand=linear,0.1;diffusealpha,0; + +# lifts were added in sm-ssc. (hiding them for now though, since SM4 doesn't have 'em.) +LiftsTextX=-18+64*1.5 +LiftsTextY=16*0 +LiftsTextOnCommand=shadowlength,0;visible,false +LiftsTextOffCommand=linear,0.1;diffusealpha,0; +LiftsLabelX=-34+64*1.5 +LiftsLabelY=16*0 +LiftsLabelOnCommand=halign,1;visible,false +LiftsLabelOffCommand=linear,0.1;diffusealpha,0; + +MachineHighScoreTextX=170 +MachineHighScoreTextY=16*-1 +MachineHighScoreTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); +MachineHighScoreTextOffCommand=linear,0.1;diffusealpha,0; +MachineHighScoreLabelX= +MachineHighScoreLabelY= +MachineHighScoreLabelOnCommand=visible,false; + +MachineHighNameTextX=120 +MachineHighNameTextY=16*-1 +MachineHighNameTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); +MachineHighNameTextOffCommand=linear,0.1;diffusealpha,0; +MachineHighNameLabelX= +MachineHighNameLabelY= +MachineHighNameLabelOnCommand=visible,false; +MachineHighNameLabelOffCommand= + +ProfileHighScoreTextX=145 +ProfileHighScoreTextY=16*0 +ProfileHighScoreTextOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");strokecolor,color("#77777744");diffusebottomedge,color("#bbbbbb"); +ProfileHighScoreTextOffCommand= +ProfileHighScoreLabelX= +ProfileHighScoreLabelY= +ProfileHighScoreLabelOnCommand=visible,false; +ProfileHighScoreLabelOffCommand= + +[ScreenSandbox] +Class="ScreenSandbox" +Fallback="Screen" + +[PlayerSyncMachine] +Fallback="Player" +ComboOnCommand=visible,false + +[Profile] +ShowCoinData=true +UnlockAuthString= + +[NoteField] +ShowBoard=false +ShowBeatBars=false +FadeBeforeTargetsPercent=0 +BarMeasureAlpha=1 +Bar4thAlpha=1 +Bar8thAlpha=1 +Bar16thAlpha=1 +RoutineNoteSkinP1=default +RoutineNoteSkinP2=default + +[ArrowEffects] +FrameWidthEffectsPixelsPerSecond=400 +FrameWidthEffectsMinMultiplier=0.5 +FrameWidthEffectsMaxMultiplier=1.2 +FrameWidthLockEffectsToOverlapping=false +FrameWidthLockEffectsTweenPixels=25 +ArrowSpacing=64 + +[SoundEffectControl] +LockToHold=false + +[SoundEffectControl_Off] +Fallback="SoundEffectControl" +SoundProperty="" +PropertyMin=1.0 +PropertyCenter=1.0 +PropertyMax=1.0 + +[SoundEffectControl_Speed] +Fallback="SoundEffectControl" +SoundProperty="Speed" +PropertyMin=4/8 +PropertyCenter=1.0 +PropertyMax=16/8 + +[SoundEffectControl_Pitch] +Fallback="SoundEffectControl" +SoundProperty="Pitch" +PropertyMin=7/8 +PropertyCenter=1.0 +PropertyMax=9/8 + +[StepsDisplayList] +ItemsSpacingY=20 +NumShownItems=5 +CapitalizeDifficultyNames=1 +CursorP1OnCommand= +CursorP1OffCommand= +CursorP1TweenOnCommand=linear,0.5;diffusealpha,1 +CursorP1ChangeCommand=finishtweening;decelerate,0.15 +CursorP2OnCommand= +CursorP2OffCommand= +CursorP2TweenOnCommand=linear,0.5;diffusealpha,1 +CursorP2ChangeCommand=finishtweening;decelerate,0.15 +RowOnCommand= +RowOffCommand= +MoveCommand=finishtweening;linear,0.3 +CursorP1ShowCommand=sleep,.3;linear,.3;diffusealpha,1 +CursorP2ShowCommand=sleep,.3;linear,.3;diffusealpha,1 +CursorP1HideCommand=linear,.3;diffusealpha,0 +CursorP2HideCommand=linear,.3;diffusealpha,0 + +[StreamDisplay] +; a simple bar life meter: +; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end +# this was moved to a file in scripts +PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + local zoomed_width=28; \ + local zoomed_height=8; \ + local spacing_x=11.3; \ + self:zoomtoheight(zoomed_height); \ + self:x((itemIndex-(numItems/2))*spacing_x); \ + local zoomed_width=0; \ + if (itemIndex % 2) == 0 then \ + self:zoomtowidth(24); \ + self:rotationz(90); \ + else \ + self:zoomtowidth(31); \ + self:rotationz(-58); \ + end; \ +end +TextureCoordScaleX=10 +NumPills=20 +# if these metrics aren't used, nuke 'em +UseThreePartMethod=false +ThreePartWidth=128 +AlwaysBounceNormalBar=false + +[StreamDisplayExtra] +Fallback="StreamDisplay" + +[ScoreDisplayNormal] +FrameX=0 +FrameY=0 +TextX=0 +TextY=0 +TextOnCommand=shadowlength,0; +TextLoadCommand=%function(self,param) self:diffuse(PlayerScoreColor(param.PlayerState:GetPlayerNumber())); end + +[RollingNumbers] +TextFormat="%09.0f" +ApproachSeconds=0.2 +Commify=true +LeadingZeroMultiplyColor=color("#777777FF") + +[RollingNumbersEvaluation] +Fallback="RollingNumbers" +ApproachSeconds=2 + +[RollingNumbersJudgment] +TextFormat="%04.0f" +ApproachSeconds=0.2 +Commify=false +Fallback="RollingNumbers" +ApproachSeconds=1 + +[GraphDisplay] +BodyWidth=140 +BodyHeight=38 + +[ComboGraph] +BodyWidth=140 + +[CustomScoring] +ComboAboveThresholdAddsToScoreBonus=0 +ComboScoreBonusThreshold=50 +ComboScoreBonusValue=1000 +# this was removed in SM4 +ComboMultiplier=0.0 + +DoubleNoteScoreMultiplier=1.0 +TripleNoteScoreMultiplier=1.0 +QuadOrHigherNoteScoreMultiplier=1.0 + +PointsW1=1000 +PointsW2=1000 +PointsW3=500 +PointsW4=100 +PointsW5=-200 +PointsMiss=-500 +PointsHitMine=-500 +PointsCheckpointHit=1000 +PointsCheckpointMiss=-200 +PointsNone=0 +PointsHoldHeld=1000 +PointsHoldLetGo=-500 + +[CustomDifficulty] +#See pump theme for an example +Names="" + +[ScreenOptionsEdit] +Class="ScreenOptionsMaster" +Fallback="ScreenOptionsSimple" +; This NextScreen is only used for the "exit" choice. +NextScreen=ScreenTitleBranch() +PrevScreen=ScreenTitleBranch() +LineNames="1,2,3,4,5,6" +Line1="gamecommand;screen,ScreenEditMenu;name,Edit Songs/Steps" +Line2="gamecommand;screen,ScreenOptionsExportPackage;name,Export Packages" +Line3="gamecommand;screen,ScreenOptionsManageCourses;name,Edit Courses" +Line4="gamecommand;screen,ScreenServiceActionCopyEditsMachineToMemoryCard;name,Transfer Edits to USB" +Line5="gamecommand;screen,ScreenOptionsGraphicsSound;name,Transfer Edits from USB" +Line6="gamecommand;screen,ScreenOptionsAdvanced;name,Clear USB edits" + +[ScreenOptionsExportPackage] +Class="ScreenOptionsExportPackage" +Fallback="ScreenOptionsSimple" +PrevScreen="ScreenOptionsEdit" +NextScreen="ScreenOptionsEdit" + +[ScreenOptionsEditChild] +Fallback="ScreenOptionsServiceChild" +PrevScreen="ScreenOptionsEdit" +NextScreen="ScreenOptionsEdit" + +[ScreenServiceAction] +Class="ScreenServiceAction" +Fallback="ScreenOptionsEditChild" + +[ScreenServiceActionCopyEditsMachineToMemoryCard] +Fallback="ScreenServiceAction" +Actions="CopyEditsMachineToMemoryCard" + +[ScreenServiceActionCopyEditsMemoryCardToMachine] +Fallback="ScreenServiceAction" +Actions="CopyEditsMemoryCardToMachine" diff --git a/Themes/_portKit-sm4/readme.txt b/Themes/_portKit-sm4/readme.txt index 924d9fc9dd..6768737b51 100644 --- a/Themes/_portKit-sm4/readme.txt +++ b/Themes/_portKit-sm4/readme.txt @@ -1,35 +1,35 @@ -PortKit: StepMania 4 --------------------------------------------------------------------------------- -[What is a PortKit?] -PortKits are designed to help facilitate rapid porting of themes from one -version of StepMania to another. - -[How to use a PortKit/ThemeKit] -In the metrics.ini file for the theme, you'll need to add (or change) the lines -between the underscores: -___________________________ -[Global] -FallbackTheme=_portKit-xxx -___________________________ -where "xxx" represents the PortKit you're using. -If the theme you're working with has this set already, you should perform the -edit in the theme that FallbackTheme is pointing to, unless it is _fallback or -default. (Please don't edit the sm-ssc fallback and default themes.) - -[What about this PortKit in particular?] -PortKit: StepMania 4 replicates the default StepMania 4 theme on top of -sm-ssc's _fallback. In addition to the metrics (mainly taken wholesale from -the default SM4 theme with IsBaseTheme set to 0), there are a few other things -added in: - -* BGAnimations folder - _missing isn't in the fallback theme currently, plus some themes rely on the - various frame scripts that live there. -* Graphics folder - Some themes rely on _frames 1d. -* Scripts folder - Since sm-ssc uses a different branch system, the old one is provided - here for compatibility. -* Sounds folder - No one should ever have to deal with missing sounds when importing a SM4 +PortKit: StepMania 4 +-------------------------------------------------------------------------------- +[What is a PortKit?] +PortKits are designed to help facilitate rapid porting of themes from one +version of StepMania to another. + +[How to use a PortKit/ThemeKit] +In the metrics.ini file for the theme, you'll need to add (or change) the lines +between the underscores: +___________________________ +[Global] +FallbackTheme=_portKit-xxx +___________________________ +where "xxx" represents the PortKit you're using. +If the theme you're working with has this set already, you should perform the +edit in the theme that FallbackTheme is pointing to, unless it is _fallback or +default. (Please don't edit the sm-ssc fallback and default themes.) + +[What about this PortKit in particular?] +PortKit: StepMania 4 replicates the default StepMania 4 theme on top of +sm-ssc's _fallback. In addition to the metrics (mainly taken wholesale from +the default SM4 theme with IsBaseTheme set to 0), there are a few other things +added in: + +* BGAnimations folder + _missing isn't in the fallback theme currently, plus some themes rely on the + various frame scripts that live there. +* Graphics folder + Some themes rely on _frames 1d. +* Scripts folder + Since sm-ssc uses a different branch system, the old one is provided + here for compatibility. +* Sounds folder + No one should ever have to deal with missing sounds when importing a SM4 theme. Ever. \ No newline at end of file diff --git a/Themes/default-dev-midi/BGAnimations/ScreenGameplay underlay/default.lua b/Themes/default-dev-midi/BGAnimations/ScreenGameplay underlay/default.lua index 1fa7919e8c..362e5013a2 100644 --- a/Themes/default-dev-midi/BGAnimations/ScreenGameplay underlay/default.lua +++ b/Themes/default-dev-midi/BGAnimations/ScreenGameplay underlay/default.lua @@ -1,512 +1,512 @@ -local t = Def.ActorFrame{} - -local newBPS; -local oldBPS; - - --- DECORATIONS //////////////////////// - --- Left Hex Corner Decoration -t[#t+1] = LoadActor("decoration_corner") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1)); - OnCommand=cmd(horizalign,left;x,SCREEN_LEFT;vertalign,top;y,SCREEN_TOP;zoomy,0.4;zoomx,0.6;diffusealpha,0.3;blend,Blend.Add); -}; - --- Right Hex Corner Decoration -t[#t+1] = LoadActor("decoration_corner") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2)); - OnCommand=cmd(horizalign,left;x,SCREEN_RIGHT;vertalign,top;y,SCREEN_TOP;zoomy,0.4;;zoomx,-0.6;diffusealpha,0.3;blend,Blend.Add); -}; - - --- WAVY LINE (thanks AJ) //////////////////////// - - ---P1 -t[#t+1] = LoadActor("hot_lores") .. { - OnCommand=cmd(diffusealpha,0;visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;texcoordvelocity,0.1,0;queuecommand,"Begin"); - BeginCommand=function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - local move = GAMESTATE:GetSongBPS()/2 - if GAMESTATE:GetSongFreeze() then - move = 0; - end - self:texcoordvelocity(move,0); - self:sleep(0.001); - self:queuecommand("Begin"); - end; - end; - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_1 then - local lifeP1=params.LifeMeter:GetLife(); - if lifeP1>=THEME:GetMetric("LifeMeterBar", "HotValue") then - self:diffusealpha(0.5); - else - self:diffusealpha(0); - end; - end; - end; -}; - ---P2 -t[#t+1] = LoadActor("hot_lores") .. { - OnCommand=cmd(diffusealpha,0;visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,left;x,SCREEN_RIGHT-18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,(SCREEN_WIDTH/2-26)*-1;texcoordvelocity,0.1,0;queuecommand,"Begin"); - BeginCommand=function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - local move = GAMESTATE:GetSongBPS()/2 - if GAMESTATE:GetSongFreeze() then - move = 0; - end - self:texcoordvelocity(move,0); - self:sleep(0.001); - self:queuecommand("Begin"); - end; - end; - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_2 then - local lifeP2=params.LifeMeter:GetLife(); - if lifeP2>=THEME:GetMetric("LifeMeterBar", "HotValue") then - self:diffusealpha(0.5); - else - self:diffusealpha(0); - end; - end; - end; -}; - ---Double ---customtexturerect,0,0,[PixelsToCoverWidth]/[ImageWidth],[PixelsToCoverHeight]/[ImageHeight] ---I said that I was gonna write it down. thx midi - -t[#t+1] = LoadActor("hot_lores") .. { - OnCommand=cmd(diffusealpha,0;horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH-36;texcoordvelocity,0.1,0;customtexturerect,0,0,600/(SCREEN_WIDTH-36),1;queuecommand,"Begin"); - BeginCommand=function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - local move = GAMESTATE:GetSongBPS()/2 - if GAMESTATE:GetSongFreeze() then - move = 0; - end - self:texcoordvelocity(move,0); - self:sleep(0.001); - self:queuecommand("Begin"); - else - self:visible(false); - end; - end; - LifeChangedMessageCommand=function(self,params) - local life=params.LifeMeter:GetLife(); - if life>=THEME:GetMetric("LifeMeterBar", "HotValue") then - self:diffusealpha(0.5); - else - self:diffusealpha(0); - end; - end; -}; - - --- DANGER //////////////////////// - - ---DANGER P1 single -t[#t+1] = LoadActor("danger") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;zoomy,0.5); - OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_1 then - local lifeP1 = params.LifeMeter:GetLife(); - if lifeP1 <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - self:visible(true); - end; - else - self:visible(false); - end; - end; -end; - -}; - ---DANGER P2 single -t[#t+1] = LoadActor("danger") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,right;x,SCREEN_RIGHT-18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;zoomy,0.5); - OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_2 then - local lifeP2 = params.LifeMeter:GetLife(); - if lifeP2 <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - self:visible(true); - end; - else - self:visible(false); - end; - end; - end; -}; - ---DANGER double -t[#t+1] = LoadActor("danger") .. { - InitCommand=cmd(visible,false;horizalign,center;x,SCREEN_CENTER_X;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH-36;zoomy,0.5); - OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); - LifeChangedMessageCommand=function(self,params) - local life = params.LifeMeter:GetLife(); - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - if life <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - - - --- METERS //////////////////////// - - - - - ----basemeter masked P1 -t[#t+1] = LoadActor("basemeter") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;valign,0.5;y,SCREEN_TOP+41;zoomy,0.5;blend,Blend.Add); - OnCommand=cmd(bounce;effectmagnitude,-40,0,0;effectclock,"bgm";effecttiming,2,0,0,0;); - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_1 then - local style = GAMESTATE:GetCurrentStyle(); - local lifeP1 = params.LifeMeter:GetLife(); - if GAMESTATE:IsHumanPlayer(PLAYER_1)==true then - if lifeP1==0 then - self:visible(false); - else - - if lifeP1==1 then - self:effectmagnitude(0,0,0); - else - self:effectmagnitude(-40,0,0); - end; - - self:visible(true); - end - end - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:zoomtowidth((SCREEN_WIDTH-40)*lifeP1+5); - else - self:zoomtowidth((SCREEN_WIDTH/2-26)*lifeP1); - end; - - end; - end; - -}; - - - - - - - ----basemeter masked P2 -t[#t+1] = LoadActor("basemeter") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,right;x,SCREEN_RIGHT+18;valign,0.5;y,SCREEN_TOP+41;zoomy,0.5;blend,Blend.Add;queuecommand,"Set"); - OnCommand=cmd(bob;effectmagnitude,40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); - SetCommand=function(self,params) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:effectmagnitude(-40,0,0); - self:horizalign(left); - self:x(SCREEN_LEFT+18); - end; - end; - - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_2 then - local style = GAMESTATE:GetCurrentStyle(); - local lifeP2 = params.LifeMeter:GetLife(); - if GAMESTATE:IsHumanPlayer(PLAYER_2)==true then - if lifeP2==0 then - self:visible(false); - else - - if lifeP2==1 then - self:effectmagnitude(0,0,0); - else - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:effectmagnitude(-40,0,0); - else - self:effectmagnitude(40,0,0); - end - end; - - self:visible(true); - end - end - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:zoomtowidth((SCREEN_WIDTH-40)*lifeP2); - else - self:zoomtowidth(((SCREEN_WIDTH/2-26)*lifeP2)+40); - end; - - end; - end; - -}; - - - - --- FRAMES & TIPS //////////////////////// - - --- Left Corner -t[#t+1] = LoadActor("mask") .. { - OnCommand=cmd(horizalign,right;x,SCREEN_LEFT+130;vertalign,top;y,SCREEN_TOP+12;zoom,0.45;queuecommand,"Set"); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(true); - else - if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - --- Right Corner -t[#t+1] = LoadActor("mask") .. { - OnCommand=cmd(horizalign,right;x,SCREEN_RIGHT-130;vertalign,top;y,SCREEN_TOP+12;zoomx,-0.45;zoomy,0.45;queuecommand,"Set"); -SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(true); - else - if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - - --- Left Corner -t[#t+1] = LoadActor("corner") .. { - OnCommand=cmd(horizalign,left;x,SCREEN_LEFT+15;vertalign,top;y,SCREEN_TOP+16;zoom,0.75;queuecommand,"Set"); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(true); - else - if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - --- Right Corner -t[#t+1] = LoadActor("corner") .. { - OnCommand=cmd(horizalign,left;x,SCREEN_RIGHT-15;vertalign,top;y,SCREEN_TOP+16;zoomx,-0.75;zoomy,0.75;queuecommand,"Set"); -SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(true); - else - if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - --- Center Corner Left -t[#t+1] = LoadActor("center") .. { - OnCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+5;vertalign,top;y,SCREEN_TOP+16;zoomx,-0.75;zoomy,0.75;queuecommand,"Set"); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - --- Center Corner Right -t[#t+1] = LoadActor("center") .. { - OnCommand=cmd(horizalign,left;x,SCREEN_CENTER_X-5;vertalign,top;y,SCREEN_TOP+16;zoom,0.75;queuecommand,"Set"); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false); - else - if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then - self:visible(true); - else - self:visible(false); - end; - end; - end; -}; - --- Center part 1 -t[#t+1] = LoadActor("frame") .. { - OnCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+52.5;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-85;zoomy,0.75;queuecommand,"Set";); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:zoomtowidth(SCREEN_WIDTH-105); - self:visible(true) - else - if GAMESTATE:IsHumanPlayer(PLAYER_1) == false then - self:visible(false) - else - self:visible(true) - end - end; - end; -}; - --- Center part 2 -t[#t+1] = LoadActor("frame") .. { - OnCommand=cmd(horizalign,right;x,SCREEN_RIGHT-52.5;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-85;zoomy,0.75;queuecommand,"Set";); - SetCommand = function(self) - local style = GAMESTATE:GetCurrentStyle(); - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:visible(false) - else - if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then - self:visible(true) - else - self:visible(false) - end; - end; - end; -}; - - - ----tip P1 -t[#t+1] = LoadActor("tip") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);valign,0.5;y,SCREEN_TOP+41;zoom,0.5;blend,Blend.Add;queuecommand,"Set"); - --OnCommand=cmd(bob;effectmagnitude,-40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_1 then - local style = GAMESTATE:GetCurrentStyle(); - local lifeP1 = params.LifeMeter:GetLife(); - if GAMESTATE:IsHumanPlayer(PLAYER_1)==true then - if lifeP1==0 then - self:visible(false); - else - self:visible(true); - end - end - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:x((SCREEN_WIDTH-40)*lifeP1+20); - else - self:x((SCREEN_WIDTH/2-26)*lifeP1+20); - end; - - end; - end; - -}; - - - ----tip P2 -t[#t+1] = LoadActor("tip") .. { - InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);valign,0.5;y,SCREEN_TOP+41;zoom,0.5;blend,Blend.Add;); - --OnCommand=cmd(bob;effectmagnitude,40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); - LifeChangedMessageCommand=function(self,params) - if params.Player == PLAYER_2 then - local style = GAMESTATE:GetCurrentStyle(); - local lifeP2 = params.LifeMeter:GetLife(); - local fullstate; - if GAMESTATE:IsHumanPlayer(PLAYER_2)==true then - if lifeP2==0 then - self:visible(false); - else - self:visible(true); - end - end - if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then - self:x((SCREEN_WIDTH-40)*lifeP2+20); - else - self:x(SCREEN_RIGHT-((SCREEN_WIDTH/2-26)*lifeP2)-20); - end; - - end; - end; - -}; - --- NAMES //////////////////////// - ---P1 NAME -t[#t+1] = LoadFont("Common Normal") .. { - InitCommand=cmd(horizalign,left;x,SCREEN_LEFT+30;y,SCREEN_TOP+15;zoom,0.4;shadowlength,1;uppercase,true); - BeginCommand=function(self) - local profile = PROFILEMAN:GetProfile(PLAYER_1); - local name = profile:GetDisplayName(); - - if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then - if name=="" then - self:settext("Player 1"); - else - self:settext( name ); - end - end - - end; - - }; - ---P2 NAME -t[#t+1] = LoadFont("Common Normal") .. { - InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT-30;y,SCREEN_TOP+15;zoom,0.4;shadowlength,1;uppercase,true); - BeginCommand=function(self) - local profile = PROFILEMAN:GetProfile(PLAYER_2); - local name = profile:GetDisplayName(); - - if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then - if name=="" then - self:settext("Player 2"); - else - self:settext( name ); - end - end - end; - - }; - - - +local t = Def.ActorFrame{} + +local newBPS; +local oldBPS; + + +-- DECORATIONS //////////////////////// + +-- Left Hex Corner Decoration +t[#t+1] = LoadActor("decoration_corner") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1)); + OnCommand=cmd(horizalign,left;x,SCREEN_LEFT;vertalign,top;y,SCREEN_TOP;zoomy,0.4;zoomx,0.6;diffusealpha,0.3;blend,Blend.Add); +}; + +-- Right Hex Corner Decoration +t[#t+1] = LoadActor("decoration_corner") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2)); + OnCommand=cmd(horizalign,left;x,SCREEN_RIGHT;vertalign,top;y,SCREEN_TOP;zoomy,0.4;;zoomx,-0.6;diffusealpha,0.3;blend,Blend.Add); +}; + + +-- WAVY LINE (thanks AJ) //////////////////////// + + +--P1 +t[#t+1] = LoadActor("hot_lores") .. { + OnCommand=cmd(diffusealpha,0;visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;texcoordvelocity,0.1,0;queuecommand,"Begin"); + BeginCommand=function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + local move = GAMESTATE:GetSongBPS()/2 + if GAMESTATE:GetSongFreeze() then + move = 0; + end + self:texcoordvelocity(move,0); + self:sleep(0.001); + self:queuecommand("Begin"); + end; + end; + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_1 then + local lifeP1=params.LifeMeter:GetLife(); + if lifeP1>=THEME:GetMetric("LifeMeterBar", "HotValue") then + self:diffusealpha(0.5); + else + self:diffusealpha(0); + end; + end; + end; +}; + +--P2 +t[#t+1] = LoadActor("hot_lores") .. { + OnCommand=cmd(diffusealpha,0;visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,left;x,SCREEN_RIGHT-18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,(SCREEN_WIDTH/2-26)*-1;texcoordvelocity,0.1,0;queuecommand,"Begin"); + BeginCommand=function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + local move = GAMESTATE:GetSongBPS()/2 + if GAMESTATE:GetSongFreeze() then + move = 0; + end + self:texcoordvelocity(move,0); + self:sleep(0.001); + self:queuecommand("Begin"); + end; + end; + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_2 then + local lifeP2=params.LifeMeter:GetLife(); + if lifeP2>=THEME:GetMetric("LifeMeterBar", "HotValue") then + self:diffusealpha(0.5); + else + self:diffusealpha(0); + end; + end; + end; +}; + +--Double +--customtexturerect,0,0,[PixelsToCoverWidth]/[ImageWidth],[PixelsToCoverHeight]/[ImageHeight] +--I said that I was gonna write it down. thx midi + +t[#t+1] = LoadActor("hot_lores") .. { + OnCommand=cmd(diffusealpha,0;horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH-36;texcoordvelocity,0.1,0;customtexturerect,0,0,600/(SCREEN_WIDTH-36),1;queuecommand,"Begin"); + BeginCommand=function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + local move = GAMESTATE:GetSongBPS()/2 + if GAMESTATE:GetSongFreeze() then + move = 0; + end + self:texcoordvelocity(move,0); + self:sleep(0.001); + self:queuecommand("Begin"); + else + self:visible(false); + end; + end; + LifeChangedMessageCommand=function(self,params) + local life=params.LifeMeter:GetLife(); + if life>=THEME:GetMetric("LifeMeterBar", "HotValue") then + self:diffusealpha(0.5); + else + self:diffusealpha(0); + end; + end; +}; + + +-- DANGER //////////////////////// + + +--DANGER P1 single +t[#t+1] = LoadActor("danger") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;zoomy,0.5); + OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_1 then + local lifeP1 = params.LifeMeter:GetLife(); + if lifeP1 <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + self:visible(true); + end; + else + self:visible(false); + end; + end; +end; + +}; + +--DANGER P2 single +t[#t+1] = LoadActor("danger") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,right;x,SCREEN_RIGHT-18;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-26;zoomy,0.5); + OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_2 then + local lifeP2 = params.LifeMeter:GetLife(); + if lifeP2 <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + self:visible(true); + end; + else + self:visible(false); + end; + end; + end; +}; + +--DANGER double +t[#t+1] = LoadActor("danger") .. { + InitCommand=cmd(visible,false;horizalign,center;x,SCREEN_CENTER_X;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH-36;zoomy,0.5); + OnCommand=cmd(effectclock,"bgm";diffusealpha,1;linear,0.2;diffusealpha,0.25;linear,0.2;diffusealpha,1;queuecommand,"On"); + LifeChangedMessageCommand=function(self,params) + local life = params.LifeMeter:GetLife(); + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + if life <= THEME:GetMetric("LifeMeterBar", "DangerThreshold") then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + + + +-- METERS //////////////////////// + + + + + +---basemeter masked P1 +t[#t+1] = LoadActor("basemeter") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+18;valign,0.5;y,SCREEN_TOP+41;zoomy,0.5;blend,Blend.Add); + OnCommand=cmd(bounce;effectmagnitude,-40,0,0;effectclock,"bgm";effecttiming,2,0,0,0;); + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_1 then + local style = GAMESTATE:GetCurrentStyle(); + local lifeP1 = params.LifeMeter:GetLife(); + if GAMESTATE:IsHumanPlayer(PLAYER_1)==true then + if lifeP1==0 then + self:visible(false); + else + + if lifeP1==1 then + self:effectmagnitude(0,0,0); + else + self:effectmagnitude(-40,0,0); + end; + + self:visible(true); + end + end + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:zoomtowidth((SCREEN_WIDTH-40)*lifeP1+5); + else + self:zoomtowidth((SCREEN_WIDTH/2-26)*lifeP1); + end; + + end; + end; + +}; + + + + + + + +---basemeter masked P2 +t[#t+1] = LoadActor("basemeter") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);horizalign,right;x,SCREEN_RIGHT+18;valign,0.5;y,SCREEN_TOP+41;zoomy,0.5;blend,Blend.Add;queuecommand,"Set"); + OnCommand=cmd(bob;effectmagnitude,40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); + SetCommand=function(self,params) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:effectmagnitude(-40,0,0); + self:horizalign(left); + self:x(SCREEN_LEFT+18); + end; + end; + + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_2 then + local style = GAMESTATE:GetCurrentStyle(); + local lifeP2 = params.LifeMeter:GetLife(); + if GAMESTATE:IsHumanPlayer(PLAYER_2)==true then + if lifeP2==0 then + self:visible(false); + else + + if lifeP2==1 then + self:effectmagnitude(0,0,0); + else + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:effectmagnitude(-40,0,0); + else + self:effectmagnitude(40,0,0); + end + end; + + self:visible(true); + end + end + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:zoomtowidth((SCREEN_WIDTH-40)*lifeP2); + else + self:zoomtowidth(((SCREEN_WIDTH/2-26)*lifeP2)+40); + end; + + end; + end; + +}; + + + + +-- FRAMES & TIPS //////////////////////// + + +-- Left Corner +t[#t+1] = LoadActor("mask") .. { + OnCommand=cmd(horizalign,right;x,SCREEN_LEFT+130;vertalign,top;y,SCREEN_TOP+12;zoom,0.45;queuecommand,"Set"); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(true); + else + if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + +-- Right Corner +t[#t+1] = LoadActor("mask") .. { + OnCommand=cmd(horizalign,right;x,SCREEN_RIGHT-130;vertalign,top;y,SCREEN_TOP+12;zoomx,-0.45;zoomy,0.45;queuecommand,"Set"); +SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(true); + else + if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + + +-- Left Corner +t[#t+1] = LoadActor("corner") .. { + OnCommand=cmd(horizalign,left;x,SCREEN_LEFT+15;vertalign,top;y,SCREEN_TOP+16;zoom,0.75;queuecommand,"Set"); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(true); + else + if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + +-- Right Corner +t[#t+1] = LoadActor("corner") .. { + OnCommand=cmd(horizalign,left;x,SCREEN_RIGHT-15;vertalign,top;y,SCREEN_TOP+16;zoomx,-0.75;zoomy,0.75;queuecommand,"Set"); +SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(true); + else + if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + +-- Center Corner Left +t[#t+1] = LoadActor("center") .. { + OnCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+5;vertalign,top;y,SCREEN_TOP+16;zoomx,-0.75;zoomy,0.75;queuecommand,"Set"); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + +-- Center Corner Right +t[#t+1] = LoadActor("center") .. { + OnCommand=cmd(horizalign,left;x,SCREEN_CENTER_X-5;vertalign,top;y,SCREEN_TOP+16;zoom,0.75;queuecommand,"Set"); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false); + else + if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then + self:visible(true); + else + self:visible(false); + end; + end; + end; +}; + +-- Center part 1 +t[#t+1] = LoadActor("frame") .. { + OnCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);horizalign,left;x,SCREEN_LEFT+52.5;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-85;zoomy,0.75;queuecommand,"Set";); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:zoomtowidth(SCREEN_WIDTH-105); + self:visible(true) + else + if GAMESTATE:IsHumanPlayer(PLAYER_1) == false then + self:visible(false) + else + self:visible(true) + end + end; + end; +}; + +-- Center part 2 +t[#t+1] = LoadActor("frame") .. { + OnCommand=cmd(horizalign,right;x,SCREEN_RIGHT-52.5;vertalign,top;y,SCREEN_TOP+16;zoomtowidth,SCREEN_WIDTH/2-85;zoomy,0.75;queuecommand,"Set";); + SetCommand = function(self) + local style = GAMESTATE:GetCurrentStyle(); + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:visible(false) + else + if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then + self:visible(true) + else + self:visible(false) + end; + end; + end; +}; + + + +---tip P1 +t[#t+1] = LoadActor("tip") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_1);valign,0.5;y,SCREEN_TOP+41;zoom,0.5;blend,Blend.Add;queuecommand,"Set"); + --OnCommand=cmd(bob;effectmagnitude,-40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_1 then + local style = GAMESTATE:GetCurrentStyle(); + local lifeP1 = params.LifeMeter:GetLife(); + if GAMESTATE:IsHumanPlayer(PLAYER_1)==true then + if lifeP1==0 then + self:visible(false); + else + self:visible(true); + end + end + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:x((SCREEN_WIDTH-40)*lifeP1+20); + else + self:x((SCREEN_WIDTH/2-26)*lifeP1+20); + end; + + end; + end; + +}; + + + +---tip P2 +t[#t+1] = LoadActor("tip") .. { + InitCommand=cmd(visible,GAMESTATE:IsHumanPlayer(PLAYER_2);valign,0.5;y,SCREEN_TOP+41;zoom,0.5;blend,Blend.Add;); + --OnCommand=cmd(bob;effectmagnitude,40,0,0;effectclock,"bgm";effecttiming,1,0,0,0;); + LifeChangedMessageCommand=function(self,params) + if params.Player == PLAYER_2 then + local style = GAMESTATE:GetCurrentStyle(); + local lifeP2 = params.LifeMeter:GetLife(); + local fullstate; + if GAMESTATE:IsHumanPlayer(PLAYER_2)==true then + if lifeP2==0 then + self:visible(false); + else + self:visible(true); + end + end + if style:GetStyleType() == "StyleType_OnePlayerTwoSides" then + self:x((SCREEN_WIDTH-40)*lifeP2+20); + else + self:x(SCREEN_RIGHT-((SCREEN_WIDTH/2-26)*lifeP2)-20); + end; + + end; + end; + +}; + +-- NAMES //////////////////////// + +--P1 NAME +t[#t+1] = LoadFont("Common Normal") .. { + InitCommand=cmd(horizalign,left;x,SCREEN_LEFT+30;y,SCREEN_TOP+15;zoom,0.4;shadowlength,1;uppercase,true); + BeginCommand=function(self) + local profile = PROFILEMAN:GetProfile(PLAYER_1); + local name = profile:GetDisplayName(); + + if GAMESTATE:IsHumanPlayer(PLAYER_1) == true then + if name=="" then + self:settext("Player 1"); + else + self:settext( name ); + end + end + + end; + + }; + +--P2 NAME +t[#t+1] = LoadFont("Common Normal") .. { + InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT-30;y,SCREEN_TOP+15;zoom,0.4;shadowlength,1;uppercase,true); + BeginCommand=function(self) + local profile = PROFILEMAN:GetProfile(PLAYER_2); + local name = profile:GetDisplayName(); + + if GAMESTATE:IsHumanPlayer(PLAYER_2) == true then + if name=="" then + self:settext("Player 2"); + else + self:settext( name ); + end + end + end; + + }; + + + return t \ No newline at end of file diff --git a/Themes/default-dev-midi/ThemeInfo.ini b/Themes/default-dev-midi/ThemeInfo.ini index 56c62b42cd..856c1da7ee 100644 --- a/Themes/default-dev-midi/ThemeInfo.ini +++ b/Themes/default-dev-midi/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=Midi Dev Theme +[ThemeInfo] +DisplayName=Midi Dev Theme Author=Midiman \ No newline at end of file diff --git a/Themes/default-dev-midi/metrics.ini b/Themes/default-dev-midi/metrics.ini index 87e92e1686..e2eab4c818 100644 --- a/Themes/default-dev-midi/metrics.ini +++ b/Themes/default-dev-midi/metrics.ini @@ -1,5 +1,5 @@ -[Global] -FallbackTheme=default -[ScreenGameplay] -LifeP1OnCommand=visible,false +[Global] +FallbackTheme=default +[ScreenGameplay] +LifeP1OnCommand=visible,false LifeP2OnCommand=visible,false \ No newline at end of file diff --git a/Themes/default/BGAnimations/Screen cancel/default.lua b/Themes/default/BGAnimations/Screen cancel/default.lua index e5c61720a9..542f71f863 100644 --- a/Themes/default/BGAnimations/Screen cancel/default.lua +++ b/Themes/default/BGAnimations/Screen cancel/default.lua @@ -1,9 +1,9 @@ -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0.5");sleep,0.15;diffusealpha,1;sleep,0.15); - }; - LoadActor(THEME:GetPathS("_Screen","cancel")) .. { - StartTransitioningCommand=cmd(play); - }; +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0.5");sleep,0.15;diffusealpha,1;sleep,0.15); + }; + LoadActor(THEME:GetPathS("_Screen","cancel")) .. { + StartTransitioningCommand=cmd(play); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/Screen in/default.lua b/Themes/default/BGAnimations/Screen in/default.lua index 812bf753ff..6272fd0d2a 100644 --- a/Themes/default/BGAnimations/Screen in/default.lua +++ b/Themes/default/BGAnimations/Screen in/default.lua @@ -1,8 +1,8 @@ -local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenInDelay"); -return Def.ActorFrame { - OnCommand=cmd(sleep,0.15+fSleepTime); - Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,1");sleep,fSleepTime;linear,0.15;diffusealpha,0); - }; +local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenInDelay"); +return Def.ActorFrame { + OnCommand=cmd(sleep,0.15+fSleepTime); + Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");sleep,fSleepTime;linear,0.15;diffusealpha,0); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/Screen out/default.lua b/Themes/default/BGAnimations/Screen out/default.lua index d9bce01fc8..3363ce0a2a 100644 --- a/Themes/default/BGAnimations/Screen out/default.lua +++ b/Themes/default/BGAnimations/Screen out/default.lua @@ -1,8 +1,8 @@ -local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenOutDelay"); -return Def.ActorFrame { - OnCommand=cmd(sleep,0.15+fSleepTime); - Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0");sleep,fSleepTime;linear,0.15;diffusealpha,1); - }; +local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenOutDelay"); +return Def.ActorFrame { + OnCommand=cmd(sleep,0.15+fSleepTime); + Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0");sleep,fSleepTime;linear,0.15;diffusealpha,1); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenDemonstration decorations.lua b/Themes/default/BGAnimations/ScreenDemonstration decorations.lua index bca99f7f6c..65d556611d 100644 --- a/Themes/default/BGAnimations/ScreenDemonstration decorations.lua +++ b/Themes/default/BGAnimations/ScreenDemonstration decorations.lua @@ -1,3 +1,3 @@ -local t = LoadFallbackB(); -t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); +local t = LoadFallbackB(); +t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenDemonstration out.lua b/Themes/default/BGAnimations/ScreenDemonstration out.lua index 3d1cfdd216..0ddcb832c7 100644 --- a/Themes/default/BGAnimations/ScreenDemonstration out.lua +++ b/Themes/default/BGAnimations/ScreenDemonstration out.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("0,0,0,1");cropbottom,1;fadebottom,1); - OnCommand=cmd(decelerate,0.5;cropbottom,0;fadebottom,0); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("0,0,0,1");cropbottom,1;fadebottom,1); + OnCommand=cmd(decelerate,0.5;cropbottom,0;fadebottom,0); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenDemonstration overlay/default.lua b/Themes/default/BGAnimations/ScreenDemonstration overlay/default.lua index 1f3a7c0e9f..0998de7add 100644 --- a/Themes/default/BGAnimations/ScreenDemonstration overlay/default.lua +++ b/Themes/default/BGAnimations/ScreenDemonstration overlay/default.lua @@ -1,43 +1,43 @@ -local t = Def.ActorFrame{ - Def.Quad{ - Name="TopFrame"; - InitCommand=cmd(CenterX;y,SCREEN_TOP;valign,0;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT*0.15;diffuse,color("0,0,0,1");fadebottom,0.5); - }; - - Def.Quad{ - Name="BotFrame"; - InitCommand=cmd(CenterX;y,SCREEN_BOTTOM;valign,1;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT*0.15;diffuse,color("0,0,0,1");fadetop,0.5); - }; - - Def.ActorFrame{ - Name="MiddleSection"; - InitCommand=cmd(CenterX;y,SCREEN_CENTER_Y*1.35); - Def.Quad{ - Name="Frame"; - InitCommand=cmd(zoomto,SCREEN_WIDTH,0;diffuse,color("0.1,0.1,0.1,0.75");fadebottom,0.25;fadetop,0.25;); - OnCommand=cmd(smooth,0.75;zoomtoheight,64;); - }; - LoadFont("Common normal")..{ - Text=Screen.String("Demonstration"); - InitCommand=cmd(diffusealpha,0;strokecolor,color("0,0,0,0.5")); - OnCommand=cmd(smooth,0.75;diffusealpha,1;diffuseshift;effectcolor1,HSV(38,0.45,0.95)); - }; - }; - - LoadFont("Common normal")..{ - Name="SongTitle"; - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_TOP+20;zoom,0.5;shadowlength,1); - BeginCommand=function(self) - local song = GAMESTATE:GetCurrentSong(); - local text = ""; - if song then - text = song:GetDisplayArtist().." - "..song:GetDisplayFullTitle().." [from "..song:GetGroupName().."]"; - end; - self:settext(text); - end; --- OnCommand=cmd(queuecommand,"Scroll"); --- ScrollCommand=cmd(linear,10;x,-SCREEN_WIDTH*2;sleep,1;x,SCREEN_WIDTH*2;queuecommand,"Scroll"); - }; -}; - +local t = Def.ActorFrame{ + Def.Quad{ + Name="TopFrame"; + InitCommand=cmd(CenterX;y,SCREEN_TOP;valign,0;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT*0.15;diffuse,color("0,0,0,1");fadebottom,0.5); + }; + + Def.Quad{ + Name="BotFrame"; + InitCommand=cmd(CenterX;y,SCREEN_BOTTOM;valign,1;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT*0.15;diffuse,color("0,0,0,1");fadetop,0.5); + }; + + Def.ActorFrame{ + Name="MiddleSection"; + InitCommand=cmd(CenterX;y,SCREEN_CENTER_Y*1.35); + Def.Quad{ + Name="Frame"; + InitCommand=cmd(zoomto,SCREEN_WIDTH,0;diffuse,color("0.1,0.1,0.1,0.75");fadebottom,0.25;fadetop,0.25;); + OnCommand=cmd(smooth,0.75;zoomtoheight,64;); + }; + LoadFont("Common normal")..{ + Text=Screen.String("Demonstration"); + InitCommand=cmd(diffusealpha,0;strokecolor,color("0,0,0,0.5")); + OnCommand=cmd(smooth,0.75;diffusealpha,1;diffuseshift;effectcolor1,HSV(38,0.45,0.95)); + }; + }; + + LoadFont("Common normal")..{ + Name="SongTitle"; + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_TOP+20;zoom,0.5;shadowlength,1); + BeginCommand=function(self) + local song = GAMESTATE:GetCurrentSong(); + local text = ""; + if song then + text = song:GetDisplayArtist().." - "..song:GetDisplayFullTitle().." [from "..song:GetGroupName().."]"; + end; + self:settext(text); + end; +-- OnCommand=cmd(queuecommand,"Scroll"); +-- ScrollCommand=cmd(linear,10;x,-SCREEN_WIDTH*2;sleep,1;x,SCREEN_WIDTH*2;queuecommand,"Scroll"); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenEdit background.lua b/Themes/default/BGAnimations/ScreenEdit background.lua index c24f3b6ab5..d61ac30ad5 100644 --- a/Themes/default/BGAnimations/ScreenEdit background.lua +++ b/Themes/default/BGAnimations/ScreenEdit background.lua @@ -1,31 +1,31 @@ -local t = Def.ActorFrame { - InitCommand=cmd(fov,90); -}; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("#ffcb05")); - }; - LoadActor( THEME:GetPathB("ScreenWithMenuElements","background/_bg top") ) .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - }; - Def.Quad{ - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color("0.2,0.2,0.2,0")); - OnCommand=function(self) - local topScreen = SCREENMAN:GetTopScreen() - if topScreen then - local screenName = topScreen:GetName() - if screenName == "ScreenEdit" or screenName == "ScreenPractice" then - self:diffusealpha(0.325) - else - self:diffusealpha(0) - end; - end; - end; - EditorShowMessageCommand=cmd(stoptweening;linear,0.5;diffusealpha,0.75); - EditorHideMessageCommand=cmd(stoptweening;linear,0.5;diffusealpha,0.325); - }; -}; - -return t; +local t = Def.ActorFrame { + InitCommand=cmd(fov,90); +}; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("#ffcb05")); + }; + LoadActor( THEME:GetPathB("ScreenWithMenuElements","background/_bg top") ) .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + }; + Def.Quad{ + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color("0.2,0.2,0.2,0")); + OnCommand=function(self) + local topScreen = SCREENMAN:GetTopScreen() + if topScreen then + local screenName = topScreen:GetName() + if screenName == "ScreenEdit" or screenName == "ScreenPractice" then + self:diffusealpha(0.325) + else + self:diffusealpha(0) + end; + end; + end; + EditorShowMessageCommand=cmd(stoptweening;linear,0.5;diffusealpha,0.75); + EditorHideMessageCommand=cmd(stoptweening;linear,0.5;diffusealpha,0.325); + }; +}; + +return t; diff --git a/Themes/default/BGAnimations/ScreenEvaluation background/default.lua b/Themes/default/BGAnimations/ScreenEvaluation background/default.lua index ec4cf72db5..ac0c710158 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation background/default.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation background/default.lua @@ -1,32 +1,32 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.Sprite { - OnCommand=function(self) - if GAMESTATE:GetCurrentSong() then - self:LoadBackground( GAMESTATE:GetCurrentSong():GetBackgroundPath() ); - self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT ); - (cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self); - else - self:visible(false); - end - end; - }; - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00");diffusealpha,0.45); - }; ---[[ - LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_grid")).. { - InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); - OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Black");diffuseshift;effecttiming,(1/8)*4,0,(7/8)*4,0;effectclock,'beatnooffset'; - effectcolor2,Color("Black");effectcolor1,Colors.Alpha(Color("Black"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480;diffusealpha,0.345); - }; --]] - LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_bg top")) .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); - }; - -}; - +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.Sprite { + OnCommand=function(self) + if GAMESTATE:GetCurrentSong() then + self:LoadBackground( GAMESTATE:GetCurrentSong():GetBackgroundPath() ); + self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT ); + (cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self); + else + self:visible(false); + end + end; + }; + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00");diffusealpha,0.45); + }; +--[[ + LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_grid")).. { + InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); + OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Black");diffuseshift;effecttiming,(1/8)*4,0,(7/8)*4,0;effectclock,'beatnooffset'; + effectcolor2,Color("Black");effectcolor1,Colors.Alpha(Color("Black"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480;diffusealpha,0.345); + }; --]] + LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_bg top")) .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); + }; + +}; + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua b/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua index 83ab0fd632..978be114b1 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua @@ -1,252 +1,252 @@ -local function GraphDisplay( pn ) - local t = Def.ActorFrame { - Def.GraphDisplay { - InitCommand=cmd(Load,"GraphDisplay";); - BeginCommand=function(self) - local ss = SCREENMAN:GetTopScreen():GetStageStats(); - self:Set( ss, ss:GetPlayerStageStats(pn) ); - self:player( pn ); - end - }; - }; - return t; -end - -local function ComboGraph( pn ) - local t = Def.ActorFrame { - Def.ComboGraph { - InitCommand=cmd(Load,"ComboGraph";); - BeginCommand=function(self) - local ss = SCREENMAN:GetTopScreen():GetStageStats(); - self:Set( ss, ss:GetPlayerStageStats(pn) ); - self:player( pn ); - end - }; - }; - return t; -end - -local function PercentScore( pn ) - local t = LoadFont("Common normal")..{ - InitCommand=cmd(zoom,0.625;shadowlength,1;player,pn); - BeginCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - -- todo: color by difficulty - local StepsOrTrail; - if GAMESTATE:IsCourseMode() then - StepsOrTrail = GAMESTATE:GetCurrentTrail(pn) - else - StepsOrTrail = GAMESTATE:GetCurrentSteps(pn) - end; - local st = StepsOrTrail:GetStepsType(); - local diff = StepsOrTrail:GetDifficulty(); - local courseType = GAMESTATE:IsCourseMode() and SongOrCourse:GetCourseType() or nil; - local cd = GetCustomDifficulty(st, diff, courseType); - self:diffuse(CustomDifficultyToColor(cd)); - self:shadowcolor(CustomDifficultyToDarkColor(cd)); - - local pss = STATSMAN:GetPlayedStageStats(1):GetPlayerStageStats(pn); - if pss then - local pct = pss:GetPercentDancePoints(); - if pct == 1 then - self:settext("100%"); - else - self:settext(FormatPercentScore(pct)); - end; - end; - end; - }; - return t; -end - -local t = LoadFallbackB(); - -t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); - -if ShowStandardDecoration("GraphDisplay") then - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - t[#t+1] = StandardDecorationFromTable( "GraphDisplay" .. ToEnumShortString(pn), GraphDisplay(pn) ); - end -end - -if ShowStandardDecoration("ComboGraph") then - for pn in ivalues(GAMESTATE:GetHumanPlayers()) do - t[#t+1] = StandardDecorationFromTable( "ComboGraph" .. ToEnumShortString(pn), ComboGraph(pn) ); - end -end - -if ShowStandardDecoration("StepsDisplay") then - for pn in ivalues(PlayerNumber) do - local t2 = Def.StepsDisplay { - InitCommand=cmd(Load,"StepsDisplayEvaluation",pn;SetFromGameState,pn;); - UpdateNetEvalStatsMessageCommand=function(self,param) - if GAMESTATE:IsPlayerEnabled(pn) then - self:SetFromSteps(param.Steps) - end; - end; - }; - t[#t+1] = StandardDecorationFromTable( "StepsDisplay" .. ToEnumShortString(pn), t2 ); - t[#t+1] = StandardDecorationFromTable( "PercentScore" .. ToEnumShortString(pn), PercentScore(pn) ); - end -end - -for pn in ivalues(PlayerNumber) do - local MetricsName = "MachineRecord" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "MachineRecord"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - }; -end - -for pn in ivalues(PlayerNumber) do - local MetricsName = "PersonalRecord" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "PersonalRecord"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - }; -end - -for pn in ivalues(PlayerNumber) do - local MetricsName = "StageAward" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "StageAward"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - BeginCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local tStats = THEME:GetMetric(Var "LoadingScreen", "Summary") and STATSMAN:GetAccumPlayedStageStats() or STATSMAN:GetCurStageStats(); - tStats = tStats:GetPlayerStageStats(pn); - if tStats:GetStageAward() then - self:settext( THEME:GetString( "StageAward", ToEnumShortString( tStats:GetStageAward() ) ) ); - else - self:settext( "" ); - end - end; - }; -end - -for pn in ivalues(PlayerNumber) do - local MetricsName = "PeakComboAward" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "PeakComboAward"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - BeginCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local tStats = THEME:GetMetric(Var "LoadingScreen", "Summary") and STATSMAN:GetAccumPlayedStageStats() or STATSMAN:GetCurStageStats(); - tStats = tStats:GetPlayerStageStats(pn); - if tStats:GetPeakComboAward() then - self:settext( THEME:GetString( "PeakComboAward", ToEnumShortString( tStats:GetPeakComboAward() ) ) ); - else - self:settext( "" ); - end - end; - }; -end - -t[#t+1] = StandardDecorationFromFileOptional("SongInformation","SongInformation") .. { - BeginCommand=function(self) - local SongOrCourse; - if GAMESTATE:GetCurrentSong() then - SongOrCourse = GAMESTATE:GetCurrentSong(); - elseif GAMESTATE:GetCurrentCourse() then - SongOrCourse = GAMESTATE:GetCurrentCourse(); - else - return - end - - if SongOrCourse:HasBanner() then - self:visible(false); - else - self:visible(true); - end - end; - SetCommand=function(self) - local c = self:GetChildren(); - local SongOrCourse; - if GAMESTATE:GetCurrentSong() then - SongOrCourse = GAMESTATE:GetCurrentSong(); - - c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil ); - c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil ); - c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil ); - - if SongOrCourse:GetDisplaySubTitle() == "" then - c.TextTitle:visible(true); - c.TextTitle:y(-16.5/2); - c.TextSubtitle:visible(false); - c.TextSubtitle:y(0); - c.TextArtist:visible(true); - c.TextArtist:y(18/2); - else - c.TextTitle:visible(true); - c.TextTitle:y(-16.5); - c.TextSubtitle:visible(true); - c.TextSubtitle:y(0); - c.TextArtist:visible(true); - c.TextArtist:y(18); - end --- self:playcommand("Tick"); - elseif GAMESTATE:GetCurrentCourse() then - SongOrCourse = GAMESTATE:GetCurrentCourse(); - - c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil ); - c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil ); - c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil ); - --- self:playcommand("Tick"); - else - SongOrCourse = nil; - - c.TextTitle:settext(""); - c.TextSubtitle:settext(""); - c.TextArtist:settext(""); - - self:playcommand("Hide") - end - end; --- OnCommand=cmd(playcommand,"Set"); - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - DisplayLanguageChangedMessageCommand=cmd(playcommand,"Set"); -}; -t[#t+1] = StandardDecorationFromFileOptional("LifeDifficulty","LifeDifficulty"); -t[#t+1] = StandardDecorationFromFileOptional("TimingDifficulty","TimingDifficulty"); -t[#t+1] = StandardDecorationFromFileOptional("GameType","GameType"); -t[#t+1] = Def.ActorFrame { - Condition=GAMESTATE:HasEarnedExtraStage() and GAMESTATE:IsExtraStage() and not GAMESTATE:IsExtraStage2(); - InitCommand=cmd(draworder,105); - LoadActor( THEME:GetPathS("ScreenEvaluation","try Extra1" ) ) .. { - Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; - OnCommand=cmd(play); - }; - LoadActor( THEME:GetPathG("ScreenStageInformation","Stage extra1" ) ) .. { - Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; - InitCommand=cmd(Center); - OnCommand=cmd(diffusealpha,0;zoom,0.85;bounceend,1;zoom,1;diffusealpha,1;sleep,0;glow,Color("White");decelerate,1;glow,Color("Invisible");smooth,0.35;zoom,0.25;y,SCREEN_BOTTOM-72); - }; -}; -t[#t+1] = Def.ActorFrame { - Condition=GAMESTATE:HasEarnedExtraStage() and not GAMESTATE:IsExtraStage() and GAMESTATE:IsExtraStage2(); - InitCommand=cmd(draworder,105); - LoadActor( THEME:GetPathS("ScreenEvaluation","try Extra2" ) ) .. { - Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; - OnCommand=cmd(play); - }; - LoadActor( THEME:GetPathG("ScreenStageInformation","Stage extra2" ) ) .. { - Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; - InitCommand=cmd(Center); - OnCommand=cmd(diffusealpha,0;zoom,0.85;bounceend,1;zoom,1;diffusealpha,1;sleep,0;glow,Color("White");decelerate,1;glow,Color("Invisible");smooth,0.35;zoom,0.25;y,SCREEN_BOTTOM-72); - }; -}; +local function GraphDisplay( pn ) + local t = Def.ActorFrame { + Def.GraphDisplay { + InitCommand=cmd(Load,"GraphDisplay";); + BeginCommand=function(self) + local ss = SCREENMAN:GetTopScreen():GetStageStats(); + self:Set( ss, ss:GetPlayerStageStats(pn) ); + self:player( pn ); + end + }; + }; + return t; +end + +local function ComboGraph( pn ) + local t = Def.ActorFrame { + Def.ComboGraph { + InitCommand=cmd(Load,"ComboGraph";); + BeginCommand=function(self) + local ss = SCREENMAN:GetTopScreen():GetStageStats(); + self:Set( ss, ss:GetPlayerStageStats(pn) ); + self:player( pn ); + end + }; + }; + return t; +end + +local function PercentScore( pn ) + local t = LoadFont("Common normal")..{ + InitCommand=cmd(zoom,0.625;shadowlength,1;player,pn); + BeginCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + -- todo: color by difficulty + local StepsOrTrail; + if GAMESTATE:IsCourseMode() then + StepsOrTrail = GAMESTATE:GetCurrentTrail(pn) + else + StepsOrTrail = GAMESTATE:GetCurrentSteps(pn) + end; + local st = StepsOrTrail:GetStepsType(); + local diff = StepsOrTrail:GetDifficulty(); + local courseType = GAMESTATE:IsCourseMode() and SongOrCourse:GetCourseType() or nil; + local cd = GetCustomDifficulty(st, diff, courseType); + self:diffuse(CustomDifficultyToColor(cd)); + self:shadowcolor(CustomDifficultyToDarkColor(cd)); + + local pss = STATSMAN:GetPlayedStageStats(1):GetPlayerStageStats(pn); + if pss then + local pct = pss:GetPercentDancePoints(); + if pct == 1 then + self:settext("100%"); + else + self:settext(FormatPercentScore(pct)); + end; + end; + end; + }; + return t; +end + +local t = LoadFallbackB(); + +t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); + +if ShowStandardDecoration("GraphDisplay") then + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + t[#t+1] = StandardDecorationFromTable( "GraphDisplay" .. ToEnumShortString(pn), GraphDisplay(pn) ); + end +end + +if ShowStandardDecoration("ComboGraph") then + for pn in ivalues(GAMESTATE:GetHumanPlayers()) do + t[#t+1] = StandardDecorationFromTable( "ComboGraph" .. ToEnumShortString(pn), ComboGraph(pn) ); + end +end + +if ShowStandardDecoration("StepsDisplay") then + for pn in ivalues(PlayerNumber) do + local t2 = Def.StepsDisplay { + InitCommand=cmd(Load,"StepsDisplayEvaluation",pn;SetFromGameState,pn;); + UpdateNetEvalStatsMessageCommand=function(self,param) + if GAMESTATE:IsPlayerEnabled(pn) then + self:SetFromSteps(param.Steps) + end; + end; + }; + t[#t+1] = StandardDecorationFromTable( "StepsDisplay" .. ToEnumShortString(pn), t2 ); + t[#t+1] = StandardDecorationFromTable( "PercentScore" .. ToEnumShortString(pn), PercentScore(pn) ); + end +end + +for pn in ivalues(PlayerNumber) do + local MetricsName = "MachineRecord" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "MachineRecord"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + }; +end + +for pn in ivalues(PlayerNumber) do + local MetricsName = "PersonalRecord" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "PersonalRecord"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + }; +end + +for pn in ivalues(PlayerNumber) do + local MetricsName = "StageAward" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "StageAward"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + BeginCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local tStats = THEME:GetMetric(Var "LoadingScreen", "Summary") and STATSMAN:GetAccumPlayedStageStats() or STATSMAN:GetCurStageStats(); + tStats = tStats:GetPlayerStageStats(pn); + if tStats:GetStageAward() then + self:settext( THEME:GetString( "StageAward", ToEnumShortString( tStats:GetStageAward() ) ) ); + else + self:settext( "" ); + end + end; + }; +end + +for pn in ivalues(PlayerNumber) do + local MetricsName = "PeakComboAward" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG(Var "LoadingScreen", "PeakComboAward"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + BeginCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local tStats = THEME:GetMetric(Var "LoadingScreen", "Summary") and STATSMAN:GetAccumPlayedStageStats() or STATSMAN:GetCurStageStats(); + tStats = tStats:GetPlayerStageStats(pn); + if tStats:GetPeakComboAward() then + self:settext( THEME:GetString( "PeakComboAward", ToEnumShortString( tStats:GetPeakComboAward() ) ) ); + else + self:settext( "" ); + end + end; + }; +end + +t[#t+1] = StandardDecorationFromFileOptional("SongInformation","SongInformation") .. { + BeginCommand=function(self) + local SongOrCourse; + if GAMESTATE:GetCurrentSong() then + SongOrCourse = GAMESTATE:GetCurrentSong(); + elseif GAMESTATE:GetCurrentCourse() then + SongOrCourse = GAMESTATE:GetCurrentCourse(); + else + return + end + + if SongOrCourse:HasBanner() then + self:visible(false); + else + self:visible(true); + end + end; + SetCommand=function(self) + local c = self:GetChildren(); + local SongOrCourse; + if GAMESTATE:GetCurrentSong() then + SongOrCourse = GAMESTATE:GetCurrentSong(); + + c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil ); + c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil ); + c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil ); + + if SongOrCourse:GetDisplaySubTitle() == "" then + c.TextTitle:visible(true); + c.TextTitle:y(-16.5/2); + c.TextSubtitle:visible(false); + c.TextSubtitle:y(0); + c.TextArtist:visible(true); + c.TextArtist:y(18/2); + else + c.TextTitle:visible(true); + c.TextTitle:y(-16.5); + c.TextSubtitle:visible(true); + c.TextSubtitle:y(0); + c.TextArtist:visible(true); + c.TextArtist:y(18); + end +-- self:playcommand("Tick"); + elseif GAMESTATE:GetCurrentCourse() then + SongOrCourse = GAMESTATE:GetCurrentCourse(); + + c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil ); + c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil ); + c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil ); + +-- self:playcommand("Tick"); + else + SongOrCourse = nil; + + c.TextTitle:settext(""); + c.TextSubtitle:settext(""); + c.TextArtist:settext(""); + + self:playcommand("Hide") + end + end; +-- OnCommand=cmd(playcommand,"Set"); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + DisplayLanguageChangedMessageCommand=cmd(playcommand,"Set"); +}; +t[#t+1] = StandardDecorationFromFileOptional("LifeDifficulty","LifeDifficulty"); +t[#t+1] = StandardDecorationFromFileOptional("TimingDifficulty","TimingDifficulty"); +t[#t+1] = StandardDecorationFromFileOptional("GameType","GameType"); +t[#t+1] = Def.ActorFrame { + Condition=GAMESTATE:HasEarnedExtraStage() and GAMESTATE:IsExtraStage() and not GAMESTATE:IsExtraStage2(); + InitCommand=cmd(draworder,105); + LoadActor( THEME:GetPathS("ScreenEvaluation","try Extra1" ) ) .. { + Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; + OnCommand=cmd(play); + }; + LoadActor( THEME:GetPathG("ScreenStageInformation","Stage extra1" ) ) .. { + Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; + InitCommand=cmd(Center); + OnCommand=cmd(diffusealpha,0;zoom,0.85;bounceend,1;zoom,1;diffusealpha,1;sleep,0;glow,Color("White");decelerate,1;glow,Color("Invisible");smooth,0.35;zoom,0.25;y,SCREEN_BOTTOM-72); + }; +}; +t[#t+1] = Def.ActorFrame { + Condition=GAMESTATE:HasEarnedExtraStage() and not GAMESTATE:IsExtraStage() and GAMESTATE:IsExtraStage2(); + InitCommand=cmd(draworder,105); + LoadActor( THEME:GetPathS("ScreenEvaluation","try Extra2" ) ) .. { + Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; + OnCommand=cmd(play); + }; + LoadActor( THEME:GetPathG("ScreenStageInformation","Stage extra2" ) ) .. { + Condition=THEME:GetMetric( Var "LoadingScreen","Summary" ) == false; + InitCommand=cmd(Center); + OnCommand=cmd(diffusealpha,0;zoom,0.85;bounceend,1;zoom,1;diffusealpha,1;sleep,0;glow,Color("White");decelerate,1;glow,Color("Invisible");smooth,0.35;zoom,0.25;y,SCREEN_BOTTOM-72); + }; +}; return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua b/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua index e9267db809..13c78bc09b 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua @@ -1,64 +1,64 @@ -local vStats = STATSMAN:GetCurStageStats(); - -local function CreateStats( pnPlayer ) - -- Actor Templates - local aLabel = LoadFont("Common Normal") .. { InitCommand=cmd(zoom,0.5;shadowlength,1;horizalign,left); }; - local aText = LoadFont("Common Normal") .. { InitCommand=cmd(zoom,0.5;shadowlength,1;horizalign,left); }; - -- DA STATS, JIM!! - local pnStageStats = vStats:GetPlayerStageStats( pnPlayer ); - -- Organized Stats. - local tStats = { - W1 = pnStageStats:GetTapNoteScores('TapNoteScore_W1'); - W2 = pnStageStats:GetTapNoteScores('TapNoteScore_W2'); - W3 = pnStageStats:GetTapNoteScores('TapNoteScore_W3'); - W4 = pnStageStats:GetTapNoteScores('TapNoteScore_W4'); - W5 = pnStageStats:GetTapNoteScores('TapNoteScore_W5'); - Miss = pnStageStats:GetTapNoteScores('TapNoteScore_Miss'); - HitMine = pnStageStats:GetTapNoteScores('TapNoteScore_HitMine'); - AvoidMine = pnStageStats:GetTapNoteScores('TapNoteScore_AvoidMine'); - Held = pnStageStats:GetHoldNoteScores('HoldNoteScore_Held'); - LetGo = pnStageStats:GetHoldNoteScores('HoldNoteScore_LetGo'); - }; - -- Organized Equation Values - local tValues = { - -- marvcount*7 + perfcount*6 + greatcount*5 + goodcount*4 + boocount*2 + okcount*7 - ITG = ( tStats["W1"]*7 + tStats["W2"]*6 + tStats["W3"]*5 + tStats["W4"]*4 + tStats["W5"]*2 + tStats["Held"]*7 ), - -- (marvcount + perfcount + greatcount + goodcount + boocount + misscount + okcount + ngcount)*7 - ITG_MAX = ( tStats["W1"] + tStats["W2"] + tStats["W3"] + tStats["W4"] + tStats["W5"] + tStats["Miss"] + tStats["Held"] + tStats["LetGo"] )*7, - -- marvcount*3 + perfcount*2 + greatcount*1 - boocount*4 - misscount*8 + okcount*6 - MIGS = ( tStats["W1"]*3 + tStats["W2"]*2 + tStats["W3"] - tStats["W5"]*4 - tStats["Miss"]*8 + tStats["Held"]*6 ), - -- (marvcount + perfcount + greatcount + goodcount + boocount + misscount)*3 + (okcount + ngcount)*6 - MIGS_MAX = ( (tStats["W1"] + tStats["W2"] + tStats["W3"] + tStats["W4"] + tStats["W5"] + tStats["Miss"])*3 + (tStats["Held"] + tStats["LetGo"])*6 ), - }; - - local t = Def.ActorFrame {}; - t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,-34); - LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { - InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); - }; - aLabel .. { Text="ITG DP:"; InitCommand=cmd(x,-64) }; - aText .. { Text=string.format("%04i",tValues["ITG"]); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); }; - aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); }; - aText .. { Text=string.format("%04i",tValues["ITG_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; - }; - t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,-6); - LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { - InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); - }; - aLabel .. { Text="MIGS DP:"; InitCommand=cmd(x,-64) }; - aText .. { Text=string.format("%04i",tValues["MIGS"]); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); }; - aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); }; - aText .. { Text=string.format("%04i",tValues["MIGS_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; - }; - return t -end; - --- xxx: this only currently works for player 1. -aj -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,WideScale(math.floor(SCREEN_CENTER_X*0.3)-8,math.floor(SCREEN_CENTER_X*0.5)-8);y,SCREEN_CENTER_Y); - CreateStats( PLAYER_1 ); -}; +local vStats = STATSMAN:GetCurStageStats(); + +local function CreateStats( pnPlayer ) + -- Actor Templates + local aLabel = LoadFont("Common Normal") .. { InitCommand=cmd(zoom,0.5;shadowlength,1;horizalign,left); }; + local aText = LoadFont("Common Normal") .. { InitCommand=cmd(zoom,0.5;shadowlength,1;horizalign,left); }; + -- DA STATS, JIM!! + local pnStageStats = vStats:GetPlayerStageStats( pnPlayer ); + -- Organized Stats. + local tStats = { + W1 = pnStageStats:GetTapNoteScores('TapNoteScore_W1'); + W2 = pnStageStats:GetTapNoteScores('TapNoteScore_W2'); + W3 = pnStageStats:GetTapNoteScores('TapNoteScore_W3'); + W4 = pnStageStats:GetTapNoteScores('TapNoteScore_W4'); + W5 = pnStageStats:GetTapNoteScores('TapNoteScore_W5'); + Miss = pnStageStats:GetTapNoteScores('TapNoteScore_Miss'); + HitMine = pnStageStats:GetTapNoteScores('TapNoteScore_HitMine'); + AvoidMine = pnStageStats:GetTapNoteScores('TapNoteScore_AvoidMine'); + Held = pnStageStats:GetHoldNoteScores('HoldNoteScore_Held'); + LetGo = pnStageStats:GetHoldNoteScores('HoldNoteScore_LetGo'); + }; + -- Organized Equation Values + local tValues = { + -- marvcount*7 + perfcount*6 + greatcount*5 + goodcount*4 + boocount*2 + okcount*7 + ITG = ( tStats["W1"]*7 + tStats["W2"]*6 + tStats["W3"]*5 + tStats["W4"]*4 + tStats["W5"]*2 + tStats["Held"]*7 ), + -- (marvcount + perfcount + greatcount + goodcount + boocount + misscount + okcount + ngcount)*7 + ITG_MAX = ( tStats["W1"] + tStats["W2"] + tStats["W3"] + tStats["W4"] + tStats["W5"] + tStats["Miss"] + tStats["Held"] + tStats["LetGo"] )*7, + -- marvcount*3 + perfcount*2 + greatcount*1 - boocount*4 - misscount*8 + okcount*6 + MIGS = ( tStats["W1"]*3 + tStats["W2"]*2 + tStats["W3"] - tStats["W5"]*4 - tStats["Miss"]*8 + tStats["Held"]*6 ), + -- (marvcount + perfcount + greatcount + goodcount + boocount + misscount)*3 + (okcount + ngcount)*6 + MIGS_MAX = ( (tStats["W1"] + tStats["W2"] + tStats["W3"] + tStats["W4"] + tStats["W5"] + tStats["Miss"])*3 + (tStats["Held"] + tStats["LetGo"])*6 ), + }; + + local t = Def.ActorFrame {}; + t[#t+1] = Def.ActorFrame { + InitCommand=cmd(y,-34); + LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); + }; + aLabel .. { Text="ITG DP:"; InitCommand=cmd(x,-64) }; + aText .. { Text=string.format("%04i",tValues["ITG"]); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); }; + aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); }; + aText .. { Text=string.format("%04i",tValues["ITG_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; + }; + t[#t+1] = Def.ActorFrame { + InitCommand=cmd(y,-6); + LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); + }; + aLabel .. { Text="MIGS DP:"; InitCommand=cmd(x,-64) }; + aText .. { Text=string.format("%04i",tValues["MIGS"]); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); }; + aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); }; + aText .. { Text=string.format("%04i",tValues["MIGS_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; + }; + return t +end; + +-- xxx: this only currently works for player 1. -aj +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,WideScale(math.floor(SCREEN_CENTER_X*0.3)-8,math.floor(SCREEN_CENTER_X*0.5)-8);y,SCREEN_CENTER_Y); + CreateStats( PLAYER_1 ); +}; return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenEvaluation overlay/original.lua b/Themes/default/BGAnimations/ScreenEvaluation overlay/original.lua index df3f8441cb..8cde03487b 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation overlay/original.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation overlay/original.lua @@ -1,86 +1,86 @@ -local ss = STATSMAN:GetCurStageStats(); -local pss = ss:GetPlayerStageStats('PlayerNumber_P1'); -local misscount = pss:GetTapNoteScores('TapNoteScore_Miss'); -local boocount = pss:GetTapNoteScores('TapNoteScore_W5'); -local goodcount = pss:GetTapNoteScores('TapNoteScore_W4'); -local greatcount = pss:GetTapNoteScores('TapNoteScore_W3'); -local perfcount = pss:GetTapNoteScores('TapNoteScore_W2'); -local marvcount = pss:GetTapNoteScores('TapNoteScore_W1'); -local minehitcount = pss:GetTapNoteScores('TapNoteScore_HitMine'); -local minemisscount = pss:GetTapNoteScores('TapNoteScore_AvoidMine'); -local okcount = pss:GetHoldNoteScores('HoldNoteScore_Held'); -local ngcount = pss:GetHoldNoteScores('HoldNoteScore_LetGo'); -local ITGdp = marvcount*7 + perfcount*6 + greatcount*5 + goodcount*4 + boocount*2 + okcount*7 -local ITGdpmax = (marvcount + perfcount + greatcount + goodcount + boocount + misscount + okcount + ngcount)*7 -local MIGSdp = marvcount*3 + perfcount*2 + greatcount*1 - boocount*4 - misscount*8 + okcount*6 -local MIGSdpmax = (marvcount + perfcount + greatcount + goodcount + boocount + misscount)*3 + (okcount + ngcount)*6 -local histogram = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -local total = 0 -local maxValue = 0; -print("John11length: "..#histogram); - -for i=1,#tTotalJudgmentsSigned do - print("John11Timings: "..i.." - "..tTotalJudgmentsSigned[i]) - local index = math.floor((0.18-tTotalJudgmentsSigned[i])*(#histogram/.36)); - print("John11Index: "..i.." - "..index) - if index >= 0 and index <= #histogram - 1 then - histogram[index] = histogram[index] + 1 - total = total + 1 - if histogram[index] > maxValue then - maxValue = histogram[index] - end - end -end - -for i=1,#histogram do - print("John11Judgments: "..i.." - "..histogram[i]) -end - -local t = Def.ActorFrame {} -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X/3;y,SCREEN_CENTER_Y); - LoadFont("Common Normal") .. { - Text="MIGS DP: "..tostring(MIGSdp).."/"..tostring(MIGSdpmax).."\nITG DP: "..tostring(ITGdp).."/"..tostring(ITGdpmax).."\nOffset Avg: "..RoundTo(tTimingDifferenceAverage,5).."\nAbs Offset Avg: "..RoundTo(tTimingDifferenceAbsAverage,5).."\nEarly Taps: "..tEarlyHits.."\nLate Taps: "..tLateHits; - InitCommand=cmd(y,-4;shadowlength,1;diffuse,Color("Red");zoom,0.5) - }; -} - -for i=1,#histogram do - local offset = -1 - if i > #histogram/2 then - offset = 1 - end - t[#t+1] = Def.Quad { - InitCommand=cmd(diffuse,Color("Red");zoomtowidth,300/#histogram-1;zoomtoheight,histogram[#histogram-i]/maxValue*150;x,SCREEN_CENTER_X+100+300/#histogram*i+offset;y,SCREEN_CENTER_Y-histogram[#histogram-i]/maxValue*150/2); - } -end - -t[#t+1] = Def.Quad { - InitCommand=cmd(x,SCREEN_CENTER_X+250;y,SCREEN_CENTER_Y+3;zoomtowidth,300;zoomtoheight,5;diffuse,color("#FFFFFF")); -} - -t[#t+1] = Def.Quad { - InitCommand=cmd(x,SCREEN_CENTER_X+252;y,SCREEN_CENTER_Y-75;zoomtowidth,1;zoomtoheight,150;diffuse,color("#000000")); -} - - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X+125;y,SCREEN_CENTER_Y+15); - LoadFont("Common Normal") .. { - Text="Early"; - InitCommand=cmd(shadowlength,1;diffuse,Color("#FF0000");zoom,0.5) - }; -} - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X+375;y,SCREEN_CENTER_Y+15); - LoadFont("Common Normal") .. { - Text="Late"; - InitCommand=cmd(shadowlength,1;diffuse,Color("#FF0000");zoom,0.5) - }; -} - -print("John11Total: "..total) -print("John11MaxValue: "..maxValue) - +local ss = STATSMAN:GetCurStageStats(); +local pss = ss:GetPlayerStageStats('PlayerNumber_P1'); +local misscount = pss:GetTapNoteScores('TapNoteScore_Miss'); +local boocount = pss:GetTapNoteScores('TapNoteScore_W5'); +local goodcount = pss:GetTapNoteScores('TapNoteScore_W4'); +local greatcount = pss:GetTapNoteScores('TapNoteScore_W3'); +local perfcount = pss:GetTapNoteScores('TapNoteScore_W2'); +local marvcount = pss:GetTapNoteScores('TapNoteScore_W1'); +local minehitcount = pss:GetTapNoteScores('TapNoteScore_HitMine'); +local minemisscount = pss:GetTapNoteScores('TapNoteScore_AvoidMine'); +local okcount = pss:GetHoldNoteScores('HoldNoteScore_Held'); +local ngcount = pss:GetHoldNoteScores('HoldNoteScore_LetGo'); +local ITGdp = marvcount*7 + perfcount*6 + greatcount*5 + goodcount*4 + boocount*2 + okcount*7 +local ITGdpmax = (marvcount + perfcount + greatcount + goodcount + boocount + misscount + okcount + ngcount)*7 +local MIGSdp = marvcount*3 + perfcount*2 + greatcount*1 - boocount*4 - misscount*8 + okcount*6 +local MIGSdpmax = (marvcount + perfcount + greatcount + goodcount + boocount + misscount)*3 + (okcount + ngcount)*6 +local histogram = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} +local total = 0 +local maxValue = 0; +print("John11length: "..#histogram); + +for i=1,#tTotalJudgmentsSigned do + print("John11Timings: "..i.." - "..tTotalJudgmentsSigned[i]) + local index = math.floor((0.18-tTotalJudgmentsSigned[i])*(#histogram/.36)); + print("John11Index: "..i.." - "..index) + if index >= 0 and index <= #histogram - 1 then + histogram[index] = histogram[index] + 1 + total = total + 1 + if histogram[index] > maxValue then + maxValue = histogram[index] + end + end +end + +for i=1,#histogram do + print("John11Judgments: "..i.." - "..histogram[i]) +end + +local t = Def.ActorFrame {} +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X/3;y,SCREEN_CENTER_Y); + LoadFont("Common Normal") .. { + Text="MIGS DP: "..tostring(MIGSdp).."/"..tostring(MIGSdpmax).."\nITG DP: "..tostring(ITGdp).."/"..tostring(ITGdpmax).."\nOffset Avg: "..RoundTo(tTimingDifferenceAverage,5).."\nAbs Offset Avg: "..RoundTo(tTimingDifferenceAbsAverage,5).."\nEarly Taps: "..tEarlyHits.."\nLate Taps: "..tLateHits; + InitCommand=cmd(y,-4;shadowlength,1;diffuse,Color("Red");zoom,0.5) + }; +} + +for i=1,#histogram do + local offset = -1 + if i > #histogram/2 then + offset = 1 + end + t[#t+1] = Def.Quad { + InitCommand=cmd(diffuse,Color("Red");zoomtowidth,300/#histogram-1;zoomtoheight,histogram[#histogram-i]/maxValue*150;x,SCREEN_CENTER_X+100+300/#histogram*i+offset;y,SCREEN_CENTER_Y-histogram[#histogram-i]/maxValue*150/2); + } +end + +t[#t+1] = Def.Quad { + InitCommand=cmd(x,SCREEN_CENTER_X+250;y,SCREEN_CENTER_Y+3;zoomtowidth,300;zoomtoheight,5;diffuse,color("#FFFFFF")); +} + +t[#t+1] = Def.Quad { + InitCommand=cmd(x,SCREEN_CENTER_X+252;y,SCREEN_CENTER_Y-75;zoomtowidth,1;zoomtoheight,150;diffuse,color("#000000")); +} + + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X+125;y,SCREEN_CENTER_Y+15); + LoadFont("Common Normal") .. { + Text="Early"; + InitCommand=cmd(shadowlength,1;diffuse,Color("#FF0000");zoom,0.5) + }; +} + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X+375;y,SCREEN_CENTER_Y+15); + LoadFont("Common Normal") .. { + Text="Late"; + InitCommand=cmd(shadowlength,1;diffuse,Color("#FF0000");zoom,0.5) + }; +} + +print("John11Total: "..total) +print("John11MaxValue: "..maxValue) + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameInformation underlay/default.lua b/Themes/default/BGAnimations/ScreenGameInformation underlay/default.lua index bbb05ba9ae..119f22d4f1 100644 --- a/Themes/default/BGAnimations/ScreenGameInformation underlay/default.lua +++ b/Themes/default/BGAnimations/ScreenGameInformation underlay/default.lua @@ -1,10 +1,10 @@ -local t = Def.ActorFrame {}; ---[[ t[#t+1] = Def.Actor { - OnCommand=function(self) - local sTarget = PROFILEMAN:GetProfileDir('ProfileSlot_Machine'); - -- - WriteFile(sTarget .. "Jason.txt","Charlie is a magical unicorn!"); - end; -}; --]] - +local t = Def.ActorFrame {}; +--[[ t[#t+1] = Def.Actor { + OnCommand=function(self) + local sTarget = PROFILEMAN:GetProfileDir('ProfileSlot_Machine'); + -- + WriteFile(sTarget .. "Jason.txt","Charlie is a magical unicorn!"); + end; +}; --]] + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameOver underlay/default.lua b/Themes/default/BGAnimations/ScreenGameOver underlay/default.lua index 1c06c22a8d..ead078958e 100644 --- a/Themes/default/BGAnimations/ScreenGameOver underlay/default.lua +++ b/Themes/default/BGAnimations/ScreenGameOver underlay/default.lua @@ -1,11 +1,11 @@ -return Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - LoadFont("Common Normal") .. { - Text="GAME OVER"; - InitCommand=cmd(y,-4;shadowlength,1;diffuse,Color("Red")); - }; - LoadFont("Common Normal") .. { - Text="Play again soon!"; - InitCommand=cmd(y,16;shadowlength,1;zoom,0.5;); - }; +return Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + LoadFont("Common Normal") .. { + Text="GAME OVER"; + InitCommand=cmd(y,-4;shadowlength,1;diffuse,Color("Red")); + }; + LoadFont("Common Normal") .. { + Text="Play again soon!"; + InitCommand=cmd(y,16;shadowlength,1;zoom,0.5;); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay danger all/default.lua b/Themes/default/BGAnimations/ScreenGameplay danger all/default.lua index f69c902ce0..ca4fb88585 100644 --- a/Themes/default/BGAnimations/ScreenGameplay danger all/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay danger all/default.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame { - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); - OnCommand=cmd(smooth,1;diffuse,color("0.75,0,0,0.75");decelerate,2;diffuse,color("0,0,0,1")); - }; +return Def.ActorFrame { + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); + OnCommand=cmd(smooth,1;diffuse,color("0.75,0,0,0.75");decelerate,2;diffuse,color("0,0,0,1")); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay danger p1/BGAnimation.ini b/Themes/default/BGAnimations/ScreenGameplay danger p1/BGAnimation.ini index 3f9cc440c9..6e6bc1669d 100644 --- a/Themes/default/BGAnimations/ScreenGameplay danger p1/BGAnimation.ini +++ b/Themes/default/BGAnimations/ScreenGameplay danger p1/BGAnimation.ini @@ -1 +1 @@ -[BGAnimation] +[BGAnimation] diff --git a/Themes/default/BGAnimations/ScreenGameplay danger p2/BGAnimation.ini b/Themes/default/BGAnimations/ScreenGameplay danger p2/BGAnimation.ini index 3f9cc440c9..6e6bc1669d 100644 --- a/Themes/default/BGAnimations/ScreenGameplay danger p2/BGAnimation.ini +++ b/Themes/default/BGAnimations/ScreenGameplay danger p2/BGAnimation.ini @@ -1 +1 @@ -[BGAnimation] +[BGAnimation] diff --git a/Themes/default/BGAnimations/ScreenGameplay dead p1/BGAnimation.ini b/Themes/default/BGAnimations/ScreenGameplay dead p1/BGAnimation.ini index 3f9cc440c9..6e6bc1669d 100644 --- a/Themes/default/BGAnimations/ScreenGameplay dead p1/BGAnimation.ini +++ b/Themes/default/BGAnimations/ScreenGameplay dead p1/BGAnimation.ini @@ -1 +1 @@ -[BGAnimation] +[BGAnimation] diff --git a/Themes/default/BGAnimations/ScreenGameplay dead p2/BGAnimation.ini b/Themes/default/BGAnimations/ScreenGameplay dead p2/BGAnimation.ini index 3f9cc440c9..6e6bc1669d 100644 --- a/Themes/default/BGAnimations/ScreenGameplay dead p2/BGAnimation.ini +++ b/Themes/default/BGAnimations/ScreenGameplay dead p2/BGAnimation.ini @@ -1 +1 @@ -[BGAnimation] +[BGAnimation] diff --git a/Themes/default/BGAnimations/ScreenGameplay decorations/default.lua b/Themes/default/BGAnimations/ScreenGameplay decorations/default.lua index 1eeeb911f1..c86d6323b6 100644 --- a/Themes/default/BGAnimations/ScreenGameplay decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay decorations/default.lua @@ -1,178 +1,178 @@ -local function CreateStops() - local t = Def.ActorFrame { }; - local bars = Def.ActorFrame{ }; - local bpmFrame = Def.ActorFrame{ Name="BPMFrame"; }; - local stopFrame = Def.ActorFrame{ Name="StopFrame"; }; - - local fFrameWidth = 380; - local fFrameHeight = 8; - -- XXX: doesn't work in course mode -aj - if not GAMESTATE:IsCourseMode() then - -- Straight rip off NCRX - local song = GAMESTATE:GetCurrentSong(); - local timingData = song:GetTimingData(); - -- if we're using SSC, might as well use the StepsSeconds, which will - -- almost always be more proper than a r21'd file. - if song then - local songLen = song:MusicLengthSeconds(); - - local firstBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetFirstBeat()); - local lastBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetLastBeat()); - - local bpms = timingData:GetBPMs(); - - local stops = timingData:GetStops(); - for i=1,#stops do - local data = split("=",stops[i]); - local beat = data[1]; - local secs = data[2]; - local beatTime = timingData:GetElapsedTimeFromBeat(beat); - if beatTime < 0 then beatTime = 0; end; - - stopFrame[#stopFrame+1] = Def.ActorFrame { - Def.Quad { - InitCommand=function(self) - --self:diffuse(HSVA(192,1,0.8,0.8)); - self:shadowlength(0); - self:shadowcolor( color("#FFFFFF77") ); - -- set width - self:zoomto( math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight ); - -- find location - self:x( ( scale(beatTime, firstBeatSecs,lastBeatSecs, -fFrameWidth/2,fFrameWidth/2) ) ); - end; - OnCommand=function(self) - self:diffuse(Color("White")); - self:sleep(beatTime+1); - self:linear(2); - self:diffusealpha(0); - end; - }; - Def.Quad { - InitCommand=function(self) - --self:diffuse(HSVA(192,1,0.8,0.8)); - self:shadowlength(0); - self:shadowcolor( color("#FFFFFF77") ); - -- set width - self:zoomto( math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight ); - -- find location - self:x( ( scale(beatTime, firstBeatSecs,lastBeatSecs, -fFrameWidth/2,fFrameWidth/2) ) ); - end; - OnCommand=function(self) - self:diffusealpha(1); - self:diffuseshift(); - self:effectcolor1(Color("Orange")); - self:effectcolor2(Color("Red")); - self:effectclock('beat'); - self:effectperiod(1/8); - -- - self:diffusealpha(0); - self:sleep(beatTime+1); - -- self:linear(1); - self:diffusealpha(1); - self:linear(4); - self:diffusealpha(0); - end; - }; - --OnCommand=cmd(diffuse,Color("White");sleep,math.min(0.00001+(secs-5),0.00001);linear,1;diffuse,Color("Orange");sleep,4;linear,2;diffusealpha,0); - --OnCommand=cmd(diffuse,Color("White");linear,1;diffuse,Color("Orange");); - }; - end; - end; - bars[#bars+1] = stopFrame; - t[#t+1] = bars; - end - return t -end -local t = LoadFallbackB() -for pn in ivalues(PlayerNumber) do --- local MetricsName = "SongMeterDisplay" .. PlayerNumberToString(pn); ---[[ t[#t+1] = Def.ActorFrame { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'frame ' .. PlayerNumberToString(pn) ) ) .. { - InitCommand=function(self) - self:name('Frame'); - ActorUtil.LoadAllCommandsAndSetXY(self,MetricsName); - end; - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.25,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.5,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.75,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); - }; - Def.SongMeterDisplay { - StreamWidth=THEME:GetMetric( MetricsName, 'StreamWidth' ); - Stream=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'stream ' .. PlayerNumberToString(pn) ) )..{ - InitCommand=cmd(diffuse,PlayerColor(pn);diffusealpha,0.5;blend,Blend.Add;); - }; - Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(pn) ) ) .. { InitCommand=cmd(visible,false); }; - }; - CreateStops(); - }; --]] -end; -for pn in ivalues(PlayerNumber) do - local MetricsName = "ToastyDisplay" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG("Player", 'toasty'), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - }; -end; - -t[#t+1] = StandardDecorationFromFileOptional("ScoreFrame","ScoreFrame"); -t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay"); -t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); -t[#t+1] = StandardDecorationFromFileOptional("SongTitle","SongTitle"); - -t[#t+1] = Def.ActorFrame { - InitCommand=function(self) - self:name("SongMeterDisplay"); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'frame ' .. PlayerNumberToString(PLAYER_1) ) ) .. { - InitCommand=function(self) - self:name('Frame'); - ActorUtil.LoadAllCommandsAndSetXY(self,"SongMeterDisplay"); - end; - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.25,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.5,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,2,8); - OnCommand=cmd(x,scale(0.75,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); - }; - Def.SongMeterDisplay { - InitCommand=cmd(SetStreamWidth,THEME:GetMetric( "SongMeterDisplay", 'StreamWidth' )); - Stream=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'stream ' .. PlayerNumberToString(PLAYER_1) ) )..{ - InitCommand=cmd(diffuse,Color("Orange");diffusealpha,0.5;blend,Blend.Add;); - }; - Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(PLAYER_1) ) ) .. { InitCommand=cmd(visible,false); }; - }; - CreateStops(); -}; -if PREFSMAN:GetPreference("ScoringType") == 'ScoringType_Custom' then - t[#t+1] = Def.Actor{ - JudgmentMessageCommand = function(self, params) - SpecialScoring[GetUserPref("UserPrefSpecialScoringMode")](params, STATSMAN:GetCurStageStats():GetPlayerStageStats(params.Player)) - end; - }; -end; -return t +local function CreateStops() + local t = Def.ActorFrame { }; + local bars = Def.ActorFrame{ }; + local bpmFrame = Def.ActorFrame{ Name="BPMFrame"; }; + local stopFrame = Def.ActorFrame{ Name="StopFrame"; }; + + local fFrameWidth = 380; + local fFrameHeight = 8; + -- XXX: doesn't work in course mode -aj + if not GAMESTATE:IsCourseMode() then + -- Straight rip off NCRX + local song = GAMESTATE:GetCurrentSong(); + local timingData = song:GetTimingData(); + -- if we're using SSC, might as well use the StepsSeconds, which will + -- almost always be more proper than a r21'd file. + if song then + local songLen = song:MusicLengthSeconds(); + + local firstBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetFirstBeat()); + local lastBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetLastBeat()); + + local bpms = timingData:GetBPMs(); + + local stops = timingData:GetStops(); + for i=1,#stops do + local data = split("=",stops[i]); + local beat = data[1]; + local secs = data[2]; + local beatTime = timingData:GetElapsedTimeFromBeat(beat); + if beatTime < 0 then beatTime = 0; end; + + stopFrame[#stopFrame+1] = Def.ActorFrame { + Def.Quad { + InitCommand=function(self) + --self:diffuse(HSVA(192,1,0.8,0.8)); + self:shadowlength(0); + self:shadowcolor( color("#FFFFFF77") ); + -- set width + self:zoomto( math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight ); + -- find location + self:x( ( scale(beatTime, firstBeatSecs,lastBeatSecs, -fFrameWidth/2,fFrameWidth/2) ) ); + end; + OnCommand=function(self) + self:diffuse(Color("White")); + self:sleep(beatTime+1); + self:linear(2); + self:diffusealpha(0); + end; + }; + Def.Quad { + InitCommand=function(self) + --self:diffuse(HSVA(192,1,0.8,0.8)); + self:shadowlength(0); + self:shadowcolor( color("#FFFFFF77") ); + -- set width + self:zoomto( math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight ); + -- find location + self:x( ( scale(beatTime, firstBeatSecs,lastBeatSecs, -fFrameWidth/2,fFrameWidth/2) ) ); + end; + OnCommand=function(self) + self:diffusealpha(1); + self:diffuseshift(); + self:effectcolor1(Color("Orange")); + self:effectcolor2(Color("Red")); + self:effectclock('beat'); + self:effectperiod(1/8); + -- + self:diffusealpha(0); + self:sleep(beatTime+1); + -- self:linear(1); + self:diffusealpha(1); + self:linear(4); + self:diffusealpha(0); + end; + }; + --OnCommand=cmd(diffuse,Color("White");sleep,math.min(0.00001+(secs-5),0.00001);linear,1;diffuse,Color("Orange");sleep,4;linear,2;diffusealpha,0); + --OnCommand=cmd(diffuse,Color("White");linear,1;diffuse,Color("Orange");); + }; + end; + end; + bars[#bars+1] = stopFrame; + t[#t+1] = bars; + end + return t +end +local t = LoadFallbackB() +for pn in ivalues(PlayerNumber) do +-- local MetricsName = "SongMeterDisplay" .. PlayerNumberToString(pn); +--[[ t[#t+1] = Def.ActorFrame { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'frame ' .. PlayerNumberToString(pn) ) ) .. { + InitCommand=function(self) + self:name('Frame'); + ActorUtil.LoadAllCommandsAndSetXY(self,MetricsName); + end; + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.25,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.5,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.75,0,1,-380/2,380/2);diffuse,PlayerColor(pn);diffusealpha,0.5); + }; + Def.SongMeterDisplay { + StreamWidth=THEME:GetMetric( MetricsName, 'StreamWidth' ); + Stream=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'stream ' .. PlayerNumberToString(pn) ) )..{ + InitCommand=cmd(diffuse,PlayerColor(pn);diffusealpha,0.5;blend,Blend.Add;); + }; + Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(pn) ) ) .. { InitCommand=cmd(visible,false); }; + }; + CreateStops(); + }; --]] +end; +for pn in ivalues(PlayerNumber) do + local MetricsName = "ToastyDisplay" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG("Player", 'toasty'), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + }; +end; + +t[#t+1] = StandardDecorationFromFileOptional("ScoreFrame","ScoreFrame"); +t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay"); +t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); +t[#t+1] = StandardDecorationFromFileOptional("SongTitle","SongTitle"); + +t[#t+1] = Def.ActorFrame { + InitCommand=function(self) + self:name("SongMeterDisplay"); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'frame ' .. PlayerNumberToString(PLAYER_1) ) ) .. { + InitCommand=function(self) + self:name('Frame'); + ActorUtil.LoadAllCommandsAndSetXY(self,"SongMeterDisplay"); + end; + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.25,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.5,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,2,8); + OnCommand=cmd(x,scale(0.75,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5); + }; + Def.SongMeterDisplay { + InitCommand=cmd(SetStreamWidth,THEME:GetMetric( "SongMeterDisplay", 'StreamWidth' )); + Stream=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'stream ' .. PlayerNumberToString(PLAYER_1) ) )..{ + InitCommand=cmd(diffuse,Color("Orange");diffusealpha,0.5;blend,Blend.Add;); + }; + Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(PLAYER_1) ) ) .. { InitCommand=cmd(visible,false); }; + }; + CreateStops(); +}; +if PREFSMAN:GetPreference("ScoringType") == 'ScoringType_Custom' then + t[#t+1] = Def.Actor{ + JudgmentMessageCommand = function(self, params) + SpecialScoring[GetUserPref("UserPrefSpecialScoringMode")](params, STATSMAN:GetCurStageStats():GetPlayerStageStats(params.Player)) + end; + }; +end; +return t diff --git a/Themes/default/BGAnimations/ScreenGameplay failed/default.lua b/Themes/default/BGAnimations/ScreenGameplay failed/default.lua index 7982d7254b..ab6f9a6dcf 100644 --- a/Themes/default/BGAnimations/ScreenGameplay failed/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay failed/default.lua @@ -1,31 +1,31 @@ -local longFail = GetUserPrefB("UserPrefLongFail"); - -local t = Def.ActorFrame{}; - -if longFail then - t[#t+1] = Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); - OnCommand=cmd(decelerate,1.25;diffuse,color("0.75,0,0,0.75");linear,7;diffuse,color("0,0,0,1");sleep,1.25;linear,1;diffuse,color("1,0,0,1");decelerate,2;diffuse,color("0,0,0,1")); - }; - t[#t+1] = Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("1,1,1,1");diffusealpha,0); - OnCommand=cmd(finishtweening;diffusealpha,1;decelerate,1.25;diffuse,color("1,0,0,0")); - }; - t[#t+1] = LoadActor(THEME:GetPathS( "ScreenGameplayAlternate", "failed" ) ) .. { - StartTransitioningCommand=cmd(play); - }; -else - t[#t+1] = Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); - OnCommand=cmd(smooth,1;diffuse,color("0.75,0,0,0.75");decelerate,2;diffuse,color("0,0,0,1")); - }; - t[#t+1] = Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("1,1,1,1");diffusealpha,0); - OnCommand=cmd(finishtweening;diffusealpha,1;decelerate,1.25;diffuse,color("1,0,0,0")); - }; - t[#t+1] = LoadActor(THEME:GetPathS( Var "LoadingScreen", "failed" ) ) .. { - StartTransitioningCommand=cmd(play); - }; -end; - +local longFail = GetUserPrefB("UserPrefLongFail"); + +local t = Def.ActorFrame{}; + +if longFail then + t[#t+1] = Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); + OnCommand=cmd(decelerate,1.25;diffuse,color("0.75,0,0,0.75");linear,7;diffuse,color("0,0,0,1");sleep,1.25;linear,1;diffuse,color("1,0,0,1");decelerate,2;diffuse,color("0,0,0,1")); + }; + t[#t+1] = Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("1,1,1,1");diffusealpha,0); + OnCommand=cmd(finishtweening;diffusealpha,1;decelerate,1.25;diffuse,color("1,0,0,0")); + }; + t[#t+1] = LoadActor(THEME:GetPathS( "ScreenGameplayAlternate", "failed" ) ) .. { + StartTransitioningCommand=cmd(play); + }; +else + t[#t+1] = Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply); + OnCommand=cmd(smooth,1;diffuse,color("0.75,0,0,0.75");decelerate,2;diffuse,color("0,0,0,1")); + }; + t[#t+1] = Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("1,1,1,1");diffusealpha,0); + OnCommand=cmd(finishtweening;diffusealpha,1;decelerate,1.25;diffuse,color("1,0,0,0")); + }; + t[#t+1] = LoadActor(THEME:GetPathS( Var "LoadingScreen", "failed" ) ) .. { + StartTransitioningCommand=cmd(play); + }; +end; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay in/default.lua b/Themes/default/BGAnimations/ScreenGameplay in/default.lua index 93059d15bf..c89a4026e4 100644 --- a/Themes/default/BGAnimations/ScreenGameplay in/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay in/default.lua @@ -1,7 +1,7 @@ -local t = Def.ActorFrame {}; -t[#t+1] = Def.Sprite { - InitCommand=cmd(Center); - BeginCommand=cmd(LoadFromCurrentSongBackground); - OnCommand=cmd(diffusealpha,1;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;linear,1;diffusealpha,0;); -}; +local t = Def.ActorFrame {}; +t[#t+1] = Def.Sprite { + InitCommand=cmd(Center); + BeginCommand=cmd(LoadFromCurrentSongBackground); + OnCommand=cmd(diffusealpha,1;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;linear,1;diffusealpha,0;); +}; return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay next course song/default.lua b/Themes/default/BGAnimations/ScreenGameplay next course song/default.lua index d7bc92bcbf..de7cf0b949 100644 --- a/Themes/default/BGAnimations/ScreenGameplay next course song/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay next course song/default.lua @@ -1,39 +1,39 @@ -local t = Def.ActorFrame{}; - -if not GAMESTATE:IsCourseMode() then return t; end; - -t[#t+1] = Def.Sprite { - InitCommand=cmd(Center); - BeforeLoadingNextCourseSongMessageCommand=function(self) self:LoadFromSongBackground( SCREENMAN:GetTopScreen():GetNextCourseSong() ) end; - ChangeCourseSongInMessageCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - StartCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1;); - FinishCommand=cmd(linear,0.1;glow,Colors.Alpha(Color("White"),0.5);decelerate,0.4;glow,Color("Invisible");diffusealpha,0); -}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - OnCommand=cmd(stoptweening;addx,30;linear,3;addx,-30); - LoadFont("Common Normal") .. { - InitCommand=cmd(strokecolor,Color("Outline");y,-10); - BeforeLoadingNextCourseSongMessageCommand=function(self) - local NextSong = SCREENMAN:GetTopScreen():GetNextCourseSong(); - self:settext( NextSong:GetDisplayFullTitle() ); - end; - StartCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; ---[[ LoadFont("Common Normal") .. { - Text=GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentCourse():GetCourseType() or GAMESTATE:GetCurrentSong():GetDisplayArtist(); - InitCommand=cmd(strokecolor,Color("Outline");zoom,0.75); - OnCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; --]] - LoadFont("Common Normal") .. { - InitCommand=cmd(strokecolor,Color("Outline");diffuse,Color("Orange");diffusebottomedge,Color("Yellow");zoom,0.75;y,10); - BeforeLoadingNextCourseSongMessageCommand=function(self) - local NextSong = SCREENMAN:GetTopScreen():GetNextCourseSong(); - self:settext( SecondsToMSSMsMs( NextSong:MusicLengthSeconds() ) ); - end; - StartCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; -}; - +local t = Def.ActorFrame{}; + +if not GAMESTATE:IsCourseMode() then return t; end; + +t[#t+1] = Def.Sprite { + InitCommand=cmd(Center); + BeforeLoadingNextCourseSongMessageCommand=function(self) self:LoadFromSongBackground( SCREENMAN:GetTopScreen():GetNextCourseSong() ) end; + ChangeCourseSongInMessageCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + StartCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1;); + FinishCommand=cmd(linear,0.1;glow,Colors.Alpha(Color("White"),0.5);decelerate,0.4;glow,Color("Invisible");diffusealpha,0); +}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + OnCommand=cmd(stoptweening;addx,30;linear,3;addx,-30); + LoadFont("Common Normal") .. { + InitCommand=cmd(strokecolor,Color("Outline");y,-10); + BeforeLoadingNextCourseSongMessageCommand=function(self) + local NextSong = SCREENMAN:GetTopScreen():GetNextCourseSong(); + self:settext( NextSong:GetDisplayFullTitle() ); + end; + StartCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; +--[[ LoadFont("Common Normal") .. { + Text=GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentCourse():GetCourseType() or GAMESTATE:GetCurrentSong():GetDisplayArtist(); + InitCommand=cmd(strokecolor,Color("Outline");zoom,0.75); + OnCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; --]] + LoadFont("Common Normal") .. { + InitCommand=cmd(strokecolor,Color("Outline");diffuse,Color("Orange");diffusebottomedge,Color("Yellow");zoom,0.75;y,10); + BeforeLoadingNextCourseSongMessageCommand=function(self) + local NextSong = SCREENMAN:GetTopScreen():GetNextCourseSong(); + self:settext( SecondsToMSSMsMs( NextSong:MusicLengthSeconds() ) ); + end; + StartCommand=cmd(faderight,1;diffusealpha,0;linear,0.5;faderight,0;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay out.lua b/Themes/default/BGAnimations/ScreenGameplay out.lua index 841ecba903..cb3ce0e9d2 100644 --- a/Themes/default/BGAnimations/ScreenGameplay out.lua +++ b/Themes/default/BGAnimations/ScreenGameplay out.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(FullScreen;diffuse,color("0,0,0,0")); - OnCommand=cmd(linear,5;diffusealpha,1); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(FullScreen;diffuse,color("0,0,0,0")); + OnCommand=cmd(linear,5;diffusealpha,1); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenGameplay overlay.lua b/Themes/default/BGAnimations/ScreenGameplay overlay.lua index 7056d62c0a..d5d91b1b7d 100644 --- a/Themes/default/BGAnimations/ScreenGameplay overlay.lua +++ b/Themes/default/BGAnimations/ScreenGameplay overlay.lua @@ -1,40 +1,40 @@ -local t = Def.ActorFrame {}; -local function UpdateTime(self) - local c = self:GetChildren(); - for pn in ivalues(PlayerNumber) do - local vStats = STATSMAN:GetCurStageStats():GetPlayerStageStats( pn ); - local vTime; - local obj = self:GetChild( string.format("RemainingTime" .. PlayerNumberToString(pn) ) ); - if vStats and obj then - vTime = vStats:GetLifeRemainingSeconds() - obj:settext( SecondsToMMSSMsMs( vTime ) ); - end; - end; -end -if GAMESTATE:GetCurrentCourse() then - if GAMESTATE:GetCurrentCourse():GetCourseType() == "CourseType_Survival" then - -- RemainingTime - for pn in ivalues(PlayerNumber) do - local MetricsName = "RemainingTime" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG( Var "LoadingScreen", "RemainingTime"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - }; - end - for pn in ivalues(PlayerNumber) do - local MetricsName = "DeltaSeconds" .. PlayerNumberToString(pn); - t[#t+1] = LoadActor( THEME:GetPathG( Var "LoadingScreen", "DeltaSeconds"), pn ) .. { - InitCommand=function(self) - self:player(pn); - self:name(MetricsName); - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - }; - end - end; -end; --]] -t.InitCommand=cmd(SetUpdateFunction,UpdateTime); -return t +local t = Def.ActorFrame {}; +local function UpdateTime(self) + local c = self:GetChildren(); + for pn in ivalues(PlayerNumber) do + local vStats = STATSMAN:GetCurStageStats():GetPlayerStageStats( pn ); + local vTime; + local obj = self:GetChild( string.format("RemainingTime" .. PlayerNumberToString(pn) ) ); + if vStats and obj then + vTime = vStats:GetLifeRemainingSeconds() + obj:settext( SecondsToMMSSMsMs( vTime ) ); + end; + end; +end +if GAMESTATE:GetCurrentCourse() then + if GAMESTATE:GetCurrentCourse():GetCourseType() == "CourseType_Survival" then + -- RemainingTime + for pn in ivalues(PlayerNumber) do + local MetricsName = "RemainingTime" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG( Var "LoadingScreen", "RemainingTime"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + }; + end + for pn in ivalues(PlayerNumber) do + local MetricsName = "DeltaSeconds" .. PlayerNumberToString(pn); + t[#t+1] = LoadActor( THEME:GetPathG( Var "LoadingScreen", "DeltaSeconds"), pn ) .. { + InitCommand=function(self) + self:player(pn); + self:name(MetricsName); + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + }; + end + end; +end; --]] +t.InitCommand=cmd(SetUpdateFunction,UpdateTime); +return t diff --git a/Themes/default/BGAnimations/ScreenGameplay ready/default.lua b/Themes/default/BGAnimations/ScreenGameplay ready/default.lua index 04d4e33cfa..49afb3c004 100644 --- a/Themes/default/BGAnimations/ScreenGameplay ready/default.lua +++ b/Themes/default/BGAnimations/ScreenGameplay ready/default.lua @@ -1,4 +1,4 @@ -return LoadActor("ready") .. { - InitCommand=cmd(Center); - OnCommand=cmd(zoom,1.3;diffusealpha,0;bounceend,0.25;zoom,1;diffusealpha,1;linear,0.15;glow,BoostColor(Color("Orange"),1.75);decelerate,0.3;glow,1,1,1,0;sleep,1-0.45;linear,0.25;diffusealpha,0;); +return LoadActor("ready") .. { + InitCommand=cmd(Center); + OnCommand=cmd(zoom,1.3;diffusealpha,0;bounceend,0.25;zoom,1;diffusealpha,1;linear,0.15;glow,BoostColor(Color("Orange"),1.75);decelerate,0.3;glow,1,1,1,0;sleep,1-0.45;linear,0.25;diffusealpha,0;); }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua b/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua index 310877c318..9a81d425c1 100644 --- a/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua +++ b/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua @@ -1,13 +1,13 @@ --- how does installed song??? let's find out - -local t = Def.ActorFrame{ - LoadFont("Common Normal")..{ - Name="Header"; - InitCommand=cmd(x,SCREEN_LEFT+24;y,SCREEN_TOP+24;halign,0;diffuse,color("#CCCCCC");settext,Screen.String("BodyHeader");shadowlength,1;shadowcolor,HSV(40,0,0.6);diffusetopedge,color("#FFFFFF")); - OnCommand=cmd(queuecommand,"Anim"); - AnimCommand=cmd(cropright,1;faderight,1;addx,96;decelerate,1;addx,-96;skewx,-0.1;cropright,0;faderight,0;); - }; - -- todo: add explantion paragraph here (above the scroller) -}; - +-- how does installed song??? let's find out + +local t = Def.ActorFrame{ + LoadFont("Common Normal")..{ + Name="Header"; + InitCommand=cmd(x,SCREEN_LEFT+24;y,SCREEN_TOP+24;halign,0;diffuse,color("#CCCCCC");settext,Screen.String("BodyHeader");shadowlength,1;shadowcolor,HSV(40,0,0.6);diffusetopedge,color("#FFFFFF")); + OnCommand=cmd(queuecommand,"Anim"); + AnimCommand=cmd(cropright,1;faderight,1;addx,96;decelerate,1;addx,-96;skewx,-0.1;cropright,0;faderight,0;); + }; + -- todo: add explantion paragraph here (above the scroller) +}; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenHowToPlay background/default.lua b/Themes/default/BGAnimations/ScreenHowToPlay background/default.lua index f9550aee44..90b31246e0 100644 --- a/Themes/default/BGAnimations/ScreenHowToPlay background/default.lua +++ b/Themes/default/BGAnimations/ScreenHowToPlay background/default.lua @@ -1,4 +1,4 @@ -return LoadActor("bg.png") ..{ - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomtowidth,SCREEN_WIDTH;zoomtoheight,SCREEN_HEIGHT); - OnCommand=cmd(texcoordvelocity,0,-1;customtexturerect,0,0,SCREEN_WIDTH/self:GetWidth(),SCREEN_HEIGHT/self:GetHeight();diffuse,color("0.9,0.9,0.9,1")); +return LoadActor("bg.png") ..{ + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomtowidth,SCREEN_WIDTH;zoomtoheight,SCREEN_HEIGHT); + OnCommand=cmd(texcoordvelocity,0,-1;customtexturerect,0,0,SCREEN_WIDTH/self:GetWidth(),SCREEN_HEIGHT/self:GetHeight();diffuse,color("0.9,0.9,0.9,1")); }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenHowToPlay decorations.lua b/Themes/default/BGAnimations/ScreenHowToPlay decorations.lua index bca99f7f6c..65d556611d 100644 --- a/Themes/default/BGAnimations/ScreenHowToPlay decorations.lua +++ b/Themes/default/BGAnimations/ScreenHowToPlay decorations.lua @@ -1,3 +1,3 @@ -local t = LoadFallbackB(); -t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); +local t = LoadFallbackB(); +t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenHowToPlay overlay/default.lua b/Themes/default/BGAnimations/ScreenHowToPlay overlay/default.lua index 3f13c002ad..60254ad5d7 100644 --- a/Themes/default/BGAnimations/ScreenHowToPlay overlay/default.lua +++ b/Themes/default/BGAnimations/ScreenHowToPlay overlay/default.lua @@ -1,74 +1,74 @@ -return Def.ActorFrame { - Def.ActorFrame { - OnCommand=cmd(x,SCREEN_CENTER_X-20); - - -- Initial glow around receptors - LoadActor("tapglow") .. { - OnCommand=cmd(x,85;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapglow") .. { - OnCommand=cmd(x,275;y,95;zoom,0.7;rotationz,270;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapglow") .. { - OnCommand=cmd(x,212;y,95;zoom,0.7;rotationz,180;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapglow") .. { - OnCommand=cmd(x,148;y,95;zoom,0.7;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - - LoadActor("tapglow") .. { - OnCommand=cmd(x,148;y,95;zoom,0.7;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,9.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - - -- 2nd step UP - LoadActor("tapglow") .. { - OnCommand=cmd(x,212;y,95;zoom,0.7;rotationz,180;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,12.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - - -- 3rd step UP - LoadActor("tapglow") .. { - OnCommand=cmd(x,84;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,15.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - - -- 4th step jump - LoadActor("tapglow") .. { - OnCommand=cmd(x,85;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapglow") .. { - OnCommand=cmd(x,275;y,95;zoom,0.7;rotationz,270;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - - -- miss step - LoadActor("healthhilight") .. { - OnCommand=cmd(x,180;y,40;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,22.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - }; - - -- messages - LoadFont("Common Normal") .. { - Text = "How To Play StepMania", - InitCommand=cmd(zbuffer,1;z,20;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;shadowlength,1;strokecolor,Color("Outline")); - OnCommand=cmd(diffusealpha,0;zoom,4;sleep,0.0;linear,0.3;diffusealpha,1;zoom,1;sleep,1.8;linear,0.3;zoom,0.75;x,170;y,60); - }; - LoadActor("feet") .. { - OnCommand=cmd(zbuffer,1;z,20;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;addx,-SCREEN_WIDTH;sleep,2.4;decelerate,0.3;addx,SCREEN_WIDTH;sleep,2;linear,0.3;zoomy,0); - }; - LoadActor("tapmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,2;linear,0;diffusealpha,0); - }; - LoadActor("tapmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,9.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,12.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("tapmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,15.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("jumpmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); - }; - LoadActor("missmessage") .. { - OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,22.7;linear,0;diffusealpha,1;sleep,22.7;linear,0;diffusealpha,0); - }; -}; +return Def.ActorFrame { + Def.ActorFrame { + OnCommand=cmd(x,SCREEN_CENTER_X-20); + + -- Initial glow around receptors + LoadActor("tapglow") .. { + OnCommand=cmd(x,85;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapglow") .. { + OnCommand=cmd(x,275;y,95;zoom,0.7;rotationz,270;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapglow") .. { + OnCommand=cmd(x,212;y,95;zoom,0.7;rotationz,180;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapglow") .. { + OnCommand=cmd(x,148;y,95;zoom,0.7;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + + LoadActor("tapglow") .. { + OnCommand=cmd(x,148;y,95;zoom,0.7;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,9.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + + -- 2nd step UP + LoadActor("tapglow") .. { + OnCommand=cmd(x,212;y,95;zoom,0.7;rotationz,180;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,12.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + + -- 3rd step UP + LoadActor("tapglow") .. { + OnCommand=cmd(x,84;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,15.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + + -- 4th step jump + LoadActor("tapglow") .. { + OnCommand=cmd(x,85;y,95;zoom,0.7;rotationz,90;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapglow") .. { + OnCommand=cmd(x,275;y,95;zoom,0.7;rotationz,270;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + + -- miss step + LoadActor("healthhilight") .. { + OnCommand=cmd(x,180;y,40;diffuseshift;effectcolor1,1,0.93333,0.266666,0.4;effectcolor2,1,1,1,1;effectperiod,0.25;effectmagnitude,0,1,0;diffusealpha,0;sleep,22.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + }; + + -- messages + LoadFont("Common Normal") .. { + Text = "How To Play StepMania", + InitCommand=cmd(zbuffer,1;z,20;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;shadowlength,1;strokecolor,Color("Outline")); + OnCommand=cmd(diffusealpha,0;zoom,4;sleep,0.0;linear,0.3;diffusealpha,1;zoom,1;sleep,1.8;linear,0.3;zoom,0.75;x,170;y,60); + }; + LoadActor("feet") .. { + OnCommand=cmd(zbuffer,1;z,20;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;addx,-SCREEN_WIDTH;sleep,2.4;decelerate,0.3;addx,SCREEN_WIDTH;sleep,2;linear,0.3;zoomy,0); + }; + LoadActor("tapmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,6;linear,0;diffusealpha,1;sleep,2;linear,0;diffusealpha,0); + }; + LoadActor("tapmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,9.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,12.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("tapmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,15.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("jumpmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,18.7;linear,0;diffusealpha,1;sleep,1.7;linear,0;diffusealpha,0); + }; + LoadActor("missmessage") .. { + OnCommand=cmd(x,SCREEN_HEIGHT;y,280;diffusealpha,0;sleep,22.7;linear,0;diffusealpha,1;sleep,22.7;linear,0;diffusealpha,0); + }; +}; diff --git a/Themes/default/BGAnimations/ScreenInit decorations.lua b/Themes/default/BGAnimations/ScreenInit decorations.lua index bca99f7f6c..65d556611d 100644 --- a/Themes/default/BGAnimations/ScreenInit decorations.lua +++ b/Themes/default/BGAnimations/ScreenInit decorations.lua @@ -1,3 +1,3 @@ -local t = LoadFallbackB(); -t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); +local t = LoadFallbackB(); +t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenLogo decorations.lua b/Themes/default/BGAnimations/ScreenLogo decorations.lua index 00228e6624..1a520b1693 100644 --- a/Themes/default/BGAnimations/ScreenLogo decorations.lua +++ b/Themes/default/BGAnimations/ScreenLogo decorations.lua @@ -1,6 +1,6 @@ -local t = LoadFallbackB(); - -t[#t+1] = StandardDecorationFromFileOptional("Logo","Logo"); -t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); - +local t = LoadFallbackB(); + +t[#t+1] = StandardDecorationFromFileOptional("Logo","Logo"); +t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenMiniMenu underlay/default.lua b/Themes/default/BGAnimations/ScreenMiniMenu underlay/default.lua index 21cd48f127..a4f08559c1 100644 --- a/Themes/default/BGAnimations/ScreenMiniMenu underlay/default.lua +++ b/Themes/default/BGAnimations/ScreenMiniMenu underlay/default.lua @@ -1,5 +1,5 @@ -return Def.ActorFrame { - Def.Quad{ - InitCommand=cmd(scaletocover,-SCREEN_WIDTH*2,SCREEN_TOP,SCREEN_WIDTH*2,SCREEN_BOTTOM;diffuse,color("0,0,0,0.5")); - }; +return Def.ActorFrame { + Def.Quad{ + InitCommand=cmd(scaletocover,-SCREEN_WIDTH*2,SCREEN_TOP,SCREEN_WIDTH*2,SCREEN_BOTTOM;diffuse,color("0,0,0,0.5")); + }; }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenNetSelectMusic decorations.lua b/Themes/default/BGAnimations/ScreenNetSelectMusic decorations.lua index 60d155a443..02168d5e29 100644 --- a/Themes/default/BGAnimations/ScreenNetSelectMusic decorations.lua +++ b/Themes/default/BGAnimations/ScreenNetSelectMusic decorations.lua @@ -1,5 +1,5 @@ -local t = LoadFallbackB(); - -t[#t+1] = StandardDecorationFromFileOptional("BPMLabel","BPMLabel"); -t[#t+1] = StandardDecorationFromFileOptional("DifficultyDisplay","DifficultyDisplay"); +local t = LoadFallbackB(); + +t[#t+1] = StandardDecorationFromFileOptional("BPMLabel","BPMLabel"); +t[#t+1] = StandardDecorationFromFileOptional("DifficultyDisplay","DifficultyDisplay"); return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenPlayerOptions background.lua b/Themes/default/BGAnimations/ScreenPlayerOptions background.lua index 5ac433168e..a02c0291d9 100644 --- a/Themes/default/BGAnimations/ScreenPlayerOptions background.lua +++ b/Themes/default/BGAnimations/ScreenPlayerOptions background.lua @@ -1,30 +1,30 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.Sprite { - Condition=not GAMESTATE:IsCourseMode(); - OnCommand=function(self) - if GAMESTATE:GetCurrentSong() then - self:LoadBackground( GAMESTATE:GetCurrentSong():GetBackgroundPath() ); - self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT ); - (cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self); - else - self:visible(false); - end - end; - }; - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00");diffusealpha,0.45); - }; ---[[ LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_grid")).. { - InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); - OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Black");diffuseshift;effecttiming,(1/8)*4,0,(7/8)*4,0;effectclock,'beatnooffset'; - effectcolor2,Color("Black");effectcolor1,Colors.Alpha(Color("Black"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480;diffusealpha,0.345); - }; --]] - LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_bg top")) .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); - }; -}; +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.Sprite { + Condition=not GAMESTATE:IsCourseMode(); + OnCommand=function(self) + if GAMESTATE:GetCurrentSong() then + self:LoadBackground( GAMESTATE:GetCurrentSong():GetBackgroundPath() ); + self:scaletoclipped( SCREEN_WIDTH+1,SCREEN_HEIGHT ); + (cmd(fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480))(self); + else + self:visible(false); + end + end; + }; + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00");diffusealpha,0.45); + }; +--[[ LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_grid")).. { + InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); + OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Black");diffuseshift;effecttiming,(1/8)*4,0,(7/8)*4,0;effectclock,'beatnooffset'; + effectcolor2,Color("Black");effectcolor1,Colors.Alpha(Color("Black"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480;diffusealpha,0.345); + }; --]] + LoadActor(THEME:GetPathB("ScreenWithMenuElements","background/_bg top")) .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); + }; +}; return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenPlayerOptions out.lua b/Themes/default/BGAnimations/ScreenPlayerOptions out.lua index 181ed3ff0b..3f9c2a7856 100644 --- a/Themes/default/BGAnimations/ScreenPlayerOptions out.lua +++ b/Themes/default/BGAnimations/ScreenPlayerOptions out.lua @@ -1,39 +1,39 @@ -if PREFSMAN:GetPreference( "ShowSongOptions" ) ~= "Maybe_Ask" then - return LoadActor( THEME:GetPathB("Screen", "out") ); -end - -local t = Def.ActorFrame { - LoadActor( THEME:GetPathB("Screen", "out") ); - - LoadFont( "common normal" ) .. { - InitCommand=cmd(settext,"Press &START; for more options";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+100;visible,false); - AskForGoToOptionsCommand=cmd( - visible,true; - diffusealpha,0; - linear,0.15; - zoomy,1; - diffusealpha,1; - sleep,1; - linear,0.15; - diffusealpha,0; - zoomy,0; - ); - GoToOptionsCommand=cmd(visible,false); - }; - LoadFont( "common normal" ) .. { - InitCommand=cmd(settext,"entering options...";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+100;visible,false); - AskForGoToOptionsCommand=cmd( - visible,false; - linear,0.15; - zoomy,1; - diffusealpha,1; - sleep,1; - linear,0.15; - diffusealpha,0; - zoomy,0; - ); - GoToOptionsCommand=cmd(visible,true); - }; -}; - +if PREFSMAN:GetPreference( "ShowSongOptions" ) ~= "Maybe_Ask" then + return LoadActor( THEME:GetPathB("Screen", "out") ); +end + +local t = Def.ActorFrame { + LoadActor( THEME:GetPathB("Screen", "out") ); + + LoadFont( "common normal" ) .. { + InitCommand=cmd(settext,"Press &START; for more options";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+100;visible,false); + AskForGoToOptionsCommand=cmd( + visible,true; + diffusealpha,0; + linear,0.15; + zoomy,1; + diffusealpha,1; + sleep,1; + linear,0.15; + diffusealpha,0; + zoomy,0; + ); + GoToOptionsCommand=cmd(visible,false); + }; + LoadFont( "common normal" ) .. { + InitCommand=cmd(settext,"entering options...";x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+100;visible,false); + AskForGoToOptionsCommand=cmd( + visible,false; + linear,0.15; + zoomy,1; + diffusealpha,1; + sleep,1; + linear,0.15; + diffusealpha,0; + zoomy,0; + ); + GoToOptionsCommand=cmd(visible,true); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenQuickSetupOverview decorations/default.lua b/Themes/default/BGAnimations/ScreenQuickSetupOverview decorations/default.lua index 642da738da..5db3d61be1 100644 --- a/Themes/default/BGAnimations/ScreenQuickSetupOverview decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenQuickSetupOverview decorations/default.lua @@ -1,11 +1,11 @@ -local t = LoadFallbackB(); - -t[#t+1] = LoadFont("Common Normal") .. { - Name="Explanation"; - Text=THEME:GetString(Var "LoadingScreen","Explanation"); - InitCommand=function(self) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; -}; - +local t = LoadFallbackB(); + +t[#t+1] = LoadFont("Common Normal") .. { + Name="Explanation"; + Text=THEME:GetString(Var "LoadingScreen","Explanation"); + InitCommand=function(self) + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; +}; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua b/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua index cd35ac278c..ccb91250a8 100644 --- a/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua @@ -1,244 +1,244 @@ -local t = LoadFallbackB(); - --- Legacy StepMania 4 Function -local function StepsDisplay(pn) - local function set(self, player) - self:SetFromGameState( player ); - end - - local t = Def.StepsDisplay { - InitCommand=cmd(Load,"StepsDisplay",GAMESTATE:GetPlayerState(pn);); - }; - - if pn == PLAYER_1 then - t.CurrentStepsP1ChangedMessageCommand=function(self) set(self, pn); end; - t.CurrentTrailP1ChangedMessageCommand=function(self) set(self, pn); end; - else - t.CurrentStepsP2ChangedMessageCommand=function(self) set(self, pn); end; - t.CurrentTrailP2ChangedMessageCommand=function(self) set(self, pn); end; - end - - return t; -end -t[#t+1] = StandardDecorationFromFileOptional("AlternateHelpDisplay","AlternateHelpDisplay"); - -local function PercentScore(pn) - local t = LoadFont("Common normal")..{ - InitCommand=cmd(zoom,0.625;shadowlength,1); - BeginCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local SongOrCourse, StepsOrTrail; - if GAMESTATE:IsCourseMode() then - SongOrCourse = GAMESTATE:GetCurrentCourse(); - StepsOrTrail = GAMESTATE:GetCurrentTrail(pn); - else - SongOrCourse = GAMESTATE:GetCurrentSong(); - StepsOrTrail = GAMESTATE:GetCurrentSteps(pn); - end; - - local profile, scorelist; - local text = ""; - if SongOrCourse and StepsOrTrail then - local st = StepsOrTrail:GetStepsType(); - local diff = StepsOrTrail:GetDifficulty(); - local courseType = GAMESTATE:IsCourseMode() and SongOrCourse:GetCourseType() or nil; - local cd = GetCustomDifficulty(st, diff, courseType); - self:diffuse(CustomDifficultyToColor(cd)); - self:shadowcolor(CustomDifficultyToDarkColor(cd)); - - if PROFILEMAN:IsPersistentProfile(pn) then - -- player profile - profile = PROFILEMAN:GetProfile(pn); - else - -- machine profile - profile = PROFILEMAN:GetMachineProfile(); - end; - - scorelist = profile:GetHighScoreList(SongOrCourse,StepsOrTrail); - assert(scorelist) - local scores = scorelist:GetHighScores(); - local topscore = scores[1]; - if topscore then - text = string.format("%.2f%%", topscore:GetPercentDP()*100.0); - -- 100% hack - if text == "100.00%" then - text = "100%"; - end; - else - text = string.format("%.2f%%", 0); - end; - else - text = ""; - end; - self:settext(text); - end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - }; - - if pn == PLAYER_1 then - t.CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); - t.CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - else - t.CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); - t.CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); - end - - return t; -end - --- Legacy StepMania 4 Function -for pn in ivalues(PlayerNumber) do - local MetricsName = "StepsDisplay" .. PlayerNumberToString(pn); - t[#t+1] = StepsDisplay(pn) .. { - InitCommand=function(self) self:player(pn); self:name(MetricsName); ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); end; - PlayerJoinedMessageCommand=function(self, params) - if params.Player == pn then - self:visible(true); - (cmd(zoom,0;bounceend,0.3;zoom,1))(self); - end; - end; - PlayerUnjoinedMessageCommand=function(self, params) - if params.Player == pn then - self:visible(true); - (cmd(bouncebegin,0.3;zoom,0))(self); - end; - end; - }; - if ShowStandardDecoration("PercentScore"..ToEnumShortString(pn)) then - t[#t+1] = StandardDecorationFromTable("PercentScore"..ToEnumShortString(pn), PercentScore(pn)); - end; -end - -t[#t+1] = StandardDecorationFromFileOptional("BannerFrame","BannerFrame"); -t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP1","PaneDisplayFrame"); -t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP2","PaneDisplayFrame"); -t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP1","PaneDisplayTextP1"); -t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP2","PaneDisplayTextP2"); -t[#t+1] = StandardDecorationFromFileOptional("DifficultyList","DifficultyList"); -t[#t+1] = StandardDecorationFromFileOptional("CourseContentsList","CourseContentsList"); -t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay"); -t[#t+1] = StandardDecorationFromFileOptional("BPMLabel","BPMLabel"); ---[[ t[#t+1] = StandardDecorationFromFileOptional("NegativeDisplay","NegativeDisplay") .. { -}; --]] - -t[#t+1] = StandardDecorationFromFileOptional("SongTime","SongTime") .. { - SetCommand=function(self) - local curSelection = nil; - local length = 0.0; - if GAMESTATE:IsCourseMode() then - curSelection = GAMESTATE:GetCurrentCourse(); - self:playcommand("Reset"); - if curSelection then - local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); - if trail then - length = TrailUtil.GetTotalSeconds(trail); - else - length = 0.0; - end; - else - length = 0.0; - end; - else - curSelection = GAMESTATE:GetCurrentSong(); - self:playcommand("Reset"); - if curSelection then - length = curSelection:MusicLengthSeconds(); - if curSelection:IsLong() then - self:playcommand("Long"); - elseif curSelection:IsMarathon() then - self:playcommand("Marathon"); - else - self:playcommand("Reset"); - end - else - length = 0.0; - self:playcommand("Reset"); - end; - end; - self:settext( SecondsToMSS(length) ); - end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); -} - -if not GAMESTATE:IsCourseMode() then - t[#t+1] = StandardDecorationFromFileOptional("NewSong","NewSong") .. { - -- ShowCommand=THEME:GetMetric(Var "LoadingScreen", "NewSongShowCommand" ); - -- HideCommand=THEME:GetMetric(Var "LoadingScreen", "NewSongHideCommand" ); - InitCommand=cmd(playcommand,"Set"); - BeginCommand=cmd(playcommand,"Set"); - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - -- local pTargetProfile; - local sSong; - -- Start! - if GAMESTATE:GetCurrentSong() then - if PROFILEMAN:IsSongNew(GAMESTATE:GetCurrentSong()) then - self:playcommand("Show"); - else - self:playcommand("Hide"); - end - else - self:playcommand("Hide"); - end - end; - }; - t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); -end; - -if GAMESTATE:IsCourseMode() then - t[#t+1] = StandardDecorationFromFileOptional("NumCourseSongs","NumCourseSongs")..{ - InitCommand=cmd(horizalign,right); - SetCommand=function(self) - local curSelection= nil; - local sAppend = ""; - if GAMESTATE:IsCourseMode() then - curSelection = GAMESTATE:GetCurrentCourse(); - if curSelection then - sAppend = (curSelection:GetEstimatedNumStages() == 1) and "Stage" or "Stages"; - self:visible(true); - self:settext( curSelection:GetEstimatedNumStages() .. " " .. sAppend); - else - self:visible(false); - end; - else - self:visible(false); - end; - end; - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - }; -end - -t[#t+1] = StandardDecorationFromFileOptional("DifficultyDisplay","DifficultyDisplay"); -t[#t+1] = StandardDecorationFromFileOptional("SortOrderFrame","SortOrderFrame") .. { ---[[ BeginCommand=cmd(playcommand,"Set"); - SortOrderChangedMessageCommand=cmd(playcommand,"Set";); - SetCommand=function(self) - local s = SortOrderToLocalizedString( GAMESTATE:GetSortOrder() ); - self:settext( s ); - self:playcommand("Sort"); - end; --]] -}; -t[#t+1] = StandardDecorationFromFileOptional("SortOrder","SortOrderText") .. { - BeginCommand=cmd(playcommand,"Set"); - SortOrderChangedMessageCommand=cmd(playcommand,"Set";); - SetCommand=function(self) - local s = SortOrderToLocalizedString( GAMESTATE:GetSortOrder() ); - self:settext( s ); - self:playcommand("Sort"); - end; -}; -t[#t+1] = StandardDecorationFromFileOptional("SongOptionsFrame","SongOptionsFrame") .. { - ShowPressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameShowCommand"); - ShowEnteringOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameEnterCommand"); - HidePressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameHideCommand"); -}; -t[#t+1] = StandardDecorationFromFileOptional("SongOptions","SongOptionsText") .. { - ShowPressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsShowCommand"); - ShowEnteringOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsEnterCommand"); - HidePressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsHideCommand"); -}; +local t = LoadFallbackB(); + +-- Legacy StepMania 4 Function +local function StepsDisplay(pn) + local function set(self, player) + self:SetFromGameState( player ); + end + + local t = Def.StepsDisplay { + InitCommand=cmd(Load,"StepsDisplay",GAMESTATE:GetPlayerState(pn);); + }; + + if pn == PLAYER_1 then + t.CurrentStepsP1ChangedMessageCommand=function(self) set(self, pn); end; + t.CurrentTrailP1ChangedMessageCommand=function(self) set(self, pn); end; + else + t.CurrentStepsP2ChangedMessageCommand=function(self) set(self, pn); end; + t.CurrentTrailP2ChangedMessageCommand=function(self) set(self, pn); end; + end + + return t; +end +t[#t+1] = StandardDecorationFromFileOptional("AlternateHelpDisplay","AlternateHelpDisplay"); + +local function PercentScore(pn) + local t = LoadFont("Common normal")..{ + InitCommand=cmd(zoom,0.625;shadowlength,1); + BeginCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local SongOrCourse, StepsOrTrail; + if GAMESTATE:IsCourseMode() then + SongOrCourse = GAMESTATE:GetCurrentCourse(); + StepsOrTrail = GAMESTATE:GetCurrentTrail(pn); + else + SongOrCourse = GAMESTATE:GetCurrentSong(); + StepsOrTrail = GAMESTATE:GetCurrentSteps(pn); + end; + + local profile, scorelist; + local text = ""; + if SongOrCourse and StepsOrTrail then + local st = StepsOrTrail:GetStepsType(); + local diff = StepsOrTrail:GetDifficulty(); + local courseType = GAMESTATE:IsCourseMode() and SongOrCourse:GetCourseType() or nil; + local cd = GetCustomDifficulty(st, diff, courseType); + self:diffuse(CustomDifficultyToColor(cd)); + self:shadowcolor(CustomDifficultyToDarkColor(cd)); + + if PROFILEMAN:IsPersistentProfile(pn) then + -- player profile + profile = PROFILEMAN:GetProfile(pn); + else + -- machine profile + profile = PROFILEMAN:GetMachineProfile(); + end; + + scorelist = profile:GetHighScoreList(SongOrCourse,StepsOrTrail); + assert(scorelist) + local scores = scorelist:GetHighScores(); + local topscore = scores[1]; + if topscore then + text = string.format("%.2f%%", topscore:GetPercentDP()*100.0); + -- 100% hack + if text == "100.00%" then + text = "100%"; + end; + else + text = string.format("%.2f%%", 0); + end; + else + text = ""; + end; + self:settext(text); + end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + }; + + if pn == PLAYER_1 then + t.CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + t.CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + else + t.CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + t.CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + end + + return t; +end + +-- Legacy StepMania 4 Function +for pn in ivalues(PlayerNumber) do + local MetricsName = "StepsDisplay" .. PlayerNumberToString(pn); + t[#t+1] = StepsDisplay(pn) .. { + InitCommand=function(self) self:player(pn); self:name(MetricsName); ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); end; + PlayerJoinedMessageCommand=function(self, params) + if params.Player == pn then + self:visible(true); + (cmd(zoom,0;bounceend,0.3;zoom,1))(self); + end; + end; + PlayerUnjoinedMessageCommand=function(self, params) + if params.Player == pn then + self:visible(true); + (cmd(bouncebegin,0.3;zoom,0))(self); + end; + end; + }; + if ShowStandardDecoration("PercentScore"..ToEnumShortString(pn)) then + t[#t+1] = StandardDecorationFromTable("PercentScore"..ToEnumShortString(pn), PercentScore(pn)); + end; +end + +t[#t+1] = StandardDecorationFromFileOptional("BannerFrame","BannerFrame"); +t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP1","PaneDisplayFrame"); +t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP2","PaneDisplayFrame"); +t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP1","PaneDisplayTextP1"); +t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP2","PaneDisplayTextP2"); +t[#t+1] = StandardDecorationFromFileOptional("DifficultyList","DifficultyList"); +t[#t+1] = StandardDecorationFromFileOptional("CourseContentsList","CourseContentsList"); +t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay"); +t[#t+1] = StandardDecorationFromFileOptional("BPMLabel","BPMLabel"); +--[[ t[#t+1] = StandardDecorationFromFileOptional("NegativeDisplay","NegativeDisplay") .. { +}; --]] + +t[#t+1] = StandardDecorationFromFileOptional("SongTime","SongTime") .. { + SetCommand=function(self) + local curSelection = nil; + local length = 0.0; + if GAMESTATE:IsCourseMode() then + curSelection = GAMESTATE:GetCurrentCourse(); + self:playcommand("Reset"); + if curSelection then + local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); + if trail then + length = TrailUtil.GetTotalSeconds(trail); + else + length = 0.0; + end; + else + length = 0.0; + end; + else + curSelection = GAMESTATE:GetCurrentSong(); + self:playcommand("Reset"); + if curSelection then + length = curSelection:MusicLengthSeconds(); + if curSelection:IsLong() then + self:playcommand("Long"); + elseif curSelection:IsMarathon() then + self:playcommand("Marathon"); + else + self:playcommand("Reset"); + end + else + length = 0.0; + self:playcommand("Reset"); + end; + end; + self:settext( SecondsToMSS(length) ); + end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); +} + +if not GAMESTATE:IsCourseMode() then + t[#t+1] = StandardDecorationFromFileOptional("NewSong","NewSong") .. { + -- ShowCommand=THEME:GetMetric(Var "LoadingScreen", "NewSongShowCommand" ); + -- HideCommand=THEME:GetMetric(Var "LoadingScreen", "NewSongHideCommand" ); + InitCommand=cmd(playcommand,"Set"); + BeginCommand=cmd(playcommand,"Set"); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + -- local pTargetProfile; + local sSong; + -- Start! + if GAMESTATE:GetCurrentSong() then + if PROFILEMAN:IsSongNew(GAMESTATE:GetCurrentSong()) then + self:playcommand("Show"); + else + self:playcommand("Hide"); + end + else + self:playcommand("Hide"); + end + end; + }; + t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); +end; + +if GAMESTATE:IsCourseMode() then + t[#t+1] = StandardDecorationFromFileOptional("NumCourseSongs","NumCourseSongs")..{ + InitCommand=cmd(horizalign,right); + SetCommand=function(self) + local curSelection= nil; + local sAppend = ""; + if GAMESTATE:IsCourseMode() then + curSelection = GAMESTATE:GetCurrentCourse(); + if curSelection then + sAppend = (curSelection:GetEstimatedNumStages() == 1) and "Stage" or "Stages"; + self:visible(true); + self:settext( curSelection:GetEstimatedNumStages() .. " " .. sAppend); + else + self:visible(false); + end; + else + self:visible(false); + end; + end; + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + }; +end + +t[#t+1] = StandardDecorationFromFileOptional("DifficultyDisplay","DifficultyDisplay"); +t[#t+1] = StandardDecorationFromFileOptional("SortOrderFrame","SortOrderFrame") .. { +--[[ BeginCommand=cmd(playcommand,"Set"); + SortOrderChangedMessageCommand=cmd(playcommand,"Set";); + SetCommand=function(self) + local s = SortOrderToLocalizedString( GAMESTATE:GetSortOrder() ); + self:settext( s ); + self:playcommand("Sort"); + end; --]] +}; +t[#t+1] = StandardDecorationFromFileOptional("SortOrder","SortOrderText") .. { + BeginCommand=cmd(playcommand,"Set"); + SortOrderChangedMessageCommand=cmd(playcommand,"Set";); + SetCommand=function(self) + local s = SortOrderToLocalizedString( GAMESTATE:GetSortOrder() ); + self:settext( s ); + self:playcommand("Sort"); + end; +}; +t[#t+1] = StandardDecorationFromFileOptional("SongOptionsFrame","SongOptionsFrame") .. { + ShowPressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameShowCommand"); + ShowEnteringOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameEnterCommand"); + HidePressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsFrameHideCommand"); +}; +t[#t+1] = StandardDecorationFromFileOptional("SongOptions","SongOptionsText") .. { + ShowPressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsShowCommand"); + ShowEnteringOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsEnterCommand"); + HidePressStartForOptionsCommand=THEME:GetMetric(Var "LoadingScreen","SongOptionsHideCommand"); +}; return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenSelectPlayMode underlay.lua b/Themes/default/BGAnimations/ScreenSelectPlayMode underlay.lua index 3758173bda..30d92730d8 100644 --- a/Themes/default/BGAnimations/ScreenSelectPlayMode underlay.lua +++ b/Themes/default/BGAnimations/ScreenSelectPlayMode underlay.lua @@ -1,3 +1,3 @@ -local t = Def.ActorFrame {}; -t[#t+1] = StandardDecorationFromFileOptional("BackgroundFrame","BackgroundFrame"); +local t = Def.ActorFrame {}; +t[#t+1] = StandardDecorationFromFileOptional("BackgroundFrame","BackgroundFrame"); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua index 2094ef1054..8355b85580 100644 --- a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua @@ -1,299 +1,299 @@ -function GetLocalProfiles() - local ret = {}; - - for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do - local profile=PROFILEMAN:GetLocalProfileFromIndex(p); - local item = Def.ActorFrame { ---[[ Def.Quad { - InitCommand=cmd(zoomto,200,1;y,40/2); - OnCommand=cmd(diffuse,Color('Outline');); - }; --]] - LoadFont("Common Normal") .. { - Text=profile:GetDisplayName(); - InitCommand=cmd(shadowlength,1;y,-10;zoom,1;ztest,true); - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(shadowlength,1;y,8;zoom,0.5;vertspacing,-8;ztest,true); - BeginCommand=function(self) - local numSongsPlayed = profile:GetNumTotalSongsPlayed(); - local s = numSongsPlayed == 1 and "Song" or "Songs"; - -- todo: localize - self:settext( numSongsPlayed.." "..s.." Played" ); - end; - }; - }; - table.insert( ret, item ); - end; - - return ret; -end; - -function LoadCard(cColor) - local t = Def.ActorFrame { - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { - InitCommand=cmd(diffuse,cColor); - }; - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); - }; - return t -end -function LoadPlayerStuff(Player) - local ret = {}; - - local pn = (Player == PLAYER_1) and 1 or 2; - ---[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { - Name = 'BigFrame'; - }; --]] - local t = Def.ActorFrame { - Name = 'JoinFrame'; - LoadCard(Color('Orange')); ---[[ Def.Quad { - InitCommand=cmd(zoomto,200+4,230+4); - OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); - }; - Def.Quad { - InitCommand=cmd(zoomto,200,230); - OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); - }; --]] - LoadFont("Common Normal") .. { - Text="Press &START; to join."; - InitCommand=cmd(shadowlength,1); - OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); - }; - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = 'BigFrame'; - LoadCard(PlayerColor(Player)); - }; - table.insert( ret, t ); - ---[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { - Name = 'SmallFrame'; - }; --]] - t = Def.ActorFrame { - Name = 'SmallFrame'; ---[[ Def.Quad { - InitCommand=cmd(zoomto,170+4,32+4); - OnCommand=cmd(shadowlength,1); - }; --]] - InitCommand=cmd(y,-2); - Def.Quad { - InitCommand=cmd(zoomto,200-10,40+2); - OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,40); - OnCommand=cmd(diffuse,PlayerColor(Player);fadeleft,0.25;faderight,0.25;glow,color("1,1,1,0.25")); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,40;y,-40/2+20); - OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); - }; - Def.Quad { - InitCommand=cmd(zoomto,200-10,1;y,-40/2+1); - OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); - }; - }; - table.insert( ret, t ); - - t = Def.ActorScroller{ - Name = 'Scroller'; - NumItemsToDraw=6; --- InitCommand=cmd(y,-230/2+20;); - OnCommand=cmd(y,1;SetFastCatchup,true;SetMask,200,58;SetSecondsPerItem,0.15); - TransformFunction=function(self, offset, itemIndex, numItems) - local focus = scale(math.abs(offset),0,2,1,0); - self:visible(false); - self:y(math.floor( offset*40 )); --- self:zoomy( focus ); --- self:z(-math.abs(offset)); --- self:zoom(focus); - end; - children = GetLocalProfiles(); - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = "EffectFrame"; - --[[ Def.Quad { - InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); - }; - Def.Quad { - InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); - }; --]] - }; - table.insert( ret, t ); ---[[ t = Def.BitmapText { - OnCommand = cmd(y,160); - Name = 'SelectedProfileText'; - Font = "Common Normal"; - Text = 'No profile'; - }; --]] - t = LoadFont("Common Normal") .. { - Name = 'SelectedProfileText'; - --InitCommand=cmd(y,160;shadowlength,1;diffuse,PlayerColor(Player)); - InitCommand=cmd(y,160;shadowlength,1;); - }; - table.insert( ret, t ); - - return ret; -end; - -function UpdateInternal3(self, Player) - local pn = (Player == PLAYER_1) and 1 or 2; - local frame = self:GetChild(string.format('P%uFrame', pn)); - local scroller = frame:GetChild('Scroller'); - local seltext = frame:GetChild('SelectedProfileText'); - local joinframe = frame:GetChild('JoinFrame'); - local smallframe = frame:GetChild('SmallFrame'); - local bigframe = frame:GetChild('BigFrame'); - - if GAMESTATE:IsHumanPlayer(Player) then - frame:visible(true); - if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then - --using profile if any - joinframe:visible(false); - smallframe:visible(true); - bigframe:visible(true); - seltext:visible(true); - scroller:visible(true); - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); - if ind > 0 then - scroller:SetDestinationItem(ind-1); - seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); - else - if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then - scroller:SetDestinationItem(0); - self:queuecommand('UpdateInternal2'); - else - joinframe:visible(true); - smallframe:visible(false); - bigframe:visible(false); - scroller:visible(false); - seltext:settext('No profile'); - end; - end; - else - --using card - smallframe:visible(false); - scroller:visible(false); - seltext:settext('CARD'); - SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); - end; - else - joinframe:visible(true); - scroller:visible(false); - seltext:visible(false); - smallframe:visible(false); - bigframe:visible(false); - end; -end; - -local t = Def.ActorFrame { - - StorageDevicesChangedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - CodeMessageCommand = function(self, params) - if params.Name == 'Start' or params.Name == 'Center' then - MESSAGEMAN:Broadcast("StartButton"); - if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); - else - SCREENMAN:GetTopScreen():Finish(); - end; - end; - if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 1 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 0 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Back' then - if GAMESTATE:GetNumPlayersEnabled()==0 then - SCREENMAN:GetTopScreen():Cancel(); - else - MESSAGEMAN:Broadcast("BackButton"); - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); - end; - end; - end; - - PlayerJoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - PlayerUnjoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - OnCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - UpdateInternal2Command=function(self) - UpdateInternal3(self, PLAYER_1); - UpdateInternal3(self, PLAYER_2); - end; - - children = { - Def.ActorFrame { - Name = 'P1Frame'; - InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); - OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); - OffCommand=cmd(bouncebegin,0.35;zoom,0); - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_1 then - (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); - end; - end; - children = LoadPlayerStuff(PLAYER_1); - }; - Def.ActorFrame { - Name = 'P2Frame'; - InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); - OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); - OffCommand=cmd(bouncebegin,0.35;zoom,0); - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_2 then - (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); - end; - end; - children = LoadPlayerStuff(PLAYER_2); - }; - -- sounds - LoadActor( THEME:GetPathS("Common","start") )..{ - StartButtonMessageCommand=cmd(play); - }; - LoadActor( THEME:GetPathS("Common","cancel") )..{ - BackButtonMessageCommand=cmd(play); - }; - LoadActor( THEME:GetPathS("Common","value") )..{ - DirectionButtonMessageCommand=cmd(play); - }; - }; -}; - -return t; +function GetLocalProfiles() + local ret = {}; + + for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do + local profile=PROFILEMAN:GetLocalProfileFromIndex(p); + local item = Def.ActorFrame { +--[[ Def.Quad { + InitCommand=cmd(zoomto,200,1;y,40/2); + OnCommand=cmd(diffuse,Color('Outline');); + }; --]] + LoadFont("Common Normal") .. { + Text=profile:GetDisplayName(); + InitCommand=cmd(shadowlength,1;y,-10;zoom,1;ztest,true); + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(shadowlength,1;y,8;zoom,0.5;vertspacing,-8;ztest,true); + BeginCommand=function(self) + local numSongsPlayed = profile:GetNumTotalSongsPlayed(); + local s = numSongsPlayed == 1 and "Song" or "Songs"; + -- todo: localize + self:settext( numSongsPlayed.." "..s.." Played" ); + end; + }; + }; + table.insert( ret, item ); + end; + + return ret; +end; + +function LoadCard(cColor) + local t = Def.ActorFrame { + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { + InitCommand=cmd(diffuse,cColor); + }; + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); + }; + return t +end +function LoadPlayerStuff(Player) + local ret = {}; + + local pn = (Player == PLAYER_1) and 1 or 2; + +--[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { + Name = 'BigFrame'; + }; --]] + local t = Def.ActorFrame { + Name = 'JoinFrame'; + LoadCard(Color('Orange')); +--[[ Def.Quad { + InitCommand=cmd(zoomto,200+4,230+4); + OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,230); + OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); + }; --]] + LoadFont("Common Normal") .. { + Text="Press &START; to join."; + InitCommand=cmd(shadowlength,1); + OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = 'BigFrame'; + LoadCard(PlayerColor(Player)); + }; + table.insert( ret, t ); + +--[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { + Name = 'SmallFrame'; + }; --]] + t = Def.ActorFrame { + Name = 'SmallFrame'; +--[[ Def.Quad { + InitCommand=cmd(zoomto,170+4,32+4); + OnCommand=cmd(shadowlength,1); + }; --]] + InitCommand=cmd(y,-2); + Def.Quad { + InitCommand=cmd(zoomto,200-10,40+2); + OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,40); + OnCommand=cmd(diffuse,PlayerColor(Player);fadeleft,0.25;faderight,0.25;glow,color("1,1,1,0.25")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,40;y,-40/2+20); + OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); + }; + Def.Quad { + InitCommand=cmd(zoomto,200-10,1;y,-40/2+1); + OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorScroller{ + Name = 'Scroller'; + NumItemsToDraw=6; +-- InitCommand=cmd(y,-230/2+20;); + OnCommand=cmd(y,1;SetFastCatchup,true;SetMask,200,58;SetSecondsPerItem,0.15); + TransformFunction=function(self, offset, itemIndex, numItems) + local focus = scale(math.abs(offset),0,2,1,0); + self:visible(false); + self:y(math.floor( offset*40 )); +-- self:zoomy( focus ); +-- self:z(-math.abs(offset)); +-- self:zoom(focus); + end; + children = GetLocalProfiles(); + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = "EffectFrame"; + --[[ Def.Quad { + InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; --]] + }; + table.insert( ret, t ); +--[[ t = Def.BitmapText { + OnCommand = cmd(y,160); + Name = 'SelectedProfileText'; + Font = "Common Normal"; + Text = 'No profile'; + }; --]] + t = LoadFont("Common Normal") .. { + Name = 'SelectedProfileText'; + --InitCommand=cmd(y,160;shadowlength,1;diffuse,PlayerColor(Player)); + InitCommand=cmd(y,160;shadowlength,1;); + }; + table.insert( ret, t ); + + return ret; +end; + +function UpdateInternal3(self, Player) + local pn = (Player == PLAYER_1) and 1 or 2; + local frame = self:GetChild(string.format('P%uFrame', pn)); + local scroller = frame:GetChild('Scroller'); + local seltext = frame:GetChild('SelectedProfileText'); + local joinframe = frame:GetChild('JoinFrame'); + local smallframe = frame:GetChild('SmallFrame'); + local bigframe = frame:GetChild('BigFrame'); + + if GAMESTATE:IsHumanPlayer(Player) then + frame:visible(true); + if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then + --using profile if any + joinframe:visible(false); + smallframe:visible(true); + bigframe:visible(true); + seltext:visible(true); + scroller:visible(true); + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); + if ind > 0 then + scroller:SetDestinationItem(ind-1); + seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); + else + if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then + scroller:SetDestinationItem(0); + self:queuecommand('UpdateInternal2'); + else + joinframe:visible(true); + smallframe:visible(false); + bigframe:visible(false); + scroller:visible(false); + seltext:settext('No profile'); + end; + end; + else + --using card + smallframe:visible(false); + scroller:visible(false); + seltext:settext('CARD'); + SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); + end; + else + joinframe:visible(true); + scroller:visible(false); + seltext:visible(false); + smallframe:visible(false); + bigframe:visible(false); + end; +end; + +local t = Def.ActorFrame { + + StorageDevicesChangedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + CodeMessageCommand = function(self, params) + if params.Name == 'Start' or params.Name == 'Center' then + MESSAGEMAN:Broadcast("StartButton"); + if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); + else + SCREENMAN:GetTopScreen():Finish(); + end; + end; + if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 1 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 0 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Back' then + if GAMESTATE:GetNumPlayersEnabled()==0 then + SCREENMAN:GetTopScreen():Cancel(); + else + MESSAGEMAN:Broadcast("BackButton"); + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); + end; + end; + end; + + PlayerJoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + PlayerUnjoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + OnCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + UpdateInternal2Command=function(self) + UpdateInternal3(self, PLAYER_1); + UpdateInternal3(self, PLAYER_2); + end; + + children = { + Def.ActorFrame { + Name = 'P1Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_1 then + (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_1); + }; + Def.ActorFrame { + Name = 'P2Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_2 then + (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_2); + }; + -- sounds + LoadActor( THEME:GetPathS("Common","start") )..{ + StartButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","cancel") )..{ + BackButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","value") )..{ + DirectionButtonMessageCommand=cmd(play); + }; + }; +}; + +return t; diff --git a/Themes/default/BGAnimations/ScreenStageInformation underlay/default.lua b/Themes/default/BGAnimations/ScreenStageInformation underlay/default.lua index 154527c91d..8eb5003af7 100644 --- a/Themes/default/BGAnimations/ScreenStageInformation underlay/default.lua +++ b/Themes/default/BGAnimations/ScreenStageInformation underlay/default.lua @@ -1,76 +1,76 @@ -local playMode = GAMESTATE:GetPlayMode() -if playMode ~= 'PlayMode_Regular' and playMode ~= 'PlayMode_Rave' and playMode ~= 'PlayMode_Battle' then - curStage = playMode; -end; -local sStage = GAMESTATE:GetCurrentStage(); -local tRemap = { - Stage_1st = 1, - Stage_2nd = 2, - Stage_3rd = 3, - Stage_4th = 4, - Stage_5th = 5, - Stage_6th = 6, -}; - -if tRemap[sStage] == PREFSMAN:GetPreference("SongsPerPlay") then - sStage = "Stage_Final"; -else - sStage = sStage; -end; - -local t = Def.ActorFrame {}; -t[#t+1] = Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color("Black")); -}; -t[#t+1] = Def.Sprite { - InitCommand=cmd(Center); - BeginCommand=cmd(LoadFromCurrentSongBackground); - OnCommand=cmd(diffusealpha,0;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3); -}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - OnCommand=cmd(stoptweening;zoom,1.25;decelerate,3;zoom,1); - - LoadActor( THEME:GetPathG("ScreenStageInformation", "Stage " .. ToEnumShortString(sStage) ) ) .. { - OnCommand=cmd(diffusealpha,0;linear,0.25;diffusealpha,1;sleep,1.75;linear,0.5;zoomy,0;zoomx,2;diffusealpha,0); - }; -}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+96); - OnCommand=cmd(stoptweening;addy,-16;decelerate,3;addy,16); - LoadFont("Common Normal") .. { - Text=GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentCourse():GetDisplayFullTitle() or GAMESTATE:GetCurrentSong():GetDisplayFullTitle(); - InitCommand=cmd(strokecolor,Color("Outline");y,-20); - OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; - LoadFont("Common Normal") .. { - Text=GAMESTATE:IsCourseMode() and ToEnumShortString( GAMESTATE:GetCurrentCourse():GetCourseType() ) or GAMESTATE:GetCurrentSong():GetDisplayArtist(); - InitCommand=cmd(strokecolor,Color("Outline");zoom,0.75); - OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(strokecolor,Color("Outline");diffuse,Color("Orange");diffusebottomedge,Color("Yellow");zoom,0.75;y,20); - BeginCommand=function(self) - local text = ""; - local SongOrCourse; - if GAMESTATE:IsCourseMode() then - local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); - SongOrCourse = GAMESTATE:GetCurrentCourse(); - if SongOrCourse:GetEstimatedNumStages() == 1 then - text = SongOrCourse:GetEstimatedNumStages() .." Stage / ".. SecondsToMSSMsMs( TrailUtil.GetTotalSeconds(trail) ); - else - text = SongOrCourse:GetEstimatedNumStages() .." Stages / ".. SecondsToMSSMsMs( TrailUtil.GetTotalSeconds(trail) ); - end - else - SongOrCourse = GAMESTATE:GetCurrentSong(); - text = SecondsToMSSMsMs( SongOrCourse:MusicLengthSeconds() ); - end; - self:settext(text); - end; - OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); - }; -}; - +local playMode = GAMESTATE:GetPlayMode() +if playMode ~= 'PlayMode_Regular' and playMode ~= 'PlayMode_Rave' and playMode ~= 'PlayMode_Battle' then + curStage = playMode; +end; +local sStage = GAMESTATE:GetCurrentStage(); +local tRemap = { + Stage_1st = 1, + Stage_2nd = 2, + Stage_3rd = 3, + Stage_4th = 4, + Stage_5th = 5, + Stage_6th = 6, +}; + +if tRemap[sStage] == PREFSMAN:GetPreference("SongsPerPlay") then + sStage = "Stage_Final"; +else + sStage = sStage; +end; + +local t = Def.ActorFrame {}; +t[#t+1] = Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color("Black")); +}; +t[#t+1] = Def.Sprite { + InitCommand=cmd(Center); + BeginCommand=cmd(LoadFromCurrentSongBackground); + OnCommand=cmd(diffusealpha,0;scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT;sleep,0.5;linear,0.50;diffusealpha,1;sleep,3); +}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + OnCommand=cmd(stoptweening;zoom,1.25;decelerate,3;zoom,1); + + LoadActor( THEME:GetPathG("ScreenStageInformation", "Stage " .. ToEnumShortString(sStage) ) ) .. { + OnCommand=cmd(diffusealpha,0;linear,0.25;diffusealpha,1;sleep,1.75;linear,0.5;zoomy,0;zoomx,2;diffusealpha,0); + }; +}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+96); + OnCommand=cmd(stoptweening;addy,-16;decelerate,3;addy,16); + LoadFont("Common Normal") .. { + Text=GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentCourse():GetDisplayFullTitle() or GAMESTATE:GetCurrentSong():GetDisplayFullTitle(); + InitCommand=cmd(strokecolor,Color("Outline");y,-20); + OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; + LoadFont("Common Normal") .. { + Text=GAMESTATE:IsCourseMode() and ToEnumShortString( GAMESTATE:GetCurrentCourse():GetCourseType() ) or GAMESTATE:GetCurrentSong():GetDisplayArtist(); + InitCommand=cmd(strokecolor,Color("Outline");zoom,0.75); + OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(strokecolor,Color("Outline");diffuse,Color("Orange");diffusebottomedge,Color("Yellow");zoom,0.75;y,20); + BeginCommand=function(self) + local text = ""; + local SongOrCourse; + if GAMESTATE:IsCourseMode() then + local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()); + SongOrCourse = GAMESTATE:GetCurrentCourse(); + if SongOrCourse:GetEstimatedNumStages() == 1 then + text = SongOrCourse:GetEstimatedNumStages() .." Stage / ".. SecondsToMSSMsMs( TrailUtil.GetTotalSeconds(trail) ); + else + text = SongOrCourse:GetEstimatedNumStages() .." Stages / ".. SecondsToMSSMsMs( TrailUtil.GetTotalSeconds(trail) ); + end + else + SongOrCourse = GAMESTATE:GetCurrentSong(); + text = SecondsToMSSMsMs( SongOrCourse:MusicLengthSeconds() ); + end; + self:settext(text); + end; + OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,1.5;linear,0.5;diffusealpha,0); + }; +}; + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenTitleJoin decorations.lua b/Themes/default/BGAnimations/ScreenTitleJoin decorations.lua index bca99f7f6c..65d556611d 100644 --- a/Themes/default/BGAnimations/ScreenTitleJoin decorations.lua +++ b/Themes/default/BGAnimations/ScreenTitleJoin decorations.lua @@ -1,3 +1,3 @@ -local t = LoadFallbackB(); -t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); +local t = LoadFallbackB(); +t[#t+1] = LoadActor( THEME:GetPathB("_Arcade","decorations") ); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenTitleJoin overlay.lua b/Themes/default/BGAnimations/ScreenTitleJoin overlay.lua index fd321c1401..c5e1b70009 100644 --- a/Themes/default/BGAnimations/ScreenTitleJoin overlay.lua +++ b/Themes/default/BGAnimations/ScreenTitleJoin overlay.lua @@ -1,11 +1,11 @@ -local t = Def.ActorFrame{}; - --- todo: add event mode indicators and such -if GAMESTATE:IsEventMode() then - t[#t+1] = LoadFont("Common normal")..{ - Text=Screen.String("EventMode"); - InitCommand=cmd(CenterX;y,SCREEN_BOTTOM-72;zoom,0.75;diffuse,HSV(56,0.8,1)); - }; -end; - +local t = Def.ActorFrame{}; + +-- todo: add event mode indicators and such +if GAMESTATE:IsEventMode() then + t[#t+1] = LoadFont("Common normal")..{ + Text=Screen.String("EventMode"); + InitCommand=cmd(CenterX;y,SCREEN_BOTTOM-72;zoom,0.75;diffuse,HSV(56,0.8,1)); + }; +end; + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenTitleMenu background/default.lua b/Themes/default/BGAnimations/ScreenTitleMenu background/default.lua index 27dab613ee..e0cae44c76 100644 --- a/Themes/default/BGAnimations/ScreenTitleMenu background/default.lua +++ b/Themes/default/BGAnimations/ScreenTitleMenu background/default.lua @@ -1,3 +1,3 @@ -return LoadActor("_bg") .. { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+256,SCREEN_HEIGHT); +return LoadActor("_bg") .. { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+256,SCREEN_HEIGHT); }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenTitleMenu underlay.lua b/Themes/default/BGAnimations/ScreenTitleMenu underlay.lua index 2f805742e1..3f4af5add1 100644 --- a/Themes/default/BGAnimations/ScreenTitleMenu underlay.lua +++ b/Themes/default/BGAnimations/ScreenTitleMenu underlay.lua @@ -1,12 +1,12 @@ -InitUserPrefs(); -local t = Def.ActorFrame {}; - -t[#t+1] = StandardDecorationFromFileOptional("Logo","Logo"); -t[#t+1] = StandardDecorationFromFileOptional("VersionInfo","VersionInfo"); -t[#t+1] = StandardDecorationFromFileOptional("CurrentGametype","CurrentGametype"); -t[#t+1] = StandardDecorationFromFileOptional("LifeDifficulty","LifeDifficulty"); -t[#t+1] = StandardDecorationFromFileOptional("TimingDifficulty","TimingDifficulty"); -t[#t+1] = StandardDecorationFromFileOptional("NetworkStatus","NetworkStatus"); -t[#t+1] = StandardDecorationFromFileOptional("SystemDirection","SystemDirection"); - +InitUserPrefs(); +local t = Def.ActorFrame {}; + +t[#t+1] = StandardDecorationFromFileOptional("Logo","Logo"); +t[#t+1] = StandardDecorationFromFileOptional("VersionInfo","VersionInfo"); +t[#t+1] = StandardDecorationFromFileOptional("CurrentGametype","CurrentGametype"); +t[#t+1] = StandardDecorationFromFileOptional("LifeDifficulty","LifeDifficulty"); +t[#t+1] = StandardDecorationFromFileOptional("TimingDifficulty","TimingDifficulty"); +t[#t+1] = StandardDecorationFromFileOptional("NetworkStatus","NetworkStatus"); +t[#t+1] = StandardDecorationFromFileOptional("SystemDirection","SystemDirection"); + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua b/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua index ac142b1ad2..31a19bf9b2 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua @@ -1,72 +1,72 @@ -local Params = { - NumParticles = 80, - VelocityXMin = 100, - VelocityXMax = 400, - VelocityYMin = 0, - VelocityYMax = 0, - VelocityZMin = 0, - VelocityZMax = 0, - BobRateZMin = 0.4, - BobRateZMax = 0.7, - ZoomMin = 0.5, - ZoomMax = 1, - SpinZ = 0, - BobZ = 52, - File = "_particle normal", -}; - -local t = Def.ActorFrame{}; - -local tParticleInfo = {} - -for i=1,Params.NumParticles do - tParticleInfo[i] = { - X = math.random(Params.VelocityXMin, Params.VelocityXMax), - Y = math.random(Params.VelocityYMin, Params.VelocityYMax), - Z = math.random(Params.VelocityZMin, Params.VelocityZMax), - Zoom = math.random(Params.ZoomMin*1000,Params.ZoomMax*1000) / 1000, - BobZRate = math.random(Params.BobRateZMin*1000,Params.BobRateZMax*1000) / 1000, - Age = 0, - }; - t[#t+1] = LoadActor( Params.File )..{ - Name="Particle"..i; - InitCommand=function(self) - self:basezoom(tParticleInfo[i].Zoom); - self:x(math.random(SCREEN_LEFT+(self:GetWidth()/2),SCREEN_RIGHT-(self:GetWidth()/2))); - self:y(math.random(SCREEN_TOP+(self:GetHeight()/2),SCREEN_BOTTOM-(self:GetHeight()/2))); --- self:z(math.random(-64,0)); - end; - OnCommand=cmd(diffuse,ColorLightTone(color("#ffd400"));diffusealpha,0.8); - }; -end - -local function UpdateParticles(self,DeltaTime) - tParticles = self:GetChildren(); - for i=1, Params.NumParticles do - local p = tParticles["Particle"..i]; - local vX = tParticleInfo[i].X; - local vY = tParticleInfo[i].Y; - local vZ = tParticleInfo[i].Z; - tParticleInfo[i].Age = tParticleInfo[i].Age + DeltaTime; - p:x(p:GetX() + (vX * DeltaTime)); - p:y(p:GetY() + (vY * DeltaTime)); - p:z(p:GetZ() + (vZ * DeltaTime)); --- p:zoom( 1 + math.cos( --- (tParticleInfo[i].Age * math.pi*2) --- ) * 0.125 ); - if p:GetX() > SCREEN_RIGHT + (p:GetWidth()/2 - p:GetZ()) then - p:x(SCREEN_LEFT - (p:GetWidth()/2)); - elseif p:GetX() < SCREEN_LEFT - (p:GetWidth()/2 - p:GetZ()) then - p:x(SCREEN_RIGHT + (p:GetWidth()/2)); - end - if p:GetY() > SCREEN_BOTTOM + (p:GetHeight()/2 - p:GetZ()) then - p:y(SCREEN_TOP - (p:GetHeight()/2)); - elseif p:GetY() < SCREEN_TOP - (p:GetHeight()/2 - p:GetZ()) then - p:y(SCREEN_BOTTOM + (p:GetHeight()/2)); - end - end; -end; - -t.InitCommand = cmd(fov,90;SetUpdateFunction,UpdateParticles); - -return t; +local Params = { + NumParticles = 80, + VelocityXMin = 100, + VelocityXMax = 400, + VelocityYMin = 0, + VelocityYMax = 0, + VelocityZMin = 0, + VelocityZMax = 0, + BobRateZMin = 0.4, + BobRateZMax = 0.7, + ZoomMin = 0.5, + ZoomMax = 1, + SpinZ = 0, + BobZ = 52, + File = "_particle normal", +}; + +local t = Def.ActorFrame{}; + +local tParticleInfo = {} + +for i=1,Params.NumParticles do + tParticleInfo[i] = { + X = math.random(Params.VelocityXMin, Params.VelocityXMax), + Y = math.random(Params.VelocityYMin, Params.VelocityYMax), + Z = math.random(Params.VelocityZMin, Params.VelocityZMax), + Zoom = math.random(Params.ZoomMin*1000,Params.ZoomMax*1000) / 1000, + BobZRate = math.random(Params.BobRateZMin*1000,Params.BobRateZMax*1000) / 1000, + Age = 0, + }; + t[#t+1] = LoadActor( Params.File )..{ + Name="Particle"..i; + InitCommand=function(self) + self:basezoom(tParticleInfo[i].Zoom); + self:x(math.random(SCREEN_LEFT+(self:GetWidth()/2),SCREEN_RIGHT-(self:GetWidth()/2))); + self:y(math.random(SCREEN_TOP+(self:GetHeight()/2),SCREEN_BOTTOM-(self:GetHeight()/2))); +-- self:z(math.random(-64,0)); + end; + OnCommand=cmd(diffuse,ColorLightTone(color("#ffd400"));diffusealpha,0.8); + }; +end + +local function UpdateParticles(self,DeltaTime) + tParticles = self:GetChildren(); + for i=1, Params.NumParticles do + local p = tParticles["Particle"..i]; + local vX = tParticleInfo[i].X; + local vY = tParticleInfo[i].Y; + local vZ = tParticleInfo[i].Z; + tParticleInfo[i].Age = tParticleInfo[i].Age + DeltaTime; + p:x(p:GetX() + (vX * DeltaTime)); + p:y(p:GetY() + (vY * DeltaTime)); + p:z(p:GetZ() + (vZ * DeltaTime)); +-- p:zoom( 1 + math.cos( +-- (tParticleInfo[i].Age * math.pi*2) +-- ) * 0.125 ); + if p:GetX() > SCREEN_RIGHT + (p:GetWidth()/2 - p:GetZ()) then + p:x(SCREEN_LEFT - (p:GetWidth()/2)); + elseif p:GetX() < SCREEN_LEFT - (p:GetWidth()/2 - p:GetZ()) then + p:x(SCREEN_RIGHT + (p:GetWidth()/2)); + end + if p:GetY() > SCREEN_BOTTOM + (p:GetHeight()/2 - p:GetZ()) then + p:y(SCREEN_TOP - (p:GetHeight()/2)); + elseif p:GetY() < SCREEN_TOP - (p:GetHeight()/2 - p:GetZ()) then + p:y(SCREEN_BOTTOM + (p:GetHeight()/2)); + end + end; +end; + +t.InitCommand = cmd(fov,90;SetUpdateFunction,UpdateParticles); + +return t; diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements background/default.lua b/Themes/default/BGAnimations/ScreenWithMenuElements background/default.lua index 776ff2819f..2a5ef20e90 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements background/default.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements background/default.lua @@ -1,43 +1,43 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - FOV=90; - InitCommand=cmd(Center); - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00")); - }; - LoadActor("_pattern") .. { - InitCommand=cmd(rotationy,-12.25;rotationz,-30;rotationx,-20;zoomto,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;customtexturerect,0,0,SCREEN_WIDTH*4/256,SCREEN_HEIGHT*4/256); - OnCommand=cmd(texcoordvelocity,0.125,0.5;diffuse,color("#ffd400");diffusealpha,0.075); - }; - LoadActor("_particleLoader") .. { - InitCommand=cmd(x,-SCREEN_CENTER_X;y,-SCREEN_CENTER_Y); - }; ---[[ LoadActor("_particles") .. { - InitCommand=cmd(x,-SCREEN_CENTER_X;y,-SCREEN_CENTER_Y); - }; --]] - - Def.Quad { - InitCommand=cmd(vertalign,top;scaletoclipped,SCREEN_WIDTH+1,80;y,-SCREEN_CENTER_Y+20;fadebottom,0.75); - OnCommand=cmd(diffuse,color("#FFCB05")); - }; - Def.Quad { - InitCommand=cmd(vertalign,bottom;scaletoclipped,SCREEN_WIDTH+1,80;y,SCREEN_CENTER_Y-20;fadetop,0.75); - OnCommand=cmd(diffuse,color("#FFCB05")); - }; ---[[ LoadActor("_pattern") .. { - InitCommand=cmd(z,32;x,4;y,4;;rotationy,-12.25;rotationz,-30;rotationx,-20;zoomto,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;customtexturerect,0,0,SCREEN_WIDTH*4/256,SCREEN_HEIGHT*4/256); - OnCommand=cmd(texcoordvelocity,0.125,0.5;diffuse,Color("Black");diffusealpha,0.5); - }; --]] ---[[ LoadActor("_grid") .. { - InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); - OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Orange");diffuseshift;effecttiming,(1/8)*2,0,(7/8)*2,0;effectclock,'beatnooffset'; - effectcolor2,Color("Orange");effectcolor1,Colors.Alpha(Color("Orange"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480); - }; --]] - LoadActor("_bg top") .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); - }; -}; - -return t; +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + FOV=90; + InitCommand=cmd(Center); + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("#FFCB05");diffusebottomedge,color("#F0BA00")); + }; + LoadActor("_pattern") .. { + InitCommand=cmd(rotationy,-12.25;rotationz,-30;rotationx,-20;zoomto,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;customtexturerect,0,0,SCREEN_WIDTH*4/256,SCREEN_HEIGHT*4/256); + OnCommand=cmd(texcoordvelocity,0.125,0.5;diffuse,color("#ffd400");diffusealpha,0.075); + }; + LoadActor("_particleLoader") .. { + InitCommand=cmd(x,-SCREEN_CENTER_X;y,-SCREEN_CENTER_Y); + }; +--[[ LoadActor("_particles") .. { + InitCommand=cmd(x,-SCREEN_CENTER_X;y,-SCREEN_CENTER_Y); + }; --]] + + Def.Quad { + InitCommand=cmd(vertalign,top;scaletoclipped,SCREEN_WIDTH+1,80;y,-SCREEN_CENTER_Y+20;fadebottom,0.75); + OnCommand=cmd(diffuse,color("#FFCB05")); + }; + Def.Quad { + InitCommand=cmd(vertalign,bottom;scaletoclipped,SCREEN_WIDTH+1,80;y,SCREEN_CENTER_Y-20;fadetop,0.75); + OnCommand=cmd(diffuse,color("#FFCB05")); + }; +--[[ LoadActor("_pattern") .. { + InitCommand=cmd(z,32;x,4;y,4;;rotationy,-12.25;rotationz,-30;rotationx,-20;zoomto,SCREEN_WIDTH*2,SCREEN_HEIGHT*2;customtexturerect,0,0,SCREEN_WIDTH*4/256,SCREEN_HEIGHT*4/256); + OnCommand=cmd(texcoordvelocity,0.125,0.5;diffuse,Color("Black");diffusealpha,0.5); + }; --]] +--[[ LoadActor("_grid") .. { + InitCommand=cmd(customtexturerect,0,0,(SCREEN_WIDTH+1)/4,SCREEN_HEIGHT/4;SetTextureFiltering,true); + OnCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT;diffuse,Color("Orange");diffuseshift;effecttiming,(1/8)*2,0,(7/8)*2,0;effectclock,'beatnooffset'; + effectcolor2,Color("Orange");effectcolor1,Colors.Alpha(Color("Orange"),0.45);fadebottom,0.25;fadetop,0.25;croptop,48/480;cropbottom,48/480); + }; --]] + LoadActor("_bg top") .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH+1,SCREEN_HEIGHT); + }; +}; + +return t; diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements decorations/default.lua b/Themes/default/BGAnimations/ScreenWithMenuElements decorations/default.lua index ae8c9159f0..2339719651 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements decorations/default.lua @@ -1,8 +1,8 @@ --- Loads up a slew of objects to load into the screen, like how 3.9 does. --- I prefer to keep these optional, incase another screen wants to hide --- these elements. -local t = Def.ActorFrame {}; -t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); -t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); -t[#t+1] = StandardDecorationFromFileOptional( "Help", "Help" ); +-- Loads up a slew of objects to load into the screen, like how 3.9 does. +-- I prefer to keep these optional, incase another screen wants to hide +-- these elements. +local t = Def.ActorFrame {}; +t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); +t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); +t[#t+1] = StandardDecorationFromFileOptional( "Help", "Help" ); return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements in/default.lua b/Themes/default/BGAnimations/ScreenWithMenuElements in/default.lua index 31aa36928b..b1609a31c6 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements in/default.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements in/default.lua @@ -1,35 +1,35 @@ -local fTileSize = 32; -local iTilesX = math.ceil( SCREEN_WIDTH/fTileSize ); -local iTilesY = math.ceil( SCREEN_HEIGHT/fTileSize ); -local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenInDelay"); ---[[ local function Actor:PositionTile(self,iX,iY) - self:x( scale(iX,1,iTilesX,-SCREEN_CENTER_X,SCREEN_CENTER_X) ); - self:y( scale(iY,1,iTilesY,-SCREEN_CENTER_Y,SCREEN_CENTER_Y) ); -end --]] -local t = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - OnCommand=cmd(sleep,fSleepTime); -}; ---[[ for indx=1,iTilesX do - for indy=1,iTilesY do - t[#t+1] = Def.Quad { - InitCommand=cmd(zoom,fTileSize-2; - x,math.floor( scale(indx,1,iTilesX,(iTilesX/2)*fTileSize*-1,(iTilesX/2)*fTileSize*1) ); - y,math.floor( scale(indy,1,iTilesY,(iTilesY/2)*fTileSize*-1,(iTilesY/2)*fTileSize*1) ); - ); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,1;zoom,fTileSize-2;sleep,(iTilesX+iTilesY)*(1/60);linear,0.0325 + ( indx / 60 );diffusealpha,0;zoom,fTileSize*1.25); - }; - end -end --]] -t[#t+1] = Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,1");sleep,0.0325 + fSleepTime;linear,0.15;diffusealpha,0); -}; ---[[ return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,1");linear,0.15;diffusealpha,0); - }; -}; --]] - +local fTileSize = 32; +local iTilesX = math.ceil( SCREEN_WIDTH/fTileSize ); +local iTilesY = math.ceil( SCREEN_HEIGHT/fTileSize ); +local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenInDelay"); +--[[ local function Actor:PositionTile(self,iX,iY) + self:x( scale(iX,1,iTilesX,-SCREEN_CENTER_X,SCREEN_CENTER_X) ); + self:y( scale(iY,1,iTilesY,-SCREEN_CENTER_Y,SCREEN_CENTER_Y) ); +end --]] +local t = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + OnCommand=cmd(sleep,fSleepTime); +}; +--[[ for indx=1,iTilesX do + for indy=1,iTilesY do + t[#t+1] = Def.Quad { + InitCommand=cmd(zoom,fTileSize-2; + x,math.floor( scale(indx,1,iTilesX,(iTilesX/2)*fTileSize*-1,(iTilesX/2)*fTileSize*1) ); + y,math.floor( scale(indy,1,iTilesY,(iTilesY/2)*fTileSize*-1,(iTilesY/2)*fTileSize*1) ); + ); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,1;zoom,fTileSize-2;sleep,(iTilesX+iTilesY)*(1/60);linear,0.0325 + ( indx / 60 );diffusealpha,0;zoom,fTileSize*1.25); + }; + end +end --]] +t[#t+1] = Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");sleep,0.0325 + fSleepTime;linear,0.15;diffusealpha,0); +}; +--[[ return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");linear,0.15;diffusealpha,0); + }; +}; --]] + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements out/default.lua b/Themes/default/BGAnimations/ScreenWithMenuElements out/default.lua index 02d2d72ab1..ce931f4004 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements out/default.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements out/default.lua @@ -1,35 +1,35 @@ -local fTileSize = 32; -local iTilesX = math.ceil( SCREEN_WIDTH/fTileSize ); -local iTilesY = math.ceil( SCREEN_HEIGHT/fTileSize ); -local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenOutDelay"); ---[[ local function Actor:PositionTile(self,iX,iY) - self:x( scale(iX,1,iTilesX,-SCREEN_CENTER_X,SCREEN_CENTER_X) ); - self:y( scale(iY,1,iTilesY,-SCREEN_CENTER_Y,SCREEN_CENTER_Y) ); -end --]] -local t = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - OnCommand=cmd(sleep,fSleepTime); -}; ---[[ for indx=1,iTilesX do - for indy=1,iTilesY do - t[#t+1] = Def.Quad { - InitCommand=cmd(zoom,fTileSize-2; - x,math.floor( scale(indx,1,iTilesX,(iTilesX/2)*fTileSize*-1,(iTilesX/2)*fTileSize*1) ); - y,math.floor( scale(indy,1,iTilesY,(iTilesY/2)*fTileSize*-1,(iTilesY/2)*fTileSize*1) ); - ); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;zoom,fTileSize*1.25;linear,0.0325 + ( indx / 60 );diffusealpha,1;zoom,fTileSize-2); - }; - end -end --]] -t[#t+1] = Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0");sleep,0.0325 + fSleepTime;linear,0.15;diffusealpha,1); -}; ---[[ return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,1");linear,0.15;diffusealpha,0); - }; -}; --]] - +local fTileSize = 32; +local iTilesX = math.ceil( SCREEN_WIDTH/fTileSize ); +local iTilesY = math.ceil( SCREEN_HEIGHT/fTileSize ); +local fSleepTime = THEME:GetMetric( Var "LoadingScreen","ScreenOutDelay"); +--[[ local function Actor:PositionTile(self,iX,iY) + self:x( scale(iX,1,iTilesX,-SCREEN_CENTER_X,SCREEN_CENTER_X) ); + self:y( scale(iY,1,iTilesY,-SCREEN_CENTER_Y,SCREEN_CENTER_Y) ); +end --]] +local t = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + OnCommand=cmd(sleep,fSleepTime); +}; +--[[ for indx=1,iTilesX do + for indy=1,iTilesY do + t[#t+1] = Def.Quad { + InitCommand=cmd(zoom,fTileSize-2; + x,math.floor( scale(indx,1,iTilesX,(iTilesX/2)*fTileSize*-1,(iTilesX/2)*fTileSize*1) ); + y,math.floor( scale(indy,1,iTilesY,(iTilesY/2)*fTileSize*-1,(iTilesY/2)*fTileSize*1) ); + ); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;zoom,fTileSize*1.25;linear,0.0325 + ( indx / 60 );diffusealpha,1;zoom,fTileSize-2); + }; + end +end --]] +t[#t+1] = Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0");sleep,0.0325 + fSleepTime;linear,0.15;diffusealpha,1); +}; +--[[ return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH+1,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");linear,0.15;diffusealpha,0); + }; +}; --]] + return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/_Arcade decorations/default.lua b/Themes/default/BGAnimations/_Arcade decorations/default.lua index df1354da80..ebefb058ab 100644 --- a/Themes/default/BGAnimations/_Arcade decorations/default.lua +++ b/Themes/default/BGAnimations/_Arcade decorations/default.lua @@ -1,31 +1,31 @@ -local t = Def.ActorFrame {}; -t.InitCommand=function(self) - self:name("ArcadeOverlay") - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") -end; -t[#t+1] = Def.ActorFrame { - Name="ArcadeOverlay.Text"; - InitCommand=function(self) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") - end; - LoadActor(THEME:GetPathG("OptionRowExit","Frame")) .. { - InitCommand=cmd(diffuse,Color("Orange");diffusealpha,0.35); - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(zoom,0.75;shadowlength,1;glowshift;strokecolor,Color("Outline");diffuse,Color("Orange");diffusetopedge,Color("Yellow");textglowmode,'TextGlowMode_Inner'); - Text="TESTING"; - OnCommand=cmd(playcommand,"Refresh"); - CoinInsertedMessageCommand=cmd(playcommand,"Refresh"); - CoinModeChangedMessageCommand=cmd(playcommand,"Refresh"); - RefreshCommand=function(self) - local bCanPlay = GAMESTATE:EnoughCreditsToJoin(); - local bReady = GAMESTATE:GetNumSidesJoined() > 0; - if bCanPlay or bReady then - self:settext(THEME:GetString("ScreenTitleJoin","HelpTextJoin")); - else - self:settext(THEME:GetString("ScreenTitleJoin","HelpTextWait")); - end - end; - }; -}; +local t = Def.ActorFrame {}; +t.InitCommand=function(self) + self:name("ArcadeOverlay") + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") +end; +t[#t+1] = Def.ActorFrame { + Name="ArcadeOverlay.Text"; + InitCommand=function(self) + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen") + end; + LoadActor(THEME:GetPathG("OptionRowExit","Frame")) .. { + InitCommand=cmd(diffuse,Color("Orange");diffusealpha,0.35); + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(zoom,0.75;shadowlength,1;glowshift;strokecolor,Color("Outline");diffuse,Color("Orange");diffusetopedge,Color("Yellow");textglowmode,'TextGlowMode_Inner'); + Text="TESTING"; + OnCommand=cmd(playcommand,"Refresh"); + CoinInsertedMessageCommand=cmd(playcommand,"Refresh"); + CoinModeChangedMessageCommand=cmd(playcommand,"Refresh"); + RefreshCommand=function(self) + local bCanPlay = GAMESTATE:EnoughCreditsToJoin(); + local bReady = GAMESTATE:GetNumSidesJoined() > 0; + if bCanPlay or bReady then + self:settext(THEME:GetString("ScreenTitleJoin","HelpTextJoin")); + else + self:settext(THEME:GetString("ScreenTitleJoin","HelpTextWait")); + end + end; + }; +}; return t \ No newline at end of file diff --git a/Themes/default/BGAnimations/_ScreenTitleMenu out/default.lua b/Themes/default/BGAnimations/_ScreenTitleMenu out/default.lua index fcea9f6825..29ab735b5f 100644 --- a/Themes/default/BGAnimations/_ScreenTitleMenu out/default.lua +++ b/Themes/default/BGAnimations/_ScreenTitleMenu out/default.lua @@ -1,23 +1,23 @@ -return Def.ActorFrame { - InitCommand=cmd(Center); - Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;visible,false); - StartTransitioningCommand=cmd(visible,true;diffuse,Color("Black");sleep,3.5;diffusealpha,0); - }; - -- Sublime - Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH,80;diffuse,Color("Orange");visible,false); - StartTransitioningCommand=cmd(visible,true;decelerate,2;zoomy,44;decelerate,0.5;diffusealpha,0); - }; - LoadFont("Common Normal") .. { - Text="This is only the beginning..."; - InitCommand=cmd(visible,false;shadowlength,1;shadowcolor,BoostColor(Color("Orange"),0.5)); - StartTransitioningCommand=cmd(visible,true;zoom,0.75;fadeleft,1;faderight,1;linear,1;faderight,0;fadeleft,0;sleep,1;decelerate,0.5;y,12;diffusealpha,0); - }; - -- End - Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color("White");visible,false); - StartTransitioningCommand=cmd(visible,true;decelerate,1;diffusealpha,0); - }; - +return Def.ActorFrame { + InitCommand=cmd(Center); + Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;visible,false); + StartTransitioningCommand=cmd(visible,true;diffuse,Color("Black");sleep,3.5;diffusealpha,0); + }; + -- Sublime + Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,80;diffuse,Color("Orange");visible,false); + StartTransitioningCommand=cmd(visible,true;decelerate,2;zoomy,44;decelerate,0.5;diffusealpha,0); + }; + LoadFont("Common Normal") .. { + Text="This is only the beginning..."; + InitCommand=cmd(visible,false;shadowlength,1;shadowcolor,BoostColor(Color("Orange"),0.5)); + StartTransitioningCommand=cmd(visible,true;zoom,0.75;fadeleft,1;faderight,1;linear,1;faderight,0;fadeleft,0;sleep,1;decelerate,0.5;y,12;diffusealpha,0); + }; + -- End + Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color("White");visible,false); + StartTransitioningCommand=cmd(visible,true;decelerate,1;diffusealpha,0); + }; + }; \ No newline at end of file diff --git a/Themes/default/BGAnimations/_ScreenWithMenuElements aux.lua b/Themes/default/BGAnimations/_ScreenWithMenuElements aux.lua index 34dee35765..b45f994ddf 100644 --- a/Themes/default/BGAnimations/_ScreenWithMenuElements aux.lua +++ b/Themes/default/BGAnimations/_ScreenWithMenuElements aux.lua @@ -1 +1 @@ -local t = Def.ActorFrame {}; +local t = Def.ActorFrame {}; diff --git a/Themes/default/BGAnimations/_frame 3x1/default.lua b/Themes/default/BGAnimations/_frame 3x1/default.lua index 72cc1cd50c..9673efba02 100644 --- a/Themes/default/BGAnimations/_frame 3x1/default.lua +++ b/Themes/default/BGAnimations/_frame 3x1/default.lua @@ -1,12 +1,12 @@ -local File, Width = ... -assert( File ); -assert( Width ); - -local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) -local Frame = LoadActor( FullFile ) - -return Def.ActorFrame { - Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; - Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; - Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; -}; +local File, Width = ... +assert( File ); +assert( Width ); + +local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) +local Frame = LoadActor( FullFile ) + +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; +}; diff --git a/Themes/default/BGAnimations/_frame 3x3/default.lua b/Themes/default/BGAnimations/_frame 3x3/default.lua index e5e403448c..be645fc354 100644 --- a/Themes/default/BGAnimations/_frame 3x3/default.lua +++ b/Themes/default/BGAnimations/_frame 3x3/default.lua @@ -1,18 +1,18 @@ -local File, Width, Height = ... -assert( File ); -assert( Width ); -assert( Height ); - -local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) -local Frame = LoadActor( FullFile ) -return Def.ActorFrame { - Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; - Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; - Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; - Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; - Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; -}; +local File, Width, Height = ... +assert( File ); +assert( Width ); +assert( Height ); + +local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) +local Frame = LoadActor( FullFile ) +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; +}; diff --git a/Themes/default/BGAnimations/old ScreenWithMenuElements background/default.lua b/Themes/default/BGAnimations/old ScreenWithMenuElements background/default.lua index f80ac3f9c7..7a72bd6e78 100644 --- a/Themes/default/BGAnimations/old ScreenWithMenuElements background/default.lua +++ b/Themes/default/BGAnimations/old ScreenWithMenuElements background/default.lua @@ -1,11 +1,11 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(Center); - Def.Quad { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("#00bfe8");diffusetopedge,color("#009ad5")); - }; -}; - +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(Center); + Def.Quad { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("#00bfe8");diffusetopedge,color("#009ad5")); + }; +}; + return t \ No newline at end of file diff --git a/Themes/default/Fonts/Combo Numbers.ini b/Themes/default/Fonts/Combo Numbers.ini index 92ded6905a..3c4c05f827 100644 --- a/Themes/default/Fonts/Combo Numbers.ini +++ b/Themes/default/Fonts/Combo Numbers.ini @@ -1,30 +1,30 @@ -[common] -Baseline=42 -Top=11 -LineSpacing=50 -DrawExtraPixelsLeft=0 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 - -[numbers] -Line 0=0123 -Line 1=4567 -Line 2=89%. -Line 3= :x, - -0=27 -1=27 -2=27 -3=27 -4=27 -5=27 -6=27 -7=27 -8=27 -9=27 -10=31 -11=12 -12=10 -13=12 -14=23 -15=11 +[common] +Baseline=42 +Top=11 +LineSpacing=50 +DrawExtraPixelsLeft=0 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 + +[numbers] +Line 0=0123 +Line 1=4567 +Line 2=89%. +Line 3= :x, + +0=27 +1=27 +2=27 +3=27 +4=27 +5=27 +6=27 +7=27 +8=27 +9=27 +10=31 +11=12 +12=10 +13=12 +14=23 +15=11 diff --git a/Themes/default/Fonts/_blaster 18px.ini b/Themes/default/Fonts/_blaster 18px.ini index 3f63ab10e8..ff17ef8cc8 100644 --- a/Themes/default/Fonts/_blaster 18px.ini +++ b/Themes/default/Fonts/_blaster 18px.ini @@ -1,352 +1,352 @@ -[common] -Baseline=14 -Top=0 -LineSpacing=17 -DrawExtraPixelsLeft=3 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 - -[main] -Line 0= !"#$%&'()*+,-. -Line 1=/0123456789:;<= -Line 2=>?@ABCDEFGHIJKL -Line 3=MNOPQRSTUVWXYZ[ -Line 4=\]^_`abcdefghij -Line 5=klmnopqrstuvwxy -Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š -Line 7=‹ŒŽ‘’“”•–—˜™š›œ -Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ -Line 9=­®¯°±²³´µ¶·¸¹º» -Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ -Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ -Line 12=ÚÛÜÝÞßàáâãäåæçè -Line 13=éêëìíîïðñòóôõö÷ -Line 14=øùúûüýþÿ - -0=8 -1=5 -2=6 -3=12 -4=13 -5=11 -6=12 -7=4 -8=7 -9=7 -10=7 -11=9 -12=4 -13=9 -14=4 -15=6 -16=12 -17=7 -18=12 -19=13 -20=12 -21=12 -22=12 -23=13 -24=12 -25=12 -26=4 -27=4 -28=9 -29=9 -30=9 -31=12 -32=19 -33=12 -34=12 -35=12 -36=12 -37=12 -38=12 -39=12 -40=12 -41=5 -42=9 -43=12 -44=9 -45=21 -46=12 -47=12 -48=12 -49=13 -50=12 -51=12 -52=12 -53=12 -54=12 -55=21 -56=12 -57=13 -58=12 -59=7 -60=6 -61=7 -62=7 -63=9 -64=5 -65=12 -66=12 -67=12 -68=12 -69=12 -70=9 -71=12 -72=12 -73=5 -74=5 -75=12 -76=5 -77=21 -78=12 -79=12 -80=12 -81=12 -82=9 -83=12 -84=9 -85=12 -86=12 -87=21 -88=12 -89=12 -90=12 -91=9 -92=5 -93=9 -94=8 -95=11 -96=5 -97=7 -98=6 -99=20 -100=10 -101=10 -102=7 -103=16 -104=12 -105=5 -106=17 -107=12 -108=5 -109=5 -110=6 -111=6 -112=10 -113=8 -114=16 -115=8 -116=10 -117=12 -118=5 -119=17 -120=10 -121=13 -122=8 -123=5 -124=12 -125=12 -126=10 -127=13 -128=5 -129=12 -130=10 -131=12 -132=5 -133=7 -134=10 -135=10 -136=8 -137=10 -138=6 -139=10 -140=4 -141=5 -142=5 -143=9 -144=12 -145=5 -146=10 -147=3 -148=5 -149=7 -150=10 -151=10 -152=12 -153=12 -154=12 -155=12 -156=12 -157=13 -158=13 -159=13 -160=17 -161=12 -162=12 -163=12 -164=12 -165=13 -166=5 -167=5 -168=5 -169=5 -170=15 -171=13 -172=12 -173=12 -174=12 -175=13 -176=13 -177=8 -178=12 -179=12 -180=12 -181=12 -182=13 -183=13 -184=12 -185=12 -186=12 -187=12 -188=12 -189=13 -190=13 -191=13 -192=17 -193=12 -194=12 -195=12 -196=12 -197=13 -198=5 -199=5 -200=7 -201=7 -202=9 -203=13 -204=12 -205=12 -206=12 -207=13 -208=13 -209=9 -210=12 -211=12 -212=12 -213=12 -214=13 -215=12 -216=12 -217=13 - -[alt] -Line 0= Ą˘Ł¤ĽŚ§¨Š -Line 1=ŞŤŹ­ŽŻ°ą˛ł -Line 2=´ľśˇ¸šşťź˝ -Line 3=žżŔÁÂĂÄĹĆÇ -Line 4=ČÉĘËĚÍÎĎĐŃ -Line 5=ŇÓÔŐÖ×ŘŮÚŰ -Line 6=ÜÝŢßŕáâăäĺ -Line 7=ćçčéęëěíîď -Line 8=đńňóôőö÷řů -Line 9=úűüýţ˙ - -0=8 -1=13 -2=10 -3=11 -4=10 -5=11 -6=13 -7=12 -8=10 -9=12 -10=13 -11=12 -12=12 -13=10 -14=12 -15=12 -16=6 -17=11 -18=10 -19=4 -20=5 -21=4 -22=10 -23=10 -24=10 -25=12 -26=10 -27=8 -28=10 -29=10 -30=10 -31=10 -32=14 -33=12 -34=12 -35=13 -36=13 -37=11 -38=14 -39=12 -40=14 -41=12 -42=13 -43=13 -44=13 -45=5 -46=5 -47=14 -48=14 -49=14 -50=14 -51=12 -52=12 -53=16 -54=13 -55=8 -56=14 -57=14 -58=12 -59=14 -60=13 -61=13 -62=12 -63=12 -64=7 -65=12 -66=12 -67=11 -68=13 -69=4 -70=10 -71=12 -72=10 -73=12 -74=11 -75=13 -76=11 -77=5 -78=7 -79=13 -80=11 -81=11 -82=11 -83=12 -84=12 -85=11 -86=13 -87=9 -88=7 -89=11 -90=12 -91=11 -92=13 -93=12 -94=6 -95=10 +[common] +Baseline=14 +Top=0 +LineSpacing=17 +DrawExtraPixelsLeft=3 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 + +[main] +Line 0= !"#$%&'()*+,-. +Line 1=/0123456789:;<= +Line 2=>?@ABCDEFGHIJKL +Line 3=MNOPQRSTUVWXYZ[ +Line 4=\]^_`abcdefghij +Line 5=klmnopqrstuvwxy +Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š +Line 7=‹ŒŽ‘’“”•–—˜™š›œ +Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ +Line 9=­®¯°±²³´µ¶·¸¹º» +Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ +Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ +Line 12=ÚÛÜÝÞßàáâãäåæçè +Line 13=éêëìíîïðñòóôõö÷ +Line 14=øùúûüýþÿ + +0=8 +1=5 +2=6 +3=12 +4=13 +5=11 +6=12 +7=4 +8=7 +9=7 +10=7 +11=9 +12=4 +13=9 +14=4 +15=6 +16=12 +17=7 +18=12 +19=13 +20=12 +21=12 +22=12 +23=13 +24=12 +25=12 +26=4 +27=4 +28=9 +29=9 +30=9 +31=12 +32=19 +33=12 +34=12 +35=12 +36=12 +37=12 +38=12 +39=12 +40=12 +41=5 +42=9 +43=12 +44=9 +45=21 +46=12 +47=12 +48=12 +49=13 +50=12 +51=12 +52=12 +53=12 +54=12 +55=21 +56=12 +57=13 +58=12 +59=7 +60=6 +61=7 +62=7 +63=9 +64=5 +65=12 +66=12 +67=12 +68=12 +69=12 +70=9 +71=12 +72=12 +73=5 +74=5 +75=12 +76=5 +77=21 +78=12 +79=12 +80=12 +81=12 +82=9 +83=12 +84=9 +85=12 +86=12 +87=21 +88=12 +89=12 +90=12 +91=9 +92=5 +93=9 +94=8 +95=11 +96=5 +97=7 +98=6 +99=20 +100=10 +101=10 +102=7 +103=16 +104=12 +105=5 +106=17 +107=12 +108=5 +109=5 +110=6 +111=6 +112=10 +113=8 +114=16 +115=8 +116=10 +117=12 +118=5 +119=17 +120=10 +121=13 +122=8 +123=5 +124=12 +125=12 +126=10 +127=13 +128=5 +129=12 +130=10 +131=12 +132=5 +133=7 +134=10 +135=10 +136=8 +137=10 +138=6 +139=10 +140=4 +141=5 +142=5 +143=9 +144=12 +145=5 +146=10 +147=3 +148=5 +149=7 +150=10 +151=10 +152=12 +153=12 +154=12 +155=12 +156=12 +157=13 +158=13 +159=13 +160=17 +161=12 +162=12 +163=12 +164=12 +165=13 +166=5 +167=5 +168=5 +169=5 +170=15 +171=13 +172=12 +173=12 +174=12 +175=13 +176=13 +177=8 +178=12 +179=12 +180=12 +181=12 +182=13 +183=13 +184=12 +185=12 +186=12 +187=12 +188=12 +189=13 +190=13 +191=13 +192=17 +193=12 +194=12 +195=12 +196=12 +197=13 +198=5 +199=5 +200=7 +201=7 +202=9 +203=13 +204=12 +205=12 +206=12 +207=13 +208=13 +209=9 +210=12 +211=12 +212=12 +213=12 +214=13 +215=12 +216=12 +217=13 + +[alt] +Line 0= Ą˘Ł¤ĽŚ§¨Š +Line 1=ŞŤŹ­ŽŻ°ą˛ł +Line 2=´ľśˇ¸šşťź˝ +Line 3=žżŔÁÂĂÄĹĆÇ +Line 4=ČÉĘËĚÍÎĎĐŃ +Line 5=ŇÓÔŐÖ×ŘŮÚŰ +Line 6=ÜÝŢßŕáâăäĺ +Line 7=ćçčéęëěíîď +Line 8=đńňóôőö÷řů +Line 9=úűüýţ˙ + +0=8 +1=13 +2=10 +3=11 +4=10 +5=11 +6=13 +7=12 +8=10 +9=12 +10=13 +11=12 +12=12 +13=10 +14=12 +15=12 +16=6 +17=11 +18=10 +19=4 +20=5 +21=4 +22=10 +23=10 +24=10 +25=12 +26=10 +27=8 +28=10 +29=10 +30=10 +31=10 +32=14 +33=12 +34=12 +35=13 +36=13 +37=11 +38=14 +39=12 +40=14 +41=12 +42=13 +43=13 +44=13 +45=5 +46=5 +47=14 +48=14 +49=14 +50=14 +51=12 +52=12 +53=16 +54=13 +55=8 +56=14 +57=14 +58=12 +59=14 +60=13 +61=13 +62=12 +63=12 +64=7 +65=12 +66=12 +67=11 +68=13 +69=4 +70=10 +71=12 +72=10 +73=12 +74=11 +75=13 +76=11 +77=5 +78=7 +79=13 +80=11 +81=11 +82=11 +83=12 +84=12 +85=11 +86=13 +87=9 +88=7 +89=11 +90=12 +91=11 +92=13 +93=12 +94=6 +95=10 diff --git a/Themes/default/Fonts/_helveticaneuelt std extblk cn 42px.ini b/Themes/default/Fonts/_helveticaneuelt std extblk cn 42px.ini index eb058b76bb..90be41f302 100644 --- a/Themes/default/Fonts/_helveticaneuelt std extblk cn 42px.ini +++ b/Themes/default/Fonts/_helveticaneuelt std extblk cn 42px.ini @@ -1,352 +1,352 @@ -[common] -Baseline=43 -Top=11 -LineSpacing=52 -DrawExtraPixelsLeft=4 -DrawExtraPixelsRight=0 -AdvanceExtraPixels=0 - -[main] -Line 0= !"#$%&'()*+,-. -Line 1=/0123456789:;<= -Line 2=>?@ABCDEFGHIJKL -Line 3=MNOPQRSTUVWXYZ[ -Line 4=\]^_`abcdefghij -Line 5=klmnopqrstuvwxy -Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š -Line 7=‹ŒŽ‘’“”•–—˜™š›œ -Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ -Line 9=­®¯°±²³´µ¶·¸¹º» -Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ -Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ -Line 12=ÚÛÜÝÞßàáâãäåæçè -Line 13=éêëìíîïðñòóôõö÷ -Line 14=øùúûüýþÿ - -0=11 -1=14 -2=21 -3=22 -4=22 -5=33 -6=26 -7=11 -8=14 -9=14 -10=17 -11=25 -12=11 -13=16 -14=11 -15=15 -16=22 -17=22 -18=22 -19=22 -20=22 -21=22 -22=22 -23=22 -24=22 -25=22 -26=11 -27=11 -28=25 -29=25 -30=25 -31=21 -32=34 -33=24 -34=24 -35=23 -36=24 -37=21 -38=20 -39=23 -40=24 -41=11 -42=21 -43=24 -44=19 -45=33 -46=25 -47=23 -48=23 -49=23 -50=24 -51=23 -52=19 -53=23 -54=23 -55=33 -56=23 -57=23 -58=20 -59=14 -60=15 -61=14 -62=25 -63=21 -64=11 -65=21 -66=22 -67=20 -68=22 -69=20 -70=13 -71=22 -72=22 -73=11 -74=11 -75=22 -76=11 -77=33 -78=22 -79=21 -80=22 -81=22 -82=16 -83=19 -84=13 -85=22 -86=20 -87=32 -88=21 -89=20 -90=19 -91=14 -92=12 -93=14 -94=25 -95=22 -96=11 -97=22 -98=21 -99=42 -100=22 -101=22 -102=11 -103=47 -104=23 -105=10 -106=32 -107=20 -108=11 -109=11 -110=21 -111=21 -112=21 -113=21 -114=42 -115=11 -116=42 -117=19 -118=10 -119=31 -120=19 -121=23 -122=11 -123=14 -124=22 -125=22 -126=22 -127=22 -128=12 -129=22 -130=11 -131=34 -132=14 -133=19 -134=25 -135=16 -136=34 -137=11 -138=17 -139=25 -140=14 -141=14 -142=11 -143=22 -144=26 -145=11 -146=11 -147=14 -148=14 -149=19 -150=33 -151=33 -152=33 -153=21 -154=24 -155=24 -156=24 -157=24 -158=24 -159=24 -160=33 -161=23 -162=21 -163=21 -164=21 -165=21 -166=11 -167=11 -168=11 -169=11 -170=24 -171=25 -172=23 -173=23 -174=23 -175=23 -176=23 -177=25 -178=23 -179=23 -180=23 -181=23 -182=23 -183=23 -184=23 -185=23 -186=21 -187=21 -188=21 -189=21 -190=21 -191=21 -192=31 -193=20 -194=20 -195=20 -196=20 -197=20 -198=11 -199=11 -200=11 -201=11 -202=21 -203=22 -204=21 -205=21 -206=21 -207=21 -208=21 -209=25 -210=21 -211=22 -212=22 -213=22 -214=22 -215=20 -216=22 -217=20 - -[alt] -Line 0= Ą˘Ł¤ĽŚ§¨Š -Line 1=ŞŤŹ­ŽŻ°ą˛ł -Line 2=´ľśˇ¸šşťź˝ -Line 3=žżŔÁÂĂÄĹĆÇ -Line 4=ČÉĘËĚÍÎĎĐŃ -Line 5=ŇÓÔŐÖ×ŘŮÚŰ -Line 6=ÜÝŢßŕáâăäĺ -Line 7=ćçčéęëěíîď -Line 8=đńňóôőö÷řů -Line 9=úűüýţ˙ - -0=11 -1=9 -2=11 -3=19 -4=22 -5=7 -6=8 -7=22 -8=11 -9=23 -10=8 -11=7 -12=7 -13=16 -14=20 -15=7 -16=17 -17=7 -18=11 -19=12 -20=11 -21=7 -22=7 -23=11 -24=11 -25=19 -26=7 -27=9 -28=7 -29=11 -30=19 -31=7 -32=8 -33=24 -34=24 -35=9 -36=24 -37=6 -38=7 -39=23 -40=7 -41=21 -42=7 -43=21 -44=7 -45=11 -46=11 -47=8 -48=8 -49=9 -50=9 -51=23 -52=23 -53=8 -54=23 -55=25 -56=8 -57=8 -58=23 -59=8 -60=23 -61=23 -62=7 -63=23 -64=7 -65=21 -66=21 -67=7 -68=21 -69=3 -70=7 -71=20 -72=7 -73=20 -74=7 -75=20 -76=7 -77=11 -78=11 -79=10 -80=8 -81=7 -82=7 -83=21 -84=21 -85=7 -86=21 -87=25 -88=7 -89=7 -90=22 -91=7 -92=22 -93=20 -94=6 -95=11 +[common] +Baseline=43 +Top=11 +LineSpacing=52 +DrawExtraPixelsLeft=4 +DrawExtraPixelsRight=0 +AdvanceExtraPixels=0 + +[main] +Line 0= !"#$%&'()*+,-. +Line 1=/0123456789:;<= +Line 2=>?@ABCDEFGHIJKL +Line 3=MNOPQRSTUVWXYZ[ +Line 4=\]^_`abcdefghij +Line 5=klmnopqrstuvwxy +Line 6=z{|}~€‚ƒ„…†‡ˆ‰Š +Line 7=‹ŒŽ‘’“”•–—˜™š›œ +Line 8=žŸ ¡¢£¤¥¦§¨©ª«¬ +Line 9=­®¯°±²³´µ¶·¸¹º» +Line 10=¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊ +Line 11=ËÌÍÎÏÐÑÒÓÔÕÖ×ØÙ +Line 12=ÚÛÜÝÞßàáâãäåæçè +Line 13=éêëìíîïðñòóôõö÷ +Line 14=øùúûüýþÿ + +0=11 +1=14 +2=21 +3=22 +4=22 +5=33 +6=26 +7=11 +8=14 +9=14 +10=17 +11=25 +12=11 +13=16 +14=11 +15=15 +16=22 +17=22 +18=22 +19=22 +20=22 +21=22 +22=22 +23=22 +24=22 +25=22 +26=11 +27=11 +28=25 +29=25 +30=25 +31=21 +32=34 +33=24 +34=24 +35=23 +36=24 +37=21 +38=20 +39=23 +40=24 +41=11 +42=21 +43=24 +44=19 +45=33 +46=25 +47=23 +48=23 +49=23 +50=24 +51=23 +52=19 +53=23 +54=23 +55=33 +56=23 +57=23 +58=20 +59=14 +60=15 +61=14 +62=25 +63=21 +64=11 +65=21 +66=22 +67=20 +68=22 +69=20 +70=13 +71=22 +72=22 +73=11 +74=11 +75=22 +76=11 +77=33 +78=22 +79=21 +80=22 +81=22 +82=16 +83=19 +84=13 +85=22 +86=20 +87=32 +88=21 +89=20 +90=19 +91=14 +92=12 +93=14 +94=25 +95=22 +96=11 +97=22 +98=21 +99=42 +100=22 +101=22 +102=11 +103=47 +104=23 +105=10 +106=32 +107=20 +108=11 +109=11 +110=21 +111=21 +112=21 +113=21 +114=42 +115=11 +116=42 +117=19 +118=10 +119=31 +120=19 +121=23 +122=11 +123=14 +124=22 +125=22 +126=22 +127=22 +128=12 +129=22 +130=11 +131=34 +132=14 +133=19 +134=25 +135=16 +136=34 +137=11 +138=17 +139=25 +140=14 +141=14 +142=11 +143=22 +144=26 +145=11 +146=11 +147=14 +148=14 +149=19 +150=33 +151=33 +152=33 +153=21 +154=24 +155=24 +156=24 +157=24 +158=24 +159=24 +160=33 +161=23 +162=21 +163=21 +164=21 +165=21 +166=11 +167=11 +168=11 +169=11 +170=24 +171=25 +172=23 +173=23 +174=23 +175=23 +176=23 +177=25 +178=23 +179=23 +180=23 +181=23 +182=23 +183=23 +184=23 +185=23 +186=21 +187=21 +188=21 +189=21 +190=21 +191=21 +192=31 +193=20 +194=20 +195=20 +196=20 +197=20 +198=11 +199=11 +200=11 +201=11 +202=21 +203=22 +204=21 +205=21 +206=21 +207=21 +208=21 +209=25 +210=21 +211=22 +212=22 +213=22 +214=22 +215=20 +216=22 +217=20 + +[alt] +Line 0= Ą˘Ł¤ĽŚ§¨Š +Line 1=ŞŤŹ­ŽŻ°ą˛ł +Line 2=´ľśˇ¸šşťź˝ +Line 3=žżŔÁÂĂÄĹĆÇ +Line 4=ČÉĘËĚÍÎĎĐŃ +Line 5=ŇÓÔŐÖ×ŘŮÚŰ +Line 6=ÜÝŢßŕáâăäĺ +Line 7=ćçčéęëěíîď +Line 8=đńňóôőö÷řů +Line 9=úűüýţ˙ + +0=11 +1=9 +2=11 +3=19 +4=22 +5=7 +6=8 +7=22 +8=11 +9=23 +10=8 +11=7 +12=7 +13=16 +14=20 +15=7 +16=17 +17=7 +18=11 +19=12 +20=11 +21=7 +22=7 +23=11 +24=11 +25=19 +26=7 +27=9 +28=7 +29=11 +30=19 +31=7 +32=8 +33=24 +34=24 +35=9 +36=24 +37=6 +38=7 +39=23 +40=7 +41=21 +42=7 +43=21 +44=7 +45=11 +46=11 +47=8 +48=8 +49=9 +50=9 +51=23 +52=23 +53=8 +54=23 +55=25 +56=8 +57=8 +58=23 +59=8 +60=23 +61=23 +62=7 +63=23 +64=7 +65=21 +66=21 +67=7 +68=21 +69=3 +70=7 +71=20 +72=7 +73=20 +74=7 +75=20 +76=7 +77=11 +78=11 +79=10 +80=8 +81=7 +82=7 +83=21 +84=21 +85=7 +86=21 +87=25 +88=7 +89=7 +90=22 +91=7 +92=22 +93=20 +94=6 +95=11 diff --git a/Themes/default/Graphics/CombinedLifeMeterTug frame.lua b/Themes/default/Graphics/CombinedLifeMeterTug frame.lua index ec1d9eb7e3..33bdc6d350 100644 --- a/Themes/default/Graphics/CombinedLifeMeterTug frame.lua +++ b/Themes/default/Graphics/CombinedLifeMeterTug frame.lua @@ -1,3 +1,3 @@ -return LoadActor(THEME:GetPathG("_combined","life frame"))..{ - InitCommand=cmd(diffuseleftedge,PlayerColor(PLAYER_1);diffuserightedge,PlayerColor(PLAYER_2);); +return LoadActor(THEME:GetPathG("_combined","life frame"))..{ + InitCommand=cmd(diffuseleftedge,PlayerColor(PLAYER_1);diffuserightedge,PlayerColor(PLAYER_2);); }; \ No newline at end of file diff --git a/Themes/default/Graphics/Combo 1000milestone/default.lua b/Themes/default/Graphics/Combo 1000milestone/default.lua index a146c031d6..80789ecc72 100644 --- a/Themes/default/Graphics/Combo 1000milestone/default.lua +++ b/Themes/default/Graphics/Combo 1000milestone/default.lua @@ -1,12 +1,12 @@ -return Def.ActorFrame { - FOV=90; ---[[ LoadActor("shot") .. { - InitCommand=cmd(diffusealpha,0;zoom,2;blend,'BlendMode_Add'); - MilestoneCommand=cmd(diffusealpha,0.75;rotationz,0;accelerate,2.5;diffusealpha,0;rotationz,360;zoom,2.5); - }; --]] ---[[ LoadActor("shot") .. { - InitCommand=cmd(diffusealpha,0;zoom,2;zoomx,-2;blend,'BlendMode_Add'); - MilestoneCommand=cmd(diffusealpha,0.75;rotationz,-360;x,0;linear,2.5;diffusealpha,0;rotationz,0;zoom,2.5); - }; --]] - LoadActor(THEME:GetPathG("Combo","100Milestone")); -}; +return Def.ActorFrame { + FOV=90; +--[[ LoadActor("shot") .. { + InitCommand=cmd(diffusealpha,0;zoom,2;blend,'BlendMode_Add'); + MilestoneCommand=cmd(diffusealpha,0.75;rotationz,0;accelerate,2.5;diffusealpha,0;rotationz,360;zoom,2.5); + }; --]] +--[[ LoadActor("shot") .. { + InitCommand=cmd(diffusealpha,0;zoom,2;zoomx,-2;blend,'BlendMode_Add'); + MilestoneCommand=cmd(diffusealpha,0.75;rotationz,-360;x,0;linear,2.5;diffusealpha,0;rotationz,0;zoom,2.5); + }; --]] + LoadActor(THEME:GetPathG("Combo","100Milestone")); +}; diff --git a/Themes/default/Graphics/Combo 100milestone/default.lua b/Themes/default/Graphics/Combo 100milestone/default.lua index 093cf52340..0d7279c583 100644 --- a/Themes/default/Graphics/Combo 100milestone/default.lua +++ b/Themes/default/Graphics/Combo 100milestone/default.lua @@ -1,11 +1,11 @@ -local ShowFlashyCombo = GetUserPrefB("UserPrefFlashyCombo") -return Def.ActorFrame { - LoadActor("explosion") .. { - InitCommand=cmd(diffusealpha,0;blend,'BlendMode_Add';hide_if,not ShowFlashyCombo); - MilestoneCommand=cmd(rotationz,0;zoom,2;diffusealpha,0.5;linear,0.5;rotationz,90;zoom,1.75;diffusealpha,0); - }; - LoadActor("explosion") .. { - InitCommand=cmd(diffusealpha,0;blend,'BlendMode_Add';hide_if,not ShowFlashyCombo); - MilestoneCommand=cmd(rotationz,0;zoom,2;diffusealpha,0.5;linear,0.5;rotationz,-90;zoom,2.5;diffusealpha,0); - }; +local ShowFlashyCombo = GetUserPrefB("UserPrefFlashyCombo") +return Def.ActorFrame { + LoadActor("explosion") .. { + InitCommand=cmd(diffusealpha,0;blend,'BlendMode_Add';hide_if,not ShowFlashyCombo); + MilestoneCommand=cmd(rotationz,0;zoom,2;diffusealpha,0.5;linear,0.5;rotationz,90;zoom,1.75;diffusealpha,0); + }; + LoadActor("explosion") .. { + InitCommand=cmd(diffusealpha,0;blend,'BlendMode_Add';hide_if,not ShowFlashyCombo); + MilestoneCommand=cmd(rotationz,0;zoom,2;diffusealpha,0.5;linear,0.5;rotationz,-90;zoom,2.5;diffusealpha,0); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ComboGraph ComboNumber.lua b/Themes/default/Graphics/ComboGraph ComboNumber.lua index 3a71855b81..fe1b36a7a1 100644 --- a/Themes/default/Graphics/ComboGraph ComboNumber.lua +++ b/Themes/default/Graphics/ComboGraph ComboNumber.lua @@ -1,3 +1,3 @@ -return LoadFont("Combo Numbers") .. { - InitCommand=cmd(zoom,0.4;y,-1;shadowlengthx,0;shadowlengthy,1;strokecolor,color("#00000077");); +return LoadFont("Combo Numbers") .. { + InitCommand=cmd(zoom,0.4;y,-1;shadowlengthx,0;shadowlengthy,1;strokecolor,color("#00000077");); }; \ No newline at end of file diff --git a/Themes/default/Graphics/EditMenu Right.lua b/Themes/default/Graphics/EditMenu Right.lua index 8c02a68cea..ed065fd94e 100644 --- a/Themes/default/Graphics/EditMenu Right.lua +++ b/Themes/default/Graphics/EditMenu Right.lua @@ -1,7 +1,7 @@ -local t = Def.ActorFrame{ - LoadActor("EditMenu Left")..{ - BeginCommand=cmd(zoomx,-1); - }; -}; - +local t = Def.ActorFrame{ + LoadActor("EditMenu Left")..{ + BeginCommand=cmd(zoomx,-1); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/MusicWheelItem Roulette NormalPart.lua b/Themes/default/Graphics/MusicWheelItem Roulette NormalPart.lua index 0cab9a0683..d4ac731f08 100644 --- a/Themes/default/Graphics/MusicWheelItem Roulette NormalPart.lua +++ b/Themes/default/Graphics/MusicWheelItem Roulette NormalPart.lua @@ -1,3 +1,3 @@ -return LoadActor(THEME:GetPathG("_MusicWheelItem","Roulette NormalPart")) .. { ---~ InitCommand=cmd(texcoordvelocity,-1,0); +return LoadActor(THEME:GetPathG("_MusicWheelItem","Roulette NormalPart")) .. { +--~ InitCommand=cmd(texcoordvelocity,-1,0); }; \ No newline at end of file diff --git a/Themes/default/Graphics/MusicWheelItem grades/default.lua b/Themes/default/Graphics/MusicWheelItem grades/default.lua index 514e4f775a..dbbca63f71 100644 --- a/Themes/default/Graphics/MusicWheelItem grades/default.lua +++ b/Themes/default/Graphics/MusicWheelItem grades/default.lua @@ -1,73 +1,73 @@ --- This actor is duplicated. Upvalues will not be duplicated. - -local grades = { - Grade_Tier01 = 0; - Grade_Tier02 = 1; - Grade_Tier03 = 2; - Grade_Tier04 = 3; - Grade_Tier05 = 4; - Grade_Tier06 = 5; - Grade_Tier07 = 6; - Grade_Failed = 7; - Grade_None = 8; -}; - ---[[ local t = LoadActor( "grades" ) .. { - InitCommand=cmd(pause); - SetGradeCommand=function(self, params) - local state = grades[params.Grade] or grades.Grade_None; - state = state*2; - - if params.PlayerNumber == PLAYER_2 then - state = state+1; - end - - self:setstate(state); - end; -}; --]] -local t = LoadFont("Common Normal") .. { - InitCommand=cmd(zoom,0.75;shadowlength,1;strokecolor,Color("Black")); - ShowCommand=cmd(stoptweening;bounceend,0.15;zoomy,0.75); - HideCommand=cmd(stoptweening;bouncebegin,0.15;zoomy,0); - SetGradeCommand=function(self,params) - local pnPlayer = params.PlayerNumber; - local sGrade = params.Grade or 'Grade_None'; - local gradeString = THEME:GetString("Grade",string.sub(sGrade,7)); - - self:settext(gradeString); - self:diffuse(PlayerColor(pnPlayer)); - self:diffusetopedge(BoostColor(PlayerColor(pnPlayer),1.5)); - self:strokecolor(BoostColor(PlayerColor(pnPlayer),0.25)); - ---[[ if sGrade == "Grade_NoTier" then - self:playcommand("Hide"); - else - self:playcommand("Show"); - end; --]] - end; -}; - -return t; - --- (c) 2007 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +-- This actor is duplicated. Upvalues will not be duplicated. + +local grades = { + Grade_Tier01 = 0; + Grade_Tier02 = 1; + Grade_Tier03 = 2; + Grade_Tier04 = 3; + Grade_Tier05 = 4; + Grade_Tier06 = 5; + Grade_Tier07 = 6; + Grade_Failed = 7; + Grade_None = 8; +}; + +--[[ local t = LoadActor( "grades" ) .. { + InitCommand=cmd(pause); + SetGradeCommand=function(self, params) + local state = grades[params.Grade] or grades.Grade_None; + state = state*2; + + if params.PlayerNumber == PLAYER_2 then + state = state+1; + end + + self:setstate(state); + end; +}; --]] +local t = LoadFont("Common Normal") .. { + InitCommand=cmd(zoom,0.75;shadowlength,1;strokecolor,Color("Black")); + ShowCommand=cmd(stoptweening;bounceend,0.15;zoomy,0.75); + HideCommand=cmd(stoptweening;bouncebegin,0.15;zoomy,0); + SetGradeCommand=function(self,params) + local pnPlayer = params.PlayerNumber; + local sGrade = params.Grade or 'Grade_None'; + local gradeString = THEME:GetString("Grade",string.sub(sGrade,7)); + + self:settext(gradeString); + self:diffuse(PlayerColor(pnPlayer)); + self:diffusetopedge(BoostColor(PlayerColor(pnPlayer),1.5)); + self:strokecolor(BoostColor(PlayerColor(pnPlayer),0.25)); + +--[[ if sGrade == "Grade_NoTier" then + self:playcommand("Hide"); + else + self:playcommand("Show"); + end; --]] + end; +}; + +return t; + +-- (c) 2007 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/default/Graphics/PaneDisplay text.lua b/Themes/default/Graphics/PaneDisplay text.lua index 3738f5bdb1..5a9983b945 100644 --- a/Themes/default/Graphics/PaneDisplay text.lua +++ b/Themes/default/Graphics/PaneDisplay text.lua @@ -1,152 +1,152 @@ -local iPN = ...; -assert(iPN,"[Graphics/PaneDisplay text.lua] No PlayerNumber Provided."); - -local t = Def.ActorFrame {}; -local function GetRadarData( pnPlayer, rcRadarCategory ) - local tRadarValues; - local StepsOrTrail; - local fDesiredValue = 0; - if GAMESTATE:GetCurrentSteps( pnPlayer ) then - StepsOrTrail = GAMESTATE:GetCurrentSteps( pnPlayer ); - fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); - elseif GAMESTATE:GetCurrentTrail( pnPlayer ) then - StepsOrTrail = GAMESTATE:GetCurrentTrail( pnPlayer ); - fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); - else - StepsOrTrail = nil; - end; - return fDesiredValue; -end; - -local function CreatePaneDisplayItem( _pnPlayer, _sLabel, _rcRadarCategory ) - return Def.ActorFrame { - LoadFont("Common Normal") .. { - Text=_sLabel; - InitCommand=cmd(horizalign,left); - OnCommand=cmd(zoom,0.5;diffuse,color("0.9,0.9,0.9");shadowlength,1); - }; - LoadFont("Common Normal") .. { - Text="000"; - InitCommand=cmd(x,32+8+4;horizalign,left); - OnCommand=cmd(zoom,0.5;shadowlength,1); - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:settext("000") - else - self:settextf("%03i", GetRadarData( _pnPlayer, _rcRadarCategory ) ); - end - end; - }; - }; -end; - -local function CreatePaneDisplayGraph( _pnPlayer, _sLabel, _rcRadarCategory ) - return Def.ActorFrame { - LoadFont("Common Normal") .. { - Text=_sLabel; - InitCommand=cmd(horizalign,left); - OnCommand=cmd(zoom,0.5;shadowlength,1); - }; - Def.Quad { - InitCommand=cmd(x,12;zoomto,50,10;horizalign,left); - OnCommand=cmd(diffuse,Color("Black");shadowlength,1;diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(x,12;zoomto,50,10;horizalign,left); - OnCommand=cmd(shadowlength,0;diffuse,Color("Green");diffusebottomedge,ColorLightTone(Color("Green"))); - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:stoptweening(); - self:decelerate(0.2); - self:zoomtowidth(0); - else - self:stoptweening(); - self:decelerate(0.2); - self:zoomtowidth( clamp(GetRadarData( _pnPlayer, _rcRadarCategory ) * 50,0,50) ); - end - end; - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(x,40;zoom,0.5;); - OnCommand=cmd(shadowlength,1;); - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:settext("") - else - self:settextf("%i%%", GetRadarData( _pnPlayer, _rcRadarCategory ) * 100 ); - end - end; - }; - }; -end; - ---[[ Numbers ]] -t[#t+1] = Def.ActorFrame { - -- Left - CreatePaneDisplayItem( iPN, "TAPS", 'RadarCategory_TapsAndHolds' ) .. { - InitCommand=cmd(x,-128+16+8;y,-14); - }; - CreatePaneDisplayItem( iPN, "JUMPS", 'RadarCategory_Jumps' ) .. { - InitCommand=cmd(x,-128+16+8;y,-14+16); - }; - CreatePaneDisplayItem( iPN, "HOLDS", 'RadarCategory_Holds' ) .. { - InitCommand=cmd(x,-128+16+8;y,-14+16*2); - }; - CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Mines' ) .. { - InitCommand=cmd(x,-128+16+8;y,-14+16*3); - }; - -- Center - CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. { - InitCommand=cmd(x,-128+16+8+74;y,-14); - }; - CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. { - InitCommand=cmd(x,-128+16+8+74;y,-14+16); - }; - CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. { - InitCommand=cmd(x,-128+16+8+74;y,-14+16*2); - }; - CreatePaneDisplayItem( iPN, "FAKES", 'RadarCategory_Fakes' ) .. { - InitCommand=cmd(x,-128+16+8+74;y,-14+16*3); - }; - -- Right - CreatePaneDisplayGraph( iPN, "S", 'RadarCategory_Stream' ) .. { - InitCommand=cmd(x,-128+16+8+74*2;y,-14); - }; - CreatePaneDisplayGraph( iPN, "V", 'RadarCategory_Voltage' ) .. { - InitCommand=cmd(x,-128+16+8+74*2;y,-14+12); - }; - CreatePaneDisplayGraph( iPN, "A", 'RadarCategory_Air' ) .. { - InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*2); - }; - CreatePaneDisplayGraph( iPN, "F", 'RadarCategory_Freeze' ) .. { - InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*3); - }; - CreatePaneDisplayGraph( iPN, "C", 'RadarCategory_Chaos' ) .. { - InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*4); - }; -}; +local iPN = ...; +assert(iPN,"[Graphics/PaneDisplay text.lua] No PlayerNumber Provided."); + +local t = Def.ActorFrame {}; +local function GetRadarData( pnPlayer, rcRadarCategory ) + local tRadarValues; + local StepsOrTrail; + local fDesiredValue = 0; + if GAMESTATE:GetCurrentSteps( pnPlayer ) then + StepsOrTrail = GAMESTATE:GetCurrentSteps( pnPlayer ); + fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); + elseif GAMESTATE:GetCurrentTrail( pnPlayer ) then + StepsOrTrail = GAMESTATE:GetCurrentTrail( pnPlayer ); + fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); + else + StepsOrTrail = nil; + end; + return fDesiredValue; +end; + +local function CreatePaneDisplayItem( _pnPlayer, _sLabel, _rcRadarCategory ) + return Def.ActorFrame { + LoadFont("Common Normal") .. { + Text=_sLabel; + InitCommand=cmd(horizalign,left); + OnCommand=cmd(zoom,0.5;diffuse,color("0.9,0.9,0.9");shadowlength,1); + }; + LoadFont("Common Normal") .. { + Text="000"; + InitCommand=cmd(x,32+8+4;horizalign,left); + OnCommand=cmd(zoom,0.5;shadowlength,1); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:settext("000") + else + self:settextf("%03i", GetRadarData( _pnPlayer, _rcRadarCategory ) ); + end + end; + }; + }; +end; + +local function CreatePaneDisplayGraph( _pnPlayer, _sLabel, _rcRadarCategory ) + return Def.ActorFrame { + LoadFont("Common Normal") .. { + Text=_sLabel; + InitCommand=cmd(horizalign,left); + OnCommand=cmd(zoom,0.5;shadowlength,1); + }; + Def.Quad { + InitCommand=cmd(x,12;zoomto,50,10;horizalign,left); + OnCommand=cmd(diffuse,Color("Black");shadowlength,1;diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(x,12;zoomto,50,10;horizalign,left); + OnCommand=cmd(shadowlength,0;diffuse,Color("Green");diffusebottomedge,ColorLightTone(Color("Green"))); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:stoptweening(); + self:decelerate(0.2); + self:zoomtowidth(0); + else + self:stoptweening(); + self:decelerate(0.2); + self:zoomtowidth( clamp(GetRadarData( _pnPlayer, _rcRadarCategory ) * 50,0,50) ); + end + end; + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(x,40;zoom,0.5;); + OnCommand=cmd(shadowlength,1;); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:settext("") + else + self:settextf("%i%%", GetRadarData( _pnPlayer, _rcRadarCategory ) * 100 ); + end + end; + }; + }; +end; + +--[[ Numbers ]] +t[#t+1] = Def.ActorFrame { + -- Left + CreatePaneDisplayItem( iPN, "TAPS", 'RadarCategory_TapsAndHolds' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14); + }; + CreatePaneDisplayItem( iPN, "JUMPS", 'RadarCategory_Jumps' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16); + }; + CreatePaneDisplayItem( iPN, "HOLDS", 'RadarCategory_Holds' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16*2); + }; + CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Mines' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16*3); + }; + -- Center + CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. { + InitCommand=cmd(x,-128+16+8+74;y,-14); + }; + CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. { + InitCommand=cmd(x,-128+16+8+74;y,-14+16); + }; + CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. { + InitCommand=cmd(x,-128+16+8+74;y,-14+16*2); + }; + CreatePaneDisplayItem( iPN, "FAKES", 'RadarCategory_Fakes' ) .. { + InitCommand=cmd(x,-128+16+8+74;y,-14+16*3); + }; + -- Right + CreatePaneDisplayGraph( iPN, "S", 'RadarCategory_Stream' ) .. { + InitCommand=cmd(x,-128+16+8+74*2;y,-14); + }; + CreatePaneDisplayGraph( iPN, "V", 'RadarCategory_Voltage' ) .. { + InitCommand=cmd(x,-128+16+8+74*2;y,-14+12); + }; + CreatePaneDisplayGraph( iPN, "A", 'RadarCategory_Air' ) .. { + InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*2); + }; + CreatePaneDisplayGraph( iPN, "F", 'RadarCategory_Freeze' ) .. { + InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*3); + }; + CreatePaneDisplayGraph( iPN, "C", 'RadarCategory_Chaos' ) .. { + InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*4); + }; +}; return t; \ No newline at end of file diff --git a/Themes/default/Graphics/Player combo/default.lua b/Themes/default/Graphics/Player combo/default.lua index 9ddb43cee3..185d4ba80b 100644 --- a/Themes/default/Graphics/Player combo/default.lua +++ b/Themes/default/Graphics/Player combo/default.lua @@ -1,142 +1,142 @@ -local c; -local cf; -local player = Var "Player"; -local ShowComboAt = THEME:GetMetric("Combo", "ShowComboAt"); -local Pulse = THEME:GetMetric("Combo", "PulseCommand"); -local PulseLabel = THEME:GetMetric("Combo", "PulseLabelCommand"); - -local NumberMinZoom = THEME:GetMetric("Combo", "NumberMinZoom"); -local NumberMaxZoom = THEME:GetMetric("Combo", "NumberMaxZoom"); -local NumberMaxZoomAt = THEME:GetMetric("Combo", "NumberMaxZoomAt"); - -local LabelMinZoom = THEME:GetMetric("Combo", "LabelMinZoom"); -local LabelMaxZoom = THEME:GetMetric("Combo", "LabelMaxZoom"); - -local ShowFlashyCombo = GetUserPrefB("UserPrefFlashyCombo") - -local t = Def.ActorFrame { - InitCommand=cmd(vertalign,bottom); - -- flashy combo elements: - LoadActor(THEME:GetPathG("Combo","100Milestone")) .. { - Name="OneHundredMilestone"; - InitCommand=cmd(visible,ShowFlashyCombo); - FiftyMilestoneCommand=cmd(playcommand,"Milestone"); - }; - LoadActor(THEME:GetPathG("Combo","1000Milestone")) .. { - Name="OneThousandMilestone"; - InitCommand=cmd(visible,ShowFlashyCombo); - ToastyAchievedMessageCommand=cmd(playcommand,"Milestone"); - }; - -- normal combo elements: - Def.ActorFrame { - Name="ComboFrame"; - LoadFont( "Combo", "numbers" ) .. { - Name="Number"; - OnCommand = THEME:GetMetric("Combo", "NumberOnCommand"); - }; - LoadFont("Common Normal") .. { - Name="Label"; - OnCommand = THEME:GetMetric("Combo", "LabelOnCommand"); - }; - }; - InitCommand = function(self) - c = self:GetChildren(); - cf = c.ComboFrame:GetChildren(); - cf.Number:visible(false); - cf.Label:visible(false); - end; - -- Milestones: - -- 25,50,100,250,600 Multiples; ---[[ if (iCombo % 100) == 0 then - c.OneHundredMilestone:playcommand("Milestone"); - elseif (iCombo % 250) == 0 then - -- It should really be 1000 but thats slightly unattainable, since - -- combo doesnt save over now. - c.OneThousandMilestone:playcommand("Milestone"); - else - return - end; --]] - TwentyFiveMilestoneCommand=function(self,parent) - if ShowFlashyCombo then - (cmd(skewy,-0.125;decelerate,0.325;skewy,0))(self); - end; - end; - --]] - --[[ - ToastyAchievedMessageCommand=function(self,params) - if params.PlayerNumber == player then - (cmd(thump,2;effectclock,'beat'))(c.ComboFrame); - end; - end; - ToastyDroppedMessageCommand=function(self,params) - if params.PlayerNumber == player then - (cmd(stopeffect))(c.ComboFrame); - end; - end; --]] - ComboCommand=function(self, param) - local iCombo = param.Misses or param.Combo; - if not iCombo or iCombo < ShowComboAt then - cf.Number:visible(false); - cf.Label:visible(false); - return; - end - - local labeltext = ""; - if param.Combo then - labeltext = "COMBO"; --- c.Number:playcommand("Reset"); - else - labeltext = "MISSES"; --- c.Number:playcommand("Miss"); - end - cf.Label:settext( labeltext ); - cf.Label:visible(false); - - param.Zoom = scale( iCombo, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom ); - param.Zoom = clamp( param.Zoom, NumberMinZoom, NumberMaxZoom ); - - param.LabelZoom = scale( iCombo, 0, NumberMaxZoomAt, LabelMinZoom, LabelMaxZoom ); - param.LabelZoom = clamp( param.LabelZoom, LabelMinZoom, LabelMaxZoom ); - - cf.Number:visible(true); - cf.Label:visible(true); - cf.Number:settext( string.format("%i", iCombo) ); - -- FullCombo Rewards - if param.FullComboW1 then - cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W1"] ); - cf.Number:glowshift(); - elseif param.FullComboW2 then - cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W2"] ); - cf.Number:glowshift(); - elseif param.FullComboW3 then - cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W3"] ); - cf.Number:stopeffect(); - elseif param.Combo then - -- Player 1's color is Red, which conflicts with the miss combo. - -- instead, just diffuse to white for now. -aj - --c.Number:diffuse(PlayerColor(player)); - cf.Number:diffuse(Color("White")); - cf.Number:stopeffect(); - (cmd(diffuse,Color("White");diffusebottomedge,color("0.5,0.5,0.5,1")))(cf.Label); - else - cf.Number:diffuse(color("#ff0000")); - cf.Number:stopeffect(); - (cmd(diffuse,Color("Red");diffusebottomedge,color("0.5,0,0,1")))(cf.Label); - end - -- Pulse - Pulse( cf.Number, param ); - PulseLabel( cf.Label, param ); - -- Milestone Logic - end; ---[[ ScoreChangedMessageCommand=function(self,param) - local iToastyCombo = param.ToastyCombo; - if iToastyCombo and (iToastyCombo > 0) then --- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) --- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) - else --- c.Number:stopeffect(); - end; - end; --]] -}; - -return t; +local c; +local cf; +local player = Var "Player"; +local ShowComboAt = THEME:GetMetric("Combo", "ShowComboAt"); +local Pulse = THEME:GetMetric("Combo", "PulseCommand"); +local PulseLabel = THEME:GetMetric("Combo", "PulseLabelCommand"); + +local NumberMinZoom = THEME:GetMetric("Combo", "NumberMinZoom"); +local NumberMaxZoom = THEME:GetMetric("Combo", "NumberMaxZoom"); +local NumberMaxZoomAt = THEME:GetMetric("Combo", "NumberMaxZoomAt"); + +local LabelMinZoom = THEME:GetMetric("Combo", "LabelMinZoom"); +local LabelMaxZoom = THEME:GetMetric("Combo", "LabelMaxZoom"); + +local ShowFlashyCombo = GetUserPrefB("UserPrefFlashyCombo") + +local t = Def.ActorFrame { + InitCommand=cmd(vertalign,bottom); + -- flashy combo elements: + LoadActor(THEME:GetPathG("Combo","100Milestone")) .. { + Name="OneHundredMilestone"; + InitCommand=cmd(visible,ShowFlashyCombo); + FiftyMilestoneCommand=cmd(playcommand,"Milestone"); + }; + LoadActor(THEME:GetPathG("Combo","1000Milestone")) .. { + Name="OneThousandMilestone"; + InitCommand=cmd(visible,ShowFlashyCombo); + ToastyAchievedMessageCommand=cmd(playcommand,"Milestone"); + }; + -- normal combo elements: + Def.ActorFrame { + Name="ComboFrame"; + LoadFont( "Combo", "numbers" ) .. { + Name="Number"; + OnCommand = THEME:GetMetric("Combo", "NumberOnCommand"); + }; + LoadFont("Common Normal") .. { + Name="Label"; + OnCommand = THEME:GetMetric("Combo", "LabelOnCommand"); + }; + }; + InitCommand = function(self) + c = self:GetChildren(); + cf = c.ComboFrame:GetChildren(); + cf.Number:visible(false); + cf.Label:visible(false); + end; + -- Milestones: + -- 25,50,100,250,600 Multiples; +--[[ if (iCombo % 100) == 0 then + c.OneHundredMilestone:playcommand("Milestone"); + elseif (iCombo % 250) == 0 then + -- It should really be 1000 but thats slightly unattainable, since + -- combo doesnt save over now. + c.OneThousandMilestone:playcommand("Milestone"); + else + return + end; --]] + TwentyFiveMilestoneCommand=function(self,parent) + if ShowFlashyCombo then + (cmd(skewy,-0.125;decelerate,0.325;skewy,0))(self); + end; + end; + --]] + --[[ + ToastyAchievedMessageCommand=function(self,params) + if params.PlayerNumber == player then + (cmd(thump,2;effectclock,'beat'))(c.ComboFrame); + end; + end; + ToastyDroppedMessageCommand=function(self,params) + if params.PlayerNumber == player then + (cmd(stopeffect))(c.ComboFrame); + end; + end; --]] + ComboCommand=function(self, param) + local iCombo = param.Misses or param.Combo; + if not iCombo or iCombo < ShowComboAt then + cf.Number:visible(false); + cf.Label:visible(false); + return; + end + + local labeltext = ""; + if param.Combo then + labeltext = "COMBO"; +-- c.Number:playcommand("Reset"); + else + labeltext = "MISSES"; +-- c.Number:playcommand("Miss"); + end + cf.Label:settext( labeltext ); + cf.Label:visible(false); + + param.Zoom = scale( iCombo, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom ); + param.Zoom = clamp( param.Zoom, NumberMinZoom, NumberMaxZoom ); + + param.LabelZoom = scale( iCombo, 0, NumberMaxZoomAt, LabelMinZoom, LabelMaxZoom ); + param.LabelZoom = clamp( param.LabelZoom, LabelMinZoom, LabelMaxZoom ); + + cf.Number:visible(true); + cf.Label:visible(true); + cf.Number:settext( string.format("%i", iCombo) ); + -- FullCombo Rewards + if param.FullComboW1 then + cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W1"] ); + cf.Number:glowshift(); + elseif param.FullComboW2 then + cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W2"] ); + cf.Number:glowshift(); + elseif param.FullComboW3 then + cf.Number:diffuse( GameColor.Judgment["JudgmentLine_W3"] ); + cf.Number:stopeffect(); + elseif param.Combo then + -- Player 1's color is Red, which conflicts with the miss combo. + -- instead, just diffuse to white for now. -aj + --c.Number:diffuse(PlayerColor(player)); + cf.Number:diffuse(Color("White")); + cf.Number:stopeffect(); + (cmd(diffuse,Color("White");diffusebottomedge,color("0.5,0.5,0.5,1")))(cf.Label); + else + cf.Number:diffuse(color("#ff0000")); + cf.Number:stopeffect(); + (cmd(diffuse,Color("Red");diffusebottomedge,color("0.5,0,0,1")))(cf.Label); + end + -- Pulse + Pulse( cf.Number, param ); + PulseLabel( cf.Label, param ); + -- Milestone Logic + end; +--[[ ScoreChangedMessageCommand=function(self,param) + local iToastyCombo = param.ToastyCombo; + if iToastyCombo and (iToastyCombo > 0) then +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) + else +-- c.Number:stopeffect(); + end; + end; --]] +}; + +return t; diff --git a/Themes/default/Graphics/Player judgment/default.lua b/Themes/default/Graphics/Player judgment/default.lua index 33e2dafde2..2028320c0d 100644 --- a/Themes/default/Graphics/Player judgment/default.lua +++ b/Themes/default/Graphics/Player judgment/default.lua @@ -1,221 +1,221 @@ -local c; -local player = Var "Player"; -local bShowProtiming = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(player) ); - -local function MakeAverage( t ) - local sum = 0; - for i=1,#t do - sum = sum + t[i]; - end - return sum / #t -end - -local tTotalJudgments = {}; - -local JudgeCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); -}; - -local ProtimingCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); -}; - -local AverageCmds = { - Pulse = THEME:GetMetric( "Protiming", "AveragePulseCommand" ); -}; -local TextCmds = { - Pulse = THEME:GetMetric( "Protiming", "TextPulseCommand" ); -}; - -local TNSFrames = { - TapNoteScore_W1 = 0; - TapNoteScore_W2 = 1; - TapNoteScore_W3 = 2; - TapNoteScore_W4 = 3; - TapNoteScore_W5 = 4; - TapNoteScore_Miss = 5; -}; -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - LoadActor(THEME:GetPathG("Judgment","Normal")) .. { - Name="Judgment"; - InitCommand=cmd(pause;visible,false); - OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - LoadFont("Combo Numbers") .. { - Name="ProtimingDisplay"; - Text=""; - InitCommand=cmd(visible,false); - OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - LoadFont("Common Normal") .. { - Name="ProtimingAverage"; - Text=""; - InitCommand=cmd(visible,false); - OnCommand=THEME:GetMetric("Protiming","AverageOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - LoadFont("Common Normal") .. { - Name="TextDisplay"; - Text="MS"; - InitCommand=cmd(visible,false); - OnCommand=THEME:GetMetric("Protiming","TextOnCommand"); - ResetCommand=cmd(finishtweening;stopeffect;visible,false); - }; - Def.Quad { - Name="ProtimingGraphBG"; - InitCommand=cmd(visible,false;y,32;zoomto,192,16); - ResetCommand=cmd(finishtweening;diffusealpha,0.8;visible,false); - OnCommand=cmd(diffuse,Color("Black");diffusetopedge,color("0.1,0.1,0.1,1");diffusealpha,0.8;shadowlength,2;); - }; - Def.Quad { - Name="ProtimingGraphWindowW3"; - InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4); - ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); - OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W3"];); - }; - Def.Quad { - Name="ProtimingGraphWindowW2"; - InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW2"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4); - ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); - OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W2"];); - }; - Def.Quad { - Name="ProtimingGraphWindowW1"; - InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW1"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4); - ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); - OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W1"];); - }; - Def.Quad { - Name="ProtimingGraphUnderlay"; - InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4); - ResetCommand=cmd(finishtweening;diffusealpha,0.25;visible,false); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); - }; - Def.Quad { - Name="ProtimingGraphFill"; - InitCommand=cmd(visible,false;y,32;zoomto,0,16-4;horizalign,left;); - ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); - OnCommand=cmd(diffuse,Color("Red");); - }; - Def.Quad { - Name="ProtimingGraphAverage"; - InitCommand=cmd(visible,false;y,32;zoomto,2,7;); - ResetCommand=cmd(finishtweening;diffusealpha,0.85;visible,false); - OnCommand=cmd(diffuse,Color("Orange");diffusealpha,0.85); - }; - Def.Quad { - Name="ProtimingGraphCenter"; - InitCommand=cmd(visible,false;y,32;zoomto,2,16-4;); - ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); - OnCommand=cmd(diffuse,Color("White");diffusealpha,1); - }; - InitCommand = function(self) - c = self:GetChildren(); - end; - - JudgmentMessageCommand=function(self, param) - if param.Player ~= player then return end; - if param.HoldNoteScore then return end; - - local iNumStates = c.Judgment:GetNumStates(); - local iFrame = TNSFrames[param.TapNoteScore]; - - if not iFrame then return end - if iNumStates == 12 then - iFrame = iFrame * 2; - if not param.Early then - iFrame = iFrame + 1; - end - end - - - local fTapNoteOffset = param.TapNoteOffset; - if param.HoldNoteScore then - fTapNoteOffset = 1; - else - fTapNoteOffset = param.TapNoteOffset; - end - - if param.TapNoteScore == 'TapNoteScore_Miss' then - fTapNoteOffset = 1; - bUseNegative = true; - else --- fTapNoteOffset = fTapNoteOffset; - bUseNegative = false; - end; - - if fTapNoteOffset ~= 1 then - -- we're safe, you can push the values - tTotalJudgments[#tTotalJudgments+1] = bUseNegative and fTapNoteOffset or math.abs( fTapNoteOffset ); - end - - self:playcommand("Reset"); - - c.Judgment:visible( not bShowProtiming ); - c.Judgment:setstate( iFrame ); - JudgeCmds[param.TapNoteScore](c.Judgment); - - c.ProtimingDisplay:visible( bShowProtiming ); - c.ProtimingDisplay:settextf("%i",math.abs(fTapNoteOffset * 1000)); - ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); - - c.ProtimingAverage:visible( bShowProtiming ); - c.ProtimingAverage:settextf("%.2f%%",clamp(100 - MakeAverage( tTotalJudgments ) * 1000 ,0,100)); - AverageCmds['Pulse'](c.ProtimingAverage); - - c.TextDisplay:visible( bShowProtiming ); - TextCmds['Pulse'](c.TextDisplay); - - c.ProtimingGraphBG:visible( bShowProtiming ); - c.ProtimingGraphUnderlay:visible( bShowProtiming ); - c.ProtimingGraphWindowW3:visible( bShowProtiming ); - c.ProtimingGraphWindowW2:visible( bShowProtiming ); - c.ProtimingGraphWindowW1:visible( bShowProtiming ); - c.ProtimingGraphFill:visible( bShowProtiming ); - c.ProtimingGraphFill:finishtweening(); - c.ProtimingGraphFill:decelerate(1/60); --- c.ProtimingGraphFill:zoomtowidth( clamp(fTapNoteOffset * 188,-188/2,188/2) ); - c.ProtimingGraphFill:zoomtowidth( clamp( - scale( - fTapNoteOffset, - 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0,188/2), - -188/2,188/2) - ); - c.ProtimingGraphAverage:visible( bShowProtiming ); - c.ProtimingGraphAverage:zoomtowidth( clamp( - scale( - MakeAverage( tTotalJudgments ), - 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0,188), - 0,188) - ); --- c.ProtimingGraphAverage:zoomtowidth( clamp(MakeAverage( tTotalJudgments ) * 1880,0,188) ); - c.ProtimingGraphCenter:visible( bShowProtiming ); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphBG); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphUnderlay); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW3); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW2); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW1); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphFill); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphAverage); - (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphCenter); - end; - -}; - - -return t; +local c; +local player = Var "Player"; +local bShowProtiming = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(player) ); + +local function MakeAverage( t ) + local sum = 0; + for i=1,#t do + sum = sum + t[i]; + end + return sum / #t +end + +local tTotalJudgments = {}; + +local JudgeCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); +}; + +local ProtimingCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); +}; + +local AverageCmds = { + Pulse = THEME:GetMetric( "Protiming", "AveragePulseCommand" ); +}; +local TextCmds = { + Pulse = THEME:GetMetric( "Protiming", "TextPulseCommand" ); +}; + +local TNSFrames = { + TapNoteScore_W1 = 0; + TapNoteScore_W2 = 1; + TapNoteScore_W3 = 2; + TapNoteScore_W4 = 3; + TapNoteScore_W5 = 4; + TapNoteScore_Miss = 5; +}; +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + LoadActor(THEME:GetPathG("Judgment","Normal")) .. { + Name="Judgment"; + InitCommand=cmd(pause;visible,false); + OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Combo Numbers") .. { + Name="ProtimingDisplay"; + Text=""; + InitCommand=cmd(visible,false); + OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Common Normal") .. { + Name="ProtimingAverage"; + Text=""; + InitCommand=cmd(visible,false); + OnCommand=THEME:GetMetric("Protiming","AverageOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Common Normal") .. { + Name="TextDisplay"; + Text="MS"; + InitCommand=cmd(visible,false); + OnCommand=THEME:GetMetric("Protiming","TextOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + Def.Quad { + Name="ProtimingGraphBG"; + InitCommand=cmd(visible,false;y,32;zoomto,192,16); + ResetCommand=cmd(finishtweening;diffusealpha,0.8;visible,false); + OnCommand=cmd(diffuse,Color("Black");diffusetopedge,color("0.1,0.1,0.1,1");diffusealpha,0.8;shadowlength,2;); + }; + Def.Quad { + Name="ProtimingGraphWindowW3"; + InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W3"];); + }; + Def.Quad { + Name="ProtimingGraphWindowW2"; + InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW2"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W2"];); + }; + Def.Quad { + Name="ProtimingGraphWindowW1"; + InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW1"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W1"];); + }; + Def.Quad { + Name="ProtimingGraphUnderlay"; + InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4); + ResetCommand=cmd(finishtweening;diffusealpha,0.25;visible,false); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + Name="ProtimingGraphFill"; + InitCommand=cmd(visible,false;y,32;zoomto,0,16-4;horizalign,left;); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,Color("Red");); + }; + Def.Quad { + Name="ProtimingGraphAverage"; + InitCommand=cmd(visible,false;y,32;zoomto,2,7;); + ResetCommand=cmd(finishtweening;diffusealpha,0.85;visible,false); + OnCommand=cmd(diffuse,Color("Orange");diffusealpha,0.85); + }; + Def.Quad { + Name="ProtimingGraphCenter"; + InitCommand=cmd(visible,false;y,32;zoomto,2,16-4;); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,Color("White");diffusealpha,1); + }; + InitCommand = function(self) + c = self:GetChildren(); + end; + + JudgmentMessageCommand=function(self, param) + if param.Player ~= player then return end; + if param.HoldNoteScore then return end; + + local iNumStates = c.Judgment:GetNumStates(); + local iFrame = TNSFrames[param.TapNoteScore]; + + if not iFrame then return end + if iNumStates == 12 then + iFrame = iFrame * 2; + if not param.Early then + iFrame = iFrame + 1; + end + end + + + local fTapNoteOffset = param.TapNoteOffset; + if param.HoldNoteScore then + fTapNoteOffset = 1; + else + fTapNoteOffset = param.TapNoteOffset; + end + + if param.TapNoteScore == 'TapNoteScore_Miss' then + fTapNoteOffset = 1; + bUseNegative = true; + else +-- fTapNoteOffset = fTapNoteOffset; + bUseNegative = false; + end; + + if fTapNoteOffset ~= 1 then + -- we're safe, you can push the values + tTotalJudgments[#tTotalJudgments+1] = bUseNegative and fTapNoteOffset or math.abs( fTapNoteOffset ); + end + + self:playcommand("Reset"); + + c.Judgment:visible( not bShowProtiming ); + c.Judgment:setstate( iFrame ); + JudgeCmds[param.TapNoteScore](c.Judgment); + + c.ProtimingDisplay:visible( bShowProtiming ); + c.ProtimingDisplay:settextf("%i",math.abs(fTapNoteOffset * 1000)); + ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); + + c.ProtimingAverage:visible( bShowProtiming ); + c.ProtimingAverage:settextf("%.2f%%",clamp(100 - MakeAverage( tTotalJudgments ) * 1000 ,0,100)); + AverageCmds['Pulse'](c.ProtimingAverage); + + c.TextDisplay:visible( bShowProtiming ); + TextCmds['Pulse'](c.TextDisplay); + + c.ProtimingGraphBG:visible( bShowProtiming ); + c.ProtimingGraphUnderlay:visible( bShowProtiming ); + c.ProtimingGraphWindowW3:visible( bShowProtiming ); + c.ProtimingGraphWindowW2:visible( bShowProtiming ); + c.ProtimingGraphWindowW1:visible( bShowProtiming ); + c.ProtimingGraphFill:visible( bShowProtiming ); + c.ProtimingGraphFill:finishtweening(); + c.ProtimingGraphFill:decelerate(1/60); +-- c.ProtimingGraphFill:zoomtowidth( clamp(fTapNoteOffset * 188,-188/2,188/2) ); + c.ProtimingGraphFill:zoomtowidth( clamp( + scale( + fTapNoteOffset, + 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), + 0,188/2), + -188/2,188/2) + ); + c.ProtimingGraphAverage:visible( bShowProtiming ); + c.ProtimingGraphAverage:zoomtowidth( clamp( + scale( + MakeAverage( tTotalJudgments ), + 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), + 0,188), + 0,188) + ); +-- c.ProtimingGraphAverage:zoomtowidth( clamp(MakeAverage( tTotalJudgments ) * 1880,0,188) ); + c.ProtimingGraphCenter:visible( bShowProtiming ); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphBG); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphUnderlay); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW3); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW2); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW1); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphFill); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphAverage); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphCenter); + end; + +}; + + +return t; diff --git a/Themes/default/Graphics/Player toasty/default.lua b/Themes/default/Graphics/Player toasty/default.lua index 806fab1278..bbc4c72c04 100644 --- a/Themes/default/Graphics/Player toasty/default.lua +++ b/Themes/default/Graphics/Player toasty/default.lua @@ -1,34 +1,34 @@ -local Player = ... -assert(Player); -local HasToasty = false; -local fWidth = ( GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' ) and 600 or 256+16; -return Def.ActorFrame { - ToastyAchievedMessageCommand=function(self,params) - if params.PlayerNumber == Player then - (cmd(thump,1;effectclock,'beat';effectmagnitude,1,1,1; - effectcolor1,color("1,1.125,1,1");effectcolor2,color("1,1,1,1")))(self); - end - end; - Def.Quad { - InitCommand=cmd(zoomto,fWidth,SCREEN_HEIGHT;diffuse,PlayerColor(Player);diffusealpha,0;fadeleft,32/(256+16);faderight,32/(256+16)); - ToastyAchievedMessageCommand=function(self,params) - if params.PlayerNumber == Player then - (cmd(stoptweening;linear,2.125;diffuse,Colors.Alpha( PlayerColor(Player), 0.345 );glow,color("1,1,1,0.5");decelerate,3;glow,Colors.Alpha( ColorDarkTone( PlayerColor(Player) ), 0 );diffuseramp; - effectcolor1,ColorLightTone( PlayerColor(Player) );effectcolor2,PlayerColor(Player); - effectclock,'beat';effectperiod,2; - ))(self); - HasToasty = true; - end - end; - ToastyDroppedMessageCommand=function(self,params) - if params.PlayerNumber == Player then - if HasToasty then - (cmd(finishtweening;stopeffect;glow,color("1,1,1,0.5");decelerate,0.35;diffuse,Colors.Alpha( Color("Black"), 0.25 );glow,color("1,1,1,0");linear,0.35*0.25;diffusealpha,0))(self); - HasToasty = false; - else - return - end - end - end; - }; +local Player = ... +assert(Player); +local HasToasty = false; +local fWidth = ( GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' ) and 600 or 256+16; +return Def.ActorFrame { + ToastyAchievedMessageCommand=function(self,params) + if params.PlayerNumber == Player then + (cmd(thump,1;effectclock,'beat';effectmagnitude,1,1,1; + effectcolor1,color("1,1.125,1,1");effectcolor2,color("1,1,1,1")))(self); + end + end; + Def.Quad { + InitCommand=cmd(zoomto,fWidth,SCREEN_HEIGHT;diffuse,PlayerColor(Player);diffusealpha,0;fadeleft,32/(256+16);faderight,32/(256+16)); + ToastyAchievedMessageCommand=function(self,params) + if params.PlayerNumber == Player then + (cmd(stoptweening;linear,2.125;diffuse,Colors.Alpha( PlayerColor(Player), 0.345 );glow,color("1,1,1,0.5");decelerate,3;glow,Colors.Alpha( ColorDarkTone( PlayerColor(Player) ), 0 );diffuseramp; + effectcolor1,ColorLightTone( PlayerColor(Player) );effectcolor2,PlayerColor(Player); + effectclock,'beat';effectperiod,2; + ))(self); + HasToasty = true; + end + end; + ToastyDroppedMessageCommand=function(self,params) + if params.PlayerNumber == Player then + if HasToasty then + (cmd(finishtweening;stopeffect;glow,color("1,1,1,0.5");decelerate,0.35;diffuse,Colors.Alpha( Color("Black"), 0.25 );glow,color("1,1,1,0");linear,0.35*0.25;diffusealpha,0))(self); + HasToasty = false; + else + return + end + end + end; + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation GameType.lua b/Themes/default/Graphics/ScreenEvaluation GameType.lua index 6e72da4928..acd98e1007 100644 --- a/Themes/default/Graphics/ScreenEvaluation GameType.lua +++ b/Themes/default/Graphics/ScreenEvaluation GameType.lua @@ -1,3 +1,3 @@ -return LoadFont("Common Normal") .. { - Text=GAMESTATE:GetCurrentGame():GetName(); +return LoadFont("Common Normal") .. { + Text=GAMESTATE:GetCurrentGame():GetName(); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation LifeDifficulty.lua b/Themes/default/Graphics/ScreenEvaluation LifeDifficulty.lua index cfc20c06e8..2c237016da 100644 --- a/Themes/default/Graphics/ScreenEvaluation LifeDifficulty.lua +++ b/Themes/default/Graphics/ScreenEvaluation LifeDifficulty.lua @@ -1,7 +1,7 @@ -return LoadFont("Common Normal") .. { - Text=GetLifeDifficulty(); - AltText=""; - BeginCommand=function(self) - self:settextf( Screen.String("LifeDifficulty"), GetLifeDifficulty() ); - end +return LoadFont("Common Normal") .. { + Text=GetLifeDifficulty(); + AltText=""; + BeginCommand=function(self) + self:settextf( Screen.String("LifeDifficulty"), GetLifeDifficulty() ); + end }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation MachineRecord.lua b/Themes/default/Graphics/ScreenEvaluation MachineRecord.lua index 58dada9d49..3a19359761 100644 --- a/Themes/default/Graphics/ScreenEvaluation MachineRecord.lua +++ b/Themes/default/Graphics/ScreenEvaluation MachineRecord.lua @@ -1,11 +1,11 @@ -local Player = ... -assert(Player,"MachineRecord needs Player") -local stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(Player); -local record = stats:GetMachineHighScoreIndex() -local hasMachineRecord = record ~= -1 - -return LoadFont("Common normal")..{ - Text=string.format("Machine Record #%i!", record+1); - InitCommand=cmd(zoom,0.55;shadowlength,1;NoStroke;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.25")); - BeginCommand=cmd(visible,hasMachineRecord;); +local Player = ... +assert(Player,"MachineRecord needs Player") +local stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(Player); +local record = stats:GetMachineHighScoreIndex() +local hasMachineRecord = record ~= -1 + +return LoadFont("Common normal")..{ + Text=string.format("Machine Record #%i!", record+1); + InitCommand=cmd(zoom,0.55;shadowlength,1;NoStroke;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.25")); + BeginCommand=cmd(visible,hasMachineRecord;); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation PersonalRecord.lua b/Themes/default/Graphics/ScreenEvaluation PersonalRecord.lua index 01ecde54dd..3d8cf2ca9b 100644 --- a/Themes/default/Graphics/ScreenEvaluation PersonalRecord.lua +++ b/Themes/default/Graphics/ScreenEvaluation PersonalRecord.lua @@ -1,11 +1,11 @@ -local Player = ... -assert(Player,"PersonalRecord needs Player") -local stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(Player); -local record = stats:GetPersonalHighScoreIndex() -local hasPersonalRecord = record ~= -1 - -return LoadFont("Common normal")..{ - Text=string.format("Personal Record #%i!", record+1); - InitCommand=cmd(zoom,0.55;shadowlength,1;NoStroke;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.25")); - BeginCommand=cmd(visible,hasPersonalRecord;); +local Player = ... +assert(Player,"PersonalRecord needs Player") +local stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(Player); +local record = stats:GetPersonalHighScoreIndex() +local hasPersonalRecord = record ~= -1 + +return LoadFont("Common normal")..{ + Text=string.format("Personal Record #%i!", record+1); + InitCommand=cmd(zoom,0.55;shadowlength,1;NoStroke;glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.25")); + BeginCommand=cmd(visible,hasPersonalRecord;); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation SongInformation.lua b/Themes/default/Graphics/ScreenEvaluation SongInformation.lua index 35a84238c7..38ca441389 100644 --- a/Themes/default/Graphics/ScreenEvaluation SongInformation.lua +++ b/Themes/default/Graphics/ScreenEvaluation SongInformation.lua @@ -1,20 +1,20 @@ -return Def.ActorFrame { - LoadFont("Common Normal") .. { - Name="TextTitle"; - InitCommand=cmd(y,-16.5;zoom,0.875;maxwidth,256/0.875;); - OnCommand=cmd(shadowlength,1); --- TickCommand=cmd(finishtweening;diffusealpha,0;addx,-10;zoomx,1.25;zoomy,0;decelerate,0.25;diffusealpha,1;addx,10;zoom,1;sleep,0;glow,Color("White");decelerate,0.275;glow,Color("Invisible")); - }; - LoadFont("Common Normal") .. { - Name="TextSubtitle"; - InitCommand=cmd(zoom,0.5;maxwidth,256/0.5); - OnCommand=cmd(shadowlength,1); --- TickCommand=cmd(finishtweening;diffusealpha,0;addy,-10;addx,10;decelerate,0.25;diffusealpha,1;addy,10;addx,-10); - }; - LoadFont("Common Normal") .. { - Name="TextArtist"; - InitCommand=cmd(y,18;zoom,0.75;maxwidth,256/0.75); - OnCommand=cmd(shadowlength,1;skewx,-0.2); --- TickCommand=cmd(finishtweening;diffusealpha,0;addy,10;addx,10;decelerate,0.25;diffusealpha,1;addy,-10;addx,-10); - }; +return Def.ActorFrame { + LoadFont("Common Normal") .. { + Name="TextTitle"; + InitCommand=cmd(y,-16.5;zoom,0.875;maxwidth,256/0.875;); + OnCommand=cmd(shadowlength,1); +-- TickCommand=cmd(finishtweening;diffusealpha,0;addx,-10;zoomx,1.25;zoomy,0;decelerate,0.25;diffusealpha,1;addx,10;zoom,1;sleep,0;glow,Color("White");decelerate,0.275;glow,Color("Invisible")); + }; + LoadFont("Common Normal") .. { + Name="TextSubtitle"; + InitCommand=cmd(zoom,0.5;maxwidth,256/0.5); + OnCommand=cmd(shadowlength,1); +-- TickCommand=cmd(finishtweening;diffusealpha,0;addy,-10;addx,10;decelerate,0.25;diffusealpha,1;addy,10;addx,-10); + }; + LoadFont("Common Normal") .. { + Name="TextArtist"; + InitCommand=cmd(y,18;zoom,0.75;maxwidth,256/0.75); + OnCommand=cmd(shadowlength,1;skewx,-0.2); +-- TickCommand=cmd(finishtweening;diffusealpha,0;addy,10;addx,10;decelerate,0.25;diffusealpha,1;addy,-10;addx,-10); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenEvaluation TimingDifficulty.lua b/Themes/default/Graphics/ScreenEvaluation TimingDifficulty.lua index a5658f1fd3..f029edacb5 100644 --- a/Themes/default/Graphics/ScreenEvaluation TimingDifficulty.lua +++ b/Themes/default/Graphics/ScreenEvaluation TimingDifficulty.lua @@ -1,7 +1,7 @@ -return LoadFont("Common Normal") .. { - Text=GetLifeDifficulty(); - AltText=""; - BeginCommand=function(self) - self:settextf( Screen.String("TimingDifficulty"), GetTimingDifficulty() ); - end +return LoadFont("Common Normal") .. { + Text=GetLifeDifficulty(); + AltText=""; + BeginCommand=function(self) + self:settextf( Screen.String("TimingDifficulty"), GetTimingDifficulty() ); + end }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenGameplay BPMDisplay.lua b/Themes/default/Graphics/ScreenGameplay BPMDisplay.lua index 3a4c83ee2c..3bed3203ec 100644 --- a/Themes/default/Graphics/ScreenGameplay BPMDisplay.lua +++ b/Themes/default/Graphics/ScreenGameplay BPMDisplay.lua @@ -1,8 +1,8 @@ -return Def.SongBPMDisplay { - File=THEME:GetPathF("BPMDisplay", "bpm"); - Name="BPMDisplay"; - InitCommand=cmd(zoom,0.675;shadowlength,1); - SetCommand=function(self) self:SetFromGameState() end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); +return Def.SongBPMDisplay { + File=THEME:GetPathF("BPMDisplay", "bpm"); + Name="BPMDisplay"; + InitCommand=cmd(zoom,0.675;shadowlength,1); + SetCommand=function(self) self:SetFromGameState() end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenGameplay DeltaSeconds.lua b/Themes/default/Graphics/ScreenGameplay DeltaSeconds.lua index 91590401a7..a34e7365b0 100644 --- a/Themes/default/Graphics/ScreenGameplay DeltaSeconds.lua +++ b/Themes/default/Graphics/ScreenGameplay DeltaSeconds.lua @@ -1,21 +1,21 @@ -local PlayerNumber = ...; -assert( PlayerNumber ); - -local t = LoadFont("ScreenGameplay","RemainingTime") .. { - Name="RemainingTime"; - Text=""; - JudgmentMessageCommand=function(self,params) - if params.Player == PlayerNumber then - if params.TapNoteScore then - self:playcommand( "GainSeconds" ); - self:playcommand( ToEnumShortString( params.TapNoteScore ) ); - self:settextf( "%+1.1fs", PREFSMAN:GetPreference( string.format("TimeMeterSecondsChange%s", ToEnumShortString( params.TapNoteScore ) ) ) ); - else - return - end - else - return - end - end; -}; +local PlayerNumber = ...; +assert( PlayerNumber ); + +local t = LoadFont("ScreenGameplay","RemainingTime") .. { + Name="RemainingTime"; + Text=""; + JudgmentMessageCommand=function(self,params) + if params.Player == PlayerNumber then + if params.TapNoteScore then + self:playcommand( "GainSeconds" ); + self:playcommand( ToEnumShortString( params.TapNoteScore ) ); + self:settextf( "%+1.1fs", PREFSMAN:GetPreference( string.format("TimeMeterSecondsChange%s", ToEnumShortString( params.TapNoteScore ) ) ) ); + else + return + end + else + return + end + end; +}; return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenGameplay RemainingTime.lua b/Themes/default/Graphics/ScreenGameplay RemainingTime.lua index 593acc15aa..46fa34bd13 100644 --- a/Themes/default/Graphics/ScreenGameplay RemainingTime.lua +++ b/Themes/default/Graphics/ScreenGameplay RemainingTime.lua @@ -1,9 +1,9 @@ -local PlayerNumber = ...; -assert( PlayerNumber ); - -local t = LoadFont("ScreenGameplay","RemainingTime") .. { - Name="SurvivalTime"; - Text=""; -}; - +local PlayerNumber = ...; +assert( PlayerNumber ); + +local t = LoadFont("ScreenGameplay","RemainingTime") .. { + Name="SurvivalTime"; + Text=""; +}; + return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenGameplay SongTitle.lua b/Themes/default/Graphics/ScreenGameplay SongTitle.lua index 4da5e47d87..bcba67547d 100644 --- a/Themes/default/Graphics/ScreenGameplay SongTitle.lua +++ b/Themes/default/Graphics/ScreenGameplay SongTitle.lua @@ -1,16 +1,16 @@ -return LoadFont("ScreenGameplay","SongTitle") .. { - CurrentSongChangedMessageCommand=cmd(playcommand,"Refresh"); - RefreshCommand=function(self) - local vSong = GAMESTATE:GetCurrentSong(); - local vCourse = GAMESTATE:GetCurrentCourse(); - local sText = "" - if vSong then - sText = vSong:GetDisplayArtist() .. " - " .. vSong:GetDisplayFullTitle() - end - if vCourse then - sText = vCourse:GetDisplayFullTitle() .. " - " .. vSong:GetDisplayFullTitle(); - end - self:settext( sText ); - self:playcommand( "On" ); - end; +return LoadFont("ScreenGameplay","SongTitle") .. { + CurrentSongChangedMessageCommand=cmd(playcommand,"Refresh"); + RefreshCommand=function(self) + local vSong = GAMESTATE:GetCurrentSong(); + local vCourse = GAMESTATE:GetCurrentCourse(); + local sText = "" + if vSong then + sText = vSong:GetDisplayArtist() .. " - " .. vSong:GetDisplayFullTitle() + end + if vCourse then + sText = vCourse:GetDisplayFullTitle() .. " - " .. vSong:GetDisplayFullTitle(); + end + self:settext( sText ); + self:playcommand( "On" ); + end; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenGameplay StageDisplay.lua b/Themes/default/Graphics/ScreenGameplay StageDisplay.lua index fc7c4e2211..a20a1c542f 100644 --- a/Themes/default/Graphics/ScreenGameplay StageDisplay.lua +++ b/Themes/default/Graphics/ScreenGameplay StageDisplay.lua @@ -1,36 +1,36 @@ -local stages = Def.ActorFrame { - BeginCommand=cmd(playcommand,"Set";); - CurrentSongChangedMessageCommand=cmd(finishtweening;playcommand,"Set";); -}; - -local ScreenName = Var "LoadingScreen"; - -function MakeBitmapTest() - return LoadFont(ScreenName,"StageDisplay") .. { - - }; -end - -for s in ivalues(Stage) do - stages[#stages+1] = MakeBitmapTest() .. { - SetCommand=function(self, params) - local Stage = GAMESTATE:GetCurrentStage(); - local StageIndex = GAMESTATE:GetCurrentStageIndex(); - local screen = SCREENMAN:GetTopScreen(); - local cStageOutlineColor = ColorDarkTone( StageToStrokeColor(s) ); - cStageOutlineColor[4] = 0.75; - if screen and screen.GetStageStats then - local ss = screen:GetStageStats(); - Stage = ss:GetStage(); - StageIndex = ss:GetStageIndex(); - end - self:visible( Stage == s ); - self:settext( StageToLocalizedString(Stage) ); - self:diffuse( StageToColor(s) ); - self:diffusebottomedge( ColorMidTone(StageToColor(s)) ); - self:strokecolor( cStageOutlineColor ); - end; - } -end - -return stages; +local stages = Def.ActorFrame { + BeginCommand=cmd(playcommand,"Set";); + CurrentSongChangedMessageCommand=cmd(finishtweening;playcommand,"Set";); +}; + +local ScreenName = Var "LoadingScreen"; + +function MakeBitmapTest() + return LoadFont(ScreenName,"StageDisplay") .. { + + }; +end + +for s in ivalues(Stage) do + stages[#stages+1] = MakeBitmapTest() .. { + SetCommand=function(self, params) + local Stage = GAMESTATE:GetCurrentStage(); + local StageIndex = GAMESTATE:GetCurrentStageIndex(); + local screen = SCREENMAN:GetTopScreen(); + local cStageOutlineColor = ColorDarkTone( StageToStrokeColor(s) ); + cStageOutlineColor[4] = 0.75; + if screen and screen.GetStageStats then + local ss = screen:GetStageStats(); + Stage = ss:GetStage(); + StageIndex = ss:GetStageIndex(); + end + self:visible( Stage == s ); + self:settext( StageToLocalizedString(Stage) ); + self:diffuse( StageToColor(s) ); + self:diffusebottomedge( ColorMidTone(StageToColor(s)) ); + self:strokecolor( cStageOutlineColor ); + end; + } +end + +return stages; diff --git a/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua b/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua index 36a998d9dc..73fd0c5e72 100644 --- a/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua +++ b/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua @@ -1,121 +1,121 @@ -local gc = Var "GameCommand"; -local Name = gc:GetName(); -local Index = gc:GetIndex(); - -local previewWidth = SCREEN_CENTER_X*0.825; -local previewHeight = SCREEN_CENTER_Y; - -local t = Def.ActorFrame{ - Name="PreviewFrame"; - InitCommand=cmd(x,SCREEN_CENTER_X*1.5;y,SCREEN_CENTER_Y*0.85); - OffCommand=cmd(bouncebegin,0.25;addx,SCREEN_CENTER_X); -}; - -local function TitleMenuItem(text,focused) - if focused == nil then focused = false; end; - local textColor = focused and color("#FFFFFF") or color("#888888"); - return LoadFont("Common Normal")..{ - Text=text; - InitCommand=cmd(zoom,0.45;strokecolor,Color("Outline");diffuse,textColor); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; -end; - -local previews = { - WhereToFind = Def.ActorFrame{ - LoadActor(THEME:GetPathG("_howto","find"))..{ - InitCommand=cmd(zoomto,previewWidth,previewHeight); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - }; - HowToInstall = Def.ActorFrame{ - LoadActor(THEME:GetPathG("_howto","install"))..{ - InitCommand=cmd(zoomto,previewWidth,previewHeight); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - }; - AdditionalFolders = Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,previewWidth,previewHeight); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - Def.Quad{ - InitCommand=cmd(y,-previewHeight*0.45;diffuse,color("#E0F0F0");zoomto,previewWidth,previewHeight*0.1;); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - LoadFont("Common normal")..{ - InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.475);zoom,0.625;halign,0;valign,0;diffuse,color("#000000")); - BeginCommand=function(self) - local text = "Preferences.ini"; - self:settext(text); - end; - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - LoadFont("Common normal")..{ - Text="[Options]\nAdditionalCourseFolders=\nAdditionalFolders=\nAdditionalSongFolders="; - InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.35);zoom,0.75;halign,0;valign,0;diffuse,color("#000000")); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - }; - ReloadSongs = Def.ActorFrame{ - LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ - InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - LoadFont("Common normal")..{ - InitCommand=cmd(zoom,0.4;maxwidth,(previewWidth*1.6)-8); - BeginCommand=function(self) - local song = SONGMAN:GetRandomSong(); - self:settext("Loading songs...\n"..song:GetGroupName().."\n"..song:GetDisplayFullTitle()); - end; - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - }; - Exit = Def.ActorFrame{ - LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ - InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - LoadActor(THEME:GetPathG("ScreenTitleMenu","logo"))..{ - InitCommand=cmd(y,-28;zoom,0.35;propagate,true); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); - }; - TitleMenuItem("Game Start",true)..{ - InitCommand=cmd(y,20); - }; - TitleMenuItem("Options")..{ - InitCommand=cmd(y,32); - }; - TitleMenuItem("Edit/Share")..{ - InitCommand=cmd(y,44); - }; - TitleMenuItem("Exit")..{ - InitCommand=cmd(y,56); - }; - }; -}; - -t[#t+1] = previews[Name]; - -t[#t+1] = LoadFont("Common normal")..{ - Name="Explanation"; - --Text="The quick brown fox jumps over the lazy dog ".. Index .." times."; - Text=Screen.String("Explanation-"..Name); - -- was x,-(SCREEN_CENTER_X*0.4);y,SCREEN_CENTER_Y*0.525; - InitCommand=cmd(x,-(SCREEN_CENTER_X*0.8);y,SCREEN_CENTER_Y*0.8;halign,0;valign,0;zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH*0.55)*1.75;NoStroke;shadowlength,1); - GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); -}; - +local gc = Var "GameCommand"; +local Name = gc:GetName(); +local Index = gc:GetIndex(); + +local previewWidth = SCREEN_CENTER_X*0.825; +local previewHeight = SCREEN_CENTER_Y; + +local t = Def.ActorFrame{ + Name="PreviewFrame"; + InitCommand=cmd(x,SCREEN_CENTER_X*1.5;y,SCREEN_CENTER_Y*0.85); + OffCommand=cmd(bouncebegin,0.25;addx,SCREEN_CENTER_X); +}; + +local function TitleMenuItem(text,focused) + if focused == nil then focused = false; end; + local textColor = focused and color("#FFFFFF") or color("#888888"); + return LoadFont("Common Normal")..{ + Text=text; + InitCommand=cmd(zoom,0.45;strokecolor,Color("Outline");diffuse,textColor); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; +end; + +local previews = { + WhereToFind = Def.ActorFrame{ + LoadActor(THEME:GetPathG("_howto","find"))..{ + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + }; + HowToInstall = Def.ActorFrame{ + LoadActor(THEME:GetPathG("_howto","install"))..{ + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + }; + AdditionalFolders = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + Def.Quad{ + InitCommand=cmd(y,-previewHeight*0.45;diffuse,color("#E0F0F0");zoomto,previewWidth,previewHeight*0.1;); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + LoadFont("Common normal")..{ + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.475);zoom,0.625;halign,0;valign,0;diffuse,color("#000000")); + BeginCommand=function(self) + local text = "Preferences.ini"; + self:settext(text); + end; + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + LoadFont("Common normal")..{ + Text="[Options]\nAdditionalCourseFolders=\nAdditionalFolders=\nAdditionalSongFolders="; + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.35);zoom,0.75;halign,0;valign,0;diffuse,color("#000000")); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + }; + ReloadSongs = Def.ActorFrame{ + LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ + InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + LoadFont("Common normal")..{ + InitCommand=cmd(zoom,0.4;maxwidth,(previewWidth*1.6)-8); + BeginCommand=function(self) + local song = SONGMAN:GetRandomSong(); + self:settext("Loading songs...\n"..song:GetGroupName().."\n"..song:GetDisplayFullTitle()); + end; + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + }; + Exit = Def.ActorFrame{ + LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ + InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + LoadActor(THEME:GetPathG("ScreenTitleMenu","logo"))..{ + InitCommand=cmd(y,-28;zoom,0.35;propagate,true); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); + }; + TitleMenuItem("Game Start",true)..{ + InitCommand=cmd(y,20); + }; + TitleMenuItem("Options")..{ + InitCommand=cmd(y,32); + }; + TitleMenuItem("Edit/Share")..{ + InitCommand=cmd(y,44); + }; + TitleMenuItem("Exit")..{ + InitCommand=cmd(y,56); + }; + }; +}; + +t[#t+1] = previews[Name]; + +t[#t+1] = LoadFont("Common normal")..{ + Name="Explanation"; + --Text="The quick brown fox jumps over the lazy dog ".. Index .." times."; + Text=Screen.String("Explanation-"..Name); + -- was x,-(SCREEN_CENTER_X*0.4);y,SCREEN_CENTER_Y*0.525; + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.8);y,SCREEN_CENTER_Y*0.8;halign,0;valign,0;zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH*0.55)*1.75;NoStroke;shadowlength,1); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenHowToInstallSongs scroll.lua b/Themes/default/Graphics/ScreenHowToInstallSongs scroll.lua index 35d1ab7005..41b7963298 100644 --- a/Themes/default/Graphics/ScreenHowToInstallSongs scroll.lua +++ b/Themes/default/Graphics/ScreenHowToInstallSongs scroll.lua @@ -1,16 +1,16 @@ -local gc = Var("GameCommand"); -local squareSize = 8; -- was 18 - -return Def.ActorFrame { - Def.Quad{ - InitCommand=cmd(x,-12;zoom,squareSize;rotationz,45;diffuse,color("#222222")); - GainFocusCommand=cmd(stoptweening;accelerate,0.25;zoom,squareSize;rotationz,45;); - LoseFocusCommand=cmd(stoptweening;decelerate,0.25;zoom,0;rotationz,360+45); - }; - LoadFont("Common Normal") .. { - Text=gc:GetText(); - InitCommand=cmd(halign,0;zoom,0.625); - GainFocusCommand=cmd(stoptweening;decelerate,0.25;diffuse,color("1,1,1,1")); - LoseFocusCommand=cmd(stoptweening;accelerate,0.25;diffuse,color("0.5,0.5,0.5,1")); - }; +local gc = Var("GameCommand"); +local squareSize = 8; -- was 18 + +return Def.ActorFrame { + Def.Quad{ + InitCommand=cmd(x,-12;zoom,squareSize;rotationz,45;diffuse,color("#222222")); + GainFocusCommand=cmd(stoptweening;accelerate,0.25;zoom,squareSize;rotationz,45;); + LoseFocusCommand=cmd(stoptweening;decelerate,0.25;zoom,0;rotationz,360+45); + }; + LoadFont("Common Normal") .. { + Text=gc:GetText(); + InitCommand=cmd(halign,0;zoom,0.625); + GainFocusCommand=cmd(stoptweening;decelerate,0.25;diffuse,color("1,1,1,1")); + LoseFocusCommand=cmd(stoptweening;accelerate,0.25;diffuse,color("0.5,0.5,0.5,1")); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenNetSelectBase ChatInputBox.lua b/Themes/default/Graphics/ScreenNetSelectBase ChatInputBox.lua index 25a41e471c..288b3b06bb 100644 --- a/Themes/default/Graphics/ScreenNetSelectBase ChatInputBox.lua +++ b/Themes/default/Graphics/ScreenNetSelectBase ChatInputBox.lua @@ -1,5 +1,5 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,THEME:GetMetric(Var "LoadingScreen","ChatInputBoxWidth"),THEME:GetMetric(Var "LoadingScreen","ChatInputBoxHeight");diffuse,color("0,0,0,0.25")); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(zoomto,THEME:GetMetric(Var "LoadingScreen","ChatInputBoxWidth"),THEME:GetMetric(Var "LoadingScreen","ChatInputBoxHeight");diffuse,color("0,0,0,0.25")); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenNetSelectBase ChatOutputBox.lua b/Themes/default/Graphics/ScreenNetSelectBase ChatOutputBox.lua index 2f0458f04e..31d73053d7 100644 --- a/Themes/default/Graphics/ScreenNetSelectBase ChatOutputBox.lua +++ b/Themes/default/Graphics/ScreenNetSelectBase ChatOutputBox.lua @@ -1,5 +1,5 @@ -return Def.ActorFrame{ - Def.Quad{ - InitCommand=cmd(zoomto,THEME:GetMetric(Var "LoadingScreen","ChatOutputBoxWidth"),THEME:GetMetric(Var "LoadingScreen","ChatOutputBoxHeight");diffuse,color("0,0,0,0.25")); - }; +return Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(zoomto,THEME:GetMetric(Var "LoadingScreen","ChatOutputBoxWidth"),THEME:GetMetric(Var "LoadingScreen","ChatOutputBoxHeight");diffuse,color("0,0,0,0.25")); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenOptions disqualify.lua b/Themes/default/Graphics/ScreenOptions disqualify.lua index 250e18f633..b0dc98a26a 100644 --- a/Themes/default/Graphics/ScreenOptions disqualify.lua +++ b/Themes/default/Graphics/ScreenOptions disqualify.lua @@ -1,3 +1,3 @@ -return LoadFont("Common Normal") .. { - Text="Score will be disqualified!"; +return LoadFont("Common Normal") .. { + Text="Score will be disqualified!"; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenQuickSetupOverview icon/default.lua b/Themes/default/Graphics/ScreenQuickSetupOverview icon/default.lua index 2bf66b890e..737cc41cc2 100644 --- a/Themes/default/Graphics/ScreenQuickSetupOverview icon/default.lua +++ b/Themes/default/Graphics/ScreenQuickSetupOverview icon/default.lua @@ -1,37 +1,37 @@ -local gc = Var "GameCommand"; -local c = {}; - c.X = THEME:GetMetric( Var "LoadingScreen", "Icon" .. gc:GetName() .. "X"); - c.Y = THEME:GetMetric( Var "LoadingScreen", "Icon" .. gc:GetName() .. "Y"); -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - Condition=( gc:GetName() ~= "Back" ); - InitCommand=cmd(x,c.X;y,c.Y); - GainFocusCommand=cmd(finishtweening;zoom,1.125;bounceend,0.125;zoom,1); - LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.875); - LoadActor("_base") .. { - GainFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("Orange");diffusetopedge,Color("Yellow")); - LoseFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("White")); - }; - LoadFont("Common Normal") .. { - Text=gc:GetName(); - InitCommand=cmd(strokecolor,Color("White")); - OnCommand=cmd(diffuse,Color("Black")); - }; -}; -t[#t+1] = Def.ActorFrame { - Condition=( gc:GetName() == "Back" ); - InitCommand=cmd(x,c.X;y,c.Y); - GainFocusCommand=cmd(finishtweening;zoom,1.125;bounceend,0.125;zoom,1); - LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.875); - LoadActor("_base") .. { - GainFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("Red")); - LoseFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("White")); - }; - LoadFont("Common Normal") .. { - Text=gc:GetName(); - InitCommand=cmd(strokecolor,Color("White")); - OnCommand=cmd(diffuse,Color("Black")); - }; -}; - +local gc = Var "GameCommand"; +local c = {}; + c.X = THEME:GetMetric( Var "LoadingScreen", "Icon" .. gc:GetName() .. "X"); + c.Y = THEME:GetMetric( Var "LoadingScreen", "Icon" .. gc:GetName() .. "Y"); +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + Condition=( gc:GetName() ~= "Back" ); + InitCommand=cmd(x,c.X;y,c.Y); + GainFocusCommand=cmd(finishtweening;zoom,1.125;bounceend,0.125;zoom,1); + LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.875); + LoadActor("_base") .. { + GainFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("Orange");diffusetopedge,Color("Yellow")); + LoseFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("White")); + }; + LoadFont("Common Normal") .. { + Text=gc:GetName(); + InitCommand=cmd(strokecolor,Color("White")); + OnCommand=cmd(diffuse,Color("Black")); + }; +}; +t[#t+1] = Def.ActorFrame { + Condition=( gc:GetName() == "Back" ); + InitCommand=cmd(x,c.X;y,c.Y); + GainFocusCommand=cmd(finishtweening;zoom,1.125;bounceend,0.125;zoom,1); + LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.875); + LoadActor("_base") .. { + GainFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("Red")); + LoseFocusCommand=cmd(stoptweening;linear,0.125;diffuse,Color("White")); + }; + LoadFont("Common Normal") .. { + Text=gc:GetName(); + InitCommand=cmd(strokecolor,Color("White")); + OnCommand=cmd(diffuse,Color("Black")); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenRanking banner frame.redir b/Themes/default/Graphics/ScreenRanking banner frame.redir index 56cf597902..c700c90d39 100644 --- a/Themes/default/Graphics/ScreenRanking banner frame.redir +++ b/Themes/default/Graphics/ScreenRanking banner frame.redir @@ -1 +1 @@ -_blank +_blank diff --git a/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua b/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua index cd7889b469..e950ca90f1 100644 --- a/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua +++ b/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua @@ -1,33 +1,33 @@ -return Def.HelpDisplay { - File = THEME:GetPathF("HelpDisplay", "text"); - InitCommand=function(self) - local s = THEME:GetString(Var "LoadingScreen","AlternateHelpText"); - self:SetTipsColonSeparated(s); - end; - SetHelpTextCommand=function(self, params) - self:SetTipsColonSeparated( params.Text ); - end; -}; ---[[ local sString = THEME:GetString(Var "LoadingScreen","AlternateHelpText"); -local tItems = split(sString,"&"); - -local t = Def.ActorScroller { - NumItemsToDraw=#tItems; - SecondsPerItem=1.25; - TransformFunction=function( self, offset, itemIndex, numItems ) - self:x( offset*74 ); - end; - InitCommand=cmd(SetLoop,true); --- OnCommand=cmd(scrollwithpadding,10,0); -}; - -for i=1,#tItems do - t[#t+1] = Def.ActorFrame { - LoadFont("HelpDisplay", "text") .. { - Text=tostring(tItems[i]); - OnCommand=THEME:GetMetric( Var "LoadingScreen","HelpOnCommand"); - }; - }; -end - -return t; --]] +return Def.HelpDisplay { + File = THEME:GetPathF("HelpDisplay", "text"); + InitCommand=function(self) + local s = THEME:GetString(Var "LoadingScreen","AlternateHelpText"); + self:SetTipsColonSeparated(s); + end; + SetHelpTextCommand=function(self, params) + self:SetTipsColonSeparated( params.Text ); + end; +}; +--[[ local sString = THEME:GetString(Var "LoadingScreen","AlternateHelpText"); +local tItems = split(sString,"&"); + +local t = Def.ActorScroller { + NumItemsToDraw=#tItems; + SecondsPerItem=1.25; + TransformFunction=function( self, offset, itemIndex, numItems ) + self:x( offset*74 ); + end; + InitCommand=cmd(SetLoop,true); +-- OnCommand=cmd(scrollwithpadding,10,0); +}; + +for i=1,#tItems do + t[#t+1] = Def.ActorFrame { + LoadFont("HelpDisplay", "text") .. { + Text=tostring(tItems[i]); + OnCommand=THEME:GetMetric( Var "LoadingScreen","HelpOnCommand"); + }; + }; +end + +return t; --]] diff --git a/Themes/default/Graphics/ScreenSelectMusic BPMDisplay.lua b/Themes/default/Graphics/ScreenSelectMusic BPMDisplay.lua index 013412a714..097e6e92da 100644 --- a/Themes/default/Graphics/ScreenSelectMusic BPMDisplay.lua +++ b/Themes/default/Graphics/ScreenSelectMusic BPMDisplay.lua @@ -1,7 +1,7 @@ -return Def.BPMDisplay { - File=THEME:GetPathF("BPMDisplay", "bpm"); - Name="BPMDisplay"; - SetCommand=function(self) self:SetFromGameState() end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); +return Def.BPMDisplay { + File=THEME:GetPathF("BPMDisplay", "bpm"); + Name="BPMDisplay"; + SetCommand=function(self) self:SetFromGameState() end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic BPMLabel.lua b/Themes/default/Graphics/ScreenSelectMusic BPMLabel.lua index 78733f252f..f217b24720 100644 --- a/Themes/default/Graphics/ScreenSelectMusic BPMLabel.lua +++ b/Themes/default/Graphics/ScreenSelectMusic BPMLabel.lua @@ -1,19 +1,19 @@ -return Def.ActorFrame { - LoadFont("Common Normal") .. { - Text="BPM"; - InitCommand=cmd(horizalign,right;zoom,0.75;strokecolor,Color("Outline")); - SetCommand=function(self) - local bIsFirst = false; - local song = GAMESTATE:GetCurrentSong(); - self:stoptweening(); --- self:linear(0.25); - if song then - self:diffusebottomedge( song:GetTimingData():HasStops() and Color("Orange") or Color("White") ); - else - self:diffusebottomedge( Color("White") ); - end; - end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); - }; +return Def.ActorFrame { + LoadFont("Common Normal") .. { + Text="BPM"; + InitCommand=cmd(horizalign,right;zoom,0.75;strokecolor,Color("Outline")); + SetCommand=function(self) + local bIsFirst = false; + local song = GAMESTATE:GetCurrentSong(); + self:stoptweening(); +-- self:linear(0.25); + if song then + self:diffusebottomedge( song:GetTimingData():HasStops() and Color("Orange") or Color("White") ); + else + self:diffusebottomedge( Color("White") ); + end; + end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic CourseContentsList.lua b/Themes/default/Graphics/ScreenSelectMusic CourseContentsList.lua index f1287177db..1df9511108 100644 --- a/Themes/default/Graphics/ScreenSelectMusic CourseContentsList.lua +++ b/Themes/default/Graphics/ScreenSelectMusic CourseContentsList.lua @@ -1,104 +1,104 @@ -return Def.CourseContentsList { - MaxSongs = 4; - NumItemsToDraw = 8; -- xxx: Doesn't scroll anymore. ---[[ InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y+91); - OnCommand=cmd(zoomy,0;bounceend,0.3;zoom,1); - OffCommand=cmd(zoomy,1;bouncebegin,0.3;zoomy,0); --]] - ShowCommand=cmd(bouncebegin,0.3;zoomy,1); - HideCommand=cmd(linear,0.3;zoomy,0); - SetCommand=function(self) - self:SetFromGameState(); - self:PositionItems(); - self:SetTransformFromHeight(44); - self:SetCurrentAndDestinationItem(0); --- self:SetDestinationItem( self:GetNumItems()-2 ); - self:SetLoop(false); - self:SetMask(270,0); - end; - CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); - CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); - - Display = Def.ActorFrame { - InitCommand=cmd(setsize,270,44); - - LoadActor(THEME:GetPathG("CourseEntryDisplay","bar")) .. { --- InitCommand=cmd(diffusetopedge,Color("Invisible")); - SetSongCommand=function(self, params) - if params.Difficulty then --- self:diffuse( SONGMAN:GetSongColor(params.Song) ); - self:diffuse( CustomDifficultyToColor(params.Difficulty) ); - else - self:diffuse( color("#FFFFFF") ); --- self:diffuse( CustomDifficultyToColor(params.Difficulty) ); - end - - (cmd(finishtweening;diffusealpha,0;sleep,0.125*params.Number;linear,0.125;diffusealpha,1;linear,0.05;glow,color("1,1,1,0.5");decelerate,0.1;glow,color("1,1,1,0")))(self); - end; - }; - - Def.TextBanner { - InitCommand=cmd(x,-128;y,1;Load,"TextBanner";SetFromString,"", "", "", "", "", ""); - SetSongCommand=function(self, params) - if params.Song then - if GAMESTATE:GetCurrentCourse():GetDisplayFullTitle() == "Abomination" then - -- abomination hack - if PREFSMAN:GetPreference("EasterEggs") then - if params.Number % 2 ~= 0 then - -- turkey march - local artist = params.Song:GetDisplayArtist(); - self:SetFromString( "Turkey", "", "", "", artist, "" ); - else - self:SetFromSong( params.Song ); - end; - else - self:SetFromSong( params.Song ); - end; - else - self:SetFromSong( params.Song ); - end; - self:diffuse( CustomDifficultyToColor(params.Difficulty) ); --- self:glow("1,1,1,0.5"); - else - self:SetFromString( "??????????", "??????????", "", "", "", "" ); - self:diffuse( color("#FFFFFF") ); --- self:glow("1,1,1,0"); - end - - (cmd(finishtweening;zoomy,0;sleep,0.125*params.Number;linear,0.125;zoomy,1.1;linear,0.05;zoomx,1.1;decelerate,0.1;zoom,1))(self); - end; - }; - ---[[ LoadFont("CourseEntryDisplay","number") .. { - InitCommand=cmd(x,114+8;y,-12;shadowlength,1); - SetSongCommand=function(self, params) - self:settext(string.format("#%i", params.Number)); - - (cmd(finishtweening;zoom,0.5;zoomy,0.5*1.5;diffusealpha,0;sleep,0.125*params.Number;linear,0.125;diffusealpha,1;linear,0.05;zoomy,0.5*1;zoomx,0.5*1.1;glow,color("1,1,1,0.5");decelerate,0.1;zoom,0.5;glow,color("1,1,1,0")))(self); - end; - }; --]] - LoadFont("CourseEntryDisplay","difficulty") .. { - Text="0"; - InitCommand=cmd(x,114;y,0;zoom,0.75;shadowlength,1); - SetSongCommand=function(self, params) - if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end - self:settext( params.Meter ); - self:diffuse( CustomDifficultyToColor(params.Difficulty) ); - (cmd(finishtweening;zoomy,0;sleep,0.125*params.Number;linear,0.125;zoomy,1.1;linear,0.05;zoomx,1.1;decelerate,0.1;zoom,1))(self); - end; - }; ---[[ LoadFont("Common","normal") .. { - OnCommand=cmd(x,0;y,-8;zoom,0.7;shadowlength,0); - DifficultyChangedCommand=function(self, params) - if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end - self:settext( params.Meter ); - self:diffuse( CourseDifficultyColors[params.Difficulty] ); - end; - }; --]] - ---[[ LoadFont("Common","normal") .. { - OnCommand=cmd(x,SCREEN_CENTER_X-192;y,SCREEN_CENTER_Y-230;horizalign,right;shadowlength,0); - SetSongCommand=function(self, params) self:settext(params.Modifiers); end; - }; --]] - - }; +return Def.CourseContentsList { + MaxSongs = 4; + NumItemsToDraw = 8; -- xxx: Doesn't scroll anymore. +--[[ InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y+91); + OnCommand=cmd(zoomy,0;bounceend,0.3;zoom,1); + OffCommand=cmd(zoomy,1;bouncebegin,0.3;zoomy,0); --]] + ShowCommand=cmd(bouncebegin,0.3;zoomy,1); + HideCommand=cmd(linear,0.3;zoomy,0); + SetCommand=function(self) + self:SetFromGameState(); + self:PositionItems(); + self:SetTransformFromHeight(44); + self:SetCurrentAndDestinationItem(0); +-- self:SetDestinationItem( self:GetNumItems()-2 ); + self:SetLoop(false); + self:SetMask(270,0); + end; + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + + Display = Def.ActorFrame { + InitCommand=cmd(setsize,270,44); + + LoadActor(THEME:GetPathG("CourseEntryDisplay","bar")) .. { +-- InitCommand=cmd(diffusetopedge,Color("Invisible")); + SetSongCommand=function(self, params) + if params.Difficulty then +-- self:diffuse( SONGMAN:GetSongColor(params.Song) ); + self:diffuse( CustomDifficultyToColor(params.Difficulty) ); + else + self:diffuse( color("#FFFFFF") ); +-- self:diffuse( CustomDifficultyToColor(params.Difficulty) ); + end + + (cmd(finishtweening;diffusealpha,0;sleep,0.125*params.Number;linear,0.125;diffusealpha,1;linear,0.05;glow,color("1,1,1,0.5");decelerate,0.1;glow,color("1,1,1,0")))(self); + end; + }; + + Def.TextBanner { + InitCommand=cmd(x,-128;y,1;Load,"TextBanner";SetFromString,"", "", "", "", "", ""); + SetSongCommand=function(self, params) + if params.Song then + if GAMESTATE:GetCurrentCourse():GetDisplayFullTitle() == "Abomination" then + -- abomination hack + if PREFSMAN:GetPreference("EasterEggs") then + if params.Number % 2 ~= 0 then + -- turkey march + local artist = params.Song:GetDisplayArtist(); + self:SetFromString( "Turkey", "", "", "", artist, "" ); + else + self:SetFromSong( params.Song ); + end; + else + self:SetFromSong( params.Song ); + end; + else + self:SetFromSong( params.Song ); + end; + self:diffuse( CustomDifficultyToColor(params.Difficulty) ); +-- self:glow("1,1,1,0.5"); + else + self:SetFromString( "??????????", "??????????", "", "", "", "" ); + self:diffuse( color("#FFFFFF") ); +-- self:glow("1,1,1,0"); + end + + (cmd(finishtweening;zoomy,0;sleep,0.125*params.Number;linear,0.125;zoomy,1.1;linear,0.05;zoomx,1.1;decelerate,0.1;zoom,1))(self); + end; + }; + +--[[ LoadFont("CourseEntryDisplay","number") .. { + InitCommand=cmd(x,114+8;y,-12;shadowlength,1); + SetSongCommand=function(self, params) + self:settext(string.format("#%i", params.Number)); + + (cmd(finishtweening;zoom,0.5;zoomy,0.5*1.5;diffusealpha,0;sleep,0.125*params.Number;linear,0.125;diffusealpha,1;linear,0.05;zoomy,0.5*1;zoomx,0.5*1.1;glow,color("1,1,1,0.5");decelerate,0.1;zoom,0.5;glow,color("1,1,1,0")))(self); + end; + }; --]] + LoadFont("CourseEntryDisplay","difficulty") .. { + Text="0"; + InitCommand=cmd(x,114;y,0;zoom,0.75;shadowlength,1); + SetSongCommand=function(self, params) + if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end + self:settext( params.Meter ); + self:diffuse( CustomDifficultyToColor(params.Difficulty) ); + (cmd(finishtweening;zoomy,0;sleep,0.125*params.Number;linear,0.125;zoomy,1.1;linear,0.05;zoomx,1.1;decelerate,0.1;zoom,1))(self); + end; + }; +--[[ LoadFont("Common","normal") .. { + OnCommand=cmd(x,0;y,-8;zoom,0.7;shadowlength,0); + DifficultyChangedCommand=function(self, params) + if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end + self:settext( params.Meter ); + self:diffuse( CourseDifficultyColors[params.Difficulty] ); + end; + }; --]] + +--[[ LoadFont("Common","normal") .. { + OnCommand=cmd(x,SCREEN_CENTER_X-192;y,SCREEN_CENTER_Y-230;horizalign,right;shadowlength,0); + SetSongCommand=function(self, params) self:settext(params.Modifiers); end; + }; --]] + + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic CourseType.lua b/Themes/default/Graphics/ScreenSelectMusic CourseType.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic CourseType.lua +++ b/Themes/default/Graphics/ScreenSelectMusic CourseType.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic DifficultyDisplay/default.lua b/Themes/default/Graphics/ScreenSelectMusic DifficultyDisplay/default.lua index a94af9c639..afc47353f7 100644 --- a/Themes/default/Graphics/ScreenSelectMusic DifficultyDisplay/default.lua +++ b/Themes/default/Graphics/ScreenSelectMusic DifficultyDisplay/default.lua @@ -1,58 +1,58 @@ -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - LoadActor("_Background"); -}; --- -for idx,diff in pairs(Difficulty) do - local sDifficulty = ToEnumShortString( diff ); - local tLocation = { - Beginner = 16, - Easy = 16*2, - Medium = 16*3, - Hard = 16*4, - Challenge = 16*5, - Edit = 16*7, - }; - t[#t+1] = Def.ActorFrame { - SetCommand=function(self) - local c = self:GetChildren(); --- local Bar = self:GetChild("Bar"); --- local Meter = self:GetChild("Meter" - local song = GAMESTATE:GetCurrentSong() - local bHasStepsTypeAndDifficulty = false; - local meter = ""; - if song then - local st = GAMESTATE:GetCurrentStyle():GetStepsType() - bHasStepsTypeAndDifficulty = song:HasStepsTypeAndDifficulty( st, diff ); - local steps = song:GetOneSteps( st, diff ); - if steps then - meter = steps:GetMeter(); - if meter >= 50 then - meter = "!"; - end; - if diff == 'Difficulty_Edit' then - meter = meter .. " Edit"; - end; - end; - end; - c.Meter:settext( meter ); - self:playcommand( bHasStepsTypeAndDifficulty and "Show" or "Hide" ); - end; - CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); - -- - LoadActor("_barpeice " .. sDifficulty ) .. { - Name="BarPeice"; - ShowCommand=cmd(stoptweening;linear,0.1;diffuse,CustomDifficultyToColor( sDifficulty )); - HideCommand=cmd(stoptweening;decelerate,0.2;diffuse,CustomDifficultyToDarkColor( sDifficulty )); - InitCommand=cmd(diffuse,CustomDifficultyToColor( sDifficulty )); - }; - LoadFont("StepsDisplay","Meter") .. { - Name="Meter"; - Text=(sDifficulty == "Edit") and "0 Edits" or "0"; - ShowCommand=cmd(stoptweening;linear,0.1;diffuse,CustomDifficultyToColor( sDifficulty )); - HideCommand=cmd(stoptweening;decelerate,0.2;diffuse,CustomDifficultyToDarkColor( sDifficulty )); - InitCommand=cmd(x,-64-8+tLocation[sDifficulty];shadowlength,1;zoom,0.5;diffuse,CustomDifficultyToColor( sDifficulty )); - }; - }; -end +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + LoadActor("_Background"); +}; +-- +for idx,diff in pairs(Difficulty) do + local sDifficulty = ToEnumShortString( diff ); + local tLocation = { + Beginner = 16, + Easy = 16*2, + Medium = 16*3, + Hard = 16*4, + Challenge = 16*5, + Edit = 16*7, + }; + t[#t+1] = Def.ActorFrame { + SetCommand=function(self) + local c = self:GetChildren(); +-- local Bar = self:GetChild("Bar"); +-- local Meter = self:GetChild("Meter" + local song = GAMESTATE:GetCurrentSong() + local bHasStepsTypeAndDifficulty = false; + local meter = ""; + if song then + local st = GAMESTATE:GetCurrentStyle():GetStepsType() + bHasStepsTypeAndDifficulty = song:HasStepsTypeAndDifficulty( st, diff ); + local steps = song:GetOneSteps( st, diff ); + if steps then + meter = steps:GetMeter(); + if meter >= 50 then + meter = "!"; + end; + if diff == 'Difficulty_Edit' then + meter = meter .. " Edit"; + end; + end; + end; + c.Meter:settext( meter ); + self:playcommand( bHasStepsTypeAndDifficulty and "Show" or "Hide" ); + end; + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + -- + LoadActor("_barpeice " .. sDifficulty ) .. { + Name="BarPeice"; + ShowCommand=cmd(stoptweening;linear,0.1;diffuse,CustomDifficultyToColor( sDifficulty )); + HideCommand=cmd(stoptweening;decelerate,0.2;diffuse,CustomDifficultyToDarkColor( sDifficulty )); + InitCommand=cmd(diffuse,CustomDifficultyToColor( sDifficulty )); + }; + LoadFont("StepsDisplay","Meter") .. { + Name="Meter"; + Text=(sDifficulty == "Edit") and "0 Edits" or "0"; + ShowCommand=cmd(stoptweening;linear,0.1;diffuse,CustomDifficultyToColor( sDifficulty )); + HideCommand=cmd(stoptweening;decelerate,0.2;diffuse,CustomDifficultyToDarkColor( sDifficulty )); + InitCommand=cmd(x,-64-8+tLocation[sDifficulty];shadowlength,1;zoom,0.5;diffuse,CustomDifficultyToColor( sDifficulty )); + }; + }; +end return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic DifficultyList.lua b/Themes/default/Graphics/ScreenSelectMusic DifficultyList.lua index 84eaac70f5..c432acd4b3 100644 --- a/Themes/default/Graphics/ScreenSelectMusic DifficultyList.lua +++ b/Themes/default/Graphics/ScreenSelectMusic DifficultyList.lua @@ -1,86 +1,86 @@ -return Def.ActorFrame { - CurrentSongChangedMessageCommand=function(self) - local song = GAMESTATE:GetCurrentSong(); - if song then --- self:setaux(0); - self:finishtweening(); - self:playcommand("TweenOn"); - elseif not song and self:GetZoomX() == 1 then --- self:setaux(1); - self:finishtweening(); - self:playcommand("TweenOff"); - end; - end; - Def.Quad { - InitCommand=cmd(y,-14;zoomto,164,2;fadeleft,8/164;faderight,8/164); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5); - }; - Def.Quad { - InitCommand=cmd(y,24*(5)-10;zoomto,164,2;fadeleft,8/164;faderight,8/164); - OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5); - }; - Def.StepsDisplayList { - Name="StepsDisplayListRow"; - - CursorP1 = Def.ActorFrame { - InitCommand=cmd(x,-128+16;player,PLAYER_1); - PlayerJoinedMessageCommand=function(self, params) - if params.Player == PLAYER_1 then - self:visible(true); - (cmd(zoom,0;bounceend,0.3;zoom,1))(self); - end; - end; - PlayerUnjoinedMessageCommand=function(self, params) - if params.Player == PLAYER_1 then - self:visible(true); - (cmd(bouncebegin,0.3;zoom,0))(self); - end; - end; - LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { - InitCommand=cmd(diffuse,PlayerColor(PLAYER_1);x,8;zoom,0.75); - }; - LoadActor(THEME:GetPathG("_StepsDisplayListRow","arrow")) .. { - InitCommand=cmd(x,20;diffuse,PlayerColor(PLAYER_1)); - OnCommand=cmd(thump,1;effectmagnitude,1,1.25,1;effectclock,'beat';); - }; - LoadFont("Common Normal") .. { - Text="P1"; - InitCommand=cmd(x,2;diffuse,PlayerColor(PLAYER_1);shadowlength,1); - OnCommand=cmd(zoom,0.75); - }; - }; - CursorP2 = Def.ActorFrame { - InitCommand=cmd(x,128-16;player,PLAYER_2); - PlayerJoinedMessageCommand=function(self, params) - if params.Player == PLAYER_2 then - self:visible(true); - (cmd(zoom,0;bounceend,0.3;zoom,1))(self); - end; - end; - PlayerUnjoinedMessageCommand=function(self, params) - if params.Player == PLAYER_2 then - self:visible(true); - (cmd(bouncebegin,0.3;zoom,0))(self); - end; - end; - LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { - InitCommand=cmd(diffuse,PlayerColor(PLAYER_2);x,-8;zoom,0.75;zoomx,-0.75;); - }; - LoadActor(THEME:GetPathG("_StepsDisplayListRow","arrow")) .. { - InitCommand=cmd(x,-20;diffuse,PlayerColor(PLAYER_2);zoomx,-1); - OnCommand=cmd(thump,1;effectmagnitude,1,1.25,1;effectclock,'beat';); - }; - LoadFont("Common Normal") .. { - Text="P2"; - InitCommand=cmd(x,-2;diffuse,PlayerColor(PLAYER_2);shadowlength,1); - OnCommand=cmd(zoom,0.75); - }; - }; - CursorP1Frame = Def.Actor{ - ChangeCommand=cmd(stoptweening;decelerate,0.125); - }; - CursorP2Frame = Def.Actor{ - ChangeCommand=cmd(stoptweening;decelerate,0.125); - }; - }; +return Def.ActorFrame { + CurrentSongChangedMessageCommand=function(self) + local song = GAMESTATE:GetCurrentSong(); + if song then +-- self:setaux(0); + self:finishtweening(); + self:playcommand("TweenOn"); + elseif not song and self:GetZoomX() == 1 then +-- self:setaux(1); + self:finishtweening(); + self:playcommand("TweenOff"); + end; + end; + Def.Quad { + InitCommand=cmd(y,-14;zoomto,164,2;fadeleft,8/164;faderight,8/164); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(y,24*(5)-10;zoomto,164,2;fadeleft,8/164;faderight,8/164); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5); + }; + Def.StepsDisplayList { + Name="StepsDisplayListRow"; + + CursorP1 = Def.ActorFrame { + InitCommand=cmd(x,-128+16;player,PLAYER_1); + PlayerJoinedMessageCommand=function(self, params) + if params.Player == PLAYER_1 then + self:visible(true); + (cmd(zoom,0;bounceend,0.3;zoom,1))(self); + end; + end; + PlayerUnjoinedMessageCommand=function(self, params) + if params.Player == PLAYER_1 then + self:visible(true); + (cmd(bouncebegin,0.3;zoom,0))(self); + end; + end; + LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { + InitCommand=cmd(diffuse,PlayerColor(PLAYER_1);x,8;zoom,0.75); + }; + LoadActor(THEME:GetPathG("_StepsDisplayListRow","arrow")) .. { + InitCommand=cmd(x,20;diffuse,PlayerColor(PLAYER_1)); + OnCommand=cmd(thump,1;effectmagnitude,1,1.25,1;effectclock,'beat';); + }; + LoadFont("Common Normal") .. { + Text="P1"; + InitCommand=cmd(x,2;diffuse,PlayerColor(PLAYER_1);shadowlength,1); + OnCommand=cmd(zoom,0.75); + }; + }; + CursorP2 = Def.ActorFrame { + InitCommand=cmd(x,128-16;player,PLAYER_2); + PlayerJoinedMessageCommand=function(self, params) + if params.Player == PLAYER_2 then + self:visible(true); + (cmd(zoom,0;bounceend,0.3;zoom,1))(self); + end; + end; + PlayerUnjoinedMessageCommand=function(self, params) + if params.Player == PLAYER_2 then + self:visible(true); + (cmd(bouncebegin,0.3;zoom,0))(self); + end; + end; + LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { + InitCommand=cmd(diffuse,PlayerColor(PLAYER_2);x,-8;zoom,0.75;zoomx,-0.75;); + }; + LoadActor(THEME:GetPathG("_StepsDisplayListRow","arrow")) .. { + InitCommand=cmd(x,-20;diffuse,PlayerColor(PLAYER_2);zoomx,-1); + OnCommand=cmd(thump,1;effectmagnitude,1,1.25,1;effectclock,'beat';); + }; + LoadFont("Common Normal") .. { + Text="P2"; + InitCommand=cmd(x,-2;diffuse,PlayerColor(PLAYER_2);shadowlength,1); + OnCommand=cmd(zoom,0.75); + }; + }; + CursorP1Frame = Def.Actor{ + ChangeCommand=cmd(stoptweening;decelerate,0.125); + }; + CursorP2Frame = Def.Actor{ + ChangeCommand=cmd(stoptweening;decelerate,0.125); + }; + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic NewSong.lua b/Themes/default/Graphics/ScreenSelectMusic NewSong.lua index 2c6f6c701e..0c686ee792 100644 --- a/Themes/default/Graphics/ScreenSelectMusic NewSong.lua +++ b/Themes/default/Graphics/ScreenSelectMusic NewSong.lua @@ -1,3 +1,3 @@ -return LoadFont("Common Normal") .. { - Text="NEW!"; +return LoadFont("Common Normal") .. { + Text="NEW!"; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic NumCourseSongs.lua b/Themes/default/Graphics/ScreenSelectMusic NumCourseSongs.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic NumCourseSongs.lua +++ b/Themes/default/Graphics/ScreenSelectMusic NumCourseSongs.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SongOptions.lua b/Themes/default/Graphics/ScreenSelectMusic SongOptions.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SongOptions.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SongOptions.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SongOptionsFrame.lua b/Themes/default/Graphics/ScreenSelectMusic SongOptionsFrame.lua index ce8a571be3..19756a33bf 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SongOptionsFrame.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SongOptionsFrame.lua @@ -1,3 +1,3 @@ -return Def.Quad { - InitCommand=cmd(zoomto,SCREEN_WIDTH,64); +return Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,64); }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SongOptionsText.lua b/Themes/default/Graphics/ScreenSelectMusic SongOptionsText.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SongOptionsText.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SongOptionsText.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SongTime.lua b/Themes/default/Graphics/ScreenSelectMusic SongTime.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SongTime.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SongTime.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SortOrderFrame.lua b/Themes/default/Graphics/ScreenSelectMusic SortOrderFrame.lua index bb36ce33c1..0abf8c6a8a 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SortOrderFrame.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SortOrderFrame.lua @@ -1,8 +1,8 @@ -return Def.ActorFrame { - LoadActor(THEME:GetPathG("OptionRowExit","frame")) .. { - InitCommand=cmd(diffusebottomedge,Color("Orange")); - }; - LoadActor(THEME:GetPathG("_icon","Sort")) .. { - InitCommand=cmd(x,-60;shadowlength,1;diffuse,Color("Orange");diffusetopedge,Color("Yellow")); - }; +return Def.ActorFrame { + LoadActor(THEME:GetPathG("OptionRowExit","frame")) .. { + InitCommand=cmd(diffusebottomedge,Color("Orange")); + }; + LoadActor(THEME:GetPathG("_icon","Sort")) .. { + InitCommand=cmd(x,-60;shadowlength,1;diffuse,Color("Orange");diffusetopedge,Color("Yellow")); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic SortOrderText.lua b/Themes/default/Graphics/ScreenSelectMusic SortOrderText.lua index 93e17dacca..784c3f5c19 100644 --- a/Themes/default/Graphics/ScreenSelectMusic SortOrderText.lua +++ b/Themes/default/Graphics/ScreenSelectMusic SortOrderText.lua @@ -1,2 +1,2 @@ -return LoadFont("Common Normal") .. { +return LoadFont("Common Normal") .. { }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectPlayMode Icon/default.lua b/Themes/default/Graphics/ScreenSelectPlayMode Icon/default.lua index fe06a3763e..61625bdda1 100644 --- a/Themes/default/Graphics/ScreenSelectPlayMode Icon/default.lua +++ b/Themes/default/Graphics/ScreenSelectPlayMode Icon/default.lua @@ -1,35 +1,35 @@ -local gc = Var("GameCommand"); -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - GainFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconGainFocusCommand"); - LoseFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconLoseFocusCommand"); --- IconGainFocusCommand=cmd(stoptweening;glowshift;decelerate,0.125;zoom,1); --- IconLoseFocusCommand=cmd(stoptweening;stopeffect;decelerate,0.125;zoom,fZoom); - - LoadActor("_background base")..{ - InitCommand=cmd(diffuse,ModeIconColors[gc:GetName()]); - }; - LoadActor("_background effect"); - LoadActor("_gloss"); - LoadActor("_stroke"); - LoadActor("_cutout"); - - -- todo: generate a better font for these. - LoadFont("_helveticaneuelt std extblk cn 42px")..{ - InitCommand=cmd(y,-12;zoom,1.1;diffuse,color("#000000");uppercase,true;settext,gc:GetName();); - }; - LoadFont("_helveticaneuelt std extblk cn 42px")..{ - InitCommand=cmd(y,27.5;zoom,0.45;maxwidth,320*1.6;uppercase,true;settext,THEME:GetString(Var "LoadingScreen", gc:GetName().."Explanation")); - }; - LoadActor("_background base") .. { - DisabledCommand=cmd(diffuse,color("0,0,0,0.5")); - EnabledCommand=cmd(diffuse,color("1,1,1,0")); - }; - --[[ - LoadActor(THEME:GetPathG("_SelectIcon",gc:GetName() )) .. { - DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); - EnabledCommand=cmd(diffuse,color("1,1,1,1")); - }; - --]] -}; +local gc = Var("GameCommand"); +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + GainFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconGainFocusCommand"); + LoseFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconLoseFocusCommand"); +-- IconGainFocusCommand=cmd(stoptweening;glowshift;decelerate,0.125;zoom,1); +-- IconLoseFocusCommand=cmd(stoptweening;stopeffect;decelerate,0.125;zoom,fZoom); + + LoadActor("_background base")..{ + InitCommand=cmd(diffuse,ModeIconColors[gc:GetName()]); + }; + LoadActor("_background effect"); + LoadActor("_gloss"); + LoadActor("_stroke"); + LoadActor("_cutout"); + + -- todo: generate a better font for these. + LoadFont("_helveticaneuelt std extblk cn 42px")..{ + InitCommand=cmd(y,-12;zoom,1.1;diffuse,color("#000000");uppercase,true;settext,gc:GetName();); + }; + LoadFont("_helveticaneuelt std extblk cn 42px")..{ + InitCommand=cmd(y,27.5;zoom,0.45;maxwidth,320*1.6;uppercase,true;settext,THEME:GetString(Var "LoadingScreen", gc:GetName().."Explanation")); + }; + LoadActor("_background base") .. { + DisabledCommand=cmd(diffuse,color("0,0,0,0.5")); + EnabledCommand=cmd(diffuse,color("1,1,1,0")); + }; + --[[ + LoadActor(THEME:GetPathG("_SelectIcon",gc:GetName() )) .. { + DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); + EnabledCommand=cmd(diffuse,color("1,1,1,1")); + }; + --]] +}; return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua b/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua index 101aed3983..b13282add8 100644 --- a/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua +++ b/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua @@ -1,65 +1,65 @@ -local gc = Var "GameCommand"; -local colors = { - Easy = color("#00ff00"), - Normal = color("#feee00"), - Hard = color("#feee00"), - Rave = color("#c44dff"), - Extended = color("#00ffff"), - Oni = color("#d70b8c"), - Endless = color("748392"), -}; -local t = Def.ActorFrame {}; --- Background! -t[#t+1] = Def.ActorFrame { --- GainFocusCommand=cmd(visible,true); --- LoseFocusCommand=cmd(visible,false); - LoadActor("_HighlightFrame") .. { - InitCommand=cmd(diffuse,colors[gc:GetName()];diffusealpha,0); - GainFocusCommand=cmd(stoptweening;linear,0.125;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;linear,0.125;diffusealpha,0); - OffFocusedCommand=cmd(finishtweening;glow,Color("White");decelerate,1.5;glow,Color("Invisible")); - }; -}; --- Emblem Frame -t[#t+1] = Def.ActorFrame { - FOV=90; - InitCommand=cmd(x,-192;zoom,0.9); - -- Main Shadow - LoadActor( gc:GetName() ) .. { - InitCommand=cmd(x,2;y,2;diffuse,Color("Black");diffusealpha,0;zoom,0.75); - GainFocusCommand=cmd(stoptweening;stopeffect;smooth,0.125;diffusealpha,0;zoom,1;decelerate,0.25;diffusealpha,0.5;pulse;effecttiming,0.75,0.125,0.125,0.75;effectmagnitude,0.95,1,1;); - LoseFocusCommand=cmd(stoptweening;stopeffect;smooth,0.25;diffusealpha,0;zoom,0.75;); - OffFocusedCommand=cmd(finishtweening;stopeffect;glow,colors[gc:GetName()];decelerate,1.75;rotationy,360*1;); - }; - -- Main Emblem - LoadActor( gc:GetName() ) .. { - InitCommand=cmd(diffusealpha,0;zoom,0.75); - GainFocusCommand=cmd(stoptweening;stopeffect;smooth,0.125;diffusealpha,1;zoom,1;glow,Color("White");decelerate,0.25;glow,Color("Invisible");pulse;effecttiming,0.75,0.125,0.125,0.75;effectmagnitude,0.95,1,1;); - LoseFocusCommand=cmd(stoptweening;stopeffect;smooth,0.25;diffusealpha,0;zoom,0.75;glow,Color("Invisible")); - OffFocusedCommand=cmd(finishtweening;stopeffect;glow,colors[gc:GetName()];decelerate,1.75;rotationy,360*1;glow,Color("Invisible")); - }; -}; --- Text Frame -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,-192/2;y,-10); - Def.Quad { - InitCommand=cmd(horizalign,left;y,20;zoomto,320,2;diffuse,colors[gc:GetName()];diffusealpha,0;fadeleft,0.35;faderight,0.35); - GainFocusCommand=cmd(stoptweening;linear,0.2;diffusealpha,1); - LoseFocusCommand=cmd(stoptweening;linear,0.2;diffusealpha,0); - }; - LoadFont("_helveticaneuelt std extblk cn 42px") .. { - Text=gc:GetName(); - InitCommand=cmd(horizalign,left;diffuse,colors[gc:GetName()];shadowcolor,ColorDarkTone(colors[gc:GetName()]);shadowlength,2;diffusealpha,0;skewx,-0.125); - GainFocusCommand=cmd(stoptweening;x,-16;decelerate,0.25;diffusealpha,1;x,0); - LoseFocusCommand=cmd(stoptweening;x,0;accelerate,0.25;diffusealpha,0;x,16;diffusealpha,0); - }; - LoadFont("_helveticaneuelt std extblk cn 42px") .. { - Text=THEME:GetString(Var "LoadingScreen", gc:GetName() .. "Explanation"); - InitCommand=cmd(horizalign,right;x,320;y,30;shadowlength,1;diffusealpha,0;skewx,-0.125;zoom,0.5); - GainFocusCommand=cmd(stoptweening;x,320-16;decelerate,0.25;diffusealpha,1;x,320); - LoseFocusCommand=cmd(stoptweening;x,320;accelerate,0.25;diffusealpha,0;x,320+16;diffusealpha,0); - }; -}; --- t.GainFocusCommand=cmd(visible,true); --- t.LoseFocusCommand=cmd(visible,false); +local gc = Var "GameCommand"; +local colors = { + Easy = color("#00ff00"), + Normal = color("#feee00"), + Hard = color("#feee00"), + Rave = color("#c44dff"), + Extended = color("#00ffff"), + Oni = color("#d70b8c"), + Endless = color("748392"), +}; +local t = Def.ActorFrame {}; +-- Background! +t[#t+1] = Def.ActorFrame { +-- GainFocusCommand=cmd(visible,true); +-- LoseFocusCommand=cmd(visible,false); + LoadActor("_HighlightFrame") .. { + InitCommand=cmd(diffuse,colors[gc:GetName()];diffusealpha,0); + GainFocusCommand=cmd(stoptweening;linear,0.125;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;linear,0.125;diffusealpha,0); + OffFocusedCommand=cmd(finishtweening;glow,Color("White");decelerate,1.5;glow,Color("Invisible")); + }; +}; +-- Emblem Frame +t[#t+1] = Def.ActorFrame { + FOV=90; + InitCommand=cmd(x,-192;zoom,0.9); + -- Main Shadow + LoadActor( gc:GetName() ) .. { + InitCommand=cmd(x,2;y,2;diffuse,Color("Black");diffusealpha,0;zoom,0.75); + GainFocusCommand=cmd(stoptweening;stopeffect;smooth,0.125;diffusealpha,0;zoom,1;decelerate,0.25;diffusealpha,0.5;pulse;effecttiming,0.75,0.125,0.125,0.75;effectmagnitude,0.95,1,1;); + LoseFocusCommand=cmd(stoptweening;stopeffect;smooth,0.25;diffusealpha,0;zoom,0.75;); + OffFocusedCommand=cmd(finishtweening;stopeffect;glow,colors[gc:GetName()];decelerate,1.75;rotationy,360*1;); + }; + -- Main Emblem + LoadActor( gc:GetName() ) .. { + InitCommand=cmd(diffusealpha,0;zoom,0.75); + GainFocusCommand=cmd(stoptweening;stopeffect;smooth,0.125;diffusealpha,1;zoom,1;glow,Color("White");decelerate,0.25;glow,Color("Invisible");pulse;effecttiming,0.75,0.125,0.125,0.75;effectmagnitude,0.95,1,1;); + LoseFocusCommand=cmd(stoptweening;stopeffect;smooth,0.25;diffusealpha,0;zoom,0.75;glow,Color("Invisible")); + OffFocusedCommand=cmd(finishtweening;stopeffect;glow,colors[gc:GetName()];decelerate,1.75;rotationy,360*1;glow,Color("Invisible")); + }; +}; +-- Text Frame +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,-192/2;y,-10); + Def.Quad { + InitCommand=cmd(horizalign,left;y,20;zoomto,320,2;diffuse,colors[gc:GetName()];diffusealpha,0;fadeleft,0.35;faderight,0.35); + GainFocusCommand=cmd(stoptweening;linear,0.2;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;linear,0.2;diffusealpha,0); + }; + LoadFont("_helveticaneuelt std extblk cn 42px") .. { + Text=gc:GetName(); + InitCommand=cmd(horizalign,left;diffuse,colors[gc:GetName()];shadowcolor,ColorDarkTone(colors[gc:GetName()]);shadowlength,2;diffusealpha,0;skewx,-0.125); + GainFocusCommand=cmd(stoptweening;x,-16;decelerate,0.25;diffusealpha,1;x,0); + LoseFocusCommand=cmd(stoptweening;x,0;accelerate,0.25;diffusealpha,0;x,16;diffusealpha,0); + }; + LoadFont("_helveticaneuelt std extblk cn 42px") .. { + Text=THEME:GetString(Var "LoadingScreen", gc:GetName() .. "Explanation"); + InitCommand=cmd(horizalign,right;x,320;y,30;shadowlength,1;diffusealpha,0;skewx,-0.125;zoom,0.5); + GainFocusCommand=cmd(stoptweening;x,320-16;decelerate,0.25;diffusealpha,1;x,320); + LoseFocusCommand=cmd(stoptweening;x,320;accelerate,0.25;diffusealpha,0;x,320+16;diffusealpha,0); + }; +}; +-- t.GainFocusCommand=cmd(visible,true); +-- t.LoseFocusCommand=cmd(visible,false); return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectStyle Icon.lua b/Themes/default/Graphics/ScreenSelectStyle Icon.lua index 6dbc7e3141..2c206d90f3 100644 --- a/Themes/default/Graphics/ScreenSelectStyle Icon.lua +++ b/Themes/default/Graphics/ScreenSelectStyle Icon.lua @@ -1,11 +1,11 @@ -local gc = Var("GameCommand"); -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - GainFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconGainFocusCommand"); - LoseFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconLoseFocusCommand"); - LoadActor(THEME:GetPathG("_SelectIcon",gc:GetName() )) .. { - DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); - EnabledCommand=cmd(diffuse,color("1,1,1,1")); - }; -}; +local gc = Var("GameCommand"); +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + GainFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconGainFocusCommand"); + LoseFocusCommand=THEME:GetMetric(Var "LoadingScreen","IconLoseFocusCommand"); + LoadActor(THEME:GetPathG("_SelectIcon",gc:GetName() )) .. { + DisabledCommand=cmd(diffuse,color("0.5,0.5,0.5,1")); + EnabledCommand=cmd(diffuse,color("1,1,1,1")); + }; +}; return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu CurrentGametype.lua b/Themes/default/Graphics/ScreenTitleMenu CurrentGametype.lua index 9f23d79cab..575c84d4bd 100644 --- a/Themes/default/Graphics/ScreenTitleMenu CurrentGametype.lua +++ b/Themes/default/Graphics/ScreenTitleMenu CurrentGametype.lua @@ -1,11 +1,11 @@ -local curGameName = GAMESTATE:GetCurrentGame():GetName(); - -local t = Def.ActorFrame{ - LoadFont("Common Normal") .. { - InitCommand=cmd(horizalign,left;zoom,0.5;); - BeginCommand=function(self) - self:settextf( Screen.String("CurrentGametype"), curGameName ); - end; - }; -}; +local curGameName = GAMESTATE:GetCurrentGame():GetName(); + +local t = Def.ActorFrame{ + LoadFont("Common Normal") .. { + InitCommand=cmd(horizalign,left;zoom,0.5;); + BeginCommand=function(self) + self:settextf( Screen.String("CurrentGametype"), curGameName ); + end; + }; +}; return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu LifeDifficulty.lua b/Themes/default/Graphics/ScreenTitleMenu LifeDifficulty.lua index 9a30dfbf60..5026c22481 100644 --- a/Themes/default/Graphics/ScreenTitleMenu LifeDifficulty.lua +++ b/Themes/default/Graphics/ScreenTitleMenu LifeDifficulty.lua @@ -1,32 +1,32 @@ -return Def.ActorFrame { ---[[ LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { - OnCommand=function(self) - if GetLifeDifficulty() < 3 then - (cmd(diffuseshift;effectcolor1,Color("Blue");effectcolor2,ColorDarkTone(Color("Blue"));effectperiod,1.25))(self); - elseif GetLifeDifficulty() > 3 then - (cmd(diffuseshift;effectcolor1,Color("Red");effectcolor2,ColorDarkTone(Color("Red"));effectperiod,1.25))(self); - else - (cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")))(self); - end; - end; - }; --]] --- LoadActor(THEME:GetPathG("OptionRowExit","frame")); - LoadActor(THEME:GetPathG("_icon","Health")) .. { - InitCommand=cmd(x,-60;shadowlength,1); - }; - LoadFont("Common Normal") .. { - Text=GetLifeDifficulty(); - AltText=""; - InitCommand=cmd(x,-72+28;horizalign,left;zoom,0.5); - OnCommand=cmd(shadowlength,1); - BeginCommand=function(self) - self:settextf( Screen.String("LifeDifficulty"), "" ); - end - }; - LoadFont("Common Normal") .. { - Text=GetLifeDifficulty(); - AltText=""; - InitCommand=cmd(x,72*0.75+8;zoom,0.875); - OnCommand=cmd(shadowlength,1;skewx,-0.125); - }; +return Def.ActorFrame { +--[[ LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + OnCommand=function(self) + if GetLifeDifficulty() < 3 then + (cmd(diffuseshift;effectcolor1,Color("Blue");effectcolor2,ColorDarkTone(Color("Blue"));effectperiod,1.25))(self); + elseif GetLifeDifficulty() > 3 then + (cmd(diffuseshift;effectcolor1,Color("Red");effectcolor2,ColorDarkTone(Color("Red"));effectperiod,1.25))(self); + else + (cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")))(self); + end; + end; + }; --]] +-- LoadActor(THEME:GetPathG("OptionRowExit","frame")); + LoadActor(THEME:GetPathG("_icon","Health")) .. { + InitCommand=cmd(x,-60;shadowlength,1); + }; + LoadFont("Common Normal") .. { + Text=GetLifeDifficulty(); + AltText=""; + InitCommand=cmd(x,-72+28;horizalign,left;zoom,0.5); + OnCommand=cmd(shadowlength,1); + BeginCommand=function(self) + self:settextf( Screen.String("LifeDifficulty"), "" ); + end + }; + LoadFont("Common Normal") .. { + Text=GetLifeDifficulty(); + AltText=""; + InitCommand=cmd(x,72*0.75+8;zoom,0.875); + OnCommand=cmd(shadowlength,1;skewx,-0.125); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu NetworkStatus.lua b/Themes/default/Graphics/ScreenTitleMenu NetworkStatus.lua index 33d2f51bf7..4fcd297528 100644 --- a/Themes/default/Graphics/ScreenTitleMenu NetworkStatus.lua +++ b/Themes/default/Graphics/ScreenTitleMenu NetworkStatus.lua @@ -1,30 +1,30 @@ -local netConnected = IsNetConnected(); -local loggedOnSMO = IsNetSMOnline(); - -local t = Def.ActorFrame{ - LoadFont("Common Normal") .. { - InitCommand=cmd(uppercase,true;zoom,0.75;horizalign,left); - BeginCommand=function(self) - -- check network status - if netConnected then - self:diffuse( color("0.95,0.975,1,1") ); - self:diffusebottomedge( color("0.72,0.89,1,1") ); - self:settext( Screen.String("Network OK") ); - else - self:diffuse( color("0.75,0.75,0.75,1") ); - self:settext( Screen.String("Offline") ); - end; - end; - }; -}; - -if netConnected then - t[#t+1] = LoadFont("Common Normal") .. { - InitCommand=cmd(y,14;horizalign,left;zoom,0.5;diffuse,color("0.72,0.89,1,1")); - BeginCommand=function(self) - self:settext( string.format(Screen.String("Connected to %s"), GetServerName()) ); - end; - }; -end; - +local netConnected = IsNetConnected(); +local loggedOnSMO = IsNetSMOnline(); + +local t = Def.ActorFrame{ + LoadFont("Common Normal") .. { + InitCommand=cmd(uppercase,true;zoom,0.75;horizalign,left); + BeginCommand=function(self) + -- check network status + if netConnected then + self:diffuse( color("0.95,0.975,1,1") ); + self:diffusebottomedge( color("0.72,0.89,1,1") ); + self:settext( Screen.String("Network OK") ); + else + self:diffuse( color("0.75,0.75,0.75,1") ); + self:settext( Screen.String("Offline") ); + end; + end; + }; +}; + +if netConnected then + t[#t+1] = LoadFont("Common Normal") .. { + InitCommand=cmd(y,14;horizalign,left;zoom,0.5;diffuse,color("0.72,0.89,1,1")); + BeginCommand=function(self) + self:settext( string.format(Screen.String("Connected to %s"), GetServerName()) ); + end; + }; +end; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua b/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua index f27f3acb64..c9a5c0fc98 100644 --- a/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua +++ b/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua @@ -1,105 +1,105 @@ -local t = Def.ActorFrame {}; -local tInfo = { - {"EventMode","Stages"}, - {"LifeDifficulty","Life"}, - {"TimingDifficulty","Difficulty"}, -}; -local fSpacingX = 72; -local function MakeDisplayBar( fZoomX, fZoomY ) - return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(vertalign,bottom;y,1;zoomto,fZoomX+2,fZoomY+2); - OnCommand=cmd(diffuse,Color("Black")); - }; - Def.Quad { - InitCommand=cmd(vertalign,bottom;zoomto,fZoomX,fZoomY); - OnCommand=cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")); - }; - }; -end -local function MakeIcon( sTarget ) - local t = Def.ActorFrame { - LoadActor(THEME:GetPathG("MenuTimer","Frame")); - LoadFont("Common Normal") .. { - Text=sTarget[2]; - InitCommand=cmd(y,24+2;zoom,0.5;shadowlength,1); - }; - -- - LoadFont("Common Normal") .. { - Text="0"; - OnCommand=cmd(settext, - ( PREFSMAN:GetPreference("EventMode") ) and "∞" or PREFSMAN:GetPreference("SongsPerPlay") - ); - Condition=sTarget[1] == "EventMode"; - }; - Def.ActorFrame { - -- Life goes up to 1-5 - Def.ActorFrame { - InitCommand=cmd(y,12); - MakeDisplayBar( 6, 5 ) .. { - InitCommand=cmd(x,-16;visible,( GetLifeDifficulty() >= 1 )); - }; - MakeDisplayBar( 6, 9 ) .. { - InitCommand=cmd(x,-8;visible,( GetLifeDifficulty() >= 2 )); - }; - MakeDisplayBar( 6, 13 ) .. { - InitCommand=cmd(x,0;visible,( GetLifeDifficulty() >= 3 )); - }; - MakeDisplayBar( 6, 16 ) .. { - InitCommand=cmd(x,8;visible,( GetLifeDifficulty() >= 4 )); - }; - MakeDisplayBar( 6, 20 ) .. { - InitCommand=cmd(x,16;visible,( GetLifeDifficulty() >= 5 )); - }; - }; - Condition=sTarget[1] == "LifeDifficulty"; - }; - Def.ActorFrame { - -- Timing goes up to 1-8 - Def.ActorFrame { - InitCommand=cmd(y,12); - MakeDisplayBar( 4, 5 ) .. { - InitCommand=cmd(x,-20;visible,( GetTimingDifficulty() >= 1 )); - }; - MakeDisplayBar( 4, 9 ) .. { - InitCommand=cmd(x,-15;visible,( GetTimingDifficulty() >= 2 )); - }; - MakeDisplayBar( 4, 13 ) .. { - InitCommand=cmd(x,-10;visible,( GetTimingDifficulty() >= 3 )); - }; - MakeDisplayBar( 4, 16 ) .. { - InitCommand=cmd(x,-5;visible,( GetTimingDifficulty() >= 4 )); - }; - MakeDisplayBar( 4, 20 ) .. { - InitCommand=cmd(x,5;visible,( GetTimingDifficulty() >= 5 )); - }; - MakeDisplayBar( 4, 20 ) .. { - InitCommand=cmd(x,10;visible,( GetTimingDifficulty() >= 6 )); - }; - MakeDisplayBar( 4, 20 ) .. { - InitCommand=cmd(x,15;visible,( GetTimingDifficulty() >= 7 )); - }; - MakeDisplayBar( 4, 20 ) .. { - InitCommand=cmd(x,20;visible,( GetTimingDifficulty() >= 8 )); - }; - }; - Condition=sTarget[1] == "TimingDifficulty"; - }; - -- ---[[ for i=1,8 do - t[#t+1] = Def.Quad { - InitCommand=cmd(vertalign,bottom;zoomto,4,10+(i*4)); - }; - end --]] - }; - return t -end; - -for i=1,#tInfo do - t[#t+1] = MakeIcon( tInfo[i] ) .. { - InitCommand=cmd(x,(i-1)*fSpacingX); - }; -end - -return t - +local t = Def.ActorFrame {}; +local tInfo = { + {"EventMode","Stages"}, + {"LifeDifficulty","Life"}, + {"TimingDifficulty","Difficulty"}, +}; +local fSpacingX = 72; +local function MakeDisplayBar( fZoomX, fZoomY ) + return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(vertalign,bottom;y,1;zoomto,fZoomX+2,fZoomY+2); + OnCommand=cmd(diffuse,Color("Black")); + }; + Def.Quad { + InitCommand=cmd(vertalign,bottom;zoomto,fZoomX,fZoomY); + OnCommand=cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")); + }; + }; +end +local function MakeIcon( sTarget ) + local t = Def.ActorFrame { + LoadActor(THEME:GetPathG("MenuTimer","Frame")); + LoadFont("Common Normal") .. { + Text=sTarget[2]; + InitCommand=cmd(y,24+2;zoom,0.5;shadowlength,1); + }; + -- + LoadFont("Common Normal") .. { + Text="0"; + OnCommand=cmd(settext, + ( PREFSMAN:GetPreference("EventMode") ) and "∞" or PREFSMAN:GetPreference("SongsPerPlay") + ); + Condition=sTarget[1] == "EventMode"; + }; + Def.ActorFrame { + -- Life goes up to 1-5 + Def.ActorFrame { + InitCommand=cmd(y,12); + MakeDisplayBar( 6, 5 ) .. { + InitCommand=cmd(x,-16;visible,( GetLifeDifficulty() >= 1 )); + }; + MakeDisplayBar( 6, 9 ) .. { + InitCommand=cmd(x,-8;visible,( GetLifeDifficulty() >= 2 )); + }; + MakeDisplayBar( 6, 13 ) .. { + InitCommand=cmd(x,0;visible,( GetLifeDifficulty() >= 3 )); + }; + MakeDisplayBar( 6, 16 ) .. { + InitCommand=cmd(x,8;visible,( GetLifeDifficulty() >= 4 )); + }; + MakeDisplayBar( 6, 20 ) .. { + InitCommand=cmd(x,16;visible,( GetLifeDifficulty() >= 5 )); + }; + }; + Condition=sTarget[1] == "LifeDifficulty"; + }; + Def.ActorFrame { + -- Timing goes up to 1-8 + Def.ActorFrame { + InitCommand=cmd(y,12); + MakeDisplayBar( 4, 5 ) .. { + InitCommand=cmd(x,-20;visible,( GetTimingDifficulty() >= 1 )); + }; + MakeDisplayBar( 4, 9 ) .. { + InitCommand=cmd(x,-15;visible,( GetTimingDifficulty() >= 2 )); + }; + MakeDisplayBar( 4, 13 ) .. { + InitCommand=cmd(x,-10;visible,( GetTimingDifficulty() >= 3 )); + }; + MakeDisplayBar( 4, 16 ) .. { + InitCommand=cmd(x,-5;visible,( GetTimingDifficulty() >= 4 )); + }; + MakeDisplayBar( 4, 20 ) .. { + InitCommand=cmd(x,5;visible,( GetTimingDifficulty() >= 5 )); + }; + MakeDisplayBar( 4, 20 ) .. { + InitCommand=cmd(x,10;visible,( GetTimingDifficulty() >= 6 )); + }; + MakeDisplayBar( 4, 20 ) .. { + InitCommand=cmd(x,15;visible,( GetTimingDifficulty() >= 7 )); + }; + MakeDisplayBar( 4, 20 ) .. { + InitCommand=cmd(x,20;visible,( GetTimingDifficulty() >= 8 )); + }; + }; + Condition=sTarget[1] == "TimingDifficulty"; + }; + -- +--[[ for i=1,8 do + t[#t+1] = Def.Quad { + InitCommand=cmd(vertalign,bottom;zoomto,4,10+(i*4)); + }; + end --]] + }; + return t +end; + +for i=1,#tInfo do + t[#t+1] = MakeIcon( tInfo[i] ) .. { + InitCommand=cmd(x,(i-1)*fSpacingX); + }; +end + +return t + diff --git a/Themes/default/Graphics/ScreenTitleMenu TimingDifficulty.lua b/Themes/default/Graphics/ScreenTitleMenu TimingDifficulty.lua index 4e285d5d15..0437d83b4d 100644 --- a/Themes/default/Graphics/ScreenTitleMenu TimingDifficulty.lua +++ b/Themes/default/Graphics/ScreenTitleMenu TimingDifficulty.lua @@ -1,42 +1,42 @@ -return Def.ActorFrame { ---[[ LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { - OnCommand=function(self) - if GetTimingDifficulty() == 7 then - (cmd(glowshift;diffuse,Color("Yellow");diffuserightedge,Color("Red");effectcolor1,Colors.Alpha( Color("Red"), 0.5 );effectcolor2,Color("Invisible");effectperiod,1.25/2))(self); - elseif GetTimingDifficulty() < 4 then - (cmd(diffuseshift;effectcolor1,Color("Blue");effectcolor2,ColorDarkTone(Color("Blue"));effectperiod,1.25))(self); - elseif GetTimingDifficulty() > 4 and GetTimingDifficulty < 6 then - (cmd(diffuseshift;effectcolor1,Color("Red");effectcolor2,ColorDarkTone(Color("Red"));effectperiod,1.25))(self); - else - (cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")))(self); - end; - end; - }; --]] --- LoadActor(THEME:GetPathG("OptionRowExit","frame")); - LoadActor(THEME:GetPathG("_icon","Timing")) .. { - InitCommand=cmd(x,-60;shadowlength,1); - }; - LoadFont("Common Normal") .. { - Text=GetTimingDifficulty(); - AltText=""; - InitCommand=cmd(x,-72+28;horizalign,left;zoom,0.5); - OnCommand=cmd(shadowlength,1); - BeginCommand=function(self) - self:settextf( Screen.String("TimingDifficulty"), "" ); - end - }; - LoadFont("Common Normal") .. { - Text=GetTimingDifficulty(); - AltText=""; - InitCommand=cmd(x,72*0.75+8;zoom,0.875); - OnCommand=function(self) - (cmd(shadowlength,1;skewx,-0.125))(self); - if GetTimingDifficulty() == 9 then - self:settext("Justice"); - (cmd(zoom,0.5;diffuse,ColorLightTone( Color("Orange")) ))(self); - else - self:settext( GetTimingDifficulty() ); - end - end; - }; +return Def.ActorFrame { +--[[ LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + OnCommand=function(self) + if GetTimingDifficulty() == 7 then + (cmd(glowshift;diffuse,Color("Yellow");diffuserightedge,Color("Red");effectcolor1,Colors.Alpha( Color("Red"), 0.5 );effectcolor2,Color("Invisible");effectperiod,1.25/2))(self); + elseif GetTimingDifficulty() < 4 then + (cmd(diffuseshift;effectcolor1,Color("Blue");effectcolor2,ColorDarkTone(Color("Blue"));effectperiod,1.25))(self); + elseif GetTimingDifficulty() > 4 and GetTimingDifficulty < 6 then + (cmd(diffuseshift;effectcolor1,Color("Red");effectcolor2,ColorDarkTone(Color("Red"));effectperiod,1.25))(self); + else + (cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow")))(self); + end; + end; + }; --]] +-- LoadActor(THEME:GetPathG("OptionRowExit","frame")); + LoadActor(THEME:GetPathG("_icon","Timing")) .. { + InitCommand=cmd(x,-60;shadowlength,1); + }; + LoadFont("Common Normal") .. { + Text=GetTimingDifficulty(); + AltText=""; + InitCommand=cmd(x,-72+28;horizalign,left;zoom,0.5); + OnCommand=cmd(shadowlength,1); + BeginCommand=function(self) + self:settextf( Screen.String("TimingDifficulty"), "" ); + end + }; + LoadFont("Common Normal") .. { + Text=GetTimingDifficulty(); + AltText=""; + InitCommand=cmd(x,72*0.75+8;zoom,0.875); + OnCommand=function(self) + (cmd(shadowlength,1;skewx,-0.125))(self); + if GetTimingDifficulty() == 9 then + self:settext("Justice"); + (cmd(zoom,0.5;diffuse,ColorLightTone( Color("Orange")) ))(self); + else + self:settext( GetTimingDifficulty() ); + end + end; + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu VersionInfo.lua b/Themes/default/Graphics/ScreenTitleMenu VersionInfo.lua index f754202e9a..8f35d2a5fb 100644 --- a/Themes/default/Graphics/ScreenTitleMenu VersionInfo.lua +++ b/Themes/default/Graphics/ScreenTitleMenu VersionInfo.lua @@ -1,20 +1,20 @@ -return Def.ActorFrame { - LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { - OnCommand=cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow");diffusealpha,0.25); - }; - LoadFont("Common Normal") .. { - Text=ProductID(); - AltText=""; - InitCommand=cmd(x,-72;y,-1;horizalign,left;zoom,0.75); - OnCommand=cmd(shadowlength,1); - }; - LoadFont("Common Normal") .. { - Text=ProductVersion() .. "\n" .. VersionDate(); - AltText=""; - InitCommand=cmd(x,72*0.35;zoom,0.5); - OnCommand=cmd(shadowlength,1;skewx,-0.125); - }; ---[[ LoadFont("Common Normal") .. { - OnCommand=cmd(settext,"You're using " ..ProductID().." "..ProductVersion().."\nBuilt on "..VersionDate().." at "..VersionTime();horizalign,right;vertalign,bottom;zoom,0.5;); - }; --]] +return Def.ActorFrame { + LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + OnCommand=cmd(diffuse,Color("Orange");diffusetopedge,Color("Yellow");diffusealpha,0.25); + }; + LoadFont("Common Normal") .. { + Text=ProductID(); + AltText=""; + InitCommand=cmd(x,-72;y,-1;horizalign,left;zoom,0.75); + OnCommand=cmd(shadowlength,1); + }; + LoadFont("Common Normal") .. { + Text=ProductVersion() .. "\n" .. VersionDate(); + AltText=""; + InitCommand=cmd(x,72*0.35;zoom,0.5); + OnCommand=cmd(shadowlength,1;skewx,-0.125); + }; +--[[ LoadFont("Common Normal") .. { + OnCommand=cmd(settext,"You're using " ..ProductID().." "..ProductVersion().."\nBuilt on "..VersionDate().." at "..VersionTime();horizalign,right;vertalign,bottom;zoom,0.5;); + }; --]] }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu cursor.lua b/Themes/default/Graphics/ScreenTitleMenu cursor.lua index 51881d00a6..9e10a78ff3 100644 --- a/Themes/default/Graphics/ScreenTitleMenu cursor.lua +++ b/Themes/default/Graphics/ScreenTitleMenu cursor.lua @@ -1,8 +1,8 @@ -local t = Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,32,32); - OnCommand=cmd(spin); - }; -}; - +local t = Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,32,32); + OnCommand=cmd(spin); + }; +}; + return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu logo/default.lua b/Themes/default/Graphics/ScreenTitleMenu logo/default.lua index f08e0322d5..39bedbfad4 100644 --- a/Themes/default/Graphics/ScreenTitleMenu logo/default.lua +++ b/Themes/default/Graphics/ScreenTitleMenu logo/default.lua @@ -1,23 +1,23 @@ --- comments show how this compares to a StepMania 3.9 BGAnimation.ini. --- It should be noted that additional commands on the ActorFrame as a whole for --- this file are in metrics.ini ([ScreenTitleMenu] ShowLogo, etc.) -local t = Def.ActorFrame{ -- [BGAnimation] - LoadActor("_ball"); -- [Layer1] Type=0 File=_ball.png - LoadActor("_ball")..{ -- [Layer2] Type=0 File=_ball.png - }; - LoadActor("_text")..{ -- [Layer3] Type=0 File=_text.png - InitCommand=cmd(y,48;hide_if,GAMESTATE:GetMultiplayer()); -- Command=y,48 - }; - LoadActor("_multi")..{ -- [Layer4] Type=0 File=_multi.png - InitCommand=cmd(y,60;hide_if,not GAMESTATE:GetMultiplayer()); -- Command=y,48 - -- the hide_if command would be similar to Condition=, which also exists. - -- Condition=GAMESTATE:GetMultiplayer(); is the equivalent code. - }; - LoadFont("Common normal")..{ - Text="sm-ssc Multiplayer"; - InitCommand=cmd(y,5;shadowlength,0;strokecolor,color("0,0,0,0.375");diffusebottomedge,color("#D6DBDD");); - BeginCommand=cmd(hide_if,not GAMESTATE:GetMultiplayer()); - }; -}; - +-- comments show how this compares to a StepMania 3.9 BGAnimation.ini. +-- It should be noted that additional commands on the ActorFrame as a whole for +-- this file are in metrics.ini ([ScreenTitleMenu] ShowLogo, etc.) +local t = Def.ActorFrame{ -- [BGAnimation] + LoadActor("_ball"); -- [Layer1] Type=0 File=_ball.png + LoadActor("_ball")..{ -- [Layer2] Type=0 File=_ball.png + }; + LoadActor("_text")..{ -- [Layer3] Type=0 File=_text.png + InitCommand=cmd(y,48;hide_if,GAMESTATE:GetMultiplayer()); -- Command=y,48 + }; + LoadActor("_multi")..{ -- [Layer4] Type=0 File=_multi.png + InitCommand=cmd(y,60;hide_if,not GAMESTATE:GetMultiplayer()); -- Command=y,48 + -- the hide_if command would be similar to Condition=, which also exists. + -- Condition=GAMESTATE:GetMultiplayer(); is the equivalent code. + }; + LoadFont("Common normal")..{ + Text="sm-ssc Multiplayer"; + InitCommand=cmd(y,5;shadowlength,0;strokecolor,color("0,0,0,0.375");diffusebottomedge,color("#D6DBDD");); + BeginCommand=cmd(hide_if,not GAMESTATE:GetMultiplayer()); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenTitleMenu scroll.lua b/Themes/default/Graphics/ScreenTitleMenu scroll.lua index e4ab8c1423..3587fe15d6 100644 --- a/Themes/default/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/default/Graphics/ScreenTitleMenu scroll.lua @@ -1,34 +1,34 @@ -local gc = Var("GameCommand"); - -return Def.ActorFrame { - Def.Quad{ - InitCommand=cmd(zoomto,192,26;diffuse,HSVA(192,0.8,1,0.45);blend,Blend.Add;fadeleft,0.5;faderight,0.35;skewx,-0.1); - OnCommand=cmd(glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.125");); - --[[ - GainFocusCommand=cmd(stoptweening;croptop,0;cropbottom,1;linear,0.05;cropbottom,0;); - LoseFocusCommand=cmd(stoptweening;croptop,0;linear,0.05;croptop,1;); - --]] - GainFocusCommand=cmd(stoptweening;cropright,0;cropleft,1;linear,0.05;cropleft,0;); - LoseFocusCommand=cmd(stoptweening;cropright,0;linear,0.05;cropright,1;); - }; - LoadFont("Common Normal") .. { - Text=gc:GetText(); ---[[ EnabledCommand=function(self) - if string.find( THEME:GetMetric( Var "LoadingScreen", "DisabledChoices") , gc:GetText() ) ~= nil then - self:diffuse(Color("Red")); - end - end; --]] - OnCommand=cmd(strokecolor,Color("Outline")); - GainFocusCommand=cmd(stoptweening;linear,0.125;zoom,1;diffuse,color("1,1,1,1")); ---[[ GainFocusCommand=function(self) - if string.find( tostring( THEME:GetMetric( Var "LoadingScreen", "DisabledChoices") ) , gc:GetText() ) ~= nil then - self:zoom(1); - self:diffuse(Color("Red")); - else - self:zoom(1); - self:diffuse(Color("White")); - end - end; --]] - LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.75;diffuse,color("0.5,0.5,0.5,1")); - }; +local gc = Var("GameCommand"); + +return Def.ActorFrame { + Def.Quad{ + InitCommand=cmd(zoomto,192,26;diffuse,HSVA(192,0.8,1,0.45);blend,Blend.Add;fadeleft,0.5;faderight,0.35;skewx,-0.1); + OnCommand=cmd(glowshift;effectcolor1,color("1,1,1,0");effectcolor2,color("1,1,1,0.125");); + --[[ + GainFocusCommand=cmd(stoptweening;croptop,0;cropbottom,1;linear,0.05;cropbottom,0;); + LoseFocusCommand=cmd(stoptweening;croptop,0;linear,0.05;croptop,1;); + --]] + GainFocusCommand=cmd(stoptweening;cropright,0;cropleft,1;linear,0.05;cropleft,0;); + LoseFocusCommand=cmd(stoptweening;cropright,0;linear,0.05;cropright,1;); + }; + LoadFont("Common Normal") .. { + Text=gc:GetText(); +--[[ EnabledCommand=function(self) + if string.find( THEME:GetMetric( Var "LoadingScreen", "DisabledChoices") , gc:GetText() ) ~= nil then + self:diffuse(Color("Red")); + end + end; --]] + OnCommand=cmd(strokecolor,Color("Outline")); + GainFocusCommand=cmd(stoptweening;linear,0.125;zoom,1;diffuse,color("1,1,1,1")); +--[[ GainFocusCommand=function(self) + if string.find( tostring( THEME:GetMetric( Var "LoadingScreen", "DisabledChoices") ) , gc:GetText() ) ~= nil then + self:zoom(1); + self:diffuse(Color("Red")); + else + self:zoom(1); + self:diffuse(Color("White")); + end + end; --]] + LoseFocusCommand=cmd(stoptweening;linear,0.125;zoom,0.75;diffuse,color("0.5,0.5,0.5,1")); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenWithMenuElements Help.lua b/Themes/default/Graphics/ScreenWithMenuElements Help.lua index aa895803c5..fcb77351b2 100644 --- a/Themes/default/Graphics/ScreenWithMenuElements Help.lua +++ b/Themes/default/Graphics/ScreenWithMenuElements Help.lua @@ -1,10 +1,10 @@ -return Def.HelpDisplay { - File = THEME:GetPathF("HelpDisplay", "text"); - InitCommand=function(self) - local s = THEME:GetString(Var "LoadingScreen","HelpText"); - self:SetTipsColonSeparated(s); - end; - SetHelpTextCommand=function(self, params) - self:SetTipsColonSeparated( params.Text ); - end; +return Def.HelpDisplay { + File = THEME:GetPathF("HelpDisplay", "text"); + InitCommand=function(self) + local s = THEME:GetString(Var "LoadingScreen","HelpText"); + self:SetTipsColonSeparated(s); + end; + SetHelpTextCommand=function(self, params) + self:SetTipsColonSeparated( params.Text ); + end; }; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenWithMenuElements StageDisplay.lua b/Themes/default/Graphics/ScreenWithMenuElements StageDisplay.lua index cc9f4f6a8a..abc1409fa6 100644 --- a/Themes/default/Graphics/ScreenWithMenuElements StageDisplay.lua +++ b/Themes/default/Graphics/ScreenWithMenuElements StageDisplay.lua @@ -1,78 +1,78 @@ - -local stages = Def.ActorFrame { - BeginCommand=cmd(playcommand,"Set";); - CurrentSongChangedMessageCommand=cmd(finishtweening;playcommand,"Set";); -}; - -local ScreenName = Var "LoadingScreen"; - -function MakeBitmapTest() - return LoadFont(ScreenName,"StageDisplay") .. { - - }; -end -if not PREFSMAN:GetPreference("EventMode") then - for s in ivalues(Stage) do - stages[#stages+1] = MakeBitmapTest() .. { - SetCommand=function(self, params) - local tRemap = { - Stage_1st = 1, - Stage_2nd = 2, - Stage_3rd = 3, - Stage_4th = 4, - Stage_5th = 5, - Stage_6th = 6, ---[[ 'Stage_Next' = 6, - 'Stage_Final' = 7, - 'Stage_Extra1' = 8, - 'Stage_Extra2' = 9, - 'Stage_Nonstop' = 10, - 'Stage_Oni' = 11, - 'Stage_Endless' = 12, - 'Stage_Event' = 13, - 'Stage_Demo' = 14, --]] - } - local Stage = GAMESTATE:GetCurrentStage(); - local StageIndex = GAMESTATE:GetCurrentStageIndex(); - local screen = SCREENMAN:GetTopScreen(); --- local cStageOutlineColor = ColorDarkTone( StageToStrokeColor(s) ); --- cStageOutlineColor[4] = 0.75; - if screen and screen.GetStageStats then - local ss = screen:GetStageStats(); - Stage = ss:GetStage(); - StageIndex = ss:GetStageIndex(); - end - self:visible( Stage == s ); - - if tRemap[Stage] == PREFSMAN:GetPreference("SongsPerPlay") then - Stage = 'Stage_Final'; --- s = 7; - else - Stage = Stage; - s = s; - end; - self:settext( StageToLocalizedString(Stage) .. " Stage" ); --- self:settext( StageToLocalizedString(Stage) .. " Stage" ); - self:diffuse( (Stage == 'Stage_Final') and StageToColor('Stage_Final') or StageToColor(s) ); - self:diffusebottomedge( (Stage == 'Stage_Final') and ColorMidTone(StageToColor('Stage_Final')) or ColorMidTone(StageToColor(s)) ); - self:strokecolor( (Stage == 'Stage_Final') and ColorDarkTone(StageToColor('Stage_Final')) or ColorDarkTone(StageToColor(s)) ); - end; - } - end -else - stages[#stages+1] = MakeBitmapTest() .. { - SetCommand=function(self,params) - if Var "LoadingScreen" then - local Offset = THEME:GetMetric(Var "LoadingScreen","StageDisplayNumberOffset"); - local Stage = GAMESTATE:GetCurrentStageIndex(); - local RealStage = Stage + Offset; - self:settextf( "Stage %03i", RealStage); - self:diffuse( StageToColor('Stage_1st') ); - self:diffusebottomedge( ColorMidTone(StageToColor('Stage_1st')) ); - self:strokecolor( Colors.Alpha( ColorDarkTone(StageToColor('Stage_1st')), 0.75) ); - end; - end; - } -end - -return stages; + +local stages = Def.ActorFrame { + BeginCommand=cmd(playcommand,"Set";); + CurrentSongChangedMessageCommand=cmd(finishtweening;playcommand,"Set";); +}; + +local ScreenName = Var "LoadingScreen"; + +function MakeBitmapTest() + return LoadFont(ScreenName,"StageDisplay") .. { + + }; +end +if not PREFSMAN:GetPreference("EventMode") then + for s in ivalues(Stage) do + stages[#stages+1] = MakeBitmapTest() .. { + SetCommand=function(self, params) + local tRemap = { + Stage_1st = 1, + Stage_2nd = 2, + Stage_3rd = 3, + Stage_4th = 4, + Stage_5th = 5, + Stage_6th = 6, +--[[ 'Stage_Next' = 6, + 'Stage_Final' = 7, + 'Stage_Extra1' = 8, + 'Stage_Extra2' = 9, + 'Stage_Nonstop' = 10, + 'Stage_Oni' = 11, + 'Stage_Endless' = 12, + 'Stage_Event' = 13, + 'Stage_Demo' = 14, --]] + } + local Stage = GAMESTATE:GetCurrentStage(); + local StageIndex = GAMESTATE:GetCurrentStageIndex(); + local screen = SCREENMAN:GetTopScreen(); +-- local cStageOutlineColor = ColorDarkTone( StageToStrokeColor(s) ); +-- cStageOutlineColor[4] = 0.75; + if screen and screen.GetStageStats then + local ss = screen:GetStageStats(); + Stage = ss:GetStage(); + StageIndex = ss:GetStageIndex(); + end + self:visible( Stage == s ); + + if tRemap[Stage] == PREFSMAN:GetPreference("SongsPerPlay") then + Stage = 'Stage_Final'; +-- s = 7; + else + Stage = Stage; + s = s; + end; + self:settext( StageToLocalizedString(Stage) .. " Stage" ); +-- self:settext( StageToLocalizedString(Stage) .. " Stage" ); + self:diffuse( (Stage == 'Stage_Final') and StageToColor('Stage_Final') or StageToColor(s) ); + self:diffusebottomedge( (Stage == 'Stage_Final') and ColorMidTone(StageToColor('Stage_Final')) or ColorMidTone(StageToColor(s)) ); + self:strokecolor( (Stage == 'Stage_Final') and ColorDarkTone(StageToColor('Stage_Final')) or ColorDarkTone(StageToColor(s)) ); + end; + } + end +else + stages[#stages+1] = MakeBitmapTest() .. { + SetCommand=function(self,params) + if Var "LoadingScreen" then + local Offset = THEME:GetMetric(Var "LoadingScreen","StageDisplayNumberOffset"); + local Stage = GAMESTATE:GetCurrentStageIndex(); + local RealStage = Stage + Offset; + self:settextf( "Stage %03i", RealStage); + self:diffuse( StageToColor('Stage_1st') ); + self:diffusebottomedge( ColorMidTone(StageToColor('Stage_1st')) ); + self:strokecolor( Colors.Alpha( ColorDarkTone(StageToColor('Stage_1st')), 0.75) ); + end; + end; + } +end + +return stages; diff --git a/Themes/default/Graphics/ScreenWithMenuElements header/default.lua b/Themes/default/Graphics/ScreenWithMenuElements header/default.lua index 85fabc6526..6e79934dbf 100644 --- a/Themes/default/Graphics/ScreenWithMenuElements header/default.lua +++ b/Themes/default/Graphics/ScreenWithMenuElements header/default.lua @@ -1,21 +1,21 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = LoadActor("Header") .. { - InitCommand=cmd(vertalign,top;zoomtowidth,SCREEN_WIDTH+1;diffuse,color("#ffd400")); -}; ---[[ t[#t+1] = LoadActor("_texture stripe") .. { - InitCommand=cmd(vertalign,top;zoomto,SCREEN_WIDTH+64,44;customtexturerect,0,0,SCREEN_WIDTH+64/8,44/32); - OnCommand=cmd(fadebottom,0.8;texcoordvelocity,1,0;skewx,-0.0025;diffuse,Color("Black");diffusealpha,0.235); -}; --]] -t[#t+1] = LoadFont("Common Normal") .. { - Name="HeaderText"; - Text=Screen.String("HeaderText"); - InitCommand=cmd(x,-SCREEN_CENTER_X+24;y,24;zoom,1;horizalign,left;shadowlength,0;maxwidth,200); - OnCommand=cmd(skewx,-0.125;strokecolor,Color("Outline");diffusebottomedge,color("0.875,0.875,0.875")); - UpdateScreenHeaderMessageCommand=function(self,param) - self:settext(param.Header); - end; -}; - - +local t = Def.ActorFrame {}; + +t[#t+1] = LoadActor("Header") .. { + InitCommand=cmd(vertalign,top;zoomtowidth,SCREEN_WIDTH+1;diffuse,color("#ffd400")); +}; +--[[ t[#t+1] = LoadActor("_texture stripe") .. { + InitCommand=cmd(vertalign,top;zoomto,SCREEN_WIDTH+64,44;customtexturerect,0,0,SCREEN_WIDTH+64/8,44/32); + OnCommand=cmd(fadebottom,0.8;texcoordvelocity,1,0;skewx,-0.0025;diffuse,Color("Black");diffusealpha,0.235); +}; --]] +t[#t+1] = LoadFont("Common Normal") .. { + Name="HeaderText"; + Text=Screen.String("HeaderText"); + InitCommand=cmd(x,-SCREEN_CENTER_X+24;y,24;zoom,1;horizalign,left;shadowlength,0;maxwidth,200); + OnCommand=cmd(skewx,-0.125;strokecolor,Color("Outline");diffusebottomedge,color("0.875,0.875,0.875")); + UpdateScreenHeaderMessageCommand=function(self,param) + self:settext(param.Header); + end; +}; + + return t \ No newline at end of file diff --git a/Themes/default/Graphics/ScrollBar TickThumb.lua b/Themes/default/Graphics/ScrollBar TickThumb.lua index ee3986645f..0c8ff6249f 100644 --- a/Themes/default/Graphics/ScrollBar TickThumb.lua +++ b/Themes/default/Graphics/ScrollBar TickThumb.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame {}; - -t[#t+1] = Def.ActorFrame { - Def.Quad { - InitCommand=cmd(zoomto,32,32); - }; -}; - +local t = Def.ActorFrame {}; + +t[#t+1] = Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomto,32,32); + }; +}; + return t \ No newline at end of file diff --git a/Themes/default/Graphics/StepsDisplay StepsType.lua b/Themes/default/Graphics/StepsDisplay StepsType.lua index 6d3aa4752d..3afec31aee 100644 --- a/Themes/default/Graphics/StepsDisplay StepsType.lua +++ b/Themes/default/Graphics/StepsDisplay StepsType.lua @@ -1,29 +1,29 @@ -local sString; -local t = Def.ActorFrame{ - - LoadFont("Common normal")..{ - InitCommand=cmd(shadowlength,1); - SetMessageCommand=function(self,param) - if param.StepsType then - sString = THEME:GetString("StepsDisplay StepsType",ToEnumShortString(param.StepsType)); - if param.Steps and param.Steps:IsAutogen() then - self:diffusebottomedge(color("0.75,0.75,0.75,1")); - else - self:diffuse(Color("White")); - end; - self:settext( sString ); - end; - end; - }; - -- argh this isn't working as nicely as I would've hoped... - --[[ - Def.Sprite{ - SetMessageCommand=function(self,param) - self:Load( THEME:GetPathG("","_StepsType/"..ToEnumShortString(param.StepsType)) ); - self:diffusealpha(0.5); - end; - }; - --]] -}; - +local sString; +local t = Def.ActorFrame{ + + LoadFont("Common normal")..{ + InitCommand=cmd(shadowlength,1); + SetMessageCommand=function(self,param) + if param.StepsType then + sString = THEME:GetString("StepsDisplay StepsType",ToEnumShortString(param.StepsType)); + if param.Steps and param.Steps:IsAutogen() then + self:diffusebottomedge(color("0.75,0.75,0.75,1")); + else + self:diffuse(Color("White")); + end; + self:settext( sString ); + end; + end; + }; + -- argh this isn't working as nicely as I would've hoped... + --[[ + Def.Sprite{ + SetMessageCommand=function(self,param) + self:Load( THEME:GetPathG("","_StepsType/"..ToEnumShortString(param.StepsType)) ); + self:diffusealpha(0.5); + end; + }; + --]] +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/StepsDisplayListRow StepsType.lua b/Themes/default/Graphics/StepsDisplayListRow StepsType.lua index 7b2333402d..d79262b22b 100644 --- a/Themes/default/Graphics/StepsDisplayListRow StepsType.lua +++ b/Themes/default/Graphics/StepsDisplayListRow StepsType.lua @@ -1,29 +1,29 @@ -local sString; -local t = Def.ActorFrame{ ---[[ LoadActor("TestStep") .. { - InitCommand=cmd(zoomto,20,20); - }; --]] - LoadFont("Common normal")..{ - InitCommand=cmd(shadowlength,1;horizalign,left;zoom,0.45;skewx,-0.125); - SetMessageCommand=function(self,param) - sString = THEME:GetString("StepsListDisplayRow StepsType",ToEnumShortString(param.StepsType)); - if param.Steps and param.Steps:IsAutogen() then - self:diffusebottomedge(color("0.75,0.75,0.75,1")); - else - self:diffuse(Color("White")); - end; - self:settext( sString ); - end; - }; - -- argh this isn't working as nicely as I would've hoped... - --[[ - Def.Sprite{ - SetMessageCommand=function(self,param) - self:Load( THEME:GetPathG("","_StepsType/"..ToEnumShortString(param.StepsType)) ); - self:diffusealpha(0.5); - end; - }; - --]] -}; - +local sString; +local t = Def.ActorFrame{ +--[[ LoadActor("TestStep") .. { + InitCommand=cmd(zoomto,20,20); + }; --]] + LoadFont("Common normal")..{ + InitCommand=cmd(shadowlength,1;horizalign,left;zoom,0.45;skewx,-0.125); + SetMessageCommand=function(self,param) + sString = THEME:GetString("StepsListDisplayRow StepsType",ToEnumShortString(param.StepsType)); + if param.Steps and param.Steps:IsAutogen() then + self:diffusebottomedge(color("0.75,0.75,0.75,1")); + else + self:diffuse(Color("White")); + end; + self:settext( sString ); + end; + }; + -- argh this isn't working as nicely as I would've hoped... + --[[ + Def.Sprite{ + SetMessageCommand=function(self,param) + self:Load( THEME:GetPathG("","_StepsType/"..ToEnumShortString(param.StepsType)) ); + self:diffusealpha(0.5); + end; + }; + --]] +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/_JudgmentLineLabel/default.lua b/Themes/default/Graphics/_JudgmentLineLabel/default.lua index 7e3ece00ab..904efe9c61 100644 --- a/Themes/default/Graphics/_JudgmentLineLabel/default.lua +++ b/Themes/default/Graphics/_JudgmentLineLabel/default.lua @@ -1,19 +1,19 @@ -local jl = Var "JudgmentLine"; - -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(horizalign,right;zoomto,256,18); - OnCommand=cmd(diffuse,Color("Black");fadeleft,1); - }; - Def.Quad { - InitCommand=cmd(horizalign,left;zoomto,256,18); - OnCommand=cmd(diffuse,Color("Black");faderight,1); - }; - - LoadActor("_frame") .. { - InitCommand=cmd(zoomy,0.75;diffuse,JudgmentLineToColor(jl)); - }; - LoadFont("Common Normal") .. { - InitCommand=cmd(zoom,0.75;settext,string.upper(JudgmentLineToLocalizedString(jl));diffuse,JudgmentLineToColor(jl);strokecolor,JudgmentLineToStrokeColor(jl);shadowlength,0;maxwidth,180); - }; +local jl = Var "JudgmentLine"; + +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(horizalign,right;zoomto,256,18); + OnCommand=cmd(diffuse,Color("Black");fadeleft,1); + }; + Def.Quad { + InitCommand=cmd(horizalign,left;zoomto,256,18); + OnCommand=cmd(diffuse,Color("Black");faderight,1); + }; + + LoadActor("_frame") .. { + InitCommand=cmd(zoomy,0.75;diffuse,JudgmentLineToColor(jl)); + }; + LoadFont("Common Normal") .. { + InitCommand=cmd(zoom,0.75;settext,string.upper(JudgmentLineToLocalizedString(jl));diffuse,JudgmentLineToColor(jl);strokecolor,JudgmentLineToStrokeColor(jl);shadowlength,0;maxwidth,180); + }; }; \ No newline at end of file diff --git a/Themes/default/Graphics/_frame 1d.lua b/Themes/default/Graphics/_frame 1d.lua index 8cfcee91cd..ffd95ec281 100644 --- a/Themes/default/Graphics/_frame 1d.lua +++ b/Themes/default/Graphics/_frame 1d.lua @@ -1,167 +1,167 @@ --- --- Load a resizable 1-d frame. p contains an odd number of parts. --- Even parts are resized; odd parts are not (unless the requested --- width is too small). The frame is centered on the midway part --- of p; parts to the left and right are anchored on the inside. --- --- A 3-part frame; the center third is dynamic, expanding outwards --- in both directions: --- p = { 1/3, 1/3, 1/3 }; --- --oo-- --- --oooooooooo-- --- --- A 2-part frame. The left half is static, the right side dynamic; --- the left part stays in place as the right half expands to the right, --- with the frame centered on the boundary: --- <<-- --- <<----------- --- p = { 1/2, 0, 0, 1/2, 0 }; --- --- A 5-part frame, with an anchored center and static caps on each --- end, expanding outwards: --- <<--oo-->> --- <<----------oo---------->> --- p = { 1/5, 1/5, 1/10, 0, 1/10, 1/5, 1/5 }; --- - -local p, a = ... -assert( (#p%2) == 1 ); - -local t = Def.ActorFrame { -}; -local Widths = { } - -local TextureXPos = 0 -for i = 1,#p do - t[i] = a .. { - Name = tostring(i); - InitCommand = function(self) - if i < math.ceil(#p/2) then self:horizalign("HorizAlign_Right"); - elseif i == math.ceil(#p/2) then self:horizalign("HorizAlign_Center"); - else self:horizalign("HorizAlign_Left"); - end - - Widths[i] = self:GetWidth(); - end; - - SetPartSizeCommand = function(self, params) - self:x( params.XPos[i] ); - self:zoomtowidth( params.Zooms[i] ); - end; - }; - - local Width = p[i]; - t[i].Frames = - { - { -- state 0 - { x=TextureXPos, y=0 }, -- top-left - { x=(TextureXPos+Width), y=1 } -- bottom-right - } - }; - - TextureXPos = TextureXPos + Width; -end - -t.InitCommand = function(self, params) - local Child = self:GetChild("1"); - local Height = Child:GetHeight(); - self:SetHeight(Height); -end - -t.SetPartSizeCommand = function(self, params) - self:zoomx( params.FrameZoom ); -end - -t.SetSizeCommand = function(self, params) - local Width = params.Width; - assert( Width ); - - self:SetWidth( Width ); - - if params.tween then - params.tween(self); - self:RunCommandsOnChildren( params.tween ); - end; - - local UnscaledPartWidth = 0; - local ScaledPartWidth = 0; - for i = 1,#p do - if(i%2)==0 then - ScaledPartWidth = ScaledPartWidth + Widths[i]; - else - UnscaledPartWidth = UnscaledPartWidth + Widths[i]; - end - end - - local WidthToScale = Width - UnscaledPartWidth; - local CurrentScaledPartWidth = math.max( WidthToScale, 0 ); - - params.Zooms = {}; - params.XPos = {}; - local pos = 0; - for i = math.ceil(#p/2),1,-1 do - local ThisScaledPartWidth = Widths[i]; - if (i % 2) == 0 then - ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); - end - - params.XPos[i] = pos; - - if i == math.ceil(#p/2) then - pos = pos - ThisScaledPartWidth/2; - else - pos = pos - ThisScaledPartWidth; - end - - params.Zooms[i] = ThisScaledPartWidth; - end - pos = 0; - for i = math.ceil(#p/2),#p do - local ThisScaledPartWidth = Widths[i]; - if (i % 2) == 0 then - ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); - end - - params.XPos[i] = pos; - - if i == math.ceil(#p/2) then - pos = pos + ThisScaledPartWidth/2; - else - pos = pos + ThisScaledPartWidth; - end - - params.Zooms[i] = ThisScaledPartWidth; - end - - params.FrameZoom = math.min(Width / UnscaledPartWidth, 1); - - self:playcommand("SetPartSize", params); -end - -return t; - --- --- (c) 2007 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. --- - +-- +-- Load a resizable 1-d frame. p contains an odd number of parts. +-- Even parts are resized; odd parts are not (unless the requested +-- width is too small). The frame is centered on the midway part +-- of p; parts to the left and right are anchored on the inside. +-- +-- A 3-part frame; the center third is dynamic, expanding outwards +-- in both directions: +-- p = { 1/3, 1/3, 1/3 }; +-- --oo-- +-- --oooooooooo-- +-- +-- A 2-part frame. The left half is static, the right side dynamic; +-- the left part stays in place as the right half expands to the right, +-- with the frame centered on the boundary: +-- <<-- +-- <<----------- +-- p = { 1/2, 0, 0, 1/2, 0 }; +-- +-- A 5-part frame, with an anchored center and static caps on each +-- end, expanding outwards: +-- <<--oo-->> +-- <<----------oo---------->> +-- p = { 1/5, 1/5, 1/10, 0, 1/10, 1/5, 1/5 }; +-- + +local p, a = ... +assert( (#p%2) == 1 ); + +local t = Def.ActorFrame { +}; +local Widths = { } + +local TextureXPos = 0 +for i = 1,#p do + t[i] = a .. { + Name = tostring(i); + InitCommand = function(self) + if i < math.ceil(#p/2) then self:horizalign("HorizAlign_Right"); + elseif i == math.ceil(#p/2) then self:horizalign("HorizAlign_Center"); + else self:horizalign("HorizAlign_Left"); + end + + Widths[i] = self:GetWidth(); + end; + + SetPartSizeCommand = function(self, params) + self:x( params.XPos[i] ); + self:zoomtowidth( params.Zooms[i] ); + end; + }; + + local Width = p[i]; + t[i].Frames = + { + { -- state 0 + { x=TextureXPos, y=0 }, -- top-left + { x=(TextureXPos+Width), y=1 } -- bottom-right + } + }; + + TextureXPos = TextureXPos + Width; +end + +t.InitCommand = function(self, params) + local Child = self:GetChild("1"); + local Height = Child:GetHeight(); + self:SetHeight(Height); +end + +t.SetPartSizeCommand = function(self, params) + self:zoomx( params.FrameZoom ); +end + +t.SetSizeCommand = function(self, params) + local Width = params.Width; + assert( Width ); + + self:SetWidth( Width ); + + if params.tween then + params.tween(self); + self:RunCommandsOnChildren( params.tween ); + end; + + local UnscaledPartWidth = 0; + local ScaledPartWidth = 0; + for i = 1,#p do + if(i%2)==0 then + ScaledPartWidth = ScaledPartWidth + Widths[i]; + else + UnscaledPartWidth = UnscaledPartWidth + Widths[i]; + end + end + + local WidthToScale = Width - UnscaledPartWidth; + local CurrentScaledPartWidth = math.max( WidthToScale, 0 ); + + params.Zooms = {}; + params.XPos = {}; + local pos = 0; + for i = math.ceil(#p/2),1,-1 do + local ThisScaledPartWidth = Widths[i]; + if (i % 2) == 0 then + ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); + end + + params.XPos[i] = pos; + + if i == math.ceil(#p/2) then + pos = pos - ThisScaledPartWidth/2; + else + pos = pos - ThisScaledPartWidth; + end + + params.Zooms[i] = ThisScaledPartWidth; + end + pos = 0; + for i = math.ceil(#p/2),#p do + local ThisScaledPartWidth = Widths[i]; + if (i % 2) == 0 then + ThisScaledPartWidth = scale( CurrentScaledPartWidth, 0, ScaledPartWidth, 0, Widths[i] ); + end + + params.XPos[i] = pos; + + if i == math.ceil(#p/2) then + pos = pos + ThisScaledPartWidth/2; + else + pos = pos + ThisScaledPartWidth; + end + + params.Zooms[i] = ThisScaledPartWidth; + end + + params.FrameZoom = math.min(Width / UnscaledPartWidth, 1); + + self:playcommand("SetPartSize", params); +end + +return t; + +-- +-- (c) 2007 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. +-- + diff --git a/Themes/default/Languages/en.ini b/Themes/default/Languages/en.ini index 92cff0cbce..125ed3b51f 100644 --- a/Themes/default/Languages/en.ini +++ b/Themes/default/Languages/en.ini @@ -1,163 +1,163 @@ -[Screen] -HelpText=&BACK; Exit &START; Select &SELECT; Options &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Move -[ScreenWithMenuElements] -HelpText=&BACK; Exit &START; Select &MENULEFT;&MENURIGHT; Move -[ScreenTitleMenu] -HelpText=&BACK; Exit &START; Select &MENUUP;&MENUDOWN; Move -Network OK=Network OK -Offline=Offline -Connected to %s=Connected to %s -CurrentGametype=Current Gametype: %s -LifeDifficulty=Life Difficulty: %s -TimingDifficulty=Timing Difficulty: %s -[ScreenTitleJoin] -HelpText=Press &START; to Play -HelpTextJoin=Press &START; to Play -HelpTextWait=Insert Credits... -EventMode=Event Mode -JointPremiumMain=Joint Premium -JointPremiumSecondary=Two players can play with one credit! -DoublesPremiumMain=Doubles Premium -DoublesPremiumSecondary=Play doubles for one credit! -[ScreenDemonstration] -Demonstration=Demonstration -[ScreenQuickSetupOverview] -Explanation=Quick Setup provides a easy way to set commonly-changed and useful preferences. -[ScreenProfileLoad] -HelpText=... Loading profiles, please wait ... -[ScreenSelectProfile] -HelpText=&MENUUP;&MENUDOWN; Switch Profile &START; Choose/Join &BACK; Unselect -[ScreenSelectMaster] -HelpText=&BACK; Exit &START; Select / Join &MENULEFT;&MENURIGHT; Move -[ScreenSelectPlayMode] -HelpText=&BACK; Exit &START; Select / Join &MENULEFT;&MENURIGHT; Move -EasyExplanation=A mode for beginners. -HardExplanation=For experts. -OldNormalExplanation=Not too easy, not too hard. -NormalExplanation=Play all your favorite songs! -RaveExplanation=Battle against friend or foe. -ExtendedExplanation=Several Songs in a row -OniExplanation=A true test of skill. -EndlessExplanation=It don't stop, it keep rollin'. -[ScreenSelectPlayStyle] -HelpText=&BACK; Exit &START; Select &MENULEFT;&MENURIGHT; Move -[ScreenGameInformation] -HelpText=&BACK; Exit &START; Skip -[ScreenSelectMusic] -HelpText=&BACK; Exit &START; Select / Join &SELECT; Magic Codes &MENULEFT;&MENURIGHT; Move::&AUXWHITE;+[KEY] Sort To [KEY] -AlternateHelpText=&SELECT;+&MENULEFT;&MENURIGHT; Change Difficulties &SELECT;+&START; Quick Sort -[ScreenSelectCourse] -HelpText=&BACK; Exit &START; Select / Join &SELECT; Magic Codes &MENULEFT;&MENURIGHT; Move::&UP;&DOWN;&UP;&DOWN; for other course types -[ScreenOptions] -HelpText=&BACK; Exit &START; Choose &SELECT; Go Up &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Move -[ScreenStageInformation] -HelpText= -[ScreenGameplay] -HelpText= -[ScreenEvaluation] -HelpText=&BACK; Exit &START; Move On &MENULEFT;+&MENURIGHT; or &SELECT; Snapshot -LifeDifficulty=Life Difficulty: %s -TimingDifficulty=Timing Difficulty: %s -[OptionTitles] -GamePrefAutoSetStyle=Auto Set Style -UserPrefSpecialScoringMode=Special Scoring Mode -GamePrefNotePosition=Note Positions -GamePrefComboOnRolls=Rolls Increment Combo -GamePrefComboUnderField=Combo Under Field - -UserPrefGameplayShowScore=Show Score -UserPrefGameplayShowStepsDisplay=Show Steps -UserPrefShowLotsaOptions=Options Density -UserPrefLongFail=Fail Length -UserPrefFlashyCombo=Flashy Combo -UserPrefGameplayFooter=Gameplay Footer -[OptionExplanations] -GamePrefAutoSetStyle=Allow the game to list all one player and two player modes at once instead of one style only. This might require a restart of StepMania\n( or alternatively hit F2! ) -GamePrefNotePosition=Determines where the arrow receptors are placed in gameplay. -GamePrefComboOnRolls=Choose if rolls should increment the combo or not. -GamePrefComboUnderField=Determine if the combo should display under the notes or not. - -UserPrefGameplayShowScore=Show or Hide the score display in gameplay. -UserPrefSpecialScoringMode=Select the scoring mode to be used if the Special scoring type is selected. -UserPrefGameplayShowStepsDisplay=Show or Hide the step information display in gameplay. -UserPrefShowLotsaOptions=Choose how many lines/rows of options to choose from. &oq;Few&cq; keeps the list to a minimum. &oq;Many&cq; adds various show-off mods. -UserPrefLongFail=Choose between the original sm-ssc fail (Long) or the new sm-ssc fail (Short). -UserPrefFlashyCombo=Determine if combo flashes should be shown or not. -UserPrefGameplayFooter=If on, displays a footer that blocks visibility of incoming arrows for a certain region ( DDR's score frame ). - -ScoringType=Defines which scoring method to use. If Special is selected, you can select a Special Scoring Mode in Theme Options. - -Speed=Adjust the speed at which arrows travel toward the targets. -Accel=Change the way arrows approach the targets. -Effect=Change the size or movement of the arrows and/or targets. -Appearance=Control the visibilty of the arrows. -Turn=Change the step choreography by adjusting the position of arrows. -Insert=Add tap notes to the step choreography. -Holds=Turn some tap notes into hold notes. -Mines=Add or remove mine notes. -PlayerAutoPlay=Have the notefield play by itself. -ScoreDisplay=Change the way your score is shown. -ProTiming=Change the way your judgments are shown. -Scroll=Adjust the direction arrows flow to meet the targets. -NoteSkins=Choose a different appearance for the arrows. -Handicap=Removes notes. Using these will invalidate a high score. -Hide=Adjust the visibility of the targets. -Persp=Change the viewing angle of the arrow stream. -Steps=Adjust the difficulty of the steps. -Characters=Dancing buddies. -SaveToProfileHelp=Requires profile or memory card. -MusicRateHelp=Play the music at a faster rate. -[StepsListDisplayRow StepsType] -Dance_Single=4 -Dance_Double=8 -Dance_Couple=8 -Dance_Solo=6 -Dance_Routine=8 -Dance_Threepanel=3 -Pump_Single=5 -Pump_Double=10 -Pump_Halfdouble=6 -Pump_Couple=5 -Pump_Routine=10 -Kb7_Single=7 -Ez2_Single=ES -Ez2_Double=ED -Ez2_Real=ER -Para_Single=PS -Ds3ddx_Single=XS -Bm_Single5=5 -Bm_Double5=10 -Bm_Single7=7 -Bm_Double7=14 -Maniax_Single=MS -Maniax_Double=MD -Techno_Single4=4 -Techno_Single5=5 -Techno_Single8=8 -Techno_Double4=D4 -Techno_Double5=D5 -Pnm_Five=5 -Pnm_Nine=9 -Guitar_Five=5 -Karaoke=V -Lights_Cabinet=! - -[ScreenHowToInstallSongs] -BodyHeader=How to Obtain and Install Songs for sm-ssc -Finding Songs=Where to Find Songs -Installing Songs=How to Install Songs -Importing Songs=Importing from existing StepMania installs -Reload Songs=Reload Songs -Exit=Back to Title Menu - -Explanation-WhereToFind=Launches a web page with information on finding songs for use with sm-ssc. -Explanation-HowToInstall=Launches a web page with song installation instructions. -Explanation-AdditionalFolders=If you have other installs of StepMania, you can use the AdditionalFolders preferences to load it into sm-ssc. -Explanation-ReloadSongs=Reload the songs. This is required if you've added/changed/deleted songs while sm-ssc is running. -Explanation-Exit=Return to the title menu. - -[OptionNames] -Custom=Special - -[ScreenTestInput] +[Screen] +HelpText=&BACK; Exit &START; Select &SELECT; Options &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Move +[ScreenWithMenuElements] +HelpText=&BACK; Exit &START; Select &MENULEFT;&MENURIGHT; Move +[ScreenTitleMenu] +HelpText=&BACK; Exit &START; Select &MENUUP;&MENUDOWN; Move +Network OK=Network OK +Offline=Offline +Connected to %s=Connected to %s +CurrentGametype=Current Gametype: %s +LifeDifficulty=Life Difficulty: %s +TimingDifficulty=Timing Difficulty: %s +[ScreenTitleJoin] +HelpText=Press &START; to Play +HelpTextJoin=Press &START; to Play +HelpTextWait=Insert Credits... +EventMode=Event Mode +JointPremiumMain=Joint Premium +JointPremiumSecondary=Two players can play with one credit! +DoublesPremiumMain=Doubles Premium +DoublesPremiumSecondary=Play doubles for one credit! +[ScreenDemonstration] +Demonstration=Demonstration +[ScreenQuickSetupOverview] +Explanation=Quick Setup provides a easy way to set commonly-changed and useful preferences. +[ScreenProfileLoad] +HelpText=... Loading profiles, please wait ... +[ScreenSelectProfile] +HelpText=&MENUUP;&MENUDOWN; Switch Profile &START; Choose/Join &BACK; Unselect +[ScreenSelectMaster] +HelpText=&BACK; Exit &START; Select / Join &MENULEFT;&MENURIGHT; Move +[ScreenSelectPlayMode] +HelpText=&BACK; Exit &START; Select / Join &MENULEFT;&MENURIGHT; Move +EasyExplanation=A mode for beginners. +HardExplanation=For experts. +OldNormalExplanation=Not too easy, not too hard. +NormalExplanation=Play all your favorite songs! +RaveExplanation=Battle against friend or foe. +ExtendedExplanation=Several Songs in a row +OniExplanation=A true test of skill. +EndlessExplanation=It don't stop, it keep rollin'. +[ScreenSelectPlayStyle] +HelpText=&BACK; Exit &START; Select &MENULEFT;&MENURIGHT; Move +[ScreenGameInformation] +HelpText=&BACK; Exit &START; Skip +[ScreenSelectMusic] +HelpText=&BACK; Exit &START; Select / Join &SELECT; Magic Codes &MENULEFT;&MENURIGHT; Move::&AUXWHITE;+[KEY] Sort To [KEY] +AlternateHelpText=&SELECT;+&MENULEFT;&MENURIGHT; Change Difficulties &SELECT;+&START; Quick Sort +[ScreenSelectCourse] +HelpText=&BACK; Exit &START; Select / Join &SELECT; Magic Codes &MENULEFT;&MENURIGHT; Move::&UP;&DOWN;&UP;&DOWN; for other course types +[ScreenOptions] +HelpText=&BACK; Exit &START; Choose &SELECT; Go Up &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Move +[ScreenStageInformation] +HelpText= +[ScreenGameplay] +HelpText= +[ScreenEvaluation] +HelpText=&BACK; Exit &START; Move On &MENULEFT;+&MENURIGHT; or &SELECT; Snapshot +LifeDifficulty=Life Difficulty: %s +TimingDifficulty=Timing Difficulty: %s +[OptionTitles] +GamePrefAutoSetStyle=Auto Set Style +UserPrefSpecialScoringMode=Special Scoring Mode +GamePrefNotePosition=Note Positions +GamePrefComboOnRolls=Rolls Increment Combo +GamePrefComboUnderField=Combo Under Field + +UserPrefGameplayShowScore=Show Score +UserPrefGameplayShowStepsDisplay=Show Steps +UserPrefShowLotsaOptions=Options Density +UserPrefLongFail=Fail Length +UserPrefFlashyCombo=Flashy Combo +UserPrefGameplayFooter=Gameplay Footer +[OptionExplanations] +GamePrefAutoSetStyle=Allow the game to list all one player and two player modes at once instead of one style only. This might require a restart of StepMania\n( or alternatively hit F2! ) +GamePrefNotePosition=Determines where the arrow receptors are placed in gameplay. +GamePrefComboOnRolls=Choose if rolls should increment the combo or not. +GamePrefComboUnderField=Determine if the combo should display under the notes or not. + +UserPrefGameplayShowScore=Show or Hide the score display in gameplay. +UserPrefSpecialScoringMode=Select the scoring mode to be used if the Special scoring type is selected. +UserPrefGameplayShowStepsDisplay=Show or Hide the step information display in gameplay. +UserPrefShowLotsaOptions=Choose how many lines/rows of options to choose from. &oq;Few&cq; keeps the list to a minimum. &oq;Many&cq; adds various show-off mods. +UserPrefLongFail=Choose between the original sm-ssc fail (Long) or the new sm-ssc fail (Short). +UserPrefFlashyCombo=Determine if combo flashes should be shown or not. +UserPrefGameplayFooter=If on, displays a footer that blocks visibility of incoming arrows for a certain region ( DDR's score frame ). + +ScoringType=Defines which scoring method to use. If Special is selected, you can select a Special Scoring Mode in Theme Options. + +Speed=Adjust the speed at which arrows travel toward the targets. +Accel=Change the way arrows approach the targets. +Effect=Change the size or movement of the arrows and/or targets. +Appearance=Control the visibilty of the arrows. +Turn=Change the step choreography by adjusting the position of arrows. +Insert=Add tap notes to the step choreography. +Holds=Turn some tap notes into hold notes. +Mines=Add or remove mine notes. +PlayerAutoPlay=Have the notefield play by itself. +ScoreDisplay=Change the way your score is shown. +ProTiming=Change the way your judgments are shown. +Scroll=Adjust the direction arrows flow to meet the targets. +NoteSkins=Choose a different appearance for the arrows. +Handicap=Removes notes. Using these will invalidate a high score. +Hide=Adjust the visibility of the targets. +Persp=Change the viewing angle of the arrow stream. +Steps=Adjust the difficulty of the steps. +Characters=Dancing buddies. +SaveToProfileHelp=Requires profile or memory card. +MusicRateHelp=Play the music at a faster rate. +[StepsListDisplayRow StepsType] +Dance_Single=4 +Dance_Double=8 +Dance_Couple=8 +Dance_Solo=6 +Dance_Routine=8 +Dance_Threepanel=3 +Pump_Single=5 +Pump_Double=10 +Pump_Halfdouble=6 +Pump_Couple=5 +Pump_Routine=10 +Kb7_Single=7 +Ez2_Single=ES +Ez2_Double=ED +Ez2_Real=ER +Para_Single=PS +Ds3ddx_Single=XS +Bm_Single5=5 +Bm_Double5=10 +Bm_Single7=7 +Bm_Double7=14 +Maniax_Single=MS +Maniax_Double=MD +Techno_Single4=4 +Techno_Single5=5 +Techno_Single8=8 +Techno_Double4=D4 +Techno_Double5=D5 +Pnm_Five=5 +Pnm_Nine=9 +Guitar_Five=5 +Karaoke=V +Lights_Cabinet=! + +[ScreenHowToInstallSongs] +BodyHeader=How to Obtain and Install Songs for sm-ssc +Finding Songs=Where to Find Songs +Installing Songs=How to Install Songs +Importing Songs=Importing from existing StepMania installs +Reload Songs=Reload Songs +Exit=Back to Title Menu + +Explanation-WhereToFind=Launches a web page with information on finding songs for use with sm-ssc. +Explanation-HowToInstall=Launches a web page with song installation instructions. +Explanation-AdditionalFolders=If you have other installs of StepMania, you can use the AdditionalFolders preferences to load it into sm-ssc. +Explanation-ReloadSongs=Reload the songs. This is required if you've added/changed/deleted songs while sm-ssc is running. +Explanation-Exit=Return to the title menu. + +[OptionNames] +Custom=Special + +[ScreenTestInput] HelpText=Hold &BACK; or &START; to exit. \ No newline at end of file diff --git a/Themes/default/Other/Profile Catalog.xsl b/Themes/default/Other/Profile Catalog.xsl index 52aafed04f..8ba3b5d540 100644 --- a/Themes/default/Other/Profile Catalog.xsl +++ b/Themes/default/Other/Profile Catalog.xsl @@ -1,105 +1,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Totals - - - - - - - - -
- -
-
- -
- - - - - - - - - Steps - Trail - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
- - - - - - - -
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Totals + + + + + + + + +
+ +
+
+ +
+ + + + + + + + + Steps + Trail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + + + + + +
+ diff --git a/Themes/default/Other/Profile Common.xsl b/Themes/default/Other/Profile Common.xsl index 273753d6a0..e7be81657b 100644 --- a/Themes/default/Other/Profile Common.xsl +++ b/Themes/default/Other/Profile Common.xsl @@ -1,831 +1,831 @@ - - - - - - - - - - - - JavaScript: toggleLinkClicked(event); - JavaScript: return false; - JavaScript: toggleLinkOnMouseOver(event); - JavaScript: toggleLinkOnMouseOut(event); - cursor: hand; - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select="$Catalog/ProductTitle" /><xsl:text> </xsl:text><xsl:value-of select="$DocName" /> - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - -
- - - - - - - button - Internet Ranking - navButton - JavaScript: window.location = ''; - - - - - - button - Upload Stats - navButton - JavaScript: window.location = '&stats_xml=' + window.location; - - - - - Machine: - - - Name: - -
- Last Played: -
- -
- -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - : - - - - - - - - - - - - true - - - false - - - - - - - - Guid= - - - _new - - - - - - - - - - - - - - - - - - - - valuename - - nowrap - - - -   - - dyndata - - nowrap - - - -     - - - - - - - - - - -
-
- - - - - - - - - - valuename - - - - - dyndata - - - -
  
- -
- - - - - - - -
- - -
-
-
- - - - - - - - - valuename - - -    - - - valuename - - - -    - - dyndata - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - -
- -
-
-
-
- - - - - - - - - main - - - - - - - -
- -
-
- - - - - - - - main - - - - - - -
- -
-
- - - - - - - - main - - - - - - - -
- -
-
- - - - - - - - - - - - - -
- + + + + + + + + + + + + JavaScript: toggleLinkClicked(event); + JavaScript: return false; + JavaScript: toggleLinkOnMouseOver(event); + JavaScript: toggleLinkOnMouseOut(event); + cursor: hand; + + + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="$Catalog/ProductTitle" /><xsl:text> </xsl:text><xsl:value-of select="$DocName" /> + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + +
+ + + + + + + button + Internet Ranking + navButton + JavaScript: window.location = ''; + + + + + + button + Upload Stats + navButton + JavaScript: window.location = '&stats_xml=' + window.location; + + + + + Machine: + + + Name: + +
+ Last Played: +
+ +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + : + + + + + + + + + + + + true + + + false + + + + + + + + Guid= + + + _new + + + + + + + + + + + + + + + + + + + + valuename + + nowrap + + + +   + + dyndata + + nowrap + + + +     + + + + + + + + + + +
+
+ + + + + + + + + + valuename + + + + + dyndata + + + +
  
+ +
+ + + + + + + +
+ + +
+
+
+ + + + + + + + + valuename + + +    + + + valuename + + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + + + + + + + main + + + + + + + +
+ +
+
+ + + + + + + + main + + + + + + +
+ +
+
+ + + + + + + + main + + + + + + + +
+ +
+
+ + + + + + + + + + + + + +
+ diff --git a/Themes/default/Other/Profile Stats.xsl b/Themes/default/Other/Profile Stats.xsl index b6caa6aec1..da5f22a745 100644 --- a/Themes/default/Other/Profile Stats.xsl +++ b/Themes/default/Other/Profile Stats.xsl @@ -1,1421 +1,1421 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Instructions - - - -

Overview

- - - - -
- This section explains all the files saved to your memory card. Please read the instructions below before modifying any files on your memory card. Modifying files may result in irreversible loss of your data. -
- -
- -

Description of Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Edits/ - This directory contains edit step files that you've created yourself or downloaded from the internet. - - More Info - - You can place up to 200 .edit files in this directory. The edit file format is similar to an .sm file, except that it has only two tags: -
- #SONG:<SongDirectory>; -
- #NOTES:<StepsType>:<Description>:<Difficulty>:<Meter>:<RadarValues>:<NoteData>; -
-
-
LastGood/ - This directory contains a backup of your last Stats.xml and signatures that were successfully loaded. - - More Info - - The stats on your memory card may fail to load because: -
    -
  • The Stats.xml file or its digital signatures have become corrupt.
  • -
  • The Stats.xml file has been modified outside of the game. This will cause the digital signature check to fail.
  • -
- If your saved statistics fail to load, your can restore from from the "last good" data. Copy all 3 files in the files LastGood directory into the main profile directory (one level up from LastGood). -
-
-
Screenshots/ - All in-game screenshots that you take are saved in this directory. - - More Info - - This directory contains all screenshots that you've captured while playing the game. The Screenshots section of Stats.xml shows thumbnails score details for all screens you've captured. -
- The MD5 hash for a screenshot file can be used to verify that the screenshot has not been modified since it was first saved. -
- If your memory card is full, you can free space by deleting some of the screenshot .jpg files or moving them to another disk. -
-
-
Catalog.xmlContains game data used by Stats.xsl for displaying a report of your stats.
DontShare.sig - DontShare.sig is a digital signature that's required by the game when it loads your memory card data. This is a secret file that you shouldn't share with anyone else. - - More Info - - You can freely share Stats.xml and Stats.xml.sig with other players or submit these files for internet ranking. However, you should always keep DontShare.sig private. - Without the DontShare.sig, another player will not be able to load your saved data and pass it off as their own. - - -
Editable.ini - Holds preferences that you can edit using your home computer. You can open this file using any text editor program and save changes. -
Stats.xmlYou're looking at this file now. It contains all of your saved scores, statistics, and preferences. The game reads this data when you insert your memory card.
Stats.xml.sig - This is the digital signature for Stats.xml. - - More Info - - Digital signatures are used to verify that your data hasn't been modified outside of the game. This prevents cheaters from changing their score data and passing it off as real. -
- If any of Stats.xml, Stats.xml.sig, or DontShare.sig have been modified outside of the game, your memory card data will be ignored and overridden after the next save. It's important that you don't modify any of these three files because doing so will render your data permanently unusable. -
-
-
- -
-
-
- - - - - - - - - - - General Data - - - - - - - - -
- -
- - - Song Count by PlayMode - - - - - - - - - - - - - - - - - - - - - - Song Count by Style - - - - - - - - - - - - - - - - - - - - - - Song Count by Difficulty - - - - - - - - - - - - - - - - - - - - - - Song Count by Meter - - - - - - - - - - - - - - - - - - - - - - Stages Passed by Grade - - - - - - - - - - - - - - - - - - - - - - Stages Passed by PlayMode - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - - - - - - - - - Songs - Courses - - - Steps - Trail - - - - - - Popularity - - - - - Ranking - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Unplayed - - - - - - - - - - - - - - - - - - - - - - - Ranking - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
-
-
- -
- -
-
- -
-
-
- - - - - - - - - - Steps - Trail - - - - Top Scores - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - -
-
-
-
- - - - - - - - - - - Songs - Courses - - - Steps - Trail - - - Difficulty - CourseDifficulty - - - - Completeness - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Actual - - - - - -
Possible - - - - - -
Percentage - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- -
-
-
-
-
-
- - - - - - - - - - - - Recent Scores - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Screenshots - - - - - - - - - - - - - - - - -
- - - _new - - - 160 - 120 - border-width: 0 - - - - - - - - -
- -
-
- - - - - - - - - - Coin Counts - - - - - - - - - - - - - - - - - -
- -
-
- -
- -
-
-
- - - - - - - - - - - Calories - - - - - WARNING: Weight is not set. Calorie counts may be inaccurate. -
-
- - - - - - - - - All time - - - - - - - - Per Song - - - 0 - - - - - - - - - - Per Minute of Gameplay - - - 0 - - - - - - - - - - - -
- -

By Week

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SunMonTueWedThuFriSat
- -
-
-
- - - - - - - - - Week of - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - error: - - - - - - - - - - - Sun - Mon - Tue - Wed - Thu - Fri - Sat - error: - - - - - - - - - - - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - error: - - - - - - - - - - - January - February - March - April - May - June - July - August - September - October - November - December - error: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [not implemented] - - - - - 0 - - - - - - 0 - - - - - - - 12 - 0 - - 0 - - - - - - - [not implemented] - - - - - 0 - - - - - - 0 - - - - - - - AM - PM - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [not implemented] - - - - - [not implemented] - - - - - [not implemented] - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Instructions + + + +

Overview

+ + + + +
+ This section explains all the files saved to your memory card. Please read the instructions below before modifying any files on your memory card. Modifying files may result in irreversible loss of your data. +
+ +
+ +

Description of Files

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Edits/ + This directory contains edit step files that you've created yourself or downloaded from the internet. + + More Info + + You can place up to 200 .edit files in this directory. The edit file format is similar to an .sm file, except that it has only two tags: +
+ #SONG:<SongDirectory>; +
+ #NOTES:<StepsType>:<Description>:<Difficulty>:<Meter>:<RadarValues>:<NoteData>; +
+
+
LastGood/ + This directory contains a backup of your last Stats.xml and signatures that were successfully loaded. + + More Info + + The stats on your memory card may fail to load because: +
    +
  • The Stats.xml file or its digital signatures have become corrupt.
  • +
  • The Stats.xml file has been modified outside of the game. This will cause the digital signature check to fail.
  • +
+ If your saved statistics fail to load, your can restore from from the "last good" data. Copy all 3 files in the files LastGood directory into the main profile directory (one level up from LastGood). +
+
+
Screenshots/ + All in-game screenshots that you take are saved in this directory. + + More Info + + This directory contains all screenshots that you've captured while playing the game. The Screenshots section of Stats.xml shows thumbnails score details for all screens you've captured. +
+ The MD5 hash for a screenshot file can be used to verify that the screenshot has not been modified since it was first saved. +
+ If your memory card is full, you can free space by deleting some of the screenshot .jpg files or moving them to another disk. +
+
+
Catalog.xmlContains game data used by Stats.xsl for displaying a report of your stats.
DontShare.sig + DontShare.sig is a digital signature that's required by the game when it loads your memory card data. This is a secret file that you shouldn't share with anyone else. + + More Info + + You can freely share Stats.xml and Stats.xml.sig with other players or submit these files for internet ranking. However, you should always keep DontShare.sig private. + Without the DontShare.sig, another player will not be able to load your saved data and pass it off as their own. + + +
Editable.ini + Holds preferences that you can edit using your home computer. You can open this file using any text editor program and save changes. +
Stats.xmlYou're looking at this file now. It contains all of your saved scores, statistics, and preferences. The game reads this data when you insert your memory card.
Stats.xml.sig + This is the digital signature for Stats.xml. + + More Info + + Digital signatures are used to verify that your data hasn't been modified outside of the game. This prevents cheaters from changing their score data and passing it off as real. +
+ If any of Stats.xml, Stats.xml.sig, or DontShare.sig have been modified outside of the game, your memory card data will be ignored and overridden after the next save. It's important that you don't modify any of these three files because doing so will render your data permanently unusable. +
+
+
+ +
+
+
+ + + + + + + + + + + General Data + + + + + + + + +
+ +
+ + + Song Count by PlayMode + + + + + + + + + + + + + + + + + + + + + + Song Count by Style + + + + + + + + + + + + + + + + + + + + + + Song Count by Difficulty + + + + + + + + + + + + + + + + + + + + + + Song Count by Meter + + + + + + + + + + + + + + + + + + + + + + Stages Passed by Grade + + + + + + + + + + + + + + + + + + + + + + Stages Passed by PlayMode + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + Songs + Courses + + + Steps + Trail + + + + + + Popularity + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unplayed + + + + + + + + + + + + + + + + + + + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+
+ +
+ +
+
+ +
+
+
+ + + + + + + + + + Steps + Trail + + + + Top Scores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + Songs + Courses + + + Steps + Trail + + + Difficulty + CourseDifficulty + + + + Completeness + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
Actual + + + + + +
Possible + + + + + +
Percentage + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+
+
+
+
+
+ + + + + + + + + + + + Recent Scores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Screenshots + + + + + + + + + + + + + + + + +
+ + + _new + + + 160 + 120 + border-width: 0 + + + + + + + + +
+ +
+
+ + + + + + + + + + Coin Counts + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+
+
+ + + + + + + + + + + Calories + + + + + WARNING: Weight is not set. Calorie counts may be inaccurate. +
+
+ + + + + + + + + All time + + + + + + + + Per Song + + + 0 + + + + + + + + + + Per Minute of Gameplay + + + 0 + + + + + + + + + + + +
+ +

By Week

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SunMonTueWedThuFriSat
+ +
+
+
+ + + + + + + + + Week of + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + error: + + + + + + + + + + + Sun + Mon + Tue + Wed + Thu + Fri + Sat + error: + + + + + + + + + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + error: + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + error: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + 12 + 0 + + 0 + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + AM + PM + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + [not implemented] + + + + + [not implemented] + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/Themes/default/Other/ScreenGameplaySyncMachine music.sm b/Themes/default/Other/ScreenGameplaySyncMachine music.sm index 6936cd36c1..f04a555f23 100644 --- a/Themes/default/Other/ScreenGameplaySyncMachine music.sm +++ b/Themes/default/Other/ScreenGameplaySyncMachine music.sm @@ -1,175 +1,175 @@ -#TITLE:Sync; -#SUBTITLE:; -#ARTIST:Unknown artist; -#TITLETRANSLIT:; -#SUBTITLETRANSLIT:; -#ARTISTTRANSLIT:; -#GENRE:; -#CREDIT:; -#BANNER:; -#BACKGROUND:; -#LYRICSPATH:; -#CDTITLE:; -#MUSIC:_gameplay sync music.ogg; -#OFFSET:-0.012; -#SAMPLESTART:0.000; -#SAMPLELENGTH:12.000; -#SELECTABLE:YES; -#BPMS:0.000=132.000; -#STOPS:; -#BGCHANGES:; -#KEYSOUNDS:; - -//---------------dance-single - blank---------------- -#NOTES: - dance-single: - blank: - Beginner: - 1: - 0.302,0.205,0.000,0.000,0.000: - // measure 1 -0000 -0000 -0000 -0000 -, // measure 2 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 3 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 4 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 5 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 6 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 7 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -, // measure 8 -1000 -0001 -1000 -0001 -1000 -0001 -1000 -0001 -; - -//---------------dance-single - blank---------------- -#NOTES: - pump-single: - blank: - Beginner: - 1: - 0.302,0.205,0.000,0.000,0.000: - // measure 1 -00000 -00000 -00000 -00000 -, // measure 2 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 3 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 4 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 5 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 6 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 7 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -, // measure 8 -10000 -00001 -10000 -00001 -10000 -00001 -10000 -00001 -; +#TITLE:Sync; +#SUBTITLE:; +#ARTIST:Unknown artist; +#TITLETRANSLIT:; +#SUBTITLETRANSLIT:; +#ARTISTTRANSLIT:; +#GENRE:; +#CREDIT:; +#BANNER:; +#BACKGROUND:; +#LYRICSPATH:; +#CDTITLE:; +#MUSIC:_gameplay sync music.ogg; +#OFFSET:-0.012; +#SAMPLESTART:0.000; +#SAMPLELENGTH:12.000; +#SELECTABLE:YES; +#BPMS:0.000=132.000; +#STOPS:; +#BGCHANGES:; +#KEYSOUNDS:; + +//---------------dance-single - blank---------------- +#NOTES: + dance-single: + blank: + Beginner: + 1: + 0.302,0.205,0.000,0.000,0.000: + // measure 1 +0000 +0000 +0000 +0000 +, // measure 2 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 3 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 4 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 5 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 6 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 7 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +, // measure 8 +1000 +0001 +1000 +0001 +1000 +0001 +1000 +0001 +; + +//---------------dance-single - blank---------------- +#NOTES: + pump-single: + blank: + Beginner: + 1: + 0.302,0.205,0.000,0.000,0.000: + // measure 1 +00000 +00000 +00000 +00000 +, // measure 2 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 3 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 4 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 5 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 6 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 7 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +, // measure 8 +10000 +00001 +10000 +00001 +10000 +00001 +10000 +00001 +; diff --git a/Themes/default/Other/ScreenHowToPlay steps.sm b/Themes/default/Other/ScreenHowToPlay steps.sm index 3758bfa8de..56f5d6c89c 100644 --- a/Themes/default/Other/ScreenHowToPlay steps.sm +++ b/Themes/default/Other/ScreenHowToPlay steps.sm @@ -1,170 +1,170 @@ -// these steps are only used by the How To Play screen. -// you can use any difficuly here, as long as there is -// only one set of steps in the file. the steps start -// as soon as the screen comes up. also, the music used -// is Sounds/ScreenHowToPlay Music, so no need to specify -// a song file here. -#TITLE:ScreenHowToPlay steps; -#ARTIST:foo; -#BPMS:0.000=100.000; -#STOPS:16=2,18=2,20=2,22=2; - -#NOTES: - dance-single: - BASIC: - easy: - 1: - 0,0,0,0,0: -0000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0100 -0000 -0010 -0000 -, -1000 -0000 -1001 -0000 -, -1000 -0100 -0001 -0100 -0010 -1000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -, -0000 -0000 -0000 -0000 -,; - -#NOTES: - pump-single: - NORMAL: - easy: - 1: - 0,0,0,0,0: -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 -, -01000 -00000 -00100 -00000 -, -10000 -00000 -10010 -00000 -, -10000 -01000 -00010 -01000 -00100 -10000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 -, -00000 -00000 -00000 -00000 -,; +// these steps are only used by the How To Play screen. +// you can use any difficuly here, as long as there is +// only one set of steps in the file. the steps start +// as soon as the screen comes up. also, the music used +// is Sounds/ScreenHowToPlay Music, so no need to specify +// a song file here. +#TITLE:ScreenHowToPlay steps; +#ARTIST:foo; +#BPMS:0.000=100.000; +#STOPS:16=2,18=2,20=2,22=2; + +#NOTES: + dance-single: + BASIC: + easy: + 1: + 0,0,0,0,0: +0000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0100 +0000 +0010 +0000 +, +1000 +0000 +1001 +0000 +, +1000 +0100 +0001 +0100 +0010 +1000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +, +0000 +0000 +0000 +0000 +,; + +#NOTES: + pump-single: + NORMAL: + easy: + 1: + 0,0,0,0,0: +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 +, +01000 +00000 +00100 +00000 +, +10000 +00000 +10010 +00000 +, +10000 +01000 +00010 +01000 +00100 +10000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 +, +00000 +00000 +00000 +00000 +,; diff --git a/Themes/default/Scripts/00 ThemeInfo.lua b/Themes/default/Scripts/00 ThemeInfo.lua index 3fb9b937fa..4e8f3990d8 100644 --- a/Themes/default/Scripts/00 ThemeInfo.lua +++ b/Themes/default/Scripts/00 ThemeInfo.lua @@ -1,9 +1,9 @@ --- theme identification: -themeInfo = { - ProductCode = "SSC-00X", - Name = "Move Me", - Version = 1.00, - Date = "20100906", - Internal = "rel 00000000-3500", - Revision = 3500, +-- theme identification: +themeInfo = { + ProductCode = "SSC-00X", + Name = "Move Me", + Version = 1.00, + Date = "20100906", + Internal = "rel 00000000-3500", + Revision = 3500, }; \ No newline at end of file diff --git a/Themes/default/Scripts/02 Colors.lua b/Themes/default/Scripts/02 Colors.lua index 99028c3cf8..af16034dbd 100644 --- a/Themes/default/Scripts/02 Colors.lua +++ b/Themes/default/Scripts/02 Colors.lua @@ -1,7 +1,7 @@ -ModeIconColors = { - Normal = color("#FFEE00"), -- yellow - Rave = color("#4400CC"), -- purple - Extended = color("#00CCFF"), -- cyan - Oni = color("#CC00FF"), -- redder purple - Endless = color("#444488"), -- steel +ModeIconColors = { + Normal = color("#FFEE00"), -- yellow + Rave = color("#4400CC"), -- purple + Extended = color("#00CCFF"), -- cyan + Oni = color("#CC00FF"), -- redder purple + Endless = color("#444488"), -- steel } \ No newline at end of file diff --git a/Themes/default/Scripts/02 Lyrics.lua b/Themes/default/Scripts/02 Lyrics.lua index 4f94aa1a77..39010b936d 100644 --- a/Themes/default/Scripts/02 Lyrics.lua +++ b/Themes/default/Scripts/02 Lyrics.lua @@ -1,68 +1,68 @@ -function Actor:LyricCommand(side) - self:settext( Var "LyricText" ); - - self:stoptweening(); - self:shadowlengthx(0); - self:shadowlengthy(0); - self:strokecolor(Color("Outline")); - - local Zoom = SCREEN_WIDTH/(self:GetZoomedWidth()+1); - if( Zoom > 1 ) then Zoom = 1 end - self:zoomx( Zoom ); - - local Color = Var "LyricColor"; - local Factor = 1 - if side == "Back" then - Factor = 0.5 - elseif side == "Front" then - Factor = 0.9 - end - self:diffuse( { - Color[1] * Factor, - Color[2] * Factor, - Color[3] * Factor, - Color[4] * Factor } ) - - if side == "Front" then - self:cropright(1); - else - self:cropleft(0); - end - - self:diffusealpha(0); - self:linear(0.2); - self:diffusealpha(0.75); - self:linear( Var "LyricDuration" * 0.75); - if side == "Front" then - self:cropright(0); - else - self:cropleft(1); - end - self:sleep( Var "LyricDuration" * 0.25 ); - self:linear(0.2); - self:diffusealpha(0); -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. - +function Actor:LyricCommand(side) + self:settext( Var "LyricText" ); + + self:stoptweening(); + self:shadowlengthx(0); + self:shadowlengthy(0); + self:strokecolor(Color("Outline")); + + local Zoom = SCREEN_WIDTH/(self:GetZoomedWidth()+1); + if( Zoom > 1 ) then Zoom = 1 end + self:zoomx( Zoom ); + + local Color = Var "LyricColor"; + local Factor = 1 + if side == "Back" then + Factor = 0.5 + elseif side == "Front" then + Factor = 0.9 + end + self:diffuse( { + Color[1] * Factor, + Color[2] * Factor, + Color[3] * Factor, + Color[4] * Factor } ) + + if side == "Front" then + self:cropright(1); + else + self:cropleft(0); + end + + self:diffusealpha(0); + self:linear(0.2); + self:diffusealpha(0.75); + self:linear( Var "LyricDuration" * 0.75); + if side == "Front" then + self:cropright(0); + else + self:cropleft(1); + end + self:sleep( Var "LyricDuration" * 0.25 ); + self:linear(0.2); + self:diffusealpha(0); +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + diff --git a/Themes/default/Scripts/02 TextBanner.lua b/Themes/default/Scripts/02 TextBanner.lua index 84dc6900f4..b70206dea8 100644 --- a/Themes/default/Scripts/02 TextBanner.lua +++ b/Themes/default/Scripts/02 TextBanner.lua @@ -1,19 +1,19 @@ -local mainMaxWidth = 228; -- zoom w/subtitle is 0.75 (multiply by 1.25) -local subMaxWidth = 420; -- zoom is 0.6 (multiply zoom,1 value by 1.4) -local artistMaxWidth = 300/0.8; - -function TextBannerAfterSet(self,param) - local Title=self:GetChild("Title"); - local Subtitle=self:GetChild("Subtitle"); - local Artist=self:GetChild("Artist"); - if Subtitle:GetText() == "" then - (cmd(maxwidth,mainMaxWidth;y,-8;zoom,1;))(Title); - (cmd(visible,false))(Subtitle); - (cmd(zoom,0.66;maxwidth,artistMaxWidth;y,8))(Artist); - else - -- subtitle below - (cmd(maxwidth,mainMaxWidth*1.25;y,-11;zoom,0.75;))(Title); - (cmd(visible,true;zoom,0.6;y,0;maxwidth,subMaxWidth))(Subtitle); - (cmd(zoom,0.6;maxwidth,artistMaxWidth;y,10))(Artist); - end +local mainMaxWidth = 228; -- zoom w/subtitle is 0.75 (multiply by 1.25) +local subMaxWidth = 420; -- zoom is 0.6 (multiply zoom,1 value by 1.4) +local artistMaxWidth = 300/0.8; + +function TextBannerAfterSet(self,param) + local Title=self:GetChild("Title"); + local Subtitle=self:GetChild("Subtitle"); + local Artist=self:GetChild("Artist"); + if Subtitle:GetText() == "" then + (cmd(maxwidth,mainMaxWidth;y,-8;zoom,1;))(Title); + (cmd(visible,false))(Subtitle); + (cmd(zoom,0.66;maxwidth,artistMaxWidth;y,8))(Artist); + else + -- subtitle below + (cmd(maxwidth,mainMaxWidth*1.25;y,-11;zoom,0.75;))(Title); + (cmd(visible,true;zoom,0.6;y,0;maxwidth,subMaxWidth))(Subtitle); + (cmd(zoom,0.6;maxwidth,artistMaxWidth;y,10))(Artist); + end end \ No newline at end of file diff --git a/Themes/default/Scripts/03 ThemePrefs.lua b/Themes/default/Scripts/03 ThemePrefs.lua index 8d414c3ae2..86da78bb68 100644 --- a/Themes/default/Scripts/03 ThemePrefs.lua +++ b/Themes/default/Scripts/03 ThemePrefs.lua @@ -1,500 +1,500 @@ --- sm-ssc Default Theme Preferences Handler - --- Example usage of new system (not really implemented yet) - -local Prefs = -{ - AutoSetStyle = - { - Default = false, - Choices = { "ON", "OFF" }, - Values = { true, false } - }, -}; - -ThemePrefs.InitAll( Prefs ) - -function InitUserPrefs() - if GetUserPref("UserPrefGameplayShowStepsDisplay") == nil then - SetUserPref("UserPrefGameplayShowStepsDisplay", true); - end; - if GetUserPref("UserPrefGameplayShowScore") == nil then - SetUserPref("UserPrefGameplayShowScore", false); - end; - if GetUserPref("UserPrefSpecialScoringMode") == nil then - SetUserPref("UserPrefSpecialScoringMode", 'DDR 1st Mix'); - end; - if GetUserPrefB("UserPrefShowLotsaOptions") == nil then - SetUserPref("UserPrefShowLotsaOptions", true); - end; - if GetUserPrefB("UserPrefAutoSetStyle") == nil then - SetUserPref("UserPrefAutoSetStyle", false); - end; - if GetUserPrefB("UserPrefLongFail") == nil then - SetUserPref("UserPrefLongFail", false); - end; - if GetUserPrefB("UserPrefNotePosition") == nil then - SetUserPref("UserPrefNotePosition", true); - end; - if GetUserPrefB("UserPrefComboOnRolls") == nil then - SetUserPref("UserPrefComboOnRolls", false); - end; - if GetUserPrefB("UserPrefProtimingP1") == nil then - SetUserPref("UserPrefProtimingP1", false); - end; - if GetUserPrefB("UserPrefProtimingP2") == nil then - SetUserPref("UserPrefProtimingP2", false); - end; - if GetUserPrefB("FlashyCombos") == nil then - SetUserPref("FlashyCombos", false); - end; - if GetUserPrefB("UserPrefComboUnderField") == nil then - SetUserPref("UserPrefComboUnderField", true); - end; ---[[ if GetUserPref("ProTimingP1") == nil then - SetUserPref("ProTimingP1", false); - end; - if GetUserPref("ProTimingP2") == nil then - SetUserPref("ProTimingP2", false); - end; --]] -end; - -function GetProTiming(pn) - local pname = ToEnumShortString(pn); - if GetUserPref("ProTiming"..pname) then - return GetUserPrefB("ProTiming"..pname); - else - SetUserPref("ProTiming"..pname,false); - return false; - end; -end; - ---[[ option rows ]] - --- screen cover -function OptionRowProTiming() - local t = { - Name = "ProTiming"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = false; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - local bShow; - if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then - bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ); - if bShow then - list[2] = true; - else - list[1] = true; - end - else - list[1] = true; - end; ---[[ local pname = ToEnumShortString(pn); - - if getenv("ProTiming"..pname) == true then - list[2] = true; - else - list[1] = true; - end; --]] - end; - SaveSelections = function(self, list, pn) - local bSave; - if list[2] then - bSave = true; - else - bSave = false; - end; - SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave); ---[[ local val; - if list[2] then - val = true; - else - val = false; - end; - local pname = ToEnumShortString(pn); - setenv("ProTiming"..pname, val); --]] - end; - }; - setmetatable( t, t ); - return t; -end; - -function UserPrefGameplayShowScore() - local t = { - Name = "UserPrefGameplayShowScore"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then - if GetUserPrefB("UserPrefGameplayShowScore") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefGameplayShowScore",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefGameplayShowScore",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefGameplayShowStepsDisplay() - local t = { - Name = "UserPrefGameplayShowStepsDisplay"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then - if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefGameplayShowStepsDisplay",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefGameplayShowStepsDisplay",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefShowLotsaOptions() - local t = { - Name = "UserPrefShowLotsaOptions"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Many','Few' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then - if GetUserPrefB("UserPrefShowLotsaOptions") then - list[1] = true; - else - list[2] = true; - end; - else - WritePrefToFile("UserPrefShowLotsaOptions",false); - list[2] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[1] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefShowLotsaOptions",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefSpecialScoringMode() - local baseChoices = { 'DDR 1stMIX', 'DDR 4thMIX', 'DDR SuperNOVA', 'DDR SuperNOVA 2', 'MIGS' }; --'[SSC] Radar Master' - local t = { - Name = "UserPrefSpecialScoringMode"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = baseChoices; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefSpecialScoringMode") ~= nil then - local theValue = ReadPrefFromFile("UserPrefSpecialScoringMode"); - local success = false; - for k,v in ipairs(baseChoices) do if v == theValue then list[k] = true success = true break end end; - if success == false then list[1] = true end; - else - WritePrefToFile("UserPrefSpecialScoringMode", 'DDR 1stMIX'); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - for k,v in ipairs(list) do if v then WritePrefToFile("UserPrefSpecialScoringMode", baseChoices[k]) break end end; - end; - }; - setmetatable( t, t ); - return t; -end - -function GetDefaultOptionLines() - local LineSets = { - "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All - "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx ) - }; - local function IsExtra() - if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then - return true - else - return false - end - end - if not IsExtra() then - if GetUserPrefB("UserPrefShowLotsaOptions") then - return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2]; - else - return LineSets[2]; -- Just make sure! - end - else - return "1,8,14,2,7,13,16,17,18" -- "failsafe" list - end -end; - -function UserPrefAutoSetStyle() - local t = { - Name = "UserPrefAutoSetStyle"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefAutoSetStyle") ~= nil then - if GetUserPrefB("UserPrefAutoSetStyle") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefAutoSetStyle",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefAutoSetStyle",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - - -function UserPrefNotePosition() - local t = { - Name = "UserPrefNotePosition"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Normal','Lower' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefNotePosition") ~= nil then - if GetUserPrefB("UserPrefNotePosition") then - list[1] = true; - else - list[2] = true; - end; - else - WritePrefToFile("UserPrefNotePosition",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[1] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefNotePosition",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefLongFail() - local t = { - Name = "UserPrefLongFail"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Short','Long' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefLongFail") ~= nil then - if GetUserPrefB("UserPrefLongFail") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefLongFail",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefLongFail",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefComboOnRolls() - local t = { - Name = "UserPrefComboOnRolls"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefComboOnRolls") ~= nil then - if GetUserPrefB("UserPrefComboOnRolls") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefComboOnRolls",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefComboOnRolls",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefFlashyCombo() - local t = { - Name = "UserPrefFlashyCombo"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then - if GetUserPrefB("UserPrefFlashyCombo") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefFlashyCombo",false); - list[1] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefFlashyCombo",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end - -function UserPrefComboUnderField() - local t = { - Name = "UserPrefComboUnderField"; - LayoutType = "ShowAllInRow"; - SelectType = "SelectOne"; - OneChoiceForAllPlayers = true; - ExportOnChange = false; - Choices = { 'Off','On' }; - LoadSelections = function(self, list, pn) - if ReadPrefFromFile("UserPrefComboUnderField") ~= nil then - if GetUserPrefB("UserPrefComboUnderField") then - list[2] = true; - else - list[1] = true; - end; - else - WritePrefToFile("UserPrefComboUnderField",true); - list[2] = true; - end; - end; - SaveSelections = function(self, list, pn) - local val; - if list[2] then - val = true; - else - val = false; - end; - WritePrefToFile("UserPrefComboUnderField",val); - MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); - THEME:ReloadMetrics(); - end; - }; - setmetatable( t, t ); - return t; -end ---[[ end option rows ]] +-- sm-ssc Default Theme Preferences Handler + +-- Example usage of new system (not really implemented yet) + +local Prefs = +{ + AutoSetStyle = + { + Default = false, + Choices = { "ON", "OFF" }, + Values = { true, false } + }, +}; + +ThemePrefs.InitAll( Prefs ) + +function InitUserPrefs() + if GetUserPref("UserPrefGameplayShowStepsDisplay") == nil then + SetUserPref("UserPrefGameplayShowStepsDisplay", true); + end; + if GetUserPref("UserPrefGameplayShowScore") == nil then + SetUserPref("UserPrefGameplayShowScore", false); + end; + if GetUserPref("UserPrefSpecialScoringMode") == nil then + SetUserPref("UserPrefSpecialScoringMode", 'DDR 1st Mix'); + end; + if GetUserPrefB("UserPrefShowLotsaOptions") == nil then + SetUserPref("UserPrefShowLotsaOptions", true); + end; + if GetUserPrefB("UserPrefAutoSetStyle") == nil then + SetUserPref("UserPrefAutoSetStyle", false); + end; + if GetUserPrefB("UserPrefLongFail") == nil then + SetUserPref("UserPrefLongFail", false); + end; + if GetUserPrefB("UserPrefNotePosition") == nil then + SetUserPref("UserPrefNotePosition", true); + end; + if GetUserPrefB("UserPrefComboOnRolls") == nil then + SetUserPref("UserPrefComboOnRolls", false); + end; + if GetUserPrefB("UserPrefProtimingP1") == nil then + SetUserPref("UserPrefProtimingP1", false); + end; + if GetUserPrefB("UserPrefProtimingP2") == nil then + SetUserPref("UserPrefProtimingP2", false); + end; + if GetUserPrefB("FlashyCombos") == nil then + SetUserPref("FlashyCombos", false); + end; + if GetUserPrefB("UserPrefComboUnderField") == nil then + SetUserPref("UserPrefComboUnderField", true); + end; +--[[ if GetUserPref("ProTimingP1") == nil then + SetUserPref("ProTimingP1", false); + end; + if GetUserPref("ProTimingP2") == nil then + SetUserPref("ProTimingP2", false); + end; --]] +end; + +function GetProTiming(pn) + local pname = ToEnumShortString(pn); + if GetUserPref("ProTiming"..pname) then + return GetUserPrefB("ProTiming"..pname); + else + SetUserPref("ProTiming"..pname,false); + return false; + end; +end; + +--[[ option rows ]] + +-- screen cover +function OptionRowProTiming() + local t = { + Name = "ProTiming"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = false; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + local bShow; + if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then + bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ); + if bShow then + list[2] = true; + else + list[1] = true; + end + else + list[1] = true; + end; +--[[ local pname = ToEnumShortString(pn); + + if getenv("ProTiming"..pname) == true then + list[2] = true; + else + list[1] = true; + end; --]] + end; + SaveSelections = function(self, list, pn) + local bSave; + if list[2] then + bSave = true; + else + bSave = false; + end; + SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave); +--[[ local val; + if list[2] then + val = true; + else + val = false; + end; + local pname = ToEnumShortString(pn); + setenv("ProTiming"..pname, val); --]] + end; + }; + setmetatable( t, t ); + return t; +end; + +function UserPrefGameplayShowScore() + local t = { + Name = "UserPrefGameplayShowScore"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then + if GetUserPrefB("UserPrefGameplayShowScore") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefGameplayShowScore",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefGameplayShowScore",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefGameplayShowStepsDisplay() + local t = { + Name = "UserPrefGameplayShowStepsDisplay"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then + if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefGameplayShowStepsDisplay",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefGameplayShowStepsDisplay",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefShowLotsaOptions() + local t = { + Name = "UserPrefShowLotsaOptions"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Many','Few' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then + if GetUserPrefB("UserPrefShowLotsaOptions") then + list[1] = true; + else + list[2] = true; + end; + else + WritePrefToFile("UserPrefShowLotsaOptions",false); + list[2] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[1] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefShowLotsaOptions",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefSpecialScoringMode() + local baseChoices = { 'DDR 1stMIX', 'DDR 4thMIX', 'DDR SuperNOVA', 'DDR SuperNOVA 2', 'MIGS' }; --'[SSC] Radar Master' + local t = { + Name = "UserPrefSpecialScoringMode"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = baseChoices; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefSpecialScoringMode") ~= nil then + local theValue = ReadPrefFromFile("UserPrefSpecialScoringMode"); + local success = false; + for k,v in ipairs(baseChoices) do if v == theValue then list[k] = true success = true break end end; + if success == false then list[1] = true end; + else + WritePrefToFile("UserPrefSpecialScoringMode", 'DDR 1stMIX'); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + for k,v in ipairs(list) do if v then WritePrefToFile("UserPrefSpecialScoringMode", baseChoices[k]) break end end; + end; + }; + setmetatable( t, t ); + return t; +end + +function GetDefaultOptionLines() + local LineSets = { + "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All + "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx ) + }; + local function IsExtra() + if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then + return true + else + return false + end + end + if not IsExtra() then + if GetUserPrefB("UserPrefShowLotsaOptions") then + return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2]; + else + return LineSets[2]; -- Just make sure! + end + else + return "1,8,14,2,7,13,16,17,18" -- "failsafe" list + end +end; + +function UserPrefAutoSetStyle() + local t = { + Name = "UserPrefAutoSetStyle"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefAutoSetStyle") ~= nil then + if GetUserPrefB("UserPrefAutoSetStyle") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefAutoSetStyle",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefAutoSetStyle",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + + +function UserPrefNotePosition() + local t = { + Name = "UserPrefNotePosition"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Normal','Lower' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefNotePosition") ~= nil then + if GetUserPrefB("UserPrefNotePosition") then + list[1] = true; + else + list[2] = true; + end; + else + WritePrefToFile("UserPrefNotePosition",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[1] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefNotePosition",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefLongFail() + local t = { + Name = "UserPrefLongFail"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Short','Long' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefLongFail") ~= nil then + if GetUserPrefB("UserPrefLongFail") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefLongFail",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefLongFail",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefComboOnRolls() + local t = { + Name = "UserPrefComboOnRolls"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefComboOnRolls") ~= nil then + if GetUserPrefB("UserPrefComboOnRolls") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefComboOnRolls",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefComboOnRolls",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefFlashyCombo() + local t = { + Name = "UserPrefFlashyCombo"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then + if GetUserPrefB("UserPrefFlashyCombo") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefFlashyCombo",false); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefFlashyCombo",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end + +function UserPrefComboUnderField() + local t = { + Name = "UserPrefComboUnderField"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { 'Off','On' }; + LoadSelections = function(self, list, pn) + if ReadPrefFromFile("UserPrefComboUnderField") ~= nil then + if GetUserPrefB("UserPrefComboUnderField") then + list[2] = true; + else + list[1] = true; + end; + else + WritePrefToFile("UserPrefComboUnderField",true); + list[2] = true; + end; + end; + SaveSelections = function(self, list, pn) + local val; + if list[2] then + val = true; + else + val = false; + end; + WritePrefToFile("UserPrefComboUnderField",val); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end +--[[ end option rows ]] diff --git a/Themes/default/Scripts/04 SpecialScoring.lua b/Themes/default/Scripts/04 SpecialScoring.lua index 80cf1d4656..2f24ebff05 100644 --- a/Themes/default/Scripts/04 SpecialScoring.lua +++ b/Themes/default/Scripts/04 SpecialScoring.lua @@ -1,157 +1,157 @@ ---Special Scoring types. -local r = {}; -local DisabledScoringModes = { 'DDR Extreme', '[SSC] Radar Master' }; ---the following metatable makes any missing value in a table 0 instead of nil. -local ZeroIfNotFound = { __index = function() return 0 end; }; - --- Retrieve the amount of taps/holds/rolls involved. Used for some formulas. -function GetTotalItems(radars) - return radars:GetValue('RadarCategory_TapsAndHolds') - + radars:GetValue('RadarCategory_Holds') - + radars:GetValue('RadarCategory_Rolls'); -end; - --- Determine whether marvelous timing is to be considered. -function IsW1Allowed(tapScore) - return tapScore == 'TapNoteScore_W2' - and (PREFSMAN:GetPreference("AllowW1") ~= 'AllowW1_Never' - or not (GAMESTATE:IsCourseMode() and - PREFSMAN:GetPreference("AllowW1") == 'AllowW1_CoursesOnly')); -end; - --- Get the radar values directly. The individual steps aren't used much. -function GetDirectRadar(player) - return GAMESTATE:GetCurrentSteps(player):GetRadarValues(player); -end; - ------------------------------------------------------------ ---DDR 1st Mix and 2nd Mix Scoring ------------------------------------------------------------ -r['DDR 1stMIX'] = function(params, pss) - local dCombo = math.floor((pss:GetCurrentCombo()+1)/4); - local bScore = (dCombo^2+1) * 100; - local multLookup = { ['TapNoteScore_W1']=3, ['TapNoteScore_W2']=3, ['TapNoteScore_W3']=1 }; - setmetatable(multLookup, ZeroIfNotFound); - --if score increases above the boundaries of a 32-bit signed - --(about 2.15 billion), it stops increasing. Conveniently, - --1st Mix clamped score as well. - pss:SetScore(clamp(pss:GetScore()+(bScore*multLookup[params.TapNoteScore]),0,999999999)); -end; ------------------------------------------------------------ ---DDR 4th Mix/Extra Mix/Konamix/GB3/DDRPC Scoring ------------------------------------------------------------ -r['DDR 4thMIX'] = function(params, pss) - local scoreLookupTable = { ['TapNoteScore_W1']=777, ['TapNoteScore_W2']=777, ['TapNoteScore_W3']=555 }; - setmetatable(scoreLookupTable, ZeroIfNotFound); - local comboBonusForThisStep = (pss:GetCurrentCombo()+1)*333; - pss:SetScore(clamp(pss:GetScore()+scoreLookupTable[params.TapNoteScore]+(scoreLookupTable[params.TapNoteScore] and comboBonusForThisStep or 0),0,999999999)); -end; ------------------------------------------------------------ ---DDR MAX2/Extreme Scoring ---This scoring system doesn't work and is locked out. ------------------------------------------------------------ -r['DDR Extreme'] = function(params, pss) - local judgmentBase = { - ['TapNoteScore_W1'] = 10, - ['TapNoteScore_W2'] = 9, - ['TapNoteScore_W3'] = 5 - }; - setmetatable(judgmentBase, ZeroIfNotFound); - local steps = GAMESTATE:GetCurrentSteps(params.Player); - local radarValues = steps:GetRadarValues(params.Player); - local baseScore = (steps:IsAnEdit() and - 5 or steps:GetMeter()) * 10000000; - local currentStep = 0; -- TODO: Get current step/hold. - local totalItems = GetTotalItems(radarValues); - local singleStep = (1 + totalItems) * totalItems / 2; - local stepLast = math.floor(baseScore / singleStep) * currentStep; - local judgeScore = 0; - if (params.HoldNoteScore == 'HoldNoteScore_Held') then - judgeScore = judgmentBase['TapNoteScore_W1']; - else - judgeScore = judgmentBase[params.TapNoteScore]; - if (IsW1Allowed(params.TapNoteScore)) then - judgeScore = judgmentBase['TapNoteScore_W1']; - end; - end; - local stepScore = judgeScore * stepLast; - - pss:SetScore(pss:GetScore() + stepScore); -end; ------------------------------------------------------------ ---DDR SuperNOVA(-esque) scoring ------------------------------------------------------------ -r['DDR SuperNOVA'] = function(params, pss) - local multLookup = { ['TapNoteScore_W1'] = 1, ['TapNoteScore_W2'] = 1, ['TapNoteScore_W3'] = 0.5 }; - setmetatable(multLookup, ZeroIfNotFound); - local radarValues = GetDirectRadar(params.Player); - local totalItems = GetTotalItems(radarValues); - local buildScore = (10000000 / totalItems * multLookup[params.TapNoteScore]) + (10000000 / totalItems * (params.HoldNoteScore == 'HoldNoteScore_Held' and 1 or 0)); - pss:SetScore(pss:GetScore() + math.round(buildScore)); -end; ------------------------------------------------------------ ---DDR SuperNOVA 2(-esque) scoring ------------------------------------------------------------ -r['DDR SuperNOVA 2'] = function(params, pss) - local multLookup = { ['TapNoteScore_W1'] = 1, ['TapNoteScore_W2'] = 1, ['TapNoteScore_W3'] = 0.5 }; - setmetatable(multLookup, ZeroIfNotFound); - local radarValues = GetDirectRadar(params.Player); - local totalItems = GetTotalItems(radarValues); - local buildScore = (100000 / totalItems * multLookup[params.TapNoteScore] - (IsW1Allowed(params.TapNoteScore) and 10 or 0)) + (100000 / totalItems * (params.HoldNoteScore == 'HoldNoteScore_Held' and 1 or 0)); - pss:SetScore(pss:GetScore() + (math.round(buildScore) * 10)); -end; ------------------------------------------------------------ ---Radar Master (doesn't work in 1.2.1, disabled) ---don't try to "fix it up", either. you *cannot* make it work in 1.2.1. ------------------------------------------------------------ -r['[SSC] Radar Master'] = function(params, pss) - local masterTable = { - ['RadarCategory_Stream'] = 0, - ['RadarCategory_Voltage'] = 0, - ['RadarCategory_Air'] = 0, - ['RadarCategory_Freeze'] = 0, - ['RadarCategory_Chaos'] = 0 - }; - local totalRadar = 0; - local finalScore = 0; - for k,v in pairs(masterTable) do - local firstRadar = GetDirectRadar(params.Player):GetValue(k); - if firstRadar == 0 then - masterTable[k] = nil; - else - masterTable[k] = firstRadar; - totalRadar = totalRadar + firstRadar; - end; - end; - --two loops are needed because we need to calculate totalRadar - --to actually calculate any part of the score - for k,v in pairs(masterTable) do - local curPortion = pss:GetRadarActual():GetValue(k) / v; - finalScore = finalScore + curPortion*(500000000*(v/totalRadar)); - end; - pss:SetScore(finalScore); -end; ------------------------------------------------------------- ---Marvelous Incorporated Grading System (or MIGS for short) ---basically like DP scoring with locked DP values ------------------------------------------------------------- -r['MIGS'] = function(params,pss) - local curScore = 0; - local tapScoreTable = { ['TapNoteScore_W1'] = 3, ['TapNoteScore_W2'] = 2, ['TapNoteScore_W3'] = 1, ['TapNoteScore_W5'] = -4, ['TapNoteScore_Miss'] = -8 }; - for k,v in pairs(tapScoreTable) do - curScore = curScore + ( pss:GetTapNoteScores(k) * v ); - end; - curScore = curScore + ( pss:GetHoldNoteScores('HoldNoteScore_Held') * 6 ); - pss:SetScore(clamp(curScore,0,math.huge)); -end; -SpecialScoring = {}; -setmetatable(SpecialScoring, { - __metatable = { "Letting you change the metatable sort of defeats the purpose." }; - __index = function(tbl, key) - for v in ivalues(DisabledScoringModes) do - if key == v then return r['DDR 1stMIX']; end; - end; - return r[key]; - end; - } -); +--Special Scoring types. +local r = {}; +local DisabledScoringModes = { 'DDR Extreme', '[SSC] Radar Master' }; +--the following metatable makes any missing value in a table 0 instead of nil. +local ZeroIfNotFound = { __index = function() return 0 end; }; + +-- Retrieve the amount of taps/holds/rolls involved. Used for some formulas. +function GetTotalItems(radars) + return radars:GetValue('RadarCategory_TapsAndHolds') + + radars:GetValue('RadarCategory_Holds') + + radars:GetValue('RadarCategory_Rolls'); +end; + +-- Determine whether marvelous timing is to be considered. +function IsW1Allowed(tapScore) + return tapScore == 'TapNoteScore_W2' + and (PREFSMAN:GetPreference("AllowW1") ~= 'AllowW1_Never' + or not (GAMESTATE:IsCourseMode() and + PREFSMAN:GetPreference("AllowW1") == 'AllowW1_CoursesOnly')); +end; + +-- Get the radar values directly. The individual steps aren't used much. +function GetDirectRadar(player) + return GAMESTATE:GetCurrentSteps(player):GetRadarValues(player); +end; + +----------------------------------------------------------- +--DDR 1st Mix and 2nd Mix Scoring +----------------------------------------------------------- +r['DDR 1stMIX'] = function(params, pss) + local dCombo = math.floor((pss:GetCurrentCombo()+1)/4); + local bScore = (dCombo^2+1) * 100; + local multLookup = { ['TapNoteScore_W1']=3, ['TapNoteScore_W2']=3, ['TapNoteScore_W3']=1 }; + setmetatable(multLookup, ZeroIfNotFound); + --if score increases above the boundaries of a 32-bit signed + --(about 2.15 billion), it stops increasing. Conveniently, + --1st Mix clamped score as well. + pss:SetScore(clamp(pss:GetScore()+(bScore*multLookup[params.TapNoteScore]),0,999999999)); +end; +----------------------------------------------------------- +--DDR 4th Mix/Extra Mix/Konamix/GB3/DDRPC Scoring +----------------------------------------------------------- +r['DDR 4thMIX'] = function(params, pss) + local scoreLookupTable = { ['TapNoteScore_W1']=777, ['TapNoteScore_W2']=777, ['TapNoteScore_W3']=555 }; + setmetatable(scoreLookupTable, ZeroIfNotFound); + local comboBonusForThisStep = (pss:GetCurrentCombo()+1)*333; + pss:SetScore(clamp(pss:GetScore()+scoreLookupTable[params.TapNoteScore]+(scoreLookupTable[params.TapNoteScore] and comboBonusForThisStep or 0),0,999999999)); +end; +----------------------------------------------------------- +--DDR MAX2/Extreme Scoring +--This scoring system doesn't work and is locked out. +----------------------------------------------------------- +r['DDR Extreme'] = function(params, pss) + local judgmentBase = { + ['TapNoteScore_W1'] = 10, + ['TapNoteScore_W2'] = 9, + ['TapNoteScore_W3'] = 5 + }; + setmetatable(judgmentBase, ZeroIfNotFound); + local steps = GAMESTATE:GetCurrentSteps(params.Player); + local radarValues = steps:GetRadarValues(params.Player); + local baseScore = (steps:IsAnEdit() and + 5 or steps:GetMeter()) * 10000000; + local currentStep = 0; -- TODO: Get current step/hold. + local totalItems = GetTotalItems(radarValues); + local singleStep = (1 + totalItems) * totalItems / 2; + local stepLast = math.floor(baseScore / singleStep) * currentStep; + local judgeScore = 0; + if (params.HoldNoteScore == 'HoldNoteScore_Held') then + judgeScore = judgmentBase['TapNoteScore_W1']; + else + judgeScore = judgmentBase[params.TapNoteScore]; + if (IsW1Allowed(params.TapNoteScore)) then + judgeScore = judgmentBase['TapNoteScore_W1']; + end; + end; + local stepScore = judgeScore * stepLast; + + pss:SetScore(pss:GetScore() + stepScore); +end; +----------------------------------------------------------- +--DDR SuperNOVA(-esque) scoring +----------------------------------------------------------- +r['DDR SuperNOVA'] = function(params, pss) + local multLookup = { ['TapNoteScore_W1'] = 1, ['TapNoteScore_W2'] = 1, ['TapNoteScore_W3'] = 0.5 }; + setmetatable(multLookup, ZeroIfNotFound); + local radarValues = GetDirectRadar(params.Player); + local totalItems = GetTotalItems(radarValues); + local buildScore = (10000000 / totalItems * multLookup[params.TapNoteScore]) + (10000000 / totalItems * (params.HoldNoteScore == 'HoldNoteScore_Held' and 1 or 0)); + pss:SetScore(pss:GetScore() + math.round(buildScore)); +end; +----------------------------------------------------------- +--DDR SuperNOVA 2(-esque) scoring +----------------------------------------------------------- +r['DDR SuperNOVA 2'] = function(params, pss) + local multLookup = { ['TapNoteScore_W1'] = 1, ['TapNoteScore_W2'] = 1, ['TapNoteScore_W3'] = 0.5 }; + setmetatable(multLookup, ZeroIfNotFound); + local radarValues = GetDirectRadar(params.Player); + local totalItems = GetTotalItems(radarValues); + local buildScore = (100000 / totalItems * multLookup[params.TapNoteScore] - (IsW1Allowed(params.TapNoteScore) and 10 or 0)) + (100000 / totalItems * (params.HoldNoteScore == 'HoldNoteScore_Held' and 1 or 0)); + pss:SetScore(pss:GetScore() + (math.round(buildScore) * 10)); +end; +----------------------------------------------------------- +--Radar Master (doesn't work in 1.2.1, disabled) +--don't try to "fix it up", either. you *cannot* make it work in 1.2.1. +----------------------------------------------------------- +r['[SSC] Radar Master'] = function(params, pss) + local masterTable = { + ['RadarCategory_Stream'] = 0, + ['RadarCategory_Voltage'] = 0, + ['RadarCategory_Air'] = 0, + ['RadarCategory_Freeze'] = 0, + ['RadarCategory_Chaos'] = 0 + }; + local totalRadar = 0; + local finalScore = 0; + for k,v in pairs(masterTable) do + local firstRadar = GetDirectRadar(params.Player):GetValue(k); + if firstRadar == 0 then + masterTable[k] = nil; + else + masterTable[k] = firstRadar; + totalRadar = totalRadar + firstRadar; + end; + end; + --two loops are needed because we need to calculate totalRadar + --to actually calculate any part of the score + for k,v in pairs(masterTable) do + local curPortion = pss:GetRadarActual():GetValue(k) / v; + finalScore = finalScore + curPortion*(500000000*(v/totalRadar)); + end; + pss:SetScore(finalScore); +end; +------------------------------------------------------------ +--Marvelous Incorporated Grading System (or MIGS for short) +--basically like DP scoring with locked DP values +------------------------------------------------------------ +r['MIGS'] = function(params,pss) + local curScore = 0; + local tapScoreTable = { ['TapNoteScore_W1'] = 3, ['TapNoteScore_W2'] = 2, ['TapNoteScore_W3'] = 1, ['TapNoteScore_W5'] = -4, ['TapNoteScore_Miss'] = -8 }; + for k,v in pairs(tapScoreTable) do + curScore = curScore + ( pss:GetTapNoteScores(k) * v ); + end; + curScore = curScore + ( pss:GetHoldNoteScores('HoldNoteScore_Held') * 6 ); + pss:SetScore(clamp(curScore,0,math.huge)); +end; +SpecialScoring = {}; +setmetatable(SpecialScoring, { + __metatable = { "Letting you change the metatable sort of defeats the purpose." }; + __index = function(tbl, key) + for v in ivalues(DisabledScoringModes) do + if key == v then return r['DDR 1stMIX']; end; + end; + return r[key]; + end; + } +); diff --git a/Themes/default/ThemeInfo.ini b/Themes/default/ThemeInfo.ini index 989ac4f3f7..213c5d2525 100644 --- a/Themes/default/ThemeInfo.ini +++ b/Themes/default/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=Default +[ThemeInfo] +DisplayName=Default Author=Midiman \ No newline at end of file diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 9f57baa9f3..fe7af31f60 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -1,2089 +1,2089 @@ -[Global] -FallbackTheme=_fallback - -[Common] -FirstAttractScreen="" -InitialScreen="ScreenInit" - -# AutoSetStyle=GetUserPrefB("UserPrefAutoSetStyle") -[BitmapText] -NumRainbowColors=1 -RainbowColor1=Color("Black"); - -[BPMDisplay] -SetNoBpmCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875); -SetNormalCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875); -SetChangeCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5); -SetRandomCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Blue");diffusetopedge,BoostColor(Color("Blue"),1.5); -SetExtraCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.5); -Cycle=true -NoBpmText="000" -RandomCycleSpeed=0.2 -- smaller numbers mean the bpm cycles faster -Separator="-" -ShowQMarksInRandomCycle=true - -[CombinedLifeMeterTug] -# We dont use it. -MeterWidth=512-8 -MeterHeight=40 - -[CodeDetector] -# For Future Reference: -# @ = Holding -# - = In Conjuction With / Then -# ~ = Released -# + = At The Same Time -[DifficultyList] -CapitalizeDifficultyNames=false -NumShownItems=8 -ItemsSpacingY=24 -[HelpDisplay] -TipShowTime=7 -[Combo] -ShowComboAt=2 - -NumberMinZoom=0.8 -NumberMaxZoom=1 -NumberMaxZoomAt=100 -LabelMinZoom=0.75*0.75 -LabelMaxZoom=0.75*1 - -PulseCommand=%function(self,param) self:finishtweening(); self:diffusealpha(1); self:zoom(1.125*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); self:sleep(2); self:linear(0.5); self:diffusealpha(0); end; -PulseLabelCommand=%function(self,param) self:finishtweening(); self:diffusealpha(1); self:zoom(1.075*param.LabelZoom); self:linear(0.05); self:zoom(param.LabelZoom); self:sleep(2); self:linear(0.5); self:diffusealpha(0); end; -NumberOnCommand=y,240-216-1.5;shadowlength,1;horizalign,right;vertalign,bottom;skewx,-0.125; -LabelOnCommand=x,6;y,22.5;shadowlength,1;zoom,0.75;diffusebottomedge,color("0.75,0.75,0.75,1");horizalign,left;vertalign,bottom - -[FadingBanner] -BannerOnCommand= -BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;accelerate,0.05;glow,Colors.Alpha( Color("White"), 0.45 );decelerate,0.175;diffusealpha,0;glow,Color("Invisible"); -BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 -BannerResetFadeCommand=diffusealpha,1 - -[HoldJudgment] -# !!! # -# HoldJudgmentLetGoCommand=HoldJudgmentLetGo() -# HoldJudgmentHeldCommand=HoldJudgmentHeld() -HoldJudgmentLetGoCommand=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 -HoldJudgmentHeldCommand=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 -# HoldJudgmentLetGoCommand=GAMESTATE:GetCurrentGame():GetName() == "pump" and "visible,false" or "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"; -# HoldJudgmentHeldCommand=GAMESTATE:GetCurrentGame():GetName() == "pump" and "visible,false" or "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"; -# HoldJudgmentLetGoCommand=function(self) \ - # if GAMESTATE:GetCurrentGame():GetName() == "pump" then \ - # return (cmd(visible,false))(self); \ - # 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))(self); \ - # end; \ -# end; -# HoldJudgmentHeldCommand=function(self) \ - # if GAMESTATE:GetCurrentGame():GetName() == "pump" then \ - # return (cmd(visible,false)); \ - # 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))(self); \ - # end; \ -# end; - -[Judgment] -# New # -JudgmentOnCommand= -# !!! # -JudgmentW1Command=finishtweening;shadowlength,0;y,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,1,1,1,0;effectcolor2,1,1,1,0.8 -JudgmentW2Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentW3Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW4Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; -JudgmentW5Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,1,2,2;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -JudgmentMissCommand=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 -# Late/Early -OffsetOnCommand= -OffsetLateCommand= -OffsetEarlyCommand= -[LifeMeterBar] -OverOnCommand=diffuse,Color("Orange");diffuserightedge,BoostColor(Color("Orange"),1.5) - -[LifeMeterBattery] -BatteryBlinkTime=0.5 -# -BatteryP1X=0 -BatteryP1Y=0 -BatteryP2X=0 -BatteryP2Y=0 -# -NumLivesP1X=-92 -NumLivesP1Y=0 -NumLivesP2X=92 -NumLivesP2Y=0 -NumLivesP2OnCommand=zoomx,-1 - -[LifeMeterBattery Percent] -# still asking for this even though it's in fallback... -aj -Format= -# -DancePointsP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -DancePointsP2OffCommand= -# -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) -PercentP2OffCommand= - -[NoteField] -ShowBoard=GAMESTATE:GetCurrentGame():GetName() == "kb7" - -[MenuTimer] -Text1OnCommand=stopeffect;stoptweening;shadowlength,0;strokecolor,Color("Outline") -Text1FormatFunction=function(fSeconds) \ - return string.format("%0.1f", fSeconds); \ -end -FrameOnCommand= -Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); -#~ Warning10Command=%function(self) \ - #~ MESSAGEMAN:Broadcast("TimerWarning"); \ - #~ cmd(diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"))(self); \ -#~ end; - -[MusicWheel] -FadeSeconds=1 -SwitchSeconds=0.08 -RandomPicksLockedSongs=true -RouletteSwitchSeconds=0.05 -RouletteSlowDownSwitches=5 -LockedInitialVelocity=7 -ScrollBarHeight=300 -ScrollBarOnCommand=visible,false -; linear wheel example: -; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ -; self:y(offsetFromCenter*38); \ -; end; -; 3D wheel example: -; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ -; local curve = math.pi; \ -; local WHEEL_3D_RADIUS = 245; \ -; local rotationx_radians = scale(offsetFromCenter,-numItems/2,numItems/2,-curve/2,curve/2); \ -; self:x( 0 - math.cos(offsetFromCenter/math.pi) ); \ -; self:y( WHEEL_3D_RADIUS * math.sin(rotationx_radians) ); \ -; self:z( -100 + WHEEL_3D_RADIUS * math.cos(rotationx_radians) ); \ -; self:rotationx( rotationx_radians * 180/math.pi ); --[[ to degrees end]] \ -; end; -ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*46 ); end -NumWheelItems=11 -MusicWheelSortOnCommand=fov,90; -MusicWheelSortOffCommand=fov,90; -MusicWheelItemSortOnCommand=zoomy,0;bounceend,0.15;zoomy,1 -MusicWheelItemSortOffCommand=linear,0.175;zoomy,0 -HighlightOnCommand=diffuseshift;effecttiming,(1/8),0,(7/8),0;effectcolor2,Color("White");effectcolor1,color("1,1,1,0.5");effectclock,'beatnooffset' -HighlightOffCommand= -HighlightSortOnCommand=stoptweening;decelerate,0.125;glow,Color("Stealth");zoom,1 -HighlightSortOffCommand=stoptweening;accelerate,0.125;glow,Color("Orange");zoom,1.05 -WheelItemOnDelayOffset=0.04 -WheelItemOffDelayOffset=0.04 -WheelItemLockedColor=color("0,0,0,0.5") -# -NumSectionColors=1 -SectionColor1=Color("Orange") -# -SongRealExtraColor=Color("Red") -SortMenuColor=Color("Orange") -# -ShowRoulette=true -ShowRandom=false -ShowPortal=false -MostPlayedSongsToShow=30 -#~ ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,Genre,Length" -#~ ChoicePreferred="sort,Preferred" -#~ ChoiceGroup="sort,Group" -#~ ChoiceTitle="sort,Title" -#~ ChoiceBpm="sort,BPM" -#~ ChoicePopularity="sort,Popularity" -#~ ChoiceTopGrades="sort,TopGrades" -#~ ChoiceArtist="sort,Artist" -#~ ChoiceGenre="sort,Genre" -#~ ChoiceEasyMeter="sort,EasyMeter" -#~ ChoiceMediumMeter="sort,MediumMeter" -#~ ChoiceHardMeter="sort,HardMeter" -#~ ChoiceChallengeMeter="sort,ChallengeMeter" -#~ ChoiceLength="sort,Length" -#~ ChoiceCourses="sort,AllCourses;" -UseEasyMarkerFlag=true -# - -[MusicWheelItem] -WheelNotifyIconX=-128-16+0.5 -WheelNotifyIconY=0 -WheelNotifyIconOnCommand=shadowlength,2; -# -SongNameX=-120 -SongNameY=0 -SongNameOnCommand= -# -CourseX=-120 -CourseY=0 -CourseOnCommand=maxwidth,208;horizalign,left -# -SectionExpandedX=-38 -SectionExpandedY=-2 -SectionExpandedOnCommand=maxwidth,194;shadowlength,1;shadowcolor,color("0.1,0.1,0.1,0.25") -# -SectionCollapsedX=-38 -SectionCollapsedY=-2 -SectionCollapsedOnCommand=maxwidth,194;shadowlength,1;shadowcolor,color("0.1,0.1,0.1,0.2") -SectionCountX=112 -SectionCountY=0 -SectionCountOnCommand=zoom,0.75;strokecolor,Color("Outline") -# -RouletteX=0 -RouletteY=0 -RouletteOnCommand=maxwidth,400;shadowlength,1;zoom,0.75;rainbowscroll,true;thump,2; -# -SortX=-132 -SortY=-2 -SortOnCommand=maxwidth,256;horizalign,left;shadowlength,1;shadowcolor,color("0,0,0,0.325") -# -ModeX=-132 -ModeY=-2 -ModeOnCommand=maxwidth,256;horizalign,left;strokecolor,Color("Outline") -# -GradeP1X=106+16 -GradeP1Y=-8 -GradeP2X=110+16 -GradeP2Y=8 -GradesShowMachine=true - -[OptionRow] -TitleOnCommand=shadowlength,0;skewx,-0.1;uppercase,true;wrapwidthpixels,136;maxheight,42;zoom,0.6 -TitleGainFocusCommand=stoptweening;zoom,0.6375*1.125;bounceend,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);strokecolor,Color("Black");zoom,0.6375; -# TitleGainFocusCommand=stoptweening;zoom,0.6375*1.25;bounceend,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);strokecolor,Color("Black");zoom,0.6375;thump;effectmagnitude,1,1.05,1;effectclock,'beat' -TitleLoseFocusCommand=diffuse,Color("White");strokecolor,Color("Black");stopeffect; -[OptionRowMiniMenu] -Fallback="OptionRow" - -TitleX=SCREEN_CENTER_X-320+48 -TitleOnCommand=horizalign,left;shadowlength,0;uppercase,true;zoom,0.6375;strokecolor,Color("Black"); -#~ TitleGainFocusCommand= -#~ TitleLoseFocusCommand= - -ColorSelected=color("1,1,1,1") -ColorNotSelected=color("0.9,0.9,0.9,1") -ColorDisabled=color("0.5,0.5,0.5,1") - -ItemOnCommand=zoom,0.6375 -ItemsLongRowP1X=SCREEN_CENTER_X-240 -ItemsLongRowP2X=SCREEN_CENTER_X+240 -ItemsLongRowSharedX=SCREEN_CENTER_X+200 - -[OptionRowMiniMenuContext] -Fallback="OptionRowMiniMenu" - -[OptionRowExit] -Fallback="OptionRow" -FrameOnCommand=visible,true;diffuse,Color("Red"); -FrameX=SCREEN_CENTER_X -TitleOnCommand=visible,false - -ItemsMinBaseZoom=1 -ItemOnCommand=shadowlength,1;zoom,0.8;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.75);shadowcolor,BoostColor(Color("Red"),0.35) -ItemGainFocusCommand=stoptweening;linear,0.2;zoom,1;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.75) -ItemLoseFocusCommand=stoptweening;decelerate,0.5;zoom,0.8; -ColorSelected=Color("Red") -ColorNotSelected=Color("Red") -ColorDisabled=Color("Red") - -ItemsLongRowP1X=SCREEN_CENTER_X-1024 -ItemsLongRowP2X=SCREEN_CENTER_X+1024 -ItemsLongRowSharedX=SCREEN_CENTER_X - -[OptionsCursorP1] -LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_1) -MiddleOnCommand=;diffuse,PlayerColor(PLAYER_1) -RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_1) -[OptionsCursorP2] -LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_2) -MiddleOnCommand=;diffuse,PlayerColor(PLAYER_2) -RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_2) -[OptionsUnderlineP1] -LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_1) -MiddleOnCommand=;diffuse,PlayerColor(PLAYER_1) -RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_1) -[OptionsUnderlineP2] -LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_2) -MiddleOnCommand=;diffuse,PlayerColor(PLAYER_2) -RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_2) -[Protiming] -ProtimingOnCommand=shadowlength,1;horizalign,right;x,30;strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; -AverageOnCommand=shadowlength,1;horizalign,left;x,32;y,8;zoom,0.75;diffuse,ColorLightTone( Color("Green") );strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; -TextOnCommand=shadowlength,1;horizalign,left;x,32;y,-6;zoom,0.5;strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; -# -ProtimingW1Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W1"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -ProtimingW2Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W2"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -ProtimingW3Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W3"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -ProtimingW4Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W4"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -ProtimingW5Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W5"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -ProtimingMissCommand=finishtweening;diffusealpha,1;zoom,1.15;glow,GameColor.Judgment["JudgmentLine_Miss"];linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_Miss"];sleep,2;linear,0.5;diffuse,Color("Invisible"); -# -AveragePulseCommand=finishtweening;diffusealpha,1;zoom,0.75*1.025;decelerate,0.05;zoom,0.75;sleep,2;linear,0.5;diffusealpha,0; -TextPulseCommand=finishtweening;diffusealpha,1;zoom,0.5*1.025;decelerate,0.05;zoom,0.5;sleep,2;linear,0.5;diffusealpha,0; -[Player] -# ReceptorArrowsYStandard=GetTapPosition('Standard') -# ReceptorArrowsYReverse=GetTapPosition('Reverse') -# RollBodyIncrementsCombo=GetUserPrefB("UserPrefComboOnRolls") - -[ScoreDisplayNormal] -FrameX= -FrameY= -FrameOnCommand= -FrameOffCommand= -TextX= -TextY= -TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) -TextOffCommand= - -[ScoreDisplayOni] -TextX= -TextY= -TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) -TextOffCommand= -[ScoreDisplayOni Numbers] -TextX= -TextY= -TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) -TextOffCommand= -[ScoreDisplayLifeTime] -FrameX= -FrameY= -FrameOnCommand=visible,false;spin -FrameOffCommand= -# -TimeRemainingX= -TimeRemainingY=80 -TimeRemainingOnCommand=zoom,1;shadowlength,1;settext,"Hi!"; -TimeRemainingOffCommand= -# -DeltaSecondsOnCommand=y,80;settext,Hi;spin; -DeltaSecondsNoneCommand= -DeltaSecondsHitMineCommand= -DeltaSecondsAvoidMineCommand= -DeltaSecondsCheckpointMissCommand= -DeltaSecondsCheckpointHitCommand= -DeltaSecondsMissCommand= -DeltaSecondsW5Command= -DeltaSecondsW4Command= -DeltaSecondsW3Command= -DeltaSecondsW2Command= -DeltaSecondsW1Command= -DeltaSecondsLetGoCommand= -DeltaSecondsHeldCommand= -DeltaSecondsGainLifeCommand=zoom,0.5;settext,"Hi!"; -[ScoreDisplayPercentage Percent] -PercentP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5) -PercentP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5) -[ScreenEvaluation Percent] -# This shouldn't even be named this but whatever man. -PercentP1X=0 -PercentP1Y=0 -PercentP1OnCommand=horizalign,right;shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); -PercentP1OffCommand= -PercentP2X=0 -PercentP2Y=0 -PercentP2OnCommand=horizalign,right;shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); -PercentP2OffCommand= -PercentRemainderP1X=0 -PercentRemainderP1Y=0 -PercentRemainderP1OnCommand=horizalign,left;shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); -PercentRemainderP1OffCommand= -PercentRemainderP2X=0 -PercentRemainderP2Y=0 -PercentRemainderP2OnCommand=horizalign,left;shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); -PercentRemainderP2OffCommand= -DancePointsP1X=0 -DancePointsP1Y=0 -DancePointsP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); -DancePointsP1OffCommand= -DancePointsP2X=0 -DancePointsP2Y=0 -DancePointsP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); -DancePointsP2OffCommand= -DancePointsDigits=2 -PercentUseRemainder=true -ApplyScoreDisplayOptions=true -FormatPercentScore=FormatPercentScore -Format= -PercentDecimalPlaces=2 -PercentTotalSize=5 - -[ScoreDisplayRave] -MeterP1X= -MeterP1Y= -MeterP1OnCommand=draworder,-1 -MeterP1OffCommand= -MeterP2X= -MeterP2Y= -MeterP2OnCommand=draworder,-1;zoomx,-1 -MeterP2OffCommand= - -LevelP1X= -LevelP1Y= -LevelP1OnCommand=draworder,105;zoom,0.75;diffuse,ColorLightTone( PlayerColor(PLAYER_1) );strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );x,-144;skewx,-0.125; -LevelP1OffCommand= -LevelP2X= -LevelP2Y= -LevelP2OnCommand=draworder,105;draworder,105;zoom,0.75;diffuse,ColorLightTone( PlayerColor(PLAYER_2) );strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );x,144;skewx,-0.125; -LevelP2OffCommand= -[SongManager] -SongGroupColor1=BoostColor(Color("Orange"),1.2) -SongGroupColor2=BoostColor(Color("Orange"),1.25) -SongGroupColor3=BoostColor(Color("Orange"),1.25) -SongGroupColor4=BoostColor(Color("Orange"),1.25) -SongGroupColor5=BoostColor(Color("Orange"),1.25) -SongGroupColor6=BoostColor(Color("Orange"),1.25) -SongGroupColor7=BoostColor(Color("Orange"),1.25) -SongGroupColor8=BoostColor(Color("Orange"),1.25) -SongGroupColor9=BoostColor(Color("Orange"),1.25) -SongGroupColor10=BoostColor(Color("Orange"),1.25) - -CourseGroupColor1=color("1,1,1,1") -UnlockColor=color("1,0.5,0,1") -ExtraColor=color("#ff0000") -- red - -[SongMeterDisplay] -StreamWidth=380 - -ContainerX= -ContainerY= -ContainerOnCommand= -ContainerOffCommand= - -FrameX=0 -FrameY=0 -FrameOnCommand=sleep,2;linear,0.25;diffuse,Color("Orange");glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 -FrameOffCommand= - -StreamX=0 -StreamY=0 -StreamOnCommand=0 -StreamOffCommand=0 - -TipX=0 -TipY=0 -TipOnCommand= -TipOffCommand= -[SongMeterDisplayP1] -Fallback="SongMeterDisplay" -FrameOnCommand=sleep,2;linear,0.25;diffuse,PlayerColor(PLAYER_1);glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 -[SongMeterDisplayP2] -Fallback="SongMeterDisplay" -FrameOnCommand=sleep,2;linear,0.25;diffuse,PlayerColor(PLAYER_2);glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 -[StepsDisplay] -FrameX=0 -FrameY=0 -FrameOnCommand= -FrameLoadCommand=%function(self,param) end; -FrameSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - end; \ -end; -# -ShowTicks=false -NumTicks=10 -MaxTicks=14 -TicksX=0 -TicksY=0 -TicksOnCommand=shadowlength,0; -TicksSetCommand=%function(self,param) end; -# -ShowMeter=true -ZeroMeterString="?" -MeterX=56-32 -MeterY=0 -MeterOnCommand=shadowlength,1;textglowmode,'TextGlowMode_Inner' -MeterSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ - if param.Meter then \ - if param.Meter >= 100 then \ - self:basezoom(0.8); \ - self:glowshift(); \ - elseif param.Meter >= 10 then \ - self:basezoom(1); \ - self:glowshift(); \ - else \ - self:basezoom(1); \ - self:stopeffect(); \ - end; \ - end; \ -end; -# -ShowDescription=true -DescriptionX=-20-32 -DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 -# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 -DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 -DescriptionSetCommand=%function(self,param) \ - if self:GetText() == "" then \ - self:settext("Edit"); \ - end; \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ -end; -# -ShowAutogen=false -AutogenX=40-32 -AutogenY=0 -AutogenOnCommand= -AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end -# -ShowStepsType=GetGamePrefB("AutoSetStyle") -# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") -StepsTypeX=-20-32 -StepsTypeY=7 -StepsTypeOnCommand=zoom,0.45 - -[StepsDisplayEdit] -Fallback="StepsDisplayGameplay" - -[StepsDisplayGameplay] -Fallback="StepsDisplay" - -FrameX=0 -FrameY=0 -FrameOnCommand= -FrameLoadCommand=%function(self,param) end; -FrameSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - end; \ -end; -# -ShowTicks=false -NumTicks=10 -MaxTicks=14 -TicksX=0 -TicksY=0 -TicksOnCommand=shadowlength,0; -TicksSetCommand=%function(self,param) end; -# -ShowMeter=true -ZeroMeterString="?" -MeterX=56 -MeterY=0 -MeterOnCommand=shadowlength,1;textglowmode,'TextGlowMode_Inner' -MeterSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ - if param.Meter then \ - if param.Meter >= 100 then \ - self:zoom(0.8); \ - else \ - self:zoom(1); \ - end; \ - end; \ -end; -# -ShowDescription=true -DescriptionX=-20 -DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 -# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 -DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 -DescriptionSetCommand=%function(self,param) \ - if self:GetText() == "" then \ - self:settext("Edit"); \ - end; \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ - (cmd(finishtweening;diffusealpha,0;addx,-4;smooth,0.125;addx,4;diffusealpha,1))(self); \ -end; -# -ShowAutogen=false -AutogenX=40 -AutogenY=0 -AutogenOnCommand= -AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end -# -ShowStepsType=GetGamePrefB("AutoSetStyle") -# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") -StepsTypeX=-20 -StepsTypeY=7 -StepsTypeOnCommand=zoom,0.45 - -[StepsDisplayEvaluation] -Fallback="StepsDisplay" - -[StepsDisplayListRow] -# -CapitalizeDifficultyNames=false -NumShownItems=5 -ItemsSpacingY=24 -MoveCommand=decelerate,0.3 -# -FrameX= -FrameY=0 -FrameOnCommand= -FrameOffCommand= -FrameSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(ColorMidTone( CustomDifficultyToColor(param.CustomDifficulty) )); \ - else \ - self:diffuse(color('1,1,1,1')); \ - end; \ -end; -# -ShowTicks=false -NumTicks=10 -MaxTicks=10 -TicksSetCommand= -# -ShowMeter=true -ZeroMeterString="0" -MeterX=56 -MeterY=0 -MeterOnCommand=shadowlength,1;zoom,0.65;textglowmode,'TextGlowMode_Inner'; -MeterOffCommand= -MeterSetCommand=%function(self,param) \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ - if param.Meter then \ - if param.Meter >= 10 then \ - self:textglowmode('TextGlowMode_Inner'); \ - self:glowshift(); \ - else \ - self:stopeffect(); \ - end; \ - end; \ -end; -# -ShowDescription=true -DescriptionX=GetGamePrefB("AutoSetStyle") and (-64-8+20) or (-64-8) -# DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8) -DescriptionY=0 -DescriptionOnCommand=shadowlength,1;horizalign,left;zoom,0.65;maxwidth,128+8-20;uppercase,true; -DescriptionOffCommand= -DescriptionSetCommand=%function(self,param) \ - if self:GetText() == "" then \ - self:settext("Edit"); \ - end; \ - if param.CustomDifficulty then \ - self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ - self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ - end; \ -end; -# -ShowAutogen=true -AutogenX=0 -AutogenY=0 -#AutogenOnCommand=diffuseshift;effectcolor1,Colors.Alpha( Color("Green") , 0.5 );effectcolor2,ColorLightTone( Color("Green") ); -AutogenOnCommand=blend,Blend.Add;diffuseshift;effectcolor1,color("#FFCC00FF");effectcolor2,color("#FFCC0088"); -AutogenSetCommand= -# -ShowStepsType=GetGamePrefB("AutoSetStyle") -# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") -StepsTypeX=-64-8 -StepsTypeY=0 -StepsTypeOnCommand= -StepsTypeSetCommand= - -[StreamDisplay] -; a simple bar life meter: -; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end -# PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - # local fItemWidth = ( 256 / numItems ) \ - # self:x( ((itemIndex-(numItems/2))*fItemWidth) + ( numItems / 2 ) ); \ - # self:zoomtowidth(fItemWidth); \ - # self:diffuseramp(); \ - # self:effectperiod(4); \ - # self:effectoffset((itemIndex-1)/numItems * -1); \ - # self:effectcolor2(color("1,1,1,1")); \ - # self:effectcolor1(color("0.5,0.5,0.5,1")); \ - # self:effectclock('beatnooffset'); \ -# end; -PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - local fItemWidth = ( 256 / numItems ) \ - self:zoomtowidth(fItemWidth); \ -end; -# PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ - # local fItemWidth = ( 256 / numItems ) \ - # self:x( ((itemIndex-(numItems/2))*fItemWidth) + ( numItems / 2 ) ); \ - # self:zoomtowidth(fItemWidth); \ - # self:diffuseramp(); \ - # self:effecttiming(1,0.01875*itemIndex,1,1-(0.01875*itemIndex)); \ - # self:effectclock('beatnooffset'); \ -# end; -TextureCoordScaleX=1 -NumPills=1 -AlwaysBounceNormalBar=false - -[TextBanner] -TitleOnCommand=horizalign,left;shadowlength,1; -SubtitleOnCommand=horizalign,left;shadowlength,1; -ArtistOnCommand=horizalign,left;shadowlength,1;skewx,-0.2 -ArtistPrependString="" -AfterSetCommand=%TextBannerAfterSet - -[ScreenSystemLayer] -CreditsP1OnCommand=horizalign,left;vertalign,bottom;zoom,0.675;shadowlength,1;diffusebottomedge,PlayerColor(PLAYER_1); -CreditsP1OffCommand= -# -CreditsP2OnCommand=horizalign,right;vertalign,bottom;zoom,0.675;shadowlength,1;diffusebottomedge,PlayerColor(PLAYER_2); -CreditsP2OffCommand= -[ScreenWithMenuElements] -WaitForChildrenBeforeTweening=true - -ScreenInDelay=0 -ScreenOutDelay=0 - -FOV=90 -ShowHeader=true -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP -HeaderOnCommand=draworder,5; -HeaderOffCommand= - -ShowFooter=true -FooterX=SCREEN_CENTER_X -FooterY=SCREEN_BOTTOM -FooterOnCommand=draworder,5;vertalign,bottom;zoomtowidth,SCREEN_WIDTH+1;diffuse,color("#ffd400"); -FooterOffCommand= - -ShowHelp=true -HelpX=SCREEN_CENTER_X -HelpY=SCREEN_BOTTOM-16 -HelpOnCommand=SetSecsBetweenSwitches,4;shadowlength,1;strokecolor,Color("Black");draworder,105;zoomy,0;linear,0.175;zoom,1*0.675;maxwidth,(640*0.75)/0.5; -HelpOffCommand=linear,0.175;zoomy,0 - -AlternateHelpDisplayX=SCREEN_CENTER_X -AlternateHelpDisplayY=SCREEN_BOTTOM-16 -# AlternateHelpDisplayOnCommand=draworder,105; -AlternateHelpDisplayOnCommand=SetSecsBetweenSwitches,4;shadowlength,1;strokecolor,Color("Black");draworder,105;zoomy,0;linear,0.175;zoom,1*0.675;maxwidth,(640*0.75)/0.5;;diffusealpha,0 -AlternateHelpDisplayOffCommand=linear,0.175;zoomy,0 - -TimerX=SCREEN_RIGHT-36-4 -TimerY=SCREEN_TOP+22 -TimerOnCommand=draworder,6;visible,PREFSMAN:GetPreference("MenuTimer"); -# TimerOnCommand=fov,90;vanishpoint,SCREEN_RIGHT-36-4,SCREEN_TOP+20;draworder,5;visible,PREFSMAN:GetPreference("MenuTimer");rotationy,90;decelerate,0.4;rotationy,0; -TimerOffCommand= -# TimerOffCommand=accelerate,0.4;rotationx,90; - -StageDisplayNumberOffset=1 - -# This is useful -ArcadeOverlayX= -ArcadeOverlayY= -ArcadeOverlayOnCommand=draworder,100 -ArcadeOverlayOffCommand= -# -ArcadeOverlay.TextX=SCREEN_CENTER_X -ArcadeOverlay.TextY=SCREEN_BOTTOM-48 -ArcadeOverlay.TextOnCommand= -ArcadeOverlay.TextOffCommand= -[ScreenWithMenuElementsBlank] -ShowHeader=false -ShowFooter=false - -[ScreenOptions] -DisqualifyP1X=SCREEN_CENTER_X-176 -DisqualifyP1Y=SCREEN_BOTTOM-98 -DisqualifyP1OnCommand=draworder,100;zoom,0.5;shadowlength,1;player,PLAYER_1 -DisqualifyP1OffCommand= -DisqualifyP2X=SCREEN_CENTER_X+176 -DisqualifyP2Y=SCREEN_BOTTOM-98 -DisqualifyP2OnCommand=draworder,100;zoom,0.5;shadowlength,1;player,PLAYER_2 -DisqualifyP2OffCommand= - -ContainerOnCommand=x,-SCREEN_WIDTH;decelerate,0.35;x,SCREEN_LEFT -# PageOnCommand=fadetop,0.125;fadebottom,0.125;cropbottom,0.5;croptop,0.5;decelerate,0.25;croptop,0;cropbottom,0;fadetop,0;fadebottom,0; -CursorOnCommand= - -LineHighlightOnCommand=cropleft,0.1;cropright,0.1;zoomx,1.25;fadeleft,0.05;faderight,0.05;diffuseshift;effectcolor2,color("1,1,1,0.5");effectcolor1,color("1,1,1,0.25");effectclock,'beat' -LineHighlightChangeCommand=linear,0.1;diffuse,Color("White");diffuseshift;effectcolor2,color("1,1,1,0.5");effectcolor1,color("1,1,1,0.25") -LineHighlightChangeToExitCommand=linear,0.1;diffuse,Color("Red");diffuseshift;effectcolor2,color("1,0,0,0.5");effectcolor1,color("1,0,0,0.25") - -[ScreenMiniMenu] -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP -HeaderOnCommand=draworder,100;visible,false -HeaderOffCommand= - -LineHighlightOnCommand=cropleft,0.1;cropright,0.1;zoomx,1.3;fadeleft,0.25;faderight,0.25;diffusealpha,0.375 -LineHighlightChangeCommand= -LineHighlightChangeToExitCommand= - -[ScreenMiniMenuContext] -PageOnCommand=visible,false -LineHighlightX=SCREEN_CENTER_X/2 - -TitleX=SCREEN_CENTER_X -TitleOnCommand=shadowlength,1; -ItemsStartX=SCREEN_CENTER_X -ItemsEndX=SCREEN_CENTER_X -ItemsGapX=14 -ItemsLongRowP1X=SCREEN_CENTER_X -ItemsLongRowP2X=SCREEN_CENTER_X -ItemsLongRowSharedX=SCREEN_CENTER_X - -[ScreenOptionsTheme] -Fallback="ScreenOptionsServiceChild" -NextScreen="ScreenOptionsExtended" -PrevScreen="ScreenOptionsExtended" -LineNames="gNotePos,gAuto,gScore,gSScore,gSDisp,gOpts,gLongFail,gComboUnderField,FlashyCombo,GameplayFooter" -LinegNotePos="lua,GamePrefNotePosition()" -LinegScore="lua,UserPrefGameplayShowScore()" -LinegSScore="lua,UserPrefSpecialScoringMode()" -LinegSDisp="lua,UserPrefGameplayShowStepsDisplay()" -LinegOpts="lua,UserPrefShowLotsaOptions()" -LinegAuto="lua,GamePrefAutoSetStyle()" -LinegLongFail="lua,UserPrefLongFail()" -LinegComboUnderField="lua,GamePrefComboUnderField()" -LineFlashyCombo="lua,UserPrefFlashyCombo()" -LineGameplayFooter="lua,UserPrefGameplayFooter()" -[ScreenOptionsSystemDirection] -LineNames="1,2,3,4,5,6,7,8,9,FlashyCombo,RollCombo,10,11,12,13,14,15,16,LF,17,18,19,20,21,22" -LineLF="lua,UserPrefLongFail()" -LineRollCombo="lua,GamePrefComboOnRolls()" -LineFlashyCombo="lua,UserPrefFlashyCombo()" -[ScreenOptionsAdvanced] -LineNames="2,3,4,8,11,13,14,15,16,28,29,30,RollCombo" -LineRollCombo="lua,GamePrefComboOnRolls()" -[ScreenOptionsService] -ShowHeader=false - -# ScreenOptionsSystemDirection" - -NumRowsShown=14 -RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-170+24*offsetFromCenter) end - -SeparateExitRow=false -SeparateExitRowY=SCREEN_BOTTOM-40 - -[ScreenTextEntry] -QuestionOnCommand=diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);wrapwidthpixels,600 -AnswerOnCommand=diffuse,Color("Blue");glowshift; -KeysInitCommand=zoom,0.8;shadowlength,0 - -[ScreenInit] -PrepareScreens="ScreenTitleMenu,ScreenTitleJoin" -GroupedScreens="ScreenInit,ScreenTitleJoin,ScreenTitleMenu" -PersistScreens="ScreenInit,ScreenTitleJoin,ScreenTitleMenu" - -[ScreenTitleMenu] -ShowHeader=false -ShowFooter=false -# -ShowScroller=true -WrapScroller=false -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((28)*(itemIndex-(numItems-1)/2)); end; -ScrollerSecondsPerItem=0 -ScrollerNumItemsToDraw=20 -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y+80 -ScrollerOnCommand=zoom,0;bounceend,0.35;zoom,1 -# -ShowLogo=true -LogoX=SCREEN_CENTER_X -LogoY=SCREEN_CENTER_Y-68 -LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 -LogoOffCommand=stopeffect;bouncebegin,0.35;rotationz,360;zoom,0 -# -ShowCurrentGametype=true -CurrentGametypeX=SCREEN_WIDTH*0.01 -CurrentGametypeY=SCREEN_HEIGHT*0.1575 -CurrentGametypeOnCommand=vertalign,bottom; -CurrentGametypeOffCommand=linear,0.5;cropleft,1 -# -ShowTimingDifficulty=true -TimingDifficultyX=SCREEN_LEFT+84 -TimingDifficultyY=SCREEN_TOP+22 -TimingDifficultyOnCommand= -TimingDifficultyOffCommand= -# -ShowLifeDifficulty=true -LifeDifficultyX=SCREEN_LEFT+84 -LifeDifficultyY=SCREEN_TOP+48 -LifeDifficultyOnCommand= -LifeDifficultyOffCommand= -# -ShowSystemDirection=false -SystemDirectionX=SCREEN_LEFT+40 -SystemDirectionY=SCREEN_TOP+24 -SystemDirectionOnCommand= -SystemDirectionOffCommand= -# -ShowVersionInfo=true -VersionInfoX=SCREEN_RIGHT-84 -VersionInfoY=SCREEN_BOTTOM-64 -VersionInfoOnCommand= -VersionInfoOffCommand= -# -ShowNetworkStatus=true -NetworkStatusX=SCREEN_WIDTH*0.0125 -NetworkStatusY=SCREEN_HEIGHT*0.85 -NetworkStatusOnCommand=horizalign,left; -NetworkStatusOffCommand=linear,0.5;cropright,1 -# -HelpY=SCREEN_BOTTOM-24 -# -#ChoiceNames="1,Setup,4,5,7" -ChoiceNames="1,4,5,7" -#~ ChoiceNames="1,3,4,7" -DefaultChoice="1" -#DisabledChoices="Setup" -#ChoiceSetup="text,Setup" -ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" - -[ScreenQuickSetupOverview] -IconStartX=SCREEN_CENTER_X-160 -IconStartY=SCREEN_BOTTOM-60 -IconSetX=SCREEN_CENTER_X-160 -IconSetY=SCREEN_BOTTOM-60 -IconBackX=SCREEN_CENTER_X+160 -IconBackY=SCREEN_BOTTOM-60 - -ExplanationX=SCREEN_CENTER_X -ExplanationY=SCREEN_BOTTOM-100 -ExplanationOnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_WIDTH/0.75; -ExplanationOffCommand= -[ScreenProfileLoad] -# -ShowHeader=true -ShowFooter=true -ShowHelp=true -[ScreenSelectProfile] -WaitForChildrenBeforeTweening=true -[ScreenSelectStyle] -UpdateOnMesage="" -# -FOV=90 -# -PerChoiceScrollElement=false -PerChoiceIconElement=false -# -DefaultChoice="Single" -ChoiceNames=GameCompatibleModes() -# -OptionOrderAuto="1:2,2:1" -ChoiceSingle="name,Single;style,single;screen,"..Branch.AfterSelectPlayMode() -ChoiceDouble="name,Double;style,double;screen,"..Branch.AfterSelectPlayMode() -ChoiceSolo="name,Solo;style,solo;screen,"..Branch.AfterSelectPlayMode() -ChoiceVersus="name,Versus;style,versus;screen,"..Branch.AfterSelectPlayMode() -ChoiceCouple="name,Couple;style,couple;screen,"..Branch.AfterSelectPlayMode() -ChoiceHalfDouble="name,HalfDouble;style,halfdouble;screen,"..Branch.AfterSelectPlayMode() -Choice5Keys="name,5Keys;style,single5;;screen,"..Branch.AfterSelectPlayMode() -Choice7Keys="name,7Keys;style,single7;screen,"..Branch.AfterSelectPlayMode() -Choice10Keys="name,10Keys;style,double10;screen,"..Branch.AfterSelectPlayMode() -Choice14Keys="name,14Keys;style,double14;screen,"..Branch.AfterSelectPlayMode() -ChoiceKB7="name,kb7;style,single;screen,"..Branch.AfterSelectPlayMode() -# -ShowScroller=false -ShowIcon=true -WrapScroller=false -UseIconMetrics=true -# -IconGainFocusCommand=stoptweening;bounceend,0.125;zoom,1; -IconLoseFocusCommand=stoptweening;decelerate,0.25;zoom,0.8; -# -IconChoiceSingleX=SCREEN_CENTER_X-160 -IconChoiceSingleY=SCREEN_CENTER_Y-96 -IconChoiceSingleOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceSingleOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceDoubleX=SCREEN_CENTER_X-160 -IconChoiceDoubleY=SCREEN_CENTER_Y -IconChoiceDoubleOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceDoubleOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceSoloX=SCREEN_CENTER_X-160 -IconChoiceSoloY=SCREEN_CENTER_Y+96 -IconChoiceSoloOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceSoloOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceHalfDoubleX=SCREEN_CENTER_X-160 -IconChoiceHalfDoubleY=SCREEN_CENTER_Y+96 -IconChoiceHalfDoubleOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceHalfDoubleOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceVersusX=SCREEN_CENTER_X+160 -IconChoiceVersusY=SCREEN_CENTER_Y-48 -IconChoiceVersusOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceVersusOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceCoupleX=SCREEN_CENTER_X+160 -IconChoiceCoupleY=SCREEN_CENTER_Y+48 -IconChoiceCoupleOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoiceCoupleOffCommand=linear,0.1175;zoomx,0 -# -IconChoicekb7X=SCREEN_CENTER_X -IconChoicekb7Y=SCREEN_CENTER_Y -IconChoicekb7OnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoicekb7OffCommand=linear,0.1175;zoomx,0 -# -IconChoice5KeysX=SCREEN_CENTER_X-160 -IconChoice5KeysY=SCREEN_CENTER_Y-48 -IconChoice5KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoice5KeysOffCommand=linear,0.1175;zoomx,0 -# -IconChoice7KeysX=SCREEN_CENTER_X-160 -IconChoice7KeysY=SCREEN_CENTER_Y+48 -IconChoice7KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoice7KeysOffCommand=linear,0.1175;zoomx,0 -# -IconChoice10KeysX=SCREEN_CENTER_X+160 -IconChoice10KeysY=SCREEN_CENTER_Y-48 -IconChoice10KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoice10KeysOffCommand=linear,0.1175;zoomx,0 -# -IconChoice14KeysX=SCREEN_CENTER_X+160 -IconChoice14KeysY=SCREEN_CENTER_Y+48 -IconChoice14KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 -IconChoice14KeysOffCommand=linear,0.1175;zoomx,0 - -[ScreenSelectPlayMode] -PersistScreens="ScreenSelectPlayMode,ScreenSelectMusic" -# -ScreenOutDelay=3 -# -DefaultChoice="Easy" -# ChoiceNames="Normal,Extended" -# -PerChoiceIconElement=false -# -ShowScroller=true -WrapScroller=true -ScrollerX=SCREEN_CENTER_X -ScrollerY=SCREEN_CENTER_Y-60 -ScrollerOnCommand=SetFastCatchup,true; -ScrollerOffCommand=decelerate,0.8;y,SCREEN_CENTER_Y;sleep,2;linear,0.1;zoomy,0 -# -ShowBackgroundFrame=true -BackgroundFrameX=SCREEN_CENTER_X -BackgroundFrameY=SCREEN_CENTER_Y-60 -BackgroundFrameOnCommand=diffuse,Color("Black");diffusealpha,0.7 -BackgroundFrameOffCommand=decelerate,0.8;y,SCREEN_CENTER_Y;sleep,2;linear,0.1;zoomy,0 -# -ShowIcon=true -UseIconMetrics=true -# -IconGainFocusCommand=stoptweening;glowshift;decelerate,0.125;zoom,1; -IconLoseFocusCommand=stoptweening;stopeffect;decelerate,0.125;zoom,0.6; -# IconMinZoom=0.5 -# IconBaseZoom=0.6 -# -IconChoiceEasyX=SCREEN_CENTER_X-(240*(5/6)) -IconChoiceEasyY=SCREEN_BOTTOM-88-64 -IconChoiceEasyOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceEasyOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceNormalX=SCREEN_CENTER_X-80 -IconChoiceNormalY=SCREEN_BOTTOM-88-64 -IconChoiceNormalOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceNormalOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceHardX=SCREEN_CENTER_X+(80*(5/6)) -IconChoiceHardY=SCREEN_BOTTOM-88-64 -IconChoiceHardOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceHardOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceRaveX=SCREEN_CENTER_X+80 -IconChoiceRaveY=SCREEN_BOTTOM-88-64 -IconChoiceRaveOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceRaveOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceExtendedX=SCREEN_CENTER_X-160 -IconChoiceExtendedY=SCREEN_BOTTOM-88 -IconChoiceExtendedOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceExtendedOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceOniX=SCREEN_CENTER_X -IconChoiceOniY=SCREEN_BOTTOM-88 -IconChoiceOniOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceOniOffCommand=linear,0.1175;zoomx,0 -# -IconChoiceEndlessX=SCREEN_CENTER_X+160 -IconChoiceEndlessY=SCREEN_BOTTOM-88 -IconChoiceEndlessOnCommand=zoom,0;bounceend,0.35;zoom,0.8 -IconChoiceEndlessOffCommand=linear,0.1175;zoomx,0 - -[ScreenSelectMusic] -UsePlayerSelectMenu=false -# OptionsMenuAvailable=(getenv(sMode) ~= Oni) -SelectMenuAvailable=true -# ModeMenuAvailable=(getenv(sMode) == Normal) -# HelpDisplay has things added here to make sure it disappears for another -# actor, which we defined in this screens decorations. -HelpSelectMenuOpenedMessageCommand=stoptweening;decelerate,0.125;diffusealpha,0; -HelpSelectMenuClosedMessageCommand=stoptweening;accelerate,0.0725;diffusealpha,1; -# Clone everything from HelpDisplay: we're lazy -ShowAlternateHelpDisplay=true -# AlternateHelpDisplaySelectMenuOpenedMessageCommand=stoptweening;y,SCREEN_BOTTOM-16;accelerate,0.0725/2;y,SCREEN_BOTTOM-16-16;diffusealpha,1;decelerate,0.0725/2;y,SCREEN_BOTTOM-16-32; -# AlternateHelpDisplaySelectMenuClosedMessageCommand=stoptweening;y,SCREEN_BOTTOM-16;smooth,0.125;y,SCREEN_BOTTOM-16;diffusealpha,0; -AlternateHelpDisplaySelectMenuOpenedMessageCommand=stoptweening;accelerate,0.0725;diffusealpha,1; -AlternateHelpDisplaySelectMenuClosedMessageCommand=stoptweening;decelerate,0.125;diffusealpha,0; -# -MusicWheelX=SCREEN_CENTER_X+160 -MusicWheelY=SCREEN_CENTER_Y -MusicWheelOnCommand=draworder,-5;fov,90;vanishpoint,SCREEN_CENTER_X+160,SCREEN_CENTER_Y;addx,SCREEN_CENTER_X;decelerate,0.35;addx,-SCREEN_CENTER_X -MusicWheelOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowNewSong=not GAMESTATE:IsCourseMode() -NewSongX=SCREEN_CENTER_X-160+128-24 -NewSongY=SCREEN_TOP+160-6 -NewSongOnCommand=finishtweening;diffuse,Color("Orange");diffusetopedge,Color("Yellow");strokecolor,Color("Black");zoom,0.675;draworder,106;playcommand,"Set" -NewSongOffCommand=accelerate,0.35*0.5;zoom,0.675;diffusealpha,0 -NewSongShowCommand=finishtweening;diffusealpha,1;glowshift;effectclock,'bgm';effectperiod,4;textglowmode,'TextGlowMode_Inner'; -NewSongHideCommand=finishtweening;;diffusealpha,0;stopeffect; -# -ShowSongTime=true -SongTimeX=SCREEN_CENTER_X-160 -SongTimeY=SCREEN_TOP+160+(36/2)+8 -SongTimeOnCommand=zoom,0.75;strokecolor,Color("Outline");shadowlength,1 -SongTimeOffCommand=bouncebegin,0.15;zoom,0;diffusealpha,0; -SongTimeResetCommand=diffuse,Color("White"); -SongTimeAutogenCommand=diffuse,Color("Green"); -SongTimeLongCommand=diffuse,Color("Yellow");diffusebottomedge,Color("Orange"); -SongTimeMarathonCommand=diffuse,Color("Orange");diffusebottomedge,Color("Red"); -# -ShowSortOrderFrame=true -SortOrderFrameX=SCREEN_CENTER_X+128+32 -SortOrderFrameY=SCREEN_TOP+24 -SortOrderFrameOnCommand=draworder,105;shadowlength,1 -SortOrderFrameSortCommand= -SortOrderFrameSongChosenCommand=linear,0.25;diffusealpha,0; -SortOrderFrameOffCommand=bouncebegin,0.15;zoomy,0; -# -ShowSortOrder=true -SortOrderX=SCREEN_CENTER_X+128+32-48+4 -SortOrderY=SCREEN_TOP+24 -SortOrderOnCommand=draworder,105;horizalign,left;strokecolor,Color("Outline");zoom,0.675;maxwidth,114/0.675; -SortOrderSortCommand=finishtweening;zoom,0.675*1.25;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");decelerate,0.5;zoom,0.675;diffuse,Color("White"); -SortOrderSongChosenCommand=linear,0.25;diffusealpha,0; -SortOrderOffCommand=bouncebegin,0.15;zoomy,0; -# -ShowStageDisplay=true -StageDisplayX=SCREEN_CENTER_X-160-64 -StageDisplayY=SCREEN_TOP+160-96+4 -StageDisplayOnCommand=draworder,105;fov,90;zoom,0.75;zoomy,0;sleep,0.35;smooth,0.35;zoomy,0.75 -StageDisplayOffCommand=linear,0.25;zoomy,0; -# -ShowDifficultyDisplay=not GetGamePrefB("AutoSetStyle") and not GAMESTATE:IsCourseMode() -# ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode() -DifficultyDisplayX=SCREEN_CENTER_X-160+64 -DifficultyDisplayY=SCREEN_TOP+160-96+4 -DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1 -DifficultyDisplayOffCommand=linear,0.25;zoomy,0; -# -BannerX=SCREEN_CENTER_X-160 -BannerY=SCREEN_TOP+160-36 -BannerOnCommand=draworder,-1;scaletoclipped,256,80;visible,true;ztest,1;addy,-SCREEN_CENTER_Y;decelerate,0.35;addy,SCREEN_CENTER_Y -BannerOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowBannerFrame=true -BannerFrameX=SCREEN_CENTER_X-160 -BannerFrameY=SCREEN_TOP+160-36 -BannerFrameOnCommand=draworder,105;addy,-SCREEN_CENTER_Y;decelerate,0.35;addy,SCREEN_CENTER_Y -BannerFrameOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowBPMDisplay=true -BPMDisplayX=SCREEN_CENTER_X-160-90+2 -BPMDisplayY=SCREEN_TOP+160+(36/2)+8 -BPMDisplayOnCommand=finishtweening;maxwidth,128;horizalign,left;strokecolor,Color("Outline");addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1 -BPMDisplayOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowBPMLabel=true -BPMLabelX=SCREEN_CENTER_X-160-90 -BPMLabelY=SCREEN_TOP+160+(36/2)+6 -BPMLabelOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X -BPMLabelOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowDifficultyList=not GAMESTATE:IsCourseMode(); -DifficultyListX=SCREEN_CENTER_X-160 -DifficultyListY=SCREEN_TOP+216 -DifficultyListOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X; -DifficultyListOffCommand=bouncebegin,0.15;zoomx,0; -# -DifficultyListTweenOnCommand=stoptweening;bounceend,0.135;zoomx,1 -DifficultyListTweenOffCommand=stoptweening;bouncebegin,0.135;zoomx,0 -# Shrink the difficultylist for viewing panedisplays; -# DifficultyListSelectMenuOpenedMessageCommand=stoptweening;decelerate,0.125;zoom,0.5; -# DifficultyListSelectMenuClosedMessageCommand=stoptweening;accelerate,0.0725;zoom,1; -# -ShowPaneDisplayFrameP1=true -PaneDisplayFrameP1X=SCREEN_CENTER_X-160 -PaneDisplayFrameP1Y=SCREEN_BOTTOM-112-2 -PaneDisplayFrameP1OnCommand=player,PLAYER_1;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 -PaneDisplayFrameP1OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowPaneDisplayTextP1=true -PaneDisplayTextP1X=SCREEN_CENTER_X-160 -PaneDisplayTextP1Y=SCREEN_BOTTOM-122-2 -PaneDisplayTextP1OnCommand=player,PLAYER_1;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 -PaneDisplayTextP1OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowPaneDisplayFrameP2=true -PaneDisplayFrameP2X=SCREEN_CENTER_X+160 -PaneDisplayFrameP2Y=SCREEN_BOTTOM-112-2 -PaneDisplayFrameP2OnCommand=player,PLAYER_2;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 -PaneDisplayFrameP2OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowPaneDisplayTextP2=true -PaneDisplayTextP2X=SCREEN_CENTER_X+160 -PaneDisplayTextP2Y=SCREEN_BOTTOM-122-2 -PaneDisplayTextP2OnCommand=player,PLAYER_2;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 -PaneDisplayTextP2OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowCourseContentsList=false -CourseContentsListX=SCREEN_CENTER_X-160 -CourseContentsListY=SCREEN_TOP+216+6 -CourseContentsListOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X -CourseContentsListOffCommand=bouncebegin,0.15;zoomx,0; -# -ShowNumCourseSongs=GAMESTATE:IsCourseMode() -NumCourseSongsX=SCREEN_CENTER_X-160+128 -NumCourseSongsY=SCREEN_TOP+160+(36/2)+8 -NumCourseSongsOnCommand=zoom,0.75;strokecolor,Color("Outline");shadowlength,1 -NumCourseSongsOffCommand=bouncebegin,0.15;zoom,0;diffusealpha,0; -# -ShowSongOptions=true -SongOptionsX=SCREEN_CENTER_X -SongOptionsY=SCREEN_CENTER_Y -SongOptionsOnCommand=visible,false;draworder,1000 -SongOptionsOffCommand= -#-- -SongOptionsShowCommand=visible,true;zoom,1.2;settext,"PRESS &START; FOR OPTIONS";decelerate,0.3;zoom,1; -SongOptionsEnterCommand=settext,"ENTERING OPTIONS";sleep,0.5;linear,0.3;zoomy,0; -SongOptionsHideCommand=linear,0.3;zoomy,0; -# -ShowSongOptionsFrame=true -SongOptionsFrameX=SCREEN_CENTER_X -SongOptionsFrameY=SCREEN_CENTER_Y -SongOptionsFrameOnCommand=visible,false;draworder,1000 -SongOptionsFrameOffCommand= -#-- -SongOptionsFrameShowCommand=visible,true;diffuse,Color("Orange");diffusealpha,0.5;zoomy,40*1.5;linear,1.5;zoomy,40; -SongOptionsFrameEnterCommand=sleep,0.5;linear,0.3;diffusealpha,0; -SongOptionsFrameHideCommand=linear,0.3;diffusealpha,0 -# -CDTitleX=SCREEN_CENTER_X-160+90 -CDTitleY=SCREEN_TOP+160+(36/2)+8 -CDTitleFrontCommand=diffuse,color('0.5,0.5,0.5,1');cullmode,'CullMode_Front' -CDTitleBackCommand=cullmode,'CullMode_Back' -CDTitleOnCommand=draworder,106;shadowlength,1;zoom,0.75;diffusealpha,1;zoom,0;bounceend,0.35;zoom,0.75;spin;effectmagnitude,0,180,0; -CDTitleOffCommand=bouncebegin,0.15;zoomx,0; -# -ScoreFrameP1X= -ScoreFrameP1Y= -ScoreFrameP1OnCommand=visible,false -ScoreFrameP1OffCommand= -ScoreP1X= -ScoreP1Y= -ScoreP1OnCommand=visible,false -ScoreP1OffCommand= -# -ScoreP2X= -ScoreP2Y= -ScoreP2OnCommand=visible,false -ScoreP2OffCommand= -ScoreFrameP2X= -ScoreFrameP2Y= -ScoreFrameP2OnCommand=visible,false -ScoreFrameP2OffCommand= -# -ScoreP1SortChangeCommand=stoptweening; -ScoreP2SortChangeCommand=stoptweening; -ScoreFrameP1SortChangeCommand=stoptweening; -ScoreFrameP2SortChangeCommand=stoptweening; -# -ShowStepsDisplayP1=GAMESTATE:IsHumanPlayer(PLAYER_1) -StepsDisplayP1X=SCREEN_CENTER_X-160 -StepsDisplayP1Y=SCREEN_BOTTOM-60 -StepsDisplayP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -StepsDisplayP1OffCommand=bouncebegin,0.15;zoomx,0; -# StepsDisplayP1CurrentStepsP1ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1 -# -ShowStepsDisplayP2=GAMESTATE:IsHumanPlayer(PLAYER_2) -StepsDisplayP2X=SCREEN_CENTER_X+160 -StepsDisplayP2Y=SCREEN_BOTTOM-60 -StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0; -# StepsDisplayP2CurrentStepsP2ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1 -# -ShowPercentScoreP1=true -PercentScoreP1X=SCREEN_CENTER_X-80-1 -PercentScoreP1Y=SCREEN_BOTTOM-60 -PercentScoreP1OnCommand=player,PLAYER_1;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowPercentScoreP2=true -PercentScoreP2X=SCREEN_CENTER_X+240-1 -PercentScoreP2Y=SCREEN_BOTTOM-60 -PercentScoreP2OnCommand=player,PLAYER_2;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0; -[ScreenSelectCourse] -#~ ScreenInitCommand=%function(self) \ - #~ GAMESTATE:ApplyGameCommand("sort,AllCourses",PLAYER_1); \ - #~ GAMESTATE:ApplyGameCommand("sort,AllCourses",PLAYER_2); \ -#~ end; -# -DefaultSort="Nonstop" -# -ShowDifficultyList=false -ShowCourseContentsList=true -ShowNumCourseSongs=true -# -UsePlayerSelectMenu=false -SelectMenuAvailable=false -# -ShowPaneDisplayFrameP1=false -ShowPaneDisplayTextP1=false -ShowPaneDisplayFrameP2=false -ShowPaneDisplayTextP2=false -[ScreenNetSelectMusic] -StepsDisplayP1X=SCREEN_CENTER_X-240 -StepsDisplayP1Y=SCREEN_CENTER_Y+185 -StepsDisplayP1OnCommand=horizalign,right;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -StepsDisplayP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -#--# -StepsDisplayP2X=SCREEN_CENTER_X-110 -StepsDisplayP2Y=SCREEN_CENTER_Y+185 -StepsDisplayP2OnCommand=horizalign,right;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 -StepsDisplayP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 -#====# -BPMDisplayX=SCREEN_CENTER_X-160-90+2 -BPMDisplayY=SCREEN_CENTER_Y+156 -BPMDisplayOnCommand=finishtweening;horizalign,left;strokecolor,Color("Outline");maxwidth,128;addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1 -BPMDisplayOffCommand=bouncebegin,0.15;zoomx,0; -#--# -ShowBPMLabel=true -BPMLabelX=SCREEN_CENTER_X-160-90 -BPMLabelY=SCREEN_CENTER_Y+156 -BPMLabelOnCommand=horizalign,right;zoom,0.75;strokecolor,Color("Outline");addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X -BPMLabelOffCommand=bouncebegin,0.15;zoomx,0; - -UsersX=SCREEN_CENTER_X-272 -UsersY=SCREEN_CENTER_Y-172 -UsersDX=40 -UsersAY=16 -UsersOnCommand=draworder,2;zoom,0.75;shadowlength,1 -# -ShowDifficultyDisplay=true -DifficultyDisplayX=SCREEN_CENTER_X-240+200 -DifficultyDisplayY=SCREEN_CENTER_Y+185 -DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1 -DifficultyDisplayOffCommand=linear,0.25;zoomy,0; -[ScreenPlayerOptions] -LineNames=GetDefaultOptionLines() -#~ LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" -Line1="lua,SpeedMods()" -#~ Line1="list,Speed" -Line2="list,Accel" -Line3="list,Effect" -Line4="list,Appearance" -Line5="list,Turn" -Line6="list,Insert" -LineR="list,Remove" -Line7="list,Scroll" -Line8="list,NoteSkins" -Line9="list,Holds" -Line10="list,Mines" -Line11="list,Attacks" -Line12="list,PlayerAutoPlay" -Line13="list,Hide" -Line14="list,Persp" -Line15="list,ScoreDisplay" -Line16="list,Steps" -Line17="lua,OptionRowProTiming()" -Line18="list,Characters" -[ScreenEditOptions] -Line1="lua,SpeedMods()" - -[ScreenStageInformation] -ForceTimer=true -TimerOnCommand=visible,false -TimerSeconds=3 -# -WaitForChildrenBeforeTweening=true -[ScreenGameplay] -ShowLifeMeterForDisabledPlayers=false -# -SongMeterDisplayX=SCREEN_CENTER_X -SongMeterDisplayY=SCREEN_TOP+50 -SongMeterDisplayOnCommand=draworder,50;zoom,0;y,SCREEN_TOP-24;sleep,1.5;decelerate,0.5;zoom,1;y,SCREEN_TOP+50 -SongMeterDisplayOffCommand= -# -ShowSongTitle=true -SongTitleX=SCREEN_CENTER_X -SongTitleY=SCREEN_TOP+50+12 -SongTitleOnCommand=draworder,55;shadowlength,1;basezoom,0.5;zoomy,0;sleep,1.5+0.5;smooth,0.5;zoom,1 -SongTitleOffCommand= -# -SongMeterDisplayP1X=SCREEN_LEFT+16 -SongMeterDisplayP1Y=SCREEN_CENTER_Y -SongMeterDisplayP1OnCommand=rotationz,-90;zoom,0;addx,-24;sleep,1.5;decelerate,0.5;zoom,1;addx,24 -SongMeterDisplayP1OffCommand= -# -SongMeterDisplayP2X=SCREEN_RIGHT-16 -SongMeterDisplayP2Y=SCREEN_CENTER_Y -SongMeterDisplayP2OnCommand=rotationz,-90;zoom,0;addx,24;sleep,1.5;decelerate,0.5;zoom,1;addx,-24 -SongMeterDisplayP2OffCommand= -# -ShowBPMDisplay=true -BPMDisplayX=Center1Player() and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X -# BPMDisplayX=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X -BPMDisplayY=SCREEN_BOTTOM-16 -# BPMDisplayOnCommand=zoom,0.5; -BPMDisplayOffCommand=bounceend,0.25;zoom,0 -# -ShowStageDisplay=false -StageDisplayX=SCREEN_CENTER_X -StageDisplayY=SCREEN_TOP+24 -StageDisplayOnCommand=zoom,0.5; -StageDisplayOffCommand=bounceend,0.25;zoom,0 -# -ShowScoreFrame=GetUserPrefB("GameplayFooter"); -ScoreFrameX=SCREEN_CENTER_X -ScoreFrameY=SCREEN_BOTTOM+4 -ScoreFrameOnCommand=vertalign,bottom;zoomtowidth,SCREEN_WIDTH+4;diffuse,color("#ffd400");addy,80;sleep,2;decelerate,0.5;addy,-80; -ScoreFrameOffCommand= -# -LifeP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# LifeP1X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -LifeP1Y=SCREEN_TOP+24 -LifeP1OnCommand=finishtweening;addy,-48;sleep,1.25;bounceend,0.35;addy,48; -#~ LifeP1OnCommand=addx,-SCREEN_CENTER_X;sleep,1.25;decelerate,0.35*0.25;addx,SCREEN_CENTER_X*1.5;accelerate,0.35*0.25;addx,-SCREEN_CENTER_X*0.25;bounceend,0.35*0.25;addx,-SCREEN_CENTER_X*0.25 -LifeP1OffCommand= -LifeP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# LifeP2X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -LifeP2Y=SCREEN_TOP+24 -LifeP2OnCommand=finishtweening;zoomx,-1;addy,-48;sleep,1.25;bounceend,0.35;addy,48; -#~ LifeP2OnCommand=zoomx,-1;addx,SCREEN_CENTER_X;sleep,1.25;decelerate,0.35*0.25;addx,-SCREEN_CENTER_X*1.5;accelerate,0.35*0.25;addx,SCREEN_CENTER_X*0.25;bounceend,0.35*0.25;addx,SCREEN_CENTER_X*0.25 -LifeP2OffCommand= -CombinedLifeX=SCREEN_CENTER_X -CombinedLifeY=SCREEN_TOP+24 -CombinedLifeOnCommand=finishtweening;diffuseleftedge,PlayerColor(PLAYER_1);diffuserightedge,PlayerColor(PLAYER_2);addy,-48;sleep,1.25;bounceend,0.35;addy,48; -CombinedLifeOffCommand= -# -ToastyDisplayP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# ToastyDisplayP1X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ToastyDisplayP1Y=SCREEN_CENTER_Y -ToastyDisplayP1OnCommand=visible,false -ToastyDisplayP1OffCommand= -# -ToastyDisplayP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# ToastyDisplayP2X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -ToastyDisplayP2Y=SCREEN_CENTER_Y -ToastyDisplayP2OnCommand=visible,false -ToastyDisplayP2OffCommand= -# -SongNumberP1X=Center1Player() and SCREEN_CENTER_X - 60 or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") - 60 -SongNumberP1Y=SCREEN_TOP+24+7 -SongNumberP1OnCommand=zoom,0.75;diffuse,PlayerColor(PLAYER_1);strokecolor,BoostColor(PlayerColor(PLAYER_1),0.5) -SongNumberP1OffCommand= -SongNumberP2X=Center1Player() and SCREEN_CENTER_X + 60 or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 60 -SongNumberP2Y=SCREEN_TOP+24+7 -SongNumberP2OnCommand=zoom,0.75;diffuse,PlayerColor(PLAYER_2);strokecolor,BoostColor(PlayerColor(PLAYER_2),0.5) -SongNumberP2OffCommand= -# -RemainingTimeP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") + 32 -RemainingTimeP1Y=THEME:GetMetric(Var "LoadingScreen","ScoreP1Y") - 22 -RemainingTimeP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);diffusebottomedge,ColorMidTone(PlayerColor(PLAYER_1)); -RemainingTimeP1OffCommand= -RemainingTimeP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 32 -RemainingTimeP2Y=THEME:GetMetric(Var "LoadingScreen","ScoreP2Y") - 22 -RemainingTimeP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);diffusebottomedge,ColorMidTone(PlayerColor(PLAYER_2)); -RemainingTimeP2OffCommand= -# -DeltaSecondsP1X=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP1X") - 80 -DeltaSecondsP1Y=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP1Y") -DeltaSecondsP1OnCommand=shadowlength,1;skewx,-0.125 -DeltaSecondsP1GainSecondsCommand=finishtweening;diffusealpha,1;zoom,1;decelerate,0.3;zoom,0.75;sleep,0.5;linear,0.2;diffusealpha,0;zoom,0 -DeltaSecondsP1OffCommand= -DeltaSecondsP2X=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP2X") - 80 -DeltaSecondsP2Y=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP2Y") -DeltaSecondsP2OnCommand=shadowlength,1;skewx,-0.125 -DeltaSecondsP2GainSecondsCommand=finishtweening;diffusealpha,1;zoom,1;decelerate,0.3;zoom,0.75;sleep,0.5;linear,0.2;diffusealpha,0;zoom,0 -DeltaSecondsP2OffCommand= -# -ScoreP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# ScoreP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ScoreP1Y=SCREEN_BOTTOM-28 -ScoreP1OnCommand=visible,GetUserPrefB("UserPrefGameplayShowScore");diffuse,PlayerColor(PLAYER_1);sleep,3+0.3;smooth,0.5;y,SCREEN_BOTTOM-50 -ScoreP1OffCommand= -ScoreP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# ScoreP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -ScoreP2Y=SCREEN_BOTTOM-28 -ScoreP2OnCommand=visible,GetUserPrefB("UserPrefGameplayShowScore");diffuse,PlayerColor(PLAYER_2);sleep,3+0.3;smooth,0.5;y,SCREEN_BOTTOM-50 -ScoreP2OffCommand= -# -StepsDescriptionP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# StepsDescriptionP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -StepsDescriptionP1Y=SCREEN_CENTER_Y-24 -StepsDescriptionP1OnCommand=zoom,0.5;diffusealpha,0;addy,-10;smooth,0.3;diffusealpha,1;addy,10;sleep,3;smooth,0.5;addy,-10;diffusealpha,0 -StepsDescriptionP1OffCommand= -StepsDescriptionP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# StepsDescriptionP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -StepsDescriptionP2Y=SCREEN_CENTER_Y-24 -StepsDescriptionP2OnCommand=zoom,0.5;diffusealpha,0;addy,-10;smooth,0.3;diffusealpha,1;addy,10;sleep,3;smooth,0.5;addy,-10;diffusealpha,0 -StepsDescriptionP2OffCommand= -# -PlayerOptionsP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# PlayerOptionsP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -PlayerOptionsP1Y=SCREEN_CENTER_Y+24 -PlayerOptionsP1OnCommand=vertalign,top;wrapwidthpixels,256*2;zoom,0.5;diffusealpha,0;addy,10;smooth,0.3;diffusealpha,1;addy,-10;sleep,3;smooth,0.5;addy,10;diffusealpha,0 -PlayerOptionsP1OffCommand= -PlayerOptionsP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# PlayerOptionsP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -PlayerOptionsP2Y=SCREEN_CENTER_Y+24 -PlayerOptionsP2OnCommand=vertalign,top;wrapwidthpixels,256*2;zoom,0.5;diffusealpha,0;addy,10;smooth,0.3;diffusealpha,1;addy,-10;sleep,3;smooth,0.5;addy,10;diffusealpha,0 -PlayerOptionsP2OffCommand= -# -StepsDisplayP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -# StepsDisplayP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -StepsDisplayP1Y=SCREEN_CENTER_Y -StepsDisplayP1OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;queuecommand,( GetUserPrefB("UserPrefGameplayShowStepsDisplay") == true and "Show" or "Hide" ); -StepsDisplayP1ShowCommand=smooth,0.5;y,SCREEN_BOTTOM-20; -StepsDisplayP1HideCommand=linear,0.5;zoomy,0 -StepsDisplayP1OffCommand= -StepsDisplayP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -# StepsDisplayP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") -StepsDisplayP2Y=SCREEN_CENTER_Y -StepsDisplayP2OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;queuecommand,( GetUserPrefB("UserPrefGameplayShowStepsDisplay") == true and "Show" or "Hide" ); -StepsDisplayP2ShowCommand=smooth,0.5;y,SCREEN_BOTTOM-20; -StepsDisplayP2HideCommand=linear,0.5;zoomy,0 -StepsDisplayP2OffCommand= -# -SongOptionsX=Center1Player() and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X -# SongOptionsX=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X -SongOptionsY=SCREEN_BOTTOM-32 -SongOptionsOnCommand=zoom,0.5 -SongOptionsOffCommand= -# -OniGameOverP1X= -OniGameOverP1Y= -OniGameOverP1OnCommand= -OniGameOverP1OffCommand= -# -OniGameOverP2X= -OniGameOverP2Y= -OniGameOverP2OnCommand= -OniGameOverP2OffCommand= -# -SurviveTimeX=SCREEN_CENTER_X -SurviveTimeY=SCREEN_CENTER_Y+40 -SurviveTimeOnCommand=shadowlength,1;zoomx,0;bounceend,1;zoomx,1 -SurviveTimeOffCommand=shadowlength,1;linear,1;zoom,0.75;diffusealpha,0 -# -ActiveAttackListP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ActiveAttackListP1Y= -ActiveAttackListP1OnCommand=visible,false -ActiveAttackListP1OffCommand= -ActiveAttackListP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -ActiveAttackListP2Y= -ActiveAttackListP2OnCommand=visible,false -ActiveAttackListP2OffCommand= -# -LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+160 -LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-140 -# This is used if one player is in reverse and the other isn't. -LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-160; -LyricDisplayDefaultColor=Color("White") - -[ScreenGameplaySyncMachine] -SongMeterDisplayP1OnCommand=visible,false -SongMeterDisplayP2OnCommand=visible,false -StepsDescriptionP1OnCommand=visible,false -StepsDescriptionP2OnCommand=visible,false -StepsDisplayP1OnCommand=visible,false -StepsDisplayP2OnCommand=visible,false -PlayerOptionsP1OnCommand=visible,false -PlayerOptionsP2OnCommand=visible,false - -[ScreenEvaluation] -Class="ScreenEvaluation" -Fallback="ScreenWithMenuElements" -# -StageDisplayNumberOffset=0 -# -NextScreen=Branches.AfterEvaluation() -PrevScreen=Branches.AfterEvaluation() -# -PlayMusic=false -# -PrepareScreens="ScreenProfileSave,ScreenSelectMusic" -PersistScreens="ScreenEvaluation,ScreenProfileSave,ScreenSelectMusic" -# -ShowJudgmentLineW1=true -ShowJudgmentLineW2=true -ShowJudgmentLineW3=true -ShowJudgmentLineW4=true -ShowJudgmentLineW5=true -ShowJudgmentLineHeld=true -ShowJudgmentLineMiss=true -ShowJudgmentLineMaxCombo=true -ShowGradeArea=true -ShowScoreArea=true -ShowPointsArea=true -ShowSharedJudgmentLineLabels=true -ShowGraphDisplay=true -ShowComboGraph=true -ShowStepsDisplay=true - -# -W1NumberP1X=SCREEN_CENTER_X-160+40 -W1NumberP1Y=SCREEN_TOP+160 -W1NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -W1NumberP1OffCommand= -W1NumberP2X=SCREEN_CENTER_X+160-40 -W1NumberP2Y=SCREEN_TOP+160 -W1NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -W1NumberP2OffCommand= -W1LabelX=SCREEN_CENTER_X -W1LabelY=SCREEN_TOP+160 -W1LabelOnCommand= -W1LabelOffCommand= -# -W2NumberP1X=SCREEN_CENTER_X-160+40 -W2NumberP1Y=SCREEN_TOP+180 -W2NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -W2NumberP1OffCommand= -W2NumberP2X=SCREEN_CENTER_X+160-40 -W2NumberP2Y=SCREEN_TOP+180 -W2NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -W2NumberP2OffCommand= -W2LabelX=SCREEN_CENTER_X -W2LabelY=SCREEN_TOP+180 -W2LabelOnCommand= -W2LabelOffCommand= -# -W3NumberP1X=SCREEN_CENTER_X-160+40 -W3NumberP1Y=SCREEN_TOP+200 -W3NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -W3NumberP1OffCommand= -W3NumberP2X=SCREEN_CENTER_X+160-40 -W3NumberP2Y=SCREEN_TOP+200 -W3NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -W3NumberP2OffCommand= -W3LabelX=SCREEN_CENTER_X -W3LabelY=SCREEN_TOP+200 -W3LabelOnCommand= -W3LabelOffCommand= -# -W4NumberP1X=SCREEN_CENTER_X-160+40 -W4NumberP1Y=SCREEN_TOP+220 -W4NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -W4NumberP1OffCommand= -W4NumberP2X=SCREEN_CENTER_X+160-40 -W4NumberP2Y=SCREEN_TOP+220 -W4NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -W4NumberP2OffCommand= -W4LabelX=SCREEN_CENTER_X -W4LabelY=SCREEN_TOP+220 -W4LabelOnCommand= -W4LabelOffCommand= -# -W5NumberP1X=SCREEN_CENTER_X-160+40 -W5NumberP1Y=SCREEN_TOP+240 -W5NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -W5NumberP1OffCommand= -W5NumberP2X=SCREEN_CENTER_X+160-40 -W5NumberP2Y=SCREEN_TOP+240 -W5NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -W5NumberP2OffCommand= -W5LabelX=SCREEN_CENTER_X -W5LabelY=SCREEN_TOP+240 -W5LabelOnCommand= -W5LabelOffCommand= -# -MissNumberP1X=SCREEN_CENTER_X-160+40 -MissNumberP1Y=SCREEN_TOP+260 -MissNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -MissNumberP1OffCommand= -MissNumberP2X=SCREEN_CENTER_X+160-40 -MissNumberP2Y=SCREEN_TOP+260 -MissNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -MissNumberP2OffCommand= -MissLabelX=SCREEN_CENTER_X -MissLabelY=SCREEN_TOP+260 -MissLabelOnCommand= -MissLabelOffCommand= -# -HeldNumberP1X=SCREEN_CENTER_X-160+40 -HeldNumberP1Y=SCREEN_TOP+280 -HeldNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -HeldNumberP1OffCommand= -HeldNumberP2X=SCREEN_CENTER_X+160-40 -HeldNumberP2Y=SCREEN_TOP+280 -HeldNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -HeldNumberP2OffCommand= -HeldLabelX=SCREEN_CENTER_X -HeldLabelY=SCREEN_TOP+280 -HeldLabelOnCommand= -HeldLabelOffCommand= -# -MaxComboNumberP1X=SCREEN_CENTER_X-160+40 -MaxComboNumberP1Y=SCREEN_TOP+300 -MaxComboNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 -MaxComboNumberP1OffCommand= -MaxComboNumberP2X=SCREEN_CENTER_X+160-40 -MaxComboNumberP2Y=SCREEN_TOP+300 -MaxComboNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 -MaxComboNumberP2OffCommand= -MaxComboLabelX=SCREEN_CENTER_X -MaxComboLabelY=SCREEN_TOP+300 -MaxComboLabelOnCommand= -MaxComboLabelOffCommand= -# -ScoreLabelX=SCREEN_CENTER_X -ScoreLabelY=SCREEN_TOP+330 -ScoreLabelOnCommand= -ScoreLabelOffCommand= -# -ScoreNumberP1X=SCREEN_CENTER_X-160 -ScoreNumberP1Y=SCREEN_TOP+320 -ScoreNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1;zoom,0.775 -ScoreNumberP1OffCommand= -ScoreNumberP2X=SCREEN_CENTER_X+160 -ScoreNumberP2Y=SCREEN_TOP+320 -ScoreNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1;zoom,0.775 -ScoreNumberP2OffCommand= -# -PercentFrameP1X=SCREEN_CENTER_X-160 -PercentFrameP1Y=SCREEN_TOP+320 -PercentFrameP1OnCommand=visible,false -PercentFrameP1OffCommand= -# -PercentFrameP2X=SCREEN_CENTER_X+160 -PercentFrameP2Y=SCREEN_TOP+320 -PercentFrameP2OnCommand=visible,false -PercentFrameP2OffCommand= -# -PercentP1X=SCREEN_CENTER_X-160 -PercentP1Y=SCREEN_TOP+320 -PercentP1OnCommand=visible,false -PercentP1OffCommand= -# -PercentP2X=SCREEN_CENTER_X+160 -PercentP2Y=SCREEN_TOP+320 -PercentP2OnCommand=visible,false -PercentP2OffCommand= -# -LargeBannerX=SCREEN_CENTER_X -LargeBannerY=SCREEN_TOP+100 -LargeBannerOnCommand= -LargeBannerOffCommand= -LargeBannerFrameX=SCREEN_CENTER_X -LargeBannerFrameY=SCREEN_TOP+100 -LargeBannerFrameOnCommand= -LargeBannerFrameOffCommand= -# -GradeFrameP1X=SCREEN_CENTER_X-220 -GradeFrameP1Y=SCREEN_TOP+80 -GradeFrameP1OnCommand= -GradeFrameP1OffCommand= -GradeFrameP2X=SCREEN_CENTER_X+220 -GradeFrameP2Y=SCREEN_TOP+80 -GradeFrameP2OnCommand= -GradeFrameP2OffCommand= -# -GradeP1X=SCREEN_CENTER_X-220 -GradeP1Y=SCREEN_TOP+100 -GradeP1OnCommand= -GradeP1OffCommand= -GradeP2X=SCREEN_CENTER_X+220 -GradeP2Y=SCREEN_TOP+100 -GradeP2OnCommand= -GradeP2OffCommand= -# -PlayerOptionsP1X=SCREEN_CENTER_X-160 -PlayerOptionsP1Y=SCREEN_TOP+352 -PlayerOptionsP1OnCommand=zoom,0.5;shadowlength,1 -PlayerOptionsP1OffCommand= -## -PlayerOptionsP2X=SCREEN_CENTER_X+160 -PlayerOptionsP2Y=SCREEN_TOP+352 -PlayerOptionsP2OnCommand=zoom,0.5;shadowlength,1 -PlayerOptionsP2OffCommand= -# -SongOptionsX=SCREEN_CENTER_X -SongOptionsY=SCREEN_BOTTOM-104 -SongOptionsOnCommand=zoom,0.5;shadowlength,1; -SongOptionsOffCommand= -# -DisqualifiedP1X=SCREEN_CENTER_X-220 -DisqualifiedP1Y=SCREEN_TOP+140 -DisqualifiedP1OnCommand= -DisqualifiedP1OffCommand= -DisqualifiedP2X=SCREEN_CENTER_X+220 -DisqualifiedP2Y=SCREEN_TOP+140 -DisqualifiedP2OnCommand= -DisqualifiedP2OffCommand= -# -GraphDisplayP1X=SCREEN_CENTER_X-160 -GraphDisplayP1Y=SCREEN_BOTTOM-100 -GraphDisplayP1OnCommand= -GraphDisplayP1OffCommand= -GraphDisplayP2X=SCREEN_CENTER_X+160 -GraphDisplayP2Y=SCREEN_BOTTOM-100 -GraphDisplayP2OnCommand= -GraphDisplayP2OffCommand= -# -ComboGraphP1X=SCREEN_CENTER_X-160 -ComboGraphP1Y=SCREEN_BOTTOM-100+32-7 -ComboGraphP1OnCommand= -ComboGraphP1OffCommand= -ComboGraphP2X=SCREEN_CENTER_X+160 -ComboGraphP2Y=SCREEN_BOTTOM-100+32-7 -ComboGraphP2OnCommand= -ComboGraphP2OffCommand= -# -MachineRecordP1X=SCREEN_CENTER_X-220 -#MachineRecordP1Y=SCREEN_BOTTOM-156 - -MachineRecordP1Y=SCREEN_TOP+146 -MachineRecordP1OnCommand= -MachineRecordP1OffCommand= -# -MachineRecordP2X=SCREEN_CENTER_X+220 -#MachineRecordP2Y=SCREEN_BOTTOM-156 -MachineRecordP2Y=SCREEN_TOP+146 -MachineRecordP2OnCommand= -MachineRecordP2OffCommand= -# -PersonalRecordP1X=SCREEN_CENTER_X-160 -PersonalRecordP1Y=SCREEN_BOTTOM-144 -PersonalRecordP1OnCommand= -PersonalRecordP1OffCommand= -# -PersonalRecordP2X=SCREEN_CENTER_X+160 -PersonalRecordP2Y=SCREEN_BOTTOM-144 -PersonalRecordP2OnCommand= -PersonalRecordP2OffCommand= -# -StageAwardP1X=SCREEN_CENTER_X-220 -StageAwardP1Y=SCREEN_TOP+130 -StageAwardP1OnCommand=draworder,105;zoom,0.75;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");strokecolor,ColorDarkTone( Color("Orange") );glowshift;textglowmode,'TextGlowMode_Inner' -StageAwardP1OffCommand= -# -StageAwardP2X=SCREEN_CENTER_X+220 -StageAwardP2Y=SCREEN_TOP+130 -StageAwardP2OnCommand=draworder,105;zoom,0.75;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");strokecolor,ColorDarkTone( Color("Orange") );glowshift;textglowmode,'TextGlowMode_Inner' -StageAwardP2OffCommand= -# -PeakComboAwardP1X=SCREEN_CENTER_X-160 -PeakComboAwardP1Y=SCREEN_TOP+300+10 -PeakComboAwardP1OnCommand=draworder,105;zoom,0.5;diffusebottomedge,Color("Blue");strokecolor,ColorDarkTone( Color("Blue") );glowshift;textglowmode,'TextGlowMode_Inner' -PeakComboAwardP1OffCommand= -# -PeakComboAwardP2X=SCREEN_CENTER_X+160 -PeakComboAwardP2Y=SCREEN_TOP+300+10 -PeakComboAwardP2OnCommand=draworder,105;zoom,0.5;diffusebottomedge,Color("Blue");strokecolor,ColorDarkTone( Color("Blue") );glowshift;textglowmode,'TextGlowMode_Inner' -PeakComboAwardP2OffCommand= -# -ShowStepsDisplayP1=GAMESTATE:IsHumanPlayer(PLAYER_1) -StepsDisplayP1X=SCREEN_CENTER_X-160 -StepsDisplayP1Y=SCREEN_BOTTOM-50 -StepsDisplayP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -StepsDisplayP1OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowStepsDisplayP2=GAMESTATE:IsHumanPlayer(PLAYER_2) -StepsDisplayP2X=SCREEN_CENTER_X+160 -StepsDisplayP2Y=SCREEN_BOTTOM-50 -StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y -StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0; -# -PercentScoreP1X=SCREEN_CENTER_X-82 -PercentScoreP1Y=SCREEN_BOTTOM-50 -PercentScoreP1OnCommand=draworder,100;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y; -PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0; -# -PercentScoreP2X=SCREEN_CENTER_X+238 -PercentScoreP2Y=SCREEN_BOTTOM-50 -PercentScoreP2OnCommand=draworder,100;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y; -PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0; -# -ShowGameType=true -GameTypeX=SCREEN_CENTER_X -GameTypeY=SCREEN_BOTTOM-48 -GameTypeOnCommand=addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y;zoom,0.675;shadowlength,1;shadowcolor,color("#22222266") -GameTypeOffCommand=bouncebegin,0.15;addy,SCREEN_CENTER_Y; -# -ShowTimingDifficulty=true -TimingDifficultyX=SCREEN_CENTER_X -TimingDifficultyY=SCREEN_TOP+16 -TimingDifficultyOnCommand=zoom,0.675;draworder,105 -TimingDifficultyOffCommand= -# -ShowLifeDifficulty=true -LifeDifficultyX=SCREEN_CENTER_X -LifeDifficultyY=SCREEN_TOP+32 -LifeDifficultyOnCommand=zoom,0.675;draworder,105 -LifeDifficultyOffCommand= -# -ShowSongInformation=true -SongInformationX=SCREEN_CENTER_X -SongInformationY=SCREEN_TOP+100 -SongInformationOnCommand=playcommand,"Set";draworder,105 -SongInformationOffCommand= -[ScreenEvaluationNormal] -Fallback="ScreenEvaluation" -# -PlayMusic=false -# -ShowBannerFrame=false -# -ShowStageDisplay=true -StageDisplayX=SCREEN_CENTER_X+160 -StageDisplayY=SCREEN_TOP+28 -StageDisplayOnCommand=draworder,105;fov,90;vertalign,bottom;vanishpoint,SCREEN_CENTER_X+160,SCREEN_TOP+28;rotationy,90;decelerate,0.5;rotationy,0; -StageDisplayOffCommand= - -[ScreenEvaluationSummary] -Fallback="ScreenEvaluation" -# -NextScreen=Branch.AfterSummary -# -PlayMusic=false -# -Summary=true -# -ShowStageDisplay=false -# -SmallBanner1X=SCREEN_CENTER_X-72 -SmallBanner1Y=SCREEN_TOP+100-24 -SmallBanner1OnCommand=zoom,0.5 -SmallBanner1OffCommand= - -SmallBanner2X=SCREEN_CENTER_X-48 -SmallBanner2Y=SCREEN_TOP+100-16 -SmallBanner2OnCommand=zoom,0.5 -SmallBanner2OffCommand= - -SmallBanner3X=SCREEN_CENTER_X-24 -SmallBanner3Y=SCREEN_TOP+100-8 -SmallBanner3OnCommand=zoom,0.5 -SmallBanner3OffCommand= - -SmallBanner4X=SCREEN_CENTER_X+24 -SmallBanner4Y=SCREEN_TOP+100+8 -SmallBanner4OnCommand=zoom,0.5 -SmallBanner4OffCommand= - -SmallBanner5X=SCREEN_CENTER_X+48 -SmallBanner5Y=SCREEN_TOP+100+16 -SmallBanner5OnCommand=zoom,0.5 -SmallBanner5OfCommand= - -SmallBanner6X=SCREEN_CENTER_X+72 -SmallBanner6Y=SCREEN_TOP+100+24 -SmallBanner6OnCommand=zoom,0.5 -SmallBanner6OffCommand= - -[ScreenNetEvaluation] -UserTier02OrBetterCommand=diffuseshift;effectperiod,0.75;effectcolor1,color("1,0.95,0.8,1");effectcolor2,color("0.8,0.95,1,1") - -# arcade stuff -[ScreenLogo] -TimerSeconds=10 -ShowLogo=true -LogoX=SCREEN_CENTER_X -LogoY=SCREEN_CENTER_Y-18 -LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 -LogoOffCommand=stopeffect;bouncebegin,0.35;zoom,0 - -ArcadeOverlay.TextY=SCREEN_BOTTOM-60 -# -[ScreenTitleJoin] -ShowHelp=false -HelpText=Screen.String("HelpTextTitleJoin") -HelpY=SCREEN_CENTER_Y+100 -HelpOnCommand=visible,false;zoom,1;strokecolor,color("0.125,0.125,0.125,0.5");queuecommand,"Refresh" -HelpCoinIsertedMessageCommand=playcommand,"Refresh" -HelpCoinModeChangedMessageCommand=playcommand,"Refresh" -HelpRefreshCommand=%function(self) \ - local bCanPlay = GAMESTATE:EnoughCreditsToJoin(); \ - local bReady = GAMESTATE:GetNumSidesJoined() > 0; \ - if bCanPlay or bReady then \ - self:SetTipsColonSeperated(THEME:GetString( Var "LoadingScreen","HelpTextPlay")); \ - else \ - self:SetTipsColonSeperated(THEME:GetString( Var "LoadingScreen","HelpTextWait")); \ - end \ -end; -# -LogoX=SCREEN_CENTER_X -LogoY=SCREEN_CENTER_Y-28 -LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 -LogoOffCommand=stopeffect;bouncebegin,0.35;rotationz,360;zoom,0 - -VersionInfoX=SCREEN_CENTER_X+114 -VersionInfoY=SCREEN_CENTER_Y+44 -VersionInfoOnCommand=settext,ProductVersion();horizalign,right;vertalign,bottom;bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.65;shadowlength,1;shadowcolor,color("0.2,0.2,0.2,0.925"); - -ScrollerOnCommand=visible,false; - -ArcadeOverlay.TextY=SCREEN_BOTTOM-128 - -[ScreenDemonstration] -SongMeterDisplayOnCommand=visible,false -SongMeterDisplayP1OnCommand=visible,false -SongMeterDisplayP2OnCommand=visible,false -LifeP1OnCommand=visible,false -LifeP2OnCommand=visible,false -ScoreP1OnCommand=visible,false -ScoreP2OnCommand=visible,false -StepsDisplayP1OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;smooth,0.5;y,SCREEN_BOTTOM-20;zoomy,0 -StepsDisplayP2OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;smooth,0.5;y,SCREEN_BOTTOM-20;zoomy,0 -ShowBPMDisplay=false -# -PlayMusic=false - -# sm-ssc helper screens -[ScreenHowToInstallSongs] -Class="ScreenSelectMaster" -Fallback="ScreenSelectMaster" -ShowHeader=false - -ShowScroller=true -PerChoiceScrollElement=false -# -ShowIcon=true -UseIconMetrics=false -PerChoiceIconElement=false -# -ScrollerX=SCREEN_LEFT+32 -ScrollerY=SCREEN_CENTER_Y -ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(24*(itemIndex-(numItems-1)/2)); end -ScrollerNumItemsToDraw=20 -ScrollerOffCommand=bouncebegin,0.25;addx,-SCREEN_CENTER_X - -ChoiceNames="WhereToFind,HowToInstall,AdditionalFolders,ReloadSongs,Exit" -ChoiceWhereToFind="urlnoexit,http://code.google.com/p/sm-ssc/wiki/FindingContent;text,"..Screen.String("Finding Songs") -ChoiceHowToInstall="urlnoexit,http://code.google.com/p/sm-ssc/wiki/InstallingContent;text,"..Screen.String("Installing Songs") -ChoiceAdditionalFolders="text,"..Screen.String("Importing Songs") -ChoiceReloadSongs="screen,ScreenReloadSongs;text,"..Screen.String("Reload Songs") -ChoiceExit="screen,"..Branch.TitleMenu()..";text,"..Screen.String("Exit") -DefaultChoice="WhereToFind" - -OptionOrderUp="5:4,4:3,3:2,2:1,1:5" -OptionOrderDown="1:2,2:3,3:4,4:5,5:1" -[CustomScoring] -# So special scoring works properly, we zero this out -ComboAboveThresholdAddsToScoreBonus=0 -ComboScoreBonusThreshold=0 -ComboScoreBonusValue=0 -ComboMultiplier=0 -DoubleNoteScoreMultiplier=0 -TripleNoteScoreMultiplier=0 -QuadOrHigherNoteScoreMultiplier=0 -PointsW1=0 -PointsW2=0 -PointsW3=0 -PointsW4=0 -PointsW5=0 -PointsMiss=0 -PointsHitMine=0 -PointsCheckpointHit=0 -PointsCheckpointMiss=0 -PointsNone=0 -PointsHoldHeld=0 -PointsHoldLetGo=0 +[Global] +FallbackTheme=_fallback + +[Common] +FirstAttractScreen="" +InitialScreen="ScreenInit" + +# AutoSetStyle=GetUserPrefB("UserPrefAutoSetStyle") +[BitmapText] +NumRainbowColors=1 +RainbowColor1=Color("Black"); + +[BPMDisplay] +SetNoBpmCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875); +SetNormalCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875); +SetChangeCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5); +SetRandomCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Blue");diffusetopedge,BoostColor(Color("Blue"),1.5); +SetExtraCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.5); +Cycle=true +NoBpmText="000" +RandomCycleSpeed=0.2 -- smaller numbers mean the bpm cycles faster +Separator="-" +ShowQMarksInRandomCycle=true + +[CombinedLifeMeterTug] +# We dont use it. +MeterWidth=512-8 +MeterHeight=40 + +[CodeDetector] +# For Future Reference: +# @ = Holding +# - = In Conjuction With / Then +# ~ = Released +# + = At The Same Time +[DifficultyList] +CapitalizeDifficultyNames=false +NumShownItems=8 +ItemsSpacingY=24 +[HelpDisplay] +TipShowTime=7 +[Combo] +ShowComboAt=2 + +NumberMinZoom=0.8 +NumberMaxZoom=1 +NumberMaxZoomAt=100 +LabelMinZoom=0.75*0.75 +LabelMaxZoom=0.75*1 + +PulseCommand=%function(self,param) self:finishtweening(); self:diffusealpha(1); self:zoom(1.125*param.Zoom); self:linear(0.05); self:zoom(param.Zoom); self:sleep(2); self:linear(0.5); self:diffusealpha(0); end; +PulseLabelCommand=%function(self,param) self:finishtweening(); self:diffusealpha(1); self:zoom(1.075*param.LabelZoom); self:linear(0.05); self:zoom(param.LabelZoom); self:sleep(2); self:linear(0.5); self:diffusealpha(0); end; +NumberOnCommand=y,240-216-1.5;shadowlength,1;horizalign,right;vertalign,bottom;skewx,-0.125; +LabelOnCommand=x,6;y,22.5;shadowlength,1;zoom,0.75;diffusebottomedge,color("0.75,0.75,0.75,1");horizalign,left;vertalign,bottom + +[FadingBanner] +BannerOnCommand= +BannerFadeFromCachedCommand=diffusealpha,1;stoptweening;accelerate,0.05;glow,Colors.Alpha( Color("White"), 0.45 );decelerate,0.175;diffusealpha,0;glow,Color("Invisible"); +BannerFadeOffCommand=diffusealpha,1;stoptweening;linear,0.25;diffusealpha,0 +BannerResetFadeCommand=diffusealpha,1 + +[HoldJudgment] +# !!! # +# HoldJudgmentLetGoCommand=HoldJudgmentLetGo() +# HoldJudgmentHeldCommand=HoldJudgmentHeld() +HoldJudgmentLetGoCommand=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 +HoldJudgmentHeldCommand=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 +# HoldJudgmentLetGoCommand=GAMESTATE:GetCurrentGame():GetName() == "pump" and "visible,false" or "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"; +# HoldJudgmentHeldCommand=GAMESTATE:GetCurrentGame():GetName() == "pump" and "visible,false" or "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"; +# HoldJudgmentLetGoCommand=function(self) \ + # if GAMESTATE:GetCurrentGame():GetName() == "pump" then \ + # return (cmd(visible,false))(self); \ + # 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))(self); \ + # end; \ +# end; +# HoldJudgmentHeldCommand=function(self) \ + # if GAMESTATE:GetCurrentGame():GetName() == "pump" then \ + # return (cmd(visible,false)); \ + # 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))(self); \ + # end; \ +# end; + +[Judgment] +# New # +JudgmentOnCommand= +# !!! # +JudgmentW1Command=finishtweening;shadowlength,0;y,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,1,1,1,0;effectcolor2,1,1,1,0.8 +JudgmentW2Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentW3Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW4Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0; +JudgmentW5Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,1,2,2;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +JudgmentMissCommand=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0 +# Late/Early +OffsetOnCommand= +OffsetLateCommand= +OffsetEarlyCommand= +[LifeMeterBar] +OverOnCommand=diffuse,Color("Orange");diffuserightedge,BoostColor(Color("Orange"),1.5) + +[LifeMeterBattery] +BatteryBlinkTime=0.5 +# +BatteryP1X=0 +BatteryP1Y=0 +BatteryP2X=0 +BatteryP2Y=0 +# +NumLivesP1X=-92 +NumLivesP1Y=0 +NumLivesP2X=92 +NumLivesP2Y=0 +NumLivesP2OnCommand=zoomx,-1 + +[LifeMeterBattery Percent] +# still asking for this even though it's in fallback... -aj +Format= +# +DancePointsP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +DancePointsP2OffCommand= +# +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2) +PercentP2OffCommand= + +[NoteField] +ShowBoard=GAMESTATE:GetCurrentGame():GetName() == "kb7" + +[MenuTimer] +Text1OnCommand=stopeffect;stoptweening;shadowlength,0;strokecolor,Color("Outline") +Text1FormatFunction=function(fSeconds) \ + return string.format("%0.1f", fSeconds); \ +end +FrameOnCommand= +Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); +#~ Warning10Command=%function(self) \ + #~ MESSAGEMAN:Broadcast("TimerWarning"); \ + #~ cmd(diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"))(self); \ +#~ end; + +[MusicWheel] +FadeSeconds=1 +SwitchSeconds=0.08 +RandomPicksLockedSongs=true +RouletteSwitchSeconds=0.05 +RouletteSlowDownSwitches=5 +LockedInitialVelocity=7 +ScrollBarHeight=300 +ScrollBarOnCommand=visible,false +; linear wheel example: +; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ +; self:y(offsetFromCenter*38); \ +; end; +; 3D wheel example: +; ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ +; local curve = math.pi; \ +; local WHEEL_3D_RADIUS = 245; \ +; local rotationx_radians = scale(offsetFromCenter,-numItems/2,numItems/2,-curve/2,curve/2); \ +; self:x( 0 - math.cos(offsetFromCenter/math.pi) ); \ +; self:y( WHEEL_3D_RADIUS * math.sin(rotationx_radians) ); \ +; self:z( -100 + WHEEL_3D_RADIUS * math.cos(rotationx_radians) ); \ +; self:rotationx( rotationx_radians * 180/math.pi ); --[[ to degrees end]] \ +; end; +ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*44 ); self:y( offsetFromCenter*46 ); end +NumWheelItems=11 +MusicWheelSortOnCommand=fov,90; +MusicWheelSortOffCommand=fov,90; +MusicWheelItemSortOnCommand=zoomy,0;bounceend,0.15;zoomy,1 +MusicWheelItemSortOffCommand=linear,0.175;zoomy,0 +HighlightOnCommand=diffuseshift;effecttiming,(1/8),0,(7/8),0;effectcolor2,Color("White");effectcolor1,color("1,1,1,0.5");effectclock,'beatnooffset' +HighlightOffCommand= +HighlightSortOnCommand=stoptweening;decelerate,0.125;glow,Color("Stealth");zoom,1 +HighlightSortOffCommand=stoptweening;accelerate,0.125;glow,Color("Orange");zoom,1.05 +WheelItemOnDelayOffset=0.04 +WheelItemOffDelayOffset=0.04 +WheelItemLockedColor=color("0,0,0,0.5") +# +NumSectionColors=1 +SectionColor1=Color("Orange") +# +SongRealExtraColor=Color("Red") +SortMenuColor=Color("Orange") +# +ShowRoulette=true +ShowRandom=false +ShowPortal=false +MostPlayedSongsToShow=30 +#~ ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,Genre,Length" +#~ ChoicePreferred="sort,Preferred" +#~ ChoiceGroup="sort,Group" +#~ ChoiceTitle="sort,Title" +#~ ChoiceBpm="sort,BPM" +#~ ChoicePopularity="sort,Popularity" +#~ ChoiceTopGrades="sort,TopGrades" +#~ ChoiceArtist="sort,Artist" +#~ ChoiceGenre="sort,Genre" +#~ ChoiceEasyMeter="sort,EasyMeter" +#~ ChoiceMediumMeter="sort,MediumMeter" +#~ ChoiceHardMeter="sort,HardMeter" +#~ ChoiceChallengeMeter="sort,ChallengeMeter" +#~ ChoiceLength="sort,Length" +#~ ChoiceCourses="sort,AllCourses;" +UseEasyMarkerFlag=true +# + +[MusicWheelItem] +WheelNotifyIconX=-128-16+0.5 +WheelNotifyIconY=0 +WheelNotifyIconOnCommand=shadowlength,2; +# +SongNameX=-120 +SongNameY=0 +SongNameOnCommand= +# +CourseX=-120 +CourseY=0 +CourseOnCommand=maxwidth,208;horizalign,left +# +SectionExpandedX=-38 +SectionExpandedY=-2 +SectionExpandedOnCommand=maxwidth,194;shadowlength,1;shadowcolor,color("0.1,0.1,0.1,0.25") +# +SectionCollapsedX=-38 +SectionCollapsedY=-2 +SectionCollapsedOnCommand=maxwidth,194;shadowlength,1;shadowcolor,color("0.1,0.1,0.1,0.2") +SectionCountX=112 +SectionCountY=0 +SectionCountOnCommand=zoom,0.75;strokecolor,Color("Outline") +# +RouletteX=0 +RouletteY=0 +RouletteOnCommand=maxwidth,400;shadowlength,1;zoom,0.75;rainbowscroll,true;thump,2; +# +SortX=-132 +SortY=-2 +SortOnCommand=maxwidth,256;horizalign,left;shadowlength,1;shadowcolor,color("0,0,0,0.325") +# +ModeX=-132 +ModeY=-2 +ModeOnCommand=maxwidth,256;horizalign,left;strokecolor,Color("Outline") +# +GradeP1X=106+16 +GradeP1Y=-8 +GradeP2X=110+16 +GradeP2Y=8 +GradesShowMachine=true + +[OptionRow] +TitleOnCommand=shadowlength,0;skewx,-0.1;uppercase,true;wrapwidthpixels,136;maxheight,42;zoom,0.6 +TitleGainFocusCommand=stoptweening;zoom,0.6375*1.125;bounceend,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);strokecolor,Color("Black");zoom,0.6375; +# TitleGainFocusCommand=stoptweening;zoom,0.6375*1.25;bounceend,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);strokecolor,Color("Black");zoom,0.6375;thump;effectmagnitude,1,1.05,1;effectclock,'beat' +TitleLoseFocusCommand=diffuse,Color("White");strokecolor,Color("Black");stopeffect; +[OptionRowMiniMenu] +Fallback="OptionRow" + +TitleX=SCREEN_CENTER_X-320+48 +TitleOnCommand=horizalign,left;shadowlength,0;uppercase,true;zoom,0.6375;strokecolor,Color("Black"); +#~ TitleGainFocusCommand= +#~ TitleLoseFocusCommand= + +ColorSelected=color("1,1,1,1") +ColorNotSelected=color("0.9,0.9,0.9,1") +ColorDisabled=color("0.5,0.5,0.5,1") + +ItemOnCommand=zoom,0.6375 +ItemsLongRowP1X=SCREEN_CENTER_X-240 +ItemsLongRowP2X=SCREEN_CENTER_X+240 +ItemsLongRowSharedX=SCREEN_CENTER_X+200 + +[OptionRowMiniMenuContext] +Fallback="OptionRowMiniMenu" + +[OptionRowExit] +Fallback="OptionRow" +FrameOnCommand=visible,true;diffuse,Color("Red"); +FrameX=SCREEN_CENTER_X +TitleOnCommand=visible,false + +ItemsMinBaseZoom=1 +ItemOnCommand=shadowlength,1;zoom,0.8;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.75);shadowcolor,BoostColor(Color("Red"),0.35) +ItemGainFocusCommand=stoptweening;linear,0.2;zoom,1;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.75) +ItemLoseFocusCommand=stoptweening;decelerate,0.5;zoom,0.8; +ColorSelected=Color("Red") +ColorNotSelected=Color("Red") +ColorDisabled=Color("Red") + +ItemsLongRowP1X=SCREEN_CENTER_X-1024 +ItemsLongRowP2X=SCREEN_CENTER_X+1024 +ItemsLongRowSharedX=SCREEN_CENTER_X + +[OptionsCursorP1] +LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_1) +MiddleOnCommand=;diffuse,PlayerColor(PLAYER_1) +RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_1) +[OptionsCursorP2] +LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_2) +MiddleOnCommand=;diffuse,PlayerColor(PLAYER_2) +RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_2) +[OptionsUnderlineP1] +LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_1) +MiddleOnCommand=;diffuse,PlayerColor(PLAYER_1) +RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_1) +[OptionsUnderlineP2] +LeftOnCommand=horizalign,right;diffuse,PlayerColor(PLAYER_2) +MiddleOnCommand=;diffuse,PlayerColor(PLAYER_2) +RightOnCommand=horizalign,left;diffuse,PlayerColor(PLAYER_2) +[Protiming] +ProtimingOnCommand=shadowlength,1;horizalign,right;x,30;strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; +AverageOnCommand=shadowlength,1;horizalign,left;x,32;y,8;zoom,0.75;diffuse,ColorLightTone( Color("Green") );strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; +TextOnCommand=shadowlength,1;horizalign,left;x,32;y,-6;zoom,0.5;strokecolor,Color("Outline");skewx,-0.125;textglowmode,"TextGlowMode_Inner"; +# +ProtimingW1Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W1"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +ProtimingW2Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W2"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +ProtimingW3Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W3"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +ProtimingW4Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W4"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +ProtimingW5Command=finishtweening;diffuse,Color("White");zoom,1.15;glow,Color("White");linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_W5"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +ProtimingMissCommand=finishtweening;diffusealpha,1;zoom,1.15;glow,GameColor.Judgment["JudgmentLine_Miss"];linear,0.05;zoom,1;glow,Color("Invisible");diffuse,GameColor.Judgment["JudgmentLine_Miss"];sleep,2;linear,0.5;diffuse,Color("Invisible"); +# +AveragePulseCommand=finishtweening;diffusealpha,1;zoom,0.75*1.025;decelerate,0.05;zoom,0.75;sleep,2;linear,0.5;diffusealpha,0; +TextPulseCommand=finishtweening;diffusealpha,1;zoom,0.5*1.025;decelerate,0.05;zoom,0.5;sleep,2;linear,0.5;diffusealpha,0; +[Player] +# ReceptorArrowsYStandard=GetTapPosition('Standard') +# ReceptorArrowsYReverse=GetTapPosition('Reverse') +# RollBodyIncrementsCombo=GetUserPrefB("UserPrefComboOnRolls") + +[ScoreDisplayNormal] +FrameX= +FrameY= +FrameOnCommand= +FrameOffCommand= +TextX= +TextY= +TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) +TextOffCommand= + +[ScoreDisplayOni] +TextX= +TextY= +TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) +TextOffCommand= +[ScoreDisplayOni Numbers] +TextX= +TextY= +TextOnCommand=shadowlength,1;diffusebottomedge,BoostColor(Color('White'),0.75) +TextOffCommand= +[ScoreDisplayLifeTime] +FrameX= +FrameY= +FrameOnCommand=visible,false;spin +FrameOffCommand= +# +TimeRemainingX= +TimeRemainingY=80 +TimeRemainingOnCommand=zoom,1;shadowlength,1;settext,"Hi!"; +TimeRemainingOffCommand= +# +DeltaSecondsOnCommand=y,80;settext,Hi;spin; +DeltaSecondsNoneCommand= +DeltaSecondsHitMineCommand= +DeltaSecondsAvoidMineCommand= +DeltaSecondsCheckpointMissCommand= +DeltaSecondsCheckpointHitCommand= +DeltaSecondsMissCommand= +DeltaSecondsW5Command= +DeltaSecondsW4Command= +DeltaSecondsW3Command= +DeltaSecondsW2Command= +DeltaSecondsW1Command= +DeltaSecondsLetGoCommand= +DeltaSecondsHeldCommand= +DeltaSecondsGainLifeCommand=zoom,0.5;settext,"Hi!"; +[ScoreDisplayPercentage Percent] +PercentP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5) +PercentP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5) +[ScreenEvaluation Percent] +# This shouldn't even be named this but whatever man. +PercentP1X=0 +PercentP1Y=0 +PercentP1OnCommand=horizalign,right;shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); +PercentP1OffCommand= +PercentP2X=0 +PercentP2Y=0 +PercentP2OnCommand=horizalign,right;shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); +PercentP2OffCommand= +PercentRemainderP1X=0 +PercentRemainderP1Y=0 +PercentRemainderP1OnCommand=horizalign,left;shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); +PercentRemainderP1OffCommand= +PercentRemainderP2X=0 +PercentRemainderP2Y=0 +PercentRemainderP2OnCommand=horizalign,left;shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); +PercentRemainderP2OffCommand= +DancePointsP1X=0 +DancePointsP1Y=0 +DancePointsP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) ); +DancePointsP1OffCommand= +DancePointsP2X=0 +DancePointsP2Y=0 +DancePointsP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) ); +DancePointsP2OffCommand= +DancePointsDigits=2 +PercentUseRemainder=true +ApplyScoreDisplayOptions=true +FormatPercentScore=FormatPercentScore +Format= +PercentDecimalPlaces=2 +PercentTotalSize=5 + +[ScoreDisplayRave] +MeterP1X= +MeterP1Y= +MeterP1OnCommand=draworder,-1 +MeterP1OffCommand= +MeterP2X= +MeterP2Y= +MeterP2OnCommand=draworder,-1;zoomx,-1 +MeterP2OffCommand= + +LevelP1X= +LevelP1Y= +LevelP1OnCommand=draworder,105;zoom,0.75;diffuse,ColorLightTone( PlayerColor(PLAYER_1) );strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );x,-144;skewx,-0.125; +LevelP1OffCommand= +LevelP2X= +LevelP2Y= +LevelP2OnCommand=draworder,105;draworder,105;zoom,0.75;diffuse,ColorLightTone( PlayerColor(PLAYER_2) );strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );x,144;skewx,-0.125; +LevelP2OffCommand= +[SongManager] +SongGroupColor1=BoostColor(Color("Orange"),1.2) +SongGroupColor2=BoostColor(Color("Orange"),1.25) +SongGroupColor3=BoostColor(Color("Orange"),1.25) +SongGroupColor4=BoostColor(Color("Orange"),1.25) +SongGroupColor5=BoostColor(Color("Orange"),1.25) +SongGroupColor6=BoostColor(Color("Orange"),1.25) +SongGroupColor7=BoostColor(Color("Orange"),1.25) +SongGroupColor8=BoostColor(Color("Orange"),1.25) +SongGroupColor9=BoostColor(Color("Orange"),1.25) +SongGroupColor10=BoostColor(Color("Orange"),1.25) + +CourseGroupColor1=color("1,1,1,1") +UnlockColor=color("1,0.5,0,1") +ExtraColor=color("#ff0000") -- red + +[SongMeterDisplay] +StreamWidth=380 + +ContainerX= +ContainerY= +ContainerOnCommand= +ContainerOffCommand= + +FrameX=0 +FrameY=0 +FrameOnCommand=sleep,2;linear,0.25;diffuse,Color("Orange");glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 +FrameOffCommand= + +StreamX=0 +StreamY=0 +StreamOnCommand=0 +StreamOffCommand=0 + +TipX=0 +TipY=0 +TipOnCommand= +TipOffCommand= +[SongMeterDisplayP1] +Fallback="SongMeterDisplay" +FrameOnCommand=sleep,2;linear,0.25;diffuse,PlayerColor(PLAYER_1);glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 +[SongMeterDisplayP2] +Fallback="SongMeterDisplay" +FrameOnCommand=sleep,2;linear,0.25;diffuse,PlayerColor(PLAYER_2);glow,1,1,1,0.5;decelerate,0.6;glow,1,1,1,0 +[StepsDisplay] +FrameX=0 +FrameY=0 +FrameOnCommand= +FrameLoadCommand=%function(self,param) end; +FrameSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + end; \ +end; +# +ShowTicks=false +NumTicks=10 +MaxTicks=14 +TicksX=0 +TicksY=0 +TicksOnCommand=shadowlength,0; +TicksSetCommand=%function(self,param) end; +# +ShowMeter=true +ZeroMeterString="?" +MeterX=56-32 +MeterY=0 +MeterOnCommand=shadowlength,1;textglowmode,'TextGlowMode_Inner' +MeterSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ + if param.Meter then \ + if param.Meter >= 100 then \ + self:basezoom(0.8); \ + self:glowshift(); \ + elseif param.Meter >= 10 then \ + self:basezoom(1); \ + self:glowshift(); \ + else \ + self:basezoom(1); \ + self:stopeffect(); \ + end; \ + end; \ +end; +# +ShowDescription=true +DescriptionX=-20-32 +DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 +# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 +DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 +DescriptionSetCommand=%function(self,param) \ + if self:GetText() == "" then \ + self:settext("Edit"); \ + end; \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ +end; +# +ShowAutogen=false +AutogenX=40-32 +AutogenY=0 +AutogenOnCommand= +AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end +# +ShowStepsType=GetGamePrefB("AutoSetStyle") +# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") +StepsTypeX=-20-32 +StepsTypeY=7 +StepsTypeOnCommand=zoom,0.45 + +[StepsDisplayEdit] +Fallback="StepsDisplayGameplay" + +[StepsDisplayGameplay] +Fallback="StepsDisplay" + +FrameX=0 +FrameY=0 +FrameOnCommand= +FrameLoadCommand=%function(self,param) end; +FrameSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + end; \ +end; +# +ShowTicks=false +NumTicks=10 +MaxTicks=14 +TicksX=0 +TicksY=0 +TicksOnCommand=shadowlength,0; +TicksSetCommand=%function(self,param) end; +# +ShowMeter=true +ZeroMeterString="?" +MeterX=56 +MeterY=0 +MeterOnCommand=shadowlength,1;textglowmode,'TextGlowMode_Inner' +MeterSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ + if param.Meter then \ + if param.Meter >= 100 then \ + self:zoom(0.8); \ + else \ + self:zoom(1); \ + end; \ + end; \ +end; +# +ShowDescription=true +DescriptionX=-20 +DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 +# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 +DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 +DescriptionSetCommand=%function(self,param) \ + if self:GetText() == "" then \ + self:settext("Edit"); \ + end; \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ + (cmd(finishtweening;diffusealpha,0;addx,-4;smooth,0.125;addx,4;diffusealpha,1))(self); \ +end; +# +ShowAutogen=false +AutogenX=40 +AutogenY=0 +AutogenOnCommand= +AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end +# +ShowStepsType=GetGamePrefB("AutoSetStyle") +# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") +StepsTypeX=-20 +StepsTypeY=7 +StepsTypeOnCommand=zoom,0.45 + +[StepsDisplayEvaluation] +Fallback="StepsDisplay" + +[StepsDisplayListRow] +# +CapitalizeDifficultyNames=false +NumShownItems=5 +ItemsSpacingY=24 +MoveCommand=decelerate,0.3 +# +FrameX= +FrameY=0 +FrameOnCommand= +FrameOffCommand= +FrameSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(ColorMidTone( CustomDifficultyToColor(param.CustomDifficulty) )); \ + else \ + self:diffuse(color('1,1,1,1')); \ + end; \ +end; +# +ShowTicks=false +NumTicks=10 +MaxTicks=10 +TicksSetCommand= +# +ShowMeter=true +ZeroMeterString="0" +MeterX=56 +MeterY=0 +MeterOnCommand=shadowlength,1;zoom,0.65;textglowmode,'TextGlowMode_Inner'; +MeterOffCommand= +MeterSetCommand=%function(self,param) \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ + if param.Meter then \ + if param.Meter >= 10 then \ + self:textglowmode('TextGlowMode_Inner'); \ + self:glowshift(); \ + else \ + self:stopeffect(); \ + end; \ + end; \ +end; +# +ShowDescription=true +DescriptionX=GetGamePrefB("AutoSetStyle") and (-64-8+20) or (-64-8) +# DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8) +DescriptionY=0 +DescriptionOnCommand=shadowlength,1;horizalign,left;zoom,0.65;maxwidth,128+8-20;uppercase,true; +DescriptionOffCommand= +DescriptionSetCommand=%function(self,param) \ + if self:GetText() == "" then \ + self:settext("Edit"); \ + end; \ + if param.CustomDifficulty then \ + self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \ + self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \ + end; \ +end; +# +ShowAutogen=true +AutogenX=0 +AutogenY=0 +#AutogenOnCommand=diffuseshift;effectcolor1,Colors.Alpha( Color("Green") , 0.5 );effectcolor2,ColorLightTone( Color("Green") ); +AutogenOnCommand=blend,Blend.Add;diffuseshift;effectcolor1,color("#FFCC00FF");effectcolor2,color("#FFCC0088"); +AutogenSetCommand= +# +ShowStepsType=GetGamePrefB("AutoSetStyle") +# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") +StepsTypeX=-64-8 +StepsTypeY=0 +StepsTypeOnCommand= +StepsTypeSetCommand= + +[StreamDisplay] +; a simple bar life meter: +; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end +# PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + # local fItemWidth = ( 256 / numItems ) \ + # self:x( ((itemIndex-(numItems/2))*fItemWidth) + ( numItems / 2 ) ); \ + # self:zoomtowidth(fItemWidth); \ + # self:diffuseramp(); \ + # self:effectperiod(4); \ + # self:effectoffset((itemIndex-1)/numItems * -1); \ + # self:effectcolor2(color("1,1,1,1")); \ + # self:effectcolor1(color("0.5,0.5,0.5,1")); \ + # self:effectclock('beatnooffset'); \ +# end; +PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + local fItemWidth = ( 256 / numItems ) \ + self:zoomtowidth(fItemWidth); \ +end; +# PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) \ + # local fItemWidth = ( 256 / numItems ) \ + # self:x( ((itemIndex-(numItems/2))*fItemWidth) + ( numItems / 2 ) ); \ + # self:zoomtowidth(fItemWidth); \ + # self:diffuseramp(); \ + # self:effecttiming(1,0.01875*itemIndex,1,1-(0.01875*itemIndex)); \ + # self:effectclock('beatnooffset'); \ +# end; +TextureCoordScaleX=1 +NumPills=1 +AlwaysBounceNormalBar=false + +[TextBanner] +TitleOnCommand=horizalign,left;shadowlength,1; +SubtitleOnCommand=horizalign,left;shadowlength,1; +ArtistOnCommand=horizalign,left;shadowlength,1;skewx,-0.2 +ArtistPrependString="" +AfterSetCommand=%TextBannerAfterSet + +[ScreenSystemLayer] +CreditsP1OnCommand=horizalign,left;vertalign,bottom;zoom,0.675;shadowlength,1;diffusebottomedge,PlayerColor(PLAYER_1); +CreditsP1OffCommand= +# +CreditsP2OnCommand=horizalign,right;vertalign,bottom;zoom,0.675;shadowlength,1;diffusebottomedge,PlayerColor(PLAYER_2); +CreditsP2OffCommand= +[ScreenWithMenuElements] +WaitForChildrenBeforeTweening=true + +ScreenInDelay=0 +ScreenOutDelay=0 + +FOV=90 +ShowHeader=true +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP +HeaderOnCommand=draworder,5; +HeaderOffCommand= + +ShowFooter=true +FooterX=SCREEN_CENTER_X +FooterY=SCREEN_BOTTOM +FooterOnCommand=draworder,5;vertalign,bottom;zoomtowidth,SCREEN_WIDTH+1;diffuse,color("#ffd400"); +FooterOffCommand= + +ShowHelp=true +HelpX=SCREEN_CENTER_X +HelpY=SCREEN_BOTTOM-16 +HelpOnCommand=SetSecsBetweenSwitches,4;shadowlength,1;strokecolor,Color("Black");draworder,105;zoomy,0;linear,0.175;zoom,1*0.675;maxwidth,(640*0.75)/0.5; +HelpOffCommand=linear,0.175;zoomy,0 + +AlternateHelpDisplayX=SCREEN_CENTER_X +AlternateHelpDisplayY=SCREEN_BOTTOM-16 +# AlternateHelpDisplayOnCommand=draworder,105; +AlternateHelpDisplayOnCommand=SetSecsBetweenSwitches,4;shadowlength,1;strokecolor,Color("Black");draworder,105;zoomy,0;linear,0.175;zoom,1*0.675;maxwidth,(640*0.75)/0.5;;diffusealpha,0 +AlternateHelpDisplayOffCommand=linear,0.175;zoomy,0 + +TimerX=SCREEN_RIGHT-36-4 +TimerY=SCREEN_TOP+22 +TimerOnCommand=draworder,6;visible,PREFSMAN:GetPreference("MenuTimer"); +# TimerOnCommand=fov,90;vanishpoint,SCREEN_RIGHT-36-4,SCREEN_TOP+20;draworder,5;visible,PREFSMAN:GetPreference("MenuTimer");rotationy,90;decelerate,0.4;rotationy,0; +TimerOffCommand= +# TimerOffCommand=accelerate,0.4;rotationx,90; + +StageDisplayNumberOffset=1 + +# This is useful +ArcadeOverlayX= +ArcadeOverlayY= +ArcadeOverlayOnCommand=draworder,100 +ArcadeOverlayOffCommand= +# +ArcadeOverlay.TextX=SCREEN_CENTER_X +ArcadeOverlay.TextY=SCREEN_BOTTOM-48 +ArcadeOverlay.TextOnCommand= +ArcadeOverlay.TextOffCommand= +[ScreenWithMenuElementsBlank] +ShowHeader=false +ShowFooter=false + +[ScreenOptions] +DisqualifyP1X=SCREEN_CENTER_X-176 +DisqualifyP1Y=SCREEN_BOTTOM-98 +DisqualifyP1OnCommand=draworder,100;zoom,0.5;shadowlength,1;player,PLAYER_1 +DisqualifyP1OffCommand= +DisqualifyP2X=SCREEN_CENTER_X+176 +DisqualifyP2Y=SCREEN_BOTTOM-98 +DisqualifyP2OnCommand=draworder,100;zoom,0.5;shadowlength,1;player,PLAYER_2 +DisqualifyP2OffCommand= + +ContainerOnCommand=x,-SCREEN_WIDTH;decelerate,0.35;x,SCREEN_LEFT +# PageOnCommand=fadetop,0.125;fadebottom,0.125;cropbottom,0.5;croptop,0.5;decelerate,0.25;croptop,0;cropbottom,0;fadetop,0;fadebottom,0; +CursorOnCommand= + +LineHighlightOnCommand=cropleft,0.1;cropright,0.1;zoomx,1.25;fadeleft,0.05;faderight,0.05;diffuseshift;effectcolor2,color("1,1,1,0.5");effectcolor1,color("1,1,1,0.25");effectclock,'beat' +LineHighlightChangeCommand=linear,0.1;diffuse,Color("White");diffuseshift;effectcolor2,color("1,1,1,0.5");effectcolor1,color("1,1,1,0.25") +LineHighlightChangeToExitCommand=linear,0.1;diffuse,Color("Red");diffuseshift;effectcolor2,color("1,0,0,0.5");effectcolor1,color("1,0,0,0.25") + +[ScreenMiniMenu] +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP +HeaderOnCommand=draworder,100;visible,false +HeaderOffCommand= + +LineHighlightOnCommand=cropleft,0.1;cropright,0.1;zoomx,1.3;fadeleft,0.25;faderight,0.25;diffusealpha,0.375 +LineHighlightChangeCommand= +LineHighlightChangeToExitCommand= + +[ScreenMiniMenuContext] +PageOnCommand=visible,false +LineHighlightX=SCREEN_CENTER_X/2 + +TitleX=SCREEN_CENTER_X +TitleOnCommand=shadowlength,1; +ItemsStartX=SCREEN_CENTER_X +ItemsEndX=SCREEN_CENTER_X +ItemsGapX=14 +ItemsLongRowP1X=SCREEN_CENTER_X +ItemsLongRowP2X=SCREEN_CENTER_X +ItemsLongRowSharedX=SCREEN_CENTER_X + +[ScreenOptionsTheme] +Fallback="ScreenOptionsServiceChild" +NextScreen="ScreenOptionsExtended" +PrevScreen="ScreenOptionsExtended" +LineNames="gNotePos,gAuto,gScore,gSScore,gSDisp,gOpts,gLongFail,gComboUnderField,FlashyCombo,GameplayFooter" +LinegNotePos="lua,GamePrefNotePosition()" +LinegScore="lua,UserPrefGameplayShowScore()" +LinegSScore="lua,UserPrefSpecialScoringMode()" +LinegSDisp="lua,UserPrefGameplayShowStepsDisplay()" +LinegOpts="lua,UserPrefShowLotsaOptions()" +LinegAuto="lua,GamePrefAutoSetStyle()" +LinegLongFail="lua,UserPrefLongFail()" +LinegComboUnderField="lua,GamePrefComboUnderField()" +LineFlashyCombo="lua,UserPrefFlashyCombo()" +LineGameplayFooter="lua,UserPrefGameplayFooter()" +[ScreenOptionsSystemDirection] +LineNames="1,2,3,4,5,6,7,8,9,FlashyCombo,RollCombo,10,11,12,13,14,15,16,LF,17,18,19,20,21,22" +LineLF="lua,UserPrefLongFail()" +LineRollCombo="lua,GamePrefComboOnRolls()" +LineFlashyCombo="lua,UserPrefFlashyCombo()" +[ScreenOptionsAdvanced] +LineNames="2,3,4,8,11,13,14,15,16,28,29,30,RollCombo" +LineRollCombo="lua,GamePrefComboOnRolls()" +[ScreenOptionsService] +ShowHeader=false + +# ScreenOptionsSystemDirection" + +NumRowsShown=14 +RowPositionTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:y(SCREEN_CENTER_Y-170+24*offsetFromCenter) end + +SeparateExitRow=false +SeparateExitRowY=SCREEN_BOTTOM-40 + +[ScreenTextEntry] +QuestionOnCommand=diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);wrapwidthpixels,600 +AnswerOnCommand=diffuse,Color("Blue");glowshift; +KeysInitCommand=zoom,0.8;shadowlength,0 + +[ScreenInit] +PrepareScreens="ScreenTitleMenu,ScreenTitleJoin" +GroupedScreens="ScreenInit,ScreenTitleJoin,ScreenTitleMenu" +PersistScreens="ScreenInit,ScreenTitleJoin,ScreenTitleMenu" + +[ScreenTitleMenu] +ShowHeader=false +ShowFooter=false +# +ShowScroller=true +WrapScroller=false +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y((28)*(itemIndex-(numItems-1)/2)); end; +ScrollerSecondsPerItem=0 +ScrollerNumItemsToDraw=20 +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y+80 +ScrollerOnCommand=zoom,0;bounceend,0.35;zoom,1 +# +ShowLogo=true +LogoX=SCREEN_CENTER_X +LogoY=SCREEN_CENTER_Y-68 +LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 +LogoOffCommand=stopeffect;bouncebegin,0.35;rotationz,360;zoom,0 +# +ShowCurrentGametype=true +CurrentGametypeX=SCREEN_WIDTH*0.01 +CurrentGametypeY=SCREEN_HEIGHT*0.1575 +CurrentGametypeOnCommand=vertalign,bottom; +CurrentGametypeOffCommand=linear,0.5;cropleft,1 +# +ShowTimingDifficulty=true +TimingDifficultyX=SCREEN_LEFT+84 +TimingDifficultyY=SCREEN_TOP+22 +TimingDifficultyOnCommand= +TimingDifficultyOffCommand= +# +ShowLifeDifficulty=true +LifeDifficultyX=SCREEN_LEFT+84 +LifeDifficultyY=SCREEN_TOP+48 +LifeDifficultyOnCommand= +LifeDifficultyOffCommand= +# +ShowSystemDirection=false +SystemDirectionX=SCREEN_LEFT+40 +SystemDirectionY=SCREEN_TOP+24 +SystemDirectionOnCommand= +SystemDirectionOffCommand= +# +ShowVersionInfo=true +VersionInfoX=SCREEN_RIGHT-84 +VersionInfoY=SCREEN_BOTTOM-64 +VersionInfoOnCommand= +VersionInfoOffCommand= +# +ShowNetworkStatus=true +NetworkStatusX=SCREEN_WIDTH*0.0125 +NetworkStatusY=SCREEN_HEIGHT*0.85 +NetworkStatusOnCommand=horizalign,left; +NetworkStatusOffCommand=linear,0.5;cropright,1 +# +HelpY=SCREEN_BOTTOM-24 +# +#ChoiceNames="1,Setup,4,5,7" +ChoiceNames="1,4,5,7" +#~ ChoiceNames="1,3,4,7" +DefaultChoice="1" +#DisabledChoices="Setup" +#ChoiceSetup="text,Setup" +ChoiceSetup="screen,ScreenQuickSetupOverview;text,Setup" + +[ScreenQuickSetupOverview] +IconStartX=SCREEN_CENTER_X-160 +IconStartY=SCREEN_BOTTOM-60 +IconSetX=SCREEN_CENTER_X-160 +IconSetY=SCREEN_BOTTOM-60 +IconBackX=SCREEN_CENTER_X+160 +IconBackY=SCREEN_BOTTOM-60 + +ExplanationX=SCREEN_CENTER_X +ExplanationY=SCREEN_BOTTOM-100 +ExplanationOnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_WIDTH/0.75; +ExplanationOffCommand= +[ScreenProfileLoad] +# +ShowHeader=true +ShowFooter=true +ShowHelp=true +[ScreenSelectProfile] +WaitForChildrenBeforeTweening=true +[ScreenSelectStyle] +UpdateOnMesage="" +# +FOV=90 +# +PerChoiceScrollElement=false +PerChoiceIconElement=false +# +DefaultChoice="Single" +ChoiceNames=GameCompatibleModes() +# +OptionOrderAuto="1:2,2:1" +ChoiceSingle="name,Single;style,single;screen,"..Branch.AfterSelectPlayMode() +ChoiceDouble="name,Double;style,double;screen,"..Branch.AfterSelectPlayMode() +ChoiceSolo="name,Solo;style,solo;screen,"..Branch.AfterSelectPlayMode() +ChoiceVersus="name,Versus;style,versus;screen,"..Branch.AfterSelectPlayMode() +ChoiceCouple="name,Couple;style,couple;screen,"..Branch.AfterSelectPlayMode() +ChoiceHalfDouble="name,HalfDouble;style,halfdouble;screen,"..Branch.AfterSelectPlayMode() +Choice5Keys="name,5Keys;style,single5;;screen,"..Branch.AfterSelectPlayMode() +Choice7Keys="name,7Keys;style,single7;screen,"..Branch.AfterSelectPlayMode() +Choice10Keys="name,10Keys;style,double10;screen,"..Branch.AfterSelectPlayMode() +Choice14Keys="name,14Keys;style,double14;screen,"..Branch.AfterSelectPlayMode() +ChoiceKB7="name,kb7;style,single;screen,"..Branch.AfterSelectPlayMode() +# +ShowScroller=false +ShowIcon=true +WrapScroller=false +UseIconMetrics=true +# +IconGainFocusCommand=stoptweening;bounceend,0.125;zoom,1; +IconLoseFocusCommand=stoptweening;decelerate,0.25;zoom,0.8; +# +IconChoiceSingleX=SCREEN_CENTER_X-160 +IconChoiceSingleY=SCREEN_CENTER_Y-96 +IconChoiceSingleOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceSingleOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceDoubleX=SCREEN_CENTER_X-160 +IconChoiceDoubleY=SCREEN_CENTER_Y +IconChoiceDoubleOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceDoubleOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceSoloX=SCREEN_CENTER_X-160 +IconChoiceSoloY=SCREEN_CENTER_Y+96 +IconChoiceSoloOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceSoloOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceHalfDoubleX=SCREEN_CENTER_X-160 +IconChoiceHalfDoubleY=SCREEN_CENTER_Y+96 +IconChoiceHalfDoubleOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceHalfDoubleOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceVersusX=SCREEN_CENTER_X+160 +IconChoiceVersusY=SCREEN_CENTER_Y-48 +IconChoiceVersusOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceVersusOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceCoupleX=SCREEN_CENTER_X+160 +IconChoiceCoupleY=SCREEN_CENTER_Y+48 +IconChoiceCoupleOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoiceCoupleOffCommand=linear,0.1175;zoomx,0 +# +IconChoicekb7X=SCREEN_CENTER_X +IconChoicekb7Y=SCREEN_CENTER_Y +IconChoicekb7OnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoicekb7OffCommand=linear,0.1175;zoomx,0 +# +IconChoice5KeysX=SCREEN_CENTER_X-160 +IconChoice5KeysY=SCREEN_CENTER_Y-48 +IconChoice5KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoice5KeysOffCommand=linear,0.1175;zoomx,0 +# +IconChoice7KeysX=SCREEN_CENTER_X-160 +IconChoice7KeysY=SCREEN_CENTER_Y+48 +IconChoice7KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoice7KeysOffCommand=linear,0.1175;zoomx,0 +# +IconChoice10KeysX=SCREEN_CENTER_X+160 +IconChoice10KeysY=SCREEN_CENTER_Y-48 +IconChoice10KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoice10KeysOffCommand=linear,0.1175;zoomx,0 +# +IconChoice14KeysX=SCREEN_CENTER_X+160 +IconChoice14KeysY=SCREEN_CENTER_Y+48 +IconChoice14KeysOnCommand=zoom,0;bounceend,0.35;zoom,1 +IconChoice14KeysOffCommand=linear,0.1175;zoomx,0 + +[ScreenSelectPlayMode] +PersistScreens="ScreenSelectPlayMode,ScreenSelectMusic" +# +ScreenOutDelay=3 +# +DefaultChoice="Easy" +# ChoiceNames="Normal,Extended" +# +PerChoiceIconElement=false +# +ShowScroller=true +WrapScroller=true +ScrollerX=SCREEN_CENTER_X +ScrollerY=SCREEN_CENTER_Y-60 +ScrollerOnCommand=SetFastCatchup,true; +ScrollerOffCommand=decelerate,0.8;y,SCREEN_CENTER_Y;sleep,2;linear,0.1;zoomy,0 +# +ShowBackgroundFrame=true +BackgroundFrameX=SCREEN_CENTER_X +BackgroundFrameY=SCREEN_CENTER_Y-60 +BackgroundFrameOnCommand=diffuse,Color("Black");diffusealpha,0.7 +BackgroundFrameOffCommand=decelerate,0.8;y,SCREEN_CENTER_Y;sleep,2;linear,0.1;zoomy,0 +# +ShowIcon=true +UseIconMetrics=true +# +IconGainFocusCommand=stoptweening;glowshift;decelerate,0.125;zoom,1; +IconLoseFocusCommand=stoptweening;stopeffect;decelerate,0.125;zoom,0.6; +# IconMinZoom=0.5 +# IconBaseZoom=0.6 +# +IconChoiceEasyX=SCREEN_CENTER_X-(240*(5/6)) +IconChoiceEasyY=SCREEN_BOTTOM-88-64 +IconChoiceEasyOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceEasyOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceNormalX=SCREEN_CENTER_X-80 +IconChoiceNormalY=SCREEN_BOTTOM-88-64 +IconChoiceNormalOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceNormalOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceHardX=SCREEN_CENTER_X+(80*(5/6)) +IconChoiceHardY=SCREEN_BOTTOM-88-64 +IconChoiceHardOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceHardOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceRaveX=SCREEN_CENTER_X+80 +IconChoiceRaveY=SCREEN_BOTTOM-88-64 +IconChoiceRaveOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceRaveOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceExtendedX=SCREEN_CENTER_X-160 +IconChoiceExtendedY=SCREEN_BOTTOM-88 +IconChoiceExtendedOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceExtendedOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceOniX=SCREEN_CENTER_X +IconChoiceOniY=SCREEN_BOTTOM-88 +IconChoiceOniOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceOniOffCommand=linear,0.1175;zoomx,0 +# +IconChoiceEndlessX=SCREEN_CENTER_X+160 +IconChoiceEndlessY=SCREEN_BOTTOM-88 +IconChoiceEndlessOnCommand=zoom,0;bounceend,0.35;zoom,0.8 +IconChoiceEndlessOffCommand=linear,0.1175;zoomx,0 + +[ScreenSelectMusic] +UsePlayerSelectMenu=false +# OptionsMenuAvailable=(getenv(sMode) ~= Oni) +SelectMenuAvailable=true +# ModeMenuAvailable=(getenv(sMode) == Normal) +# HelpDisplay has things added here to make sure it disappears for another +# actor, which we defined in this screens decorations. +HelpSelectMenuOpenedMessageCommand=stoptweening;decelerate,0.125;diffusealpha,0; +HelpSelectMenuClosedMessageCommand=stoptweening;accelerate,0.0725;diffusealpha,1; +# Clone everything from HelpDisplay: we're lazy +ShowAlternateHelpDisplay=true +# AlternateHelpDisplaySelectMenuOpenedMessageCommand=stoptweening;y,SCREEN_BOTTOM-16;accelerate,0.0725/2;y,SCREEN_BOTTOM-16-16;diffusealpha,1;decelerate,0.0725/2;y,SCREEN_BOTTOM-16-32; +# AlternateHelpDisplaySelectMenuClosedMessageCommand=stoptweening;y,SCREEN_BOTTOM-16;smooth,0.125;y,SCREEN_BOTTOM-16;diffusealpha,0; +AlternateHelpDisplaySelectMenuOpenedMessageCommand=stoptweening;accelerate,0.0725;diffusealpha,1; +AlternateHelpDisplaySelectMenuClosedMessageCommand=stoptweening;decelerate,0.125;diffusealpha,0; +# +MusicWheelX=SCREEN_CENTER_X+160 +MusicWheelY=SCREEN_CENTER_Y +MusicWheelOnCommand=draworder,-5;fov,90;vanishpoint,SCREEN_CENTER_X+160,SCREEN_CENTER_Y;addx,SCREEN_CENTER_X;decelerate,0.35;addx,-SCREEN_CENTER_X +MusicWheelOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowNewSong=not GAMESTATE:IsCourseMode() +NewSongX=SCREEN_CENTER_X-160+128-24 +NewSongY=SCREEN_TOP+160-6 +NewSongOnCommand=finishtweening;diffuse,Color("Orange");diffusetopedge,Color("Yellow");strokecolor,Color("Black");zoom,0.675;draworder,106;playcommand,"Set" +NewSongOffCommand=accelerate,0.35*0.5;zoom,0.675;diffusealpha,0 +NewSongShowCommand=finishtweening;diffusealpha,1;glowshift;effectclock,'bgm';effectperiod,4;textglowmode,'TextGlowMode_Inner'; +NewSongHideCommand=finishtweening;;diffusealpha,0;stopeffect; +# +ShowSongTime=true +SongTimeX=SCREEN_CENTER_X-160 +SongTimeY=SCREEN_TOP+160+(36/2)+8 +SongTimeOnCommand=zoom,0.75;strokecolor,Color("Outline");shadowlength,1 +SongTimeOffCommand=bouncebegin,0.15;zoom,0;diffusealpha,0; +SongTimeResetCommand=diffuse,Color("White"); +SongTimeAutogenCommand=diffuse,Color("Green"); +SongTimeLongCommand=diffuse,Color("Yellow");diffusebottomedge,Color("Orange"); +SongTimeMarathonCommand=diffuse,Color("Orange");diffusebottomedge,Color("Red"); +# +ShowSortOrderFrame=true +SortOrderFrameX=SCREEN_CENTER_X+128+32 +SortOrderFrameY=SCREEN_TOP+24 +SortOrderFrameOnCommand=draworder,105;shadowlength,1 +SortOrderFrameSortCommand= +SortOrderFrameSongChosenCommand=linear,0.25;diffusealpha,0; +SortOrderFrameOffCommand=bouncebegin,0.15;zoomy,0; +# +ShowSortOrder=true +SortOrderX=SCREEN_CENTER_X+128+32-48+4 +SortOrderY=SCREEN_TOP+24 +SortOrderOnCommand=draworder,105;horizalign,left;strokecolor,Color("Outline");zoom,0.675;maxwidth,114/0.675; +SortOrderSortCommand=finishtweening;zoom,0.675*1.25;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");decelerate,0.5;zoom,0.675;diffuse,Color("White"); +SortOrderSongChosenCommand=linear,0.25;diffusealpha,0; +SortOrderOffCommand=bouncebegin,0.15;zoomy,0; +# +ShowStageDisplay=true +StageDisplayX=SCREEN_CENTER_X-160-64 +StageDisplayY=SCREEN_TOP+160-96+4 +StageDisplayOnCommand=draworder,105;fov,90;zoom,0.75;zoomy,0;sleep,0.35;smooth,0.35;zoomy,0.75 +StageDisplayOffCommand=linear,0.25;zoomy,0; +# +ShowDifficultyDisplay=not GetGamePrefB("AutoSetStyle") and not GAMESTATE:IsCourseMode() +# ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode() +DifficultyDisplayX=SCREEN_CENTER_X-160+64 +DifficultyDisplayY=SCREEN_TOP+160-96+4 +DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1 +DifficultyDisplayOffCommand=linear,0.25;zoomy,0; +# +BannerX=SCREEN_CENTER_X-160 +BannerY=SCREEN_TOP+160-36 +BannerOnCommand=draworder,-1;scaletoclipped,256,80;visible,true;ztest,1;addy,-SCREEN_CENTER_Y;decelerate,0.35;addy,SCREEN_CENTER_Y +BannerOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowBannerFrame=true +BannerFrameX=SCREEN_CENTER_X-160 +BannerFrameY=SCREEN_TOP+160-36 +BannerFrameOnCommand=draworder,105;addy,-SCREEN_CENTER_Y;decelerate,0.35;addy,SCREEN_CENTER_Y +BannerFrameOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowBPMDisplay=true +BPMDisplayX=SCREEN_CENTER_X-160-90+2 +BPMDisplayY=SCREEN_TOP+160+(36/2)+8 +BPMDisplayOnCommand=finishtweening;maxwidth,128;horizalign,left;strokecolor,Color("Outline");addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1 +BPMDisplayOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowBPMLabel=true +BPMLabelX=SCREEN_CENTER_X-160-90 +BPMLabelY=SCREEN_TOP+160+(36/2)+6 +BPMLabelOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X +BPMLabelOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowDifficultyList=not GAMESTATE:IsCourseMode(); +DifficultyListX=SCREEN_CENTER_X-160 +DifficultyListY=SCREEN_TOP+216 +DifficultyListOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X; +DifficultyListOffCommand=bouncebegin,0.15;zoomx,0; +# +DifficultyListTweenOnCommand=stoptweening;bounceend,0.135;zoomx,1 +DifficultyListTweenOffCommand=stoptweening;bouncebegin,0.135;zoomx,0 +# Shrink the difficultylist for viewing panedisplays; +# DifficultyListSelectMenuOpenedMessageCommand=stoptweening;decelerate,0.125;zoom,0.5; +# DifficultyListSelectMenuClosedMessageCommand=stoptweening;accelerate,0.0725;zoom,1; +# +ShowPaneDisplayFrameP1=true +PaneDisplayFrameP1X=SCREEN_CENTER_X-160 +PaneDisplayFrameP1Y=SCREEN_BOTTOM-112-2 +PaneDisplayFrameP1OnCommand=player,PLAYER_1;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 +PaneDisplayFrameP1OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowPaneDisplayTextP1=true +PaneDisplayTextP1X=SCREEN_CENTER_X-160 +PaneDisplayTextP1Y=SCREEN_BOTTOM-122-2 +PaneDisplayTextP1OnCommand=player,PLAYER_1;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 +PaneDisplayTextP1OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowPaneDisplayFrameP2=true +PaneDisplayFrameP2X=SCREEN_CENTER_X+160 +PaneDisplayFrameP2Y=SCREEN_BOTTOM-112-2 +PaneDisplayFrameP2OnCommand=player,PLAYER_2;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 +PaneDisplayFrameP2OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowPaneDisplayTextP2=true +PaneDisplayTextP2X=SCREEN_CENTER_X+160 +PaneDisplayTextP2Y=SCREEN_BOTTOM-122-2 +PaneDisplayTextP2OnCommand=player,PLAYER_2;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1 +PaneDisplayTextP2OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowCourseContentsList=false +CourseContentsListX=SCREEN_CENTER_X-160 +CourseContentsListY=SCREEN_TOP+216+6 +CourseContentsListOnCommand=addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X +CourseContentsListOffCommand=bouncebegin,0.15;zoomx,0; +# +ShowNumCourseSongs=GAMESTATE:IsCourseMode() +NumCourseSongsX=SCREEN_CENTER_X-160+128 +NumCourseSongsY=SCREEN_TOP+160+(36/2)+8 +NumCourseSongsOnCommand=zoom,0.75;strokecolor,Color("Outline");shadowlength,1 +NumCourseSongsOffCommand=bouncebegin,0.15;zoom,0;diffusealpha,0; +# +ShowSongOptions=true +SongOptionsX=SCREEN_CENTER_X +SongOptionsY=SCREEN_CENTER_Y +SongOptionsOnCommand=visible,false;draworder,1000 +SongOptionsOffCommand= +#-- +SongOptionsShowCommand=visible,true;zoom,1.2;settext,"PRESS &START; FOR OPTIONS";decelerate,0.3;zoom,1; +SongOptionsEnterCommand=settext,"ENTERING OPTIONS";sleep,0.5;linear,0.3;zoomy,0; +SongOptionsHideCommand=linear,0.3;zoomy,0; +# +ShowSongOptionsFrame=true +SongOptionsFrameX=SCREEN_CENTER_X +SongOptionsFrameY=SCREEN_CENTER_Y +SongOptionsFrameOnCommand=visible,false;draworder,1000 +SongOptionsFrameOffCommand= +#-- +SongOptionsFrameShowCommand=visible,true;diffuse,Color("Orange");diffusealpha,0.5;zoomy,40*1.5;linear,1.5;zoomy,40; +SongOptionsFrameEnterCommand=sleep,0.5;linear,0.3;diffusealpha,0; +SongOptionsFrameHideCommand=linear,0.3;diffusealpha,0 +# +CDTitleX=SCREEN_CENTER_X-160+90 +CDTitleY=SCREEN_TOP+160+(36/2)+8 +CDTitleFrontCommand=diffuse,color('0.5,0.5,0.5,1');cullmode,'CullMode_Front' +CDTitleBackCommand=cullmode,'CullMode_Back' +CDTitleOnCommand=draworder,106;shadowlength,1;zoom,0.75;diffusealpha,1;zoom,0;bounceend,0.35;zoom,0.75;spin;effectmagnitude,0,180,0; +CDTitleOffCommand=bouncebegin,0.15;zoomx,0; +# +ScoreFrameP1X= +ScoreFrameP1Y= +ScoreFrameP1OnCommand=visible,false +ScoreFrameP1OffCommand= +ScoreP1X= +ScoreP1Y= +ScoreP1OnCommand=visible,false +ScoreP1OffCommand= +# +ScoreP2X= +ScoreP2Y= +ScoreP2OnCommand=visible,false +ScoreP2OffCommand= +ScoreFrameP2X= +ScoreFrameP2Y= +ScoreFrameP2OnCommand=visible,false +ScoreFrameP2OffCommand= +# +ScoreP1SortChangeCommand=stoptweening; +ScoreP2SortChangeCommand=stoptweening; +ScoreFrameP1SortChangeCommand=stoptweening; +ScoreFrameP2SortChangeCommand=stoptweening; +# +ShowStepsDisplayP1=GAMESTATE:IsHumanPlayer(PLAYER_1) +StepsDisplayP1X=SCREEN_CENTER_X-160 +StepsDisplayP1Y=SCREEN_BOTTOM-60 +StepsDisplayP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +StepsDisplayP1OffCommand=bouncebegin,0.15;zoomx,0; +# StepsDisplayP1CurrentStepsP1ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1 +# +ShowStepsDisplayP2=GAMESTATE:IsHumanPlayer(PLAYER_2) +StepsDisplayP2X=SCREEN_CENTER_X+160 +StepsDisplayP2Y=SCREEN_BOTTOM-60 +StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0; +# StepsDisplayP2CurrentStepsP2ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1 +# +ShowPercentScoreP1=true +PercentScoreP1X=SCREEN_CENTER_X-80-1 +PercentScoreP1Y=SCREEN_BOTTOM-60 +PercentScoreP1OnCommand=player,PLAYER_1;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowPercentScoreP2=true +PercentScoreP2X=SCREEN_CENTER_X+240-1 +PercentScoreP2Y=SCREEN_BOTTOM-60 +PercentScoreP2OnCommand=player,PLAYER_2;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0; +[ScreenSelectCourse] +#~ ScreenInitCommand=%function(self) \ + #~ GAMESTATE:ApplyGameCommand("sort,AllCourses",PLAYER_1); \ + #~ GAMESTATE:ApplyGameCommand("sort,AllCourses",PLAYER_2); \ +#~ end; +# +DefaultSort="Nonstop" +# +ShowDifficultyList=false +ShowCourseContentsList=true +ShowNumCourseSongs=true +# +UsePlayerSelectMenu=false +SelectMenuAvailable=false +# +ShowPaneDisplayFrameP1=false +ShowPaneDisplayTextP1=false +ShowPaneDisplayFrameP2=false +ShowPaneDisplayTextP2=false +[ScreenNetSelectMusic] +StepsDisplayP1X=SCREEN_CENTER_X-240 +StepsDisplayP1Y=SCREEN_CENTER_Y+185 +StepsDisplayP1OnCommand=horizalign,right;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +StepsDisplayP1OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +#--# +StepsDisplayP2X=SCREEN_CENTER_X-110 +StepsDisplayP2Y=SCREEN_CENTER_Y+185 +StepsDisplayP2OnCommand=horizalign,right;zoomx,0.0;zoomy,0.0;linear,0.5;zoomy,1.0;zoomx,1.0 +StepsDisplayP2OffCommand=linear,0.5;zoomx,0.0;zoomy,0.0 +#====# +BPMDisplayX=SCREEN_CENTER_X-160-90+2 +BPMDisplayY=SCREEN_CENTER_Y+156 +BPMDisplayOnCommand=finishtweening;horizalign,left;strokecolor,Color("Outline");maxwidth,128;addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1 +BPMDisplayOffCommand=bouncebegin,0.15;zoomx,0; +#--# +ShowBPMLabel=true +BPMLabelX=SCREEN_CENTER_X-160-90 +BPMLabelY=SCREEN_CENTER_Y+156 +BPMLabelOnCommand=horizalign,right;zoom,0.75;strokecolor,Color("Outline");addx,-SCREEN_CENTER_X;decelerate,0.35;addx,SCREEN_CENTER_X +BPMLabelOffCommand=bouncebegin,0.15;zoomx,0; + +UsersX=SCREEN_CENTER_X-272 +UsersY=SCREEN_CENTER_Y-172 +UsersDX=40 +UsersAY=16 +UsersOnCommand=draworder,2;zoom,0.75;shadowlength,1 +# +ShowDifficultyDisplay=true +DifficultyDisplayX=SCREEN_CENTER_X-240+200 +DifficultyDisplayY=SCREEN_CENTER_Y+185 +DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1 +DifficultyDisplayOffCommand=linear,0.25;zoomy,0; +[ScreenPlayerOptions] +LineNames=GetDefaultOptionLines() +#~ LineNames="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" +Line1="lua,SpeedMods()" +#~ Line1="list,Speed" +Line2="list,Accel" +Line3="list,Effect" +Line4="list,Appearance" +Line5="list,Turn" +Line6="list,Insert" +LineR="list,Remove" +Line7="list,Scroll" +Line8="list,NoteSkins" +Line9="list,Holds" +Line10="list,Mines" +Line11="list,Attacks" +Line12="list,PlayerAutoPlay" +Line13="list,Hide" +Line14="list,Persp" +Line15="list,ScoreDisplay" +Line16="list,Steps" +Line17="lua,OptionRowProTiming()" +Line18="list,Characters" +[ScreenEditOptions] +Line1="lua,SpeedMods()" + +[ScreenStageInformation] +ForceTimer=true +TimerOnCommand=visible,false +TimerSeconds=3 +# +WaitForChildrenBeforeTweening=true +[ScreenGameplay] +ShowLifeMeterForDisabledPlayers=false +# +SongMeterDisplayX=SCREEN_CENTER_X +SongMeterDisplayY=SCREEN_TOP+50 +SongMeterDisplayOnCommand=draworder,50;zoom,0;y,SCREEN_TOP-24;sleep,1.5;decelerate,0.5;zoom,1;y,SCREEN_TOP+50 +SongMeterDisplayOffCommand= +# +ShowSongTitle=true +SongTitleX=SCREEN_CENTER_X +SongTitleY=SCREEN_TOP+50+12 +SongTitleOnCommand=draworder,55;shadowlength,1;basezoom,0.5;zoomy,0;sleep,1.5+0.5;smooth,0.5;zoom,1 +SongTitleOffCommand= +# +SongMeterDisplayP1X=SCREEN_LEFT+16 +SongMeterDisplayP1Y=SCREEN_CENTER_Y +SongMeterDisplayP1OnCommand=rotationz,-90;zoom,0;addx,-24;sleep,1.5;decelerate,0.5;zoom,1;addx,24 +SongMeterDisplayP1OffCommand= +# +SongMeterDisplayP2X=SCREEN_RIGHT-16 +SongMeterDisplayP2Y=SCREEN_CENTER_Y +SongMeterDisplayP2OnCommand=rotationz,-90;zoom,0;addx,24;sleep,1.5;decelerate,0.5;zoom,1;addx,-24 +SongMeterDisplayP2OffCommand= +# +ShowBPMDisplay=true +BPMDisplayX=Center1Player() and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X +# BPMDisplayX=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X +BPMDisplayY=SCREEN_BOTTOM-16 +# BPMDisplayOnCommand=zoom,0.5; +BPMDisplayOffCommand=bounceend,0.25;zoom,0 +# +ShowStageDisplay=false +StageDisplayX=SCREEN_CENTER_X +StageDisplayY=SCREEN_TOP+24 +StageDisplayOnCommand=zoom,0.5; +StageDisplayOffCommand=bounceend,0.25;zoom,0 +# +ShowScoreFrame=GetUserPrefB("GameplayFooter"); +ScoreFrameX=SCREEN_CENTER_X +ScoreFrameY=SCREEN_BOTTOM+4 +ScoreFrameOnCommand=vertalign,bottom;zoomtowidth,SCREEN_WIDTH+4;diffuse,color("#ffd400");addy,80;sleep,2;decelerate,0.5;addy,-80; +ScoreFrameOffCommand= +# +LifeP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# LifeP1X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +LifeP1Y=SCREEN_TOP+24 +LifeP1OnCommand=finishtweening;addy,-48;sleep,1.25;bounceend,0.35;addy,48; +#~ LifeP1OnCommand=addx,-SCREEN_CENTER_X;sleep,1.25;decelerate,0.35*0.25;addx,SCREEN_CENTER_X*1.5;accelerate,0.35*0.25;addx,-SCREEN_CENTER_X*0.25;bounceend,0.35*0.25;addx,-SCREEN_CENTER_X*0.25 +LifeP1OffCommand= +LifeP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# LifeP2X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +LifeP2Y=SCREEN_TOP+24 +LifeP2OnCommand=finishtweening;zoomx,-1;addy,-48;sleep,1.25;bounceend,0.35;addy,48; +#~ LifeP2OnCommand=zoomx,-1;addx,SCREEN_CENTER_X;sleep,1.25;decelerate,0.35*0.25;addx,-SCREEN_CENTER_X*1.5;accelerate,0.35*0.25;addx,SCREEN_CENTER_X*0.25;bounceend,0.35*0.25;addx,SCREEN_CENTER_X*0.25 +LifeP2OffCommand= +CombinedLifeX=SCREEN_CENTER_X +CombinedLifeY=SCREEN_TOP+24 +CombinedLifeOnCommand=finishtweening;diffuseleftedge,PlayerColor(PLAYER_1);diffuserightedge,PlayerColor(PLAYER_2);addy,-48;sleep,1.25;bounceend,0.35;addy,48; +CombinedLifeOffCommand= +# +ToastyDisplayP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# ToastyDisplayP1X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ToastyDisplayP1Y=SCREEN_CENTER_Y +ToastyDisplayP1OnCommand=visible,false +ToastyDisplayP1OffCommand= +# +ToastyDisplayP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# ToastyDisplayP2X=(GAMESTATE:GetCurrentStyle():GetStyleType() == 'StyleType_OnePlayerTwoSides' or (PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1)) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +ToastyDisplayP2Y=SCREEN_CENTER_Y +ToastyDisplayP2OnCommand=visible,false +ToastyDisplayP2OffCommand= +# +SongNumberP1X=Center1Player() and SCREEN_CENTER_X - 60 or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") - 60 +SongNumberP1Y=SCREEN_TOP+24+7 +SongNumberP1OnCommand=zoom,0.75;diffuse,PlayerColor(PLAYER_1);strokecolor,BoostColor(PlayerColor(PLAYER_1),0.5) +SongNumberP1OffCommand= +SongNumberP2X=Center1Player() and SCREEN_CENTER_X + 60 or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 60 +SongNumberP2Y=SCREEN_TOP+24+7 +SongNumberP2OnCommand=zoom,0.75;diffuse,PlayerColor(PLAYER_2);strokecolor,BoostColor(PlayerColor(PLAYER_2),0.5) +SongNumberP2OffCommand= +# +RemainingTimeP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") + 32 +RemainingTimeP1Y=THEME:GetMetric(Var "LoadingScreen","ScoreP1Y") - 22 +RemainingTimeP1OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_1);diffusebottomedge,ColorMidTone(PlayerColor(PLAYER_1)); +RemainingTimeP1OffCommand= +RemainingTimeP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") + 32 +RemainingTimeP2Y=THEME:GetMetric(Var "LoadingScreen","ScoreP2Y") - 22 +RemainingTimeP2OnCommand=shadowlength,1;diffuse,PlayerColor(PLAYER_2);diffusebottomedge,ColorMidTone(PlayerColor(PLAYER_2)); +RemainingTimeP2OffCommand= +# +DeltaSecondsP1X=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP1X") - 80 +DeltaSecondsP1Y=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP1Y") +DeltaSecondsP1OnCommand=shadowlength,1;skewx,-0.125 +DeltaSecondsP1GainSecondsCommand=finishtweening;diffusealpha,1;zoom,1;decelerate,0.3;zoom,0.75;sleep,0.5;linear,0.2;diffusealpha,0;zoom,0 +DeltaSecondsP1OffCommand= +DeltaSecondsP2X=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP2X") - 80 +DeltaSecondsP2Y=THEME:GetMetric(Var "LoadingScreen","RemainingTimeP2Y") +DeltaSecondsP2OnCommand=shadowlength,1;skewx,-0.125 +DeltaSecondsP2GainSecondsCommand=finishtweening;diffusealpha,1;zoom,1;decelerate,0.3;zoom,0.75;sleep,0.5;linear,0.2;diffusealpha,0;zoom,0 +DeltaSecondsP2OffCommand= +# +ScoreP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# ScoreP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ScoreP1Y=SCREEN_BOTTOM-28 +ScoreP1OnCommand=visible,GetUserPrefB("UserPrefGameplayShowScore");diffuse,PlayerColor(PLAYER_1);sleep,3+0.3;smooth,0.5;y,SCREEN_BOTTOM-50 +ScoreP1OffCommand= +ScoreP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# ScoreP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +ScoreP2Y=SCREEN_BOTTOM-28 +ScoreP2OnCommand=visible,GetUserPrefB("UserPrefGameplayShowScore");diffuse,PlayerColor(PLAYER_2);sleep,3+0.3;smooth,0.5;y,SCREEN_BOTTOM-50 +ScoreP2OffCommand= +# +StepsDescriptionP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# StepsDescriptionP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +StepsDescriptionP1Y=SCREEN_CENTER_Y-24 +StepsDescriptionP1OnCommand=zoom,0.5;diffusealpha,0;addy,-10;smooth,0.3;diffusealpha,1;addy,10;sleep,3;smooth,0.5;addy,-10;diffusealpha,0 +StepsDescriptionP1OffCommand= +StepsDescriptionP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# StepsDescriptionP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +StepsDescriptionP2Y=SCREEN_CENTER_Y-24 +StepsDescriptionP2OnCommand=zoom,0.5;diffusealpha,0;addy,-10;smooth,0.3;diffusealpha,1;addy,10;sleep,3;smooth,0.5;addy,-10;diffusealpha,0 +StepsDescriptionP2OffCommand= +# +PlayerOptionsP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# PlayerOptionsP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +PlayerOptionsP1Y=SCREEN_CENTER_Y+24 +PlayerOptionsP1OnCommand=vertalign,top;wrapwidthpixels,256*2;zoom,0.5;diffusealpha,0;addy,10;smooth,0.3;diffusealpha,1;addy,-10;sleep,3;smooth,0.5;addy,10;diffusealpha,0 +PlayerOptionsP1OffCommand= +PlayerOptionsP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# PlayerOptionsP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +PlayerOptionsP2Y=SCREEN_CENTER_Y+24 +PlayerOptionsP2OnCommand=vertalign,top;wrapwidthpixels,256*2;zoom,0.5;diffusealpha,0;addy,10;smooth,0.3;diffusealpha,1;addy,-10;sleep,3;smooth,0.5;addy,10;diffusealpha,0 +PlayerOptionsP2OffCommand= +# +StepsDisplayP1X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +# StepsDisplayP1X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +StepsDisplayP1Y=SCREEN_CENTER_Y +StepsDisplayP1OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;queuecommand,( GetUserPrefB("UserPrefGameplayShowStepsDisplay") == true and "Show" or "Hide" ); +StepsDisplayP1ShowCommand=smooth,0.5;y,SCREEN_BOTTOM-20; +StepsDisplayP1HideCommand=linear,0.5;zoomy,0 +StepsDisplayP1OffCommand= +StepsDisplayP2X=Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +# StepsDisplayP2X=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX") +StepsDisplayP2Y=SCREEN_CENTER_Y +StepsDisplayP2OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;queuecommand,( GetUserPrefB("UserPrefGameplayShowStepsDisplay") == true and "Show" or "Hide" ); +StepsDisplayP2ShowCommand=smooth,0.5;y,SCREEN_BOTTOM-20; +StepsDisplayP2HideCommand=linear,0.5;zoomy,0 +StepsDisplayP2OffCommand= +# +SongOptionsX=Center1Player() and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X +# SongOptionsX=(PREFSMAN:GetPreference("Center1Player") and GAMESTATE:GetNumPlayersEnabled() == 1) and (GAMESTATE:GetMasterPlayerNumber() == PLAYER_1 and THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") or THEME:GetMetric(Var "LoadingScreen","PlayerP2OnePlayerOneSideX")) or SCREEN_CENTER_X +SongOptionsY=SCREEN_BOTTOM-32 +SongOptionsOnCommand=zoom,0.5 +SongOptionsOffCommand= +# +OniGameOverP1X= +OniGameOverP1Y= +OniGameOverP1OnCommand= +OniGameOverP1OffCommand= +# +OniGameOverP2X= +OniGameOverP2Y= +OniGameOverP2OnCommand= +OniGameOverP2OffCommand= +# +SurviveTimeX=SCREEN_CENTER_X +SurviveTimeY=SCREEN_CENTER_Y+40 +SurviveTimeOnCommand=shadowlength,1;zoomx,0;bounceend,1;zoomx,1 +SurviveTimeOffCommand=shadowlength,1;linear,1;zoom,0.75;diffusealpha,0 +# +ActiveAttackListP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ActiveAttackListP1Y= +ActiveAttackListP1OnCommand=visible,false +ActiveAttackListP1OffCommand= +ActiveAttackListP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") +ActiveAttackListP2Y= +ActiveAttackListP2OnCommand=visible,false +ActiveAttackListP2OffCommand= +# +LyricDisplaySetNoReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+160 +LyricDisplaySetReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-140 +# This is used if one player is in reverse and the other isn't. +LyricDisplaySetOneReverseCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-160; +LyricDisplayDefaultColor=Color("White") + +[ScreenGameplaySyncMachine] +SongMeterDisplayP1OnCommand=visible,false +SongMeterDisplayP2OnCommand=visible,false +StepsDescriptionP1OnCommand=visible,false +StepsDescriptionP2OnCommand=visible,false +StepsDisplayP1OnCommand=visible,false +StepsDisplayP2OnCommand=visible,false +PlayerOptionsP1OnCommand=visible,false +PlayerOptionsP2OnCommand=visible,false + +[ScreenEvaluation] +Class="ScreenEvaluation" +Fallback="ScreenWithMenuElements" +# +StageDisplayNumberOffset=0 +# +NextScreen=Branches.AfterEvaluation() +PrevScreen=Branches.AfterEvaluation() +# +PlayMusic=false +# +PrepareScreens="ScreenProfileSave,ScreenSelectMusic" +PersistScreens="ScreenEvaluation,ScreenProfileSave,ScreenSelectMusic" +# +ShowJudgmentLineW1=true +ShowJudgmentLineW2=true +ShowJudgmentLineW3=true +ShowJudgmentLineW4=true +ShowJudgmentLineW5=true +ShowJudgmentLineHeld=true +ShowJudgmentLineMiss=true +ShowJudgmentLineMaxCombo=true +ShowGradeArea=true +ShowScoreArea=true +ShowPointsArea=true +ShowSharedJudgmentLineLabels=true +ShowGraphDisplay=true +ShowComboGraph=true +ShowStepsDisplay=true + +# +W1NumberP1X=SCREEN_CENTER_X-160+40 +W1NumberP1Y=SCREEN_TOP+160 +W1NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +W1NumberP1OffCommand= +W1NumberP2X=SCREEN_CENTER_X+160-40 +W1NumberP2Y=SCREEN_TOP+160 +W1NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +W1NumberP2OffCommand= +W1LabelX=SCREEN_CENTER_X +W1LabelY=SCREEN_TOP+160 +W1LabelOnCommand= +W1LabelOffCommand= +# +W2NumberP1X=SCREEN_CENTER_X-160+40 +W2NumberP1Y=SCREEN_TOP+180 +W2NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +W2NumberP1OffCommand= +W2NumberP2X=SCREEN_CENTER_X+160-40 +W2NumberP2Y=SCREEN_TOP+180 +W2NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +W2NumberP2OffCommand= +W2LabelX=SCREEN_CENTER_X +W2LabelY=SCREEN_TOP+180 +W2LabelOnCommand= +W2LabelOffCommand= +# +W3NumberP1X=SCREEN_CENTER_X-160+40 +W3NumberP1Y=SCREEN_TOP+200 +W3NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +W3NumberP1OffCommand= +W3NumberP2X=SCREEN_CENTER_X+160-40 +W3NumberP2Y=SCREEN_TOP+200 +W3NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +W3NumberP2OffCommand= +W3LabelX=SCREEN_CENTER_X +W3LabelY=SCREEN_TOP+200 +W3LabelOnCommand= +W3LabelOffCommand= +# +W4NumberP1X=SCREEN_CENTER_X-160+40 +W4NumberP1Y=SCREEN_TOP+220 +W4NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +W4NumberP1OffCommand= +W4NumberP2X=SCREEN_CENTER_X+160-40 +W4NumberP2Y=SCREEN_TOP+220 +W4NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +W4NumberP2OffCommand= +W4LabelX=SCREEN_CENTER_X +W4LabelY=SCREEN_TOP+220 +W4LabelOnCommand= +W4LabelOffCommand= +# +W5NumberP1X=SCREEN_CENTER_X-160+40 +W5NumberP1Y=SCREEN_TOP+240 +W5NumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +W5NumberP1OffCommand= +W5NumberP2X=SCREEN_CENTER_X+160-40 +W5NumberP2Y=SCREEN_TOP+240 +W5NumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +W5NumberP2OffCommand= +W5LabelX=SCREEN_CENTER_X +W5LabelY=SCREEN_TOP+240 +W5LabelOnCommand= +W5LabelOffCommand= +# +MissNumberP1X=SCREEN_CENTER_X-160+40 +MissNumberP1Y=SCREEN_TOP+260 +MissNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +MissNumberP1OffCommand= +MissNumberP2X=SCREEN_CENTER_X+160-40 +MissNumberP2Y=SCREEN_TOP+260 +MissNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +MissNumberP2OffCommand= +MissLabelX=SCREEN_CENTER_X +MissLabelY=SCREEN_TOP+260 +MissLabelOnCommand= +MissLabelOffCommand= +# +HeldNumberP1X=SCREEN_CENTER_X-160+40 +HeldNumberP1Y=SCREEN_TOP+280 +HeldNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +HeldNumberP1OffCommand= +HeldNumberP2X=SCREEN_CENTER_X+160-40 +HeldNumberP2Y=SCREEN_TOP+280 +HeldNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +HeldNumberP2OffCommand= +HeldLabelX=SCREEN_CENTER_X +HeldLabelY=SCREEN_TOP+280 +HeldLabelOnCommand= +HeldLabelOffCommand= +# +MaxComboNumberP1X=SCREEN_CENTER_X-160+40 +MaxComboNumberP1Y=SCREEN_TOP+300 +MaxComboNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1 +MaxComboNumberP1OffCommand= +MaxComboNumberP2X=SCREEN_CENTER_X+160-40 +MaxComboNumberP2Y=SCREEN_TOP+300 +MaxComboNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1 +MaxComboNumberP2OffCommand= +MaxComboLabelX=SCREEN_CENTER_X +MaxComboLabelY=SCREEN_TOP+300 +MaxComboLabelOnCommand= +MaxComboLabelOffCommand= +# +ScoreLabelX=SCREEN_CENTER_X +ScoreLabelY=SCREEN_TOP+330 +ScoreLabelOnCommand= +ScoreLabelOffCommand= +# +ScoreNumberP1X=SCREEN_CENTER_X-160 +ScoreNumberP1Y=SCREEN_TOP+320 +ScoreNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1;zoom,0.775 +ScoreNumberP1OffCommand= +ScoreNumberP2X=SCREEN_CENTER_X+160 +ScoreNumberP2Y=SCREEN_TOP+320 +ScoreNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1;zoom,0.775 +ScoreNumberP2OffCommand= +# +PercentFrameP1X=SCREEN_CENTER_X-160 +PercentFrameP1Y=SCREEN_TOP+320 +PercentFrameP1OnCommand=visible,false +PercentFrameP1OffCommand= +# +PercentFrameP2X=SCREEN_CENTER_X+160 +PercentFrameP2Y=SCREEN_TOP+320 +PercentFrameP2OnCommand=visible,false +PercentFrameP2OffCommand= +# +PercentP1X=SCREEN_CENTER_X-160 +PercentP1Y=SCREEN_TOP+320 +PercentP1OnCommand=visible,false +PercentP1OffCommand= +# +PercentP2X=SCREEN_CENTER_X+160 +PercentP2Y=SCREEN_TOP+320 +PercentP2OnCommand=visible,false +PercentP2OffCommand= +# +LargeBannerX=SCREEN_CENTER_X +LargeBannerY=SCREEN_TOP+100 +LargeBannerOnCommand= +LargeBannerOffCommand= +LargeBannerFrameX=SCREEN_CENTER_X +LargeBannerFrameY=SCREEN_TOP+100 +LargeBannerFrameOnCommand= +LargeBannerFrameOffCommand= +# +GradeFrameP1X=SCREEN_CENTER_X-220 +GradeFrameP1Y=SCREEN_TOP+80 +GradeFrameP1OnCommand= +GradeFrameP1OffCommand= +GradeFrameP2X=SCREEN_CENTER_X+220 +GradeFrameP2Y=SCREEN_TOP+80 +GradeFrameP2OnCommand= +GradeFrameP2OffCommand= +# +GradeP1X=SCREEN_CENTER_X-220 +GradeP1Y=SCREEN_TOP+100 +GradeP1OnCommand= +GradeP1OffCommand= +GradeP2X=SCREEN_CENTER_X+220 +GradeP2Y=SCREEN_TOP+100 +GradeP2OnCommand= +GradeP2OffCommand= +# +PlayerOptionsP1X=SCREEN_CENTER_X-160 +PlayerOptionsP1Y=SCREEN_TOP+352 +PlayerOptionsP1OnCommand=zoom,0.5;shadowlength,1 +PlayerOptionsP1OffCommand= +## +PlayerOptionsP2X=SCREEN_CENTER_X+160 +PlayerOptionsP2Y=SCREEN_TOP+352 +PlayerOptionsP2OnCommand=zoom,0.5;shadowlength,1 +PlayerOptionsP2OffCommand= +# +SongOptionsX=SCREEN_CENTER_X +SongOptionsY=SCREEN_BOTTOM-104 +SongOptionsOnCommand=zoom,0.5;shadowlength,1; +SongOptionsOffCommand= +# +DisqualifiedP1X=SCREEN_CENTER_X-220 +DisqualifiedP1Y=SCREEN_TOP+140 +DisqualifiedP1OnCommand= +DisqualifiedP1OffCommand= +DisqualifiedP2X=SCREEN_CENTER_X+220 +DisqualifiedP2Y=SCREEN_TOP+140 +DisqualifiedP2OnCommand= +DisqualifiedP2OffCommand= +# +GraphDisplayP1X=SCREEN_CENTER_X-160 +GraphDisplayP1Y=SCREEN_BOTTOM-100 +GraphDisplayP1OnCommand= +GraphDisplayP1OffCommand= +GraphDisplayP2X=SCREEN_CENTER_X+160 +GraphDisplayP2Y=SCREEN_BOTTOM-100 +GraphDisplayP2OnCommand= +GraphDisplayP2OffCommand= +# +ComboGraphP1X=SCREEN_CENTER_X-160 +ComboGraphP1Y=SCREEN_BOTTOM-100+32-7 +ComboGraphP1OnCommand= +ComboGraphP1OffCommand= +ComboGraphP2X=SCREEN_CENTER_X+160 +ComboGraphP2Y=SCREEN_BOTTOM-100+32-7 +ComboGraphP2OnCommand= +ComboGraphP2OffCommand= +# +MachineRecordP1X=SCREEN_CENTER_X-220 +#MachineRecordP1Y=SCREEN_BOTTOM-156 + +MachineRecordP1Y=SCREEN_TOP+146 +MachineRecordP1OnCommand= +MachineRecordP1OffCommand= +# +MachineRecordP2X=SCREEN_CENTER_X+220 +#MachineRecordP2Y=SCREEN_BOTTOM-156 +MachineRecordP2Y=SCREEN_TOP+146 +MachineRecordP2OnCommand= +MachineRecordP2OffCommand= +# +PersonalRecordP1X=SCREEN_CENTER_X-160 +PersonalRecordP1Y=SCREEN_BOTTOM-144 +PersonalRecordP1OnCommand= +PersonalRecordP1OffCommand= +# +PersonalRecordP2X=SCREEN_CENTER_X+160 +PersonalRecordP2Y=SCREEN_BOTTOM-144 +PersonalRecordP2OnCommand= +PersonalRecordP2OffCommand= +# +StageAwardP1X=SCREEN_CENTER_X-220 +StageAwardP1Y=SCREEN_TOP+130 +StageAwardP1OnCommand=draworder,105;zoom,0.75;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");strokecolor,ColorDarkTone( Color("Orange") );glowshift;textglowmode,'TextGlowMode_Inner' +StageAwardP1OffCommand= +# +StageAwardP2X=SCREEN_CENTER_X+220 +StageAwardP2Y=SCREEN_TOP+130 +StageAwardP2OnCommand=draworder,105;zoom,0.75;diffuse,Color("Yellow");diffusebottomedge,Color("Orange");strokecolor,ColorDarkTone( Color("Orange") );glowshift;textglowmode,'TextGlowMode_Inner' +StageAwardP2OffCommand= +# +PeakComboAwardP1X=SCREEN_CENTER_X-160 +PeakComboAwardP1Y=SCREEN_TOP+300+10 +PeakComboAwardP1OnCommand=draworder,105;zoom,0.5;diffusebottomedge,Color("Blue");strokecolor,ColorDarkTone( Color("Blue") );glowshift;textglowmode,'TextGlowMode_Inner' +PeakComboAwardP1OffCommand= +# +PeakComboAwardP2X=SCREEN_CENTER_X+160 +PeakComboAwardP2Y=SCREEN_TOP+300+10 +PeakComboAwardP2OnCommand=draworder,105;zoom,0.5;diffusebottomedge,Color("Blue");strokecolor,ColorDarkTone( Color("Blue") );glowshift;textglowmode,'TextGlowMode_Inner' +PeakComboAwardP2OffCommand= +# +ShowStepsDisplayP1=GAMESTATE:IsHumanPlayer(PLAYER_1) +StepsDisplayP1X=SCREEN_CENTER_X-160 +StepsDisplayP1Y=SCREEN_BOTTOM-50 +StepsDisplayP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +StepsDisplayP1OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowStepsDisplayP2=GAMESTATE:IsHumanPlayer(PLAYER_2) +StepsDisplayP2X=SCREEN_CENTER_X+160 +StepsDisplayP2Y=SCREEN_BOTTOM-50 +StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0; +# +PercentScoreP1X=SCREEN_CENTER_X-82 +PercentScoreP1Y=SCREEN_BOTTOM-50 +PercentScoreP1OnCommand=draworder,100;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y; +PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0; +# +PercentScoreP2X=SCREEN_CENTER_X+238 +PercentScoreP2Y=SCREEN_BOTTOM-50 +PercentScoreP2OnCommand=draworder,100;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y; +PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowGameType=true +GameTypeX=SCREEN_CENTER_X +GameTypeY=SCREEN_BOTTOM-48 +GameTypeOnCommand=addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y;zoom,0.675;shadowlength,1;shadowcolor,color("#22222266") +GameTypeOffCommand=bouncebegin,0.15;addy,SCREEN_CENTER_Y; +# +ShowTimingDifficulty=true +TimingDifficultyX=SCREEN_CENTER_X +TimingDifficultyY=SCREEN_TOP+16 +TimingDifficultyOnCommand=zoom,0.675;draworder,105 +TimingDifficultyOffCommand= +# +ShowLifeDifficulty=true +LifeDifficultyX=SCREEN_CENTER_X +LifeDifficultyY=SCREEN_TOP+32 +LifeDifficultyOnCommand=zoom,0.675;draworder,105 +LifeDifficultyOffCommand= +# +ShowSongInformation=true +SongInformationX=SCREEN_CENTER_X +SongInformationY=SCREEN_TOP+100 +SongInformationOnCommand=playcommand,"Set";draworder,105 +SongInformationOffCommand= +[ScreenEvaluationNormal] +Fallback="ScreenEvaluation" +# +PlayMusic=false +# +ShowBannerFrame=false +# +ShowStageDisplay=true +StageDisplayX=SCREEN_CENTER_X+160 +StageDisplayY=SCREEN_TOP+28 +StageDisplayOnCommand=draworder,105;fov,90;vertalign,bottom;vanishpoint,SCREEN_CENTER_X+160,SCREEN_TOP+28;rotationy,90;decelerate,0.5;rotationy,0; +StageDisplayOffCommand= + +[ScreenEvaluationSummary] +Fallback="ScreenEvaluation" +# +NextScreen=Branch.AfterSummary +# +PlayMusic=false +# +Summary=true +# +ShowStageDisplay=false +# +SmallBanner1X=SCREEN_CENTER_X-72 +SmallBanner1Y=SCREEN_TOP+100-24 +SmallBanner1OnCommand=zoom,0.5 +SmallBanner1OffCommand= + +SmallBanner2X=SCREEN_CENTER_X-48 +SmallBanner2Y=SCREEN_TOP+100-16 +SmallBanner2OnCommand=zoom,0.5 +SmallBanner2OffCommand= + +SmallBanner3X=SCREEN_CENTER_X-24 +SmallBanner3Y=SCREEN_TOP+100-8 +SmallBanner3OnCommand=zoom,0.5 +SmallBanner3OffCommand= + +SmallBanner4X=SCREEN_CENTER_X+24 +SmallBanner4Y=SCREEN_TOP+100+8 +SmallBanner4OnCommand=zoom,0.5 +SmallBanner4OffCommand= + +SmallBanner5X=SCREEN_CENTER_X+48 +SmallBanner5Y=SCREEN_TOP+100+16 +SmallBanner5OnCommand=zoom,0.5 +SmallBanner5OfCommand= + +SmallBanner6X=SCREEN_CENTER_X+72 +SmallBanner6Y=SCREEN_TOP+100+24 +SmallBanner6OnCommand=zoom,0.5 +SmallBanner6OffCommand= + +[ScreenNetEvaluation] +UserTier02OrBetterCommand=diffuseshift;effectperiod,0.75;effectcolor1,color("1,0.95,0.8,1");effectcolor2,color("0.8,0.95,1,1") + +# arcade stuff +[ScreenLogo] +TimerSeconds=10 +ShowLogo=true +LogoX=SCREEN_CENTER_X +LogoY=SCREEN_CENTER_Y-18 +LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 +LogoOffCommand=stopeffect;bouncebegin,0.35;zoom,0 + +ArcadeOverlay.TextY=SCREEN_BOTTOM-60 +# +[ScreenTitleJoin] +ShowHelp=false +HelpText=Screen.String("HelpTextTitleJoin") +HelpY=SCREEN_CENTER_Y+100 +HelpOnCommand=visible,false;zoom,1;strokecolor,color("0.125,0.125,0.125,0.5");queuecommand,"Refresh" +HelpCoinIsertedMessageCommand=playcommand,"Refresh" +HelpCoinModeChangedMessageCommand=playcommand,"Refresh" +HelpRefreshCommand=%function(self) \ + local bCanPlay = GAMESTATE:EnoughCreditsToJoin(); \ + local bReady = GAMESTATE:GetNumSidesJoined() > 0; \ + if bCanPlay or bReady then \ + self:SetTipsColonSeperated(THEME:GetString( Var "LoadingScreen","HelpTextPlay")); \ + else \ + self:SetTipsColonSeperated(THEME:GetString( Var "LoadingScreen","HelpTextWait")); \ + end \ +end; +# +LogoX=SCREEN_CENTER_X +LogoY=SCREEN_CENTER_Y-28 +LogoOnCommand=bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.75 +LogoOffCommand=stopeffect;bouncebegin,0.35;rotationz,360;zoom,0 + +VersionInfoX=SCREEN_CENTER_X+114 +VersionInfoY=SCREEN_CENTER_Y+44 +VersionInfoOnCommand=settext,ProductVersion();horizalign,right;vertalign,bottom;bob;effectperiod,4;effectmagnitude,0,5.25,0;zoom,0;bounceend,0.35;zoom,0.65;shadowlength,1;shadowcolor,color("0.2,0.2,0.2,0.925"); + +ScrollerOnCommand=visible,false; + +ArcadeOverlay.TextY=SCREEN_BOTTOM-128 + +[ScreenDemonstration] +SongMeterDisplayOnCommand=visible,false +SongMeterDisplayP1OnCommand=visible,false +SongMeterDisplayP2OnCommand=visible,false +LifeP1OnCommand=visible,false +LifeP2OnCommand=visible,false +ScoreP1OnCommand=visible,false +ScoreP2OnCommand=visible,false +StepsDisplayP1OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;smooth,0.5;y,SCREEN_BOTTOM-20;zoomy,0 +StepsDisplayP2OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;smooth,0.5;y,SCREEN_BOTTOM-20;zoomy,0 +ShowBPMDisplay=false +# +PlayMusic=false + +# sm-ssc helper screens +[ScreenHowToInstallSongs] +Class="ScreenSelectMaster" +Fallback="ScreenSelectMaster" +ShowHeader=false + +ShowScroller=true +PerChoiceScrollElement=false +# +ShowIcon=true +UseIconMetrics=false +PerChoiceIconElement=false +# +ScrollerX=SCREEN_LEFT+32 +ScrollerY=SCREEN_CENTER_Y +ScrollerTransform=function(self,offset,itemIndex,numItems) self:y(24*(itemIndex-(numItems-1)/2)); end +ScrollerNumItemsToDraw=20 +ScrollerOffCommand=bouncebegin,0.25;addx,-SCREEN_CENTER_X + +ChoiceNames="WhereToFind,HowToInstall,AdditionalFolders,ReloadSongs,Exit" +ChoiceWhereToFind="urlnoexit,http://code.google.com/p/sm-ssc/wiki/FindingContent;text,"..Screen.String("Finding Songs") +ChoiceHowToInstall="urlnoexit,http://code.google.com/p/sm-ssc/wiki/InstallingContent;text,"..Screen.String("Installing Songs") +ChoiceAdditionalFolders="text,"..Screen.String("Importing Songs") +ChoiceReloadSongs="screen,ScreenReloadSongs;text,"..Screen.String("Reload Songs") +ChoiceExit="screen,"..Branch.TitleMenu()..";text,"..Screen.String("Exit") +DefaultChoice="WhereToFind" + +OptionOrderUp="5:4,4:3,3:2,2:1,1:5" +OptionOrderDown="1:2,2:3,3:4,4:5,5:1" +[CustomScoring] +# So special scoring works properly, we zero this out +ComboAboveThresholdAddsToScoreBonus=0 +ComboScoreBonusThreshold=0 +ComboScoreBonusValue=0 +ComboMultiplier=0 +DoubleNoteScoreMultiplier=0 +TripleNoteScoreMultiplier=0 +QuadOrHigherNoteScoreMultiplier=0 +PointsW1=0 +PointsW2=0 +PointsW3=0 +PointsW4=0 +PointsW5=0 +PointsMiss=0 +PointsHitMine=0 +PointsCheckpointHit=0 +PointsCheckpointMiss=0 +PointsNone=0 +PointsHoldHeld=0 +PointsHoldLetGo=0 diff --git a/Themes/rsr/BGAnimations/ScreenWithMenuElements background/default.lua b/Themes/rsr/BGAnimations/ScreenWithMenuElements background/default.lua index d3ebaea695..da92848d5c 100644 --- a/Themes/rsr/BGAnimations/ScreenWithMenuElements background/default.lua +++ b/Themes/rsr/BGAnimations/ScreenWithMenuElements background/default.lua @@ -1,62 +1,62 @@ -local t = Def.ActorFrame {}; --- ---[[ local tGridSizeMajor = { 32, 32 }; -local tGridSizeMinor = { 16, 16 }; -local function CreateDebugGrid() - local t = Def.ActorFrame {}; - local numX = math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - local numY = math.ceil(SCREEN_HEIGHT/tGridSizeMajor[2]) - local offset = ( math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - SCREEN_WIDTH ) + SCREEN_WIDTH; - for a=1,numY do - for b=1,numX do - t[#t+1] = Def.Quad { - InitCommand=cmd(x,b*tGridSizeMajor[1]-(tGridSizeMajor[1]/2);y,a*tGridSizeMajor[2]-(tGridSizeMajor[2]/2)); - OnCommand=cmd(zoomto,tGridSizeMajor[1]-2,tGridSizeMajor[2]-2;diffuse,color("1,1,1,0.25")); - }; - end; - end; - return t -end --]] - --- -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - LoadActor("VOL1-29-NTSC") .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffusealpha,0.75); - }; -}; --- -local bShow = 0; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(visible,false); - ToggleConsoleDisplayMessageCommand=function(self) - bShow = 1 - bShow; - self:visible( bShow == 1 ); - end; - -- Grid - LoadActor("_32") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/32,SCREEN_HEIGHT/32); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; - LoadActor("_16") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/16,SCREEN_HEIGHT/16); - OnCommand=cmd(diffuse,color("1,1,1,0.125")); - }; ---[[ LoadActor("_8") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/8,SCREEN_HEIGHT/8); - OnCommand=cmd(diffuse,color("#00BFE833")); - }; --]] - -- Left - Def.Quad { - InitCommand=cmd(horizalign,left;x,SCREEN_LEFT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; - -- Right - Def.Quad { - InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; -}; --- +local t = Def.ActorFrame {}; +-- +--[[ local tGridSizeMajor = { 32, 32 }; +local tGridSizeMinor = { 16, 16 }; +local function CreateDebugGrid() + local t = Def.ActorFrame {}; + local numX = math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) + local numY = math.ceil(SCREEN_HEIGHT/tGridSizeMajor[2]) + local offset = ( math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - SCREEN_WIDTH ) + SCREEN_WIDTH; + for a=1,numY do + for b=1,numX do + t[#t+1] = Def.Quad { + InitCommand=cmd(x,b*tGridSizeMajor[1]-(tGridSizeMajor[1]/2);y,a*tGridSizeMajor[2]-(tGridSizeMajor[2]/2)); + OnCommand=cmd(zoomto,tGridSizeMajor[1]-2,tGridSizeMajor[2]-2;diffuse,color("1,1,1,0.25")); + }; + end; + end; + return t +end --]] + +-- +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + LoadActor("VOL1-29-NTSC") .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffusealpha,0.75); + }; +}; +-- +local bShow = 0; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(visible,false); + ToggleConsoleDisplayMessageCommand=function(self) + bShow = 1 - bShow; + self:visible( bShow == 1 ); + end; + -- Grid + LoadActor("_32") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/32,SCREEN_HEIGHT/32); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; + LoadActor("_16") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/16,SCREEN_HEIGHT/16); + OnCommand=cmd(diffuse,color("1,1,1,0.125")); + }; +--[[ LoadActor("_8") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/8,SCREEN_HEIGHT/8); + OnCommand=cmd(diffuse,color("#00BFE833")); + }; --]] + -- Left + Def.Quad { + InitCommand=cmd(horizalign,left;x,SCREEN_LEFT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; + -- Right + Def.Quad { + InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; +}; +-- return t \ No newline at end of file diff --git a/Themes/rsr/BGAnimations/ScreenWithMenuElements decorations/default.lua b/Themes/rsr/BGAnimations/ScreenWithMenuElements decorations/default.lua index d69d08b791..d3a0d5252a 100644 --- a/Themes/rsr/BGAnimations/ScreenWithMenuElements decorations/default.lua +++ b/Themes/rsr/BGAnimations/ScreenWithMenuElements decorations/default.lua @@ -1,7 +1,7 @@ --- Loads up a slew of objects to load into the screen, like how 3.9 does. --- I prefer to keep these optional, incase another screen wants to hide --- these elements. -local t = Def.ActorFrame {}; -t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); -t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); +-- Loads up a slew of objects to load into the screen, like how 3.9 does. +-- I prefer to keep these optional, incase another screen wants to hide +-- these elements. +local t = Def.ActorFrame {}; +t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); +t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); return t \ No newline at end of file diff --git a/Themes/rsr/Graphics/MusicWheelItem Song ColorPart.lua b/Themes/rsr/Graphics/MusicWheelItem Song ColorPart.lua index edfa6611f8..d3d0df30f3 100644 --- a/Themes/rsr/Graphics/MusicWheelItem Song ColorPart.lua +++ b/Themes/rsr/Graphics/MusicWheelItem Song ColorPart.lua @@ -1,14 +1,14 @@ -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(x,-128+4;zoomto,4,46); --- OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; ---[[ Def.Quad { - InitCommand=cmd(x,-128+16+6;zoomto,32,46); --- OnCommand=cmd(faderight,1;diffusealpha,0.5); - }; --]] ---[[ Def.Quad { - InitCommand=cmd(x,2;y,23;zoomto,320,1); --- OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; --]] +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(x,-128+4;zoomto,4,46); +-- OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; +--[[ Def.Quad { + InitCommand=cmd(x,-128+16+6;zoomto,32,46); +-- OnCommand=cmd(faderight,1;diffusealpha,0.5); + }; --]] +--[[ Def.Quad { + InitCommand=cmd(x,2;y,23;zoomto,320,1); +-- OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; --]] }; \ No newline at end of file diff --git a/Themes/rsr/Graphics/MusicWheelItem Song NormalPart.lua b/Themes/rsr/Graphics/MusicWheelItem Song NormalPart.lua index 60de25400c..7c5b876099 100644 --- a/Themes/rsr/Graphics/MusicWheelItem Song NormalPart.lua +++ b/Themes/rsr/Graphics/MusicWheelItem Song NormalPart.lua @@ -1,6 +1,6 @@ -return Def.ActorFrame { - Def.Quad { - InitCommand=cmd(x,4;zoomto,256-4,46); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; +return Def.ActorFrame { + Def.Quad { + InitCommand=cmd(x,4;zoomto,256-4,46); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; }; \ No newline at end of file diff --git a/Themes/rsr/Graphics/ScreenTitleMenu scroll.lua b/Themes/rsr/Graphics/ScreenTitleMenu scroll.lua index 84e2da8460..fa40c9c589 100644 --- a/Themes/rsr/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/rsr/Graphics/ScreenTitleMenu scroll.lua @@ -1,11 +1,11 @@ -local gc = Var("GameCommand"); - -local t = Def.ActorFrame {}; - -t[#t+1] = LoadFont("Common Normal") .. { - Text=gc:GetText(); -}; - -t.GainFocusCommand=cmd(diffusealpha,1); -t.LoseFocusCommand=cmd(diffusealpha,0.5); +local gc = Var("GameCommand"); + +local t = Def.ActorFrame {}; + +t[#t+1] = LoadFont("Common Normal") .. { + Text=gc:GetText(); +}; + +t.GainFocusCommand=cmd(diffusealpha,1); +t.LoseFocusCommand=cmd(diffusealpha,0.5); return t; \ No newline at end of file diff --git a/Themes/rsr/Graphics/ScreenWithMenuElements footer/default.lua b/Themes/rsr/Graphics/ScreenWithMenuElements footer/default.lua index 5dae6eeb87..8c4742c670 100644 --- a/Themes/rsr/Graphics/ScreenWithMenuElements footer/default.lua +++ b/Themes/rsr/Graphics/ScreenWithMenuElements footer/default.lua @@ -1,9 +1,9 @@ -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,-64); - Def.Quad { - InitCommand=cmd(vertalign,top;zoomto,SCREEN_WIDTH-32,2); - OnCommand=cmd(diffusealpha,0.5); - }; -}; +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(y,-64); + Def.Quad { + InitCommand=cmd(vertalign,top;zoomto,SCREEN_WIDTH-32,2); + OnCommand=cmd(diffusealpha,0.5); + }; +}; return t \ No newline at end of file diff --git a/Themes/rsr/Graphics/ScreenWithMenuElements header/default.lua b/Themes/rsr/Graphics/ScreenWithMenuElements header/default.lua index 1795dc8c31..28ad31bf77 100644 --- a/Themes/rsr/Graphics/ScreenWithMenuElements header/default.lua +++ b/Themes/rsr/Graphics/ScreenWithMenuElements header/default.lua @@ -1,35 +1,35 @@ -local t = Def.ActorFrame {}; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,48); - Def.Quad { - InitCommand=cmd(vertalign,bottom;zoomto,SCREEN_WIDTH-32,2); - OnCommand=cmd(diffusealpha,0.5); - }; -}; -t[#t+1] = Def.ActorFrame { Name="MenuTimerDecoration"; - InitCommand=cmd(y,48); - LoadFont("Common Normal") .. { - Text="TIME"; - InitCommand=cmd(vertalign,bottom;horizalign,right;x,SCREEN_CENTER_X-16;y,-4.5); - OnCommand=cmd(zoom,0.5); - }; ---[[ LoadFont("Common Normal") .. { - Text="99"; - InitCommand=cmd(vertalign,bottom;horizalign,right;x,SCREEN_CENTER_X-64;y,-4.5); - OnCommand=cmd(); - }; --]] -}; -t[#t+1] = Def.ActorFrame { Name="HeaderTextDecoration"; - InitCommand=cmd(y,48); - LoadFont("Common Normal") .. { - Text="SELECT"; - InitCommand=cmd(vertalign,bottom;horizalign,left;x,-SCREEN_CENTER_X+16;y,-4.5); - OnCommand=cmd(zoom,0.5); - }; - LoadFont("Common Normal") .. { - Text="OPTIONS"; - InitCommand=cmd(vertalign,bottom;horizalign,left;x,-SCREEN_CENTER_X+64;y,-4.5); - OnCommand=cmd(); - }; -}; +local t = Def.ActorFrame {}; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(y,48); + Def.Quad { + InitCommand=cmd(vertalign,bottom;zoomto,SCREEN_WIDTH-32,2); + OnCommand=cmd(diffusealpha,0.5); + }; +}; +t[#t+1] = Def.ActorFrame { Name="MenuTimerDecoration"; + InitCommand=cmd(y,48); + LoadFont("Common Normal") .. { + Text="TIME"; + InitCommand=cmd(vertalign,bottom;horizalign,right;x,SCREEN_CENTER_X-16;y,-4.5); + OnCommand=cmd(zoom,0.5); + }; +--[[ LoadFont("Common Normal") .. { + Text="99"; + InitCommand=cmd(vertalign,bottom;horizalign,right;x,SCREEN_CENTER_X-64;y,-4.5); + OnCommand=cmd(); + }; --]] +}; +t[#t+1] = Def.ActorFrame { Name="HeaderTextDecoration"; + InitCommand=cmd(y,48); + LoadFont("Common Normal") .. { + Text="SELECT"; + InitCommand=cmd(vertalign,bottom;horizalign,left;x,-SCREEN_CENTER_X+16;y,-4.5); + OnCommand=cmd(zoom,0.5); + }; + LoadFont("Common Normal") .. { + Text="OPTIONS"; + InitCommand=cmd(vertalign,bottom;horizalign,left;x,-SCREEN_CENTER_X+64;y,-4.5); + OnCommand=cmd(); + }; +}; return t \ No newline at end of file diff --git a/Themes/rsr/Sounds/_Music title (loop).sm b/Themes/rsr/Sounds/_Music title (loop).sm index 283865a6c9..960f7c3767 100644 --- a/Themes/rsr/Sounds/_Music title (loop).sm +++ b/Themes/rsr/Sounds/_Music title (loop).sm @@ -1,5 +1,5 @@ -#TITLE:Break The Sabbath; -#OFFSET:0.000; -#BPMS:0.000=140.000; -#STOPS:; - +#TITLE:Break The Sabbath; +#OFFSET:0.000; +#BPMS:0.000=140.000; +#STOPS:; + diff --git a/Themes/rsr/ThemeInfo.ini b/Themes/rsr/ThemeInfo.ini index 9215ef43e2..cfa7e1474c 100644 --- a/Themes/rsr/ThemeInfo.ini +++ b/Themes/rsr/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=Real Stepping Roots +[ThemeInfo] +DisplayName=Real Stepping Roots Author=Midiman \ No newline at end of file diff --git a/Themes/rsr/library.txt b/Themes/rsr/library.txt index 1b6b60c1e1..54af4efe66 100644 --- a/Themes/rsr/library.txt +++ b/Themes/rsr/library.txt @@ -1,11 +1,11 @@ -=== -COLORS -==== - BACKGROUND -==== - Clear #000000 (Black) - Light #646464 (Grey) - Primary #007cd4 (Slate Blue) - Secondary #a4005d (Slate Purple) - the base is black (#000000) +=== +COLORS +==== + BACKGROUND +==== + Clear #000000 (Black) + Light #646464 (Grey) + Primary #007cd4 (Slate Blue) + Secondary #a4005d (Slate Purple) + the base is black (#000000) === \ No newline at end of file diff --git a/Themes/rsr/metrics.ini b/Themes/rsr/metrics.ini index d46f998386..e5b8dc7a54 100644 --- a/Themes/rsr/metrics.ini +++ b/Themes/rsr/metrics.ini @@ -1,39 +1,39 @@ -[Global] -FallbackTheme=_fallback -[ScreenWithMenuElements] -ShowHeader=true -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP -HeaderOnCommand= -HeaderOffCommand= -# -ShowFooter=true -FooterX=SCREEN_CENTER_X -FooterY=SCREEN_BOTTOM -FooterOnCommand= -FooterOffCommand= -# -TimerX=SCREEN_WIDTH-64 -TimerY=SCREEN_TOP+48-4.5 -TimerOnCommand= -TimerOffCommand= -[MenuTimer] -Text1OnCommand=stopeffect;stoptweening;vertalign,bottom;horizalign,right -Text1FormatFunction=function(fSeconds) \ - return string.format("%0.1f", fSeconds); \ -end -FrameOnCommand= -Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); -#~ Warning10Command=%function(self) \ - #~ MESSAGEMAN:Broadcast("TimerWarning"); \ - #~ cmd(diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"))(self); \ -#~ end; -[ScreenTitleMenu] -ShowHeader=true -ShowFooter=true -[ScreenSelectMusic] -MusicWheelX=SCREEN_RIGHT-128-18 -MusicWheelOnCommand=draworder,-1 -[MusicWheel] -ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*0 ); self:y( offsetFromCenter*48 ); end +[Global] +FallbackTheme=_fallback +[ScreenWithMenuElements] +ShowHeader=true +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP +HeaderOnCommand= +HeaderOffCommand= +# +ShowFooter=true +FooterX=SCREEN_CENTER_X +FooterY=SCREEN_BOTTOM +FooterOnCommand= +FooterOffCommand= +# +TimerX=SCREEN_WIDTH-64 +TimerY=SCREEN_TOP+48-4.5 +TimerOnCommand= +TimerOffCommand= +[MenuTimer] +Text1OnCommand=stopeffect;stoptweening;vertalign,bottom;horizalign,right +Text1FormatFunction=function(fSeconds) \ + return string.format("%0.1f", fSeconds); \ +end +FrameOnCommand= +Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); +#~ Warning10Command=%function(self) \ + #~ MESSAGEMAN:Broadcast("TimerWarning"); \ + #~ cmd(diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"))(self); \ +#~ end; +[ScreenTitleMenu] +ShowHeader=true +ShowFooter=true +[ScreenSelectMusic] +MusicWheelX=SCREEN_RIGHT-128-18 +MusicWheelOnCommand=draworder,-1 +[MusicWheel] +ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*0 ); self:y( offsetFromCenter*48 ); end NumWheelItems=13 \ No newline at end of file diff --git a/Themes/themekit/BGAnimations/ScreenWithMenuElements background/default.lua b/Themes/themekit/BGAnimations/ScreenWithMenuElements background/default.lua index d3ebaea695..da92848d5c 100644 --- a/Themes/themekit/BGAnimations/ScreenWithMenuElements background/default.lua +++ b/Themes/themekit/BGAnimations/ScreenWithMenuElements background/default.lua @@ -1,62 +1,62 @@ -local t = Def.ActorFrame {}; --- ---[[ local tGridSizeMajor = { 32, 32 }; -local tGridSizeMinor = { 16, 16 }; -local function CreateDebugGrid() - local t = Def.ActorFrame {}; - local numX = math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - local numY = math.ceil(SCREEN_HEIGHT/tGridSizeMajor[2]) - local offset = ( math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - SCREEN_WIDTH ) + SCREEN_WIDTH; - for a=1,numY do - for b=1,numX do - t[#t+1] = Def.Quad { - InitCommand=cmd(x,b*tGridSizeMajor[1]-(tGridSizeMajor[1]/2);y,a*tGridSizeMajor[2]-(tGridSizeMajor[2]/2)); - OnCommand=cmd(zoomto,tGridSizeMajor[1]-2,tGridSizeMajor[2]-2;diffuse,color("1,1,1,0.25")); - }; - end; - end; - return t -end --]] - --- -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); - LoadActor("VOL1-29-NTSC") .. { - InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); - OnCommand=cmd(diffusealpha,0.75); - }; -}; --- -local bShow = 0; -t[#t+1] = Def.ActorFrame { - InitCommand=cmd(visible,false); - ToggleConsoleDisplayMessageCommand=function(self) - bShow = 1 - bShow; - self:visible( bShow == 1 ); - end; - -- Grid - LoadActor("_32") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/32,SCREEN_HEIGHT/32); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; - LoadActor("_16") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/16,SCREEN_HEIGHT/16); - OnCommand=cmd(diffuse,color("1,1,1,0.125")); - }; ---[[ LoadActor("_8") .. { - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/8,SCREEN_HEIGHT/8); - OnCommand=cmd(diffuse,color("#00BFE833")); - }; --]] - -- Left - Def.Quad { - InitCommand=cmd(horizalign,left;x,SCREEN_LEFT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; - -- Right - Def.Quad { - InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); - OnCommand=cmd(diffuse,color("0,0,0,0.5")); - }; -}; --- +local t = Def.ActorFrame {}; +-- +--[[ local tGridSizeMajor = { 32, 32 }; +local tGridSizeMinor = { 16, 16 }; +local function CreateDebugGrid() + local t = Def.ActorFrame {}; + local numX = math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) + local numY = math.ceil(SCREEN_HEIGHT/tGridSizeMajor[2]) + local offset = ( math.ceil(SCREEN_WIDTH/tGridSizeMajor[1]) - SCREEN_WIDTH ) + SCREEN_WIDTH; + for a=1,numY do + for b=1,numX do + t[#t+1] = Def.Quad { + InitCommand=cmd(x,b*tGridSizeMajor[1]-(tGridSizeMajor[1]/2);y,a*tGridSizeMajor[2]-(tGridSizeMajor[2]/2)); + OnCommand=cmd(zoomto,tGridSizeMajor[1]-2,tGridSizeMajor[2]-2;diffuse,color("1,1,1,0.25")); + }; + end; + end; + return t +end --]] + +-- +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + LoadActor("VOL1-29-NTSC") .. { + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffusealpha,0.75); + }; +}; +-- +local bShow = 0; +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(visible,false); + ToggleConsoleDisplayMessageCommand=function(self) + bShow = 1 - bShow; + self:visible( bShow == 1 ); + end; + -- Grid + LoadActor("_32") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/32,SCREEN_HEIGHT/32); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; + LoadActor("_16") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/16,SCREEN_HEIGHT/16); + OnCommand=cmd(diffuse,color("1,1,1,0.125")); + }; +--[[ LoadActor("_8") .. { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;customtexturerect,0,0,SCREEN_WIDTH/8,SCREEN_HEIGHT/8); + OnCommand=cmd(diffuse,color("#00BFE833")); + }; --]] + -- Left + Def.Quad { + InitCommand=cmd(horizalign,left;x,SCREEN_LEFT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; + -- Right + Def.Quad { + InitCommand=cmd(horizalign,right;x,SCREEN_RIGHT;y,SCREEN_CENTER_Y;zoomto,16,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,0.5")); + }; +}; +-- return t \ No newline at end of file diff --git a/Themes/themekit/BGAnimations/ScreenWithMenuElements decorations/default.lua b/Themes/themekit/BGAnimations/ScreenWithMenuElements decorations/default.lua index d69d08b791..d3a0d5252a 100644 --- a/Themes/themekit/BGAnimations/ScreenWithMenuElements decorations/default.lua +++ b/Themes/themekit/BGAnimations/ScreenWithMenuElements decorations/default.lua @@ -1,7 +1,7 @@ --- Loads up a slew of objects to load into the screen, like how 3.9 does. --- I prefer to keep these optional, incase another screen wants to hide --- these elements. -local t = Def.ActorFrame {}; -t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); -t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); +-- Loads up a slew of objects to load into the screen, like how 3.9 does. +-- I prefer to keep these optional, incase another screen wants to hide +-- these elements. +local t = Def.ActorFrame {}; +t[#t+1] = StandardDecorationFromFileOptional("Header","Header"); +t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer"); return t \ No newline at end of file diff --git a/Themes/themekit/Graphics/ScreenTitleMenu scroll.lua b/Themes/themekit/Graphics/ScreenTitleMenu scroll.lua index 84e2da8460..fa40c9c589 100644 --- a/Themes/themekit/Graphics/ScreenTitleMenu scroll.lua +++ b/Themes/themekit/Graphics/ScreenTitleMenu scroll.lua @@ -1,11 +1,11 @@ -local gc = Var("GameCommand"); - -local t = Def.ActorFrame {}; - -t[#t+1] = LoadFont("Common Normal") .. { - Text=gc:GetText(); -}; - -t.GainFocusCommand=cmd(diffusealpha,1); -t.LoseFocusCommand=cmd(diffusealpha,0.5); +local gc = Var("GameCommand"); + +local t = Def.ActorFrame {}; + +t[#t+1] = LoadFont("Common Normal") .. { + Text=gc:GetText(); +}; + +t.GainFocusCommand=cmd(diffusealpha,1); +t.LoseFocusCommand=cmd(diffusealpha,0.5); return t; \ No newline at end of file diff --git a/Themes/themekit/ThemeInfo.ini b/Themes/themekit/ThemeInfo.ini index da4837b4d0..8b6290c953 100644 --- a/Themes/themekit/ThemeInfo.ini +++ b/Themes/themekit/ThemeInfo.ini @@ -1,3 +1,3 @@ -[ThemeInfo] -DisplayName=ThemeKit +[ThemeInfo] +DisplayName=ThemeKit Author=Midiman \ No newline at end of file diff --git a/Themes/themekit/metrics.ini b/Themes/themekit/metrics.ini index ffd154d4d0..fbc0f5651a 100644 --- a/Themes/themekit/metrics.ini +++ b/Themes/themekit/metrics.ini @@ -1,37 +1,37 @@ -[Global] -FallbackTheme=_fallback -[ScreenWithMenuElements] -ShowHeader=true -HeaderX=SCREEN_CENTER_X -HeaderY=SCREEN_TOP -HeaderOnCommand= -HeaderOffCommand= -# -ShowFooter=true -FooterX=SCREEN_CENTER_X -FooterY=SCREEN_BOTTOM -FooterOnCommand= -FooterOffCommand= -# -TimerX=SCREEN_WIDTH-64 -TimerY=SCREEN_TOP+48-4.5 -TimerOnCommand= -TimerOffCommand= -[MenuTimer] -# Text -Text1OnCommand=stopeffect;stoptweening;vertalign,bottom;horizalign,right -Text1FormatFunction=function(fSeconds) \ - return string.format("%0.1f", fSeconds); \ -end -FrameOnCommand= -# Warning -Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); -[ScreenTitleMenu] -ShowHeader=true -ShowFooter=true -[ScreenSelectMusic] -MusicWheelX=SCREEN_RIGHT-128-18 -MusicWheelOnCommand=draworder,-1 -[MusicWheel] -ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*0 ); self:y( offsetFromCenter*48 ); end +[Global] +FallbackTheme=_fallback +[ScreenWithMenuElements] +ShowHeader=true +HeaderX=SCREEN_CENTER_X +HeaderY=SCREEN_TOP +HeaderOnCommand= +HeaderOffCommand= +# +ShowFooter=true +FooterX=SCREEN_CENTER_X +FooterY=SCREEN_BOTTOM +FooterOnCommand= +FooterOffCommand= +# +TimerX=SCREEN_WIDTH-64 +TimerY=SCREEN_TOP+48-4.5 +TimerOnCommand= +TimerOffCommand= +[MenuTimer] +# Text +Text1OnCommand=stopeffect;stoptweening;vertalign,bottom;horizalign,right +Text1FormatFunction=function(fSeconds) \ + return string.format("%0.1f", fSeconds); \ +end +FrameOnCommand= +# Warning +Warning10Command=diffuseshift;effectperiod,1;effectcolor2,Color("Red");effectcolor1,color("0.5,0,0,1"); +[ScreenTitleMenu] +ShowHeader=true +ShowFooter=true +[ScreenSelectMusic] +MusicWheelX=SCREEN_RIGHT-128-18 +MusicWheelOnCommand=draworder,-1 +[MusicWheel] +ItemTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) self:x( (1-math.cos(offsetFromCenter/math.pi))*0 ); self:y( offsetFromCenter*48 ); end NumWheelItems=13 \ No newline at end of file diff --git a/Utils/Font generation/Output/placeholder.txt b/Utils/Font generation/Output/placeholder.txt index c95063507b..2c0c083733 100644 --- a/Utils/Font generation/Output/placeholder.txt +++ b/Utils/Font generation/Output/placeholder.txt @@ -1 +1 @@ -Generated font pages go here. (placeholder to make CVS create dir) +Generated font pages go here. (placeholder to make CVS create dir) diff --git a/Xcode/Libraries/ffmpeg-config.h b/Xcode/Libraries/ffmpeg-config.h index cb1de0089b..3e9a156904 100644 --- a/Xcode/Libraries/ffmpeg-config.h +++ b/Xcode/Libraries/ffmpeg-config.h @@ -1,1086 +1,1086 @@ -#define attribute_deprecated -#if defined(__ppc__) -/* Automatically generated by configure - do not modify! */ -#define FFMPEG_CONFIGURATION "--disable-static --enable-shared --disable-debug --disable-vhook --enable-memalign-hack --disable-network --enable-small --disable-encoders --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-muxers --enable-demuxer=avi --enable-demuxer=h261 --enable-demuxer=h263 --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=mpegvideo --enable-demuxer=ogg --enable-demuxer=rawvideo --enable-demuxer=yuv4mpegpipe --disable-decoders --enable-decoder=h261 --enable-decoder=h263 --enable-decoder=h263i --enable-decoder=h264 --enable-decoder=huffyuv --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-decoder=mpeg_xvmc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=mpegvideo --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=rawvideo --enable-decoder=theora --disable-parsers --enable-parser=h261 --enable-parser=h263 --enable-parser=h264 --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=ac3" -#define ARCH_POWERPC 1 -#define WORDS_BIGENDIAN 1 -#define HAVE_ALTIVEC 1 -#define HAVE_ALTIVEC_H 1 -#define HAVE_DCBZL 1 -#define HAVE_DLFCN_H 1 -#define HAVE_DLOPEN 1 -#define HAVE_FREETYPE2 1 -#define HAVE_INET_ATON 1 -#define HAVE_LOCALTIME_R 1 -#define HAVE_LRINTF 1 -#define HAVE_SDL 1 -#define CONFIG_DECODERS 1 -#define CONFIG_DEMUXERS 1 -#define CONFIG_MEMALIGN_HACK 1 -#define CONFIG_MPEGAUDIO_HP 1 -#define CONFIG_PROTOCOLS 1 -#define CONFIG_ZLIB 1 -#define TARGET_ALTIVEC 1 -#define CONFIG_DARWIN 1 -#define restrict __restrict__ -#define always_inline -#define CONFIG_SMALL 1 -#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" -#define ENABLE_AASC_DECODER 0 -#define ENABLE_ASV1_DECODER 0 -#define ENABLE_ASV2_DECODER 0 -#define ENABLE_AVS_DECODER 0 -#define ENABLE_BMP_DECODER 0 -#define ENABLE_CAVS_DECODER 0 -#define ENABLE_CINEPAK_DECODER 0 -#define ENABLE_CLJR_DECODER 0 -#define ENABLE_CSCD_DECODER 0 -#define ENABLE_CYUV_DECODER 0 -#define ENABLE_DCA_DECODER 0 -#define ENABLE_DNXHD_DECODER 0 -#define ENABLE_DSICINVIDEO_DECODER 0 -#define ENABLE_DVVIDEO_DECODER 0 -#define ENABLE_DXA_DECODER 0 -#define ENABLE_EIGHTBPS_DECODER 0 -#define ENABLE_FFV1_DECODER 0 -#define ENABLE_FFVHUFF_DECODER 0 -#define ENABLE_FLASHSV_DECODER 0 -#define ENABLE_FLIC_DECODER 0 -#define ENABLE_FLV_DECODER 0 -#define ENABLE_FOURXM_DECODER 0 -#define ENABLE_FRAPS_DECODER 0 -#define ENABLE_GIF_DECODER 0 -#define CONFIG_H261_DECODER 1 -#define ENABLE_H261_DECODER 1 -#define CONFIG_H263_DECODER 1 -#define ENABLE_H263_DECODER 1 -#define CONFIG_H263I_DECODER 1 -#define ENABLE_H263I_DECODER 1 -#define CONFIG_H264_DECODER 1 -#define ENABLE_H264_DECODER 1 -#define CONFIG_HUFFYUV_DECODER 1 -#define ENABLE_HUFFYUV_DECODER 1 -#define ENABLE_IDCIN_DECODER 0 -#define ENABLE_INDEO2_DECODER 0 -#define ENABLE_INDEO3_DECODER 0 -#define ENABLE_INTERPLAY_VIDEO_DECODER 0 -#define ENABLE_KMVC_DECODER 0 -#define ENABLE_LOCO_DECODER 0 -#define ENABLE_MDEC_DECODER 0 -#define CONFIG_MJPEG_DECODER 1 -#define ENABLE_MJPEG_DECODER 1 -#define CONFIG_MJPEGB_DECODER 1 -#define ENABLE_MJPEGB_DECODER 1 -#define ENABLE_MMVIDEO_DECODER 0 -#define ENABLE_MPEG_XVMC_DECODER 0 -#define CONFIG_MPEG1VIDEO_DECODER 1 -#define ENABLE_MPEG1VIDEO_DECODER 1 -#define CONFIG_MPEG2VIDEO_DECODER 1 -#define ENABLE_MPEG2VIDEO_DECODER 1 -#define CONFIG_MPEG4_DECODER 1 -#define ENABLE_MPEG4_DECODER 1 -#define CONFIG_MPEGVIDEO_DECODER 1 -#define ENABLE_MPEGVIDEO_DECODER 1 -#define CONFIG_MSMPEG4V1_DECODER 1 -#define ENABLE_MSMPEG4V1_DECODER 1 -#define CONFIG_MSMPEG4V2_DECODER 1 -#define ENABLE_MSMPEG4V2_DECODER 1 -#define CONFIG_MSMPEG4V3_DECODER 1 -#define ENABLE_MSMPEG4V3_DECODER 1 -#define ENABLE_MSRLE_DECODER 0 -#define ENABLE_MSVIDEO1_DECODER 0 -#define ENABLE_MSZH_DECODER 0 -#define ENABLE_NUV_DECODER 0 -#define ENABLE_PNG_DECODER 0 -#define ENABLE_QDRAW_DECODER 0 -#define ENABLE_QPEG_DECODER 0 -#define ENABLE_QTRLE_DECODER 0 -#define CONFIG_RAWVIDEO_DECODER 1 -#define ENABLE_RAWVIDEO_DECODER 1 -#define ENABLE_ROQ_DECODER 0 -#define ENABLE_RPZA_DECODER 0 -#define ENABLE_RV10_DECODER 0 -#define ENABLE_RV20_DECODER 0 -#define ENABLE_SMACKER_DECODER 0 -#define ENABLE_SMC_DECODER 0 -#define ENABLE_SNOW_DECODER 0 -#define ENABLE_SP5X_DECODER 0 -#define ENABLE_SVQ1_DECODER 0 -#define ENABLE_SVQ3_DECODER 0 -#define ENABLE_TARGA_DECODER 0 -#define CONFIG_THEORA_DECODER 1 -#define ENABLE_THEORA_DECODER 1 -#define ENABLE_TIERTEXSEQVIDEO_DECODER 0 -#define ENABLE_TIFF_DECODER 0 -#define ENABLE_TRUEMOTION1_DECODER 0 -#define ENABLE_TRUEMOTION2_DECODER 0 -#define ENABLE_TSCC_DECODER 0 -#define ENABLE_ULTI_DECODER 0 -#define ENABLE_VC1_DECODER 0 -#define ENABLE_VCR1_DECODER 0 -#define ENABLE_VMDVIDEO_DECODER 0 -#define ENABLE_VMNC_DECODER 0 -#define ENABLE_VP3_DECODER 0 -#define ENABLE_VP5_DECODER 0 -#define ENABLE_VP6_DECODER 0 -#define ENABLE_VP6F_DECODER 0 -#define ENABLE_VQA_DECODER 0 -#define ENABLE_WMV1_DECODER 0 -#define ENABLE_WMV2_DECODER 0 -#define ENABLE_WMV3_DECODER 0 -#define ENABLE_WNV1_DECODER 0 -#define ENABLE_XAN_WC3_DECODER 0 -#define ENABLE_XL_DECODER 0 -#define ENABLE_ZLIB_DECODER 0 -#define ENABLE_ZMBV_DECODER 0 -#define ENABLE_AAC_DECODER 0 -#define ENABLE_MPEG4AAC_DECODER 0 -#define ENABLE_ALAC_DECODER 0 -#define ENABLE_AMR_NB_DECODER 0 -#define ENABLE_AMR_WB_DECODER 0 -#define ENABLE_COOK_DECODER 0 -#define ENABLE_DSICINAUDIO_DECODER 0 -#define ENABLE_DTS_DECODER 0 -#define ENABLE_FLAC_DECODER 0 -#define ENABLE_IMC_DECODER 0 -#define ENABLE_LIBA52_DECODER 0 -#define ENABLE_LIBGSM_DECODER 0 -#define ENABLE_LIBGSM_MS_DECODER 0 -#define ENABLE_MACE3_DECODER 0 -#define ENABLE_MACE6_DECODER 0 -#define ENABLE_MP2_DECODER 0 -#define ENABLE_MP3_DECODER 0 -#define ENABLE_MP3ADU_DECODER 0 -#define ENABLE_MP3ON4_DECODER 0 -#define ENABLE_MPC7_DECODER 0 -#define ENABLE_OGGVORBIS_DECODER 0 -#define ENABLE_QDM2_DECODER 0 -#define ENABLE_RA_144_DECODER 0 -#define ENABLE_RA_288_DECODER 0 -#define ENABLE_SHORTEN_DECODER 0 -#define ENABLE_SMACKAUD_DECODER 0 -#define ENABLE_SONIC_DECODER 0 -#define ENABLE_TRUESPEECH_DECODER 0 -#define ENABLE_TTA_DECODER 0 -#define ENABLE_VMDAUDIO_DECODER 0 -#define ENABLE_VORBIS_DECODER 0 -#define ENABLE_WAVPACK_DECODER 0 -#define ENABLE_WMAV1_DECODER 0 -#define ENABLE_WMAV2_DECODER 0 -#define ENABLE_WS_SND1_DECODER 0 -#define ENABLE_PCM_ALAW_DECODER 0 -#define ENABLE_PCM_MULAW_DECODER 0 -#define ENABLE_PCM_S8_DECODER 0 -#define ENABLE_PCM_S16BE_DECODER 0 -#define ENABLE_PCM_S16LE_DECODER 0 -#define ENABLE_PCM_S24BE_DECODER 0 -#define ENABLE_PCM_S24DAUD_DECODER 0 -#define ENABLE_PCM_S24LE_DECODER 0 -#define ENABLE_PCM_S32BE_DECODER 0 -#define ENABLE_PCM_S32LE_DECODER 0 -#define ENABLE_PCM_U8_DECODER 0 -#define ENABLE_PCM_U16BE_DECODER 0 -#define ENABLE_PCM_U16LE_DECODER 0 -#define ENABLE_PCM_U24BE_DECODER 0 -#define ENABLE_PCM_U24LE_DECODER 0 -#define ENABLE_PCM_U32BE_DECODER 0 -#define ENABLE_PCM_U32LE_DECODER 0 -#define ENABLE_INTERPLAY_DPCM_DECODER 0 -#define ENABLE_ROQ_DPCM_DECODER 0 -#define ENABLE_SOL_DPCM_DECODER 0 -#define ENABLE_XAN_DPCM_DECODER 0 -#define ENABLE_ADPCM_4XM_DECODER 0 -#define ENABLE_ADPCM_ADX_DECODER 0 -#define ENABLE_ADPCM_CT_DECODER 0 -#define ENABLE_ADPCM_EA_DECODER 0 -#define ENABLE_ADPCM_G726_DECODER 0 -#define ENABLE_ADPCM_IMA_DK3_DECODER 0 -#define ENABLE_ADPCM_IMA_DK4_DECODER 0 -#define ENABLE_ADPCM_IMA_QT_DECODER 0 -#define ENABLE_ADPCM_IMA_SMJPEG_DECODER 0 -#define ENABLE_ADPCM_IMA_WAV_DECODER 0 -#define ENABLE_ADPCM_IMA_WS_DECODER 0 -#define ENABLE_ADPCM_MS_DECODER 0 -#define ENABLE_ADPCM_SBPRO_2_DECODER 0 -#define ENABLE_ADPCM_SBPRO_3_DECODER 0 -#define ENABLE_ADPCM_SBPRO_4_DECODER 0 -#define ENABLE_ADPCM_SWF_DECODER 0 -#define ENABLE_ADPCM_XA_DECODER 0 -#define ENABLE_ADPCM_YAMAHA_DECODER 0 -#define ENABLE_DVBSUB_DECODER 0 -#define ENABLE_DVDSUB_DECODER 0 -#define ENABLE_ASV1_ENCODER 0 -#define ENABLE_ASV2_ENCODER 0 -#define ENABLE_BMP_ENCODER 0 -#define ENABLE_DVVIDEO_ENCODER 0 -#define ENABLE_FFV1_ENCODER 0 -#define ENABLE_FFVHUFF_ENCODER 0 -#define ENABLE_FLASHSV_ENCODER 0 -#define ENABLE_FLV_ENCODER 0 -#define ENABLE_GIF_ENCODER 0 -#define ENABLE_H261_ENCODER 0 -#define ENABLE_H263_ENCODER 0 -#define ENABLE_H263P_ENCODER 0 -#define ENABLE_HUFFYUV_ENCODER 0 -#define ENABLE_JPEGLS_ENCODER 0 -#define ENABLE_LJPEG_ENCODER 0 -#define ENABLE_MJPEG_ENCODER 0 -#define ENABLE_MPEG1VIDEO_ENCODER 0 -#define ENABLE_MPEG2VIDEO_ENCODER 0 -#define ENABLE_MPEG4_ENCODER 0 -#define ENABLE_MSMPEG4V1_ENCODER 0 -#define ENABLE_MSMPEG4V2_ENCODER 0 -#define ENABLE_MSMPEG4V3_ENCODER 0 -#define ENABLE_PAM_ENCODER 0 -#define ENABLE_PBM_ENCODER 0 -#define ENABLE_PGM_ENCODER 0 -#define ENABLE_PGMYUV_ENCODER 0 -#define ENABLE_PNG_ENCODER 0 -#define ENABLE_PPM_ENCODER 0 -#define ENABLE_RAWVIDEO_ENCODER 0 -#define ENABLE_RV10_ENCODER 0 -#define ENABLE_RV20_ENCODER 0 -#define ENABLE_SNOW_ENCODER 0 -#define ENABLE_SVQ1_ENCODER 0 -#define ENABLE_TARGA_ENCODER 0 -#define ENABLE_WMV1_ENCODER 0 -#define ENABLE_WMV2_ENCODER 0 -#define ENABLE_X264_ENCODER 0 -#define ENABLE_XVID_ENCODER 0 -#define ENABLE_ZLIB_ENCODER 0 -#define ENABLE_ZMBV_ENCODER 0 -#define ENABLE_AC3_ENCODER 0 -#define ENABLE_AMR_NB_ENCODER 0 -#define ENABLE_AMR_WB_ENCODER 0 -#define ENABLE_FAAC_ENCODER 0 -#define ENABLE_FLAC_ENCODER 0 -#define ENABLE_LIBGSM_ENCODER 0 -#define ENABLE_LIBGSM_MS_ENCODER 0 -#define ENABLE_LIBTHEORA_ENCODER 0 -#define ENABLE_MP2_ENCODER 0 -#define ENABLE_MP3LAME_ENCODER 0 -#define ENABLE_OGGVORBIS_ENCODER 0 -#define ENABLE_SONIC_ENCODER 0 -#define ENABLE_SONIC_LS_ENCODER 0 -#define ENABLE_VORBIS_ENCODER 0 -#define ENABLE_WMAV1_ENCODER 0 -#define ENABLE_WMAV2_ENCODER 0 -#define ENABLE_PCM_ALAW_ENCODER 0 -#define ENABLE_PCM_MULAW_ENCODER 0 -#define ENABLE_PCM_S8_ENCODER 0 -#define ENABLE_PCM_S16BE_ENCODER 0 -#define ENABLE_PCM_S16LE_ENCODER 0 -#define ENABLE_PCM_S24BE_ENCODER 0 -#define ENABLE_PCM_S24DAUD_ENCODER 0 -#define ENABLE_PCM_S24LE_ENCODER 0 -#define ENABLE_PCM_S32BE_ENCODER 0 -#define ENABLE_PCM_S32LE_ENCODER 0 -#define ENABLE_PCM_U8_ENCODER 0 -#define ENABLE_PCM_U16BE_ENCODER 0 -#define ENABLE_PCM_U16LE_ENCODER 0 -#define ENABLE_PCM_U24BE_ENCODER 0 -#define ENABLE_PCM_U24LE_ENCODER 0 -#define ENABLE_PCM_U32BE_ENCODER 0 -#define ENABLE_PCM_U32LE_ENCODER 0 -#define ENABLE_ADPCM_4XM_ENCODER 0 -#define ENABLE_ADPCM_ADX_ENCODER 0 -#define ENABLE_ADPCM_CT_ENCODER 0 -#define ENABLE_ADPCM_EA_ENCODER 0 -#define ENABLE_ADPCM_G726_ENCODER 0 -#define ENABLE_ADPCM_IMA_DK3_ENCODER 0 -#define ENABLE_ADPCM_IMA_DK4_ENCODER 0 -#define ENABLE_ADPCM_IMA_QT_ENCODER 0 -#define ENABLE_ADPCM_IMA_SMJPEG_ENCODER 0 -#define ENABLE_ADPCM_IMA_WAV_ENCODER 0 -#define ENABLE_ADPCM_IMA_WS_ENCODER 0 -#define ENABLE_ADPCM_MS_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_2_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_3_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_4_ENCODER 0 -#define ENABLE_ADPCM_SWF_ENCODER 0 -#define ENABLE_ADPCM_XA_ENCODER 0 -#define ENABLE_ADPCM_YAMAHA_ENCODER 0 -#define ENABLE_DVBSUB_ENCODER 0 -#define ENABLE_DVDSUB_ENCODER 0 -#define ENABLE_AAC_PARSER 0 -#define CONFIG_AC3_PARSER 1 -#define ENABLE_AC3_PARSER 1 -#define ENABLE_CAVSVIDEO_PARSER 0 -#define ENABLE_DCA_PARSER 0 -#define ENABLE_DVBSUB_PARSER 0 -#define ENABLE_DVDSUB_PARSER 0 -#define CONFIG_H261_PARSER 1 -#define ENABLE_H261_PARSER 1 -#define CONFIG_H263_PARSER 1 -#define ENABLE_H263_PARSER 1 -#define CONFIG_H264_PARSER 1 -#define ENABLE_H264_PARSER 1 -#define CONFIG_MJPEG_PARSER 1 -#define ENABLE_MJPEG_PARSER 1 -#define CONFIG_MPEG4VIDEO_PARSER 1 -#define ENABLE_MPEG4VIDEO_PARSER 1 -#define CONFIG_MPEGAUDIO_PARSER 1 -#define ENABLE_MPEGAUDIO_PARSER 1 -#define CONFIG_MPEGVIDEO_PARSER 1 -#define ENABLE_MPEGVIDEO_PARSER 1 -#define ENABLE_PNM_PARSER 0 -#define ENABLE_VC1_PARSER 0 -#define CONFIG_AAC_DEMUXER 1 -#define ENABLE_AAC_DEMUXER 1 -#define CONFIG_AC3_DEMUXER 1 -#define ENABLE_AC3_DEMUXER 1 -#define CONFIG_AIFF_DEMUXER 1 -#define ENABLE_AIFF_DEMUXER 1 -#define CONFIG_AMR_DEMUXER 1 -#define ENABLE_AMR_DEMUXER 1 -#define CONFIG_ASF_DEMUXER 1 -#define ENABLE_ASF_DEMUXER 1 -#define CONFIG_AU_DEMUXER 1 -#define ENABLE_AU_DEMUXER 1 -#define ENABLE_AUDIO_DEMUXER 0 -#define CONFIG_AVI_DEMUXER 1 -#define ENABLE_AVI_DEMUXER 1 -#define CONFIG_AVS_DEMUXER 1 -#define ENABLE_AVS_DEMUXER 1 -#define CONFIG_DAUD_DEMUXER 1 -#define ENABLE_DAUD_DEMUXER 1 -#define ENABLE_DC1394_DEMUXER 0 -#define CONFIG_DSICIN_DEMUXER 1 -#define ENABLE_DSICIN_DEMUXER 1 -#define CONFIG_DTS_DEMUXER 1 -#define ENABLE_DTS_DEMUXER 1 -#define CONFIG_DV_DEMUXER 1 -#define ENABLE_DV_DEMUXER 1 -#define ENABLE_DV1394_DEMUXER 0 -#define CONFIG_DXA_DEMUXER 1 -#define ENABLE_DXA_DEMUXER 1 -#define CONFIG_EA_DEMUXER 1 -#define ENABLE_EA_DEMUXER 1 -#define CONFIG_FFM_DEMUXER 1 -#define ENABLE_FFM_DEMUXER 1 -#define CONFIG_FLAC_DEMUXER 1 -#define ENABLE_FLAC_DEMUXER 1 -#define CONFIG_FLIC_DEMUXER 1 -#define ENABLE_FLIC_DEMUXER 1 -#define CONFIG_FLV_DEMUXER 1 -#define ENABLE_FLV_DEMUXER 1 -#define CONFIG_FOURXM_DEMUXER 1 -#define ENABLE_FOURXM_DEMUXER 1 -#define CONFIG_GIF_DEMUXER 1 -#define ENABLE_GIF_DEMUXER 1 -#define CONFIG_GXF_DEMUXER 1 -#define ENABLE_GXF_DEMUXER 1 -#define CONFIG_H261_DEMUXER 1 -#define ENABLE_H261_DEMUXER 1 -#define CONFIG_H263_DEMUXER 1 -#define ENABLE_H263_DEMUXER 1 -#define CONFIG_H264_DEMUXER 1 -#define ENABLE_H264_DEMUXER 1 -#define CONFIG_IDCIN_DEMUXER 1 -#define ENABLE_IDCIN_DEMUXER 1 -#define CONFIG_IMAGE2_DEMUXER 1 -#define ENABLE_IMAGE2_DEMUXER 1 -#define CONFIG_IMAGE2PIPE_DEMUXER 1 -#define ENABLE_IMAGE2PIPE_DEMUXER 1 -#define CONFIG_INGENIENT_DEMUXER 1 -#define ENABLE_INGENIENT_DEMUXER 1 -#define CONFIG_IPMOVIE_DEMUXER 1 -#define ENABLE_IPMOVIE_DEMUXER 1 -#define ENABLE_LIBNUT_DEMUXER 0 -#define CONFIG_M4V_DEMUXER 1 -#define ENABLE_M4V_DEMUXER 1 -#define CONFIG_MATROSKA_DEMUXER 1 -#define ENABLE_MATROSKA_DEMUXER 1 -#define CONFIG_MJPEG_DEMUXER 1 -#define ENABLE_MJPEG_DEMUXER 1 -#define CONFIG_MM_DEMUXER 1 -#define ENABLE_MM_DEMUXER 1 -#define CONFIG_MMF_DEMUXER 1 -#define ENABLE_MMF_DEMUXER 1 -#define CONFIG_MOV_DEMUXER 1 -#define ENABLE_MOV_DEMUXER 1 -#define CONFIG_MP3_DEMUXER 1 -#define ENABLE_MP3_DEMUXER 1 -#define CONFIG_MPC_DEMUXER 1 -#define ENABLE_MPC_DEMUXER 1 -#define CONFIG_MPEGPS_DEMUXER 1 -#define ENABLE_MPEGPS_DEMUXER 1 -#define CONFIG_MPEGTS_DEMUXER 1 -#define ENABLE_MPEGTS_DEMUXER 1 -#define CONFIG_MPEGVIDEO_DEMUXER 1 -#define ENABLE_MPEGVIDEO_DEMUXER 1 -#define CONFIG_MTV_DEMUXER 1 -#define ENABLE_MTV_DEMUXER 1 -#define CONFIG_MXF_DEMUXER 1 -#define ENABLE_MXF_DEMUXER 1 -#define CONFIG_NSV_DEMUXER 1 -#define ENABLE_NSV_DEMUXER 1 -#define CONFIG_NUT_DEMUXER 1 -#define ENABLE_NUT_DEMUXER 1 -#define CONFIG_NUV_DEMUXER 1 -#define ENABLE_NUV_DEMUXER 1 -#define CONFIG_OGG_DEMUXER 1 -#define ENABLE_OGG_DEMUXER 1 -#define CONFIG_PCM_ALAW_DEMUXER 1 -#define ENABLE_PCM_ALAW_DEMUXER 1 -#define CONFIG_PCM_MULAW_DEMUXER 1 -#define ENABLE_PCM_MULAW_DEMUXER 1 -#define CONFIG_PCM_S16BE_DEMUXER 1 -#define ENABLE_PCM_S16BE_DEMUXER 1 -#define CONFIG_PCM_S16LE_DEMUXER 1 -#define ENABLE_PCM_S16LE_DEMUXER 1 -#define CONFIG_PCM_S8_DEMUXER 1 -#define ENABLE_PCM_S8_DEMUXER 1 -#define CONFIG_PCM_U16BE_DEMUXER 1 -#define ENABLE_PCM_U16BE_DEMUXER 1 -#define CONFIG_PCM_U16LE_DEMUXER 1 -#define ENABLE_PCM_U16LE_DEMUXER 1 -#define CONFIG_PCM_U8_DEMUXER 1 -#define ENABLE_PCM_U8_DEMUXER 1 -#define CONFIG_RAWVIDEO_DEMUXER 1 -#define ENABLE_RAWVIDEO_DEMUXER 1 -#define CONFIG_RM_DEMUXER 1 -#define ENABLE_RM_DEMUXER 1 -#define CONFIG_ROQ_DEMUXER 1 -#define ENABLE_ROQ_DEMUXER 1 -#define ENABLE_REDIR_DEMUXER 0 -#define ENABLE_RTSP_DEMUXER 0 -#define ENABLE_SDP_DEMUXER 0 -#define CONFIG_SEGAFILM_DEMUXER 1 -#define ENABLE_SEGAFILM_DEMUXER 1 -#define CONFIG_SHORTEN_DEMUXER 1 -#define ENABLE_SHORTEN_DEMUXER 1 -#define CONFIG_SMACKER_DEMUXER 1 -#define ENABLE_SMACKER_DEMUXER 1 -#define CONFIG_SOL_DEMUXER 1 -#define ENABLE_SOL_DEMUXER 1 -#define CONFIG_STR_DEMUXER 1 -#define ENABLE_STR_DEMUXER 1 -#define CONFIG_SWF_DEMUXER 1 -#define ENABLE_SWF_DEMUXER 1 -#define CONFIG_TIERTEXSEQ_DEMUXER 1 -#define ENABLE_TIERTEXSEQ_DEMUXER 1 -#define CONFIG_TTA_DEMUXER 1 -#define ENABLE_TTA_DEMUXER 1 -#define ENABLE_V4L2_DEMUXER 0 -#define CONFIG_VC1_DEMUXER 1 -#define ENABLE_VC1_DEMUXER 1 -#define ENABLE_VIDEO_GRAB_DEVICE_DEMUXER 0 -#define CONFIG_VMD_DEMUXER 1 -#define ENABLE_VMD_DEMUXER 1 -#define CONFIG_VOC_DEMUXER 1 -#define ENABLE_VOC_DEMUXER 1 -#define CONFIG_WAV_DEMUXER 1 -#define ENABLE_WAV_DEMUXER 1 -#define CONFIG_WC3_DEMUXER 1 -#define ENABLE_WC3_DEMUXER 1 -#define CONFIG_WSAUD_DEMUXER 1 -#define ENABLE_WSAUD_DEMUXER 1 -#define CONFIG_WSVQA_DEMUXER 1 -#define ENABLE_WSVQA_DEMUXER 1 -#define CONFIG_WV_DEMUXER 1 -#define ENABLE_WV_DEMUXER 1 -#define ENABLE_X11_GRAB_DEVICE_DEMUXER 0 -#define CONFIG_YUV4MPEGPIPE_DEMUXER 1 -#define ENABLE_YUV4MPEGPIPE_DEMUXER 1 -#define ENABLE_AC3_MUXER 0 -#define ENABLE_ADTS_MUXER 0 -#define ENABLE_AIFF_MUXER 0 -#define ENABLE_AMR_MUXER 0 -#define ENABLE_ASF_MUXER 0 -#define ENABLE_ASF_STREAM_MUXER 0 -#define ENABLE_AU_MUXER 0 -#define ENABLE_AUDIO_MUXER 0 -#define ENABLE_AVI_MUXER 0 -#define ENABLE_CRC_MUXER 0 -#define ENABLE_DV_MUXER 0 -#define ENABLE_FFM_MUXER 0 -#define ENABLE_FLAC_MUXER 0 -#define ENABLE_FLV_MUXER 0 -#define ENABLE_FRAMECRC_MUXER 0 -#define ENABLE_GIF_MUXER 0 -#define ENABLE_GXF_MUXER 0 -#define ENABLE_H261_MUXER 0 -#define ENABLE_H263_MUXER 0 -#define ENABLE_H264_MUXER 0 -#define ENABLE_IMAGE2_MUXER 0 -#define ENABLE_IMAGE2PIPE_MUXER 0 -#define ENABLE_LIBNUT_MUXER 0 -#define ENABLE_M4V_MUXER 0 -#define ENABLE_MJPEG_MUXER 0 -#define ENABLE_MMF_MUXER 0 -#define ENABLE_MOV_MUXER 0 -#define ENABLE_MP2_MUXER 0 -#define ENABLE_MP3_MUXER 0 -#define ENABLE_MP4_MUXER 0 -#define ENABLE_MPEG1SYSTEM_MUXER 0 -#define ENABLE_MPEG1VCD_MUXER 0 -#define ENABLE_MPEG1VIDEO_MUXER 0 -#define ENABLE_MPEG2DVD_MUXER 0 -#define ENABLE_MPEG2SVCD_MUXER 0 -#define ENABLE_MPEG2VIDEO_MUXER 0 -#define ENABLE_MPEG2VOB_MUXER 0 -#define ENABLE_MPEGTS_MUXER 0 -#define ENABLE_MPJPEG_MUXER 0 -#define ENABLE_NULL_MUXER 0 -#define ENABLE_OGG_MUXER 0 -#define ENABLE_PCM_ALAW_MUXER 0 -#define ENABLE_PCM_MULAW_MUXER 0 -#define ENABLE_PCM_S16BE_MUXER 0 -#define ENABLE_PCM_S16LE_MUXER 0 -#define ENABLE_PCM_S8_MUXER 0 -#define ENABLE_PCM_U16BE_MUXER 0 -#define ENABLE_PCM_U16LE_MUXER 0 -#define ENABLE_PCM_U8_MUXER 0 -#define ENABLE_PSP_MUXER 0 -#define ENABLE_RAWVIDEO_MUXER 0 -#define ENABLE_RM_MUXER 0 -#define ENABLE_RTP_MUXER 0 -#define ENABLE_SWF_MUXER 0 -#define ENABLE_TG2_MUXER 0 -#define ENABLE_TGP_MUXER 0 -#define ENABLE_VOC_MUXER 0 -#define ENABLE_WAV_MUXER 0 -#define ENABLE_YUV4MPEGPIPE_MUXER 0 -#elif defined(__i386__) -/* Automatically generated by configure - do not modify! */ -#define FFMPEG_CONFIGURATION "--disable-shared --enable-static --disable-debug --disable-vhook --enable-memalign-hack --disable-network --enable-small --disable-encoders --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-muxers --enable-demuxer=avi --enable-demuxer=h261 --enable-demuxer=h263 --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=mpegvideo --enable-demuxer=ogg --enable-demuxer=rawvideo --enable-demuxer=yuv4mpegpipe --disable-decoders --enable-decoder=h261 --enable-decoder=h263 --enable-decoder=h263i --enable-decoder=h264 --enable-decoder=huffyuv --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-decoder=mpeg_xvmc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=mpegvideo --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=rawvideo --enable-decoder=theora --disable-parsers --enable-parser=h261 --enable-parser=h263 --enable-parser=h264 --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=ac3" -#define ARCH_X86_32 1 -#define ARCH_X86 1 -#define __CPU__ 586 -#define HAVE_DLFCN_H 1 -#define HAVE_DLOPEN 1 -#define HAVE_FREETYPE2 1 -#define HAVE_INET_ATON 1 -#define HAVE_LOCALTIME_R 1 -#define HAVE_LRINTF 1 -#define HAVE_MMX 1 -#define CONFIG_DECODERS 1 -#define CONFIG_DEMUXERS 1 -#define CONFIG_MEMALIGN_HACK 1 -#define CONFIG_MPEGAUDIO_HP 1 -#define CONFIG_PROTOCOLS 1 -#define CONFIG_ZLIB 1 -#define TARGET_MMX 1 -#define CONFIG_DARWIN 1 -#define restrict __restrict__ -#define always_inline -#define CONFIG_SMALL 1 -#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" -#define ENABLE_AASC_DECODER 0 -#define ENABLE_ASV1_DECODER 0 -#define ENABLE_ASV2_DECODER 0 -#define ENABLE_AVS_DECODER 0 -#define ENABLE_BMP_DECODER 0 -#define ENABLE_CAVS_DECODER 0 -#define ENABLE_CINEPAK_DECODER 0 -#define ENABLE_CLJR_DECODER 0 -#define ENABLE_CSCD_DECODER 0 -#define ENABLE_CYUV_DECODER 0 -#define ENABLE_DCA_DECODER 0 -#define ENABLE_DNXHD_DECODER 0 -#define ENABLE_DSICINVIDEO_DECODER 0 -#define ENABLE_DVVIDEO_DECODER 0 -#define ENABLE_DXA_DECODER 0 -#define ENABLE_EIGHTBPS_DECODER 0 -#define ENABLE_FFV1_DECODER 0 -#define ENABLE_FFVHUFF_DECODER 0 -#define ENABLE_FLASHSV_DECODER 0 -#define ENABLE_FLIC_DECODER 0 -#define ENABLE_FLV_DECODER 0 -#define ENABLE_FOURXM_DECODER 0 -#define ENABLE_FRAPS_DECODER 0 -#define ENABLE_GIF_DECODER 0 -#define CONFIG_H261_DECODER 1 -#define ENABLE_H261_DECODER 1 -#define CONFIG_H263_DECODER 1 -#define ENABLE_H263_DECODER 1 -#define CONFIG_H263I_DECODER 1 -#define ENABLE_H263I_DECODER 1 -#define CONFIG_H264_DECODER 1 -#define ENABLE_H264_DECODER 1 -#define CONFIG_HUFFYUV_DECODER 1 -#define ENABLE_HUFFYUV_DECODER 1 -#define ENABLE_IDCIN_DECODER 0 -#define ENABLE_INDEO2_DECODER 0 -#define ENABLE_INDEO3_DECODER 0 -#define ENABLE_INTERPLAY_VIDEO_DECODER 0 -#define ENABLE_KMVC_DECODER 0 -#define ENABLE_LOCO_DECODER 0 -#define ENABLE_MDEC_DECODER 0 -#define CONFIG_MJPEG_DECODER 1 -#define ENABLE_MJPEG_DECODER 1 -#define CONFIG_MJPEGB_DECODER 1 -#define ENABLE_MJPEGB_DECODER 1 -#define ENABLE_MMVIDEO_DECODER 0 -#define ENABLE_MPEG_XVMC_DECODER 0 -#define CONFIG_MPEG1VIDEO_DECODER 1 -#define ENABLE_MPEG1VIDEO_DECODER 1 -#define CONFIG_MPEG2VIDEO_DECODER 1 -#define ENABLE_MPEG2VIDEO_DECODER 1 -#define CONFIG_MPEG4_DECODER 1 -#define ENABLE_MPEG4_DECODER 1 -#define CONFIG_MPEGVIDEO_DECODER 1 -#define ENABLE_MPEGVIDEO_DECODER 1 -#define CONFIG_MSMPEG4V1_DECODER 1 -#define ENABLE_MSMPEG4V1_DECODER 1 -#define CONFIG_MSMPEG4V2_DECODER 1 -#define ENABLE_MSMPEG4V2_DECODER 1 -#define CONFIG_MSMPEG4V3_DECODER 1 -#define ENABLE_MSMPEG4V3_DECODER 1 -#define ENABLE_MSRLE_DECODER 0 -#define ENABLE_MSVIDEO1_DECODER 0 -#define ENABLE_MSZH_DECODER 0 -#define ENABLE_NUV_DECODER 0 -#define ENABLE_PNG_DECODER 0 -#define ENABLE_QDRAW_DECODER 0 -#define ENABLE_QPEG_DECODER 0 -#define ENABLE_QTRLE_DECODER 0 -#define CONFIG_RAWVIDEO_DECODER 1 -#define ENABLE_RAWVIDEO_DECODER 1 -#define ENABLE_ROQ_DECODER 0 -#define ENABLE_RPZA_DECODER 0 -#define ENABLE_RV10_DECODER 0 -#define ENABLE_RV20_DECODER 0 -#define ENABLE_SMACKER_DECODER 0 -#define ENABLE_SMC_DECODER 0 -#define ENABLE_SNOW_DECODER 0 -#define ENABLE_SP5X_DECODER 0 -#define ENABLE_SVQ1_DECODER 0 -#define ENABLE_SVQ3_DECODER 0 -#define ENABLE_TARGA_DECODER 0 -#define CONFIG_THEORA_DECODER 1 -#define ENABLE_THEORA_DECODER 1 -#define ENABLE_TIERTEXSEQVIDEO_DECODER 0 -#define ENABLE_TIFF_DECODER 0 -#define ENABLE_TRUEMOTION1_DECODER 0 -#define ENABLE_TRUEMOTION2_DECODER 0 -#define ENABLE_TSCC_DECODER 0 -#define ENABLE_ULTI_DECODER 0 -#define ENABLE_VC1_DECODER 0 -#define ENABLE_VCR1_DECODER 0 -#define ENABLE_VMDVIDEO_DECODER 0 -#define ENABLE_VMNC_DECODER 0 -#define ENABLE_VP3_DECODER 0 -#define ENABLE_VP5_DECODER 0 -#define ENABLE_VP6_DECODER 0 -#define ENABLE_VP6F_DECODER 0 -#define ENABLE_VQA_DECODER 0 -#define ENABLE_WMV1_DECODER 0 -#define ENABLE_WMV2_DECODER 0 -#define ENABLE_WMV3_DECODER 0 -#define ENABLE_WNV1_DECODER 0 -#define ENABLE_XAN_WC3_DECODER 0 -#define ENABLE_XL_DECODER 0 -#define ENABLE_ZLIB_DECODER 0 -#define ENABLE_ZMBV_DECODER 0 -#define ENABLE_AAC_DECODER 0 -#define ENABLE_MPEG4AAC_DECODER 0 -#define ENABLE_ALAC_DECODER 0 -#define ENABLE_AMR_NB_DECODER 0 -#define ENABLE_AMR_WB_DECODER 0 -#define ENABLE_COOK_DECODER 0 -#define ENABLE_DSICINAUDIO_DECODER 0 -#define ENABLE_DTS_DECODER 0 -#define ENABLE_FLAC_DECODER 0 -#define ENABLE_IMC_DECODER 0 -#define ENABLE_LIBA52_DECODER 0 -#define ENABLE_LIBGSM_DECODER 0 -#define ENABLE_LIBGSM_MS_DECODER 0 -#define ENABLE_MACE3_DECODER 0 -#define ENABLE_MACE6_DECODER 0 -#define ENABLE_MP2_DECODER 0 -#define ENABLE_MP3_DECODER 0 -#define ENABLE_MP3ADU_DECODER 0 -#define ENABLE_MP3ON4_DECODER 0 -#define ENABLE_MPC7_DECODER 0 -#define ENABLE_OGGVORBIS_DECODER 0 -#define ENABLE_QDM2_DECODER 0 -#define ENABLE_RA_144_DECODER 0 -#define ENABLE_RA_288_DECODER 0 -#define ENABLE_SHORTEN_DECODER 0 -#define ENABLE_SMACKAUD_DECODER 0 -#define ENABLE_SONIC_DECODER 0 -#define ENABLE_TRUESPEECH_DECODER 0 -#define ENABLE_TTA_DECODER 0 -#define ENABLE_VMDAUDIO_DECODER 0 -#define ENABLE_VORBIS_DECODER 0 -#define ENABLE_WAVPACK_DECODER 0 -#define ENABLE_WMAV1_DECODER 0 -#define ENABLE_WMAV2_DECODER 0 -#define ENABLE_WS_SND1_DECODER 0 -#define ENABLE_PCM_ALAW_DECODER 0 -#define ENABLE_PCM_MULAW_DECODER 0 -#define ENABLE_PCM_S8_DECODER 0 -#define ENABLE_PCM_S16BE_DECODER 0 -#define ENABLE_PCM_S16LE_DECODER 0 -#define ENABLE_PCM_S24BE_DECODER 0 -#define ENABLE_PCM_S24DAUD_DECODER 0 -#define ENABLE_PCM_S24LE_DECODER 0 -#define ENABLE_PCM_S32BE_DECODER 0 -#define ENABLE_PCM_S32LE_DECODER 0 -#define ENABLE_PCM_U8_DECODER 0 -#define ENABLE_PCM_U16BE_DECODER 0 -#define ENABLE_PCM_U16LE_DECODER 0 -#define ENABLE_PCM_U24BE_DECODER 0 -#define ENABLE_PCM_U24LE_DECODER 0 -#define ENABLE_PCM_U32BE_DECODER 0 -#define ENABLE_PCM_U32LE_DECODER 0 -#define ENABLE_INTERPLAY_DPCM_DECODER 0 -#define ENABLE_ROQ_DPCM_DECODER 0 -#define ENABLE_SOL_DPCM_DECODER 0 -#define ENABLE_XAN_DPCM_DECODER 0 -#define ENABLE_ADPCM_4XM_DECODER 0 -#define ENABLE_ADPCM_ADX_DECODER 0 -#define ENABLE_ADPCM_CT_DECODER 0 -#define ENABLE_ADPCM_EA_DECODER 0 -#define ENABLE_ADPCM_G726_DECODER 0 -#define ENABLE_ADPCM_IMA_DK3_DECODER 0 -#define ENABLE_ADPCM_IMA_DK4_DECODER 0 -#define ENABLE_ADPCM_IMA_QT_DECODER 0 -#define ENABLE_ADPCM_IMA_SMJPEG_DECODER 0 -#define ENABLE_ADPCM_IMA_WAV_DECODER 0 -#define ENABLE_ADPCM_IMA_WS_DECODER 0 -#define ENABLE_ADPCM_MS_DECODER 0 -#define ENABLE_ADPCM_SBPRO_2_DECODER 0 -#define ENABLE_ADPCM_SBPRO_3_DECODER 0 -#define ENABLE_ADPCM_SBPRO_4_DECODER 0 -#define ENABLE_ADPCM_SWF_DECODER 0 -#define ENABLE_ADPCM_XA_DECODER 0 -#define ENABLE_ADPCM_YAMAHA_DECODER 0 -#define ENABLE_DVBSUB_DECODER 0 -#define ENABLE_DVDSUB_DECODER 0 -#define ENABLE_ASV1_ENCODER 0 -#define ENABLE_ASV2_ENCODER 0 -#define ENABLE_BMP_ENCODER 0 -#define ENABLE_DVVIDEO_ENCODER 0 -#define ENABLE_FFV1_ENCODER 0 -#define ENABLE_FFVHUFF_ENCODER 0 -#define ENABLE_FLASHSV_ENCODER 0 -#define ENABLE_FLV_ENCODER 0 -#define ENABLE_GIF_ENCODER 0 -#define ENABLE_H261_ENCODER 0 -#define ENABLE_H263_ENCODER 0 -#define ENABLE_H263P_ENCODER 0 -#define ENABLE_HUFFYUV_ENCODER 0 -#define ENABLE_JPEGLS_ENCODER 0 -#define ENABLE_LJPEG_ENCODER 0 -#define ENABLE_MJPEG_ENCODER 0 -#define ENABLE_MPEG1VIDEO_ENCODER 0 -#define ENABLE_MPEG2VIDEO_ENCODER 0 -#define ENABLE_MPEG4_ENCODER 0 -#define ENABLE_MSMPEG4V1_ENCODER 0 -#define ENABLE_MSMPEG4V2_ENCODER 0 -#define ENABLE_MSMPEG4V3_ENCODER 0 -#define ENABLE_PAM_ENCODER 0 -#define ENABLE_PBM_ENCODER 0 -#define ENABLE_PGM_ENCODER 0 -#define ENABLE_PGMYUV_ENCODER 0 -#define ENABLE_PNG_ENCODER 0 -#define ENABLE_PPM_ENCODER 0 -#define ENABLE_RAWVIDEO_ENCODER 0 -#define ENABLE_RV10_ENCODER 0 -#define ENABLE_RV20_ENCODER 0 -#define ENABLE_SNOW_ENCODER 0 -#define ENABLE_SVQ1_ENCODER 0 -#define ENABLE_TARGA_ENCODER 0 -#define ENABLE_WMV1_ENCODER 0 -#define ENABLE_WMV2_ENCODER 0 -#define ENABLE_X264_ENCODER 0 -#define ENABLE_XVID_ENCODER 0 -#define ENABLE_ZLIB_ENCODER 0 -#define ENABLE_ZMBV_ENCODER 0 -#define ENABLE_AC3_ENCODER 0 -#define ENABLE_AMR_NB_ENCODER 0 -#define ENABLE_AMR_WB_ENCODER 0 -#define ENABLE_FAAC_ENCODER 0 -#define ENABLE_FLAC_ENCODER 0 -#define ENABLE_LIBGSM_ENCODER 0 -#define ENABLE_LIBGSM_MS_ENCODER 0 -#define ENABLE_LIBTHEORA_ENCODER 0 -#define ENABLE_MP2_ENCODER 0 -#define ENABLE_MP3LAME_ENCODER 0 -#define ENABLE_OGGVORBIS_ENCODER 0 -#define ENABLE_SONIC_ENCODER 0 -#define ENABLE_SONIC_LS_ENCODER 0 -#define ENABLE_VORBIS_ENCODER 0 -#define ENABLE_WMAV1_ENCODER 0 -#define ENABLE_WMAV2_ENCODER 0 -#define ENABLE_PCM_ALAW_ENCODER 0 -#define ENABLE_PCM_MULAW_ENCODER 0 -#define ENABLE_PCM_S8_ENCODER 0 -#define ENABLE_PCM_S16BE_ENCODER 0 -#define ENABLE_PCM_S16LE_ENCODER 0 -#define ENABLE_PCM_S24BE_ENCODER 0 -#define ENABLE_PCM_S24DAUD_ENCODER 0 -#define ENABLE_PCM_S24LE_ENCODER 0 -#define ENABLE_PCM_S32BE_ENCODER 0 -#define ENABLE_PCM_S32LE_ENCODER 0 -#define ENABLE_PCM_U8_ENCODER 0 -#define ENABLE_PCM_U16BE_ENCODER 0 -#define ENABLE_PCM_U16LE_ENCODER 0 -#define ENABLE_PCM_U24BE_ENCODER 0 -#define ENABLE_PCM_U24LE_ENCODER 0 -#define ENABLE_PCM_U32BE_ENCODER 0 -#define ENABLE_PCM_U32LE_ENCODER 0 -#define ENABLE_ADPCM_4XM_ENCODER 0 -#define ENABLE_ADPCM_ADX_ENCODER 0 -#define ENABLE_ADPCM_CT_ENCODER 0 -#define ENABLE_ADPCM_EA_ENCODER 0 -#define ENABLE_ADPCM_G726_ENCODER 0 -#define ENABLE_ADPCM_IMA_DK3_ENCODER 0 -#define ENABLE_ADPCM_IMA_DK4_ENCODER 0 -#define ENABLE_ADPCM_IMA_QT_ENCODER 0 -#define ENABLE_ADPCM_IMA_SMJPEG_ENCODER 0 -#define ENABLE_ADPCM_IMA_WAV_ENCODER 0 -#define ENABLE_ADPCM_IMA_WS_ENCODER 0 -#define ENABLE_ADPCM_MS_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_2_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_3_ENCODER 0 -#define ENABLE_ADPCM_SBPRO_4_ENCODER 0 -#define ENABLE_ADPCM_SWF_ENCODER 0 -#define ENABLE_ADPCM_XA_ENCODER 0 -#define ENABLE_ADPCM_YAMAHA_ENCODER 0 -#define ENABLE_DVBSUB_ENCODER 0 -#define ENABLE_DVDSUB_ENCODER 0 -#define ENABLE_AAC_PARSER 0 -#define CONFIG_AC3_PARSER 1 -#define ENABLE_AC3_PARSER 1 -#define ENABLE_CAVSVIDEO_PARSER 0 -#define ENABLE_DCA_PARSER 0 -#define ENABLE_DVBSUB_PARSER 0 -#define ENABLE_DVDSUB_PARSER 0 -#define CONFIG_H261_PARSER 1 -#define ENABLE_H261_PARSER 1 -#define CONFIG_H263_PARSER 1 -#define ENABLE_H263_PARSER 1 -#define CONFIG_H264_PARSER 1 -#define ENABLE_H264_PARSER 1 -#define CONFIG_MJPEG_PARSER 1 -#define ENABLE_MJPEG_PARSER 1 -#define CONFIG_MPEG4VIDEO_PARSER 1 -#define ENABLE_MPEG4VIDEO_PARSER 1 -#define CONFIG_MPEGAUDIO_PARSER 1 -#define ENABLE_MPEGAUDIO_PARSER 1 -#define CONFIG_MPEGVIDEO_PARSER 1 -#define ENABLE_MPEGVIDEO_PARSER 1 -#define ENABLE_PNM_PARSER 0 -#define ENABLE_VC1_PARSER 0 -#define CONFIG_AAC_DEMUXER 1 -#define ENABLE_AAC_DEMUXER 1 -#define CONFIG_AC3_DEMUXER 1 -#define ENABLE_AC3_DEMUXER 1 -#define CONFIG_AIFF_DEMUXER 1 -#define ENABLE_AIFF_DEMUXER 1 -#define CONFIG_AMR_DEMUXER 1 -#define ENABLE_AMR_DEMUXER 1 -#define CONFIG_ASF_DEMUXER 1 -#define ENABLE_ASF_DEMUXER 1 -#define CONFIG_AU_DEMUXER 1 -#define ENABLE_AU_DEMUXER 1 -#define ENABLE_AUDIO_DEMUXER 0 -#define CONFIG_AVI_DEMUXER 1 -#define ENABLE_AVI_DEMUXER 1 -#define CONFIG_AVS_DEMUXER 1 -#define ENABLE_AVS_DEMUXER 1 -#define CONFIG_DAUD_DEMUXER 1 -#define ENABLE_DAUD_DEMUXER 1 -#define ENABLE_DC1394_DEMUXER 0 -#define CONFIG_DSICIN_DEMUXER 1 -#define ENABLE_DSICIN_DEMUXER 1 -#define CONFIG_DTS_DEMUXER 1 -#define ENABLE_DTS_DEMUXER 1 -#define CONFIG_DV_DEMUXER 1 -#define ENABLE_DV_DEMUXER 1 -#define ENABLE_DV1394_DEMUXER 0 -#define CONFIG_DXA_DEMUXER 1 -#define ENABLE_DXA_DEMUXER 1 -#define CONFIG_EA_DEMUXER 1 -#define ENABLE_EA_DEMUXER 1 -#define CONFIG_FFM_DEMUXER 1 -#define ENABLE_FFM_DEMUXER 1 -#define CONFIG_FLAC_DEMUXER 1 -#define ENABLE_FLAC_DEMUXER 1 -#define CONFIG_FLIC_DEMUXER 1 -#define ENABLE_FLIC_DEMUXER 1 -#define CONFIG_FLV_DEMUXER 1 -#define ENABLE_FLV_DEMUXER 1 -#define CONFIG_FOURXM_DEMUXER 1 -#define ENABLE_FOURXM_DEMUXER 1 -#define CONFIG_GIF_DEMUXER 1 -#define ENABLE_GIF_DEMUXER 1 -#define CONFIG_GXF_DEMUXER 1 -#define ENABLE_GXF_DEMUXER 1 -#define CONFIG_H261_DEMUXER 1 -#define ENABLE_H261_DEMUXER 1 -#define CONFIG_H263_DEMUXER 1 -#define ENABLE_H263_DEMUXER 1 -#define CONFIG_H264_DEMUXER 1 -#define ENABLE_H264_DEMUXER 1 -#define CONFIG_IDCIN_DEMUXER 1 -#define ENABLE_IDCIN_DEMUXER 1 -#define CONFIG_IMAGE2_DEMUXER 1 -#define ENABLE_IMAGE2_DEMUXER 1 -#define CONFIG_IMAGE2PIPE_DEMUXER 1 -#define ENABLE_IMAGE2PIPE_DEMUXER 1 -#define CONFIG_INGENIENT_DEMUXER 1 -#define ENABLE_INGENIENT_DEMUXER 1 -#define CONFIG_IPMOVIE_DEMUXER 1 -#define ENABLE_IPMOVIE_DEMUXER 1 -#define ENABLE_LIBNUT_DEMUXER 0 -#define CONFIG_M4V_DEMUXER 1 -#define ENABLE_M4V_DEMUXER 1 -#define CONFIG_MATROSKA_DEMUXER 1 -#define ENABLE_MATROSKA_DEMUXER 1 -#define CONFIG_MJPEG_DEMUXER 1 -#define ENABLE_MJPEG_DEMUXER 1 -#define CONFIG_MM_DEMUXER 1 -#define ENABLE_MM_DEMUXER 1 -#define CONFIG_MMF_DEMUXER 1 -#define ENABLE_MMF_DEMUXER 1 -#define CONFIG_MOV_DEMUXER 1 -#define ENABLE_MOV_DEMUXER 1 -#define CONFIG_MP3_DEMUXER 1 -#define ENABLE_MP3_DEMUXER 1 -#define CONFIG_MPC_DEMUXER 1 -#define ENABLE_MPC_DEMUXER 1 -#define CONFIG_MPEGPS_DEMUXER 1 -#define ENABLE_MPEGPS_DEMUXER 1 -#define CONFIG_MPEGTS_DEMUXER 1 -#define ENABLE_MPEGTS_DEMUXER 1 -#define CONFIG_MPEGVIDEO_DEMUXER 1 -#define ENABLE_MPEGVIDEO_DEMUXER 1 -#define CONFIG_MTV_DEMUXER 1 -#define ENABLE_MTV_DEMUXER 1 -#define CONFIG_MXF_DEMUXER 1 -#define ENABLE_MXF_DEMUXER 1 -#define CONFIG_NSV_DEMUXER 1 -#define ENABLE_NSV_DEMUXER 1 -#define CONFIG_NUT_DEMUXER 1 -#define ENABLE_NUT_DEMUXER 1 -#define CONFIG_NUV_DEMUXER 1 -#define ENABLE_NUV_DEMUXER 1 -#define CONFIG_OGG_DEMUXER 1 -#define ENABLE_OGG_DEMUXER 1 -#define CONFIG_PCM_ALAW_DEMUXER 1 -#define ENABLE_PCM_ALAW_DEMUXER 1 -#define CONFIG_PCM_MULAW_DEMUXER 1 -#define ENABLE_PCM_MULAW_DEMUXER 1 -#define CONFIG_PCM_S16BE_DEMUXER 1 -#define ENABLE_PCM_S16BE_DEMUXER 1 -#define CONFIG_PCM_S16LE_DEMUXER 1 -#define ENABLE_PCM_S16LE_DEMUXER 1 -#define CONFIG_PCM_S8_DEMUXER 1 -#define ENABLE_PCM_S8_DEMUXER 1 -#define CONFIG_PCM_U16BE_DEMUXER 1 -#define ENABLE_PCM_U16BE_DEMUXER 1 -#define CONFIG_PCM_U16LE_DEMUXER 1 -#define ENABLE_PCM_U16LE_DEMUXER 1 -#define CONFIG_PCM_U8_DEMUXER 1 -#define ENABLE_PCM_U8_DEMUXER 1 -#define CONFIG_RAWVIDEO_DEMUXER 1 -#define ENABLE_RAWVIDEO_DEMUXER 1 -#define CONFIG_RM_DEMUXER 1 -#define ENABLE_RM_DEMUXER 1 -#define CONFIG_ROQ_DEMUXER 1 -#define ENABLE_ROQ_DEMUXER 1 -#define ENABLE_REDIR_DEMUXER 0 -#define ENABLE_RTSP_DEMUXER 0 -#define ENABLE_SDP_DEMUXER 0 -#define CONFIG_SEGAFILM_DEMUXER 1 -#define ENABLE_SEGAFILM_DEMUXER 1 -#define CONFIG_SHORTEN_DEMUXER 1 -#define ENABLE_SHORTEN_DEMUXER 1 -#define CONFIG_SMACKER_DEMUXER 1 -#define ENABLE_SMACKER_DEMUXER 1 -#define CONFIG_SOL_DEMUXER 1 -#define ENABLE_SOL_DEMUXER 1 -#define CONFIG_STR_DEMUXER 1 -#define ENABLE_STR_DEMUXER 1 -#define CONFIG_SWF_DEMUXER 1 -#define ENABLE_SWF_DEMUXER 1 -#define CONFIG_TIERTEXSEQ_DEMUXER 1 -#define ENABLE_TIERTEXSEQ_DEMUXER 1 -#define CONFIG_TTA_DEMUXER 1 -#define ENABLE_TTA_DEMUXER 1 -#define ENABLE_V4L2_DEMUXER 0 -#define CONFIG_VC1_DEMUXER 1 -#define ENABLE_VC1_DEMUXER 1 -#define ENABLE_VIDEO_GRAB_DEVICE_DEMUXER 0 -#define CONFIG_VMD_DEMUXER 1 -#define ENABLE_VMD_DEMUXER 1 -#define CONFIG_VOC_DEMUXER 1 -#define ENABLE_VOC_DEMUXER 1 -#define CONFIG_WAV_DEMUXER 1 -#define ENABLE_WAV_DEMUXER 1 -#define CONFIG_WC3_DEMUXER 1 -#define ENABLE_WC3_DEMUXER 1 -#define CONFIG_WSAUD_DEMUXER 1 -#define ENABLE_WSAUD_DEMUXER 1 -#define CONFIG_WSVQA_DEMUXER 1 -#define ENABLE_WSVQA_DEMUXER 1 -#define CONFIG_WV_DEMUXER 1 -#define ENABLE_WV_DEMUXER 1 -#define ENABLE_X11_GRAB_DEVICE_DEMUXER 0 -#define CONFIG_YUV4MPEGPIPE_DEMUXER 1 -#define ENABLE_YUV4MPEGPIPE_DEMUXER 1 -#define ENABLE_AC3_MUXER 0 -#define ENABLE_ADTS_MUXER 0 -#define ENABLE_AIFF_MUXER 0 -#define ENABLE_AMR_MUXER 0 -#define ENABLE_ASF_MUXER 0 -#define ENABLE_ASF_STREAM_MUXER 0 -#define ENABLE_AU_MUXER 0 -#define ENABLE_AUDIO_MUXER 0 -#define ENABLE_AVI_MUXER 0 -#define ENABLE_CRC_MUXER 0 -#define ENABLE_DV_MUXER 0 -#define ENABLE_FFM_MUXER 0 -#define ENABLE_FLAC_MUXER 0 -#define ENABLE_FLV_MUXER 0 -#define ENABLE_FRAMECRC_MUXER 0 -#define ENABLE_GIF_MUXER 0 -#define ENABLE_GXF_MUXER 0 -#define ENABLE_H261_MUXER 0 -#define ENABLE_H263_MUXER 0 -#define ENABLE_H264_MUXER 0 -#define ENABLE_IMAGE2_MUXER 0 -#define ENABLE_IMAGE2PIPE_MUXER 0 -#define ENABLE_LIBNUT_MUXER 0 -#define ENABLE_M4V_MUXER 0 -#define ENABLE_MJPEG_MUXER 0 -#define ENABLE_MMF_MUXER 0 -#define ENABLE_MOV_MUXER 0 -#define ENABLE_MP2_MUXER 0 -#define ENABLE_MP3_MUXER 0 -#define ENABLE_MP4_MUXER 0 -#define ENABLE_MPEG1SYSTEM_MUXER 0 -#define ENABLE_MPEG1VCD_MUXER 0 -#define ENABLE_MPEG1VIDEO_MUXER 0 -#define ENABLE_MPEG2DVD_MUXER 0 -#define ENABLE_MPEG2SVCD_MUXER 0 -#define ENABLE_MPEG2VIDEO_MUXER 0 -#define ENABLE_MPEG2VOB_MUXER 0 -#define ENABLE_MPEGTS_MUXER 0 -#define ENABLE_MPJPEG_MUXER 0 -#define ENABLE_NULL_MUXER 0 -#define ENABLE_OGG_MUXER 0 -#define ENABLE_PCM_ALAW_MUXER 0 -#define ENABLE_PCM_MULAW_MUXER 0 -#define ENABLE_PCM_S16BE_MUXER 0 -#define ENABLE_PCM_S16LE_MUXER 0 -#define ENABLE_PCM_S8_MUXER 0 -#define ENABLE_PCM_U16BE_MUXER 0 -#define ENABLE_PCM_U16LE_MUXER 0 -#define ENABLE_PCM_U8_MUXER 0 -#define ENABLE_PSP_MUXER 0 -#define ENABLE_RAWVIDEO_MUXER 0 -#define ENABLE_RM_MUXER 0 -#define ENABLE_RTP_MUXER 0 -#define ENABLE_SWF_MUXER 0 -#define ENABLE_TG2_MUXER 0 -#define ENABLE_TGP_MUXER 0 -#define ENABLE_VOC_MUXER 0 -#define ENABLE_WAV_MUXER 0 -#define ENABLE_YUV4MPEGPIPE_MUXER 0 -#endif +#define attribute_deprecated +#if defined(__ppc__) +/* Automatically generated by configure - do not modify! */ +#define FFMPEG_CONFIGURATION "--disable-static --enable-shared --disable-debug --disable-vhook --enable-memalign-hack --disable-network --enable-small --disable-encoders --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-muxers --enable-demuxer=avi --enable-demuxer=h261 --enable-demuxer=h263 --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=mpegvideo --enable-demuxer=ogg --enable-demuxer=rawvideo --enable-demuxer=yuv4mpegpipe --disable-decoders --enable-decoder=h261 --enable-decoder=h263 --enable-decoder=h263i --enable-decoder=h264 --enable-decoder=huffyuv --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-decoder=mpeg_xvmc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=mpegvideo --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=rawvideo --enable-decoder=theora --disable-parsers --enable-parser=h261 --enable-parser=h263 --enable-parser=h264 --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=ac3" +#define ARCH_POWERPC 1 +#define WORDS_BIGENDIAN 1 +#define HAVE_ALTIVEC 1 +#define HAVE_ALTIVEC_H 1 +#define HAVE_DCBZL 1 +#define HAVE_DLFCN_H 1 +#define HAVE_DLOPEN 1 +#define HAVE_FREETYPE2 1 +#define HAVE_INET_ATON 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_LRINTF 1 +#define HAVE_SDL 1 +#define CONFIG_DECODERS 1 +#define CONFIG_DEMUXERS 1 +#define CONFIG_MEMALIGN_HACK 1 +#define CONFIG_MPEGAUDIO_HP 1 +#define CONFIG_PROTOCOLS 1 +#define CONFIG_ZLIB 1 +#define TARGET_ALTIVEC 1 +#define CONFIG_DARWIN 1 +#define restrict __restrict__ +#define always_inline +#define CONFIG_SMALL 1 +#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" +#define ENABLE_AASC_DECODER 0 +#define ENABLE_ASV1_DECODER 0 +#define ENABLE_ASV2_DECODER 0 +#define ENABLE_AVS_DECODER 0 +#define ENABLE_BMP_DECODER 0 +#define ENABLE_CAVS_DECODER 0 +#define ENABLE_CINEPAK_DECODER 0 +#define ENABLE_CLJR_DECODER 0 +#define ENABLE_CSCD_DECODER 0 +#define ENABLE_CYUV_DECODER 0 +#define ENABLE_DCA_DECODER 0 +#define ENABLE_DNXHD_DECODER 0 +#define ENABLE_DSICINVIDEO_DECODER 0 +#define ENABLE_DVVIDEO_DECODER 0 +#define ENABLE_DXA_DECODER 0 +#define ENABLE_EIGHTBPS_DECODER 0 +#define ENABLE_FFV1_DECODER 0 +#define ENABLE_FFVHUFF_DECODER 0 +#define ENABLE_FLASHSV_DECODER 0 +#define ENABLE_FLIC_DECODER 0 +#define ENABLE_FLV_DECODER 0 +#define ENABLE_FOURXM_DECODER 0 +#define ENABLE_FRAPS_DECODER 0 +#define ENABLE_GIF_DECODER 0 +#define CONFIG_H261_DECODER 1 +#define ENABLE_H261_DECODER 1 +#define CONFIG_H263_DECODER 1 +#define ENABLE_H263_DECODER 1 +#define CONFIG_H263I_DECODER 1 +#define ENABLE_H263I_DECODER 1 +#define CONFIG_H264_DECODER 1 +#define ENABLE_H264_DECODER 1 +#define CONFIG_HUFFYUV_DECODER 1 +#define ENABLE_HUFFYUV_DECODER 1 +#define ENABLE_IDCIN_DECODER 0 +#define ENABLE_INDEO2_DECODER 0 +#define ENABLE_INDEO3_DECODER 0 +#define ENABLE_INTERPLAY_VIDEO_DECODER 0 +#define ENABLE_KMVC_DECODER 0 +#define ENABLE_LOCO_DECODER 0 +#define ENABLE_MDEC_DECODER 0 +#define CONFIG_MJPEG_DECODER 1 +#define ENABLE_MJPEG_DECODER 1 +#define CONFIG_MJPEGB_DECODER 1 +#define ENABLE_MJPEGB_DECODER 1 +#define ENABLE_MMVIDEO_DECODER 0 +#define ENABLE_MPEG_XVMC_DECODER 0 +#define CONFIG_MPEG1VIDEO_DECODER 1 +#define ENABLE_MPEG1VIDEO_DECODER 1 +#define CONFIG_MPEG2VIDEO_DECODER 1 +#define ENABLE_MPEG2VIDEO_DECODER 1 +#define CONFIG_MPEG4_DECODER 1 +#define ENABLE_MPEG4_DECODER 1 +#define CONFIG_MPEGVIDEO_DECODER 1 +#define ENABLE_MPEGVIDEO_DECODER 1 +#define CONFIG_MSMPEG4V1_DECODER 1 +#define ENABLE_MSMPEG4V1_DECODER 1 +#define CONFIG_MSMPEG4V2_DECODER 1 +#define ENABLE_MSMPEG4V2_DECODER 1 +#define CONFIG_MSMPEG4V3_DECODER 1 +#define ENABLE_MSMPEG4V3_DECODER 1 +#define ENABLE_MSRLE_DECODER 0 +#define ENABLE_MSVIDEO1_DECODER 0 +#define ENABLE_MSZH_DECODER 0 +#define ENABLE_NUV_DECODER 0 +#define ENABLE_PNG_DECODER 0 +#define ENABLE_QDRAW_DECODER 0 +#define ENABLE_QPEG_DECODER 0 +#define ENABLE_QTRLE_DECODER 0 +#define CONFIG_RAWVIDEO_DECODER 1 +#define ENABLE_RAWVIDEO_DECODER 1 +#define ENABLE_ROQ_DECODER 0 +#define ENABLE_RPZA_DECODER 0 +#define ENABLE_RV10_DECODER 0 +#define ENABLE_RV20_DECODER 0 +#define ENABLE_SMACKER_DECODER 0 +#define ENABLE_SMC_DECODER 0 +#define ENABLE_SNOW_DECODER 0 +#define ENABLE_SP5X_DECODER 0 +#define ENABLE_SVQ1_DECODER 0 +#define ENABLE_SVQ3_DECODER 0 +#define ENABLE_TARGA_DECODER 0 +#define CONFIG_THEORA_DECODER 1 +#define ENABLE_THEORA_DECODER 1 +#define ENABLE_TIERTEXSEQVIDEO_DECODER 0 +#define ENABLE_TIFF_DECODER 0 +#define ENABLE_TRUEMOTION1_DECODER 0 +#define ENABLE_TRUEMOTION2_DECODER 0 +#define ENABLE_TSCC_DECODER 0 +#define ENABLE_ULTI_DECODER 0 +#define ENABLE_VC1_DECODER 0 +#define ENABLE_VCR1_DECODER 0 +#define ENABLE_VMDVIDEO_DECODER 0 +#define ENABLE_VMNC_DECODER 0 +#define ENABLE_VP3_DECODER 0 +#define ENABLE_VP5_DECODER 0 +#define ENABLE_VP6_DECODER 0 +#define ENABLE_VP6F_DECODER 0 +#define ENABLE_VQA_DECODER 0 +#define ENABLE_WMV1_DECODER 0 +#define ENABLE_WMV2_DECODER 0 +#define ENABLE_WMV3_DECODER 0 +#define ENABLE_WNV1_DECODER 0 +#define ENABLE_XAN_WC3_DECODER 0 +#define ENABLE_XL_DECODER 0 +#define ENABLE_ZLIB_DECODER 0 +#define ENABLE_ZMBV_DECODER 0 +#define ENABLE_AAC_DECODER 0 +#define ENABLE_MPEG4AAC_DECODER 0 +#define ENABLE_ALAC_DECODER 0 +#define ENABLE_AMR_NB_DECODER 0 +#define ENABLE_AMR_WB_DECODER 0 +#define ENABLE_COOK_DECODER 0 +#define ENABLE_DSICINAUDIO_DECODER 0 +#define ENABLE_DTS_DECODER 0 +#define ENABLE_FLAC_DECODER 0 +#define ENABLE_IMC_DECODER 0 +#define ENABLE_LIBA52_DECODER 0 +#define ENABLE_LIBGSM_DECODER 0 +#define ENABLE_LIBGSM_MS_DECODER 0 +#define ENABLE_MACE3_DECODER 0 +#define ENABLE_MACE6_DECODER 0 +#define ENABLE_MP2_DECODER 0 +#define ENABLE_MP3_DECODER 0 +#define ENABLE_MP3ADU_DECODER 0 +#define ENABLE_MP3ON4_DECODER 0 +#define ENABLE_MPC7_DECODER 0 +#define ENABLE_OGGVORBIS_DECODER 0 +#define ENABLE_QDM2_DECODER 0 +#define ENABLE_RA_144_DECODER 0 +#define ENABLE_RA_288_DECODER 0 +#define ENABLE_SHORTEN_DECODER 0 +#define ENABLE_SMACKAUD_DECODER 0 +#define ENABLE_SONIC_DECODER 0 +#define ENABLE_TRUESPEECH_DECODER 0 +#define ENABLE_TTA_DECODER 0 +#define ENABLE_VMDAUDIO_DECODER 0 +#define ENABLE_VORBIS_DECODER 0 +#define ENABLE_WAVPACK_DECODER 0 +#define ENABLE_WMAV1_DECODER 0 +#define ENABLE_WMAV2_DECODER 0 +#define ENABLE_WS_SND1_DECODER 0 +#define ENABLE_PCM_ALAW_DECODER 0 +#define ENABLE_PCM_MULAW_DECODER 0 +#define ENABLE_PCM_S8_DECODER 0 +#define ENABLE_PCM_S16BE_DECODER 0 +#define ENABLE_PCM_S16LE_DECODER 0 +#define ENABLE_PCM_S24BE_DECODER 0 +#define ENABLE_PCM_S24DAUD_DECODER 0 +#define ENABLE_PCM_S24LE_DECODER 0 +#define ENABLE_PCM_S32BE_DECODER 0 +#define ENABLE_PCM_S32LE_DECODER 0 +#define ENABLE_PCM_U8_DECODER 0 +#define ENABLE_PCM_U16BE_DECODER 0 +#define ENABLE_PCM_U16LE_DECODER 0 +#define ENABLE_PCM_U24BE_DECODER 0 +#define ENABLE_PCM_U24LE_DECODER 0 +#define ENABLE_PCM_U32BE_DECODER 0 +#define ENABLE_PCM_U32LE_DECODER 0 +#define ENABLE_INTERPLAY_DPCM_DECODER 0 +#define ENABLE_ROQ_DPCM_DECODER 0 +#define ENABLE_SOL_DPCM_DECODER 0 +#define ENABLE_XAN_DPCM_DECODER 0 +#define ENABLE_ADPCM_4XM_DECODER 0 +#define ENABLE_ADPCM_ADX_DECODER 0 +#define ENABLE_ADPCM_CT_DECODER 0 +#define ENABLE_ADPCM_EA_DECODER 0 +#define ENABLE_ADPCM_G726_DECODER 0 +#define ENABLE_ADPCM_IMA_DK3_DECODER 0 +#define ENABLE_ADPCM_IMA_DK4_DECODER 0 +#define ENABLE_ADPCM_IMA_QT_DECODER 0 +#define ENABLE_ADPCM_IMA_SMJPEG_DECODER 0 +#define ENABLE_ADPCM_IMA_WAV_DECODER 0 +#define ENABLE_ADPCM_IMA_WS_DECODER 0 +#define ENABLE_ADPCM_MS_DECODER 0 +#define ENABLE_ADPCM_SBPRO_2_DECODER 0 +#define ENABLE_ADPCM_SBPRO_3_DECODER 0 +#define ENABLE_ADPCM_SBPRO_4_DECODER 0 +#define ENABLE_ADPCM_SWF_DECODER 0 +#define ENABLE_ADPCM_XA_DECODER 0 +#define ENABLE_ADPCM_YAMAHA_DECODER 0 +#define ENABLE_DVBSUB_DECODER 0 +#define ENABLE_DVDSUB_DECODER 0 +#define ENABLE_ASV1_ENCODER 0 +#define ENABLE_ASV2_ENCODER 0 +#define ENABLE_BMP_ENCODER 0 +#define ENABLE_DVVIDEO_ENCODER 0 +#define ENABLE_FFV1_ENCODER 0 +#define ENABLE_FFVHUFF_ENCODER 0 +#define ENABLE_FLASHSV_ENCODER 0 +#define ENABLE_FLV_ENCODER 0 +#define ENABLE_GIF_ENCODER 0 +#define ENABLE_H261_ENCODER 0 +#define ENABLE_H263_ENCODER 0 +#define ENABLE_H263P_ENCODER 0 +#define ENABLE_HUFFYUV_ENCODER 0 +#define ENABLE_JPEGLS_ENCODER 0 +#define ENABLE_LJPEG_ENCODER 0 +#define ENABLE_MJPEG_ENCODER 0 +#define ENABLE_MPEG1VIDEO_ENCODER 0 +#define ENABLE_MPEG2VIDEO_ENCODER 0 +#define ENABLE_MPEG4_ENCODER 0 +#define ENABLE_MSMPEG4V1_ENCODER 0 +#define ENABLE_MSMPEG4V2_ENCODER 0 +#define ENABLE_MSMPEG4V3_ENCODER 0 +#define ENABLE_PAM_ENCODER 0 +#define ENABLE_PBM_ENCODER 0 +#define ENABLE_PGM_ENCODER 0 +#define ENABLE_PGMYUV_ENCODER 0 +#define ENABLE_PNG_ENCODER 0 +#define ENABLE_PPM_ENCODER 0 +#define ENABLE_RAWVIDEO_ENCODER 0 +#define ENABLE_RV10_ENCODER 0 +#define ENABLE_RV20_ENCODER 0 +#define ENABLE_SNOW_ENCODER 0 +#define ENABLE_SVQ1_ENCODER 0 +#define ENABLE_TARGA_ENCODER 0 +#define ENABLE_WMV1_ENCODER 0 +#define ENABLE_WMV2_ENCODER 0 +#define ENABLE_X264_ENCODER 0 +#define ENABLE_XVID_ENCODER 0 +#define ENABLE_ZLIB_ENCODER 0 +#define ENABLE_ZMBV_ENCODER 0 +#define ENABLE_AC3_ENCODER 0 +#define ENABLE_AMR_NB_ENCODER 0 +#define ENABLE_AMR_WB_ENCODER 0 +#define ENABLE_FAAC_ENCODER 0 +#define ENABLE_FLAC_ENCODER 0 +#define ENABLE_LIBGSM_ENCODER 0 +#define ENABLE_LIBGSM_MS_ENCODER 0 +#define ENABLE_LIBTHEORA_ENCODER 0 +#define ENABLE_MP2_ENCODER 0 +#define ENABLE_MP3LAME_ENCODER 0 +#define ENABLE_OGGVORBIS_ENCODER 0 +#define ENABLE_SONIC_ENCODER 0 +#define ENABLE_SONIC_LS_ENCODER 0 +#define ENABLE_VORBIS_ENCODER 0 +#define ENABLE_WMAV1_ENCODER 0 +#define ENABLE_WMAV2_ENCODER 0 +#define ENABLE_PCM_ALAW_ENCODER 0 +#define ENABLE_PCM_MULAW_ENCODER 0 +#define ENABLE_PCM_S8_ENCODER 0 +#define ENABLE_PCM_S16BE_ENCODER 0 +#define ENABLE_PCM_S16LE_ENCODER 0 +#define ENABLE_PCM_S24BE_ENCODER 0 +#define ENABLE_PCM_S24DAUD_ENCODER 0 +#define ENABLE_PCM_S24LE_ENCODER 0 +#define ENABLE_PCM_S32BE_ENCODER 0 +#define ENABLE_PCM_S32LE_ENCODER 0 +#define ENABLE_PCM_U8_ENCODER 0 +#define ENABLE_PCM_U16BE_ENCODER 0 +#define ENABLE_PCM_U16LE_ENCODER 0 +#define ENABLE_PCM_U24BE_ENCODER 0 +#define ENABLE_PCM_U24LE_ENCODER 0 +#define ENABLE_PCM_U32BE_ENCODER 0 +#define ENABLE_PCM_U32LE_ENCODER 0 +#define ENABLE_ADPCM_4XM_ENCODER 0 +#define ENABLE_ADPCM_ADX_ENCODER 0 +#define ENABLE_ADPCM_CT_ENCODER 0 +#define ENABLE_ADPCM_EA_ENCODER 0 +#define ENABLE_ADPCM_G726_ENCODER 0 +#define ENABLE_ADPCM_IMA_DK3_ENCODER 0 +#define ENABLE_ADPCM_IMA_DK4_ENCODER 0 +#define ENABLE_ADPCM_IMA_QT_ENCODER 0 +#define ENABLE_ADPCM_IMA_SMJPEG_ENCODER 0 +#define ENABLE_ADPCM_IMA_WAV_ENCODER 0 +#define ENABLE_ADPCM_IMA_WS_ENCODER 0 +#define ENABLE_ADPCM_MS_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_2_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_3_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_4_ENCODER 0 +#define ENABLE_ADPCM_SWF_ENCODER 0 +#define ENABLE_ADPCM_XA_ENCODER 0 +#define ENABLE_ADPCM_YAMAHA_ENCODER 0 +#define ENABLE_DVBSUB_ENCODER 0 +#define ENABLE_DVDSUB_ENCODER 0 +#define ENABLE_AAC_PARSER 0 +#define CONFIG_AC3_PARSER 1 +#define ENABLE_AC3_PARSER 1 +#define ENABLE_CAVSVIDEO_PARSER 0 +#define ENABLE_DCA_PARSER 0 +#define ENABLE_DVBSUB_PARSER 0 +#define ENABLE_DVDSUB_PARSER 0 +#define CONFIG_H261_PARSER 1 +#define ENABLE_H261_PARSER 1 +#define CONFIG_H263_PARSER 1 +#define ENABLE_H263_PARSER 1 +#define CONFIG_H264_PARSER 1 +#define ENABLE_H264_PARSER 1 +#define CONFIG_MJPEG_PARSER 1 +#define ENABLE_MJPEG_PARSER 1 +#define CONFIG_MPEG4VIDEO_PARSER 1 +#define ENABLE_MPEG4VIDEO_PARSER 1 +#define CONFIG_MPEGAUDIO_PARSER 1 +#define ENABLE_MPEGAUDIO_PARSER 1 +#define CONFIG_MPEGVIDEO_PARSER 1 +#define ENABLE_MPEGVIDEO_PARSER 1 +#define ENABLE_PNM_PARSER 0 +#define ENABLE_VC1_PARSER 0 +#define CONFIG_AAC_DEMUXER 1 +#define ENABLE_AAC_DEMUXER 1 +#define CONFIG_AC3_DEMUXER 1 +#define ENABLE_AC3_DEMUXER 1 +#define CONFIG_AIFF_DEMUXER 1 +#define ENABLE_AIFF_DEMUXER 1 +#define CONFIG_AMR_DEMUXER 1 +#define ENABLE_AMR_DEMUXER 1 +#define CONFIG_ASF_DEMUXER 1 +#define ENABLE_ASF_DEMUXER 1 +#define CONFIG_AU_DEMUXER 1 +#define ENABLE_AU_DEMUXER 1 +#define ENABLE_AUDIO_DEMUXER 0 +#define CONFIG_AVI_DEMUXER 1 +#define ENABLE_AVI_DEMUXER 1 +#define CONFIG_AVS_DEMUXER 1 +#define ENABLE_AVS_DEMUXER 1 +#define CONFIG_DAUD_DEMUXER 1 +#define ENABLE_DAUD_DEMUXER 1 +#define ENABLE_DC1394_DEMUXER 0 +#define CONFIG_DSICIN_DEMUXER 1 +#define ENABLE_DSICIN_DEMUXER 1 +#define CONFIG_DTS_DEMUXER 1 +#define ENABLE_DTS_DEMUXER 1 +#define CONFIG_DV_DEMUXER 1 +#define ENABLE_DV_DEMUXER 1 +#define ENABLE_DV1394_DEMUXER 0 +#define CONFIG_DXA_DEMUXER 1 +#define ENABLE_DXA_DEMUXER 1 +#define CONFIG_EA_DEMUXER 1 +#define ENABLE_EA_DEMUXER 1 +#define CONFIG_FFM_DEMUXER 1 +#define ENABLE_FFM_DEMUXER 1 +#define CONFIG_FLAC_DEMUXER 1 +#define ENABLE_FLAC_DEMUXER 1 +#define CONFIG_FLIC_DEMUXER 1 +#define ENABLE_FLIC_DEMUXER 1 +#define CONFIG_FLV_DEMUXER 1 +#define ENABLE_FLV_DEMUXER 1 +#define CONFIG_FOURXM_DEMUXER 1 +#define ENABLE_FOURXM_DEMUXER 1 +#define CONFIG_GIF_DEMUXER 1 +#define ENABLE_GIF_DEMUXER 1 +#define CONFIG_GXF_DEMUXER 1 +#define ENABLE_GXF_DEMUXER 1 +#define CONFIG_H261_DEMUXER 1 +#define ENABLE_H261_DEMUXER 1 +#define CONFIG_H263_DEMUXER 1 +#define ENABLE_H263_DEMUXER 1 +#define CONFIG_H264_DEMUXER 1 +#define ENABLE_H264_DEMUXER 1 +#define CONFIG_IDCIN_DEMUXER 1 +#define ENABLE_IDCIN_DEMUXER 1 +#define CONFIG_IMAGE2_DEMUXER 1 +#define ENABLE_IMAGE2_DEMUXER 1 +#define CONFIG_IMAGE2PIPE_DEMUXER 1 +#define ENABLE_IMAGE2PIPE_DEMUXER 1 +#define CONFIG_INGENIENT_DEMUXER 1 +#define ENABLE_INGENIENT_DEMUXER 1 +#define CONFIG_IPMOVIE_DEMUXER 1 +#define ENABLE_IPMOVIE_DEMUXER 1 +#define ENABLE_LIBNUT_DEMUXER 0 +#define CONFIG_M4V_DEMUXER 1 +#define ENABLE_M4V_DEMUXER 1 +#define CONFIG_MATROSKA_DEMUXER 1 +#define ENABLE_MATROSKA_DEMUXER 1 +#define CONFIG_MJPEG_DEMUXER 1 +#define ENABLE_MJPEG_DEMUXER 1 +#define CONFIG_MM_DEMUXER 1 +#define ENABLE_MM_DEMUXER 1 +#define CONFIG_MMF_DEMUXER 1 +#define ENABLE_MMF_DEMUXER 1 +#define CONFIG_MOV_DEMUXER 1 +#define ENABLE_MOV_DEMUXER 1 +#define CONFIG_MP3_DEMUXER 1 +#define ENABLE_MP3_DEMUXER 1 +#define CONFIG_MPC_DEMUXER 1 +#define ENABLE_MPC_DEMUXER 1 +#define CONFIG_MPEGPS_DEMUXER 1 +#define ENABLE_MPEGPS_DEMUXER 1 +#define CONFIG_MPEGTS_DEMUXER 1 +#define ENABLE_MPEGTS_DEMUXER 1 +#define CONFIG_MPEGVIDEO_DEMUXER 1 +#define ENABLE_MPEGVIDEO_DEMUXER 1 +#define CONFIG_MTV_DEMUXER 1 +#define ENABLE_MTV_DEMUXER 1 +#define CONFIG_MXF_DEMUXER 1 +#define ENABLE_MXF_DEMUXER 1 +#define CONFIG_NSV_DEMUXER 1 +#define ENABLE_NSV_DEMUXER 1 +#define CONFIG_NUT_DEMUXER 1 +#define ENABLE_NUT_DEMUXER 1 +#define CONFIG_NUV_DEMUXER 1 +#define ENABLE_NUV_DEMUXER 1 +#define CONFIG_OGG_DEMUXER 1 +#define ENABLE_OGG_DEMUXER 1 +#define CONFIG_PCM_ALAW_DEMUXER 1 +#define ENABLE_PCM_ALAW_DEMUXER 1 +#define CONFIG_PCM_MULAW_DEMUXER 1 +#define ENABLE_PCM_MULAW_DEMUXER 1 +#define CONFIG_PCM_S16BE_DEMUXER 1 +#define ENABLE_PCM_S16BE_DEMUXER 1 +#define CONFIG_PCM_S16LE_DEMUXER 1 +#define ENABLE_PCM_S16LE_DEMUXER 1 +#define CONFIG_PCM_S8_DEMUXER 1 +#define ENABLE_PCM_S8_DEMUXER 1 +#define CONFIG_PCM_U16BE_DEMUXER 1 +#define ENABLE_PCM_U16BE_DEMUXER 1 +#define CONFIG_PCM_U16LE_DEMUXER 1 +#define ENABLE_PCM_U16LE_DEMUXER 1 +#define CONFIG_PCM_U8_DEMUXER 1 +#define ENABLE_PCM_U8_DEMUXER 1 +#define CONFIG_RAWVIDEO_DEMUXER 1 +#define ENABLE_RAWVIDEO_DEMUXER 1 +#define CONFIG_RM_DEMUXER 1 +#define ENABLE_RM_DEMUXER 1 +#define CONFIG_ROQ_DEMUXER 1 +#define ENABLE_ROQ_DEMUXER 1 +#define ENABLE_REDIR_DEMUXER 0 +#define ENABLE_RTSP_DEMUXER 0 +#define ENABLE_SDP_DEMUXER 0 +#define CONFIG_SEGAFILM_DEMUXER 1 +#define ENABLE_SEGAFILM_DEMUXER 1 +#define CONFIG_SHORTEN_DEMUXER 1 +#define ENABLE_SHORTEN_DEMUXER 1 +#define CONFIG_SMACKER_DEMUXER 1 +#define ENABLE_SMACKER_DEMUXER 1 +#define CONFIG_SOL_DEMUXER 1 +#define ENABLE_SOL_DEMUXER 1 +#define CONFIG_STR_DEMUXER 1 +#define ENABLE_STR_DEMUXER 1 +#define CONFIG_SWF_DEMUXER 1 +#define ENABLE_SWF_DEMUXER 1 +#define CONFIG_TIERTEXSEQ_DEMUXER 1 +#define ENABLE_TIERTEXSEQ_DEMUXER 1 +#define CONFIG_TTA_DEMUXER 1 +#define ENABLE_TTA_DEMUXER 1 +#define ENABLE_V4L2_DEMUXER 0 +#define CONFIG_VC1_DEMUXER 1 +#define ENABLE_VC1_DEMUXER 1 +#define ENABLE_VIDEO_GRAB_DEVICE_DEMUXER 0 +#define CONFIG_VMD_DEMUXER 1 +#define ENABLE_VMD_DEMUXER 1 +#define CONFIG_VOC_DEMUXER 1 +#define ENABLE_VOC_DEMUXER 1 +#define CONFIG_WAV_DEMUXER 1 +#define ENABLE_WAV_DEMUXER 1 +#define CONFIG_WC3_DEMUXER 1 +#define ENABLE_WC3_DEMUXER 1 +#define CONFIG_WSAUD_DEMUXER 1 +#define ENABLE_WSAUD_DEMUXER 1 +#define CONFIG_WSVQA_DEMUXER 1 +#define ENABLE_WSVQA_DEMUXER 1 +#define CONFIG_WV_DEMUXER 1 +#define ENABLE_WV_DEMUXER 1 +#define ENABLE_X11_GRAB_DEVICE_DEMUXER 0 +#define CONFIG_YUV4MPEGPIPE_DEMUXER 1 +#define ENABLE_YUV4MPEGPIPE_DEMUXER 1 +#define ENABLE_AC3_MUXER 0 +#define ENABLE_ADTS_MUXER 0 +#define ENABLE_AIFF_MUXER 0 +#define ENABLE_AMR_MUXER 0 +#define ENABLE_ASF_MUXER 0 +#define ENABLE_ASF_STREAM_MUXER 0 +#define ENABLE_AU_MUXER 0 +#define ENABLE_AUDIO_MUXER 0 +#define ENABLE_AVI_MUXER 0 +#define ENABLE_CRC_MUXER 0 +#define ENABLE_DV_MUXER 0 +#define ENABLE_FFM_MUXER 0 +#define ENABLE_FLAC_MUXER 0 +#define ENABLE_FLV_MUXER 0 +#define ENABLE_FRAMECRC_MUXER 0 +#define ENABLE_GIF_MUXER 0 +#define ENABLE_GXF_MUXER 0 +#define ENABLE_H261_MUXER 0 +#define ENABLE_H263_MUXER 0 +#define ENABLE_H264_MUXER 0 +#define ENABLE_IMAGE2_MUXER 0 +#define ENABLE_IMAGE2PIPE_MUXER 0 +#define ENABLE_LIBNUT_MUXER 0 +#define ENABLE_M4V_MUXER 0 +#define ENABLE_MJPEG_MUXER 0 +#define ENABLE_MMF_MUXER 0 +#define ENABLE_MOV_MUXER 0 +#define ENABLE_MP2_MUXER 0 +#define ENABLE_MP3_MUXER 0 +#define ENABLE_MP4_MUXER 0 +#define ENABLE_MPEG1SYSTEM_MUXER 0 +#define ENABLE_MPEG1VCD_MUXER 0 +#define ENABLE_MPEG1VIDEO_MUXER 0 +#define ENABLE_MPEG2DVD_MUXER 0 +#define ENABLE_MPEG2SVCD_MUXER 0 +#define ENABLE_MPEG2VIDEO_MUXER 0 +#define ENABLE_MPEG2VOB_MUXER 0 +#define ENABLE_MPEGTS_MUXER 0 +#define ENABLE_MPJPEG_MUXER 0 +#define ENABLE_NULL_MUXER 0 +#define ENABLE_OGG_MUXER 0 +#define ENABLE_PCM_ALAW_MUXER 0 +#define ENABLE_PCM_MULAW_MUXER 0 +#define ENABLE_PCM_S16BE_MUXER 0 +#define ENABLE_PCM_S16LE_MUXER 0 +#define ENABLE_PCM_S8_MUXER 0 +#define ENABLE_PCM_U16BE_MUXER 0 +#define ENABLE_PCM_U16LE_MUXER 0 +#define ENABLE_PCM_U8_MUXER 0 +#define ENABLE_PSP_MUXER 0 +#define ENABLE_RAWVIDEO_MUXER 0 +#define ENABLE_RM_MUXER 0 +#define ENABLE_RTP_MUXER 0 +#define ENABLE_SWF_MUXER 0 +#define ENABLE_TG2_MUXER 0 +#define ENABLE_TGP_MUXER 0 +#define ENABLE_VOC_MUXER 0 +#define ENABLE_WAV_MUXER 0 +#define ENABLE_YUV4MPEGPIPE_MUXER 0 +#elif defined(__i386__) +/* Automatically generated by configure - do not modify! */ +#define FFMPEG_CONFIGURATION "--disable-shared --enable-static --disable-debug --disable-vhook --enable-memalign-hack --disable-network --enable-small --disable-encoders --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-muxers --enable-demuxer=avi --enable-demuxer=h261 --enable-demuxer=h263 --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mpegps --enable-demuxer=mpegts --enable-demuxer=mpegvideo --enable-demuxer=ogg --enable-demuxer=rawvideo --enable-demuxer=yuv4mpegpipe --disable-decoders --enable-decoder=h261 --enable-decoder=h263 --enable-decoder=h263i --enable-decoder=h264 --enable-decoder=huffyuv --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-decoder=mpeg_xvmc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=mpegvideo --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=rawvideo --enable-decoder=theora --disable-parsers --enable-parser=h261 --enable-parser=h263 --enable-parser=h264 --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=ac3" +#define ARCH_X86_32 1 +#define ARCH_X86 1 +#define __CPU__ 586 +#define HAVE_DLFCN_H 1 +#define HAVE_DLOPEN 1 +#define HAVE_FREETYPE2 1 +#define HAVE_INET_ATON 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_LRINTF 1 +#define HAVE_MMX 1 +#define CONFIG_DECODERS 1 +#define CONFIG_DEMUXERS 1 +#define CONFIG_MEMALIGN_HACK 1 +#define CONFIG_MPEGAUDIO_HP 1 +#define CONFIG_PROTOCOLS 1 +#define CONFIG_ZLIB 1 +#define TARGET_MMX 1 +#define CONFIG_DARWIN 1 +#define restrict __restrict__ +#define always_inline +#define CONFIG_SMALL 1 +#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" +#define ENABLE_AASC_DECODER 0 +#define ENABLE_ASV1_DECODER 0 +#define ENABLE_ASV2_DECODER 0 +#define ENABLE_AVS_DECODER 0 +#define ENABLE_BMP_DECODER 0 +#define ENABLE_CAVS_DECODER 0 +#define ENABLE_CINEPAK_DECODER 0 +#define ENABLE_CLJR_DECODER 0 +#define ENABLE_CSCD_DECODER 0 +#define ENABLE_CYUV_DECODER 0 +#define ENABLE_DCA_DECODER 0 +#define ENABLE_DNXHD_DECODER 0 +#define ENABLE_DSICINVIDEO_DECODER 0 +#define ENABLE_DVVIDEO_DECODER 0 +#define ENABLE_DXA_DECODER 0 +#define ENABLE_EIGHTBPS_DECODER 0 +#define ENABLE_FFV1_DECODER 0 +#define ENABLE_FFVHUFF_DECODER 0 +#define ENABLE_FLASHSV_DECODER 0 +#define ENABLE_FLIC_DECODER 0 +#define ENABLE_FLV_DECODER 0 +#define ENABLE_FOURXM_DECODER 0 +#define ENABLE_FRAPS_DECODER 0 +#define ENABLE_GIF_DECODER 0 +#define CONFIG_H261_DECODER 1 +#define ENABLE_H261_DECODER 1 +#define CONFIG_H263_DECODER 1 +#define ENABLE_H263_DECODER 1 +#define CONFIG_H263I_DECODER 1 +#define ENABLE_H263I_DECODER 1 +#define CONFIG_H264_DECODER 1 +#define ENABLE_H264_DECODER 1 +#define CONFIG_HUFFYUV_DECODER 1 +#define ENABLE_HUFFYUV_DECODER 1 +#define ENABLE_IDCIN_DECODER 0 +#define ENABLE_INDEO2_DECODER 0 +#define ENABLE_INDEO3_DECODER 0 +#define ENABLE_INTERPLAY_VIDEO_DECODER 0 +#define ENABLE_KMVC_DECODER 0 +#define ENABLE_LOCO_DECODER 0 +#define ENABLE_MDEC_DECODER 0 +#define CONFIG_MJPEG_DECODER 1 +#define ENABLE_MJPEG_DECODER 1 +#define CONFIG_MJPEGB_DECODER 1 +#define ENABLE_MJPEGB_DECODER 1 +#define ENABLE_MMVIDEO_DECODER 0 +#define ENABLE_MPEG_XVMC_DECODER 0 +#define CONFIG_MPEG1VIDEO_DECODER 1 +#define ENABLE_MPEG1VIDEO_DECODER 1 +#define CONFIG_MPEG2VIDEO_DECODER 1 +#define ENABLE_MPEG2VIDEO_DECODER 1 +#define CONFIG_MPEG4_DECODER 1 +#define ENABLE_MPEG4_DECODER 1 +#define CONFIG_MPEGVIDEO_DECODER 1 +#define ENABLE_MPEGVIDEO_DECODER 1 +#define CONFIG_MSMPEG4V1_DECODER 1 +#define ENABLE_MSMPEG4V1_DECODER 1 +#define CONFIG_MSMPEG4V2_DECODER 1 +#define ENABLE_MSMPEG4V2_DECODER 1 +#define CONFIG_MSMPEG4V3_DECODER 1 +#define ENABLE_MSMPEG4V3_DECODER 1 +#define ENABLE_MSRLE_DECODER 0 +#define ENABLE_MSVIDEO1_DECODER 0 +#define ENABLE_MSZH_DECODER 0 +#define ENABLE_NUV_DECODER 0 +#define ENABLE_PNG_DECODER 0 +#define ENABLE_QDRAW_DECODER 0 +#define ENABLE_QPEG_DECODER 0 +#define ENABLE_QTRLE_DECODER 0 +#define CONFIG_RAWVIDEO_DECODER 1 +#define ENABLE_RAWVIDEO_DECODER 1 +#define ENABLE_ROQ_DECODER 0 +#define ENABLE_RPZA_DECODER 0 +#define ENABLE_RV10_DECODER 0 +#define ENABLE_RV20_DECODER 0 +#define ENABLE_SMACKER_DECODER 0 +#define ENABLE_SMC_DECODER 0 +#define ENABLE_SNOW_DECODER 0 +#define ENABLE_SP5X_DECODER 0 +#define ENABLE_SVQ1_DECODER 0 +#define ENABLE_SVQ3_DECODER 0 +#define ENABLE_TARGA_DECODER 0 +#define CONFIG_THEORA_DECODER 1 +#define ENABLE_THEORA_DECODER 1 +#define ENABLE_TIERTEXSEQVIDEO_DECODER 0 +#define ENABLE_TIFF_DECODER 0 +#define ENABLE_TRUEMOTION1_DECODER 0 +#define ENABLE_TRUEMOTION2_DECODER 0 +#define ENABLE_TSCC_DECODER 0 +#define ENABLE_ULTI_DECODER 0 +#define ENABLE_VC1_DECODER 0 +#define ENABLE_VCR1_DECODER 0 +#define ENABLE_VMDVIDEO_DECODER 0 +#define ENABLE_VMNC_DECODER 0 +#define ENABLE_VP3_DECODER 0 +#define ENABLE_VP5_DECODER 0 +#define ENABLE_VP6_DECODER 0 +#define ENABLE_VP6F_DECODER 0 +#define ENABLE_VQA_DECODER 0 +#define ENABLE_WMV1_DECODER 0 +#define ENABLE_WMV2_DECODER 0 +#define ENABLE_WMV3_DECODER 0 +#define ENABLE_WNV1_DECODER 0 +#define ENABLE_XAN_WC3_DECODER 0 +#define ENABLE_XL_DECODER 0 +#define ENABLE_ZLIB_DECODER 0 +#define ENABLE_ZMBV_DECODER 0 +#define ENABLE_AAC_DECODER 0 +#define ENABLE_MPEG4AAC_DECODER 0 +#define ENABLE_ALAC_DECODER 0 +#define ENABLE_AMR_NB_DECODER 0 +#define ENABLE_AMR_WB_DECODER 0 +#define ENABLE_COOK_DECODER 0 +#define ENABLE_DSICINAUDIO_DECODER 0 +#define ENABLE_DTS_DECODER 0 +#define ENABLE_FLAC_DECODER 0 +#define ENABLE_IMC_DECODER 0 +#define ENABLE_LIBA52_DECODER 0 +#define ENABLE_LIBGSM_DECODER 0 +#define ENABLE_LIBGSM_MS_DECODER 0 +#define ENABLE_MACE3_DECODER 0 +#define ENABLE_MACE6_DECODER 0 +#define ENABLE_MP2_DECODER 0 +#define ENABLE_MP3_DECODER 0 +#define ENABLE_MP3ADU_DECODER 0 +#define ENABLE_MP3ON4_DECODER 0 +#define ENABLE_MPC7_DECODER 0 +#define ENABLE_OGGVORBIS_DECODER 0 +#define ENABLE_QDM2_DECODER 0 +#define ENABLE_RA_144_DECODER 0 +#define ENABLE_RA_288_DECODER 0 +#define ENABLE_SHORTEN_DECODER 0 +#define ENABLE_SMACKAUD_DECODER 0 +#define ENABLE_SONIC_DECODER 0 +#define ENABLE_TRUESPEECH_DECODER 0 +#define ENABLE_TTA_DECODER 0 +#define ENABLE_VMDAUDIO_DECODER 0 +#define ENABLE_VORBIS_DECODER 0 +#define ENABLE_WAVPACK_DECODER 0 +#define ENABLE_WMAV1_DECODER 0 +#define ENABLE_WMAV2_DECODER 0 +#define ENABLE_WS_SND1_DECODER 0 +#define ENABLE_PCM_ALAW_DECODER 0 +#define ENABLE_PCM_MULAW_DECODER 0 +#define ENABLE_PCM_S8_DECODER 0 +#define ENABLE_PCM_S16BE_DECODER 0 +#define ENABLE_PCM_S16LE_DECODER 0 +#define ENABLE_PCM_S24BE_DECODER 0 +#define ENABLE_PCM_S24DAUD_DECODER 0 +#define ENABLE_PCM_S24LE_DECODER 0 +#define ENABLE_PCM_S32BE_DECODER 0 +#define ENABLE_PCM_S32LE_DECODER 0 +#define ENABLE_PCM_U8_DECODER 0 +#define ENABLE_PCM_U16BE_DECODER 0 +#define ENABLE_PCM_U16LE_DECODER 0 +#define ENABLE_PCM_U24BE_DECODER 0 +#define ENABLE_PCM_U24LE_DECODER 0 +#define ENABLE_PCM_U32BE_DECODER 0 +#define ENABLE_PCM_U32LE_DECODER 0 +#define ENABLE_INTERPLAY_DPCM_DECODER 0 +#define ENABLE_ROQ_DPCM_DECODER 0 +#define ENABLE_SOL_DPCM_DECODER 0 +#define ENABLE_XAN_DPCM_DECODER 0 +#define ENABLE_ADPCM_4XM_DECODER 0 +#define ENABLE_ADPCM_ADX_DECODER 0 +#define ENABLE_ADPCM_CT_DECODER 0 +#define ENABLE_ADPCM_EA_DECODER 0 +#define ENABLE_ADPCM_G726_DECODER 0 +#define ENABLE_ADPCM_IMA_DK3_DECODER 0 +#define ENABLE_ADPCM_IMA_DK4_DECODER 0 +#define ENABLE_ADPCM_IMA_QT_DECODER 0 +#define ENABLE_ADPCM_IMA_SMJPEG_DECODER 0 +#define ENABLE_ADPCM_IMA_WAV_DECODER 0 +#define ENABLE_ADPCM_IMA_WS_DECODER 0 +#define ENABLE_ADPCM_MS_DECODER 0 +#define ENABLE_ADPCM_SBPRO_2_DECODER 0 +#define ENABLE_ADPCM_SBPRO_3_DECODER 0 +#define ENABLE_ADPCM_SBPRO_4_DECODER 0 +#define ENABLE_ADPCM_SWF_DECODER 0 +#define ENABLE_ADPCM_XA_DECODER 0 +#define ENABLE_ADPCM_YAMAHA_DECODER 0 +#define ENABLE_DVBSUB_DECODER 0 +#define ENABLE_DVDSUB_DECODER 0 +#define ENABLE_ASV1_ENCODER 0 +#define ENABLE_ASV2_ENCODER 0 +#define ENABLE_BMP_ENCODER 0 +#define ENABLE_DVVIDEO_ENCODER 0 +#define ENABLE_FFV1_ENCODER 0 +#define ENABLE_FFVHUFF_ENCODER 0 +#define ENABLE_FLASHSV_ENCODER 0 +#define ENABLE_FLV_ENCODER 0 +#define ENABLE_GIF_ENCODER 0 +#define ENABLE_H261_ENCODER 0 +#define ENABLE_H263_ENCODER 0 +#define ENABLE_H263P_ENCODER 0 +#define ENABLE_HUFFYUV_ENCODER 0 +#define ENABLE_JPEGLS_ENCODER 0 +#define ENABLE_LJPEG_ENCODER 0 +#define ENABLE_MJPEG_ENCODER 0 +#define ENABLE_MPEG1VIDEO_ENCODER 0 +#define ENABLE_MPEG2VIDEO_ENCODER 0 +#define ENABLE_MPEG4_ENCODER 0 +#define ENABLE_MSMPEG4V1_ENCODER 0 +#define ENABLE_MSMPEG4V2_ENCODER 0 +#define ENABLE_MSMPEG4V3_ENCODER 0 +#define ENABLE_PAM_ENCODER 0 +#define ENABLE_PBM_ENCODER 0 +#define ENABLE_PGM_ENCODER 0 +#define ENABLE_PGMYUV_ENCODER 0 +#define ENABLE_PNG_ENCODER 0 +#define ENABLE_PPM_ENCODER 0 +#define ENABLE_RAWVIDEO_ENCODER 0 +#define ENABLE_RV10_ENCODER 0 +#define ENABLE_RV20_ENCODER 0 +#define ENABLE_SNOW_ENCODER 0 +#define ENABLE_SVQ1_ENCODER 0 +#define ENABLE_TARGA_ENCODER 0 +#define ENABLE_WMV1_ENCODER 0 +#define ENABLE_WMV2_ENCODER 0 +#define ENABLE_X264_ENCODER 0 +#define ENABLE_XVID_ENCODER 0 +#define ENABLE_ZLIB_ENCODER 0 +#define ENABLE_ZMBV_ENCODER 0 +#define ENABLE_AC3_ENCODER 0 +#define ENABLE_AMR_NB_ENCODER 0 +#define ENABLE_AMR_WB_ENCODER 0 +#define ENABLE_FAAC_ENCODER 0 +#define ENABLE_FLAC_ENCODER 0 +#define ENABLE_LIBGSM_ENCODER 0 +#define ENABLE_LIBGSM_MS_ENCODER 0 +#define ENABLE_LIBTHEORA_ENCODER 0 +#define ENABLE_MP2_ENCODER 0 +#define ENABLE_MP3LAME_ENCODER 0 +#define ENABLE_OGGVORBIS_ENCODER 0 +#define ENABLE_SONIC_ENCODER 0 +#define ENABLE_SONIC_LS_ENCODER 0 +#define ENABLE_VORBIS_ENCODER 0 +#define ENABLE_WMAV1_ENCODER 0 +#define ENABLE_WMAV2_ENCODER 0 +#define ENABLE_PCM_ALAW_ENCODER 0 +#define ENABLE_PCM_MULAW_ENCODER 0 +#define ENABLE_PCM_S8_ENCODER 0 +#define ENABLE_PCM_S16BE_ENCODER 0 +#define ENABLE_PCM_S16LE_ENCODER 0 +#define ENABLE_PCM_S24BE_ENCODER 0 +#define ENABLE_PCM_S24DAUD_ENCODER 0 +#define ENABLE_PCM_S24LE_ENCODER 0 +#define ENABLE_PCM_S32BE_ENCODER 0 +#define ENABLE_PCM_S32LE_ENCODER 0 +#define ENABLE_PCM_U8_ENCODER 0 +#define ENABLE_PCM_U16BE_ENCODER 0 +#define ENABLE_PCM_U16LE_ENCODER 0 +#define ENABLE_PCM_U24BE_ENCODER 0 +#define ENABLE_PCM_U24LE_ENCODER 0 +#define ENABLE_PCM_U32BE_ENCODER 0 +#define ENABLE_PCM_U32LE_ENCODER 0 +#define ENABLE_ADPCM_4XM_ENCODER 0 +#define ENABLE_ADPCM_ADX_ENCODER 0 +#define ENABLE_ADPCM_CT_ENCODER 0 +#define ENABLE_ADPCM_EA_ENCODER 0 +#define ENABLE_ADPCM_G726_ENCODER 0 +#define ENABLE_ADPCM_IMA_DK3_ENCODER 0 +#define ENABLE_ADPCM_IMA_DK4_ENCODER 0 +#define ENABLE_ADPCM_IMA_QT_ENCODER 0 +#define ENABLE_ADPCM_IMA_SMJPEG_ENCODER 0 +#define ENABLE_ADPCM_IMA_WAV_ENCODER 0 +#define ENABLE_ADPCM_IMA_WS_ENCODER 0 +#define ENABLE_ADPCM_MS_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_2_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_3_ENCODER 0 +#define ENABLE_ADPCM_SBPRO_4_ENCODER 0 +#define ENABLE_ADPCM_SWF_ENCODER 0 +#define ENABLE_ADPCM_XA_ENCODER 0 +#define ENABLE_ADPCM_YAMAHA_ENCODER 0 +#define ENABLE_DVBSUB_ENCODER 0 +#define ENABLE_DVDSUB_ENCODER 0 +#define ENABLE_AAC_PARSER 0 +#define CONFIG_AC3_PARSER 1 +#define ENABLE_AC3_PARSER 1 +#define ENABLE_CAVSVIDEO_PARSER 0 +#define ENABLE_DCA_PARSER 0 +#define ENABLE_DVBSUB_PARSER 0 +#define ENABLE_DVDSUB_PARSER 0 +#define CONFIG_H261_PARSER 1 +#define ENABLE_H261_PARSER 1 +#define CONFIG_H263_PARSER 1 +#define ENABLE_H263_PARSER 1 +#define CONFIG_H264_PARSER 1 +#define ENABLE_H264_PARSER 1 +#define CONFIG_MJPEG_PARSER 1 +#define ENABLE_MJPEG_PARSER 1 +#define CONFIG_MPEG4VIDEO_PARSER 1 +#define ENABLE_MPEG4VIDEO_PARSER 1 +#define CONFIG_MPEGAUDIO_PARSER 1 +#define ENABLE_MPEGAUDIO_PARSER 1 +#define CONFIG_MPEGVIDEO_PARSER 1 +#define ENABLE_MPEGVIDEO_PARSER 1 +#define ENABLE_PNM_PARSER 0 +#define ENABLE_VC1_PARSER 0 +#define CONFIG_AAC_DEMUXER 1 +#define ENABLE_AAC_DEMUXER 1 +#define CONFIG_AC3_DEMUXER 1 +#define ENABLE_AC3_DEMUXER 1 +#define CONFIG_AIFF_DEMUXER 1 +#define ENABLE_AIFF_DEMUXER 1 +#define CONFIG_AMR_DEMUXER 1 +#define ENABLE_AMR_DEMUXER 1 +#define CONFIG_ASF_DEMUXER 1 +#define ENABLE_ASF_DEMUXER 1 +#define CONFIG_AU_DEMUXER 1 +#define ENABLE_AU_DEMUXER 1 +#define ENABLE_AUDIO_DEMUXER 0 +#define CONFIG_AVI_DEMUXER 1 +#define ENABLE_AVI_DEMUXER 1 +#define CONFIG_AVS_DEMUXER 1 +#define ENABLE_AVS_DEMUXER 1 +#define CONFIG_DAUD_DEMUXER 1 +#define ENABLE_DAUD_DEMUXER 1 +#define ENABLE_DC1394_DEMUXER 0 +#define CONFIG_DSICIN_DEMUXER 1 +#define ENABLE_DSICIN_DEMUXER 1 +#define CONFIG_DTS_DEMUXER 1 +#define ENABLE_DTS_DEMUXER 1 +#define CONFIG_DV_DEMUXER 1 +#define ENABLE_DV_DEMUXER 1 +#define ENABLE_DV1394_DEMUXER 0 +#define CONFIG_DXA_DEMUXER 1 +#define ENABLE_DXA_DEMUXER 1 +#define CONFIG_EA_DEMUXER 1 +#define ENABLE_EA_DEMUXER 1 +#define CONFIG_FFM_DEMUXER 1 +#define ENABLE_FFM_DEMUXER 1 +#define CONFIG_FLAC_DEMUXER 1 +#define ENABLE_FLAC_DEMUXER 1 +#define CONFIG_FLIC_DEMUXER 1 +#define ENABLE_FLIC_DEMUXER 1 +#define CONFIG_FLV_DEMUXER 1 +#define ENABLE_FLV_DEMUXER 1 +#define CONFIG_FOURXM_DEMUXER 1 +#define ENABLE_FOURXM_DEMUXER 1 +#define CONFIG_GIF_DEMUXER 1 +#define ENABLE_GIF_DEMUXER 1 +#define CONFIG_GXF_DEMUXER 1 +#define ENABLE_GXF_DEMUXER 1 +#define CONFIG_H261_DEMUXER 1 +#define ENABLE_H261_DEMUXER 1 +#define CONFIG_H263_DEMUXER 1 +#define ENABLE_H263_DEMUXER 1 +#define CONFIG_H264_DEMUXER 1 +#define ENABLE_H264_DEMUXER 1 +#define CONFIG_IDCIN_DEMUXER 1 +#define ENABLE_IDCIN_DEMUXER 1 +#define CONFIG_IMAGE2_DEMUXER 1 +#define ENABLE_IMAGE2_DEMUXER 1 +#define CONFIG_IMAGE2PIPE_DEMUXER 1 +#define ENABLE_IMAGE2PIPE_DEMUXER 1 +#define CONFIG_INGENIENT_DEMUXER 1 +#define ENABLE_INGENIENT_DEMUXER 1 +#define CONFIG_IPMOVIE_DEMUXER 1 +#define ENABLE_IPMOVIE_DEMUXER 1 +#define ENABLE_LIBNUT_DEMUXER 0 +#define CONFIG_M4V_DEMUXER 1 +#define ENABLE_M4V_DEMUXER 1 +#define CONFIG_MATROSKA_DEMUXER 1 +#define ENABLE_MATROSKA_DEMUXER 1 +#define CONFIG_MJPEG_DEMUXER 1 +#define ENABLE_MJPEG_DEMUXER 1 +#define CONFIG_MM_DEMUXER 1 +#define ENABLE_MM_DEMUXER 1 +#define CONFIG_MMF_DEMUXER 1 +#define ENABLE_MMF_DEMUXER 1 +#define CONFIG_MOV_DEMUXER 1 +#define ENABLE_MOV_DEMUXER 1 +#define CONFIG_MP3_DEMUXER 1 +#define ENABLE_MP3_DEMUXER 1 +#define CONFIG_MPC_DEMUXER 1 +#define ENABLE_MPC_DEMUXER 1 +#define CONFIG_MPEGPS_DEMUXER 1 +#define ENABLE_MPEGPS_DEMUXER 1 +#define CONFIG_MPEGTS_DEMUXER 1 +#define ENABLE_MPEGTS_DEMUXER 1 +#define CONFIG_MPEGVIDEO_DEMUXER 1 +#define ENABLE_MPEGVIDEO_DEMUXER 1 +#define CONFIG_MTV_DEMUXER 1 +#define ENABLE_MTV_DEMUXER 1 +#define CONFIG_MXF_DEMUXER 1 +#define ENABLE_MXF_DEMUXER 1 +#define CONFIG_NSV_DEMUXER 1 +#define ENABLE_NSV_DEMUXER 1 +#define CONFIG_NUT_DEMUXER 1 +#define ENABLE_NUT_DEMUXER 1 +#define CONFIG_NUV_DEMUXER 1 +#define ENABLE_NUV_DEMUXER 1 +#define CONFIG_OGG_DEMUXER 1 +#define ENABLE_OGG_DEMUXER 1 +#define CONFIG_PCM_ALAW_DEMUXER 1 +#define ENABLE_PCM_ALAW_DEMUXER 1 +#define CONFIG_PCM_MULAW_DEMUXER 1 +#define ENABLE_PCM_MULAW_DEMUXER 1 +#define CONFIG_PCM_S16BE_DEMUXER 1 +#define ENABLE_PCM_S16BE_DEMUXER 1 +#define CONFIG_PCM_S16LE_DEMUXER 1 +#define ENABLE_PCM_S16LE_DEMUXER 1 +#define CONFIG_PCM_S8_DEMUXER 1 +#define ENABLE_PCM_S8_DEMUXER 1 +#define CONFIG_PCM_U16BE_DEMUXER 1 +#define ENABLE_PCM_U16BE_DEMUXER 1 +#define CONFIG_PCM_U16LE_DEMUXER 1 +#define ENABLE_PCM_U16LE_DEMUXER 1 +#define CONFIG_PCM_U8_DEMUXER 1 +#define ENABLE_PCM_U8_DEMUXER 1 +#define CONFIG_RAWVIDEO_DEMUXER 1 +#define ENABLE_RAWVIDEO_DEMUXER 1 +#define CONFIG_RM_DEMUXER 1 +#define ENABLE_RM_DEMUXER 1 +#define CONFIG_ROQ_DEMUXER 1 +#define ENABLE_ROQ_DEMUXER 1 +#define ENABLE_REDIR_DEMUXER 0 +#define ENABLE_RTSP_DEMUXER 0 +#define ENABLE_SDP_DEMUXER 0 +#define CONFIG_SEGAFILM_DEMUXER 1 +#define ENABLE_SEGAFILM_DEMUXER 1 +#define CONFIG_SHORTEN_DEMUXER 1 +#define ENABLE_SHORTEN_DEMUXER 1 +#define CONFIG_SMACKER_DEMUXER 1 +#define ENABLE_SMACKER_DEMUXER 1 +#define CONFIG_SOL_DEMUXER 1 +#define ENABLE_SOL_DEMUXER 1 +#define CONFIG_STR_DEMUXER 1 +#define ENABLE_STR_DEMUXER 1 +#define CONFIG_SWF_DEMUXER 1 +#define ENABLE_SWF_DEMUXER 1 +#define CONFIG_TIERTEXSEQ_DEMUXER 1 +#define ENABLE_TIERTEXSEQ_DEMUXER 1 +#define CONFIG_TTA_DEMUXER 1 +#define ENABLE_TTA_DEMUXER 1 +#define ENABLE_V4L2_DEMUXER 0 +#define CONFIG_VC1_DEMUXER 1 +#define ENABLE_VC1_DEMUXER 1 +#define ENABLE_VIDEO_GRAB_DEVICE_DEMUXER 0 +#define CONFIG_VMD_DEMUXER 1 +#define ENABLE_VMD_DEMUXER 1 +#define CONFIG_VOC_DEMUXER 1 +#define ENABLE_VOC_DEMUXER 1 +#define CONFIG_WAV_DEMUXER 1 +#define ENABLE_WAV_DEMUXER 1 +#define CONFIG_WC3_DEMUXER 1 +#define ENABLE_WC3_DEMUXER 1 +#define CONFIG_WSAUD_DEMUXER 1 +#define ENABLE_WSAUD_DEMUXER 1 +#define CONFIG_WSVQA_DEMUXER 1 +#define ENABLE_WSVQA_DEMUXER 1 +#define CONFIG_WV_DEMUXER 1 +#define ENABLE_WV_DEMUXER 1 +#define ENABLE_X11_GRAB_DEVICE_DEMUXER 0 +#define CONFIG_YUV4MPEGPIPE_DEMUXER 1 +#define ENABLE_YUV4MPEGPIPE_DEMUXER 1 +#define ENABLE_AC3_MUXER 0 +#define ENABLE_ADTS_MUXER 0 +#define ENABLE_AIFF_MUXER 0 +#define ENABLE_AMR_MUXER 0 +#define ENABLE_ASF_MUXER 0 +#define ENABLE_ASF_STREAM_MUXER 0 +#define ENABLE_AU_MUXER 0 +#define ENABLE_AUDIO_MUXER 0 +#define ENABLE_AVI_MUXER 0 +#define ENABLE_CRC_MUXER 0 +#define ENABLE_DV_MUXER 0 +#define ENABLE_FFM_MUXER 0 +#define ENABLE_FLAC_MUXER 0 +#define ENABLE_FLV_MUXER 0 +#define ENABLE_FRAMECRC_MUXER 0 +#define ENABLE_GIF_MUXER 0 +#define ENABLE_GXF_MUXER 0 +#define ENABLE_H261_MUXER 0 +#define ENABLE_H263_MUXER 0 +#define ENABLE_H264_MUXER 0 +#define ENABLE_IMAGE2_MUXER 0 +#define ENABLE_IMAGE2PIPE_MUXER 0 +#define ENABLE_LIBNUT_MUXER 0 +#define ENABLE_M4V_MUXER 0 +#define ENABLE_MJPEG_MUXER 0 +#define ENABLE_MMF_MUXER 0 +#define ENABLE_MOV_MUXER 0 +#define ENABLE_MP2_MUXER 0 +#define ENABLE_MP3_MUXER 0 +#define ENABLE_MP4_MUXER 0 +#define ENABLE_MPEG1SYSTEM_MUXER 0 +#define ENABLE_MPEG1VCD_MUXER 0 +#define ENABLE_MPEG1VIDEO_MUXER 0 +#define ENABLE_MPEG2DVD_MUXER 0 +#define ENABLE_MPEG2SVCD_MUXER 0 +#define ENABLE_MPEG2VIDEO_MUXER 0 +#define ENABLE_MPEG2VOB_MUXER 0 +#define ENABLE_MPEGTS_MUXER 0 +#define ENABLE_MPJPEG_MUXER 0 +#define ENABLE_NULL_MUXER 0 +#define ENABLE_OGG_MUXER 0 +#define ENABLE_PCM_ALAW_MUXER 0 +#define ENABLE_PCM_MULAW_MUXER 0 +#define ENABLE_PCM_S16BE_MUXER 0 +#define ENABLE_PCM_S16LE_MUXER 0 +#define ENABLE_PCM_S8_MUXER 0 +#define ENABLE_PCM_U16BE_MUXER 0 +#define ENABLE_PCM_U16LE_MUXER 0 +#define ENABLE_PCM_U8_MUXER 0 +#define ENABLE_PSP_MUXER 0 +#define ENABLE_RAWVIDEO_MUXER 0 +#define ENABLE_RM_MUXER 0 +#define ENABLE_RTP_MUXER 0 +#define ENABLE_SWF_MUXER 0 +#define ENABLE_TG2_MUXER 0 +#define ENABLE_TGP_MUXER 0 +#define ENABLE_VOC_MUXER 0 +#define ENABLE_WAV_MUXER 0 +#define ENABLE_YUV4MPEGPIPE_MUXER 0 +#endif diff --git a/Xcode/Patcher/CopyFiles.h b/Xcode/Patcher/CopyFiles.h index a03d06a47e..79b11dd728 100644 --- a/Xcode/Patcher/CopyFiles.h +++ b/Xcode/Patcher/CopyFiles.h @@ -1,30 +1,30 @@ -#import - -BOOL NeedsPrivs( NSString *path ); -NSString *CopyWithPrivs( NSString *src, NSString *dest ); -NSString *Copy( NSString *src, NSString *dest ); - -/* - * (c) 2006 Steve Checkoway - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#import + +BOOL NeedsPrivs( NSString *path ); +NSString *CopyWithPrivs( NSString *src, NSString *dest ); +NSString *Copy( NSString *src, NSString *dest ); + +/* + * (c) 2006 Steve Checkoway + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/Xcode/Patcher/Identification.txt b/Xcode/Patcher/Identification.txt index 011f12f9e2..6b0ede8d25 100644 --- a/Xcode/Patcher/Identification.txt +++ b/Xcode/Patcher/Identification.txt @@ -1,11 +1,11 @@ -# The format of this file is: -# Application name -# Bundle ID -# version1 -# version2 -# ... -# The version key -ALL- or no version keys matches all versions. - -StepMania -com.StepMania --ALL- +# The format of this file is: +# Application name +# Bundle ID +# version1 +# version2 +# ... +# The version key -ALL- or no version keys matches all versions. + +StepMania +com.StepMania +-ALL- diff --git a/Xcode/Patcher/Upgrader.h b/Xcode/Patcher/Upgrader.h index 78e833690b..785a531d16 100644 --- a/Xcode/Patcher/Upgrader.h +++ b/Xcode/Patcher/Upgrader.h @@ -1,56 +1,56 @@ -/* Upgrader */ - -#import - -@interface Upgrader : NSObject -{ - IBOutlet NSButton *m_Choose; - IBOutlet NSButton *m_Okay; - IBOutlet NSPanel *m_Panel; - IBOutlet NSProgressIndicator *m_ProgressBar; - IBOutlet NSProgressIndicator *m_Searching; - IBOutlet NSTextField *m_StatusText; - IBOutlet NSTextField *m_SelectionText; - IBOutlet NSTextField *m_PatchingText; - IBOutlet NSWindow *m_Window; - NSString *m_sAppID; - NSArray *m_vVersions; - NSString *m_sName; - NSString *m_sError; - NSString *m_sPath; -} -- (IBAction) chooseFile:(id)sender; -- (IBAction) upgrade:(id)sender; -- (void) findApp:(id)obj; -- (void) foundApp:(id)obj; -- (void) upgradeFile:(id)path; -- (void) sheetEnded:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; -- (BOOL) panel:(id)sender isValidFilename:(NSString *)filename; -- (BOOL) panel:(id)sender shouldShowFilename:(NSString *)filename; -- (BOOL) checkPath:(NSString *)path; -@end - -/* - * (c) 2006 Steve Checkoway - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* Upgrader */ + +#import + +@interface Upgrader : NSObject +{ + IBOutlet NSButton *m_Choose; + IBOutlet NSButton *m_Okay; + IBOutlet NSPanel *m_Panel; + IBOutlet NSProgressIndicator *m_ProgressBar; + IBOutlet NSProgressIndicator *m_Searching; + IBOutlet NSTextField *m_StatusText; + IBOutlet NSTextField *m_SelectionText; + IBOutlet NSTextField *m_PatchingText; + IBOutlet NSWindow *m_Window; + NSString *m_sAppID; + NSArray *m_vVersions; + NSString *m_sName; + NSString *m_sError; + NSString *m_sPath; +} +- (IBAction) chooseFile:(id)sender; +- (IBAction) upgrade:(id)sender; +- (void) findApp:(id)obj; +- (void) foundApp:(id)obj; +- (void) upgradeFile:(id)path; +- (void) sheetEnded:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; +- (BOOL) panel:(id)sender isValidFilename:(NSString *)filename; +- (BOOL) panel:(id)sender shouldShowFilename:(NSString *)filename; +- (BOOL) checkPath:(NSString *)path; +@end + +/* + * (c) 2006 Steve Checkoway + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActiveAttackList.cpp b/src/ActiveAttackList.cpp index 50011e030f..72fe7ba585 100644 --- a/src/ActiveAttackList.cpp +++ b/src/ActiveAttackList.cpp @@ -1,79 +1,79 @@ -#include "global.h" -#include "ActiveAttackList.h" -#include "RageUtil.h" -#include "GameState.h" -#include "Inventory.h" -#include "RageTimer.h" -#include "PlayerOptions.h" -#include "PlayerState.h" - -ActiveAttackList::ActiveAttackList() -{ -} - -void ActiveAttackList::Init( const PlayerState* pPlayerState ) -{ - m_pPlayerState = pPlayerState; -} - -void ActiveAttackList::Update( float fDelta ) -{ - bool bTimeToRefresh = - IsFirstUpdate() || // check this before running Actor::Update() - m_pPlayerState->m_bAttackBeganThisUpdate || - m_pPlayerState->m_bAttackEndedThisUpdate; - - BitmapText::Update( fDelta ); - - if( bTimeToRefresh ) - Refresh(); -} - -void ActiveAttackList::Refresh() -{ - const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks; - - vector vsThemedMods; - for( unsigned i=0; iSetText( s ); // BitmapText will not rebuild vertices if these strings are the same. -} - -/* - * (c) 2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActiveAttackList.h" +#include "RageUtil.h" +#include "GameState.h" +#include "Inventory.h" +#include "RageTimer.h" +#include "PlayerOptions.h" +#include "PlayerState.h" + +ActiveAttackList::ActiveAttackList() +{ +} + +void ActiveAttackList::Init( const PlayerState* pPlayerState ) +{ + m_pPlayerState = pPlayerState; +} + +void ActiveAttackList::Update( float fDelta ) +{ + bool bTimeToRefresh = + IsFirstUpdate() || // check this before running Actor::Update() + m_pPlayerState->m_bAttackBeganThisUpdate || + m_pPlayerState->m_bAttackEndedThisUpdate; + + BitmapText::Update( fDelta ); + + if( bTimeToRefresh ) + Refresh(); +} + +void ActiveAttackList::Refresh() +{ + const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks; + + vector vsThemedMods; + for( unsigned i=0; iSetText( s ); // BitmapText will not rebuild vertices if these strings are the same. +} + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActiveAttackList.h b/src/ActiveAttackList.h index 38589c8840..dd5859a081 100644 --- a/src/ActiveAttackList.h +++ b/src/ActiveAttackList.h @@ -1,56 +1,56 @@ -#ifndef ACTIVE_ATTACK_LIST_H -#define ACTIVE_ATTACK_LIST_H - -#include "BitmapText.h" -class PlayerState; - -/** @brief Shows currently active Player modifiers during gameplay. */ -class ActiveAttackList : public BitmapText -{ -public: - /** @brief The constructor that does nothing. */ - ActiveAttackList(); - /** - * @brief Set up the PlayerState. - * @param pPlayerState the PlayerState involved with the attacks. */ - void Init( const PlayerState* pPlayerState ); - /** - * @brief Look into updating the list. - * @param fDelta the present time. */ - virtual void Update( float fDelta ); - /** @brief Refresh the list of attacks. */ - void Refresh(); - -protected: - /** @brief the PlayerState of the Player who is dealing with the attack list. */ - const PlayerState* m_pPlayerState; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTIVE_ATTACK_LIST_H +#define ACTIVE_ATTACK_LIST_H + +#include "BitmapText.h" +class PlayerState; + +/** @brief Shows currently active Player modifiers during gameplay. */ +class ActiveAttackList : public BitmapText +{ +public: + /** @brief The constructor that does nothing. */ + ActiveAttackList(); + /** + * @brief Set up the PlayerState. + * @param pPlayerState the PlayerState involved with the attacks. */ + void Init( const PlayerState* pPlayerState ); + /** + * @brief Look into updating the list. + * @param fDelta the present time. */ + virtual void Update( float fDelta ); + /** @brief Refresh the list of attacks. */ + void Refresh(); + +protected: + /** @brief the PlayerState of the Player who is dealing with the attack list. */ + const PlayerState* m_pPlayerState; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Actor.cpp b/src/Actor.cpp index 241b79dfb1..72a3ee3856 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -1,1728 +1,1728 @@ -#include "global.h" -#include "Actor.h" -#include "RageDisplay.h" -#include "RageUtil.h" -#include "RageMath.h" -#include "RageLog.h" -#include "arch/Dialog/Dialog.h" -#include "Foreach.h" -#include "XmlFile.h" -#include "LuaBinding.h" -#include "ThemeManager.h" -#include "LuaReference.h" -#include "MessageManager.h" -#include "LightsManager.h" // for NUM_CabinetLight -#include "ActorUtil.h" -#include "Preference.h" -#include - -static Preference g_bShowMasks("ShowMasks", false); - -/** - * @brief Set up a hidden Actor that won't be drawn. - * - * It's useful to be able to construct a basic Actor in XML, in - * order to simply delay a Transition, or receive and send broadcasts. - * Since these actors will never draw, set them hidden by default. */ -class HiddenActor: public Actor -{ -public: - HiddenActor() { SetVisible(false); } - virtual HiddenActor *Copy() const; -}; -REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor ); - -float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; -float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0; - - -Actor *Actor::Copy() const { return new Actor(*this); } - -static float g_fCabinetLights[NUM_CabinetLight]; - -static const char *HorizAlignNames[] = { - "Left", - "Center", - "Right" -}; -XToString( HorizAlign ); -LuaXType( HorizAlign ); - -static const char *VertAlignNames[] = { - "Top", - "Middle", - "Bottom" -}; -XToString( VertAlign ); -LuaXType( VertAlign ); - -void Actor::SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBeatNoOffset ) -{ - g_fCurrentBGMTime = fTime; - g_fCurrentBGMBeat = fBeat; - - /* This timer is generally only used for effects tied to the background music - * when GameSoundManager is aligning music beats. Alignment doesn't handle - * g_fVisualDelaySeconds. */ - g_fCurrentBGMTimeNoOffset = fTimeNoOffset; - g_fCurrentBGMBeatNoOffset = fBeatNoOffset; -} - -void Actor::SetBGMLight( int iLightNumber, float fCabinetLights ) -{ - ASSERT( iLightNumber < NUM_CabinetLight ); - g_fCabinetLights[iLightNumber] = fCabinetLights; -} - -void Actor::InitState() -{ - StopTweening(); - - m_pTempState = NULL; - - m_baseRotation = RageVector3( 0, 0, 0 ); - m_baseScale = RageVector3( 1, 1, 1 ); - m_fBaseAlpha = 1; - - m_start.Init(); - m_current.Init(); - - m_fHorizAlign = 0.5f; - m_fVertAlign = 0.5f; -#if defined(SSC_FUTURES) - for( unsigned i = 0; i < m_Effects.size(); ++i ) - m_Effects[i] = no_effect; -#else - m_Effect = no_effect; -#endif - m_fSecsIntoEffect = 0; - m_fEffectDelta = 0; - m_fEffectRampUp = 0.5; - m_fEffectHoldAtHalf = 0; - m_fEffectRampDown = 0.5; - m_fEffectHoldAtZero = 0; - m_fEffectOffset = 0; - m_EffectClock = CLOCK_TIMER; - m_vEffectMagnitude = RageVector3(0,0,10); - m_effectColor1 = RageColor(1,1,1,1); - m_effectColor2 = RageColor(1,1,1,1); - - m_bVisible = true; - m_fShadowLengthX = 0; - m_fShadowLengthY = 0; - m_ShadowColor = RageColor(0,0,0,0.5); - m_bIsAnimating = true; - m_fHibernateSecondsLeft = 0; - m_iDrawOrder = 0; - - m_bTextureWrapping = false; - m_bTextureFiltering = true; - - m_BlendMode = BLEND_NORMAL; - m_fZBias = 0; - m_bClearZBuffer = false; - m_ZTestMode = ZTEST_OFF; - m_bZWrite = false; - m_CullMode = CULL_NONE; -} - -static bool GetMessageNameFromCommandName( const RString &sCommandName, RString &sMessageNameOut ) -{ - if( sCommandName.Right(7) == "Message" ) - { - sMessageNameOut = sCommandName.Left(sCommandName.size()-7); - return true; - } - else - { - return false; - } -} - -Actor::Actor() -{ - m_pLuaInstance = new LuaClass; - Lua *L = LUA->Get(); - m_pLuaInstance->PushSelf( L ); - lua_newtable( L ); - lua_pushvalue( L, -1 ); - lua_setmetatable( L, -2 ); - lua_setfield( L, -2, "ctx" ); - lua_pop( L, 1 ); - LUA->Release( L ); - - - m_size = RageVector2( 1, 1 ); - InitState(); - m_pParent = NULL; - m_bFirstUpdate = true; -} - -Actor::~Actor() -{ - StopTweening(); - UnsubscribeAll(); -} - -Actor::Actor( const Actor &cpy ): - MessageSubscriber( cpy ) -{ - /* Don't copy an Actor in the middle of rendering. */ - ASSERT( cpy.m_pTempState == NULL ); - m_pTempState = NULL; - -#define CPY(x) x = cpy.x - CPY( m_sName ); - CPY( m_pParent ); - CPY( m_pLuaInstance ); - - CPY( m_baseRotation ); - CPY( m_baseScale ); - CPY( m_fBaseAlpha ); - - - CPY( m_size ); - CPY( m_current ); - CPY( m_start ); - for( unsigned i = 0; i < cpy.m_Tweens.size(); ++i ) - m_Tweens.push_back( new TweenStateAndInfo(*cpy.m_Tweens[i]) ); - - CPY( m_bFirstUpdate ); - - CPY( m_fHorizAlign ); - CPY( m_fVertAlign ); -#if defined(SSC_FUTURES) - // I'm a bit worried about this -aj - for( unsigned i = 0; i < cpy.m_Effects.size(); ++i ) - m_Effects.push_back( (*cpy.m_Effects[i]) ); -#else - CPY( m_Effect ); -#endif - CPY( m_fSecsIntoEffect ); - CPY( m_fEffectDelta ); - CPY( m_fEffectRampUp ); - CPY( m_fEffectHoldAtHalf ); - CPY( m_fEffectRampDown ); - CPY( m_fEffectHoldAtZero ); - CPY( m_fEffectOffset ); - CPY( m_EffectClock ); - - CPY( m_effectColor1 ); - CPY( m_effectColor2 ); - CPY( m_vEffectMagnitude ); - - CPY( m_bVisible ); - CPY( m_fHibernateSecondsLeft ); - CPY( m_fShadowLengthX ); - CPY( m_fShadowLengthY ); - CPY( m_ShadowColor ); - CPY( m_bIsAnimating ); - CPY( m_iDrawOrder ); - - CPY( m_bTextureWrapping ); - CPY( m_bTextureFiltering ); - CPY( m_BlendMode ); - CPY( m_bClearZBuffer ); - CPY( m_ZTestMode ); - CPY( m_bZWrite ); - CPY( m_fZBias ); - CPY( m_CullMode ); - - CPY( m_mapNameToCommands ); -#undef CPY -} - -/* XXX: This calls InitCommand, which must happen after all other - * initialization (eg. ActorFrame loading children). However, it - * also loads input variables, which should happen first. The - * former is more important. */ -void Actor::LoadFromNode( const XNode* pNode ) -{ - Lua *L = LUA->Get(); - FOREACH_CONST_Attr( pNode, pAttr ) - { - // Load Name, if any. - const RString &sKeyName = pAttr->first; - const XNodeValue *pValue = pAttr->second; - if( sKeyName == "Name" ) SetName( pValue->GetValue() ); - else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( pValue->GetValue() ); - else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( pValue->GetValue() ); - else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( pValue->GetValue() ); - else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( pValue->GetValue() ); - else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( pValue->GetValue() ); - else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( pValue->GetValue() ); - else if( EndsWith(sKeyName,"Command") ) - { - LuaReference *pRef = new LuaReference; - pValue->PushValue( L ); - pRef->SetFromStack( L ); - RString sCmdName = sKeyName.Left( sKeyName.size()-7 ); - AddCommand( sCmdName, apActorCommands( pRef ) ); - } - } - - LUA->Release( L ); - - // Don't recurse Init. It gets called once for every Actor when the - // Actor is loaded, and we don't want to call it again. - PlayCommandNoRecurse( Message("Init") ); -} - -void Actor::Draw() -{ - if( !m_bVisible ) - return; // early abort - if( m_fHibernateSecondsLeft > 0 ) - return; // early abort - if( this->EarlyAbortDraw() ) - return; - - // call the most-derived versions - this->BeginDraw(); - this->DrawPrimitives(); // call the most-derived version of DrawPrimitives(); - this->EndDraw(); -} - -void Actor::BeginDraw() // set the world matrix and calculate actor properties -{ - DISPLAY->PushMatrix(); // we're actually going to do some drawing in this function - - // Somthing below may set m_pTempState to tempState - m_pTempState = &m_current; - - // set temporary drawing properties based on Effects - static TweenState tempState; - - // todo: account for SSC_FUTURES -aj - if( m_Effect == no_effect ) - { - } - else - { - m_pTempState = &tempState; - tempState = m_current; - - const float fTotalPeriod = GetEffectPeriod(); - ASSERT( fTotalPeriod > 0 ); - const float fTimeIntoEffect = fmodfp( m_fSecsIntoEffect+m_fEffectOffset, fTotalPeriod ); - - float fPercentThroughEffect; - if( fTimeIntoEffect < m_fEffectRampUp ) - { - fPercentThroughEffect = SCALE( - fTimeIntoEffect, - 0, - m_fEffectRampUp, - 0.0f, - 0.5f ); - } - else if( fTimeIntoEffect < m_fEffectRampUp + m_fEffectHoldAtHalf ) - { - fPercentThroughEffect = 0.5f; - } - else if( fTimeIntoEffect < m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown ) - { - fPercentThroughEffect = SCALE( - fTimeIntoEffect, - m_fEffectRampUp + m_fEffectHoldAtHalf, - m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown, - 0.5f, - 1.0f ); - } - else - { - fPercentThroughEffect = 0; - } - ASSERT_M( fPercentThroughEffect >= 0 && fPercentThroughEffect <= 1, - ssprintf("PercentThroughEffect: %f", fPercentThroughEffect) ); - - bool bBlinkOn = fPercentThroughEffect > 0.5f; - float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; - ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1, - ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) ); - float fOriginalAlpha = tempState.diffuse[0].a; - - // todo: account for SSC_FUTURES -aj - switch( m_Effect ) - { - case diffuse_blink: - /* XXX: Should diffuse_blink and diffuse_shift multiply the tempState color? - * (That would have the same effect with 1,1,1,1, and allow tweening the diffuse - * while blinking and shifting.) */ - for(int i=0; i<4; i++) - { - tempState.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2; - tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing - } - break; - case diffuse_shift: - for(int i=0; i<4; i++) - { - tempState.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); - tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing - } - break; - case diffuse_ramp: - for(int i=0; i<4; i++) - { - tempState.diffuse[i] = m_effectColor1*fPercentThroughEffect + m_effectColor2*(1.0f-fPercentThroughEffect); - tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing - } - break; - case glow_blink: - tempState.glow = bBlinkOn ? m_effectColor1 : m_effectColor2; - tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! - break; - case glow_shift: - tempState.glow = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); - tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! - break; - case glow_ramp: - tempState.glow = m_effectColor1*fPercentThroughEffect + m_effectColor2*(1.0f-fPercentThroughEffect); - tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! - break; - case rainbow: - tempState.diffuse[0] = RageColor( - RageFastCos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, - RageFastCos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, - RageFastCos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, - fOriginalAlpha ); - for( int i=1; i<4; i++ ) - tempState.diffuse[i] = tempState.diffuse[0]; - break; - case wag: - tempState.rotation += m_vEffectMagnitude * RageFastSin( fPercentThroughEffect * 2.0f * PI ); - break; - case spin: - // nothing needs to be here - break; - case vibrate: - tempState.pos.x += m_vEffectMagnitude.x * randomf(-1.0f, 1.0f) * GetZoom(); - tempState.pos.y += m_vEffectMagnitude.y * randomf(-1.0f, 1.0f) * GetZoom(); - tempState.pos.z += m_vEffectMagnitude.z * randomf(-1.0f, 1.0f) * GetZoom(); - break; - case bounce: - { - float fPercentOffset = RageFastSin( fPercentThroughEffect*PI ); - tempState.pos += m_vEffectMagnitude * fPercentOffset; - tempState.pos.x = roundf( tempState.pos.x ); - tempState.pos.y = roundf( tempState.pos.y ); - tempState.pos.z = roundf( tempState.pos.z ); - } - break; - case bob: - { - float fPercentOffset = RageFastSin( fPercentThroughEffect*PI*2 ); - tempState.pos += m_vEffectMagnitude * fPercentOffset; - tempState.pos.x = roundf( tempState.pos.x ); - tempState.pos.y = roundf( tempState.pos.y ); - tempState.pos.z = roundf( tempState.pos.z ); - } - break; - case pulse: - { - float fMinZoom = m_vEffectMagnitude[0]; - float fMaxZoom = m_vEffectMagnitude[1]; - float fPercentOffset = RageFastSin( fPercentThroughEffect*PI ); - float fZoom = SCALE( fPercentOffset, 0.f, 1.f, fMinZoom, fMaxZoom ); - tempState.scale *= fZoom; - - // Use the color as a Vector3 to scale the effect for added control - RageColor c = SCALE( fPercentOffset, 0.f, 1.f, m_effectColor1, m_effectColor2 ); - tempState.scale.x *= c.r; - tempState.scale.y *= c.g; - tempState.scale.z *= c.b; - } - break; - default: - ASSERT(0); // invalid Effect - } - } - - if( m_fBaseAlpha != 1 ) - { - if( m_pTempState != &tempState ) - { - m_pTempState = &tempState; - tempState = m_current; - } - - for( int i=0; i<4; i++ ) - tempState.diffuse[i].a *= m_fBaseAlpha; - } - - if( m_pTempState->pos.x != 0 || m_pTempState->pos.y != 0 || m_pTempState->pos.z != 0 ) - { - RageMatrix m; - RageMatrixTranslate( - &m, - m_pTempState->pos.x, - m_pTempState->pos.y, - m_pTempState->pos.z - ); - DISPLAY->PreMultMatrix( m ); - } - - { - /* The only time rotation and quat should normally be used simultaneously - * is for m_baseRotation. Most objects aren't rotated at all, so optimize - * that case. */ - const float fRotateX = m_pTempState->rotation.x + m_baseRotation.x; - const float fRotateY = m_pTempState->rotation.y + m_baseRotation.y; - const float fRotateZ = m_pTempState->rotation.z + m_baseRotation.z; - - if( fRotateX != 0 || fRotateY != 0 || fRotateZ != 0 ) - { - RageMatrix m; - RageMatrixRotationXYZ( &m, fRotateX, fRotateY, fRotateZ ); - DISPLAY->PreMultMatrix( m ); - } - } - - // handle scaling - { - const float fScaleX = m_pTempState->scale.x * m_baseScale.x; - const float fScaleY = m_pTempState->scale.y * m_baseScale.y; - const float fScaleZ = m_pTempState->scale.z * m_baseScale.z; - - if( fScaleX != 1 || fScaleY != 1 || fScaleZ != 1 ) - { - RageMatrix m; - RageMatrixScale( - &m, - fScaleX, - fScaleY, - fScaleZ ); - DISPLAY->PreMultMatrix( m ); - } - } - - // handle alignment; most actors have default alignment. - if( unlikely(m_fHorizAlign != 0.5f || m_fVertAlign != 0.5f) ) - { - float fX = SCALE( m_fHorizAlign, 0.0f, 1.0f, +m_size.x/2.0f, -m_size.x/2.0f ); - float fY = SCALE( m_fVertAlign, 0.0f, 1.0f, +m_size.y/2.0f, -m_size.y/2.0f ); - RageMatrix m; - RageMatrixTranslate( - &m, - fX, - fY, - 0 - ); - DISPLAY->PreMultMatrix( m ); - } - - if( m_pTempState->quat.x != 0 || m_pTempState->quat.y != 0 || m_pTempState->quat.z != 0 || m_pTempState->quat.w != 1 ) - { - RageMatrix mat; - RageMatrixFromQuat( &mat, m_pTempState->quat ); - - DISPLAY->MultMatrix(mat); - } - - // handle skews - if( m_pTempState->fSkewX != 0 ) - { - DISPLAY->SkewX( m_pTempState->fSkewX ); - } - - if( m_pTempState->fSkewY != 0 ) - { - DISPLAY->SkewY( m_pTempState->fSkewY ); - } - -} - -void Actor::SetGlobalRenderStates() -{ - // set Actor-defined render states - if( !g_bShowMasks.Get() || m_BlendMode != BLEND_NO_EFFECT ) - DISPLAY->SetBlendMode( m_BlendMode ); - DISPLAY->SetZWrite( m_bZWrite ); - DISPLAY->SetZTestMode( m_ZTestMode ); - - // BLEND_NO_EFFECT is used to draw masks to the Z-buffer, which always wants - // Z-bias enabled. - if( m_fZBias == 0 && m_BlendMode == BLEND_NO_EFFECT ) - DISPLAY->SetZBias( 1.0f ); - else - DISPLAY->SetZBias( m_fZBias ); - - if( m_bClearZBuffer ) - DISPLAY->ClearZBuffer(); - DISPLAY->SetCullMode( m_CullMode ); -} - -void Actor::SetTextureRenderStates() -{ - DISPLAY->SetTextureWrapping( TextureUnit_1, m_bTextureWrapping ); - DISPLAY->SetTextureFiltering( TextureUnit_1, m_bTextureFiltering ); -} - -void Actor::EndDraw() -{ - DISPLAY->PopMatrix(); - m_pTempState = NULL; -} - -void Actor::UpdateTweening( float fDeltaTime ) -{ - while( 1 ) - { - if( m_Tweens.empty() ) // nothing to do - return; - - if( fDeltaTime == 0 ) // nothing will change - return; - - // update current tween state - // earliest tween - TweenState &TS = m_Tweens[0]->state; - TweenInfo &TI = m_Tweens[0]->info; - - bool bBeginning = TI.m_fTimeLeftInTween == TI.m_fTweenTime; - - float fSecsToSubtract = min( TI.m_fTimeLeftInTween, fDeltaTime ); - TI.m_fTimeLeftInTween -= fSecsToSubtract; - fDeltaTime -= fSecsToSubtract; - - RString sCommand = TI.m_sCommandName; - if( bBeginning ) // we are just beginning this tween - m_start = m_current; // set the start position - - if( TI.m_fTimeLeftInTween == 0 ) // Current tween is over. Stop. - { - m_current = TS; - - // delete the head tween - delete m_Tweens.front(); - m_Tweens.erase( m_Tweens.begin() ); - } - else // in the middle of tweening. Recalcute the current position. - { - const float fPercentThroughTween = 1-(TI.m_fTimeLeftInTween / TI.m_fTweenTime); - - // distort the percentage if appropriate - float fPercentAlongPath = TI.m_pTween->Tween( fPercentThroughTween ); - TweenState::MakeWeightedAverage( m_current, m_start, TS, fPercentAlongPath ); - } - - if( bBeginning ) - { - // Execute the command in this tween (if any). Do this last, and don't - // access TI or TS after, since this may modify the tweening queue. - if( !sCommand.empty() ) - { - if( sCommand.Left(1) == "!" ) - MESSAGEMAN->Broadcast( sCommand.substr(1) ); - else - this->PlayCommand( sCommand ); - } - } - } -} - -bool Actor::IsFirstUpdate() const -{ - return m_bFirstUpdate; -} - -void Actor::Update( float fDeltaTime ) -{ -// LOG->Trace( "Actor::Update( %f )", fDeltaTime ); - ASSERT_M( fDeltaTime >= 0, ssprintf("DeltaTime: %f",fDeltaTime) ); - - if( m_fHibernateSecondsLeft > 0 ) - { - m_fHibernateSecondsLeft -= fDeltaTime; - if( m_fHibernateSecondsLeft > 0 ) - return; - - // Grab the leftover time. - fDeltaTime = -m_fHibernateSecondsLeft; - m_fHibernateSecondsLeft = 0; - } - - this->UpdateInternal( fDeltaTime ); -} - -void Actor::UpdateInternal( float fDeltaTime ) -{ - if( m_bFirstUpdate ) - m_bFirstUpdate = false; - - switch( m_EffectClock ) - { - case CLOCK_TIMER: - m_fSecsIntoEffect += fDeltaTime; - m_fEffectDelta = fDeltaTime; - - /* Wrap the counter, so it doesn't increase indefinitely (causing loss - * of precision if a screen is left to sit for a day). */ - if( m_fSecsIntoEffect >= GetEffectPeriod() ) - m_fSecsIntoEffect -= GetEffectPeriod(); - break; - - case CLOCK_TIMER_GLOBAL: - { - float fTime = RageTimer::GetTimeSinceStartFast(); - m_fEffectDelta = fTime - m_fSecsIntoEffect; - m_fSecsIntoEffect = fTime; - break; - } - - case CLOCK_BGM_BEAT: - m_fEffectDelta = g_fCurrentBGMBeat - m_fSecsIntoEffect; - m_fSecsIntoEffect = g_fCurrentBGMBeat; - break; - - case CLOCK_BGM_TIME: - m_fEffectDelta = g_fCurrentBGMTime - m_fSecsIntoEffect; - m_fSecsIntoEffect = g_fCurrentBGMTime; - break; - - case CLOCK_BGM_BEAT_NO_OFFSET: - m_fEffectDelta = g_fCurrentBGMBeatNoOffset - m_fSecsIntoEffect; - m_fSecsIntoEffect = g_fCurrentBGMBeatNoOffset; - break; - - case CLOCK_BGM_TIME_NO_OFFSET: - m_fEffectDelta = g_fCurrentBGMTimeNoOffset - m_fSecsIntoEffect; - m_fSecsIntoEffect = g_fCurrentBGMTimeNoOffset; - break; - - default: - if( m_EffectClock >= CLOCK_LIGHT_1 && m_EffectClock <= CLOCK_LIGHT_LAST ) - { - int i = m_EffectClock - CLOCK_LIGHT_1; - m_fEffectDelta = g_fCabinetLights[i] - m_fSecsIntoEffect; - m_fSecsIntoEffect = g_fCabinetLights[i]; - } - break; - } - - // update effect - // todo: account for SSC_FUTURES -aj - switch( m_Effect ) - { - case spin: - m_current.rotation += m_fEffectDelta*m_vEffectMagnitude; - wrap( m_current.rotation.x, 360 ); - wrap( m_current.rotation.y, 360 ); - wrap( m_current.rotation.z, 360 ); - break; - } - - UpdateTweening( fDeltaTime ); -} - -RString Actor::GetLineage() const -{ - RString sPath; - - if( m_pParent ) - sPath = m_pParent->GetLineage() + '/'; - sPath += ssprintf( "<%s> %s", typeid(*this).name(), m_sName.c_str() ); - return sPath; -} - -void Actor::BeginTweening( float time, ITween *pTween ) -{ - ASSERT( time >= 0 ); - - time = max( time, 0 ); - - // If the number of tweens to ever gets this large, there's probably an infinitely - // recursing ActorCommand. - if( m_Tweens.size() > 50 ) - { - RString sError = ssprintf( "Tween overflow: \"%s\"; infinitely recursing ActorCommand?", GetLineage().c_str() ); - - LOG->Warn( "%s", sError.c_str() ); - Dialog::OK( sError ); - FinishTweening(); - } - - // add a new TweenState to the tail, and initialize it - m_Tweens.push_back( new TweenStateAndInfo ); - - // latest - TweenState &TS = m_Tweens.back()->state; - TweenInfo &TI = m_Tweens.back()->info; - - if( m_Tweens.size() >= 2 ) // if there was already a TS on the stack - { - // initialize the new TS from the last TS in the list - TS = m_Tweens[m_Tweens.size()-2]->state; - } - else - { - // This new TS is the only TS. - // Set our tween starting and ending values to the current position. - TS = m_current; - } - - TI.m_pTween = pTween; - TI.m_fTweenTime = time; - TI.m_fTimeLeftInTween = time; -} - -void Actor::BeginTweening( float time, TweenType tt ) -{ - ITween *pTween = ITween::CreateFromType( tt ); - BeginTweening( time, pTween ); -} - -void Actor::StopTweening() -{ - for( unsigned i = 0; i < m_Tweens.size(); ++i ) - delete m_Tweens[i]; - m_Tweens.clear(); -} - -void Actor::FinishTweening() -{ - if( !m_Tweens.empty() ) - m_current = DestTweenState(); - StopTweening(); -} - -void Actor::HurryTweening( float factor ) -{ - for( unsigned i = 0; i < m_Tweens.size(); ++i ) - { - m_Tweens[i]->info.m_fTimeLeftInTween *= factor; - m_Tweens[i]->info.m_fTweenTime *= factor; - } -} - -void Actor::ScaleTo( const RectF &rect, StretchType st ) -{ - // width and height of rectangle - float rect_width = rect.GetWidth(); - float rect_height = rect.GetHeight(); - - if( rect_width < 0 ) SetRotationY( 180 ); - if( rect_height < 0 ) SetRotationX( 180 ); - - // zoom fActor needed to scale the Actor to fill the rectangle - float fNewZoomX = fabsf(rect_width / m_size.x); - float fNewZoomY = fabsf(rect_height / m_size.y); - - float fNewZoom = 0.f; - switch( st ) - { - case cover: - fNewZoom = fNewZoomX>fNewZoomY ? fNewZoomX : fNewZoomY; // use larger zoom - break; - case fit_inside: - fNewZoom = fNewZoomX>fNewZoomY ? fNewZoomY : fNewZoomX; // use smaller zoom - break; - } - - SetX( rect.left + rect_width * m_fHorizAlign ); - SetY( rect.top + rect_height * m_fVertAlign ); - - SetZoom( fNewZoom ); -} - -void Actor::SetEffectClockString( const RString &s ) -{ - if (s.EqualsNoCase("timer")) this->SetEffectClock( CLOCK_TIMER ); - if (s.EqualsNoCase("timerglobal")) this->SetEffectClock( CLOCK_TIMER_GLOBAL ); - else if(s.EqualsNoCase("beat")) this->SetEffectClock( CLOCK_BGM_BEAT ); - else if(s.EqualsNoCase("music")) this->SetEffectClock( CLOCK_BGM_TIME ); - else if(s.EqualsNoCase("bgm")) this->SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated - else if(s.EqualsNoCase("musicnooffset"))this->SetEffectClock( CLOCK_BGM_TIME_NO_OFFSET ); - else if(s.EqualsNoCase("beatnooffset")) this->SetEffectClock( CLOCK_BGM_BEAT_NO_OFFSET ); - else - { - CabinetLight cl = StringToCabinetLight( s ); - if( cl != CabinetLight_Invalid ) - { - this->SetEffectClock( (EffectClock) (cl + CLOCK_LIGHT_1) ); - return; - } - else - ASSERT(0); - } -} - -void Actor::StretchTo( const RectF &r ) -{ - // width and height of rectangle - float width = r.GetWidth(); - float height = r.GetHeight(); - - // center of the rectangle - float cx = r.left + width/2.0f; - float cy = r.top + height/2.0f; - - // zoom fActor needed to scale the Actor to fill the rectangle - float fNewZoomX = width / m_size.x; - float fNewZoomY = height / m_size.y; - - SetXY( cx, cy ); - SetZoomX( fNewZoomX ); - SetZoomY( fNewZoomY ); -} - - -void Actor::SetEffectPeriod( float fTime ) -{ - ASSERT( fTime > 0 ); - m_fEffectRampUp = fTime/2; - m_fEffectHoldAtHalf = 0; - m_fEffectRampDown = fTime/2; - m_fEffectHoldAtZero = 0; -} - -float Actor::GetEffectPeriod() const -{ - return m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown + m_fEffectHoldAtZero; -} - -void Actor::SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, float fAtZero ) -{ - m_fEffectRampUp = fRampUp; - m_fEffectHoldAtHalf = fAtHalf; - m_fEffectRampDown = fRampDown; - m_fEffectHoldAtZero = fAtZero; - ASSERT( GetEffectPeriod() > 0 ); -} - -// effect "macros" - -void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != diffuse_blink ) - { - m_Effect = diffuse_blink; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != diffuse_shift ) - { - m_Effect = diffuse_shift; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != diffuse_ramp ) - { - m_Effect = diffuse_ramp; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != glow_blink ) - { - m_Effect = glow_blink; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != glow_shift ) - { - m_Effect = glow_shift; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != glow_ramp ) - { - m_Effect = glow_ramp; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); - m_effectColor1 = c1; - m_effectColor2 = c2; -} - -void Actor::SetEffectRainbow( float fEffectPeriodSeconds ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != rainbow ) - { - m_Effect = rainbow; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fEffectPeriodSeconds ); -} - -void Actor::SetEffectWag( float fPeriod, RageVector3 vect ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect != wag ) - { - m_Effect = wag; - m_fSecsIntoEffect = 0; - } - SetEffectPeriod( fPeriod ); - m_vEffectMagnitude = vect; -} - -void Actor::SetEffectBounce( float fPeriod, RageVector3 vect ) -{ - // todo: account for SSC_FUTURES -aj - m_Effect = bounce; - SetEffectPeriod( fPeriod ); - m_vEffectMagnitude = vect; - m_fSecsIntoEffect = 0; -} - -void Actor::SetEffectBob( float fPeriod, RageVector3 vect ) -{ - // todo: account for SSC_FUTURES -aj - if( m_Effect!=bob || GetEffectPeriod() != fPeriod ) - { - m_Effect = bob; - SetEffectPeriod( fPeriod ); - m_fSecsIntoEffect = 0; - } - m_vEffectMagnitude = vect; -} - -void Actor::SetEffectSpin( RageVector3 vect ) -{ - // todo: account for SSC_FUTURES -aj - m_Effect = spin; - m_vEffectMagnitude = vect; -} - -void Actor::SetEffectVibrate( RageVector3 vect ) -{ - // todo: account for SSC_FUTURES -aj - m_Effect = vibrate; - m_vEffectMagnitude = vect; -} - -void Actor::SetEffectPulse( float fPeriod, float fMinZoom, float fMaxZoom ) -{ - // todo: account for SSC_FUTURES -aj - m_Effect = pulse; - SetEffectPeriod( fPeriod ); - m_vEffectMagnitude[0] = fMinZoom; - m_vEffectMagnitude[1] = fMaxZoom; -} - - -void Actor::AddRotationH( float rot ) -{ - RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromH(rot) ); -} - -void Actor::AddRotationP( float rot ) -{ - RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromP(rot) ); -} - -void Actor::AddRotationR( float rot ) -{ - RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) ); -} - -void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTable ) -{ - Lua *L = LUA->Get(); - - // function - cmds.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - - // 1st parameter - this->PushSelf( L ); - - // 2nd parameter - if( pParamTable == NULL ) - lua_pushnil( L ); - else - pParamTable->PushSelf( L ); - - // call function with 2 arguments and 0 results - RString sError; - if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) - LOG->Warn( "Error playing command: %s", sError.c_str() ); - - LUA->Release(L); -} - -float Actor::GetTweenTimeLeft() const -{ - float tot = 0; - - tot += m_fHibernateSecondsLeft; - - for( unsigned i=0; iinfo.m_fTimeLeftInTween; - - return tot; -} - -/* This is a hack to change all tween states while leaving existing tweens alone. - * - * Hmm. Most commands actually act on a TweenStateAndInfo, not the Actor itself. - * Conceptually, it wouldn't be hard to give TweenState a presence in Lua, so - * we can simply say eg. "for x in states(Actor) do x.SetDiffuseColor(c) end". - * However, we'd then have to give every TweenState a userdata in Lua while it's - * being manipulated, which would add overhead ... */ -void Actor::SetGlobalDiffuseColor( RageColor c ) -{ - for( int i=0; i<4; i++ ) // color, not alpha - { - for( unsigned ts = 0; ts < m_Tweens.size(); ++ts ) - { - m_Tweens[ts]->state.diffuse[i].r = c.r; - m_Tweens[ts]->state.diffuse[i].g = c.g; - m_Tweens[ts]->state.diffuse[i].b = c.b; - } - m_current.diffuse[i].r = c.r; - m_current.diffuse[i].g = c.g; - m_current.diffuse[i].b = c.b; - m_start.diffuse[i].r = c.r; - m_start.diffuse[i].g = c.g; - m_start.diffuse[i].b = c.b; - } -} - -void Actor::SetDiffuseColor( RageColor c ) -{ - for( int i=0; i<4; i++ ) - { - DestTweenState().diffuse[i].r = c.r; - DestTweenState().diffuse[i].g = c.g; - DestTweenState().diffuse[i].b = c.b; - } -} - - -void Actor::TweenState::Init() -{ - pos = RageVector3( 0, 0, 0 ); - rotation = RageVector3( 0, 0, 0 ); - quat = RageVector4( 0, 0, 0, 1 ); - scale = RageVector3( 1, 1, 1 ); - fSkewX = 0; - fSkewY = 0; - crop = RectF( 0,0,0,0 ); - fade = RectF( 0,0,0,0 ); - for( int i=0; i<4; i++ ) - diffuse[i] = RageColor( 1, 1, 1, 1 ); - glow = RageColor( 1, 1, 1, 0 ); - aux = 0; -} - -bool Actor::TweenState::operator==( const TweenState &other ) const -{ -#define COMPARE( x ) if( x != other.x ) return false; - COMPARE( pos ); - COMPARE( rotation ); - COMPARE( quat ); - COMPARE( scale ); - COMPARE( fSkewX ); - COMPARE( fSkewY ); - COMPARE( crop ); - COMPARE( fade ); - for( unsigned i=0; iinfo; - TI.m_sCommandName = sCommandName; -} - -void Actor::QueueMessage( const RString& sMessageName ) -{ - // Hack: use "!" as a marker to broadcast a command, instead of playing a - // command, so we don't have to add yet another element to every tween - // state for this rarely-used command. - BeginTweening( 0, TWEEN_LINEAR ); - TweenInfo &TI = m_Tweens.back()->info; - TI.m_sCommandName = "!" + sMessageName; -} - -void Actor::AddCommand( const RString &sCmdName, apActorCommands apac ) -{ - if( HasCommand(sCmdName) ) - { - RString sWarning = GetLineage()+"'s command '"+sCmdName+"' defined twice"; - Dialog::OK( sWarning, "COMMAND_DEFINED_TWICE" ); - } - - RString sMessage; - if( GetMessageNameFromCommandName(sCmdName, sMessage) ) - { - SubscribeToMessage( sMessage ); - m_mapNameToCommands[sMessage] = apac; // sCmdName w/o "Message" at the end - } - else - { - m_mapNameToCommands[sCmdName] = apac; - } -} - -bool Actor::HasCommand( const RString &sCmdName ) const -{ - return GetCommand(sCmdName) != NULL; -} - -const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const -{ - map::const_iterator it = m_mapNameToCommands.find( sCommandName ); - if( it == m_mapNameToCommands.end() ) - return NULL; - return &it->second; -} - -void Actor::HandleMessage( const Message &msg ) -{ - PlayCommandNoRecurse( msg ); -} - -void Actor::PlayCommandNoRecurse( const Message &msg ) -{ - const apActorCommands *pCmd = GetCommand( msg.GetName() ); - if( pCmd != NULL ) - RunCommands( *pCmd, &msg.GetParamTable() ); -} - -void Actor::PushContext( lua_State *L ) -{ - // self.ctx should already exist - m_pLuaInstance->PushSelf( L ); - lua_getfield( L, -1, "ctx" ); - lua_remove( L, -2 ); -} - -void Actor::SetParent( Actor *pParent ) -{ - m_pParent = pParent; - - Lua *L = LUA->Get(); - int iTop = lua_gettop( L ); - - this->PushContext( L ); - lua_pushstring( L, "__index" ); - pParent->PushContext( L ); - lua_settable( L, -3 ); - - lua_settop( L, iTop ); - LUA->Release( L ); -} - -Actor::TweenInfo::TweenInfo() -{ - m_pTween = NULL; -} - -Actor::TweenInfo::~TweenInfo() -{ - delete m_pTween; -} - -Actor::TweenInfo::TweenInfo( const TweenInfo &cpy ) -{ - m_pTween = NULL; - *this = cpy; -} - -Actor::TweenInfo &Actor::TweenInfo::operator=( const TweenInfo &rhs ) -{ - delete m_pTween; - m_pTween = (rhs.m_pTween? rhs.m_pTween->Copy():NULL); - m_fTimeLeftInTween = rhs.m_fTimeLeftInTween; - m_fTweenTime = rhs.m_fTweenTime; - m_sCommandName = rhs.m_sCommandName; - return *this; -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the Actor. */ -class LunaActor : public Luna -{ -public: - static int name( T* p, lua_State *L ) { p->SetName(SArg(1)); return 0; } - static int sleep( T* p, lua_State *L ) { p->Sleep(FArg(1)); return 0; } - static int linear( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_LINEAR); return 0; } - static int accelerate( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_ACCELERATE); return 0; } - static int decelerate( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_DECELERATE); return 0; } - static int spring( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_SPRING); return 0; } - static int tween( T* p, lua_State *L ) - { - ITween *pTween = ITween::CreateFromStack( L, 2 ); - p->BeginTweening( FArg(1), pTween ); - return 0; - } - static int stoptweening( T* p, lua_State *L ) { p->StopTweening(); return 0; } - static int finishtweening( T* p, lua_State *L ) { p->FinishTweening(); return 0; } - static int hurrytweening( T* p, lua_State *L ) { p->HurryTweening(FArg(1)); return 0; } - static int GetTweenTimeLeft( T* p, lua_State *L ) { lua_pushnumber( L, p->GetTweenTimeLeft() ); return 1; } - static int x( T* p, lua_State *L ) { p->SetX(FArg(1)); return 0; } - static int y( T* p, lua_State *L ) { p->SetY(FArg(1)); return 0; } - static int z( T* p, lua_State *L ) { p->SetZ(FArg(1)); return 0; } - static int addx( T* p, lua_State *L ) { p->AddX(FArg(1)); return 0; } - static int addy( T* p, lua_State *L ) { p->AddY(FArg(1)); return 0; } - static int addz( T* p, lua_State *L ) { p->AddZ(FArg(1)); return 0; } - static int zoom( T* p, lua_State *L ) { p->SetZoom(FArg(1)); return 0; } - static int zoomx( T* p, lua_State *L ) { p->SetZoomX(FArg(1)); return 0; } - static int zoomy( T* p, lua_State *L ) { p->SetZoomY(FArg(1)); return 0; } - static int zoomz( T* p, lua_State *L ) { p->SetZoomZ(FArg(1)); return 0; } - static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); return 0; } - static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); return 0; } - static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); return 0; } - static int setsize( T* p, lua_State *L ) { p->SetWidth(FArg(1)); p->SetHeight(FArg(2)); return 0; } - static int SetWidth( T* p, lua_State *L ) { p->SetWidth(FArg(1)); return 0; } - static int SetHeight( T* p, lua_State *L ) { p->SetHeight(FArg(1)); return 0; } - static int basealpha( T* p, lua_State *L ) { p->SetBaseAlpha(FArg(1)); return 0; } - static int basezoom( T* p, lua_State *L ) { p->SetBaseZoom(FArg(1)); return 0; } - static int basezoomx( T* p, lua_State *L ) { p->SetBaseZoomX(FArg(1)); return 0; } - static int basezoomy( T* p, lua_State *L ) { p->SetBaseZoomY(FArg(1)); return 0; } - static int basezoomz( T* p, lua_State *L ) { p->SetBaseZoomZ(FArg(1)); return 0; } - static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; } - static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); return 0; } - static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); return 0; } - static int cropright( T* p, lua_State *L ) { p->SetCropRight(FArg(1)); return 0; } - static int cropbottom( T* p, lua_State *L ) { p->SetCropBottom(FArg(1)); return 0; } - static int fadeleft( T* p, lua_State *L ) { p->SetFadeLeft(FArg(1)); return 0; } - static int fadetop( T* p, lua_State *L ) { p->SetFadeTop(FArg(1)); return 0; } - static int faderight( T* p, lua_State *L ) { p->SetFadeRight(FArg(1)); return 0; } - static int fadebottom( T* p, lua_State *L ) { p->SetFadeBottom(FArg(1)); return 0; } - static int diffuse( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuse( c ); return 0; } - static int diffuseupperleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperLeft( c ); return 0; } - static int diffuseupperright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperRight( c ); return 0; } - static int diffuselowerleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerLeft( c ); return 0; } - static int diffuselowerright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerRight( c ); return 0; } - static int diffuseleftedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLeftEdge( c ); return 0; } - static int diffuserightedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseRightEdge( c ); return 0; } - static int diffusetopedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseTopEdge( c ); return 0; } - static int diffusebottomedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseBottomEdge( c ); return 0; } - static int diffusealpha( T* p, lua_State *L ) { p->SetDiffuseAlpha(FArg(1)); return 0; } - static int diffusecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseColor( c ); return 0; } - static int glow( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetGlow( c ); return 0; } - static int aux( T* p, lua_State *L ) { p->SetAux( FArg(1) ); return 0; } - static int getaux( T* p, lua_State *L ) { lua_pushnumber( L, p->GetAux() ); return 1; } - static int rotationx( T* p, lua_State *L ) { p->SetRotationX(FArg(1)); return 0; } - static int rotationy( T* p, lua_State *L ) { p->SetRotationY(FArg(1)); return 0; } - static int rotationz( T* p, lua_State *L ) { p->SetRotationZ(FArg(1)); return 0; } - static int addrotationx( T* p, lua_State *L ) { p->AddRotationX(FArg(1)); return 0; } - static int addrotationy( T* p, lua_State *L ) { p->AddRotationY(FArg(1)); return 0; } - static int addrotationz( T* p, lua_State *L ) { p->AddRotationZ(FArg(1)); return 0; } - static int getrotation( T* p, lua_State *L ) { lua_pushnumber(L, p->GetRotationX()); lua_pushnumber(L, p->GetRotationY()); lua_pushnumber(L, p->GetRotationZ()); return 3; } - static int baserotationx( T* p, lua_State *L ) { p->SetBaseRotationX(FArg(1)); return 0; } - static int baserotationy( T* p, lua_State *L ) { p->SetBaseRotationY(FArg(1)); return 0; } - static int baserotationz( T* p, lua_State *L ) { p->SetBaseRotationZ(FArg(1)); return 0; } - static int skewx( T* p, lua_State *L ) { p->SetSkewX(FArg(1)); return 0; } - static int skewy( T* p, lua_State *L ) { p->SetSkewY(FArg(1)); return 0; } - static int heading( T* p, lua_State *L ) { p->AddRotationH(FArg(1)); return 0; } - static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; } - static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; } - static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; } - static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); return 0; } - static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); return 0; } - static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); return 0; } - static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check(L, 1)); return 0; } - static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check(L, 1)); return 0; } - static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); return 0; } - static int valign( T* p, lua_State *L ) { p->SetVertAlign(FArg(1)); return 0; } - static int diffuseblink( T* p, lua_State *L ) { p->SetEffectDiffuseBlink(); return 0; } - static int diffuseshift( T* p, lua_State *L ) { p->SetEffectDiffuseShift(); return 0; } - static int diffuseramp( T* p, lua_State *L ) { p->SetEffectDiffuseRamp(); return 0; } - static int glowblink( T* p, lua_State *L ) { p->SetEffectGlowBlink(); return 0; } - static int glowshift( T* p, lua_State *L ) { p->SetEffectGlowShift(); return 0; } - static int glowramp( T* p, lua_State *L ) { p->SetEffectGlowRamp(); return 0; } - static int rainbow( T* p, lua_State *L ) { p->SetEffectRainbow(); return 0; } - static int wag( T* p, lua_State *L ) { p->SetEffectWag(); return 0; } - static int bounce( T* p, lua_State *L ) { p->SetEffectBounce(); return 0; } - static int bob( T* p, lua_State *L ) { p->SetEffectBob(); return 0; } - static int pulse( T* p, lua_State *L ) { p->SetEffectPulse(); return 0; } - static int spin( T* p, lua_State *L ) { p->SetEffectSpin(); return 0; } - static int vibrate( T* p, lua_State *L ) { p->SetEffectVibrate(); return 0; } - static int stopeffect( T* p, lua_State *L ) { p->StopEffect(); return 0; } - static int effectcolor1( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor1( c ); return 0; } - static int effectcolor2( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor2( c ); return 0; } - static int effectperiod( T* p, lua_State *L ) { p->SetEffectPeriod(FArg(1)); return 0; } - static int effecttiming( T* p, lua_State *L ) { p->SetEffectTiming(FArg(1),FArg(2),FArg(3),FArg(4)); return 0; } - static int effectoffset( T* p, lua_State *L ) { p->SetEffectOffset(FArg(1)); return 0; } - static int effectclock( T* p, lua_State *L ) { p->SetEffectClockString(SArg(1)); return 0; } - static int effectmagnitude( T* p, lua_State *L ) { p->SetEffectMagnitude( RageVector3(FArg(1),FArg(2),FArg(3)) ); return 0; } - static int geteffectmagnitude( T* p, lua_State *L ) { RageVector3 v = p->GetEffectMagnitude(); lua_pushnumber(L, v[0]); lua_pushnumber(L, v[1]); lua_pushnumber(L, v[2]); return 3; } - static int scaletocover( T* p, lua_State *L ) { p->ScaleToCover( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } - static int scaletofit( T* p, lua_State *L ) { p->ScaleToFitInside( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } - static int animate( T* p, lua_State *L ) { p->EnableAnimation(BIArg(1)); return 0; } - static int play( T* p, lua_State *L ) { p->EnableAnimation(true); return 0; } - static int pause( T* p, lua_State *L ) { p->EnableAnimation(false); return 0; } - static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); return 0; } - static int GetNumStates( T* p, lua_State *L ) { LuaHelpers::Push( L, p->GetNumStates() ); return 1; } - static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(BIArg(1)); return 0; } - static int SetTextureFiltering( T* p, lua_State *L ) { p->SetTextureFiltering(BArg(1)); return 0; } - static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); return 0; } - static int zbuffer( T* p, lua_State *L ) { p->SetUseZBuffer(BIArg(1)); return 0; } - static int ztest( T* p, lua_State *L ) { p->SetZTestMode((BIArg(1))?ZTEST_WRITE_ON_PASS:ZTEST_OFF); return 0; } - static int ztestmode( T* p, lua_State *L ) { p->SetZTestMode( Enum::Check(L, 1) ); return 0; } - static int zwrite( T* p, lua_State *L ) { p->SetZWrite(BIArg(1)); return 0; } - static int zbias( T* p, lua_State *L ) { p->SetZBias(FArg(1)); return 0; } - static int clearzbuffer( T* p, lua_State *L ) { p->SetClearZBuffer(BIArg(1)); return 0; } - static int backfacecull( T* p, lua_State *L ) { p->SetCullMode((BIArg(1)) ? CULL_BACK : CULL_NONE); return 0; } - static int cullmode( T* p, lua_State *L ) { p->SetCullMode( Enum::Check(L, 1)); return 0; } - static int visible( T* p, lua_State *L ) { p->SetVisible(BIArg(1)); return 0; } - static int hibernate( T* p, lua_State *L ) { p->SetHibernate(FArg(1)); return 0; } - static int draworder( T* p, lua_State *L ) { p->SetDrawOrder(IArg(1)); return 0; } - static int playcommand( T* p, lua_State *L ) - { - if( !lua_istable(L, 2) && !lua_isnoneornil(L, 2) ) - luaL_typerror( L, 2, "table or nil" ); - - LuaReference ParamTable; - lua_pushvalue( L, 2 ); - ParamTable.SetFromStack( L ); - - Message msg( SArg(1), ParamTable ); - p->HandleMessage( msg ); - - return 0; - } - static int queuecommand( T* p, lua_State *L ) { p->QueueCommand(SArg(1)); return 0; } - static int queuemessage( T* p, lua_State *L ) { p->QueueMessage(SArg(1)); return 0; } - static int addcommand( T* p, lua_State *L ) - { - LuaReference *pRef = new LuaReference; - pRef->SetFromStack( L ); - p->AddCommand( SArg(1), apActorCommands(pRef) ); - return 0; - } - static int GetCommand( T* p, lua_State *L ) - { - const apActorCommands *pCommand = p->GetCommand(SArg(1)); - if( pCommand == NULL ) - lua_pushnil( L ); - else - (*pCommand)->PushSelf(L); - - return 1; - } - static int RunCommandsRecursively( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TFUNCTION ); - if( !lua_istable(L, 2) && !lua_isnoneornil(L, 2) ) - luaL_typerror( L, 2, "table or nil" ); - - LuaReference ref; - lua_pushvalue( L, 1 ); - ref.SetFromStack( L ); - - LuaReference ParamTable; - lua_pushvalue( L, 2 ); - ParamTable.SetFromStack( L ); - - p->RunCommandsRecursively( ref, &ParamTable ); - return 0; - } - - static int GetX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetX() ); return 1; } - static int GetY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetY() ); return 1; } - static int GetZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZ() ); return 1; } - static int GetWidth( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnzoomedWidth() ); return 1; } - static int GetHeight( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnzoomedHeight() ); return 1; } - static int GetZoomedWidth( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomedWidth() ); return 1; } - static int GetZoomedHeight( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomedHeight() ); return 1; } - static int GetZoom( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoom() ); return 1; } - static int GetZoomX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomX() ); return 1; } - static int GetZoomY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomY() ); return 1; } - static int GetZoomZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomZ() ); return 1; } - static int GetBaseZoomX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomX() ); return 1; } - static int GetBaseZoomY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomY() ); return 1; } - static int GetBaseZoomZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomZ() ); return 1; } - static int GetRotationX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationX() ); return 1; } - static int GetRotationY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationY() ); return 1; } - static int GetRotationZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationZ() ); return 1; } - static int GetSecsIntoEffect( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecsIntoEffect() ); return 1; } - static int GetEffectDelta( T* p, lua_State *L ) { lua_pushnumber( L, p->GetEffectDelta() ); return 1; } - DEFINE_METHOD( GetDiffuse, GetDiffuse() ) - DEFINE_METHOD( GetGlow, GetGlow() ) - static int GetDiffuseAlpha( T* p, lua_State *L ) { lua_pushnumber( L, p->GetDiffuseAlpha() ); return 1; } - static int GetVisible( T* p, lua_State *L ) { lua_pushboolean( L, p->GetVisible() ); return 1; } - static int GetHAlign( T* p, lua_State *L ) { lua_pushnumber( L, p->GetHorizAlign() ); return 1; } - static int GetVAlign( T* p, lua_State *L ) { lua_pushnumber( L, p->GetVertAlign() ); return 1; } - - static int GetName( T* p, lua_State *L ) { lua_pushstring( L, p->GetName() ); return 1; } - static int GetParent( T* p, lua_State *L ) - { - Actor *pParent = p->GetParent(); - if( pParent == NULL ) - lua_pushnil( L ); - else - pParent->PushSelf(L); - return 1; - } - static int Draw( T* p, lua_State *L ) - { - LUA->YieldLua(); - p->Draw(); - LUA->UnyieldLua(); - return 0; - } - - LunaActor() - { - ADD_METHOD( name ); - ADD_METHOD( sleep ); - ADD_METHOD( linear ); - ADD_METHOD( accelerate ); - ADD_METHOD( decelerate ); - ADD_METHOD( spring ); - ADD_METHOD( tween ); - ADD_METHOD( stoptweening ); - ADD_METHOD( finishtweening ); - ADD_METHOD( hurrytweening ); - ADD_METHOD( GetTweenTimeLeft ); - ADD_METHOD( x ); - ADD_METHOD( y ); - ADD_METHOD( z ); - ADD_METHOD( addx ); - ADD_METHOD( addy ); - ADD_METHOD( addz ); - ADD_METHOD( zoom ); - ADD_METHOD( zoomx ); - ADD_METHOD( zoomy ); - ADD_METHOD( zoomz ); - ADD_METHOD( zoomto ); - ADD_METHOD( zoomtowidth ); - ADD_METHOD( zoomtoheight ); - ADD_METHOD( setsize ); - ADD_METHOD( SetWidth ); - ADD_METHOD( SetHeight ); - ADD_METHOD( basealpha ); - ADD_METHOD( basezoom ); - ADD_METHOD( basezoomx ); - ADD_METHOD( basezoomy ); - ADD_METHOD( basezoomz ); - ADD_METHOD( stretchto ); - ADD_METHOD( cropleft ); - ADD_METHOD( croptop ); - ADD_METHOD( cropright ); - ADD_METHOD( cropbottom ); - ADD_METHOD( fadeleft ); - ADD_METHOD( fadetop ); - ADD_METHOD( faderight ); - ADD_METHOD( fadebottom ); - ADD_METHOD( diffuse ); - ADD_METHOD( diffuseupperleft ); - ADD_METHOD( diffuseupperright ); - ADD_METHOD( diffuselowerleft ); - ADD_METHOD( diffuselowerright ); - ADD_METHOD( diffuseleftedge ); - ADD_METHOD( diffuserightedge ); - ADD_METHOD( diffusetopedge ); - ADD_METHOD( diffusebottomedge ); - ADD_METHOD( diffusealpha ); - ADD_METHOD( diffusecolor ); - ADD_METHOD( glow ); - ADD_METHOD( aux ); - ADD_METHOD( getaux ); - ADD_METHOD( rotationx ); - ADD_METHOD( rotationy ); - ADD_METHOD( rotationz ); - ADD_METHOD( addrotationx ); - ADD_METHOD( addrotationy ); - ADD_METHOD( addrotationz ); - ADD_METHOD( getrotation ); - ADD_METHOD( baserotationx ); - ADD_METHOD( baserotationy ); - ADD_METHOD( baserotationz ); - ADD_METHOD( skewx ); - ADD_METHOD( skewy ); - ADD_METHOD( heading ); - ADD_METHOD( pitch ); - ADD_METHOD( roll ); - ADD_METHOD( shadowlength ); - ADD_METHOD( shadowlengthx ); - ADD_METHOD( shadowlengthy ); - ADD_METHOD( shadowcolor ); - ADD_METHOD( horizalign ); - ADD_METHOD( vertalign ); - ADD_METHOD( halign ); - ADD_METHOD( valign ); - ADD_METHOD( diffuseblink ); - ADD_METHOD( diffuseshift ); - ADD_METHOD( diffuseramp ); - ADD_METHOD( glowblink ); - ADD_METHOD( glowshift ); - ADD_METHOD( glowramp ); - ADD_METHOD( rainbow ); - ADD_METHOD( wag ); - ADD_METHOD( bounce ); - ADD_METHOD( bob ); - ADD_METHOD( pulse ); - ADD_METHOD( spin ); - ADD_METHOD( vibrate ); - ADD_METHOD( stopeffect ); - ADD_METHOD( effectcolor1 ); - ADD_METHOD( effectcolor2 ); - ADD_METHOD( effectperiod ); - ADD_METHOD( effecttiming ); - ADD_METHOD( effectoffset ); - ADD_METHOD( effectclock ); - ADD_METHOD( effectmagnitude ); - ADD_METHOD( geteffectmagnitude ); - ADD_METHOD( scaletocover ); - ADD_METHOD( scaletofit ); - ADD_METHOD( animate ); - ADD_METHOD( play ); - ADD_METHOD( pause ); - ADD_METHOD( setstate ); - ADD_METHOD( GetNumStates ); - ADD_METHOD( texturewrapping ); - ADD_METHOD( SetTextureFiltering ); - ADD_METHOD( blend ); - ADD_METHOD( zbuffer ); - ADD_METHOD( ztest ); - ADD_METHOD( ztestmode ); - ADD_METHOD( zwrite ); - ADD_METHOD( zbias ); - ADD_METHOD( clearzbuffer ); - ADD_METHOD( backfacecull ); - ADD_METHOD( cullmode ); - ADD_METHOD( visible ); - ADD_METHOD( hibernate ); - ADD_METHOD( draworder ); - ADD_METHOD( playcommand ); - ADD_METHOD( queuecommand ); - ADD_METHOD( queuemessage ); - ADD_METHOD( addcommand ); - ADD_METHOD( GetCommand ); - ADD_METHOD( RunCommandsRecursively ); - - ADD_METHOD( GetX ); - ADD_METHOD( GetY ); - ADD_METHOD( GetZ ); - ADD_METHOD( GetWidth ); - ADD_METHOD( GetHeight ); - ADD_METHOD( GetZoomedWidth ); - ADD_METHOD( GetZoomedHeight ); - ADD_METHOD( GetZoom ); - ADD_METHOD( GetZoomX ); - ADD_METHOD( GetZoomY ); - ADD_METHOD( GetZoomZ ); - ADD_METHOD( GetRotationX ); - ADD_METHOD( GetRotationY ); - ADD_METHOD( GetRotationZ ); - ADD_METHOD( GetBaseZoomX ); - ADD_METHOD( GetBaseZoomY ); - ADD_METHOD( GetBaseZoomZ ); - ADD_METHOD( GetSecsIntoEffect ); - ADD_METHOD( GetEffectDelta ); - ADD_METHOD( GetDiffuse ); - ADD_METHOD( GetDiffuseAlpha ); - ADD_METHOD( GetGlow ); - ADD_METHOD( GetVisible ); - ADD_METHOD( GetHAlign ); - ADD_METHOD( GetVAlign ); - - ADD_METHOD( GetName ); - ADD_METHOD( GetParent ); - - ADD_METHOD( Draw ); - } -}; - -LUA_REGISTER_INSTANCED_BASE_CLASS( Actor ) -// lua end - - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Actor.h" +#include "RageDisplay.h" +#include "RageUtil.h" +#include "RageMath.h" +#include "RageLog.h" +#include "arch/Dialog/Dialog.h" +#include "Foreach.h" +#include "XmlFile.h" +#include "LuaBinding.h" +#include "ThemeManager.h" +#include "LuaReference.h" +#include "MessageManager.h" +#include "LightsManager.h" // for NUM_CabinetLight +#include "ActorUtil.h" +#include "Preference.h" +#include + +static Preference g_bShowMasks("ShowMasks", false); + +/** + * @brief Set up a hidden Actor that won't be drawn. + * + * It's useful to be able to construct a basic Actor in XML, in + * order to simply delay a Transition, or receive and send broadcasts. + * Since these actors will never draw, set them hidden by default. */ +class HiddenActor: public Actor +{ +public: + HiddenActor() { SetVisible(false); } + virtual HiddenActor *Copy() const; +}; +REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor ); + +float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; +float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0; + + +Actor *Actor::Copy() const { return new Actor(*this); } + +static float g_fCabinetLights[NUM_CabinetLight]; + +static const char *HorizAlignNames[] = { + "Left", + "Center", + "Right" +}; +XToString( HorizAlign ); +LuaXType( HorizAlign ); + +static const char *VertAlignNames[] = { + "Top", + "Middle", + "Bottom" +}; +XToString( VertAlign ); +LuaXType( VertAlign ); + +void Actor::SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBeatNoOffset ) +{ + g_fCurrentBGMTime = fTime; + g_fCurrentBGMBeat = fBeat; + + /* This timer is generally only used for effects tied to the background music + * when GameSoundManager is aligning music beats. Alignment doesn't handle + * g_fVisualDelaySeconds. */ + g_fCurrentBGMTimeNoOffset = fTimeNoOffset; + g_fCurrentBGMBeatNoOffset = fBeatNoOffset; +} + +void Actor::SetBGMLight( int iLightNumber, float fCabinetLights ) +{ + ASSERT( iLightNumber < NUM_CabinetLight ); + g_fCabinetLights[iLightNumber] = fCabinetLights; +} + +void Actor::InitState() +{ + StopTweening(); + + m_pTempState = NULL; + + m_baseRotation = RageVector3( 0, 0, 0 ); + m_baseScale = RageVector3( 1, 1, 1 ); + m_fBaseAlpha = 1; + + m_start.Init(); + m_current.Init(); + + m_fHorizAlign = 0.5f; + m_fVertAlign = 0.5f; +#if defined(SSC_FUTURES) + for( unsigned i = 0; i < m_Effects.size(); ++i ) + m_Effects[i] = no_effect; +#else + m_Effect = no_effect; +#endif + m_fSecsIntoEffect = 0; + m_fEffectDelta = 0; + m_fEffectRampUp = 0.5; + m_fEffectHoldAtHalf = 0; + m_fEffectRampDown = 0.5; + m_fEffectHoldAtZero = 0; + m_fEffectOffset = 0; + m_EffectClock = CLOCK_TIMER; + m_vEffectMagnitude = RageVector3(0,0,10); + m_effectColor1 = RageColor(1,1,1,1); + m_effectColor2 = RageColor(1,1,1,1); + + m_bVisible = true; + m_fShadowLengthX = 0; + m_fShadowLengthY = 0; + m_ShadowColor = RageColor(0,0,0,0.5); + m_bIsAnimating = true; + m_fHibernateSecondsLeft = 0; + m_iDrawOrder = 0; + + m_bTextureWrapping = false; + m_bTextureFiltering = true; + + m_BlendMode = BLEND_NORMAL; + m_fZBias = 0; + m_bClearZBuffer = false; + m_ZTestMode = ZTEST_OFF; + m_bZWrite = false; + m_CullMode = CULL_NONE; +} + +static bool GetMessageNameFromCommandName( const RString &sCommandName, RString &sMessageNameOut ) +{ + if( sCommandName.Right(7) == "Message" ) + { + sMessageNameOut = sCommandName.Left(sCommandName.size()-7); + return true; + } + else + { + return false; + } +} + +Actor::Actor() +{ + m_pLuaInstance = new LuaClass; + Lua *L = LUA->Get(); + m_pLuaInstance->PushSelf( L ); + lua_newtable( L ); + lua_pushvalue( L, -1 ); + lua_setmetatable( L, -2 ); + lua_setfield( L, -2, "ctx" ); + lua_pop( L, 1 ); + LUA->Release( L ); + + + m_size = RageVector2( 1, 1 ); + InitState(); + m_pParent = NULL; + m_bFirstUpdate = true; +} + +Actor::~Actor() +{ + StopTweening(); + UnsubscribeAll(); +} + +Actor::Actor( const Actor &cpy ): + MessageSubscriber( cpy ) +{ + /* Don't copy an Actor in the middle of rendering. */ + ASSERT( cpy.m_pTempState == NULL ); + m_pTempState = NULL; + +#define CPY(x) x = cpy.x + CPY( m_sName ); + CPY( m_pParent ); + CPY( m_pLuaInstance ); + + CPY( m_baseRotation ); + CPY( m_baseScale ); + CPY( m_fBaseAlpha ); + + + CPY( m_size ); + CPY( m_current ); + CPY( m_start ); + for( unsigned i = 0; i < cpy.m_Tweens.size(); ++i ) + m_Tweens.push_back( new TweenStateAndInfo(*cpy.m_Tweens[i]) ); + + CPY( m_bFirstUpdate ); + + CPY( m_fHorizAlign ); + CPY( m_fVertAlign ); +#if defined(SSC_FUTURES) + // I'm a bit worried about this -aj + for( unsigned i = 0; i < cpy.m_Effects.size(); ++i ) + m_Effects.push_back( (*cpy.m_Effects[i]) ); +#else + CPY( m_Effect ); +#endif + CPY( m_fSecsIntoEffect ); + CPY( m_fEffectDelta ); + CPY( m_fEffectRampUp ); + CPY( m_fEffectHoldAtHalf ); + CPY( m_fEffectRampDown ); + CPY( m_fEffectHoldAtZero ); + CPY( m_fEffectOffset ); + CPY( m_EffectClock ); + + CPY( m_effectColor1 ); + CPY( m_effectColor2 ); + CPY( m_vEffectMagnitude ); + + CPY( m_bVisible ); + CPY( m_fHibernateSecondsLeft ); + CPY( m_fShadowLengthX ); + CPY( m_fShadowLengthY ); + CPY( m_ShadowColor ); + CPY( m_bIsAnimating ); + CPY( m_iDrawOrder ); + + CPY( m_bTextureWrapping ); + CPY( m_bTextureFiltering ); + CPY( m_BlendMode ); + CPY( m_bClearZBuffer ); + CPY( m_ZTestMode ); + CPY( m_bZWrite ); + CPY( m_fZBias ); + CPY( m_CullMode ); + + CPY( m_mapNameToCommands ); +#undef CPY +} + +/* XXX: This calls InitCommand, which must happen after all other + * initialization (eg. ActorFrame loading children). However, it + * also loads input variables, which should happen first. The + * former is more important. */ +void Actor::LoadFromNode( const XNode* pNode ) +{ + Lua *L = LUA->Get(); + FOREACH_CONST_Attr( pNode, pAttr ) + { + // Load Name, if any. + const RString &sKeyName = pAttr->first; + const XNodeValue *pValue = pAttr->second; + if( sKeyName == "Name" ) SetName( pValue->GetValue() ); + else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( pValue->GetValue() ); + else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( pValue->GetValue() ); + else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( pValue->GetValue() ); + else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( pValue->GetValue() ); + else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( pValue->GetValue() ); + else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( pValue->GetValue() ); + else if( EndsWith(sKeyName,"Command") ) + { + LuaReference *pRef = new LuaReference; + pValue->PushValue( L ); + pRef->SetFromStack( L ); + RString sCmdName = sKeyName.Left( sKeyName.size()-7 ); + AddCommand( sCmdName, apActorCommands( pRef ) ); + } + } + + LUA->Release( L ); + + // Don't recurse Init. It gets called once for every Actor when the + // Actor is loaded, and we don't want to call it again. + PlayCommandNoRecurse( Message("Init") ); +} + +void Actor::Draw() +{ + if( !m_bVisible ) + return; // early abort + if( m_fHibernateSecondsLeft > 0 ) + return; // early abort + if( this->EarlyAbortDraw() ) + return; + + // call the most-derived versions + this->BeginDraw(); + this->DrawPrimitives(); // call the most-derived version of DrawPrimitives(); + this->EndDraw(); +} + +void Actor::BeginDraw() // set the world matrix and calculate actor properties +{ + DISPLAY->PushMatrix(); // we're actually going to do some drawing in this function + + // Somthing below may set m_pTempState to tempState + m_pTempState = &m_current; + + // set temporary drawing properties based on Effects + static TweenState tempState; + + // todo: account for SSC_FUTURES -aj + if( m_Effect == no_effect ) + { + } + else + { + m_pTempState = &tempState; + tempState = m_current; + + const float fTotalPeriod = GetEffectPeriod(); + ASSERT( fTotalPeriod > 0 ); + const float fTimeIntoEffect = fmodfp( m_fSecsIntoEffect+m_fEffectOffset, fTotalPeriod ); + + float fPercentThroughEffect; + if( fTimeIntoEffect < m_fEffectRampUp ) + { + fPercentThroughEffect = SCALE( + fTimeIntoEffect, + 0, + m_fEffectRampUp, + 0.0f, + 0.5f ); + } + else if( fTimeIntoEffect < m_fEffectRampUp + m_fEffectHoldAtHalf ) + { + fPercentThroughEffect = 0.5f; + } + else if( fTimeIntoEffect < m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown ) + { + fPercentThroughEffect = SCALE( + fTimeIntoEffect, + m_fEffectRampUp + m_fEffectHoldAtHalf, + m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown, + 0.5f, + 1.0f ); + } + else + { + fPercentThroughEffect = 0; + } + ASSERT_M( fPercentThroughEffect >= 0 && fPercentThroughEffect <= 1, + ssprintf("PercentThroughEffect: %f", fPercentThroughEffect) ); + + bool bBlinkOn = fPercentThroughEffect > 0.5f; + float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; + ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1, + ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) ); + float fOriginalAlpha = tempState.diffuse[0].a; + + // todo: account for SSC_FUTURES -aj + switch( m_Effect ) + { + case diffuse_blink: + /* XXX: Should diffuse_blink and diffuse_shift multiply the tempState color? + * (That would have the same effect with 1,1,1,1, and allow tweening the diffuse + * while blinking and shifting.) */ + for(int i=0; i<4; i++) + { + tempState.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2; + tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing + } + break; + case diffuse_shift: + for(int i=0; i<4; i++) + { + tempState.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); + tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing + } + break; + case diffuse_ramp: + for(int i=0; i<4; i++) + { + tempState.diffuse[i] = m_effectColor1*fPercentThroughEffect + m_effectColor2*(1.0f-fPercentThroughEffect); + tempState.diffuse[i].a *= fOriginalAlpha; // multiply the alphas so we can fade even while an effect is playing + } + break; + case glow_blink: + tempState.glow = bBlinkOn ? m_effectColor1 : m_effectColor2; + tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! + break; + case glow_shift: + tempState.glow = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); + tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! + break; + case glow_ramp: + tempState.glow = m_effectColor1*fPercentThroughEffect + m_effectColor2*(1.0f-fPercentThroughEffect); + tempState.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! + break; + case rainbow: + tempState.diffuse[0] = RageColor( + RageFastCos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, + RageFastCos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, + RageFastCos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, + fOriginalAlpha ); + for( int i=1; i<4; i++ ) + tempState.diffuse[i] = tempState.diffuse[0]; + break; + case wag: + tempState.rotation += m_vEffectMagnitude * RageFastSin( fPercentThroughEffect * 2.0f * PI ); + break; + case spin: + // nothing needs to be here + break; + case vibrate: + tempState.pos.x += m_vEffectMagnitude.x * randomf(-1.0f, 1.0f) * GetZoom(); + tempState.pos.y += m_vEffectMagnitude.y * randomf(-1.0f, 1.0f) * GetZoom(); + tempState.pos.z += m_vEffectMagnitude.z * randomf(-1.0f, 1.0f) * GetZoom(); + break; + case bounce: + { + float fPercentOffset = RageFastSin( fPercentThroughEffect*PI ); + tempState.pos += m_vEffectMagnitude * fPercentOffset; + tempState.pos.x = roundf( tempState.pos.x ); + tempState.pos.y = roundf( tempState.pos.y ); + tempState.pos.z = roundf( tempState.pos.z ); + } + break; + case bob: + { + float fPercentOffset = RageFastSin( fPercentThroughEffect*PI*2 ); + tempState.pos += m_vEffectMagnitude * fPercentOffset; + tempState.pos.x = roundf( tempState.pos.x ); + tempState.pos.y = roundf( tempState.pos.y ); + tempState.pos.z = roundf( tempState.pos.z ); + } + break; + case pulse: + { + float fMinZoom = m_vEffectMagnitude[0]; + float fMaxZoom = m_vEffectMagnitude[1]; + float fPercentOffset = RageFastSin( fPercentThroughEffect*PI ); + float fZoom = SCALE( fPercentOffset, 0.f, 1.f, fMinZoom, fMaxZoom ); + tempState.scale *= fZoom; + + // Use the color as a Vector3 to scale the effect for added control + RageColor c = SCALE( fPercentOffset, 0.f, 1.f, m_effectColor1, m_effectColor2 ); + tempState.scale.x *= c.r; + tempState.scale.y *= c.g; + tempState.scale.z *= c.b; + } + break; + default: + ASSERT(0); // invalid Effect + } + } + + if( m_fBaseAlpha != 1 ) + { + if( m_pTempState != &tempState ) + { + m_pTempState = &tempState; + tempState = m_current; + } + + for( int i=0; i<4; i++ ) + tempState.diffuse[i].a *= m_fBaseAlpha; + } + + if( m_pTempState->pos.x != 0 || m_pTempState->pos.y != 0 || m_pTempState->pos.z != 0 ) + { + RageMatrix m; + RageMatrixTranslate( + &m, + m_pTempState->pos.x, + m_pTempState->pos.y, + m_pTempState->pos.z + ); + DISPLAY->PreMultMatrix( m ); + } + + { + /* The only time rotation and quat should normally be used simultaneously + * is for m_baseRotation. Most objects aren't rotated at all, so optimize + * that case. */ + const float fRotateX = m_pTempState->rotation.x + m_baseRotation.x; + const float fRotateY = m_pTempState->rotation.y + m_baseRotation.y; + const float fRotateZ = m_pTempState->rotation.z + m_baseRotation.z; + + if( fRotateX != 0 || fRotateY != 0 || fRotateZ != 0 ) + { + RageMatrix m; + RageMatrixRotationXYZ( &m, fRotateX, fRotateY, fRotateZ ); + DISPLAY->PreMultMatrix( m ); + } + } + + // handle scaling + { + const float fScaleX = m_pTempState->scale.x * m_baseScale.x; + const float fScaleY = m_pTempState->scale.y * m_baseScale.y; + const float fScaleZ = m_pTempState->scale.z * m_baseScale.z; + + if( fScaleX != 1 || fScaleY != 1 || fScaleZ != 1 ) + { + RageMatrix m; + RageMatrixScale( + &m, + fScaleX, + fScaleY, + fScaleZ ); + DISPLAY->PreMultMatrix( m ); + } + } + + // handle alignment; most actors have default alignment. + if( unlikely(m_fHorizAlign != 0.5f || m_fVertAlign != 0.5f) ) + { + float fX = SCALE( m_fHorizAlign, 0.0f, 1.0f, +m_size.x/2.0f, -m_size.x/2.0f ); + float fY = SCALE( m_fVertAlign, 0.0f, 1.0f, +m_size.y/2.0f, -m_size.y/2.0f ); + RageMatrix m; + RageMatrixTranslate( + &m, + fX, + fY, + 0 + ); + DISPLAY->PreMultMatrix( m ); + } + + if( m_pTempState->quat.x != 0 || m_pTempState->quat.y != 0 || m_pTempState->quat.z != 0 || m_pTempState->quat.w != 1 ) + { + RageMatrix mat; + RageMatrixFromQuat( &mat, m_pTempState->quat ); + + DISPLAY->MultMatrix(mat); + } + + // handle skews + if( m_pTempState->fSkewX != 0 ) + { + DISPLAY->SkewX( m_pTempState->fSkewX ); + } + + if( m_pTempState->fSkewY != 0 ) + { + DISPLAY->SkewY( m_pTempState->fSkewY ); + } + +} + +void Actor::SetGlobalRenderStates() +{ + // set Actor-defined render states + if( !g_bShowMasks.Get() || m_BlendMode != BLEND_NO_EFFECT ) + DISPLAY->SetBlendMode( m_BlendMode ); + DISPLAY->SetZWrite( m_bZWrite ); + DISPLAY->SetZTestMode( m_ZTestMode ); + + // BLEND_NO_EFFECT is used to draw masks to the Z-buffer, which always wants + // Z-bias enabled. + if( m_fZBias == 0 && m_BlendMode == BLEND_NO_EFFECT ) + DISPLAY->SetZBias( 1.0f ); + else + DISPLAY->SetZBias( m_fZBias ); + + if( m_bClearZBuffer ) + DISPLAY->ClearZBuffer(); + DISPLAY->SetCullMode( m_CullMode ); +} + +void Actor::SetTextureRenderStates() +{ + DISPLAY->SetTextureWrapping( TextureUnit_1, m_bTextureWrapping ); + DISPLAY->SetTextureFiltering( TextureUnit_1, m_bTextureFiltering ); +} + +void Actor::EndDraw() +{ + DISPLAY->PopMatrix(); + m_pTempState = NULL; +} + +void Actor::UpdateTweening( float fDeltaTime ) +{ + while( 1 ) + { + if( m_Tweens.empty() ) // nothing to do + return; + + if( fDeltaTime == 0 ) // nothing will change + return; + + // update current tween state + // earliest tween + TweenState &TS = m_Tweens[0]->state; + TweenInfo &TI = m_Tweens[0]->info; + + bool bBeginning = TI.m_fTimeLeftInTween == TI.m_fTweenTime; + + float fSecsToSubtract = min( TI.m_fTimeLeftInTween, fDeltaTime ); + TI.m_fTimeLeftInTween -= fSecsToSubtract; + fDeltaTime -= fSecsToSubtract; + + RString sCommand = TI.m_sCommandName; + if( bBeginning ) // we are just beginning this tween + m_start = m_current; // set the start position + + if( TI.m_fTimeLeftInTween == 0 ) // Current tween is over. Stop. + { + m_current = TS; + + // delete the head tween + delete m_Tweens.front(); + m_Tweens.erase( m_Tweens.begin() ); + } + else // in the middle of tweening. Recalcute the current position. + { + const float fPercentThroughTween = 1-(TI.m_fTimeLeftInTween / TI.m_fTweenTime); + + // distort the percentage if appropriate + float fPercentAlongPath = TI.m_pTween->Tween( fPercentThroughTween ); + TweenState::MakeWeightedAverage( m_current, m_start, TS, fPercentAlongPath ); + } + + if( bBeginning ) + { + // Execute the command in this tween (if any). Do this last, and don't + // access TI or TS after, since this may modify the tweening queue. + if( !sCommand.empty() ) + { + if( sCommand.Left(1) == "!" ) + MESSAGEMAN->Broadcast( sCommand.substr(1) ); + else + this->PlayCommand( sCommand ); + } + } + } +} + +bool Actor::IsFirstUpdate() const +{ + return m_bFirstUpdate; +} + +void Actor::Update( float fDeltaTime ) +{ +// LOG->Trace( "Actor::Update( %f )", fDeltaTime ); + ASSERT_M( fDeltaTime >= 0, ssprintf("DeltaTime: %f",fDeltaTime) ); + + if( m_fHibernateSecondsLeft > 0 ) + { + m_fHibernateSecondsLeft -= fDeltaTime; + if( m_fHibernateSecondsLeft > 0 ) + return; + + // Grab the leftover time. + fDeltaTime = -m_fHibernateSecondsLeft; + m_fHibernateSecondsLeft = 0; + } + + this->UpdateInternal( fDeltaTime ); +} + +void Actor::UpdateInternal( float fDeltaTime ) +{ + if( m_bFirstUpdate ) + m_bFirstUpdate = false; + + switch( m_EffectClock ) + { + case CLOCK_TIMER: + m_fSecsIntoEffect += fDeltaTime; + m_fEffectDelta = fDeltaTime; + + /* Wrap the counter, so it doesn't increase indefinitely (causing loss + * of precision if a screen is left to sit for a day). */ + if( m_fSecsIntoEffect >= GetEffectPeriod() ) + m_fSecsIntoEffect -= GetEffectPeriod(); + break; + + case CLOCK_TIMER_GLOBAL: + { + float fTime = RageTimer::GetTimeSinceStartFast(); + m_fEffectDelta = fTime - m_fSecsIntoEffect; + m_fSecsIntoEffect = fTime; + break; + } + + case CLOCK_BGM_BEAT: + m_fEffectDelta = g_fCurrentBGMBeat - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_fCurrentBGMBeat; + break; + + case CLOCK_BGM_TIME: + m_fEffectDelta = g_fCurrentBGMTime - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_fCurrentBGMTime; + break; + + case CLOCK_BGM_BEAT_NO_OFFSET: + m_fEffectDelta = g_fCurrentBGMBeatNoOffset - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_fCurrentBGMBeatNoOffset; + break; + + case CLOCK_BGM_TIME_NO_OFFSET: + m_fEffectDelta = g_fCurrentBGMTimeNoOffset - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_fCurrentBGMTimeNoOffset; + break; + + default: + if( m_EffectClock >= CLOCK_LIGHT_1 && m_EffectClock <= CLOCK_LIGHT_LAST ) + { + int i = m_EffectClock - CLOCK_LIGHT_1; + m_fEffectDelta = g_fCabinetLights[i] - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_fCabinetLights[i]; + } + break; + } + + // update effect + // todo: account for SSC_FUTURES -aj + switch( m_Effect ) + { + case spin: + m_current.rotation += m_fEffectDelta*m_vEffectMagnitude; + wrap( m_current.rotation.x, 360 ); + wrap( m_current.rotation.y, 360 ); + wrap( m_current.rotation.z, 360 ); + break; + } + + UpdateTweening( fDeltaTime ); +} + +RString Actor::GetLineage() const +{ + RString sPath; + + if( m_pParent ) + sPath = m_pParent->GetLineage() + '/'; + sPath += ssprintf( "<%s> %s", typeid(*this).name(), m_sName.c_str() ); + return sPath; +} + +void Actor::BeginTweening( float time, ITween *pTween ) +{ + ASSERT( time >= 0 ); + + time = max( time, 0 ); + + // If the number of tweens to ever gets this large, there's probably an infinitely + // recursing ActorCommand. + if( m_Tweens.size() > 50 ) + { + RString sError = ssprintf( "Tween overflow: \"%s\"; infinitely recursing ActorCommand?", GetLineage().c_str() ); + + LOG->Warn( "%s", sError.c_str() ); + Dialog::OK( sError ); + FinishTweening(); + } + + // add a new TweenState to the tail, and initialize it + m_Tweens.push_back( new TweenStateAndInfo ); + + // latest + TweenState &TS = m_Tweens.back()->state; + TweenInfo &TI = m_Tweens.back()->info; + + if( m_Tweens.size() >= 2 ) // if there was already a TS on the stack + { + // initialize the new TS from the last TS in the list + TS = m_Tweens[m_Tweens.size()-2]->state; + } + else + { + // This new TS is the only TS. + // Set our tween starting and ending values to the current position. + TS = m_current; + } + + TI.m_pTween = pTween; + TI.m_fTweenTime = time; + TI.m_fTimeLeftInTween = time; +} + +void Actor::BeginTweening( float time, TweenType tt ) +{ + ITween *pTween = ITween::CreateFromType( tt ); + BeginTweening( time, pTween ); +} + +void Actor::StopTweening() +{ + for( unsigned i = 0; i < m_Tweens.size(); ++i ) + delete m_Tweens[i]; + m_Tweens.clear(); +} + +void Actor::FinishTweening() +{ + if( !m_Tweens.empty() ) + m_current = DestTweenState(); + StopTweening(); +} + +void Actor::HurryTweening( float factor ) +{ + for( unsigned i = 0; i < m_Tweens.size(); ++i ) + { + m_Tweens[i]->info.m_fTimeLeftInTween *= factor; + m_Tweens[i]->info.m_fTweenTime *= factor; + } +} + +void Actor::ScaleTo( const RectF &rect, StretchType st ) +{ + // width and height of rectangle + float rect_width = rect.GetWidth(); + float rect_height = rect.GetHeight(); + + if( rect_width < 0 ) SetRotationY( 180 ); + if( rect_height < 0 ) SetRotationX( 180 ); + + // zoom fActor needed to scale the Actor to fill the rectangle + float fNewZoomX = fabsf(rect_width / m_size.x); + float fNewZoomY = fabsf(rect_height / m_size.y); + + float fNewZoom = 0.f; + switch( st ) + { + case cover: + fNewZoom = fNewZoomX>fNewZoomY ? fNewZoomX : fNewZoomY; // use larger zoom + break; + case fit_inside: + fNewZoom = fNewZoomX>fNewZoomY ? fNewZoomY : fNewZoomX; // use smaller zoom + break; + } + + SetX( rect.left + rect_width * m_fHorizAlign ); + SetY( rect.top + rect_height * m_fVertAlign ); + + SetZoom( fNewZoom ); +} + +void Actor::SetEffectClockString( const RString &s ) +{ + if (s.EqualsNoCase("timer")) this->SetEffectClock( CLOCK_TIMER ); + if (s.EqualsNoCase("timerglobal")) this->SetEffectClock( CLOCK_TIMER_GLOBAL ); + else if(s.EqualsNoCase("beat")) this->SetEffectClock( CLOCK_BGM_BEAT ); + else if(s.EqualsNoCase("music")) this->SetEffectClock( CLOCK_BGM_TIME ); + else if(s.EqualsNoCase("bgm")) this->SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated + else if(s.EqualsNoCase("musicnooffset"))this->SetEffectClock( CLOCK_BGM_TIME_NO_OFFSET ); + else if(s.EqualsNoCase("beatnooffset")) this->SetEffectClock( CLOCK_BGM_BEAT_NO_OFFSET ); + else + { + CabinetLight cl = StringToCabinetLight( s ); + if( cl != CabinetLight_Invalid ) + { + this->SetEffectClock( (EffectClock) (cl + CLOCK_LIGHT_1) ); + return; + } + else + ASSERT(0); + } +} + +void Actor::StretchTo( const RectF &r ) +{ + // width and height of rectangle + float width = r.GetWidth(); + float height = r.GetHeight(); + + // center of the rectangle + float cx = r.left + width/2.0f; + float cy = r.top + height/2.0f; + + // zoom fActor needed to scale the Actor to fill the rectangle + float fNewZoomX = width / m_size.x; + float fNewZoomY = height / m_size.y; + + SetXY( cx, cy ); + SetZoomX( fNewZoomX ); + SetZoomY( fNewZoomY ); +} + + +void Actor::SetEffectPeriod( float fTime ) +{ + ASSERT( fTime > 0 ); + m_fEffectRampUp = fTime/2; + m_fEffectHoldAtHalf = 0; + m_fEffectRampDown = fTime/2; + m_fEffectHoldAtZero = 0; +} + +float Actor::GetEffectPeriod() const +{ + return m_fEffectRampUp + m_fEffectHoldAtHalf + m_fEffectRampDown + m_fEffectHoldAtZero; +} + +void Actor::SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, float fAtZero ) +{ + m_fEffectRampUp = fRampUp; + m_fEffectHoldAtHalf = fAtHalf; + m_fEffectRampDown = fRampDown; + m_fEffectHoldAtZero = fAtZero; + ASSERT( GetEffectPeriod() > 0 ); +} + +// effect "macros" + +void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != diffuse_blink ) + { + m_Effect = diffuse_blink; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != diffuse_shift ) + { + m_Effect = diffuse_shift; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != diffuse_ramp ) + { + m_Effect = diffuse_ramp; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != glow_blink ) + { + m_Effect = glow_blink; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != glow_shift ) + { + m_Effect = glow_shift; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != glow_ramp ) + { + m_Effect = glow_ramp; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); + m_effectColor1 = c1; + m_effectColor2 = c2; +} + +void Actor::SetEffectRainbow( float fEffectPeriodSeconds ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != rainbow ) + { + m_Effect = rainbow; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fEffectPeriodSeconds ); +} + +void Actor::SetEffectWag( float fPeriod, RageVector3 vect ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect != wag ) + { + m_Effect = wag; + m_fSecsIntoEffect = 0; + } + SetEffectPeriod( fPeriod ); + m_vEffectMagnitude = vect; +} + +void Actor::SetEffectBounce( float fPeriod, RageVector3 vect ) +{ + // todo: account for SSC_FUTURES -aj + m_Effect = bounce; + SetEffectPeriod( fPeriod ); + m_vEffectMagnitude = vect; + m_fSecsIntoEffect = 0; +} + +void Actor::SetEffectBob( float fPeriod, RageVector3 vect ) +{ + // todo: account for SSC_FUTURES -aj + if( m_Effect!=bob || GetEffectPeriod() != fPeriod ) + { + m_Effect = bob; + SetEffectPeriod( fPeriod ); + m_fSecsIntoEffect = 0; + } + m_vEffectMagnitude = vect; +} + +void Actor::SetEffectSpin( RageVector3 vect ) +{ + // todo: account for SSC_FUTURES -aj + m_Effect = spin; + m_vEffectMagnitude = vect; +} + +void Actor::SetEffectVibrate( RageVector3 vect ) +{ + // todo: account for SSC_FUTURES -aj + m_Effect = vibrate; + m_vEffectMagnitude = vect; +} + +void Actor::SetEffectPulse( float fPeriod, float fMinZoom, float fMaxZoom ) +{ + // todo: account for SSC_FUTURES -aj + m_Effect = pulse; + SetEffectPeriod( fPeriod ); + m_vEffectMagnitude[0] = fMinZoom; + m_vEffectMagnitude[1] = fMaxZoom; +} + + +void Actor::AddRotationH( float rot ) +{ + RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromH(rot) ); +} + +void Actor::AddRotationP( float rot ) +{ + RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromP(rot) ); +} + +void Actor::AddRotationR( float rot ) +{ + RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) ); +} + +void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTable ) +{ + Lua *L = LUA->Get(); + + // function + cmds.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + + // 1st parameter + this->PushSelf( L ); + + // 2nd parameter + if( pParamTable == NULL ) + lua_pushnil( L ); + else + pParamTable->PushSelf( L ); + + // call function with 2 arguments and 0 results + RString sError; + if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) + LOG->Warn( "Error playing command: %s", sError.c_str() ); + + LUA->Release(L); +} + +float Actor::GetTweenTimeLeft() const +{ + float tot = 0; + + tot += m_fHibernateSecondsLeft; + + for( unsigned i=0; iinfo.m_fTimeLeftInTween; + + return tot; +} + +/* This is a hack to change all tween states while leaving existing tweens alone. + * + * Hmm. Most commands actually act on a TweenStateAndInfo, not the Actor itself. + * Conceptually, it wouldn't be hard to give TweenState a presence in Lua, so + * we can simply say eg. "for x in states(Actor) do x.SetDiffuseColor(c) end". + * However, we'd then have to give every TweenState a userdata in Lua while it's + * being manipulated, which would add overhead ... */ +void Actor::SetGlobalDiffuseColor( RageColor c ) +{ + for( int i=0; i<4; i++ ) // color, not alpha + { + for( unsigned ts = 0; ts < m_Tweens.size(); ++ts ) + { + m_Tweens[ts]->state.diffuse[i].r = c.r; + m_Tweens[ts]->state.diffuse[i].g = c.g; + m_Tweens[ts]->state.diffuse[i].b = c.b; + } + m_current.diffuse[i].r = c.r; + m_current.diffuse[i].g = c.g; + m_current.diffuse[i].b = c.b; + m_start.diffuse[i].r = c.r; + m_start.diffuse[i].g = c.g; + m_start.diffuse[i].b = c.b; + } +} + +void Actor::SetDiffuseColor( RageColor c ) +{ + for( int i=0; i<4; i++ ) + { + DestTweenState().diffuse[i].r = c.r; + DestTweenState().diffuse[i].g = c.g; + DestTweenState().diffuse[i].b = c.b; + } +} + + +void Actor::TweenState::Init() +{ + pos = RageVector3( 0, 0, 0 ); + rotation = RageVector3( 0, 0, 0 ); + quat = RageVector4( 0, 0, 0, 1 ); + scale = RageVector3( 1, 1, 1 ); + fSkewX = 0; + fSkewY = 0; + crop = RectF( 0,0,0,0 ); + fade = RectF( 0,0,0,0 ); + for( int i=0; i<4; i++ ) + diffuse[i] = RageColor( 1, 1, 1, 1 ); + glow = RageColor( 1, 1, 1, 0 ); + aux = 0; +} + +bool Actor::TweenState::operator==( const TweenState &other ) const +{ +#define COMPARE( x ) if( x != other.x ) return false; + COMPARE( pos ); + COMPARE( rotation ); + COMPARE( quat ); + COMPARE( scale ); + COMPARE( fSkewX ); + COMPARE( fSkewY ); + COMPARE( crop ); + COMPARE( fade ); + for( unsigned i=0; iinfo; + TI.m_sCommandName = sCommandName; +} + +void Actor::QueueMessage( const RString& sMessageName ) +{ + // Hack: use "!" as a marker to broadcast a command, instead of playing a + // command, so we don't have to add yet another element to every tween + // state for this rarely-used command. + BeginTweening( 0, TWEEN_LINEAR ); + TweenInfo &TI = m_Tweens.back()->info; + TI.m_sCommandName = "!" + sMessageName; +} + +void Actor::AddCommand( const RString &sCmdName, apActorCommands apac ) +{ + if( HasCommand(sCmdName) ) + { + RString sWarning = GetLineage()+"'s command '"+sCmdName+"' defined twice"; + Dialog::OK( sWarning, "COMMAND_DEFINED_TWICE" ); + } + + RString sMessage; + if( GetMessageNameFromCommandName(sCmdName, sMessage) ) + { + SubscribeToMessage( sMessage ); + m_mapNameToCommands[sMessage] = apac; // sCmdName w/o "Message" at the end + } + else + { + m_mapNameToCommands[sCmdName] = apac; + } +} + +bool Actor::HasCommand( const RString &sCmdName ) const +{ + return GetCommand(sCmdName) != NULL; +} + +const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const +{ + map::const_iterator it = m_mapNameToCommands.find( sCommandName ); + if( it == m_mapNameToCommands.end() ) + return NULL; + return &it->second; +} + +void Actor::HandleMessage( const Message &msg ) +{ + PlayCommandNoRecurse( msg ); +} + +void Actor::PlayCommandNoRecurse( const Message &msg ) +{ + const apActorCommands *pCmd = GetCommand( msg.GetName() ); + if( pCmd != NULL ) + RunCommands( *pCmd, &msg.GetParamTable() ); +} + +void Actor::PushContext( lua_State *L ) +{ + // self.ctx should already exist + m_pLuaInstance->PushSelf( L ); + lua_getfield( L, -1, "ctx" ); + lua_remove( L, -2 ); +} + +void Actor::SetParent( Actor *pParent ) +{ + m_pParent = pParent; + + Lua *L = LUA->Get(); + int iTop = lua_gettop( L ); + + this->PushContext( L ); + lua_pushstring( L, "__index" ); + pParent->PushContext( L ); + lua_settable( L, -3 ); + + lua_settop( L, iTop ); + LUA->Release( L ); +} + +Actor::TweenInfo::TweenInfo() +{ + m_pTween = NULL; +} + +Actor::TweenInfo::~TweenInfo() +{ + delete m_pTween; +} + +Actor::TweenInfo::TweenInfo( const TweenInfo &cpy ) +{ + m_pTween = NULL; + *this = cpy; +} + +Actor::TweenInfo &Actor::TweenInfo::operator=( const TweenInfo &rhs ) +{ + delete m_pTween; + m_pTween = (rhs.m_pTween? rhs.m_pTween->Copy():NULL); + m_fTimeLeftInTween = rhs.m_fTimeLeftInTween; + m_fTweenTime = rhs.m_fTweenTime; + m_sCommandName = rhs.m_sCommandName; + return *this; +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the Actor. */ +class LunaActor : public Luna +{ +public: + static int name( T* p, lua_State *L ) { p->SetName(SArg(1)); return 0; } + static int sleep( T* p, lua_State *L ) { p->Sleep(FArg(1)); return 0; } + static int linear( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_LINEAR); return 0; } + static int accelerate( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_ACCELERATE); return 0; } + static int decelerate( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_DECELERATE); return 0; } + static int spring( T* p, lua_State *L ) { p->BeginTweening(FArg(1),TWEEN_SPRING); return 0; } + static int tween( T* p, lua_State *L ) + { + ITween *pTween = ITween::CreateFromStack( L, 2 ); + p->BeginTweening( FArg(1), pTween ); + return 0; + } + static int stoptweening( T* p, lua_State *L ) { p->StopTweening(); return 0; } + static int finishtweening( T* p, lua_State *L ) { p->FinishTweening(); return 0; } + static int hurrytweening( T* p, lua_State *L ) { p->HurryTweening(FArg(1)); return 0; } + static int GetTweenTimeLeft( T* p, lua_State *L ) { lua_pushnumber( L, p->GetTweenTimeLeft() ); return 1; } + static int x( T* p, lua_State *L ) { p->SetX(FArg(1)); return 0; } + static int y( T* p, lua_State *L ) { p->SetY(FArg(1)); return 0; } + static int z( T* p, lua_State *L ) { p->SetZ(FArg(1)); return 0; } + static int addx( T* p, lua_State *L ) { p->AddX(FArg(1)); return 0; } + static int addy( T* p, lua_State *L ) { p->AddY(FArg(1)); return 0; } + static int addz( T* p, lua_State *L ) { p->AddZ(FArg(1)); return 0; } + static int zoom( T* p, lua_State *L ) { p->SetZoom(FArg(1)); return 0; } + static int zoomx( T* p, lua_State *L ) { p->SetZoomX(FArg(1)); return 0; } + static int zoomy( T* p, lua_State *L ) { p->SetZoomY(FArg(1)); return 0; } + static int zoomz( T* p, lua_State *L ) { p->SetZoomZ(FArg(1)); return 0; } + static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); return 0; } + static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); return 0; } + static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); return 0; } + static int setsize( T* p, lua_State *L ) { p->SetWidth(FArg(1)); p->SetHeight(FArg(2)); return 0; } + static int SetWidth( T* p, lua_State *L ) { p->SetWidth(FArg(1)); return 0; } + static int SetHeight( T* p, lua_State *L ) { p->SetHeight(FArg(1)); return 0; } + static int basealpha( T* p, lua_State *L ) { p->SetBaseAlpha(FArg(1)); return 0; } + static int basezoom( T* p, lua_State *L ) { p->SetBaseZoom(FArg(1)); return 0; } + static int basezoomx( T* p, lua_State *L ) { p->SetBaseZoomX(FArg(1)); return 0; } + static int basezoomy( T* p, lua_State *L ) { p->SetBaseZoomY(FArg(1)); return 0; } + static int basezoomz( T* p, lua_State *L ) { p->SetBaseZoomZ(FArg(1)); return 0; } + static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; } + static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); return 0; } + static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); return 0; } + static int cropright( T* p, lua_State *L ) { p->SetCropRight(FArg(1)); return 0; } + static int cropbottom( T* p, lua_State *L ) { p->SetCropBottom(FArg(1)); return 0; } + static int fadeleft( T* p, lua_State *L ) { p->SetFadeLeft(FArg(1)); return 0; } + static int fadetop( T* p, lua_State *L ) { p->SetFadeTop(FArg(1)); return 0; } + static int faderight( T* p, lua_State *L ) { p->SetFadeRight(FArg(1)); return 0; } + static int fadebottom( T* p, lua_State *L ) { p->SetFadeBottom(FArg(1)); return 0; } + static int diffuse( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuse( c ); return 0; } + static int diffuseupperleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperLeft( c ); return 0; } + static int diffuseupperright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperRight( c ); return 0; } + static int diffuselowerleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerLeft( c ); return 0; } + static int diffuselowerright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerRight( c ); return 0; } + static int diffuseleftedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLeftEdge( c ); return 0; } + static int diffuserightedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseRightEdge( c ); return 0; } + static int diffusetopedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseTopEdge( c ); return 0; } + static int diffusebottomedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseBottomEdge( c ); return 0; } + static int diffusealpha( T* p, lua_State *L ) { p->SetDiffuseAlpha(FArg(1)); return 0; } + static int diffusecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseColor( c ); return 0; } + static int glow( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetGlow( c ); return 0; } + static int aux( T* p, lua_State *L ) { p->SetAux( FArg(1) ); return 0; } + static int getaux( T* p, lua_State *L ) { lua_pushnumber( L, p->GetAux() ); return 1; } + static int rotationx( T* p, lua_State *L ) { p->SetRotationX(FArg(1)); return 0; } + static int rotationy( T* p, lua_State *L ) { p->SetRotationY(FArg(1)); return 0; } + static int rotationz( T* p, lua_State *L ) { p->SetRotationZ(FArg(1)); return 0; } + static int addrotationx( T* p, lua_State *L ) { p->AddRotationX(FArg(1)); return 0; } + static int addrotationy( T* p, lua_State *L ) { p->AddRotationY(FArg(1)); return 0; } + static int addrotationz( T* p, lua_State *L ) { p->AddRotationZ(FArg(1)); return 0; } + static int getrotation( T* p, lua_State *L ) { lua_pushnumber(L, p->GetRotationX()); lua_pushnumber(L, p->GetRotationY()); lua_pushnumber(L, p->GetRotationZ()); return 3; } + static int baserotationx( T* p, lua_State *L ) { p->SetBaseRotationX(FArg(1)); return 0; } + static int baserotationy( T* p, lua_State *L ) { p->SetBaseRotationY(FArg(1)); return 0; } + static int baserotationz( T* p, lua_State *L ) { p->SetBaseRotationZ(FArg(1)); return 0; } + static int skewx( T* p, lua_State *L ) { p->SetSkewX(FArg(1)); return 0; } + static int skewy( T* p, lua_State *L ) { p->SetSkewY(FArg(1)); return 0; } + static int heading( T* p, lua_State *L ) { p->AddRotationH(FArg(1)); return 0; } + static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; } + static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; } + static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; } + static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); return 0; } + static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); return 0; } + static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); return 0; } + static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check(L, 1)); return 0; } + static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check(L, 1)); return 0; } + static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); return 0; } + static int valign( T* p, lua_State *L ) { p->SetVertAlign(FArg(1)); return 0; } + static int diffuseblink( T* p, lua_State *L ) { p->SetEffectDiffuseBlink(); return 0; } + static int diffuseshift( T* p, lua_State *L ) { p->SetEffectDiffuseShift(); return 0; } + static int diffuseramp( T* p, lua_State *L ) { p->SetEffectDiffuseRamp(); return 0; } + static int glowblink( T* p, lua_State *L ) { p->SetEffectGlowBlink(); return 0; } + static int glowshift( T* p, lua_State *L ) { p->SetEffectGlowShift(); return 0; } + static int glowramp( T* p, lua_State *L ) { p->SetEffectGlowRamp(); return 0; } + static int rainbow( T* p, lua_State *L ) { p->SetEffectRainbow(); return 0; } + static int wag( T* p, lua_State *L ) { p->SetEffectWag(); return 0; } + static int bounce( T* p, lua_State *L ) { p->SetEffectBounce(); return 0; } + static int bob( T* p, lua_State *L ) { p->SetEffectBob(); return 0; } + static int pulse( T* p, lua_State *L ) { p->SetEffectPulse(); return 0; } + static int spin( T* p, lua_State *L ) { p->SetEffectSpin(); return 0; } + static int vibrate( T* p, lua_State *L ) { p->SetEffectVibrate(); return 0; } + static int stopeffect( T* p, lua_State *L ) { p->StopEffect(); return 0; } + static int effectcolor1( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor1( c ); return 0; } + static int effectcolor2( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor2( c ); return 0; } + static int effectperiod( T* p, lua_State *L ) { p->SetEffectPeriod(FArg(1)); return 0; } + static int effecttiming( T* p, lua_State *L ) { p->SetEffectTiming(FArg(1),FArg(2),FArg(3),FArg(4)); return 0; } + static int effectoffset( T* p, lua_State *L ) { p->SetEffectOffset(FArg(1)); return 0; } + static int effectclock( T* p, lua_State *L ) { p->SetEffectClockString(SArg(1)); return 0; } + static int effectmagnitude( T* p, lua_State *L ) { p->SetEffectMagnitude( RageVector3(FArg(1),FArg(2),FArg(3)) ); return 0; } + static int geteffectmagnitude( T* p, lua_State *L ) { RageVector3 v = p->GetEffectMagnitude(); lua_pushnumber(L, v[0]); lua_pushnumber(L, v[1]); lua_pushnumber(L, v[2]); return 3; } + static int scaletocover( T* p, lua_State *L ) { p->ScaleToCover( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } + static int scaletofit( T* p, lua_State *L ) { p->ScaleToFitInside( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } + static int animate( T* p, lua_State *L ) { p->EnableAnimation(BIArg(1)); return 0; } + static int play( T* p, lua_State *L ) { p->EnableAnimation(true); return 0; } + static int pause( T* p, lua_State *L ) { p->EnableAnimation(false); return 0; } + static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); return 0; } + static int GetNumStates( T* p, lua_State *L ) { LuaHelpers::Push( L, p->GetNumStates() ); return 1; } + static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(BIArg(1)); return 0; } + static int SetTextureFiltering( T* p, lua_State *L ) { p->SetTextureFiltering(BArg(1)); return 0; } + static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); return 0; } + static int zbuffer( T* p, lua_State *L ) { p->SetUseZBuffer(BIArg(1)); return 0; } + static int ztest( T* p, lua_State *L ) { p->SetZTestMode((BIArg(1))?ZTEST_WRITE_ON_PASS:ZTEST_OFF); return 0; } + static int ztestmode( T* p, lua_State *L ) { p->SetZTestMode( Enum::Check(L, 1) ); return 0; } + static int zwrite( T* p, lua_State *L ) { p->SetZWrite(BIArg(1)); return 0; } + static int zbias( T* p, lua_State *L ) { p->SetZBias(FArg(1)); return 0; } + static int clearzbuffer( T* p, lua_State *L ) { p->SetClearZBuffer(BIArg(1)); return 0; } + static int backfacecull( T* p, lua_State *L ) { p->SetCullMode((BIArg(1)) ? CULL_BACK : CULL_NONE); return 0; } + static int cullmode( T* p, lua_State *L ) { p->SetCullMode( Enum::Check(L, 1)); return 0; } + static int visible( T* p, lua_State *L ) { p->SetVisible(BIArg(1)); return 0; } + static int hibernate( T* p, lua_State *L ) { p->SetHibernate(FArg(1)); return 0; } + static int draworder( T* p, lua_State *L ) { p->SetDrawOrder(IArg(1)); return 0; } + static int playcommand( T* p, lua_State *L ) + { + if( !lua_istable(L, 2) && !lua_isnoneornil(L, 2) ) + luaL_typerror( L, 2, "table or nil" ); + + LuaReference ParamTable; + lua_pushvalue( L, 2 ); + ParamTable.SetFromStack( L ); + + Message msg( SArg(1), ParamTable ); + p->HandleMessage( msg ); + + return 0; + } + static int queuecommand( T* p, lua_State *L ) { p->QueueCommand(SArg(1)); return 0; } + static int queuemessage( T* p, lua_State *L ) { p->QueueMessage(SArg(1)); return 0; } + static int addcommand( T* p, lua_State *L ) + { + LuaReference *pRef = new LuaReference; + pRef->SetFromStack( L ); + p->AddCommand( SArg(1), apActorCommands(pRef) ); + return 0; + } + static int GetCommand( T* p, lua_State *L ) + { + const apActorCommands *pCommand = p->GetCommand(SArg(1)); + if( pCommand == NULL ) + lua_pushnil( L ); + else + (*pCommand)->PushSelf(L); + + return 1; + } + static int RunCommandsRecursively( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TFUNCTION ); + if( !lua_istable(L, 2) && !lua_isnoneornil(L, 2) ) + luaL_typerror( L, 2, "table or nil" ); + + LuaReference ref; + lua_pushvalue( L, 1 ); + ref.SetFromStack( L ); + + LuaReference ParamTable; + lua_pushvalue( L, 2 ); + ParamTable.SetFromStack( L ); + + p->RunCommandsRecursively( ref, &ParamTable ); + return 0; + } + + static int GetX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetX() ); return 1; } + static int GetY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetY() ); return 1; } + static int GetZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZ() ); return 1; } + static int GetWidth( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnzoomedWidth() ); return 1; } + static int GetHeight( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnzoomedHeight() ); return 1; } + static int GetZoomedWidth( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomedWidth() ); return 1; } + static int GetZoomedHeight( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomedHeight() ); return 1; } + static int GetZoom( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoom() ); return 1; } + static int GetZoomX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomX() ); return 1; } + static int GetZoomY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomY() ); return 1; } + static int GetZoomZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetZoomZ() ); return 1; } + static int GetBaseZoomX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomX() ); return 1; } + static int GetBaseZoomY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomY() ); return 1; } + static int GetBaseZoomZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetBaseZoomZ() ); return 1; } + static int GetRotationX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationX() ); return 1; } + static int GetRotationY( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationY() ); return 1; } + static int GetRotationZ( T* p, lua_State *L ) { lua_pushnumber( L, p->GetRotationZ() ); return 1; } + static int GetSecsIntoEffect( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecsIntoEffect() ); return 1; } + static int GetEffectDelta( T* p, lua_State *L ) { lua_pushnumber( L, p->GetEffectDelta() ); return 1; } + DEFINE_METHOD( GetDiffuse, GetDiffuse() ) + DEFINE_METHOD( GetGlow, GetGlow() ) + static int GetDiffuseAlpha( T* p, lua_State *L ) { lua_pushnumber( L, p->GetDiffuseAlpha() ); return 1; } + static int GetVisible( T* p, lua_State *L ) { lua_pushboolean( L, p->GetVisible() ); return 1; } + static int GetHAlign( T* p, lua_State *L ) { lua_pushnumber( L, p->GetHorizAlign() ); return 1; } + static int GetVAlign( T* p, lua_State *L ) { lua_pushnumber( L, p->GetVertAlign() ); return 1; } + + static int GetName( T* p, lua_State *L ) { lua_pushstring( L, p->GetName() ); return 1; } + static int GetParent( T* p, lua_State *L ) + { + Actor *pParent = p->GetParent(); + if( pParent == NULL ) + lua_pushnil( L ); + else + pParent->PushSelf(L); + return 1; + } + static int Draw( T* p, lua_State *L ) + { + LUA->YieldLua(); + p->Draw(); + LUA->UnyieldLua(); + return 0; + } + + LunaActor() + { + ADD_METHOD( name ); + ADD_METHOD( sleep ); + ADD_METHOD( linear ); + ADD_METHOD( accelerate ); + ADD_METHOD( decelerate ); + ADD_METHOD( spring ); + ADD_METHOD( tween ); + ADD_METHOD( stoptweening ); + ADD_METHOD( finishtweening ); + ADD_METHOD( hurrytweening ); + ADD_METHOD( GetTweenTimeLeft ); + ADD_METHOD( x ); + ADD_METHOD( y ); + ADD_METHOD( z ); + ADD_METHOD( addx ); + ADD_METHOD( addy ); + ADD_METHOD( addz ); + ADD_METHOD( zoom ); + ADD_METHOD( zoomx ); + ADD_METHOD( zoomy ); + ADD_METHOD( zoomz ); + ADD_METHOD( zoomto ); + ADD_METHOD( zoomtowidth ); + ADD_METHOD( zoomtoheight ); + ADD_METHOD( setsize ); + ADD_METHOD( SetWidth ); + ADD_METHOD( SetHeight ); + ADD_METHOD( basealpha ); + ADD_METHOD( basezoom ); + ADD_METHOD( basezoomx ); + ADD_METHOD( basezoomy ); + ADD_METHOD( basezoomz ); + ADD_METHOD( stretchto ); + ADD_METHOD( cropleft ); + ADD_METHOD( croptop ); + ADD_METHOD( cropright ); + ADD_METHOD( cropbottom ); + ADD_METHOD( fadeleft ); + ADD_METHOD( fadetop ); + ADD_METHOD( faderight ); + ADD_METHOD( fadebottom ); + ADD_METHOD( diffuse ); + ADD_METHOD( diffuseupperleft ); + ADD_METHOD( diffuseupperright ); + ADD_METHOD( diffuselowerleft ); + ADD_METHOD( diffuselowerright ); + ADD_METHOD( diffuseleftedge ); + ADD_METHOD( diffuserightedge ); + ADD_METHOD( diffusetopedge ); + ADD_METHOD( diffusebottomedge ); + ADD_METHOD( diffusealpha ); + ADD_METHOD( diffusecolor ); + ADD_METHOD( glow ); + ADD_METHOD( aux ); + ADD_METHOD( getaux ); + ADD_METHOD( rotationx ); + ADD_METHOD( rotationy ); + ADD_METHOD( rotationz ); + ADD_METHOD( addrotationx ); + ADD_METHOD( addrotationy ); + ADD_METHOD( addrotationz ); + ADD_METHOD( getrotation ); + ADD_METHOD( baserotationx ); + ADD_METHOD( baserotationy ); + ADD_METHOD( baserotationz ); + ADD_METHOD( skewx ); + ADD_METHOD( skewy ); + ADD_METHOD( heading ); + ADD_METHOD( pitch ); + ADD_METHOD( roll ); + ADD_METHOD( shadowlength ); + ADD_METHOD( shadowlengthx ); + ADD_METHOD( shadowlengthy ); + ADD_METHOD( shadowcolor ); + ADD_METHOD( horizalign ); + ADD_METHOD( vertalign ); + ADD_METHOD( halign ); + ADD_METHOD( valign ); + ADD_METHOD( diffuseblink ); + ADD_METHOD( diffuseshift ); + ADD_METHOD( diffuseramp ); + ADD_METHOD( glowblink ); + ADD_METHOD( glowshift ); + ADD_METHOD( glowramp ); + ADD_METHOD( rainbow ); + ADD_METHOD( wag ); + ADD_METHOD( bounce ); + ADD_METHOD( bob ); + ADD_METHOD( pulse ); + ADD_METHOD( spin ); + ADD_METHOD( vibrate ); + ADD_METHOD( stopeffect ); + ADD_METHOD( effectcolor1 ); + ADD_METHOD( effectcolor2 ); + ADD_METHOD( effectperiod ); + ADD_METHOD( effecttiming ); + ADD_METHOD( effectoffset ); + ADD_METHOD( effectclock ); + ADD_METHOD( effectmagnitude ); + ADD_METHOD( geteffectmagnitude ); + ADD_METHOD( scaletocover ); + ADD_METHOD( scaletofit ); + ADD_METHOD( animate ); + ADD_METHOD( play ); + ADD_METHOD( pause ); + ADD_METHOD( setstate ); + ADD_METHOD( GetNumStates ); + ADD_METHOD( texturewrapping ); + ADD_METHOD( SetTextureFiltering ); + ADD_METHOD( blend ); + ADD_METHOD( zbuffer ); + ADD_METHOD( ztest ); + ADD_METHOD( ztestmode ); + ADD_METHOD( zwrite ); + ADD_METHOD( zbias ); + ADD_METHOD( clearzbuffer ); + ADD_METHOD( backfacecull ); + ADD_METHOD( cullmode ); + ADD_METHOD( visible ); + ADD_METHOD( hibernate ); + ADD_METHOD( draworder ); + ADD_METHOD( playcommand ); + ADD_METHOD( queuecommand ); + ADD_METHOD( queuemessage ); + ADD_METHOD( addcommand ); + ADD_METHOD( GetCommand ); + ADD_METHOD( RunCommandsRecursively ); + + ADD_METHOD( GetX ); + ADD_METHOD( GetY ); + ADD_METHOD( GetZ ); + ADD_METHOD( GetWidth ); + ADD_METHOD( GetHeight ); + ADD_METHOD( GetZoomedWidth ); + ADD_METHOD( GetZoomedHeight ); + ADD_METHOD( GetZoom ); + ADD_METHOD( GetZoomX ); + ADD_METHOD( GetZoomY ); + ADD_METHOD( GetZoomZ ); + ADD_METHOD( GetRotationX ); + ADD_METHOD( GetRotationY ); + ADD_METHOD( GetRotationZ ); + ADD_METHOD( GetBaseZoomX ); + ADD_METHOD( GetBaseZoomY ); + ADD_METHOD( GetBaseZoomZ ); + ADD_METHOD( GetSecsIntoEffect ); + ADD_METHOD( GetEffectDelta ); + ADD_METHOD( GetDiffuse ); + ADD_METHOD( GetDiffuseAlpha ); + ADD_METHOD( GetGlow ); + ADD_METHOD( GetVisible ); + ADD_METHOD( GetHAlign ); + ADD_METHOD( GetVAlign ); + + ADD_METHOD( GetName ); + ADD_METHOD( GetParent ); + + ADD_METHOD( Draw ); + } +}; + +LUA_REGISTER_INSTANCED_BASE_CLASS( Actor ) +// lua end + + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Actor.h b/src/Actor.h index ec6117bdc7..e0795e310f 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -1,705 +1,705 @@ -#ifndef ACTOR_H -#define ACTOR_H - -#include "RageTypes.h" -#include "RageUtil_AutoPtr.h" -#include "LuaReference.h" -#include "EnumHelper.h" -#include -class XNode; -struct lua_State; -class LuaClass; -#include "MessageManager.h" -#include "Tween.h" - -typedef AutoPtrCopyOnWrite apActorCommands; - -/** @brief The background layer. */ -#define DRAW_ORDER_BEFORE_EVERYTHING -200 -/** @brief The underlay layer. */ -#define DRAW_ORDER_UNDERLAY -100 -/** @brief The decorations layer. */ -#define DRAW_ORDER_DECORATIONS 0 -/** @brief The overlay layer. - * - * Normal screen elements go here. */ -#define DRAW_ORDER_OVERLAY +100 -/** @brief The transitions layer. */ -#define DRAW_ORDER_TRANSITIONS +200 -/** @brief The over everything layer. */ -#define DRAW_ORDER_AFTER_EVERYTHING +300 - -/** @brief The different horizontal alignments. */ -enum HorizAlign -{ - HorizAlign_Left, /**< Align to the left. */ - HorizAlign_Center, /**< Align to the center. */ - HorizAlign_Right, /**< Align to the right. */ - NUM_HorizAlign, /**< The number of horizontal alignments. */ - HorizAlign_Invalid -}; -LuaDeclareType( HorizAlign ); - -/** @brief The different vertical alignments. */ -enum VertAlign -{ - VertAlign_Top, /**< Align to the top. */ - VertAlign_Middle, /**< Align to the middle. */ - VertAlign_Bottom, /**< Align to the bottom. */ - NUM_VertAlign, /**< The number of vertical alignments. */ - VertAlign_Invalid -}; -LuaDeclareType( VertAlign ); - -/** @brief The left horizontal alignment constant. */ -#define align_left 0.0f -/** @brief The center horizontal alignment constant. */ -#define align_center 0.5f -/** @brief The right horizontal alignment constant. */ -#define align_right 1.0f -/** @brief The top vertical alignment constant. */ -#define align_top 0.0f -/** @brief The middle vertical alignment constant. */ -#define align_middle 0.5f -/** @brief The bottom vertical alignment constant. */ -#define align_bottom 1.0f - -// ssc futures: -/* -enum EffectAction -{ - EffectAction_None, // no_effect - // [Diffuse] - EffectAction_DiffuseBlink, // diffuse_blink - EffectAction_DiffuseShift, // diffuse_shift - EffectAction_DiffuseRamp, // diffuse_ramp - EffectAction_Rainbow, // rainbow - // [Glow] - EffectAction_GlowBlink, // glow_blink - EffectAction_GlowShift, // glow_shift - EffectAction_GlowRamp, // glow_ramp - // [Translate] - EffectAction_Bob, - EffectAction_Bounce, - EffectAction_Vibrate, - // [Rotate] - EffectAction_Spin, - EffectAction_Wag, - // [Zoom] - EffectAction_Pulse, - NUM_EffectAction, - EffectAction_Invalid -}; -LuaDeclareType( EffectAction ); -*/ - -/** @brief Base class for all objects that appear on the screen. */ -class Actor : public MessageSubscriber -{ -public: - /** @brief Set up the Actor with its initial settings. */ - Actor(); - Actor( const Actor &cpy ); - virtual ~Actor(); - virtual Actor *Copy() const; - virtual void InitState(); - virtual void LoadFromNode( const XNode* pNode ); - - static void SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBeatNoOffset ); - static void SetBGMLight( int iLightNumber, float fCabinetLights ); - - /** - * @brief The list of the different effects. - * - * todo: split out into diffuse effects and translation effects, or - * create an effect stack instead. -aj */ - enum Effect { no_effect, - diffuse_blink, diffuse_shift, diffuse_ramp, - glow_blink, glow_shift, glow_ramp, rainbow, - wag, bounce, bob, pulse, spin, vibrate - }; - - /** @brief Various values an Actor's effect can be tied to. */ - enum EffectClock - { - CLOCK_TIMER, - CLOCK_TIMER_GLOBAL, - CLOCK_BGM_TIME, - CLOCK_BGM_BEAT, - CLOCK_BGM_TIME_NO_OFFSET, - CLOCK_BGM_BEAT_NO_OFFSET, - CLOCK_LIGHT_1 = 1000, - CLOCK_LIGHT_LAST = 1100, - NUM_CLOCKS - }; - - /* - * @brief What type of Effect this is. - * - * This is an internal enum for checking if an effect can be run; - * You can't have more than one of most EffectTypes in the Effect list. (You - * might be able to have mutliple EffectType_Translates; not sure yet.) -aj */ - /* - enum EffectType { - EffectType_Diffuse, - EffectType_Glow, - EffectType_Translate, - EffectType_Rotate, - EffectType_Zoom, - NUM_EffectType, - EffectType_Invalid - }; - */ - - // todo: use this instead of the Effect enum -aj - /* - // This is similar to Attributes in BitmapText as far as implementation. - struct Effect - { - Effect() : m_Action(EffectAction_None), m_Type(EffectType_Invalid), m_fSecsIntoEffect(0), - m_fEffectDelta(0), m_fEffectRampUp(0.5f), m_fEffectHoldAtHalf(0), - m_fEffectRampDown(0.5f), m_fEffectHoldAtZero(0), m_fEffectOffset(0), - m_EffectClock(CLOCK_TIMER), m_vEffectMagnitude(RageVector3(0,0,10)), - m_effectColor1(RageColor(1,1,1,1)), m_effectColor2(RageColor(1,1,1,1)) - { } - - RString m_sName; // friendly name - EffectAction m_Action; // replaces the old Effect enum - EffectType m_Type; // determined by EffectAction - float m_fSecsIntoEffect; - float m_fEffectDelta; - RageColor m_EffectColor1; - RageColor m_EffectColor2; - RageVector3 m_vEffectMagnitude; - EffectClock m_EffectClock; - // units depend on m_EffectClock - float m_fEffectRampUp; - float m_fEffectHoldAtHalf; - float m_fEffectRampDown; - float m_fEffectHoldAtZero; - float m_fEffectOffset; - }; - */ - - /** - * @brief The present state for the Tween. - */ - struct TweenState - { - void Init(); - static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ); - bool operator==( const TweenState &other ) const; - bool operator!=( const TweenState &other ) const { return !operator==(other); } - - // start and end position for tweening - RageVector3 pos; - RageVector3 rotation; - RageVector4 quat; - RageVector3 scale; - float fSkewX, fSkewY; - /** - * @brief The amount of cropping involved. - * - * If 0, there is no cropping. If 1, it's fully cropped. */ - RectF crop; - /** - * @brief The amount of fading involved. - * - * If 0, there is no fade. If 1, it's fully faded. */ - RectF fade; - /** - * @brief Four values making up the diffuse in this TweenState. - * - * 0 = UpperLeft, 1 = UpperRight, 2 = LowerLeft, 3 = LowerRight */ - RageColor diffuse[4]; - /** @brief The glow color for this TweenState. */ - RageColor glow; - /** @brief A magical value that nobody really knows the use for. ;) */ - float aux; - }; - - void Draw(); // calls, EarlyAbortDraw, BeginDraw, DrawPrimitives, EndDraw - virtual bool EarlyAbortDraw() const { return false; } // return true to early abort drawing of this Actor - virtual void BeginDraw(); // pushes transform onto world matrix stack - virtual void SetGlobalRenderStates(); // Actor should call this at beginning of their DrawPrimitives() - virtual void SetTextureRenderStates(); // Actor should call this after setting a texture - /** - * @brief Draw the primitives of the Actor. - * - * Derivative classes should override this function. */ - virtual void DrawPrimitives() {}; - /** @brief Pop the transform from the world matrix stack. */ - virtual void EndDraw(); - - // TODO: make Update non virtual and change all classes to override UpdateInternal - // instead. - bool IsFirstUpdate() const; - virtual void Update( float fDeltaTime ); // this can short circuit UpdateInternal - virtual void UpdateInternal( float fDeltaTime ); // override this - void UpdateTweening( float fDeltaTime ); - - /** - * @brief Retrieve the Actor's name. - * @return the Actor's name. */ - const RString &GetName() const { return m_sName; } - /** - * @brief Set the Actor's name to a new one. - * @param sName the new name for the Actor. */ - virtual void SetName( const RString &sName ) { m_sName = sName; } - /** - * @brief Give this Actor a new parent. - * @param pParent the new parent Actor. */ - void SetParent( Actor *pParent ); - /** - * @brief Retrieve the Actor's parent. - * @return the Actor's parent. */ - Actor *GetParent() { return m_pParent; } - /** - * @brief Retrieve the Actor's lineage. - * @return the Actor's lineage. */ - RString GetLineage() const; - - /** - * @brief Retrieve the Actor's x position. - * @return the Actor's x position. */ - float GetX() const { return m_current.pos.x; }; - /** - * @brief Retrieve the Actor's y position. - * @return the Actor's y position. */ - float GetY() const { return m_current.pos.y; }; - /** - * @brief Retrieve the Actor's z position. - * @return the Actor's z position. */ - float GetZ() const { return m_current.pos.z; }; - float GetDestX() const { return DestTweenState().pos.x; }; - float GetDestY() const { return DestTweenState().pos.y; }; - float GetDestZ() const { return DestTweenState().pos.z; }; - void SetX( float x ) { DestTweenState().pos.x = x; }; - void SetY( float y ) { DestTweenState().pos.y = y; }; - void SetZ( float z ) { DestTweenState().pos.z = z; }; - void SetXY( float x, float y ) { DestTweenState().pos.x = x; DestTweenState().pos.y = y; }; - /** - * @brief Add to the x position of this Actor. - * @param x the amount to add to the Actor's x position. */ - void AddX( float x ) { SetX( GetDestX()+x ); } - /** - * @brief Add to the y position of this Actor. - * @param y the amount to add to the Actor's y position. */ - void AddY( float y ) { SetY( GetDestY()+y ); } - /** - * @brief Add to the z position of this Actor. - * @param z the amount to add to the Actor's z position. */ - void AddZ( float z ) { SetZ( GetDestZ()+z ); } - - // height and width vary depending on zoom - float GetUnzoomedWidth() const { return m_size.x; } - float GetUnzoomedHeight() const { return m_size.y; } - float GetZoomedWidth() const { return m_size.x * m_baseScale.x * DestTweenState().scale.x; } - float GetZoomedHeight() const { return m_size.y * m_baseScale.y * DestTweenState().scale.y; } - void SetWidth( float width ) { m_size.x = width; } - void SetHeight( float height ) { m_size.y = height; } - - // Base values - float GetBaseZoomX() const { return m_baseScale.x; } - void SetBaseZoomX( float zoom ) { m_baseScale.x = zoom; } - float GetBaseZoomY() const { return m_baseScale.y; } - void SetBaseZoomY( float zoom ) { m_baseScale.y = zoom; } - float GetBaseZoomZ() const { return m_baseScale.z; } - void SetBaseZoomZ( float zoom ) { m_baseScale.z = zoom; } - void SetBaseZoom( float zoom ) { m_baseScale = RageVector3(zoom,zoom,zoom); } - void SetBaseRotationX( float rot ) { m_baseRotation.x = rot; } - void SetBaseRotationY( float rot ) { m_baseRotation.y = rot; } - void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } - void SetBaseRotation( const RageVector3 &rot ) { m_baseRotation = rot; } - virtual void SetBaseAlpha( float fAlpha ) { m_fBaseAlpha = fAlpha; } - - /** - * @brief Retrieve the general zoom factor, using the x coordinate of the Actor. - * - * Note that this is not accurate in some cases. - * @return the zoom factor for the x coordinate of the Actor. */ - float GetZoom() const { return DestTweenState().scale.x; } - /** - * @brief Retrieve the zoom factor for the x coordinate of the Actor. - * @return the zoom factor for the x coordinate of the Actor. */ - float GetZoomX() const { return DestTweenState().scale.x; } - /** - * @brief Retrieve the zoom factor for the y coordinate of the Actor. - * @return the zoom factor for the y coordinate of the Actor. */ - float GetZoomY() const { return DestTweenState().scale.y; } - /** - * @brief Retrieve the zoom factor for the z coordinate of the Actor. - * @return the zoom factor for the z coordinate of the Actor. */ - float GetZoomZ() const { return DestTweenState().scale.z; } - void SetZoom( float zoom ) { DestTweenState().scale.x = zoom; DestTweenState().scale.y = zoom; DestTweenState().scale.z = zoom; } - void SetZoomX( float zoom ) { DestTweenState().scale.x = zoom; } - void SetZoomY( float zoom ) { DestTweenState().scale.y = zoom; } - void SetZoomZ( float zoom ) { DestTweenState().scale.z = zoom; } - void ZoomTo( float fX, float fY ) { ZoomToWidth(fX); ZoomToHeight(fY); } - void ZoomToWidth( float zoom ) { SetZoomX( zoom / GetUnzoomedWidth() ); } - void ZoomToHeight( float zoom ) { SetZoomY( zoom / GetUnzoomedHeight() ); } - - float GetRotationX() const { return DestTweenState().rotation.x; } - float GetRotationY() const { return DestTweenState().rotation.y; } - float GetRotationZ() const { return DestTweenState().rotation.z; } - void SetRotationX( float rot ) { DestTweenState().rotation.x = rot; } - void SetRotationY( float rot ) { DestTweenState().rotation.y = rot; } - void SetRotationZ( float rot ) { DestTweenState().rotation.z = rot; } - // added in StepNXA, now available in sm-ssc: - void AddRotationX( float rot ) { DestTweenState().rotation.x += rot; }; - void AddRotationY( float rot ) { DestTweenState().rotation.y += rot; }; - void AddRotationZ( float rot ) { DestTweenState().rotation.z += rot; }; - // and these were normally in SM: - void AddRotationH( float rot ); - void AddRotationP( float rot ); - void AddRotationR( float rot ); - - void SetSkewX( float fAmount ) { DestTweenState().fSkewX = fAmount; } - float GetSkewX( float fAmount ) const { return DestTweenState().fSkewX; } - void SetSkewY( float fAmount ) { DestTweenState().fSkewY = fAmount; } - float GetSkewY( float fAmount ) const { return DestTweenState().fSkewY; } - - float GetCropLeft() const { return DestTweenState().crop.left; } - float GetCropTop() const { return DestTweenState().crop.top; } - float GetCropRight() const { return DestTweenState().crop.right; } - float GetCropBottom() const { return DestTweenState().crop.bottom; } - void SetCropLeft( float percent ) { DestTweenState().crop.left = percent; } - void SetCropTop( float percent ) { DestTweenState().crop.top = percent; } - void SetCropRight( float percent ) { DestTweenState().crop.right = percent; } - void SetCropBottom( float percent ) { DestTweenState().crop.bottom = percent; } - - void SetFadeLeft( float percent ) { DestTweenState().fade.left = percent; } - void SetFadeTop( float percent ) { DestTweenState().fade.top = percent; } - void SetFadeRight( float percent ) { DestTweenState().fade.right = percent; } - void SetFadeBottom( float percent ) { DestTweenState().fade.bottom = percent; } - - void SetGlobalDiffuseColor( RageColor c ); - - virtual void SetDiffuse( RageColor c ) { for(int i=0; i<4; i++) DestTweenState().diffuse[i] = c; }; - virtual void SetDiffuseAlpha( float f ) { for(int i = 0; i < 4; ++i) { RageColor c = GetDiffuses( i ); c.a = f; SetDiffuses( i, c ); } } - float GetCurrentDiffuseAlpha() const { return m_current.diffuse[0].a; } - void SetDiffuseColor( RageColor c ); - void SetDiffuses( int i, RageColor c ) { DestTweenState().diffuse[i] = c; }; - void SetDiffuseUpperLeft( RageColor c ) { DestTweenState().diffuse[0] = c; }; - void SetDiffuseUpperRight( RageColor c ) { DestTweenState().diffuse[1] = c; }; - void SetDiffuseLowerLeft( RageColor c ) { DestTweenState().diffuse[2] = c; }; - void SetDiffuseLowerRight( RageColor c ) { DestTweenState().diffuse[3] = c; }; - void SetDiffuseTopEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c; }; - void SetDiffuseRightEdge( RageColor c ) { DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c; }; - void SetDiffuseBottomEdge( RageColor c ) { DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c; }; - void SetDiffuseLeftEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c; }; - RageColor GetDiffuse() const { return DestTweenState().diffuse[0]; }; - RageColor GetDiffuses( int i ) const { return DestTweenState().diffuse[i]; }; - float GetDiffuseAlpha() const { return DestTweenState().diffuse[0].a; }; - void SetGlow( RageColor c ) { DestTweenState().glow = c; }; - RageColor GetGlow() const { return DestTweenState().glow; }; - - void SetAux( float f ) { DestTweenState().aux = f; } - float GetAux() const { return m_current.aux; } - - void BeginTweening( float time, ITween *pInterp ); - void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); - void StopTweening(); - void Sleep( float time ); - void QueueCommand( const RString& sCommandName ); - void QueueMessage( const RString& sMessageName ); - virtual void FinishTweening(); - virtual void HurryTweening( float factor ); - // Let ActorFrame and BGAnimation override - virtual float GetTweenTimeLeft() const; // Amount of time until all tweens have stopped - TweenState& DestTweenState() // where Actor will end when its tween finish - { - if( m_Tweens.empty() ) // not tweening - return m_current; - else - return m_Tweens.back()->state; - } - const TweenState& DestTweenState() const { return const_cast(this)->DestTweenState(); } - - /** @brief How do we handle stretching the Actor? */ - enum StretchType - { - fit_inside, /**< Have the Actor fit inside its parent, using the smaller zoom. */ - cover /**, Have the Actor cover its parent, using the larger zoom. */ - }; - - void ScaleToCover( const RectF &rect ) { ScaleTo( rect, cover ); } - void ScaleToFitInside( const RectF &rect ) { ScaleTo( rect, fit_inside); }; - void ScaleTo( const RectF &rect, StretchType st ); - - void StretchTo( const RectF &rect ); - - // Alignment settings. These need to be virtual for BitmapText - virtual void SetHorizAlign( float f ) { m_fHorizAlign = f; } - virtual void SetVertAlign( float f ) { m_fVertAlign = f; } - void SetHorizAlign( HorizAlign ha ) { SetHorizAlign( (ha == HorizAlign_Left)? 0.0f: (ha == HorizAlign_Center)? 0.5f: +1.0f ); } - void SetVertAlign( VertAlign va ) { SetVertAlign( (va == VertAlign_Top)? 0.0f: (va == VertAlign_Middle)? 0.5f: +1.0f ); } - virtual float GetHorizAlign() { return m_fHorizAlign; } - virtual float GetVertAlign() { return m_fVertAlign; } - - // effects -#if defined(SSC_FUTURES) - void StopEffects(); - Effect GetEffect( int i ) const { return m_Effects[i]; } -#else - void StopEffect() { m_Effect = no_effect; } - Effect GetEffect() const { return m_Effect; } -#endif - float GetSecsIntoEffect() const { return m_fSecsIntoEffect; } - float GetEffectDelta() const { return m_fEffectDelta; } - - // todo: account for SSC_FUTURES by adding an effect as an arg to each one -aj - void SetEffectColor1( RageColor c ) { m_effectColor1 = c; } - void SetEffectColor2( RageColor c ) { m_effectColor2 = c; } - void SetEffectPeriod( float fTime ); - float GetEffectPeriod() const; - void SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, float fAtZero ); - void SetEffectOffset( float fTime ) { m_fEffectOffset = fTime; } - void SetEffectClock( EffectClock c ) { m_EffectClock = c; } - void SetEffectClockString( const RString &s ); // convenience - - void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; } - RageVector3 GetEffectMagnitude() const { return m_vEffectMagnitude; } - - void SetEffectDiffuseBlink( - float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(0.5f,0.5f,0.5f,1), - RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectDiffuseShift( float fEffectPeriodSeconds = 1.f, - RageColor c1 = RageColor(0,0,0,1), - RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectDiffuseRamp( float fEffectPeriodSeconds = 1.f, - RageColor c1 = RageColor(0,0,0,1), - RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectGlowBlink( float fEffectPeriodSeconds = 1.f, - RageColor c1 = RageColor(1,1,1,0.2f), - RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectGlowShift( - float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(1,1,1,0.2f), - RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectGlowRamp( - float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(1,1,1,0.2f), - RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectRainbow( - float fEffectPeriodSeconds = 2.0f ); - void SetEffectWag( - float fPeriod = 2.f, - RageVector3 vect = RageVector3(0,0,20) ); - void SetEffectBounce( - float fPeriod = 2.f, - RageVector3 vect = RageVector3(0,20,0) ); - void SetEffectBob( - float fPeriod = 2.f, - RageVector3 vect = RageVector3(0,20,0) ); - void SetEffectPulse( - float fPeriod = 2.f, - float fMinZoom = 0.5f, - float fMaxZoom = 1.f ); - void SetEffectSpin( RageVector3 vect = RageVector3(0,0,180) ); - void SetEffectVibrate( RageVector3 vect = RageVector3(10,10,10) ); - - - // other properties - /** - * @brief Determine if the Actor is visible at this time. - * @return true if it's visible, false otherwise. */ - bool GetVisible() const { return m_bVisible; } - void SetVisible( bool b ) { m_bVisible = b; } - void SetShadowLength( float fLength ) { m_fShadowLengthX = fLength; m_fShadowLengthY = fLength; } - void SetShadowLengthX( float fLengthX ) { m_fShadowLengthX = fLengthX; } - void SetShadowLengthY( float fLengthY ) { m_fShadowLengthY = fLengthY; } - void SetShadowColor( RageColor c ) { m_ShadowColor = c; } - // TODO: Implement hibernate as a tween type? - void SetHibernate( float fSecs ) { m_fHibernateSecondsLeft = fSecs; } - void SetDrawOrder( int iOrder ) { m_iDrawOrder = iOrder; } - int GetDrawOrder() const { return m_iDrawOrder; } - - virtual void EnableAnimation( bool b ) { m_bIsAnimating = b; } // Sprite needs to overload this - void StartAnimating() { this->EnableAnimation(true); } - void StopAnimating() { this->EnableAnimation(false); } - - // render states - void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } - void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } - void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; } - void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } - void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); } - virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; } - virtual void SetZWrite( bool b ) { m_bZWrite = b; } - void SetZBias( float f ) { m_fZBias = f; } - virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; } - - // Lua - virtual void PushSelf( lua_State *L ); - virtual void PushContext( lua_State *L ); - - // Named commands - void AddCommand( const RString &sCmdName, apActorCommands apac ); - bool HasCommand( const RString &sCmdName ) const; - const apActorCommands *GetCommand( const RString &sCommandName ) const; - void PlayCommand( const RString &sCommandName ) { HandleMessage( Message(sCommandName) ); } // convenience - void PlayCommandNoRecurse( const Message &msg ); - - // Commands by reference - virtual void RunCommands( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); - void RunCommands( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommands( *cmds, pParamTable ); } // convenience - virtual void RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable = NULL ) { RunCommands(cmds, pParamTable); } - // If we're a leaf, then execute this command. - virtual void RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable = NULL ) { RunCommands(cmds, pParamTable); } - - // Messages - virtual void HandleMessage( const Message &msg ); - - // Animation - virtual int GetNumStates() const { return 1; } - virtual void SetState( int iNewState ) {} - virtual float GetAnimationLengthSeconds() const { return 0; } - virtual void SetSecondsIntoAnimation( float fSeconds ) {} - virtual void SetUpdateRate( float fRate ) {} - - HiddenPtr m_pLuaInstance; - -protected: - /** @brief the name of the Actor. */ - RString m_sName; - /** @brief the current parent of this Actor if it exists. */ - Actor *m_pParent; - - /** @brief Some general information about the Tween. */ - struct TweenInfo - { - // counters for tweening - TweenInfo(); - ~TweenInfo(); - TweenInfo( const TweenInfo &cpy ); - TweenInfo &operator=( const TweenInfo &rhs ); - - ITween *m_pTween; - /** @brief How far into the tween are we? */ - float m_fTimeLeftInTween; - /** @brief The number of seconds between Start and End positions/zooms. */ - float m_fTweenTime; - /** @brief The command to execute when this TweenState goes into effect. */ - RString m_sCommandName; - }; - - RageVector3 m_baseRotation; - RageVector3 m_baseScale; - float m_fBaseAlpha; - - RageVector2 m_size; - TweenState m_current; - TweenState m_start; - struct TweenStateAndInfo - { - TweenState state; - TweenInfo info; - }; - vector m_Tweens; - - /** @brief Temporary variables that are filled just before drawing */ - TweenState *m_pTempState; - - bool m_bFirstUpdate; - - // Stuff for alignment - /** @brief The particular horizontal alignment. - * - * Use the defined constant values for best effect. */ - float m_fHorizAlign; - /** @brief The particular vertical alignment. - * - * Use the defined constant values for best effect. */ - float m_fVertAlign; - - // Stuff for effects -#if defined(SSC_FUTURES) // be able to stack effects - vector m_Effects; -#else // compatibility - Effect m_Effect; -#endif - float m_fSecsIntoEffect; - float m_fEffectDelta; - - // units depend on m_EffectClock - float m_fEffectRampUp; - float m_fEffectHoldAtHalf; - float m_fEffectRampDown; - float m_fEffectHoldAtZero; - float m_fEffectOffset; - EffectClock m_EffectClock; - - /* This can be used in lieu of the fDeltaTime parameter to Update() to - * follow the effect clock. Actor::Update must be called first. */ - float GetEffectDeltaTime() const { return m_fEffectDelta; } - - // todo: account for SSC_FUTURES by having these be vectors too -aj - RageColor m_effectColor1; - RageColor m_effectColor2; - RageVector3 m_vEffectMagnitude; - - // other properties - bool m_bVisible; - bool m_bIsAnimating; - float m_fHibernateSecondsLeft; - float m_fShadowLengthX; - float m_fShadowLengthY; - RageColor m_ShadowColor; - /** @brief The draw order priority. - * - * The lower this number is, the sooner it is drawn. */ - int m_iDrawOrder; - - // render states - BlendMode m_BlendMode; - ZTestMode m_ZTestMode; - CullMode m_CullMode; - bool m_bTextureWrapping; - bool m_bTextureFiltering; - bool m_bClearZBuffer; - bool m_bZWrite; - /** - * @brief The amount of bias. - * - * If 0, there is no bias. If 1, there is a full bias. */ - float m_fZBias; - - // global state - static float g_fCurrentBGMTime, g_fCurrentBGMBeat; - static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset; - -private: - // commands - map m_mapNameToCommands; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTOR_H +#define ACTOR_H + +#include "RageTypes.h" +#include "RageUtil_AutoPtr.h" +#include "LuaReference.h" +#include "EnumHelper.h" +#include +class XNode; +struct lua_State; +class LuaClass; +#include "MessageManager.h" +#include "Tween.h" + +typedef AutoPtrCopyOnWrite apActorCommands; + +/** @brief The background layer. */ +#define DRAW_ORDER_BEFORE_EVERYTHING -200 +/** @brief The underlay layer. */ +#define DRAW_ORDER_UNDERLAY -100 +/** @brief The decorations layer. */ +#define DRAW_ORDER_DECORATIONS 0 +/** @brief The overlay layer. + * + * Normal screen elements go here. */ +#define DRAW_ORDER_OVERLAY +100 +/** @brief The transitions layer. */ +#define DRAW_ORDER_TRANSITIONS +200 +/** @brief The over everything layer. */ +#define DRAW_ORDER_AFTER_EVERYTHING +300 + +/** @brief The different horizontal alignments. */ +enum HorizAlign +{ + HorizAlign_Left, /**< Align to the left. */ + HorizAlign_Center, /**< Align to the center. */ + HorizAlign_Right, /**< Align to the right. */ + NUM_HorizAlign, /**< The number of horizontal alignments. */ + HorizAlign_Invalid +}; +LuaDeclareType( HorizAlign ); + +/** @brief The different vertical alignments. */ +enum VertAlign +{ + VertAlign_Top, /**< Align to the top. */ + VertAlign_Middle, /**< Align to the middle. */ + VertAlign_Bottom, /**< Align to the bottom. */ + NUM_VertAlign, /**< The number of vertical alignments. */ + VertAlign_Invalid +}; +LuaDeclareType( VertAlign ); + +/** @brief The left horizontal alignment constant. */ +#define align_left 0.0f +/** @brief The center horizontal alignment constant. */ +#define align_center 0.5f +/** @brief The right horizontal alignment constant. */ +#define align_right 1.0f +/** @brief The top vertical alignment constant. */ +#define align_top 0.0f +/** @brief The middle vertical alignment constant. */ +#define align_middle 0.5f +/** @brief The bottom vertical alignment constant. */ +#define align_bottom 1.0f + +// ssc futures: +/* +enum EffectAction +{ + EffectAction_None, // no_effect + // [Diffuse] + EffectAction_DiffuseBlink, // diffuse_blink + EffectAction_DiffuseShift, // diffuse_shift + EffectAction_DiffuseRamp, // diffuse_ramp + EffectAction_Rainbow, // rainbow + // [Glow] + EffectAction_GlowBlink, // glow_blink + EffectAction_GlowShift, // glow_shift + EffectAction_GlowRamp, // glow_ramp + // [Translate] + EffectAction_Bob, + EffectAction_Bounce, + EffectAction_Vibrate, + // [Rotate] + EffectAction_Spin, + EffectAction_Wag, + // [Zoom] + EffectAction_Pulse, + NUM_EffectAction, + EffectAction_Invalid +}; +LuaDeclareType( EffectAction ); +*/ + +/** @brief Base class for all objects that appear on the screen. */ +class Actor : public MessageSubscriber +{ +public: + /** @brief Set up the Actor with its initial settings. */ + Actor(); + Actor( const Actor &cpy ); + virtual ~Actor(); + virtual Actor *Copy() const; + virtual void InitState(); + virtual void LoadFromNode( const XNode* pNode ); + + static void SetBGMTime( float fTime, float fBeat, float fTimeNoOffset, float fBeatNoOffset ); + static void SetBGMLight( int iLightNumber, float fCabinetLights ); + + /** + * @brief The list of the different effects. + * + * todo: split out into diffuse effects and translation effects, or + * create an effect stack instead. -aj */ + enum Effect { no_effect, + diffuse_blink, diffuse_shift, diffuse_ramp, + glow_blink, glow_shift, glow_ramp, rainbow, + wag, bounce, bob, pulse, spin, vibrate + }; + + /** @brief Various values an Actor's effect can be tied to. */ + enum EffectClock + { + CLOCK_TIMER, + CLOCK_TIMER_GLOBAL, + CLOCK_BGM_TIME, + CLOCK_BGM_BEAT, + CLOCK_BGM_TIME_NO_OFFSET, + CLOCK_BGM_BEAT_NO_OFFSET, + CLOCK_LIGHT_1 = 1000, + CLOCK_LIGHT_LAST = 1100, + NUM_CLOCKS + }; + + /* + * @brief What type of Effect this is. + * + * This is an internal enum for checking if an effect can be run; + * You can't have more than one of most EffectTypes in the Effect list. (You + * might be able to have mutliple EffectType_Translates; not sure yet.) -aj */ + /* + enum EffectType { + EffectType_Diffuse, + EffectType_Glow, + EffectType_Translate, + EffectType_Rotate, + EffectType_Zoom, + NUM_EffectType, + EffectType_Invalid + }; + */ + + // todo: use this instead of the Effect enum -aj + /* + // This is similar to Attributes in BitmapText as far as implementation. + struct Effect + { + Effect() : m_Action(EffectAction_None), m_Type(EffectType_Invalid), m_fSecsIntoEffect(0), + m_fEffectDelta(0), m_fEffectRampUp(0.5f), m_fEffectHoldAtHalf(0), + m_fEffectRampDown(0.5f), m_fEffectHoldAtZero(0), m_fEffectOffset(0), + m_EffectClock(CLOCK_TIMER), m_vEffectMagnitude(RageVector3(0,0,10)), + m_effectColor1(RageColor(1,1,1,1)), m_effectColor2(RageColor(1,1,1,1)) + { } + + RString m_sName; // friendly name + EffectAction m_Action; // replaces the old Effect enum + EffectType m_Type; // determined by EffectAction + float m_fSecsIntoEffect; + float m_fEffectDelta; + RageColor m_EffectColor1; + RageColor m_EffectColor2; + RageVector3 m_vEffectMagnitude; + EffectClock m_EffectClock; + // units depend on m_EffectClock + float m_fEffectRampUp; + float m_fEffectHoldAtHalf; + float m_fEffectRampDown; + float m_fEffectHoldAtZero; + float m_fEffectOffset; + }; + */ + + /** + * @brief The present state for the Tween. + */ + struct TweenState + { + void Init(); + static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ); + bool operator==( const TweenState &other ) const; + bool operator!=( const TweenState &other ) const { return !operator==(other); } + + // start and end position for tweening + RageVector3 pos; + RageVector3 rotation; + RageVector4 quat; + RageVector3 scale; + float fSkewX, fSkewY; + /** + * @brief The amount of cropping involved. + * + * If 0, there is no cropping. If 1, it's fully cropped. */ + RectF crop; + /** + * @brief The amount of fading involved. + * + * If 0, there is no fade. If 1, it's fully faded. */ + RectF fade; + /** + * @brief Four values making up the diffuse in this TweenState. + * + * 0 = UpperLeft, 1 = UpperRight, 2 = LowerLeft, 3 = LowerRight */ + RageColor diffuse[4]; + /** @brief The glow color for this TweenState. */ + RageColor glow; + /** @brief A magical value that nobody really knows the use for. ;) */ + float aux; + }; + + void Draw(); // calls, EarlyAbortDraw, BeginDraw, DrawPrimitives, EndDraw + virtual bool EarlyAbortDraw() const { return false; } // return true to early abort drawing of this Actor + virtual void BeginDraw(); // pushes transform onto world matrix stack + virtual void SetGlobalRenderStates(); // Actor should call this at beginning of their DrawPrimitives() + virtual void SetTextureRenderStates(); // Actor should call this after setting a texture + /** + * @brief Draw the primitives of the Actor. + * + * Derivative classes should override this function. */ + virtual void DrawPrimitives() {}; + /** @brief Pop the transform from the world matrix stack. */ + virtual void EndDraw(); + + // TODO: make Update non virtual and change all classes to override UpdateInternal + // instead. + bool IsFirstUpdate() const; + virtual void Update( float fDeltaTime ); // this can short circuit UpdateInternal + virtual void UpdateInternal( float fDeltaTime ); // override this + void UpdateTweening( float fDeltaTime ); + + /** + * @brief Retrieve the Actor's name. + * @return the Actor's name. */ + const RString &GetName() const { return m_sName; } + /** + * @brief Set the Actor's name to a new one. + * @param sName the new name for the Actor. */ + virtual void SetName( const RString &sName ) { m_sName = sName; } + /** + * @brief Give this Actor a new parent. + * @param pParent the new parent Actor. */ + void SetParent( Actor *pParent ); + /** + * @brief Retrieve the Actor's parent. + * @return the Actor's parent. */ + Actor *GetParent() { return m_pParent; } + /** + * @brief Retrieve the Actor's lineage. + * @return the Actor's lineage. */ + RString GetLineage() const; + + /** + * @brief Retrieve the Actor's x position. + * @return the Actor's x position. */ + float GetX() const { return m_current.pos.x; }; + /** + * @brief Retrieve the Actor's y position. + * @return the Actor's y position. */ + float GetY() const { return m_current.pos.y; }; + /** + * @brief Retrieve the Actor's z position. + * @return the Actor's z position. */ + float GetZ() const { return m_current.pos.z; }; + float GetDestX() const { return DestTweenState().pos.x; }; + float GetDestY() const { return DestTweenState().pos.y; }; + float GetDestZ() const { return DestTweenState().pos.z; }; + void SetX( float x ) { DestTweenState().pos.x = x; }; + void SetY( float y ) { DestTweenState().pos.y = y; }; + void SetZ( float z ) { DestTweenState().pos.z = z; }; + void SetXY( float x, float y ) { DestTweenState().pos.x = x; DestTweenState().pos.y = y; }; + /** + * @brief Add to the x position of this Actor. + * @param x the amount to add to the Actor's x position. */ + void AddX( float x ) { SetX( GetDestX()+x ); } + /** + * @brief Add to the y position of this Actor. + * @param y the amount to add to the Actor's y position. */ + void AddY( float y ) { SetY( GetDestY()+y ); } + /** + * @brief Add to the z position of this Actor. + * @param z the amount to add to the Actor's z position. */ + void AddZ( float z ) { SetZ( GetDestZ()+z ); } + + // height and width vary depending on zoom + float GetUnzoomedWidth() const { return m_size.x; } + float GetUnzoomedHeight() const { return m_size.y; } + float GetZoomedWidth() const { return m_size.x * m_baseScale.x * DestTweenState().scale.x; } + float GetZoomedHeight() const { return m_size.y * m_baseScale.y * DestTweenState().scale.y; } + void SetWidth( float width ) { m_size.x = width; } + void SetHeight( float height ) { m_size.y = height; } + + // Base values + float GetBaseZoomX() const { return m_baseScale.x; } + void SetBaseZoomX( float zoom ) { m_baseScale.x = zoom; } + float GetBaseZoomY() const { return m_baseScale.y; } + void SetBaseZoomY( float zoom ) { m_baseScale.y = zoom; } + float GetBaseZoomZ() const { return m_baseScale.z; } + void SetBaseZoomZ( float zoom ) { m_baseScale.z = zoom; } + void SetBaseZoom( float zoom ) { m_baseScale = RageVector3(zoom,zoom,zoom); } + void SetBaseRotationX( float rot ) { m_baseRotation.x = rot; } + void SetBaseRotationY( float rot ) { m_baseRotation.y = rot; } + void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } + void SetBaseRotation( const RageVector3 &rot ) { m_baseRotation = rot; } + virtual void SetBaseAlpha( float fAlpha ) { m_fBaseAlpha = fAlpha; } + + /** + * @brief Retrieve the general zoom factor, using the x coordinate of the Actor. + * + * Note that this is not accurate in some cases. + * @return the zoom factor for the x coordinate of the Actor. */ + float GetZoom() const { return DestTweenState().scale.x; } + /** + * @brief Retrieve the zoom factor for the x coordinate of the Actor. + * @return the zoom factor for the x coordinate of the Actor. */ + float GetZoomX() const { return DestTweenState().scale.x; } + /** + * @brief Retrieve the zoom factor for the y coordinate of the Actor. + * @return the zoom factor for the y coordinate of the Actor. */ + float GetZoomY() const { return DestTweenState().scale.y; } + /** + * @brief Retrieve the zoom factor for the z coordinate of the Actor. + * @return the zoom factor for the z coordinate of the Actor. */ + float GetZoomZ() const { return DestTweenState().scale.z; } + void SetZoom( float zoom ) { DestTweenState().scale.x = zoom; DestTweenState().scale.y = zoom; DestTweenState().scale.z = zoom; } + void SetZoomX( float zoom ) { DestTweenState().scale.x = zoom; } + void SetZoomY( float zoom ) { DestTweenState().scale.y = zoom; } + void SetZoomZ( float zoom ) { DestTweenState().scale.z = zoom; } + void ZoomTo( float fX, float fY ) { ZoomToWidth(fX); ZoomToHeight(fY); } + void ZoomToWidth( float zoom ) { SetZoomX( zoom / GetUnzoomedWidth() ); } + void ZoomToHeight( float zoom ) { SetZoomY( zoom / GetUnzoomedHeight() ); } + + float GetRotationX() const { return DestTweenState().rotation.x; } + float GetRotationY() const { return DestTweenState().rotation.y; } + float GetRotationZ() const { return DestTweenState().rotation.z; } + void SetRotationX( float rot ) { DestTweenState().rotation.x = rot; } + void SetRotationY( float rot ) { DestTweenState().rotation.y = rot; } + void SetRotationZ( float rot ) { DestTweenState().rotation.z = rot; } + // added in StepNXA, now available in sm-ssc: + void AddRotationX( float rot ) { DestTweenState().rotation.x += rot; }; + void AddRotationY( float rot ) { DestTweenState().rotation.y += rot; }; + void AddRotationZ( float rot ) { DestTweenState().rotation.z += rot; }; + // and these were normally in SM: + void AddRotationH( float rot ); + void AddRotationP( float rot ); + void AddRotationR( float rot ); + + void SetSkewX( float fAmount ) { DestTweenState().fSkewX = fAmount; } + float GetSkewX( float fAmount ) const { return DestTweenState().fSkewX; } + void SetSkewY( float fAmount ) { DestTweenState().fSkewY = fAmount; } + float GetSkewY( float fAmount ) const { return DestTweenState().fSkewY; } + + float GetCropLeft() const { return DestTweenState().crop.left; } + float GetCropTop() const { return DestTweenState().crop.top; } + float GetCropRight() const { return DestTweenState().crop.right; } + float GetCropBottom() const { return DestTweenState().crop.bottom; } + void SetCropLeft( float percent ) { DestTweenState().crop.left = percent; } + void SetCropTop( float percent ) { DestTweenState().crop.top = percent; } + void SetCropRight( float percent ) { DestTweenState().crop.right = percent; } + void SetCropBottom( float percent ) { DestTweenState().crop.bottom = percent; } + + void SetFadeLeft( float percent ) { DestTweenState().fade.left = percent; } + void SetFadeTop( float percent ) { DestTweenState().fade.top = percent; } + void SetFadeRight( float percent ) { DestTweenState().fade.right = percent; } + void SetFadeBottom( float percent ) { DestTweenState().fade.bottom = percent; } + + void SetGlobalDiffuseColor( RageColor c ); + + virtual void SetDiffuse( RageColor c ) { for(int i=0; i<4; i++) DestTweenState().diffuse[i] = c; }; + virtual void SetDiffuseAlpha( float f ) { for(int i = 0; i < 4; ++i) { RageColor c = GetDiffuses( i ); c.a = f; SetDiffuses( i, c ); } } + float GetCurrentDiffuseAlpha() const { return m_current.diffuse[0].a; } + void SetDiffuseColor( RageColor c ); + void SetDiffuses( int i, RageColor c ) { DestTweenState().diffuse[i] = c; }; + void SetDiffuseUpperLeft( RageColor c ) { DestTweenState().diffuse[0] = c; }; + void SetDiffuseUpperRight( RageColor c ) { DestTweenState().diffuse[1] = c; }; + void SetDiffuseLowerLeft( RageColor c ) { DestTweenState().diffuse[2] = c; }; + void SetDiffuseLowerRight( RageColor c ) { DestTweenState().diffuse[3] = c; }; + void SetDiffuseTopEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c; }; + void SetDiffuseRightEdge( RageColor c ) { DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c; }; + void SetDiffuseBottomEdge( RageColor c ) { DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c; }; + void SetDiffuseLeftEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c; }; + RageColor GetDiffuse() const { return DestTweenState().diffuse[0]; }; + RageColor GetDiffuses( int i ) const { return DestTweenState().diffuse[i]; }; + float GetDiffuseAlpha() const { return DestTweenState().diffuse[0].a; }; + void SetGlow( RageColor c ) { DestTweenState().glow = c; }; + RageColor GetGlow() const { return DestTweenState().glow; }; + + void SetAux( float f ) { DestTweenState().aux = f; } + float GetAux() const { return m_current.aux; } + + void BeginTweening( float time, ITween *pInterp ); + void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); + void StopTweening(); + void Sleep( float time ); + void QueueCommand( const RString& sCommandName ); + void QueueMessage( const RString& sMessageName ); + virtual void FinishTweening(); + virtual void HurryTweening( float factor ); + // Let ActorFrame and BGAnimation override + virtual float GetTweenTimeLeft() const; // Amount of time until all tweens have stopped + TweenState& DestTweenState() // where Actor will end when its tween finish + { + if( m_Tweens.empty() ) // not tweening + return m_current; + else + return m_Tweens.back()->state; + } + const TweenState& DestTweenState() const { return const_cast(this)->DestTweenState(); } + + /** @brief How do we handle stretching the Actor? */ + enum StretchType + { + fit_inside, /**< Have the Actor fit inside its parent, using the smaller zoom. */ + cover /**, Have the Actor cover its parent, using the larger zoom. */ + }; + + void ScaleToCover( const RectF &rect ) { ScaleTo( rect, cover ); } + void ScaleToFitInside( const RectF &rect ) { ScaleTo( rect, fit_inside); }; + void ScaleTo( const RectF &rect, StretchType st ); + + void StretchTo( const RectF &rect ); + + // Alignment settings. These need to be virtual for BitmapText + virtual void SetHorizAlign( float f ) { m_fHorizAlign = f; } + virtual void SetVertAlign( float f ) { m_fVertAlign = f; } + void SetHorizAlign( HorizAlign ha ) { SetHorizAlign( (ha == HorizAlign_Left)? 0.0f: (ha == HorizAlign_Center)? 0.5f: +1.0f ); } + void SetVertAlign( VertAlign va ) { SetVertAlign( (va == VertAlign_Top)? 0.0f: (va == VertAlign_Middle)? 0.5f: +1.0f ); } + virtual float GetHorizAlign() { return m_fHorizAlign; } + virtual float GetVertAlign() { return m_fVertAlign; } + + // effects +#if defined(SSC_FUTURES) + void StopEffects(); + Effect GetEffect( int i ) const { return m_Effects[i]; } +#else + void StopEffect() { m_Effect = no_effect; } + Effect GetEffect() const { return m_Effect; } +#endif + float GetSecsIntoEffect() const { return m_fSecsIntoEffect; } + float GetEffectDelta() const { return m_fEffectDelta; } + + // todo: account for SSC_FUTURES by adding an effect as an arg to each one -aj + void SetEffectColor1( RageColor c ) { m_effectColor1 = c; } + void SetEffectColor2( RageColor c ) { m_effectColor2 = c; } + void SetEffectPeriod( float fTime ); + float GetEffectPeriod() const; + void SetEffectTiming( float fRampUp, float fAtHalf, float fRampDown, float fAtZero ); + void SetEffectOffset( float fTime ) { m_fEffectOffset = fTime; } + void SetEffectClock( EffectClock c ) { m_EffectClock = c; } + void SetEffectClockString( const RString &s ); // convenience + + void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; } + RageVector3 GetEffectMagnitude() const { return m_vEffectMagnitude; } + + void SetEffectDiffuseBlink( + float fEffectPeriodSeconds = 1.0f, + RageColor c1 = RageColor(0.5f,0.5f,0.5f,1), + RageColor c2 = RageColor(1,1,1,1) ); + void SetEffectDiffuseShift( float fEffectPeriodSeconds = 1.f, + RageColor c1 = RageColor(0,0,0,1), + RageColor c2 = RageColor(1,1,1,1) ); + void SetEffectDiffuseRamp( float fEffectPeriodSeconds = 1.f, + RageColor c1 = RageColor(0,0,0,1), + RageColor c2 = RageColor(1,1,1,1) ); + void SetEffectGlowBlink( float fEffectPeriodSeconds = 1.f, + RageColor c1 = RageColor(1,1,1,0.2f), + RageColor c2 = RageColor(1,1,1,0.8f) ); + void SetEffectGlowShift( + float fEffectPeriodSeconds = 1.0f, + RageColor c1 = RageColor(1,1,1,0.2f), + RageColor c2 = RageColor(1,1,1,0.8f) ); + void SetEffectGlowRamp( + float fEffectPeriodSeconds = 1.0f, + RageColor c1 = RageColor(1,1,1,0.2f), + RageColor c2 = RageColor(1,1,1,0.8f) ); + void SetEffectRainbow( + float fEffectPeriodSeconds = 2.0f ); + void SetEffectWag( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,0,20) ); + void SetEffectBounce( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,20,0) ); + void SetEffectBob( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,20,0) ); + void SetEffectPulse( + float fPeriod = 2.f, + float fMinZoom = 0.5f, + float fMaxZoom = 1.f ); + void SetEffectSpin( RageVector3 vect = RageVector3(0,0,180) ); + void SetEffectVibrate( RageVector3 vect = RageVector3(10,10,10) ); + + + // other properties + /** + * @brief Determine if the Actor is visible at this time. + * @return true if it's visible, false otherwise. */ + bool GetVisible() const { return m_bVisible; } + void SetVisible( bool b ) { m_bVisible = b; } + void SetShadowLength( float fLength ) { m_fShadowLengthX = fLength; m_fShadowLengthY = fLength; } + void SetShadowLengthX( float fLengthX ) { m_fShadowLengthX = fLengthX; } + void SetShadowLengthY( float fLengthY ) { m_fShadowLengthY = fLengthY; } + void SetShadowColor( RageColor c ) { m_ShadowColor = c; } + // TODO: Implement hibernate as a tween type? + void SetHibernate( float fSecs ) { m_fHibernateSecondsLeft = fSecs; } + void SetDrawOrder( int iOrder ) { m_iDrawOrder = iOrder; } + int GetDrawOrder() const { return m_iDrawOrder; } + + virtual void EnableAnimation( bool b ) { m_bIsAnimating = b; } // Sprite needs to overload this + void StartAnimating() { this->EnableAnimation(true); } + void StopAnimating() { this->EnableAnimation(false); } + + // render states + void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } + void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } + void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; } + void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } + void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); } + virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; } + virtual void SetZWrite( bool b ) { m_bZWrite = b; } + void SetZBias( float f ) { m_fZBias = f; } + virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; } + + // Lua + virtual void PushSelf( lua_State *L ); + virtual void PushContext( lua_State *L ); + + // Named commands + void AddCommand( const RString &sCmdName, apActorCommands apac ); + bool HasCommand( const RString &sCmdName ) const; + const apActorCommands *GetCommand( const RString &sCommandName ) const; + void PlayCommand( const RString &sCommandName ) { HandleMessage( Message(sCommandName) ); } // convenience + void PlayCommandNoRecurse( const Message &msg ); + + // Commands by reference + virtual void RunCommands( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); + void RunCommands( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommands( *cmds, pParamTable ); } // convenience + virtual void RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable = NULL ) { RunCommands(cmds, pParamTable); } + // If we're a leaf, then execute this command. + virtual void RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable = NULL ) { RunCommands(cmds, pParamTable); } + + // Messages + virtual void HandleMessage( const Message &msg ); + + // Animation + virtual int GetNumStates() const { return 1; } + virtual void SetState( int iNewState ) {} + virtual float GetAnimationLengthSeconds() const { return 0; } + virtual void SetSecondsIntoAnimation( float fSeconds ) {} + virtual void SetUpdateRate( float fRate ) {} + + HiddenPtr m_pLuaInstance; + +protected: + /** @brief the name of the Actor. */ + RString m_sName; + /** @brief the current parent of this Actor if it exists. */ + Actor *m_pParent; + + /** @brief Some general information about the Tween. */ + struct TweenInfo + { + // counters for tweening + TweenInfo(); + ~TweenInfo(); + TweenInfo( const TweenInfo &cpy ); + TweenInfo &operator=( const TweenInfo &rhs ); + + ITween *m_pTween; + /** @brief How far into the tween are we? */ + float m_fTimeLeftInTween; + /** @brief The number of seconds between Start and End positions/zooms. */ + float m_fTweenTime; + /** @brief The command to execute when this TweenState goes into effect. */ + RString m_sCommandName; + }; + + RageVector3 m_baseRotation; + RageVector3 m_baseScale; + float m_fBaseAlpha; + + RageVector2 m_size; + TweenState m_current; + TweenState m_start; + struct TweenStateAndInfo + { + TweenState state; + TweenInfo info; + }; + vector m_Tweens; + + /** @brief Temporary variables that are filled just before drawing */ + TweenState *m_pTempState; + + bool m_bFirstUpdate; + + // Stuff for alignment + /** @brief The particular horizontal alignment. + * + * Use the defined constant values for best effect. */ + float m_fHorizAlign; + /** @brief The particular vertical alignment. + * + * Use the defined constant values for best effect. */ + float m_fVertAlign; + + // Stuff for effects +#if defined(SSC_FUTURES) // be able to stack effects + vector m_Effects; +#else // compatibility + Effect m_Effect; +#endif + float m_fSecsIntoEffect; + float m_fEffectDelta; + + // units depend on m_EffectClock + float m_fEffectRampUp; + float m_fEffectHoldAtHalf; + float m_fEffectRampDown; + float m_fEffectHoldAtZero; + float m_fEffectOffset; + EffectClock m_EffectClock; + + /* This can be used in lieu of the fDeltaTime parameter to Update() to + * follow the effect clock. Actor::Update must be called first. */ + float GetEffectDeltaTime() const { return m_fEffectDelta; } + + // todo: account for SSC_FUTURES by having these be vectors too -aj + RageColor m_effectColor1; + RageColor m_effectColor2; + RageVector3 m_vEffectMagnitude; + + // other properties + bool m_bVisible; + bool m_bIsAnimating; + float m_fHibernateSecondsLeft; + float m_fShadowLengthX; + float m_fShadowLengthY; + RageColor m_ShadowColor; + /** @brief The draw order priority. + * + * The lower this number is, the sooner it is drawn. */ + int m_iDrawOrder; + + // render states + BlendMode m_BlendMode; + ZTestMode m_ZTestMode; + CullMode m_CullMode; + bool m_bTextureWrapping; + bool m_bTextureFiltering; + bool m_bClearZBuffer; + bool m_bZWrite; + /** + * @brief The amount of bias. + * + * If 0, there is no bias. If 1, there is a full bias. */ + float m_fZBias; + + // global state + static float g_fCurrentBGMTime, g_fCurrentBGMBeat; + static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset; + +private: + // commands + map m_mapNameToCommands; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 32887346ed..c1d4e76879 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -1,630 +1,630 @@ -#include "global.h" -#include "ActorFrame.h" -#include "arch/Dialog/Dialog.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "XmlFile.h" -#include "ActorUtil.h" -#include "LuaBinding.h" -#include "ActorUtil.h" -#include "RageDisplay.h" -#include "ScreenDimensions.h" -#include "Foreach.h" - -/* Tricky: We need ActorFrames created in Lua to auto delete their children. - * We don't want classes that derive from ActorFrame to auto delete their - * children. The name "ActorFrame" is widely used in Lua, so we'll have - * that string instead create an ActorFrameAutoDeleteChildren object. - */ -//REGISTER_ACTOR_CLASS( ActorFrame ); -REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameAutoDeleteChildren, ActorFrame ); -ActorFrame *ActorFrame::Copy() const { return new ActorFrame(*this); } - - -ActorFrame::ActorFrame() -{ - m_bPropagateCommands = false; - m_bDeleteChildren = false; - m_bDrawByZPosition = false; - m_DrawFunction.SetFromNil(); - m_UpdateFunction.SetFromNil(); - m_fUpdateRate = 1; - m_fFOV = -1; - m_fVanishX = SCREEN_CENTER_X; - m_fVanishY = SCREEN_CENTER_Y; - m_bOverrideLighting = false; - m_bLighting = false; - m_ambientColor = RageColor(1,1,1,1); - m_diffuseColor = RageColor(1,1,1,1); - m_specularColor = RageColor(1,1,1,1); - m_lightDirection = RageVector3(0,0,1); -} - -ActorFrame::~ActorFrame() -{ - if( m_bDeleteChildren ) - DeleteAllChildren(); -} - -ActorFrame::ActorFrame( const ActorFrame &cpy ): - Actor( cpy ) -{ -#define CPY(x) this->x = cpy.x; - CPY( m_bPropagateCommands ); - CPY( m_bDeleteChildren ); - CPY( m_bDrawByZPosition ); - CPY( m_DrawFunction ); - CPY( m_UpdateFunction ); - CPY( m_fUpdateRate ); - CPY( m_fFOV ); - CPY( m_fVanishX ); - CPY( m_fVanishY ); - CPY( m_bOverrideLighting ); - CPY( m_bLighting ); - CPY( m_ambientColor ); - CPY( m_diffuseColor ); - CPY( m_specularColor ); - CPY( m_lightDirection ); -#undef CPY - - /* If m_bDeleteChildren, we own our children and it's up to us to copy - * them. If not, the derived class owns the children. This must preserve - * the current order of m_SubActors. */ - if( m_bDeleteChildren ) - { - for( unsigned i = 0; i < cpy.m_SubActors.size(); ++i ) - { - Actor *pActor = cpy.m_SubActors[i]->Copy(); - this->AddChild( pActor ); - } - } -} - -void ActorFrame::InitState() -{ - FOREACH( Actor*, m_SubActors, a ) - (*a)->InitState(); - Actor::InitState(); -} - -void ActorFrame::LoadFromNode( const XNode* pNode ) -{ - if( AutoLoadChildren() ) - LoadChildrenFromNode( pNode ); - - Actor::LoadFromNode( pNode ); - - pNode->GetAttrValue( "UpdateRate", m_fUpdateRate ); - pNode->GetAttrValue( "FOV", m_fFOV ); - pNode->GetAttrValue( "VanishX", m_fVanishX ); - pNode->GetAttrValue( "VanishY", m_fVanishY ); - m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting ); - // new lighting values (only ambient color seems to work?) -aj - RString sTemp1,sTemp2,sTemp3; - pNode->GetAttrValue( "AmbientColor", sTemp1 ); - m_ambientColor.FromString(sTemp1); - pNode->GetAttrValue( "DiffuseColor", sTemp2 ); - m_diffuseColor.FromString(sTemp2); - pNode->GetAttrValue( "SpecularColor", sTemp3 ); - m_specularColor.FromString(sTemp3); - // Values need to be converted into a RageVector3, so more work needs to be done... - //pNode->GetAttrValue( "LightDirection", m_lightDirection ); -} - -void ActorFrame::LoadChildrenFromNode( const XNode* pNode ) -{ - // Shouldn't be calling this unless we're going to delete our children. - ASSERT( m_bDeleteChildren ); - - // Load children - const XNode* pChildren = pNode->GetChild("children"); - bool bArrayOnly = false; - if( pChildren == NULL ) - { - bArrayOnly = true; - pChildren = pNode; - } - - FOREACH_CONST_Child( pChildren, pChild ) - { - if( bArrayOnly && !IsAnInt(pChild->GetName()) ) - continue; - - Actor* pChildActor = ActorUtil::LoadFromNode( pChild, this ); - if( pChildActor ) - AddChild( pChildActor ); - } - SortByDrawOrder(); -} - -void ActorFrame::AddChild( Actor *pActor ) -{ -#ifdef DEBUG - // check that this Actor isn't already added. - vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); - if( iter != m_SubActors.end() ) - Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) ); -#endif - - ASSERT( pActor ); - ASSERT( (void*)pActor != (void*)0xC0000005 ); - m_SubActors.push_back( pActor ); - - pActor->SetParent( this ); -} - -void ActorFrame::RemoveChild( Actor *pActor ) -{ - vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); - if( iter != m_SubActors.end() ) - m_SubActors.erase( iter ); -} - -void ActorFrame::TransferChildren( ActorFrame *pTo ) -{ - FOREACH( Actor*, m_SubActors, i ) - pTo->AddChild( *i ); - RemoveAllChildren(); -} - -Actor* ActorFrame::GetChild( const RString &sName ) -{ - FOREACH( Actor*, m_SubActors, a ) - { - if( (*a)->GetName() == sName ) - return *a; - } - return NULL; -} - -void ActorFrame::RemoveAllChildren() -{ - m_SubActors.clear(); -} - -void ActorFrame::MoveToTail( Actor* pActor ) -{ - vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); - if( iter == m_SubActors.end() ) // didn't find - { - ASSERT(0); // called with a pActor that doesn't exist - return; - } - - m_SubActors.erase( iter ); - m_SubActors.push_back( pActor ); -} - -void ActorFrame::MoveToHead( Actor* pActor ) -{ - vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); - if( iter == m_SubActors.end() ) // didn't find - { - ASSERT(0); // called with a pActor that doesn't exist - return; - } - - m_SubActors.erase( iter ); - m_SubActors.insert( m_SubActors.begin(), pActor ); -} - -void ActorFrame::BeginDraw() -{ - Actor::BeginDraw(); - if( m_fFOV != -1 ) - { - DISPLAY->CameraPushMatrix(); - DISPLAY->LoadMenuPerspective( m_fFOV, SCREEN_WIDTH, SCREEN_HEIGHT, m_fVanishX, m_fVanishY ); - } - - if( m_bOverrideLighting ) - { - DISPLAY->SetLighting( m_bLighting ); - if( m_bLighting ) - DISPLAY->SetLightDirectional( 0,m_ambientColor,m_diffuseColor,m_specularColor,m_lightDirection ); - } -} - - -void ActorFrame::DrawPrimitives() -{ - ASSERT_M( !m_bClearZBuffer, "ClearZBuffer not supported on ActorFrames" ); - - // Don't set Actor-defined render states because we won't be drawing - // any geometry that belongs to this object. - // Actor::DrawPrimitives(); - - if( unlikely(!m_DrawFunction.IsNil()) ) - { - Lua *L = LUA->Get(); - m_DrawFunction.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - this->PushSelf( L ); - RString sError; - if( !LuaHelpers::RunScriptOnStack(L, sError, 1, 0) ) // 1 arg, 0 results - LOG->Warn( "Error running DrawFunction: %s", sError.c_str() ); - LUA->Release(L); - return; - } - - // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space - if( m_bDrawByZPosition ) - { - vector subs = m_SubActors; - ActorUtil::SortByZPosition( subs ); - for( unsigned i=0; iDraw(); - } - else - { - for( unsigned i=0; iDraw(); - } -} - - -void ActorFrame::EndDraw() -{ - if( m_bOverrideLighting ) - { - // TODO: pop state instead of turning lighting off - DISPLAY->SetLightOff( 0 ); - DISPLAY->SetLighting( false ); - } - - if( m_fFOV != -1 ) - { - DISPLAY->CameraPopMatrix(); - } - Actor::EndDraw(); -} - -void ActorFrame::PushChildrenTable( lua_State *L ) -{ - lua_newtable( L ); - FOREACH( Actor*, m_SubActors, a ) - { - LuaHelpers::Push( L, (*a)->GetName() ); - (*a)->PushSelf( L ); - lua_rawset( L, -3 ); - } -} - -void ActorFrame::PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable ) -{ - const apActorCommands *pCmd = GetCommand( sCommandName ); - if( pCmd != NULL ) - RunCommandsOnChildren( *pCmd, pParamTable ); -} - -void ActorFrame::PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable ) -{ - const apActorCommands *pCmd = GetCommand( sCommandName ); - if( pCmd != NULL ) - RunCommandsOnLeaves( **pCmd, pParamTable ); -} - -void ActorFrame::RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable ) -{ - for( unsigned i=0; iRunCommandsRecursively( cmds, pParamTable ); - Actor::RunCommandsRecursively( cmds, pParamTable ); -} - -void ActorFrame::RunCommandsOnChildren( const LuaReference& cmds, const LuaReference *pParamTable ) -{ - for( unsigned i=0; iRunCommands( cmds, pParamTable ); -} - -void ActorFrame::RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable ) -{ - for( unsigned i=0; iRunCommandsOnLeaves( cmds, pParamTable ); -} - -void ActorFrame::UpdateInternal( float fDeltaTime ) -{ -// LOG->Trace( "ActorFrame::Update( %f )", fDeltaTime ); - - fDeltaTime *= m_fUpdateRate; - - Actor::UpdateInternal( fDeltaTime ); - - // update all sub-Actors - for( vector::iterator it=m_SubActors.begin(); it!=m_SubActors.end(); it++ ) - { - Actor *pActor = *it; - pActor->Update(fDeltaTime); - } - - if( unlikely(!m_UpdateFunction.IsNil()) ) - { - Lua *L = LUA->Get(); - m_UpdateFunction.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - this->PushSelf( L ); - lua_pushnumber( L, fDeltaTime ); - RString sError; - - if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) // 1 args, 0 results - LOG->Warn( "Error running m_UpdateFunction: %s", sError.c_str() ); - LUA->Release(L); - } -} - -#define PropagateActorFrameCommand( cmd ) \ - void ActorFrame::cmd() \ - { \ - Actor::cmd(); \ - \ - /* set all sub-Actors */ \ - for( unsigned i=0; icmd(); \ - } - -#define PropagateActorFrameCommand1Param( cmd, type ) \ - void ActorFrame::cmd( type f ) \ - { \ - Actor::cmd( f ); \ - \ - /* set all sub-Actors */ \ - for( unsigned i=0; icmd( f ); \ - } - -PropagateActorFrameCommand( FinishTweening ) -PropagateActorFrameCommand1Param( SetDiffuse, RageColor ) -PropagateActorFrameCommand1Param( SetZTestMode, ZTestMode ) -PropagateActorFrameCommand1Param( SetZWrite, bool ) -PropagateActorFrameCommand1Param( HurryTweening, float ) -PropagateActorFrameCommand1Param( SetDiffuseAlpha, float ) -PropagateActorFrameCommand1Param( SetBaseAlpha, float ) - - -float ActorFrame::GetTweenTimeLeft() const -{ - float m = Actor::GetTweenTimeLeft(); - - for( unsigned i=0; iGetTweenTimeLeft()); - } - - return m; - -} - -static bool CompareActorsByDrawOrder(const Actor *p1, const Actor *p2) -{ - return p1->GetDrawOrder() < p2->GetDrawOrder(); -} - -void ActorFrame::SortByDrawOrder() -{ - // Preserve ordering of Actors with equal DrawOrders. - stable_sort( m_SubActors.begin(), m_SubActors.end(), CompareActorsByDrawOrder ); -} - -void ActorFrame::DeleteAllChildren() -{ - for( unsigned i=0; iHandleMessage( msg ); - } -} - -void ActorFrame::SetDrawByZPosition( bool b ) -{ - m_bDrawByZPosition = b; -} - - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorFrame. */ -class LunaActorFrame : public Luna -{ -public: - static int playcommandonchildren( T* p, lua_State *L ) { p->PlayCommandOnChildren(SArg(1)); return 0; } - static int playcommandonleaves( T* p, lua_State *L ) { p->PlayCommandOnLeaves(SArg(1)); return 0; } - static int runcommandsonleaves( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TFUNCTION ); - LuaReference cmds; - cmds.SetFromStack( L ); - - p->RunCommandsOnLeaves( cmds ); - return 0; - } - static int RunCommandsOnChildren( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TFUNCTION ); - lua_pushvalue( L, 2 ); - LuaReference ParamTable; - ParamTable.SetFromStack( L ); - - lua_pushvalue( L, 1 ); - LuaReference cmds; - cmds.SetFromStack( L ); - - p->RunCommandsOnChildren( cmds, &ParamTable ); - return 0; - } - static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( BIArg(1) ); return 0; } - static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } - static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; } - static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } - static int vanishpoint( T* p, lua_State *L ) { p->SetVanishPoint( FArg(1), FArg(2) ); return 0; } - static int GetChild( T* p, lua_State *L ) - { - Actor *pChild = p->GetChild( SArg(1) ); - if( pChild ) - pChild->PushSelf( L ); - else - lua_pushnil( L ); - return 1; - } - static int GetChildren( T* p, lua_State *L ) - { - p->PushChildrenTable( L ); - return 1; - } - static int GetNumChildren( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumChildren() ); return 1; } - static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; } - static int SetDrawFunction( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TFUNCTION ); - - LuaReference ref; - lua_pushvalue( L, 1 ); - ref.SetFromStack( L ); - p->SetDrawFunction( ref ); - return 0; - } - static int GetDrawFunction( T* p, lua_State *L ) - { - p->GetDrawFunction().PushSelf(L); - return 1; - } - static int SetUpdateFunction( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TFUNCTION ); - - LuaReference ref; - lua_pushvalue( L, 1 ); - ref.SetFromStack( L ); - p->SetUpdateFunction( ref ); - return 0; - } - static int SortByDrawOrder( T* p, lua_State *L ) { p->SortByDrawOrder(); return 0; } - - //static int CustomLighting( T* p, lua_State *L ) { p->SetCustomLighting(BArg(1)); return 0; } - static int SetAmbientLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetAmbientLightColor( c ); return 0; } - static int SetDiffuseLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLightColor( c ); return 0; } - static int SetSpecularLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetSpecularLightColor( c ); return 0; } - static int SetLightDirection( T* p, lua_State *L ) - { - luaL_checktype( L, 1, LUA_TTABLE ); - lua_pushvalue( L, 1 ); - vector coords; - LuaHelpers::ReadArrayFromTable( coords, L ); - lua_pop( L, 1 ); - if( coords.size() !=3 ) - { - //error - } - RageVector3 vTmp = RageVector3( coords[0], coords[1], coords[2] ); - p->SetLightDirection( vTmp ); - return 0; - } - - // xxx: these might not be good ideas... -aj - /* - static int AddChild( T* p, lua_State *L ) - { - // this one is tricky, we need to get an Actor from Lua. - return 0; - } - - static int RemoveChild( T* p, lua_State *L ) - { - Actor *pChild = p->GetChild( SArg(1) ); - if( pChild ) - p->RemoveChild( pChild ); - else - lua_pushnil( L ); - return 1; - } - static int RemoveAllChildren( T* p, lua_State *L ) { p->RemoveAllChildren( ); return 0; } - */ - - LunaActorFrame() - { - ADD_METHOD( playcommandonchildren ); - ADD_METHOD( playcommandonleaves ); - ADD_METHOD( runcommandsonleaves ); - ADD_METHOD( RunCommandsOnChildren ); - ADD_METHOD( propagate ); // deprecated - ADD_METHOD( fov ); - ADD_METHOD( SetUpdateRate ); - ADD_METHOD( SetFOV ); - ADD_METHOD( vanishpoint ); - ADD_METHOD( GetChild ); - ADD_METHOD( GetChildren ); - ADD_METHOD( GetNumChildren ); - ADD_METHOD( SetDrawByZPosition ); - ADD_METHOD( SetDrawFunction ); - ADD_METHOD( GetDrawFunction ); - ADD_METHOD( SetUpdateFunction ); - ADD_METHOD( SortByDrawOrder ); - //ADD_METHOD( CustomLighting ); - ADD_METHOD( SetAmbientLightColor ); - ADD_METHOD( SetDiffuseLightColor ); - ADD_METHOD( SetSpecularLightColor ); - ADD_METHOD( SetLightDirection ); - // not good ideas - /* - ADD_METHOD( AddChild ); - ADD_METHOD( RemoveChild ); - ADD_METHOD( RemoveAllChildren ); - */ - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorFrame, Actor ) -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorFrame.h" +#include "arch/Dialog/Dialog.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "XmlFile.h" +#include "ActorUtil.h" +#include "LuaBinding.h" +#include "ActorUtil.h" +#include "RageDisplay.h" +#include "ScreenDimensions.h" +#include "Foreach.h" + +/* Tricky: We need ActorFrames created in Lua to auto delete their children. + * We don't want classes that derive from ActorFrame to auto delete their + * children. The name "ActorFrame" is widely used in Lua, so we'll have + * that string instead create an ActorFrameAutoDeleteChildren object. + */ +//REGISTER_ACTOR_CLASS( ActorFrame ); +REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameAutoDeleteChildren, ActorFrame ); +ActorFrame *ActorFrame::Copy() const { return new ActorFrame(*this); } + + +ActorFrame::ActorFrame() +{ + m_bPropagateCommands = false; + m_bDeleteChildren = false; + m_bDrawByZPosition = false; + m_DrawFunction.SetFromNil(); + m_UpdateFunction.SetFromNil(); + m_fUpdateRate = 1; + m_fFOV = -1; + m_fVanishX = SCREEN_CENTER_X; + m_fVanishY = SCREEN_CENTER_Y; + m_bOverrideLighting = false; + m_bLighting = false; + m_ambientColor = RageColor(1,1,1,1); + m_diffuseColor = RageColor(1,1,1,1); + m_specularColor = RageColor(1,1,1,1); + m_lightDirection = RageVector3(0,0,1); +} + +ActorFrame::~ActorFrame() +{ + if( m_bDeleteChildren ) + DeleteAllChildren(); +} + +ActorFrame::ActorFrame( const ActorFrame &cpy ): + Actor( cpy ) +{ +#define CPY(x) this->x = cpy.x; + CPY( m_bPropagateCommands ); + CPY( m_bDeleteChildren ); + CPY( m_bDrawByZPosition ); + CPY( m_DrawFunction ); + CPY( m_UpdateFunction ); + CPY( m_fUpdateRate ); + CPY( m_fFOV ); + CPY( m_fVanishX ); + CPY( m_fVanishY ); + CPY( m_bOverrideLighting ); + CPY( m_bLighting ); + CPY( m_ambientColor ); + CPY( m_diffuseColor ); + CPY( m_specularColor ); + CPY( m_lightDirection ); +#undef CPY + + /* If m_bDeleteChildren, we own our children and it's up to us to copy + * them. If not, the derived class owns the children. This must preserve + * the current order of m_SubActors. */ + if( m_bDeleteChildren ) + { + for( unsigned i = 0; i < cpy.m_SubActors.size(); ++i ) + { + Actor *pActor = cpy.m_SubActors[i]->Copy(); + this->AddChild( pActor ); + } + } +} + +void ActorFrame::InitState() +{ + FOREACH( Actor*, m_SubActors, a ) + (*a)->InitState(); + Actor::InitState(); +} + +void ActorFrame::LoadFromNode( const XNode* pNode ) +{ + if( AutoLoadChildren() ) + LoadChildrenFromNode( pNode ); + + Actor::LoadFromNode( pNode ); + + pNode->GetAttrValue( "UpdateRate", m_fUpdateRate ); + pNode->GetAttrValue( "FOV", m_fFOV ); + pNode->GetAttrValue( "VanishX", m_fVanishX ); + pNode->GetAttrValue( "VanishY", m_fVanishY ); + m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting ); + // new lighting values (only ambient color seems to work?) -aj + RString sTemp1,sTemp2,sTemp3; + pNode->GetAttrValue( "AmbientColor", sTemp1 ); + m_ambientColor.FromString(sTemp1); + pNode->GetAttrValue( "DiffuseColor", sTemp2 ); + m_diffuseColor.FromString(sTemp2); + pNode->GetAttrValue( "SpecularColor", sTemp3 ); + m_specularColor.FromString(sTemp3); + // Values need to be converted into a RageVector3, so more work needs to be done... + //pNode->GetAttrValue( "LightDirection", m_lightDirection ); +} + +void ActorFrame::LoadChildrenFromNode( const XNode* pNode ) +{ + // Shouldn't be calling this unless we're going to delete our children. + ASSERT( m_bDeleteChildren ); + + // Load children + const XNode* pChildren = pNode->GetChild("children"); + bool bArrayOnly = false; + if( pChildren == NULL ) + { + bArrayOnly = true; + pChildren = pNode; + } + + FOREACH_CONST_Child( pChildren, pChild ) + { + if( bArrayOnly && !IsAnInt(pChild->GetName()) ) + continue; + + Actor* pChildActor = ActorUtil::LoadFromNode( pChild, this ); + if( pChildActor ) + AddChild( pChildActor ); + } + SortByDrawOrder(); +} + +void ActorFrame::AddChild( Actor *pActor ) +{ +#ifdef DEBUG + // check that this Actor isn't already added. + vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); + if( iter != m_SubActors.end() ) + Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", GetLineage().c_str(), pActor->GetName().c_str()) ); +#endif + + ASSERT( pActor ); + ASSERT( (void*)pActor != (void*)0xC0000005 ); + m_SubActors.push_back( pActor ); + + pActor->SetParent( this ); +} + +void ActorFrame::RemoveChild( Actor *pActor ) +{ + vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); + if( iter != m_SubActors.end() ) + m_SubActors.erase( iter ); +} + +void ActorFrame::TransferChildren( ActorFrame *pTo ) +{ + FOREACH( Actor*, m_SubActors, i ) + pTo->AddChild( *i ); + RemoveAllChildren(); +} + +Actor* ActorFrame::GetChild( const RString &sName ) +{ + FOREACH( Actor*, m_SubActors, a ) + { + if( (*a)->GetName() == sName ) + return *a; + } + return NULL; +} + +void ActorFrame::RemoveAllChildren() +{ + m_SubActors.clear(); +} + +void ActorFrame::MoveToTail( Actor* pActor ) +{ + vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); + if( iter == m_SubActors.end() ) // didn't find + { + ASSERT(0); // called with a pActor that doesn't exist + return; + } + + m_SubActors.erase( iter ); + m_SubActors.push_back( pActor ); +} + +void ActorFrame::MoveToHead( Actor* pActor ) +{ + vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); + if( iter == m_SubActors.end() ) // didn't find + { + ASSERT(0); // called with a pActor that doesn't exist + return; + } + + m_SubActors.erase( iter ); + m_SubActors.insert( m_SubActors.begin(), pActor ); +} + +void ActorFrame::BeginDraw() +{ + Actor::BeginDraw(); + if( m_fFOV != -1 ) + { + DISPLAY->CameraPushMatrix(); + DISPLAY->LoadMenuPerspective( m_fFOV, SCREEN_WIDTH, SCREEN_HEIGHT, m_fVanishX, m_fVanishY ); + } + + if( m_bOverrideLighting ) + { + DISPLAY->SetLighting( m_bLighting ); + if( m_bLighting ) + DISPLAY->SetLightDirectional( 0,m_ambientColor,m_diffuseColor,m_specularColor,m_lightDirection ); + } +} + + +void ActorFrame::DrawPrimitives() +{ + ASSERT_M( !m_bClearZBuffer, "ClearZBuffer not supported on ActorFrames" ); + + // Don't set Actor-defined render states because we won't be drawing + // any geometry that belongs to this object. + // Actor::DrawPrimitives(); + + if( unlikely(!m_DrawFunction.IsNil()) ) + { + Lua *L = LUA->Get(); + m_DrawFunction.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + this->PushSelf( L ); + RString sError; + if( !LuaHelpers::RunScriptOnStack(L, sError, 1, 0) ) // 1 arg, 0 results + LOG->Warn( "Error running DrawFunction: %s", sError.c_str() ); + LUA->Release(L); + return; + } + + // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space + if( m_bDrawByZPosition ) + { + vector subs = m_SubActors; + ActorUtil::SortByZPosition( subs ); + for( unsigned i=0; iDraw(); + } + else + { + for( unsigned i=0; iDraw(); + } +} + + +void ActorFrame::EndDraw() +{ + if( m_bOverrideLighting ) + { + // TODO: pop state instead of turning lighting off + DISPLAY->SetLightOff( 0 ); + DISPLAY->SetLighting( false ); + } + + if( m_fFOV != -1 ) + { + DISPLAY->CameraPopMatrix(); + } + Actor::EndDraw(); +} + +void ActorFrame::PushChildrenTable( lua_State *L ) +{ + lua_newtable( L ); + FOREACH( Actor*, m_SubActors, a ) + { + LuaHelpers::Push( L, (*a)->GetName() ); + (*a)->PushSelf( L ); + lua_rawset( L, -3 ); + } +} + +void ActorFrame::PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable ) +{ + const apActorCommands *pCmd = GetCommand( sCommandName ); + if( pCmd != NULL ) + RunCommandsOnChildren( *pCmd, pParamTable ); +} + +void ActorFrame::PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable ) +{ + const apActorCommands *pCmd = GetCommand( sCommandName ); + if( pCmd != NULL ) + RunCommandsOnLeaves( **pCmd, pParamTable ); +} + +void ActorFrame::RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable ) +{ + for( unsigned i=0; iRunCommandsRecursively( cmds, pParamTable ); + Actor::RunCommandsRecursively( cmds, pParamTable ); +} + +void ActorFrame::RunCommandsOnChildren( const LuaReference& cmds, const LuaReference *pParamTable ) +{ + for( unsigned i=0; iRunCommands( cmds, pParamTable ); +} + +void ActorFrame::RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable ) +{ + for( unsigned i=0; iRunCommandsOnLeaves( cmds, pParamTable ); +} + +void ActorFrame::UpdateInternal( float fDeltaTime ) +{ +// LOG->Trace( "ActorFrame::Update( %f )", fDeltaTime ); + + fDeltaTime *= m_fUpdateRate; + + Actor::UpdateInternal( fDeltaTime ); + + // update all sub-Actors + for( vector::iterator it=m_SubActors.begin(); it!=m_SubActors.end(); it++ ) + { + Actor *pActor = *it; + pActor->Update(fDeltaTime); + } + + if( unlikely(!m_UpdateFunction.IsNil()) ) + { + Lua *L = LUA->Get(); + m_UpdateFunction.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + this->PushSelf( L ); + lua_pushnumber( L, fDeltaTime ); + RString sError; + + if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) // 1 args, 0 results + LOG->Warn( "Error running m_UpdateFunction: %s", sError.c_str() ); + LUA->Release(L); + } +} + +#define PropagateActorFrameCommand( cmd ) \ + void ActorFrame::cmd() \ + { \ + Actor::cmd(); \ + \ + /* set all sub-Actors */ \ + for( unsigned i=0; icmd(); \ + } + +#define PropagateActorFrameCommand1Param( cmd, type ) \ + void ActorFrame::cmd( type f ) \ + { \ + Actor::cmd( f ); \ + \ + /* set all sub-Actors */ \ + for( unsigned i=0; icmd( f ); \ + } + +PropagateActorFrameCommand( FinishTweening ) +PropagateActorFrameCommand1Param( SetDiffuse, RageColor ) +PropagateActorFrameCommand1Param( SetZTestMode, ZTestMode ) +PropagateActorFrameCommand1Param( SetZWrite, bool ) +PropagateActorFrameCommand1Param( HurryTweening, float ) +PropagateActorFrameCommand1Param( SetDiffuseAlpha, float ) +PropagateActorFrameCommand1Param( SetBaseAlpha, float ) + + +float ActorFrame::GetTweenTimeLeft() const +{ + float m = Actor::GetTweenTimeLeft(); + + for( unsigned i=0; iGetTweenTimeLeft()); + } + + return m; + +} + +static bool CompareActorsByDrawOrder(const Actor *p1, const Actor *p2) +{ + return p1->GetDrawOrder() < p2->GetDrawOrder(); +} + +void ActorFrame::SortByDrawOrder() +{ + // Preserve ordering of Actors with equal DrawOrders. + stable_sort( m_SubActors.begin(), m_SubActors.end(), CompareActorsByDrawOrder ); +} + +void ActorFrame::DeleteAllChildren() +{ + for( unsigned i=0; iHandleMessage( msg ); + } +} + +void ActorFrame::SetDrawByZPosition( bool b ) +{ + m_bDrawByZPosition = b; +} + + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorFrame. */ +class LunaActorFrame : public Luna +{ +public: + static int playcommandonchildren( T* p, lua_State *L ) { p->PlayCommandOnChildren(SArg(1)); return 0; } + static int playcommandonleaves( T* p, lua_State *L ) { p->PlayCommandOnLeaves(SArg(1)); return 0; } + static int runcommandsonleaves( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TFUNCTION ); + LuaReference cmds; + cmds.SetFromStack( L ); + + p->RunCommandsOnLeaves( cmds ); + return 0; + } + static int RunCommandsOnChildren( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TFUNCTION ); + lua_pushvalue( L, 2 ); + LuaReference ParamTable; + ParamTable.SetFromStack( L ); + + lua_pushvalue( L, 1 ); + LuaReference cmds; + cmds.SetFromStack( L ); + + p->RunCommandsOnChildren( cmds, &ParamTable ); + return 0; + } + static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( BIArg(1) ); return 0; } + static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } + static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; } + static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } + static int vanishpoint( T* p, lua_State *L ) { p->SetVanishPoint( FArg(1), FArg(2) ); return 0; } + static int GetChild( T* p, lua_State *L ) + { + Actor *pChild = p->GetChild( SArg(1) ); + if( pChild ) + pChild->PushSelf( L ); + else + lua_pushnil( L ); + return 1; + } + static int GetChildren( T* p, lua_State *L ) + { + p->PushChildrenTable( L ); + return 1; + } + static int GetNumChildren( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumChildren() ); return 1; } + static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; } + static int SetDrawFunction( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TFUNCTION ); + + LuaReference ref; + lua_pushvalue( L, 1 ); + ref.SetFromStack( L ); + p->SetDrawFunction( ref ); + return 0; + } + static int GetDrawFunction( T* p, lua_State *L ) + { + p->GetDrawFunction().PushSelf(L); + return 1; + } + static int SetUpdateFunction( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TFUNCTION ); + + LuaReference ref; + lua_pushvalue( L, 1 ); + ref.SetFromStack( L ); + p->SetUpdateFunction( ref ); + return 0; + } + static int SortByDrawOrder( T* p, lua_State *L ) { p->SortByDrawOrder(); return 0; } + + //static int CustomLighting( T* p, lua_State *L ) { p->SetCustomLighting(BArg(1)); return 0; } + static int SetAmbientLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetAmbientLightColor( c ); return 0; } + static int SetDiffuseLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLightColor( c ); return 0; } + static int SetSpecularLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetSpecularLightColor( c ); return 0; } + static int SetLightDirection( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TTABLE ); + lua_pushvalue( L, 1 ); + vector coords; + LuaHelpers::ReadArrayFromTable( coords, L ); + lua_pop( L, 1 ); + if( coords.size() !=3 ) + { + //error + } + RageVector3 vTmp = RageVector3( coords[0], coords[1], coords[2] ); + p->SetLightDirection( vTmp ); + return 0; + } + + // xxx: these might not be good ideas... -aj + /* + static int AddChild( T* p, lua_State *L ) + { + // this one is tricky, we need to get an Actor from Lua. + return 0; + } + + static int RemoveChild( T* p, lua_State *L ) + { + Actor *pChild = p->GetChild( SArg(1) ); + if( pChild ) + p->RemoveChild( pChild ); + else + lua_pushnil( L ); + return 1; + } + static int RemoveAllChildren( T* p, lua_State *L ) { p->RemoveAllChildren( ); return 0; } + */ + + LunaActorFrame() + { + ADD_METHOD( playcommandonchildren ); + ADD_METHOD( playcommandonleaves ); + ADD_METHOD( runcommandsonleaves ); + ADD_METHOD( RunCommandsOnChildren ); + ADD_METHOD( propagate ); // deprecated + ADD_METHOD( fov ); + ADD_METHOD( SetUpdateRate ); + ADD_METHOD( SetFOV ); + ADD_METHOD( vanishpoint ); + ADD_METHOD( GetChild ); + ADD_METHOD( GetChildren ); + ADD_METHOD( GetNumChildren ); + ADD_METHOD( SetDrawByZPosition ); + ADD_METHOD( SetDrawFunction ); + ADD_METHOD( GetDrawFunction ); + ADD_METHOD( SetUpdateFunction ); + ADD_METHOD( SortByDrawOrder ); + //ADD_METHOD( CustomLighting ); + ADD_METHOD( SetAmbientLightColor ); + ADD_METHOD( SetDiffuseLightColor ); + ADD_METHOD( SetSpecularLightColor ); + ADD_METHOD( SetLightDirection ); + // not good ideas + /* + ADD_METHOD( AddChild ); + ADD_METHOD( RemoveChild ); + ADD_METHOD( RemoveAllChildren ); + */ + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorFrame, Actor ) +// lua end + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorFrame.h b/src/ActorFrame.h index 3aeaf2a105..ba377ffcfb 100644 --- a/src/ActorFrame.h +++ b/src/ActorFrame.h @@ -1,164 +1,164 @@ -#ifndef ACTORFRAME_H -#define ACTORFRAME_H - -#include "Actor.h" - -/** @brief A container for other Actors. */ -class ActorFrame : public Actor -{ -public: - ActorFrame(); - ActorFrame( const ActorFrame &cpy ); - virtual ~ActorFrame(); - - /** @brief Set up the initial state. */ - virtual void InitState(); - void LoadFromNode( const XNode* pNode ); - virtual ActorFrame *Copy() const; - - /** - * @brief Add a new child to the ActorFrame. - * @param pActor the new Actor to add. */ - virtual void AddChild( Actor *pActor ); - /** - * @brief Remove the specified child from the ActorFrame. - * @param pActor the Actor to remove. */ - virtual void RemoveChild( Actor *pActor ); - void TransferChildren( ActorFrame *pTo ); - Actor* GetChild( const RString &sName ); - vector GetChildren() { return m_SubActors; } - int GetNumChildren() const { return m_SubActors.size(); } - - /** @brief Remove all of the children from the frame. */ - void RemoveAllChildren(); - /** - * @brief Move a particular actor to the tail. - * @param pActor the actor to go to the tail. - */ - void MoveToTail( Actor* pActor ); - /** - * @brief Move a particular actor to the head. - * @param pActor the actor to go to the head. - */ - void MoveToHead( Actor* pActor ); - void SortByDrawOrder(); - void SetDrawByZPosition( bool b ); - - void SetDrawFunction( const LuaReference &DrawFunction ) { m_DrawFunction = DrawFunction; } - void SetUpdateFunction( const LuaReference &UpdateFunction ) { m_UpdateFunction = UpdateFunction; } - - LuaReference GetDrawFunction() const { return m_DrawFunction; } - virtual bool AutoLoadChildren() const { return false; } // derived classes override to automatically LoadChildrenFromNode - void DeleteChildrenWhenDone( bool bDelete=true ) { m_bDeleteChildren = bDelete; } - void DeleteAllChildren(); - - // Commands - virtual void PushSelf( lua_State *L ); - void PushChildrenTable( lua_State *L ); - void PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable = NULL ); - void PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable = NULL ); - - virtual void RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); - virtual void RunCommandsOnChildren( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); /* but not on self */ - void RunCommandsOnChildren( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommandsOnChildren( *cmds, pParamTable ); } // convenience - virtual void RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); /* but not on self */ - - virtual void UpdateInternal( float fDeltaTime ); - virtual void BeginDraw(); - virtual void DrawPrimitives(); - virtual void EndDraw(); - - // propagated commands - virtual void SetDiffuse( RageColor c ); - virtual void SetDiffuseAlpha( float f ); - virtual void SetBaseAlpha( float f ); - virtual void SetZTestMode( ZTestMode mode ); - virtual void SetZWrite( bool b ); - virtual void FinishTweening(); - virtual void HurryTweening( float factor ); - - void SetUpdateRate( float fUpdateRate ) { m_fUpdateRate = fUpdateRate; } - void SetFOV( float fFOV ) { m_fFOV = fFOV; } - void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; } - - void SetCustomLighting( bool bCustomLighting ) { m_bOverrideLighting = bCustomLighting; } - void SetAmbientLightColor( RageColor c ) { m_ambientColor = c; } - void SetDiffuseLightColor( RageColor c ) { m_diffuseColor = c; } - void SetSpecularLightColor( RageColor c ) { m_specularColor = c; } - void SetLightDirection( RageVector3 vec ) { m_lightDirection = vec; } - - virtual void SetPropagateCommands( bool b ); - - /** @brief Amount of time until all tweens (and all children's tweens) have stopped: */ - virtual float GetTweenTimeLeft() const; - - virtual void HandleMessage( const Message &msg ); - virtual void RunCommands( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); - void RunCommands( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommands( *cmds, pParamTable ); } // convenience - -protected: - void LoadChildrenFromNode( const XNode* pNode ); - - /** @brief The children Actors used by the ActorFrame. */ - vector m_SubActors; - bool m_bPropagateCommands; - bool m_bDeleteChildren; - bool m_bDrawByZPosition; - LuaReference m_UpdateFunction; - LuaReference m_DrawFunction; - - // state effects - float m_fUpdateRate; - float m_fFOV; // -1 = no change - float m_fVanishX; - float m_fVanishY; - /** - * @brief A flad to see if an override for the lighting is needed. - * - * If true, set lightning to m_bLightning. */ - bool m_bOverrideLighting; - bool m_bLighting; - - // lighting variables - RageColor m_ambientColor; - RageColor m_diffuseColor; - RageColor m_specularColor; - RageVector3 m_lightDirection; -}; -/** @brief an ActorFrame that handles deleting children Actors automatically. */ -class ActorFrameAutoDeleteChildren : public ActorFrame -{ -public: - ActorFrameAutoDeleteChildren() { DeleteChildrenWhenDone(true); } - virtual bool AutoLoadChildren() const { return true; } - virtual ActorFrameAutoDeleteChildren *Copy() const; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTORFRAME_H +#define ACTORFRAME_H + +#include "Actor.h" + +/** @brief A container for other Actors. */ +class ActorFrame : public Actor +{ +public: + ActorFrame(); + ActorFrame( const ActorFrame &cpy ); + virtual ~ActorFrame(); + + /** @brief Set up the initial state. */ + virtual void InitState(); + void LoadFromNode( const XNode* pNode ); + virtual ActorFrame *Copy() const; + + /** + * @brief Add a new child to the ActorFrame. + * @param pActor the new Actor to add. */ + virtual void AddChild( Actor *pActor ); + /** + * @brief Remove the specified child from the ActorFrame. + * @param pActor the Actor to remove. */ + virtual void RemoveChild( Actor *pActor ); + void TransferChildren( ActorFrame *pTo ); + Actor* GetChild( const RString &sName ); + vector GetChildren() { return m_SubActors; } + int GetNumChildren() const { return m_SubActors.size(); } + + /** @brief Remove all of the children from the frame. */ + void RemoveAllChildren(); + /** + * @brief Move a particular actor to the tail. + * @param pActor the actor to go to the tail. + */ + void MoveToTail( Actor* pActor ); + /** + * @brief Move a particular actor to the head. + * @param pActor the actor to go to the head. + */ + void MoveToHead( Actor* pActor ); + void SortByDrawOrder(); + void SetDrawByZPosition( bool b ); + + void SetDrawFunction( const LuaReference &DrawFunction ) { m_DrawFunction = DrawFunction; } + void SetUpdateFunction( const LuaReference &UpdateFunction ) { m_UpdateFunction = UpdateFunction; } + + LuaReference GetDrawFunction() const { return m_DrawFunction; } + virtual bool AutoLoadChildren() const { return false; } // derived classes override to automatically LoadChildrenFromNode + void DeleteChildrenWhenDone( bool bDelete=true ) { m_bDeleteChildren = bDelete; } + void DeleteAllChildren(); + + // Commands + virtual void PushSelf( lua_State *L ); + void PushChildrenTable( lua_State *L ); + void PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable = NULL ); + void PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable = NULL ); + + virtual void RunCommandsRecursively( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); + virtual void RunCommandsOnChildren( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); /* but not on self */ + void RunCommandsOnChildren( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommandsOnChildren( *cmds, pParamTable ); } // convenience + virtual void RunCommandsOnLeaves( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); /* but not on self */ + + virtual void UpdateInternal( float fDeltaTime ); + virtual void BeginDraw(); + virtual void DrawPrimitives(); + virtual void EndDraw(); + + // propagated commands + virtual void SetDiffuse( RageColor c ); + virtual void SetDiffuseAlpha( float f ); + virtual void SetBaseAlpha( float f ); + virtual void SetZTestMode( ZTestMode mode ); + virtual void SetZWrite( bool b ); + virtual void FinishTweening(); + virtual void HurryTweening( float factor ); + + void SetUpdateRate( float fUpdateRate ) { m_fUpdateRate = fUpdateRate; } + void SetFOV( float fFOV ) { m_fFOV = fFOV; } + void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; } + + void SetCustomLighting( bool bCustomLighting ) { m_bOverrideLighting = bCustomLighting; } + void SetAmbientLightColor( RageColor c ) { m_ambientColor = c; } + void SetDiffuseLightColor( RageColor c ) { m_diffuseColor = c; } + void SetSpecularLightColor( RageColor c ) { m_specularColor = c; } + void SetLightDirection( RageVector3 vec ) { m_lightDirection = vec; } + + virtual void SetPropagateCommands( bool b ); + + /** @brief Amount of time until all tweens (and all children's tweens) have stopped: */ + virtual float GetTweenTimeLeft() const; + + virtual void HandleMessage( const Message &msg ); + virtual void RunCommands( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); + void RunCommands( const apActorCommands& cmds, const LuaReference *pParamTable = NULL ) { this->RunCommands( *cmds, pParamTable ); } // convenience + +protected: + void LoadChildrenFromNode( const XNode* pNode ); + + /** @brief The children Actors used by the ActorFrame. */ + vector m_SubActors; + bool m_bPropagateCommands; + bool m_bDeleteChildren; + bool m_bDrawByZPosition; + LuaReference m_UpdateFunction; + LuaReference m_DrawFunction; + + // state effects + float m_fUpdateRate; + float m_fFOV; // -1 = no change + float m_fVanishX; + float m_fVanishY; + /** + * @brief A flad to see if an override for the lighting is needed. + * + * If true, set lightning to m_bLightning. */ + bool m_bOverrideLighting; + bool m_bLighting; + + // lighting variables + RageColor m_ambientColor; + RageColor m_diffuseColor; + RageColor m_specularColor; + RageVector3 m_lightDirection; +}; +/** @brief an ActorFrame that handles deleting children Actors automatically. */ +class ActorFrameAutoDeleteChildren : public ActorFrame +{ +public: + ActorFrameAutoDeleteChildren() { DeleteChildrenWhenDone(true); } + virtual bool AutoLoadChildren() const { return true; } + virtual ActorFrameAutoDeleteChildren *Copy() const; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorFrameTexture.cpp b/src/ActorFrameTexture.cpp index 9b36b85e5e..4a907f7611 100644 --- a/src/ActorFrameTexture.cpp +++ b/src/ActorFrameTexture.cpp @@ -1,127 +1,127 @@ -#include "global.h" -#include "ActorFrameTexture.h" -#include "RageTextureRenderTarget.h" -#include "RageTextureManager.h" -#include "ActorUtil.h" - -REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture ); -ActorFrameTexture *ActorFrameTexture::Copy() const { return new ActorFrameTexture(*this); } - -ActorFrameTexture::ActorFrameTexture() -{ - m_bDepthBuffer = false; - m_bAlphaBuffer = false; - m_bFloat = false; - m_bPreserveTexture = false; - static uint64_t i = 0; - ++i; - m_sTextureName = ssprintf( ConvertI64FormatString("ActorFrameTexture %lli"), i ); - - m_pRenderTarget = NULL; -} - -ActorFrameTexture::ActorFrameTexture( const ActorFrameTexture &cpy ): - ActorFrame(cpy) -{ - FAIL_M( "ActorFrameTexture copy not implemented" ); -} - -ActorFrameTexture::~ActorFrameTexture() -{ - /* Release our reference to the texture. */ - TEXTUREMAN->UnloadTexture( m_pRenderTarget ); -} - -void ActorFrameTexture::Create() -{ - ASSERT( m_pRenderTarget == NULL ); - RageTextureID id( m_sTextureName ); - id.Policy = RageTextureID::TEX_VOLATILE; - - RenderTargetParam param; - param.bWithDepthBuffer = m_bDepthBuffer; - param.bWithAlpha = m_bAlphaBuffer; - param.bFloat = m_bFloat; - param.iWidth = (int) m_size.x; - param.iHeight = (int) m_size.y; - m_pRenderTarget = new RageTextureRenderTarget( id, param ); - m_pRenderTarget->m_bWasUsed = true; - - /* This passes ownership of m_pRenderTarget to TEXTUREMAN, but we retain - * our reference to it until we call TEXTUREMAN->UnloadTexture. */ - TEXTUREMAN->RegisterTexture( id, m_pRenderTarget ); -} - -void ActorFrameTexture::DrawPrimitives() -{ - if( m_pRenderTarget == NULL ) - return; - - m_pRenderTarget->BeginRenderingTo( m_bPreserveTexture ); - - ActorFrame::DrawPrimitives(); - - m_pRenderTarget->FinishRenderingTo(); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorFrameTexture. */ -class LunaActorFrameTexture : public Luna -{ -public: - static int Create( T* p, lua_State *L ) { p->Create(); return 0; } - static int EnableDepthBuffer( T* p, lua_State *L ) { p->EnableDepthBuffer(BArg(1)); return 0; } - static int EnableAlphaBuffer( T* p, lua_State *L ) { p->EnableAlphaBuffer(BArg(1)); return 0; } - static int EnableFloat( T* p, lua_State *L ) { p->EnableFloat(BArg(1)); return 0; } - static int EnablePreserveTexture( T* p, lua_State *L ) { p->EnablePreserveTexture(BArg(1)); return 0; } - static int SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); return 0; } - static int GetTexture( T* p, lua_State *L ) - { - RageTexture *pTexture = p->GetTexture(); - if( pTexture == NULL ) - return 0; - pTexture->PushSelf(L); - return 1; - } - - LunaActorFrameTexture() - { - ADD_METHOD( Create ); - ADD_METHOD( EnableDepthBuffer ); - ADD_METHOD( EnableAlphaBuffer ); - ADD_METHOD( EnableFloat ); - ADD_METHOD( EnablePreserveTexture ); - ADD_METHOD( SetTextureName ); - ADD_METHOD( GetTexture ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorFrameTexture, ActorFrame ) -// lua end - -/* - * (c) 2006 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorFrameTexture.h" +#include "RageTextureRenderTarget.h" +#include "RageTextureManager.h" +#include "ActorUtil.h" + +REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture ); +ActorFrameTexture *ActorFrameTexture::Copy() const { return new ActorFrameTexture(*this); } + +ActorFrameTexture::ActorFrameTexture() +{ + m_bDepthBuffer = false; + m_bAlphaBuffer = false; + m_bFloat = false; + m_bPreserveTexture = false; + static uint64_t i = 0; + ++i; + m_sTextureName = ssprintf( ConvertI64FormatString("ActorFrameTexture %lli"), i ); + + m_pRenderTarget = NULL; +} + +ActorFrameTexture::ActorFrameTexture( const ActorFrameTexture &cpy ): + ActorFrame(cpy) +{ + FAIL_M( "ActorFrameTexture copy not implemented" ); +} + +ActorFrameTexture::~ActorFrameTexture() +{ + /* Release our reference to the texture. */ + TEXTUREMAN->UnloadTexture( m_pRenderTarget ); +} + +void ActorFrameTexture::Create() +{ + ASSERT( m_pRenderTarget == NULL ); + RageTextureID id( m_sTextureName ); + id.Policy = RageTextureID::TEX_VOLATILE; + + RenderTargetParam param; + param.bWithDepthBuffer = m_bDepthBuffer; + param.bWithAlpha = m_bAlphaBuffer; + param.bFloat = m_bFloat; + param.iWidth = (int) m_size.x; + param.iHeight = (int) m_size.y; + m_pRenderTarget = new RageTextureRenderTarget( id, param ); + m_pRenderTarget->m_bWasUsed = true; + + /* This passes ownership of m_pRenderTarget to TEXTUREMAN, but we retain + * our reference to it until we call TEXTUREMAN->UnloadTexture. */ + TEXTUREMAN->RegisterTexture( id, m_pRenderTarget ); +} + +void ActorFrameTexture::DrawPrimitives() +{ + if( m_pRenderTarget == NULL ) + return; + + m_pRenderTarget->BeginRenderingTo( m_bPreserveTexture ); + + ActorFrame::DrawPrimitives(); + + m_pRenderTarget->FinishRenderingTo(); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorFrameTexture. */ +class LunaActorFrameTexture : public Luna +{ +public: + static int Create( T* p, lua_State *L ) { p->Create(); return 0; } + static int EnableDepthBuffer( T* p, lua_State *L ) { p->EnableDepthBuffer(BArg(1)); return 0; } + static int EnableAlphaBuffer( T* p, lua_State *L ) { p->EnableAlphaBuffer(BArg(1)); return 0; } + static int EnableFloat( T* p, lua_State *L ) { p->EnableFloat(BArg(1)); return 0; } + static int EnablePreserveTexture( T* p, lua_State *L ) { p->EnablePreserveTexture(BArg(1)); return 0; } + static int SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); return 0; } + static int GetTexture( T* p, lua_State *L ) + { + RageTexture *pTexture = p->GetTexture(); + if( pTexture == NULL ) + return 0; + pTexture->PushSelf(L); + return 1; + } + + LunaActorFrameTexture() + { + ADD_METHOD( Create ); + ADD_METHOD( EnableDepthBuffer ); + ADD_METHOD( EnableAlphaBuffer ); + ADD_METHOD( EnableFloat ); + ADD_METHOD( EnablePreserveTexture ); + ADD_METHOD( SetTextureName ); + ADD_METHOD( GetTexture ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorFrameTexture, ActorFrame ) +// lua end + +/* + * (c) 2006 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorFrameTexture.h b/src/ActorFrameTexture.h index 08c068eadd..3997b7dcde 100644 --- a/src/ActorFrameTexture.h +++ b/src/ActorFrameTexture.h @@ -1,88 +1,88 @@ -#ifndef ACTOR_FRAME_TEXTURE_H -#define ACTOR_FRAME_TEXTURE_H - -#include "ActorFrame.h" -class RageTextureRenderTarget; - -class ActorFrameTexture: public ActorFrame -{ -public: - ActorFrameTexture(); - ActorFrameTexture( const ActorFrameTexture &cpy ); - virtual ~ActorFrameTexture(); - virtual ActorFrameTexture *Copy() const; - - /** - * @brief Set the texture name. - * - * This can be used with RageTextureManager (and users, eg. Sprite) - * to load the texture. If no name is supplied, a unique one will - * be generated. In that case, the only way to access the texture - * is via GetTextureName. - * @param sName the new name. */ - void SetTextureName( const RString &sName ) { m_sTextureName = sName; } - /** - * @brief Retrieve the texture name. - * @return the texture name. */ - RString GetTextureName() const { return m_sTextureName; } - RageTextureRenderTarget *GetTexture() { return m_pRenderTarget; } - - void EnableDepthBuffer( bool b ) { m_bDepthBuffer = b; } - void EnableAlphaBuffer( bool b ) { m_bAlphaBuffer = b; } - void EnableFloat( bool b ) { m_bFloat = b; } - void EnablePreserveTexture( bool b ) { m_bPreserveTexture = b; } - - void Create(); - - virtual void DrawPrimitives(); - - // Commands - virtual void PushSelf( lua_State *L ); - -private: - RageTextureRenderTarget *m_pRenderTarget; - - bool m_bDepthBuffer; - bool m_bAlphaBuffer; - bool m_bFloat; - bool m_bPreserveTexture; - /** @brief the name of this ActorFrameTexture. */ - RString m_sTextureName; -}; - -class ActorFrameTextureAutoDeleteChildren : public ActorFrameTexture -{ -public: - ActorFrameTextureAutoDeleteChildren() { DeleteChildrenWhenDone(true); } - virtual bool AutoLoadChildren() const { return true; } - virtual ActorFrameTextureAutoDeleteChildren *Copy() const; -}; - -#endif - -/** - * @file - * @author Glenn Maynard (c) 2006 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTOR_FRAME_TEXTURE_H +#define ACTOR_FRAME_TEXTURE_H + +#include "ActorFrame.h" +class RageTextureRenderTarget; + +class ActorFrameTexture: public ActorFrame +{ +public: + ActorFrameTexture(); + ActorFrameTexture( const ActorFrameTexture &cpy ); + virtual ~ActorFrameTexture(); + virtual ActorFrameTexture *Copy() const; + + /** + * @brief Set the texture name. + * + * This can be used with RageTextureManager (and users, eg. Sprite) + * to load the texture. If no name is supplied, a unique one will + * be generated. In that case, the only way to access the texture + * is via GetTextureName. + * @param sName the new name. */ + void SetTextureName( const RString &sName ) { m_sTextureName = sName; } + /** + * @brief Retrieve the texture name. + * @return the texture name. */ + RString GetTextureName() const { return m_sTextureName; } + RageTextureRenderTarget *GetTexture() { return m_pRenderTarget; } + + void EnableDepthBuffer( bool b ) { m_bDepthBuffer = b; } + void EnableAlphaBuffer( bool b ) { m_bAlphaBuffer = b; } + void EnableFloat( bool b ) { m_bFloat = b; } + void EnablePreserveTexture( bool b ) { m_bPreserveTexture = b; } + + void Create(); + + virtual void DrawPrimitives(); + + // Commands + virtual void PushSelf( lua_State *L ); + +private: + RageTextureRenderTarget *m_pRenderTarget; + + bool m_bDepthBuffer; + bool m_bAlphaBuffer; + bool m_bFloat; + bool m_bPreserveTexture; + /** @brief the name of this ActorFrameTexture. */ + RString m_sTextureName; +}; + +class ActorFrameTextureAutoDeleteChildren : public ActorFrameTexture +{ +public: + ActorFrameTextureAutoDeleteChildren() { DeleteChildrenWhenDone(true); } + virtual bool AutoLoadChildren() const { return true; } + virtual ActorFrameTextureAutoDeleteChildren *Copy() const; +}; + +#endif + +/** + * @file + * @author Glenn Maynard (c) 2006 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorMultiTexture.cpp b/src/ActorMultiTexture.cpp index 7b7fd85f21..af2685f420 100644 --- a/src/ActorMultiTexture.cpp +++ b/src/ActorMultiTexture.cpp @@ -1,215 +1,215 @@ -#include "global.h" -#include - -#include "ActorMultiTexture.h" -#include "RageTextureManager.h" -#include "XmlFile.h" -#include "RageLog.h" -#include "RageDisplay.h" -#include "RageTexture.h" -#include "RageUtil.h" -#include "ActorUtil.h" -#include "Foreach.h" -#include "LuaBinding.h" -#include "LuaManager.h" - -REGISTER_ACTOR_CLASS( ActorMultiTexture ); - - -ActorMultiTexture::ActorMultiTexture() -{ - m_EffectMode = EffectMode_Normal; -} - - -ActorMultiTexture::~ActorMultiTexture() -{ - ClearTextures(); -} - -ActorMultiTexture::ActorMultiTexture( const ActorMultiTexture &cpy ): - Actor( cpy ) -{ -#define CPY(a) a = cpy.a - CPY( m_Rect ); - CPY( m_aTextureUnits ); -#undef CPY - - FOREACH( TextureUnitState, m_aTextureUnits, tex ) - tex->m_pTexture = TEXTUREMAN->CopyTexture( tex->m_pTexture ); -} - -void ActorMultiTexture::SetTextureCoords( const RectF &r ) -{ - m_Rect = r; -} - -void ActorMultiTexture::LoadFromNode( const XNode* pNode ) -{ - m_Rect = RectF( 0, 0, 1, 1 ); - Actor::LoadFromNode( pNode ); -} - -void ActorMultiTexture::SetSizeFromTexture( RageTexture *pTexture ) -{ - ActorMultiTexture::m_size.x = pTexture->GetSourceWidth(); - ActorMultiTexture::m_size.y = pTexture->GetSourceHeight(); -} - -void ActorMultiTexture::ClearTextures() -{ - FOREACH( TextureUnitState, m_aTextureUnits, tex ) - TEXTUREMAN->UnloadTexture( tex->m_pTexture ); - m_aTextureUnits.clear(); -} - -int ActorMultiTexture::AddTexture( RageTexture *pTexture ) -{ - ASSERT( pTexture != NULL ); - LOG->Trace( "ActorMultiTexture::AddTexture( %s )", pTexture->GetID().filename.c_str() ); - - m_aTextureUnits.push_back( TextureUnitState() ); - m_aTextureUnits.back().m_pTexture = TEXTUREMAN->CopyTexture( pTexture ); - return m_aTextureUnits.size() - 1; -} - -void ActorMultiTexture::SetTextureMode( int iIndex, TextureMode tm ) -{ - ASSERT( iIndex < (int) m_aTextureUnits.size() ); - m_aTextureUnits[iIndex].m_TextureMode = tm; -} - -void ActorMultiTexture::DrawPrimitives() -{ - Actor::SetGlobalRenderStates(); // set Actor-specified render states - - RectF quadVerticies; - quadVerticies.left = -m_size.x/2.0f; - quadVerticies.right = +m_size.x/2.0f; - quadVerticies.top = -m_size.y/2.0f; - quadVerticies.bottom = +m_size.y/2.0f; - - DISPLAY->ClearAllTextures(); - for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) - { - TextureUnit tu = enum_add2(TextureUnit_1, i); - DISPLAY->SetTexture( tu, m_aTextureUnits[i].m_pTexture->GetTexHandle() ); - DISPLAY->SetTextureWrapping( tu, m_bTextureWrapping ); - DISPLAY->SetTextureMode( tu, m_aTextureUnits[i].m_TextureMode ); - } - - DISPLAY->SetEffectMode( m_EffectMode ); - - static RageSpriteVertex v[4]; - v[0].p = RageVector3( quadVerticies.left, quadVerticies.top, 0 ); // top left - v[1].p = RageVector3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left - v[2].p = RageVector3( quadVerticies.right, quadVerticies.bottom, 0 ); // bottom right - v[3].p = RageVector3( quadVerticies.right, quadVerticies.top, 0 ); // top right - - const RectF *pTexCoordRect = &m_Rect; - v[0].t = RageVector2( pTexCoordRect->left, pTexCoordRect->top ); // top left - v[1].t = RageVector2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left - v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right - v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right - - v[0].c = m_pTempState->diffuse[0]; // top left - v[1].c = m_pTempState->diffuse[2]; // bottom left - v[2].c = m_pTempState->diffuse[3]; // bottom right - v[3].c = m_pTempState->diffuse[1]; // top right - - DISPLAY->DrawQuad( v ); - - for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) - DISPLAY->SetTexture( enum_add2(TextureUnit_1, i), 0 ); - - DISPLAY->SetEffectMode( EffectMode_Normal ); -} - -bool ActorMultiTexture::EarlyAbortDraw() const -{ - return m_aTextureUnits.empty(); -} - - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorMultiTexture. */ -class LunaActorMultiTexture: public Luna -{ -public: - static int ClearTextures( T* p, lua_State *L ) - { - p->ClearTextures(); - return 0; - } - static int AddTexture( T* p, lua_State *L ) - { - RageTexture *pTexture = Luna::check(L, 1); - int iRet = p->AddTexture( pTexture ); - lua_pushinteger( L, iRet ); - return 1; - } - static int SetTextureMode( T* p, lua_State *L ) - { - int iIndex = IArg(1); - TextureMode tm = Enum::Check(L, 2); - p->SetTextureMode( iIndex, tm ); - return 0; - } - static int SetTextureCoords( T* p, lua_State *L ) - { - p->SetTextureCoords( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); - return 0; - } - static int SetSizeFromTexture( T* p, lua_State *L ) - { - RageTexture *pTexture = Luna::check(L, 1); - p->SetSizeFromTexture( pTexture ); - return 0; - } - static int SetEffectMode( T* p, lua_State *L ) - { - EffectMode em = Enum::Check(L, 1); - p->SetEffectMode( em ); - return 0; - } - - LunaActorMultiTexture() - { - ADD_METHOD( ClearTextures ); - ADD_METHOD( AddTexture ); - ADD_METHOD( SetTextureMode ); - ADD_METHOD( SetTextureCoords ); - ADD_METHOD( SetSizeFromTexture ); - ADD_METHOD( SetEffectMode ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorMultiTexture, Actor ) -// lua end - -/* - * (c) 2001-2007 Glenn Maynard, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include + +#include "ActorMultiTexture.h" +#include "RageTextureManager.h" +#include "XmlFile.h" +#include "RageLog.h" +#include "RageDisplay.h" +#include "RageTexture.h" +#include "RageUtil.h" +#include "ActorUtil.h" +#include "Foreach.h" +#include "LuaBinding.h" +#include "LuaManager.h" + +REGISTER_ACTOR_CLASS( ActorMultiTexture ); + + +ActorMultiTexture::ActorMultiTexture() +{ + m_EffectMode = EffectMode_Normal; +} + + +ActorMultiTexture::~ActorMultiTexture() +{ + ClearTextures(); +} + +ActorMultiTexture::ActorMultiTexture( const ActorMultiTexture &cpy ): + Actor( cpy ) +{ +#define CPY(a) a = cpy.a + CPY( m_Rect ); + CPY( m_aTextureUnits ); +#undef CPY + + FOREACH( TextureUnitState, m_aTextureUnits, tex ) + tex->m_pTexture = TEXTUREMAN->CopyTexture( tex->m_pTexture ); +} + +void ActorMultiTexture::SetTextureCoords( const RectF &r ) +{ + m_Rect = r; +} + +void ActorMultiTexture::LoadFromNode( const XNode* pNode ) +{ + m_Rect = RectF( 0, 0, 1, 1 ); + Actor::LoadFromNode( pNode ); +} + +void ActorMultiTexture::SetSizeFromTexture( RageTexture *pTexture ) +{ + ActorMultiTexture::m_size.x = pTexture->GetSourceWidth(); + ActorMultiTexture::m_size.y = pTexture->GetSourceHeight(); +} + +void ActorMultiTexture::ClearTextures() +{ + FOREACH( TextureUnitState, m_aTextureUnits, tex ) + TEXTUREMAN->UnloadTexture( tex->m_pTexture ); + m_aTextureUnits.clear(); +} + +int ActorMultiTexture::AddTexture( RageTexture *pTexture ) +{ + ASSERT( pTexture != NULL ); + LOG->Trace( "ActorMultiTexture::AddTexture( %s )", pTexture->GetID().filename.c_str() ); + + m_aTextureUnits.push_back( TextureUnitState() ); + m_aTextureUnits.back().m_pTexture = TEXTUREMAN->CopyTexture( pTexture ); + return m_aTextureUnits.size() - 1; +} + +void ActorMultiTexture::SetTextureMode( int iIndex, TextureMode tm ) +{ + ASSERT( iIndex < (int) m_aTextureUnits.size() ); + m_aTextureUnits[iIndex].m_TextureMode = tm; +} + +void ActorMultiTexture::DrawPrimitives() +{ + Actor::SetGlobalRenderStates(); // set Actor-specified render states + + RectF quadVerticies; + quadVerticies.left = -m_size.x/2.0f; + quadVerticies.right = +m_size.x/2.0f; + quadVerticies.top = -m_size.y/2.0f; + quadVerticies.bottom = +m_size.y/2.0f; + + DISPLAY->ClearAllTextures(); + for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) + { + TextureUnit tu = enum_add2(TextureUnit_1, i); + DISPLAY->SetTexture( tu, m_aTextureUnits[i].m_pTexture->GetTexHandle() ); + DISPLAY->SetTextureWrapping( tu, m_bTextureWrapping ); + DISPLAY->SetTextureMode( tu, m_aTextureUnits[i].m_TextureMode ); + } + + DISPLAY->SetEffectMode( m_EffectMode ); + + static RageSpriteVertex v[4]; + v[0].p = RageVector3( quadVerticies.left, quadVerticies.top, 0 ); // top left + v[1].p = RageVector3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left + v[2].p = RageVector3( quadVerticies.right, quadVerticies.bottom, 0 ); // bottom right + v[3].p = RageVector3( quadVerticies.right, quadVerticies.top, 0 ); // top right + + const RectF *pTexCoordRect = &m_Rect; + v[0].t = RageVector2( pTexCoordRect->left, pTexCoordRect->top ); // top left + v[1].t = RageVector2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left + v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right + v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right + + v[0].c = m_pTempState->diffuse[0]; // top left + v[1].c = m_pTempState->diffuse[2]; // bottom left + v[2].c = m_pTempState->diffuse[3]; // bottom right + v[3].c = m_pTempState->diffuse[1]; // top right + + DISPLAY->DrawQuad( v ); + + for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) + DISPLAY->SetTexture( enum_add2(TextureUnit_1, i), 0 ); + + DISPLAY->SetEffectMode( EffectMode_Normal ); +} + +bool ActorMultiTexture::EarlyAbortDraw() const +{ + return m_aTextureUnits.empty(); +} + + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorMultiTexture. */ +class LunaActorMultiTexture: public Luna +{ +public: + static int ClearTextures( T* p, lua_State *L ) + { + p->ClearTextures(); + return 0; + } + static int AddTexture( T* p, lua_State *L ) + { + RageTexture *pTexture = Luna::check(L, 1); + int iRet = p->AddTexture( pTexture ); + lua_pushinteger( L, iRet ); + return 1; + } + static int SetTextureMode( T* p, lua_State *L ) + { + int iIndex = IArg(1); + TextureMode tm = Enum::Check(L, 2); + p->SetTextureMode( iIndex, tm ); + return 0; + } + static int SetTextureCoords( T* p, lua_State *L ) + { + p->SetTextureCoords( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); + return 0; + } + static int SetSizeFromTexture( T* p, lua_State *L ) + { + RageTexture *pTexture = Luna::check(L, 1); + p->SetSizeFromTexture( pTexture ); + return 0; + } + static int SetEffectMode( T* p, lua_State *L ) + { + EffectMode em = Enum::Check(L, 1); + p->SetEffectMode( em ); + return 0; + } + + LunaActorMultiTexture() + { + ADD_METHOD( ClearTextures ); + ADD_METHOD( AddTexture ); + ADD_METHOD( SetTextureMode ); + ADD_METHOD( SetTextureCoords ); + ADD_METHOD( SetSizeFromTexture ); + ADD_METHOD( SetEffectMode ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorMultiTexture, Actor ) +// lua end + +/* + * (c) 2001-2007 Glenn Maynard, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorMultiTexture.h b/src/ActorMultiTexture.h index 5973ab6234..6f4d793361 100644 --- a/src/ActorMultiTexture.h +++ b/src/ActorMultiTexture.h @@ -1,73 +1,73 @@ -/** @brief ActorMultiTexture - A texture created from multiple textures. */ - -#ifndef ACTOR_MULTI_TEXTURE_H -#define ACTOR_MULTI_TEXTURE_H - -#include "Actor.h" -#include "RageDisplay.h" - -class RageTexture; - -class ActorMultiTexture: public Actor -{ -public: - ActorMultiTexture(); - ActorMultiTexture( const ActorMultiTexture &cpy ); - virtual ~ActorMultiTexture(); - - void LoadFromNode( const XNode* pNode ); - virtual ActorMultiTexture *Copy() const; - - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); - - void ClearTextures(); - int AddTexture( RageTexture *pTexture ); - void SetTextureMode( int iIndex, TextureMode tm ); - - void SetSizeFromTexture( RageTexture *pTexture ); - void SetTextureCoords( const RectF &r ); - void SetEffectMode( EffectMode em ) { m_EffectMode = em; } - - virtual void PushSelf( lua_State *L ); - -private: - EffectMode m_EffectMode; - struct TextureUnitState - { - TextureUnitState(): m_pTexture(NULL), m_TextureMode(TextureMode_Modulate) {} - RageTexture *m_pTexture; - TextureMode m_TextureMode; - }; - vector m_aTextureUnits; - RectF m_Rect; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief ActorMultiTexture - A texture created from multiple textures. */ + +#ifndef ACTOR_MULTI_TEXTURE_H +#define ACTOR_MULTI_TEXTURE_H + +#include "Actor.h" +#include "RageDisplay.h" + +class RageTexture; + +class ActorMultiTexture: public Actor +{ +public: + ActorMultiTexture(); + ActorMultiTexture( const ActorMultiTexture &cpy ); + virtual ~ActorMultiTexture(); + + void LoadFromNode( const XNode* pNode ); + virtual ActorMultiTexture *Copy() const; + + virtual bool EarlyAbortDraw() const; + virtual void DrawPrimitives(); + + void ClearTextures(); + int AddTexture( RageTexture *pTexture ); + void SetTextureMode( int iIndex, TextureMode tm ); + + void SetSizeFromTexture( RageTexture *pTexture ); + void SetTextureCoords( const RectF &r ); + void SetEffectMode( EffectMode em ) { m_EffectMode = em; } + + virtual void PushSelf( lua_State *L ); + +private: + EffectMode m_EffectMode; + struct TextureUnitState + { + TextureUnitState(): m_pTexture(NULL), m_TextureMode(TextureMode_Modulate) {} + RageTexture *m_pTexture; + TextureMode m_TextureMode; + }; + vector m_aTextureUnits; + RectF m_Rect; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorProxy.cpp b/src/ActorProxy.cpp index 38938818d0..92f721f9b9 100644 --- a/src/ActorProxy.cpp +++ b/src/ActorProxy.cpp @@ -1,90 +1,90 @@ -#include "global.h" -#include "ActorProxy.h" -#include "ActorUtil.h" - -REGISTER_ACTOR_CLASS( ActorProxy ); - -ActorProxy::ActorProxy() -{ - m_pActorTarget = NULL; -} - -bool ActorProxy::EarlyAbortDraw() const -{ - return m_pActorTarget == NULL || Actor::EarlyAbortDraw(); -} - -void ActorProxy::DrawPrimitives() -{ - if( m_pActorTarget != NULL ) - { - bool bVisible = m_pActorTarget->GetVisible(); - m_pActorTarget->SetVisible( true ); - m_pActorTarget->Draw(); - m_pActorTarget->SetVisible( bVisible ); - } -} - -void ActorProxy::LoadFromNode( const XNode* pNode ) -{ - Actor::LoadFromNode( pNode ); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorProxy. */ -class LunaActorProxy: public Luna -{ -public: - static int SetTarget( T* p, lua_State *L ) - { - Actor *pTarget = Luna::check( L, 1 ); - p->SetTarget( pTarget ); - return 0; - } - - static int GetTarget( T* p, lua_State *L ) - { - Actor *pTarget = p->GetTarget(); - if( pTarget != NULL ) - pTarget->PushSelf( L ); - else - lua_pushnil( L ); - return 1; - } - - LunaActorProxy() - { - ADD_METHOD( SetTarget ); - ADD_METHOD( GetTarget ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorProxy, Actor ) -// lua end - -/* - * (c) 2006 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorProxy.h" +#include "ActorUtil.h" + +REGISTER_ACTOR_CLASS( ActorProxy ); + +ActorProxy::ActorProxy() +{ + m_pActorTarget = NULL; +} + +bool ActorProxy::EarlyAbortDraw() const +{ + return m_pActorTarget == NULL || Actor::EarlyAbortDraw(); +} + +void ActorProxy::DrawPrimitives() +{ + if( m_pActorTarget != NULL ) + { + bool bVisible = m_pActorTarget->GetVisible(); + m_pActorTarget->SetVisible( true ); + m_pActorTarget->Draw(); + m_pActorTarget->SetVisible( bVisible ); + } +} + +void ActorProxy::LoadFromNode( const XNode* pNode ) +{ + Actor::LoadFromNode( pNode ); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorProxy. */ +class LunaActorProxy: public Luna +{ +public: + static int SetTarget( T* p, lua_State *L ) + { + Actor *pTarget = Luna::check( L, 1 ); + p->SetTarget( pTarget ); + return 0; + } + + static int GetTarget( T* p, lua_State *L ) + { + Actor *pTarget = p->GetTarget(); + if( pTarget != NULL ) + pTarget->PushSelf( L ); + else + lua_pushnil( L ); + return 1; + } + + LunaActorProxy() + { + ADD_METHOD( SetTarget ); + ADD_METHOD( GetTarget ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorProxy, Actor ) +// lua end + +/* + * (c) 2006 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorProxy.h b/src/ActorProxy.h index 1da6572d74..763ea74599 100644 --- a/src/ActorProxy.h +++ b/src/ActorProxy.h @@ -1,54 +1,54 @@ -#ifndef ACTOR_PROXY_H -#define ACTOR_PROXY_H - -#include "Actor.h" - -struct lua_State; -/** @brief Renders another actor. */ -class ActorProxy: public Actor -{ -public: - ActorProxy(); - - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); - - void LoadFromNode( const XNode* pNode ); - virtual ActorProxy *Copy() const; - - Actor *GetTarget() { return m_pActorTarget; } - void SetTarget( Actor *pTarget ) { m_pActorTarget = pTarget; } - - // Lua - virtual void PushSelf( lua_State *L ); - -private: - Actor *m_pActorTarget; -}; - -#endif - -/* - * (c) 2006 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTOR_PROXY_H +#define ACTOR_PROXY_H + +#include "Actor.h" + +struct lua_State; +/** @brief Renders another actor. */ +class ActorProxy: public Actor +{ +public: + ActorProxy(); + + virtual bool EarlyAbortDraw() const; + virtual void DrawPrimitives(); + + void LoadFromNode( const XNode* pNode ); + virtual ActorProxy *Copy() const; + + Actor *GetTarget() { return m_pActorTarget; } + void SetTarget( Actor *pTarget ) { m_pActorTarget = pTarget; } + + // Lua + virtual void PushSelf( lua_State *L ); + +private: + Actor *m_pActorTarget; +}; + +#endif + +/* + * (c) 2006 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorScroller.cpp b/src/ActorScroller.cpp index 91f1927a7c..e463af73b3 100644 --- a/src/ActorScroller.cpp +++ b/src/ActorScroller.cpp @@ -1,397 +1,397 @@ -#include "global.h" -#include "ActorScroller.h" -#include "Foreach.h" -#include "RageUtil.h" -#include "XmlFile.h" -#include "arch/Dialog/Dialog.h" -#include "RageLog.h" -#include "ActorUtil.h" -#include "LuaBinding.h" - -/* Tricky: We need ActorFrames created in Lua to auto delete their children. - * We don't want classes that derive from ActorFrame to auto delete their - * children. The name "ActorFrame" is widely used in Lua, so we'll have - * that string instead create an ActorFrameAutoDeleteChildren object. */ -//REGISTER_ACTOR_CLASS( ActorScroller ); -REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller ); -ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); } - - -ActorScroller::ActorScroller() -{ - m_iNumItems = 0; - m_fCurrentItem = 0; - m_fDestinationItem = 0; - m_fSecondsPerItem = 1; - m_fSecondsPauseBetweenItems = 0; - m_fNumItemsToDraw = 7; - m_iFirstSubActorIndex = 0; - m_bLoop = false; - m_bFastCatchup = false; - m_bFunctionDependsOnPositionOffset = true; - m_bFunctionDependsOnItemIndex = true; - m_fPauseCountdownSeconds = 0; - m_fQuantizePixels = 0; - - m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values - m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer - m_fMaskWidth = 0; - m_fMaskHeight = 0; - DisableMask(); -} - -void ActorScroller::Load2() -{ - m_iNumItems = m_SubActors.size(); - - Lua *L = LUA->Get(); - for( unsigned i = 0; i < m_SubActors.size(); ++i ) - { - lua_pushnumber( L, i ); - this->m_SubActors[i]->m_pLuaInstance->Set( L, "ItemIndex" ); - } - LUA->Release( L ); -} - -void ActorScroller::SetTransformFromReference( const LuaReference &ref ) -{ - m_exprTransformFunction.SetFromReference( ref ); - - // Probe to find which of the parameters are used. -#define GP(a,b) m_exprTransformFunction.GetTransformCached( a, b, 2 ) - m_bFunctionDependsOnPositionOffset = (GP(0,0) != GP(1,0)) && (GP(0,1) != GP(1,1)); - m_bFunctionDependsOnItemIndex = (GP(0,0) != GP(0,1)) && (GP(1,0) != GP(1,1)); - m_exprTransformFunction.ClearCache(); -} - -void ActorScroller::SetTransformFromExpression( const RString &sTransformFunction ) -{ - LuaReference ref; - ref.SetFromExpression( sTransformFunction ); - SetTransformFromReference( ref ); -} - -void ActorScroller::SetTransformFromWidth( float fItemWidth ) -{ - SetTransformFromExpression( ssprintf("function(self,offset,itemIndex,numItems) self:x(%f*offset) end",fItemWidth) ); -} - -void ActorScroller::SetTransformFromHeight( float fItemHeight ) -{ - SetTransformFromExpression( ssprintf("function(self,offset,itemIndex,numItems) self:y(%f*offset) end",fItemHeight) ); -} - -void ActorScroller::EnableMask( float fWidth, float fHeight ) -{ - m_quadMask.SetVisible( fWidth != 0 && fHeight != 0 ); - m_quadMask.SetWidth( fWidth ); - m_fMaskWidth = fWidth; - m_quadMask.SetHeight( fHeight ); - m_fMaskHeight = fHeight; -} - -void ActorScroller::DisableMask() -{ - m_quadMask.SetVisible( false ); -} - -void ActorScroller::ScrollThroughAllItems() -{ - m_fCurrentItem = m_bLoop ? +m_fNumItemsToDraw/2.0f : -(m_fNumItemsToDraw/2.0f)-1; - m_fDestinationItem = (float)(m_iNumItems+m_fNumItemsToDraw/2.0f+1); -} - -void ActorScroller::ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd ) -{ - m_fCurrentItem = -fItemPaddingStart; - m_fDestinationItem = m_iNumItems-1+fItemPaddingEnd; -} - -float ActorScroller::GetSecondsForCompleteScrollThrough() const -{ - float fTotalItems = m_fNumItemsToDraw + m_iNumItems; - return fTotalItems * (m_fSecondsPerItem + m_fSecondsPauseBetweenItems ); -} - -float ActorScroller::GetSecondsToDestination() const -{ - float fTotalItemsToMove = fabsf(m_fCurrentItem - m_fDestinationItem); - return fTotalItemsToMove * m_fSecondsPerItem; -} - -void ActorScroller::LoadFromNode( const XNode *pNode ) -{ - ActorFrame::LoadFromNode( pNode ); - - Load2(); - - float fNumItemsToDraw = 0; - if( pNode->GetAttrValue("NumItemsToDraw", fNumItemsToDraw) ) - SetNumItemsToDraw( fNumItemsToDraw ); - - float fSecondsPerItem = 0; - if( pNode->GetAttrValue("SecondsPerItem", fSecondsPerItem) ) - ActorScroller::SetSecondsPerItem( fSecondsPerItem ); - - Lua *L = LUA->Get(); - pNode->PushAttrValue( L, "TransformFunction" ); - { - LuaReference ref; - ref.SetFromStack( L ); - if( !ref.IsNil() ) - SetTransformFromReference( ref ); - } - LUA->Release( L ); - - int iSubdivisions = 1; - if( pNode->GetAttrValue("Subdivisions", iSubdivisions) ) - ActorScroller::SetNumSubdivisions( iSubdivisions ); - - bool bUseMask = false; - pNode->GetAttrValue( "UseMask", bUseMask ); - - if( bUseMask ) - { - pNode->GetAttrValue( "MaskWidth", m_fMaskWidth ); - pNode->GetAttrValue( "MaskHeight", m_fMaskHeight ); - EnableMask( m_fMaskWidth, m_fMaskHeight ); - } - - pNode->GetAttrValue( "QuantizePixels", m_fQuantizePixels ); -} - -void ActorScroller::UpdateInternal( float fDeltaTime ) -{ - ActorFrame::UpdateInternal( fDeltaTime ); - - // If we have no children, the code below will busy loop. - if( !m_SubActors.size() ) - return; - - // handle pause - if( fDeltaTime > m_fPauseCountdownSeconds ) - { - fDeltaTime -= m_fPauseCountdownSeconds; - m_fPauseCountdownSeconds = 0; - } - else - { - m_fPauseCountdownSeconds -= fDeltaTime; - fDeltaTime = 0; - return; - } - - - if( m_fCurrentItem == m_fDestinationItem ) - return; // done scrolling - - - float fOldItemAtTop = m_fCurrentItem; - if( m_fSecondsPerItem > 0 ) - { - float fApproachSpeed = fDeltaTime/m_fSecondsPerItem; - if( m_bFastCatchup ) - { - float fDistanceToMove = fabsf(m_fCurrentItem - m_fDestinationItem); - if( fDistanceToMove > 1 ) - fApproachSpeed *= fDistanceToMove*fDistanceToMove; - } - - fapproach( m_fCurrentItem, m_fDestinationItem, fApproachSpeed ); - } - - // if items changed, then pause - if( (int)fOldItemAtTop != (int)m_fCurrentItem ) - m_fPauseCountdownSeconds = m_fSecondsPauseBetweenItems; - - if( m_bLoop ) - m_fCurrentItem = fmodf( m_fCurrentItem, (float) m_iNumItems ); -} - -void ActorScroller::DrawPrimitives() -{ - PositionItemsAndDrawPrimitives( true ); -} - -void ActorScroller::PositionItems() -{ - PositionItemsAndDrawPrimitives( false ); -} - -/* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex - * in m_SubActors[0]. */ -void ActorScroller::ShiftSubActors( int iDist ) -{ - if( iDist != INT_MAX ) - CircularShift( m_SubActors, iDist ); -} - -void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives ) -{ - if( m_SubActors.empty() ) - return; - - float fNumItemsToDraw = m_fNumItemsToDraw; - if( m_quadMask.GetVisible() ) - { - // write to z buffer so that top and bottom are clipped - // Draw an extra item; this is the one that will be masked. - fNumItemsToDraw++; - float fPositionFullyOffScreenTop = -(fNumItemsToDraw)/2.f; - float fPositionFullyOffScreenBottom = (fNumItemsToDraw)/2.f; - - m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenTop, -1, m_iNumItems ); - if( bDrawPrimitives ) m_quadMask.Draw(); - - m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenBottom, m_iNumItems, m_iNumItems ); - if( bDrawPrimitives ) m_quadMask.Draw(); - } - - float fFirstItemToDraw = m_fCurrentItem - fNumItemsToDraw/2.f; - float fLastItemToDraw = m_fCurrentItem + fNumItemsToDraw/2.f; - int iFirstItemToDraw = (int) ceilf( fFirstItemToDraw ); - int iLastItemToDraw = (int) ceilf( fLastItemToDraw ); - if( !m_bLoop ) - { - iFirstItemToDraw = clamp( iFirstItemToDraw, 0, m_iNumItems ); - iLastItemToDraw = clamp( iLastItemToDraw, 0, m_iNumItems ); - } - - bool bDelayedDraw = m_bDrawByZPosition && !m_bLoop; - vector subs; - - { - // Shift m_SubActors so iFirstItemToDraw is at the beginning. - int iNewFirstIndex = iFirstItemToDraw; - int iDist = iNewFirstIndex - m_iFirstSubActorIndex; - m_iFirstSubActorIndex = iNewFirstIndex; - ShiftSubActors( iDist ); - } - - int iNumToDraw = iLastItemToDraw - iFirstItemToDraw; - for( int i = 0; i < iNumToDraw; ++i ) - { - int iItem = i + iFirstItemToDraw; - float fPosition = iItem - m_fCurrentItem; - int iIndex = i; // index into m_SubActors - if( m_bLoop ) - wrap( iIndex, m_SubActors.size() ); - else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() ) - continue; - - // Optimization: Zero out unused parameters so that they don't create new, - // unnecessary entries in the position cache. On scrollers with lots of - // items, especially with Subdivisions > 1, m_exprTransformFunction uses - // too much memory. - if( !m_bFunctionDependsOnPositionOffset ) - fPosition = 0; - if( !m_bFunctionDependsOnItemIndex ) - iItem = 0; - - m_exprTransformFunction.TransformItemCached( *m_SubActors[iIndex], fPosition, iItem, m_iNumItems ); - if( bDrawPrimitives ) - { - if( bDelayedDraw ) - subs.push_back( m_SubActors[iIndex] ); - else - m_SubActors[iIndex]->Draw(); - } - } - - if( bDelayedDraw ) - { - ActorUtil::SortByZPosition( subs ); - FOREACH( Actor*, subs, a ) - (*a)->Draw(); - } -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorScroller. */ -class LunaActorScroller: public Luna -{ -public: - static int PositionItems( T* p, lua_State *L ) { p->PositionItems(); return 0; } - static int SetTransformFromFunction( T* p, lua_State *L ) - { - LuaReference ref; - LuaHelpers::FromStack( L, ref, 1 ); - p->SetTransformFromReference( ref ); - return 0; - } - static int SetTransformFromHeight( T* p, lua_State *L ) { p->SetTransformFromHeight(FArg(1)); return 0; } - static int SetTransformFromWidth( T* p, lua_State *L ) { p->SetTransformFromWidth(FArg(1)); return 0; } - static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); return 0; } - static int SetDestinationItem( T* p, lua_State *L ) { p->SetDestinationItem( FArg(1) ); return 0; } - static int GetSecondsToDestination( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsToDestination() ); return 1; } - static int SetSecondsPerItem( T* p, lua_State *L ) { p->SetSecondsPerItem(FArg(1)); return 0; } - static int SetSecondsPauseBetweenItems( T* p, lua_State *L ) { p->SetSecondsPauseBetweenItems(FArg(1)); return 0; } - static int SetPauseCountdownSeconds( T* p, lua_State *L ) { p->SetPauseCountdownSeconds(FArg(1)); return 0; } - static int SetNumSubdivisions( T* p, lua_State *L ) { p->SetNumSubdivisions(IArg(1)); return 0; } - static int ScrollThroughAllItems( T* p, lua_State *L ) { p->ScrollThroughAllItems(); return 0; } - static int ScrollWithPadding( T* p, lua_State *L ) { p->ScrollWithPadding(FArg(1),FArg(2)); return 0; } - static int SetFastCatchup( T* p, lua_State *L ) { p->SetFastCatchup(BArg(1)); return 0; } - static int SetLoop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); return 0; } - static int SetMask( T* p, lua_State *L ) { p->EnableMask(FArg(1), FArg(2)); return 0; } - - static int SetNumItemsToDraw( T* p, lua_State *L ) { p->SetNumItemsToDraw(FArg(1)); return 0; } - static int GetFullScrollLengthSeconds( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsForCompleteScrollThrough() ); return 1; } - static int GetCurrentItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetCurrentItem() ); return 1; } - static int GetDestinationItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetDestinationItem() ); return 1; } - static int GetNumItems( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumItems() ); return 1; } - - LunaActorScroller() - { - ADD_METHOD( PositionItems ); - ADD_METHOD( SetTransformFromFunction ); - ADD_METHOD( SetTransformFromHeight ); - ADD_METHOD( SetTransformFromWidth ); - ADD_METHOD( SetCurrentAndDestinationItem ); - ADD_METHOD( SetDestinationItem ); - ADD_METHOD( GetSecondsToDestination ); - ADD_METHOD( SetSecondsPerItem ); - ADD_METHOD( SetSecondsPauseBetweenItems ); - ADD_METHOD( SetPauseCountdownSeconds ); - ADD_METHOD( SetNumSubdivisions ); - ADD_METHOD( ScrollThroughAllItems ); - ADD_METHOD( ScrollWithPadding ); - ADD_METHOD( SetFastCatchup ); - ADD_METHOD( SetLoop ); - ADD_METHOD( SetMask ); - ADD_METHOD( SetNumItemsToDraw ); - ADD_METHOD( GetFullScrollLengthSeconds ); - ADD_METHOD( GetCurrentItem ); - ADD_METHOD( GetDestinationItem ); - ADD_METHOD( GetNumItems ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorScroller, ActorFrame ) -// lua end - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorScroller.h" +#include "Foreach.h" +#include "RageUtil.h" +#include "XmlFile.h" +#include "arch/Dialog/Dialog.h" +#include "RageLog.h" +#include "ActorUtil.h" +#include "LuaBinding.h" + +/* Tricky: We need ActorFrames created in Lua to auto delete their children. + * We don't want classes that derive from ActorFrame to auto delete their + * children. The name "ActorFrame" is widely used in Lua, so we'll have + * that string instead create an ActorFrameAutoDeleteChildren object. */ +//REGISTER_ACTOR_CLASS( ActorScroller ); +REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller ); +ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); } + + +ActorScroller::ActorScroller() +{ + m_iNumItems = 0; + m_fCurrentItem = 0; + m_fDestinationItem = 0; + m_fSecondsPerItem = 1; + m_fSecondsPauseBetweenItems = 0; + m_fNumItemsToDraw = 7; + m_iFirstSubActorIndex = 0; + m_bLoop = false; + m_bFastCatchup = false; + m_bFunctionDependsOnPositionOffset = true; + m_bFunctionDependsOnItemIndex = true; + m_fPauseCountdownSeconds = 0; + m_fQuantizePixels = 0; + + m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values + m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer + m_fMaskWidth = 0; + m_fMaskHeight = 0; + DisableMask(); +} + +void ActorScroller::Load2() +{ + m_iNumItems = m_SubActors.size(); + + Lua *L = LUA->Get(); + for( unsigned i = 0; i < m_SubActors.size(); ++i ) + { + lua_pushnumber( L, i ); + this->m_SubActors[i]->m_pLuaInstance->Set( L, "ItemIndex" ); + } + LUA->Release( L ); +} + +void ActorScroller::SetTransformFromReference( const LuaReference &ref ) +{ + m_exprTransformFunction.SetFromReference( ref ); + + // Probe to find which of the parameters are used. +#define GP(a,b) m_exprTransformFunction.GetTransformCached( a, b, 2 ) + m_bFunctionDependsOnPositionOffset = (GP(0,0) != GP(1,0)) && (GP(0,1) != GP(1,1)); + m_bFunctionDependsOnItemIndex = (GP(0,0) != GP(0,1)) && (GP(1,0) != GP(1,1)); + m_exprTransformFunction.ClearCache(); +} + +void ActorScroller::SetTransformFromExpression( const RString &sTransformFunction ) +{ + LuaReference ref; + ref.SetFromExpression( sTransformFunction ); + SetTransformFromReference( ref ); +} + +void ActorScroller::SetTransformFromWidth( float fItemWidth ) +{ + SetTransformFromExpression( ssprintf("function(self,offset,itemIndex,numItems) self:x(%f*offset) end",fItemWidth) ); +} + +void ActorScroller::SetTransformFromHeight( float fItemHeight ) +{ + SetTransformFromExpression( ssprintf("function(self,offset,itemIndex,numItems) self:y(%f*offset) end",fItemHeight) ); +} + +void ActorScroller::EnableMask( float fWidth, float fHeight ) +{ + m_quadMask.SetVisible( fWidth != 0 && fHeight != 0 ); + m_quadMask.SetWidth( fWidth ); + m_fMaskWidth = fWidth; + m_quadMask.SetHeight( fHeight ); + m_fMaskHeight = fHeight; +} + +void ActorScroller::DisableMask() +{ + m_quadMask.SetVisible( false ); +} + +void ActorScroller::ScrollThroughAllItems() +{ + m_fCurrentItem = m_bLoop ? +m_fNumItemsToDraw/2.0f : -(m_fNumItemsToDraw/2.0f)-1; + m_fDestinationItem = (float)(m_iNumItems+m_fNumItemsToDraw/2.0f+1); +} + +void ActorScroller::ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd ) +{ + m_fCurrentItem = -fItemPaddingStart; + m_fDestinationItem = m_iNumItems-1+fItemPaddingEnd; +} + +float ActorScroller::GetSecondsForCompleteScrollThrough() const +{ + float fTotalItems = m_fNumItemsToDraw + m_iNumItems; + return fTotalItems * (m_fSecondsPerItem + m_fSecondsPauseBetweenItems ); +} + +float ActorScroller::GetSecondsToDestination() const +{ + float fTotalItemsToMove = fabsf(m_fCurrentItem - m_fDestinationItem); + return fTotalItemsToMove * m_fSecondsPerItem; +} + +void ActorScroller::LoadFromNode( const XNode *pNode ) +{ + ActorFrame::LoadFromNode( pNode ); + + Load2(); + + float fNumItemsToDraw = 0; + if( pNode->GetAttrValue("NumItemsToDraw", fNumItemsToDraw) ) + SetNumItemsToDraw( fNumItemsToDraw ); + + float fSecondsPerItem = 0; + if( pNode->GetAttrValue("SecondsPerItem", fSecondsPerItem) ) + ActorScroller::SetSecondsPerItem( fSecondsPerItem ); + + Lua *L = LUA->Get(); + pNode->PushAttrValue( L, "TransformFunction" ); + { + LuaReference ref; + ref.SetFromStack( L ); + if( !ref.IsNil() ) + SetTransformFromReference( ref ); + } + LUA->Release( L ); + + int iSubdivisions = 1; + if( pNode->GetAttrValue("Subdivisions", iSubdivisions) ) + ActorScroller::SetNumSubdivisions( iSubdivisions ); + + bool bUseMask = false; + pNode->GetAttrValue( "UseMask", bUseMask ); + + if( bUseMask ) + { + pNode->GetAttrValue( "MaskWidth", m_fMaskWidth ); + pNode->GetAttrValue( "MaskHeight", m_fMaskHeight ); + EnableMask( m_fMaskWidth, m_fMaskHeight ); + } + + pNode->GetAttrValue( "QuantizePixels", m_fQuantizePixels ); +} + +void ActorScroller::UpdateInternal( float fDeltaTime ) +{ + ActorFrame::UpdateInternal( fDeltaTime ); + + // If we have no children, the code below will busy loop. + if( !m_SubActors.size() ) + return; + + // handle pause + if( fDeltaTime > m_fPauseCountdownSeconds ) + { + fDeltaTime -= m_fPauseCountdownSeconds; + m_fPauseCountdownSeconds = 0; + } + else + { + m_fPauseCountdownSeconds -= fDeltaTime; + fDeltaTime = 0; + return; + } + + + if( m_fCurrentItem == m_fDestinationItem ) + return; // done scrolling + + + float fOldItemAtTop = m_fCurrentItem; + if( m_fSecondsPerItem > 0 ) + { + float fApproachSpeed = fDeltaTime/m_fSecondsPerItem; + if( m_bFastCatchup ) + { + float fDistanceToMove = fabsf(m_fCurrentItem - m_fDestinationItem); + if( fDistanceToMove > 1 ) + fApproachSpeed *= fDistanceToMove*fDistanceToMove; + } + + fapproach( m_fCurrentItem, m_fDestinationItem, fApproachSpeed ); + } + + // if items changed, then pause + if( (int)fOldItemAtTop != (int)m_fCurrentItem ) + m_fPauseCountdownSeconds = m_fSecondsPauseBetweenItems; + + if( m_bLoop ) + m_fCurrentItem = fmodf( m_fCurrentItem, (float) m_iNumItems ); +} + +void ActorScroller::DrawPrimitives() +{ + PositionItemsAndDrawPrimitives( true ); +} + +void ActorScroller::PositionItems() +{ + PositionItemsAndDrawPrimitives( false ); +} + +/* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex + * in m_SubActors[0]. */ +void ActorScroller::ShiftSubActors( int iDist ) +{ + if( iDist != INT_MAX ) + CircularShift( m_SubActors, iDist ); +} + +void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives ) +{ + if( m_SubActors.empty() ) + return; + + float fNumItemsToDraw = m_fNumItemsToDraw; + if( m_quadMask.GetVisible() ) + { + // write to z buffer so that top and bottom are clipped + // Draw an extra item; this is the one that will be masked. + fNumItemsToDraw++; + float fPositionFullyOffScreenTop = -(fNumItemsToDraw)/2.f; + float fPositionFullyOffScreenBottom = (fNumItemsToDraw)/2.f; + + m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenTop, -1, m_iNumItems ); + if( bDrawPrimitives ) m_quadMask.Draw(); + + m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenBottom, m_iNumItems, m_iNumItems ); + if( bDrawPrimitives ) m_quadMask.Draw(); + } + + float fFirstItemToDraw = m_fCurrentItem - fNumItemsToDraw/2.f; + float fLastItemToDraw = m_fCurrentItem + fNumItemsToDraw/2.f; + int iFirstItemToDraw = (int) ceilf( fFirstItemToDraw ); + int iLastItemToDraw = (int) ceilf( fLastItemToDraw ); + if( !m_bLoop ) + { + iFirstItemToDraw = clamp( iFirstItemToDraw, 0, m_iNumItems ); + iLastItemToDraw = clamp( iLastItemToDraw, 0, m_iNumItems ); + } + + bool bDelayedDraw = m_bDrawByZPosition && !m_bLoop; + vector subs; + + { + // Shift m_SubActors so iFirstItemToDraw is at the beginning. + int iNewFirstIndex = iFirstItemToDraw; + int iDist = iNewFirstIndex - m_iFirstSubActorIndex; + m_iFirstSubActorIndex = iNewFirstIndex; + ShiftSubActors( iDist ); + } + + int iNumToDraw = iLastItemToDraw - iFirstItemToDraw; + for( int i = 0; i < iNumToDraw; ++i ) + { + int iItem = i + iFirstItemToDraw; + float fPosition = iItem - m_fCurrentItem; + int iIndex = i; // index into m_SubActors + if( m_bLoop ) + wrap( iIndex, m_SubActors.size() ); + else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() ) + continue; + + // Optimization: Zero out unused parameters so that they don't create new, + // unnecessary entries in the position cache. On scrollers with lots of + // items, especially with Subdivisions > 1, m_exprTransformFunction uses + // too much memory. + if( !m_bFunctionDependsOnPositionOffset ) + fPosition = 0; + if( !m_bFunctionDependsOnItemIndex ) + iItem = 0; + + m_exprTransformFunction.TransformItemCached( *m_SubActors[iIndex], fPosition, iItem, m_iNumItems ); + if( bDrawPrimitives ) + { + if( bDelayedDraw ) + subs.push_back( m_SubActors[iIndex] ); + else + m_SubActors[iIndex]->Draw(); + } + } + + if( bDelayedDraw ) + { + ActorUtil::SortByZPosition( subs ); + FOREACH( Actor*, subs, a ) + (*a)->Draw(); + } +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorScroller. */ +class LunaActorScroller: public Luna +{ +public: + static int PositionItems( T* p, lua_State *L ) { p->PositionItems(); return 0; } + static int SetTransformFromFunction( T* p, lua_State *L ) + { + LuaReference ref; + LuaHelpers::FromStack( L, ref, 1 ); + p->SetTransformFromReference( ref ); + return 0; + } + static int SetTransformFromHeight( T* p, lua_State *L ) { p->SetTransformFromHeight(FArg(1)); return 0; } + static int SetTransformFromWidth( T* p, lua_State *L ) { p->SetTransformFromWidth(FArg(1)); return 0; } + static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); return 0; } + static int SetDestinationItem( T* p, lua_State *L ) { p->SetDestinationItem( FArg(1) ); return 0; } + static int GetSecondsToDestination( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsToDestination() ); return 1; } + static int SetSecondsPerItem( T* p, lua_State *L ) { p->SetSecondsPerItem(FArg(1)); return 0; } + static int SetSecondsPauseBetweenItems( T* p, lua_State *L ) { p->SetSecondsPauseBetweenItems(FArg(1)); return 0; } + static int SetPauseCountdownSeconds( T* p, lua_State *L ) { p->SetPauseCountdownSeconds(FArg(1)); return 0; } + static int SetNumSubdivisions( T* p, lua_State *L ) { p->SetNumSubdivisions(IArg(1)); return 0; } + static int ScrollThroughAllItems( T* p, lua_State *L ) { p->ScrollThroughAllItems(); return 0; } + static int ScrollWithPadding( T* p, lua_State *L ) { p->ScrollWithPadding(FArg(1),FArg(2)); return 0; } + static int SetFastCatchup( T* p, lua_State *L ) { p->SetFastCatchup(BArg(1)); return 0; } + static int SetLoop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); return 0; } + static int SetMask( T* p, lua_State *L ) { p->EnableMask(FArg(1), FArg(2)); return 0; } + + static int SetNumItemsToDraw( T* p, lua_State *L ) { p->SetNumItemsToDraw(FArg(1)); return 0; } + static int GetFullScrollLengthSeconds( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsForCompleteScrollThrough() ); return 1; } + static int GetCurrentItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetCurrentItem() ); return 1; } + static int GetDestinationItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetDestinationItem() ); return 1; } + static int GetNumItems( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumItems() ); return 1; } + + LunaActorScroller() + { + ADD_METHOD( PositionItems ); + ADD_METHOD( SetTransformFromFunction ); + ADD_METHOD( SetTransformFromHeight ); + ADD_METHOD( SetTransformFromWidth ); + ADD_METHOD( SetCurrentAndDestinationItem ); + ADD_METHOD( SetDestinationItem ); + ADD_METHOD( GetSecondsToDestination ); + ADD_METHOD( SetSecondsPerItem ); + ADD_METHOD( SetSecondsPauseBetweenItems ); + ADD_METHOD( SetPauseCountdownSeconds ); + ADD_METHOD( SetNumSubdivisions ); + ADD_METHOD( ScrollThroughAllItems ); + ADD_METHOD( ScrollWithPadding ); + ADD_METHOD( SetFastCatchup ); + ADD_METHOD( SetLoop ); + ADD_METHOD( SetMask ); + ADD_METHOD( SetNumItemsToDraw ); + ADD_METHOD( GetFullScrollLengthSeconds ); + ADD_METHOD( GetCurrentItem ); + ADD_METHOD( GetDestinationItem ); + ADD_METHOD( GetNumItems ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorScroller, ActorFrame ) +// lua end + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorScroller.h b/src/ActorScroller.h index 64c22e2098..2a195dcde2 100644 --- a/src/ActorScroller.h +++ b/src/ActorScroller.h @@ -1,123 +1,123 @@ -#ifndef ActorScroller_H -#define ActorScroller_H - -#include "ActorFrame.h" -#include "Quad.h" -class XNode; -#include "LuaExpressionTransform.h" -/** @brief ActorFrame that moves its children. */ -class ActorScroller : public ActorFrame -{ -public: - ActorScroller(); - - void SetTransformFromReference( const LuaReference &ref ); - void SetTransformFromExpression( const RString &sTransformFunction ); - void SetTransformFromWidth( float fItemWidth ); - void SetTransformFromHeight( float fItemHeight ); - - void Load2(); - - void EnableMask( float fWidth, float fHeight ); - void DisableMask(); - - virtual void UpdateInternal( float fDelta ); - virtual void DrawPrimitives(); // handles drawing and doesn't call ActorFrame::DrawPrimitives - - void PositionItems(); - - void LoadFromNode( const XNode *pNode ); - virtual ActorScroller *Copy() const; - - void SetLoop( bool bLoop ) { m_bLoop = bLoop; } - void SetNumItemsToDraw( float fNumItemsToDraw ) { m_fNumItemsToDraw = fNumItemsToDraw; } - void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; } - void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; } - float GetCurrentItem() const { return m_fCurrentItem; } - float GetDestinationItem() const { return m_fDestinationItem; } - void ScrollThroughAllItems(); - void ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd ); - void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; } - void SetFastCatchup( bool bOn ) { m_bFastCatchup = bOn; } - void SetSecondsPerItem( float fSeconds ) { m_fSecondsPerItem = fSeconds; } - void SetSecondsPauseBetweenItems( float fSeconds ) { m_fSecondsPauseBetweenItems = fSeconds; } - void SetNumSubdivisions( int iNumSubdivisions ) { m_exprTransformFunction.SetNumSubdivisions( iNumSubdivisions ); } - float GetSecondsForCompleteScrollThrough() const; - float GetSecondsToDestination() const; - int GetNumItems() const { return m_iNumItems; } - - // Commands - void PushSelf( lua_State *L ); - -protected: - void PositionItemsAndDrawPrimitives( bool bDrawPrimitives ); - virtual void ShiftSubActors( int iDist ); - - int m_iNumItems; - /** - * @brief the current item we are focused on. - * - * An item at the center of the list, usually between 0 and m_SubActors.size(), - * will approach its destination. - * - * The above comment was paraphrased from what was here previously. It could use - * some clearing up. -Wolfman2000 */ - float m_fCurrentItem; - float m_fDestinationItem; - /** - * @brief How many seconds are there per item? - * - * If this is less than zero, then we are not scrolling. */ - float m_fSecondsPerItem; - float m_fSecondsPauseBetweenItems; - float m_fNumItemsToDraw; - int m_iFirstSubActorIndex; - bool m_bLoop; - bool m_bFastCatchup; - bool m_bFunctionDependsOnPositionOffset; - bool m_bFunctionDependsOnItemIndex; - float m_fPauseCountdownSeconds; - float m_fQuantizePixels; - - Quad m_quadMask; - float m_fMaskWidth, m_fMaskHeight; - - LuaExpressionTransform m_exprTransformFunction; // params: self,offset,itemIndex,numItems -}; - -class ActorScrollerAutoDeleteChildren : public ActorScroller -{ -public: - ActorScrollerAutoDeleteChildren() { DeleteChildrenWhenDone(true); } - virtual bool AutoLoadChildren() const { return true; } - virtual ActorScrollerAutoDeleteChildren *Copy() const; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ActorScroller_H +#define ActorScroller_H + +#include "ActorFrame.h" +#include "Quad.h" +class XNode; +#include "LuaExpressionTransform.h" +/** @brief ActorFrame that moves its children. */ +class ActorScroller : public ActorFrame +{ +public: + ActorScroller(); + + void SetTransformFromReference( const LuaReference &ref ); + void SetTransformFromExpression( const RString &sTransformFunction ); + void SetTransformFromWidth( float fItemWidth ); + void SetTransformFromHeight( float fItemHeight ); + + void Load2(); + + void EnableMask( float fWidth, float fHeight ); + void DisableMask(); + + virtual void UpdateInternal( float fDelta ); + virtual void DrawPrimitives(); // handles drawing and doesn't call ActorFrame::DrawPrimitives + + void PositionItems(); + + void LoadFromNode( const XNode *pNode ); + virtual ActorScroller *Copy() const; + + void SetLoop( bool bLoop ) { m_bLoop = bLoop; } + void SetNumItemsToDraw( float fNumItemsToDraw ) { m_fNumItemsToDraw = fNumItemsToDraw; } + void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; } + void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; } + float GetCurrentItem() const { return m_fCurrentItem; } + float GetDestinationItem() const { return m_fDestinationItem; } + void ScrollThroughAllItems(); + void ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd ); + void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; } + void SetFastCatchup( bool bOn ) { m_bFastCatchup = bOn; } + void SetSecondsPerItem( float fSeconds ) { m_fSecondsPerItem = fSeconds; } + void SetSecondsPauseBetweenItems( float fSeconds ) { m_fSecondsPauseBetweenItems = fSeconds; } + void SetNumSubdivisions( int iNumSubdivisions ) { m_exprTransformFunction.SetNumSubdivisions( iNumSubdivisions ); } + float GetSecondsForCompleteScrollThrough() const; + float GetSecondsToDestination() const; + int GetNumItems() const { return m_iNumItems; } + + // Commands + void PushSelf( lua_State *L ); + +protected: + void PositionItemsAndDrawPrimitives( bool bDrawPrimitives ); + virtual void ShiftSubActors( int iDist ); + + int m_iNumItems; + /** + * @brief the current item we are focused on. + * + * An item at the center of the list, usually between 0 and m_SubActors.size(), + * will approach its destination. + * + * The above comment was paraphrased from what was here previously. It could use + * some clearing up. -Wolfman2000 */ + float m_fCurrentItem; + float m_fDestinationItem; + /** + * @brief How many seconds are there per item? + * + * If this is less than zero, then we are not scrolling. */ + float m_fSecondsPerItem; + float m_fSecondsPauseBetweenItems; + float m_fNumItemsToDraw; + int m_iFirstSubActorIndex; + bool m_bLoop; + bool m_bFastCatchup; + bool m_bFunctionDependsOnPositionOffset; + bool m_bFunctionDependsOnItemIndex; + float m_fPauseCountdownSeconds; + float m_fQuantizePixels; + + Quad m_quadMask; + float m_fMaskWidth, m_fMaskHeight; + + LuaExpressionTransform m_exprTransformFunction; // params: self,offset,itemIndex,numItems +}; + +class ActorScrollerAutoDeleteChildren : public ActorScroller +{ +public: + ActorScrollerAutoDeleteChildren() { DeleteChildrenWhenDone(true); } + virtual bool AutoLoadChildren() const { return true; } + virtual ActorScrollerAutoDeleteChildren *Copy() const; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorSound.cpp b/src/ActorSound.cpp index 054ee2c2a7..588a6635af 100644 --- a/src/ActorSound.cpp +++ b/src/ActorSound.cpp @@ -1,103 +1,103 @@ -#include "global.h" -#include "ActorSound.h" -#include "ActorUtil.h" -#include "LuaManager.h" -#include "XmlFile.h" -#include "RageUtil.h" - -REGISTER_ACTOR_CLASS_WITH_NAME( ActorSound, Sound ); - -void ActorSound::Load( const RString &sPath ) -{ - m_Sound.Load( sPath, true ); -} - -void ActorSound::Play() -{ - // This fix makes it possible to stop and pause ActorSounds. (Also, - // sometimes stacking sounds is annoying.) -DaisuMaster - if( m_Sound.IsPlaying() ) - { - m_Sound.PlayCopy(); - return; - } - m_Sound.StartPlaying(); -} - -void ActorSound::Pause( bool bPause ) -{ - m_Sound.Pause(bPause); -} - -void ActorSound::Stop() -{ - m_Sound.Stop(); -} - -void ActorSound::LoadFromNode( const XNode* pNode ) -{ - RageSoundLoadParams params; - pNode->GetAttrValue("SupportPan", params.m_bSupportPan); - pNode->GetAttrValue("SupportRateChanging", params.m_bSupportRateChanging); - - bool bPrecache = true; - pNode->GetAttrValue( "Precache", bPrecache ); - - Actor::LoadFromNode( pNode ); - - RString sFile; - if( ActorUtil::GetAttrPath(pNode, "File", sFile) ) - m_Sound.Load( sFile, bPrecache, ¶ms ); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ActorSound. */ -class LunaActorSound: public Luna -{ -public: - static int load( T* p, lua_State *L ) { p->Load(SArg(1)); return 0; } - static int play( T* p, lua_State *L ) { p->Play(); return 0; } - static int pause( T* p, lua_State *L ) { p->Pause(BArg(1)); return 0; } - static int stop( T* p, lua_State *L ) { p->Stop(); return 0; } - static int get( T* p, lua_State *L ) { p->PushSound( L ); return 1; } - - LunaActorSound() - { - ADD_METHOD( load ); - ADD_METHOD( play ); - ADD_METHOD( pause ); - ADD_METHOD( stop ); - ADD_METHOD( get ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ActorSound, Actor ) -// lua end - - -/* - * (c) 2005 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorSound.h" +#include "ActorUtil.h" +#include "LuaManager.h" +#include "XmlFile.h" +#include "RageUtil.h" + +REGISTER_ACTOR_CLASS_WITH_NAME( ActorSound, Sound ); + +void ActorSound::Load( const RString &sPath ) +{ + m_Sound.Load( sPath, true ); +} + +void ActorSound::Play() +{ + // This fix makes it possible to stop and pause ActorSounds. (Also, + // sometimes stacking sounds is annoying.) -DaisuMaster + if( m_Sound.IsPlaying() ) + { + m_Sound.PlayCopy(); + return; + } + m_Sound.StartPlaying(); +} + +void ActorSound::Pause( bool bPause ) +{ + m_Sound.Pause(bPause); +} + +void ActorSound::Stop() +{ + m_Sound.Stop(); +} + +void ActorSound::LoadFromNode( const XNode* pNode ) +{ + RageSoundLoadParams params; + pNode->GetAttrValue("SupportPan", params.m_bSupportPan); + pNode->GetAttrValue("SupportRateChanging", params.m_bSupportRateChanging); + + bool bPrecache = true; + pNode->GetAttrValue( "Precache", bPrecache ); + + Actor::LoadFromNode( pNode ); + + RString sFile; + if( ActorUtil::GetAttrPath(pNode, "File", sFile) ) + m_Sound.Load( sFile, bPrecache, ¶ms ); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ActorSound. */ +class LunaActorSound: public Luna +{ +public: + static int load( T* p, lua_State *L ) { p->Load(SArg(1)); return 0; } + static int play( T* p, lua_State *L ) { p->Play(); return 0; } + static int pause( T* p, lua_State *L ) { p->Pause(BArg(1)); return 0; } + static int stop( T* p, lua_State *L ) { p->Stop(); return 0; } + static int get( T* p, lua_State *L ) { p->PushSound( L ); return 1; } + + LunaActorSound() + { + ADD_METHOD( load ); + ADD_METHOD( play ); + ADD_METHOD( pause ); + ADD_METHOD( stop ); + ADD_METHOD( get ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ActorSound, Actor ) +// lua end + + +/* + * (c) 2005 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorSound.h b/src/ActorSound.h index f2153181e7..8b1d29d90a 100644 --- a/src/ActorSound.h +++ b/src/ActorSound.h @@ -1,56 +1,56 @@ -#ifndef ACTOR_SOUND_H -#define ACTOR_SOUND_H - -#include "Actor.h" -#include "RageSound.h" -/** @brief RageSound Actor interface. */ -class ActorSound: public Actor -{ -public: - virtual ~ActorSound() { } - virtual ActorSound *Copy() const; - - void Load( const RString &sPath ); - void Play(); - void Pause( bool bPause ); - void Stop(); - void LoadFromNode( const XNode* pNode ); - void PushSound( lua_State *L ) { m_Sound.PushSelf( L ); } - - // - // Lua - // - virtual void PushSelf( lua_State *L ); - -private: - RageSound m_Sound; -}; - -#endif - -/** - * @file - * @author Glenn Maynard (c) 2005 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTOR_SOUND_H +#define ACTOR_SOUND_H + +#include "Actor.h" +#include "RageSound.h" +/** @brief RageSound Actor interface. */ +class ActorSound: public Actor +{ +public: + virtual ~ActorSound() { } + virtual ActorSound *Copy() const; + + void Load( const RString &sPath ); + void Play(); + void Pause( bool bPause ); + void Stop(); + void LoadFromNode( const XNode* pNode ); + void PushSound( lua_State *L ) { m_Sound.PushSelf( L ); } + + // + // Lua + // + virtual void PushSelf( lua_State *L ); + +private: + RageSound m_Sound; +}; + +#endif + +/** + * @file + * @author Glenn Maynard (c) 2005 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorUtil.cpp b/src/ActorUtil.cpp index b81d5e3969..fc51a2a428 100644 --- a/src/ActorUtil.cpp +++ b/src/ActorUtil.cpp @@ -1,484 +1,484 @@ -#include "global.h" -#include "ActorUtil.h" -#include "ThemeManager.h" -#include "RageFileManager.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "EnumHelper.h" -#include "XmlFile.h" -#include "XmlFileUtil.h" -#include "LuaManager.h" -#include "Foreach.h" - -#include "arch/Dialog/Dialog.h" - - -// Actor registration -static map *g_pmapRegistrees = NULL; - -static bool IsRegistered( const RString& sClassName ) -{ - return g_pmapRegistrees->find( sClassName ) != g_pmapRegistrees->end(); -} - -void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn ) -{ - if( g_pmapRegistrees == NULL ) - g_pmapRegistrees = new map; - - map::iterator iter = g_pmapRegistrees->find( sClassName ); - ASSERT_M( iter == g_pmapRegistrees->end(), ssprintf("Actor class '%s' already registered.", sClassName.c_str()) ); - - (*g_pmapRegistrees)[sClassName] = pfn; -} - -bool ActorUtil::ResolvePath( RString &sPath, const RString &sName ) -{ -retry: - CollapsePath( sPath ); - - // If we know this is an exact match, don't bother with the GetDirListing, - // so "foo" doesn't partial match "foobar" if "foo" exists. - RageFileManager::FileType ft = FILEMAN->GetFileType( sPath ); - if( ft != RageFileManager::TYPE_FILE && ft != RageFileManager::TYPE_DIR ) - { - vector asPaths; - GetDirListing( sPath + "*", asPaths, false, true ); // return path too - - if( asPaths.empty() ) - { - RString sError = ssprintf( "%s: references a file \"%s\" which doesn't exist", sName.c_str(), sPath.c_str() ); - switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) - { - case Dialog::abort: - RageException::Throw( "%s", sError.c_str() ); - break; - case Dialog::retry: - FILEMAN->FlushDirCache(); - goto retry; - case Dialog::ignore: - return false; - default: - ASSERT(0); - } - } - - THEME->FilterFileLanguages( asPaths ); - - if( asPaths.size() > 1 ) - { - RString sError = ssprintf( "%s: references a file \"%s\" which has multiple matches", sName.c_str(), sPath.c_str() ); - sError += "\n" + join( "\n", asPaths ); - switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) - { - case Dialog::abort: - RageException::Throw( "%s", sError.c_str() ); - break; - case Dialog::retry: - FILEMAN->FlushDirCache(); - goto retry; - case Dialog::ignore: - asPaths.erase( asPaths.begin()+1, asPaths.end() ); - break; - default: - ASSERT(0); - } - } - - sPath = asPaths[0]; - } - - if( ft == RageFileManager::TYPE_DIR ) - { - RString sLuaPath = sPath + "/default.lua"; - if( DoesFileExist(sLuaPath) ) - { - sPath = sLuaPath; - return true; - } - } - - sPath = DerefRedir( sPath ); - return true; -} - -Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor ) -{ - ASSERT( pNode ); - - // Remove this in favor of using conditionals in Lua. -Chris - // There are a number of themes out there that depend on this (including - // sm-ssc default). Probably for the best to leave this in. -aj - { - bool bCond; - if( pNode->GetAttrValue("Condition", bCond) && !bCond ) - return NULL; - } - - RString sClass; - pNode->GetAttrValue( "Class", sClass ); - - map::iterator iter = g_pmapRegistrees->find( sClass ); - if( iter == g_pmapRegistrees->end() ) - { - // sClass is invalid - RString sError = ssprintf( "%s: invalid Class \"%s\"", - ActorUtil::GetWhere(pNode).c_str(), sClass.c_str() ); - Dialog::OK( sError ); - return new Actor; // Return a dummy object so that we don't crash in AutoActor later. - } - - const CreateActorFn &pfn = iter->second; - Actor *pRet = pfn(); - - if( pParentActor ) - pRet->SetParent( pParentActor ); - - pRet->LoadFromNode( pNode ); - return pRet; -} - -namespace -{ - XNode *LoadXNodeFromLuaShowErrors( const RString &sFile ) - { - RString sScript; - if( !GetFileContents(sFile, sScript) ) - return NULL; - - Lua *L = LUA->Get(); - - RString sError; - if( !LuaHelpers::LoadScript(L, sScript, "@" + sFile, sError) ) - { - LUA->Release( L ); - sError = ssprintf( "Lua runtime error: %s", sError.c_str() ); - Dialog::OK( sError, "LUA_ERROR" ); - return NULL; - } - - XNode *pRet = NULL; - if( ActorUtil::LoadTableFromStackShowErrors(L) ) - pRet = XmlFileUtil::XNodeFromTable( L ); - - LUA->Release( L ); - return pRet; - } -} - -/* Run the function at the top of the stack, which returns an actor description - * table. If the table was returned, return true and leave it on the stack. - * If not, display an error, return false, and leave nothing on the stack. */ -bool ActorUtil::LoadTableFromStackShowErrors( Lua *L ) -{ - LuaReference func; - lua_pushvalue( L, -1 ); - func.SetFromStack( L ); - - RString sError; - if( !LuaHelpers::RunScriptOnStack(L, sError, 0, 1) ) - { - lua_pop( L, 1 ); - sError = ssprintf( "Lua runtime error: %s", sError.c_str() ); - Dialog::OK( sError, "LUA_ERROR" ); - return false; - } - - if( lua_type(L, -1) != LUA_TTABLE ) - { - lua_pop( L, 1 ); - - func.PushSelf( L ); - lua_Debug debug; - lua_getinfo( L, ">nS", &debug ); - - sError = ssprintf( "%s: must return a table", debug.short_src ); - - Dialog::OK( sError, "LUA_ERROR" ); - return false; - } - return true; -} - -Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor ) -{ - RString sPath( sPath_ ); - - FileType ft = GetFileType( sPath ); - switch( ft ) - { - case FT_Lua: - { - auto_ptr pNode( LoadXNodeFromLuaShowErrors(sPath) ); - if( pNode.get() == NULL ) - { - // XNode will warn about the error - return new Actor; - } - - Actor *pRet = ActorUtil::LoadFromNode( pNode.get(), pParentActor ); - return pRet; - } - case FT_Directory: - { - if( sPath.Right(1) != "/" ) - sPath += '/'; - XNode xml; - xml.AppendAttr( "Class", "BGAnimation" ); - xml.AppendAttr( "AniDir", sPath ); - - return ActorUtil::LoadFromNode( &xml, pParentActor ); - } - case FT_Bitmap: - case FT_Movie: - { - XNode xml; - xml.AppendAttr( "Class", "Sprite" ); - xml.AppendAttr( "Texture", sPath ); - - return ActorUtil::LoadFromNode( &xml, pParentActor ); - } - case FT_Model: - { - XNode xml; - xml.AppendAttr( "Class", "Model" ); - xml.AppendAttr( "Meshes", sPath ); - xml.AppendAttr( "Materials", sPath ); - xml.AppendAttr( "Bones", sPath ); - - return ActorUtil::LoadFromNode( &xml, pParentActor ); - } - default: - { - LOG->Warn( "File \"%s\" has unknown type, \"%s\".", sPath.c_str(), FileTypeToString(ft).c_str() ); - - XNode xml; - xml.AppendAttr( "Class", "Actor" ); - return ActorUtil::LoadFromNode( &xml, pParentActor ); - } - } -} - -RString ActorUtil::GetSourcePath( const XNode *pNode ) -{ - RString sRet; - pNode->GetAttrValue( "_Source", sRet ); - if( sRet.substr(0, 1) == "@" ) - sRet.erase( 0, 1 ); - - return sRet; -} - -RString ActorUtil::GetWhere( const XNode *pNode ) -{ - RString sPath = GetSourcePath( pNode ); - - int iLine; - if( pNode->GetAttrValue("_Line", iLine) ) - sPath += ssprintf( ":%i", iLine ); - return sPath; -} - -bool ActorUtil::GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ) -{ - if( !pNode->GetAttrValue(sName, sOut) ) - return false; - - bool bIsRelativePath = sOut.Left(1) != "/"; - if( bIsRelativePath ) - { - RString sDir; - if( !pNode->GetAttrValue("_Dir", sDir) ) - { - LOG->Warn( "Relative path \"%s\", but path is unknown", sOut.c_str() ); - return false; - } - sOut = sDir+sOut; - } - - return ActorUtil::ResolvePath( sOut, ActorUtil::GetWhere(pNode) ); -} - -apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands, const RString &sName ) -{ - Lua *L = LUA->Get(); - LuaHelpers::ParseCommandList( L, sCommands, sName ); - LuaReference *pRet = new LuaReference; - pRet->SetFromStack( L ); - LUA->Release( L ); - - return apActorCommands( pRet ); -} - -void ActorUtil::SetXY( Actor& actor, const RString &sMetricsGroup ) -{ - ASSERT( !actor.GetName().empty() ); - - /* - * Hack: This is run after InitCommand, and InitCommand might set X/Y. If - * these are both 0, leave the actor where it is. If InitCommand doesn't, - * then 0,0 is the default, anyway. - */ - float fX = THEME->GetMetricF(sMetricsGroup,actor.GetName()+"X"); - float fY = THEME->GetMetricF(sMetricsGroup,actor.GetName()+"Y"); - if( fX != 0 || fY != 0 ) - actor.SetXY( fX, fY ); -} - -void ActorUtil::LoadCommand( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName ) -{ - ActorUtil::LoadCommandFromName( actor, sMetricsGroup, sCommandName, actor.GetName() ); -} - -void ActorUtil::LoadCommandFromName( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName, const RString &sName ) -{ - actor.AddCommand( sCommandName, THEME->GetMetricA(sMetricsGroup,sName+sCommandName+"Command") ); -} - -void ActorUtil::LoadAllCommands( Actor& actor, const RString &sMetricsGroup ) -{ - LoadAllCommandsFromName( actor, sMetricsGroup, actor.GetName() ); -} - -void ActorUtil::LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName ) -{ - set vsValueNames; - THEME->GetMetricsThatBeginWith( sMetricsGroup, sName, vsValueNames ); - - FOREACHS_CONST( RString, vsValueNames, v ) - { - const RString &sv = *v; - static const RString sEnding = "Command"; - if( EndsWith(sv,sEnding) ) - { - RString sCommandName( sv.begin()+sName.size(), sv.end()-sEnding.size() ); - LoadCommandFromName( actor, sMetricsGroup, sCommandName, sName ); - } - } -} - -static bool CompareActorsByZPosition(const Actor *p1, const Actor *p2) -{ - return p1->GetZ() < p2->GetZ(); -} - -void ActorUtil::SortByZPosition( vector &vActors ) -{ - // Preserve ordering of Actors with equal Z positions. - stable_sort( vActors.begin(), vActors.end(), CompareActorsByZPosition ); -} - -static const char *FileTypeNames[] = { - "Bitmap", - "Sound", - "Movie", - "Directory", - "Lua", - "Model", -}; -XToString( FileType ); -LuaXType( FileType ); - -FileType ActorUtil::GetFileType( const RString &sPath ) -{ - RString sExt = GetExtension( sPath ); - sExt.MakeLower(); - - if( sExt=="lua" ) return FT_Lua; - else if( - sExt=="png" || - sExt=="jpg" || - sExt=="gif" || - sExt=="bmp" ) return FT_Bitmap; - else if( - sExt=="ogg" || - sExt=="oga" || - sExt=="wav" || - sExt=="mp3" ) return FT_Sound; - else if( - sExt=="ogv" || - sExt=="avi" || - sExt=="mpeg" || - sExt=="mpg" ) return FT_Movie; - else if( - sExt=="txt" ) return FT_Model; - else if( sPath.size() > 0 && sPath[sPath.size()-1] == '/' ) - return FT_Directory; - /* Do this last, to avoid the IsADirectory in most cases. */ - else if( IsADirectory(sPath) ) return FT_Directory; - else return FileType_Invalid; -} - - -// lua start -#include "LuaBinding.h" - -namespace -{ - int GetFileType( lua_State *L ) { Enum::Push( L, ActorUtil::GetFileType(SArg(1)) ); return 1; } - int ResolvePath( lua_State *L ) - { - RString sPath( SArg(1) ); - int iLevel = IArg(2); - luaL_where( L, iLevel ); - RString sWhere = lua_tostring( L, -1 ); - if( sWhere.size() > 2 && sWhere.substr(sWhere.size()-2, 2) == ": " ) - sWhere = sWhere.substr( 0, sWhere.size()-2 ); // remove trailing ": " - - LUA->YieldLua(); - bool bRet = ActorUtil::ResolvePath( sPath, sWhere ); - LUA->UnyieldLua(); - - if( !bRet ) - return 0; - LuaHelpers::Push( L, sPath ); - return 1; - } - int IsRegisteredClass( lua_State *L ) - { - lua_pushboolean( L, IsRegistered(SArg(1)) ); - return 1; - } - static int LoadAllCommandsAndSetXY( lua_State *L ) - { - Actor *p = Luna::check( L, 1 ); - ActorUtil::LoadAllCommandsAndSetXY( p, SArg(2) ); - return 0; - } - - const luaL_Reg ActorUtilTable[] = - { - LIST_METHOD( GetFileType ), - LIST_METHOD( ResolvePath ), - LIST_METHOD( IsRegisteredClass ), - LIST_METHOD( LoadAllCommandsAndSetXY ), - { NULL, NULL } - }; -} - -LUA_REGISTER_NAMESPACE( ActorUtil ) - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ActorUtil.h" +#include "ThemeManager.h" +#include "RageFileManager.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "EnumHelper.h" +#include "XmlFile.h" +#include "XmlFileUtil.h" +#include "LuaManager.h" +#include "Foreach.h" + +#include "arch/Dialog/Dialog.h" + + +// Actor registration +static map *g_pmapRegistrees = NULL; + +static bool IsRegistered( const RString& sClassName ) +{ + return g_pmapRegistrees->find( sClassName ) != g_pmapRegistrees->end(); +} + +void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn ) +{ + if( g_pmapRegistrees == NULL ) + g_pmapRegistrees = new map; + + map::iterator iter = g_pmapRegistrees->find( sClassName ); + ASSERT_M( iter == g_pmapRegistrees->end(), ssprintf("Actor class '%s' already registered.", sClassName.c_str()) ); + + (*g_pmapRegistrees)[sClassName] = pfn; +} + +bool ActorUtil::ResolvePath( RString &sPath, const RString &sName ) +{ +retry: + CollapsePath( sPath ); + + // If we know this is an exact match, don't bother with the GetDirListing, + // so "foo" doesn't partial match "foobar" if "foo" exists. + RageFileManager::FileType ft = FILEMAN->GetFileType( sPath ); + if( ft != RageFileManager::TYPE_FILE && ft != RageFileManager::TYPE_DIR ) + { + vector asPaths; + GetDirListing( sPath + "*", asPaths, false, true ); // return path too + + if( asPaths.empty() ) + { + RString sError = ssprintf( "%s: references a file \"%s\" which doesn't exist", sName.c_str(), sPath.c_str() ); + switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) + { + case Dialog::abort: + RageException::Throw( "%s", sError.c_str() ); + break; + case Dialog::retry: + FILEMAN->FlushDirCache(); + goto retry; + case Dialog::ignore: + return false; + default: + ASSERT(0); + } + } + + THEME->FilterFileLanguages( asPaths ); + + if( asPaths.size() > 1 ) + { + RString sError = ssprintf( "%s: references a file \"%s\" which has multiple matches", sName.c_str(), sPath.c_str() ); + sError += "\n" + join( "\n", asPaths ); + switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) + { + case Dialog::abort: + RageException::Throw( "%s", sError.c_str() ); + break; + case Dialog::retry: + FILEMAN->FlushDirCache(); + goto retry; + case Dialog::ignore: + asPaths.erase( asPaths.begin()+1, asPaths.end() ); + break; + default: + ASSERT(0); + } + } + + sPath = asPaths[0]; + } + + if( ft == RageFileManager::TYPE_DIR ) + { + RString sLuaPath = sPath + "/default.lua"; + if( DoesFileExist(sLuaPath) ) + { + sPath = sLuaPath; + return true; + } + } + + sPath = DerefRedir( sPath ); + return true; +} + +Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor ) +{ + ASSERT( pNode ); + + // Remove this in favor of using conditionals in Lua. -Chris + // There are a number of themes out there that depend on this (including + // sm-ssc default). Probably for the best to leave this in. -aj + { + bool bCond; + if( pNode->GetAttrValue("Condition", bCond) && !bCond ) + return NULL; + } + + RString sClass; + pNode->GetAttrValue( "Class", sClass ); + + map::iterator iter = g_pmapRegistrees->find( sClass ); + if( iter == g_pmapRegistrees->end() ) + { + // sClass is invalid + RString sError = ssprintf( "%s: invalid Class \"%s\"", + ActorUtil::GetWhere(pNode).c_str(), sClass.c_str() ); + Dialog::OK( sError ); + return new Actor; // Return a dummy object so that we don't crash in AutoActor later. + } + + const CreateActorFn &pfn = iter->second; + Actor *pRet = pfn(); + + if( pParentActor ) + pRet->SetParent( pParentActor ); + + pRet->LoadFromNode( pNode ); + return pRet; +} + +namespace +{ + XNode *LoadXNodeFromLuaShowErrors( const RString &sFile ) + { + RString sScript; + if( !GetFileContents(sFile, sScript) ) + return NULL; + + Lua *L = LUA->Get(); + + RString sError; + if( !LuaHelpers::LoadScript(L, sScript, "@" + sFile, sError) ) + { + LUA->Release( L ); + sError = ssprintf( "Lua runtime error: %s", sError.c_str() ); + Dialog::OK( sError, "LUA_ERROR" ); + return NULL; + } + + XNode *pRet = NULL; + if( ActorUtil::LoadTableFromStackShowErrors(L) ) + pRet = XmlFileUtil::XNodeFromTable( L ); + + LUA->Release( L ); + return pRet; + } +} + +/* Run the function at the top of the stack, which returns an actor description + * table. If the table was returned, return true and leave it on the stack. + * If not, display an error, return false, and leave nothing on the stack. */ +bool ActorUtil::LoadTableFromStackShowErrors( Lua *L ) +{ + LuaReference func; + lua_pushvalue( L, -1 ); + func.SetFromStack( L ); + + RString sError; + if( !LuaHelpers::RunScriptOnStack(L, sError, 0, 1) ) + { + lua_pop( L, 1 ); + sError = ssprintf( "Lua runtime error: %s", sError.c_str() ); + Dialog::OK( sError, "LUA_ERROR" ); + return false; + } + + if( lua_type(L, -1) != LUA_TTABLE ) + { + lua_pop( L, 1 ); + + func.PushSelf( L ); + lua_Debug debug; + lua_getinfo( L, ">nS", &debug ); + + sError = ssprintf( "%s: must return a table", debug.short_src ); + + Dialog::OK( sError, "LUA_ERROR" ); + return false; + } + return true; +} + +Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor ) +{ + RString sPath( sPath_ ); + + FileType ft = GetFileType( sPath ); + switch( ft ) + { + case FT_Lua: + { + auto_ptr pNode( LoadXNodeFromLuaShowErrors(sPath) ); + if( pNode.get() == NULL ) + { + // XNode will warn about the error + return new Actor; + } + + Actor *pRet = ActorUtil::LoadFromNode( pNode.get(), pParentActor ); + return pRet; + } + case FT_Directory: + { + if( sPath.Right(1) != "/" ) + sPath += '/'; + XNode xml; + xml.AppendAttr( "Class", "BGAnimation" ); + xml.AppendAttr( "AniDir", sPath ); + + return ActorUtil::LoadFromNode( &xml, pParentActor ); + } + case FT_Bitmap: + case FT_Movie: + { + XNode xml; + xml.AppendAttr( "Class", "Sprite" ); + xml.AppendAttr( "Texture", sPath ); + + return ActorUtil::LoadFromNode( &xml, pParentActor ); + } + case FT_Model: + { + XNode xml; + xml.AppendAttr( "Class", "Model" ); + xml.AppendAttr( "Meshes", sPath ); + xml.AppendAttr( "Materials", sPath ); + xml.AppendAttr( "Bones", sPath ); + + return ActorUtil::LoadFromNode( &xml, pParentActor ); + } + default: + { + LOG->Warn( "File \"%s\" has unknown type, \"%s\".", sPath.c_str(), FileTypeToString(ft).c_str() ); + + XNode xml; + xml.AppendAttr( "Class", "Actor" ); + return ActorUtil::LoadFromNode( &xml, pParentActor ); + } + } +} + +RString ActorUtil::GetSourcePath( const XNode *pNode ) +{ + RString sRet; + pNode->GetAttrValue( "_Source", sRet ); + if( sRet.substr(0, 1) == "@" ) + sRet.erase( 0, 1 ); + + return sRet; +} + +RString ActorUtil::GetWhere( const XNode *pNode ) +{ + RString sPath = GetSourcePath( pNode ); + + int iLine; + if( pNode->GetAttrValue("_Line", iLine) ) + sPath += ssprintf( ":%i", iLine ); + return sPath; +} + +bool ActorUtil::GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ) +{ + if( !pNode->GetAttrValue(sName, sOut) ) + return false; + + bool bIsRelativePath = sOut.Left(1) != "/"; + if( bIsRelativePath ) + { + RString sDir; + if( !pNode->GetAttrValue("_Dir", sDir) ) + { + LOG->Warn( "Relative path \"%s\", but path is unknown", sOut.c_str() ); + return false; + } + sOut = sDir+sOut; + } + + return ActorUtil::ResolvePath( sOut, ActorUtil::GetWhere(pNode) ); +} + +apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands, const RString &sName ) +{ + Lua *L = LUA->Get(); + LuaHelpers::ParseCommandList( L, sCommands, sName ); + LuaReference *pRet = new LuaReference; + pRet->SetFromStack( L ); + LUA->Release( L ); + + return apActorCommands( pRet ); +} + +void ActorUtil::SetXY( Actor& actor, const RString &sMetricsGroup ) +{ + ASSERT( !actor.GetName().empty() ); + + /* + * Hack: This is run after InitCommand, and InitCommand might set X/Y. If + * these are both 0, leave the actor where it is. If InitCommand doesn't, + * then 0,0 is the default, anyway. + */ + float fX = THEME->GetMetricF(sMetricsGroup,actor.GetName()+"X"); + float fY = THEME->GetMetricF(sMetricsGroup,actor.GetName()+"Y"); + if( fX != 0 || fY != 0 ) + actor.SetXY( fX, fY ); +} + +void ActorUtil::LoadCommand( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName ) +{ + ActorUtil::LoadCommandFromName( actor, sMetricsGroup, sCommandName, actor.GetName() ); +} + +void ActorUtil::LoadCommandFromName( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName, const RString &sName ) +{ + actor.AddCommand( sCommandName, THEME->GetMetricA(sMetricsGroup,sName+sCommandName+"Command") ); +} + +void ActorUtil::LoadAllCommands( Actor& actor, const RString &sMetricsGroup ) +{ + LoadAllCommandsFromName( actor, sMetricsGroup, actor.GetName() ); +} + +void ActorUtil::LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName ) +{ + set vsValueNames; + THEME->GetMetricsThatBeginWith( sMetricsGroup, sName, vsValueNames ); + + FOREACHS_CONST( RString, vsValueNames, v ) + { + const RString &sv = *v; + static const RString sEnding = "Command"; + if( EndsWith(sv,sEnding) ) + { + RString sCommandName( sv.begin()+sName.size(), sv.end()-sEnding.size() ); + LoadCommandFromName( actor, sMetricsGroup, sCommandName, sName ); + } + } +} + +static bool CompareActorsByZPosition(const Actor *p1, const Actor *p2) +{ + return p1->GetZ() < p2->GetZ(); +} + +void ActorUtil::SortByZPosition( vector &vActors ) +{ + // Preserve ordering of Actors with equal Z positions. + stable_sort( vActors.begin(), vActors.end(), CompareActorsByZPosition ); +} + +static const char *FileTypeNames[] = { + "Bitmap", + "Sound", + "Movie", + "Directory", + "Lua", + "Model", +}; +XToString( FileType ); +LuaXType( FileType ); + +FileType ActorUtil::GetFileType( const RString &sPath ) +{ + RString sExt = GetExtension( sPath ); + sExt.MakeLower(); + + if( sExt=="lua" ) return FT_Lua; + else if( + sExt=="png" || + sExt=="jpg" || + sExt=="gif" || + sExt=="bmp" ) return FT_Bitmap; + else if( + sExt=="ogg" || + sExt=="oga" || + sExt=="wav" || + sExt=="mp3" ) return FT_Sound; + else if( + sExt=="ogv" || + sExt=="avi" || + sExt=="mpeg" || + sExt=="mpg" ) return FT_Movie; + else if( + sExt=="txt" ) return FT_Model; + else if( sPath.size() > 0 && sPath[sPath.size()-1] == '/' ) + return FT_Directory; + /* Do this last, to avoid the IsADirectory in most cases. */ + else if( IsADirectory(sPath) ) return FT_Directory; + else return FileType_Invalid; +} + + +// lua start +#include "LuaBinding.h" + +namespace +{ + int GetFileType( lua_State *L ) { Enum::Push( L, ActorUtil::GetFileType(SArg(1)) ); return 1; } + int ResolvePath( lua_State *L ) + { + RString sPath( SArg(1) ); + int iLevel = IArg(2); + luaL_where( L, iLevel ); + RString sWhere = lua_tostring( L, -1 ); + if( sWhere.size() > 2 && sWhere.substr(sWhere.size()-2, 2) == ": " ) + sWhere = sWhere.substr( 0, sWhere.size()-2 ); // remove trailing ": " + + LUA->YieldLua(); + bool bRet = ActorUtil::ResolvePath( sPath, sWhere ); + LUA->UnyieldLua(); + + if( !bRet ) + return 0; + LuaHelpers::Push( L, sPath ); + return 1; + } + int IsRegisteredClass( lua_State *L ) + { + lua_pushboolean( L, IsRegistered(SArg(1)) ); + return 1; + } + static int LoadAllCommandsAndSetXY( lua_State *L ) + { + Actor *p = Luna::check( L, 1 ); + ActorUtil::LoadAllCommandsAndSetXY( p, SArg(2) ); + return 0; + } + + const luaL_Reg ActorUtilTable[] = + { + LIST_METHOD( GetFileType ), + LIST_METHOD( ResolvePath ), + LIST_METHOD( IsRegisteredClass ), + LIST_METHOD( LoadAllCommandsAndSetXY ), + { NULL, NULL } + }; +} + +LUA_REGISTER_NAMESPACE( ActorUtil ) + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ActorUtil.h b/src/ActorUtil.h index bab0991a96..1be071be39 100644 --- a/src/ActorUtil.h +++ b/src/ActorUtil.h @@ -1,161 +1,161 @@ -#ifndef ActorUtil_H -#define ActorUtil_H - -#include "Actor.h" -#include "RageTexture.h" - -class XNode; - -typedef Actor* (*CreateActorFn)(); - -template -Actor *CreateActor() { return new T; } - -/** - * @brief Register the requested Actor with the specified external name. - * - * This should be called manually only if needed. */ -#define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \ - struct Register##className { \ - Register##className() { ActorUtil::Register(#externalClassName, CreateActor); } \ - }; \ - className *className::Copy() const { return new className(*this); } \ - static Register##className register##className - -/** - * @brief Register the requested Actor so that it's more accessible. - * - * Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file. */ -#define REGISTER_ACTOR_CLASS( className ) REGISTER_ACTOR_CLASS_WITH_NAME( className, className ) - -enum FileType -{ - FT_Bitmap, - FT_Sound, - FT_Movie, - FT_Directory, - FT_Lua, - FT_Model, - NUM_FileType, - FileType_Invalid -}; -const RString& FileTypeToString( FileType ft ); - -/** @brief Utility functions for creating and manipulating Actors. */ -namespace ActorUtil -{ - // Every screen should register its class at program initialization. - void Register( const RString& sClassName, CreateActorFn pfn ); - - apActorCommands ParseActorCommands( const RString &sCommands, const RString &sName = "" ); - void SetXY( Actor& actor, const RString &sMetricsGroup ); - inline void PlayCommand( Actor& actor, const RString &sCommandName ) { actor.PlayCommand( sCommandName ); } - inline void OnCommand( Actor& actor ) - { - ASSERT_M( actor.HasCommand("On"), ssprintf("%s is missing an OnCommand.", actor.GetLineage().c_str()) ); - actor.PlayCommand("On"); - } - inline void OffCommand( Actor& actor ) - { - // HACK: It's very often that we command things to TweenOffScreen - // that we aren't drawing. We know that an Actor is not being - // used if its name is blank. So, do nothing on Actors with a blank name. - // (Do "playcommand" anyway; BGAs often have no name.) - if( actor.GetName().empty() ) - return; - ASSERT_M( actor.HasCommand("Off"), ssprintf("Actor %s is missing an OffCommand.", actor.GetLineage().c_str()) ); - actor.PlayCommand("Off"); - } - - void LoadCommand( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName ); - void LoadCommandFromName( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName, const RString &sName ); - void LoadAllCommands( Actor& actor, const RString &sMetricsGroup ); - void LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName ); - - inline void LoadAllCommandsAndSetXY( Actor& actor, const RString &sMetricsGroup ) - { - LoadAllCommands( actor, sMetricsGroup ); - SetXY( actor, sMetricsGroup ); - } - inline void LoadAllCommandsAndOnCommand( Actor& actor, const RString &sMetricsGroup ) - { - LoadAllCommands( actor, sMetricsGroup ); - OnCommand( actor ); - } - inline void SetXYAndOnCommand( Actor& actor, const RString &sMetricsGroup ) - { - SetXY( actor, sMetricsGroup ); - OnCommand( actor ); - } - inline void LoadAllCommandsAndSetXYAndOnCommand( Actor& actor, const RString &sMetricsGroup ) - { - LoadAllCommands( actor, sMetricsGroup ); - SetXY( actor, sMetricsGroup ); - OnCommand( actor ); - } - - /* convenience */ - inline void SetXY( Actor* pActor, const RString &sMetricsGroup ) { SetXY( *pActor, sMetricsGroup ); } - inline void PlayCommand( Actor* pActor, const RString &sCommandName ) { if(pActor) pActor->PlayCommand( sCommandName ); } - inline void OnCommand( Actor* pActor ) { if(pActor) ActorUtil::OnCommand( *pActor ); } - inline void OffCommand( Actor* pActor ) { if(pActor) ActorUtil::OffCommand( *pActor ); } - - inline void LoadAllCommands( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommands( *pActor, sMetricsGroup ); } - - inline void LoadAllCommandsAndSetXY( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndSetXY( *pActor, sMetricsGroup ); } - inline void LoadAllCommandsAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndOnCommand( *pActor, sMetricsGroup ); } - inline void SetXYAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) SetXYAndOnCommand( *pActor, sMetricsGroup ); } - inline void LoadAllCommandsAndSetXYAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndSetXYAndOnCommand( *pActor, sMetricsGroup ); } - - // Return a Sprite, BitmapText, or Model depending on the file type - Actor* LoadFromNode( const XNode* pNode, Actor *pParentActor = NULL ); - Actor* MakeActor( const RString &sPath, Actor *pParentActor = NULL ); - RString GetSourcePath( const XNode *pNode ); - RString GetWhere( const XNode *pNode ); - bool GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ); - bool LoadTableFromStackShowErrors( Lua *L ); - - bool ResolvePath( RString &sPath, const RString &sName ); - - void SortByZPosition( vector &vActors ); - - FileType GetFileType( const RString &sPath ); -}; - -#define SET_XY( actor ) ActorUtil::SetXY( actor, m_sName ) -#define ON_COMMAND( actor ) ActorUtil::OnCommand( actor ) -#define OFF_COMMAND( actor ) ActorUtil::OffCommand( actor ) -#define SET_XY_AND_ON_COMMAND( actor ) ActorUtil::SetXYAndOnCommand( actor, m_sName ) -#define COMMAND( actor, command_name ) ActorUtil::PlayCommand( actor, command_name ) -#define LOAD_ALL_COMMANDS( actor ) ActorUtil::LoadAllCommands( actor, m_sName ) -#define LOAD_ALL_COMMANDS_AND_SET_XY( actor ) ActorUtil::LoadAllCommandsAndSetXY( actor, m_sName ) -#define LOAD_ALL_COMMANDS_AND_ON_COMMAND( actor ) ActorUtil::LoadAllCommandsAndOnCommand( actor, m_sName ) -#define LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( actor ) ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( actor, m_sName ) - - -#endif - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ActorUtil_H +#define ActorUtil_H + +#include "Actor.h" +#include "RageTexture.h" + +class XNode; + +typedef Actor* (*CreateActorFn)(); + +template +Actor *CreateActor() { return new T; } + +/** + * @brief Register the requested Actor with the specified external name. + * + * This should be called manually only if needed. */ +#define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \ + struct Register##className { \ + Register##className() { ActorUtil::Register(#externalClassName, CreateActor); } \ + }; \ + className *className::Copy() const { return new className(*this); } \ + static Register##className register##className + +/** + * @brief Register the requested Actor so that it's more accessible. + * + * Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file. */ +#define REGISTER_ACTOR_CLASS( className ) REGISTER_ACTOR_CLASS_WITH_NAME( className, className ) + +enum FileType +{ + FT_Bitmap, + FT_Sound, + FT_Movie, + FT_Directory, + FT_Lua, + FT_Model, + NUM_FileType, + FileType_Invalid +}; +const RString& FileTypeToString( FileType ft ); + +/** @brief Utility functions for creating and manipulating Actors. */ +namespace ActorUtil +{ + // Every screen should register its class at program initialization. + void Register( const RString& sClassName, CreateActorFn pfn ); + + apActorCommands ParseActorCommands( const RString &sCommands, const RString &sName = "" ); + void SetXY( Actor& actor, const RString &sMetricsGroup ); + inline void PlayCommand( Actor& actor, const RString &sCommandName ) { actor.PlayCommand( sCommandName ); } + inline void OnCommand( Actor& actor ) + { + ASSERT_M( actor.HasCommand("On"), ssprintf("%s is missing an OnCommand.", actor.GetLineage().c_str()) ); + actor.PlayCommand("On"); + } + inline void OffCommand( Actor& actor ) + { + // HACK: It's very often that we command things to TweenOffScreen + // that we aren't drawing. We know that an Actor is not being + // used if its name is blank. So, do nothing on Actors with a blank name. + // (Do "playcommand" anyway; BGAs often have no name.) + if( actor.GetName().empty() ) + return; + ASSERT_M( actor.HasCommand("Off"), ssprintf("Actor %s is missing an OffCommand.", actor.GetLineage().c_str()) ); + actor.PlayCommand("Off"); + } + + void LoadCommand( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName ); + void LoadCommandFromName( Actor& actor, const RString &sMetricsGroup, const RString &sCommandName, const RString &sName ); + void LoadAllCommands( Actor& actor, const RString &sMetricsGroup ); + void LoadAllCommandsFromName( Actor& actor, const RString &sMetricsGroup, const RString &sName ); + + inline void LoadAllCommandsAndSetXY( Actor& actor, const RString &sMetricsGroup ) + { + LoadAllCommands( actor, sMetricsGroup ); + SetXY( actor, sMetricsGroup ); + } + inline void LoadAllCommandsAndOnCommand( Actor& actor, const RString &sMetricsGroup ) + { + LoadAllCommands( actor, sMetricsGroup ); + OnCommand( actor ); + } + inline void SetXYAndOnCommand( Actor& actor, const RString &sMetricsGroup ) + { + SetXY( actor, sMetricsGroup ); + OnCommand( actor ); + } + inline void LoadAllCommandsAndSetXYAndOnCommand( Actor& actor, const RString &sMetricsGroup ) + { + LoadAllCommands( actor, sMetricsGroup ); + SetXY( actor, sMetricsGroup ); + OnCommand( actor ); + } + + /* convenience */ + inline void SetXY( Actor* pActor, const RString &sMetricsGroup ) { SetXY( *pActor, sMetricsGroup ); } + inline void PlayCommand( Actor* pActor, const RString &sCommandName ) { if(pActor) pActor->PlayCommand( sCommandName ); } + inline void OnCommand( Actor* pActor ) { if(pActor) ActorUtil::OnCommand( *pActor ); } + inline void OffCommand( Actor* pActor ) { if(pActor) ActorUtil::OffCommand( *pActor ); } + + inline void LoadAllCommands( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommands( *pActor, sMetricsGroup ); } + + inline void LoadAllCommandsAndSetXY( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndSetXY( *pActor, sMetricsGroup ); } + inline void LoadAllCommandsAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndOnCommand( *pActor, sMetricsGroup ); } + inline void SetXYAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) SetXYAndOnCommand( *pActor, sMetricsGroup ); } + inline void LoadAllCommandsAndSetXYAndOnCommand( Actor* pActor, const RString &sMetricsGroup ) { if(pActor) LoadAllCommandsAndSetXYAndOnCommand( *pActor, sMetricsGroup ); } + + // Return a Sprite, BitmapText, or Model depending on the file type + Actor* LoadFromNode( const XNode* pNode, Actor *pParentActor = NULL ); + Actor* MakeActor( const RString &sPath, Actor *pParentActor = NULL ); + RString GetSourcePath( const XNode *pNode ); + RString GetWhere( const XNode *pNode ); + bool GetAttrPath( const XNode *pNode, const RString &sName, RString &sOut ); + bool LoadTableFromStackShowErrors( Lua *L ); + + bool ResolvePath( RString &sPath, const RString &sName ); + + void SortByZPosition( vector &vActors ); + + FileType GetFileType( const RString &sPath ); +}; + +#define SET_XY( actor ) ActorUtil::SetXY( actor, m_sName ) +#define ON_COMMAND( actor ) ActorUtil::OnCommand( actor ) +#define OFF_COMMAND( actor ) ActorUtil::OffCommand( actor ) +#define SET_XY_AND_ON_COMMAND( actor ) ActorUtil::SetXYAndOnCommand( actor, m_sName ) +#define COMMAND( actor, command_name ) ActorUtil::PlayCommand( actor, command_name ) +#define LOAD_ALL_COMMANDS( actor ) ActorUtil::LoadAllCommands( actor, m_sName ) +#define LOAD_ALL_COMMANDS_AND_SET_XY( actor ) ActorUtil::LoadAllCommandsAndSetXY( actor, m_sName ) +#define LOAD_ALL_COMMANDS_AND_ON_COMMAND( actor ) ActorUtil::LoadAllCommandsAndOnCommand( actor, m_sName ) +#define LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( actor ) ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( actor, m_sName ) + + +#endif + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AdjustSync.cpp b/src/AdjustSync.cpp index d422404472..e669f9cb74 100644 --- a/src/AdjustSync.cpp +++ b/src/AdjustSync.cpp @@ -1,388 +1,388 @@ -/* - * AdjustSync defines two methods for fixing the sync. - * - * The first method adjusts either the song or the machine by the - * average offset of the user's steps. In other words, if the user - * averages to step early by 10 ms, either the song or the global - * offset is adjusted by 10 ms to compensate for that. These - * adjustments only require a small set of data, so this method - * updates the offset while the song is playing. - * - * The second method adjusts both the offset and the tempo of an - * individual song. It records all of the steps during a play of - * the song and uses linear least squares regression to minimize the - * error of those steps. It makes one adjustment for the tempo of - * the entire song, rather than adding many different tempo segments - * to match the steps. If there are already several tempo segments - * in the stepfile, this method makes a proportional change to each - * of them. For example, if it changes 100 bpm to 101 bpm, it will - * also change 200 bpm to 202 bpm. This method also adjusts the stops. - * It assumes that a given stop is measured in terms of beats and makes - * the appropriate change. - * - * If we use this method on a small set of data late in the song, it - * can have very chaotic effects on the early settings. For example, - * it may change the offset by several hundred milliseconds and make a - * large change to the BPM to compensate if that would minimize the - * error. This problem occurs especially when the user makes a couple - * steps that are significantly off beat. The way to avoid this is to - * perform the least squares regression once on all of the data - * collected, rather than adjusting the sync every time we get another - * 50 or so data points. In fact, if we are playing in edit mode and - * the user loops through the song more than once, we use all of the - * steps made. - */ - -#include "global.h" -#include "Song.h" -#include "AdjustSync.h" -#include "GameState.h" -#include "LocalizedString.h" -#include "PrefsManager.h" -#include "ScreenManager.h" -#include "Foreach.h" - -TimingData *AdjustSync::s_pTimingDataOriginal = NULL; -float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0.0f; -int AdjustSync::s_iAutosyncOffsetSample = 0; -float AdjustSync::s_fAutosyncOffset[AdjustSync::OFFSET_SAMPLE_COUNT]; -float AdjustSync::s_fStandardDeviation = 0.0f; -vector< pair > AdjustSync::s_vAutosyncTempoData; -float AdjustSync::s_fAverageError = 0.0f; -const float AdjustSync::ERROR_TOO_HIGH = 0.025f; -int AdjustSync::s_iStepsFiltered = 0; - -void AdjustSync::ResetOriginalSyncData() -{ - if( s_pTimingDataOriginal == NULL ) - s_pTimingDataOriginal = new TimingData; - - if( GAMESTATE->m_pCurSong ) - *s_pTimingDataOriginal = GAMESTATE->m_pCurSong->m_Timing; - else - *s_pTimingDataOriginal = TimingData(); - s_fGlobalOffsetSecondsOriginal = PREFSMAN->m_fGlobalOffsetSeconds; - - ResetAutosync(); -} - -void AdjustSync::ResetAutosync() -{ - s_iAutosyncOffsetSample = 0; - s_vAutosyncTempoData.clear(); -} - -bool AdjustSync::IsSyncDataChanged() -{ - // Can't sync in course modes - if( GAMESTATE->IsCourseMode() ) - return false; - vector vs; - AdjustSync::GetSyncChangeTextGlobal( vs ); - AdjustSync::GetSyncChangeTextSong( vs ); - return !vs.empty(); -} - -void AdjustSync::SaveSyncChanges() -{ - if( GAMESTATE->IsCourseMode() ) - return; - if( GAMESTATE->m_pCurSong && *s_pTimingDataOriginal != GAMESTATE->m_pCurSong->m_Timing ) - { - if( GAMESTATE->IsEditing() ) - { - MESSAGEMAN->Broadcast( Message_SongModified ); - } - else - { - GAMESTATE->m_pCurSong->Save(); - } - } - if( s_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds ) - PREFSMAN->SavePrefsToDisk(); - ResetOriginalSyncData(); - s_fStandardDeviation = 0.0f; - s_fAverageError = 0.0f; -} - -void AdjustSync::RevertSyncChanges() -{ - if( GAMESTATE->IsCourseMode() ) - return; - PREFSMAN->m_fGlobalOffsetSeconds.Set( s_fGlobalOffsetSecondsOriginal ); - GAMESTATE->m_pCurSong->m_Timing = *s_pTimingDataOriginal; - ResetOriginalSyncData(); - s_fStandardDeviation = 0.0f; - s_fAverageError = 0.0f; -} - -static LocalizedString AUTOSYNC_CORRECTION_APPLIED ( "AdjustSync", "Autosync: Correction applied." ); -static LocalizedString AUTOSYNC_CORRECTION_NOT_APPLIED ( "AdjustSync", "Autosync: Correction NOT applied. Deviation too high." ); -static LocalizedString AUTOSYNC_SONG ( "AdjustSync", "Autosync Song" ); -static LocalizedString AUTOSYNC_MACHINE ( "AdjustSync", "Autosync Machine" ); -static LocalizedString AUTOSYNC_TEMPO ( "AdjustSync", "Autosync Tempo" ); -void AdjustSync::HandleAutosync( float fNoteOffBySeconds, float fStepTime ) -{ - if( GAMESTATE->IsCourseMode() ) - return; - switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) { - case SongOptions::AUTOSYNC_OFF: - return; - case SongOptions::AUTOSYNC_TEMPO: - { - // We collect all of the data and process it at the end - s_vAutosyncTempoData.push_back( make_pair(fStepTime, fNoteOffBySeconds) ); - break; - } - case SongOptions::AUTOSYNC_MACHINE: - case SongOptions::AUTOSYNC_SONG: - { - s_fAutosyncOffset[s_iAutosyncOffsetSample] = fNoteOffBySeconds; - ++s_iAutosyncOffsetSample; - - if( s_iAutosyncOffsetSample < OFFSET_SAMPLE_COUNT ) - break; // need more - - AutosyncOffset(); - break; - } - default: - ASSERT(0); - } -} - -void AdjustSync::HandleSongEnd() -{ - if( GAMESTATE->IsCourseMode() ) - return; - if( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType == SongOptions::AUTOSYNC_TEMPO ) - { - AutosyncTempo(); - } - - // all other states don't care -} - -void AdjustSync::AutosyncOffset() -{ - const float mean = calc_mean( s_fAutosyncOffset, s_fAutosyncOffset+OFFSET_SAMPLE_COUNT ); - const float stddev = calc_stddev( s_fAutosyncOffset, s_fAutosyncOffset+OFFSET_SAMPLE_COUNT ); - - RString sAutosyncType; - switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) - { - case SongOptions::AUTOSYNC_SONG: - sAutosyncType = AUTOSYNC_SONG; - break; - case SongOptions::AUTOSYNC_MACHINE: - sAutosyncType = AUTOSYNC_MACHINE; - break; - default: - ASSERT(0); - } - - if( stddev < .03f ) // If they stepped with less than .03 error - { - switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) - { - case SongOptions::AUTOSYNC_SONG: - GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean; - break; - case SongOptions::AUTOSYNC_MACHINE: - PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + mean ); - break; - default: - ASSERT(0); - } - - SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() ); - } - else - { - SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() ); - } - - s_iAutosyncOffsetSample = 0; - s_fStandardDeviation = stddev; -} - -void AdjustSync::AutosyncTempo() -{ - float fSlope = 0.0f; - float fIntercept = 0.0f; - if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, s_fAverageError ) ) - { - s_vAutosyncTempoData.clear(); - return; - } - - if( s_fAverageError < ERROR_TOO_HIGH ) - { - // Here we filter out any steps that are too far off. - // - // If it turns out that we want to be even more selective, we can - // keep only a fraction of the data, such as the 80% with the lowest - // error. However, throwing away the ones with high error should - // be enough in most cases. - float fFilteredError = 0.0; - s_iStepsFiltered = s_vAutosyncTempoData.size(); - FilterHighErrorPoints( s_vAutosyncTempoData, fSlope, fIntercept, ERROR_TOO_HIGH ); - s_iStepsFiltered -= s_vAutosyncTempoData.size(); - - if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, fFilteredError ) ) - return; - - GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += fIntercept; - const float fScaleBPM = 1.0f/(1.0f - fSlope); - FOREACH( BPMSegment, GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments, i ) - i->SetBPM( i->GetBPM() * fScaleBPM ); - - // We assume that the stops were measured as a number of beats. - // Therefore, if we change the bpms, we need to make a similar - // change to the stops. - FOREACH( StopSegment, GAMESTATE->m_pCurSong->m_Timing.m_StopSegments, i ) - i->m_fStopSeconds *= 1.0f - fSlope; - - SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() ); - } - else - { - // deviation... error... close enough for an error message - SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() ); - } - - s_vAutosyncTempoData.clear(); -} - - -static LocalizedString EARLIER ("AdjustSync","earlier"); -static LocalizedString LATER ("AdjustSync","later"); -static LocalizedString GLOBAL_OFFSET_FROM ( "AdjustSync", "Global Offset from %+.3f to %+.3f (notes %s)" ); -// We need to limit the length of lines so each one fits on one line of the SM console. -// The tempo and stop change message can get very long in a complicated song, and at -// a low resolution, the keep/revert menu would be pushed off the bottom of the screen -// if we didn't limit the length of the message. Keeping the lines short lets us fit -// more information on the screen. -static LocalizedString SONG_OFFSET_FROM ( "AdjustSync", "Song offset from %+.3f to %+.3f (notes %s)" ); -static LocalizedString TEMPO_SEGMENT_FROM ( "AdjustSync", "%s BPM from %.3f BPM to %.3f BPM." ); -static LocalizedString CHANGED_STOP ("AdjustSync","The stop segment #%d changed from %+.3fs to %+.3fs (change of %+.3f)."); -static LocalizedString ERROR ("AdjustSync", "Average Error %.5fs"); -static LocalizedString ETC ("AdjustSync", "Etc."); -static LocalizedString TAPS_IGNORED ("AdjustSync", "%d taps ignored."); - -void AdjustSync::GetSyncChangeTextGlobal( vector &vsAddTo ) -{ - { - float fOld = Quantize( AdjustSync::s_fGlobalOffsetSecondsOriginal, 0.001f ); - float fNew = Quantize( PREFSMAN->m_fGlobalOffsetSeconds, 0.001f ) ; - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.0001f ) - { - vsAddTo.push_back( ssprintf( - GLOBAL_OFFSET_FROM.GetValue(), - fOld, - fNew, - (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() ) ); - } - } -} - -void AdjustSync::GetSyncChangeTextSong( vector &vsAddTo ) -{ - if( GAMESTATE->m_pCurSong.Get() ) - { - unsigned int iOriginalSize = vsAddTo.size(); - - { - float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_fBeat0OffsetInSeconds, 0.001f ); - float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds, 0.001f ); - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.0001f ) - { - vsAddTo.push_back( ssprintf( - SONG_OFFSET_FROM.GetValue(), - fOld, - fNew, - (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() ) ); - } - } - - for( unsigned i=0; im_pCurSong->m_Timing.m_BPMSegments.size(); i++ ) - { - float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_BPMSegments[i].GetBPM(), 0.001f ); - float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].GetBPM(), 0.001f ); - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.0001f ) - { - if ( i >= 4 ) - { - vsAddTo.push_back(ETC.GetValue()); - break; - } - vsAddTo.push_back( ssprintf( - TEMPO_SEGMENT_FROM.GetValue(), - FormatNumberAndSuffix(i+1).c_str(), - fOld, - fNew ) ); - } - } - - for( unsigned i=0; im_pCurSong->m_Timing.m_StopSegments.size(); i++ ) - { - float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_StopSegments[i].m_fStopSeconds, 0.001f ); - float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_StopSegments[i].m_fStopSeconds, 0.001f ); - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.0001f ) - { - if ( i >= 4 ) - { - vsAddTo.push_back(ETC.GetValue()); - break; - } - vsAddTo.push_back( ssprintf( - CHANGED_STOP.GetValue(), - i+1, - fOld, - fNew ) ); - } - } - - if( vsAddTo.size() > iOriginalSize && s_fAverageError > 0.0f ) - { - vsAddTo.push_back( ssprintf(ERROR.GetValue(), s_fAverageError) ); - } - if( vsAddTo.size() > iOriginalSize && s_iStepsFiltered > 0 ) - { - vsAddTo.push_back( ssprintf(TAPS_IGNORED.GetValue(), s_iStepsFiltered) ); - } - } -} - -/* - * (c) 2003-2006 Chris Danford, John Bauer - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* + * AdjustSync defines two methods for fixing the sync. + * + * The first method adjusts either the song or the machine by the + * average offset of the user's steps. In other words, if the user + * averages to step early by 10 ms, either the song or the global + * offset is adjusted by 10 ms to compensate for that. These + * adjustments only require a small set of data, so this method + * updates the offset while the song is playing. + * + * The second method adjusts both the offset and the tempo of an + * individual song. It records all of the steps during a play of + * the song and uses linear least squares regression to minimize the + * error of those steps. It makes one adjustment for the tempo of + * the entire song, rather than adding many different tempo segments + * to match the steps. If there are already several tempo segments + * in the stepfile, this method makes a proportional change to each + * of them. For example, if it changes 100 bpm to 101 bpm, it will + * also change 200 bpm to 202 bpm. This method also adjusts the stops. + * It assumes that a given stop is measured in terms of beats and makes + * the appropriate change. + * + * If we use this method on a small set of data late in the song, it + * can have very chaotic effects on the early settings. For example, + * it may change the offset by several hundred milliseconds and make a + * large change to the BPM to compensate if that would minimize the + * error. This problem occurs especially when the user makes a couple + * steps that are significantly off beat. The way to avoid this is to + * perform the least squares regression once on all of the data + * collected, rather than adjusting the sync every time we get another + * 50 or so data points. In fact, if we are playing in edit mode and + * the user loops through the song more than once, we use all of the + * steps made. + */ + +#include "global.h" +#include "Song.h" +#include "AdjustSync.h" +#include "GameState.h" +#include "LocalizedString.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "Foreach.h" + +TimingData *AdjustSync::s_pTimingDataOriginal = NULL; +float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0.0f; +int AdjustSync::s_iAutosyncOffsetSample = 0; +float AdjustSync::s_fAutosyncOffset[AdjustSync::OFFSET_SAMPLE_COUNT]; +float AdjustSync::s_fStandardDeviation = 0.0f; +vector< pair > AdjustSync::s_vAutosyncTempoData; +float AdjustSync::s_fAverageError = 0.0f; +const float AdjustSync::ERROR_TOO_HIGH = 0.025f; +int AdjustSync::s_iStepsFiltered = 0; + +void AdjustSync::ResetOriginalSyncData() +{ + if( s_pTimingDataOriginal == NULL ) + s_pTimingDataOriginal = new TimingData; + + if( GAMESTATE->m_pCurSong ) + *s_pTimingDataOriginal = GAMESTATE->m_pCurSong->m_Timing; + else + *s_pTimingDataOriginal = TimingData(); + s_fGlobalOffsetSecondsOriginal = PREFSMAN->m_fGlobalOffsetSeconds; + + ResetAutosync(); +} + +void AdjustSync::ResetAutosync() +{ + s_iAutosyncOffsetSample = 0; + s_vAutosyncTempoData.clear(); +} + +bool AdjustSync::IsSyncDataChanged() +{ + // Can't sync in course modes + if( GAMESTATE->IsCourseMode() ) + return false; + vector vs; + AdjustSync::GetSyncChangeTextGlobal( vs ); + AdjustSync::GetSyncChangeTextSong( vs ); + return !vs.empty(); +} + +void AdjustSync::SaveSyncChanges() +{ + if( GAMESTATE->IsCourseMode() ) + return; + if( GAMESTATE->m_pCurSong && *s_pTimingDataOriginal != GAMESTATE->m_pCurSong->m_Timing ) + { + if( GAMESTATE->IsEditing() ) + { + MESSAGEMAN->Broadcast( Message_SongModified ); + } + else + { + GAMESTATE->m_pCurSong->Save(); + } + } + if( s_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds ) + PREFSMAN->SavePrefsToDisk(); + ResetOriginalSyncData(); + s_fStandardDeviation = 0.0f; + s_fAverageError = 0.0f; +} + +void AdjustSync::RevertSyncChanges() +{ + if( GAMESTATE->IsCourseMode() ) + return; + PREFSMAN->m_fGlobalOffsetSeconds.Set( s_fGlobalOffsetSecondsOriginal ); + GAMESTATE->m_pCurSong->m_Timing = *s_pTimingDataOriginal; + ResetOriginalSyncData(); + s_fStandardDeviation = 0.0f; + s_fAverageError = 0.0f; +} + +static LocalizedString AUTOSYNC_CORRECTION_APPLIED ( "AdjustSync", "Autosync: Correction applied." ); +static LocalizedString AUTOSYNC_CORRECTION_NOT_APPLIED ( "AdjustSync", "Autosync: Correction NOT applied. Deviation too high." ); +static LocalizedString AUTOSYNC_SONG ( "AdjustSync", "Autosync Song" ); +static LocalizedString AUTOSYNC_MACHINE ( "AdjustSync", "Autosync Machine" ); +static LocalizedString AUTOSYNC_TEMPO ( "AdjustSync", "Autosync Tempo" ); +void AdjustSync::HandleAutosync( float fNoteOffBySeconds, float fStepTime ) +{ + if( GAMESTATE->IsCourseMode() ) + return; + switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) { + case SongOptions::AUTOSYNC_OFF: + return; + case SongOptions::AUTOSYNC_TEMPO: + { + // We collect all of the data and process it at the end + s_vAutosyncTempoData.push_back( make_pair(fStepTime, fNoteOffBySeconds) ); + break; + } + case SongOptions::AUTOSYNC_MACHINE: + case SongOptions::AUTOSYNC_SONG: + { + s_fAutosyncOffset[s_iAutosyncOffsetSample] = fNoteOffBySeconds; + ++s_iAutosyncOffsetSample; + + if( s_iAutosyncOffsetSample < OFFSET_SAMPLE_COUNT ) + break; // need more + + AutosyncOffset(); + break; + } + default: + ASSERT(0); + } +} + +void AdjustSync::HandleSongEnd() +{ + if( GAMESTATE->IsCourseMode() ) + return; + if( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType == SongOptions::AUTOSYNC_TEMPO ) + { + AutosyncTempo(); + } + + // all other states don't care +} + +void AdjustSync::AutosyncOffset() +{ + const float mean = calc_mean( s_fAutosyncOffset, s_fAutosyncOffset+OFFSET_SAMPLE_COUNT ); + const float stddev = calc_stddev( s_fAutosyncOffset, s_fAutosyncOffset+OFFSET_SAMPLE_COUNT ); + + RString sAutosyncType; + switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) + { + case SongOptions::AUTOSYNC_SONG: + sAutosyncType = AUTOSYNC_SONG; + break; + case SongOptions::AUTOSYNC_MACHINE: + sAutosyncType = AUTOSYNC_MACHINE; + break; + default: + ASSERT(0); + } + + if( stddev < .03f ) // If they stepped with less than .03 error + { + switch( GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType ) + { + case SongOptions::AUTOSYNC_SONG: + GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean; + break; + case SongOptions::AUTOSYNC_MACHINE: + PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + mean ); + break; + default: + ASSERT(0); + } + + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() ); + } + else + { + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() ); + } + + s_iAutosyncOffsetSample = 0; + s_fStandardDeviation = stddev; +} + +void AdjustSync::AutosyncTempo() +{ + float fSlope = 0.0f; + float fIntercept = 0.0f; + if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, s_fAverageError ) ) + { + s_vAutosyncTempoData.clear(); + return; + } + + if( s_fAverageError < ERROR_TOO_HIGH ) + { + // Here we filter out any steps that are too far off. + // + // If it turns out that we want to be even more selective, we can + // keep only a fraction of the data, such as the 80% with the lowest + // error. However, throwing away the ones with high error should + // be enough in most cases. + float fFilteredError = 0.0; + s_iStepsFiltered = s_vAutosyncTempoData.size(); + FilterHighErrorPoints( s_vAutosyncTempoData, fSlope, fIntercept, ERROR_TOO_HIGH ); + s_iStepsFiltered -= s_vAutosyncTempoData.size(); + + if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, fFilteredError ) ) + return; + + GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += fIntercept; + const float fScaleBPM = 1.0f/(1.0f - fSlope); + FOREACH( BPMSegment, GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments, i ) + i->SetBPM( i->GetBPM() * fScaleBPM ); + + // We assume that the stops were measured as a number of beats. + // Therefore, if we change the bpms, we need to make a similar + // change to the stops. + FOREACH( StopSegment, GAMESTATE->m_pCurSong->m_Timing.m_StopSegments, i ) + i->m_fStopSeconds *= 1.0f - fSlope; + + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() ); + } + else + { + // deviation... error... close enough for an error message + SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() ); + } + + s_vAutosyncTempoData.clear(); +} + + +static LocalizedString EARLIER ("AdjustSync","earlier"); +static LocalizedString LATER ("AdjustSync","later"); +static LocalizedString GLOBAL_OFFSET_FROM ( "AdjustSync", "Global Offset from %+.3f to %+.3f (notes %s)" ); +// We need to limit the length of lines so each one fits on one line of the SM console. +// The tempo and stop change message can get very long in a complicated song, and at +// a low resolution, the keep/revert menu would be pushed off the bottom of the screen +// if we didn't limit the length of the message. Keeping the lines short lets us fit +// more information on the screen. +static LocalizedString SONG_OFFSET_FROM ( "AdjustSync", "Song offset from %+.3f to %+.3f (notes %s)" ); +static LocalizedString TEMPO_SEGMENT_FROM ( "AdjustSync", "%s BPM from %.3f BPM to %.3f BPM." ); +static LocalizedString CHANGED_STOP ("AdjustSync","The stop segment #%d changed from %+.3fs to %+.3fs (change of %+.3f)."); +static LocalizedString ERROR ("AdjustSync", "Average Error %.5fs"); +static LocalizedString ETC ("AdjustSync", "Etc."); +static LocalizedString TAPS_IGNORED ("AdjustSync", "%d taps ignored."); + +void AdjustSync::GetSyncChangeTextGlobal( vector &vsAddTo ) +{ + { + float fOld = Quantize( AdjustSync::s_fGlobalOffsetSecondsOriginal, 0.001f ); + float fNew = Quantize( PREFSMAN->m_fGlobalOffsetSeconds, 0.001f ) ; + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.0001f ) + { + vsAddTo.push_back( ssprintf( + GLOBAL_OFFSET_FROM.GetValue(), + fOld, + fNew, + (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() ) ); + } + } +} + +void AdjustSync::GetSyncChangeTextSong( vector &vsAddTo ) +{ + if( GAMESTATE->m_pCurSong.Get() ) + { + unsigned int iOriginalSize = vsAddTo.size(); + + { + float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_fBeat0OffsetInSeconds, 0.001f ); + float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds, 0.001f ); + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.0001f ) + { + vsAddTo.push_back( ssprintf( + SONG_OFFSET_FROM.GetValue(), + fOld, + fNew, + (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() ) ); + } + } + + for( unsigned i=0; im_pCurSong->m_Timing.m_BPMSegments.size(); i++ ) + { + float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_BPMSegments[i].GetBPM(), 0.001f ); + float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].GetBPM(), 0.001f ); + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.0001f ) + { + if ( i >= 4 ) + { + vsAddTo.push_back(ETC.GetValue()); + break; + } + vsAddTo.push_back( ssprintf( + TEMPO_SEGMENT_FROM.GetValue(), + FormatNumberAndSuffix(i+1).c_str(), + fOld, + fNew ) ); + } + } + + for( unsigned i=0; im_pCurSong->m_Timing.m_StopSegments.size(); i++ ) + { + float fOld = Quantize( AdjustSync::s_pTimingDataOriginal->m_StopSegments[i].m_fStopSeconds, 0.001f ); + float fNew = Quantize( GAMESTATE->m_pCurSong->m_Timing.m_StopSegments[i].m_fStopSeconds, 0.001f ); + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.0001f ) + { + if ( i >= 4 ) + { + vsAddTo.push_back(ETC.GetValue()); + break; + } + vsAddTo.push_back( ssprintf( + CHANGED_STOP.GetValue(), + i+1, + fOld, + fNew ) ); + } + } + + if( vsAddTo.size() > iOriginalSize && s_fAverageError > 0.0f ) + { + vsAddTo.push_back( ssprintf(ERROR.GetValue(), s_fAverageError) ); + } + if( vsAddTo.size() > iOriginalSize && s_iStepsFiltered > 0 ) + { + vsAddTo.push_back( ssprintf(TAPS_IGNORED.GetValue(), s_iStepsFiltered) ); + } + } +} + +/* + * (c) 2003-2006 Chris Danford, John Bauer + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AdjustSync.h b/src/AdjustSync.h index da7744517e..10a0810bd3 100644 --- a/src/AdjustSync.h +++ b/src/AdjustSync.h @@ -1,79 +1,79 @@ -#ifndef AdjustSync_H -#define AdjustSync_H - -class TimingData; -/** - * @brief Allows for adjusting the sync of a song. - * - * This class defines two ways of adjusting the sync of a song. - * The first adjusts only the offset, "on the fly". It can adjust either the - * song itself or the machine. The other style adjusts both the BPM and the - * offset of the song, but it needs more data. - */ -class AdjustSync -{ -public: - static TimingData *s_pTimingDataOriginal; - static float s_fGlobalOffsetSecondsOriginal; - /* We only want to call the Reset methods before a song, not immediately after - * a song. If we reset it at the end of a song, we have to carefully check - * the logic to make sure we never reset it before the user gets a chance to - * save or revert the change. Resetting at the start of the song is - * sufficient. */ - static void ResetOriginalSyncData(); - static void ResetAutosync(); - static bool IsSyncDataChanged(); - - static void SaveSyncChanges(); - static void RevertSyncChanges(); - static void HandleAutosync( float fNoteOffBySeconds, float fStepTime ); - static void HandleSongEnd(); - static void AutosyncOffset(); - static void AutosyncTempo(); - static void GetSyncChangeTextGlobal( vector &vsAddTo ); - static void GetSyncChangeTextSong( vector &vsAddTo ); - - /** @brief The minimum number of steps to hit for syncing purposes. */ - static const int OFFSET_SAMPLE_COUNT = 56; - - static float s_fAutosyncOffset[OFFSET_SAMPLE_COUNT]; - static int s_iAutosyncOffsetSample; - static float s_fStandardDeviation; - - // Measured in seconds. If the average error is too high, we - // reject the recorded data for the Least Squares Regression. - static const float ERROR_TOO_HIGH; - - static vector< pair > s_vAutosyncTempoData; - static float s_fAverageError; - static int s_iStepsFiltered; -}; - -#endif - -/** - * @file - * @author Chris Danford, John Bauer (c) 2003-2006 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef AdjustSync_H +#define AdjustSync_H + +class TimingData; +/** + * @brief Allows for adjusting the sync of a song. + * + * This class defines two ways of adjusting the sync of a song. + * The first adjusts only the offset, "on the fly". It can adjust either the + * song itself or the machine. The other style adjusts both the BPM and the + * offset of the song, but it needs more data. + */ +class AdjustSync +{ +public: + static TimingData *s_pTimingDataOriginal; + static float s_fGlobalOffsetSecondsOriginal; + /* We only want to call the Reset methods before a song, not immediately after + * a song. If we reset it at the end of a song, we have to carefully check + * the logic to make sure we never reset it before the user gets a chance to + * save or revert the change. Resetting at the start of the song is + * sufficient. */ + static void ResetOriginalSyncData(); + static void ResetAutosync(); + static bool IsSyncDataChanged(); + + static void SaveSyncChanges(); + static void RevertSyncChanges(); + static void HandleAutosync( float fNoteOffBySeconds, float fStepTime ); + static void HandleSongEnd(); + static void AutosyncOffset(); + static void AutosyncTempo(); + static void GetSyncChangeTextGlobal( vector &vsAddTo ); + static void GetSyncChangeTextSong( vector &vsAddTo ); + + /** @brief The minimum number of steps to hit for syncing purposes. */ + static const int OFFSET_SAMPLE_COUNT = 56; + + static float s_fAutosyncOffset[OFFSET_SAMPLE_COUNT]; + static int s_iAutosyncOffsetSample; + static float s_fStandardDeviation; + + // Measured in seconds. If the average error is too high, we + // reject the recorded data for the Least Squares Regression. + static const float ERROR_TOO_HIGH; + + static vector< pair > s_vAutosyncTempoData; + static float s_fAverageError; + static int s_iStepsFiltered; +}; + +#endif + +/** + * @file + * @author Chris Danford, John Bauer (c) 2003-2006 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AnnouncerManager.cpp b/src/AnnouncerManager.cpp index 50759c01dd..f64fcd624f 100644 --- a/src/AnnouncerManager.cpp +++ b/src/AnnouncerManager.cpp @@ -1,233 +1,233 @@ -#include "global.h" -#include "AnnouncerManager.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "RageFile.h" - -AnnouncerManager* ANNOUNCER = NULL; // global object accessable from anywhere in the program - - -const RString EMPTY_ANNOUNCER_NAME = "Empty"; -const RString ANNOUNCERS_DIR = "Announcers/"; - -AnnouncerManager::AnnouncerManager() -{ - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "ANNOUNCER" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } -} - -AnnouncerManager::~AnnouncerManager() -{ - // Unregister with Lua. - LUA->UnsetGlobal( "ANNOUNCER" ); -} - -void AnnouncerManager::GetAnnouncerNames( vector& AddTo ) -{ - GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true ); - - StripCvsAndSvn( AddTo ); - StripMacResourceForks( AddTo ); - - // strip out the empty announcer folder - for( int i=AddTo.size()-1; i>=0; i-- ) - if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) ) - AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 ); -} - -bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName ) -{ - if( sAnnouncerName == "" ) - return true; - - vector asAnnouncerNames; - GetAnnouncerNames( asAnnouncerNames ); - for( unsigned i=0; iTrace( "The announcer in '%s' is missing the folder '%s'.", - AnnouncerPath.c_str(), sFolderName.c_str() ); -// MessageBeep( MB_OK ); - RageFile temp; - temp.Open( AnnouncerPath+sFolderName + "/announcer files go here.txt", RageFile::WRITE ); -#endif - - return RString(); -} - -RString AnnouncerManager::GetPathTo( RString sFolderName ) -{ - return GetPathTo(m_sCurAnnouncerName, sFolderName); -} - -bool AnnouncerManager::HasSoundsFor( RString sFolderName ) -{ - return !DirectoryIsEmpty( GetPathTo(sFolderName) ); -} - -void AnnouncerManager::NextAnnouncer() -{ - vector as; - GetAnnouncerNames( as ); - if( as.size()==0 ) - return; - - if( m_sCurAnnouncerName == "" ) - SwitchAnnouncer( as[0] ); - else - { - unsigned i; - for( i=0; i -{ -public: - static int DoesAnnouncerExist( T* p, lua_State *L ) { lua_pushboolean(L, p->DoesAnnouncerExist( SArg(1) )); return 1; } - static int GetAnnouncerNames( T* p, lua_State *L ) - { - vector vAnnouncers; - p->GetAnnouncerNames( vAnnouncers ); - LuaHelpers::CreateTableFromArray(vAnnouncers, L); - return 1; - } - static int GetCurrentAnnouncer( T* p, lua_State *L ) - { - RString s = p->GetCurAnnouncerName(); - if( s.empty() ) - return 0; - lua_pushstring(L, s ); - return 1; - } - static int SetCurrentAnnouncer( T* p, lua_State *L ) - { - RString s = SArg(1); - // only bother switching if the announcer exists. -aj - if(p->DoesAnnouncerExist(s)) - p->SwitchAnnouncer(s); - return 0; - } - - LunaAnnouncerManager() - { - ADD_METHOD( DoesAnnouncerExist ); - ADD_METHOD( GetAnnouncerNames ); - ADD_METHOD( GetCurrentAnnouncer ); - ADD_METHOD( SetCurrentAnnouncer ); - } -}; - -LUA_REGISTER_CLASS( AnnouncerManager ) -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "AnnouncerManager.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "RageFile.h" + +AnnouncerManager* ANNOUNCER = NULL; // global object accessable from anywhere in the program + + +const RString EMPTY_ANNOUNCER_NAME = "Empty"; +const RString ANNOUNCERS_DIR = "Announcers/"; + +AnnouncerManager::AnnouncerManager() +{ + // Register with Lua. + { + Lua *L = LUA->Get(); + lua_pushstring( L, "ANNOUNCER" ); + this->PushSelf( L ); + lua_settable( L, LUA_GLOBALSINDEX ); + LUA->Release( L ); + } +} + +AnnouncerManager::~AnnouncerManager() +{ + // Unregister with Lua. + LUA->UnsetGlobal( "ANNOUNCER" ); +} + +void AnnouncerManager::GetAnnouncerNames( vector& AddTo ) +{ + GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true ); + + StripCvsAndSvn( AddTo ); + StripMacResourceForks( AddTo ); + + // strip out the empty announcer folder + for( int i=AddTo.size()-1; i>=0; i-- ) + if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) ) + AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 ); +} + +bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName ) +{ + if( sAnnouncerName == "" ) + return true; + + vector asAnnouncerNames; + GetAnnouncerNames( asAnnouncerNames ); + for( unsigned i=0; iTrace( "The announcer in '%s' is missing the folder '%s'.", + AnnouncerPath.c_str(), sFolderName.c_str() ); +// MessageBeep( MB_OK ); + RageFile temp; + temp.Open( AnnouncerPath+sFolderName + "/announcer files go here.txt", RageFile::WRITE ); +#endif + + return RString(); +} + +RString AnnouncerManager::GetPathTo( RString sFolderName ) +{ + return GetPathTo(m_sCurAnnouncerName, sFolderName); +} + +bool AnnouncerManager::HasSoundsFor( RString sFolderName ) +{ + return !DirectoryIsEmpty( GetPathTo(sFolderName) ); +} + +void AnnouncerManager::NextAnnouncer() +{ + vector as; + GetAnnouncerNames( as ); + if( as.size()==0 ) + return; + + if( m_sCurAnnouncerName == "" ) + SwitchAnnouncer( as[0] ); + else + { + unsigned i; + for( i=0; i +{ +public: + static int DoesAnnouncerExist( T* p, lua_State *L ) { lua_pushboolean(L, p->DoesAnnouncerExist( SArg(1) )); return 1; } + static int GetAnnouncerNames( T* p, lua_State *L ) + { + vector vAnnouncers; + p->GetAnnouncerNames( vAnnouncers ); + LuaHelpers::CreateTableFromArray(vAnnouncers, L); + return 1; + } + static int GetCurrentAnnouncer( T* p, lua_State *L ) + { + RString s = p->GetCurAnnouncerName(); + if( s.empty() ) + return 0; + lua_pushstring(L, s ); + return 1; + } + static int SetCurrentAnnouncer( T* p, lua_State *L ) + { + RString s = SArg(1); + // only bother switching if the announcer exists. -aj + if(p->DoesAnnouncerExist(s)) + p->SwitchAnnouncer(s); + return 0; + } + + LunaAnnouncerManager() + { + ADD_METHOD( DoesAnnouncerExist ); + ADD_METHOD( GetAnnouncerNames ); + ADD_METHOD( GetCurrentAnnouncer ); + ADD_METHOD( SetCurrentAnnouncer ); + } +}; + +LUA_REGISTER_CLASS( AnnouncerManager ) +// lua end + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AnnouncerManager.h b/src/AnnouncerManager.h index 6236b480fd..8d4e9f05c5 100644 --- a/src/AnnouncerManager.h +++ b/src/AnnouncerManager.h @@ -1,74 +1,74 @@ -#ifndef ANNOUNCER_MANAGER_H -#define ANNOUNCER_MANAGER_H - -#include "RageTypes.h" -/** @brief The commentators who say seemlingly random things during gameplay. */ -class AnnouncerManager -{ -public: - AnnouncerManager(); - ~AnnouncerManager(); - - /** - * @brief Retrieve the announcer names. - * @param AddTo the list of announcer names. */ - void GetAnnouncerNames( vector& AddTo ); - /** - * @brief Determine if the specified announcer exists. - * @param sAnnouncerName the announcer we're checking for. - * @return true if it exists, false otherwise. */ - bool DoesAnnouncerExist( RString sAnnouncerName ); - /** - * @brief Switch to a new specified announcer. - * @param sNewAnnouncerName the new announcer the Player will be listening to. */ - void SwitchAnnouncer( RString sNewAnnouncerName ); - /** - * @brief Retrieve the current announcer's name. - * @return the current announcer's name. */ - RString GetCurAnnouncerName() const { return m_sCurAnnouncerName; }; - void NextAnnouncer(); - - RString GetPathTo( RString sFolderName ); - bool HasSoundsFor( RString sFolderName ); - - // Lua - void PushSelf( lua_State *L ); - -protected: - static RString GetAnnouncerDirFromName( RString sAnnouncerName ); - RString GetPathTo( RString AnnouncerPath, RString sFolderName ); - /** @brief the current announcer's name. */ - RString m_sCurAnnouncerName; -}; - - -extern AnnouncerManager* ANNOUNCER; // global and accessable from anywhere in our program - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ANNOUNCER_MANAGER_H +#define ANNOUNCER_MANAGER_H + +#include "RageTypes.h" +/** @brief The commentators who say seemlingly random things during gameplay. */ +class AnnouncerManager +{ +public: + AnnouncerManager(); + ~AnnouncerManager(); + + /** + * @brief Retrieve the announcer names. + * @param AddTo the list of announcer names. */ + void GetAnnouncerNames( vector& AddTo ); + /** + * @brief Determine if the specified announcer exists. + * @param sAnnouncerName the announcer we're checking for. + * @return true if it exists, false otherwise. */ + bool DoesAnnouncerExist( RString sAnnouncerName ); + /** + * @brief Switch to a new specified announcer. + * @param sNewAnnouncerName the new announcer the Player will be listening to. */ + void SwitchAnnouncer( RString sNewAnnouncerName ); + /** + * @brief Retrieve the current announcer's name. + * @return the current announcer's name. */ + RString GetCurAnnouncerName() const { return m_sCurAnnouncerName; }; + void NextAnnouncer(); + + RString GetPathTo( RString sFolderName ); + bool HasSoundsFor( RString sFolderName ); + + // Lua + void PushSelf( lua_State *L ); + +protected: + static RString GetAnnouncerDirFromName( RString sAnnouncerName ); + RString GetPathTo( RString AnnouncerPath, RString sFolderName ); + /** @brief the current announcer's name. */ + RString m_sCurAnnouncerName; +}; + + +extern AnnouncerManager* ANNOUNCER; // global and accessable from anywhere in our program + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ArrowEffects.cpp b/src/ArrowEffects.cpp index 61c9dc0db5..7df7a37015 100644 --- a/src/ArrowEffects.cpp +++ b/src/ArrowEffects.cpp @@ -1,787 +1,787 @@ -#include "global.h" -#include "ArrowEffects.h" -#include "Steps.h" -#include "GameConstantsAndTypes.h" -#include "GameManager.h" -#include "RageTimer.h" -#include "NoteDisplay.h" -#include "Song.h" -#include "RageMath.h" -#include "ScreenDimensions.h" -#include "PlayerState.h" -#include "GameState.h" -#include "Style.h" -#include "ThemeMetric.h" -#include - -static ThemeMetric ARROW_SPACING( "ArrowEffects", "ArrowSpacing" ); -static ThemeMetric QUANTIZE_ARROW_Y( "ArrowEffects", "QuantizeArrowYPosition"); -static ThemeMetric HIDDEN_SUDDEN_PAST_RECEPTOR( "ArrowEffects", "DrawHiddenNotesAfterReceptor"); - -/* For better or for worse, allow the themes to modify the various mod - * effects for the different mods. In general, it is recommended to not - * edit the default values and instead use percentage mods when changes - * are wanted. Still, the option is available for those that want it. - * - * Is this a good idea? We'll find out. -aj & Wolfman2000 */ -static ThemeMetric BLINK_MOD_FREQUENCY( "ArrowEffects", "BlinkModFrequency" ); -static ThemeMetric BOOST_MOD_MIN_CLAMP( "ArrowEffects", "BoostModMinClamp" ); -static ThemeMetric BOOST_MOD_MAX_CLAMP( "ArrowEffects", "BoostModMaxClamp" ); -static ThemeMetric BRAKE_MOD_MIN_CLAMP( "ArrowEffects", "BrakeModMinClamp" ); -static ThemeMetric BRAKE_MOD_MAX_CLAMP( "ArrowEffects", "BrakeModMaxClamp" ); -static ThemeMetric WAVE_MOD_MAGNITUDE( "ArrowEffects", "WaveModMagnitude" ); -static ThemeMetric WAVE_MOD_HEIGHT( "ArrowEffects", "WaveModHeight" ); -static ThemeMetric BOOMERANG_PEAK_PERCENTAGE( "ArrowEffects", "BoomerangPeakPercentage" ); -static ThemeMetric EXPAND_MULTIPLIER_FREQUENCY( "ArrowEffects", "ExpandMultiplierFrequency" ); -static ThemeMetric EXPAND_MULTIPLIER_SCALE_FROM_LOW( "ArrowEffects", "ExpandMultiplierScaleFromLow" ); -static ThemeMetric EXPAND_MULTIPLIER_SCALE_FROM_HIGH( "ArrowEffects", "ExpandMultiplierScaleFromHigh" ); -static ThemeMetric EXPAND_MULTIPLIER_SCALE_TO_LOW( "ArrowEffects", "ExpandMultiplierScaleToLow" ); -static ThemeMetric EXPAND_MULTIPLIER_SCALE_TO_HIGH( "ArrowEffects", "ExpandMultiplierScaleToHigh" ); -static ThemeMetric EXPAND_SPEED_SCALE_FROM_LOW( "ArrowEffects", "ExpandSpeedScaleFromLow" ); -static ThemeMetric EXPAND_SPEED_SCALE_FROM_HIGH( "ArrowEffects", "ExpandSpeedScaleFromHigh" ); -static ThemeMetric EXPAND_SPEED_SCALE_TO_LOW( "ArrowEffects", "ExpandSpeedScaleToLow" ); -static ThemeMetric TIPSY_TIMER_FREQUENCY( "ArrowEffects", "TipsyTimerFrequency" ); -static ThemeMetric TIPSY_COLUMN_FREQUENCY( "ArrowEffects", "TipsyColumnFrequency" ); -static ThemeMetric TIPSY_ARROW_MAGNITUDE( "ArrowEffects", "TipsyArrowMagnitude" ); -static ThemeMetric TIPSY_OFFSET_TIMER_FREQUENCY( "ArrowEffects", "TipsyOffsetTimerFrequency" ); -static ThemeMetric TIPSY_OFFSET_COLUMN_FREQUENCY( "ArrowEffects", "TipsyOffsetColumnFrequency" ); -static ThemeMetric TIPSY_OFFSET_ARROW_MAGNITUDE( "ArrowEffects", "TipsyOffsetArrowMagnitude" ); -static ThemeMetric TORNADO_POSITION_SCALE_TO_LOW( "ArrowEffects", "TornadoPositionScaleToLow" ); -static ThemeMetric TORNADO_POSITION_SCALE_TO_HIGH( "ArrowEffects", "TornadoPositionScaleToHigh" ); -static ThemeMetric TORNADO_OFFSET_FREQUENCY( "ArrowEffects", "TornadoOffsetFrequency" ); -static ThemeMetric TORNADO_OFFSET_SCALE_FROM_LOW( "ArrowEffects", "TornadoOffsetScaleFromLow" ); -static ThemeMetric TORNADO_OFFSET_SCALE_FROM_HIGH( "ArrowEffects", "TornadoOffsetScaleFromHigh" ); -static ThemeMetric DRUNK_COLUMN_FREQUENCY( "ArrowEffects", "DrunkColumnFrequency" ); -static ThemeMetric DRUNK_OFFSET_FREQUENCY( "ArrowEffects", "DrunkOffsetFrequency" ); -static ThemeMetric DRUNK_ARROW_MAGNITUDE( "ArrowEffects", "DrunkArrowMagnitude" ); -static ThemeMetric BEAT_OFFSET_HEIGHT( "ArrowEffects", "BeatOffsetHeight" ); -static ThemeMetric BEAT_PI_HEIGHT( "ArrowEffects", "BeatPIHeight" ); -static ThemeMetric MINI_PERCENT_BASE( "ArrowEffects", "MiniPercentBase" ); -static ThemeMetric MINI_PERCENT_GATE( "ArrowEffects", "MiniPercentGate" ); -static ThemeMetric DIZZY_HOLD_HEADS( "ArrowEffects", "DizzyHoldHeads" ); - -static float GetNoteFieldHeight( const PlayerState* pPlayerState ) -{ - return SCREEN_HEIGHT + fabsf(pPlayerState->m_PlayerOptions.GetCurrent().m_fPerspectiveTilt)*200; -} - -namespace -{ - float g_fExpandSeconds = 0; - struct PerPlayerData - { - float m_fMinTornadoX[MAX_COLS_PER_PLAYER]; - float m_fMaxTornadoX[MAX_COLS_PER_PLAYER]; - float m_fInvertDistance[MAX_COLS_PER_PLAYER]; - float m_fBeatFactor; - }; - PerPlayerData g_EffectData[NUM_PLAYERS]; -}; - -void ArrowEffects::Update() -{ - const Style* pStyle = GAMESTATE->GetCurrentStyle(); - - { - static float fLastTime = 0; - float fTime = RageTimer::GetTimeSinceStartFast(); - if( !GAMESTATE->m_bFreeze || !GAMESTATE->m_bDelay ) - { - g_fExpandSeconds += fTime - fLastTime; - g_fExpandSeconds = fmodf( g_fExpandSeconds, PI*2 ); - } - fLastTime = fTime; - } - - FOREACH_PlayerNumber( pn ) - { - const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn]; - - PerPlayerData &data = g_EffectData[pn]; - // Update Tornado - for( int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum ) - { - // TRICKY: Tornado is very unplayable in doubles, so use a smaller - // tornado width if there are many columns - - /* the below makes an assumption for dance mode. - * perhaps check if we are actually playing on singles without, - * say more than 6 columns. That would exclude IIDX, pop'n, and - * techno-8, all of which would be very hectic. - * certain non-singles modes (like halfdoubles 6cols) - * could possibly have tornado enabled. - * let's also take default resolution (640x480) into mind. -aj */ - bool bWideField = pStyle->m_iColsPerPlayer > 4; - int iTornadoWidth = bWideField ? 2 : 3; - - int iStartCol = iColNum - iTornadoWidth; - int iEndCol = iColNum + iTornadoWidth; - CLAMP( iStartCol, 0, pStyle->m_iColsPerPlayer-1 ); - CLAMP( iEndCol, 0, pStyle->m_iColsPerPlayer-1 ); - - data.m_fMinTornadoX[iColNum] = FLT_MAX; - data.m_fMaxTornadoX[iColNum] = FLT_MIN; - - for( int i=iStartCol; i<=iEndCol; i++ ) - { - data.m_fMinTornadoX[iColNum] = min( data.m_fMinTornadoX[iColNum], pCols[i].fXOffset ); - data.m_fMaxTornadoX[iColNum] = max( data.m_fMaxTornadoX[iColNum], pCols[i].fXOffset ); - } - } - - // Update Invert - for( int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum ) - { - const int iNumCols = pStyle->m_iColsPerPlayer; - const int iNumSides = (pStyle->m_StyleType==StyleType_OnePlayerTwoSides || - pStyle->m_StyleType==StyleType_TwoPlayersSharedSides) ? 2 : 1; - const int iNumColsPerSide = iNumCols / iNumSides; - const int iSideIndex = iColNum / iNumColsPerSide; - const int iColOnSide = iColNum % iNumColsPerSide; - - const int iColLeftOfMiddle = (iNumColsPerSide-1)/2; - const int iColRightOfMiddle = (iNumColsPerSide+1)/2; - - int iFirstColOnSide = -1; - int iLastColOnSide = -1; - if( iColOnSide <= iColLeftOfMiddle ) - { - iFirstColOnSide = 0; - iLastColOnSide = iColLeftOfMiddle; - } - else if( iColOnSide >= iColRightOfMiddle ) - { - iFirstColOnSide = iColRightOfMiddle; - iLastColOnSide = iNumColsPerSide-1; - } - else - { - iFirstColOnSide = iColOnSide/2; - iLastColOnSide = iColOnSide/2; - } - - // mirror - int iNewColOnSide; - if( iFirstColOnSide == iLastColOnSide ) - iNewColOnSide = 0; - else - iNewColOnSide = SCALE( iColOnSide, iFirstColOnSide, iLastColOnSide, iLastColOnSide, iFirstColOnSide ); - const int iNewCol = iSideIndex*iNumColsPerSide + iNewColOnSide; - - const float fOldPixelOffset = pCols[iColNum].fXOffset; - const float fNewPixelOffset = pCols[iNewCol].fXOffset; - data.m_fInvertDistance[iColNum] = fNewPixelOffset - fOldPixelOffset; - } - - // Update Beat - do { - float fAccelTime = 0.2f, fTotalTime = 0.5f; - float fBeat = GAMESTATE->m_fSongBeatVisible + fAccelTime; - - const bool bEvenBeat = ( int(fBeat) % 2 ) != 0; - - data.m_fBeatFactor = 0; - if( fBeat < 0 ) - break; - - // -100.2 -> -0.2 -> 0.2 - fBeat -= truncf( fBeat ); - fBeat += 1; - fBeat -= truncf( fBeat ); - - if( fBeat >= fTotalTime ) - break; - - if( fBeat < fAccelTime ) - { - data.m_fBeatFactor = SCALE( fBeat, 0.0f, fAccelTime, 0.0f, 1.0f); - data.m_fBeatFactor *= data.m_fBeatFactor; - } else /* fBeat < fTotalTime */ { - data.m_fBeatFactor = SCALE( fBeat, fAccelTime, fTotalTime, 1.0f, 0.0f); - data.m_fBeatFactor = 1 - (1-data.m_fBeatFactor) * (1-data.m_fBeatFactor); - } - - if( bEvenBeat ) - data.m_fBeatFactor *= -1; - data.m_fBeatFactor *= 20.0f; - } while( false ); - } -} - -/* For visibility testing: if bAbsolute is false, random modifiers must return - * the minimum possible scroll speed. */ -float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, float &fPeakYOffsetOut, bool &bIsPastPeakOut, bool bAbsolute ) -{ - // Default values that are returned if boomerang is off. - fPeakYOffsetOut = FLT_MAX; - bIsPastPeakOut = true; - - float fYOffset = 0; - - /* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat spacing or - * entirely time spacing (respectively). Occasionally, we tween between them. */ - if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 1.0f ) - { - float fSongBeat = GAMESTATE->m_fSongBeatVisible; - float fBeatsUntilStep = fNoteBeat - fSongBeat; - float fYOffsetBeatSpacing = fBeatsUntilStep; - fYOffset += fYOffsetBeatSpacing * (1-pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing); - } - - if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 0.0f ) - { - float fSongSeconds = GAMESTATE->m_fMusicSecondsVisible; - float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat); - float fSecondsUntilStep = fNoteSeconds - fSongSeconds; - float fBPM = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollBPM; - float fBPS = fBPM/60.f; - float fYOffsetTimeSpacing = fSecondsUntilStep * fBPS; - fYOffset += fYOffsetTimeSpacing * pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing; - } - - // TODO: If we allow noteskins to have metricable row spacing - // (per issue 24), edit this to reflect that. -aj - fYOffset *= ARROW_SPACING; - - // don't mess with the arrows after they've crossed 0 - if( fYOffset < 0 ) - return fYOffset * pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; - - const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; - //const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - - float fYAdjust = 0; // fill this in depending on PlayerOptions - - if( fAccels[PlayerOptions::ACCEL_BOOST] != 0 ) - { - float fEffectHeight = GetNoteFieldHeight(pPlayerState); - float fNewYOffset = fYOffset * 1.5f / ((fYOffset+fEffectHeight/1.2f)/fEffectHeight); - float fAccelYAdjust = fAccels[PlayerOptions::ACCEL_BOOST] * (fNewYOffset - fYOffset); - // TRICKY: Clamp this value, or else BOOST+BOOMERANG will draw a ton of arrows on the screen. - CLAMP( fAccelYAdjust, BOOST_MOD_MIN_CLAMP, BOOST_MOD_MAX_CLAMP ); - fYAdjust += fAccelYAdjust; - } - if( fAccels[PlayerOptions::ACCEL_BRAKE] != 0 ) - { - float fEffectHeight = GetNoteFieldHeight(pPlayerState); - float fScale = SCALE( fYOffset, 0.f, fEffectHeight, 0, 1.f ); - float fNewYOffset = fYOffset * fScale; - float fBrakeYAdjust = fAccels[PlayerOptions::ACCEL_BRAKE] * (fNewYOffset - fYOffset); - // TRICKY: Clamp this value the same way as BOOST so that in BOOST+BRAKE, BRAKE doesn't overpower BOOST - CLAMP( fBrakeYAdjust, BRAKE_MOD_MIN_CLAMP, BRAKE_MOD_MAX_CLAMP ); - fYAdjust += fBrakeYAdjust; - } - if( fAccels[PlayerOptions::ACCEL_WAVE] != 0 ) - fYAdjust += fAccels[PlayerOptions::ACCEL_WAVE] * WAVE_MOD_MAGNITUDE *RageFastSin( fYOffset/WAVE_MOD_HEIGHT ); - - fYOffset += fYAdjust; - - // Factor in boomerang - if( fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0 ) - { - float fPeakAtYOffset = SCREEN_HEIGHT * BOOMERANG_PEAK_PERCENTAGE; // zero point of boomerang function - fPeakYOffsetOut = (-1*fPeakAtYOffset*fPeakAtYOffset/SCREEN_HEIGHT) + 1.5f*fPeakAtYOffset; - bIsPastPeakOut = fYOffset < fPeakAtYOffset; - - fYOffset = (-1*fYOffset*fYOffset/SCREEN_HEIGHT) + 1.5f*fYOffset; - } - - // Factor in scroll speed - float fScrollSpeed = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; - if( pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed > 0 && !bAbsolute ) - { - // Generate a deterministically "random" speed for each arrow. - unsigned seed = GAMESTATE->m_iStageSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); - - for( int i = 0; i < 3; ++i ) - seed = ((seed * 1664525u) + 1013904223u) & 0xFFFFFFFF; - float fRandom = seed / 4294967296.0f; - - /* Random speed always increases speed: a random speed of 10 indicates - * [1,11]. This keeps it consistent with other mods: 0 means no effect. */ - fScrollSpeed *= - SCALE( fRandom, - 0.0f, 1.0f, - 1.0f, pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed + 1.0f ); - } - - if( fAccels[PlayerOptions::ACCEL_EXPAND] != 0 ) - { - float fExpandMultiplier = SCALE( RageFastCos(g_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), - EXPAND_MULTIPLIER_SCALE_FROM_LOW, EXPAND_MULTIPLIER_SCALE_FROM_HIGH, - EXPAND_MULTIPLIER_SCALE_TO_LOW, EXPAND_MULTIPLIER_SCALE_TO_HIGH ); - fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND], - EXPAND_SPEED_SCALE_FROM_LOW, EXPAND_SPEED_SCALE_FROM_HIGH, - EXPAND_SPEED_SCALE_TO_LOW, fExpandMultiplier ); - } - - fYOffset *= fScrollSpeed; - fPeakYOffsetOut *= fScrollSpeed; - - return fYOffset; -} - -static void ArrowGetReverseShiftAndScale( const PlayerState* pPlayerState, int iCol, float fYReverseOffsetPixels, float &fShiftOut, float &fScaleOut ) -{ - // XXX: Hack: we need to scale the reverse shift by the zoom. - float fTinyPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_TINY]; - float fZoom = 1 - fTinyPercent*0.5f; - - // don't divide by 0 - if( fabsf(fZoom) < 0.01 ) - fZoom = 0.01f; - - float fPercentReverse = pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol); - fShiftOut = SCALE( fPercentReverse, 0.f, 1.f, -fYReverseOffsetPixels/fZoom/2, fYReverseOffsetPixels/fZoom/2 ); - float fPercentCentered = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED]; - fShiftOut = SCALE( fPercentCentered, 0.f, 1.f, fShiftOut, 0.0f ); - - fScaleOut = SCALE( fPercentReverse, 0.f, 1.f, 1.f, -1.f ); -} - -float ArrowEffects::GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse ) -{ - float f = fYOffset; - - if( WithReverse ) - { - float fShift, fScale; - ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale ); - - f *= fScale; - f += fShift; - } - - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - - if( fEffects[PlayerOptions::EFFECT_TIPSY] != 0 ) - f += fEffects[PlayerOptions::EFFECT_TIPSY] - * ( RageFastCos( RageTimer::GetTimeSinceStartFast()*TIPSY_TIMER_FREQUENCY - + iCol*TIPSY_COLUMN_FREQUENCY) * ARROW_SIZE*TIPSY_ARROW_MAGNITUDE ); - - // In beware's DDR Extreme-focused fork of StepMania 3.9, this value is - // floored, making arrows show on integer Y coordinates. Supposedly it makes - // the arrows look better, but testing needs to be done. - // todo: make this a noteskin metric instead of a theme metric? -aj - return QUANTIZE_ARROW_Y ? floor(f) : f; -} - -float ArrowEffects::GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels ) -{ - float f = YPos; - - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - if( fEffects[PlayerOptions::EFFECT_TIPSY] != 0 ) - f -= fEffects[PlayerOptions::EFFECT_TIPSY] - * ( RageFastCos( RageTimer::GetTimeSinceStartFast()*TIPSY_OFFSET_TIMER_FREQUENCY - + iCol*TIPSY_OFFSET_COLUMN_FREQUENCY) * ARROW_SIZE*TIPSY_OFFSET_ARROW_MAGNITUDE ); - - float fShift, fScale; - ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale ); - - f -= fShift; - if( fScale ) - f /= fScale; - - return f; -} - -float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float fYOffset ) -{ - float fPixelOffsetFromCenter = 0; // fill this in below - - const Style* pStyle = GAMESTATE->GetCurrentStyle(); - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - - // TODO: Don't index by PlayerNumber. - const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber]; - PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber]; - - if( fEffects[PlayerOptions::EFFECT_TORNADO] != 0 ) - { - const float fRealPixelOffset = pCols[iColNum].fXOffset; - const float fPositionBetween = SCALE( fRealPixelOffset, data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum], - TORNADO_POSITION_SCALE_TO_LOW, TORNADO_POSITION_SCALE_TO_HIGH ); - float fRads = acosf( fPositionBetween ); - fRads += fYOffset * TORNADO_OFFSET_FREQUENCY / SCREEN_HEIGHT; - - const float fAdjustedPixelOffset = SCALE( RageFastCos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, - data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum] ); - - fPixelOffsetFromCenter += (fAdjustedPixelOffset - fRealPixelOffset) * fEffects[PlayerOptions::EFFECT_TORNADO]; - } - - if( fEffects[PlayerOptions::EFFECT_DRUNK] != 0 ) - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * - ( RageFastCos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY - + fYOffset*DRUNK_OFFSET_FREQUENCY/SCREEN_HEIGHT) * ARROW_SIZE*DRUNK_ARROW_MAGNITUDE ); - if( fEffects[PlayerOptions::EFFECT_FLIP] != 0 ) - { - const int iFirstCol = 0; - const int iLastCol = pStyle->m_iColsPerPlayer-1; - const int iNewCol = SCALE( iColNum, iFirstCol, iLastCol, iLastCol, iFirstCol ); - const float fOldPixelOffset = pCols[iColNum].fXOffset; - const float fNewPixelOffset = pCols[iNewCol].fXOffset; - const float fDistance = fNewPixelOffset - fOldPixelOffset; - fPixelOffsetFromCenter += fDistance * fEffects[PlayerOptions::EFFECT_FLIP]; - } - if( fEffects[PlayerOptions::EFFECT_INVERT] != 0 ) - fPixelOffsetFromCenter += data.m_fInvertDistance[iColNum] * fEffects[PlayerOptions::EFFECT_INVERT]; - - if( fEffects[PlayerOptions::EFFECT_BEAT] != 0 ) - { - const float fShift = data.m_fBeatFactor*RageFastSin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_BEAT] * fShift; - } - - if( fEffects[PlayerOptions::EFFECT_XMODE] != 0 ) - { - // based off of code by v1toko for StepNXA, except it should work on - // any gametype now. - switch( pStyle->m_StyleType ) - { - case StyleType_OnePlayerTwoSides: - case StyleType_TwoPlayersSharedSides: // fall through? - { - // find the middle, and split based on iColNum - // it's unknown if this will work for routine. - const int iMiddleColumn = static_cast(floor(pStyle->m_iColsPerPlayer/2.0f)); - if( iColNum > iMiddleColumn-1 ) - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*-(fYOffset); - else - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*fYOffset; - } - break; - case StyleType_OnePlayerOneSide: - case StyleType_TwoPlayersTwoSides: // fall through - { - // the code was the same for both of these cases in StepNXA. - if( pPlayerState->m_PlayerNumber == PLAYER_2 ) - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*-(fYOffset); - else - fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*fYOffset; - } - break; - DEFAULT_FAIL(pStyle->m_StyleType); - } - } - - fPixelOffsetFromCenter += pCols[iColNum].fXOffset; - - if( fEffects[PlayerOptions::EFFECT_MINI] != 0 ) - { - // Allow Mini to pull tracks together, but not to push them apart. - float fMiniPercent = fEffects[PlayerOptions::EFFECT_MINI]; - fMiniPercent = min( powf(MINI_PERCENT_BASE, fMiniPercent), (float)MINI_PERCENT_GATE ); - fPixelOffsetFromCenter *= fMiniPercent; - } - - return fPixelOffsetFromCenter; -} - -float ArrowEffects::GetRotationX( const PlayerState *pPlayerState, float fYOffset ) -{ - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - float fRotation = 0; - if( fEffects[PlayerOptions::EFFECT_ROLL] != 0 ) - { - fRotation = fEffects[PlayerOptions::EFFECT_ROLL] * fYOffset/2; - } - return fRotation; -} - -float ArrowEffects::GetRotationY( const PlayerState *pPlayerState, float fYOffset ) -{ - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - float fRotation = 0; - if( fEffects[PlayerOptions::EFFECT_TWIRL] != 0 ) - { - fRotation = fEffects[PlayerOptions::EFFECT_TWIRL] * fYOffset/2; - } - return fRotation; -} - -float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead ) -{ - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - float fRotation = 0; - if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 ) - fRotation += ReceptorGetRotationZ( pPlayerState ); - - // As usual, enable dizzy hold heads at your own risk. -Wolfman2000 - if( fEffects[PlayerOptions::EFFECT_DIZZY] != 0 && ( DIZZY_HOLD_HEADS || !bIsHoldHead ) ) - { - const float fSongBeat = GAMESTATE->m_fSongBeatVisible; - float fDizzyRotation = fNoteBeat - fSongBeat; - fDizzyRotation *= fEffects[PlayerOptions::EFFECT_DIZZY]; - fDizzyRotation = fmodf( fDizzyRotation, 2*PI ); - fDizzyRotation *= 180/PI; - fRotation += fDizzyRotation; - } - return fRotation; -} - -float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState ) -{ - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - float fRotation = 0; - - if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 ) - { - float fConfRotation = GAMESTATE->m_fSongBeatVisible; - fConfRotation *= fEffects[PlayerOptions::EFFECT_CONFUSION]; - fConfRotation = fmodf( fConfRotation, 2*PI ); - fConfRotation *= -180/PI; - fRotation += fConfRotation; - } - return fRotation; -} - -#define CENTER_LINE_Y 160 // from fYOffset == 0 -#define FADE_DIST_Y 40 - -static float GetCenterLine( const PlayerState* pPlayerState ) -{ - /* Another mini hack: if EFFECT_MINI is on, then our center line is at - * eg. 320, not 160. */ - const float fMiniPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_TINY]; - const float fZoom = 1 - fMiniPercent*0.5f; - return CENTER_LINE_Y / fZoom; -} - -static float GetHiddenSudden( const PlayerState* pPlayerState ) -{ - const float* fAppearances = pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances; - return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * - fAppearances[PlayerOptions::APPEARANCE_SUDDEN]; -} - -// -// -gray arrows- -// -// ...invisible... -// -hidden end line- -// -hidden start line- -// ...visible... -// -sudden end line- -// -sudden start line- -// ...invisible... -// -// TRICKY: We fudge hidden and sudden to be farther apart if they're both on. -static float GetHiddenEndLine( const PlayerState* pPlayerState ) -{ - return GetCenterLine( pPlayerState ) + - FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -1.0f, -1.25f ) + - GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET]; -} - -static float GetHiddenStartLine( const PlayerState* pPlayerState ) -{ - return GetCenterLine( pPlayerState ) + - FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +0.0f, -0.25f ) + - GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET]; -} - -static float GetSuddenEndLine( const PlayerState* pPlayerState ) -{ - return GetCenterLine( pPlayerState ) + - FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -0.0f, +0.25f ) + - GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET]; -} - -static float GetSuddenStartLine( const PlayerState* pPlayerState ) -{ - return GetCenterLine( pPlayerState ) + - FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +1.0f, +1.25f ) + - GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET]; -} - -// used by ArrowGetAlpha and ArrowGetGlow below -float ArrowGetPercentVisible( const PlayerState* pPlayerState, float fYPosWithoutReverse ) -{ - const float fDistFromCenterLine = fYPosWithoutReverse - GetCenterLine( pPlayerState ); - - if( fYPosWithoutReverse < 0 && HIDDEN_SUDDEN_PAST_RECEPTOR) // past Gray Arrows - return 1; // totally visible - - const float* fAppearances = pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances; - - float fVisibleAdjust = 0; - - if( fAppearances[PlayerOptions::APPEARANCE_HIDDEN] != 0 ) - { - float fHiddenVisibleAdjust = SCALE( fYPosWithoutReverse, GetHiddenStartLine(pPlayerState), GetHiddenEndLine(pPlayerState), 0, -1 ); - CLAMP( fHiddenVisibleAdjust, -1, 0 ); - fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * fHiddenVisibleAdjust; - } - if( fAppearances[PlayerOptions::APPEARANCE_SUDDEN] != 0 ) - { - float fSuddenVisibleAdjust = SCALE( fYPosWithoutReverse, GetSuddenStartLine(pPlayerState), GetSuddenEndLine(pPlayerState), -1, 0 ); - CLAMP( fSuddenVisibleAdjust, -1, 0 ); - fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_SUDDEN] * fSuddenVisibleAdjust; - } - - if( fAppearances[PlayerOptions::APPEARANCE_STEALTH] != 0 ) - fVisibleAdjust -= fAppearances[PlayerOptions::APPEARANCE_STEALTH]; - if( fAppearances[PlayerOptions::APPEARANCE_BLINK] != 0 ) - { - float f = RageFastSin(RageTimer::GetTimeSinceStartFast()*10); - f = Quantize( f, BLINK_MOD_FREQUENCY ); - fVisibleAdjust += SCALE( f, 0, 1, -1, 0 ); - } - if( fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] != 0 ) - { - const float fRealFadeDist = 80; - fVisibleAdjust += SCALE( fabsf(fDistFromCenterLine), fRealFadeDist, 2*fRealFadeDist, -1, 0 ) - * fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]; - } - - return clamp( 1+fVisibleAdjust, 0, 1 ); -} - -float ArrowEffects::GetAlpha( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ) -{ - // Get the YPos without reverse (that is, factor in EFFECT_TIPSY). - float fYPosWithoutReverse = ArrowEffects::GetYPos( pPlayerState, iCol, fYOffset, fYReverseOffsetPixels, false ); - - float fPercentVisible = ArrowGetPercentVisible( pPlayerState, fYPosWithoutReverse ); - - if( fPercentFadeToFail != -1 ) - fPercentVisible = 1 - fPercentFadeToFail; - - - float fFullAlphaY = fDrawDistanceBeforeTargetsPixels*(1-fFadeInPercentOfDrawFar); - if( fYPosWithoutReverse > fFullAlphaY ) - { - float f = SCALE( fYPosWithoutReverse, fFullAlphaY, fDrawDistanceBeforeTargetsPixels, 1.0f, 0.0f ); - return f; - } - - - return (fPercentVisible>0.5f) ? 1.0f : 0.0f; -} - -float ArrowEffects::GetGlow( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ) -{ - // Get the YPos without reverse (that is, factor in EFFECT_TIPSY). - float fYPosWithoutReverse = ArrowEffects::GetYPos( pPlayerState, iCol, fYOffset, fYReverseOffsetPixels, false ); - - float fPercentVisible = ArrowGetPercentVisible( pPlayerState, fYPosWithoutReverse ); - - if( fPercentFadeToFail != -1 ) - fPercentVisible = 1 - fPercentFadeToFail; - - const float fDistFromHalf = fabsf( fPercentVisible - 0.5f ); - return SCALE( fDistFromHalf, 0, 0.5f, 1.3f, 0 ); -} - -float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteBeat ) -{ - if( GAMESTATE->IsEditing() ) - return 1; - - float fSongBeat = GAMESTATE->m_fSongBeatVisible; - float fBeatsUntilStep = fNoteBeat - fSongBeat; - - float fBrightness = SCALE( fBeatsUntilStep, 0, -1, 1.f, 0.f ); - CLAMP( fBrightness, 0, 1 ); - return fBrightness; -} - - -float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset ) -{ - float fZPos=0; - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - - if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ) - fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*RageFastSin( fYOffset/16.0f ); - - return fZPos; -} - -bool ArrowEffects::NeedZBuffer( const PlayerState* pPlayerState ) -{ - const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - // We also need to use the Z buffer if twirl is in play, because of - // hold modulation. -vyhd (OpenITG r623) - if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 || - fEffects[PlayerOptions::EFFECT_TWIRL] != 0 ) - return true; - - return false; -} - -float ArrowEffects::GetZoom( const PlayerState* pPlayerState ) -{ - float fZoom = 1.0f; - // FIXME: Move the zoom values into Style - if( GAMESTATE->GetCurrentStyle()->m_bNeedsZoomOutWith2Players && - (GAMESTATE->GetNumSidesJoined()==2 || GAMESTATE->AnyPlayersAreCpu()) ) - fZoom *= 0.6f; - - float fMiniPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_MINI]; - if( fMiniPercent != 0 ) - { - fMiniPercent = powf( 0.5f, fMiniPercent ); - fZoom *= fMiniPercent; - } - return fZoom; -} - -static ThemeMetric FRAME_WIDTH_EFFECTS_PIXELS_PER_SECOND( "ArrowEffects", "FrameWidthEffectsPixelsPerSecond" ); -static ThemeMetric FRAME_WIDTH_EFFECTS_MIN_MULTIPLIER( "ArrowEffects", "FrameWidthEffectsMinMultiplier" ); -static ThemeMetric FRAME_WIDTH_EFFECTS_MAX_MULTIPLIER( "ArrowEffects", "FrameWidthEffectsMaxMultiplier" ); -static ThemeMetric FRAME_WIDTH_LOCK_EFFECTS_TO_OVERLAPPING( "ArrowEffects", "FrameWidthLockEffectsToOverlapping" ); -static ThemeMetric FRAME_WIDTH_LOCK_EFFECTS_TWEEN_PIXELS( "ArrowEffects", "FrameWidthLockEffectsTweenPixels" ); - -float ArrowEffects::GetFrameWidthScale( const PlayerState* pPlayerState, float fYOffset, float fOverlappedTime ) -{ - float fFrameWidthMultiplier = 1.0f; - - float fPixelsPerSecond = FRAME_WIDTH_EFFECTS_PIXELS_PER_SECOND; - float fSecond = fYOffset / fPixelsPerSecond; - float fWidthEffect = pPlayerState->m_EffectHistory.GetSample( fSecond ); - if( fWidthEffect != 0 && FRAME_WIDTH_LOCK_EFFECTS_TO_OVERLAPPING ) - { - // Don't display effect data that happened before this hold overlapped the top. - float fFromEndOfOverlapped = fOverlappedTime - fSecond; - float fTrailingPixels = FRAME_WIDTH_LOCK_EFFECTS_TWEEN_PIXELS; - float fTrailingSeconds = fTrailingPixels / fPixelsPerSecond; - float fScaleEffect = SCALE( fFromEndOfOverlapped, 0.0f, fTrailingSeconds, 0.0f, 1.0f ); - CLAMP( fScaleEffect, 0.0f, 1.0f ); - fWidthEffect *= fScaleEffect; - } - - if( fWidthEffect > 0 ) - fFrameWidthMultiplier *= SCALE( fWidthEffect, 0.0f, 1.0f, 1.0f, FRAME_WIDTH_EFFECTS_MAX_MULTIPLIER ); - else if( fWidthEffect < 0 ) - fFrameWidthMultiplier *= SCALE( fWidthEffect, 0.0f, -1.0f, 1.0f, FRAME_WIDTH_EFFECTS_MIN_MULTIPLIER ); - - return fFrameWidthMultiplier; -} - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ArrowEffects.h" +#include "Steps.h" +#include "GameConstantsAndTypes.h" +#include "GameManager.h" +#include "RageTimer.h" +#include "NoteDisplay.h" +#include "Song.h" +#include "RageMath.h" +#include "ScreenDimensions.h" +#include "PlayerState.h" +#include "GameState.h" +#include "Style.h" +#include "ThemeMetric.h" +#include + +static ThemeMetric ARROW_SPACING( "ArrowEffects", "ArrowSpacing" ); +static ThemeMetric QUANTIZE_ARROW_Y( "ArrowEffects", "QuantizeArrowYPosition"); +static ThemeMetric HIDDEN_SUDDEN_PAST_RECEPTOR( "ArrowEffects", "DrawHiddenNotesAfterReceptor"); + +/* For better or for worse, allow the themes to modify the various mod + * effects for the different mods. In general, it is recommended to not + * edit the default values and instead use percentage mods when changes + * are wanted. Still, the option is available for those that want it. + * + * Is this a good idea? We'll find out. -aj & Wolfman2000 */ +static ThemeMetric BLINK_MOD_FREQUENCY( "ArrowEffects", "BlinkModFrequency" ); +static ThemeMetric BOOST_MOD_MIN_CLAMP( "ArrowEffects", "BoostModMinClamp" ); +static ThemeMetric BOOST_MOD_MAX_CLAMP( "ArrowEffects", "BoostModMaxClamp" ); +static ThemeMetric BRAKE_MOD_MIN_CLAMP( "ArrowEffects", "BrakeModMinClamp" ); +static ThemeMetric BRAKE_MOD_MAX_CLAMP( "ArrowEffects", "BrakeModMaxClamp" ); +static ThemeMetric WAVE_MOD_MAGNITUDE( "ArrowEffects", "WaveModMagnitude" ); +static ThemeMetric WAVE_MOD_HEIGHT( "ArrowEffects", "WaveModHeight" ); +static ThemeMetric BOOMERANG_PEAK_PERCENTAGE( "ArrowEffects", "BoomerangPeakPercentage" ); +static ThemeMetric EXPAND_MULTIPLIER_FREQUENCY( "ArrowEffects", "ExpandMultiplierFrequency" ); +static ThemeMetric EXPAND_MULTIPLIER_SCALE_FROM_LOW( "ArrowEffects", "ExpandMultiplierScaleFromLow" ); +static ThemeMetric EXPAND_MULTIPLIER_SCALE_FROM_HIGH( "ArrowEffects", "ExpandMultiplierScaleFromHigh" ); +static ThemeMetric EXPAND_MULTIPLIER_SCALE_TO_LOW( "ArrowEffects", "ExpandMultiplierScaleToLow" ); +static ThemeMetric EXPAND_MULTIPLIER_SCALE_TO_HIGH( "ArrowEffects", "ExpandMultiplierScaleToHigh" ); +static ThemeMetric EXPAND_SPEED_SCALE_FROM_LOW( "ArrowEffects", "ExpandSpeedScaleFromLow" ); +static ThemeMetric EXPAND_SPEED_SCALE_FROM_HIGH( "ArrowEffects", "ExpandSpeedScaleFromHigh" ); +static ThemeMetric EXPAND_SPEED_SCALE_TO_LOW( "ArrowEffects", "ExpandSpeedScaleToLow" ); +static ThemeMetric TIPSY_TIMER_FREQUENCY( "ArrowEffects", "TipsyTimerFrequency" ); +static ThemeMetric TIPSY_COLUMN_FREQUENCY( "ArrowEffects", "TipsyColumnFrequency" ); +static ThemeMetric TIPSY_ARROW_MAGNITUDE( "ArrowEffects", "TipsyArrowMagnitude" ); +static ThemeMetric TIPSY_OFFSET_TIMER_FREQUENCY( "ArrowEffects", "TipsyOffsetTimerFrequency" ); +static ThemeMetric TIPSY_OFFSET_COLUMN_FREQUENCY( "ArrowEffects", "TipsyOffsetColumnFrequency" ); +static ThemeMetric TIPSY_OFFSET_ARROW_MAGNITUDE( "ArrowEffects", "TipsyOffsetArrowMagnitude" ); +static ThemeMetric TORNADO_POSITION_SCALE_TO_LOW( "ArrowEffects", "TornadoPositionScaleToLow" ); +static ThemeMetric TORNADO_POSITION_SCALE_TO_HIGH( "ArrowEffects", "TornadoPositionScaleToHigh" ); +static ThemeMetric TORNADO_OFFSET_FREQUENCY( "ArrowEffects", "TornadoOffsetFrequency" ); +static ThemeMetric TORNADO_OFFSET_SCALE_FROM_LOW( "ArrowEffects", "TornadoOffsetScaleFromLow" ); +static ThemeMetric TORNADO_OFFSET_SCALE_FROM_HIGH( "ArrowEffects", "TornadoOffsetScaleFromHigh" ); +static ThemeMetric DRUNK_COLUMN_FREQUENCY( "ArrowEffects", "DrunkColumnFrequency" ); +static ThemeMetric DRUNK_OFFSET_FREQUENCY( "ArrowEffects", "DrunkOffsetFrequency" ); +static ThemeMetric DRUNK_ARROW_MAGNITUDE( "ArrowEffects", "DrunkArrowMagnitude" ); +static ThemeMetric BEAT_OFFSET_HEIGHT( "ArrowEffects", "BeatOffsetHeight" ); +static ThemeMetric BEAT_PI_HEIGHT( "ArrowEffects", "BeatPIHeight" ); +static ThemeMetric MINI_PERCENT_BASE( "ArrowEffects", "MiniPercentBase" ); +static ThemeMetric MINI_PERCENT_GATE( "ArrowEffects", "MiniPercentGate" ); +static ThemeMetric DIZZY_HOLD_HEADS( "ArrowEffects", "DizzyHoldHeads" ); + +static float GetNoteFieldHeight( const PlayerState* pPlayerState ) +{ + return SCREEN_HEIGHT + fabsf(pPlayerState->m_PlayerOptions.GetCurrent().m_fPerspectiveTilt)*200; +} + +namespace +{ + float g_fExpandSeconds = 0; + struct PerPlayerData + { + float m_fMinTornadoX[MAX_COLS_PER_PLAYER]; + float m_fMaxTornadoX[MAX_COLS_PER_PLAYER]; + float m_fInvertDistance[MAX_COLS_PER_PLAYER]; + float m_fBeatFactor; + }; + PerPlayerData g_EffectData[NUM_PLAYERS]; +}; + +void ArrowEffects::Update() +{ + const Style* pStyle = GAMESTATE->GetCurrentStyle(); + + { + static float fLastTime = 0; + float fTime = RageTimer::GetTimeSinceStartFast(); + if( !GAMESTATE->m_bFreeze || !GAMESTATE->m_bDelay ) + { + g_fExpandSeconds += fTime - fLastTime; + g_fExpandSeconds = fmodf( g_fExpandSeconds, PI*2 ); + } + fLastTime = fTime; + } + + FOREACH_PlayerNumber( pn ) + { + const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn]; + + PerPlayerData &data = g_EffectData[pn]; + // Update Tornado + for( int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum ) + { + // TRICKY: Tornado is very unplayable in doubles, so use a smaller + // tornado width if there are many columns + + /* the below makes an assumption for dance mode. + * perhaps check if we are actually playing on singles without, + * say more than 6 columns. That would exclude IIDX, pop'n, and + * techno-8, all of which would be very hectic. + * certain non-singles modes (like halfdoubles 6cols) + * could possibly have tornado enabled. + * let's also take default resolution (640x480) into mind. -aj */ + bool bWideField = pStyle->m_iColsPerPlayer > 4; + int iTornadoWidth = bWideField ? 2 : 3; + + int iStartCol = iColNum - iTornadoWidth; + int iEndCol = iColNum + iTornadoWidth; + CLAMP( iStartCol, 0, pStyle->m_iColsPerPlayer-1 ); + CLAMP( iEndCol, 0, pStyle->m_iColsPerPlayer-1 ); + + data.m_fMinTornadoX[iColNum] = FLT_MAX; + data.m_fMaxTornadoX[iColNum] = FLT_MIN; + + for( int i=iStartCol; i<=iEndCol; i++ ) + { + data.m_fMinTornadoX[iColNum] = min( data.m_fMinTornadoX[iColNum], pCols[i].fXOffset ); + data.m_fMaxTornadoX[iColNum] = max( data.m_fMaxTornadoX[iColNum], pCols[i].fXOffset ); + } + } + + // Update Invert + for( int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum ) + { + const int iNumCols = pStyle->m_iColsPerPlayer; + const int iNumSides = (pStyle->m_StyleType==StyleType_OnePlayerTwoSides || + pStyle->m_StyleType==StyleType_TwoPlayersSharedSides) ? 2 : 1; + const int iNumColsPerSide = iNumCols / iNumSides; + const int iSideIndex = iColNum / iNumColsPerSide; + const int iColOnSide = iColNum % iNumColsPerSide; + + const int iColLeftOfMiddle = (iNumColsPerSide-1)/2; + const int iColRightOfMiddle = (iNumColsPerSide+1)/2; + + int iFirstColOnSide = -1; + int iLastColOnSide = -1; + if( iColOnSide <= iColLeftOfMiddle ) + { + iFirstColOnSide = 0; + iLastColOnSide = iColLeftOfMiddle; + } + else if( iColOnSide >= iColRightOfMiddle ) + { + iFirstColOnSide = iColRightOfMiddle; + iLastColOnSide = iNumColsPerSide-1; + } + else + { + iFirstColOnSide = iColOnSide/2; + iLastColOnSide = iColOnSide/2; + } + + // mirror + int iNewColOnSide; + if( iFirstColOnSide == iLastColOnSide ) + iNewColOnSide = 0; + else + iNewColOnSide = SCALE( iColOnSide, iFirstColOnSide, iLastColOnSide, iLastColOnSide, iFirstColOnSide ); + const int iNewCol = iSideIndex*iNumColsPerSide + iNewColOnSide; + + const float fOldPixelOffset = pCols[iColNum].fXOffset; + const float fNewPixelOffset = pCols[iNewCol].fXOffset; + data.m_fInvertDistance[iColNum] = fNewPixelOffset - fOldPixelOffset; + } + + // Update Beat + do { + float fAccelTime = 0.2f, fTotalTime = 0.5f; + float fBeat = GAMESTATE->m_fSongBeatVisible + fAccelTime; + + const bool bEvenBeat = ( int(fBeat) % 2 ) != 0; + + data.m_fBeatFactor = 0; + if( fBeat < 0 ) + break; + + // -100.2 -> -0.2 -> 0.2 + fBeat -= truncf( fBeat ); + fBeat += 1; + fBeat -= truncf( fBeat ); + + if( fBeat >= fTotalTime ) + break; + + if( fBeat < fAccelTime ) + { + data.m_fBeatFactor = SCALE( fBeat, 0.0f, fAccelTime, 0.0f, 1.0f); + data.m_fBeatFactor *= data.m_fBeatFactor; + } else /* fBeat < fTotalTime */ { + data.m_fBeatFactor = SCALE( fBeat, fAccelTime, fTotalTime, 1.0f, 0.0f); + data.m_fBeatFactor = 1 - (1-data.m_fBeatFactor) * (1-data.m_fBeatFactor); + } + + if( bEvenBeat ) + data.m_fBeatFactor *= -1; + data.m_fBeatFactor *= 20.0f; + } while( false ); + } +} + +/* For visibility testing: if bAbsolute is false, random modifiers must return + * the minimum possible scroll speed. */ +float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, float &fPeakYOffsetOut, bool &bIsPastPeakOut, bool bAbsolute ) +{ + // Default values that are returned if boomerang is off. + fPeakYOffsetOut = FLT_MAX; + bIsPastPeakOut = true; + + float fYOffset = 0; + + /* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat spacing or + * entirely time spacing (respectively). Occasionally, we tween between them. */ + if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 1.0f ) + { + float fSongBeat = GAMESTATE->m_fSongBeatVisible; + float fBeatsUntilStep = fNoteBeat - fSongBeat; + float fYOffsetBeatSpacing = fBeatsUntilStep; + fYOffset += fYOffsetBeatSpacing * (1-pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing); + } + + if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 0.0f ) + { + float fSongSeconds = GAMESTATE->m_fMusicSecondsVisible; + float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat); + float fSecondsUntilStep = fNoteSeconds - fSongSeconds; + float fBPM = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollBPM; + float fBPS = fBPM/60.f; + float fYOffsetTimeSpacing = fSecondsUntilStep * fBPS; + fYOffset += fYOffsetTimeSpacing * pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing; + } + + // TODO: If we allow noteskins to have metricable row spacing + // (per issue 24), edit this to reflect that. -aj + fYOffset *= ARROW_SPACING; + + // don't mess with the arrows after they've crossed 0 + if( fYOffset < 0 ) + return fYOffset * pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; + + const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; + //const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + + float fYAdjust = 0; // fill this in depending on PlayerOptions + + if( fAccels[PlayerOptions::ACCEL_BOOST] != 0 ) + { + float fEffectHeight = GetNoteFieldHeight(pPlayerState); + float fNewYOffset = fYOffset * 1.5f / ((fYOffset+fEffectHeight/1.2f)/fEffectHeight); + float fAccelYAdjust = fAccels[PlayerOptions::ACCEL_BOOST] * (fNewYOffset - fYOffset); + // TRICKY: Clamp this value, or else BOOST+BOOMERANG will draw a ton of arrows on the screen. + CLAMP( fAccelYAdjust, BOOST_MOD_MIN_CLAMP, BOOST_MOD_MAX_CLAMP ); + fYAdjust += fAccelYAdjust; + } + if( fAccels[PlayerOptions::ACCEL_BRAKE] != 0 ) + { + float fEffectHeight = GetNoteFieldHeight(pPlayerState); + float fScale = SCALE( fYOffset, 0.f, fEffectHeight, 0, 1.f ); + float fNewYOffset = fYOffset * fScale; + float fBrakeYAdjust = fAccels[PlayerOptions::ACCEL_BRAKE] * (fNewYOffset - fYOffset); + // TRICKY: Clamp this value the same way as BOOST so that in BOOST+BRAKE, BRAKE doesn't overpower BOOST + CLAMP( fBrakeYAdjust, BRAKE_MOD_MIN_CLAMP, BRAKE_MOD_MAX_CLAMP ); + fYAdjust += fBrakeYAdjust; + } + if( fAccels[PlayerOptions::ACCEL_WAVE] != 0 ) + fYAdjust += fAccels[PlayerOptions::ACCEL_WAVE] * WAVE_MOD_MAGNITUDE *RageFastSin( fYOffset/WAVE_MOD_HEIGHT ); + + fYOffset += fYAdjust; + + // Factor in boomerang + if( fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0 ) + { + float fPeakAtYOffset = SCREEN_HEIGHT * BOOMERANG_PEAK_PERCENTAGE; // zero point of boomerang function + fPeakYOffsetOut = (-1*fPeakAtYOffset*fPeakAtYOffset/SCREEN_HEIGHT) + 1.5f*fPeakAtYOffset; + bIsPastPeakOut = fYOffset < fPeakAtYOffset; + + fYOffset = (-1*fYOffset*fYOffset/SCREEN_HEIGHT) + 1.5f*fYOffset; + } + + // Factor in scroll speed + float fScrollSpeed = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; + if( pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed > 0 && !bAbsolute ) + { + // Generate a deterministically "random" speed for each arrow. + unsigned seed = GAMESTATE->m_iStageSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); + + for( int i = 0; i < 3; ++i ) + seed = ((seed * 1664525u) + 1013904223u) & 0xFFFFFFFF; + float fRandom = seed / 4294967296.0f; + + /* Random speed always increases speed: a random speed of 10 indicates + * [1,11]. This keeps it consistent with other mods: 0 means no effect. */ + fScrollSpeed *= + SCALE( fRandom, + 0.0f, 1.0f, + 1.0f, pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed + 1.0f ); + } + + if( fAccels[PlayerOptions::ACCEL_EXPAND] != 0 ) + { + float fExpandMultiplier = SCALE( RageFastCos(g_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), + EXPAND_MULTIPLIER_SCALE_FROM_LOW, EXPAND_MULTIPLIER_SCALE_FROM_HIGH, + EXPAND_MULTIPLIER_SCALE_TO_LOW, EXPAND_MULTIPLIER_SCALE_TO_HIGH ); + fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND], + EXPAND_SPEED_SCALE_FROM_LOW, EXPAND_SPEED_SCALE_FROM_HIGH, + EXPAND_SPEED_SCALE_TO_LOW, fExpandMultiplier ); + } + + fYOffset *= fScrollSpeed; + fPeakYOffsetOut *= fScrollSpeed; + + return fYOffset; +} + +static void ArrowGetReverseShiftAndScale( const PlayerState* pPlayerState, int iCol, float fYReverseOffsetPixels, float &fShiftOut, float &fScaleOut ) +{ + // XXX: Hack: we need to scale the reverse shift by the zoom. + float fTinyPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_TINY]; + float fZoom = 1 - fTinyPercent*0.5f; + + // don't divide by 0 + if( fabsf(fZoom) < 0.01 ) + fZoom = 0.01f; + + float fPercentReverse = pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol); + fShiftOut = SCALE( fPercentReverse, 0.f, 1.f, -fYReverseOffsetPixels/fZoom/2, fYReverseOffsetPixels/fZoom/2 ); + float fPercentCentered = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED]; + fShiftOut = SCALE( fPercentCentered, 0.f, 1.f, fShiftOut, 0.0f ); + + fScaleOut = SCALE( fPercentReverse, 0.f, 1.f, 1.f, -1.f ); +} + +float ArrowEffects::GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse ) +{ + float f = fYOffset; + + if( WithReverse ) + { + float fShift, fScale; + ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale ); + + f *= fScale; + f += fShift; + } + + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + + if( fEffects[PlayerOptions::EFFECT_TIPSY] != 0 ) + f += fEffects[PlayerOptions::EFFECT_TIPSY] + * ( RageFastCos( RageTimer::GetTimeSinceStartFast()*TIPSY_TIMER_FREQUENCY + + iCol*TIPSY_COLUMN_FREQUENCY) * ARROW_SIZE*TIPSY_ARROW_MAGNITUDE ); + + // In beware's DDR Extreme-focused fork of StepMania 3.9, this value is + // floored, making arrows show on integer Y coordinates. Supposedly it makes + // the arrows look better, but testing needs to be done. + // todo: make this a noteskin metric instead of a theme metric? -aj + return QUANTIZE_ARROW_Y ? floor(f) : f; +} + +float ArrowEffects::GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels ) +{ + float f = YPos; + + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + if( fEffects[PlayerOptions::EFFECT_TIPSY] != 0 ) + f -= fEffects[PlayerOptions::EFFECT_TIPSY] + * ( RageFastCos( RageTimer::GetTimeSinceStartFast()*TIPSY_OFFSET_TIMER_FREQUENCY + + iCol*TIPSY_OFFSET_COLUMN_FREQUENCY) * ARROW_SIZE*TIPSY_OFFSET_ARROW_MAGNITUDE ); + + float fShift, fScale; + ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale ); + + f -= fShift; + if( fScale ) + f /= fScale; + + return f; +} + +float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float fYOffset ) +{ + float fPixelOffsetFromCenter = 0; // fill this in below + + const Style* pStyle = GAMESTATE->GetCurrentStyle(); + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + + // TODO: Don't index by PlayerNumber. + const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber]; + PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber]; + + if( fEffects[PlayerOptions::EFFECT_TORNADO] != 0 ) + { + const float fRealPixelOffset = pCols[iColNum].fXOffset; + const float fPositionBetween = SCALE( fRealPixelOffset, data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum], + TORNADO_POSITION_SCALE_TO_LOW, TORNADO_POSITION_SCALE_TO_HIGH ); + float fRads = acosf( fPositionBetween ); + fRads += fYOffset * TORNADO_OFFSET_FREQUENCY / SCREEN_HEIGHT; + + const float fAdjustedPixelOffset = SCALE( RageFastCos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, + data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum] ); + + fPixelOffsetFromCenter += (fAdjustedPixelOffset - fRealPixelOffset) * fEffects[PlayerOptions::EFFECT_TORNADO]; + } + + if( fEffects[PlayerOptions::EFFECT_DRUNK] != 0 ) + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * + ( RageFastCos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY + + fYOffset*DRUNK_OFFSET_FREQUENCY/SCREEN_HEIGHT) * ARROW_SIZE*DRUNK_ARROW_MAGNITUDE ); + if( fEffects[PlayerOptions::EFFECT_FLIP] != 0 ) + { + const int iFirstCol = 0; + const int iLastCol = pStyle->m_iColsPerPlayer-1; + const int iNewCol = SCALE( iColNum, iFirstCol, iLastCol, iLastCol, iFirstCol ); + const float fOldPixelOffset = pCols[iColNum].fXOffset; + const float fNewPixelOffset = pCols[iNewCol].fXOffset; + const float fDistance = fNewPixelOffset - fOldPixelOffset; + fPixelOffsetFromCenter += fDistance * fEffects[PlayerOptions::EFFECT_FLIP]; + } + if( fEffects[PlayerOptions::EFFECT_INVERT] != 0 ) + fPixelOffsetFromCenter += data.m_fInvertDistance[iColNum] * fEffects[PlayerOptions::EFFECT_INVERT]; + + if( fEffects[PlayerOptions::EFFECT_BEAT] != 0 ) + { + const float fShift = data.m_fBeatFactor*RageFastSin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_BEAT] * fShift; + } + + if( fEffects[PlayerOptions::EFFECT_XMODE] != 0 ) + { + // based off of code by v1toko for StepNXA, except it should work on + // any gametype now. + switch( pStyle->m_StyleType ) + { + case StyleType_OnePlayerTwoSides: + case StyleType_TwoPlayersSharedSides: // fall through? + { + // find the middle, and split based on iColNum + // it's unknown if this will work for routine. + const int iMiddleColumn = static_cast(floor(pStyle->m_iColsPerPlayer/2.0f)); + if( iColNum > iMiddleColumn-1 ) + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*-(fYOffset); + else + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*fYOffset; + } + break; + case StyleType_OnePlayerOneSide: + case StyleType_TwoPlayersTwoSides: // fall through + { + // the code was the same for both of these cases in StepNXA. + if( pPlayerState->m_PlayerNumber == PLAYER_2 ) + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*-(fYOffset); + else + fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_XMODE]*fYOffset; + } + break; + DEFAULT_FAIL(pStyle->m_StyleType); + } + } + + fPixelOffsetFromCenter += pCols[iColNum].fXOffset; + + if( fEffects[PlayerOptions::EFFECT_MINI] != 0 ) + { + // Allow Mini to pull tracks together, but not to push them apart. + float fMiniPercent = fEffects[PlayerOptions::EFFECT_MINI]; + fMiniPercent = min( powf(MINI_PERCENT_BASE, fMiniPercent), (float)MINI_PERCENT_GATE ); + fPixelOffsetFromCenter *= fMiniPercent; + } + + return fPixelOffsetFromCenter; +} + +float ArrowEffects::GetRotationX( const PlayerState *pPlayerState, float fYOffset ) +{ + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + float fRotation = 0; + if( fEffects[PlayerOptions::EFFECT_ROLL] != 0 ) + { + fRotation = fEffects[PlayerOptions::EFFECT_ROLL] * fYOffset/2; + } + return fRotation; +} + +float ArrowEffects::GetRotationY( const PlayerState *pPlayerState, float fYOffset ) +{ + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + float fRotation = 0; + if( fEffects[PlayerOptions::EFFECT_TWIRL] != 0 ) + { + fRotation = fEffects[PlayerOptions::EFFECT_TWIRL] * fYOffset/2; + } + return fRotation; +} + +float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead ) +{ + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + float fRotation = 0; + if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 ) + fRotation += ReceptorGetRotationZ( pPlayerState ); + + // As usual, enable dizzy hold heads at your own risk. -Wolfman2000 + if( fEffects[PlayerOptions::EFFECT_DIZZY] != 0 && ( DIZZY_HOLD_HEADS || !bIsHoldHead ) ) + { + const float fSongBeat = GAMESTATE->m_fSongBeatVisible; + float fDizzyRotation = fNoteBeat - fSongBeat; + fDizzyRotation *= fEffects[PlayerOptions::EFFECT_DIZZY]; + fDizzyRotation = fmodf( fDizzyRotation, 2*PI ); + fDizzyRotation *= 180/PI; + fRotation += fDizzyRotation; + } + return fRotation; +} + +float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState ) +{ + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + float fRotation = 0; + + if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 ) + { + float fConfRotation = GAMESTATE->m_fSongBeatVisible; + fConfRotation *= fEffects[PlayerOptions::EFFECT_CONFUSION]; + fConfRotation = fmodf( fConfRotation, 2*PI ); + fConfRotation *= -180/PI; + fRotation += fConfRotation; + } + return fRotation; +} + +#define CENTER_LINE_Y 160 // from fYOffset == 0 +#define FADE_DIST_Y 40 + +static float GetCenterLine( const PlayerState* pPlayerState ) +{ + /* Another mini hack: if EFFECT_MINI is on, then our center line is at + * eg. 320, not 160. */ + const float fMiniPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_TINY]; + const float fZoom = 1 - fMiniPercent*0.5f; + return CENTER_LINE_Y / fZoom; +} + +static float GetHiddenSudden( const PlayerState* pPlayerState ) +{ + const float* fAppearances = pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances; + return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * + fAppearances[PlayerOptions::APPEARANCE_SUDDEN]; +} + +// +// -gray arrows- +// +// ...invisible... +// -hidden end line- +// -hidden start line- +// ...visible... +// -sudden end line- +// -sudden start line- +// ...invisible... +// +// TRICKY: We fudge hidden and sudden to be farther apart if they're both on. +static float GetHiddenEndLine( const PlayerState* pPlayerState ) +{ + return GetCenterLine( pPlayerState ) + + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -1.0f, -1.25f ) + + GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET]; +} + +static float GetHiddenStartLine( const PlayerState* pPlayerState ) +{ + return GetCenterLine( pPlayerState ) + + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +0.0f, -0.25f ) + + GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET]; +} + +static float GetSuddenEndLine( const PlayerState* pPlayerState ) +{ + return GetCenterLine( pPlayerState ) + + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -0.0f, +0.25f ) + + GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET]; +} + +static float GetSuddenStartLine( const PlayerState* pPlayerState ) +{ + return GetCenterLine( pPlayerState ) + + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +1.0f, +1.25f ) + + GetCenterLine( pPlayerState ) * pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET]; +} + +// used by ArrowGetAlpha and ArrowGetGlow below +float ArrowGetPercentVisible( const PlayerState* pPlayerState, float fYPosWithoutReverse ) +{ + const float fDistFromCenterLine = fYPosWithoutReverse - GetCenterLine( pPlayerState ); + + if( fYPosWithoutReverse < 0 && HIDDEN_SUDDEN_PAST_RECEPTOR) // past Gray Arrows + return 1; // totally visible + + const float* fAppearances = pPlayerState->m_PlayerOptions.GetCurrent().m_fAppearances; + + float fVisibleAdjust = 0; + + if( fAppearances[PlayerOptions::APPEARANCE_HIDDEN] != 0 ) + { + float fHiddenVisibleAdjust = SCALE( fYPosWithoutReverse, GetHiddenStartLine(pPlayerState), GetHiddenEndLine(pPlayerState), 0, -1 ); + CLAMP( fHiddenVisibleAdjust, -1, 0 ); + fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * fHiddenVisibleAdjust; + } + if( fAppearances[PlayerOptions::APPEARANCE_SUDDEN] != 0 ) + { + float fSuddenVisibleAdjust = SCALE( fYPosWithoutReverse, GetSuddenStartLine(pPlayerState), GetSuddenEndLine(pPlayerState), -1, 0 ); + CLAMP( fSuddenVisibleAdjust, -1, 0 ); + fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_SUDDEN] * fSuddenVisibleAdjust; + } + + if( fAppearances[PlayerOptions::APPEARANCE_STEALTH] != 0 ) + fVisibleAdjust -= fAppearances[PlayerOptions::APPEARANCE_STEALTH]; + if( fAppearances[PlayerOptions::APPEARANCE_BLINK] != 0 ) + { + float f = RageFastSin(RageTimer::GetTimeSinceStartFast()*10); + f = Quantize( f, BLINK_MOD_FREQUENCY ); + fVisibleAdjust += SCALE( f, 0, 1, -1, 0 ); + } + if( fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] != 0 ) + { + const float fRealFadeDist = 80; + fVisibleAdjust += SCALE( fabsf(fDistFromCenterLine), fRealFadeDist, 2*fRealFadeDist, -1, 0 ) + * fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]; + } + + return clamp( 1+fVisibleAdjust, 0, 1 ); +} + +float ArrowEffects::GetAlpha( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ) +{ + // Get the YPos without reverse (that is, factor in EFFECT_TIPSY). + float fYPosWithoutReverse = ArrowEffects::GetYPos( pPlayerState, iCol, fYOffset, fYReverseOffsetPixels, false ); + + float fPercentVisible = ArrowGetPercentVisible( pPlayerState, fYPosWithoutReverse ); + + if( fPercentFadeToFail != -1 ) + fPercentVisible = 1 - fPercentFadeToFail; + + + float fFullAlphaY = fDrawDistanceBeforeTargetsPixels*(1-fFadeInPercentOfDrawFar); + if( fYPosWithoutReverse > fFullAlphaY ) + { + float f = SCALE( fYPosWithoutReverse, fFullAlphaY, fDrawDistanceBeforeTargetsPixels, 1.0f, 0.0f ); + return f; + } + + + return (fPercentVisible>0.5f) ? 1.0f : 0.0f; +} + +float ArrowEffects::GetGlow( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ) +{ + // Get the YPos without reverse (that is, factor in EFFECT_TIPSY). + float fYPosWithoutReverse = ArrowEffects::GetYPos( pPlayerState, iCol, fYOffset, fYReverseOffsetPixels, false ); + + float fPercentVisible = ArrowGetPercentVisible( pPlayerState, fYPosWithoutReverse ); + + if( fPercentFadeToFail != -1 ) + fPercentVisible = 1 - fPercentFadeToFail; + + const float fDistFromHalf = fabsf( fPercentVisible - 0.5f ); + return SCALE( fDistFromHalf, 0, 0.5f, 1.3f, 0 ); +} + +float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteBeat ) +{ + if( GAMESTATE->IsEditing() ) + return 1; + + float fSongBeat = GAMESTATE->m_fSongBeatVisible; + float fBeatsUntilStep = fNoteBeat - fSongBeat; + + float fBrightness = SCALE( fBeatsUntilStep, 0, -1, 1.f, 0.f ); + CLAMP( fBrightness, 0, 1 ); + return fBrightness; +} + + +float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset ) +{ + float fZPos=0; + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + + if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ) + fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*RageFastSin( fYOffset/16.0f ); + + return fZPos; +} + +bool ArrowEffects::NeedZBuffer( const PlayerState* pPlayerState ) +{ + const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + // We also need to use the Z buffer if twirl is in play, because of + // hold modulation. -vyhd (OpenITG r623) + if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 || + fEffects[PlayerOptions::EFFECT_TWIRL] != 0 ) + return true; + + return false; +} + +float ArrowEffects::GetZoom( const PlayerState* pPlayerState ) +{ + float fZoom = 1.0f; + // FIXME: Move the zoom values into Style + if( GAMESTATE->GetCurrentStyle()->m_bNeedsZoomOutWith2Players && + (GAMESTATE->GetNumSidesJoined()==2 || GAMESTATE->AnyPlayersAreCpu()) ) + fZoom *= 0.6f; + + float fMiniPercent = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_MINI]; + if( fMiniPercent != 0 ) + { + fMiniPercent = powf( 0.5f, fMiniPercent ); + fZoom *= fMiniPercent; + } + return fZoom; +} + +static ThemeMetric FRAME_WIDTH_EFFECTS_PIXELS_PER_SECOND( "ArrowEffects", "FrameWidthEffectsPixelsPerSecond" ); +static ThemeMetric FRAME_WIDTH_EFFECTS_MIN_MULTIPLIER( "ArrowEffects", "FrameWidthEffectsMinMultiplier" ); +static ThemeMetric FRAME_WIDTH_EFFECTS_MAX_MULTIPLIER( "ArrowEffects", "FrameWidthEffectsMaxMultiplier" ); +static ThemeMetric FRAME_WIDTH_LOCK_EFFECTS_TO_OVERLAPPING( "ArrowEffects", "FrameWidthLockEffectsToOverlapping" ); +static ThemeMetric FRAME_WIDTH_LOCK_EFFECTS_TWEEN_PIXELS( "ArrowEffects", "FrameWidthLockEffectsTweenPixels" ); + +float ArrowEffects::GetFrameWidthScale( const PlayerState* pPlayerState, float fYOffset, float fOverlappedTime ) +{ + float fFrameWidthMultiplier = 1.0f; + + float fPixelsPerSecond = FRAME_WIDTH_EFFECTS_PIXELS_PER_SECOND; + float fSecond = fYOffset / fPixelsPerSecond; + float fWidthEffect = pPlayerState->m_EffectHistory.GetSample( fSecond ); + if( fWidthEffect != 0 && FRAME_WIDTH_LOCK_EFFECTS_TO_OVERLAPPING ) + { + // Don't display effect data that happened before this hold overlapped the top. + float fFromEndOfOverlapped = fOverlappedTime - fSecond; + float fTrailingPixels = FRAME_WIDTH_LOCK_EFFECTS_TWEEN_PIXELS; + float fTrailingSeconds = fTrailingPixels / fPixelsPerSecond; + float fScaleEffect = SCALE( fFromEndOfOverlapped, 0.0f, fTrailingSeconds, 0.0f, 1.0f ); + CLAMP( fScaleEffect, 0.0f, 1.0f ); + fWidthEffect *= fScaleEffect; + } + + if( fWidthEffect > 0 ) + fFrameWidthMultiplier *= SCALE( fWidthEffect, 0.0f, 1.0f, 1.0f, FRAME_WIDTH_EFFECTS_MAX_MULTIPLIER ); + else if( fWidthEffect < 0 ) + fFrameWidthMultiplier *= SCALE( fWidthEffect, 0.0f, -1.0f, 1.0f, FRAME_WIDTH_EFFECTS_MIN_MULTIPLIER ); + + return fFrameWidthMultiplier; +} + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ArrowEffects.h b/src/ArrowEffects.h index 857b78681f..1ee054d333 100644 --- a/src/ArrowEffects.h +++ b/src/ArrowEffects.h @@ -1,116 +1,116 @@ -#ifndef ARROWEFFECTS_H -#define ARROWEFFECTS_H - -class PlayerState; -/** @brief Functions that return properties of arrows based on Style and PlayerOptions. */ -class ArrowEffects -{ -public: - static void Update(); - - // fYOffset is a vertical position in pixels relative to the center - // (positive if has not yet been stepped on, negative if has already passed). - // The ArrowEffect and ScrollSpeed is applied in this stage. - static float GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, float &fPeakYOffsetOut, bool &bIsPastPeakYOffset, bool bAbsolute=false ); - static float GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, bool bAbsolute=false ) - { - float fThrowAway; - bool bThrowAway; - return GetYOffset( pPlayerState, iCol, fNoteBeat, fThrowAway, bThrowAway, bAbsolute ); - } - - /** - * @brief Retrieve the actual display position. - * - * In this case, reverse and post-reverse-effects are factored in (fYOffset -> YPos). - * @param pPlayerState the Player's state in question, including mods. - * @param iCol the specific arrow column. - * @param fYOffset the original display position. - * @param fYReverseOffsetPixels the amount offset due to reverse. - * @param WithReverse a flag to see if the Reverse mod is on. - * @return the actual display position. */ - static float GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse = true ); - - // Inverse of ArrowGetYPos (YPos -> fYOffset). - static float GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels ); - - // fRotation is Z rotation of an arrow. This will depend on the column of - // the arrow and possibly the Arrow effect and the fYOffset (in the case of - // EFFECT_DIZZY). - static float GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead ); - static float ReceptorGetRotationZ( const PlayerState* pPlayerState ); - - // Due to the handling logic for holds on Twirl, we need to use an offset instead. - // It's more intuitive for Roll to be based off offset, so use an offset there too. - static float GetRotationX( const PlayerState* pPlayerState, float fYOffset ); - static float GetRotationY( const PlayerState* pPlayerState, float fYOffset ); - - // fXPos is a horizontal position in pixels relative to the center of the field. - // This depends on the column of the arrow and possibly the Arrow effect and - // fYPos (in the case of EFFECT_DRUNK). - static float GetXPos( const PlayerState* pPlayerState, int iCol, float fYOffset ); - - /** - * @brief Retrieve the Z position. - * - * This is normally 0. This is only visible with perspective modes. - * @param pPlayerState the Player's state, including the mods. - * @param iCol the specific arrow column. - * @param fYPos the Y position of the arrow. - * @return the Z position. */ - static float GetZPos( const PlayerState* pPlayerState, int iCol, float fYPos ); - - // Enable this if any ZPos effects are enabled. - static bool NeedZBuffer( const PlayerState* pPlayerState ); - - // fAlpha is the transparency of the arrow. It depends on fYPos and the - // AppearanceType. - static float GetAlpha( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ); - - // fAlpha is the transparency of the arrow. It depends on fYPos and the - // AppearanceType. - static float GetGlow( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ); - - /** - * @brief Retrieve the current brightness. - * - * Note that this depends on fYOffset. - * @param pPlayerState the present PlayerState. - * @param fNoteBeat the current beat. - * @return the current brightness. */ - static float GetBrightness( const PlayerState* pPlayerState, float fNoteBeat ); - - // This is the zoom of the individual tracks, not of the whole Player. - static float GetZoom( const PlayerState* pPlayerState ); - - static float GetFrameWidthScale( const PlayerState* pPlayerState, float fYOffset, float fOverlappedTime ); -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ARROWEFFECTS_H +#define ARROWEFFECTS_H + +class PlayerState; +/** @brief Functions that return properties of arrows based on Style and PlayerOptions. */ +class ArrowEffects +{ +public: + static void Update(); + + // fYOffset is a vertical position in pixels relative to the center + // (positive if has not yet been stepped on, negative if has already passed). + // The ArrowEffect and ScrollSpeed is applied in this stage. + static float GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, float &fPeakYOffsetOut, bool &bIsPastPeakYOffset, bool bAbsolute=false ); + static float GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, bool bAbsolute=false ) + { + float fThrowAway; + bool bThrowAway; + return GetYOffset( pPlayerState, iCol, fNoteBeat, fThrowAway, bThrowAway, bAbsolute ); + } + + /** + * @brief Retrieve the actual display position. + * + * In this case, reverse and post-reverse-effects are factored in (fYOffset -> YPos). + * @param pPlayerState the Player's state in question, including mods. + * @param iCol the specific arrow column. + * @param fYOffset the original display position. + * @param fYReverseOffsetPixels the amount offset due to reverse. + * @param WithReverse a flag to see if the Reverse mod is on. + * @return the actual display position. */ + static float GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse = true ); + + // Inverse of ArrowGetYPos (YPos -> fYOffset). + static float GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels ); + + // fRotation is Z rotation of an arrow. This will depend on the column of + // the arrow and possibly the Arrow effect and the fYOffset (in the case of + // EFFECT_DIZZY). + static float GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead ); + static float ReceptorGetRotationZ( const PlayerState* pPlayerState ); + + // Due to the handling logic for holds on Twirl, we need to use an offset instead. + // It's more intuitive for Roll to be based off offset, so use an offset there too. + static float GetRotationX( const PlayerState* pPlayerState, float fYOffset ); + static float GetRotationY( const PlayerState* pPlayerState, float fYOffset ); + + // fXPos is a horizontal position in pixels relative to the center of the field. + // This depends on the column of the arrow and possibly the Arrow effect and + // fYPos (in the case of EFFECT_DRUNK). + static float GetXPos( const PlayerState* pPlayerState, int iCol, float fYOffset ); + + /** + * @brief Retrieve the Z position. + * + * This is normally 0. This is only visible with perspective modes. + * @param pPlayerState the Player's state, including the mods. + * @param iCol the specific arrow column. + * @param fYPos the Y position of the arrow. + * @return the Z position. */ + static float GetZPos( const PlayerState* pPlayerState, int iCol, float fYPos ); + + // Enable this if any ZPos effects are enabled. + static bool NeedZBuffer( const PlayerState* pPlayerState ); + + // fAlpha is the transparency of the arrow. It depends on fYPos and the + // AppearanceType. + static float GetAlpha( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ); + + // fAlpha is the transparency of the arrow. It depends on fYPos and the + // AppearanceType. + static float GetGlow( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar ); + + /** + * @brief Retrieve the current brightness. + * + * Note that this depends on fYOffset. + * @param pPlayerState the present PlayerState. + * @param fNoteBeat the current beat. + * @return the current brightness. */ + static float GetBrightness( const PlayerState* pPlayerState, float fNoteBeat ); + + // This is the zoom of the individual tracks, not of the whole Player. + static float GetZoom( const PlayerState* pPlayerState ); + + static float GetFrameWidthScale( const PlayerState* pPlayerState, float fYOffset, float fOverlappedTime ); +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Attack.cpp b/src/Attack.cpp index f15fdb7cae..a896944158 100644 --- a/src/Attack.cpp +++ b/src/Attack.cpp @@ -1,115 +1,115 @@ -#include "global.h" -#include "Attack.h" -#include "GameState.h" -#include "RageUtil.h" -#include "Song.h" -#include "Foreach.h" -#include "PlayerOptions.h" -#include "PlayerState.h" - -void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const -{ - ASSERT( pSong ); - ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) ); - - fStartBeat = pSong->GetBeatFromElapsedTime( fStartSecond ); - fEndBeat = pSong->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining ); -} - -/* Get the range for an attack that's being applied in realtime, eg. during battle - * mode. We need a PlayerState for this, so we can push the region off-screen to - * prevent popping when the attack has note modifers. */ -void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const -{ - if( fStartSecond >= 0 ) - { - GetAttackBeats( pSong, fStartBeat, fEndBeat ); - return; - } - - ASSERT( pPlayerState ); - ASSERT( pSong ); - - /* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */ - fStartBeat = min( GAMESTATE->m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat ); - fStartBeat = truncf(fStartBeat)+1; - - const float lStartSecond = pSong->GetElapsedTimeFromBeat( fStartBeat ); - const float fEndSecond = lStartSecond + fSecsRemaining; - fEndBeat = pSong->GetBeatFromElapsedTime( fEndSecond ); - fEndBeat = truncf(fEndBeat)+1; - - // loading the course should have caught this. - ASSERT_M( fEndBeat >= fStartBeat, ssprintf("EndBeat %f >= StartBeat %f", fEndBeat, fStartBeat) ); -} - -bool Attack::operator== ( const Attack &rhs ) const -{ -#define EQUAL(a) (a==rhs.a) - return - EQUAL(level) && - EQUAL(fStartSecond) && - EQUAL(fSecsRemaining) && - EQUAL(sModifiers) && - EQUAL(bOn) && - EQUAL(bGlobal); -} - -bool Attack::ContainsTransformOrTurn() const -{ - PlayerOptions po; - po.FromString( sModifiers ); - return po.ContainsTransformOrTurn(); -} - -Attack Attack::FromGlobalCourseModifier( const RString &sModifiers ) -{ - Attack a; - a.fStartSecond = 0; - a.fSecsRemaining = 10000; /* whole song */ - a.level = ATTACK_LEVEL_1; - a.sModifiers = sModifiers; - a.bGlobal = true; - return a; -} - -RString Attack::GetTextDescription() const -{ - RString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining); - return s; -} - -bool AttackArray::ContainsTransformOrTurn() const -{ - FOREACH_CONST( Attack, *this, a ) - { - if( a->ContainsTransformOrTurn() ) - return true; - } - return false; -} - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Attack.h" +#include "GameState.h" +#include "RageUtil.h" +#include "Song.h" +#include "Foreach.h" +#include "PlayerOptions.h" +#include "PlayerState.h" + +void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const +{ + ASSERT( pSong ); + ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) ); + + fStartBeat = pSong->GetBeatFromElapsedTime( fStartSecond ); + fEndBeat = pSong->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining ); +} + +/* Get the range for an attack that's being applied in realtime, eg. during battle + * mode. We need a PlayerState for this, so we can push the region off-screen to + * prevent popping when the attack has note modifers. */ +void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const +{ + if( fStartSecond >= 0 ) + { + GetAttackBeats( pSong, fStartBeat, fEndBeat ); + return; + } + + ASSERT( pPlayerState ); + ASSERT( pSong ); + + /* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */ + fStartBeat = min( GAMESTATE->m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat ); + fStartBeat = truncf(fStartBeat)+1; + + const float lStartSecond = pSong->GetElapsedTimeFromBeat( fStartBeat ); + const float fEndSecond = lStartSecond + fSecsRemaining; + fEndBeat = pSong->GetBeatFromElapsedTime( fEndSecond ); + fEndBeat = truncf(fEndBeat)+1; + + // loading the course should have caught this. + ASSERT_M( fEndBeat >= fStartBeat, ssprintf("EndBeat %f >= StartBeat %f", fEndBeat, fStartBeat) ); +} + +bool Attack::operator== ( const Attack &rhs ) const +{ +#define EQUAL(a) (a==rhs.a) + return + EQUAL(level) && + EQUAL(fStartSecond) && + EQUAL(fSecsRemaining) && + EQUAL(sModifiers) && + EQUAL(bOn) && + EQUAL(bGlobal); +} + +bool Attack::ContainsTransformOrTurn() const +{ + PlayerOptions po; + po.FromString( sModifiers ); + return po.ContainsTransformOrTurn(); +} + +Attack Attack::FromGlobalCourseModifier( const RString &sModifiers ) +{ + Attack a; + a.fStartSecond = 0; + a.fSecsRemaining = 10000; /* whole song */ + a.level = ATTACK_LEVEL_1; + a.sModifiers = sModifiers; + a.bGlobal = true; + return a; +} + +RString Attack::GetTextDescription() const +{ + RString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining); + return s; +} + +bool AttackArray::ContainsTransformOrTurn() const +{ + FOREACH_CONST( Attack, *this, a ) + { + if( a->ContainsTransformOrTurn() ) + return true; + } + return false; +} + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Attack.h b/src/Attack.h index 30f87589cf..7eadbe4937 100644 --- a/src/Attack.h +++ b/src/Attack.h @@ -1,103 +1,103 @@ -#ifndef ATTACK_H -#define ATTACK_H - -#include "GameConstantsAndTypes.h" -#include "PlayerNumber.h" -class Song; -class PlayerState; -/** @brief An action made against a Player to make things more difficult. */ -struct Attack -{ - AttackLevel level; - /** - * @brief the starting point of this attack. - * - * If this is -1, then the attack starts now. */ - float fStartSecond; - /** @brief How long does this attack last? */ - float fSecsRemaining; - /** @brief The modifiers used for this attack. */ - RString sModifiers; - bool bOn; // set and used by GAMESTATE - bool bGlobal; // true for song-wide course mods - bool bShowInAttackList; - - void MakeBlank() - { - level = ATTACK_LEVEL_1; - fStartSecond = -1; - fSecsRemaining = 0; - sModifiers = RString(); - bOn = false; - bGlobal = false; - bShowInAttackList = true; - } - Attack(): level(ATTACK_LEVEL_1), fStartSecond(-1), - fSecsRemaining(0), sModifiers(RString()), - bOn(false), bGlobal(false), bShowInAttackList(true) - {} // MakeBlank() is effectively called here. - Attack( - AttackLevel level_, - float fStartSecond_, - float fSecsRemaining_, - RString sModifiers_, - bool bOn_, - bool bGlobal_, - bool bShowInAttackList_ = true ): - level(level_), fStartSecond(fStartSecond_), - fSecsRemaining(fSecsRemaining_), sModifiers(sModifiers_), - bOn(bOn_), bGlobal(bGlobal_), - bShowInAttackList(bShowInAttackList_) {} - - void GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const; - void GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const; - /** - * @brief Determine if this attack has no modifiers, and is thus blank or empty. - * @return true if it is blank/empty, or false otherwise. */ - bool IsBlank() const { return sModifiers.empty(); } - /** - * @brief Determine if two Attacks are equal to each other. - * @param rhs the other Attack in question. - * @return true if the two Attacks are equal, or false otherwise. */ - bool operator== ( const Attack &rhs ) const; - bool ContainsTransformOrTurn() const; - static Attack FromGlobalCourseModifier( const RString &sModifiers ); - RString GetTextDescription() const; -}; - -struct AttackArray : public vector -{ - /** - * @brief Determine if the list of attacks contains a transform or turn mod. - * @return true if it does, or false otherwise. */ - bool ContainsTransformOrTurn() const; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ATTACK_H +#define ATTACK_H + +#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" +class Song; +class PlayerState; +/** @brief An action made against a Player to make things more difficult. */ +struct Attack +{ + AttackLevel level; + /** + * @brief the starting point of this attack. + * + * If this is -1, then the attack starts now. */ + float fStartSecond; + /** @brief How long does this attack last? */ + float fSecsRemaining; + /** @brief The modifiers used for this attack. */ + RString sModifiers; + bool bOn; // set and used by GAMESTATE + bool bGlobal; // true for song-wide course mods + bool bShowInAttackList; + + void MakeBlank() + { + level = ATTACK_LEVEL_1; + fStartSecond = -1; + fSecsRemaining = 0; + sModifiers = RString(); + bOn = false; + bGlobal = false; + bShowInAttackList = true; + } + Attack(): level(ATTACK_LEVEL_1), fStartSecond(-1), + fSecsRemaining(0), sModifiers(RString()), + bOn(false), bGlobal(false), bShowInAttackList(true) + {} // MakeBlank() is effectively called here. + Attack( + AttackLevel level_, + float fStartSecond_, + float fSecsRemaining_, + RString sModifiers_, + bool bOn_, + bool bGlobal_, + bool bShowInAttackList_ = true ): + level(level_), fStartSecond(fStartSecond_), + fSecsRemaining(fSecsRemaining_), sModifiers(sModifiers_), + bOn(bOn_), bGlobal(bGlobal_), + bShowInAttackList(bShowInAttackList_) {} + + void GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const; + void GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const; + /** + * @brief Determine if this attack has no modifiers, and is thus blank or empty. + * @return true if it is blank/empty, or false otherwise. */ + bool IsBlank() const { return sModifiers.empty(); } + /** + * @brief Determine if two Attacks are equal to each other. + * @param rhs the other Attack in question. + * @return true if the two Attacks are equal, or false otherwise. */ + bool operator== ( const Attack &rhs ) const; + bool ContainsTransformOrTurn() const; + static Attack FromGlobalCourseModifier( const RString &sModifiers ); + RString GetTextDescription() const; +}; + +struct AttackArray : public vector +{ + /** + * @brief Determine if the list of attacks contains a transform or turn mod. + * @return true if it does, or false otherwise. */ + bool ContainsTransformOrTurn() const; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AttackDisplay.cpp b/src/AttackDisplay.cpp index 94c3bda9df..17b21af258 100644 --- a/src/AttackDisplay.cpp +++ b/src/AttackDisplay.cpp @@ -1,138 +1,138 @@ -#include "global.h" -#include "AttackDisplay.h" -#include "ThemeManager.h" -#include "GameState.h" -#include "ActorUtil.h" -#include "Character.h" -#include "RageLog.h" -#include -#include "PlayerState.h" - - -RString GetAttackPieceName( const RString &sAttack ) -{ - RString ret = ssprintf( "attack %s", sAttack.c_str() ); - - /* 1.5x -> 1_5x. If we pass a period to THEME->GetPathTo, it'll think - * we're looking for a specific file and not search. */ - ret.Replace( ".", "_" ); - - return ret; -} - -AttackDisplay::AttackDisplay() -{ - if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && - GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) - return; - - m_sprAttack.SetDiffuseAlpha( 0 ); // invisible - this->AddChild( &m_sprAttack ); -} - -void AttackDisplay::Init( const PlayerState* pPlayerState ) -{ - m_pPlayerState = pPlayerState; - - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - m_sprAttack.SetName( ssprintf("TextP%d",pn+1) ); - - if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && - GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) - return; - - set attacks; - for( int al=0; alm_pCurCharacters[pn]; - ASSERT( ch ); - const RString* asAttacks = ch->m_sAttacks[al]; - for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att ) - attacks.insert( asAttacks[att] ); - } - - for( set::const_iterator it = attacks.begin(); it != attacks.end(); ++it ) - { - const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true ); - if( path == "" ) - { - LOG->Trace( "Couldn't find \"%s\"", GetAttackPieceName( *it ).c_str() ); - continue; - } - - m_TexturePreload.Load( path ); - } -} - - -void AttackDisplay::Update( float fDelta ) -{ - ActorFrame::Update( fDelta ); - - if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && - GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) - return; - - if( !m_pPlayerState->m_bAttackBeganThisUpdate ) - return; - // don't handle this again - - for( unsigned s=0; sm_ActiveAttacks.size(); s++ ) - { - const Attack& attack = m_pPlayerState->m_ActiveAttacks[s]; - - if( attack.fStartSecond >= 0 ) - continue; /* hasn't started yet */ - - if( attack.fSecsRemaining <= 0 ) - continue; /* ended already */ - - if( attack.IsBlank() ) - continue; - - SetAttack( attack.sModifiers ); - break; - } -} - -void AttackDisplay::SetAttack( const RString &sText ) -{ - const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName(sText), true ); - if( path == "" ) - return; - - m_sprAttack.SetDiffuseAlpha( 1 ); - m_sprAttack.Load( path ); - - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - - const RString sName = ssprintf( "%sP%i", sText.c_str(), pn+1 ); - m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand") ); -} - -/* - * (c) 2003 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "AttackDisplay.h" +#include "ThemeManager.h" +#include "GameState.h" +#include "ActorUtil.h" +#include "Character.h" +#include "RageLog.h" +#include +#include "PlayerState.h" + + +RString GetAttackPieceName( const RString &sAttack ) +{ + RString ret = ssprintf( "attack %s", sAttack.c_str() ); + + /* 1.5x -> 1_5x. If we pass a period to THEME->GetPathTo, it'll think + * we're looking for a specific file and not search. */ + ret.Replace( ".", "_" ); + + return ret; +} + +AttackDisplay::AttackDisplay() +{ + if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && + GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) + return; + + m_sprAttack.SetDiffuseAlpha( 0 ); // invisible + this->AddChild( &m_sprAttack ); +} + +void AttackDisplay::Init( const PlayerState* pPlayerState ) +{ + m_pPlayerState = pPlayerState; + + // TODO: Remove use of PlayerNumber. + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + m_sprAttack.SetName( ssprintf("TextP%d",pn+1) ); + + if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && + GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) + return; + + set attacks; + for( int al=0; alm_pCurCharacters[pn]; + ASSERT( ch ); + const RString* asAttacks = ch->m_sAttacks[al]; + for( int att = 0; att < NUM_ATTACKS_PER_LEVEL; ++att ) + attacks.insert( asAttacks[att] ); + } + + for( set::const_iterator it = attacks.begin(); it != attacks.end(); ++it ) + { + const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName( *it ), true ); + if( path == "" ) + { + LOG->Trace( "Couldn't find \"%s\"", GetAttackPieceName( *it ).c_str() ); + continue; + } + + m_TexturePreload.Load( path ); + } +} + + +void AttackDisplay::Update( float fDelta ) +{ + ActorFrame::Update( fDelta ); + + if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE && + GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) + return; + + if( !m_pPlayerState->m_bAttackBeganThisUpdate ) + return; + // don't handle this again + + for( unsigned s=0; sm_ActiveAttacks.size(); s++ ) + { + const Attack& attack = m_pPlayerState->m_ActiveAttacks[s]; + + if( attack.fStartSecond >= 0 ) + continue; /* hasn't started yet */ + + if( attack.fSecsRemaining <= 0 ) + continue; /* ended already */ + + if( attack.IsBlank() ) + continue; + + SetAttack( attack.sModifiers ); + break; + } +} + +void AttackDisplay::SetAttack( const RString &sText ) +{ + const RString path = THEME->GetPathG( "AttackDisplay", GetAttackPieceName(sText), true ); + if( path == "" ) + return; + + m_sprAttack.SetDiffuseAlpha( 1 ); + m_sprAttack.Load( path ); + + // TODO: Remove use of PlayerNumber. + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + + const RString sName = ssprintf( "%sP%i", sText.c_str(), pn+1 ); + m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand") ); +} + +/* + * (c) 2003 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AttackDisplay.h b/src/AttackDisplay.h index e888cff36e..1a411ea55a 100644 --- a/src/AttackDisplay.h +++ b/src/AttackDisplay.h @@ -1,56 +1,56 @@ -#ifndef AttackDisplay_H -#define AttackDisplay_H - -#include "ActorFrame.h" -#include "Sprite.h" -#include "GameConstantsAndTypes.h" // for TapNoteScore -#include "RageTexturePreloader.h" - -class PlayerState; -/** @brief A graphical display for attacks. */ -class AttackDisplay : public ActorFrame -{ -public: - AttackDisplay(); - - void Init( const PlayerState* pPlayerState ); - void SetAttack( const RString &mod ); - - virtual void Update( float fDelta ); - -protected: - const PlayerState* m_pPlayerState; - - Sprite m_sprAttack; - - RageTexturePreloader m_TexturePreload; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef AttackDisplay_H +#define AttackDisplay_H + +#include "ActorFrame.h" +#include "Sprite.h" +#include "GameConstantsAndTypes.h" // for TapNoteScore +#include "RageTexturePreloader.h" + +class PlayerState; +/** @brief A graphical display for attacks. */ +class AttackDisplay : public ActorFrame +{ +public: + AttackDisplay(); + + void Init( const PlayerState* pPlayerState ); + void SetAttack( const RString &mod ); + + virtual void Update( float fDelta ); + +protected: + const PlayerState* m_pPlayerState; + + Sprite m_sprAttack; + + RageTexturePreloader m_TexturePreload; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AutoActor.cpp b/src/AutoActor.cpp index 8ffc66d556..26fdb4757f 100644 --- a/src/AutoActor.cpp +++ b/src/AutoActor.cpp @@ -1,95 +1,95 @@ -#include "global.h" -#include "AutoActor.h" -#include "ThemeManager.h" -#include "Actor.h" -#include "ActorUtil.h" - -void AutoActor::Unload() -{ - delete m_pActor; - m_pActor=NULL; -} - -AutoActor::AutoActor( const AutoActor &cpy ) -{ - if( cpy.m_pActor == NULL ) - m_pActor = NULL; - else - m_pActor = cpy.m_pActor->Copy(); -} - -AutoActor &AutoActor::operator=( const AutoActor &cpy ) -{ - Unload(); - - if( cpy.m_pActor == NULL ) - m_pActor = NULL; - else - m_pActor = cpy.m_pActor->Copy(); - return *this; -} - -void AutoActor::Load( Actor *pActor ) -{ - Unload(); - m_pActor = pActor; -} - -void AutoActor::Load( const RString &sPath ) -{ - Unload(); - m_pActor = ActorUtil::MakeActor( sPath ); - - // If a Condition is false, MakeActor will return NULL. - if( m_pActor == NULL ) - m_pActor = new Actor; -} - -void AutoActor::LoadB( const RString &sMetricsGroup, const RString &sElement ) -{ - ThemeManager::PathInfo pi; - bool b = THEME->GetPathInfo( pi, EC_BGANIMATIONS, sMetricsGroup, sElement ); - ASSERT( b ); - LuaThreadVariable var1( "MatchingMetricsGroup", pi.sMatchingMetricsGroup ); - LuaThreadVariable var2( "MatchingElement", pi.sMatchingElement ); - Load( pi.sResolvedPath ); -} - -void AutoActor::LoadActorFromNode( const XNode* pNode, Actor *pParent ) -{ - Unload(); - - m_pActor = ActorUtil::LoadFromNode( pNode, pParent ); -} - -void AutoActor::LoadAndSetName( const RString &sScreenName, const RString &sActorName ) -{ - Load( THEME->GetPathG(sScreenName,sActorName) ); - m_pActor->SetName( sActorName ); - ActorUtil::LoadAllCommands( *m_pActor, sScreenName ); -} - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "AutoActor.h" +#include "ThemeManager.h" +#include "Actor.h" +#include "ActorUtil.h" + +void AutoActor::Unload() +{ + delete m_pActor; + m_pActor=NULL; +} + +AutoActor::AutoActor( const AutoActor &cpy ) +{ + if( cpy.m_pActor == NULL ) + m_pActor = NULL; + else + m_pActor = cpy.m_pActor->Copy(); +} + +AutoActor &AutoActor::operator=( const AutoActor &cpy ) +{ + Unload(); + + if( cpy.m_pActor == NULL ) + m_pActor = NULL; + else + m_pActor = cpy.m_pActor->Copy(); + return *this; +} + +void AutoActor::Load( Actor *pActor ) +{ + Unload(); + m_pActor = pActor; +} + +void AutoActor::Load( const RString &sPath ) +{ + Unload(); + m_pActor = ActorUtil::MakeActor( sPath ); + + // If a Condition is false, MakeActor will return NULL. + if( m_pActor == NULL ) + m_pActor = new Actor; +} + +void AutoActor::LoadB( const RString &sMetricsGroup, const RString &sElement ) +{ + ThemeManager::PathInfo pi; + bool b = THEME->GetPathInfo( pi, EC_BGANIMATIONS, sMetricsGroup, sElement ); + ASSERT( b ); + LuaThreadVariable var1( "MatchingMetricsGroup", pi.sMatchingMetricsGroup ); + LuaThreadVariable var2( "MatchingElement", pi.sMatchingElement ); + Load( pi.sResolvedPath ); +} + +void AutoActor::LoadActorFromNode( const XNode* pNode, Actor *pParent ) +{ + Unload(); + + m_pActor = ActorUtil::LoadFromNode( pNode, pParent ); +} + +void AutoActor::LoadAndSetName( const RString &sScreenName, const RString &sActorName ) +{ + Load( THEME->GetPathG(sScreenName,sActorName) ); + m_pActor->SetName( sActorName ); + ActorUtil::LoadAllCommands( *m_pActor, sScreenName ); +} + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AutoActor.h b/src/AutoActor.h index 6f5f4a1491..c2223e6711 100644 --- a/src/AutoActor.h +++ b/src/AutoActor.h @@ -1,66 +1,66 @@ -#ifndef AutoActor_H -#define AutoActor_H - -class Actor; -class XNode; - -/** - * @brief A smart pointer for Actor. - * - * This creates the appropriate Actor derivative on load and - * automatically deletes the Actor on deconstruction. */ -class AutoActor -{ -public: - AutoActor() { m_pActor = NULL; } - ~AutoActor() { Unload(); } - AutoActor( const AutoActor &cpy ); - AutoActor &operator =( const AutoActor &cpy ); - operator const Actor* () const { return m_pActor; } - operator Actor* () { return m_pActor; } - const Actor *operator->() const { return m_pActor; } - Actor *operator->() { return m_pActor; } - void Unload(); - /** - * @brief Determine if this actor is presently loaded. - * @return true if it is loaded, or false otherwise. */ - bool IsLoaded() const { return m_pActor != NULL; } - void Load( Actor *pActor ); // transfer pointer - void Load( const RString &sPath ); - void LoadB( const RString &sMetricsGroup, const RString &sElement ); // load a background and set up LuaThreadVariables for recursive loading - void LoadActorFromNode( const XNode *pNode, Actor *pParent ); - void LoadAndSetName( const RString &sScreenName, const RString &sActorName ); - -protected: - /** @brief the Actor for which there is a smart pointer to. */ - Actor* m_pActor; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef AutoActor_H +#define AutoActor_H + +class Actor; +class XNode; + +/** + * @brief A smart pointer for Actor. + * + * This creates the appropriate Actor derivative on load and + * automatically deletes the Actor on deconstruction. */ +class AutoActor +{ +public: + AutoActor() { m_pActor = NULL; } + ~AutoActor() { Unload(); } + AutoActor( const AutoActor &cpy ); + AutoActor &operator =( const AutoActor &cpy ); + operator const Actor* () const { return m_pActor; } + operator Actor* () { return m_pActor; } + const Actor *operator->() const { return m_pActor; } + Actor *operator->() { return m_pActor; } + void Unload(); + /** + * @brief Determine if this actor is presently loaded. + * @return true if it is loaded, or false otherwise. */ + bool IsLoaded() const { return m_pActor != NULL; } + void Load( Actor *pActor ); // transfer pointer + void Load( const RString &sPath ); + void LoadB( const RString &sMetricsGroup, const RString &sElement ); // load a background and set up LuaThreadVariables for recursive loading + void LoadActorFromNode( const XNode *pNode, Actor *pParent ); + void LoadAndSetName( const RString &sScreenName, const RString &sActorName ); + +protected: + /** @brief the Actor for which there is a smart pointer to. */ + Actor* m_pActor; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/AutoKeysounds.cpp b/src/AutoKeysounds.cpp index 76d6955598..b5558456cd 100644 --- a/src/AutoKeysounds.cpp +++ b/src/AutoKeysounds.cpp @@ -1,385 +1,385 @@ -/* - * This class handles two things: auto-play preload, and runtime auto-play sounds. - * - * On song start, all autoplay sounds and the main BGM track (if any) are combined - * into a single chain, which is used as the song background. Sounds added this way - * are removed from the NoteData. - * - * Any sounds not added to the sound chain and any autoplay sounds added to the NoteData - * during play (usually due to battle mode mods) are played dynamically, via Update(). - * - * Note that autoplay sounds which are played before the BGM starts will never be - * placed in the sound chain, since the sound chain becomes the BGM; the BGM can't - * play sound before it starts. These sounds will be left in the NoteData, and played - * as dynamic sounds; this means that they don't get robust sync. This isn't a problem - * for imported BMS files, which don't have an offset value, but it's annoying. - */ - -#include "global.h" -#include "AutoKeysounds.h" -#include "GameState.h" -#include "Song.h" -#include "RageSoundReader_Chain.h" -#include "RageSoundReader_ChannelSplit.h" -#include "RageSoundReader_Extend.h" -#include "RageSoundReader_Merge.h" -#include "RageSoundReader_Pan.h" -#include "RageSoundReader_PitchChange.h" -#include "RageSoundReader_PostBuffering.h" -#include "RageSoundReader_ThreadedBuffer.h" -#include "RageSoundManager.h" -#include "RageLog.h" -#include "RageSoundReader_FileReader.h" -#include "Foreach.h" - -void AutoKeysounds::Load( PlayerNumber pn, const NoteData& ndAutoKeysoundsOnly ) -{ - m_ndAutoKeysoundsOnly[pn] = ndAutoKeysoundsOnly; -} - -void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain ) -{ - // - // Load sounds. - // - Song* pSong = GAMESTATE->m_pCurSong; - RString sSongDir = pSong->GetSongDir(); - - /* - * Add all current autoplay sounds in both players to the chain. If a sound is - * common to both players, don't pan it; otherwise pan it to that player's side. - */ - int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->m_MasterPlayerNumber].GetNumTracks(); - for( int t = 0; t < iNumTracks; t++ ) - { - int iRow = -1; - while(1) - { - /* Find the next row that either player has a note on. */ - int iNextRow = INT_MAX; - FOREACH_EnabledPlayer(pn) - { - // XXX Hack. Enabled players need not have their own note data. - if( t >= m_ndAutoKeysoundsOnly[pn].GetNumTracks() ) - continue; - int iNextRowForPlayer = iRow; - if( m_ndAutoKeysoundsOnly[pn].GetNextTapNoteRowForTrack( t, iNextRowForPlayer ) ) - iNextRow = min( iNextRow, iNextRowForPlayer ); - } - - if( iNextRow == INT_MAX ) - break; - iRow = iNextRow; - - TapNote tn[NUM_PLAYERS]; - FOREACH_EnabledPlayer(pn) - tn[pn] = m_ndAutoKeysoundsOnly[pn].GetTapNote( t, iRow ); - - /* Do all enabled players have the same note here? (Having no note at all - * counts as having a different note.) */ - bool bSoundIsGlobal = true; - { - PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1); - const TapNote &tap = tn[pn]; - pn = GetNextEnabledPlayer(pn); - while( pn != PLAYER_INVALID ) - { - if( tn[pn].type != TapNote::autoKeysound || tn[pn].iKeysoundIndex != tap.iKeysoundIndex ) - bSoundIsGlobal = false; - pn = GetNextEnabledPlayer(pn); - } - } - - FOREACH_EnabledPlayer(pn) - { - if( tn[pn] == TAP_EMPTY ) - continue; - - ASSERT( tn[pn].type == TapNote::autoKeysound ); - if( tn[pn].iKeysoundIndex >= 0 ) - { - RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex]; - float fSeconds = pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(iRow) ); - - float fPan = 0; - if( !bSoundIsGlobal ) - fPan = (pn == PLAYER_1)? -1.0f:+1.0f; - int iIndex = pChain->LoadSound( sKeysoundFilePath ); - pChain->AddSound( iIndex, fSeconds, fPan ); - } - } - } - } -} - -void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, RageSoundReader *&pPlayer1, RageSoundReader *&pPlayer2 ) -{ - // If we have two players, prefer a three-track sound; otherwise prefer a - // two-track sound. - //bool bTwoPlayers = GAMESTATE->GetNumPlayersEnabled() == 2; - - pPlayer1 = NULL; - pPlayer2 = NULL; - pShared = NULL; - - vector vsMusicFile; - const RString sMusicPath = pSong->GetMusicPath(); - - if( !sMusicPath.empty() ) - vsMusicFile.push_back( sMusicPath ); - - FOREACH_ENUM( InstrumentTrack, it ) - { - if( it == InstrumentTrack_Guitar ) - continue; - if( pSong->HasInstrumentTrack(it) ) - vsMusicFile.push_back( pSong->GetInstrumentTrackPath(it) ); - } - - - vector vpSounds; - FOREACH( RString, vsMusicFile, s ) - { - RString sError; - RageSoundReader *pSongReader = RageSoundReader_FileReader::OpenFile( *s, sError ); - vpSounds.push_back( pSongReader ); - } - - if( vpSounds.size() == 1 ) - { - RageSoundReader *pSongReader = vpSounds[0]; - - // Load the buffering filter before the effects filters, so effects aren't delayed. - pSongReader = new RageSoundReader_Extend( pSongReader ); - pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader ); - pShared = pSongReader; - } - else if( !vpSounds.empty() ) - { - RageSoundReader_Merge *pMerge = new RageSoundReader_Merge; - - FOREACH( RageSoundReader *, vpSounds, so ) - pMerge->AddSound( *so ); - pMerge->Finish( SOUNDMAN->GetDriverSampleRate() ); - - RageSoundReader *pSongReader = pMerge; - - // Load the buffering filter before the effects filters, so effects aren't delayed. - pSongReader = new RageSoundReader_Extend( pSongReader ); - pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader ); - pShared = pSongReader; - } - - - if( pSong->HasInstrumentTrack(InstrumentTrack_Guitar) ) - { - RString sError; - RageSoundReader *pGuitarTrackReader = RageSoundReader_FileReader::OpenFile( pSong->GetInstrumentTrackPath(InstrumentTrack_Guitar), sError ); - // Load the buffering filter before the effects filters, so effects aren't delayed. - pGuitarTrackReader = new RageSoundReader_Extend( pGuitarTrackReader ); - pGuitarTrackReader = new RageSoundReader_ThreadedBuffer( pGuitarTrackReader ); - pPlayer1 = pGuitarTrackReader; - } - - return; - - //if( pSongReader->GetNumChannels() <= 2 ) - //{ - // /* If we only have one track, return it as the shared track. */ - // pShared = pSongReader; - // return; - //} - - // TODO: Make this work for player 2, and for 2 players - - /* The code below is used to split the main sound stream into per-player - * sounds. The results of this method doesn't seem interesting enough to - * bother supporting this. */ - - //RageSoundSplitter Splitter( pSongReader ); - - //RageSoundReader_Split *pMainSound = Splitter.CreateSound(); - //pMainSound->AddSourceChannelToSound( 0, 0 ); - //if( pSongReader->GetNumChannels() >= 2 ) // stereo - // pMainSound->AddSourceChannelToSound( 1, 1 ); - //pShared = pMainSound; - - //RageSoundReader_Split *pLeadSound = Splitter.CreateSound(); - //pLeadSound->AddSourceChannelToSound( 2, 0 ); - //if( pSongReader->GetNumChannels() >= 4 ) // stereo - // pLeadSound->AddSourceChannelToSound( 3, 1 ); - //pPlayer1 = pLeadSound; - - //if( pSongReader->GetNumChannels() >= 5 ) - //{ - // if( bTwoPlayers ) - // { - // RageSoundReader_Split *pSecondarySound = Splitter.CreateSound(); - // pSecondarySound->AddSourceChannelToSound( 4, 0 ); - // if( pSongReader->GetNumChannels() >= 6 ) - // pSecondarySound->AddSourceChannelToSound( 5, 1 ); // stereo - // else - // pSecondarySound->AddSourceChannelToSound( 4, 1 ); // mono - // pPlayer2 = pSecondarySound; - // } - // else - // { - // /* We have a secondary track, but we only have one player. Mix it into - // * the background track. */ - // pMainSound->AddSourceChannelToSound( 4, 0 ); - // if( pSongReader->GetNumChannels() >= 6 ) - // pMainSound->AddSourceChannelToSound( 5, 1 ); // stereo - // else - // pMainSound->AddSourceChannelToSound( 4, 1 ); // mono - // } - - //} - //else if( bTwoPlayers ) - //{ - // /* We have two players, but only two tracks. Use the same track for both - // * players. */ - // pPlayer2 = pPlayer1->Copy(); - // pPlayer1->SetProperty( "Balance", -1.0f ); - // pPlayer2->SetProperty( "Balance", +1.0f ); - //} -} - -void AutoKeysounds::FinishLoading() -{ - m_sSound.Unload(); - - Song* pSong = GAMESTATE->m_pCurSong; - - vector apSounds; - LoadTracks( pSong, m_pSharedSound, m_pPlayerSounds[0], m_pPlayerSounds[1] ); - - // Load autoplay sounds, if any. - { - RageSoundReader_Chain *pChain = new RageSoundReader_Chain; - pChain->SetPreferredSampleRate( SOUNDMAN->GetDriverSampleRate() ); - LoadAutoplaySoundsInto( pChain ); - - if( pChain->GetNumSounds() > 0 ) - { - if( m_pSharedSound ) - { - int iIndex = pChain->LoadSound( m_pSharedSound ); - pChain->AddSound( iIndex, 0.0f, 0 ); - } - pChain->Finish(); - m_pSharedSound = pChain; - } - else - { - delete pChain; - } - } - ASSERT( m_pSharedSound ); - - m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound ); - m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound ); - m_pSharedSound = new RageSoundReader_Pan( m_pSharedSound ); - apSounds.push_back( m_pSharedSound ); - - if( m_pPlayerSounds[0] != NULL ) - { - m_pPlayerSounds[0] = new RageSoundReader_PitchChange( m_pPlayerSounds[0] ); - m_pPlayerSounds[0] = new RageSoundReader_PostBuffering( m_pPlayerSounds[0] ); - m_pPlayerSounds[0] = new RageSoundReader_Pan( m_pPlayerSounds[0] ); - apSounds.push_back( m_pPlayerSounds[0] ); - } - - if( m_pPlayerSounds[1] != NULL ) - { - m_pPlayerSounds[1] = new RageSoundReader_PitchChange( m_pPlayerSounds[1] ); - m_pPlayerSounds[1] = new RageSoundReader_PostBuffering( m_pPlayerSounds[1] ); - m_pPlayerSounds[1] = new RageSoundReader_Pan( m_pPlayerSounds[1] ); - apSounds.push_back( m_pPlayerSounds[1] ); - } - - if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->m_MasterPlayerNumber == PLAYER_2 ) - swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] ); - - if( apSounds.size() > 1 ) - { - RageSoundReader_Merge *pMerge = new RageSoundReader_Merge; - - FOREACH( RageSoundReader *, apSounds, ps ) - pMerge->AddSound( *ps ); - - pMerge->Finish( SOUNDMAN->GetDriverSampleRate() ); - - m_pChain = pMerge; - } - else - { - ASSERT( !apSounds.empty() ); - m_pChain = apSounds[0]; - } - - m_sSound.LoadSoundReader( m_pChain ); -} - -void AutoKeysounds::Update( float fDelta ) -{ - // Play keysounds for crossed rows. -/* - bool bCrossedABeat = false; - { - float fPositionSeconds = GAMESTATE->m_fMusicSeconds; - float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ); - - int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); - iRowNow = max( 0, iRowNow ); - static int iRowLastCrossed = 0; - - float fBeatLast = roundf(NoteRowToBeat(iRowLastCrossed)); - float fBeatNow = roundf(NoteRowToBeat(iRowNow)); - - bCrossedABeat = fBeatLast != fBeatNow; - - FOREACH_EnabledPlayer( pn ) - { - const NoteData &nd = m_ndAutoKeysoundsOnly[pn]; - - for( int t=0; tm_pCurSong; + RString sSongDir = pSong->GetSongDir(); + + /* + * Add all current autoplay sounds in both players to the chain. If a sound is + * common to both players, don't pan it; otherwise pan it to that player's side. + */ + int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->m_MasterPlayerNumber].GetNumTracks(); + for( int t = 0; t < iNumTracks; t++ ) + { + int iRow = -1; + while(1) + { + /* Find the next row that either player has a note on. */ + int iNextRow = INT_MAX; + FOREACH_EnabledPlayer(pn) + { + // XXX Hack. Enabled players need not have their own note data. + if( t >= m_ndAutoKeysoundsOnly[pn].GetNumTracks() ) + continue; + int iNextRowForPlayer = iRow; + if( m_ndAutoKeysoundsOnly[pn].GetNextTapNoteRowForTrack( t, iNextRowForPlayer ) ) + iNextRow = min( iNextRow, iNextRowForPlayer ); + } + + if( iNextRow == INT_MAX ) + break; + iRow = iNextRow; + + TapNote tn[NUM_PLAYERS]; + FOREACH_EnabledPlayer(pn) + tn[pn] = m_ndAutoKeysoundsOnly[pn].GetTapNote( t, iRow ); + + /* Do all enabled players have the same note here? (Having no note at all + * counts as having a different note.) */ + bool bSoundIsGlobal = true; + { + PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1); + const TapNote &tap = tn[pn]; + pn = GetNextEnabledPlayer(pn); + while( pn != PLAYER_INVALID ) + { + if( tn[pn].type != TapNote::autoKeysound || tn[pn].iKeysoundIndex != tap.iKeysoundIndex ) + bSoundIsGlobal = false; + pn = GetNextEnabledPlayer(pn); + } + } + + FOREACH_EnabledPlayer(pn) + { + if( tn[pn] == TAP_EMPTY ) + continue; + + ASSERT( tn[pn].type == TapNote::autoKeysound ); + if( tn[pn].iKeysoundIndex >= 0 ) + { + RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex]; + float fSeconds = pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(iRow) ); + + float fPan = 0; + if( !bSoundIsGlobal ) + fPan = (pn == PLAYER_1)? -1.0f:+1.0f; + int iIndex = pChain->LoadSound( sKeysoundFilePath ); + pChain->AddSound( iIndex, fSeconds, fPan ); + } + } + } + } +} + +void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, RageSoundReader *&pPlayer1, RageSoundReader *&pPlayer2 ) +{ + // If we have two players, prefer a three-track sound; otherwise prefer a + // two-track sound. + //bool bTwoPlayers = GAMESTATE->GetNumPlayersEnabled() == 2; + + pPlayer1 = NULL; + pPlayer2 = NULL; + pShared = NULL; + + vector vsMusicFile; + const RString sMusicPath = pSong->GetMusicPath(); + + if( !sMusicPath.empty() ) + vsMusicFile.push_back( sMusicPath ); + + FOREACH_ENUM( InstrumentTrack, it ) + { + if( it == InstrumentTrack_Guitar ) + continue; + if( pSong->HasInstrumentTrack(it) ) + vsMusicFile.push_back( pSong->GetInstrumentTrackPath(it) ); + } + + + vector vpSounds; + FOREACH( RString, vsMusicFile, s ) + { + RString sError; + RageSoundReader *pSongReader = RageSoundReader_FileReader::OpenFile( *s, sError ); + vpSounds.push_back( pSongReader ); + } + + if( vpSounds.size() == 1 ) + { + RageSoundReader *pSongReader = vpSounds[0]; + + // Load the buffering filter before the effects filters, so effects aren't delayed. + pSongReader = new RageSoundReader_Extend( pSongReader ); + pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader ); + pShared = pSongReader; + } + else if( !vpSounds.empty() ) + { + RageSoundReader_Merge *pMerge = new RageSoundReader_Merge; + + FOREACH( RageSoundReader *, vpSounds, so ) + pMerge->AddSound( *so ); + pMerge->Finish( SOUNDMAN->GetDriverSampleRate() ); + + RageSoundReader *pSongReader = pMerge; + + // Load the buffering filter before the effects filters, so effects aren't delayed. + pSongReader = new RageSoundReader_Extend( pSongReader ); + pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader ); + pShared = pSongReader; + } + + + if( pSong->HasInstrumentTrack(InstrumentTrack_Guitar) ) + { + RString sError; + RageSoundReader *pGuitarTrackReader = RageSoundReader_FileReader::OpenFile( pSong->GetInstrumentTrackPath(InstrumentTrack_Guitar), sError ); + // Load the buffering filter before the effects filters, so effects aren't delayed. + pGuitarTrackReader = new RageSoundReader_Extend( pGuitarTrackReader ); + pGuitarTrackReader = new RageSoundReader_ThreadedBuffer( pGuitarTrackReader ); + pPlayer1 = pGuitarTrackReader; + } + + return; + + //if( pSongReader->GetNumChannels() <= 2 ) + //{ + // /* If we only have one track, return it as the shared track. */ + // pShared = pSongReader; + // return; + //} + + // TODO: Make this work for player 2, and for 2 players + + /* The code below is used to split the main sound stream into per-player + * sounds. The results of this method doesn't seem interesting enough to + * bother supporting this. */ + + //RageSoundSplitter Splitter( pSongReader ); + + //RageSoundReader_Split *pMainSound = Splitter.CreateSound(); + //pMainSound->AddSourceChannelToSound( 0, 0 ); + //if( pSongReader->GetNumChannels() >= 2 ) // stereo + // pMainSound->AddSourceChannelToSound( 1, 1 ); + //pShared = pMainSound; + + //RageSoundReader_Split *pLeadSound = Splitter.CreateSound(); + //pLeadSound->AddSourceChannelToSound( 2, 0 ); + //if( pSongReader->GetNumChannels() >= 4 ) // stereo + // pLeadSound->AddSourceChannelToSound( 3, 1 ); + //pPlayer1 = pLeadSound; + + //if( pSongReader->GetNumChannels() >= 5 ) + //{ + // if( bTwoPlayers ) + // { + // RageSoundReader_Split *pSecondarySound = Splitter.CreateSound(); + // pSecondarySound->AddSourceChannelToSound( 4, 0 ); + // if( pSongReader->GetNumChannels() >= 6 ) + // pSecondarySound->AddSourceChannelToSound( 5, 1 ); // stereo + // else + // pSecondarySound->AddSourceChannelToSound( 4, 1 ); // mono + // pPlayer2 = pSecondarySound; + // } + // else + // { + // /* We have a secondary track, but we only have one player. Mix it into + // * the background track. */ + // pMainSound->AddSourceChannelToSound( 4, 0 ); + // if( pSongReader->GetNumChannels() >= 6 ) + // pMainSound->AddSourceChannelToSound( 5, 1 ); // stereo + // else + // pMainSound->AddSourceChannelToSound( 4, 1 ); // mono + // } + + //} + //else if( bTwoPlayers ) + //{ + // /* We have two players, but only two tracks. Use the same track for both + // * players. */ + // pPlayer2 = pPlayer1->Copy(); + // pPlayer1->SetProperty( "Balance", -1.0f ); + // pPlayer2->SetProperty( "Balance", +1.0f ); + //} +} + +void AutoKeysounds::FinishLoading() +{ + m_sSound.Unload(); + + Song* pSong = GAMESTATE->m_pCurSong; + + vector apSounds; + LoadTracks( pSong, m_pSharedSound, m_pPlayerSounds[0], m_pPlayerSounds[1] ); + + // Load autoplay sounds, if any. + { + RageSoundReader_Chain *pChain = new RageSoundReader_Chain; + pChain->SetPreferredSampleRate( SOUNDMAN->GetDriverSampleRate() ); + LoadAutoplaySoundsInto( pChain ); + + if( pChain->GetNumSounds() > 0 ) + { + if( m_pSharedSound ) + { + int iIndex = pChain->LoadSound( m_pSharedSound ); + pChain->AddSound( iIndex, 0.0f, 0 ); + } + pChain->Finish(); + m_pSharedSound = pChain; + } + else + { + delete pChain; + } + } + ASSERT( m_pSharedSound ); + + m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound ); + m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound ); + m_pSharedSound = new RageSoundReader_Pan( m_pSharedSound ); + apSounds.push_back( m_pSharedSound ); + + if( m_pPlayerSounds[0] != NULL ) + { + m_pPlayerSounds[0] = new RageSoundReader_PitchChange( m_pPlayerSounds[0] ); + m_pPlayerSounds[0] = new RageSoundReader_PostBuffering( m_pPlayerSounds[0] ); + m_pPlayerSounds[0] = new RageSoundReader_Pan( m_pPlayerSounds[0] ); + apSounds.push_back( m_pPlayerSounds[0] ); + } + + if( m_pPlayerSounds[1] != NULL ) + { + m_pPlayerSounds[1] = new RageSoundReader_PitchChange( m_pPlayerSounds[1] ); + m_pPlayerSounds[1] = new RageSoundReader_PostBuffering( m_pPlayerSounds[1] ); + m_pPlayerSounds[1] = new RageSoundReader_Pan( m_pPlayerSounds[1] ); + apSounds.push_back( m_pPlayerSounds[1] ); + } + + if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->m_MasterPlayerNumber == PLAYER_2 ) + swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] ); + + if( apSounds.size() > 1 ) + { + RageSoundReader_Merge *pMerge = new RageSoundReader_Merge; + + FOREACH( RageSoundReader *, apSounds, ps ) + pMerge->AddSound( *ps ); + + pMerge->Finish( SOUNDMAN->GetDriverSampleRate() ); + + m_pChain = pMerge; + } + else + { + ASSERT( !apSounds.empty() ); + m_pChain = apSounds[0]; + } + + m_sSound.LoadSoundReader( m_pChain ); +} + +void AutoKeysounds::Update( float fDelta ) +{ + // Play keysounds for crossed rows. +/* + bool bCrossedABeat = false; + { + float fPositionSeconds = GAMESTATE->m_fMusicSeconds; + float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ); + + int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); + iRowNow = max( 0, iRowNow ); + static int iRowLastCrossed = 0; + + float fBeatLast = roundf(NoteRowToBeat(iRowLastCrossed)); + float fBeatNow = roundf(NoteRowToBeat(iRowNow)); + + bCrossedABeat = fBeatLast != fBeatNow; + + FOREACH_EnabledPlayer( pn ) + { + const NoteData &nd = m_ndAutoKeysoundsOnly[pn]; + + for( int t=0; t m_vKeysounds; - RageSound m_sSound; - RageSoundReader *m_pChain; // owned by m_sSound - RageSoundReader *m_pPlayerSounds[NUM_PLAYERS]; // owned by m_sSound - RageSoundReader *m_pSharedSound; // owned by m_sSound -}; - -#endif - -/** - * @file - * @author Chris Danford, Glenn Maynard (c) 2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef AUTO_KEYSOUNDS_H +#define AUTO_KEYSOUNDS_H + +#include "NoteData.h" +#include "PlayerNumber.h" +#include "RageSound.h" + +class RageSoundReader; +class RageSoundReader_Chain; +class Song; +/** @brief Handle playback of auto keysound notes. */ +class AutoKeysounds +{ +public: + void Load( PlayerNumber pn, const NoteData& ndAutoKeysoundsOnly ); + void Update( float fDelta ); + /** @brief Finish loading the main sounds, and setup the auto keysounds if any. */ + void FinishLoading(); + RageSound *GetSound() { return &m_sSound; } + RageSoundReader *GetSharedSound() { return m_pSharedSound; } + RageSoundReader *GetPlayerSound( PlayerNumber pn ) { if( pn == PLAYER_INVALID ) return NULL; return m_pPlayerSounds[pn]; } + +protected: + void LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain ); + static void LoadTracks( const Song *pSong, RageSoundReader *&pGlobal, RageSoundReader *&pPlayer1, RageSoundReader *&pPlayer2 ); + + NoteData m_ndAutoKeysoundsOnly[NUM_PLAYERS]; + vector m_vKeysounds; + RageSound m_sSound; + RageSoundReader *m_pChain; // owned by m_sSound + RageSoundReader *m_pPlayerSounds[NUM_PLAYERS]; // owned by m_sSound + RageSoundReader *m_pSharedSound; // owned by m_sSound +}; + +#endif + +/** + * @file + * @author Chris Danford, Glenn Maynard (c) 2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BGAnimation.cpp b/src/BGAnimation.cpp index eb4fc80c4e..46f5673913 100644 --- a/src/BGAnimation.cpp +++ b/src/BGAnimation.cpp @@ -1,193 +1,193 @@ -#include "global.h" -#include "BGAnimation.h" -#include "IniFile.h" -#include "BGAnimationLayer.h" -#include "RageUtil.h" -#include "ActorUtil.h" -#include "Foreach.h" -#include "LuaManager.h" - -REGISTER_ACTOR_CLASS(BGAnimation); - -BGAnimation::BGAnimation() -{ -} - -BGAnimation::~BGAnimation() -{ - DeleteAllChildren(); -} - -static bool CompareLayerNames( const RString& s1, const RString& s2 ) -{ - int i1, i2; - int ret; - - ret = sscanf( s1, "Layer%d", &i1 ); - ASSERT( ret == 1 ); - ret = sscanf( s2, "Layer%d", &i2 ); - ASSERT( ret == 1 ); - return i1 < i2; -} - -void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode ) -{ - const RString& sAniDir = _sAniDir; - - { - vector vsLayerNames; - FOREACH_CONST_Child( pNode, pLayer ) - { - if( strncmp(pLayer->GetName(), "Layer", 5) == 0 ) - vsLayerNames.push_back( pLayer->GetName() ); - } - - sort( vsLayerNames.begin(), vsLayerNames.end(), CompareLayerNames ); - - - FOREACH_CONST( RString, vsLayerNames, s ) - { - const RString &sLayer = *s; - const XNode* pKey = pNode->GetChild( sLayer ); - ASSERT( pKey ); - - RString sImportDir; - if( pKey->GetAttrValue("Import", sImportDir) ) - { - bool bCond; - if( pKey->GetAttrValue("Condition",bCond) && !bCond ) - continue; - - // import a whole BGAnimation - sImportDir = sAniDir + sImportDir; - CollapsePath( sImportDir ); - - if( sImportDir.Right(1) != "/" ) - sImportDir += "/"; - - ASSERT_M( IsADirectory(sImportDir), sImportDir + " isn't a directory" ); - - RString sPathToIni = sImportDir + "BGAnimation.ini"; - - IniFile ini2; - ini2.ReadFile( sPathToIni ); - - AddLayersFromAniDir( sImportDir, &ini2 ); - } - else - { - // import as a single layer - BGAnimationLayer* bgLayer = new BGAnimationLayer; - bgLayer->LoadFromNode( pKey ); - this->AddChild( bgLayer ); - } - } - } -} - -void BGAnimation::LoadFromAniDir( const RString &_sAniDir ) -{ - DeleteAllChildren(); - - if( _sAniDir.empty() ) - return; - - RString sAniDir = _sAniDir; - if( sAniDir.Right(1) != "/" ) - sAniDir += "/"; - - ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); - - RString sPathToIni = sAniDir + "BGAnimation.ini"; - - if( DoesFileExist(sPathToIni) ) - { - // This is a 3.9-style BGAnimation (using .ini) - IniFile ini; - ini.ReadFile( sPathToIni ); - - AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load - - XNode* pBGAnimation = ini.GetChild( "BGAnimation" ); - XNode dummy( "BGAnimation" ); - if( pBGAnimation == NULL ) - pBGAnimation = &dummy; - - LoadFromNode( pBGAnimation ); - } - else - { - // This is an 3.0 and before-style BGAnimation (not using .ini) - - // loading a directory of layers - vector asImagePaths; - ASSERT( sAniDir != "" ); - - GetDirListing( sAniDir+"*.png", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.jpg", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.gif", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.ogv", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.avi", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.mpg", asImagePaths, false, true ); - GetDirListing( sAniDir+"*.mpeg", asImagePaths, false, true ); - - SortRStringArray( asImagePaths ); - - for( unsigned i=0; iLoadFromAniLayerFile( asImagePaths[i] ); - AddChild( pLayer ); - } - } -} - -void BGAnimation::LoadFromNode( const XNode* pNode ) -{ - RString sDir; - if( pNode->GetAttrValue("AniDir", sDir) ) - LoadFromAniDir( sDir ); - - ActorFrame::LoadFromNode( pNode ); - - /* Backwards-compatibility: if a "LengthSeconds" value is present, create a dummy - * actor that sleeps for the given length of time. This will extend GetTweenTimeLeft. */ - float fLengthSeconds = 0; - if( pNode->GetAttrValue( "LengthSeconds", fLengthSeconds ) ) - { - Actor *pActor = new Actor; - pActor->SetName( "BGAnimation dummy" ); - pActor->SetVisible( false ); - apActorCommands ap = ActorUtil::ParseActorCommands( ssprintf("sleep,%f",fLengthSeconds) ); - pActor->AddCommand( "On", ap ); - AddChild( pActor ); - } -} - -/* - * (c) 2001-2004 Ben Nordstrom, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "BGAnimation.h" +#include "IniFile.h" +#include "BGAnimationLayer.h" +#include "RageUtil.h" +#include "ActorUtil.h" +#include "Foreach.h" +#include "LuaManager.h" + +REGISTER_ACTOR_CLASS(BGAnimation); + +BGAnimation::BGAnimation() +{ +} + +BGAnimation::~BGAnimation() +{ + DeleteAllChildren(); +} + +static bool CompareLayerNames( const RString& s1, const RString& s2 ) +{ + int i1, i2; + int ret; + + ret = sscanf( s1, "Layer%d", &i1 ); + ASSERT( ret == 1 ); + ret = sscanf( s2, "Layer%d", &i2 ); + ASSERT( ret == 1 ); + return i1 < i2; +} + +void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode ) +{ + const RString& sAniDir = _sAniDir; + + { + vector vsLayerNames; + FOREACH_CONST_Child( pNode, pLayer ) + { + if( strncmp(pLayer->GetName(), "Layer", 5) == 0 ) + vsLayerNames.push_back( pLayer->GetName() ); + } + + sort( vsLayerNames.begin(), vsLayerNames.end(), CompareLayerNames ); + + + FOREACH_CONST( RString, vsLayerNames, s ) + { + const RString &sLayer = *s; + const XNode* pKey = pNode->GetChild( sLayer ); + ASSERT( pKey ); + + RString sImportDir; + if( pKey->GetAttrValue("Import", sImportDir) ) + { + bool bCond; + if( pKey->GetAttrValue("Condition",bCond) && !bCond ) + continue; + + // import a whole BGAnimation + sImportDir = sAniDir + sImportDir; + CollapsePath( sImportDir ); + + if( sImportDir.Right(1) != "/" ) + sImportDir += "/"; + + ASSERT_M( IsADirectory(sImportDir), sImportDir + " isn't a directory" ); + + RString sPathToIni = sImportDir + "BGAnimation.ini"; + + IniFile ini2; + ini2.ReadFile( sPathToIni ); + + AddLayersFromAniDir( sImportDir, &ini2 ); + } + else + { + // import as a single layer + BGAnimationLayer* bgLayer = new BGAnimationLayer; + bgLayer->LoadFromNode( pKey ); + this->AddChild( bgLayer ); + } + } + } +} + +void BGAnimation::LoadFromAniDir( const RString &_sAniDir ) +{ + DeleteAllChildren(); + + if( _sAniDir.empty() ) + return; + + RString sAniDir = _sAniDir; + if( sAniDir.Right(1) != "/" ) + sAniDir += "/"; + + ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); + + RString sPathToIni = sAniDir + "BGAnimation.ini"; + + if( DoesFileExist(sPathToIni) ) + { + // This is a 3.9-style BGAnimation (using .ini) + IniFile ini; + ini.ReadFile( sPathToIni ); + + AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load + + XNode* pBGAnimation = ini.GetChild( "BGAnimation" ); + XNode dummy( "BGAnimation" ); + if( pBGAnimation == NULL ) + pBGAnimation = &dummy; + + LoadFromNode( pBGAnimation ); + } + else + { + // This is an 3.0 and before-style BGAnimation (not using .ini) + + // loading a directory of layers + vector asImagePaths; + ASSERT( sAniDir != "" ); + + GetDirListing( sAniDir+"*.png", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.jpg", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.gif", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.ogv", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.avi", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.mpg", asImagePaths, false, true ); + GetDirListing( sAniDir+"*.mpeg", asImagePaths, false, true ); + + SortRStringArray( asImagePaths ); + + for( unsigned i=0; iLoadFromAniLayerFile( asImagePaths[i] ); + AddChild( pLayer ); + } + } +} + +void BGAnimation::LoadFromNode( const XNode* pNode ) +{ + RString sDir; + if( pNode->GetAttrValue("AniDir", sDir) ) + LoadFromAniDir( sDir ); + + ActorFrame::LoadFromNode( pNode ); + + /* Backwards-compatibility: if a "LengthSeconds" value is present, create a dummy + * actor that sleeps for the given length of time. This will extend GetTweenTimeLeft. */ + float fLengthSeconds = 0; + if( pNode->GetAttrValue( "LengthSeconds", fLengthSeconds ) ) + { + Actor *pActor = new Actor; + pActor->SetName( "BGAnimation dummy" ); + pActor->SetVisible( false ); + apActorCommands ap = ActorUtil::ParseActorCommands( ssprintf("sleep,%f",fLengthSeconds) ); + pActor->AddCommand( "On", ap ); + AddChild( pActor ); + } +} + +/* + * (c) 2001-2004 Ben Nordstrom, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BGAnimation.h b/src/BGAnimation.h index 604403f3c3..db203eac50 100644 --- a/src/BGAnimation.h +++ b/src/BGAnimation.h @@ -1,51 +1,51 @@ -#ifndef BGANIMATION_H -#define BGANIMATION_H - -#include "ActorFrame.h" - -class XNode; - -/** @brief An ActorFrame that loads itself. */ -class BGAnimation : public ActorFrameAutoDeleteChildren -{ -public: - BGAnimation(); - virtual ~BGAnimation(); - - void LoadFromAniDir( const RString &sAniDir ); - void LoadFromNode( const XNode* pNode ); - - virtual BGAnimation *Copy() const; - -protected: - void AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode ); -}; - -#endif - -/** - * @file - * @author Ben Nordstrom, Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BGANIMATION_H +#define BGANIMATION_H + +#include "ActorFrame.h" + +class XNode; + +/** @brief An ActorFrame that loads itself. */ +class BGAnimation : public ActorFrameAutoDeleteChildren +{ +public: + BGAnimation(); + virtual ~BGAnimation(); + + void LoadFromAniDir( const RString &sAniDir ); + void LoadFromNode( const XNode* pNode ); + + virtual BGAnimation *Copy() const; + +protected: + void AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNode ); +}; + +#endif + +/** + * @file + * @author Ben Nordstrom, Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BGAnimationLayer.cpp b/src/BGAnimationLayer.cpp index 62dc2b8013..1d78d92d73 100644 --- a/src/BGAnimationLayer.cpp +++ b/src/BGAnimationLayer.cpp @@ -1,671 +1,671 @@ -#include "global.h" -#include "BGAnimationLayer.h" -#include "GameState.h" -#include "XmlFile.h" -#include "RageMath.h" -#include "RageLog.h" -#include "Song.h" -#include "ScreenDimensions.h" -#include "Sprite.h" -#include "RageDisplay.h" -#include "ActorUtil.h" -#include "arch/ArchHooks/ArchHooks.h" -#include "LuaManager.h" -#include "AutoActor.h" -#include "ThemeManager.h" - - -const float PARTICLE_SPEED = 300; - -const float SPIRAL_MAX_ZOOM = 2; -const float SPIRAL_MIN_ZOOM = 0.3f; - -#define MAX_TILES_WIDE int(SCREEN_WIDTH/32+2) -#define MAX_TILES_HIGH int(SCREEN_HEIGHT/32+2) -#define MAX_SPRITES (MAX_TILES_WIDE*MAX_TILES_HIGH) - -inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; } -inline float GetOffScreenRight( Actor* pActor ) { return SCREEN_RIGHT + pActor->GetZoomedWidth()/2; } -inline float GetOffScreenTop( Actor* pActor ) { return SCREEN_TOP - pActor->GetZoomedHeight()/2; } -inline float GetOffScreenBottom(Actor* pActor ) { return SCREEN_BOTTOM+ pActor->GetZoomedHeight()/2; } - -inline bool IsOffScreenLeft( Actor* pActor ) { return pActor->GetX() < GetOffScreenLeft(pActor); } -inline bool IsOffScreenRight( Actor* pActor ) { return pActor->GetX() > GetOffScreenRight(pActor); } -inline bool IsOffScreenTop( Actor* pActor ) { return pActor->GetY() < GetOffScreenTop(pActor); } -inline bool IsOffScreenBottom(Actor* pActor ) { return pActor->GetY() > GetOffScreenBottom(pActor); } -inline bool IsOffScreen( Actor* pActor ) { return IsOffScreenLeft(pActor) || IsOffScreenRight(pActor) || IsOffScreenTop(pActor) || IsOffScreenBottom(pActor); } - -// guard rail is the area that keeps particles from going off screen -inline float GetGuardRailLeft( Actor* pActor ) { return SCREEN_LEFT + pActor->GetZoomedWidth()/2; } -inline float GetGuardRailRight( Actor* pActor ) { return SCREEN_RIGHT - pActor->GetZoomedWidth()/2; } -inline float GetGuardRailTop( Actor* pActor ) { return SCREEN_TOP + pActor->GetZoomedHeight()/2; } -inline float GetGuardRailBottom(Actor* pActor ) { return SCREEN_BOTTOM- pActor->GetZoomedHeight()/2; } - -inline bool HitGuardRailLeft( Actor* pActor ) { return pActor->GetX() < GetGuardRailLeft(pActor); } -inline bool HitGuardRailRight( Actor* pActor ) { return pActor->GetX() > GetGuardRailRight(pActor); } -inline bool HitGuardRailTop( Actor* pActor ) { return pActor->GetY() < GetGuardRailTop(pActor); } -inline bool HitGuardRailBottom(Actor* pActor ) { return pActor->GetY() > GetGuardRailBottom(pActor); } - -BGAnimationLayer::BGAnimationLayer() -{ - m_vParticleVelocity.clear(); - - m_Type = TYPE_SPRITE; - - m_fTexCoordVelocityX = 0; - m_fTexCoordVelocityY = 0; - m_bParticlesBounce = false; - m_iNumTilesWide = -1; - m_iNumTilesHigh = -1; - m_fTilesStartX = 0; - m_fTilesStartY = 0; - m_fTilesSpacingX = -1; - m_fTilesSpacingY = -1; - m_fTileVelocityX = 0; - m_fTileVelocityY = 0; -} - -BGAnimationLayer::~BGAnimationLayer() -{ - ActorFrame::DeleteAllChildren(); -} - -void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath ) -{ - /* Generic BGAs are new. Animation directories with no INI are old and obsolete. - * Don't combine them. */ - RString lcPath = sPath; - lcPath.MakeLower(); - - if( lcPath.find("usesongbg") != RString::npos ) - { - const Song* pSong = GAMESTATE->m_pCurSong; - RString sSongBGPath; - if( pSong && pSong->HasBackground() ) - sSongBGPath = pSong->GetBackgroundPath(); - else - sSongBGPath = THEME->GetPathG("Common","fallback background"); - - Sprite* pSprite = new Sprite; - pSprite->Load( Sprite::SongBGTexture(sSongBGPath) ); - pSprite->StretchTo( FullScreenRectF ); - this->AddChild( pSprite ); - - return; // this will ignore other effects in the file name - } - - enum Effect { - EFFECT_CENTER, - EFFECT_STRETCH_STILL, - EFFECT_STRETCH_SCROLL_LEFT, - EFFECT_STRETCH_SCROLL_RIGHT, - EFFECT_STRETCH_SCROLL_UP, - EFFECT_STRETCH_SCROLL_DOWN, - EFFECT_STRETCH_WATER, - EFFECT_STRETCH_BUBBLE, - EFFECT_STRETCH_TWIST, - EFFECT_STRETCH_SPIN, - EFFECT_PARTICLES_SPIRAL_OUT, - EFFECT_PARTICLES_SPIRAL_IN, - EFFECT_PARTICLES_FLOAT_UP, - EFFECT_PARTICLES_FLOAT_DOWN, - EFFECT_PARTICLES_FLOAT_LEFT, - EFFECT_PARTICLES_FLOAT_RIGHT, - EFFECT_PARTICLES_BOUNCE, - EFFECT_TILE_STILL, - EFFECT_TILE_SCROLL_LEFT, - EFFECT_TILE_SCROLL_RIGHT, - EFFECT_TILE_SCROLL_UP, - EFFECT_TILE_SCROLL_DOWN, - EFFECT_TILE_FLIP_X, - EFFECT_TILE_FLIP_Y, - EFFECT_TILE_PULSE, - NUM_EFFECTS, // leave this at the end - EFFECT_INVALID - }; - - const RString EFFECT_STRING[NUM_EFFECTS] = { - "center", - "stretchstill", - "stretchscrollleft", - "stretchscrollright", - "stretchscrollup", - "stretchscrolldown", - "stretchwater", - "stretchbubble", - "stretchtwist", - "stretchspin", - "particlesspiralout", - "particlesspiralin", - "particlesfloatup", - "particlesfloatdown", - "particlesfloatleft", - "particlesfloatright", - "particlesbounce", - "tilestill", - "tilescrollleft", - "tilescrollright", - "tilescrollup", - "tilescrolldown", - "tileflipx", - "tileflipy", - "tilepulse", - }; - - Effect effect = EFFECT_CENTER; - - for( int i=0; iAddChild( pSprite ); - pSprite->Load( sPath ); - pSprite->SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y ); - } - break; - case EFFECT_STRETCH_STILL: - case EFFECT_STRETCH_SCROLL_LEFT: - case EFFECT_STRETCH_SCROLL_RIGHT: - case EFFECT_STRETCH_SCROLL_UP: - case EFFECT_STRETCH_SCROLL_DOWN: - case EFFECT_STRETCH_WATER: - case EFFECT_STRETCH_BUBBLE: - case EFFECT_STRETCH_TWIST: - { - m_Type = TYPE_SPRITE; - Sprite* pSprite = new Sprite; - this->AddChild( pSprite ); - RageTextureID ID(sPath); - ID.bStretch = true; - pSprite->Load( Sprite::SongBGTexture(ID) ); - pSprite->StretchTo( FullScreenRectF ); - pSprite->SetCustomTextureRect( RectF(0,0,1,1) ); - - switch( effect ) - { - case EFFECT_STRETCH_SCROLL_LEFT: m_fTexCoordVelocityX = +0.5f; m_fTexCoordVelocityY = 0; break; - case EFFECT_STRETCH_SCROLL_RIGHT: m_fTexCoordVelocityX = -0.5f; m_fTexCoordVelocityY = 0; break; - case EFFECT_STRETCH_SCROLL_UP: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = +0.5f; break; - case EFFECT_STRETCH_SCROLL_DOWN: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = -0.5f; break; - break; - } - } - break; - case EFFECT_STRETCH_SPIN: - { - m_Type = TYPE_SPRITE; - Sprite* pSprite = new Sprite; - this->AddChild( pSprite ); - pSprite->Load( Sprite::SongBGTexture(sPath) ); - const RectF StretchedFullScreenRectF( - FullScreenRectF.left-200, - FullScreenRectF.top-200, - FullScreenRectF.right+200, - FullScreenRectF.bottom+200 ); - - pSprite->ScaleToCover( StretchedFullScreenRectF ); - pSprite->SetEffectSpin( RageVector3(0,0,60) ); - } - break; - case EFFECT_PARTICLES_SPIRAL_OUT: - case EFFECT_PARTICLES_SPIRAL_IN: - case EFFECT_PARTICLES_FLOAT_UP: - case EFFECT_PARTICLES_FLOAT_DOWN: - case EFFECT_PARTICLES_FLOAT_LEFT: - case EFFECT_PARTICLES_FLOAT_RIGHT: - case EFFECT_PARTICLES_BOUNCE: - { - m_Type = TYPE_PARTICLES; - Sprite s; - s.Load( sPath ); - int iSpriteArea = int( s.GetUnzoomedWidth()*s.GetUnzoomedHeight() ); - const int iMaxArea = int(SCREEN_WIDTH*SCREEN_HEIGHT); - int iNumParticles = iMaxArea / iSpriteArea; - iNumParticles = min( iNumParticles, MAX_SPRITES ); - - for( int i=0; iAddChild( pSprite ); - pSprite->Load( sPath ); - pSprite->SetZoom( 0.7f + 0.6f*i/(float)iNumParticles ); - switch( effect ) - { - case EFFECT_PARTICLES_BOUNCE: - pSprite->SetX( randomf( GetGuardRailLeft(pSprite), GetGuardRailRight(pSprite) ) ); - pSprite->SetY( randomf( GetGuardRailTop(pSprite), GetGuardRailBottom(pSprite) ) ); - break; - default: - pSprite->SetX( randomf( GetOffScreenLeft(pSprite), GetOffScreenRight(pSprite) ) ); - pSprite->SetY( randomf( GetOffScreenTop(pSprite), GetOffScreenBottom(pSprite) ) ); - break; - } - - switch( effect ) - { - case EFFECT_PARTICLES_FLOAT_UP: - case EFFECT_PARTICLES_SPIRAL_OUT: - m_vParticleVelocity.push_back( RageVector3( 0, -PARTICLE_SPEED*pSprite->GetZoom(), 0 ) ); - break; - case EFFECT_PARTICLES_FLOAT_DOWN: - case EFFECT_PARTICLES_SPIRAL_IN: - m_vParticleVelocity.push_back( RageVector3( 0, PARTICLE_SPEED*pSprite->GetZoom(), 0 ) ); - break; - case EFFECT_PARTICLES_FLOAT_LEFT: - m_vParticleVelocity.push_back( RageVector3( -PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 ) ); - break; - case EFFECT_PARTICLES_FLOAT_RIGHT: - m_vParticleVelocity.push_back( RageVector3( +PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 ) ); - break; - case EFFECT_PARTICLES_BOUNCE: - m_bParticlesBounce = true; - pSprite->SetZoom( 1 ); - m_vParticleVelocity.push_back( RageVector3( randomf(), randomf(), 0 ) ); - RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] ); - m_vParticleVelocity[i].x *= PARTICLE_SPEED; - m_vParticleVelocity[i].y *= PARTICLE_SPEED; - break; - default: - ASSERT(0); - } - } - } - break; - case EFFECT_TILE_STILL: - case EFFECT_TILE_SCROLL_LEFT: - case EFFECT_TILE_SCROLL_RIGHT: - case EFFECT_TILE_SCROLL_UP: - case EFFECT_TILE_SCROLL_DOWN: - case EFFECT_TILE_FLIP_X: - case EFFECT_TILE_FLIP_Y: - case EFFECT_TILE_PULSE: - { - m_Type = TYPE_TILES; - RageTextureID ID(sPath); - ID.bStretch = true; - Sprite s; - s.Load( ID ); - m_iNumTilesWide = 2+int(SCREEN_WIDTH /s.GetUnzoomedWidth()); - m_iNumTilesWide = min( m_iNumTilesWide, MAX_TILES_WIDE ); - m_iNumTilesHigh = 2+int(SCREEN_HEIGHT/s.GetUnzoomedHeight()); - m_iNumTilesHigh = min( m_iNumTilesHigh, MAX_TILES_HIGH ); - m_fTilesStartX = s.GetUnzoomedWidth() / 2; - m_fTilesStartY = s.GetUnzoomedHeight() / 2; - m_fTilesSpacingX = s.GetUnzoomedWidth(); - m_fTilesSpacingY = s.GetUnzoomedHeight(); - for( int x=0; xAddChild( pSprite ); - pSprite->Load( ID ); - pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" - - switch( effect ) - { - case EFFECT_TILE_STILL: - break; - case EFFECT_TILE_SCROLL_LEFT: - m_fTileVelocityX = -PARTICLE_SPEED; - break; - case EFFECT_TILE_SCROLL_RIGHT: - m_fTileVelocityX = +PARTICLE_SPEED; - break; - case EFFECT_TILE_SCROLL_UP: - m_fTileVelocityY = -PARTICLE_SPEED; - break; - case EFFECT_TILE_SCROLL_DOWN: - m_fTileVelocityY = +PARTICLE_SPEED; - break; - case EFFECT_TILE_FLIP_X: - pSprite->SetEffectSpin( RageVector3(180,0,0) ); - break; - case EFFECT_TILE_FLIP_Y: - pSprite->SetEffectSpin( RageVector3(0,180,0) ); - break; - case EFFECT_TILE_PULSE: - pSprite->SetEffectPulse( 1, 0.3f, 1.f ); - break; - default: - ASSERT(0); - } - } - } - } - break; - default: - ASSERT(0); - } - - - RString sHint = sPath; - sHint.MakeLower(); - - if( sHint.find("cyclecolor") != RString::npos ) - for( unsigned i=0; iSetEffectRainbow( 5 ); - - if( sHint.find("cyclealpha") != RString::npos ) - for( unsigned i=0; iSetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) ); - - if( sHint.find("startonrandomframe") != RString::npos ) - for( unsigned i=0; iSetState( RandomInt(m_SubActors[i]->GetNumStates()) ); - - if( sHint.find("dontanimate") != RString::npos ) - for( unsigned i=0; iStopAnimating(); - - if( sHint.find("add") != RString::npos ) - for( unsigned i=0; iSetBlendMode( BLEND_ADD ); -} - -void BGAnimationLayer::LoadFromNode( const XNode* pNode ) -{ - { - bool bCond; - if( pNode->GetAttrValue("Condition", bCond) && !bCond ) - return; - } - - bool bStretch = false; - { - RString type = "sprite"; - pNode->GetAttrValue( "Type", type ); - type.MakeLower(); - - /* The preferred way of stretching a sprite to fit the screen is "Type=sprite" - * and "stretch=1". "type=1" is for backwards-compatibility. */ - pNode->GetAttrValue( "Stretch", bStretch ); - - // Check for string match first, then do integer match. - // "if(atoi(type)==0)" was matching against all string matches. - // -Chris - if( stricmp(type,"sprite")==0 ) - { - m_Type = TYPE_SPRITE; - } - else if( stricmp(type,"particles")==0 ) - { - m_Type = TYPE_PARTICLES; - } - else if( stricmp(type,"tiles")==0 ) - { - m_Type = TYPE_TILES; - } - else if( atoi(type) == 1 ) - { - m_Type = TYPE_SPRITE; - bStretch = true; - } - else if( atoi(type) == 2 ) - { - m_Type = TYPE_PARTICLES; - } - else if( atoi(type) == 3 ) - { - m_Type = TYPE_TILES; - } - else - { - m_Type = TYPE_SPRITE; - } - } - - pNode->GetAttrValue( "FOV", m_fFOV ); - pNode->GetAttrValue( "Lighting", m_bLighting ); - - pNode->GetAttrValue( "TexCoordVelocityX", m_fTexCoordVelocityX ); - pNode->GetAttrValue( "TexCoordVelocityY", m_fTexCoordVelocityY ); - - // compat: - pNode->GetAttrValue( "StretchTexCoordVelocityX", m_fTexCoordVelocityX ); - pNode->GetAttrValue( "StretchTexCoordVelocityY", m_fTexCoordVelocityY ); - - // particle and tile stuff - float fZoomMin = 1; - float fZoomMax = 1; - pNode->GetAttrValue( "ZoomMin", fZoomMin ); - pNode->GetAttrValue( "ZoomMax", fZoomMax ); - - float fVelocityXMin = 10, fVelocityXMax = 10; - float fVelocityYMin = 0, fVelocityYMax = 0; - float fVelocityZMin = 0, fVelocityZMax = 0; - float fOverrideSpeed = 0; // 0 means don't override speed - pNode->GetAttrValue( "VelocityXMin", fVelocityXMin ); - pNode->GetAttrValue( "VelocityXMax", fVelocityXMax ); - pNode->GetAttrValue( "VelocityYMin", fVelocityYMin ); - pNode->GetAttrValue( "VelocityYMax", fVelocityYMax ); - pNode->GetAttrValue( "VelocityZMin", fVelocityZMin ); - pNode->GetAttrValue( "VelocityZMax", fVelocityZMax ); - pNode->GetAttrValue( "OverrideSpeed", fOverrideSpeed ); - - int iNumParticles = 10; - pNode->GetAttrValue( "NumParticles", iNumParticles ); - - pNode->GetAttrValue( "ParticlesBounce", m_bParticlesBounce ); - pNode->GetAttrValue( "TilesStartX", m_fTilesStartX ); - pNode->GetAttrValue( "TilesStartY", m_fTilesStartY ); - pNode->GetAttrValue( "TilesSpacingX", m_fTilesSpacingX ); - pNode->GetAttrValue( "TilesSpacingY", m_fTilesSpacingY ); - pNode->GetAttrValue( "TileVelocityX", m_fTileVelocityX ); - pNode->GetAttrValue( "TileVelocityY", m_fTileVelocityY ); - - - switch( m_Type ) - { - case TYPE_SPRITE: - { - Actor* pActor = ActorUtil::LoadFromNode( pNode, this ); - this->AddChild( pActor ); - if( bStretch ) - pActor->StretchTo( FullScreenRectF ); - } - break; - case TYPE_PARTICLES: - { - RString sFile; - ActorUtil::GetAttrPath( pNode, "File", sFile ); - FixSlashesInPlace( sFile ); - - CollapsePath( sFile ); - - for( int i=0; iAddChild( pActor ); - pActor->SetXY( randomf(float(FullScreenRectF.left),float(FullScreenRectF.right)), - randomf(float(FullScreenRectF.top),float(FullScreenRectF.bottom)) ); - pActor->SetZoom( randomf(fZoomMin,fZoomMax) ); - m_vParticleVelocity.push_back( RageVector3( - randomf(fVelocityXMin,fVelocityXMax), - randomf(fVelocityYMin,fVelocityYMax), - randomf(fVelocityZMin,fVelocityZMax) ) ); - if( fOverrideSpeed != 0 ) - { - RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] ); - m_vParticleVelocity[i] *= fOverrideSpeed; - } - } - } - break; - case TYPE_TILES: - { - RString sFile; - ActorUtil::GetAttrPath( pNode, "File", sFile ); - FixSlashesInPlace( sFile ); - - CollapsePath( sFile ); - - AutoActor s; - s.Load( sFile ); - if( m_fTilesSpacingX == -1 ) - m_fTilesSpacingX = s->GetUnzoomedWidth(); - if( m_fTilesSpacingY == -1 ) - m_fTilesSpacingY = s->GetUnzoomedHeight(); - m_iNumTilesWide = 2+(int)(SCREEN_WIDTH /m_fTilesSpacingX); - m_iNumTilesHigh = 2+(int)(SCREEN_HEIGHT/m_fTilesSpacingY); - unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh; - for( unsigned i=0; iAddChild( pSprite ); - pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" - pSprite->SetZoom( randomf(fZoomMin,fZoomMax) ); - } - } - break; - default: - ASSERT(0); - } - - bool bStartOnRandomFrame = false; - pNode->GetAttrValue( "StartOnRandomFrame", bStartOnRandomFrame ); - if( bStartOnRandomFrame ) - { - for( unsigned i=0; iSetState( RandomInt(m_SubActors[i]->GetNumStates()) ); - } -} - -void BGAnimationLayer::UpdateInternal( float fDeltaTime ) -{ - ActorFrame::UpdateInternal( fDeltaTime ); - - fDeltaTime *= m_fUpdateRate; - - switch( m_Type ) - { - case TYPE_SPRITE: - if( m_fTexCoordVelocityX || m_fTexCoordVelocityY ) - { - for( unsigned i=0; iStretchTexCoords( - fDeltaTime*m_fTexCoordVelocityX, - fDeltaTime*m_fTexCoordVelocityY ); - } - } - break; - case TYPE_PARTICLES: - for( unsigned i=0; iSetX( pActor->GetX() + fDeltaTime*vel.x ); - m_SubActors[i]->SetY( pActor->GetY() + fDeltaTime*vel.y ); - pActor->SetZ( pActor->GetZ() + fDeltaTime*vel.z ); - if( m_bParticlesBounce ) - { - if( HitGuardRailLeft(pActor) ) - { - vel.x *= -1; - pActor->SetX( GetGuardRailLeft(pActor) ); - } - if( HitGuardRailRight(pActor) ) - { - vel.x *= -1; - pActor->SetX( GetGuardRailRight(pActor) ); - } - if( HitGuardRailTop(pActor) ) - { - vel.y *= -1; - pActor->SetY( GetGuardRailTop(pActor) ); - } - if( HitGuardRailBottom(pActor) ) - { - vel.y *= -1; - pActor->SetY( GetGuardRailBottom(pActor) ); - } - } - else // !m_bParticlesBounce - { - if( vel.x<0 && IsOffScreenLeft(pActor) ) - pActor->SetX( GetOffScreenRight(pActor) ); - if( vel.x>0 && IsOffScreenRight(pActor) ) - pActor->SetX( GetOffScreenLeft(pActor) ); - if( vel.y<0 && IsOffScreenTop(pActor) ) - pActor->SetY( GetOffScreenBottom(pActor) ); - if( vel.y>0 && IsOffScreenBottom(pActor) ) - pActor->SetY( GetOffScreenTop(pActor) ); - } - } - break; - case TYPE_TILES: - { - float fSecs = RageTimer::GetTimeSinceStartFast(); - float fTotalWidth = m_iNumTilesWide * m_fTilesSpacingX; - float fTotalHeight = m_iNumTilesHigh * m_fTilesSpacingY; - - ASSERT( int(m_SubActors.size()) == m_iNumTilesWide * m_iNumTilesHigh ); - - for( int x=0; xSetX( fX ); - m_SubActors[i]->SetY( fY ); - } - } - } - break; - default: - ASSERT(0); - } -} - -/* - * (c) 2001-2004 Ben Nordstrom, Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "BGAnimationLayer.h" +#include "GameState.h" +#include "XmlFile.h" +#include "RageMath.h" +#include "RageLog.h" +#include "Song.h" +#include "ScreenDimensions.h" +#include "Sprite.h" +#include "RageDisplay.h" +#include "ActorUtil.h" +#include "arch/ArchHooks/ArchHooks.h" +#include "LuaManager.h" +#include "AutoActor.h" +#include "ThemeManager.h" + + +const float PARTICLE_SPEED = 300; + +const float SPIRAL_MAX_ZOOM = 2; +const float SPIRAL_MIN_ZOOM = 0.3f; + +#define MAX_TILES_WIDE int(SCREEN_WIDTH/32+2) +#define MAX_TILES_HIGH int(SCREEN_HEIGHT/32+2) +#define MAX_SPRITES (MAX_TILES_WIDE*MAX_TILES_HIGH) + +inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; } +inline float GetOffScreenRight( Actor* pActor ) { return SCREEN_RIGHT + pActor->GetZoomedWidth()/2; } +inline float GetOffScreenTop( Actor* pActor ) { return SCREEN_TOP - pActor->GetZoomedHeight()/2; } +inline float GetOffScreenBottom(Actor* pActor ) { return SCREEN_BOTTOM+ pActor->GetZoomedHeight()/2; } + +inline bool IsOffScreenLeft( Actor* pActor ) { return pActor->GetX() < GetOffScreenLeft(pActor); } +inline bool IsOffScreenRight( Actor* pActor ) { return pActor->GetX() > GetOffScreenRight(pActor); } +inline bool IsOffScreenTop( Actor* pActor ) { return pActor->GetY() < GetOffScreenTop(pActor); } +inline bool IsOffScreenBottom(Actor* pActor ) { return pActor->GetY() > GetOffScreenBottom(pActor); } +inline bool IsOffScreen( Actor* pActor ) { return IsOffScreenLeft(pActor) || IsOffScreenRight(pActor) || IsOffScreenTop(pActor) || IsOffScreenBottom(pActor); } + +// guard rail is the area that keeps particles from going off screen +inline float GetGuardRailLeft( Actor* pActor ) { return SCREEN_LEFT + pActor->GetZoomedWidth()/2; } +inline float GetGuardRailRight( Actor* pActor ) { return SCREEN_RIGHT - pActor->GetZoomedWidth()/2; } +inline float GetGuardRailTop( Actor* pActor ) { return SCREEN_TOP + pActor->GetZoomedHeight()/2; } +inline float GetGuardRailBottom(Actor* pActor ) { return SCREEN_BOTTOM- pActor->GetZoomedHeight()/2; } + +inline bool HitGuardRailLeft( Actor* pActor ) { return pActor->GetX() < GetGuardRailLeft(pActor); } +inline bool HitGuardRailRight( Actor* pActor ) { return pActor->GetX() > GetGuardRailRight(pActor); } +inline bool HitGuardRailTop( Actor* pActor ) { return pActor->GetY() < GetGuardRailTop(pActor); } +inline bool HitGuardRailBottom(Actor* pActor ) { return pActor->GetY() > GetGuardRailBottom(pActor); } + +BGAnimationLayer::BGAnimationLayer() +{ + m_vParticleVelocity.clear(); + + m_Type = TYPE_SPRITE; + + m_fTexCoordVelocityX = 0; + m_fTexCoordVelocityY = 0; + m_bParticlesBounce = false; + m_iNumTilesWide = -1; + m_iNumTilesHigh = -1; + m_fTilesStartX = 0; + m_fTilesStartY = 0; + m_fTilesSpacingX = -1; + m_fTilesSpacingY = -1; + m_fTileVelocityX = 0; + m_fTileVelocityY = 0; +} + +BGAnimationLayer::~BGAnimationLayer() +{ + ActorFrame::DeleteAllChildren(); +} + +void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath ) +{ + /* Generic BGAs are new. Animation directories with no INI are old and obsolete. + * Don't combine them. */ + RString lcPath = sPath; + lcPath.MakeLower(); + + if( lcPath.find("usesongbg") != RString::npos ) + { + const Song* pSong = GAMESTATE->m_pCurSong; + RString sSongBGPath; + if( pSong && pSong->HasBackground() ) + sSongBGPath = pSong->GetBackgroundPath(); + else + sSongBGPath = THEME->GetPathG("Common","fallback background"); + + Sprite* pSprite = new Sprite; + pSprite->Load( Sprite::SongBGTexture(sSongBGPath) ); + pSprite->StretchTo( FullScreenRectF ); + this->AddChild( pSprite ); + + return; // this will ignore other effects in the file name + } + + enum Effect { + EFFECT_CENTER, + EFFECT_STRETCH_STILL, + EFFECT_STRETCH_SCROLL_LEFT, + EFFECT_STRETCH_SCROLL_RIGHT, + EFFECT_STRETCH_SCROLL_UP, + EFFECT_STRETCH_SCROLL_DOWN, + EFFECT_STRETCH_WATER, + EFFECT_STRETCH_BUBBLE, + EFFECT_STRETCH_TWIST, + EFFECT_STRETCH_SPIN, + EFFECT_PARTICLES_SPIRAL_OUT, + EFFECT_PARTICLES_SPIRAL_IN, + EFFECT_PARTICLES_FLOAT_UP, + EFFECT_PARTICLES_FLOAT_DOWN, + EFFECT_PARTICLES_FLOAT_LEFT, + EFFECT_PARTICLES_FLOAT_RIGHT, + EFFECT_PARTICLES_BOUNCE, + EFFECT_TILE_STILL, + EFFECT_TILE_SCROLL_LEFT, + EFFECT_TILE_SCROLL_RIGHT, + EFFECT_TILE_SCROLL_UP, + EFFECT_TILE_SCROLL_DOWN, + EFFECT_TILE_FLIP_X, + EFFECT_TILE_FLIP_Y, + EFFECT_TILE_PULSE, + NUM_EFFECTS, // leave this at the end + EFFECT_INVALID + }; + + const RString EFFECT_STRING[NUM_EFFECTS] = { + "center", + "stretchstill", + "stretchscrollleft", + "stretchscrollright", + "stretchscrollup", + "stretchscrolldown", + "stretchwater", + "stretchbubble", + "stretchtwist", + "stretchspin", + "particlesspiralout", + "particlesspiralin", + "particlesfloatup", + "particlesfloatdown", + "particlesfloatleft", + "particlesfloatright", + "particlesbounce", + "tilestill", + "tilescrollleft", + "tilescrollright", + "tilescrollup", + "tilescrolldown", + "tileflipx", + "tileflipy", + "tilepulse", + }; + + Effect effect = EFFECT_CENTER; + + for( int i=0; iAddChild( pSprite ); + pSprite->Load( sPath ); + pSprite->SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y ); + } + break; + case EFFECT_STRETCH_STILL: + case EFFECT_STRETCH_SCROLL_LEFT: + case EFFECT_STRETCH_SCROLL_RIGHT: + case EFFECT_STRETCH_SCROLL_UP: + case EFFECT_STRETCH_SCROLL_DOWN: + case EFFECT_STRETCH_WATER: + case EFFECT_STRETCH_BUBBLE: + case EFFECT_STRETCH_TWIST: + { + m_Type = TYPE_SPRITE; + Sprite* pSprite = new Sprite; + this->AddChild( pSprite ); + RageTextureID ID(sPath); + ID.bStretch = true; + pSprite->Load( Sprite::SongBGTexture(ID) ); + pSprite->StretchTo( FullScreenRectF ); + pSprite->SetCustomTextureRect( RectF(0,0,1,1) ); + + switch( effect ) + { + case EFFECT_STRETCH_SCROLL_LEFT: m_fTexCoordVelocityX = +0.5f; m_fTexCoordVelocityY = 0; break; + case EFFECT_STRETCH_SCROLL_RIGHT: m_fTexCoordVelocityX = -0.5f; m_fTexCoordVelocityY = 0; break; + case EFFECT_STRETCH_SCROLL_UP: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = +0.5f; break; + case EFFECT_STRETCH_SCROLL_DOWN: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = -0.5f; break; + break; + } + } + break; + case EFFECT_STRETCH_SPIN: + { + m_Type = TYPE_SPRITE; + Sprite* pSprite = new Sprite; + this->AddChild( pSprite ); + pSprite->Load( Sprite::SongBGTexture(sPath) ); + const RectF StretchedFullScreenRectF( + FullScreenRectF.left-200, + FullScreenRectF.top-200, + FullScreenRectF.right+200, + FullScreenRectF.bottom+200 ); + + pSprite->ScaleToCover( StretchedFullScreenRectF ); + pSprite->SetEffectSpin( RageVector3(0,0,60) ); + } + break; + case EFFECT_PARTICLES_SPIRAL_OUT: + case EFFECT_PARTICLES_SPIRAL_IN: + case EFFECT_PARTICLES_FLOAT_UP: + case EFFECT_PARTICLES_FLOAT_DOWN: + case EFFECT_PARTICLES_FLOAT_LEFT: + case EFFECT_PARTICLES_FLOAT_RIGHT: + case EFFECT_PARTICLES_BOUNCE: + { + m_Type = TYPE_PARTICLES; + Sprite s; + s.Load( sPath ); + int iSpriteArea = int( s.GetUnzoomedWidth()*s.GetUnzoomedHeight() ); + const int iMaxArea = int(SCREEN_WIDTH*SCREEN_HEIGHT); + int iNumParticles = iMaxArea / iSpriteArea; + iNumParticles = min( iNumParticles, MAX_SPRITES ); + + for( int i=0; iAddChild( pSprite ); + pSprite->Load( sPath ); + pSprite->SetZoom( 0.7f + 0.6f*i/(float)iNumParticles ); + switch( effect ) + { + case EFFECT_PARTICLES_BOUNCE: + pSprite->SetX( randomf( GetGuardRailLeft(pSprite), GetGuardRailRight(pSprite) ) ); + pSprite->SetY( randomf( GetGuardRailTop(pSprite), GetGuardRailBottom(pSprite) ) ); + break; + default: + pSprite->SetX( randomf( GetOffScreenLeft(pSprite), GetOffScreenRight(pSprite) ) ); + pSprite->SetY( randomf( GetOffScreenTop(pSprite), GetOffScreenBottom(pSprite) ) ); + break; + } + + switch( effect ) + { + case EFFECT_PARTICLES_FLOAT_UP: + case EFFECT_PARTICLES_SPIRAL_OUT: + m_vParticleVelocity.push_back( RageVector3( 0, -PARTICLE_SPEED*pSprite->GetZoom(), 0 ) ); + break; + case EFFECT_PARTICLES_FLOAT_DOWN: + case EFFECT_PARTICLES_SPIRAL_IN: + m_vParticleVelocity.push_back( RageVector3( 0, PARTICLE_SPEED*pSprite->GetZoom(), 0 ) ); + break; + case EFFECT_PARTICLES_FLOAT_LEFT: + m_vParticleVelocity.push_back( RageVector3( -PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 ) ); + break; + case EFFECT_PARTICLES_FLOAT_RIGHT: + m_vParticleVelocity.push_back( RageVector3( +PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 ) ); + break; + case EFFECT_PARTICLES_BOUNCE: + m_bParticlesBounce = true; + pSprite->SetZoom( 1 ); + m_vParticleVelocity.push_back( RageVector3( randomf(), randomf(), 0 ) ); + RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] ); + m_vParticleVelocity[i].x *= PARTICLE_SPEED; + m_vParticleVelocity[i].y *= PARTICLE_SPEED; + break; + default: + ASSERT(0); + } + } + } + break; + case EFFECT_TILE_STILL: + case EFFECT_TILE_SCROLL_LEFT: + case EFFECT_TILE_SCROLL_RIGHT: + case EFFECT_TILE_SCROLL_UP: + case EFFECT_TILE_SCROLL_DOWN: + case EFFECT_TILE_FLIP_X: + case EFFECT_TILE_FLIP_Y: + case EFFECT_TILE_PULSE: + { + m_Type = TYPE_TILES; + RageTextureID ID(sPath); + ID.bStretch = true; + Sprite s; + s.Load( ID ); + m_iNumTilesWide = 2+int(SCREEN_WIDTH /s.GetUnzoomedWidth()); + m_iNumTilesWide = min( m_iNumTilesWide, MAX_TILES_WIDE ); + m_iNumTilesHigh = 2+int(SCREEN_HEIGHT/s.GetUnzoomedHeight()); + m_iNumTilesHigh = min( m_iNumTilesHigh, MAX_TILES_HIGH ); + m_fTilesStartX = s.GetUnzoomedWidth() / 2; + m_fTilesStartY = s.GetUnzoomedHeight() / 2; + m_fTilesSpacingX = s.GetUnzoomedWidth(); + m_fTilesSpacingY = s.GetUnzoomedHeight(); + for( int x=0; xAddChild( pSprite ); + pSprite->Load( ID ); + pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" + + switch( effect ) + { + case EFFECT_TILE_STILL: + break; + case EFFECT_TILE_SCROLL_LEFT: + m_fTileVelocityX = -PARTICLE_SPEED; + break; + case EFFECT_TILE_SCROLL_RIGHT: + m_fTileVelocityX = +PARTICLE_SPEED; + break; + case EFFECT_TILE_SCROLL_UP: + m_fTileVelocityY = -PARTICLE_SPEED; + break; + case EFFECT_TILE_SCROLL_DOWN: + m_fTileVelocityY = +PARTICLE_SPEED; + break; + case EFFECT_TILE_FLIP_X: + pSprite->SetEffectSpin( RageVector3(180,0,0) ); + break; + case EFFECT_TILE_FLIP_Y: + pSprite->SetEffectSpin( RageVector3(0,180,0) ); + break; + case EFFECT_TILE_PULSE: + pSprite->SetEffectPulse( 1, 0.3f, 1.f ); + break; + default: + ASSERT(0); + } + } + } + } + break; + default: + ASSERT(0); + } + + + RString sHint = sPath; + sHint.MakeLower(); + + if( sHint.find("cyclecolor") != RString::npos ) + for( unsigned i=0; iSetEffectRainbow( 5 ); + + if( sHint.find("cyclealpha") != RString::npos ) + for( unsigned i=0; iSetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) ); + + if( sHint.find("startonrandomframe") != RString::npos ) + for( unsigned i=0; iSetState( RandomInt(m_SubActors[i]->GetNumStates()) ); + + if( sHint.find("dontanimate") != RString::npos ) + for( unsigned i=0; iStopAnimating(); + + if( sHint.find("add") != RString::npos ) + for( unsigned i=0; iSetBlendMode( BLEND_ADD ); +} + +void BGAnimationLayer::LoadFromNode( const XNode* pNode ) +{ + { + bool bCond; + if( pNode->GetAttrValue("Condition", bCond) && !bCond ) + return; + } + + bool bStretch = false; + { + RString type = "sprite"; + pNode->GetAttrValue( "Type", type ); + type.MakeLower(); + + /* The preferred way of stretching a sprite to fit the screen is "Type=sprite" + * and "stretch=1". "type=1" is for backwards-compatibility. */ + pNode->GetAttrValue( "Stretch", bStretch ); + + // Check for string match first, then do integer match. + // "if(atoi(type)==0)" was matching against all string matches. + // -Chris + if( stricmp(type,"sprite")==0 ) + { + m_Type = TYPE_SPRITE; + } + else if( stricmp(type,"particles")==0 ) + { + m_Type = TYPE_PARTICLES; + } + else if( stricmp(type,"tiles")==0 ) + { + m_Type = TYPE_TILES; + } + else if( atoi(type) == 1 ) + { + m_Type = TYPE_SPRITE; + bStretch = true; + } + else if( atoi(type) == 2 ) + { + m_Type = TYPE_PARTICLES; + } + else if( atoi(type) == 3 ) + { + m_Type = TYPE_TILES; + } + else + { + m_Type = TYPE_SPRITE; + } + } + + pNode->GetAttrValue( "FOV", m_fFOV ); + pNode->GetAttrValue( "Lighting", m_bLighting ); + + pNode->GetAttrValue( "TexCoordVelocityX", m_fTexCoordVelocityX ); + pNode->GetAttrValue( "TexCoordVelocityY", m_fTexCoordVelocityY ); + + // compat: + pNode->GetAttrValue( "StretchTexCoordVelocityX", m_fTexCoordVelocityX ); + pNode->GetAttrValue( "StretchTexCoordVelocityY", m_fTexCoordVelocityY ); + + // particle and tile stuff + float fZoomMin = 1; + float fZoomMax = 1; + pNode->GetAttrValue( "ZoomMin", fZoomMin ); + pNode->GetAttrValue( "ZoomMax", fZoomMax ); + + float fVelocityXMin = 10, fVelocityXMax = 10; + float fVelocityYMin = 0, fVelocityYMax = 0; + float fVelocityZMin = 0, fVelocityZMax = 0; + float fOverrideSpeed = 0; // 0 means don't override speed + pNode->GetAttrValue( "VelocityXMin", fVelocityXMin ); + pNode->GetAttrValue( "VelocityXMax", fVelocityXMax ); + pNode->GetAttrValue( "VelocityYMin", fVelocityYMin ); + pNode->GetAttrValue( "VelocityYMax", fVelocityYMax ); + pNode->GetAttrValue( "VelocityZMin", fVelocityZMin ); + pNode->GetAttrValue( "VelocityZMax", fVelocityZMax ); + pNode->GetAttrValue( "OverrideSpeed", fOverrideSpeed ); + + int iNumParticles = 10; + pNode->GetAttrValue( "NumParticles", iNumParticles ); + + pNode->GetAttrValue( "ParticlesBounce", m_bParticlesBounce ); + pNode->GetAttrValue( "TilesStartX", m_fTilesStartX ); + pNode->GetAttrValue( "TilesStartY", m_fTilesStartY ); + pNode->GetAttrValue( "TilesSpacingX", m_fTilesSpacingX ); + pNode->GetAttrValue( "TilesSpacingY", m_fTilesSpacingY ); + pNode->GetAttrValue( "TileVelocityX", m_fTileVelocityX ); + pNode->GetAttrValue( "TileVelocityY", m_fTileVelocityY ); + + + switch( m_Type ) + { + case TYPE_SPRITE: + { + Actor* pActor = ActorUtil::LoadFromNode( pNode, this ); + this->AddChild( pActor ); + if( bStretch ) + pActor->StretchTo( FullScreenRectF ); + } + break; + case TYPE_PARTICLES: + { + RString sFile; + ActorUtil::GetAttrPath( pNode, "File", sFile ); + FixSlashesInPlace( sFile ); + + CollapsePath( sFile ); + + for( int i=0; iAddChild( pActor ); + pActor->SetXY( randomf(float(FullScreenRectF.left),float(FullScreenRectF.right)), + randomf(float(FullScreenRectF.top),float(FullScreenRectF.bottom)) ); + pActor->SetZoom( randomf(fZoomMin,fZoomMax) ); + m_vParticleVelocity.push_back( RageVector3( + randomf(fVelocityXMin,fVelocityXMax), + randomf(fVelocityYMin,fVelocityYMax), + randomf(fVelocityZMin,fVelocityZMax) ) ); + if( fOverrideSpeed != 0 ) + { + RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] ); + m_vParticleVelocity[i] *= fOverrideSpeed; + } + } + } + break; + case TYPE_TILES: + { + RString sFile; + ActorUtil::GetAttrPath( pNode, "File", sFile ); + FixSlashesInPlace( sFile ); + + CollapsePath( sFile ); + + AutoActor s; + s.Load( sFile ); + if( m_fTilesSpacingX == -1 ) + m_fTilesSpacingX = s->GetUnzoomedWidth(); + if( m_fTilesSpacingY == -1 ) + m_fTilesSpacingY = s->GetUnzoomedHeight(); + m_iNumTilesWide = 2+(int)(SCREEN_WIDTH /m_fTilesSpacingX); + m_iNumTilesHigh = 2+(int)(SCREEN_HEIGHT/m_fTilesSpacingY); + unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh; + for( unsigned i=0; iAddChild( pSprite ); + pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" + pSprite->SetZoom( randomf(fZoomMin,fZoomMax) ); + } + } + break; + default: + ASSERT(0); + } + + bool bStartOnRandomFrame = false; + pNode->GetAttrValue( "StartOnRandomFrame", bStartOnRandomFrame ); + if( bStartOnRandomFrame ) + { + for( unsigned i=0; iSetState( RandomInt(m_SubActors[i]->GetNumStates()) ); + } +} + +void BGAnimationLayer::UpdateInternal( float fDeltaTime ) +{ + ActorFrame::UpdateInternal( fDeltaTime ); + + fDeltaTime *= m_fUpdateRate; + + switch( m_Type ) + { + case TYPE_SPRITE: + if( m_fTexCoordVelocityX || m_fTexCoordVelocityY ) + { + for( unsigned i=0; iStretchTexCoords( + fDeltaTime*m_fTexCoordVelocityX, + fDeltaTime*m_fTexCoordVelocityY ); + } + } + break; + case TYPE_PARTICLES: + for( unsigned i=0; iSetX( pActor->GetX() + fDeltaTime*vel.x ); + m_SubActors[i]->SetY( pActor->GetY() + fDeltaTime*vel.y ); + pActor->SetZ( pActor->GetZ() + fDeltaTime*vel.z ); + if( m_bParticlesBounce ) + { + if( HitGuardRailLeft(pActor) ) + { + vel.x *= -1; + pActor->SetX( GetGuardRailLeft(pActor) ); + } + if( HitGuardRailRight(pActor) ) + { + vel.x *= -1; + pActor->SetX( GetGuardRailRight(pActor) ); + } + if( HitGuardRailTop(pActor) ) + { + vel.y *= -1; + pActor->SetY( GetGuardRailTop(pActor) ); + } + if( HitGuardRailBottom(pActor) ) + { + vel.y *= -1; + pActor->SetY( GetGuardRailBottom(pActor) ); + } + } + else // !m_bParticlesBounce + { + if( vel.x<0 && IsOffScreenLeft(pActor) ) + pActor->SetX( GetOffScreenRight(pActor) ); + if( vel.x>0 && IsOffScreenRight(pActor) ) + pActor->SetX( GetOffScreenLeft(pActor) ); + if( vel.y<0 && IsOffScreenTop(pActor) ) + pActor->SetY( GetOffScreenBottom(pActor) ); + if( vel.y>0 && IsOffScreenBottom(pActor) ) + pActor->SetY( GetOffScreenTop(pActor) ); + } + } + break; + case TYPE_TILES: + { + float fSecs = RageTimer::GetTimeSinceStartFast(); + float fTotalWidth = m_iNumTilesWide * m_fTilesSpacingX; + float fTotalHeight = m_iNumTilesHigh * m_fTilesSpacingY; + + ASSERT( int(m_SubActors.size()) == m_iNumTilesWide * m_iNumTilesHigh ); + + for( int x=0; xSetX( fX ); + m_SubActors[i]->SetY( fY ); + } + } + } + break; + default: + ASSERT(0); + } +} + +/* + * (c) 2001-2004 Ben Nordstrom, Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BGAnimationLayer.h b/src/BGAnimationLayer.h index 94d46497b3..ce3ed1c4ce 100644 --- a/src/BGAnimationLayer.h +++ b/src/BGAnimationLayer.h @@ -1,80 +1,80 @@ -#ifndef BGANIMATIONLAYER_H -#define BGANIMATIONLAYER_H - -#include "GameConstantsAndTypes.h" -#include "ActorFrame.h" -#include - -class XNode; - -/** @brief Layer elements used by BGAnimation. */ -class BGAnimationLayer : public ActorFrame -{ -public: - BGAnimationLayer(); - ~BGAnimationLayer(); - - void LoadFromAniLayerFile( const RString& sPath ); - void LoadFromNode( const XNode* pNode ); - - void UpdateInternal( float fDeltaTime ); - - float GetMaxTweenTimeLeft() const; - -protected: - vector m_vParticleVelocity; - - enum Type - { - TYPE_SPRITE, - TYPE_PARTICLES, - TYPE_TILES, - NUM_TYPES, - } m_Type; - - // stretch stuff - float m_fTexCoordVelocityX; - float m_fTexCoordVelocityY; - - // particles stuff - bool m_bParticlesBounce; - - // tiles stuff - int m_iNumTilesWide; - int m_iNumTilesHigh; - float m_fTilesStartX; - float m_fTilesStartY; - float m_fTilesSpacingX; - float m_fTilesSpacingY; - float m_fTileVelocityX; - float m_fTileVelocityY; -}; - -#endif - -/** - * @file - * @author Ben Nordstrom, Chris Danford, Glenn Maynard (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BGANIMATIONLAYER_H +#define BGANIMATIONLAYER_H + +#include "GameConstantsAndTypes.h" +#include "ActorFrame.h" +#include + +class XNode; + +/** @brief Layer elements used by BGAnimation. */ +class BGAnimationLayer : public ActorFrame +{ +public: + BGAnimationLayer(); + ~BGAnimationLayer(); + + void LoadFromAniLayerFile( const RString& sPath ); + void LoadFromNode( const XNode* pNode ); + + void UpdateInternal( float fDeltaTime ); + + float GetMaxTweenTimeLeft() const; + +protected: + vector m_vParticleVelocity; + + enum Type + { + TYPE_SPRITE, + TYPE_PARTICLES, + TYPE_TILES, + NUM_TYPES, + } m_Type; + + // stretch stuff + float m_fTexCoordVelocityX; + float m_fTexCoordVelocityY; + + // particles stuff + bool m_bParticlesBounce; + + // tiles stuff + int m_iNumTilesWide; + int m_iNumTilesHigh; + float m_fTilesStartX; + float m_fTilesStartY; + float m_fTilesSpacingX; + float m_fTilesSpacingY; + float m_fTileVelocityX; + float m_fTileVelocityY; +}; + +#endif + +/** + * @file + * @author Ben Nordstrom, Chris Danford, Glenn Maynard (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BPMDisplay.cpp b/src/BPMDisplay.cpp index 98ce045520..80ce23a145 100644 --- a/src/BPMDisplay.cpp +++ b/src/BPMDisplay.cpp @@ -1,331 +1,331 @@ -#include "global.h" -#include "BPMDisplay.h" -#include "RageUtil.h" -#include "GameConstantsAndTypes.h" -#include "GameState.h" -#include "Course.h" -#include "Style.h" -#include "ActorUtil.h" -#include "CommonMetrics.h" -#include "LocalizedString.h" -#include "Song.h" - -#include - -REGISTER_ACTOR_CLASS( BPMDisplay ); - -BPMDisplay::BPMDisplay() -{ - m_fBPMFrom = m_fBPMTo = 0; - m_iCurrentBPM = 0; - m_BPMS.push_back(0); - m_fPercentInState = 0; - m_fCycleTime = 1.0f; -} - -void BPMDisplay::Load() -{ - SET_NO_BPM_COMMAND.Load( m_sName, "SetNoBpmCommand"); - SET_NORMAL_COMMAND.Load( m_sName, "SetNormalCommand"); - SET_CHANGING_COMMAND.Load( m_sName, "SetChangeCommand" ); - SET_RANDOM_COMMAND.Load( m_sName, "SetRandomCommand" ); - SET_EXTRA_COMMAND.Load( m_sName, "SetExtraCommand" ); - CYCLE.Load( m_sName, "Cycle" ); - RANDOM_CYCLE_SPEED.Load( m_sName, "RandomCycleSpeed" ); - SEPARATOR.Load( m_sName, "Separator" ); - SHOW_QMARKS.Load( m_sName, "ShowQMarksInRandomCycle" ); - NO_BPM_TEXT.Load( m_sName, "NoBpmText" ); - QUESTIONMARKS_TEXT.Load( m_sName, "QuestionMarksText" ); - RANDOM_TEXT.Load( m_sName, "RandomText" ); - VARIOUS_TEXT.Load( m_sName, "VariousText" ); - BPM_FORMAT_STRING.Load( m_sName, "FormatString" ); - - RunCommands( SET_NORMAL_COMMAND ); -} - -void BPMDisplay::LoadFromNode( const XNode *pNode ) -{ - BitmapText::LoadFromNode( pNode ); - Load(); -} - -float BPMDisplay::GetActiveBPM() const -{ - return m_fBPMTo + (m_fBPMFrom-m_fBPMTo)*m_fPercentInState; -} - -void BPMDisplay::Update( float fDeltaTime ) -{ - BitmapText::Update( fDeltaTime ); - - if( !(bool)CYCLE ) - return; - if( m_BPMS.size() == 0 ) - return; // no bpm - - m_fPercentInState -= fDeltaTime / m_fCycleTime; - if( m_fPercentInState < 0 ) - { - // go to next state - m_fPercentInState = 1; // reset timer - - m_iCurrentBPM = (m_iCurrentBPM + 1) % m_BPMS.size(); - m_fBPMFrom = m_fBPMTo; - m_fBPMTo = m_BPMS[m_iCurrentBPM]; - - if(m_fBPMTo == -1) - { - m_fBPMFrom = -1; - if( (bool)SHOW_QMARKS ) - SetText( (RandomFloat(0,1)>0.90f) ? (RString)QUESTIONMARKS_TEXT : ssprintf((RString)BPM_FORMAT_STRING,RandomFloat(0,999)) ); - else - SetText( ssprintf((RString)BPM_FORMAT_STRING, RandomFloat(0,999)) ); - } - else if(m_fBPMFrom == -1) - { - m_fBPMFrom = m_fBPMTo; - } - } - - if( m_fBPMTo != -1) - { - const float fActualBPM = GetActiveBPM(); - SetText( ssprintf((RString)BPM_FORMAT_STRING, fActualBPM) ); - } -} - -void BPMDisplay::SetBPMRange( const DisplayBpms &bpms ) -{ - ASSERT( !bpms.vfBpms.empty() ); - - m_BPMS.clear(); - - const vector &BPMS = bpms.vfBpms; - - bool AllIdentical = true; - for( unsigned i = 0; i < BPMS.size(); ++i ) - { - if( i > 0 && BPMS[i] != BPMS[i-1] ) - AllIdentical = false; - } - - if( !(bool)CYCLE ) - { - int MinBPM = INT_MAX; - int MaxBPM = INT_MIN; - for( unsigned i = 0; i < BPMS.size(); ++i ) - { - MinBPM = min( MinBPM, (int)lrintf(BPMS[i]) ); - MaxBPM = max( MaxBPM, (int)lrintf(BPMS[i]) ); - } - if( MinBPM == MaxBPM ) - { - if( MinBPM == -1 ) - SetText( RANDOM_TEXT ); // random (was "...") -aj - else - SetText( ssprintf("%i", MinBPM) ); - } - else - { - SetText( ssprintf("%i%s%i", MinBPM, SEPARATOR.GetValue().c_str(), MaxBPM) ); - } - } - else - { - for( unsigned i = 0; i < BPMS.size(); ++i ) - { - m_BPMS.push_back(BPMS[i]); - if( BPMS[i] != -1 ) - m_BPMS.push_back(BPMS[i]); // hold - } - - m_iCurrentBPM = min(1u, m_BPMS.size()); // start on the first hold - m_fBPMFrom = BPMS[0]; - m_fBPMTo = BPMS[0]; - m_fPercentInState = 1; - } - - if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) - RunCommands( SET_EXTRA_COMMAND ); - else if( !AllIdentical ) - RunCommands( SET_CHANGING_COMMAND ); - else - RunCommands( SET_NORMAL_COMMAND ); -} - -void BPMDisplay::CycleRandomly() -{ - DisplayBpms bpms; - bpms.Add(-1); - SetBPMRange( bpms ); - - RunCommands( SET_RANDOM_COMMAND ); - - m_fCycleTime = (float)RANDOM_CYCLE_SPEED; - - // Go to default value in event of a negative value in the metrics - if( m_fCycleTime < 0 ) - m_fCycleTime = 0.2f; -} - -void BPMDisplay::NoBPM() -{ - m_BPMS.clear(); - SetText( NO_BPM_TEXT ); - RunCommands( SET_NO_BPM_COMMAND ); -} - -void BPMDisplay::SetBpmFromSong( const Song* pSong ) -{ - ASSERT( pSong ); - switch( pSong->m_DisplayBPMType ) - { - case Song::DISPLAY_ACTUAL: - case Song::DISPLAY_SPECIFIED: - { - DisplayBpms bpms; - pSong->GetDisplayBpms( bpms ); - SetBPMRange( bpms ); - m_fCycleTime = 1.0f; - } - break; - case Song::DISPLAY_RANDOM: - CycleRandomly(); - break; - default: - ASSERT(0); - } -} - -void BPMDisplay::SetBpmFromCourse( const Course* pCourse ) -{ - ASSERT( pCourse ); - ASSERT( GAMESTATE->GetCurrentStyle() ); - - StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; - Trail *pTrail = pCourse->GetTrail( st ); - ASSERT( pTrail ); - - m_fCycleTime = 0.2f; - - if( (int)pTrail->m_vEntries.size() > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) - { - SetVarious(); - return; - } - - DisplayBpms bpms; - pTrail->GetDisplayBpms( bpms ); - SetBPMRange( bpms ); -} - -void BPMDisplay::SetConstantBpm( float fBPM ) -{ - DisplayBpms bpms; - bpms.Add( fBPM ); - SetBPMRange( bpms ); -} - -void BPMDisplay::SetVarious() -{ - m_BPMS.clear(); - m_BPMS.push_back( -1 ); - SetText( VARIOUS_TEXT ); -} - -void BPMDisplay::SetFromGameState() -{ - if( GAMESTATE->m_pCurSong.Get() ) - { - if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) - CycleRandomly(); - else - SetBpmFromSong( GAMESTATE->m_pCurSong ); - return; - } - if( GAMESTATE->m_pCurCourse.Get() ) - { - if( GAMESTATE->GetCurrentStyle() == NULL ) - ; // This is true when backing out from ScreenSelectCourse to ScreenTitleMenu. So, don't call SetBpmFromCourse where an assert will fire. - else - SetBpmFromCourse( GAMESTATE->m_pCurCourse ); - - return; - } - - NoBPM(); -} - -// SongBPMDisplay (in-game BPM display) -class SongBPMDisplay: public BPMDisplay -{ -public: - SongBPMDisplay(); - virtual SongBPMDisplay *Copy() const; - virtual void Update( float fDeltaTime ); - -private: - float m_fLastGameStateBPM; - -}; - -SongBPMDisplay::SongBPMDisplay() -{ - m_fLastGameStateBPM = 0; -} - -void SongBPMDisplay::Update( float fDeltaTime ) -{ - float fGameStateBPM = GAMESTATE->m_fCurBPS * 60.0f; - if( m_fLastGameStateBPM != fGameStateBPM ) - { - m_fLastGameStateBPM = fGameStateBPM; - SetConstantBpm( fGameStateBPM ); - } - - BPMDisplay::Update( fDeltaTime ); -} - -REGISTER_ACTOR_CLASS( SongBPMDisplay ); - -#include "LuaBinding.h" -/** @brief Allow Lua to have access to the BPMDisplay. */ -class LunaBPMDisplay: public Luna -{ -public: - static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } - static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } - - LunaBPMDisplay() - { - ADD_METHOD( SetFromGameState ); - ADD_METHOD( GetText ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( BPMDisplay, BitmapText ) - -/* - * (c) 2001-2002 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "BPMDisplay.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "GameState.h" +#include "Course.h" +#include "Style.h" +#include "ActorUtil.h" +#include "CommonMetrics.h" +#include "LocalizedString.h" +#include "Song.h" + +#include + +REGISTER_ACTOR_CLASS( BPMDisplay ); + +BPMDisplay::BPMDisplay() +{ + m_fBPMFrom = m_fBPMTo = 0; + m_iCurrentBPM = 0; + m_BPMS.push_back(0); + m_fPercentInState = 0; + m_fCycleTime = 1.0f; +} + +void BPMDisplay::Load() +{ + SET_NO_BPM_COMMAND.Load( m_sName, "SetNoBpmCommand"); + SET_NORMAL_COMMAND.Load( m_sName, "SetNormalCommand"); + SET_CHANGING_COMMAND.Load( m_sName, "SetChangeCommand" ); + SET_RANDOM_COMMAND.Load( m_sName, "SetRandomCommand" ); + SET_EXTRA_COMMAND.Load( m_sName, "SetExtraCommand" ); + CYCLE.Load( m_sName, "Cycle" ); + RANDOM_CYCLE_SPEED.Load( m_sName, "RandomCycleSpeed" ); + SEPARATOR.Load( m_sName, "Separator" ); + SHOW_QMARKS.Load( m_sName, "ShowQMarksInRandomCycle" ); + NO_BPM_TEXT.Load( m_sName, "NoBpmText" ); + QUESTIONMARKS_TEXT.Load( m_sName, "QuestionMarksText" ); + RANDOM_TEXT.Load( m_sName, "RandomText" ); + VARIOUS_TEXT.Load( m_sName, "VariousText" ); + BPM_FORMAT_STRING.Load( m_sName, "FormatString" ); + + RunCommands( SET_NORMAL_COMMAND ); +} + +void BPMDisplay::LoadFromNode( const XNode *pNode ) +{ + BitmapText::LoadFromNode( pNode ); + Load(); +} + +float BPMDisplay::GetActiveBPM() const +{ + return m_fBPMTo + (m_fBPMFrom-m_fBPMTo)*m_fPercentInState; +} + +void BPMDisplay::Update( float fDeltaTime ) +{ + BitmapText::Update( fDeltaTime ); + + if( !(bool)CYCLE ) + return; + if( m_BPMS.size() == 0 ) + return; // no bpm + + m_fPercentInState -= fDeltaTime / m_fCycleTime; + if( m_fPercentInState < 0 ) + { + // go to next state + m_fPercentInState = 1; // reset timer + + m_iCurrentBPM = (m_iCurrentBPM + 1) % m_BPMS.size(); + m_fBPMFrom = m_fBPMTo; + m_fBPMTo = m_BPMS[m_iCurrentBPM]; + + if(m_fBPMTo == -1) + { + m_fBPMFrom = -1; + if( (bool)SHOW_QMARKS ) + SetText( (RandomFloat(0,1)>0.90f) ? (RString)QUESTIONMARKS_TEXT : ssprintf((RString)BPM_FORMAT_STRING,RandomFloat(0,999)) ); + else + SetText( ssprintf((RString)BPM_FORMAT_STRING, RandomFloat(0,999)) ); + } + else if(m_fBPMFrom == -1) + { + m_fBPMFrom = m_fBPMTo; + } + } + + if( m_fBPMTo != -1) + { + const float fActualBPM = GetActiveBPM(); + SetText( ssprintf((RString)BPM_FORMAT_STRING, fActualBPM) ); + } +} + +void BPMDisplay::SetBPMRange( const DisplayBpms &bpms ) +{ + ASSERT( !bpms.vfBpms.empty() ); + + m_BPMS.clear(); + + const vector &BPMS = bpms.vfBpms; + + bool AllIdentical = true; + for( unsigned i = 0; i < BPMS.size(); ++i ) + { + if( i > 0 && BPMS[i] != BPMS[i-1] ) + AllIdentical = false; + } + + if( !(bool)CYCLE ) + { + int MinBPM = INT_MAX; + int MaxBPM = INT_MIN; + for( unsigned i = 0; i < BPMS.size(); ++i ) + { + MinBPM = min( MinBPM, (int)lrintf(BPMS[i]) ); + MaxBPM = max( MaxBPM, (int)lrintf(BPMS[i]) ); + } + if( MinBPM == MaxBPM ) + { + if( MinBPM == -1 ) + SetText( RANDOM_TEXT ); // random (was "...") -aj + else + SetText( ssprintf("%i", MinBPM) ); + } + else + { + SetText( ssprintf("%i%s%i", MinBPM, SEPARATOR.GetValue().c_str(), MaxBPM) ); + } + } + else + { + for( unsigned i = 0; i < BPMS.size(); ++i ) + { + m_BPMS.push_back(BPMS[i]); + if( BPMS[i] != -1 ) + m_BPMS.push_back(BPMS[i]); // hold + } + + m_iCurrentBPM = min(1u, m_BPMS.size()); // start on the first hold + m_fBPMFrom = BPMS[0]; + m_fBPMTo = BPMS[0]; + m_fPercentInState = 1; + } + + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + RunCommands( SET_EXTRA_COMMAND ); + else if( !AllIdentical ) + RunCommands( SET_CHANGING_COMMAND ); + else + RunCommands( SET_NORMAL_COMMAND ); +} + +void BPMDisplay::CycleRandomly() +{ + DisplayBpms bpms; + bpms.Add(-1); + SetBPMRange( bpms ); + + RunCommands( SET_RANDOM_COMMAND ); + + m_fCycleTime = (float)RANDOM_CYCLE_SPEED; + + // Go to default value in event of a negative value in the metrics + if( m_fCycleTime < 0 ) + m_fCycleTime = 0.2f; +} + +void BPMDisplay::NoBPM() +{ + m_BPMS.clear(); + SetText( NO_BPM_TEXT ); + RunCommands( SET_NO_BPM_COMMAND ); +} + +void BPMDisplay::SetBpmFromSong( const Song* pSong ) +{ + ASSERT( pSong ); + switch( pSong->m_DisplayBPMType ) + { + case Song::DISPLAY_ACTUAL: + case Song::DISPLAY_SPECIFIED: + { + DisplayBpms bpms; + pSong->GetDisplayBpms( bpms ); + SetBPMRange( bpms ); + m_fCycleTime = 1.0f; + } + break; + case Song::DISPLAY_RANDOM: + CycleRandomly(); + break; + default: + ASSERT(0); + } +} + +void BPMDisplay::SetBpmFromCourse( const Course* pCourse ) +{ + ASSERT( pCourse ); + ASSERT( GAMESTATE->GetCurrentStyle() ); + + StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; + Trail *pTrail = pCourse->GetTrail( st ); + ASSERT( pTrail ); + + m_fCycleTime = 0.2f; + + if( (int)pTrail->m_vEntries.size() > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) + { + SetVarious(); + return; + } + + DisplayBpms bpms; + pTrail->GetDisplayBpms( bpms ); + SetBPMRange( bpms ); +} + +void BPMDisplay::SetConstantBpm( float fBPM ) +{ + DisplayBpms bpms; + bpms.Add( fBPM ); + SetBPMRange( bpms ); +} + +void BPMDisplay::SetVarious() +{ + m_BPMS.clear(); + m_BPMS.push_back( -1 ); + SetText( VARIOUS_TEXT ); +} + +void BPMDisplay::SetFromGameState() +{ + if( GAMESTATE->m_pCurSong.Get() ) + { + if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) + CycleRandomly(); + else + SetBpmFromSong( GAMESTATE->m_pCurSong ); + return; + } + if( GAMESTATE->m_pCurCourse.Get() ) + { + if( GAMESTATE->GetCurrentStyle() == NULL ) + ; // This is true when backing out from ScreenSelectCourse to ScreenTitleMenu. So, don't call SetBpmFromCourse where an assert will fire. + else + SetBpmFromCourse( GAMESTATE->m_pCurCourse ); + + return; + } + + NoBPM(); +} + +// SongBPMDisplay (in-game BPM display) +class SongBPMDisplay: public BPMDisplay +{ +public: + SongBPMDisplay(); + virtual SongBPMDisplay *Copy() const; + virtual void Update( float fDeltaTime ); + +private: + float m_fLastGameStateBPM; + +}; + +SongBPMDisplay::SongBPMDisplay() +{ + m_fLastGameStateBPM = 0; +} + +void SongBPMDisplay::Update( float fDeltaTime ) +{ + float fGameStateBPM = GAMESTATE->m_fCurBPS * 60.0f; + if( m_fLastGameStateBPM != fGameStateBPM ) + { + m_fLastGameStateBPM = fGameStateBPM; + SetConstantBpm( fGameStateBPM ); + } + + BPMDisplay::Update( fDeltaTime ); +} + +REGISTER_ACTOR_CLASS( SongBPMDisplay ); + +#include "LuaBinding.h" +/** @brief Allow Lua to have access to the BPMDisplay. */ +class LunaBPMDisplay: public Luna +{ +public: + static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } + + LunaBPMDisplay() + { + ADD_METHOD( SetFromGameState ); + ADD_METHOD( GetText ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( BPMDisplay, BitmapText ) + +/* + * (c) 2001-2002 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BPMDisplay.h b/src/BPMDisplay.h index 23614985ab..c99869e617 100644 --- a/src/BPMDisplay.h +++ b/src/BPMDisplay.h @@ -1,138 +1,138 @@ -#ifndef BPM_DISPLAY_H -#define BPM_DISPLAY_H - -#include "BitmapText.h" -#include "AutoActor.h" -#include "ThemeMetric.h" -#include "LocalizedString.h" -class Song; -class Course; -struct DisplayBpms; - -/** @brief Displays a BPM or a range of BPMs. */ -class BPMDisplay : public BitmapText -{ -public: - /** @brief Set up the BPM Display with default values. */ - BPMDisplay(); - /** @brief Copy the BPMDisplay to another. */ - virtual BPMDisplay *Copy() const; - /** @brief Load the various metrics needed. */ - void Load(); - /** - * @brief Update the display as required. - * @param fDeltaTime the changed time. - */ - virtual void Update( float fDeltaTime ); - void LoadFromNode( const XNode *pNode ); - /** - * @brief Use the BPM[s] from a song. - * @param pSong the song in question. - */ - void SetBpmFromSong( const Song* pSong ); - /** - * @brief Use the BPM[s] from a course. - * @param pCourse the course in question. - */ - void SetBpmFromCourse( const Course* pCourse ); - /** - * @brief Use a specified, constant BPM. - * @param fBPM the constant BPM. - */ - void SetConstantBpm( float fBPM ); - /** - * @brief Have the BPMDisplay cycle between various BPMs. - */ - void CycleRandomly(); - /** @brief Don't use a BPM at all. */ - void NoBPM(); - /** @brief Have the BPMDisplay use various BPMs. */ - void SetVarious(); - /** @brief Have the GameState determine which BPMs to display. */ - void SetFromGameState(); - - // Lua - virtual void PushSelf( lua_State *L ); - -protected: - /** - * @brief Retrieve the active BPM on display. - * @return the active BPM on display. - */ - float GetActiveBPM() const; - /** - * @brief Set the range to be used for the display. - * @param bpms the set of BPMs to be used. - */ - void SetBPMRange( const DisplayBpms &bpms ); - - /** @brief The commands to use when there is no BPM. */ - ThemeMetric SET_NO_BPM_COMMAND; - /** @brief The commands to use when there is a normal BPM. */ - ThemeMetric SET_NORMAL_COMMAND; - /** @brief The commands to use when the BPM can change between 2 or more values. */ - ThemeMetric SET_CHANGING_COMMAND; - /** @brief The commands to use when the BPM is random. */ - ThemeMetric SET_RANDOM_COMMAND; - /** @brief The commands to use if it is an extra stage. */ - ThemeMetric SET_EXTRA_COMMAND; - /** @brief A flag to determine if the BPMs cycle from low to high or just display both. */ - ThemeMetric CYCLE; - /** @brief A flag to determine if QUESTIONMARKS_TEXT is shown. */ - ThemeMetric SHOW_QMARKS; - /** @brief How often the random BPMs cycle themselves. */ - ThemeMetric RANDOM_CYCLE_SPEED; - /** @brief The text used to separate the low and high BPMs. */ - ThemeMetric SEPARATOR; - /** @brief The text used when there is no BPM. */ - ThemeMetric NO_BPM_TEXT; - /** @brief The text used when there are various BPMs for the song. */ - ThemeMetric VARIOUS_TEXT; - /** @brief The text used when it is a random BPM. */ - ThemeMetric RANDOM_TEXT; - /** @brief The text used as one possible option for random BPM. */ - ThemeMetric QUESTIONMARKS_TEXT; - /** @brief The format string used for the numbers. */ - ThemeMetric BPM_FORMAT_STRING; - - /** @brief The lowest valued BPM. */ - float m_fBPMFrom; - /** @brief The highest valued BPM. */ - float m_fBPMTo; - /** @brief The current BPM index used. */ - int m_iCurrentBPM; - /** @brief The list of BPMs. */ - vector m_BPMS; - float m_fPercentInState; - /** @brief How long it takes to cycle the various BPMs. */ - float m_fCycleTime; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2002 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BPM_DISPLAY_H +#define BPM_DISPLAY_H + +#include "BitmapText.h" +#include "AutoActor.h" +#include "ThemeMetric.h" +#include "LocalizedString.h" +class Song; +class Course; +struct DisplayBpms; + +/** @brief Displays a BPM or a range of BPMs. */ +class BPMDisplay : public BitmapText +{ +public: + /** @brief Set up the BPM Display with default values. */ + BPMDisplay(); + /** @brief Copy the BPMDisplay to another. */ + virtual BPMDisplay *Copy() const; + /** @brief Load the various metrics needed. */ + void Load(); + /** + * @brief Update the display as required. + * @param fDeltaTime the changed time. + */ + virtual void Update( float fDeltaTime ); + void LoadFromNode( const XNode *pNode ); + /** + * @brief Use the BPM[s] from a song. + * @param pSong the song in question. + */ + void SetBpmFromSong( const Song* pSong ); + /** + * @brief Use the BPM[s] from a course. + * @param pCourse the course in question. + */ + void SetBpmFromCourse( const Course* pCourse ); + /** + * @brief Use a specified, constant BPM. + * @param fBPM the constant BPM. + */ + void SetConstantBpm( float fBPM ); + /** + * @brief Have the BPMDisplay cycle between various BPMs. + */ + void CycleRandomly(); + /** @brief Don't use a BPM at all. */ + void NoBPM(); + /** @brief Have the BPMDisplay use various BPMs. */ + void SetVarious(); + /** @brief Have the GameState determine which BPMs to display. */ + void SetFromGameState(); + + // Lua + virtual void PushSelf( lua_State *L ); + +protected: + /** + * @brief Retrieve the active BPM on display. + * @return the active BPM on display. + */ + float GetActiveBPM() const; + /** + * @brief Set the range to be used for the display. + * @param bpms the set of BPMs to be used. + */ + void SetBPMRange( const DisplayBpms &bpms ); + + /** @brief The commands to use when there is no BPM. */ + ThemeMetric SET_NO_BPM_COMMAND; + /** @brief The commands to use when there is a normal BPM. */ + ThemeMetric SET_NORMAL_COMMAND; + /** @brief The commands to use when the BPM can change between 2 or more values. */ + ThemeMetric SET_CHANGING_COMMAND; + /** @brief The commands to use when the BPM is random. */ + ThemeMetric SET_RANDOM_COMMAND; + /** @brief The commands to use if it is an extra stage. */ + ThemeMetric SET_EXTRA_COMMAND; + /** @brief A flag to determine if the BPMs cycle from low to high or just display both. */ + ThemeMetric CYCLE; + /** @brief A flag to determine if QUESTIONMARKS_TEXT is shown. */ + ThemeMetric SHOW_QMARKS; + /** @brief How often the random BPMs cycle themselves. */ + ThemeMetric RANDOM_CYCLE_SPEED; + /** @brief The text used to separate the low and high BPMs. */ + ThemeMetric SEPARATOR; + /** @brief The text used when there is no BPM. */ + ThemeMetric NO_BPM_TEXT; + /** @brief The text used when there are various BPMs for the song. */ + ThemeMetric VARIOUS_TEXT; + /** @brief The text used when it is a random BPM. */ + ThemeMetric RANDOM_TEXT; + /** @brief The text used as one possible option for random BPM. */ + ThemeMetric QUESTIONMARKS_TEXT; + /** @brief The format string used for the numbers. */ + ThemeMetric BPM_FORMAT_STRING; + + /** @brief The lowest valued BPM. */ + float m_fBPMFrom; + /** @brief The highest valued BPM. */ + float m_fBPMTo; + /** @brief The current BPM index used. */ + int m_iCurrentBPM; + /** @brief The list of BPMs. */ + vector m_BPMS; + float m_fPercentInState; + /** @brief How long it takes to cycle the various BPMs. */ + float m_fCycleTime; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2002 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Background.cpp b/src/Background.cpp index 0c4005c1a7..34050aedcc 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -1,972 +1,972 @@ -#include "global.h" -#include "Background.h" -#include "RageUtil.h" -#include "GameConstantsAndTypes.h" -#include "RageTimer.h" -#include "RageLog.h" -#include "RageTextureManager.h" -#include "GameState.h" -#include "PrefsManager.h" -#include "NoteTypes.h" -#include "Steps.h" -#include "DancingCharacters.h" -#include "BeginnerHelper.h" -#include "StatsManager.h" -#include "ScreenDimensions.h" -#include "ThemeMetric.h" -#include "PlayerState.h" -#include "ActorUtil.h" -#include -#include "XmlFile.h" -#include "XmlFileUtil.h" -#include "BackgroundUtil.h" -#include "Song.h" -#include "AutoActor.h" - -static ThemeMetric LEFT_EDGE ("Background","LeftEdge"); -static ThemeMetric TOP_EDGE ("Background","TopEdge"); -static ThemeMetric RIGHT_EDGE ("Background","RightEdge"); -static ThemeMetric BOTTOM_EDGE ("Background","BottomEdge"); -#define RECT_BACKGROUND RectF (LEFT_EDGE,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) -static ThemeMetric CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent"); -static ThemeMetric SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters"); -static ThemeMetric USE_STATIC_BG ("Background","UseStaticBackground"); - - -static Preference g_bShowDanger( "ShowDanger", true ); -static Preference g_fBGBrightness( "BGBrightness", 0.7f ); -static Preference g_RandomBackgroundMode( "RandomBackgroundMode", BGMODE_RANDOMMOVIES ); -static Preference g_iNumBackgrounds( "NumBackgrounds", 8 ); -static Preference g_bSongBackgrounds( "SongBackgrounds", true ); - -// Width of the region separating the left and right brightness areas: -static float g_fBackgroundCenterWidth = 40; - -class BrightnessOverlay: public ActorFrame -{ -public: - BrightnessOverlay(); - void Update( float fDeltaTime ); - - void FadeToActualBrightness(); - void SetActualBrightness(); - void Set( float fBrightness ); - -private: - Quad m_quadBGBrightness[NUM_PLAYERS]; - Quad m_quadBGBrightnessFade; -}; - -struct BackgroundTransition -{ - apActorCommands cmdLeaves; - apActorCommands cmdRoot; -}; - - -class BackgroundImpl : public ActorFrame -{ -public: - BackgroundImpl(); - ~BackgroundImpl(); - void Init(); - - virtual void LoadFromSong( const Song *pSong ); - virtual void Unload(); - - virtual void Update( float fDeltaTime ); - virtual void DrawPrimitives(); - - void FadeToActualBrightness() { m_Brightness.FadeToActualBrightness(); } - void SetBrightness( float fBrightness ) { m_Brightness.Set(fBrightness); } /* overrides pref and Cover */ - - DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; - - void GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ); - -protected: - bool m_bInitted; - DancingCharacters* m_pDancingCharacters; - const Song *m_pSong; - map m_mapNameToTransition; - deque m_RandomBGAnimations; // random background to choose from. These may or may not be loaded into m_BGAnimations. - - void LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change ); - bool IsDangerAllVisible(); - - class Layer - { - public: - Layer(); - void Unload(); - - // return true if created and added to m_BGAnimations - bool CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent ); - // return def of the background that was created and added to m_BGAnimations. calls CreateBackground - BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque &RandomBGAnimations, Actor *pParent ); - - int FindBGSegmentForBeat( float fBeat ) const; - void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map &mapNameToTransition ); - - map m_BGAnimations; - vector m_aBGChanges; - int m_iCurBGChangeIndex; - Actor *m_pCurrentBGA; - Actor *m_pFadingBGA; - }; - Layer m_Layer[NUM_BackgroundLayer]; - - float m_fLastMusicSeconds; - bool m_bDangerAllWasVisible; - - // cover up the edge of animations that might hang outside of the background rectangle - Quad m_quadBorderLeft, m_quadBorderTop, m_quadBorderRight, m_quadBorderBottom; - - BrightnessOverlay m_Brightness; - - BackgroundDef m_StaticBackgroundDef; -}; - - -static RageColor GetBrightnessColor( float fBrightnessPercent ) -{ - RageColor cBrightness = RageColor( 0,0,0,1-fBrightnessPercent ); - RageColor cClamp = RageColor( 0.5f,0.5f,0.5f,CLAMP_OUTPUT_PERCENT ); - - // blend the two colors above as if cBrightness is drawn, then cClamp drawn on top - cBrightness.a *= (1-cClamp.a); // premultiply alpha - - RageColor ret; - ret.a = cBrightness.a + cClamp.a; - ret.r = (cBrightness.r * cBrightness.a + cClamp.r * cClamp.a) / ret.a; - ret.g = (cBrightness.g * cBrightness.a + cClamp.g * cClamp.a) / ret.a; - ret.b = (cBrightness.b * cBrightness.a + cClamp.b * cClamp.a) / ret.a; - return ret; -} - -BackgroundImpl::BackgroundImpl() -{ - m_bInitted = false; - m_pDancingCharacters = NULL; - m_pSong = NULL; -} - -BackgroundImpl::Layer::Layer() -{ - m_iCurBGChangeIndex = -1; - m_pCurrentBGA = NULL; - m_pFadingBGA = NULL; -} - -void BackgroundImpl::Init() -{ - if( m_bInitted ) - return; - m_bInitted = true; - m_bDangerAllWasVisible = false; - m_StaticBackgroundDef = BackgroundDef(); - - if( !USE_STATIC_BG ) - { - m_StaticBackgroundDef.m_sColor1 = "#00000000"; - m_StaticBackgroundDef.m_sColor2 = "#00000000"; - } - - // load transitions - { - ASSERT( m_mapNameToTransition.empty() ); - vector vsPaths, vsNames; - BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames ); - for( unsigned i=0; im_bShowBeginnerHelper && BeginnerHelper::CanUse() && - GAMESTATE->m_pCurSteps[p] && GAMESTATE->m_pCurSteps[p]->GetDifficulty() == Difficulty_Beginner ) - bShowingBeginnerHelper = true; - } - - if( bOneOrMoreChars && !bShowingBeginnerHelper && SHOW_DANCING_CHARACTERS ) - m_pDancingCharacters = new DancingCharacters; - - RageColor c = GetBrightnessColor(0); - - m_quadBorderLeft.StretchTo( RectF(SCREEN_LEFT,SCREEN_TOP,LEFT_EDGE,SCREEN_BOTTOM) ); - m_quadBorderLeft.SetDiffuse( c ); - m_quadBorderTop.StretchTo( RectF(LEFT_EDGE,SCREEN_TOP,RIGHT_EDGE,TOP_EDGE) ); - m_quadBorderTop.SetDiffuse( c ); - m_quadBorderRight.StretchTo( RectF(RIGHT_EDGE,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); - m_quadBorderRight.SetDiffuse( c ); - m_quadBorderBottom.StretchTo( RectF(LEFT_EDGE,BOTTOM_EDGE,RIGHT_EDGE,SCREEN_BOTTOM) ); - m_quadBorderBottom.SetDiffuse( c ); - - this->AddChild( &m_quadBorderLeft ); - this->AddChild( &m_quadBorderTop ); - this->AddChild( &m_quadBorderRight ); - this->AddChild( &m_quadBorderBottom ); - - this->AddChild( &m_Brightness ); -} - -BackgroundImpl::~BackgroundImpl() -{ - Unload(); - delete m_pDancingCharacters; -} - -void BackgroundImpl::Unload() -{ - FOREACH_BackgroundLayer( i ) - m_Layer[i].Unload(); - m_pSong = NULL; - m_fLastMusicSeconds = -9999; - m_RandomBGAnimations.clear(); -} - -void BackgroundImpl::Layer::Unload() -{ - FOREACHM( BackgroundDef, Actor*, m_BGAnimations, iter ) - delete iter->second; - m_BGAnimations.clear(); - m_aBGChanges.clear(); - - m_pCurrentBGA = NULL; - m_pFadingBGA = NULL; - m_iCurBGChangeIndex = -1; -} - -bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent ) -{ - ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() ); - - // Resolve the background names - vector vsToResolve; - vsToResolve.push_back( bd.m_sFile1 ); - vsToResolve.push_back( bd.m_sFile2 ); - - vector vsResolved; - vsResolved.resize( vsToResolve.size() ); - vector vsResolvedRef; - vsResolvedRef.resize( vsToResolve.size() ); - - for( unsigned i=0; i vsPaths, vsThrowAway; - - // Look for BGAnims in the song dir - if( sToResolve == SONG_BACKGROUND_FILE ) - vsPaths.push_back( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background") ); - if( vsPaths.empty() ) BackgroundUtil::GetSongBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway ); - if( vsPaths.empty() ) BackgroundUtil::GetSongMovies( pSong, sToResolve, vsPaths, vsThrowAway ); - if( vsPaths.empty() ) BackgroundUtil::GetSongBitmaps( pSong, sToResolve, vsPaths, vsThrowAway ); - if( vsPaths.empty() ) BackgroundUtil::GetGlobalBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway ); - if( vsPaths.empty() ) BackgroundUtil::GetGlobalRandomMovies( pSong, sToResolve, vsPaths, vsThrowAway ); - - RString &sResolved = vsResolved[i]; - - if( !vsPaths.empty() ) - { - sResolved = vsPaths[0]; - } - else - { - // If the main background file is missing, we failed. - if( i == 0 ) - return false; - else - sResolved = "../"+ThemeManager::GetBlankGraphicPath(); - } - - ASSERT( !sResolved.empty() ); - - vsResolvedRef[i] = new LuaThreadVariable( ssprintf("File%d",i+1), sResolved ); - } - - RString sEffect = bd.m_sEffect; - if( sEffect.empty() ) - { - FileType ft = ActorUtil::GetFileType(vsResolved[0]); - switch( ft ) - { - default: - LOG->Warn( "CreateBackground() Unknown file type '%s'", vsResolved[0].c_str() ); - // fall through - case FT_Bitmap: - case FT_Movie: - sEffect = SBE_StretchNormal; - break; - case FT_Directory: - case FT_Lua: - case FT_Model: - sEffect = SBE_UpperLeft; - break; - } - } - ASSERT( !sEffect.empty() ); - - // Set Lua color globals - LuaThreadVariable sColor1( "Color1", bd.m_sColor1.empty() ? RString("#FFFFFFFF") : bd.m_sColor1 ); - LuaThreadVariable sColor2( "Color2", bd.m_sColor2.empty() ? RString("#FFFFFFFF") : bd.m_sColor2 ); - - // Resolve the effect file. - RString sEffectFile; - for( int i=0; i<2; i++ ) - { - vector vsPaths, vsThrowAway; - BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway ); - if( vsPaths.empty() ) - { - LOG->Warn( "BackgroundEffect '%s' is missing.",sEffect.c_str() ); - sEffect = SBE_Centered; - } - else if( vsPaths.size() > 1 ) - { - LOG->Warn( "BackgroundEffect '%s' has more than one match.",sEffect.c_str() ); - sEffect = SBE_Centered; - } - else - { - sEffectFile = vsPaths[0]; - break; - } - } - ASSERT( !sEffectFile.empty() ); - - Actor *pActor = ActorUtil::MakeActor( sEffectFile ); - - ASSERT( pActor ); - m_BGAnimations[bd] = pActor; - - for( unsigned i=0; i &RandomBGAnimations, Actor *pParent ) -{ - if( g_RandomBackgroundMode == BGMODE_OFF ) - return BackgroundDef(); - - // Set to not show any BGChanges, whether scripted or random - if( GAMESTATE->m_SongOptions.GetCurrent().m_bStaticBackground ) - return BackgroundDef(); - - if( RandomBGAnimations.empty() ) - return BackgroundDef(); - - /* XXX: every time we fully loop, shuffle, so we don't play the same sequence - * over and over; and nudge the shuffle so the next one won't be a repeat */ - BackgroundDef bd = RandomBGAnimations.front(); - RandomBGAnimations.push_back( RandomBGAnimations.front() ); - RandomBGAnimations.pop_front(); - - if( !sEffect.empty() ) - bd.m_sEffect = sEffect; - - map::const_iterator iter = m_BGAnimations.find( bd ); - - // create the background if it's not already created - if( iter == m_BGAnimations.end() ) - { - bool bSuccess = CreateBackground( pSong, bd, pParent ); - ASSERT( bSuccess ); // we fed it valid files, so this shouldn't fail - } - return bd; -} - -void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change ) -{ - int iStartRow = BeatToNoteRow(fFirstBeat); - int iEndRow = BeatToNoteRow(fEndBeat); - - const TimingData &timing = m_pSong->m_Timing; - - // change BG every time signature change or 4 measures - FOREACH_CONST( TimeSignatureSegment, timing.m_vTimeSignatureSegments, iter ) - { - vector::const_iterator next = iter; - next++; - int iSegmentEndRow = (next == timing.m_vTimeSignatureSegments.end()) ? iEndRow : next->m_iStartRow; - - for( int i=max(iter->m_iStartRow,iStartRow); iGetNoteRowsPerMeasure() ) - { - // Don't fade. It causes frame rate dip, especially on slower machines. - BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); - if( !bd.IsEmpty() ) - { - BackgroundChange c = change; - c.m_def = bd; - c.m_fStartBeat = NoteRowToBeat(i); - m_Layer[0].m_aBGChanges.push_back( c ); - } - } - } - - // change BG every BPM change that is at the beginning of a measure - for( unsigned i=0; im_iStartRow) % iter->GetNoteRowsPerMeasure() == 0 ) - { - bAtBeginningOfMeasure = true; - break; - } - } - - if( !bAtBeginningOfMeasure ) - continue; // skip - - // start so that we don't create a BGChange right on top of fEndBeat - bool bInRange = bpmseg.m_iStartRow >= iStartRow && bpmseg.m_iStartRow < iEndRow; - if( !bInRange ) - continue; // skip - - BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); - if( !bd.IsEmpty() ) - { - BackgroundChange c = change; - c.m_def.m_sFile1 = bd.m_sFile1; - c.m_def.m_sFile2 = bd.m_sFile2; - c.m_fStartBeat = NoteRowToBeat(bpmseg.m_iStartRow); - m_Layer[0].m_aBGChanges.push_back( c ); - } - } -} - -void BackgroundImpl::LoadFromSong( const Song* pSong ) -{ - Init(); - Unload(); - m_pSong = pSong; - m_StaticBackgroundDef.m_sFile1 = SONG_BACKGROUND_FILE; - - if( g_fBGBrightness == 0.0f ) - return; - - // Choose a bunch of backgrounds that we'll use for the random file marker - { - vector vsThrowAway, vsNames; - switch( g_RandomBackgroundMode ) - { - default: - ASSERT_M( 0, ssprintf("Invalid RandomBackgroundMode: %i", int(g_RandomBackgroundMode)) ); - break; - case BGMODE_OFF: - break; - case BGMODE_ANIMATIONS: - BackgroundUtil::GetGlobalBGAnimations( pSong, "", vsThrowAway, vsNames ); - break; - case BGMODE_RANDOMMOVIES: - BackgroundUtil::GetGlobalRandomMovies( pSong, "", vsThrowAway, vsNames, true, true ); - break; - } - - // Pick the same random items every time the song is played. - RandomGen rnd( GetHashForString(pSong->GetSongDir()) ); - random_shuffle( vsNames.begin(), vsNames.end(), rnd ); - int iSize = min( (int)g_iNumBackgrounds, (int)vsNames.size() ); - vsNames.resize( iSize ); - - FOREACH_CONST( RString, vsNames, s ) - { - BackgroundDef bd; - bd.m_sFile1 = *s; - m_RandomBGAnimations.push_back( bd ); - } - } - - /* Song backgrounds (even just background stills) can get very big; never keep them - * in memory. */ - RageTextureID::TexPolicy OldPolicy = TEXTUREMAN->GetDefaultTexturePolicy(); - TEXTUREMAN->SetDefaultTexturePolicy( RageTextureID::TEX_VOLATILE ); - - TEXTUREMAN->DisableOddDimensionWarning(); - - // Set to not show any BGChanges, whether scripted or random if m_bStaticBackground is on - if( !g_bSongBackgrounds || GAMESTATE->m_SongOptions.GetCurrent().m_bStaticBackground ) - { - // Backgrounds are disabled; just display the song background. - BackgroundChange change; - change.m_def = m_StaticBackgroundDef; - change.m_fStartBeat = 0; - m_Layer[0].m_aBGChanges.push_back( change ); - } - // If m_bRandomBGOnly is on, then we want to ignore the scripted BG in favour of randomly loaded BGs - else if( pSong->HasBGChanges() && !GAMESTATE->m_SongOptions.GetCurrent().m_bRandomBGOnly ) - { - FOREACH_BackgroundLayer( i ) - { - Layer &layer = m_Layer[i]; - - // Load all song-specified backgrounds - FOREACH_CONST( BackgroundChange, pSong->GetBackgroundChanges(i), bgc ) - { - BackgroundChange change = *bgc; - BackgroundDef &bd = change.m_def; - - bool bIsAlreadyLoaded = layer.m_BGAnimations.find(bd) != layer.m_BGAnimations.end(); - - if( bd.m_sFile1 != RANDOM_BACKGROUND_FILE && !bIsAlreadyLoaded ) - { - if( layer.CreateBackground( m_pSong, bd, this ) ) - { - ; // do nothing. Create was successful. - } - else - { - if( i == BACKGROUND_LAYER_1 ) - { - // The background was not found. Try to use a random one instead. - // Don't use the BackgroundDef's effect, because it may be an - // effect that requires 2 files, and random BGA will only supply one file - bd = layer.CreateRandomBGA( pSong, "", m_RandomBGAnimations, this ); - if( bd.IsEmpty() ) - bd = m_StaticBackgroundDef; - } - } - } - - if( !bd.IsEmpty() ) - layer.m_aBGChanges.push_back( change ); - } - } - } - else // pSong doesn't have an animation plan - { - Layer &layer = m_Layer[0]; - - LoadFromRandom( pSong->m_fFirstBeat, pSong->m_fLastBeat, BackgroundChange() ); - - // end showing the static song background - BackgroundChange change; - change.m_def = m_StaticBackgroundDef; - change.m_fStartBeat = pSong->m_fLastBeat; - layer.m_aBGChanges.push_back( change ); - } - - // sort segments - FOREACH_BackgroundLayer( i ) - { - Layer &layer = m_Layer[i]; - BackgroundUtil::SortBackgroundChangesArray( layer.m_aBGChanges ); - } - - Layer &mainlayer = m_Layer[0]; - - /* If the first BGAnimation isn't negative, add a lead-in image showing - * the song background. */ - if( mainlayer.m_aBGChanges.empty() || mainlayer.m_aBGChanges.front().m_fStartBeat >= 0 ) - { - BackgroundChange change; - change.m_def = m_StaticBackgroundDef; - change.m_fStartBeat = -10000; - mainlayer.m_aBGChanges.insert( mainlayer.m_aBGChanges.begin(), change ); - } - - // If any BGChanges use the background image, load it. - bool bStaticBackgroundUsed = false; - FOREACH_BackgroundLayer( i ) - { - Layer &layer = m_Layer[i]; - FOREACH_CONST( BackgroundChange, layer.m_aBGChanges, bgc ) - { - const BackgroundDef &bd = bgc->m_def; - if( bd == m_StaticBackgroundDef ) - { - bStaticBackgroundUsed = true; - break; - } - } - if( bStaticBackgroundUsed ) - break; - } - - if( bStaticBackgroundUsed ) - { - bool bIsAlreadyLoaded = mainlayer.m_BGAnimations.find(m_StaticBackgroundDef) != mainlayer.m_BGAnimations.end(); - if( !bIsAlreadyLoaded ) - { - bool bSuccess = mainlayer.CreateBackground( m_pSong, m_StaticBackgroundDef, this ); - ASSERT( bSuccess ); - } - } - - // Look for the random file marker, and replace the segment with LoadFromRandom. - for( unsigned i=0; im_fLastBeat; - if( i+1 < mainlayer.m_aBGChanges.size() ) - fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat; - - mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i ); - --i; - - LoadFromRandom( fStartBeat, fEndBeat, change ); - } - - // At this point, we shouldn't have any BGChanges to "". "" is an invalid name. - for( unsigned i=0; iEnableOddDimensionWarning(); - - if( m_pDancingCharacters ) - m_pDancingCharacters->LoadNextSong(); - - TEXTUREMAN->SetDefaultTexturePolicy( OldPolicy ); -} - -int BackgroundImpl::Layer::FindBGSegmentForBeat( float fBeat ) const -{ - if( m_aBGChanges.empty() ) - return -1; - if( fBeat < m_aBGChanges[0].m_fStartBeat ) - return -1; - - // assumption: m_aBGChanges are sorted by m_fStartBeat - int i; - for( i=m_aBGChanges.size()-1; i>=0; i-- ) - { - if( fBeat >= m_aBGChanges[i].m_fStartBeat ) - return i; - } - - return i; -} - -/* If the BG segment has changed, move focus to it. Send Update() calls. */ -void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map &mapNameToTransition ) -{ - ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID ); - - if( m_aBGChanges.size() == 0 ) - return; - - float fBeat, fBPS, fThrowAway; - bool bFreeze; - int iThrowAway; - pSong->m_Timing.GetBeatAndBPSFromElapsedTime( fCurrentTime, fBeat, fBPS, bFreeze, bFreeze, iThrowAway, fThrowAway ); - - // Calls to Update() should *not* be scaled by music rate; fCurrentTime is. Undo it. - const float fRate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; - - // Find the BGSegment we're in - const int i = FindBGSegmentForBeat( fBeat ); - - float fDeltaTime = fCurrentTime - fLastMusicSeconds; - if( i != -1 && i != m_iCurBGChangeIndex ) // we're changing backgrounds - { - //LOG->Trace( "old bga %d -> new bga %d (%s), %f, %f", m_iCurBGChangeIndex, i, m_aBGChanges[i].GetTextDescription().c_str(), m_aBGChanges[i].m_fStartBeat, fBeat ); - - BackgroundChange oldChange; - if( m_iCurBGChangeIndex != -1 ) - oldChange = m_aBGChanges[m_iCurBGChangeIndex]; - - m_iCurBGChangeIndex = i; - - const BackgroundChange& change = m_aBGChanges[i]; - - m_pFadingBGA = m_pCurrentBGA; - - map::const_iterator iter = m_BGAnimations.find( change.m_def ); - if( iter == m_BGAnimations.end() ) - { - XNode *pNode = change.m_def.CreateNode(); - RString xml = XmlFileUtil::GetXML( pNode ); - Trim( xml ); - LOG->Warn( "Tried to switch to a background that was never loaded:\n%s", xml.c_str() ); - SAFE_DELETE( pNode ); - return; - } - - m_pCurrentBGA = iter->second; - - if( m_pFadingBGA == m_pCurrentBGA ) - { - m_pFadingBGA = NULL; - //LOG->Trace( "bg didn't actually change. Ignoring." ); - } - else - { - if( m_pFadingBGA ) - { - m_pFadingBGA->PlayCommand( "LoseFocus" ); - - if( !change.m_sTransition.empty() ) - { - map::const_iterator lIter = mapNameToTransition.find( change.m_sTransition ); - ASSERT( lIter != mapNameToTransition.end() ); - const BackgroundTransition &bt = lIter->second; - m_pFadingBGA->RunCommandsOnLeaves( *bt.cmdLeaves ); - m_pFadingBGA->RunCommands( *bt.cmdRoot ); - } - } - } - - m_pCurrentBGA->SetUpdateRate( change.m_fRate ); - - m_pCurrentBGA->InitState(); - m_pCurrentBGA->PlayCommand( "On" ); - m_pCurrentBGA->PlayCommand( "GainFocus" ); - - /* How much time of this BGA have we skipped? (This happens with SetSeconds.) */ - const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( change.m_fStartBeat ); - - /* This is affected by the music rate. */ - fDeltaTime = fCurrentTime - fStartSecond; - } - - if( m_pFadingBGA ) - { - if( m_pFadingBGA->GetTweenTimeLeft() == 0 ) - m_pFadingBGA = NULL; - } - - /* This is unaffected by the music rate. */ - float fDeltaTimeNoMusicRate = max( fDeltaTime / fRate, 0 ); - - if( m_pCurrentBGA ) - m_pCurrentBGA->Update( fDeltaTimeNoMusicRate ); - if( m_pFadingBGA ) - m_pFadingBGA->Update( fDeltaTimeNoMusicRate ); -} - -void BackgroundImpl::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - - { - bool bVisible = IsDangerAllVisible(); - if( m_bDangerAllWasVisible != bVisible ) - MESSAGEMAN->Broadcast( bVisible? "ShowDangerAll":"HideDangerAll" ); - m_bDangerAllWasVisible = bVisible; - } - - if( m_pDancingCharacters ) - m_pDancingCharacters->Update( fDeltaTime ); - - FOREACH_BackgroundLayer( i ) - { - Layer &layer = m_Layer[i]; - layer.UpdateCurBGChange( m_pSong, m_fLastMusicSeconds, GAMESTATE->m_fMusicSeconds, m_mapNameToTransition ); - } - m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds; -} - -void BackgroundImpl::DrawPrimitives() -{ - if( g_fBGBrightness == 0.0f ) - return; - - if( IsDangerAllVisible() ) - { - // Since this only shows when DANGER is visible, it will flash red on it's own accord :) - if( m_pDancingCharacters ) - m_pDancingCharacters->m_bDrawDangerLight = true; - } - - { - if( m_pDancingCharacters ) - m_pDancingCharacters->m_bDrawDangerLight = false; - - FOREACH_BackgroundLayer( i ) - { - Layer &layer = m_Layer[i]; - if( layer.m_pCurrentBGA ) - layer.m_pCurrentBGA->Draw(); - if( layer.m_pFadingBGA ) - layer.m_pFadingBGA->Draw(); - } - } - - if( m_pDancingCharacters ) - m_pDancingCharacters->Draw(); - - ActorFrame::DrawPrimitives(); -} - -void BackgroundImpl::GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ) -{ - FOREACH_BackgroundLayer( i ) - *pBackgroundChangesOut[i] = m_Layer[i].m_aBGChanges; -} - -bool BackgroundImpl::IsDangerAllVisible() -{ - // The players are never in danger in FAIL_OFF. - FOREACH_PlayerNumber( p ) - if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == PlayerOptions::FAIL_OFF ) - return false; - if( !g_bShowDanger ) - return false; - - /* Don't show it if everyone is already failing: it's already too late and it's - * annoying for it to show for the entire duration of a song. */ - if( STATSMAN->m_CurStageStats.AllFailed() ) - return false; - - return GAMESTATE->AllAreInDangerOrWorse(); -} - -BrightnessOverlay::BrightnessOverlay() -{ - float fQuadWidth = (RIGHT_EDGE-LEFT_EDGE)/2; - fQuadWidth -= g_fBackgroundCenterWidth/2; - - m_quadBGBrightness[0].StretchTo( RectF(LEFT_EDGE,TOP_EDGE,LEFT_EDGE+fQuadWidth,BOTTOM_EDGE) ); - m_quadBGBrightnessFade.StretchTo( RectF(LEFT_EDGE+fQuadWidth,TOP_EDGE,RIGHT_EDGE-fQuadWidth,BOTTOM_EDGE) ); - m_quadBGBrightness[1].StretchTo( RectF(RIGHT_EDGE-fQuadWidth,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) ); - - m_quadBGBrightness[0].SetName( "BrightnessOverlay" ); - ActorUtil::LoadAllCommands( m_quadBGBrightness[0], "Background" ); - this->AddChild( &m_quadBGBrightness[0] ); - - m_quadBGBrightness[1].SetName( "BrightnessOverlay" ); - ActorUtil::LoadAllCommands( m_quadBGBrightness[1], "Background" ); - this->AddChild( &m_quadBGBrightness[1] ); - - m_quadBGBrightnessFade.SetName( "BrightnessOverlay" ); - ActorUtil::LoadAllCommands( m_quadBGBrightnessFade, "Background" ); - this->AddChild( &m_quadBGBrightnessFade ); - - SetActualBrightness(); -} - -void BrightnessOverlay::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - /* If we're actually playing, then we're past fades, etc; update the - * background brightness to follow Cover. */ - if( !GAMESTATE->m_bGameplayLeadIn ) - SetActualBrightness(); -} - -void BrightnessOverlay::SetActualBrightness() -{ - float fLeftBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fCover; - float fRightBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.GetCurrent().m_fCover; - - float fBaseBGBrightness = g_fBGBrightness; - - // HACK: Always show training in full brightness - if( GAMESTATE->m_pCurSong && GAMESTATE->m_pCurSong->IsTutorial() ) - fBaseBGBrightness = 1.0f; - - fLeftBrightness *= fBaseBGBrightness; - fRightBrightness *= fBaseBGBrightness; - - if( !GAMESTATE->IsHumanPlayer(PLAYER_1) ) - fLeftBrightness = fRightBrightness; - if( !GAMESTATE->IsHumanPlayer(PLAYER_2) ) - fRightBrightness = fLeftBrightness; - - RageColor LeftColor = GetBrightnessColor(fLeftBrightness); - RageColor RightColor = GetBrightnessColor(fRightBrightness); - - m_quadBGBrightness[PLAYER_1].SetDiffuse( LeftColor ); - m_quadBGBrightness[PLAYER_2].SetDiffuse( RightColor ); - m_quadBGBrightnessFade.SetDiffuseLeftEdge( LeftColor ); - m_quadBGBrightnessFade.SetDiffuseRightEdge( RightColor ); -} - -void BrightnessOverlay::Set( float fBrightness ) -{ - RageColor c = GetBrightnessColor(fBrightness); - - FOREACH_PlayerNumber(pn) - m_quadBGBrightness[pn].SetDiffuse( c ); - m_quadBGBrightnessFade.SetDiffuse( c ); -} - -void BrightnessOverlay::FadeToActualBrightness() -{ - this->PlayCommand( "Fade" ); - SetActualBrightness(); -} - -Background::Background() { m_pImpl = new BackgroundImpl; this->AddChild(m_pImpl); } -Background::~Background() { SAFE_DELETE( m_pImpl ); } -void Background::Init() { m_pImpl->Init(); } -void Background::LoadFromSong( const Song *pSong ) { m_pImpl->LoadFromSong(pSong); } -void Background::Unload() { m_pImpl->Unload(); } -void Background::FadeToActualBrightness() { m_pImpl->FadeToActualBrightness(); } -void Background::SetBrightness( float fBrightness ) { m_pImpl->SetBrightness(fBrightness); } -DancingCharacters* Background::GetDancingCharacters() { return m_pImpl->GetDancingCharacters(); } -void Background::GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ) { m_pImpl->GetLoadedBackgroundChanges(pBackgroundChangesOut); } - -/* - * (c) 2001-2004 Chris Danford, Ben Nordstrom - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Background.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "RageTimer.h" +#include "RageLog.h" +#include "RageTextureManager.h" +#include "GameState.h" +#include "PrefsManager.h" +#include "NoteTypes.h" +#include "Steps.h" +#include "DancingCharacters.h" +#include "BeginnerHelper.h" +#include "StatsManager.h" +#include "ScreenDimensions.h" +#include "ThemeMetric.h" +#include "PlayerState.h" +#include "ActorUtil.h" +#include +#include "XmlFile.h" +#include "XmlFileUtil.h" +#include "BackgroundUtil.h" +#include "Song.h" +#include "AutoActor.h" + +static ThemeMetric LEFT_EDGE ("Background","LeftEdge"); +static ThemeMetric TOP_EDGE ("Background","TopEdge"); +static ThemeMetric RIGHT_EDGE ("Background","RightEdge"); +static ThemeMetric BOTTOM_EDGE ("Background","BottomEdge"); +#define RECT_BACKGROUND RectF (LEFT_EDGE,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) +static ThemeMetric CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent"); +static ThemeMetric SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters"); +static ThemeMetric USE_STATIC_BG ("Background","UseStaticBackground"); + + +static Preference g_bShowDanger( "ShowDanger", true ); +static Preference g_fBGBrightness( "BGBrightness", 0.7f ); +static Preference g_RandomBackgroundMode( "RandomBackgroundMode", BGMODE_RANDOMMOVIES ); +static Preference g_iNumBackgrounds( "NumBackgrounds", 8 ); +static Preference g_bSongBackgrounds( "SongBackgrounds", true ); + +// Width of the region separating the left and right brightness areas: +static float g_fBackgroundCenterWidth = 40; + +class BrightnessOverlay: public ActorFrame +{ +public: + BrightnessOverlay(); + void Update( float fDeltaTime ); + + void FadeToActualBrightness(); + void SetActualBrightness(); + void Set( float fBrightness ); + +private: + Quad m_quadBGBrightness[NUM_PLAYERS]; + Quad m_quadBGBrightnessFade; +}; + +struct BackgroundTransition +{ + apActorCommands cmdLeaves; + apActorCommands cmdRoot; +}; + + +class BackgroundImpl : public ActorFrame +{ +public: + BackgroundImpl(); + ~BackgroundImpl(); + void Init(); + + virtual void LoadFromSong( const Song *pSong ); + virtual void Unload(); + + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + + void FadeToActualBrightness() { m_Brightness.FadeToActualBrightness(); } + void SetBrightness( float fBrightness ) { m_Brightness.Set(fBrightness); } /* overrides pref and Cover */ + + DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; + + void GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ); + +protected: + bool m_bInitted; + DancingCharacters* m_pDancingCharacters; + const Song *m_pSong; + map m_mapNameToTransition; + deque m_RandomBGAnimations; // random background to choose from. These may or may not be loaded into m_BGAnimations. + + void LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change ); + bool IsDangerAllVisible(); + + class Layer + { + public: + Layer(); + void Unload(); + + // return true if created and added to m_BGAnimations + bool CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent ); + // return def of the background that was created and added to m_BGAnimations. calls CreateBackground + BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque &RandomBGAnimations, Actor *pParent ); + + int FindBGSegmentForBeat( float fBeat ) const; + void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map &mapNameToTransition ); + + map m_BGAnimations; + vector m_aBGChanges; + int m_iCurBGChangeIndex; + Actor *m_pCurrentBGA; + Actor *m_pFadingBGA; + }; + Layer m_Layer[NUM_BackgroundLayer]; + + float m_fLastMusicSeconds; + bool m_bDangerAllWasVisible; + + // cover up the edge of animations that might hang outside of the background rectangle + Quad m_quadBorderLeft, m_quadBorderTop, m_quadBorderRight, m_quadBorderBottom; + + BrightnessOverlay m_Brightness; + + BackgroundDef m_StaticBackgroundDef; +}; + + +static RageColor GetBrightnessColor( float fBrightnessPercent ) +{ + RageColor cBrightness = RageColor( 0,0,0,1-fBrightnessPercent ); + RageColor cClamp = RageColor( 0.5f,0.5f,0.5f,CLAMP_OUTPUT_PERCENT ); + + // blend the two colors above as if cBrightness is drawn, then cClamp drawn on top + cBrightness.a *= (1-cClamp.a); // premultiply alpha + + RageColor ret; + ret.a = cBrightness.a + cClamp.a; + ret.r = (cBrightness.r * cBrightness.a + cClamp.r * cClamp.a) / ret.a; + ret.g = (cBrightness.g * cBrightness.a + cClamp.g * cClamp.a) / ret.a; + ret.b = (cBrightness.b * cBrightness.a + cClamp.b * cClamp.a) / ret.a; + return ret; +} + +BackgroundImpl::BackgroundImpl() +{ + m_bInitted = false; + m_pDancingCharacters = NULL; + m_pSong = NULL; +} + +BackgroundImpl::Layer::Layer() +{ + m_iCurBGChangeIndex = -1; + m_pCurrentBGA = NULL; + m_pFadingBGA = NULL; +} + +void BackgroundImpl::Init() +{ + if( m_bInitted ) + return; + m_bInitted = true; + m_bDangerAllWasVisible = false; + m_StaticBackgroundDef = BackgroundDef(); + + if( !USE_STATIC_BG ) + { + m_StaticBackgroundDef.m_sColor1 = "#00000000"; + m_StaticBackgroundDef.m_sColor2 = "#00000000"; + } + + // load transitions + { + ASSERT( m_mapNameToTransition.empty() ); + vector vsPaths, vsNames; + BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames ); + for( unsigned i=0; im_bShowBeginnerHelper && BeginnerHelper::CanUse() && + GAMESTATE->m_pCurSteps[p] && GAMESTATE->m_pCurSteps[p]->GetDifficulty() == Difficulty_Beginner ) + bShowingBeginnerHelper = true; + } + + if( bOneOrMoreChars && !bShowingBeginnerHelper && SHOW_DANCING_CHARACTERS ) + m_pDancingCharacters = new DancingCharacters; + + RageColor c = GetBrightnessColor(0); + + m_quadBorderLeft.StretchTo( RectF(SCREEN_LEFT,SCREEN_TOP,LEFT_EDGE,SCREEN_BOTTOM) ); + m_quadBorderLeft.SetDiffuse( c ); + m_quadBorderTop.StretchTo( RectF(LEFT_EDGE,SCREEN_TOP,RIGHT_EDGE,TOP_EDGE) ); + m_quadBorderTop.SetDiffuse( c ); + m_quadBorderRight.StretchTo( RectF(RIGHT_EDGE,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); + m_quadBorderRight.SetDiffuse( c ); + m_quadBorderBottom.StretchTo( RectF(LEFT_EDGE,BOTTOM_EDGE,RIGHT_EDGE,SCREEN_BOTTOM) ); + m_quadBorderBottom.SetDiffuse( c ); + + this->AddChild( &m_quadBorderLeft ); + this->AddChild( &m_quadBorderTop ); + this->AddChild( &m_quadBorderRight ); + this->AddChild( &m_quadBorderBottom ); + + this->AddChild( &m_Brightness ); +} + +BackgroundImpl::~BackgroundImpl() +{ + Unload(); + delete m_pDancingCharacters; +} + +void BackgroundImpl::Unload() +{ + FOREACH_BackgroundLayer( i ) + m_Layer[i].Unload(); + m_pSong = NULL; + m_fLastMusicSeconds = -9999; + m_RandomBGAnimations.clear(); +} + +void BackgroundImpl::Layer::Unload() +{ + FOREACHM( BackgroundDef, Actor*, m_BGAnimations, iter ) + delete iter->second; + m_BGAnimations.clear(); + m_aBGChanges.clear(); + + m_pCurrentBGA = NULL; + m_pFadingBGA = NULL; + m_iCurBGChangeIndex = -1; +} + +bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent ) +{ + ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() ); + + // Resolve the background names + vector vsToResolve; + vsToResolve.push_back( bd.m_sFile1 ); + vsToResolve.push_back( bd.m_sFile2 ); + + vector vsResolved; + vsResolved.resize( vsToResolve.size() ); + vector vsResolvedRef; + vsResolvedRef.resize( vsToResolve.size() ); + + for( unsigned i=0; i vsPaths, vsThrowAway; + + // Look for BGAnims in the song dir + if( sToResolve == SONG_BACKGROUND_FILE ) + vsPaths.push_back( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background") ); + if( vsPaths.empty() ) BackgroundUtil::GetSongBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetSongMovies( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetSongBitmaps( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetGlobalBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetGlobalRandomMovies( pSong, sToResolve, vsPaths, vsThrowAway ); + + RString &sResolved = vsResolved[i]; + + if( !vsPaths.empty() ) + { + sResolved = vsPaths[0]; + } + else + { + // If the main background file is missing, we failed. + if( i == 0 ) + return false; + else + sResolved = "../"+ThemeManager::GetBlankGraphicPath(); + } + + ASSERT( !sResolved.empty() ); + + vsResolvedRef[i] = new LuaThreadVariable( ssprintf("File%d",i+1), sResolved ); + } + + RString sEffect = bd.m_sEffect; + if( sEffect.empty() ) + { + FileType ft = ActorUtil::GetFileType(vsResolved[0]); + switch( ft ) + { + default: + LOG->Warn( "CreateBackground() Unknown file type '%s'", vsResolved[0].c_str() ); + // fall through + case FT_Bitmap: + case FT_Movie: + sEffect = SBE_StretchNormal; + break; + case FT_Directory: + case FT_Lua: + case FT_Model: + sEffect = SBE_UpperLeft; + break; + } + } + ASSERT( !sEffect.empty() ); + + // Set Lua color globals + LuaThreadVariable sColor1( "Color1", bd.m_sColor1.empty() ? RString("#FFFFFFFF") : bd.m_sColor1 ); + LuaThreadVariable sColor2( "Color2", bd.m_sColor2.empty() ? RString("#FFFFFFFF") : bd.m_sColor2 ); + + // Resolve the effect file. + RString sEffectFile; + for( int i=0; i<2; i++ ) + { + vector vsPaths, vsThrowAway; + BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) + { + LOG->Warn( "BackgroundEffect '%s' is missing.",sEffect.c_str() ); + sEffect = SBE_Centered; + } + else if( vsPaths.size() > 1 ) + { + LOG->Warn( "BackgroundEffect '%s' has more than one match.",sEffect.c_str() ); + sEffect = SBE_Centered; + } + else + { + sEffectFile = vsPaths[0]; + break; + } + } + ASSERT( !sEffectFile.empty() ); + + Actor *pActor = ActorUtil::MakeActor( sEffectFile ); + + ASSERT( pActor ); + m_BGAnimations[bd] = pActor; + + for( unsigned i=0; i &RandomBGAnimations, Actor *pParent ) +{ + if( g_RandomBackgroundMode == BGMODE_OFF ) + return BackgroundDef(); + + // Set to not show any BGChanges, whether scripted or random + if( GAMESTATE->m_SongOptions.GetCurrent().m_bStaticBackground ) + return BackgroundDef(); + + if( RandomBGAnimations.empty() ) + return BackgroundDef(); + + /* XXX: every time we fully loop, shuffle, so we don't play the same sequence + * over and over; and nudge the shuffle so the next one won't be a repeat */ + BackgroundDef bd = RandomBGAnimations.front(); + RandomBGAnimations.push_back( RandomBGAnimations.front() ); + RandomBGAnimations.pop_front(); + + if( !sEffect.empty() ) + bd.m_sEffect = sEffect; + + map::const_iterator iter = m_BGAnimations.find( bd ); + + // create the background if it's not already created + if( iter == m_BGAnimations.end() ) + { + bool bSuccess = CreateBackground( pSong, bd, pParent ); + ASSERT( bSuccess ); // we fed it valid files, so this shouldn't fail + } + return bd; +} + +void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const BackgroundChange &change ) +{ + int iStartRow = BeatToNoteRow(fFirstBeat); + int iEndRow = BeatToNoteRow(fEndBeat); + + const TimingData &timing = m_pSong->m_Timing; + + // change BG every time signature change or 4 measures + FOREACH_CONST( TimeSignatureSegment, timing.m_vTimeSignatureSegments, iter ) + { + vector::const_iterator next = iter; + next++; + int iSegmentEndRow = (next == timing.m_vTimeSignatureSegments.end()) ? iEndRow : next->m_iStartRow; + + for( int i=max(iter->m_iStartRow,iStartRow); iGetNoteRowsPerMeasure() ) + { + // Don't fade. It causes frame rate dip, especially on slower machines. + BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); + if( !bd.IsEmpty() ) + { + BackgroundChange c = change; + c.m_def = bd; + c.m_fStartBeat = NoteRowToBeat(i); + m_Layer[0].m_aBGChanges.push_back( c ); + } + } + } + + // change BG every BPM change that is at the beginning of a measure + for( unsigned i=0; im_iStartRow) % iter->GetNoteRowsPerMeasure() == 0 ) + { + bAtBeginningOfMeasure = true; + break; + } + } + + if( !bAtBeginningOfMeasure ) + continue; // skip + + // start so that we don't create a BGChange right on top of fEndBeat + bool bInRange = bpmseg.m_iStartRow >= iStartRow && bpmseg.m_iStartRow < iEndRow; + if( !bInRange ) + continue; // skip + + BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); + if( !bd.IsEmpty() ) + { + BackgroundChange c = change; + c.m_def.m_sFile1 = bd.m_sFile1; + c.m_def.m_sFile2 = bd.m_sFile2; + c.m_fStartBeat = NoteRowToBeat(bpmseg.m_iStartRow); + m_Layer[0].m_aBGChanges.push_back( c ); + } + } +} + +void BackgroundImpl::LoadFromSong( const Song* pSong ) +{ + Init(); + Unload(); + m_pSong = pSong; + m_StaticBackgroundDef.m_sFile1 = SONG_BACKGROUND_FILE; + + if( g_fBGBrightness == 0.0f ) + return; + + // Choose a bunch of backgrounds that we'll use for the random file marker + { + vector vsThrowAway, vsNames; + switch( g_RandomBackgroundMode ) + { + default: + ASSERT_M( 0, ssprintf("Invalid RandomBackgroundMode: %i", int(g_RandomBackgroundMode)) ); + break; + case BGMODE_OFF: + break; + case BGMODE_ANIMATIONS: + BackgroundUtil::GetGlobalBGAnimations( pSong, "", vsThrowAway, vsNames ); + break; + case BGMODE_RANDOMMOVIES: + BackgroundUtil::GetGlobalRandomMovies( pSong, "", vsThrowAway, vsNames, true, true ); + break; + } + + // Pick the same random items every time the song is played. + RandomGen rnd( GetHashForString(pSong->GetSongDir()) ); + random_shuffle( vsNames.begin(), vsNames.end(), rnd ); + int iSize = min( (int)g_iNumBackgrounds, (int)vsNames.size() ); + vsNames.resize( iSize ); + + FOREACH_CONST( RString, vsNames, s ) + { + BackgroundDef bd; + bd.m_sFile1 = *s; + m_RandomBGAnimations.push_back( bd ); + } + } + + /* Song backgrounds (even just background stills) can get very big; never keep them + * in memory. */ + RageTextureID::TexPolicy OldPolicy = TEXTUREMAN->GetDefaultTexturePolicy(); + TEXTUREMAN->SetDefaultTexturePolicy( RageTextureID::TEX_VOLATILE ); + + TEXTUREMAN->DisableOddDimensionWarning(); + + // Set to not show any BGChanges, whether scripted or random if m_bStaticBackground is on + if( !g_bSongBackgrounds || GAMESTATE->m_SongOptions.GetCurrent().m_bStaticBackground ) + { + // Backgrounds are disabled; just display the song background. + BackgroundChange change; + change.m_def = m_StaticBackgroundDef; + change.m_fStartBeat = 0; + m_Layer[0].m_aBGChanges.push_back( change ); + } + // If m_bRandomBGOnly is on, then we want to ignore the scripted BG in favour of randomly loaded BGs + else if( pSong->HasBGChanges() && !GAMESTATE->m_SongOptions.GetCurrent().m_bRandomBGOnly ) + { + FOREACH_BackgroundLayer( i ) + { + Layer &layer = m_Layer[i]; + + // Load all song-specified backgrounds + FOREACH_CONST( BackgroundChange, pSong->GetBackgroundChanges(i), bgc ) + { + BackgroundChange change = *bgc; + BackgroundDef &bd = change.m_def; + + bool bIsAlreadyLoaded = layer.m_BGAnimations.find(bd) != layer.m_BGAnimations.end(); + + if( bd.m_sFile1 != RANDOM_BACKGROUND_FILE && !bIsAlreadyLoaded ) + { + if( layer.CreateBackground( m_pSong, bd, this ) ) + { + ; // do nothing. Create was successful. + } + else + { + if( i == BACKGROUND_LAYER_1 ) + { + // The background was not found. Try to use a random one instead. + // Don't use the BackgroundDef's effect, because it may be an + // effect that requires 2 files, and random BGA will only supply one file + bd = layer.CreateRandomBGA( pSong, "", m_RandomBGAnimations, this ); + if( bd.IsEmpty() ) + bd = m_StaticBackgroundDef; + } + } + } + + if( !bd.IsEmpty() ) + layer.m_aBGChanges.push_back( change ); + } + } + } + else // pSong doesn't have an animation plan + { + Layer &layer = m_Layer[0]; + + LoadFromRandom( pSong->m_fFirstBeat, pSong->m_fLastBeat, BackgroundChange() ); + + // end showing the static song background + BackgroundChange change; + change.m_def = m_StaticBackgroundDef; + change.m_fStartBeat = pSong->m_fLastBeat; + layer.m_aBGChanges.push_back( change ); + } + + // sort segments + FOREACH_BackgroundLayer( i ) + { + Layer &layer = m_Layer[i]; + BackgroundUtil::SortBackgroundChangesArray( layer.m_aBGChanges ); + } + + Layer &mainlayer = m_Layer[0]; + + /* If the first BGAnimation isn't negative, add a lead-in image showing + * the song background. */ + if( mainlayer.m_aBGChanges.empty() || mainlayer.m_aBGChanges.front().m_fStartBeat >= 0 ) + { + BackgroundChange change; + change.m_def = m_StaticBackgroundDef; + change.m_fStartBeat = -10000; + mainlayer.m_aBGChanges.insert( mainlayer.m_aBGChanges.begin(), change ); + } + + // If any BGChanges use the background image, load it. + bool bStaticBackgroundUsed = false; + FOREACH_BackgroundLayer( i ) + { + Layer &layer = m_Layer[i]; + FOREACH_CONST( BackgroundChange, layer.m_aBGChanges, bgc ) + { + const BackgroundDef &bd = bgc->m_def; + if( bd == m_StaticBackgroundDef ) + { + bStaticBackgroundUsed = true; + break; + } + } + if( bStaticBackgroundUsed ) + break; + } + + if( bStaticBackgroundUsed ) + { + bool bIsAlreadyLoaded = mainlayer.m_BGAnimations.find(m_StaticBackgroundDef) != mainlayer.m_BGAnimations.end(); + if( !bIsAlreadyLoaded ) + { + bool bSuccess = mainlayer.CreateBackground( m_pSong, m_StaticBackgroundDef, this ); + ASSERT( bSuccess ); + } + } + + // Look for the random file marker, and replace the segment with LoadFromRandom. + for( unsigned i=0; im_fLastBeat; + if( i+1 < mainlayer.m_aBGChanges.size() ) + fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat; + + mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i ); + --i; + + LoadFromRandom( fStartBeat, fEndBeat, change ); + } + + // At this point, we shouldn't have any BGChanges to "". "" is an invalid name. + for( unsigned i=0; iEnableOddDimensionWarning(); + + if( m_pDancingCharacters ) + m_pDancingCharacters->LoadNextSong(); + + TEXTUREMAN->SetDefaultTexturePolicy( OldPolicy ); +} + +int BackgroundImpl::Layer::FindBGSegmentForBeat( float fBeat ) const +{ + if( m_aBGChanges.empty() ) + return -1; + if( fBeat < m_aBGChanges[0].m_fStartBeat ) + return -1; + + // assumption: m_aBGChanges are sorted by m_fStartBeat + int i; + for( i=m_aBGChanges.size()-1; i>=0; i-- ) + { + if( fBeat >= m_aBGChanges[i].m_fStartBeat ) + return i; + } + + return i; +} + +/* If the BG segment has changed, move focus to it. Send Update() calls. */ +void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map &mapNameToTransition ) +{ + ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID ); + + if( m_aBGChanges.size() == 0 ) + return; + + float fBeat, fBPS, fThrowAway; + bool bFreeze; + int iThrowAway; + pSong->m_Timing.GetBeatAndBPSFromElapsedTime( fCurrentTime, fBeat, fBPS, bFreeze, bFreeze, iThrowAway, fThrowAway ); + + // Calls to Update() should *not* be scaled by music rate; fCurrentTime is. Undo it. + const float fRate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; + + // Find the BGSegment we're in + const int i = FindBGSegmentForBeat( fBeat ); + + float fDeltaTime = fCurrentTime - fLastMusicSeconds; + if( i != -1 && i != m_iCurBGChangeIndex ) // we're changing backgrounds + { + //LOG->Trace( "old bga %d -> new bga %d (%s), %f, %f", m_iCurBGChangeIndex, i, m_aBGChanges[i].GetTextDescription().c_str(), m_aBGChanges[i].m_fStartBeat, fBeat ); + + BackgroundChange oldChange; + if( m_iCurBGChangeIndex != -1 ) + oldChange = m_aBGChanges[m_iCurBGChangeIndex]; + + m_iCurBGChangeIndex = i; + + const BackgroundChange& change = m_aBGChanges[i]; + + m_pFadingBGA = m_pCurrentBGA; + + map::const_iterator iter = m_BGAnimations.find( change.m_def ); + if( iter == m_BGAnimations.end() ) + { + XNode *pNode = change.m_def.CreateNode(); + RString xml = XmlFileUtil::GetXML( pNode ); + Trim( xml ); + LOG->Warn( "Tried to switch to a background that was never loaded:\n%s", xml.c_str() ); + SAFE_DELETE( pNode ); + return; + } + + m_pCurrentBGA = iter->second; + + if( m_pFadingBGA == m_pCurrentBGA ) + { + m_pFadingBGA = NULL; + //LOG->Trace( "bg didn't actually change. Ignoring." ); + } + else + { + if( m_pFadingBGA ) + { + m_pFadingBGA->PlayCommand( "LoseFocus" ); + + if( !change.m_sTransition.empty() ) + { + map::const_iterator lIter = mapNameToTransition.find( change.m_sTransition ); + ASSERT( lIter != mapNameToTransition.end() ); + const BackgroundTransition &bt = lIter->second; + m_pFadingBGA->RunCommandsOnLeaves( *bt.cmdLeaves ); + m_pFadingBGA->RunCommands( *bt.cmdRoot ); + } + } + } + + m_pCurrentBGA->SetUpdateRate( change.m_fRate ); + + m_pCurrentBGA->InitState(); + m_pCurrentBGA->PlayCommand( "On" ); + m_pCurrentBGA->PlayCommand( "GainFocus" ); + + /* How much time of this BGA have we skipped? (This happens with SetSeconds.) */ + const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( change.m_fStartBeat ); + + /* This is affected by the music rate. */ + fDeltaTime = fCurrentTime - fStartSecond; + } + + if( m_pFadingBGA ) + { + if( m_pFadingBGA->GetTweenTimeLeft() == 0 ) + m_pFadingBGA = NULL; + } + + /* This is unaffected by the music rate. */ + float fDeltaTimeNoMusicRate = max( fDeltaTime / fRate, 0 ); + + if( m_pCurrentBGA ) + m_pCurrentBGA->Update( fDeltaTimeNoMusicRate ); + if( m_pFadingBGA ) + m_pFadingBGA->Update( fDeltaTimeNoMusicRate ); +} + +void BackgroundImpl::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + { + bool bVisible = IsDangerAllVisible(); + if( m_bDangerAllWasVisible != bVisible ) + MESSAGEMAN->Broadcast( bVisible? "ShowDangerAll":"HideDangerAll" ); + m_bDangerAllWasVisible = bVisible; + } + + if( m_pDancingCharacters ) + m_pDancingCharacters->Update( fDeltaTime ); + + FOREACH_BackgroundLayer( i ) + { + Layer &layer = m_Layer[i]; + layer.UpdateCurBGChange( m_pSong, m_fLastMusicSeconds, GAMESTATE->m_fMusicSeconds, m_mapNameToTransition ); + } + m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds; +} + +void BackgroundImpl::DrawPrimitives() +{ + if( g_fBGBrightness == 0.0f ) + return; + + if( IsDangerAllVisible() ) + { + // Since this only shows when DANGER is visible, it will flash red on it's own accord :) + if( m_pDancingCharacters ) + m_pDancingCharacters->m_bDrawDangerLight = true; + } + + { + if( m_pDancingCharacters ) + m_pDancingCharacters->m_bDrawDangerLight = false; + + FOREACH_BackgroundLayer( i ) + { + Layer &layer = m_Layer[i]; + if( layer.m_pCurrentBGA ) + layer.m_pCurrentBGA->Draw(); + if( layer.m_pFadingBGA ) + layer.m_pFadingBGA->Draw(); + } + } + + if( m_pDancingCharacters ) + m_pDancingCharacters->Draw(); + + ActorFrame::DrawPrimitives(); +} + +void BackgroundImpl::GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ) +{ + FOREACH_BackgroundLayer( i ) + *pBackgroundChangesOut[i] = m_Layer[i].m_aBGChanges; +} + +bool BackgroundImpl::IsDangerAllVisible() +{ + // The players are never in danger in FAIL_OFF. + FOREACH_PlayerNumber( p ) + if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == PlayerOptions::FAIL_OFF ) + return false; + if( !g_bShowDanger ) + return false; + + /* Don't show it if everyone is already failing: it's already too late and it's + * annoying for it to show for the entire duration of a song. */ + if( STATSMAN->m_CurStageStats.AllFailed() ) + return false; + + return GAMESTATE->AllAreInDangerOrWorse(); +} + +BrightnessOverlay::BrightnessOverlay() +{ + float fQuadWidth = (RIGHT_EDGE-LEFT_EDGE)/2; + fQuadWidth -= g_fBackgroundCenterWidth/2; + + m_quadBGBrightness[0].StretchTo( RectF(LEFT_EDGE,TOP_EDGE,LEFT_EDGE+fQuadWidth,BOTTOM_EDGE) ); + m_quadBGBrightnessFade.StretchTo( RectF(LEFT_EDGE+fQuadWidth,TOP_EDGE,RIGHT_EDGE-fQuadWidth,BOTTOM_EDGE) ); + m_quadBGBrightness[1].StretchTo( RectF(RIGHT_EDGE-fQuadWidth,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) ); + + m_quadBGBrightness[0].SetName( "BrightnessOverlay" ); + ActorUtil::LoadAllCommands( m_quadBGBrightness[0], "Background" ); + this->AddChild( &m_quadBGBrightness[0] ); + + m_quadBGBrightness[1].SetName( "BrightnessOverlay" ); + ActorUtil::LoadAllCommands( m_quadBGBrightness[1], "Background" ); + this->AddChild( &m_quadBGBrightness[1] ); + + m_quadBGBrightnessFade.SetName( "BrightnessOverlay" ); + ActorUtil::LoadAllCommands( m_quadBGBrightnessFade, "Background" ); + this->AddChild( &m_quadBGBrightnessFade ); + + SetActualBrightness(); +} + +void BrightnessOverlay::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + /* If we're actually playing, then we're past fades, etc; update the + * background brightness to follow Cover. */ + if( !GAMESTATE->m_bGameplayLeadIn ) + SetActualBrightness(); +} + +void BrightnessOverlay::SetActualBrightness() +{ + float fLeftBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fCover; + float fRightBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.GetCurrent().m_fCover; + + float fBaseBGBrightness = g_fBGBrightness; + + // HACK: Always show training in full brightness + if( GAMESTATE->m_pCurSong && GAMESTATE->m_pCurSong->IsTutorial() ) + fBaseBGBrightness = 1.0f; + + fLeftBrightness *= fBaseBGBrightness; + fRightBrightness *= fBaseBGBrightness; + + if( !GAMESTATE->IsHumanPlayer(PLAYER_1) ) + fLeftBrightness = fRightBrightness; + if( !GAMESTATE->IsHumanPlayer(PLAYER_2) ) + fRightBrightness = fLeftBrightness; + + RageColor LeftColor = GetBrightnessColor(fLeftBrightness); + RageColor RightColor = GetBrightnessColor(fRightBrightness); + + m_quadBGBrightness[PLAYER_1].SetDiffuse( LeftColor ); + m_quadBGBrightness[PLAYER_2].SetDiffuse( RightColor ); + m_quadBGBrightnessFade.SetDiffuseLeftEdge( LeftColor ); + m_quadBGBrightnessFade.SetDiffuseRightEdge( RightColor ); +} + +void BrightnessOverlay::Set( float fBrightness ) +{ + RageColor c = GetBrightnessColor(fBrightness); + + FOREACH_PlayerNumber(pn) + m_quadBGBrightness[pn].SetDiffuse( c ); + m_quadBGBrightnessFade.SetDiffuse( c ); +} + +void BrightnessOverlay::FadeToActualBrightness() +{ + this->PlayCommand( "Fade" ); + SetActualBrightness(); +} + +Background::Background() { m_pImpl = new BackgroundImpl; this->AddChild(m_pImpl); } +Background::~Background() { SAFE_DELETE( m_pImpl ); } +void Background::Init() { m_pImpl->Init(); } +void Background::LoadFromSong( const Song *pSong ) { m_pImpl->LoadFromSong(pSong); } +void Background::Unload() { m_pImpl->Unload(); } +void Background::FadeToActualBrightness() { m_pImpl->FadeToActualBrightness(); } +void Background::SetBrightness( float fBrightness ) { m_pImpl->SetBrightness(fBrightness); } +DancingCharacters* Background::GetDancingCharacters() { return m_pImpl->GetDancingCharacters(); } +void Background::GetLoadedBackgroundChanges( vector *pBackgroundChangesOut[NUM_BackgroundLayer] ) { m_pImpl->GetLoadedBackgroundChanges(pBackgroundChangesOut); } + +/* + * (c) 2001-2004 Chris Danford, Ben Nordstrom + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Background.h b/src/Background.h index 1435d2e7e8..9b86644750 100644 --- a/src/Background.h +++ b/src/Background.h @@ -1,64 +1,64 @@ -#ifndef BACKGROUND_H -#define BACKGROUND_H - -#include "ActorFrame.h" -#include "Quad.h" -#include "PlayerNumber.h" -#include "BackgroundUtil.h" - -class DancingCharacters; -class Song; -class BackgroundImpl; -/** @brief the Background that is behind the notes while playing. */ -class Background : public ActorFrame -{ -public: - Background(); - ~Background(); - void Init(); - - virtual void LoadFromSong( const Song *pSong ); - virtual void Unload(); - - void FadeToActualBrightness(); - void SetBrightness( float fBrightness ); // overrides pref and Cover - - /** - * @brief Retrieve whatever dancing characters are in use. - * @return the dancing characters. */ - DancingCharacters* GetDancingCharacters(); - - void GetLoadedBackgroundChanges( vector **pBackgroundChangesOut ); - -protected: - BackgroundImpl *m_pImpl; -}; - -#endif - -/** - * @file - * @author Chris Danford, Ben Nordstrom (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BACKGROUND_H +#define BACKGROUND_H + +#include "ActorFrame.h" +#include "Quad.h" +#include "PlayerNumber.h" +#include "BackgroundUtil.h" + +class DancingCharacters; +class Song; +class BackgroundImpl; +/** @brief the Background that is behind the notes while playing. */ +class Background : public ActorFrame +{ +public: + Background(); + ~Background(); + void Init(); + + virtual void LoadFromSong( const Song *pSong ); + virtual void Unload(); + + void FadeToActualBrightness(); + void SetBrightness( float fBrightness ); // overrides pref and Cover + + /** + * @brief Retrieve whatever dancing characters are in use. + * @return the dancing characters. */ + DancingCharacters* GetDancingCharacters(); + + void GetLoadedBackgroundChanges( vector **pBackgroundChangesOut ); + +protected: + BackgroundImpl *m_pImpl; +}; + +#endif + +/** + * @file + * @author Chris Danford, Ben Nordstrom (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BackgroundUtil.cpp b/src/BackgroundUtil.cpp index a66a27dbf2..e0a697ee5c 100644 --- a/src/BackgroundUtil.cpp +++ b/src/BackgroundUtil.cpp @@ -1,363 +1,363 @@ -#include "global.h" -#include "BackgroundUtil.h" -#include "RageUtil.h" -#include "Song.h" -#include "Foreach.h" -#include "IniFile.h" -#include "RageLog.h" -#include -#include "Background.h" - - -bool BackgroundDef::operator<( const BackgroundDef &other ) const -{ -#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false; - COMPARE( m_sEffect ); - COMPARE( m_sFile1 ); - COMPARE( m_sFile2 ); - COMPARE( m_sColor1 ); - COMPARE( m_sColor2 ); -#undef COMPARE - return false; -} - -bool BackgroundDef::operator==( const BackgroundDef &other ) const -{ - return - m_sEffect == other.m_sEffect && - m_sFile1 == other.m_sFile1 && - m_sFile2 == other.m_sFile2 && - m_sColor1 == other.m_sColor1 && - m_sColor2 == other.m_sColor2; -} - -XNode *BackgroundDef::CreateNode() const -{ - XNode* pNode = new XNode( "BackgroundDef" ); - - if( !m_sEffect.empty() ) - pNode->AppendAttr( "Effect", m_sEffect ); - if( !m_sFile1.empty() ) - pNode->AppendAttr( "File1", m_sFile1 ); - if( !m_sFile2.empty() ) - pNode->AppendAttr( "File2", m_sFile2 ); - if( !m_sColor1.empty() ) - pNode->AppendAttr( "Color1", m_sColor1 ); - if( !m_sColor2.empty() ) - pNode->AppendAttr( "Color2", m_sColor2 ); - - return pNode; -} - - -RString BackgroundChange::GetTextDescription() const -{ - vector vsParts; - if( !m_def.m_sFile1.empty() ) vsParts.push_back( m_def.m_sFile1 ); - if( !m_def.m_sFile2.empty() ) vsParts.push_back( m_def.m_sFile2 ); - if( m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) ); - if( !m_sTransition.empty() ) vsParts.push_back( m_sTransition ); - if( !m_def.m_sEffect.empty() ) vsParts.push_back( m_def.m_sEffect ); - if( !m_def.m_sColor1.empty() ) vsParts.push_back( m_def.m_sColor1 ); - if( !m_def.m_sColor2.empty() ) vsParts.push_back( m_def.m_sColor2 ); - - if( vsParts.empty() ) - vsParts.push_back( "(empty)" ); - - RString s = join( "\n", vsParts ); - return s; -} - - -const RString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/"; -const RString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; -const RString BG_ANIMS_DIR = "BGAnimations/"; -const RString VISUALIZATIONS_DIR = "Visualizations/"; -const RString RANDOMMOVIES_DIR = "RandomMovies/"; -const RString SONG_MOVIES_DIR = "SongMovies/"; - -const RString RANDOM_BACKGROUND_FILE = "-random-"; -const RString NO_SONG_BG_FILE = "-nosongbg-"; -const RString SONG_BACKGROUND_FILE = "songbackground"; - -const RString SBE_UpperLeft = "UpperLeft"; -const RString SBE_Centered = "Centered"; -const RString SBE_StretchNormal = "StretchNormal"; -const RString SBE_StretchNoLoop = "StretchNoLoop"; -const RString SBE_StretchRewind = "StretchRewind"; -const RString SBT_CrossFade = "CrossFade"; - -static void StripCvsAndSvn( vector &vsPathsToStrip, vector &vsNamesToStrip ) -{ - ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() ); - for( unsigned i=0; i &vBackgroundChanges ) -{ - sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges ); -} - -void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector &vsPathsOut, vector &vsNamesOut ) -{ - RString sName = _sName; - if( sName == "" ) - sName = "*"; - - vsPathsOut.clear(); - GetDirListing( BACKGROUND_EFFECTS_DIR+sName+".lua", vsPathsOut, false, true ); - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector &vsPathsOut, vector &vsNamesOut ) -{ - RString sName = _sName; - if( sName == "" ) - sName = "*"; - - vsPathsOut.clear(); - GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".xml", vsPathsOut, false, true ); - GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".lua", vsPathsOut, false, true ); - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) -{ - vsPathsOut.clear(); - if( sMatch.empty() ) - { - GetDirListing( pSong->GetSongDir()+"*", vsPathsOut, true, true ); - } - else - { - GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, true, true ); - } - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( Basename(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) -{ - vsPathsOut.clear(); - if( sMatch.empty() ) - { - GetDirListing( pSong->GetSongDir()+sMatch+"*.ogv", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.avi", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.mpg", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.mpeg", vsPathsOut, false, true ); - } - else - { - GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, false, true ); - } - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( Basename(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) -{ - vsPathsOut.clear(); - if( sMatch.empty() ) - { - GetDirListing( pSong->GetSongDir()+sMatch+"*.png", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.jpg", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.gif", vsPathsOut, false, true ); - GetDirListing( pSong->GetSongDir()+sMatch+"*.bmp", vsPathsOut, false, true ); - } - else - { - GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, false, true ); - } - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( Basename(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set &vsPossibleFileNamesOut ) -{ - vsPossibleFileNamesOut.clear(); - - if( pSong->m_sGenre.empty() ) - return; - - ASSERT( !pSong->m_sGroupName.empty() ); - IniFile ini; - RString sPath = sBaseDir+pSong->m_sGroupName+"/"+"BackgroundMapping.ini"; - ini.ReadFile( sPath ); - - RString sSection; - bool bSuccess = ini.GetValue( "GenreToSection", pSong->m_sGenre, sSection ); - if( !bSuccess ) - { - LOG->Warn( "Genre '%s' isn't mapped", pSong->m_sGenre.c_str() ); - return; - } - - XNode *pSection = ini.GetChild( sSection ); - if( pSection == NULL ) - { - ASSERT_M( 0, ssprintf("File '%s' refers to a section '%s' that is missing.", sPath.c_str(), sSection.c_str()) ); - return; - } - - FOREACH_CONST_Attr( pSection, p ) - vsPossibleFileNamesOut.insert( p->first ); -} - -void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) -{ - vsPathsOut.clear(); - GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true ); - GetDirListing( BG_ANIMS_DIR+sMatch+"*.xml", vsPathsOut, false, true ); - - vsNamesOut.clear(); - FOREACH_CONST( RString, vsPathsOut, s ) - vsNamesOut.push_back( Basename(*s) ); - - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::GetGlobalRandomMovies( - const Song *pSong, - const RString &sMatch, - vector &vsPathsOut, - vector &vsNamesOut, - bool bTryInsideOfSongGroupAndGenreFirst, - bool bTryInsideOfSongGroupFirst ) -{ - vsPathsOut.clear(); - vsNamesOut.clear(); - - // Check for an exact match - if( !sMatch.empty() ) - { - GetDirListing( SONG_MOVIES_DIR+pSong->m_sGroupName+"/"+sMatch, vsPathsOut, false, true ); // search in SongMovies/SongGroupName/ first - GetDirListing( SONG_MOVIES_DIR+sMatch, vsPathsOut, false, true ); - GetDirListing( RANDOMMOVIES_DIR+sMatch, vsPathsOut, false, true ); - if( !vsPathsOut.empty() ) - goto found_files; - - if( sMatch != NO_SONG_BG_FILE ) - LOG->Warn( "Background missing: %s", sMatch.c_str() ); - return; - } - - // Search for the most appropriate background - { - set ssFileNameWhitelist; - if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() ) - GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist ); - - vector vsDirsToTry; - if( bTryInsideOfSongGroupFirst && pSong ) - { - ASSERT( !pSong->m_sGroupName.empty() ); - vsDirsToTry.push_back( RANDOMMOVIES_DIR+pSong->m_sGroupName+"/" ); - } - vsDirsToTry.push_back( RANDOMMOVIES_DIR ); - - FOREACH_CONST( RString, vsDirsToTry, sDir ) - { - GetDirListing( *sDir+"*.ogv", vsPathsOut, false, true ); - GetDirListing( *sDir+"*.avi", vsPathsOut, false, true ); - GetDirListing( *sDir+"*.mpg", vsPathsOut, false, true ); - GetDirListing( *sDir+"*.mpeg", vsPathsOut, false, true ); - - if( !ssFileNameWhitelist.empty() ) - { - vector vsMatches; - FOREACH_CONST( RString, vsPathsOut, s ) - { - RString sBasename = Basename( *s ); - bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end(); - if( bFound ) - vsMatches.push_back(*s); - } - // If we found any that match the whitelist, use only them. - // If none match the whitelist, ignore the whitelist.. - if( !vsMatches.empty() ) - vsPathsOut = vsMatches; - } - - if( !vsPathsOut.empty() ) - goto found_files; - } - } - -found_files: - - FOREACH_CONST( RString, vsPathsOut, s ) - { - RString sName = s->Right( s->size() - RANDOMMOVIES_DIR.size() - 1 ); - vsNamesOut.push_back( sName ); - } - StripCvsAndSvn( vsPathsOut, vsNamesOut ); -} - -void BackgroundUtil::BakeAllBackgroundChanges( Song *pSong ) -{ - Background bg; - bg.LoadFromSong( pSong ); - vector *vBGChanges[NUM_BackgroundLayer]; - FOREACH_BackgroundLayer( i ) - vBGChanges[i] = &pSong->GetBackgroundChanges(i); - bg.GetLoadedBackgroundChanges( vBGChanges ); -} - -/* - * (c) 2001-2004 Chris Danford, Ben Nordstrom - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "BackgroundUtil.h" +#include "RageUtil.h" +#include "Song.h" +#include "Foreach.h" +#include "IniFile.h" +#include "RageLog.h" +#include +#include "Background.h" + + +bool BackgroundDef::operator<( const BackgroundDef &other ) const +{ +#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false; + COMPARE( m_sEffect ); + COMPARE( m_sFile1 ); + COMPARE( m_sFile2 ); + COMPARE( m_sColor1 ); + COMPARE( m_sColor2 ); +#undef COMPARE + return false; +} + +bool BackgroundDef::operator==( const BackgroundDef &other ) const +{ + return + m_sEffect == other.m_sEffect && + m_sFile1 == other.m_sFile1 && + m_sFile2 == other.m_sFile2 && + m_sColor1 == other.m_sColor1 && + m_sColor2 == other.m_sColor2; +} + +XNode *BackgroundDef::CreateNode() const +{ + XNode* pNode = new XNode( "BackgroundDef" ); + + if( !m_sEffect.empty() ) + pNode->AppendAttr( "Effect", m_sEffect ); + if( !m_sFile1.empty() ) + pNode->AppendAttr( "File1", m_sFile1 ); + if( !m_sFile2.empty() ) + pNode->AppendAttr( "File2", m_sFile2 ); + if( !m_sColor1.empty() ) + pNode->AppendAttr( "Color1", m_sColor1 ); + if( !m_sColor2.empty() ) + pNode->AppendAttr( "Color2", m_sColor2 ); + + return pNode; +} + + +RString BackgroundChange::GetTextDescription() const +{ + vector vsParts; + if( !m_def.m_sFile1.empty() ) vsParts.push_back( m_def.m_sFile1 ); + if( !m_def.m_sFile2.empty() ) vsParts.push_back( m_def.m_sFile2 ); + if( m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) ); + if( !m_sTransition.empty() ) vsParts.push_back( m_sTransition ); + if( !m_def.m_sEffect.empty() ) vsParts.push_back( m_def.m_sEffect ); + if( !m_def.m_sColor1.empty() ) vsParts.push_back( m_def.m_sColor1 ); + if( !m_def.m_sColor2.empty() ) vsParts.push_back( m_def.m_sColor2 ); + + if( vsParts.empty() ) + vsParts.push_back( "(empty)" ); + + RString s = join( "\n", vsParts ); + return s; +} + + +const RString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/"; +const RString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; +const RString BG_ANIMS_DIR = "BGAnimations/"; +const RString VISUALIZATIONS_DIR = "Visualizations/"; +const RString RANDOMMOVIES_DIR = "RandomMovies/"; +const RString SONG_MOVIES_DIR = "SongMovies/"; + +const RString RANDOM_BACKGROUND_FILE = "-random-"; +const RString NO_SONG_BG_FILE = "-nosongbg-"; +const RString SONG_BACKGROUND_FILE = "songbackground"; + +const RString SBE_UpperLeft = "UpperLeft"; +const RString SBE_Centered = "Centered"; +const RString SBE_StretchNormal = "StretchNormal"; +const RString SBE_StretchNoLoop = "StretchNoLoop"; +const RString SBE_StretchRewind = "StretchRewind"; +const RString SBT_CrossFade = "CrossFade"; + +static void StripCvsAndSvn( vector &vsPathsToStrip, vector &vsNamesToStrip ) +{ + ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() ); + for( unsigned i=0; i &vBackgroundChanges ) +{ + sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges ); +} + +void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector &vsPathsOut, vector &vsNamesOut ) +{ + RString sName = _sName; + if( sName == "" ) + sName = "*"; + + vsPathsOut.clear(); + GetDirListing( BACKGROUND_EFFECTS_DIR+sName+".lua", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector &vsPathsOut, vector &vsNamesOut ) +{ + RString sName = _sName; + if( sName == "" ) + sName = "*"; + + vsPathsOut.clear(); + GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".xml", vsPathsOut, false, true ); + GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".lua", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + if( sMatch.empty() ) + { + GetDirListing( pSong->GetSongDir()+"*", vsPathsOut, true, true ); + } + else + { + GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, true, true ); + } + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + if( sMatch.empty() ) + { + GetDirListing( pSong->GetSongDir()+sMatch+"*.ogv", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.avi", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.mpg", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.mpeg", vsPathsOut, false, true ); + } + else + { + GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, false, true ); + } + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + if( sMatch.empty() ) + { + GetDirListing( pSong->GetSongDir()+sMatch+"*.png", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.jpg", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.gif", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.bmp", vsPathsOut, false, true ); + } + else + { + GetDirListing( pSong->GetSongDir()+sMatch, vsPathsOut, false, true ); + } + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set &vsPossibleFileNamesOut ) +{ + vsPossibleFileNamesOut.clear(); + + if( pSong->m_sGenre.empty() ) + return; + + ASSERT( !pSong->m_sGroupName.empty() ); + IniFile ini; + RString sPath = sBaseDir+pSong->m_sGroupName+"/"+"BackgroundMapping.ini"; + ini.ReadFile( sPath ); + + RString sSection; + bool bSuccess = ini.GetValue( "GenreToSection", pSong->m_sGenre, sSection ); + if( !bSuccess ) + { + LOG->Warn( "Genre '%s' isn't mapped", pSong->m_sGenre.c_str() ); + return; + } + + XNode *pSection = ini.GetChild( sSection ); + if( pSection == NULL ) + { + ASSERT_M( 0, ssprintf("File '%s' refers to a section '%s' that is missing.", sPath.c_str(), sSection.c_str()) ); + return; + } + + FOREACH_CONST_Attr( pSection, p ) + vsPossibleFileNamesOut.insert( p->first ); +} + +void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true ); + GetDirListing( BG_ANIMS_DIR+sMatch+"*.xml", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( RString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetGlobalRandomMovies( + const Song *pSong, + const RString &sMatch, + vector &vsPathsOut, + vector &vsNamesOut, + bool bTryInsideOfSongGroupAndGenreFirst, + bool bTryInsideOfSongGroupFirst ) +{ + vsPathsOut.clear(); + vsNamesOut.clear(); + + // Check for an exact match + if( !sMatch.empty() ) + { + GetDirListing( SONG_MOVIES_DIR+pSong->m_sGroupName+"/"+sMatch, vsPathsOut, false, true ); // search in SongMovies/SongGroupName/ first + GetDirListing( SONG_MOVIES_DIR+sMatch, vsPathsOut, false, true ); + GetDirListing( RANDOMMOVIES_DIR+sMatch, vsPathsOut, false, true ); + if( !vsPathsOut.empty() ) + goto found_files; + + if( sMatch != NO_SONG_BG_FILE ) + LOG->Warn( "Background missing: %s", sMatch.c_str() ); + return; + } + + // Search for the most appropriate background + { + set ssFileNameWhitelist; + if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() ) + GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist ); + + vector vsDirsToTry; + if( bTryInsideOfSongGroupFirst && pSong ) + { + ASSERT( !pSong->m_sGroupName.empty() ); + vsDirsToTry.push_back( RANDOMMOVIES_DIR+pSong->m_sGroupName+"/" ); + } + vsDirsToTry.push_back( RANDOMMOVIES_DIR ); + + FOREACH_CONST( RString, vsDirsToTry, sDir ) + { + GetDirListing( *sDir+"*.ogv", vsPathsOut, false, true ); + GetDirListing( *sDir+"*.avi", vsPathsOut, false, true ); + GetDirListing( *sDir+"*.mpg", vsPathsOut, false, true ); + GetDirListing( *sDir+"*.mpeg", vsPathsOut, false, true ); + + if( !ssFileNameWhitelist.empty() ) + { + vector vsMatches; + FOREACH_CONST( RString, vsPathsOut, s ) + { + RString sBasename = Basename( *s ); + bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end(); + if( bFound ) + vsMatches.push_back(*s); + } + // If we found any that match the whitelist, use only them. + // If none match the whitelist, ignore the whitelist.. + if( !vsMatches.empty() ) + vsPathsOut = vsMatches; + } + + if( !vsPathsOut.empty() ) + goto found_files; + } + } + +found_files: + + FOREACH_CONST( RString, vsPathsOut, s ) + { + RString sName = s->Right( s->size() - RANDOMMOVIES_DIR.size() - 1 ); + vsNamesOut.push_back( sName ); + } + StripCvsAndSvn( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::BakeAllBackgroundChanges( Song *pSong ) +{ + Background bg; + bg.LoadFromSong( pSong ); + vector *vBGChanges[NUM_BackgroundLayer]; + FOREACH_BackgroundLayer( i ) + vBGChanges[i] = &pSong->GetBackgroundChanges(i); + bg.GetLoadedBackgroundChanges( vBGChanges ); +} + +/* + * (c) 2001-2004 Chris Danford, Ben Nordstrom + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BackgroundUtil.h b/src/BackgroundUtil.h index be93fa640e..ca813484d8 100644 --- a/src/BackgroundUtil.h +++ b/src/BackgroundUtil.h @@ -1,105 +1,105 @@ -#ifndef BackgroundUtil_H -#define BackgroundUtil_H - -class Song; -class XNode; - -extern const RString RANDOM_BACKGROUND_FILE; -extern const RString NO_SONG_BG_FILE; -extern const RString SONG_BACKGROUND_FILE; - -extern const RString SBE_UpperLeft; -extern const RString SBE_Centered; -extern const RString SBE_StretchNormal; -extern const RString SBE_StretchNoLoop; -extern const RString SBE_StretchRewind; -extern const RString SBT_CrossFade; - -struct BackgroundDef -{ - bool operator<( const BackgroundDef &other ) const; - bool operator==( const BackgroundDef &other ) const; - bool IsEmpty() const { return m_sFile1.empty() && m_sFile2.empty(); } - RString m_sEffect; // "" == automatically choose - RString m_sFile1; // must not be "" - RString m_sFile2; // may be "" - RString m_sColor1; // "" == use default - RString m_sColor2; // "" == use default - - XNode *CreateNode() const; -}; - -struct BackgroundChange -{ - BackgroundChange() - { - m_fStartBeat=-1; - m_fRate=1; - } - BackgroundChange( - float s, - RString f1, - RString f2=RString(), - float r=1.f, - RString e=SBE_Centered, - RString t=RString() - ) - { - m_fStartBeat=s; - m_def.m_sFile1=f1; - m_def.m_sFile2=f2; - m_fRate=r; - m_def.m_sEffect=e; - m_sTransition=t; - } - BackgroundDef m_def; - float m_fStartBeat; - float m_fRate; - RString m_sTransition; - - RString GetTextDescription() const; -}; -/** @brief Shared background-related routines. */ -namespace BackgroundUtil -{ - void SortBackgroundChangesArray( vector &vBackgroundChanges ); - - void GetBackgroundEffects( const RString &sName, vector &vsPathsOut, vector &vsNamesOut ); - void GetBackgroundTransitions( const RString &sName, vector &vsPathsOut, vector &vsNamesOut ); - - void GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); - void GetSongMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); - void GetSongBitmaps( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); - void GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); - void GetGlobalRandomMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true ); - - void BakeAllBackgroundChanges( Song *pSong ); -}; - - -#endif - -/* - * (c) 2001-2004 Chris Danford, Ben Nordstrom - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BackgroundUtil_H +#define BackgroundUtil_H + +class Song; +class XNode; + +extern const RString RANDOM_BACKGROUND_FILE; +extern const RString NO_SONG_BG_FILE; +extern const RString SONG_BACKGROUND_FILE; + +extern const RString SBE_UpperLeft; +extern const RString SBE_Centered; +extern const RString SBE_StretchNormal; +extern const RString SBE_StretchNoLoop; +extern const RString SBE_StretchRewind; +extern const RString SBT_CrossFade; + +struct BackgroundDef +{ + bool operator<( const BackgroundDef &other ) const; + bool operator==( const BackgroundDef &other ) const; + bool IsEmpty() const { return m_sFile1.empty() && m_sFile2.empty(); } + RString m_sEffect; // "" == automatically choose + RString m_sFile1; // must not be "" + RString m_sFile2; // may be "" + RString m_sColor1; // "" == use default + RString m_sColor2; // "" == use default + + XNode *CreateNode() const; +}; + +struct BackgroundChange +{ + BackgroundChange() + { + m_fStartBeat=-1; + m_fRate=1; + } + BackgroundChange( + float s, + RString f1, + RString f2=RString(), + float r=1.f, + RString e=SBE_Centered, + RString t=RString() + ) + { + m_fStartBeat=s; + m_def.m_sFile1=f1; + m_def.m_sFile2=f2; + m_fRate=r; + m_def.m_sEffect=e; + m_sTransition=t; + } + BackgroundDef m_def; + float m_fStartBeat; + float m_fRate; + RString m_sTransition; + + RString GetTextDescription() const; +}; +/** @brief Shared background-related routines. */ +namespace BackgroundUtil +{ + void SortBackgroundChangesArray( vector &vBackgroundChanges ); + + void GetBackgroundEffects( const RString &sName, vector &vsPathsOut, vector &vsNamesOut ); + void GetBackgroundTransitions( const RString &sName, vector &vsPathsOut, vector &vsNamesOut ); + + void GetSongBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetSongMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetSongBitmaps( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetGlobalBGAnimations( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetGlobalRandomMovies( const Song *pSong, const RString &sMatch, vector &vsPathsOut, vector &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true ); + + void BakeAllBackgroundChanges( Song *pSong ); +}; + + +#endif + +/* + * (c) 2001-2004 Chris Danford, Ben Nordstrom + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Banner.cpp b/src/Banner.cpp index eec43af0de..3f8b7a8b09 100644 --- a/src/Banner.cpp +++ b/src/Banner.cpp @@ -1,347 +1,347 @@ -#include "global.h" -#include "Banner.h" -#include "BannerCache.h" -#include "SongManager.h" -#include "RageUtil.h" -#include "Song.h" -#include "RageTextureManager.h" -#include "Course.h" -#include "Character.h" -#include "ThemeMetric.h" -#include "CharacterManager.h" -#include "ActorUtil.h" -#include "UnlockManager.h" -#include "PrefsManager.h" - -REGISTER_ACTOR_CLASS( Banner ); - -ThemeMetric SCROLL_RANDOM ("Banner","ScrollRandom"); -ThemeMetric SCROLL_ROULETTE ("Banner","ScrollRoulette"); - -Banner::Banner() -{ - m_bScrolling = false; - m_fPercentScrolling = 0; -} - -// Ugly: if sIsBanner is false, we're actually loading something other than a banner. -void Banner::Load( RageTextureID ID, bool bIsBanner ) -{ - if( ID.filename == "" ) - { - LoadFallback(); - return; - } - - if( bIsBanner ) - ID = SongBannerTexture(ID); - - m_fPercentScrolling = 0; - m_bScrolling = false; - - TEXTUREMAN->DisableOddDimensionWarning(); - TEXTUREMAN->VolatileTexture( ID ); - Sprite::Load( ID ); - TEXTUREMAN->EnableOddDimensionWarning(); -}; - -void Banner::LoadFromCachedBanner( const RString &sPath ) -{ - if( sPath.empty() ) - { - LoadFallback(); - return; - } - - RageTextureID ID; - bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL); - if( !bLowRes ) - { - ID = Sprite::SongBannerTexture( sPath ); - } - else - { - // Try to load the low quality version. - ID = BANNERCACHE->LoadCachedBanner( sPath ); - } - - if( TEXTUREMAN->IsTextureRegistered(ID) ) - Load( ID ); - else if( IsAFile(sPath) ) - Load( sPath ); - else - LoadFallback(); -} - -void Banner::Update( float fDeltaTime ) -{ - Sprite::Update( fDeltaTime ); - - if( m_bScrolling ) - { - m_fPercentScrolling += fDeltaTime/2; - m_fPercentScrolling -= (int)m_fPercentScrolling; - - const RectF *pTextureRect = GetCurrentTextureCoordRect(); - - float fTexCoords[8] = - { - 0+m_fPercentScrolling, pTextureRect->top, // top left - 0+m_fPercentScrolling, pTextureRect->bottom, // bottom left - 1+m_fPercentScrolling, pTextureRect->bottom, // bottom right - 1+m_fPercentScrolling, pTextureRect->top, // top right - }; - Sprite::SetCustomTextureCoords( fTexCoords ); - } -} - -void Banner::SetScrolling( bool bScroll, float Percent) -{ - m_bScrolling = bScroll; - m_fPercentScrolling = Percent; - - // Set up the texture coord rects for the current state. - Update(0); -} - -void Banner::LoadFromSong( Song* pSong ) // NULL means no song -{ - if( pSong == NULL ) LoadFallback(); - else if( pSong->HasBanner() ) Load( pSong->GetBannerPath() ); - else LoadFallback(); - - m_bScrolling = false; -} - -void Banner::LoadMode() -{ - Load( THEME->GetPathG("Banner","Mode") ); - m_bScrolling = false; -} - -void Banner::LoadFromSongGroup( RString sSongGroup ) -{ - RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); - if( sGroupBannerPath != "" ) Load( sGroupBannerPath ); - else LoadFallback(); - m_bScrolling = false; -} - -void Banner::LoadFromCourse( const Course *pCourse ) // NULL means no course -{ - if( pCourse == NULL ) LoadFallback(); - else if( pCourse->GetBannerPath() != "" ) Load( pCourse->GetBannerPath() ); - else LoadCourseFallback(); - - m_bScrolling = false; -} - -void Banner::LoadCardFromCharacter( const Character *pCharacter ) -{ - if( pCharacter == NULL ) LoadFallback(); - else if( pCharacter->GetCardPath() != "" ) Load( pCharacter->GetCardPath() ); - else LoadFallback(); - - m_bScrolling = false; -} - -void Banner::LoadIconFromCharacter( const Character *pCharacter ) -{ - if( pCharacter == NULL ) LoadFallbackCharacterIcon(); - else if( pCharacter->GetIconPath() != "" ) Load( pCharacter->GetIconPath(), false ); - else LoadFallbackCharacterIcon(); - - m_bScrolling = false; -} - -void Banner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE ) -{ - if( pUE == NULL ) - LoadFallback(); - else - { - RString sFile = pUE->GetBannerFile(); - Load( sFile ); - m_bScrolling = false; - } -} - -void Banner::LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE ) -{ - if( pUE == NULL ) - LoadFallback(); - else - { - RString sFile = pUE->GetBackgroundFile(); - Load( sFile ); - m_bScrolling = false; - } -} - -void Banner::LoadFallback() -{ - Load( THEME->GetPathG("Common","fallback banner") ); -} - -void Banner::LoadFallbackBG() -{ - Load( THEME->GetPathG("Common","fallback background") ); -} - -void Banner::LoadCourseFallback() -{ - Load( THEME->GetPathG("Banner","course fallback") ); -} - -void Banner::LoadFallbackCharacterIcon() -{ - Character *pCharacter = CHARMAN->GetDefaultCharacter(); - if( pCharacter && !pCharacter->GetIconPath().empty() ) - Load( pCharacter->GetIconPath(), false ); - else - LoadFallback(); -} - -void Banner::LoadRoulette() -{ - Load( THEME->GetPathG("Banner","roulette") ); - m_bScrolling = (bool)SCROLL_ROULETTE; -} - -void Banner::LoadRandom() -{ - Load( THEME->GetPathG("Banner","random") ); - m_bScrolling = (bool)SCROLL_RANDOM; -} - -void Banner::LoadFromSortOrder( SortOrder so ) -{ - // TODO: See if the check for NULL/PREFERRED(?) is needed. - if( so == SortOrder_Invalid ) - { - LoadFallback(); - } - else - { - if( so != SORT_GROUP && so != SORT_RECENT ) - Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(so).c_str())) ); - } - m_bScrolling = false; -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the Banner. */ -class LunaBanner: public Luna -{ -public: - static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int LoadFromSong( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } - else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } - return 0; - } - static int LoadFromCourse( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } - else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } - return 0; - } - static int LoadFromCachedBanner( T* p, lua_State *L ) - { - p->LoadFromCachedBanner( SArg(1) ); - return 0; - } - static int LoadIconFromCharacter( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } - else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; - } - static int LoadCardFromCharacter( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } - else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; - } - static int LoadBannerFromUnlockEntry( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadBannerFromUnlockEntry( NULL ); } - else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBannerFromUnlockEntry( pUE ); } - return 0; - } - static int LoadBackgroundFromUnlockEntry( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadBackgroundFromUnlockEntry( NULL ); } - else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBackgroundFromUnlockEntry( pUE ); } - return 0; - } - static int LoadFromSongGroup( T* p, lua_State *L ) - { - p->LoadFromSongGroup( SArg(1) ); - return 0; - } - static int LoadFromSortOrder( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadFromSortOrder( SortOrder_Invalid ); } - else - { - SortOrder so = Enum::Check(L, 1); - p->LoadFromSortOrder( so ); - } - return 0; - } - static int GetScrolling( T* p, lua_State *L ){ lua_pushboolean( L, p->GetScrolling() ); return 1; } - static int SetScrolling( T* p, lua_State *L ){ p->SetScrolling( BArg(1), FArg(2) ); return 0; } - static int GetPercentScrolling( T* p, lua_State *L ){ lua_pushnumber( L, p->ScrollingPercent() ); return 1; } - - LunaBanner() - { - ADD_METHOD( scaletoclipped ); - ADD_METHOD( ScaleToClipped ); - ADD_METHOD( LoadFromSong ); - ADD_METHOD( LoadFromCourse ); - ADD_METHOD( LoadFromCachedBanner ); - ADD_METHOD( LoadIconFromCharacter ); - ADD_METHOD( LoadCardFromCharacter ); - ADD_METHOD( LoadBannerFromUnlockEntry ); - ADD_METHOD( LoadBackgroundFromUnlockEntry ); - ADD_METHOD( LoadFromSongGroup ); - ADD_METHOD( LoadFromSortOrder ); - ADD_METHOD( GetScrolling ); - ADD_METHOD( SetScrolling ); - ADD_METHOD( GetPercentScrolling ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( Banner, Sprite ) -// lua end - - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Banner.h" +#include "BannerCache.h" +#include "SongManager.h" +#include "RageUtil.h" +#include "Song.h" +#include "RageTextureManager.h" +#include "Course.h" +#include "Character.h" +#include "ThemeMetric.h" +#include "CharacterManager.h" +#include "ActorUtil.h" +#include "UnlockManager.h" +#include "PrefsManager.h" + +REGISTER_ACTOR_CLASS( Banner ); + +ThemeMetric SCROLL_RANDOM ("Banner","ScrollRandom"); +ThemeMetric SCROLL_ROULETTE ("Banner","ScrollRoulette"); + +Banner::Banner() +{ + m_bScrolling = false; + m_fPercentScrolling = 0; +} + +// Ugly: if sIsBanner is false, we're actually loading something other than a banner. +void Banner::Load( RageTextureID ID, bool bIsBanner ) +{ + if( ID.filename == "" ) + { + LoadFallback(); + return; + } + + if( bIsBanner ) + ID = SongBannerTexture(ID); + + m_fPercentScrolling = 0; + m_bScrolling = false; + + TEXTUREMAN->DisableOddDimensionWarning(); + TEXTUREMAN->VolatileTexture( ID ); + Sprite::Load( ID ); + TEXTUREMAN->EnableOddDimensionWarning(); +}; + +void Banner::LoadFromCachedBanner( const RString &sPath ) +{ + if( sPath.empty() ) + { + LoadFallback(); + return; + } + + RageTextureID ID; + bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL); + if( !bLowRes ) + { + ID = Sprite::SongBannerTexture( sPath ); + } + else + { + // Try to load the low quality version. + ID = BANNERCACHE->LoadCachedBanner( sPath ); + } + + if( TEXTUREMAN->IsTextureRegistered(ID) ) + Load( ID ); + else if( IsAFile(sPath) ) + Load( sPath ); + else + LoadFallback(); +} + +void Banner::Update( float fDeltaTime ) +{ + Sprite::Update( fDeltaTime ); + + if( m_bScrolling ) + { + m_fPercentScrolling += fDeltaTime/2; + m_fPercentScrolling -= (int)m_fPercentScrolling; + + const RectF *pTextureRect = GetCurrentTextureCoordRect(); + + float fTexCoords[8] = + { + 0+m_fPercentScrolling, pTextureRect->top, // top left + 0+m_fPercentScrolling, pTextureRect->bottom, // bottom left + 1+m_fPercentScrolling, pTextureRect->bottom, // bottom right + 1+m_fPercentScrolling, pTextureRect->top, // top right + }; + Sprite::SetCustomTextureCoords( fTexCoords ); + } +} + +void Banner::SetScrolling( bool bScroll, float Percent) +{ + m_bScrolling = bScroll; + m_fPercentScrolling = Percent; + + // Set up the texture coord rects for the current state. + Update(0); +} + +void Banner::LoadFromSong( Song* pSong ) // NULL means no song +{ + if( pSong == NULL ) LoadFallback(); + else if( pSong->HasBanner() ) Load( pSong->GetBannerPath() ); + else LoadFallback(); + + m_bScrolling = false; +} + +void Banner::LoadMode() +{ + Load( THEME->GetPathG("Banner","Mode") ); + m_bScrolling = false; +} + +void Banner::LoadFromSongGroup( RString sSongGroup ) +{ + RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); + if( sGroupBannerPath != "" ) Load( sGroupBannerPath ); + else LoadFallback(); + m_bScrolling = false; +} + +void Banner::LoadFromCourse( const Course *pCourse ) // NULL means no course +{ + if( pCourse == NULL ) LoadFallback(); + else if( pCourse->GetBannerPath() != "" ) Load( pCourse->GetBannerPath() ); + else LoadCourseFallback(); + + m_bScrolling = false; +} + +void Banner::LoadCardFromCharacter( const Character *pCharacter ) +{ + if( pCharacter == NULL ) LoadFallback(); + else if( pCharacter->GetCardPath() != "" ) Load( pCharacter->GetCardPath() ); + else LoadFallback(); + + m_bScrolling = false; +} + +void Banner::LoadIconFromCharacter( const Character *pCharacter ) +{ + if( pCharacter == NULL ) LoadFallbackCharacterIcon(); + else if( pCharacter->GetIconPath() != "" ) Load( pCharacter->GetIconPath(), false ); + else LoadFallbackCharacterIcon(); + + m_bScrolling = false; +} + +void Banner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE ) +{ + if( pUE == NULL ) + LoadFallback(); + else + { + RString sFile = pUE->GetBannerFile(); + Load( sFile ); + m_bScrolling = false; + } +} + +void Banner::LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE ) +{ + if( pUE == NULL ) + LoadFallback(); + else + { + RString sFile = pUE->GetBackgroundFile(); + Load( sFile ); + m_bScrolling = false; + } +} + +void Banner::LoadFallback() +{ + Load( THEME->GetPathG("Common","fallback banner") ); +} + +void Banner::LoadFallbackBG() +{ + Load( THEME->GetPathG("Common","fallback background") ); +} + +void Banner::LoadCourseFallback() +{ + Load( THEME->GetPathG("Banner","course fallback") ); +} + +void Banner::LoadFallbackCharacterIcon() +{ + Character *pCharacter = CHARMAN->GetDefaultCharacter(); + if( pCharacter && !pCharacter->GetIconPath().empty() ) + Load( pCharacter->GetIconPath(), false ); + else + LoadFallback(); +} + +void Banner::LoadRoulette() +{ + Load( THEME->GetPathG("Banner","roulette") ); + m_bScrolling = (bool)SCROLL_ROULETTE; +} + +void Banner::LoadRandom() +{ + Load( THEME->GetPathG("Banner","random") ); + m_bScrolling = (bool)SCROLL_RANDOM; +} + +void Banner::LoadFromSortOrder( SortOrder so ) +{ + // TODO: See if the check for NULL/PREFERRED(?) is needed. + if( so == SortOrder_Invalid ) + { + LoadFallback(); + } + else + { + if( so != SORT_GROUP && so != SORT_RECENT ) + Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(so).c_str())) ); + } + m_bScrolling = false; +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the Banner. */ +class LunaBanner: public Luna +{ +public: + static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int LoadFromSong( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } + else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } + return 0; + } + static int LoadFromCourse( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } + else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } + return 0; + } + static int LoadFromCachedBanner( T* p, lua_State *L ) + { + p->LoadFromCachedBanner( SArg(1) ); + return 0; + } + static int LoadIconFromCharacter( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } + else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } + return 0; + } + static int LoadCardFromCharacter( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } + else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } + return 0; + } + static int LoadBannerFromUnlockEntry( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadBannerFromUnlockEntry( NULL ); } + else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBannerFromUnlockEntry( pUE ); } + return 0; + } + static int LoadBackgroundFromUnlockEntry( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadBackgroundFromUnlockEntry( NULL ); } + else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBackgroundFromUnlockEntry( pUE ); } + return 0; + } + static int LoadFromSongGroup( T* p, lua_State *L ) + { + p->LoadFromSongGroup( SArg(1) ); + return 0; + } + static int LoadFromSortOrder( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadFromSortOrder( SortOrder_Invalid ); } + else + { + SortOrder so = Enum::Check(L, 1); + p->LoadFromSortOrder( so ); + } + return 0; + } + static int GetScrolling( T* p, lua_State *L ){ lua_pushboolean( L, p->GetScrolling() ); return 1; } + static int SetScrolling( T* p, lua_State *L ){ p->SetScrolling( BArg(1), FArg(2) ); return 0; } + static int GetPercentScrolling( T* p, lua_State *L ){ lua_pushnumber( L, p->ScrollingPercent() ); return 1; } + + LunaBanner() + { + ADD_METHOD( scaletoclipped ); + ADD_METHOD( ScaleToClipped ); + ADD_METHOD( LoadFromSong ); + ADD_METHOD( LoadFromCourse ); + ADD_METHOD( LoadFromCachedBanner ); + ADD_METHOD( LoadIconFromCharacter ); + ADD_METHOD( LoadCardFromCharacter ); + ADD_METHOD( LoadBannerFromUnlockEntry ); + ADD_METHOD( LoadBackgroundFromUnlockEntry ); + ADD_METHOD( LoadFromSongGroup ); + ADD_METHOD( LoadFromSortOrder ); + ADD_METHOD( GetScrolling ); + ADD_METHOD( SetScrolling ); + ADD_METHOD( GetPercentScrolling ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( Banner, Sprite ) +// lua end + + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Banner.h b/src/Banner.h index a7c717bc76..8c958db687 100644 --- a/src/Banner.h +++ b/src/Banner.h @@ -1,87 +1,87 @@ -/** @brief Banner - The song/course's banner displayed in SelectMusic/Course. */ - -#ifndef BANNER_H -#define BANNER_H - -#include "Sprite.h" -#include "RageTextureID.h" -#include "GameConstantsAndTypes.h" -class Song; -class Course; -class Character; -class UnlockEntry; - -/** @brief The characteristics of a Banner */ -class Banner : public Sprite -{ -public: - Banner(); - virtual ~Banner() { } - virtual Banner *Copy() const; - - void Load( RageTextureID ID, bool bIsBanner ); - virtual void Load( RageTextureID ID ) { Load( ID, true ); } - void LoadFromCachedBanner( const RString &sPath ); - - virtual void Update( float fDeltaTime ); - - /** - * @brief Attempt to load the banner from a song. - * @param pSong the song in question. If NULL, there is no song. - */ - void LoadFromSong( Song* pSong ); - void LoadMode(); - void LoadFromSongGroup( RString sSongGroup ); - void LoadFromCourse( const Course *pCourse ); - void LoadCardFromCharacter( const Character *pCharacter ); - void LoadIconFromCharacter( const Character *pCharacter ); - void LoadBannerFromUnlockEntry( const UnlockEntry* pUE ); - void LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE ); - void LoadRoulette(); - void LoadRandom(); - void LoadFromSortOrder( SortOrder so ); - void LoadFallback(); - void LoadFallbackBG(); - void LoadCourseFallback(); - void LoadFallbackCharacterIcon(); - - void SetScrolling( bool bScroll, float Percent = 0 ); - bool GetScrolling() const { return m_bScrolling; } - float ScrollingPercent() const { return m_fPercentScrolling; } - - // Lua - void PushSelf( lua_State *L ); - -protected: - bool m_bScrolling; - float m_fPercentScrolling; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief Banner - The song/course's banner displayed in SelectMusic/Course. */ + +#ifndef BANNER_H +#define BANNER_H + +#include "Sprite.h" +#include "RageTextureID.h" +#include "GameConstantsAndTypes.h" +class Song; +class Course; +class Character; +class UnlockEntry; + +/** @brief The characteristics of a Banner */ +class Banner : public Sprite +{ +public: + Banner(); + virtual ~Banner() { } + virtual Banner *Copy() const; + + void Load( RageTextureID ID, bool bIsBanner ); + virtual void Load( RageTextureID ID ) { Load( ID, true ); } + void LoadFromCachedBanner( const RString &sPath ); + + virtual void Update( float fDeltaTime ); + + /** + * @brief Attempt to load the banner from a song. + * @param pSong the song in question. If NULL, there is no song. + */ + void LoadFromSong( Song* pSong ); + void LoadMode(); + void LoadFromSongGroup( RString sSongGroup ); + void LoadFromCourse( const Course *pCourse ); + void LoadCardFromCharacter( const Character *pCharacter ); + void LoadIconFromCharacter( const Character *pCharacter ); + void LoadBannerFromUnlockEntry( const UnlockEntry* pUE ); + void LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE ); + void LoadRoulette(); + void LoadRandom(); + void LoadFromSortOrder( SortOrder so ); + void LoadFallback(); + void LoadFallbackBG(); + void LoadCourseFallback(); + void LoadFallbackCharacterIcon(); + + void SetScrolling( bool bScroll, float Percent = 0 ); + bool GetScrolling() const { return m_bScrolling; } + float ScrollingPercent() const { return m_fPercentScrolling; } + + // Lua + void PushSelf( lua_State *L ); + +protected: + bool m_bScrolling; + float m_fPercentScrolling; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BannerCache.cpp b/src/BannerCache.cpp index dba130cf3e..8e60a2e2a8 100644 --- a/src/BannerCache.cpp +++ b/src/BannerCache.cpp @@ -1,539 +1,539 @@ -#include "global.h" - -#include "BannerCache.h" -#include "Foreach.h" -#include "RageDisplay.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "RageSurface_Load.h" -#include "SongCacheIndex.h" -#include "Sprite.h" -#include "PrefsManager.h" -#include "RageDisplay.h" -#include "RageTexture.h" -#include "RageTextureManager.h" -#include "RageSurface.h" -#include "RageSurfaceUtils.h" -#include "RageSurfaceUtils_Palettize.h" -#include "RageSurfaceUtils_Dither.h" -#include "RageSurfaceUtils_Zoom.h" -#include "SpecialFiles.h" - -#include "Banner.h" - -static Preference g_bPalettedBannerCache( "PalettedBannerCache", false ); - -/* Neither a global or a file scope static can be used for this because - * the order of initialization of nonlocal objects is unspecified. */ -//const RString BANNER_CACHE_INDEX = SpecialFiles::CACHE_DIR + "banners.cache"; -#define BANNER_CACHE_INDEX (SpecialFiles::CACHE_DIR + "banners.cache") - -/* Call CacheBanner to cache a banner by path. If the banner is already - * cached, it'll be recreated. This is efficient if the banner hasn't changed, - * but we still only do this in TidyUpData for songs. - * - * Call LoadBanner to load a cached banner into main memory. This will call - * CacheBanner only if needed. This will not do a date/size check; call CacheBanner - * directly if you need that. - * - * Call LoadCachedBanner to load a banner into a texture and retrieve an ID - * for it. You can check if the banner was actually preloaded by calling - * TEXTUREMAN->IsTextureRegistered() on the ID; it might not be if the banner cache - * is missing or disabled. - * - * Note that each cache entries has two hashes. The cache path is based soley - * on the pathname; this way, loading the cache doesn't have to do a stat on every - * banner. The full hash includes the file size and date, and is used only by - * CacheBanner to avoid doing extra work. - */ - -BannerCache *BANNERCACHE; - - -static map g_BannerPathToImage; -static int g_iDemandRefcount = 0; - -RString BannerCache::GetBannerCachePath( RString sBannerPath ) -{ - return SongCacheIndex::GetCacheFilePath( "Banners", sBannerPath ); -} - -/* If in on-demand mode, load all cached banners. This must be fast, so - * cache files will not be created if they don't exist; that should be done - * by CacheBanner or LoadBanner on startup. */ -void BannerCache::Demand() -{ - ++g_iDemandRefcount; - if( g_iDemandRefcount > 1 ) - return; - - if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) - return; - - FOREACH_CONST_Child( &BannerData, p ) - { - RString sBannerPath = p->GetName(); - - if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) - continue; /* already loaded */ - - const RString sCachePath = GetBannerCachePath(sBannerPath); - RageSurface *pImage = RageSurfaceUtils::LoadSurface( sCachePath ); - if( pImage == NULL ) - { - continue; /* doesn't exist */ - } - - g_BannerPathToImage[sBannerPath] = pImage; - } -} - -/* Release banners loaded on demand. */ -void BannerCache::Undemand() -{ - --g_iDemandRefcount; - if( g_iDemandRefcount != 0 ) - return; - - if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) - return; - - UnloadAllBanners(); -} - -/* If in a low-res banner mode, load a low-res banner into memory, creating - * the cache file if necessary. Unlike CacheBanner(), the original file will - * not be examined unless the cached banner doesn't exist, so the banner will - * not be updated if the original file changes, for efficiency. */ -void BannerCache::LoadBanner( RString sBannerPath ) -{ - if( sBannerPath == "" ) - return; // nothing to do - if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_PRELOAD && - PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) - return; - - /* Load it. */ - const RString sCachePath = GetBannerCachePath(sBannerPath); - - for( int tries = 0; tries < 2; ++tries ) - { - if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) - return; /* already loaded */ - - CHECKPOINT_M( ssprintf( "BannerCache::LoadBanner: %s", sCachePath.c_str() ) ); - RageSurface *pImage = RageSurfaceUtils::LoadSurface( sCachePath ); - if( pImage == NULL ) - { - if( tries == 0 ) - { - /* The file doesn't exist. It's possible that the banner cache file is - * missing, so try to create it. Don't do this first, for efficiency. */ - LOG->Trace( "Cached banner load of '%s' ('%s') failed, trying to cache ...", sBannerPath.c_str(), sCachePath.c_str() ); - - /* Skip the up-to-date check; it failed to load, so it can't be up - * to date. */ - CacheBannerInternal( sBannerPath ); - continue; - } - else - { - LOG->Trace( "Cached banner load of '%s' ('%s') failed", sBannerPath.c_str(), sCachePath.c_str() ); - return; - } - } - - g_BannerPathToImage[sBannerPath] = pImage; - } -} - -void BannerCache::OutputStats() const -{ - int iTotalSize = 0; - FOREACHM_CONST( RString, RageSurface *, g_BannerPathToImage, it ) - { - const RageSurface *pImage = it->second; - const int iSize = pImage->pitch * pImage->h; - iTotalSize += iSize; - } - LOG->Info( "%i bytes of banners loaded", iTotalSize ); -} - -void BannerCache::UnloadAllBanners() -{ - FOREACHM( RString, RageSurface *, g_BannerPathToImage, it ) - delete it->second; - - g_BannerPathToImage.clear(); -} - -BannerCache::BannerCache() -{ - ReadFromDisk(); -} - -BannerCache::~BannerCache() -{ - UnloadAllBanners(); -} - -void BannerCache::ReadFromDisk() -{ - BannerData.ReadFile( BANNER_CACHE_INDEX ); // don't care if this fails -} - -struct BannerTexture: public RageTexture -{ - unsigned m_uTexHandle; - unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay - /* This is a reference to a pointer in g_BannerPathToImage. */ - RageSurface *&m_pImage; - int m_iWidth, m_iHeight; - - BannerTexture( RageTextureID id, RageSurface *&pImage, int iWidth, int iHeight ): - RageTexture(id), m_pImage(pImage), m_iWidth(iWidth), m_iHeight(iHeight) - { - Create(); - } - - ~BannerTexture() - { - Destroy(); - } - - void Create() - { - ASSERT( m_pImage ); - - /* The image is preprocessed; do as little work as possible. */ - - /* The source width is the width of the original file. */ - m_iSourceWidth = m_iWidth; - m_iSourceHeight = m_iHeight; - - /* The image width (within the texture) is always the entire texture. - * Only resize if the max texture size requires it; since these images - * are already scaled down, this shouldn't happen often. */ - if( m_pImage->w > DISPLAY->GetMaxTextureSize() || - m_pImage->h > DISPLAY->GetMaxTextureSize() ) - { - LOG->Warn( "Converted %s at runtime", GetID().filename.c_str() ); - int iWidth = min( m_pImage->w, DISPLAY->GetMaxTextureSize() ); - int iHeight = min( m_pImage->h, DISPLAY->GetMaxTextureSize() ); - RageSurfaceUtils::Zoom( m_pImage, iWidth, iHeight ); - } - - /* We did this when we cached it. */ - ASSERT( m_pImage->w == power_of_two(m_pImage->w) ); - ASSERT( m_pImage->h == power_of_two(m_pImage->h) ); - - m_iTextureWidth = m_iImageWidth = m_pImage->w; - m_iTextureHeight = m_iImageHeight = m_pImage->h; - - /* Find a supported texture format. If it happens to match the stored - * file, we won't have to do any conversion here, and that'll happen often - * with paletted images. */ -#if !defined(XBOX) - PixelFormat pf = m_pImage->format->BitsPerPixel == 8? PixelFormat_PAL: PixelFormat_RGB5A1; - if( !DISPLAY->SupportsTextureFormat(pf) ) - pf = PixelFormat_RGBA4; -#else - // xbox display currently supports only rgba8 - PixelFormat pf = PixelFormat_RGBA8; -#endif - ASSERT( DISPLAY->SupportsTextureFormat(pf) ); - - ASSERT(m_pImage); - m_uTexHandle = DISPLAY->CreateTexture( pf, m_pImage, false ); - - CreateFrameRects(); - } - - void Destroy() - { - if( m_uTexHandle ) - DISPLAY->DeleteTexture( m_uTexHandle ); - m_uTexHandle = 0; - } - - void Reload() - { - Destroy(); - Create(); - } - - void Invalidate() - { - m_uTexHandle = 0; /* don't Destroy() */ - } -}; - -/* If a banner is cached, get its ID for use. */ -RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath ) -{ - RageTextureID ID( GetBannerCachePath(sBannerPath) ); - - if( sBannerPath == "" ) - return ID; - - LOG->Trace( "BannerCache::LoadCachedBanner(%s): %s", sBannerPath.c_str(), ID.filename.c_str() ); - - /* Hack: make sure Banner::Load doesn't change our return value and end up - * reloading. */ - ID = Sprite::SongBannerTexture(ID); - - /* It's not in a texture. Do we have it loaded? */ - if( g_BannerPathToImage.find(sBannerPath) == g_BannerPathToImage.end() ) - { - /* Oops, the image is missing. Warn and continue. */ - LOG->Warn( "Banner cache for '%s' wasn't loaded", sBannerPath.c_str() ); - return ID; - } - - /* This is a reference to a pointer. BannerTexture's ctor may change it - * when converting; this way, the conversion will end up in the map so we - * only have to convert once. */ - RageSurface *&pImage = g_BannerPathToImage[sBannerPath]; - ASSERT( pImage ); - - int iSourceWidth = 0, iSourceHeight = 0; - bool bWasRotatedBanner = false; - BannerData.GetValue( sBannerPath, "Width", iSourceWidth ); - BannerData.GetValue( sBannerPath, "Height", iSourceHeight ); - BannerData.GetValue( sBannerPath, "Rotated", bWasRotatedBanner ); - if( iSourceWidth == 0 || iSourceHeight == 0 ) - { - LOG->UserLog( "Cache file", sBannerPath, "couldn't be loaded." ); - return ID; - } - - if( bWasRotatedBanner ) - { - /* We need to tell Sprite that this was originally a rotated - * sprite. */ - ID.filename += "(was rotated)"; - } - - /* Is the banner already in a texture? */ - if( TEXTUREMAN->IsTextureRegistered(ID) ) - return ID; /* It's all set. */ - - LOG->Trace( "Loading banner texture %s; src %ix%i; image %ix%i", - ID.filename.c_str(), iSourceWidth, iSourceHeight, pImage->w, pImage->h ); - RageTexture *pTexture = new BannerTexture( ID, pImage, iSourceWidth, iSourceHeight ); - - ID.Policy = RageTextureID::TEX_VOLATILE; - TEXTUREMAN->RegisterTexture( ID, pTexture ); - TEXTUREMAN->UnloadTexture( pTexture ); - - return ID; -} - -static inline int closest( int num, int n1, int n2 ) -{ - if( abs(num - n1) > abs(num - n2) ) - return n2; - return n1; -} - -/* Create or update the banner cache file as necessary. If in preload mode, - * load the cache file, too. (This is done at startup.) */ -void BannerCache::CacheBanner( RString sBannerPath ) -{ - if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_PRELOAD && - PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) - return; - - CHECKPOINT_M( sBannerPath ); - if( !DoesFileExist(sBannerPath) ) - return; - - const RString sCachePath = GetBannerCachePath(sBannerPath); - - /* Check the full file hash. If it's the loaded and identical, don't recache. */ - if( DoesFileExist(sCachePath) ) - { - bool bCacheUpToDate = PREFSMAN->m_bFastLoad; - if( !bCacheUpToDate ) - { - unsigned CurFullHash; - const unsigned FullHash = GetHashForFile( sBannerPath ); - if( BannerData.GetValue( sBannerPath, "FullHash", CurFullHash ) && CurFullHash == FullHash ) - bCacheUpToDate = true; - } - - if( bCacheUpToDate ) - { - /* It's identical. Just load it, if in preload. */ - if( PREFSMAN->m_BannerCache == BNCACHE_LOW_RES_PRELOAD ) - LoadBanner( sBannerPath ); - - return; - } - } - - /* The cache file doesn't exist, or is out of date. Cache it. This - * will also load the cache into memory if in PRELOAD. */ - CacheBannerInternal( sBannerPath ); -} - -void BannerCache::CacheBannerInternal( RString sBannerPath ) -{ - RString sError; - RageSurface *pImage = RageSurfaceUtils::LoadFile( sBannerPath, sError ); - if( pImage == NULL ) - { - LOG->UserLog( "Cache file", sBannerPath, "couldn't be loaded: %s", sError.c_str() ); - return; - } - - bool bWasRotatedBanner = false; - - if( Sprite::IsDiagonalBanner(pImage->w , pImage->h) ) - { - /* Ack. It's a diagonal banner. Problem: if we resize a diagonal banner, we - * get ugly checker patterns. We need to un-rotate it. - * - * If we spin the banner by hand, we need to do a linear filter, or the - * fade to the full resolution banner is misaligned, which looks strange. - * - * To do a linear filter, we need to lose the palette. Oh well. - * - * This also makes the banner take less memory, though that could also be - * done by RLEing the surface. - */ - //RageSurfaceUtils::ApplyHotPinkColorKey( pImage ); - - RageSurfaceUtils::ConvertSurface(pImage, pImage->w, pImage->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - - RageSurface *dst = CreateSurface( - 256, 64, pImage->format->BitsPerPixel, - pImage->format->Rmask, pImage->format->Gmask, pImage->format->Bmask, pImage->format->Amask ); - - if( pImage->format->BitsPerPixel == 8 ) - { - ASSERT( pImage->format->palette ); - dst->fmt.palette = pImage->fmt.palette; - } - - const float fCustomImageCoords[8] = { - 0.02f, 0.78f, // top left - 0.22f, 0.98f, // bottom left - 0.98f, 0.22f, // bottom right - 0.78f, 0.02f, // top right - }; - - RageSurfaceUtils::BlitTransform( pImage, dst, fCustomImageCoords ); - - delete pImage; - pImage = dst; - - bWasRotatedBanner = true; - } - - const int iSourceWidth = pImage->w, iSourceHeight = pImage->h; - - int iWidth = pImage->w / 2, iHeight = pImage->h / 2; -// int iWidth = pImage->w, iHeight = pImage->h; - - /* Round to the nearest power of two. This simplifies the actual texture load. */ - iWidth = closest( iWidth, power_of_two(iWidth), power_of_two(iWidth) / 2 ); - iHeight = closest( iHeight, power_of_two(iHeight), power_of_two(iHeight) / 2 ); - - /* Don't resize the image to less than 32 pixels in either dimension or the next - * power of two of the source (whichever is smaller); it's already very low res. */ - iWidth = max( iWidth, min(32, power_of_two(iSourceWidth)) ); - iHeight = max( iHeight, min(32, power_of_two(iSourceHeight)) ); - - //RageSurfaceUtils::ApplyHotPinkColorKey( pImage ); - - RageSurfaceUtils::Zoom( pImage, iWidth, iHeight ); - - /* - * When paletted banner cache is enabled, cached banners are paletted. Cached - * 32-bit banners take 1/16 as much memory, 16-bit banners take 1/8, and paletted - * banners take 1/4. - * - * When paletted banner cache is disabled, cached banners are stored in 16-bit - * RGBA. Cached 32-bit banners take 1/8 as much memory, cached 16-bit banners - * take 1/4, and cached paletted banners take 1/2. - * - * Paletted cache is disabled by default because palettization takes time, causing - * the initial cache run to take longer. Also, newer ATI hardware doesn't supported - * paletted textures, which would slow down runtime, because we have to depalettize - * on use. They'd still have the same memory benefits, though, since we only load - * one cached banner into a texture at once, and the speed hit may not matter on - * newer ATI cards. RGBA is safer, though. - */ - if( g_bPalettedBannerCache ) - { - if( pImage->fmt.BytesPerPixel != 1 ) - RageSurfaceUtils::Palettize( pImage ); - } - else - { - /* Dither to the final format. We use A1RGB5, since that's usually supported - * natively by both OpenGL and D3D. */ - RageSurface *dst = CreateSurface( pImage->w, pImage->h, 16, - 0x7C00, 0x03E0, 0x001F, 0x8000 ); - - /* OrderedDither is still faster than ErrorDiffusionDither, and - * these images are very small and only displayed briefly. */ - RageSurfaceUtils::OrderedDither( pImage, dst ); - delete pImage; - pImage = dst; - } - - const RString sCachePath = GetBannerCachePath(sBannerPath); - RageSurfaceUtils::SaveSurface( pImage, sCachePath ); - - /* If an old image is loaded, free it. */ - if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) - { - RageSurface *oldimg = g_BannerPathToImage[sBannerPath]; - delete oldimg; - g_BannerPathToImage.erase(sBannerPath); - } - - if( PREFSMAN->m_BannerCache == BNCACHE_LOW_RES_PRELOAD ) - { - /* Keep it; we're just going to load it anyway. */ - g_BannerPathToImage[sBannerPath] = pImage; - } - else - delete pImage; - - /* Remember the original size. */ - BannerData.SetValue( sBannerPath, "Path", sCachePath ); - BannerData.SetValue( sBannerPath, "Width", iSourceWidth ); - BannerData.SetValue( sBannerPath, "Height", iSourceHeight ); - BannerData.SetValue( sBannerPath, "FullHash", GetHashForFile( sBannerPath ) ); - /* Remember this, so we can hint Sprite. */ - BannerData.SetValue( sBannerPath, "Rotated", bWasRotatedBanner ); - BannerData.WriteFile( BANNER_CACHE_INDEX ); -} - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" + +#include "BannerCache.h" +#include "Foreach.h" +#include "RageDisplay.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "RageSurface_Load.h" +#include "SongCacheIndex.h" +#include "Sprite.h" +#include "PrefsManager.h" +#include "RageDisplay.h" +#include "RageTexture.h" +#include "RageTextureManager.h" +#include "RageSurface.h" +#include "RageSurfaceUtils.h" +#include "RageSurfaceUtils_Palettize.h" +#include "RageSurfaceUtils_Dither.h" +#include "RageSurfaceUtils_Zoom.h" +#include "SpecialFiles.h" + +#include "Banner.h" + +static Preference g_bPalettedBannerCache( "PalettedBannerCache", false ); + +/* Neither a global or a file scope static can be used for this because + * the order of initialization of nonlocal objects is unspecified. */ +//const RString BANNER_CACHE_INDEX = SpecialFiles::CACHE_DIR + "banners.cache"; +#define BANNER_CACHE_INDEX (SpecialFiles::CACHE_DIR + "banners.cache") + +/* Call CacheBanner to cache a banner by path. If the banner is already + * cached, it'll be recreated. This is efficient if the banner hasn't changed, + * but we still only do this in TidyUpData for songs. + * + * Call LoadBanner to load a cached banner into main memory. This will call + * CacheBanner only if needed. This will not do a date/size check; call CacheBanner + * directly if you need that. + * + * Call LoadCachedBanner to load a banner into a texture and retrieve an ID + * for it. You can check if the banner was actually preloaded by calling + * TEXTUREMAN->IsTextureRegistered() on the ID; it might not be if the banner cache + * is missing or disabled. + * + * Note that each cache entries has two hashes. The cache path is based soley + * on the pathname; this way, loading the cache doesn't have to do a stat on every + * banner. The full hash includes the file size and date, and is used only by + * CacheBanner to avoid doing extra work. + */ + +BannerCache *BANNERCACHE; + + +static map g_BannerPathToImage; +static int g_iDemandRefcount = 0; + +RString BannerCache::GetBannerCachePath( RString sBannerPath ) +{ + return SongCacheIndex::GetCacheFilePath( "Banners", sBannerPath ); +} + +/* If in on-demand mode, load all cached banners. This must be fast, so + * cache files will not be created if they don't exist; that should be done + * by CacheBanner or LoadBanner on startup. */ +void BannerCache::Demand() +{ + ++g_iDemandRefcount; + if( g_iDemandRefcount > 1 ) + return; + + if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) + return; + + FOREACH_CONST_Child( &BannerData, p ) + { + RString sBannerPath = p->GetName(); + + if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) + continue; /* already loaded */ + + const RString sCachePath = GetBannerCachePath(sBannerPath); + RageSurface *pImage = RageSurfaceUtils::LoadSurface( sCachePath ); + if( pImage == NULL ) + { + continue; /* doesn't exist */ + } + + g_BannerPathToImage[sBannerPath] = pImage; + } +} + +/* Release banners loaded on demand. */ +void BannerCache::Undemand() +{ + --g_iDemandRefcount; + if( g_iDemandRefcount != 0 ) + return; + + if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) + return; + + UnloadAllBanners(); +} + +/* If in a low-res banner mode, load a low-res banner into memory, creating + * the cache file if necessary. Unlike CacheBanner(), the original file will + * not be examined unless the cached banner doesn't exist, so the banner will + * not be updated if the original file changes, for efficiency. */ +void BannerCache::LoadBanner( RString sBannerPath ) +{ + if( sBannerPath == "" ) + return; // nothing to do + if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_PRELOAD && + PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) + return; + + /* Load it. */ + const RString sCachePath = GetBannerCachePath(sBannerPath); + + for( int tries = 0; tries < 2; ++tries ) + { + if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) + return; /* already loaded */ + + CHECKPOINT_M( ssprintf( "BannerCache::LoadBanner: %s", sCachePath.c_str() ) ); + RageSurface *pImage = RageSurfaceUtils::LoadSurface( sCachePath ); + if( pImage == NULL ) + { + if( tries == 0 ) + { + /* The file doesn't exist. It's possible that the banner cache file is + * missing, so try to create it. Don't do this first, for efficiency. */ + LOG->Trace( "Cached banner load of '%s' ('%s') failed, trying to cache ...", sBannerPath.c_str(), sCachePath.c_str() ); + + /* Skip the up-to-date check; it failed to load, so it can't be up + * to date. */ + CacheBannerInternal( sBannerPath ); + continue; + } + else + { + LOG->Trace( "Cached banner load of '%s' ('%s') failed", sBannerPath.c_str(), sCachePath.c_str() ); + return; + } + } + + g_BannerPathToImage[sBannerPath] = pImage; + } +} + +void BannerCache::OutputStats() const +{ + int iTotalSize = 0; + FOREACHM_CONST( RString, RageSurface *, g_BannerPathToImage, it ) + { + const RageSurface *pImage = it->second; + const int iSize = pImage->pitch * pImage->h; + iTotalSize += iSize; + } + LOG->Info( "%i bytes of banners loaded", iTotalSize ); +} + +void BannerCache::UnloadAllBanners() +{ + FOREACHM( RString, RageSurface *, g_BannerPathToImage, it ) + delete it->second; + + g_BannerPathToImage.clear(); +} + +BannerCache::BannerCache() +{ + ReadFromDisk(); +} + +BannerCache::~BannerCache() +{ + UnloadAllBanners(); +} + +void BannerCache::ReadFromDisk() +{ + BannerData.ReadFile( BANNER_CACHE_INDEX ); // don't care if this fails +} + +struct BannerTexture: public RageTexture +{ + unsigned m_uTexHandle; + unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay + /* This is a reference to a pointer in g_BannerPathToImage. */ + RageSurface *&m_pImage; + int m_iWidth, m_iHeight; + + BannerTexture( RageTextureID id, RageSurface *&pImage, int iWidth, int iHeight ): + RageTexture(id), m_pImage(pImage), m_iWidth(iWidth), m_iHeight(iHeight) + { + Create(); + } + + ~BannerTexture() + { + Destroy(); + } + + void Create() + { + ASSERT( m_pImage ); + + /* The image is preprocessed; do as little work as possible. */ + + /* The source width is the width of the original file. */ + m_iSourceWidth = m_iWidth; + m_iSourceHeight = m_iHeight; + + /* The image width (within the texture) is always the entire texture. + * Only resize if the max texture size requires it; since these images + * are already scaled down, this shouldn't happen often. */ + if( m_pImage->w > DISPLAY->GetMaxTextureSize() || + m_pImage->h > DISPLAY->GetMaxTextureSize() ) + { + LOG->Warn( "Converted %s at runtime", GetID().filename.c_str() ); + int iWidth = min( m_pImage->w, DISPLAY->GetMaxTextureSize() ); + int iHeight = min( m_pImage->h, DISPLAY->GetMaxTextureSize() ); + RageSurfaceUtils::Zoom( m_pImage, iWidth, iHeight ); + } + + /* We did this when we cached it. */ + ASSERT( m_pImage->w == power_of_two(m_pImage->w) ); + ASSERT( m_pImage->h == power_of_two(m_pImage->h) ); + + m_iTextureWidth = m_iImageWidth = m_pImage->w; + m_iTextureHeight = m_iImageHeight = m_pImage->h; + + /* Find a supported texture format. If it happens to match the stored + * file, we won't have to do any conversion here, and that'll happen often + * with paletted images. */ +#if !defined(XBOX) + PixelFormat pf = m_pImage->format->BitsPerPixel == 8? PixelFormat_PAL: PixelFormat_RGB5A1; + if( !DISPLAY->SupportsTextureFormat(pf) ) + pf = PixelFormat_RGBA4; +#else + // xbox display currently supports only rgba8 + PixelFormat pf = PixelFormat_RGBA8; +#endif + ASSERT( DISPLAY->SupportsTextureFormat(pf) ); + + ASSERT(m_pImage); + m_uTexHandle = DISPLAY->CreateTexture( pf, m_pImage, false ); + + CreateFrameRects(); + } + + void Destroy() + { + if( m_uTexHandle ) + DISPLAY->DeleteTexture( m_uTexHandle ); + m_uTexHandle = 0; + } + + void Reload() + { + Destroy(); + Create(); + } + + void Invalidate() + { + m_uTexHandle = 0; /* don't Destroy() */ + } +}; + +/* If a banner is cached, get its ID for use. */ +RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath ) +{ + RageTextureID ID( GetBannerCachePath(sBannerPath) ); + + if( sBannerPath == "" ) + return ID; + + LOG->Trace( "BannerCache::LoadCachedBanner(%s): %s", sBannerPath.c_str(), ID.filename.c_str() ); + + /* Hack: make sure Banner::Load doesn't change our return value and end up + * reloading. */ + ID = Sprite::SongBannerTexture(ID); + + /* It's not in a texture. Do we have it loaded? */ + if( g_BannerPathToImage.find(sBannerPath) == g_BannerPathToImage.end() ) + { + /* Oops, the image is missing. Warn and continue. */ + LOG->Warn( "Banner cache for '%s' wasn't loaded", sBannerPath.c_str() ); + return ID; + } + + /* This is a reference to a pointer. BannerTexture's ctor may change it + * when converting; this way, the conversion will end up in the map so we + * only have to convert once. */ + RageSurface *&pImage = g_BannerPathToImage[sBannerPath]; + ASSERT( pImage ); + + int iSourceWidth = 0, iSourceHeight = 0; + bool bWasRotatedBanner = false; + BannerData.GetValue( sBannerPath, "Width", iSourceWidth ); + BannerData.GetValue( sBannerPath, "Height", iSourceHeight ); + BannerData.GetValue( sBannerPath, "Rotated", bWasRotatedBanner ); + if( iSourceWidth == 0 || iSourceHeight == 0 ) + { + LOG->UserLog( "Cache file", sBannerPath, "couldn't be loaded." ); + return ID; + } + + if( bWasRotatedBanner ) + { + /* We need to tell Sprite that this was originally a rotated + * sprite. */ + ID.filename += "(was rotated)"; + } + + /* Is the banner already in a texture? */ + if( TEXTUREMAN->IsTextureRegistered(ID) ) + return ID; /* It's all set. */ + + LOG->Trace( "Loading banner texture %s; src %ix%i; image %ix%i", + ID.filename.c_str(), iSourceWidth, iSourceHeight, pImage->w, pImage->h ); + RageTexture *pTexture = new BannerTexture( ID, pImage, iSourceWidth, iSourceHeight ); + + ID.Policy = RageTextureID::TEX_VOLATILE; + TEXTUREMAN->RegisterTexture( ID, pTexture ); + TEXTUREMAN->UnloadTexture( pTexture ); + + return ID; +} + +static inline int closest( int num, int n1, int n2 ) +{ + if( abs(num - n1) > abs(num - n2) ) + return n2; + return n1; +} + +/* Create or update the banner cache file as necessary. If in preload mode, + * load the cache file, too. (This is done at startup.) */ +void BannerCache::CacheBanner( RString sBannerPath ) +{ + if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_PRELOAD && + PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) + return; + + CHECKPOINT_M( sBannerPath ); + if( !DoesFileExist(sBannerPath) ) + return; + + const RString sCachePath = GetBannerCachePath(sBannerPath); + + /* Check the full file hash. If it's the loaded and identical, don't recache. */ + if( DoesFileExist(sCachePath) ) + { + bool bCacheUpToDate = PREFSMAN->m_bFastLoad; + if( !bCacheUpToDate ) + { + unsigned CurFullHash; + const unsigned FullHash = GetHashForFile( sBannerPath ); + if( BannerData.GetValue( sBannerPath, "FullHash", CurFullHash ) && CurFullHash == FullHash ) + bCacheUpToDate = true; + } + + if( bCacheUpToDate ) + { + /* It's identical. Just load it, if in preload. */ + if( PREFSMAN->m_BannerCache == BNCACHE_LOW_RES_PRELOAD ) + LoadBanner( sBannerPath ); + + return; + } + } + + /* The cache file doesn't exist, or is out of date. Cache it. This + * will also load the cache into memory if in PRELOAD. */ + CacheBannerInternal( sBannerPath ); +} + +void BannerCache::CacheBannerInternal( RString sBannerPath ) +{ + RString sError; + RageSurface *pImage = RageSurfaceUtils::LoadFile( sBannerPath, sError ); + if( pImage == NULL ) + { + LOG->UserLog( "Cache file", sBannerPath, "couldn't be loaded: %s", sError.c_str() ); + return; + } + + bool bWasRotatedBanner = false; + + if( Sprite::IsDiagonalBanner(pImage->w , pImage->h) ) + { + /* Ack. It's a diagonal banner. Problem: if we resize a diagonal banner, we + * get ugly checker patterns. We need to un-rotate it. + * + * If we spin the banner by hand, we need to do a linear filter, or the + * fade to the full resolution banner is misaligned, which looks strange. + * + * To do a linear filter, we need to lose the palette. Oh well. + * + * This also makes the banner take less memory, though that could also be + * done by RLEing the surface. + */ + //RageSurfaceUtils::ApplyHotPinkColorKey( pImage ); + + RageSurfaceUtils::ConvertSurface(pImage, pImage->w, pImage->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + + RageSurface *dst = CreateSurface( + 256, 64, pImage->format->BitsPerPixel, + pImage->format->Rmask, pImage->format->Gmask, pImage->format->Bmask, pImage->format->Amask ); + + if( pImage->format->BitsPerPixel == 8 ) + { + ASSERT( pImage->format->palette ); + dst->fmt.palette = pImage->fmt.palette; + } + + const float fCustomImageCoords[8] = { + 0.02f, 0.78f, // top left + 0.22f, 0.98f, // bottom left + 0.98f, 0.22f, // bottom right + 0.78f, 0.02f, // top right + }; + + RageSurfaceUtils::BlitTransform( pImage, dst, fCustomImageCoords ); + + delete pImage; + pImage = dst; + + bWasRotatedBanner = true; + } + + const int iSourceWidth = pImage->w, iSourceHeight = pImage->h; + + int iWidth = pImage->w / 2, iHeight = pImage->h / 2; +// int iWidth = pImage->w, iHeight = pImage->h; + + /* Round to the nearest power of two. This simplifies the actual texture load. */ + iWidth = closest( iWidth, power_of_two(iWidth), power_of_two(iWidth) / 2 ); + iHeight = closest( iHeight, power_of_two(iHeight), power_of_two(iHeight) / 2 ); + + /* Don't resize the image to less than 32 pixels in either dimension or the next + * power of two of the source (whichever is smaller); it's already very low res. */ + iWidth = max( iWidth, min(32, power_of_two(iSourceWidth)) ); + iHeight = max( iHeight, min(32, power_of_two(iSourceHeight)) ); + + //RageSurfaceUtils::ApplyHotPinkColorKey( pImage ); + + RageSurfaceUtils::Zoom( pImage, iWidth, iHeight ); + + /* + * When paletted banner cache is enabled, cached banners are paletted. Cached + * 32-bit banners take 1/16 as much memory, 16-bit banners take 1/8, and paletted + * banners take 1/4. + * + * When paletted banner cache is disabled, cached banners are stored in 16-bit + * RGBA. Cached 32-bit banners take 1/8 as much memory, cached 16-bit banners + * take 1/4, and cached paletted banners take 1/2. + * + * Paletted cache is disabled by default because palettization takes time, causing + * the initial cache run to take longer. Also, newer ATI hardware doesn't supported + * paletted textures, which would slow down runtime, because we have to depalettize + * on use. They'd still have the same memory benefits, though, since we only load + * one cached banner into a texture at once, and the speed hit may not matter on + * newer ATI cards. RGBA is safer, though. + */ + if( g_bPalettedBannerCache ) + { + if( pImage->fmt.BytesPerPixel != 1 ) + RageSurfaceUtils::Palettize( pImage ); + } + else + { + /* Dither to the final format. We use A1RGB5, since that's usually supported + * natively by both OpenGL and D3D. */ + RageSurface *dst = CreateSurface( pImage->w, pImage->h, 16, + 0x7C00, 0x03E0, 0x001F, 0x8000 ); + + /* OrderedDither is still faster than ErrorDiffusionDither, and + * these images are very small and only displayed briefly. */ + RageSurfaceUtils::OrderedDither( pImage, dst ); + delete pImage; + pImage = dst; + } + + const RString sCachePath = GetBannerCachePath(sBannerPath); + RageSurfaceUtils::SaveSurface( pImage, sCachePath ); + + /* If an old image is loaded, free it. */ + if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) + { + RageSurface *oldimg = g_BannerPathToImage[sBannerPath]; + delete oldimg; + g_BannerPathToImage.erase(sBannerPath); + } + + if( PREFSMAN->m_BannerCache == BNCACHE_LOW_RES_PRELOAD ) + { + /* Keep it; we're just going to load it anyway. */ + g_BannerPathToImage[sBannerPath] = pImage; + } + else + delete pImage; + + /* Remember the original size. */ + BannerData.SetValue( sBannerPath, "Path", sCachePath ); + BannerData.SetValue( sBannerPath, "Width", iSourceWidth ); + BannerData.SetValue( sBannerPath, "Height", iSourceHeight ); + BannerData.SetValue( sBannerPath, "FullHash", GetHashForFile( sBannerPath ) ); + /* Remember this, so we can hint Sprite. */ + BannerData.SetValue( sBannerPath, "Rotated", bWasRotatedBanner ); + BannerData.WriteFile( BANNER_CACHE_INDEX ); +} + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BannerCache.h b/src/BannerCache.h index 2f7529e442..ad3323818b 100644 --- a/src/BannerCache.h +++ b/src/BannerCache.h @@ -1,63 +1,63 @@ -#ifndef BANNER_CACHE_H -#define BANNER_CACHE_H - -#include "IniFile.h" - -#include "RageTexture.h" - -class LoadingWindow; -/** @brief Maintains a cache of reduced-quality banners. */ -class BannerCache -{ -public: - BannerCache(); - ~BannerCache(); - void ReadFromDisk(); - - RageTextureID LoadCachedBanner( RString sBannerPath ); - void CacheBanner( RString sBannerPath ); - void LoadBanner( RString sBannerPath ); - - void Demand(); - void Undemand(); - - void OutputStats() const; - -private: - static RString GetBannerCachePath( RString sBannerPath ); - void UnloadAllBanners(); - void CacheBannerInternal( RString sBannerPath ); - - IniFile BannerData; -}; - -extern BannerCache *BANNERCACHE; // global and accessable from anywhere in our program - -#endif - -/** - * @file - * @author Glenn Maynard (c) 2003 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BANNER_CACHE_H +#define BANNER_CACHE_H + +#include "IniFile.h" + +#include "RageTexture.h" + +class LoadingWindow; +/** @brief Maintains a cache of reduced-quality banners. */ +class BannerCache +{ +public: + BannerCache(); + ~BannerCache(); + void ReadFromDisk(); + + RageTextureID LoadCachedBanner( RString sBannerPath ); + void CacheBanner( RString sBannerPath ); + void LoadBanner( RString sBannerPath ); + + void Demand(); + void Undemand(); + + void OutputStats() const; + +private: + static RString GetBannerCachePath( RString sBannerPath ); + void UnloadAllBanners(); + void CacheBannerInternal( RString sBannerPath ); + + IniFile BannerData; +}; + +extern BannerCache *BANNERCACHE; // global and accessable from anywhere in our program + +#endif + +/** + * @file + * @author Glenn Maynard (c) 2003 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BaseClasses/amextra.cpp b/src/BaseClasses/amextra.cpp index 0a55a27d91..156bbd3772 100644 --- a/src/BaseClasses/amextra.cpp +++ b/src/BaseClasses/amextra.cpp @@ -1,111 +1,111 @@ -//------------------------------------------------------------------------------ -// File: AMExtra.cpp -// -// Desc: DirectShow base classes - implements CRenderedInputPin class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include // DirectShow base class definitions -#include // Needed for definition of timeGetTime -#include // Standard data type limit definitions -#include // Used for time critical log functions - -#include "amextra.h" - -#pragma warning(disable:4355) - -// Implements CRenderedInputPin class - -CRenderedInputPin::CRenderedInputPin(TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBaseInputPin(pObjectName, pFilter, pLock, phr, pName), - m_bAtEndOfStream(FALSE), - m_bCompleteNotified(FALSE) -{ -} -#ifdef UNICODE -CRenderedInputPin::CRenderedInputPin(CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBaseInputPin(pObjectName, pFilter, pLock, phr, pName), - m_bAtEndOfStream(FALSE), - m_bCompleteNotified(FALSE) -{ -} -#endif - -// Flush end of stream condition - caller should do any -// necessary stream level locking before calling this - -STDMETHODIMP CRenderedInputPin::EndOfStream() -{ - HRESULT hr = CheckStreaming(); - - // Do EC_COMPLETE handling for rendered pins - if (S_OK == hr && !m_bAtEndOfStream) { - m_bAtEndOfStream = TRUE; - FILTER_STATE fs; - EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs))); - if (fs == State_Running) { - DoCompleteHandling(); - } - } - return hr; -} - - -// Called to complete the flush - -STDMETHODIMP CRenderedInputPin::EndFlush() -{ - CAutoLock lck(m_pLock); - - // Clean up renderer state - m_bAtEndOfStream = FALSE; - m_bCompleteNotified = FALSE; - - return CBaseInputPin::EndFlush(); -} - - -// Notify of Run() from filter - -HRESULT CRenderedInputPin::Run(REFERENCE_TIME tStart) -{ - UNREFERENCED_PARAMETER(tStart); - m_bCompleteNotified = FALSE; - if (m_bAtEndOfStream) { - DoCompleteHandling(); - } - return S_OK; -} - - -// Clear status on going into paused state - -HRESULT CRenderedInputPin::Active() -{ - m_bAtEndOfStream = FALSE; - m_bCompleteNotified = FALSE; - return CBaseInputPin::Active(); -} - - -// Do stuff to deliver end of stream - -void CRenderedInputPin::DoCompleteHandling() -{ - ASSERT(m_bAtEndOfStream); - if (!m_bCompleteNotified) { - m_bCompleteNotified = TRUE; - m_pFilter->NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)m_pFilter); - } -} - +//------------------------------------------------------------------------------ +// File: AMExtra.cpp +// +// Desc: DirectShow base classes - implements CRenderedInputPin class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include // DirectShow base class definitions +#include // Needed for definition of timeGetTime +#include // Standard data type limit definitions +#include // Used for time critical log functions + +#include "amextra.h" + +#pragma warning(disable:4355) + +// Implements CRenderedInputPin class + +CRenderedInputPin::CRenderedInputPin(TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBaseInputPin(pObjectName, pFilter, pLock, phr, pName), + m_bAtEndOfStream(FALSE), + m_bCompleteNotified(FALSE) +{ +} +#ifdef UNICODE +CRenderedInputPin::CRenderedInputPin(CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBaseInputPin(pObjectName, pFilter, pLock, phr, pName), + m_bAtEndOfStream(FALSE), + m_bCompleteNotified(FALSE) +{ +} +#endif + +// Flush end of stream condition - caller should do any +// necessary stream level locking before calling this + +STDMETHODIMP CRenderedInputPin::EndOfStream() +{ + HRESULT hr = CheckStreaming(); + + // Do EC_COMPLETE handling for rendered pins + if (S_OK == hr && !m_bAtEndOfStream) { + m_bAtEndOfStream = TRUE; + FILTER_STATE fs; + EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs))); + if (fs == State_Running) { + DoCompleteHandling(); + } + } + return hr; +} + + +// Called to complete the flush + +STDMETHODIMP CRenderedInputPin::EndFlush() +{ + CAutoLock lck(m_pLock); + + // Clean up renderer state + m_bAtEndOfStream = FALSE; + m_bCompleteNotified = FALSE; + + return CBaseInputPin::EndFlush(); +} + + +// Notify of Run() from filter + +HRESULT CRenderedInputPin::Run(REFERENCE_TIME tStart) +{ + UNREFERENCED_PARAMETER(tStart); + m_bCompleteNotified = FALSE; + if (m_bAtEndOfStream) { + DoCompleteHandling(); + } + return S_OK; +} + + +// Clear status on going into paused state + +HRESULT CRenderedInputPin::Active() +{ + m_bAtEndOfStream = FALSE; + m_bCompleteNotified = FALSE; + return CBaseInputPin::Active(); +} + + +// Do stuff to deliver end of stream + +void CRenderedInputPin::DoCompleteHandling() +{ + ASSERT(m_bAtEndOfStream); + if (!m_bCompleteNotified) { + m_bCompleteNotified = TRUE; + m_pFilter->NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)m_pFilter); + } +} + diff --git a/src/BaseClasses/amextra.h b/src/BaseClasses/amextra.h index e48c09068f..b10e22ac41 100644 --- a/src/BaseClasses/amextra.h +++ b/src/BaseClasses/amextra.h @@ -1,56 +1,56 @@ -//------------------------------------------------------------------------------ -// File: AMExtra.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __AMEXTRA__ -#define __AMEXTRA__ - -// Simple rendered input pin -// -// NOTE if your filter queues stuff before rendering then it may not be -// appropriate to use this class -// -// In that case queue the end of stream condition until the last sample -// is actually rendered and flush the condition appropriately - -class CRenderedInputPin : public CBaseInputPin -{ -public: - - CRenderedInputPin(TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#ifdef UNICODE - CRenderedInputPin(CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#endif - - // Override methods to track end of stream state - STDMETHODIMP EndOfStream(); - STDMETHODIMP EndFlush(); - - HRESULT Active(); - HRESULT Run(REFERENCE_TIME tStart); - -protected: - - // Member variables to track state - BOOL m_bAtEndOfStream; // Set by EndOfStream - BOOL m_bCompleteNotified; // Set when we notify for EC_COMPLETE - -private: - void DoCompleteHandling(); -}; - -#endif // __AMEXTRA__ - +//------------------------------------------------------------------------------ +// File: AMExtra.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __AMEXTRA__ +#define __AMEXTRA__ + +// Simple rendered input pin +// +// NOTE if your filter queues stuff before rendering then it may not be +// appropriate to use this class +// +// In that case queue the end of stream condition until the last sample +// is actually rendered and flush the condition appropriately + +class CRenderedInputPin : public CBaseInputPin +{ +public: + + CRenderedInputPin(TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#ifdef UNICODE + CRenderedInputPin(CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#endif + + // Override methods to track end of stream state + STDMETHODIMP EndOfStream(); + STDMETHODIMP EndFlush(); + + HRESULT Active(); + HRESULT Run(REFERENCE_TIME tStart); + +protected: + + // Member variables to track state + BOOL m_bAtEndOfStream; // Set by EndOfStream + BOOL m_bCompleteNotified; // Set when we notify for EC_COMPLETE + +private: + void DoCompleteHandling(); +}; + +#endif // __AMEXTRA__ + diff --git a/src/BaseClasses/amfilter.cpp b/src/BaseClasses/amfilter.cpp index ed5b090212..2865bc75d1 100644 --- a/src/BaseClasses/amfilter.cpp +++ b/src/BaseClasses/amfilter.cpp @@ -1,5207 +1,5207 @@ -//------------------------------------------------------------------------------ -// File: AMFilter.cpp -// -// Desc: DirectShow base classes - implements class hierarchy for streams -// architecture. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -//===================================================================== -//===================================================================== -// The following classes are declared in this header: -// -// -// CBaseMediaFilter Basic IMediaFilter support (abstract class) -// CBaseFilter Support for IBaseFilter (incl. IMediaFilter) -// CEnumPins Enumerate input and output pins -// CEnumMediaTypes Enumerate the preferred pin formats -// CBasePin Abstract base class for IPin interface -// CBaseOutputPin Adds data provider member functions -// CBaseInputPin Implements IMemInputPin interface -// CMediaSample Basic transport unit for IMemInputPin -// CBaseAllocator General list guff for most allocators -// CMemAllocator Implements memory buffer allocation -// -//===================================================================== -//===================================================================== - -#include - - - -//===================================================================== -// Helpers -//===================================================================== -STDAPI CreateMemoryAllocator(IMemAllocator **ppAllocator) -{ - return CoCreateInstance(CLSID_MemoryAllocator, - 0, - CLSCTX_INPROC_SERVER, - IID_IMemAllocator, - (void **)ppAllocator); -} - -// Put this one here rather than in ctlutil.cpp to avoid linking -// anything brought in by ctlutil.cpp -STDAPI CreatePosPassThru( - LPUNKNOWN pAgg, - BOOL bRenderer, - IPin *pPin, - IUnknown **ppPassThru -) -{ - *ppPassThru = NULL; - IUnknown *pUnkSeek; - HRESULT hr = CoCreateInstance(CLSID_SeekingPassThru, - pAgg, - CLSCTX_INPROC_SERVER, - IID_IUnknown, - (void **)&pUnkSeek - ); - if (FAILED(hr)) { - return hr; - } - - ISeekingPassThru *pPassThru; - hr = pUnkSeek->QueryInterface(IID_ISeekingPassThru, (void**)&pPassThru); - if (FAILED(hr)) { - pUnkSeek->Release(); - return hr; - } - hr = pPassThru->Init(bRenderer, pPin); - pPassThru->Release(); - if (FAILED(hr)) { - pUnkSeek->Release(); - return hr; - } - *ppPassThru = pUnkSeek; - return S_OK; -} - - - -#define CONNECT_TRACE_LEVEL 3 - -//===================================================================== -//===================================================================== -// Implements CBaseMediaFilter -//===================================================================== -//===================================================================== - - -/* Constructor */ - -CBaseMediaFilter::CBaseMediaFilter(const TCHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid) : - CUnknown(pName, pUnk), - m_pLock(pLock), - m_clsid(clsid), - m_State(State_Stopped), - m_pClock(NULL) -{ -} - - -/* Destructor */ - -CBaseMediaFilter::~CBaseMediaFilter() -{ - // must be stopped, but can't call Stop here since - // our critsec has been destroyed. - - /* Release any clock we were using */ - - if (m_pClock) { - m_pClock->Release(); - m_pClock = NULL; - } -} - - -/* Override this to say what interfaces we support and where */ - -STDMETHODIMP -CBaseMediaFilter::NonDelegatingQueryInterface( - REFIID riid, - void ** ppv) -{ - if (riid == IID_IMediaFilter) { - return GetInterface((IMediaFilter *) this, ppv); - } else if (riid == IID_IPersist) { - return GetInterface((IPersist *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - -/* Return the filter's clsid */ -STDMETHODIMP -CBaseMediaFilter::GetClassID(CLSID *pClsID) -{ - CheckPointer(pClsID,E_POINTER); - ValidateReadWritePtr(pClsID,sizeof(CLSID)); - *pClsID = m_clsid; - return NOERROR; -} - -/* Override this if your state changes are not done synchronously */ - -STDMETHODIMP -CBaseMediaFilter::GetState(DWORD dwMSecs, FILTER_STATE *State) -{ - UNREFERENCED_PARAMETER(dwMSecs); - CheckPointer(State,E_POINTER); - ValidateReadWritePtr(State,sizeof(FILTER_STATE)); - - *State = m_State; - return S_OK; -} - - -/* Set the clock we will use for synchronisation */ - -STDMETHODIMP -CBaseMediaFilter::SetSyncSource(IReferenceClock *pClock) -{ - CAutoLock cObjectLock(m_pLock); - - // Ensure the new one does not go away - even if the same as the old - if (pClock) { - pClock->AddRef(); - } - - // if we have a clock, release it - if (m_pClock) { - m_pClock->Release(); - } - - // Set the new reference clock (might be NULL) - // Should we query it to ensure it is a clock? Consider for a debug build. - m_pClock = pClock; - - return NOERROR; -} - -/* Return the clock we are using for synchronisation */ -STDMETHODIMP -CBaseMediaFilter::GetSyncSource(IReferenceClock **pClock) -{ - CheckPointer(pClock,E_POINTER); - ValidateReadWritePtr(pClock,sizeof(IReferenceClock *)); - CAutoLock cObjectLock(m_pLock); - - if (m_pClock) { - // returning an interface... addref it... - m_pClock->AddRef(); - } - *pClock = (IReferenceClock*)m_pClock; - return NOERROR; -} - - -/* Put the filter into a stopped state */ - -STDMETHODIMP -CBaseMediaFilter::Stop() -{ - CAutoLock cObjectLock(m_pLock); - - m_State = State_Stopped; - return S_OK; -} - - -/* Put the filter into a paused state */ - -STDMETHODIMP -CBaseMediaFilter::Pause() -{ - CAutoLock cObjectLock(m_pLock); - - m_State = State_Paused; - return S_OK; -} - - -// Put the filter into a running state. - -// The time parameter is the offset to be added to the samples' -// stream time to get the reference time at which they should be presented. -// -// you can either add these two and compare it against the reference clock, -// or you can call CBaseMediaFilter::StreamTime and compare that against -// the sample timestamp. - -STDMETHODIMP -CBaseMediaFilter::Run(REFERENCE_TIME tStart) -{ - CAutoLock cObjectLock(m_pLock); - - // remember the stream time offset - m_tStart = tStart; - - if (m_State == State_Stopped){ - HRESULT hr = Pause(); - - if (FAILED(hr)) { - return hr; - } - } - m_State = State_Running; - return S_OK; -} - - -// -// return the current stream time - samples with start timestamps of this -// time or before should be rendered by now -HRESULT -CBaseMediaFilter::StreamTime(CRefTime& rtStream) -{ - // Caller must lock for synchronization - // We can't grab the filter lock because we want to be able to call - // this from worker threads without deadlocking - - if (m_pClock == NULL) { - return VFW_E_NO_CLOCK; - } - - // get the current reference time - HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream); - if (FAILED(hr)) { - return hr; - } - - // subtract the stream offset to get stream time - rtStream -= m_tStart; - - return S_OK; -} - - -//===================================================================== -//===================================================================== -// Implements CBaseFilter -//===================================================================== -//===================================================================== - - -/* Override this to say what interfaces we support and where */ - -STDMETHODIMP CBaseFilter::NonDelegatingQueryInterface(REFIID riid, - void **ppv) -{ - /* Do we have this interface */ - - if (riid == IID_IBaseFilter) { - return GetInterface((IBaseFilter *) this, ppv); - } else if (riid == IID_IMediaFilter) { - return GetInterface((IMediaFilter *) this, ppv); - } else if (riid == IID_IPersist) { - return GetInterface((IPersist *) this, ppv); - } else if (riid == IID_IAMovieSetup) { - return GetInterface((IAMovieSetup *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - -#ifdef DEBUG -STDMETHODIMP_(ULONG) CBaseFilter::NonDelegatingRelease() -{ - if (m_cRef == 1) { - KASSERT(m_pGraph == NULL); - } - return CUnknown::NonDelegatingRelease(); -} -#endif - - -/* Constructor */ - -CBaseFilter::CBaseFilter(const TCHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid) : - CUnknown( pName, pUnk ), - m_pLock(pLock), - m_clsid(clsid), - m_State(State_Stopped), - m_pClock(NULL), - m_pGraph(NULL), - m_pSink(NULL), - m_pName(NULL), - m_PinVersion(1) -{ - - ASSERT(pLock != NULL); -} - -/* Passes in a redundant HRESULT argument */ - -CBaseFilter::CBaseFilter(TCHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid, - HRESULT *phr) : - CUnknown( pName, pUnk ), - m_pLock(pLock), - m_clsid(clsid), - m_State(State_Stopped), - m_pClock(NULL), - m_pGraph(NULL), - m_pSink(NULL), - m_pName(NULL), - m_PinVersion(1) -{ - - ASSERT(pLock != NULL); - UNREFERENCED_PARAMETER(phr); -} - -#ifdef UNICODE -CBaseFilter::CBaseFilter(const CHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid) : - CUnknown( pName, pUnk ), - m_pLock(pLock), - m_clsid(clsid), - m_State(State_Stopped), - m_pClock(NULL), - m_pGraph(NULL), - m_pSink(NULL), - m_pName(NULL), - m_PinVersion(1) -{ - - ASSERT(pLock != NULL); -} -CBaseFilter::CBaseFilter(CHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid, - HRESULT *phr) : - CUnknown( pName, pUnk ), - m_pLock(pLock), - m_clsid(clsid), - m_State(State_Stopped), - m_pClock(NULL), - m_pGraph(NULL), - m_pSink(NULL), - m_pName(NULL), - m_PinVersion(1) -{ - - ASSERT(pLock != NULL); - UNREFERENCED_PARAMETER(phr); -} -#endif - -/* Destructor */ - -CBaseFilter::~CBaseFilter() -{ - - // NOTE we do NOT hold references on the filtergraph for m_pGraph or m_pSink - // When we did we had the circular reference problem. Nothing would go away. - - delete[] m_pName; - - // must be stopped, but can't call Stop here since - // our critsec has been destroyed. - - /* Release any clock we were using */ - if (m_pClock) { - m_pClock->Release(); - m_pClock = NULL; - } -} - -/* Return the filter's clsid */ -STDMETHODIMP -CBaseFilter::GetClassID(CLSID *pClsID) -{ - CheckPointer(pClsID,E_POINTER); - ValidateReadWritePtr(pClsID,sizeof(CLSID)); - *pClsID = m_clsid; - return NOERROR; -} - -/* Override this if your state changes are not done synchronously */ -STDMETHODIMP -CBaseFilter::GetState(DWORD dwMSecs, FILTER_STATE *State) -{ - UNREFERENCED_PARAMETER(dwMSecs); - CheckPointer(State,E_POINTER); - ValidateReadWritePtr(State,sizeof(FILTER_STATE)); - - *State = m_State; - return S_OK; -} - - -/* Set the clock we will use for synchronisation */ - -STDMETHODIMP -CBaseFilter::SetSyncSource(IReferenceClock *pClock) -{ - CAutoLock cObjectLock(m_pLock); - - // Ensure the new one does not go away - even if the same as the old - if (pClock) { - pClock->AddRef(); - } - - // if we have a clock, release it - if (m_pClock) { - m_pClock->Release(); - } - - // Set the new reference clock (might be NULL) - // Should we query it to ensure it is a clock? Consider for a debug build. - m_pClock = pClock; - - return NOERROR; -} - -/* Return the clock we are using for synchronisation */ -STDMETHODIMP -CBaseFilter::GetSyncSource(IReferenceClock **pClock) -{ - CheckPointer(pClock,E_POINTER); - ValidateReadWritePtr(pClock,sizeof(IReferenceClock *)); - CAutoLock cObjectLock(m_pLock); - - if (m_pClock) { - // returning an interface... addref it... - m_pClock->AddRef(); - } - *pClock = (IReferenceClock*)m_pClock; - return NOERROR; -} - - - -// override CBaseMediaFilter Stop method, to deactivate any pins this -// filter has. -STDMETHODIMP -CBaseFilter::Stop() -{ - CAutoLock cObjectLock(m_pLock); - HRESULT hr = NOERROR; - - // notify all pins of the state change - if (m_State != State_Stopped) { - int cPins = GetPinCount(); - for (int c = 0; c < cPins; c++) { - - CBasePin *pPin = GetPin(c); - - // Disconnected pins are not activated - this saves pins worrying - // about this state themselves. We ignore the return code to make - // sure everyone is inactivated regardless. The base input pin - // class can return an error if it has no allocator but Stop can - // be used to resync the graph state after something has gone bad - - if (pPin->IsConnected()) { - HRESULT hrTmp = pPin->Inactive(); - if (FAILED(hrTmp) && SUCCEEDED(hr)) { - hr = hrTmp; - } - } - } - } - - - m_State = State_Stopped; - return hr; -} - - -// override CBaseMediaFilter Pause method to activate any pins -// this filter has (also called from Run) - -STDMETHODIMP -CBaseFilter::Pause() -{ - CAutoLock cObjectLock(m_pLock); - - // notify all pins of the change to active state - if (m_State == State_Stopped) { - int cPins = GetPinCount(); - for (int c = 0; c < cPins; c++) { - - CBasePin *pPin = GetPin(c); - - // Disconnected pins are not activated - this saves pins - // worrying about this state themselves - - if (pPin->IsConnected()) { - HRESULT hr = pPin->Active(); - if (FAILED(hr)) { - return hr; - } - } - } - } - - - - m_State = State_Paused; - return S_OK; -} - -// Put the filter into a running state. - -// The time parameter is the offset to be added to the samples' -// stream time to get the reference time at which they should be presented. -// -// you can either add these two and compare it against the reference clock, -// or you can call CBaseFilter::StreamTime and compare that against -// the sample timestamp. - -STDMETHODIMP -CBaseFilter::Run(REFERENCE_TIME tStart) -{ - CAutoLock cObjectLock(m_pLock); - - // remember the stream time offset - m_tStart = tStart; - - if (m_State == State_Stopped){ - HRESULT hr = Pause(); - - if (FAILED(hr)) { - return hr; - } - } - // notify all pins of the change to active state - if (m_State != State_Running) { - int cPins = GetPinCount(); - for (int c = 0; c < cPins; c++) { - - CBasePin *pPin = GetPin(c); - - // Disconnected pins are not activated - this saves pins - // worrying about this state themselves - - if (pPin->IsConnected()) { - HRESULT hr = pPin->Run(tStart); - if (FAILED(hr)) { - return hr; - } - } - } - } - - - m_State = State_Running; - return S_OK; -} - -// -// return the current stream time - samples with start timestamps of this -// time or before should be rendered by now -HRESULT -CBaseFilter::StreamTime(CRefTime& rtStream) -{ - // Caller must lock for synchronization - // We can't grab the filter lock because we want to be able to call - // this from worker threads without deadlocking - - if (m_pClock == NULL) { - return VFW_E_NO_CLOCK; - } - - // get the current reference time - HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream); - if (FAILED(hr)) { - return hr; - } - - // subtract the stream offset to get stream time - rtStream -= m_tStart; - - return S_OK; -} - - -/* Create an enumerator for the pins attached to this filter */ - -STDMETHODIMP -CBaseFilter::EnumPins(IEnumPins **ppEnum) -{ - CheckPointer(ppEnum,E_POINTER); - ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *)); - - /* Create a new ref counted enumerator */ - - *ppEnum = new CEnumPins(this, - NULL); - - return *ppEnum == NULL ? E_OUTOFMEMORY : NOERROR; -} - - -// default behaviour of FindPin is to assume pins are named -// by their pin names -STDMETHODIMP -CBaseFilter::FindPin( - LPCWSTR Id, - IPin ** ppPin -) -{ - CheckPointer(ppPin,E_POINTER); - ValidateReadWritePtr(ppPin,sizeof(IPin *)); - - // We're going to search the pin list so maintain integrity - CAutoLock lck(m_pLock); - int iCount = GetPinCount(); - for (int i = 0; i < iCount; i++) { - CBasePin *pPin = GetPin(i); - ASSERT(pPin != NULL); - - if (0 == lstrcmpW(pPin->Name(), Id)) { - // Found one that matches - // - // AddRef() and return it - *ppPin = pPin; - pPin->AddRef(); - return S_OK; - } - } - *ppPin = NULL; - return VFW_E_NOT_FOUND; -} - -/* Return information about this filter */ - -STDMETHODIMP -CBaseFilter::QueryFilterInfo(FILTER_INFO * pInfo) -{ - CheckPointer(pInfo,E_POINTER); - ValidateReadWritePtr(pInfo,sizeof(FILTER_INFO)); - - if (m_pName) { - lstrcpynW(pInfo->achName, m_pName, sizeof(pInfo->achName)/sizeof(WCHAR)); - } else { - pInfo->achName[0] = L'\0'; - } - pInfo->pGraph = m_pGraph; - if (m_pGraph) - m_pGraph->AddRef(); - return NOERROR; -} - - -/* Provide the filter with a filter graph */ - -STDMETHODIMP -CBaseFilter::JoinFilterGraph( - IFilterGraph * pGraph, - LPCWSTR pName) -{ - CAutoLock cObjectLock(m_pLock); - - // NOTE: we no longer hold references on the graph (m_pGraph, m_pSink) - - m_pGraph = pGraph; - if (m_pGraph) { - HRESULT hr = m_pGraph->QueryInterface(IID_IMediaEventSink, - (void**) &m_pSink); - if (FAILED(hr)) { - ASSERT(m_pSink == NULL); - } - else m_pSink->Release(); // we do NOT keep a reference on it. - } else { - // if graph pointer is null, then we should - // also release the IMediaEventSink on the same object - we don't - // refcount it, so just set it to null - m_pSink = NULL; - } - - - if (m_pName) { - delete[] m_pName; - m_pName = NULL; - } - - if (pName) { - DWORD nameLen = lstrlenW(pName)+1; - m_pName = new WCHAR[nameLen]; - if (m_pName) { - CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); - } else { - // !!! error here? - ASSERT(FALSE); - } - } - - - return NOERROR; -} - - -// return a Vendor information string. Optional - may return E_NOTIMPL. -// memory returned should be freed using CoTaskMemFree -// default implementation returns E_NOTIMPL -STDMETHODIMP -CBaseFilter::QueryVendorInfo( - LPWSTR* pVendorInfo) -{ - UNREFERENCED_PARAMETER(pVendorInfo); - return E_NOTIMPL; -} - - -// send an event notification to the filter graph if we know about it. -// returns S_OK if delivered, S_FALSE if the filter graph does not sink -// events, or an error otherwise. -HRESULT -CBaseFilter::NotifyEvent( - long EventCode, - LONG_PTR EventParam1, - LONG_PTR EventParam2) -{ - // Snapshot so we don't have to lock up - IMediaEventSink *pSink = m_pSink; - if (pSink) { - if (EC_COMPLETE == EventCode) { - EventParam2 = (LONG_PTR)(IBaseFilter*)this; - } - - return pSink->Notify(EventCode, EventParam1, EventParam2); - } else { - return E_NOTIMPL; - } -} - -// Request reconnect -// pPin is the pin to reconnect -// pmt is the type to reconnect with - can be NULL -// Calls ReconnectEx on the filter graph -HRESULT -CBaseFilter::ReconnectPin( - IPin *pPin, - AM_MEDIA_TYPE const *pmt -) -{ - IFilterGraph2 *pGraph2; - if (m_pGraph != NULL) { - HRESULT hr = m_pGraph->QueryInterface(IID_IFilterGraph2, (void **)&pGraph2); - if (SUCCEEDED(hr)) { - hr = pGraph2->ReconnectEx(pPin, pmt); - pGraph2->Release(); - return hr; - } else { - return m_pGraph->Reconnect(pPin); - } - } else { - return E_NOINTERFACE; - } -} - - - -/* This is the same idea as the media type version does for type enumeration - on pins but for the list of pins available. So if the list of pins you - provide changes dynamically then either override this virtual function - to provide the version number, or more simply call IncrementPinVersion */ - -LONG CBaseFilter::GetPinVersion() -{ - return m_PinVersion; -} - - -/* Increment the current pin version cookie */ - -void CBaseFilter::IncrementPinVersion() -{ - InterlockedIncrement(&m_PinVersion); -} - -/* register filter */ - -STDMETHODIMP CBaseFilter::Register() -{ - // get setup data, if it exists - // - LPAMOVIESETUP_FILTER psetupdata = GetSetupData(); - - // check we've got data - // - if( NULL == psetupdata ) return S_FALSE; - - // init is ref counted so call just in case - // we're being called cold. - // - HRESULT hr = CoInitialize( (LPVOID)NULL ); - ASSERT( SUCCEEDED(hr) ); - - // get hold of IFilterMapper - // - IFilterMapper *pIFM; - hr = CoCreateInstance( CLSID_FilterMapper - , NULL - , CLSCTX_INPROC_SERVER - , IID_IFilterMapper - , (void **)&pIFM ); - if( SUCCEEDED(hr) ) - { - hr = AMovieSetupRegisterFilter( psetupdata, pIFM, TRUE ); - pIFM->Release(); - } - - // and clear up - // - CoFreeUnusedLibraries(); - CoUninitialize(); - - return NOERROR; -} - - -/* unregister filter */ - -STDMETHODIMP CBaseFilter::Unregister() -{ - // get setup data, if it exists - // - LPAMOVIESETUP_FILTER psetupdata = GetSetupData(); - - // check we've got data - // - if( NULL == psetupdata ) return S_FALSE; - - // OLE init is ref counted so call - // just in case we're being called cold. - // - HRESULT hr = CoInitialize( (LPVOID)NULL ); - ASSERT( SUCCEEDED(hr) ); - - // get hold of IFilterMapper - // - IFilterMapper *pIFM; - hr = CoCreateInstance( CLSID_FilterMapper - , NULL - , CLSCTX_INPROC_SERVER - , IID_IFilterMapper - , (void **)&pIFM ); - if( SUCCEEDED(hr) ) - { - hr = AMovieSetupRegisterFilter( psetupdata, pIFM, FALSE ); - - // release interface - // - pIFM->Release(); - } - - // clear up - // - CoFreeUnusedLibraries(); - CoUninitialize(); - - // handle one acceptable "error" - that - // of filter not being registered! - // (couldn't find a suitable #define'd - // name for the error!) - // - if( 0x80070002 == hr) - return NOERROR; - else - return hr; -} - - -//===================================================================== -//===================================================================== -// Implements CEnumPins -//===================================================================== -//===================================================================== - - -CEnumPins::CEnumPins(CBaseFilter *pFilter, - CEnumPins *pEnumPins) : - m_Position(0), - m_PinCount(0), - m_pFilter(pFilter), - m_cRef(1), // Already ref counted - m_PinCache(NAME("Pin Cache")) -{ - -#ifdef DEBUG - m_dwCookie = DbgRegisterObjectCreation("CEnumPins", 0); -#endif - - /* We must be owned by a filter derived from CBaseFilter */ - - ASSERT(pFilter != NULL); - - /* Hold a reference count on our filter */ - m_pFilter->AddRef(); - - /* Are we creating a new enumerator */ - - if (pEnumPins == NULL) { - m_Version = m_pFilter->GetPinVersion(); - m_PinCount = m_pFilter->GetPinCount(); - } else { - ASSERT(m_Position <= m_PinCount); - m_Position = pEnumPins->m_Position; - m_PinCount = pEnumPins->m_PinCount; - m_Version = pEnumPins->m_Version; - m_PinCache.AddTail(&(pEnumPins->m_PinCache)); - } -} - - -/* Destructor releases the reference count on our filter NOTE since we hold - a reference count on the filter who created us we know it is safe to - release it, no access can be made to it afterwards though as we have just - caused the last reference count to go and the object to be deleted */ - -CEnumPins::~CEnumPins() -{ - m_pFilter->Release(); - -#ifdef DEBUG - DbgRegisterObjectDestruction(m_dwCookie); -#endif -} - - -/* Override this to say what interfaces we support where */ - -STDMETHODIMP -CEnumPins::QueryInterface(REFIID riid,void **ppv) -{ - CheckPointer(ppv, E_POINTER); - - /* Do we have this interface */ - - if (riid == IID_IEnumPins || riid == IID_IUnknown) { - return GetInterface((IEnumPins *) this, ppv); - } else { - *ppv = NULL; - return E_NOINTERFACE; - } -} - -STDMETHODIMP_(ULONG) -CEnumPins::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -STDMETHODIMP_(ULONG) -CEnumPins::Release() -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - if (cRef == 0) { - delete this; - } - return cRef; -} - -/* One of an enumerator's basic member functions allows us to create a cloned - interface that initially has the same state. Since we are taking a snapshot - of an object (current position and all) we must lock access at the start */ - -STDMETHODIMP -CEnumPins::Clone(IEnumPins **ppEnum) -{ - CheckPointer(ppEnum,E_POINTER); - ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *)); - HRESULT hr = NOERROR; - - /* Check we are still in sync with the filter */ - if (AreWeOutOfSync() == TRUE) { - *ppEnum = NULL; - hr = VFW_E_ENUM_OUT_OF_SYNC; - } else { - - *ppEnum = new CEnumPins(m_pFilter, - this); - if (*ppEnum == NULL) { - hr = E_OUTOFMEMORY; - } - } - return hr; -} - - -/* Return the next pin after the current position */ - -STDMETHODIMP -CEnumPins::Next(ULONG cPins, // place this many pins... - IPin **ppPins, // ...in this array - ULONG *pcFetched) // actual count passed returned here -{ - CheckPointer(ppPins,E_POINTER); - ValidateReadWritePtr(ppPins,cPins * sizeof(IPin *)); - - ASSERT(ppPins); - - if (pcFetched!=NULL) { - ValidateWritePtr(pcFetched, sizeof(ULONG)); - *pcFetched = 0; // default unless we succeed - } - // now check that the parameter is valid - else if (cPins>1) { // pcFetched == NULL - return E_INVALIDARG; - } - ULONG cFetched = 0; // increment as we get each one. - - /* Check we are still in sync with the filter */ - if (AreWeOutOfSync() == TRUE) { - // If we are out of sync, we should refresh the enumerator. - // This will reset the position and update the other members, but - // will not clear cache of pins we have already returned. - Refresh(); - } - - /* Calculate the number of available pins */ - - int cRealPins = min(m_PinCount - m_Position, (int) cPins); - if (cRealPins == 0) { - return S_FALSE; - } - - /* Return each pin interface NOTE GetPin returns CBasePin * not addrefed - so we must QI for the IPin (which increments its reference count) - If while we are retrieving a pin from the filter an error occurs we - assume that our internal state is stale with respect to the filter - (for example someone has deleted a pin) so we - return VFW_E_ENUM_OUT_OF_SYNC */ - - while (cRealPins && (m_PinCount - m_Position)) { - - /* Get the next pin object from the filter */ - - CBasePin *pPin = m_pFilter->GetPin(m_Position++); - if (pPin == NULL) { - // If this happend, and it's not the first time through, then we've got a problem, - // since we should really go back and release the iPins, which we have previously - // AddRef'ed. - ASSERT( cFetched==0 ); - return VFW_E_ENUM_OUT_OF_SYNC; - } - - /* We only want to return this pin, if it is not in our cache */ - if (0 == m_PinCache.Find(pPin)) - { - /* From the object get an IPin interface */ - - *ppPins = pPin; - pPin->AddRef(); - - cFetched++; - ppPins++; - - m_PinCache.AddTail(pPin); - - cRealPins--; - - } - } - - if (pcFetched!=NULL) { - *pcFetched = cFetched; - } - - return (cPins==cFetched ? NOERROR : S_FALSE); -} - - -/* Skip over one or more entries in the enumerator */ - -STDMETHODIMP -CEnumPins::Skip(ULONG cPins) -{ - /* Check we are still in sync with the filter */ - if (AreWeOutOfSync() == TRUE) { - return VFW_E_ENUM_OUT_OF_SYNC; - } - - /* Work out how many pins are left to skip over */ - /* We could position at the end if we are asked to skip too many... */ - /* ..which would match the base implementation for CEnumMediaTypes::Skip */ - - ULONG PinsLeft = m_PinCount - m_Position; - if (cPins > PinsLeft) { - return S_FALSE; - } - m_Position += cPins; - return NOERROR; -} - - -/* Set the current position back to the start */ -/* Reset has 4 simple steps: - * - * Set position to head of list - * Sync enumerator with object being enumerated - * Clear the cache of pins already returned - * return S_OK - */ - -STDMETHODIMP -CEnumPins::Reset() -{ - m_Version = m_pFilter->GetPinVersion(); - m_PinCount = m_pFilter->GetPinCount(); - - m_Position = 0; - - // Clear the cache - m_PinCache.RemoveAll(); - - return S_OK; -} - - -/* Set the current position back to the start */ -/* Refresh has 3 simple steps: - * - * Set position to head of list - * Sync enumerator with object being enumerated - * return S_OK - */ - -STDMETHODIMP -CEnumPins::Refresh() -{ - m_Version = m_pFilter->GetPinVersion(); - m_PinCount = m_pFilter->GetPinCount(); - - m_Position = 0; - return S_OK; -} - - -//===================================================================== -//===================================================================== -// Implements CEnumMediaTypes -//===================================================================== -//===================================================================== - - -CEnumMediaTypes::CEnumMediaTypes(CBasePin *pPin, - CEnumMediaTypes *pEnumMediaTypes) : - m_Position(0), - m_pPin(pPin), - m_cRef(1) -{ - -#ifdef DEBUG - m_dwCookie = DbgRegisterObjectCreation("CEnumMediaTypes", 0); -#endif - - /* We must be owned by a pin derived from CBasePin */ - - ASSERT(pPin != NULL); - - /* Hold a reference count on our pin */ - m_pPin->AddRef(); - - /* Are we creating a new enumerator */ - - if (pEnumMediaTypes == NULL) { - m_Version = m_pPin->GetMediaTypeVersion(); - return; - } - - m_Position = pEnumMediaTypes->m_Position; - m_Version = pEnumMediaTypes->m_Version; -} - - -/* Destructor releases the reference count on our base pin. NOTE since we hold - a reference count on the pin who created us we know it is safe to release - it, no access can be made to it afterwards though as we might have just - caused the last reference count to go and the object to be deleted */ - -CEnumMediaTypes::~CEnumMediaTypes() -{ -#ifdef DEBUG - DbgRegisterObjectDestruction(m_dwCookie); -#endif - m_pPin->Release(); -} - - -/* Override this to say what interfaces we support where */ - -STDMETHODIMP -CEnumMediaTypes::QueryInterface(REFIID riid,void **ppv) -{ - CheckPointer(ppv, E_POINTER); - - /* Do we have this interface */ - - if (riid == IID_IEnumMediaTypes || riid == IID_IUnknown) { - return GetInterface((IEnumMediaTypes *) this, ppv); - } else { - *ppv = NULL; - return E_NOINTERFACE; - } -} - -STDMETHODIMP_(ULONG) -CEnumMediaTypes::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - -STDMETHODIMP_(ULONG) -CEnumMediaTypes::Release() -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - if (cRef == 0) { - delete this; - } - return cRef; -} - -/* One of an enumerator's basic member functions allows us to create a cloned - interface that initially has the same state. Since we are taking a snapshot - of an object (current position and all) we must lock access at the start */ - -STDMETHODIMP -CEnumMediaTypes::Clone(IEnumMediaTypes **ppEnum) -{ - CheckPointer(ppEnum,E_POINTER); - ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *)); - HRESULT hr = NOERROR; - - /* Check we are still in sync with the pin */ - if (AreWeOutOfSync() == TRUE) { - *ppEnum = NULL; - hr = VFW_E_ENUM_OUT_OF_SYNC; - } else { - - *ppEnum = new CEnumMediaTypes(m_pPin, - this); - - if (*ppEnum == NULL) { - hr = E_OUTOFMEMORY; - } - } - return hr; -} - - -/* Enumerate the next pin(s) after the current position. The client using this - interface passes in a pointer to an array of pointers each of which will - be filled in with a pointer to a fully initialised media type format - Return NOERROR if it all works, - S_FALSE if fewer than cMediaTypes were enumerated. - VFW_E_ENUM_OUT_OF_SYNC if the enumerator has been broken by - state changes in the filter - The actual count always correctly reflects the number of types in the array. -*/ - -STDMETHODIMP -CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types... - AM_MEDIA_TYPE **ppMediaTypes, // ...in this array - ULONG *pcFetched) // actual count passed -{ - CheckPointer(ppMediaTypes,E_POINTER); - ValidateReadWritePtr(ppMediaTypes,cMediaTypes * sizeof(AM_MEDIA_TYPE *)); - /* Check we are still in sync with the pin */ - if (AreWeOutOfSync() == TRUE) { - return VFW_E_ENUM_OUT_OF_SYNC; - } - - if (pcFetched!=NULL) { - ValidateWritePtr(pcFetched, sizeof(ULONG)); - *pcFetched = 0; // default unless we succeed - } - // now check that the parameter is valid - else if (cMediaTypes>1) { // pcFetched == NULL - return E_INVALIDARG; - } - ULONG cFetched = 0; // increment as we get each one. - - /* Return each media type by asking the filter for them in turn - If we - have an error code retured to us while we are retrieving a media type - we assume that our internal state is stale with respect to the filter - (for example the window size changing) so we return - VFW_E_ENUM_OUT_OF_SYNC */ - - while (cMediaTypes) { - - CMediaType cmt; - - HRESULT hr = m_pPin->GetMediaType(m_Position++, &cmt); - if (S_OK != hr) { - break; - } - - /* We now have a CMediaType object that contains the next media type - but when we assign it to the array position we CANNOT just assign - the AM_MEDIA_TYPE structure because as soon as the object goes out of - scope it will delete the memory we have just copied. The function - we use is CreateMediaType which allocates a task memory block */ - - /* Transfer across the format block manually to save an allocate - and free on the format block and generally go faster */ - - *ppMediaTypes = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); - if (*ppMediaTypes == NULL) { - break; - } - - /* Do a regular copy */ - **ppMediaTypes = (AM_MEDIA_TYPE)cmt; - - /* Make sure the destructor doesn't free these */ - cmt.pbFormat = NULL; - cmt.cbFormat = NULL; - cmt.pUnk = NULL; - - - ppMediaTypes++; - cFetched++; - cMediaTypes--; - } - - if (pcFetched!=NULL) { - *pcFetched = cFetched; - } - - return ( cMediaTypes==0 ? NOERROR : S_FALSE ); -} - - -/* Skip over one or more entries in the enumerator */ - -STDMETHODIMP -CEnumMediaTypes::Skip(ULONG cMediaTypes) -{ - // If we're skipping 0 elements we're guaranteed to skip the - // correct number of elements - if (cMediaTypes == 0) { - return S_OK; - } - - /* Check we are still in sync with the pin */ - if (AreWeOutOfSync() == TRUE) { - return VFW_E_ENUM_OUT_OF_SYNC; - } - - m_Position += cMediaTypes; - - /* See if we're over the end */ - CMediaType cmt; - return S_OK == m_pPin->GetMediaType(m_Position - 1, &cmt) ? S_OK : S_FALSE; -} - - -/* Set the current position back to the start */ -/* Reset has 3 simple steps: - * - * set position to head of list - * sync enumerator with object being enumerated - * return S_OK - */ - -STDMETHODIMP -CEnumMediaTypes::Reset() - -{ - m_Position = 0; - - // Bring the enumerator back into step with the current state. This - // may be a noop but ensures that the enumerator will be valid on the - // next call. - m_Version = m_pPin->GetMediaTypeVersion(); - return NOERROR; -} - - -//===================================================================== -//===================================================================== -// Implements CBasePin -//===================================================================== -//===================================================================== - - -/* NOTE The implementation of this class calls the CUnknown constructor with - a NULL outer unknown pointer. This has the effect of making us a self - contained class, ie any QueryInterface, AddRef or Release calls will be - routed to the class's NonDelegatingUnknown methods. You will typically - find that the classes that do this then override one or more of these - virtual functions to provide more specialised behaviour. A good example - of this is where a class wants to keep the QueryInterface internal but - still wants its lifetime controlled by the external object */ - -/* Constructor */ - -CBasePin::CBasePin(TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName, - PIN_DIRECTION dir) : - CUnknown( pObjectName, NULL ), - m_pFilter(pFilter), - m_pLock(pLock), - m_pName(NULL), - m_Connected(NULL), - m_dir(dir), - m_bRunTimeError(FALSE), - m_pQSink(NULL), - m_TypeVersion(1), - m_tStart(), - m_tStop(MAX_TIME), - m_bCanReconnectWhenActive(false), - m_bTryMyTypesFirst(false), - m_dRate(1.0) -{ - /* WARNING - pFilter is often not a properly constituted object at - this state (in particular QueryInterface may not work) - this - is because its owner is often its containing object and we - have been called from the containing object's constructor so - the filter's owner has not yet had its CUnknown constructor - called - */ - - ASSERT(pFilter != NULL); - ASSERT(pLock != NULL); - - if (pName) { - DWORD nameLen = lstrlenW(pName)+1; - m_pName = new WCHAR[nameLen]; - if (m_pName) { - CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); - } - } - -#ifdef DEBUG - m_cRef = 0; -#endif -} - -#ifdef UNICODE -CBasePin::CBasePin(CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName, - PIN_DIRECTION dir) : - CUnknown( pObjectName, NULL ), - m_pFilter(pFilter), - m_pLock(pLock), - m_pName(NULL), - m_Connected(NULL), - m_dir(dir), - m_bRunTimeError(FALSE), - m_pQSink(NULL), - m_TypeVersion(1), - m_tStart(), - m_tStop(MAX_TIME), - m_bCanReconnectWhenActive(false), - m_bTryMyTypesFirst(false), - m_dRate(1.0) -{ - /* WARNING - pFilter is often not a properly constituted object at - this state (in particular QueryInterface may not work) - this - is because its owner is often its containing object and we - have been called from the containing object's constructor so - the filter's owner has not yet had its CUnknown constructor - called - */ - - ASSERT(pFilter != NULL); - ASSERT(pLock != NULL); - - if (pName) { - DWORD nameLen = lstrlenW(pName)+1; - m_pName = new WCHAR[nameLen]; - if (m_pName) { - CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); - } - } - -#ifdef DEBUG - m_cRef = 0; -#endif -} -#endif - -/* Destructor since a connected pin holds a reference count on us there is - no way that we can be deleted unless we are not currently connected */ - -CBasePin::~CBasePin() -{ - - // We don't call disconnect because if the filter is going away - // all the pins must have a reference count of zero so they must - // have been disconnected anyway - (but check the assumption) - ASSERT(m_Connected == FALSE); - - delete[] m_pName; - - // check the internal reference count is consistent - ASSERT(m_cRef == 0); -} - - -/* Override this to say what interfaces we support and where */ - -STDMETHODIMP -CBasePin::NonDelegatingQueryInterface(REFIID riid, void ** ppv) -{ - /* Do we have this interface */ - - if (riid == IID_IPin) { - return GetInterface((IPin *) this, ppv); - } else if (riid == IID_IQualityControl) { - return GetInterface((IQualityControl *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -/* Override to increment the owning filter's reference count */ - -STDMETHODIMP_(ULONG) -CBasePin::NonDelegatingAddRef() -{ - ASSERT(InterlockedIncrement(&m_cRef) > 0); - return m_pFilter->AddRef(); -} - - -/* Override to decrement the owning filter's reference count */ - -STDMETHODIMP_(ULONG) -CBasePin::NonDelegatingRelease() -{ - ASSERT(InterlockedDecrement(&m_cRef) >= 0); - return m_pFilter->Release(); -} - - -/* Displays pin connection information */ - -#ifdef DEBUG -void -CBasePin::DisplayPinInfo(IPin *pReceivePin) -{ - - if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) { - PIN_INFO ConnectPinInfo; - PIN_INFO ReceivePinInfo; - - if (FAILED(QueryPinInfo(&ConnectPinInfo))) { - lstrcpyW(ConnectPinInfo.achName, L"Bad Pin"); - } else { - QueryPinInfoReleaseFilter(ConnectPinInfo); - } - - if (FAILED(pReceivePin->QueryPinInfo(&ReceivePinInfo))) { - lstrcpyW(ReceivePinInfo.achName, L"Bad Pin"); - } else { - QueryPinInfoReleaseFilter(ReceivePinInfo); - } - - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Trying to connect Pins :"))); - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" <%ls>"), ConnectPinInfo.achName)); - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" <%ls>"), ReceivePinInfo.achName)); - } -} -#endif - - -/* Displays general information on the pin media type */ - -#ifdef DEBUG -void CBasePin::DisplayTypeInfo(IPin *pPin, const CMediaType *pmt) -{ - UNREFERENCED_PARAMETER(pPin); - if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) { - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Trying media type:"))); - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" major type: %hs"), - GuidNames[*pmt->Type()])); - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" sub type : %hs"), - GuidNames[*pmt->Subtype()])); - } -} -#endif - -/* Asked to connect to a pin. A pin is always attached to an owning filter - object so we always delegate our locking to that object. We first of all - retrieve a media type enumerator for the input pin and see if we accept - any of the formats that it would ideally like, failing that we retrieve - our enumerator and see if it will accept any of our preferred types */ - -STDMETHODIMP -CBasePin::Connect( - IPin * pReceivePin, - const AM_MEDIA_TYPE *pmt // optional media type -) -{ - CheckPointer(pReceivePin,E_POINTER); - ValidateReadPtr(pReceivePin,sizeof(IPin)); - CAutoLock cObjectLock(m_pLock); - DisplayPinInfo(pReceivePin); - - /* See if we are already connected */ - - if (m_Connected) { - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Already connected"))); - return VFW_E_ALREADY_CONNECTED; - } - - /* See if the filter is active */ - if (!IsStopped() && !m_bCanReconnectWhenActive) { - return VFW_E_NOT_STOPPED; - } - - - // Find a mutually agreeable media type - - // Pass in the template media type. If this is partially specified, - // each of the enumerated media types will need to be checked against - // it. If it is non-null and fully specified, we will just try to connect - // with this. - - const CMediaType * ptype = (CMediaType*)pmt; - HRESULT hr = AgreeMediaType(pReceivePin, ptype); - if (FAILED(hr)) { - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Failed to agree type"))); - - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - - return hr; - } - - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Connection succeeded"))); - - - return NOERROR; -} - -// given a specific media type, attempt a connection (includes -// checking that the type is acceptable to this pin) -HRESULT -CBasePin::AttemptConnection( - IPin* pReceivePin, // connect to this pin - const CMediaType* pmt // using this type -) -{ - // The caller should hold the filter lock becasue this function - // uses m_Connected. The caller should also hold the filter lock - // because this function calls SetMediaType(), IsStopped() and - // CompleteConnect(). - ASSERT(CritCheckIn(m_pLock)); - - // Check that the connection is valid -- need to do this for every - // connect attempt since BreakConnect will undo it. - HRESULT hr = CheckConnect(pReceivePin); - if (FAILED(hr)) { - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("CheckConnect failed"))); - - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - return hr; - } - - DisplayTypeInfo(pReceivePin, pmt); - - /* Check we will accept this media type */ - - hr = CheckMediaType(pmt); - if (hr == NOERROR) { - - /* Make ourselves look connected otherwise ReceiveConnection - may not be able to complete the connection - */ - m_Connected = pReceivePin; - m_Connected->AddRef(); - hr = SetMediaType(pmt); - if (SUCCEEDED(hr)) { - /* See if the other pin will accept this type */ - - hr = pReceivePin->ReceiveConnection((IPin *)this, pmt); - if (SUCCEEDED(hr)) { - /* Complete the connection */ - - hr = CompleteConnect(pReceivePin); - if (SUCCEEDED(hr)) { - return hr; - } else { - DbgLog((LOG_TRACE, - CONNECT_TRACE_LEVEL, - TEXT("Failed to complete connection"))); - pReceivePin->Disconnect(); - } - } - } - } else { - // we cannot use this media type - - // return a specific media type error if there is one - // or map a general failure code to something more helpful - // (in particular S_FALSE gets changed to an error code) - if (SUCCEEDED(hr) || - (hr == E_FAIL) || - (hr == E_INVALIDARG)) { - hr = VFW_E_TYPE_NOT_ACCEPTED; - } - } - - // BreakConnect and release any connection here in case CheckMediaType - // failed, or if we set anything up during a call back during - // ReceiveConnection. - - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - /* If failed then undo our state */ - if (m_Connected) { - m_Connected->Release(); - m_Connected = NULL; - } - - return hr; -} - -/* Given an enumerator we cycle through all the media types it proposes and - firstly suggest them to our derived pin class and if that succeeds try - them with the pin in a ReceiveConnection call. This means that if our pin - proposes a media type we still check in here that we can support it. This - is deliberate so that in simple cases the enumerator can hold all of the - media types even if some of them are not really currently available */ - -HRESULT CBasePin::TryMediaTypes( - IPin *pReceivePin, - const CMediaType *pmt, - IEnumMediaTypes *pEnum) -{ - /* Reset the current enumerator position */ - - HRESULT hr = pEnum->Reset(); - if (FAILED(hr)) { - return hr; - } - - CMediaType *pMediaType = NULL; - ULONG ulMediaCount = 0; - - // attempt to remember a specific error code if there is one - HRESULT hrFailure = S_OK; - - for (;;) { - - /* Retrieve the next media type NOTE each time round the loop the - enumerator interface will allocate another AM_MEDIA_TYPE structure - If we are successful then we copy it into our output object, if - not then we must delete the memory allocated before returning */ - - hr = pEnum->Next(1, (AM_MEDIA_TYPE**)&pMediaType,&ulMediaCount); - if (hr != S_OK) { - if (S_OK == hrFailure) { - hrFailure = VFW_E_NO_ACCEPTABLE_TYPES; - } - return hrFailure; - } - - - ASSERT(ulMediaCount == 1); - ASSERT(pMediaType); - - // check that this matches the partial type (if any) - - if ((pmt == NULL) || - pMediaType->MatchesPartial(pmt)) { - - hr = AttemptConnection(pReceivePin, pMediaType); - - // attempt to remember a specific error code - if (FAILED(hr) && - SUCCEEDED(hrFailure) && - (hr != E_FAIL) && - (hr != E_INVALIDARG) && - (hr != VFW_E_TYPE_NOT_ACCEPTED)) { - hrFailure = hr; - } - } else { - hr = VFW_E_NO_ACCEPTABLE_TYPES; - } - - DeleteMediaType(pMediaType); - - if (S_OK == hr) { - return hr; - } - } -} - - -/* This is called to make the connection, including the taask of finding - a media type for the pin connection. pmt is the proposed media type - from the Connect call: if this is fully specified, we will try that. - Otherwise we enumerate and try all the input pin's types first and - if that fails we then enumerate and try all our preferred media types. - For each media type we check it against pmt (if non-null and partially - specified) as well as checking that both pins will accept it. - */ - -HRESULT CBasePin::AgreeMediaType( - IPin *pReceivePin, - const CMediaType *pmt) -{ - ASSERT(pReceivePin); - IEnumMediaTypes *pEnumMediaTypes = NULL; - - // if the media type is fully specified then use that - if ( (pmt != NULL) && (!pmt->IsPartiallySpecified())) { - - // if this media type fails, then we must fail the connection - // since if pmt is nonnull we are only allowed to connect - // using a type that matches it. - - return AttemptConnection(pReceivePin, pmt); - } - - - /* Try the other pin's enumerator */ - - HRESULT hrFailure = VFW_E_NO_ACCEPTABLE_TYPES; - - for (int i = 0; i < 2; i++) { - HRESULT hr; - if (i == (int)m_bTryMyTypesFirst) { - hr = pReceivePin->EnumMediaTypes(&pEnumMediaTypes); - } else { - hr = EnumMediaTypes(&pEnumMediaTypes); - } - if (SUCCEEDED(hr)) { - ASSERT(pEnumMediaTypes); - hr = TryMediaTypes(pReceivePin,pmt,pEnumMediaTypes); - pEnumMediaTypes->Release(); - if (SUCCEEDED(hr)) { - return NOERROR; - } else { - // try to remember specific error codes if there are any - if ((hr != E_FAIL) && - (hr != E_INVALIDARG) && - (hr != VFW_E_TYPE_NOT_ACCEPTED)) { - hrFailure = hr; - } - } - } - } - - return hrFailure; -} - - -/* Called when we want to complete a connection to another filter. Failing - this will also fail the connection and disconnect the other pin as well */ - -HRESULT -CBasePin::CompleteConnect(IPin *pReceivePin) -{ - UNREFERENCED_PARAMETER(pReceivePin); - return NOERROR; -} - - -/* This is called to set the format for a pin connection - CheckMediaType - will have been called to check the connection format and if it didn't - return an error code then this (virtual) function will be invoked */ - -HRESULT -CBasePin::SetMediaType(const CMediaType *pmt) -{ - HRESULT hr = m_mt.Set(*pmt); - if (FAILED(hr)) { - return hr; - } - - return NOERROR; -} - - -/* This is called during Connect() to provide a virtual method that can do - any specific check needed for connection such as QueryInterface. This - base class method just checks that the pin directions don't match */ - -HRESULT -CBasePin::CheckConnect(IPin * pPin) -{ - /* Check that pin directions DONT match */ - - PIN_DIRECTION pd; - pPin->QueryDirection(&pd); - - ASSERT((pd == PINDIR_OUTPUT) || (pd == PINDIR_INPUT)); - ASSERT((m_dir == PINDIR_OUTPUT) || (m_dir == PINDIR_INPUT)); - - // we should allow for non-input and non-output connections? - if (pd == m_dir) { - return VFW_E_INVALID_DIRECTION; - } - return NOERROR; -} - - -/* This is called when we realise we can't make a connection to the pin and - must undo anything we did in CheckConnect - override to release QIs done */ - -HRESULT -CBasePin::BreakConnect() -{ - return NOERROR; -} - - -/* Called normally by an output pin on an input pin to try and establish a - connection. -*/ - -STDMETHODIMP -CBasePin::ReceiveConnection( - IPin * pConnector, // this is the pin who we will connect to - const AM_MEDIA_TYPE *pmt // this is the media type we will exchange -) -{ - CheckPointer(pConnector,E_POINTER); - CheckPointer(pmt,E_POINTER); - ValidateReadPtr(pConnector,sizeof(IPin)); - ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE)); - CAutoLock cObjectLock(m_pLock); - - /* Are we already connected */ - if (m_Connected) { - return VFW_E_ALREADY_CONNECTED; - } - - /* See if the filter is active */ - if (!IsStopped() && !m_bCanReconnectWhenActive) { - return VFW_E_NOT_STOPPED; - } - - HRESULT hr = CheckConnect(pConnector); - if (FAILED(hr)) { - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - - return hr; - } - - /* Ask derived class if this media type is ok */ - - CMediaType * pcmt = (CMediaType*) pmt; - hr = CheckMediaType(pcmt); - if (hr != NOERROR) { - // no -we don't support this media type - - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - // return a specific media type error if there is one - // or map a general failure code to something more helpful - // (in particular S_FALSE gets changed to an error code) - if (SUCCEEDED(hr) || - (hr == E_FAIL) || - (hr == E_INVALIDARG)) { - hr = VFW_E_TYPE_NOT_ACCEPTED; - } - - - return hr; - } - - /* Complete the connection */ - - m_Connected = pConnector; - m_Connected->AddRef(); - hr = SetMediaType(pcmt); - if (SUCCEEDED(hr)) { - hr = CompleteConnect(pConnector); - if (SUCCEEDED(hr)) { - - - return NOERROR; - } - } - - DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Failed to set the media type or failed to complete the connection."))); - m_Connected->Release(); - m_Connected = NULL; - - // Since the procedure is already returning an error code, there - // is nothing else this function can do to report the error. - EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); - - - return hr; -} - - -/* Called when we want to terminate a pin connection */ - -STDMETHODIMP -CBasePin::Disconnect() -{ - CAutoLock cObjectLock(m_pLock); - - /* See if the filter is active */ - if (!IsStopped()) { - return VFW_E_NOT_STOPPED; - } - - return DisconnectInternal(); -} - -STDMETHODIMP -CBasePin::DisconnectInternal() -{ - ASSERT(CritCheckIn(m_pLock)); - - if (m_Connected) { - HRESULT hr = BreakConnect(); - if( FAILED( hr ) ) { - - - // There is usually a bug in the program if BreakConnect() fails. - DbgBreak( "WARNING: BreakConnect() failed in CBasePin::Disconnect()." ); - return hr; - } - - m_Connected->Release(); - m_Connected = NULL; - - - return S_OK; - } else { - // no connection - not an error - - - return S_FALSE; - } -} - - -/* Return an AddRef()'d pointer to the connected pin if there is one */ -STDMETHODIMP -CBasePin::ConnectedTo( - IPin **ppPin -) -{ - CheckPointer(ppPin,E_POINTER); - ValidateReadWritePtr(ppPin,sizeof(IPin *)); - // - // It's pointless to lock here. - // The caller should ensure integrity. - // - - IPin *pPin = m_Connected; - *ppPin = pPin; - if (pPin != NULL) { - pPin->AddRef(); - return S_OK; - } else { - ASSERT(*ppPin == NULL); - return VFW_E_NOT_CONNECTED; - } -} - -#pragma warning(disable:4702) // Unreachable code at return - -/* Return the media type of the connection */ -STDMETHODIMP -CBasePin::ConnectionMediaType( - AM_MEDIA_TYPE *pmt -) -{ - CheckPointer(pmt,E_POINTER); - ValidateReadWritePtr(pmt,sizeof(AM_MEDIA_TYPE)); - CAutoLock cObjectLock(m_pLock); - - /* Copy constructor of m_mt allocates the memory */ - if (IsConnected()) { - CopyMediaType( pmt, &m_mt ); - return S_OK; - } else { - ((CMediaType *)pmt)->InitMediaType(); - return VFW_E_NOT_CONNECTED; - } -} - -#pragma warning(default:4702) // Unreachable code at return - -/* Return information about the filter we are connect to */ - -STDMETHODIMP -CBasePin::QueryPinInfo( - PIN_INFO * pInfo -) -{ - CheckPointer(pInfo,E_POINTER); - ValidateReadWritePtr(pInfo,sizeof(PIN_INFO)); - - pInfo->pFilter = m_pFilter; - if (m_pFilter) { - m_pFilter->AddRef(); - } - - if (m_pName) { - lstrcpynW(pInfo->achName, m_pName, sizeof(pInfo->achName)/sizeof(WCHAR)); - } else { - pInfo->achName[0] = L'\0'; - } - - pInfo->dir = m_dir; - - return NOERROR; -} - -STDMETHODIMP -CBasePin::QueryDirection( - PIN_DIRECTION * pPinDir -) -{ - CheckPointer(pPinDir,E_POINTER); - ValidateReadWritePtr(pPinDir,sizeof(PIN_DIRECTION)); - - *pPinDir = m_dir; - return NOERROR; -} - -// Default QueryId to return the pin's name -STDMETHODIMP -CBasePin::QueryId( - LPWSTR * Id -) -{ - // We're not going away because someone's got a pointer to us - // so there's no need to lock - - return AMGetWideString(Name(), Id); -} - -/* Does this pin support this media type WARNING this interface function does - not lock the main object as it is meant to be asynchronous by nature - if - the media types you support depend on some internal state that is updated - dynamically then you will need to implement locking in a derived class */ - -STDMETHODIMP -CBasePin::QueryAccept( - const AM_MEDIA_TYPE *pmt -) -{ - CheckPointer(pmt,E_POINTER); - ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE)); - - /* The CheckMediaType method is valid to return error codes if the media - type is horrible, an example might be E_INVALIDARG. What we do here - is map all the error codes into either S_OK or S_FALSE regardless */ - - HRESULT hr = CheckMediaType((CMediaType*)pmt); - if (FAILED(hr)) { - return S_FALSE; - } - // note that the only defined success codes should be S_OK and S_FALSE... - return hr; -} - - -/* This can be called to return an enumerator for the pin's list of preferred - media types. An input pin is not obliged to have any preferred formats - although it can do. For example, the window renderer has a preferred type - which describes a video image that matches the current window size. All - output pins should expose at least one preferred format otherwise it is - possible that neither pin has any types and so no connection is possible */ - -STDMETHODIMP -CBasePin::EnumMediaTypes( - IEnumMediaTypes **ppEnum -) -{ - CheckPointer(ppEnum,E_POINTER); - ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *)); - - /* Create a new ref counted enumerator */ - - *ppEnum = new CEnumMediaTypes(this, - NULL); - - if (*ppEnum == NULL) { - return E_OUTOFMEMORY; - } - - return NOERROR; -} - - - -/* This is a virtual function that returns a media type corresponding with - place iPosition in the list. This base class simply returns an error as - we support no media types by default but derived classes should override */ - -HRESULT CBasePin::GetMediaType(int iPosition, CMediaType *pMediaType) -{ - UNREFERENCED_PARAMETER(iPosition); - UNREFERENCED_PARAMETER(pMediaType); - return E_UNEXPECTED; -} - - -/* This is a virtual function that returns the current media type version. - The base class initialises the media type enumerators with the value 1 - By default we always returns that same value. A Derived class may change - the list of media types available and after doing so it should increment - the version either in a method derived from this, or more simply by just - incrementing the m_TypeVersion base pin variable. The type enumerators - call this when they want to see if their enumerations are out of date */ - -LONG CBasePin::GetMediaTypeVersion() -{ - return m_TypeVersion; -} - - -/* Increment the cookie representing the current media type version */ - -void CBasePin::IncrementTypeVersion() -{ - InterlockedIncrement(&m_TypeVersion); -} - - -/* Called by IMediaFilter implementation when the state changes from Stopped - to either paused or running and in derived classes could do things like - commit memory and grab hardware resource (the default is to do nothing) */ - -HRESULT -CBasePin::Active(void) -{ - return NOERROR; -} - -/* Called by IMediaFilter implementation when the state changes from - to either paused to running and in derived classes could do things like - commit memory and grab hardware resource (the default is to do nothing) */ - -HRESULT -CBasePin::Run(REFERENCE_TIME tStart) -{ - UNREFERENCED_PARAMETER(tStart); - return NOERROR; -} - - -/* Also called by the IMediaFilter implementation when the state changes to - Stopped at which point you should decommit allocators and free hardware - resources you grabbed in the Active call (default is also to do nothing) */ - -HRESULT -CBasePin::Inactive(void) -{ - m_bRunTimeError = FALSE; - return NOERROR; -} - - -// Called when no more data will arrive -STDMETHODIMP -CBasePin::EndOfStream(void) -{ - return S_OK; -} - - -STDMETHODIMP -CBasePin::SetSink(IQualityControl * piqc) -{ - CAutoLock cObjectLock(m_pLock); - if (piqc) ValidateReadPtr(piqc,sizeof(IQualityControl)); - m_pQSink = piqc; - return NOERROR; -} // SetSink - - -STDMETHODIMP -CBasePin::Notify(IBaseFilter * pSender, Quality q) -{ - UNREFERENCED_PARAMETER(q); - UNREFERENCED_PARAMETER(pSender); - DbgBreak("IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)"); - return E_NOTIMPL; -} //Notify - - -// NewSegment notifies of the start/stop/rate applying to the data -// about to be received. Default implementation records data and -// returns S_OK. -// Override this to pass downstream. -STDMETHODIMP -CBasePin::NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate) -{ - m_tStart = tStart; - m_tStop = tStop; - m_dRate = dRate; - - return S_OK; -} - - -//===================================================================== -//===================================================================== -// Implements CBaseOutputPin -//===================================================================== -//===================================================================== - - -CBaseOutputPin::CBaseOutputPin(TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT), - m_pAllocator(NULL), - m_pInputPin(NULL) -{ - ASSERT(pFilter); -} - -#ifdef UNICODE -CBaseOutputPin::CBaseOutputPin(CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT), - m_pAllocator(NULL), - m_pInputPin(NULL) -{ - ASSERT(pFilter); -} -#endif - -/* This is called after a media type has been proposed - - Try to complete the connection by agreeing the allocator -*/ -HRESULT -CBaseOutputPin::CompleteConnect(IPin *pReceivePin) -{ - UNREFERENCED_PARAMETER(pReceivePin); - return DecideAllocator(m_pInputPin, &m_pAllocator); -} - - -/* This method is called when the output pin is about to try and connect to - an input pin. It is at this point that you should try and grab any extra - interfaces that you need, in this case IMemInputPin. Because this is - only called if we are not currently connected we do NOT need to call - BreakConnect. This also makes it easier to derive classes from us as - BreakConnect is only called when we actually have to break a connection - (or a partly made connection) and not when we are checking a connection */ - -/* Overriden from CBasePin */ - -HRESULT -CBaseOutputPin::CheckConnect(IPin * pPin) -{ - HRESULT hr = CBasePin::CheckConnect(pPin); - if (FAILED(hr)) { - return hr; - } - - // get an input pin and an allocator interface - hr = pPin->QueryInterface(IID_IMemInputPin, (void **) &m_pInputPin); - if (FAILED(hr)) { - return hr; - } - return NOERROR; -} - - -/* Overriden from CBasePin */ - -HRESULT -CBaseOutputPin::BreakConnect() -{ - /* Release any allocator we hold */ - - if (m_pAllocator) { - // Always decommit the allocator because a downstream filter may or - // may not decommit the connection's allocator. A memory leak could - // occur if the allocator is not decommited when a connection is broken. - HRESULT hr = m_pAllocator->Decommit(); - if( FAILED( hr ) ) { - return hr; - } - - m_pAllocator->Release(); - m_pAllocator = NULL; - } - - /* Release any input pin interface we hold */ - - if (m_pInputPin) { - m_pInputPin->Release(); - m_pInputPin = NULL; - } - return NOERROR; -} - - -/* This is called when the input pin didn't give us a valid allocator */ - -HRESULT -CBaseOutputPin::InitAllocator(IMemAllocator **ppAlloc) -{ - return CreateMemoryAllocator(ppAlloc); -} - - -/* Decide on an allocator, override this if you want to use your own allocator - Override DecideBufferSize to call SetProperties. If the input pin fails - the GetAllocator call then this will construct a CMemAllocator and call - DecideBufferSize on that, and if that fails then we are completely hosed. - If the you succeed the DecideBufferSize call, we will notify the input - pin of the selected allocator. NOTE this is called during Connect() which - therefore looks after grabbing and locking the object's critical section */ - -// We query the input pin for its requested properties and pass this to -// DecideBufferSize to allow it to fulfill requests that it is happy -// with (eg most people don't care about alignment and are thus happy to -// use the downstream pin's alignment request). - -HRESULT -CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, IMemAllocator **ppAlloc) -{ - HRESULT hr = NOERROR; - *ppAlloc = NULL; - - // get downstream prop request - // the derived class may modify this in DecideBufferSize, but - // we assume that he will consistently modify it the same way, - // so we only get it once - ALLOCATOR_PROPERTIES prop; - ZeroMemory(&prop, sizeof(prop)); - - // whatever he returns, we assume prop is either all zeros - // or he has filled it out. - pPin->GetAllocatorRequirements(&prop); - - // if he doesn't care about alignment, then set it to 1 - if (prop.cbAlign == 0) { - prop.cbAlign = 1; - } - - /* Try the allocator provided by the input pin */ - - hr = pPin->GetAllocator(ppAlloc); - if (SUCCEEDED(hr)) { - - hr = DecideBufferSize(*ppAlloc, &prop); - if (SUCCEEDED(hr)) { - hr = pPin->NotifyAllocator(*ppAlloc, FALSE); - if (SUCCEEDED(hr)) { - return NOERROR; - } - } - } - - /* If the GetAllocator failed we may not have an interface */ - - if (*ppAlloc) { - (*ppAlloc)->Release(); - *ppAlloc = NULL; - } - - /* Try the output pin's allocator by the same method */ - - hr = InitAllocator(ppAlloc); - if (SUCCEEDED(hr)) { - - // note - the properties passed here are in the same - // structure as above and may have been modified by - // the previous call to DecideBufferSize - hr = DecideBufferSize(*ppAlloc, &prop); - if (SUCCEEDED(hr)) { - hr = pPin->NotifyAllocator(*ppAlloc, FALSE); - if (SUCCEEDED(hr)) { - return NOERROR; - } - } - } - - /* Likewise we may not have an interface to release */ - - if (*ppAlloc) { - (*ppAlloc)->Release(); - *ppAlloc = NULL; - } - return hr; -} - - -/* This returns an empty sample buffer from the allocator WARNING the same - dangers and restrictions apply here as described below for Deliver() */ - -HRESULT -CBaseOutputPin::GetDeliveryBuffer(IMediaSample ** ppSample, - REFERENCE_TIME * pStartTime, - REFERENCE_TIME * pEndTime, - DWORD dwFlags) -{ - if (m_pAllocator != NULL) { - return m_pAllocator->GetBuffer(ppSample,pStartTime,pEndTime,dwFlags); - } else { - return E_NOINTERFACE; - } -} - - -/* Deliver a filled-in sample to the connected input pin. NOTE the object must - have locked itself before calling us otherwise we may get halfway through - executing this method only to find the filter graph has got in and - disconnected us from the input pin. If the filter has no worker threads - then the lock is best applied on Receive(), otherwise it should be done - when the worker thread is ready to deliver. There is a wee snag to worker - threads that this shows up. The worker thread must lock the object when - it is ready to deliver a sample, but it may have to wait until a state - change has completed, but that may never complete because the state change - is waiting for the worker thread to complete. The way to handle this is for - the state change code to grab the critical section, then set an abort event - for the worker thread, then release the critical section and wait for the - worker thread to see the event we set and then signal that it has finished - (with another event). At which point the state change code can complete */ - -// note (if you've still got any breath left after reading that) that you -// need to release the sample yourself after this call. if the connected -// input pin needs to hold onto the sample beyond the call, it will addref -// the sample itself. - -// of course you must release this one and call GetDeliveryBuffer for the -// next. You cannot reuse it directly. - -HRESULT -CBaseOutputPin::Deliver(IMediaSample * pSample) -{ - if (m_pInputPin == NULL) { - return VFW_E_NOT_CONNECTED; - } - - - return m_pInputPin->Receive(pSample); -} - - -// called from elsewhere in our filter to pass EOS downstream to -// our connected input pin -HRESULT -CBaseOutputPin::DeliverEndOfStream(void) -{ - // remember this is on IPin not IMemInputPin - if (m_Connected == NULL) { - return VFW_E_NOT_CONNECTED; - } - return m_Connected->EndOfStream(); -} - - -/* Commit the allocator's memory, this is called through IMediaFilter - which is responsible for locking the object before calling us */ - -HRESULT -CBaseOutputPin::Active(void) -{ - if (m_pAllocator == NULL) { - return VFW_E_NO_ALLOCATOR; - } - return m_pAllocator->Commit(); -} - - -/* Free up or unprepare allocator's memory, this is called through - IMediaFilter which is responsible for locking the object first */ - -HRESULT -CBaseOutputPin::Inactive(void) -{ - m_bRunTimeError = FALSE; - if (m_pAllocator == NULL) { - return VFW_E_NO_ALLOCATOR; - } - return m_pAllocator->Decommit(); -} - -// we have a default handling of EndOfStream which is to return -// an error, since this should be called on input pins only -STDMETHODIMP -CBaseOutputPin::EndOfStream(void) -{ - return E_UNEXPECTED; -} - - -// BeginFlush should be called on input pins only -STDMETHODIMP -CBaseOutputPin::BeginFlush(void) -{ - return E_UNEXPECTED; -} - -// EndFlush should be called on input pins only -STDMETHODIMP -CBaseOutputPin::EndFlush(void) -{ - return E_UNEXPECTED; -} - -// call BeginFlush on the connected input pin -HRESULT -CBaseOutputPin::DeliverBeginFlush(void) -{ - // remember this is on IPin not IMemInputPin - if (m_Connected == NULL) { - return VFW_E_NOT_CONNECTED; - } - return m_Connected->BeginFlush(); -} - -// call EndFlush on the connected input pin -HRESULT -CBaseOutputPin::DeliverEndFlush(void) -{ - // remember this is on IPin not IMemInputPin - if (m_Connected == NULL) { - return VFW_E_NOT_CONNECTED; - } - return m_Connected->EndFlush(); -} -// deliver NewSegment to connected pin -HRESULT -CBaseOutputPin::DeliverNewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate) -{ - if (m_Connected == NULL) { - return VFW_E_NOT_CONNECTED; - } - return m_Connected->NewSegment(tStart, tStop, dRate); -} - - -//===================================================================== -//===================================================================== -// Implements CBaseInputPin -//===================================================================== -//===================================================================== - - -/* Constructor creates a default allocator object */ - -CBaseInputPin::CBaseInputPin(TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pPinName) : - CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT), - m_pAllocator(NULL), - m_bReadOnly(FALSE), - m_bFlushing(FALSE) -{ - ZeroMemory(&m_SampleProps, sizeof(m_SampleProps)); -} - -#ifdef UNICODE -CBaseInputPin::CBaseInputPin(CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pPinName) : - CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT), - m_pAllocator(NULL), - m_bReadOnly(FALSE), - m_bFlushing(FALSE) -{ - ZeroMemory(&m_SampleProps, sizeof(m_SampleProps)); -} -#endif - -/* Destructor releases it's reference count on the default allocator */ - -CBaseInputPin::~CBaseInputPin() -{ - if (m_pAllocator != NULL) { - m_pAllocator->Release(); - m_pAllocator = NULL; - } -} - - -// override this to publicise our interfaces -STDMETHODIMP -CBaseInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) -{ - /* Do we know about this interface */ - - if (riid == IID_IMemInputPin) { - return GetInterface((IMemInputPin *) this, ppv); - } else { - return CBasePin::NonDelegatingQueryInterface(riid, ppv); - } -} - - -/* Return the allocator interface that this input pin would like the output - pin to use. NOTE subsequent calls to GetAllocator should all return an - interface onto the SAME object so we create one object at the start - - Note: - The allocator is Release()'d on disconnect and replaced on - NotifyAllocator(). - - Override this to provide your own allocator. -*/ - -STDMETHODIMP -CBaseInputPin::GetAllocator( - IMemAllocator **ppAllocator) -{ - CheckPointer(ppAllocator,E_POINTER); - ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *)); - CAutoLock cObjectLock(m_pLock); - - if (m_pAllocator == NULL) { - HRESULT hr = CreateMemoryAllocator(&m_pAllocator); - if (FAILED(hr)) { - return hr; - } - } - ASSERT(m_pAllocator != NULL); - *ppAllocator = m_pAllocator; - m_pAllocator->AddRef(); - return NOERROR; -} - - -/* Tell the input pin which allocator the output pin is actually going to use - Override this if you care - NOTE the locking we do both here and also in - GetAllocator is unnecessary but derived classes that do something useful - will undoubtedly have to lock the object so this might help remind people */ - -STDMETHODIMP -CBaseInputPin::NotifyAllocator( - IMemAllocator * pAllocator, - BOOL bReadOnly) -{ - CheckPointer(pAllocator,E_POINTER); - ValidateReadPtr(pAllocator,sizeof(IMemAllocator)); - CAutoLock cObjectLock(m_pLock); - - IMemAllocator *pOldAllocator = m_pAllocator; - pAllocator->AddRef(); - m_pAllocator = pAllocator; - - if (pOldAllocator != NULL) { - pOldAllocator->Release(); - } - - // the readonly flag indicates whether samples from this allocator should - // be regarded as readonly - if true, then inplace transforms will not be - // allowed. - m_bReadOnly = (BYTE)bReadOnly; - return NOERROR; -} - - -HRESULT -CBaseInputPin::BreakConnect() -{ - /* We don't need our allocator any more */ - if (m_pAllocator) { - // Always decommit the allocator because a downstream filter may or - // may not decommit the connection's allocator. A memory leak could - // occur if the allocator is not decommited when a pin is disconnected. - HRESULT hr = m_pAllocator->Decommit(); - if( FAILED( hr ) ) { - return hr; - } - - m_pAllocator->Release(); - m_pAllocator = NULL; - } - - return S_OK; -} - - -/* Do something with this media sample - this base class checks to see if the - format has changed with this media sample and if so checks that the filter - will accept it, generating a run time error if not. Once we have raised a - run time error we set a flag so that no more samples will be accepted - - It is important that any filter should override this method and implement - synchronization so that samples are not processed when the pin is - disconnected etc -*/ - -STDMETHODIMP -CBaseInputPin::Receive(IMediaSample *pSample) -{ - CheckPointer(pSample,E_POINTER); - ValidateReadPtr(pSample,sizeof(IMediaSample)); - ASSERT(pSample); - - HRESULT hr = CheckStreaming(); - if (S_OK != hr) { - return hr; - } - - - - /* Check for IMediaSample2 */ - IMediaSample2 *pSample2; - if (SUCCEEDED(pSample->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) { - hr = pSample2->GetProperties(sizeof(m_SampleProps), (PBYTE)&m_SampleProps); - pSample2->Release(); - if (FAILED(hr)) { - return hr; - } - } else { - /* Get the properties the hard way */ - m_SampleProps.cbData = sizeof(m_SampleProps); - m_SampleProps.dwTypeSpecificFlags = 0; - m_SampleProps.dwStreamId = AM_STREAM_MEDIA; - m_SampleProps.dwSampleFlags = 0; - if (S_OK == pSample->IsDiscontinuity()) { - m_SampleProps.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY; - } - if (S_OK == pSample->IsPreroll()) { - m_SampleProps.dwSampleFlags |= AM_SAMPLE_PREROLL; - } - if (S_OK == pSample->IsSyncPoint()) { - m_SampleProps.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT; - } - if (SUCCEEDED(pSample->GetTime(&m_SampleProps.tStart, - &m_SampleProps.tStop))) { - m_SampleProps.dwSampleFlags |= AM_SAMPLE_TIMEVALID | - AM_SAMPLE_STOPVALID; - } - if (S_OK == pSample->GetMediaType(&m_SampleProps.pMediaType)) { - m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED; - } - pSample->GetPointer(&m_SampleProps.pbBuffer); - m_SampleProps.lActual = pSample->GetActualDataLength(); - m_SampleProps.cbBuffer = pSample->GetSize(); - } - - /* Has the format changed in this sample */ - - if (!(m_SampleProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED)) { - return NOERROR; - } - - /* Check the derived class accepts this format */ - /* This shouldn't fail as the source must call QueryAccept first */ - - hr = CheckMediaType((CMediaType *)m_SampleProps.pMediaType); - - if (hr == NOERROR) { - return NOERROR; - } - - /* Raise a runtime error if we fail the media type */ - - m_bRunTimeError = TRUE; - EndOfStream(); - m_pFilter->NotifyEvent(EC_ERRORABORT,VFW_E_TYPE_NOT_ACCEPTED,0); - return VFW_E_INVALIDMEDIATYPE; -} - - -/* Receive multiple samples */ -STDMETHODIMP -CBaseInputPin::ReceiveMultiple ( - IMediaSample **pSamples, - long nSamples, - long *nSamplesProcessed) -{ - CheckPointer(pSamples,E_POINTER); - ValidateReadPtr(pSamples,nSamples * sizeof(IMediaSample *)); - - HRESULT hr = S_OK; - *nSamplesProcessed = 0; - while (nSamples-- > 0) { - hr = Receive(pSamples[*nSamplesProcessed]); - - /* S_FALSE means don't send any more */ - if (hr != S_OK) { - break; - } - (*nSamplesProcessed)++; - } - return hr; -} - -/* See if Receive() might block */ -STDMETHODIMP -CBaseInputPin::ReceiveCanBlock() -{ - /* Ask all the output pins if they block - If there are no output pin assume we do block - */ - int cPins = m_pFilter->GetPinCount(); - int cOutputPins = 0; - for (int c = 0; c < cPins; c++) { - CBasePin *pPin = m_pFilter->GetPin(c); - PIN_DIRECTION pd; - HRESULT hr = pPin->QueryDirection(&pd); - if (FAILED(hr)) { - return hr; - } - - if (pd == PINDIR_OUTPUT) { - - IPin *pConnected; - hr = pPin->ConnectedTo(&pConnected); - if (SUCCEEDED(hr)) { - ASSERT(pConnected != NULL); - cOutputPins++; - IMemInputPin *pInputPin; - hr = pConnected->QueryInterface( - IID_IMemInputPin, - (void **)&pInputPin); - pConnected->Release(); - if (SUCCEEDED(hr)) { - hr = pInputPin->ReceiveCanBlock(); - pInputPin->Release(); - if (hr != S_FALSE) { - return S_OK; - } - } else { - /* There's a transport we don't understand here */ - return S_OK; - } - } - } - } - return cOutputPins == 0 ? S_OK : S_FALSE; -} - -// Default handling for BeginFlush - call at the beginning -// of your implementation (makes sure that all Receive calls -// fail). After calling this, you need to free any queued data -// and then call downstream. -STDMETHODIMP -CBaseInputPin::BeginFlush(void) -{ - // BeginFlush is NOT synchronized with streaming but is part of - // a control action - hence we synchronize with the filter - CAutoLock lck(m_pLock); - - // if we are already in mid-flush, this is probably a mistake - // though not harmful - try to pick it up for now so I can think about it - ASSERT(!m_bFlushing); - - // first thing to do is ensure that no further Receive calls succeed - m_bFlushing = TRUE; - - // now discard any data and call downstream - must do that - // in derived classes - return S_OK; -} - -// default handling for EndFlush - call at end of your implementation -// - before calling this, ensure that there is no queued data and no thread -// pushing any more without a further receive, then call downstream, -// then call this method to clear the m_bFlushing flag and re-enable -// receives -STDMETHODIMP -CBaseInputPin::EndFlush(void) -{ - // Endlush is NOT synchronized with streaming but is part of - // a control action - hence we synchronize with the filter - CAutoLock lck(m_pLock); - - // almost certainly a mistake if we are not in mid-flush - ASSERT(m_bFlushing); - - // before calling, sync with pushing thread and ensure - // no more data is going downstream, then call EndFlush on - // downstream pins. - - // now re-enable Receives - m_bFlushing = FALSE; - - // No more errors - m_bRunTimeError = FALSE; - - return S_OK; -} - - -STDMETHODIMP -CBaseInputPin::Notify(IBaseFilter * pSender, Quality q) -{ - UNREFERENCED_PARAMETER(q); - CheckPointer(pSender,E_POINTER); - ValidateReadPtr(pSender,sizeof(IBaseFilter)); - DbgBreak("IQuality::Notify called on an input pin"); - return NOERROR; -} // Notify - -/* Free up or unprepare allocator's memory, this is called through - IMediaFilter which is responsible for locking the object first */ - -HRESULT -CBaseInputPin::Inactive(void) -{ - m_bRunTimeError = FALSE; - if (m_pAllocator == NULL) { - return VFW_E_NO_ALLOCATOR; - } - - m_bFlushing = FALSE; - - return m_pAllocator->Decommit(); -} - -// what requirements do we have of the allocator - override if you want -// to support other people's allocators but need a specific alignment -// or prefix. -STDMETHODIMP -CBaseInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES*pProps) -{ - UNREFERENCED_PARAMETER(pProps); - return E_NOTIMPL; -} - -// Check if it's OK to process data -// -HRESULT -CBaseInputPin::CheckStreaming() -{ - // Shouldn't be able to get any data if we're not connected! - ASSERT(IsConnected()); - - // Don't process stuff in Stopped state - if (IsStopped()) { - return VFW_E_WRONG_STATE; - } - if (m_bFlushing) { - return S_FALSE; - } - if (m_bRunTimeError) { - return VFW_E_RUNTIME_ERROR; - } - return S_OK; -} - -// Pass on the Quality notification q to -// a. Our QualityControl sink (if we have one) or else -// b. to our upstream filter -// and if that doesn't work, throw it away with a bad return code -HRESULT -CBaseInputPin::PassNotify(Quality& q) -{ - // We pass the message on, which means that we find the quality sink - // for our input pin and send it there - - DbgLog((LOG_TRACE,3,TEXT("Passing Quality notification through transform"))); - if (m_pQSink!=NULL) { - return m_pQSink->Notify(m_pFilter, q); - } else { - // no sink set, so pass it upstream - HRESULT hr; - IQualityControl * pIQC; - - hr = VFW_E_NOT_FOUND; // default - if (m_Connected) { - m_Connected->QueryInterface(IID_IQualityControl, (void**)&pIQC); - - if (pIQC!=NULL) { - hr = pIQC->Notify(m_pFilter, q); - pIQC->Release(); - } - } - return hr; - } - -} // PassNotify - -//===================================================================== -//===================================================================== -// Memory allocation class, implements CMediaSample -//===================================================================== -//===================================================================== - - -/* NOTE The implementation of this class calls the CUnknown constructor with - a NULL outer unknown pointer. This has the effect of making us a self - contained class, ie any QueryInterface, AddRef or Release calls will be - routed to the class's NonDelegatingUnknown methods. You will typically - find that the classes that do this then override one or more of these - virtual functions to provide more specialised behaviour. A good example - of this is where a class wants to keep the QueryInterface internal but - still wants it's lifetime controlled by the external object */ - -/* The last two parameters have default values of NULL and zero */ - -CMediaSample::CMediaSample(TCHAR *pName, - CBaseAllocator *pAllocator, - HRESULT *phr, - LPBYTE pBuffer, - LONG length) : - m_pBuffer(pBuffer), // Initialise the buffer - m_cbBuffer(length), // And it's length - m_lActual(length), // By default, actual = length - m_pMediaType(NULL), // No media type change - m_dwFlags(0), // Nothing set - m_cRef(0), // 0 ref count - m_dwTypeSpecificFlags(0), // Type specific flags - m_dwStreamId(AM_STREAM_MEDIA), // Stream id - m_pAllocator(pAllocator) // Allocator -{ - - /* We must have an owner and it must also be derived from class - CBaseAllocator BUT we do not hold a reference count on it */ - - ASSERT(pAllocator); -} - -#ifdef UNICODE -CMediaSample::CMediaSample(CHAR *pName, - CBaseAllocator *pAllocator, - HRESULT *phr, - LPBYTE pBuffer, - LONG length) : - m_pBuffer(pBuffer), // Initialise the buffer - m_cbBuffer(length), // And it's length - m_lActual(length), // By default, actual = length - m_pMediaType(NULL), // No media type change - m_dwFlags(0), // Nothing set - m_cRef(0), // 0 ref count - m_dwTypeSpecificFlags(0), // Type specific flags - m_dwStreamId(AM_STREAM_MEDIA), // Stream id - m_pAllocator(pAllocator) // Allocator -{ - - /* We must have an owner and it must also be derived from class - CBaseAllocator BUT we do not hold a reference count on it */ - - ASSERT(pAllocator); -} -#endif - -/* Destructor deletes the media type memory */ - -CMediaSample::~CMediaSample() -{ - - if (m_pMediaType) { - DeleteMediaType(m_pMediaType); - } -} - -/* Override this to publicise our interfaces */ - -STDMETHODIMP -CMediaSample::QueryInterface(REFIID riid, void **ppv) -{ - if (riid == IID_IMediaSample || - riid == IID_IMediaSample2 || - riid == IID_IUnknown) { - return GetInterface((IMediaSample *) this, ppv); - } else { - return E_NOINTERFACE; - } -} - -STDMETHODIMP_(ULONG) -CMediaSample::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} - - -// -- CMediaSample lifetimes -- -// -// On final release of this sample buffer it is not deleted but -// returned to the freelist of the owning memory allocator -// -// The allocator may be waiting for the last buffer to be placed on the free -// list in order to decommit all the memory, so the ReleaseBuffer() call may -// result in this sample being deleted. We also need to hold a refcount on -// the allocator to stop that going away until we have finished with this. -// However, we cannot release the allocator before the ReleaseBuffer, as the -// release may cause us to be deleted. Similarly we can't do it afterwards. -// -// Thus we must leave it to the allocator to hold an addref on our behalf. -// When he issues us in GetBuffer, he addref's himself. When ReleaseBuffer -// is called, he releases himself, possibly causing us and him to be deleted. - - -STDMETHODIMP_(ULONG) -CMediaSample::Release() -{ - /* Decrement our own private reference count */ - LONG lRef; - if (m_cRef == 1) { - lRef = 0; - m_cRef = 0; - } else { - lRef = InterlockedDecrement(&m_cRef); - } - ASSERT(lRef >= 0); - - DbgLog((LOG_MEMORY,3,TEXT(" Unknown %X ref-- = %d"), - this, m_cRef)); - - /* Did we release our final reference count */ - if (lRef == 0) { - /* Free all resources */ - if (m_dwFlags & Sample_TypeChanged) { - SetMediaType(NULL); - } - ASSERT(m_pMediaType == NULL); - m_dwFlags = 0; - m_dwTypeSpecificFlags = 0; - m_dwStreamId = AM_STREAM_MEDIA; - - /* This may cause us to be deleted */ - // Our refcount is reliably 0 thus no-one will mess with us - m_pAllocator->ReleaseBuffer(this); - } - return (ULONG)lRef; -} - - -// set the buffer pointer and length. Used by allocators that -// want variable sized pointers or pointers into already-read data. -// This is only available through a CMediaSample* not an IMediaSample* -// and so cannot be changed by clients. -HRESULT -CMediaSample::SetPointer(BYTE * ptr, LONG cBytes) -{ - m_pBuffer = ptr; // new buffer area (could be null) - m_cbBuffer = cBytes; // length of buffer - m_lActual = cBytes; // length of data in buffer (assume full) - - return S_OK; -} - - -// get me a read/write pointer to this buffer's memory. I will actually -// want to use sizeUsed bytes. -STDMETHODIMP -CMediaSample::GetPointer(BYTE ** ppBuffer) -{ - ValidateReadWritePtr(ppBuffer,sizeof(BYTE *)); - - // creator must have set pointer either during - // constructor or by SetPointer - ASSERT(m_pBuffer); - - *ppBuffer = m_pBuffer; - return NOERROR; -} - - -// return the size in bytes of this buffer -STDMETHODIMP_(LONG) -CMediaSample::GetSize(void) -{ - return m_cbBuffer; -} - - -// get the stream time at which this sample should start and finish. -STDMETHODIMP -CMediaSample::GetTime( - REFERENCE_TIME * pTimeStart, // put time here - REFERENCE_TIME * pTimeEnd -) -{ - ValidateReadWritePtr(pTimeStart,sizeof(REFERENCE_TIME)); - ValidateReadWritePtr(pTimeEnd,sizeof(REFERENCE_TIME)); - - if (!(m_dwFlags & Sample_StopValid)) { - if (!(m_dwFlags & Sample_TimeValid)) { - return VFW_E_SAMPLE_TIME_NOT_SET; - } else { - *pTimeStart = m_Start; - - // Make sure old stuff works - *pTimeEnd = m_Start + 1; - return VFW_S_NO_STOP_TIME; - } - } - - *pTimeStart = m_Start; - *pTimeEnd = m_End; - return NOERROR; -} - - -// Set the stream time at which this sample should start and finish. -// NULL pointers means the time is reset -STDMETHODIMP -CMediaSample::SetTime( - REFERENCE_TIME * pTimeStart, - REFERENCE_TIME * pTimeEnd -) -{ - if (pTimeStart == NULL) { - ASSERT(pTimeEnd == NULL); - m_dwFlags &= ~(Sample_TimeValid | Sample_StopValid); - } else { - if (pTimeEnd == NULL) { - m_Start = *pTimeStart; - m_dwFlags |= Sample_TimeValid; - m_dwFlags &= ~Sample_StopValid; - } else { - ValidateReadPtr(pTimeStart,sizeof(REFERENCE_TIME)); - ValidateReadPtr(pTimeEnd,sizeof(REFERENCE_TIME)); - ASSERT(*pTimeEnd >= *pTimeStart); - - m_Start = *pTimeStart; - m_End = *pTimeEnd; - m_dwFlags |= Sample_TimeValid | Sample_StopValid; - } - } - return NOERROR; -} - - -// get the media times (eg bytes) for this sample -STDMETHODIMP -CMediaSample::GetMediaTime( - LONGLONG * pTimeStart, - LONGLONG * pTimeEnd -) -{ - ValidateReadWritePtr(pTimeStart,sizeof(LONGLONG)); - ValidateReadWritePtr(pTimeEnd,sizeof(LONGLONG)); - - if (!(m_dwFlags & Sample_MediaTimeValid)) { - return VFW_E_MEDIA_TIME_NOT_SET; - } - - *pTimeStart = m_MediaStart; - *pTimeEnd = (m_MediaStart + m_MediaEnd); - return NOERROR; -} - - -// Set the media times for this sample -STDMETHODIMP -CMediaSample::SetMediaTime( - LONGLONG * pTimeStart, - LONGLONG * pTimeEnd -) -{ - if (pTimeStart == NULL) { - ASSERT(pTimeEnd == NULL); - m_dwFlags &= ~Sample_MediaTimeValid; - } else { - ValidateReadPtr(pTimeStart,sizeof(LONGLONG)); - ValidateReadPtr(pTimeEnd,sizeof(LONGLONG)); - ASSERT(*pTimeEnd >= *pTimeStart); - - m_MediaStart = *pTimeStart; - m_MediaEnd = (LONG)(*pTimeEnd - *pTimeStart); - m_dwFlags |= Sample_MediaTimeValid; - } - return NOERROR; -} - - -STDMETHODIMP -CMediaSample::IsSyncPoint(void) -{ - if (m_dwFlags & Sample_SyncPoint) { - return S_OK; - } else { - return S_FALSE; - } -} - - -STDMETHODIMP -CMediaSample::SetSyncPoint(BOOL bIsSyncPoint) -{ - if (bIsSyncPoint) { - m_dwFlags |= Sample_SyncPoint; - } else { - m_dwFlags &= ~Sample_SyncPoint; - } - return NOERROR; -} - -// returns S_OK if there is a discontinuity in the data (this same is -// not a continuation of the previous stream of data -// - there has been a seek). -STDMETHODIMP -CMediaSample::IsDiscontinuity(void) -{ - if (m_dwFlags & Sample_Discontinuity) { - return S_OK; - } else { - return S_FALSE; - } -} - -// set the discontinuity property - TRUE if this sample is not a -// continuation, but a new sample after a seek. -STDMETHODIMP -CMediaSample::SetDiscontinuity(BOOL bDiscont) -{ - // should be TRUE or FALSE - if (bDiscont) { - m_dwFlags |= Sample_Discontinuity; - } else { - m_dwFlags &= ~Sample_Discontinuity; - } - return S_OK; -} - -STDMETHODIMP -CMediaSample::IsPreroll(void) -{ - if (m_dwFlags & Sample_Preroll) { - return S_OK; - } else { - return S_FALSE; - } -} - - -STDMETHODIMP -CMediaSample::SetPreroll(BOOL bIsPreroll) -{ - if (bIsPreroll) { - m_dwFlags |= Sample_Preroll; - } else { - m_dwFlags &= ~Sample_Preroll; - } - return NOERROR; -} - -STDMETHODIMP_(LONG) -CMediaSample::GetActualDataLength(void) -{ - return m_lActual; -} - - -STDMETHODIMP -CMediaSample::SetActualDataLength(LONG lActual) -{ - if (lActual > m_cbBuffer) { - ASSERT(lActual <= GetSize()); - return VFW_E_BUFFER_OVERFLOW; - } - m_lActual = lActual; - return NOERROR; -} - - -/* These allow for limited format changes in band */ - -STDMETHODIMP -CMediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType) -{ - ValidateReadWritePtr(ppMediaType,sizeof(AM_MEDIA_TYPE *)); - ASSERT(ppMediaType); - - /* Do we have a new media type for them */ - - if (!(m_dwFlags & Sample_TypeChanged)) { - ASSERT(m_pMediaType == NULL); - *ppMediaType = NULL; - return S_FALSE; - } - - ASSERT(m_pMediaType); - - /* Create a copy of our media type */ - - *ppMediaType = CreateMediaType(m_pMediaType); - if (*ppMediaType == NULL) { - return E_OUTOFMEMORY; - } - return NOERROR; -} - - -/* Mark this sample as having a different format type */ - -STDMETHODIMP -CMediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType) -{ - /* Delete the current media type */ - - if (m_pMediaType) { - DeleteMediaType(m_pMediaType); - m_pMediaType = NULL; - } - - /* Mechanism for resetting the format type */ - - if (pMediaType == NULL) { - m_dwFlags &= ~Sample_TypeChanged; - return NOERROR; - } - - ASSERT(pMediaType); - ValidateReadPtr(pMediaType,sizeof(AM_MEDIA_TYPE)); - - /* Take a copy of the media type */ - - m_pMediaType = CreateMediaType(pMediaType); - if (m_pMediaType == NULL) { - m_dwFlags &= ~Sample_TypeChanged; - return E_OUTOFMEMORY; - } - - m_dwFlags |= Sample_TypeChanged; - return NOERROR; -} - -// Set and get properties (IMediaSample2) -STDMETHODIMP CMediaSample::GetProperties( - DWORD cbProperties, - BYTE * pbProperties -) -{ - if (0 != cbProperties) { - CheckPointer(pbProperties, E_POINTER); - // Return generic stuff up to the length - AM_SAMPLE2_PROPERTIES Props; - Props.cbData = min(cbProperties, sizeof(Props)); - Props.dwSampleFlags = m_dwFlags & ~Sample_MediaTimeValid; - Props.dwTypeSpecificFlags = m_dwTypeSpecificFlags; - Props.pbBuffer = m_pBuffer; - Props.cbBuffer = m_cbBuffer; - Props.lActual = m_lActual; - Props.tStart = m_Start; - Props.tStop = m_End; - Props.dwStreamId = m_dwStreamId; - if (m_dwFlags & AM_SAMPLE_TYPECHANGED) { - Props.pMediaType = m_pMediaType; - } else { - Props.pMediaType = NULL; - } - CopyMemory(pbProperties, &Props, Props.cbData); - } - return S_OK; -} - -#define CONTAINS_FIELD(type, field, offset) \ - ((FIELD_OFFSET(type, field) + sizeof(((type *)0)->field)) <= offset) - -HRESULT CMediaSample::SetProperties( - DWORD cbProperties, - const BYTE * pbProperties -) -{ - - /* Generic properties */ - AM_MEDIA_TYPE *pMediaType = NULL; - - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbData, cbProperties)) { - CheckPointer(pbProperties, E_POINTER); - AM_SAMPLE2_PROPERTIES *pProps = - (AM_SAMPLE2_PROPERTIES *)pbProperties; - - /* Don't use more data than is actually there */ - if (pProps->cbData < cbProperties) { - cbProperties = pProps->cbData; - } - /* We only handle IMediaSample2 */ - if (cbProperties > sizeof(*pProps) || - pProps->cbData > sizeof(*pProps)) { - return E_INVALIDARG; - } - /* Do checks first, the assignments (for backout) */ - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) { - /* Check the flags */ - if (pProps->dwSampleFlags & - (~Sample_ValidFlags | Sample_MediaTimeValid)) { - return E_INVALIDARG; - } - /* Check a flag isn't being set for a property - not being provided - */ - if ((pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) && - !(m_dwFlags & AM_SAMPLE_TIMEVALID) && - !CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) { - return E_INVALIDARG; - } - } - /* NB - can't SET the pointer or size */ - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pbBuffer, cbProperties)) { - - /* Check pbBuffer */ - if (pProps->pbBuffer != 0 && pProps->pbBuffer != m_pBuffer) { - return E_INVALIDARG; - } - } - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties)) { - - /* Check cbBuffer */ - if (pProps->cbBuffer != 0 && pProps->cbBuffer != m_cbBuffer) { - return E_INVALIDARG; - } - } - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties) && - CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) { - - /* Check lActual */ - if (pProps->cbBuffer < pProps->lActual) { - return E_INVALIDARG; - } - } - - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) { - - /* Check pMediaType */ - if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) { - CheckPointer(pProps->pMediaType, E_POINTER); - pMediaType = CreateMediaType(pProps->pMediaType); - if (pMediaType == NULL) { - return E_OUTOFMEMORY; - } - } - } - - /* Now do the assignments */ - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwStreamId, cbProperties)) { - m_dwStreamId = pProps->dwStreamId; - } - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) { - /* Set the flags */ - m_dwFlags = pProps->dwSampleFlags | - (m_dwFlags & Sample_MediaTimeValid); - m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; - } else { - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwTypeSpecificFlags, cbProperties)) { - m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; - } - } - - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) { - /* Set lActual */ - m_lActual = pProps->lActual; - } - - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) { - - /* Set the times */ - m_End = pProps->tStop; - } - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStart, cbProperties)) { - - /* Set the times */ - m_Start = pProps->tStart; - } - - if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) { - /* Set pMediaType */ - if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) { - if (m_pMediaType != NULL) { - DeleteMediaType(m_pMediaType); - } - m_pMediaType = pMediaType; - } - } - - /* Fix up the type changed flag to correctly reflect the current state - If, for instance the input contained no type change but the - output does then if we don't do this we'd lose the - output media type. - */ - if (m_pMediaType) { - m_dwFlags |= Sample_TypeChanged; - } else { - m_dwFlags &= ~Sample_TypeChanged; - } - } - - return S_OK; -} - - -// -// The streaming thread calls IPin::NewSegment(), IPin::EndOfStream(), -// IMemInputPin::Receive() and IMemInputPin::ReceiveMultiple() on the -// connected input pin. The application thread calls Block(). The -// following class members can only be called by the streaming thread. -// -// Deliver() -// DeliverNewSegment() -// StartUsingOutputPin() -// StopUsingOutputPin() -// ChangeOutputFormat() -// ChangeMediaType() -// DynamicReconnect() -// -// The following class members can only be called by the application thread. -// -// Block() -// SynchronousBlockOutputPin() -// AsynchronousBlockOutputPin() -// - -CDynamicOutputPin::CDynamicOutputPin( - TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName), - m_hStopEvent(NULL), - m_pGraphConfig(NULL), - m_bPinUsesReadOnlyAllocator(FALSE), - m_BlockState(NOT_BLOCKED), - m_hUnblockOutputPinEvent(NULL), - m_hNotifyCallerPinBlockedEvent(NULL), - m_dwBlockCallerThreadID(0), - m_dwNumOutstandingOutputPinUsers(0) -{ - HRESULT hr = Initialize(); - if( FAILED( hr ) ) { - *phr = hr; - return; - } -} - -#ifdef UNICODE -CDynamicOutputPin::CDynamicOutputPin( - CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName) : - CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName), - m_hStopEvent(NULL), - m_pGraphConfig(NULL), - m_bPinUsesReadOnlyAllocator(FALSE), - m_BlockState(NOT_BLOCKED), - m_hUnblockOutputPinEvent(NULL), - m_hNotifyCallerPinBlockedEvent(NULL), - m_dwBlockCallerThreadID(0), - m_dwNumOutstandingOutputPinUsers(0) -{ - HRESULT hr = Initialize(); - if( FAILED( hr ) ) { - *phr = hr; - return; - } -} -#endif - -CDynamicOutputPin::~CDynamicOutputPin() -{ - if(NULL != m_hUnblockOutputPinEvent) { - // This call should not fail because we have access to m_hUnblockOutputPinEvent - // and m_hUnblockOutputPinEvent is a valid event. - EXECUTE_ASSERT(::CloseHandle(m_hUnblockOutputPinEvent)); - } - - if(NULL != m_hNotifyCallerPinBlockedEvent) { - // This call should not fail because we have access to m_hNotifyCallerPinBlockedEvent - // and m_hNotifyCallerPinBlockedEvent is a valid event. - EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); - } -} - -HRESULT CDynamicOutputPin::Initialize(void) -{ - m_hUnblockOutputPinEvent = ::CreateEvent( NULL, // The event will have the default security descriptor. - TRUE, // This is a manual reset event. - TRUE, // The event is initially signaled. - NULL ); // The event is not named. - - // CreateEvent() returns NULL if an error occurs. - if(NULL == m_hUnblockOutputPinEvent) { - return AmGetLastErrorToHResult(); - } - - // Set flag to say we can reconnect while streaming. - SetReconnectWhenActive(true); - - return S_OK; -} - -STDMETHODIMP CDynamicOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) -{ - if(riid == IID_IPinFlowControl) { - return GetInterface(static_cast(this), ppv); - } else { - return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); - } -} - -STDMETHODIMP CDynamicOutputPin::Disconnect(void) -{ - CAutoLock cObjectLock(m_pLock); - return DisconnectInternal(); -} - -STDMETHODIMP CDynamicOutputPin::Block(DWORD dwBlockFlags, HANDLE hEvent) -{ - const DWORD VALID_FLAGS = AM_PIN_FLOW_CONTROL_BLOCK; - - // Check for illegal flags. - if(dwBlockFlags & ~VALID_FLAGS) { - return E_INVALIDARG; - } - - // Make sure the event is unsignaled. - if((dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) && (NULL != hEvent)) { - if( !::ResetEvent( hEvent ) ) { - return AmGetLastErrorToHResult(); - } - } - - // No flags are set if we are unblocking the output pin. - if(0 == dwBlockFlags) { - - // This parameter should be NULL because unblock operations are always synchronous. - // There is no need to notify the caller when the event is done. - if(NULL != hEvent) { - return E_INVALIDARG; - } - } - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - HRESULT hr; - - if(dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) { - // IPinFlowControl::Block()'s hEvent parameter is NULL if the block is synchronous. - // If hEvent is not NULL, the block is asynchronous. - if(NULL == hEvent) { - hr = SynchronousBlockOutputPin(); - } else { - hr = AsynchronousBlockOutputPin(hEvent); - } - } else { - hr = UnblockOutputPin(); - } - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - if(FAILED(hr)) { - return hr; - } - - return S_OK; -} - -HRESULT CDynamicOutputPin::SynchronousBlockOutputPin(void) -{ - HANDLE hNotifyCallerPinBlockedEvent = :: CreateEvent( NULL, // The event will have the default security attributes. - FALSE, // This is an automatic reset event. - FALSE, // The event is initially unsignaled. - NULL ); // The event is not named. - - // CreateEvent() returns NULL if an error occurs. - if(NULL == hNotifyCallerPinBlockedEvent) { - return AmGetLastErrorToHResult(); - } - - HRESULT hr = AsynchronousBlockOutputPin(hNotifyCallerPinBlockedEvent); - if(FAILED(hr)) { - // This call should not fail because we have access to hNotifyCallerPinBlockedEvent - // and hNotifyCallerPinBlockedEvent is a valid event. - EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent)); - - return hr; - } - - hr = WaitEvent(hNotifyCallerPinBlockedEvent); - - // This call should not fail because we have access to hNotifyCallerPinBlockedEvent - // and hNotifyCallerPinBlockedEvent is a valid event. - EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent)); - - if(FAILED(hr)) { - return hr; - } - - return S_OK; -} - -HRESULT CDynamicOutputPin::AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlockedEvent) -{ - // This function holds the m_BlockStateLock because it uses - // m_dwBlockCallerThreadID, m_BlockState and - // m_hNotifyCallerPinBlockedEvent. - CAutoLock alBlockStateLock(&m_BlockStateLock); - - if(NOT_BLOCKED != m_BlockState) { - if(m_dwBlockCallerThreadID == ::GetCurrentThreadId()) { - return VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD; - } else { - return VFW_E_PIN_ALREADY_BLOCKED; - } - } - - BOOL fSuccess = ::DuplicateHandle( ::GetCurrentProcess(), - hNotifyCallerPinBlockedEvent, - ::GetCurrentProcess(), - &m_hNotifyCallerPinBlockedEvent, - EVENT_MODIFY_STATE, - FALSE, - 0 ); - if( !fSuccess ) { - return AmGetLastErrorToHResult(); - } - - m_BlockState = PENDING; - m_dwBlockCallerThreadID = ::GetCurrentThreadId(); - - // The output pin cannot be blocked if the streaming thread is - // calling IPin::NewSegment(), IPin::EndOfStream(), IMemInputPin::Receive() - // or IMemInputPin::ReceiveMultiple() on the connected input pin. Also, it - // cannot be blocked if the streaming thread is calling DynamicReconnect(), - // ChangeMediaType() or ChangeOutputFormat(). - if(!StreamingThreadUsingOutputPin()) { - - // The output pin can be immediately blocked. - BlockOutputPin(); - } - - return S_OK; -} - -void CDynamicOutputPin::BlockOutputPin(void) -{ - // The caller should always hold the m_BlockStateLock because this function - // uses m_BlockState and m_hNotifyCallerPinBlockedEvent. - ASSERT(CritCheckIn(&m_BlockStateLock)); - - // This function should not be called if the streaming thread is modifying - // the connection state or it's passing data downstream. - ASSERT(!StreamingThreadUsingOutputPin()); - - // This should not fail because we successfully created the event - // and we have the security permissions to change it's state. - EXECUTE_ASSERT(::ResetEvent(m_hUnblockOutputPinEvent)); - - // This event should not fail because AsynchronousBlockOutputPin() successfully - // duplicated this handle and we have the appropriate security permissions. - EXECUTE_ASSERT(::SetEvent(m_hNotifyCallerPinBlockedEvent)); - EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); - - m_BlockState = BLOCKED; - m_hNotifyCallerPinBlockedEvent = NULL; -} - -HRESULT CDynamicOutputPin::UnblockOutputPin(void) -{ - // UnblockOutputPin() holds the m_BlockStateLock because it - // uses m_BlockState, m_dwBlockCallerThreadID and - // m_hNotifyCallerPinBlockedEvent. - CAutoLock alBlockStateLock(&m_BlockStateLock); - - if(NOT_BLOCKED == m_BlockState) { - return S_FALSE; - } - - // This should not fail because we successfully created the event - // and we have the security permissions to change it's state. - EXECUTE_ASSERT(::SetEvent(m_hUnblockOutputPinEvent)); - - // Cancel the block operation if it's still pending. - if(NULL != m_hNotifyCallerPinBlockedEvent) { - // This event should not fail because AsynchronousBlockOutputPin() successfully - // duplicated this handle and we have the appropriate security permissions. - EXECUTE_ASSERT(::SetEvent(m_hNotifyCallerPinBlockedEvent)); - EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); - } - - m_BlockState = NOT_BLOCKED; - m_dwBlockCallerThreadID = 0; - m_hNotifyCallerPinBlockedEvent = NULL; - - return S_OK; -} - -HRESULT CDynamicOutputPin::StartUsingOutputPin(void) -{ - // The caller should not hold m_BlockStateLock. If the caller does, - // a deadlock could occur. - ASSERT(CritCheckOut(&m_BlockStateLock)); - - CAutoLock alBlockStateLock(&m_BlockStateLock); - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - // Are we in the middle of a block operation? - while(BLOCKED == m_BlockState) { - m_BlockStateLock.Unlock(); - - // If this ASSERT fires, a deadlock could occur. The caller should make sure - // that this thread never acquires the Block State lock more than once. - ASSERT(CritCheckOut( &m_BlockStateLock )); - - // WaitForMultipleObjects() returns WAIT_OBJECT_0 if the unblock event - // is fired. It returns WAIT_OBJECT_0 + 1 if the stop event if fired. - // See the Windows SDK documentation for more information on - // WaitForMultipleObjects(). - const DWORD UNBLOCK = WAIT_OBJECT_0; - const DWORD STOP = WAIT_OBJECT_0 + 1; - - HANDLE ahWaitEvents[] = { m_hUnblockOutputPinEvent, m_hStopEvent }; - DWORD dwNumWaitEvents = sizeof(ahWaitEvents)/sizeof(HANDLE); - - DWORD dwReturnValue = ::WaitForMultipleObjects( dwNumWaitEvents, ahWaitEvents, FALSE, INFINITE ); - - m_BlockStateLock.Lock(); - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - switch( dwReturnValue ) { - case UNBLOCK: - break; - - case STOP: - return VFW_E_STATE_CHANGED; - - case WAIT_FAILED: - return AmGetLastErrorToHResult(); - - default: - DbgBreak( "An Unexpected case occured in CDynamicOutputPin::StartUsingOutputPin()." ); - return E_UNEXPECTED; - } - } - - m_dwNumOutstandingOutputPinUsers++; - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - return S_OK; -} - -void CDynamicOutputPin::StopUsingOutputPin(void) -{ - CAutoLock alBlockStateLock(&m_BlockStateLock); - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG - - m_dwNumOutstandingOutputPinUsers--; - - if((m_dwNumOutstandingOutputPinUsers == 0) && (NOT_BLOCKED != m_BlockState)) { - BlockOutputPin(); - } - - #ifdef DEBUG - AssertValid(); - #endif // DEBUG -} - -bool CDynamicOutputPin::StreamingThreadUsingOutputPin(void) -{ - CAutoLock alBlockStateLock(&m_BlockStateLock); - - return (m_dwNumOutstandingOutputPinUsers > 0); -} - -void CDynamicOutputPin::SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEvent) -{ - // This pointer is not addrefed because filters are not allowed to - // hold references to the filter graph manager. See the documentation for - // IBaseFilter::JoinFilterGraph() in the Direct Show SDK for more information. - m_pGraphConfig = pGraphConfig; - - m_hStopEvent = hStopEvent; -} - -HRESULT CDynamicOutputPin::Active(void) -{ - // Make sure the user initialized the object by calling SetConfigInfo(). - if((NULL == m_hStopEvent) || (NULL == m_pGraphConfig)) { - DbgBreak( ERROR: CDynamicOutputPin::Active() failed because m_pGraphConfig and m_hStopEvent were not initialized. Call SetConfigInfo() to initialize them. ); - return E_FAIL; - } - - // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). - // The ASSERT can also fire if the event if destroyed and then Active() is called. An event - // handle is invalid if 1) the event does not exist or the user does not have the security - // permissions to use the event. - EXECUTE_ASSERT(ResetEvent(m_hStopEvent)); - - return CBaseOutputPin::Active(); -} - -HRESULT CDynamicOutputPin::Inactive(void) -{ - // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). - // The ASSERT can also fire if the event if destroyed and then Active() is called. An event - // handle is invalid if 1) the event does not exist or the user does not have the security - // permissions to use the event. - EXECUTE_ASSERT(SetEvent(m_hStopEvent)); - - return CBaseOutputPin::Inactive(); -} - -HRESULT CDynamicOutputPin::DeliverBeginFlush(void) -{ - // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). - // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. - // An event handle is invalid if 1) the event does not exist or the user does not have the security - // permissions to use the event. - EXECUTE_ASSERT(SetEvent(m_hStopEvent)); - - return CBaseOutputPin::DeliverBeginFlush(); -} - -HRESULT CDynamicOutputPin::DeliverEndFlush(void) -{ - // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). - // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. - // An event handle is invalid if 1) the event does not exist or the user does not have the security - // permissions to use the event. - EXECUTE_ASSERT(ResetEvent(m_hStopEvent)); - - return CBaseOutputPin::DeliverEndFlush(); -} - - -// ChangeOutputFormat() either dynamicly changes the connection's format type or it dynamicly -// reconnects the output pin. -HRESULT CDynamicOutputPin::ChangeOutputFormat - ( - const AM_MEDIA_TYPE *pmt, - REFERENCE_TIME tSegmentStart, - REFERENCE_TIME tSegmentStop, - double dSegmentRate - ) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - // Callers should always pass a valid media type to ChangeOutputFormat() . - ASSERT(NULL != pmt); - - CMediaType cmt(*pmt); - HRESULT hr = ChangeMediaType(&cmt); - if (FAILED(hr)) { - return hr; - } - - hr = DeliverNewSegment(tSegmentStart, tSegmentStop, dSegmentRate); - if( FAILED( hr ) ) { - return hr; - } - - return S_OK; -} - -HRESULT CDynamicOutputPin::ChangeMediaType(const CMediaType *pmt) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - // This function assumes the filter graph is running. - ASSERT(!IsStopped()); - - if(!IsConnected()) { - return VFW_E_NOT_CONNECTED; - } - - /* First check if the downstream pin will accept a dynamic - format change - */ - QzCComPtr pConnection; - - m_Connected->QueryInterface(IID_IPinConnection, (void **)&pConnection); - if(pConnection != NULL) { - - if(S_OK == pConnection->DynamicQueryAccept(pmt)) { - - HRESULT hr = ChangeMediaTypeHelper(pmt); - if(FAILED(hr)) { - return hr; - } - - return S_OK; - } - } - - /* Can't do the dynamic connection */ - return DynamicReconnect(pmt); -} - -HRESULT CDynamicOutputPin::ChangeMediaTypeHelper(const CMediaType *pmt) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - HRESULT hr = m_Connected->ReceiveConnection(this, pmt); - if(FAILED(hr)) { - return hr; - } - - hr = SetMediaType(pmt); - if(FAILED(hr)) { - return hr; - } - - // Does this pin use the local memory transport? - if(NULL != m_pInputPin) { - // This function assumes that m_pInputPin and m_Connected are - // two different interfaces to the same object. - ASSERT(::IsEqualObject(m_Connected, m_pInputPin)); - - ALLOCATOR_PROPERTIES apInputPinRequirements; - apInputPinRequirements.cbAlign = 0; - apInputPinRequirements.cbBuffer = 0; - apInputPinRequirements.cbPrefix = 0; - apInputPinRequirements.cBuffers = 0; - - m_pInputPin->GetAllocatorRequirements(&apInputPinRequirements); - - // A zero allignment does not make any sense. - if(0 == apInputPinRequirements.cbAlign) { - apInputPinRequirements.cbAlign = 1; - } - - hr = m_pAllocator->Decommit(); - if(FAILED(hr)) { - return hr; - } - - hr = DecideBufferSize(m_pAllocator, &apInputPinRequirements); - if(FAILED(hr)) { - return hr; - } - - hr = m_pAllocator->Commit(); - if(FAILED(hr)) { - return hr; - } - - hr = m_pInputPin->NotifyAllocator(m_pAllocator, m_bPinUsesReadOnlyAllocator); - if(FAILED(hr)) { - return hr; - } - } - - return S_OK; -} - -// this method has to be called from the thread that is pushing data, -// and it's the caller's responsibility to make sure that the thread -// has no outstand samples because they cannot be delivered after a -// reconnect -// -HRESULT CDynamicOutputPin::DynamicReconnect( const CMediaType* pmt ) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - if((m_pGraphConfig == NULL) || (NULL == m_hStopEvent)) { - return E_FAIL; - } - - HRESULT hr = m_pGraphConfig->Reconnect( - this, - NULL, - pmt, - NULL, - m_hStopEvent, - AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS ); - - return hr; -} - -HRESULT CDynamicOutputPin::CompleteConnect(IPin *pReceivePin) -{ - HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin); - if(SUCCEEDED(hr)) { - if(!IsStopped() && m_pAllocator) { - hr = m_pAllocator->Commit(); - ASSERT(hr != VFW_E_ALREADY_COMMITTED); - } - } - - return hr; -} - -#ifdef DEBUG -void CDynamicOutputPin::AssertValid(void) -{ - // Make sure the object was correctly initialized. - - // This ASSERT only fires if the object failed to initialize - // and the user ignored the constructor's return code (phr). - ASSERT(NULL != m_hUnblockOutputPinEvent); - - // If either of these ASSERTs fire, the user did not correctly call - // SetConfigInfo(). - ASSERT(NULL != m_hStopEvent); - ASSERT(NULL != m_pGraphConfig); - - // Make sure the block state is consistent. - - CAutoLock alBlockStateLock(&m_BlockStateLock); - - // BLOCK_STATE variables only have three legal values: PENDING, BLOCKED and NOT_BLOCKED. - ASSERT((NOT_BLOCKED == m_BlockState) || (PENDING == m_BlockState) || (BLOCKED == m_BlockState)); - - // m_hNotifyCallerPinBlockedEvent is only needed when a block operation cannot complete - // immediately. - ASSERT(((NULL == m_hNotifyCallerPinBlockedEvent) && (PENDING != m_BlockState)) || - ((NULL != m_hNotifyCallerPinBlockedEvent) && (PENDING == m_BlockState)) ); - - // m_dwBlockCallerThreadID should always be 0 if the pin is not blocked and - // the user is not trying to block the pin. - ASSERT((0 == m_dwBlockCallerThreadID) || (NOT_BLOCKED != m_BlockState)); - - // If this ASSERT fires, the streaming thread is using the output pin and the - // output pin is blocked. - ASSERT(((0 != m_dwNumOutstandingOutputPinUsers) && (BLOCKED != m_BlockState)) || - ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED != m_BlockState)) || - ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED == m_BlockState)) ); -} -#endif // DEBUG - -HRESULT CDynamicOutputPin::WaitEvent(HANDLE hEvent) -{ - const DWORD EVENT_SIGNALED = WAIT_OBJECT_0; - - DWORD dwReturnValue = ::WaitForSingleObject(hEvent, INFINITE); - - switch( dwReturnValue ) { - case EVENT_SIGNALED: - return S_OK; - - case WAIT_FAILED: - return AmGetLastErrorToHResult(); - - default: - DbgBreak( "An Unexpected case occured in CDynamicOutputPin::WaitEvent()." ); - return E_UNEXPECTED; - } -} - -//===================================================================== -//===================================================================== -// Implements CBaseAllocator -//===================================================================== -//===================================================================== - - -/* Constructor overrides the default settings for the free list to request - that it be alertable (ie the list can be cast to a handle which can be - passed to WaitForSingleObject). Both of the allocator lists also ask for - object locking, the all list matches the object default settings but I - have included them here just so it is obvious what kind of list it is */ - -CBaseAllocator::CBaseAllocator(TCHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr, - BOOL bEvent, - BOOL fEnableReleaseCallback - ) : - CUnknown(pName, pUnk), - m_lAllocated(0), - m_bChanged(FALSE), - m_bCommitted(FALSE), - m_bDecommitInProgress(FALSE), - m_lSize(0), - m_lCount(0), - m_lAlignment(0), - m_lPrefix(0), - m_hSem(NULL), - m_lWaiting(0), - m_fEnableReleaseCallback(fEnableReleaseCallback), - m_pNotify(NULL) -{ - - if (bEvent) { - m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); - if (m_hSem == NULL) { - *phr = E_OUTOFMEMORY; - return; - } - } -} - -#ifdef UNICODE -CBaseAllocator::CBaseAllocator(CHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr, - BOOL bEvent, - BOOL fEnableReleaseCallback) : - CUnknown(pName, pUnk), - m_lAllocated(0), - m_bChanged(FALSE), - m_bCommitted(FALSE), - m_bDecommitInProgress(FALSE), - m_lSize(0), - m_lCount(0), - m_lAlignment(0), - m_lPrefix(0), - m_hSem(NULL), - m_lWaiting(0), - m_fEnableReleaseCallback(fEnableReleaseCallback), - m_pNotify(NULL) -{ - - if (bEvent) { - m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); - if (m_hSem == NULL) { - *phr = E_OUTOFMEMORY; - return; - } - } -} -#endif - -/* Destructor */ - -CBaseAllocator::~CBaseAllocator() -{ - // we can't call Decommit here since that would mean a call to a - // pure virtual in destructor. - // We must assume that the derived class has gone into decommit state in - // its destructor. - - ASSERT(!m_bCommitted); - if (m_hSem != NULL) { - EXECUTE_ASSERT(CloseHandle(m_hSem)); - } - if (m_pNotify) { - m_pNotify->Release(); - } -} - - -/* Override this to publicise our interfaces */ - -STDMETHODIMP -CBaseAllocator::NonDelegatingQueryInterface(REFIID riid, void **ppv) -{ - /* Do we know about this interface */ - - if (riid == IID_IMemAllocator || - riid == IID_IMemAllocatorCallbackTemp && m_fEnableReleaseCallback) { - return GetInterface((IMemAllocatorCallbackTemp *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -/* This sets the size and count of the required samples. The memory isn't - actually allocated until Commit() is called, if memory has already been - allocated then assuming no samples are outstanding the user may call us - to change the buffering, the memory will be released in Commit() */ - -STDMETHODIMP -CBaseAllocator::SetProperties( - ALLOCATOR_PROPERTIES* pRequest, - ALLOCATOR_PROPERTIES* pActual) -{ - CheckPointer(pRequest, E_POINTER); - CheckPointer(pActual, E_POINTER); - ValidateReadWritePtr(pActual, sizeof(ALLOCATOR_PROPERTIES)); - CAutoLock cObjectLock(this); - - ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES)); - - ASSERT(pRequest->cbBuffer > 0); - - /* Check the alignment requested */ - if (pRequest->cbAlign != 1) { - DbgLog((LOG_ERROR, 2, TEXT("Alignment requested was 0x%x, not 1"), - pRequest->cbAlign)); - return VFW_E_BADALIGN; - } - - /* Can't do this if already committed, there is an argument that says we - should not reject the SetProperties call if there are buffers still - active. However this is called by the source filter, which is the same - person who is holding the samples. Therefore it is not unreasonable - for them to free all their samples before changing the requirements */ - - if (m_bCommitted) { - return VFW_E_ALREADY_COMMITTED; - } - - /* Must be no outstanding buffers */ - - if (m_lAllocated != m_lFree.GetCount()) { - return VFW_E_BUFFERS_OUTSTANDING; - } - - /* There isn't any real need to check the parameters as they - will just be rejected when the user finally calls Commit */ - - pActual->cbBuffer = m_lSize = pRequest->cbBuffer; - pActual->cBuffers = m_lCount = pRequest->cBuffers; - pActual->cbAlign = m_lAlignment = pRequest->cbAlign; - pActual->cbPrefix = m_lPrefix = pRequest->cbPrefix; - - m_bChanged = TRUE; - return NOERROR; -} - -STDMETHODIMP -CBaseAllocator::GetProperties( - ALLOCATOR_PROPERTIES * pActual) -{ - CheckPointer(pActual,E_POINTER); - ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES)); - - CAutoLock cObjectLock(this); - pActual->cbBuffer = m_lSize; - pActual->cBuffers = m_lCount; - pActual->cbAlign = m_lAlignment; - pActual->cbPrefix = m_lPrefix; - return NOERROR; -} - -// get container for a sample. Blocking, synchronous call to get the -// next free buffer (as represented by an IMediaSample interface). -// on return, the time etc properties will be invalid, but the buffer -// pointer and size will be correct. - -HRESULT CBaseAllocator::GetBuffer(IMediaSample **ppBuffer, - REFERENCE_TIME *pStartTime, - REFERENCE_TIME *pEndTime, - DWORD dwFlags - ) -{ - UNREFERENCED_PARAMETER(pStartTime); - UNREFERENCED_PARAMETER(pEndTime); - UNREFERENCED_PARAMETER(dwFlags); - CMediaSample *pSample; - - *ppBuffer = NULL; - for (;;) - { - { // scope for lock - CAutoLock cObjectLock(this); - - /* Check we are committed */ - if (!m_bCommitted) { - return VFW_E_NOT_COMMITTED; - } - pSample = (CMediaSample *) m_lFree.RemoveHead(); - if (pSample == NULL) { - SetWaiting(); - } - } - - /* If we didn't get a sample then wait for the list to signal */ - - if (pSample) { - break; - } - if (dwFlags & AM_GBF_NOWAIT) { - return VFW_E_TIMEOUT; - } - ASSERT(m_hSem != NULL); - WaitForSingleObject(m_hSem, INFINITE); - } - - /* Addref the buffer up to one. On release - back to zero instead of being deleted, it will requeue itself by - calling the ReleaseBuffer member function. NOTE the owner of a - media sample must always be derived from CBaseAllocator */ - - - ASSERT(pSample->m_cRef == 0); - pSample->m_cRef = 1; - *ppBuffer = pSample; - - - return NOERROR; -} - - -/* Final release of a CMediaSample will call this */ - -STDMETHODIMP -CBaseAllocator::ReleaseBuffer(IMediaSample * pSample) -{ - CheckPointer(pSample,E_POINTER); - ValidateReadPtr(pSample,sizeof(IMediaSample)); - - - - BOOL bRelease = FALSE; - { - CAutoLock cal(this); - - /* Put back on the free list */ - - m_lFree.Add((CMediaSample *)pSample); - if (m_lWaiting != 0) { - NotifySample(); - } - - // if there is a pending Decommit, then we need to complete it by - // calling Free() when the last buffer is placed on the free list - - LONG l1 = m_lFree.GetCount(); - if (m_bDecommitInProgress && (l1 == m_lAllocated)) { - Free(); - m_bDecommitInProgress = FALSE; - bRelease = TRUE; - } - } - - if (m_pNotify) { - - ASSERT(m_fEnableReleaseCallback); - - // - // Note that this is not synchronized with setting up a notification - // method. - // - m_pNotify->NotifyRelease(); - } - - /* For each buffer there is one AddRef, made in GetBuffer and released - here. This may cause the allocator and all samples to be deleted */ - - if (bRelease) { - Release(); - } - return NOERROR; -} - -STDMETHODIMP -CBaseAllocator::SetNotify( - IMemAllocatorNotifyCallbackTemp* pNotify - ) -{ - ASSERT(m_fEnableReleaseCallback); - CAutoLock lck(this); - if (pNotify) { - pNotify->AddRef(); - } - if (m_pNotify) { - m_pNotify->Release(); - } - m_pNotify = pNotify; - return S_OK; -} - -STDMETHODIMP -CBaseAllocator::GetFreeCount( - LONG* plBuffersFree - ) -{ - ASSERT(m_fEnableReleaseCallback); - CAutoLock cObjectLock(this); - *plBuffersFree = m_lCount - m_lAllocated + m_lFree.GetCount(); - return NOERROR; -} - -void -CBaseAllocator::NotifySample() -{ - if (m_lWaiting != 0) { - ASSERT(m_hSem != NULL); - ReleaseSemaphore(m_hSem, m_lWaiting, 0); - m_lWaiting = 0; - } -} - -STDMETHODIMP -CBaseAllocator::Commit() -{ - /* Check we are not decommitted */ - CAutoLock cObjectLock(this); - - // cannot need to alloc or re-alloc if we are committed - if (m_bCommitted) { - return NOERROR; - } - - /* Allow GetBuffer calls */ - - m_bCommitted = TRUE; - - // is there a pending decommit ? if so, just cancel it - if (m_bDecommitInProgress) { - m_bDecommitInProgress = FALSE; - - // don't call Alloc at this point. He cannot allow SetProperties - // between Decommit and the last free, so the buffer size cannot have - // changed. And because some of the buffers are not free yet, he - // cannot re-alloc anyway. - return NOERROR; - } - - DbgLog((LOG_MEMORY, 1, TEXT("Allocating: %ldx%ld"), m_lCount, m_lSize)); - - // actually need to allocate the samples - HRESULT hr = Alloc(); - if (FAILED(hr)) { - m_bCommitted = FALSE; - return hr; - } - AddRef(); - return NOERROR; -} - - -STDMETHODIMP -CBaseAllocator::Decommit() -{ - BOOL bRelease = FALSE; - { - /* Check we are not already decommitted */ - CAutoLock cObjectLock(this); - if (m_bCommitted == FALSE) { - if (m_bDecommitInProgress == FALSE) { - return NOERROR; - } - } - - /* No more GetBuffer calls will succeed */ - m_bCommitted = FALSE; - - // are any buffers outstanding? - if (m_lFree.GetCount() < m_lAllocated) { - // please complete the decommit when last buffer is freed - m_bDecommitInProgress = TRUE; - } else { - m_bDecommitInProgress = FALSE; - - // need to complete the decommit here as there are no - // outstanding buffers - - Free(); - bRelease = TRUE; - } - - // Tell anyone waiting that they can go now so we can - // reject their call - NotifySample(); - } - - if (bRelease) { - Release(); - } - return NOERROR; -} - - -/* Base definition of allocation which checks we are ok to go ahead and do - the full allocation. We return S_FALSE if the requirements are the same */ - -HRESULT -CBaseAllocator::Alloc(void) -{ - /* Error if he hasn't set the size yet */ - if (m_lCount <= 0 || m_lSize <= 0 || m_lAlignment <= 0) { - return VFW_E_SIZENOTSET; - } - - /* should never get here while buffers outstanding */ - ASSERT(m_lFree.GetCount() == m_lAllocated); - - /* If the requirements haven't changed then don't reallocate */ - if (m_bChanged == FALSE) { - return S_FALSE; - } - - return NOERROR; -} - -/* Implement CBaseAllocator::CSampleList::Remove(pSample) - Removes pSample from the list -*/ -void -CBaseAllocator::CSampleList::Remove(CMediaSample * pSample) -{ - CMediaSample **pSearch; - for (pSearch = &m_List; - *pSearch != NULL; - pSearch = &(CBaseAllocator::NextSample(*pSearch))) { - if (*pSearch == pSample) { - *pSearch = CBaseAllocator::NextSample(pSample); - CBaseAllocator::NextSample(pSample) = NULL; - m_nOnList--; - return; - } - } - DbgBreak("Couldn't find sample in list"); -} - -//===================================================================== -//===================================================================== -// Implements CMemAllocator -//===================================================================== -//===================================================================== - - -/* This goes in the factory template table to create new instances */ -CUnknown *CMemAllocator::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) -{ - CUnknown *pUnkRet = new CMemAllocator(NAME("CMemAllocator"), pUnk, phr); - return pUnkRet; -} - -CMemAllocator::CMemAllocator( - TCHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr) - : CBaseAllocator(pName, pUnk, phr, TRUE, TRUE), - m_pBuffer(NULL) -{ -} - -#ifdef UNICODE -CMemAllocator::CMemAllocator( - CHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr) - : CBaseAllocator(pName, pUnk, phr, TRUE, TRUE), - m_pBuffer(NULL) -{ -} -#endif - -/* This sets the size and count of the required samples. The memory isn't - actually allocated until Commit() is called, if memory has already been - allocated then assuming no samples are outstanding the user may call us - to change the buffering, the memory will be released in Commit() */ -STDMETHODIMP -CMemAllocator::SetProperties( - ALLOCATOR_PROPERTIES* pRequest, - ALLOCATOR_PROPERTIES* pActual) -{ - CheckPointer(pActual,E_POINTER); - ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES)); - CAutoLock cObjectLock(this); - - ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES)); - - ASSERT(pRequest->cbBuffer > 0); - - SYSTEM_INFO SysInfo; - GetSystemInfo(&SysInfo); - - /* Check the alignment request is a power of 2 */ - if ((-pRequest->cbAlign & pRequest->cbAlign) != pRequest->cbAlign) { - DbgLog((LOG_ERROR, 1, TEXT("Alignment requested 0x%x not a power of 2!"), - pRequest->cbAlign)); - } - /* Check the alignment requested */ - if (pRequest->cbAlign == 0 || - (SysInfo.dwAllocationGranularity & (pRequest->cbAlign - 1)) != 0) { - DbgLog((LOG_ERROR, 1, TEXT("Invalid alignment 0x%x requested - granularity = 0x%x"), - pRequest->cbAlign, SysInfo.dwAllocationGranularity)); - return VFW_E_BADALIGN; - } - - /* Can't do this if already committed, there is an argument that says we - should not reject the SetProperties call if there are buffers still - active. However this is called by the source filter, which is the same - person who is holding the samples. Therefore it is not unreasonable - for them to free all their samples before changing the requirements */ - - if (m_bCommitted == TRUE) { - return VFW_E_ALREADY_COMMITTED; - } - - /* Must be no outstanding buffers */ - - if (m_lFree.GetCount() < m_lAllocated) { - return VFW_E_BUFFERS_OUTSTANDING; - } - - /* There isn't any real need to check the parameters as they - will just be rejected when the user finally calls Commit */ - - // round length up to alignment - remember that prefix is included in - // the alignment - LONG lSize = pRequest->cbBuffer + pRequest->cbPrefix; - LONG lRemainder = lSize % pRequest->cbAlign; - if (lRemainder != 0) { - lSize = lSize - lRemainder + pRequest->cbAlign; - } - pActual->cbBuffer = m_lSize = (lSize - pRequest->cbPrefix); - - pActual->cBuffers = m_lCount = pRequest->cBuffers; - pActual->cbAlign = m_lAlignment = pRequest->cbAlign; - pActual->cbPrefix = m_lPrefix = pRequest->cbPrefix; - - m_bChanged = TRUE; - return NOERROR; -} - -// override this to allocate our resources when Commit is called. -// -// note that our resources may be already allocated when this is called, -// since we don't free them on Decommit. We will only be called when in -// decommit state with all buffers free. -// -// object locked by caller -HRESULT -CMemAllocator::Alloc(void) -{ - CAutoLock lck(this); - - /* Check he has called SetProperties */ - HRESULT hr = CBaseAllocator::Alloc(); - if (FAILED(hr)) { - return hr; - } - - /* If the requirements haven't changed then don't reallocate */ - if (hr == S_FALSE) { - ASSERT(m_pBuffer); - return NOERROR; - } - ASSERT(hr == S_OK); // we use this fact in the loop below - - /* Free the old resources */ - if (m_pBuffer) { - ReallyFree(); - } - - /* Compute the aligned size */ - LONG lAlignedSize = m_lSize + m_lPrefix; - if (m_lAlignment > 1) { - LONG lRemainder = lAlignedSize % m_lAlignment; - if (lRemainder != 0) { - lAlignedSize += (m_lAlignment - lRemainder); - } - } - - /* Create the contiguous memory block for the samples - making sure it's properly aligned (64K should be enough!) - */ - ASSERT(lAlignedSize % m_lAlignment == 0); - - m_pBuffer = (PBYTE)VirtualAlloc(NULL, - m_lCount * lAlignedSize, - MEM_COMMIT, - PAGE_READWRITE); - - if (m_pBuffer == NULL) { - return E_OUTOFMEMORY; - } - - LPBYTE pNext = m_pBuffer; - CMediaSample *pSample; - - ASSERT(m_lAllocated == 0); - - // Create the new samples - we have allocated m_lSize bytes for each sample - // plus m_lPrefix bytes per sample as a prefix. We set the pointer to - // the memory after the prefix - so that GetPointer() will return a pointer - // to m_lSize bytes. - for (; m_lAllocated < m_lCount; m_lAllocated++, pNext += lAlignedSize) { - - - pSample = new CMediaSample( - NAME("Default memory media sample"), - this, - &hr, - pNext + m_lPrefix, // GetPointer() value - m_lSize); // not including prefix - - ASSERT(SUCCEEDED(hr)); - if (pSample == NULL) { - return E_OUTOFMEMORY; - } - - // This CANNOT fail - m_lFree.Add(pSample); - } - - m_bChanged = FALSE; - return NOERROR; -} - - -// override this to free up any resources we have allocated. -// called from the base class on Decommit when all buffers have been -// returned to the free list. -// -// caller has already locked the object. - -// in our case, we keep the memory until we are deleted, so -// we do nothing here. The memory is deleted in the destructor by -// calling ReallyFree() -void -CMemAllocator::Free(void) -{ - return; -} - - -// called from the destructor (and from Alloc if changing size/count) to -// actually free up the memory -void -CMemAllocator::ReallyFree(void) -{ - /* Should never be deleting this unless all buffers are freed */ - - ASSERT(m_lAllocated == m_lFree.GetCount()); - - /* Free up all the CMediaSamples */ - - CMediaSample *pSample; - for (;;) { - pSample = m_lFree.RemoveHead(); - if (pSample != NULL) { - delete pSample; - } else { - break; - } - } - - m_lAllocated = 0; - - // free the block of buffer memory - if (m_pBuffer) { - EXECUTE_ASSERT(VirtualFree(m_pBuffer, 0, MEM_RELEASE)); - m_pBuffer = NULL; - } -} - - -/* Destructor frees our memory resources */ - -CMemAllocator::~CMemAllocator() -{ - Decommit(); - ReallyFree(); -} - -// ------------------------------------------------------------------------ -// filter registration through IFilterMapper. used if IFilterMapper is -// not found (Quartz 1.0 install) - -STDAPI -AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata - , IFilterMapper * pIFM - , BOOL bRegister ) -{ - DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter"))); - - // check we've got data - // - if( NULL == psetupdata ) return S_FALSE; - - - // unregister filter - // (as pins are subkeys of filter's CLSID key - // they do not need to be removed separately). - // - DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter"))); - HRESULT hr = pIFM->UnregisterFilter( *(psetupdata->clsID) ); - - - if( bRegister ) - { - // register filter - // - DbgLog((LOG_TRACE, 3, TEXT("= = register filter"))); - hr = pIFM->RegisterFilter( *(psetupdata->clsID) - , psetupdata->strName - , psetupdata->dwMerit ); - if( SUCCEEDED(hr) ) - { - // all its pins - // - DbgLog((LOG_TRACE, 3, TEXT("= = register filter pins"))); - for( UINT m1=0; m1 < psetupdata->nPins; m1++ ) - { - hr = pIFM->RegisterPin( *(psetupdata->clsID) - , psetupdata->lpPin[m1].strName - , psetupdata->lpPin[m1].bRendered - , psetupdata->lpPin[m1].bOutput - , psetupdata->lpPin[m1].bZero - , psetupdata->lpPin[m1].bMany - , *(psetupdata->lpPin[m1].clsConnectsToFilter) - , psetupdata->lpPin[m1].strConnectsToPin ); - - if( SUCCEEDED(hr) ) - { - // and each pin's media types - // - DbgLog((LOG_TRACE, 3, TEXT("= = register filter pin types"))); - for( UINT m2=0; m2 < psetupdata->lpPin[m1].nMediaTypes; m2++ ) - { - hr = pIFM->RegisterPinType( *(psetupdata->clsID) - , psetupdata->lpPin[m1].strName - , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMajorType) - , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMinorType) ); - if( FAILED(hr) ) break; - } - if( FAILED(hr) ) break; - } - if( FAILED(hr) ) break; - } - } - } - - // handle one acceptable "error" - that - // of filter not being registered! - // (couldn't find a suitable #define'd - // name for the error!) - // - if( 0x80070002 == hr) - return NOERROR; - else - return hr; -} - -// Remove warnings about unreferenced inline functions -#pragma warning(disable:4514) - +//------------------------------------------------------------------------------ +// File: AMFilter.cpp +// +// Desc: DirectShow base classes - implements class hierarchy for streams +// architecture. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +//===================================================================== +//===================================================================== +// The following classes are declared in this header: +// +// +// CBaseMediaFilter Basic IMediaFilter support (abstract class) +// CBaseFilter Support for IBaseFilter (incl. IMediaFilter) +// CEnumPins Enumerate input and output pins +// CEnumMediaTypes Enumerate the preferred pin formats +// CBasePin Abstract base class for IPin interface +// CBaseOutputPin Adds data provider member functions +// CBaseInputPin Implements IMemInputPin interface +// CMediaSample Basic transport unit for IMemInputPin +// CBaseAllocator General list guff for most allocators +// CMemAllocator Implements memory buffer allocation +// +//===================================================================== +//===================================================================== + +#include + + + +//===================================================================== +// Helpers +//===================================================================== +STDAPI CreateMemoryAllocator(IMemAllocator **ppAllocator) +{ + return CoCreateInstance(CLSID_MemoryAllocator, + 0, + CLSCTX_INPROC_SERVER, + IID_IMemAllocator, + (void **)ppAllocator); +} + +// Put this one here rather than in ctlutil.cpp to avoid linking +// anything brought in by ctlutil.cpp +STDAPI CreatePosPassThru( + LPUNKNOWN pAgg, + BOOL bRenderer, + IPin *pPin, + IUnknown **ppPassThru +) +{ + *ppPassThru = NULL; + IUnknown *pUnkSeek; + HRESULT hr = CoCreateInstance(CLSID_SeekingPassThru, + pAgg, + CLSCTX_INPROC_SERVER, + IID_IUnknown, + (void **)&pUnkSeek + ); + if (FAILED(hr)) { + return hr; + } + + ISeekingPassThru *pPassThru; + hr = pUnkSeek->QueryInterface(IID_ISeekingPassThru, (void**)&pPassThru); + if (FAILED(hr)) { + pUnkSeek->Release(); + return hr; + } + hr = pPassThru->Init(bRenderer, pPin); + pPassThru->Release(); + if (FAILED(hr)) { + pUnkSeek->Release(); + return hr; + } + *ppPassThru = pUnkSeek; + return S_OK; +} + + + +#define CONNECT_TRACE_LEVEL 3 + +//===================================================================== +//===================================================================== +// Implements CBaseMediaFilter +//===================================================================== +//===================================================================== + + +/* Constructor */ + +CBaseMediaFilter::CBaseMediaFilter(const TCHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid) : + CUnknown(pName, pUnk), + m_pLock(pLock), + m_clsid(clsid), + m_State(State_Stopped), + m_pClock(NULL) +{ +} + + +/* Destructor */ + +CBaseMediaFilter::~CBaseMediaFilter() +{ + // must be stopped, but can't call Stop here since + // our critsec has been destroyed. + + /* Release any clock we were using */ + + if (m_pClock) { + m_pClock->Release(); + m_pClock = NULL; + } +} + + +/* Override this to say what interfaces we support and where */ + +STDMETHODIMP +CBaseMediaFilter::NonDelegatingQueryInterface( + REFIID riid, + void ** ppv) +{ + if (riid == IID_IMediaFilter) { + return GetInterface((IMediaFilter *) this, ppv); + } else if (riid == IID_IPersist) { + return GetInterface((IPersist *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + +/* Return the filter's clsid */ +STDMETHODIMP +CBaseMediaFilter::GetClassID(CLSID *pClsID) +{ + CheckPointer(pClsID,E_POINTER); + ValidateReadWritePtr(pClsID,sizeof(CLSID)); + *pClsID = m_clsid; + return NOERROR; +} + +/* Override this if your state changes are not done synchronously */ + +STDMETHODIMP +CBaseMediaFilter::GetState(DWORD dwMSecs, FILTER_STATE *State) +{ + UNREFERENCED_PARAMETER(dwMSecs); + CheckPointer(State,E_POINTER); + ValidateReadWritePtr(State,sizeof(FILTER_STATE)); + + *State = m_State; + return S_OK; +} + + +/* Set the clock we will use for synchronisation */ + +STDMETHODIMP +CBaseMediaFilter::SetSyncSource(IReferenceClock *pClock) +{ + CAutoLock cObjectLock(m_pLock); + + // Ensure the new one does not go away - even if the same as the old + if (pClock) { + pClock->AddRef(); + } + + // if we have a clock, release it + if (m_pClock) { + m_pClock->Release(); + } + + // Set the new reference clock (might be NULL) + // Should we query it to ensure it is a clock? Consider for a debug build. + m_pClock = pClock; + + return NOERROR; +} + +/* Return the clock we are using for synchronisation */ +STDMETHODIMP +CBaseMediaFilter::GetSyncSource(IReferenceClock **pClock) +{ + CheckPointer(pClock,E_POINTER); + ValidateReadWritePtr(pClock,sizeof(IReferenceClock *)); + CAutoLock cObjectLock(m_pLock); + + if (m_pClock) { + // returning an interface... addref it... + m_pClock->AddRef(); + } + *pClock = (IReferenceClock*)m_pClock; + return NOERROR; +} + + +/* Put the filter into a stopped state */ + +STDMETHODIMP +CBaseMediaFilter::Stop() +{ + CAutoLock cObjectLock(m_pLock); + + m_State = State_Stopped; + return S_OK; +} + + +/* Put the filter into a paused state */ + +STDMETHODIMP +CBaseMediaFilter::Pause() +{ + CAutoLock cObjectLock(m_pLock); + + m_State = State_Paused; + return S_OK; +} + + +// Put the filter into a running state. + +// The time parameter is the offset to be added to the samples' +// stream time to get the reference time at which they should be presented. +// +// you can either add these two and compare it against the reference clock, +// or you can call CBaseMediaFilter::StreamTime and compare that against +// the sample timestamp. + +STDMETHODIMP +CBaseMediaFilter::Run(REFERENCE_TIME tStart) +{ + CAutoLock cObjectLock(m_pLock); + + // remember the stream time offset + m_tStart = tStart; + + if (m_State == State_Stopped){ + HRESULT hr = Pause(); + + if (FAILED(hr)) { + return hr; + } + } + m_State = State_Running; + return S_OK; +} + + +// +// return the current stream time - samples with start timestamps of this +// time or before should be rendered by now +HRESULT +CBaseMediaFilter::StreamTime(CRefTime& rtStream) +{ + // Caller must lock for synchronization + // We can't grab the filter lock because we want to be able to call + // this from worker threads without deadlocking + + if (m_pClock == NULL) { + return VFW_E_NO_CLOCK; + } + + // get the current reference time + HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream); + if (FAILED(hr)) { + return hr; + } + + // subtract the stream offset to get stream time + rtStream -= m_tStart; + + return S_OK; +} + + +//===================================================================== +//===================================================================== +// Implements CBaseFilter +//===================================================================== +//===================================================================== + + +/* Override this to say what interfaces we support and where */ + +STDMETHODIMP CBaseFilter::NonDelegatingQueryInterface(REFIID riid, + void **ppv) +{ + /* Do we have this interface */ + + if (riid == IID_IBaseFilter) { + return GetInterface((IBaseFilter *) this, ppv); + } else if (riid == IID_IMediaFilter) { + return GetInterface((IMediaFilter *) this, ppv); + } else if (riid == IID_IPersist) { + return GetInterface((IPersist *) this, ppv); + } else if (riid == IID_IAMovieSetup) { + return GetInterface((IAMovieSetup *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + +#ifdef DEBUG +STDMETHODIMP_(ULONG) CBaseFilter::NonDelegatingRelease() +{ + if (m_cRef == 1) { + KASSERT(m_pGraph == NULL); + } + return CUnknown::NonDelegatingRelease(); +} +#endif + + +/* Constructor */ + +CBaseFilter::CBaseFilter(const TCHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid) : + CUnknown( pName, pUnk ), + m_pLock(pLock), + m_clsid(clsid), + m_State(State_Stopped), + m_pClock(NULL), + m_pGraph(NULL), + m_pSink(NULL), + m_pName(NULL), + m_PinVersion(1) +{ + + ASSERT(pLock != NULL); +} + +/* Passes in a redundant HRESULT argument */ + +CBaseFilter::CBaseFilter(TCHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid, + HRESULT *phr) : + CUnknown( pName, pUnk ), + m_pLock(pLock), + m_clsid(clsid), + m_State(State_Stopped), + m_pClock(NULL), + m_pGraph(NULL), + m_pSink(NULL), + m_pName(NULL), + m_PinVersion(1) +{ + + ASSERT(pLock != NULL); + UNREFERENCED_PARAMETER(phr); +} + +#ifdef UNICODE +CBaseFilter::CBaseFilter(const CHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid) : + CUnknown( pName, pUnk ), + m_pLock(pLock), + m_clsid(clsid), + m_State(State_Stopped), + m_pClock(NULL), + m_pGraph(NULL), + m_pSink(NULL), + m_pName(NULL), + m_PinVersion(1) +{ + + ASSERT(pLock != NULL); +} +CBaseFilter::CBaseFilter(CHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid, + HRESULT *phr) : + CUnknown( pName, pUnk ), + m_pLock(pLock), + m_clsid(clsid), + m_State(State_Stopped), + m_pClock(NULL), + m_pGraph(NULL), + m_pSink(NULL), + m_pName(NULL), + m_PinVersion(1) +{ + + ASSERT(pLock != NULL); + UNREFERENCED_PARAMETER(phr); +} +#endif + +/* Destructor */ + +CBaseFilter::~CBaseFilter() +{ + + // NOTE we do NOT hold references on the filtergraph for m_pGraph or m_pSink + // When we did we had the circular reference problem. Nothing would go away. + + delete[] m_pName; + + // must be stopped, but can't call Stop here since + // our critsec has been destroyed. + + /* Release any clock we were using */ + if (m_pClock) { + m_pClock->Release(); + m_pClock = NULL; + } +} + +/* Return the filter's clsid */ +STDMETHODIMP +CBaseFilter::GetClassID(CLSID *pClsID) +{ + CheckPointer(pClsID,E_POINTER); + ValidateReadWritePtr(pClsID,sizeof(CLSID)); + *pClsID = m_clsid; + return NOERROR; +} + +/* Override this if your state changes are not done synchronously */ +STDMETHODIMP +CBaseFilter::GetState(DWORD dwMSecs, FILTER_STATE *State) +{ + UNREFERENCED_PARAMETER(dwMSecs); + CheckPointer(State,E_POINTER); + ValidateReadWritePtr(State,sizeof(FILTER_STATE)); + + *State = m_State; + return S_OK; +} + + +/* Set the clock we will use for synchronisation */ + +STDMETHODIMP +CBaseFilter::SetSyncSource(IReferenceClock *pClock) +{ + CAutoLock cObjectLock(m_pLock); + + // Ensure the new one does not go away - even if the same as the old + if (pClock) { + pClock->AddRef(); + } + + // if we have a clock, release it + if (m_pClock) { + m_pClock->Release(); + } + + // Set the new reference clock (might be NULL) + // Should we query it to ensure it is a clock? Consider for a debug build. + m_pClock = pClock; + + return NOERROR; +} + +/* Return the clock we are using for synchronisation */ +STDMETHODIMP +CBaseFilter::GetSyncSource(IReferenceClock **pClock) +{ + CheckPointer(pClock,E_POINTER); + ValidateReadWritePtr(pClock,sizeof(IReferenceClock *)); + CAutoLock cObjectLock(m_pLock); + + if (m_pClock) { + // returning an interface... addref it... + m_pClock->AddRef(); + } + *pClock = (IReferenceClock*)m_pClock; + return NOERROR; +} + + + +// override CBaseMediaFilter Stop method, to deactivate any pins this +// filter has. +STDMETHODIMP +CBaseFilter::Stop() +{ + CAutoLock cObjectLock(m_pLock); + HRESULT hr = NOERROR; + + // notify all pins of the state change + if (m_State != State_Stopped) { + int cPins = GetPinCount(); + for (int c = 0; c < cPins; c++) { + + CBasePin *pPin = GetPin(c); + + // Disconnected pins are not activated - this saves pins worrying + // about this state themselves. We ignore the return code to make + // sure everyone is inactivated regardless. The base input pin + // class can return an error if it has no allocator but Stop can + // be used to resync the graph state after something has gone bad + + if (pPin->IsConnected()) { + HRESULT hrTmp = pPin->Inactive(); + if (FAILED(hrTmp) && SUCCEEDED(hr)) { + hr = hrTmp; + } + } + } + } + + + m_State = State_Stopped; + return hr; +} + + +// override CBaseMediaFilter Pause method to activate any pins +// this filter has (also called from Run) + +STDMETHODIMP +CBaseFilter::Pause() +{ + CAutoLock cObjectLock(m_pLock); + + // notify all pins of the change to active state + if (m_State == State_Stopped) { + int cPins = GetPinCount(); + for (int c = 0; c < cPins; c++) { + + CBasePin *pPin = GetPin(c); + + // Disconnected pins are not activated - this saves pins + // worrying about this state themselves + + if (pPin->IsConnected()) { + HRESULT hr = pPin->Active(); + if (FAILED(hr)) { + return hr; + } + } + } + } + + + + m_State = State_Paused; + return S_OK; +} + +// Put the filter into a running state. + +// The time parameter is the offset to be added to the samples' +// stream time to get the reference time at which they should be presented. +// +// you can either add these two and compare it against the reference clock, +// or you can call CBaseFilter::StreamTime and compare that against +// the sample timestamp. + +STDMETHODIMP +CBaseFilter::Run(REFERENCE_TIME tStart) +{ + CAutoLock cObjectLock(m_pLock); + + // remember the stream time offset + m_tStart = tStart; + + if (m_State == State_Stopped){ + HRESULT hr = Pause(); + + if (FAILED(hr)) { + return hr; + } + } + // notify all pins of the change to active state + if (m_State != State_Running) { + int cPins = GetPinCount(); + for (int c = 0; c < cPins; c++) { + + CBasePin *pPin = GetPin(c); + + // Disconnected pins are not activated - this saves pins + // worrying about this state themselves + + if (pPin->IsConnected()) { + HRESULT hr = pPin->Run(tStart); + if (FAILED(hr)) { + return hr; + } + } + } + } + + + m_State = State_Running; + return S_OK; +} + +// +// return the current stream time - samples with start timestamps of this +// time or before should be rendered by now +HRESULT +CBaseFilter::StreamTime(CRefTime& rtStream) +{ + // Caller must lock for synchronization + // We can't grab the filter lock because we want to be able to call + // this from worker threads without deadlocking + + if (m_pClock == NULL) { + return VFW_E_NO_CLOCK; + } + + // get the current reference time + HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream); + if (FAILED(hr)) { + return hr; + } + + // subtract the stream offset to get stream time + rtStream -= m_tStart; + + return S_OK; +} + + +/* Create an enumerator for the pins attached to this filter */ + +STDMETHODIMP +CBaseFilter::EnumPins(IEnumPins **ppEnum) +{ + CheckPointer(ppEnum,E_POINTER); + ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *)); + + /* Create a new ref counted enumerator */ + + *ppEnum = new CEnumPins(this, + NULL); + + return *ppEnum == NULL ? E_OUTOFMEMORY : NOERROR; +} + + +// default behaviour of FindPin is to assume pins are named +// by their pin names +STDMETHODIMP +CBaseFilter::FindPin( + LPCWSTR Id, + IPin ** ppPin +) +{ + CheckPointer(ppPin,E_POINTER); + ValidateReadWritePtr(ppPin,sizeof(IPin *)); + + // We're going to search the pin list so maintain integrity + CAutoLock lck(m_pLock); + int iCount = GetPinCount(); + for (int i = 0; i < iCount; i++) { + CBasePin *pPin = GetPin(i); + ASSERT(pPin != NULL); + + if (0 == lstrcmpW(pPin->Name(), Id)) { + // Found one that matches + // + // AddRef() and return it + *ppPin = pPin; + pPin->AddRef(); + return S_OK; + } + } + *ppPin = NULL; + return VFW_E_NOT_FOUND; +} + +/* Return information about this filter */ + +STDMETHODIMP +CBaseFilter::QueryFilterInfo(FILTER_INFO * pInfo) +{ + CheckPointer(pInfo,E_POINTER); + ValidateReadWritePtr(pInfo,sizeof(FILTER_INFO)); + + if (m_pName) { + lstrcpynW(pInfo->achName, m_pName, sizeof(pInfo->achName)/sizeof(WCHAR)); + } else { + pInfo->achName[0] = L'\0'; + } + pInfo->pGraph = m_pGraph; + if (m_pGraph) + m_pGraph->AddRef(); + return NOERROR; +} + + +/* Provide the filter with a filter graph */ + +STDMETHODIMP +CBaseFilter::JoinFilterGraph( + IFilterGraph * pGraph, + LPCWSTR pName) +{ + CAutoLock cObjectLock(m_pLock); + + // NOTE: we no longer hold references on the graph (m_pGraph, m_pSink) + + m_pGraph = pGraph; + if (m_pGraph) { + HRESULT hr = m_pGraph->QueryInterface(IID_IMediaEventSink, + (void**) &m_pSink); + if (FAILED(hr)) { + ASSERT(m_pSink == NULL); + } + else m_pSink->Release(); // we do NOT keep a reference on it. + } else { + // if graph pointer is null, then we should + // also release the IMediaEventSink on the same object - we don't + // refcount it, so just set it to null + m_pSink = NULL; + } + + + if (m_pName) { + delete[] m_pName; + m_pName = NULL; + } + + if (pName) { + DWORD nameLen = lstrlenW(pName)+1; + m_pName = new WCHAR[nameLen]; + if (m_pName) { + CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); + } else { + // !!! error here? + ASSERT(FALSE); + } + } + + + return NOERROR; +} + + +// return a Vendor information string. Optional - may return E_NOTIMPL. +// memory returned should be freed using CoTaskMemFree +// default implementation returns E_NOTIMPL +STDMETHODIMP +CBaseFilter::QueryVendorInfo( + LPWSTR* pVendorInfo) +{ + UNREFERENCED_PARAMETER(pVendorInfo); + return E_NOTIMPL; +} + + +// send an event notification to the filter graph if we know about it. +// returns S_OK if delivered, S_FALSE if the filter graph does not sink +// events, or an error otherwise. +HRESULT +CBaseFilter::NotifyEvent( + long EventCode, + LONG_PTR EventParam1, + LONG_PTR EventParam2) +{ + // Snapshot so we don't have to lock up + IMediaEventSink *pSink = m_pSink; + if (pSink) { + if (EC_COMPLETE == EventCode) { + EventParam2 = (LONG_PTR)(IBaseFilter*)this; + } + + return pSink->Notify(EventCode, EventParam1, EventParam2); + } else { + return E_NOTIMPL; + } +} + +// Request reconnect +// pPin is the pin to reconnect +// pmt is the type to reconnect with - can be NULL +// Calls ReconnectEx on the filter graph +HRESULT +CBaseFilter::ReconnectPin( + IPin *pPin, + AM_MEDIA_TYPE const *pmt +) +{ + IFilterGraph2 *pGraph2; + if (m_pGraph != NULL) { + HRESULT hr = m_pGraph->QueryInterface(IID_IFilterGraph2, (void **)&pGraph2); + if (SUCCEEDED(hr)) { + hr = pGraph2->ReconnectEx(pPin, pmt); + pGraph2->Release(); + return hr; + } else { + return m_pGraph->Reconnect(pPin); + } + } else { + return E_NOINTERFACE; + } +} + + + +/* This is the same idea as the media type version does for type enumeration + on pins but for the list of pins available. So if the list of pins you + provide changes dynamically then either override this virtual function + to provide the version number, or more simply call IncrementPinVersion */ + +LONG CBaseFilter::GetPinVersion() +{ + return m_PinVersion; +} + + +/* Increment the current pin version cookie */ + +void CBaseFilter::IncrementPinVersion() +{ + InterlockedIncrement(&m_PinVersion); +} + +/* register filter */ + +STDMETHODIMP CBaseFilter::Register() +{ + // get setup data, if it exists + // + LPAMOVIESETUP_FILTER psetupdata = GetSetupData(); + + // check we've got data + // + if( NULL == psetupdata ) return S_FALSE; + + // init is ref counted so call just in case + // we're being called cold. + // + HRESULT hr = CoInitialize( (LPVOID)NULL ); + ASSERT( SUCCEEDED(hr) ); + + // get hold of IFilterMapper + // + IFilterMapper *pIFM; + hr = CoCreateInstance( CLSID_FilterMapper + , NULL + , CLSCTX_INPROC_SERVER + , IID_IFilterMapper + , (void **)&pIFM ); + if( SUCCEEDED(hr) ) + { + hr = AMovieSetupRegisterFilter( psetupdata, pIFM, TRUE ); + pIFM->Release(); + } + + // and clear up + // + CoFreeUnusedLibraries(); + CoUninitialize(); + + return NOERROR; +} + + +/* unregister filter */ + +STDMETHODIMP CBaseFilter::Unregister() +{ + // get setup data, if it exists + // + LPAMOVIESETUP_FILTER psetupdata = GetSetupData(); + + // check we've got data + // + if( NULL == psetupdata ) return S_FALSE; + + // OLE init is ref counted so call + // just in case we're being called cold. + // + HRESULT hr = CoInitialize( (LPVOID)NULL ); + ASSERT( SUCCEEDED(hr) ); + + // get hold of IFilterMapper + // + IFilterMapper *pIFM; + hr = CoCreateInstance( CLSID_FilterMapper + , NULL + , CLSCTX_INPROC_SERVER + , IID_IFilterMapper + , (void **)&pIFM ); + if( SUCCEEDED(hr) ) + { + hr = AMovieSetupRegisterFilter( psetupdata, pIFM, FALSE ); + + // release interface + // + pIFM->Release(); + } + + // clear up + // + CoFreeUnusedLibraries(); + CoUninitialize(); + + // handle one acceptable "error" - that + // of filter not being registered! + // (couldn't find a suitable #define'd + // name for the error!) + // + if( 0x80070002 == hr) + return NOERROR; + else + return hr; +} + + +//===================================================================== +//===================================================================== +// Implements CEnumPins +//===================================================================== +//===================================================================== + + +CEnumPins::CEnumPins(CBaseFilter *pFilter, + CEnumPins *pEnumPins) : + m_Position(0), + m_PinCount(0), + m_pFilter(pFilter), + m_cRef(1), // Already ref counted + m_PinCache(NAME("Pin Cache")) +{ + +#ifdef DEBUG + m_dwCookie = DbgRegisterObjectCreation("CEnumPins", 0); +#endif + + /* We must be owned by a filter derived from CBaseFilter */ + + ASSERT(pFilter != NULL); + + /* Hold a reference count on our filter */ + m_pFilter->AddRef(); + + /* Are we creating a new enumerator */ + + if (pEnumPins == NULL) { + m_Version = m_pFilter->GetPinVersion(); + m_PinCount = m_pFilter->GetPinCount(); + } else { + ASSERT(m_Position <= m_PinCount); + m_Position = pEnumPins->m_Position; + m_PinCount = pEnumPins->m_PinCount; + m_Version = pEnumPins->m_Version; + m_PinCache.AddTail(&(pEnumPins->m_PinCache)); + } +} + + +/* Destructor releases the reference count on our filter NOTE since we hold + a reference count on the filter who created us we know it is safe to + release it, no access can be made to it afterwards though as we have just + caused the last reference count to go and the object to be deleted */ + +CEnumPins::~CEnumPins() +{ + m_pFilter->Release(); + +#ifdef DEBUG + DbgRegisterObjectDestruction(m_dwCookie); +#endif +} + + +/* Override this to say what interfaces we support where */ + +STDMETHODIMP +CEnumPins::QueryInterface(REFIID riid,void **ppv) +{ + CheckPointer(ppv, E_POINTER); + + /* Do we have this interface */ + + if (riid == IID_IEnumPins || riid == IID_IUnknown) { + return GetInterface((IEnumPins *) this, ppv); + } else { + *ppv = NULL; + return E_NOINTERFACE; + } +} + +STDMETHODIMP_(ULONG) +CEnumPins::AddRef() +{ + return InterlockedIncrement(&m_cRef); +} + +STDMETHODIMP_(ULONG) +CEnumPins::Release() +{ + ULONG cRef = InterlockedDecrement(&m_cRef); + if (cRef == 0) { + delete this; + } + return cRef; +} + +/* One of an enumerator's basic member functions allows us to create a cloned + interface that initially has the same state. Since we are taking a snapshot + of an object (current position and all) we must lock access at the start */ + +STDMETHODIMP +CEnumPins::Clone(IEnumPins **ppEnum) +{ + CheckPointer(ppEnum,E_POINTER); + ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *)); + HRESULT hr = NOERROR; + + /* Check we are still in sync with the filter */ + if (AreWeOutOfSync() == TRUE) { + *ppEnum = NULL; + hr = VFW_E_ENUM_OUT_OF_SYNC; + } else { + + *ppEnum = new CEnumPins(m_pFilter, + this); + if (*ppEnum == NULL) { + hr = E_OUTOFMEMORY; + } + } + return hr; +} + + +/* Return the next pin after the current position */ + +STDMETHODIMP +CEnumPins::Next(ULONG cPins, // place this many pins... + IPin **ppPins, // ...in this array + ULONG *pcFetched) // actual count passed returned here +{ + CheckPointer(ppPins,E_POINTER); + ValidateReadWritePtr(ppPins,cPins * sizeof(IPin *)); + + ASSERT(ppPins); + + if (pcFetched!=NULL) { + ValidateWritePtr(pcFetched, sizeof(ULONG)); + *pcFetched = 0; // default unless we succeed + } + // now check that the parameter is valid + else if (cPins>1) { // pcFetched == NULL + return E_INVALIDARG; + } + ULONG cFetched = 0; // increment as we get each one. + + /* Check we are still in sync with the filter */ + if (AreWeOutOfSync() == TRUE) { + // If we are out of sync, we should refresh the enumerator. + // This will reset the position and update the other members, but + // will not clear cache of pins we have already returned. + Refresh(); + } + + /* Calculate the number of available pins */ + + int cRealPins = min(m_PinCount - m_Position, (int) cPins); + if (cRealPins == 0) { + return S_FALSE; + } + + /* Return each pin interface NOTE GetPin returns CBasePin * not addrefed + so we must QI for the IPin (which increments its reference count) + If while we are retrieving a pin from the filter an error occurs we + assume that our internal state is stale with respect to the filter + (for example someone has deleted a pin) so we + return VFW_E_ENUM_OUT_OF_SYNC */ + + while (cRealPins && (m_PinCount - m_Position)) { + + /* Get the next pin object from the filter */ + + CBasePin *pPin = m_pFilter->GetPin(m_Position++); + if (pPin == NULL) { + // If this happend, and it's not the first time through, then we've got a problem, + // since we should really go back and release the iPins, which we have previously + // AddRef'ed. + ASSERT( cFetched==0 ); + return VFW_E_ENUM_OUT_OF_SYNC; + } + + /* We only want to return this pin, if it is not in our cache */ + if (0 == m_PinCache.Find(pPin)) + { + /* From the object get an IPin interface */ + + *ppPins = pPin; + pPin->AddRef(); + + cFetched++; + ppPins++; + + m_PinCache.AddTail(pPin); + + cRealPins--; + + } + } + + if (pcFetched!=NULL) { + *pcFetched = cFetched; + } + + return (cPins==cFetched ? NOERROR : S_FALSE); +} + + +/* Skip over one or more entries in the enumerator */ + +STDMETHODIMP +CEnumPins::Skip(ULONG cPins) +{ + /* Check we are still in sync with the filter */ + if (AreWeOutOfSync() == TRUE) { + return VFW_E_ENUM_OUT_OF_SYNC; + } + + /* Work out how many pins are left to skip over */ + /* We could position at the end if we are asked to skip too many... */ + /* ..which would match the base implementation for CEnumMediaTypes::Skip */ + + ULONG PinsLeft = m_PinCount - m_Position; + if (cPins > PinsLeft) { + return S_FALSE; + } + m_Position += cPins; + return NOERROR; +} + + +/* Set the current position back to the start */ +/* Reset has 4 simple steps: + * + * Set position to head of list + * Sync enumerator with object being enumerated + * Clear the cache of pins already returned + * return S_OK + */ + +STDMETHODIMP +CEnumPins::Reset() +{ + m_Version = m_pFilter->GetPinVersion(); + m_PinCount = m_pFilter->GetPinCount(); + + m_Position = 0; + + // Clear the cache + m_PinCache.RemoveAll(); + + return S_OK; +} + + +/* Set the current position back to the start */ +/* Refresh has 3 simple steps: + * + * Set position to head of list + * Sync enumerator with object being enumerated + * return S_OK + */ + +STDMETHODIMP +CEnumPins::Refresh() +{ + m_Version = m_pFilter->GetPinVersion(); + m_PinCount = m_pFilter->GetPinCount(); + + m_Position = 0; + return S_OK; +} + + +//===================================================================== +//===================================================================== +// Implements CEnumMediaTypes +//===================================================================== +//===================================================================== + + +CEnumMediaTypes::CEnumMediaTypes(CBasePin *pPin, + CEnumMediaTypes *pEnumMediaTypes) : + m_Position(0), + m_pPin(pPin), + m_cRef(1) +{ + +#ifdef DEBUG + m_dwCookie = DbgRegisterObjectCreation("CEnumMediaTypes", 0); +#endif + + /* We must be owned by a pin derived from CBasePin */ + + ASSERT(pPin != NULL); + + /* Hold a reference count on our pin */ + m_pPin->AddRef(); + + /* Are we creating a new enumerator */ + + if (pEnumMediaTypes == NULL) { + m_Version = m_pPin->GetMediaTypeVersion(); + return; + } + + m_Position = pEnumMediaTypes->m_Position; + m_Version = pEnumMediaTypes->m_Version; +} + + +/* Destructor releases the reference count on our base pin. NOTE since we hold + a reference count on the pin who created us we know it is safe to release + it, no access can be made to it afterwards though as we might have just + caused the last reference count to go and the object to be deleted */ + +CEnumMediaTypes::~CEnumMediaTypes() +{ +#ifdef DEBUG + DbgRegisterObjectDestruction(m_dwCookie); +#endif + m_pPin->Release(); +} + + +/* Override this to say what interfaces we support where */ + +STDMETHODIMP +CEnumMediaTypes::QueryInterface(REFIID riid,void **ppv) +{ + CheckPointer(ppv, E_POINTER); + + /* Do we have this interface */ + + if (riid == IID_IEnumMediaTypes || riid == IID_IUnknown) { + return GetInterface((IEnumMediaTypes *) this, ppv); + } else { + *ppv = NULL; + return E_NOINTERFACE; + } +} + +STDMETHODIMP_(ULONG) +CEnumMediaTypes::AddRef() +{ + return InterlockedIncrement(&m_cRef); +} + +STDMETHODIMP_(ULONG) +CEnumMediaTypes::Release() +{ + ULONG cRef = InterlockedDecrement(&m_cRef); + if (cRef == 0) { + delete this; + } + return cRef; +} + +/* One of an enumerator's basic member functions allows us to create a cloned + interface that initially has the same state. Since we are taking a snapshot + of an object (current position and all) we must lock access at the start */ + +STDMETHODIMP +CEnumMediaTypes::Clone(IEnumMediaTypes **ppEnum) +{ + CheckPointer(ppEnum,E_POINTER); + ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *)); + HRESULT hr = NOERROR; + + /* Check we are still in sync with the pin */ + if (AreWeOutOfSync() == TRUE) { + *ppEnum = NULL; + hr = VFW_E_ENUM_OUT_OF_SYNC; + } else { + + *ppEnum = new CEnumMediaTypes(m_pPin, + this); + + if (*ppEnum == NULL) { + hr = E_OUTOFMEMORY; + } + } + return hr; +} + + +/* Enumerate the next pin(s) after the current position. The client using this + interface passes in a pointer to an array of pointers each of which will + be filled in with a pointer to a fully initialised media type format + Return NOERROR if it all works, + S_FALSE if fewer than cMediaTypes were enumerated. + VFW_E_ENUM_OUT_OF_SYNC if the enumerator has been broken by + state changes in the filter + The actual count always correctly reflects the number of types in the array. +*/ + +STDMETHODIMP +CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types... + AM_MEDIA_TYPE **ppMediaTypes, // ...in this array + ULONG *pcFetched) // actual count passed +{ + CheckPointer(ppMediaTypes,E_POINTER); + ValidateReadWritePtr(ppMediaTypes,cMediaTypes * sizeof(AM_MEDIA_TYPE *)); + /* Check we are still in sync with the pin */ + if (AreWeOutOfSync() == TRUE) { + return VFW_E_ENUM_OUT_OF_SYNC; + } + + if (pcFetched!=NULL) { + ValidateWritePtr(pcFetched, sizeof(ULONG)); + *pcFetched = 0; // default unless we succeed + } + // now check that the parameter is valid + else if (cMediaTypes>1) { // pcFetched == NULL + return E_INVALIDARG; + } + ULONG cFetched = 0; // increment as we get each one. + + /* Return each media type by asking the filter for them in turn - If we + have an error code retured to us while we are retrieving a media type + we assume that our internal state is stale with respect to the filter + (for example the window size changing) so we return + VFW_E_ENUM_OUT_OF_SYNC */ + + while (cMediaTypes) { + + CMediaType cmt; + + HRESULT hr = m_pPin->GetMediaType(m_Position++, &cmt); + if (S_OK != hr) { + break; + } + + /* We now have a CMediaType object that contains the next media type + but when we assign it to the array position we CANNOT just assign + the AM_MEDIA_TYPE structure because as soon as the object goes out of + scope it will delete the memory we have just copied. The function + we use is CreateMediaType which allocates a task memory block */ + + /* Transfer across the format block manually to save an allocate + and free on the format block and generally go faster */ + + *ppMediaTypes = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + if (*ppMediaTypes == NULL) { + break; + } + + /* Do a regular copy */ + **ppMediaTypes = (AM_MEDIA_TYPE)cmt; + + /* Make sure the destructor doesn't free these */ + cmt.pbFormat = NULL; + cmt.cbFormat = NULL; + cmt.pUnk = NULL; + + + ppMediaTypes++; + cFetched++; + cMediaTypes--; + } + + if (pcFetched!=NULL) { + *pcFetched = cFetched; + } + + return ( cMediaTypes==0 ? NOERROR : S_FALSE ); +} + + +/* Skip over one or more entries in the enumerator */ + +STDMETHODIMP +CEnumMediaTypes::Skip(ULONG cMediaTypes) +{ + // If we're skipping 0 elements we're guaranteed to skip the + // correct number of elements + if (cMediaTypes == 0) { + return S_OK; + } + + /* Check we are still in sync with the pin */ + if (AreWeOutOfSync() == TRUE) { + return VFW_E_ENUM_OUT_OF_SYNC; + } + + m_Position += cMediaTypes; + + /* See if we're over the end */ + CMediaType cmt; + return S_OK == m_pPin->GetMediaType(m_Position - 1, &cmt) ? S_OK : S_FALSE; +} + + +/* Set the current position back to the start */ +/* Reset has 3 simple steps: + * + * set position to head of list + * sync enumerator with object being enumerated + * return S_OK + */ + +STDMETHODIMP +CEnumMediaTypes::Reset() + +{ + m_Position = 0; + + // Bring the enumerator back into step with the current state. This + // may be a noop but ensures that the enumerator will be valid on the + // next call. + m_Version = m_pPin->GetMediaTypeVersion(); + return NOERROR; +} + + +//===================================================================== +//===================================================================== +// Implements CBasePin +//===================================================================== +//===================================================================== + + +/* NOTE The implementation of this class calls the CUnknown constructor with + a NULL outer unknown pointer. This has the effect of making us a self + contained class, ie any QueryInterface, AddRef or Release calls will be + routed to the class's NonDelegatingUnknown methods. You will typically + find that the classes that do this then override one or more of these + virtual functions to provide more specialised behaviour. A good example + of this is where a class wants to keep the QueryInterface internal but + still wants its lifetime controlled by the external object */ + +/* Constructor */ + +CBasePin::CBasePin(TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName, + PIN_DIRECTION dir) : + CUnknown( pObjectName, NULL ), + m_pFilter(pFilter), + m_pLock(pLock), + m_pName(NULL), + m_Connected(NULL), + m_dir(dir), + m_bRunTimeError(FALSE), + m_pQSink(NULL), + m_TypeVersion(1), + m_tStart(), + m_tStop(MAX_TIME), + m_bCanReconnectWhenActive(false), + m_bTryMyTypesFirst(false), + m_dRate(1.0) +{ + /* WARNING - pFilter is often not a properly constituted object at + this state (in particular QueryInterface may not work) - this + is because its owner is often its containing object and we + have been called from the containing object's constructor so + the filter's owner has not yet had its CUnknown constructor + called + */ + + ASSERT(pFilter != NULL); + ASSERT(pLock != NULL); + + if (pName) { + DWORD nameLen = lstrlenW(pName)+1; + m_pName = new WCHAR[nameLen]; + if (m_pName) { + CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); + } + } + +#ifdef DEBUG + m_cRef = 0; +#endif +} + +#ifdef UNICODE +CBasePin::CBasePin(CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName, + PIN_DIRECTION dir) : + CUnknown( pObjectName, NULL ), + m_pFilter(pFilter), + m_pLock(pLock), + m_pName(NULL), + m_Connected(NULL), + m_dir(dir), + m_bRunTimeError(FALSE), + m_pQSink(NULL), + m_TypeVersion(1), + m_tStart(), + m_tStop(MAX_TIME), + m_bCanReconnectWhenActive(false), + m_bTryMyTypesFirst(false), + m_dRate(1.0) +{ + /* WARNING - pFilter is often not a properly constituted object at + this state (in particular QueryInterface may not work) - this + is because its owner is often its containing object and we + have been called from the containing object's constructor so + the filter's owner has not yet had its CUnknown constructor + called + */ + + ASSERT(pFilter != NULL); + ASSERT(pLock != NULL); + + if (pName) { + DWORD nameLen = lstrlenW(pName)+1; + m_pName = new WCHAR[nameLen]; + if (m_pName) { + CopyMemory(m_pName, pName, nameLen*sizeof(WCHAR)); + } + } + +#ifdef DEBUG + m_cRef = 0; +#endif +} +#endif + +/* Destructor since a connected pin holds a reference count on us there is + no way that we can be deleted unless we are not currently connected */ + +CBasePin::~CBasePin() +{ + + // We don't call disconnect because if the filter is going away + // all the pins must have a reference count of zero so they must + // have been disconnected anyway - (but check the assumption) + ASSERT(m_Connected == FALSE); + + delete[] m_pName; + + // check the internal reference count is consistent + ASSERT(m_cRef == 0); +} + + +/* Override this to say what interfaces we support and where */ + +STDMETHODIMP +CBasePin::NonDelegatingQueryInterface(REFIID riid, void ** ppv) +{ + /* Do we have this interface */ + + if (riid == IID_IPin) { + return GetInterface((IPin *) this, ppv); + } else if (riid == IID_IQualityControl) { + return GetInterface((IQualityControl *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +/* Override to increment the owning filter's reference count */ + +STDMETHODIMP_(ULONG) +CBasePin::NonDelegatingAddRef() +{ + ASSERT(InterlockedIncrement(&m_cRef) > 0); + return m_pFilter->AddRef(); +} + + +/* Override to decrement the owning filter's reference count */ + +STDMETHODIMP_(ULONG) +CBasePin::NonDelegatingRelease() +{ + ASSERT(InterlockedDecrement(&m_cRef) >= 0); + return m_pFilter->Release(); +} + + +/* Displays pin connection information */ + +#ifdef DEBUG +void +CBasePin::DisplayPinInfo(IPin *pReceivePin) +{ + + if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) { + PIN_INFO ConnectPinInfo; + PIN_INFO ReceivePinInfo; + + if (FAILED(QueryPinInfo(&ConnectPinInfo))) { + lstrcpyW(ConnectPinInfo.achName, L"Bad Pin"); + } else { + QueryPinInfoReleaseFilter(ConnectPinInfo); + } + + if (FAILED(pReceivePin->QueryPinInfo(&ReceivePinInfo))) { + lstrcpyW(ReceivePinInfo.achName, L"Bad Pin"); + } else { + QueryPinInfoReleaseFilter(ReceivePinInfo); + } + + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Trying to connect Pins :"))); + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" <%ls>"), ConnectPinInfo.achName)); + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" <%ls>"), ReceivePinInfo.achName)); + } +} +#endif + + +/* Displays general information on the pin media type */ + +#ifdef DEBUG +void CBasePin::DisplayTypeInfo(IPin *pPin, const CMediaType *pmt) +{ + UNREFERENCED_PARAMETER(pPin); + if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) { + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Trying media type:"))); + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" major type: %hs"), + GuidNames[*pmt->Type()])); + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" sub type : %hs"), + GuidNames[*pmt->Subtype()])); + } +} +#endif + +/* Asked to connect to a pin. A pin is always attached to an owning filter + object so we always delegate our locking to that object. We first of all + retrieve a media type enumerator for the input pin and see if we accept + any of the formats that it would ideally like, failing that we retrieve + our enumerator and see if it will accept any of our preferred types */ + +STDMETHODIMP +CBasePin::Connect( + IPin * pReceivePin, + const AM_MEDIA_TYPE *pmt // optional media type +) +{ + CheckPointer(pReceivePin,E_POINTER); + ValidateReadPtr(pReceivePin,sizeof(IPin)); + CAutoLock cObjectLock(m_pLock); + DisplayPinInfo(pReceivePin); + + /* See if we are already connected */ + + if (m_Connected) { + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Already connected"))); + return VFW_E_ALREADY_CONNECTED; + } + + /* See if the filter is active */ + if (!IsStopped() && !m_bCanReconnectWhenActive) { + return VFW_E_NOT_STOPPED; + } + + + // Find a mutually agreeable media type - + // Pass in the template media type. If this is partially specified, + // each of the enumerated media types will need to be checked against + // it. If it is non-null and fully specified, we will just try to connect + // with this. + + const CMediaType * ptype = (CMediaType*)pmt; + HRESULT hr = AgreeMediaType(pReceivePin, ptype); + if (FAILED(hr)) { + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Failed to agree type"))); + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + + return hr; + } + + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Connection succeeded"))); + + + return NOERROR; +} + +// given a specific media type, attempt a connection (includes +// checking that the type is acceptable to this pin) +HRESULT +CBasePin::AttemptConnection( + IPin* pReceivePin, // connect to this pin + const CMediaType* pmt // using this type +) +{ + // The caller should hold the filter lock becasue this function + // uses m_Connected. The caller should also hold the filter lock + // because this function calls SetMediaType(), IsStopped() and + // CompleteConnect(). + ASSERT(CritCheckIn(m_pLock)); + + // Check that the connection is valid -- need to do this for every + // connect attempt since BreakConnect will undo it. + HRESULT hr = CheckConnect(pReceivePin); + if (FAILED(hr)) { + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("CheckConnect failed"))); + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + return hr; + } + + DisplayTypeInfo(pReceivePin, pmt); + + /* Check we will accept this media type */ + + hr = CheckMediaType(pmt); + if (hr == NOERROR) { + + /* Make ourselves look connected otherwise ReceiveConnection + may not be able to complete the connection + */ + m_Connected = pReceivePin; + m_Connected->AddRef(); + hr = SetMediaType(pmt); + if (SUCCEEDED(hr)) { + /* See if the other pin will accept this type */ + + hr = pReceivePin->ReceiveConnection((IPin *)this, pmt); + if (SUCCEEDED(hr)) { + /* Complete the connection */ + + hr = CompleteConnect(pReceivePin); + if (SUCCEEDED(hr)) { + return hr; + } else { + DbgLog((LOG_TRACE, + CONNECT_TRACE_LEVEL, + TEXT("Failed to complete connection"))); + pReceivePin->Disconnect(); + } + } + } + } else { + // we cannot use this media type + + // return a specific media type error if there is one + // or map a general failure code to something more helpful + // (in particular S_FALSE gets changed to an error code) + if (SUCCEEDED(hr) || + (hr == E_FAIL) || + (hr == E_INVALIDARG)) { + hr = VFW_E_TYPE_NOT_ACCEPTED; + } + } + + // BreakConnect and release any connection here in case CheckMediaType + // failed, or if we set anything up during a call back during + // ReceiveConnection. + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + /* If failed then undo our state */ + if (m_Connected) { + m_Connected->Release(); + m_Connected = NULL; + } + + return hr; +} + +/* Given an enumerator we cycle through all the media types it proposes and + firstly suggest them to our derived pin class and if that succeeds try + them with the pin in a ReceiveConnection call. This means that if our pin + proposes a media type we still check in here that we can support it. This + is deliberate so that in simple cases the enumerator can hold all of the + media types even if some of them are not really currently available */ + +HRESULT CBasePin::TryMediaTypes( + IPin *pReceivePin, + const CMediaType *pmt, + IEnumMediaTypes *pEnum) +{ + /* Reset the current enumerator position */ + + HRESULT hr = pEnum->Reset(); + if (FAILED(hr)) { + return hr; + } + + CMediaType *pMediaType = NULL; + ULONG ulMediaCount = 0; + + // attempt to remember a specific error code if there is one + HRESULT hrFailure = S_OK; + + for (;;) { + + /* Retrieve the next media type NOTE each time round the loop the + enumerator interface will allocate another AM_MEDIA_TYPE structure + If we are successful then we copy it into our output object, if + not then we must delete the memory allocated before returning */ + + hr = pEnum->Next(1, (AM_MEDIA_TYPE**)&pMediaType,&ulMediaCount); + if (hr != S_OK) { + if (S_OK == hrFailure) { + hrFailure = VFW_E_NO_ACCEPTABLE_TYPES; + } + return hrFailure; + } + + + ASSERT(ulMediaCount == 1); + ASSERT(pMediaType); + + // check that this matches the partial type (if any) + + if ((pmt == NULL) || + pMediaType->MatchesPartial(pmt)) { + + hr = AttemptConnection(pReceivePin, pMediaType); + + // attempt to remember a specific error code + if (FAILED(hr) && + SUCCEEDED(hrFailure) && + (hr != E_FAIL) && + (hr != E_INVALIDARG) && + (hr != VFW_E_TYPE_NOT_ACCEPTED)) { + hrFailure = hr; + } + } else { + hr = VFW_E_NO_ACCEPTABLE_TYPES; + } + + DeleteMediaType(pMediaType); + + if (S_OK == hr) { + return hr; + } + } +} + + +/* This is called to make the connection, including the taask of finding + a media type for the pin connection. pmt is the proposed media type + from the Connect call: if this is fully specified, we will try that. + Otherwise we enumerate and try all the input pin's types first and + if that fails we then enumerate and try all our preferred media types. + For each media type we check it against pmt (if non-null and partially + specified) as well as checking that both pins will accept it. + */ + +HRESULT CBasePin::AgreeMediaType( + IPin *pReceivePin, + const CMediaType *pmt) +{ + ASSERT(pReceivePin); + IEnumMediaTypes *pEnumMediaTypes = NULL; + + // if the media type is fully specified then use that + if ( (pmt != NULL) && (!pmt->IsPartiallySpecified())) { + + // if this media type fails, then we must fail the connection + // since if pmt is nonnull we are only allowed to connect + // using a type that matches it. + + return AttemptConnection(pReceivePin, pmt); + } + + + /* Try the other pin's enumerator */ + + HRESULT hrFailure = VFW_E_NO_ACCEPTABLE_TYPES; + + for (int i = 0; i < 2; i++) { + HRESULT hr; + if (i == (int)m_bTryMyTypesFirst) { + hr = pReceivePin->EnumMediaTypes(&pEnumMediaTypes); + } else { + hr = EnumMediaTypes(&pEnumMediaTypes); + } + if (SUCCEEDED(hr)) { + ASSERT(pEnumMediaTypes); + hr = TryMediaTypes(pReceivePin,pmt,pEnumMediaTypes); + pEnumMediaTypes->Release(); + if (SUCCEEDED(hr)) { + return NOERROR; + } else { + // try to remember specific error codes if there are any + if ((hr != E_FAIL) && + (hr != E_INVALIDARG) && + (hr != VFW_E_TYPE_NOT_ACCEPTED)) { + hrFailure = hr; + } + } + } + } + + return hrFailure; +} + + +/* Called when we want to complete a connection to another filter. Failing + this will also fail the connection and disconnect the other pin as well */ + +HRESULT +CBasePin::CompleteConnect(IPin *pReceivePin) +{ + UNREFERENCED_PARAMETER(pReceivePin); + return NOERROR; +} + + +/* This is called to set the format for a pin connection - CheckMediaType + will have been called to check the connection format and if it didn't + return an error code then this (virtual) function will be invoked */ + +HRESULT +CBasePin::SetMediaType(const CMediaType *pmt) +{ + HRESULT hr = m_mt.Set(*pmt); + if (FAILED(hr)) { + return hr; + } + + return NOERROR; +} + + +/* This is called during Connect() to provide a virtual method that can do + any specific check needed for connection such as QueryInterface. This + base class method just checks that the pin directions don't match */ + +HRESULT +CBasePin::CheckConnect(IPin * pPin) +{ + /* Check that pin directions DONT match */ + + PIN_DIRECTION pd; + pPin->QueryDirection(&pd); + + ASSERT((pd == PINDIR_OUTPUT) || (pd == PINDIR_INPUT)); + ASSERT((m_dir == PINDIR_OUTPUT) || (m_dir == PINDIR_INPUT)); + + // we should allow for non-input and non-output connections? + if (pd == m_dir) { + return VFW_E_INVALID_DIRECTION; + } + return NOERROR; +} + + +/* This is called when we realise we can't make a connection to the pin and + must undo anything we did in CheckConnect - override to release QIs done */ + +HRESULT +CBasePin::BreakConnect() +{ + return NOERROR; +} + + +/* Called normally by an output pin on an input pin to try and establish a + connection. +*/ + +STDMETHODIMP +CBasePin::ReceiveConnection( + IPin * pConnector, // this is the pin who we will connect to + const AM_MEDIA_TYPE *pmt // this is the media type we will exchange +) +{ + CheckPointer(pConnector,E_POINTER); + CheckPointer(pmt,E_POINTER); + ValidateReadPtr(pConnector,sizeof(IPin)); + ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE)); + CAutoLock cObjectLock(m_pLock); + + /* Are we already connected */ + if (m_Connected) { + return VFW_E_ALREADY_CONNECTED; + } + + /* See if the filter is active */ + if (!IsStopped() && !m_bCanReconnectWhenActive) { + return VFW_E_NOT_STOPPED; + } + + HRESULT hr = CheckConnect(pConnector); + if (FAILED(hr)) { + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + + return hr; + } + + /* Ask derived class if this media type is ok */ + + CMediaType * pcmt = (CMediaType*) pmt; + hr = CheckMediaType(pcmt); + if (hr != NOERROR) { + // no -we don't support this media type + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + // return a specific media type error if there is one + // or map a general failure code to something more helpful + // (in particular S_FALSE gets changed to an error code) + if (SUCCEEDED(hr) || + (hr == E_FAIL) || + (hr == E_INVALIDARG)) { + hr = VFW_E_TYPE_NOT_ACCEPTED; + } + + + return hr; + } + + /* Complete the connection */ + + m_Connected = pConnector; + m_Connected->AddRef(); + hr = SetMediaType(pcmt); + if (SUCCEEDED(hr)) { + hr = CompleteConnect(pConnector); + if (SUCCEEDED(hr)) { + + + return NOERROR; + } + } + + DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Failed to set the media type or failed to complete the connection."))); + m_Connected->Release(); + m_Connected = NULL; + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) ); + + + return hr; +} + + +/* Called when we want to terminate a pin connection */ + +STDMETHODIMP +CBasePin::Disconnect() +{ + CAutoLock cObjectLock(m_pLock); + + /* See if the filter is active */ + if (!IsStopped()) { + return VFW_E_NOT_STOPPED; + } + + return DisconnectInternal(); +} + +STDMETHODIMP +CBasePin::DisconnectInternal() +{ + ASSERT(CritCheckIn(m_pLock)); + + if (m_Connected) { + HRESULT hr = BreakConnect(); + if( FAILED( hr ) ) { + + + // There is usually a bug in the program if BreakConnect() fails. + DbgBreak( "WARNING: BreakConnect() failed in CBasePin::Disconnect()." ); + return hr; + } + + m_Connected->Release(); + m_Connected = NULL; + + + return S_OK; + } else { + // no connection - not an error + + + return S_FALSE; + } +} + + +/* Return an AddRef()'d pointer to the connected pin if there is one */ +STDMETHODIMP +CBasePin::ConnectedTo( + IPin **ppPin +) +{ + CheckPointer(ppPin,E_POINTER); + ValidateReadWritePtr(ppPin,sizeof(IPin *)); + // + // It's pointless to lock here. + // The caller should ensure integrity. + // + + IPin *pPin = m_Connected; + *ppPin = pPin; + if (pPin != NULL) { + pPin->AddRef(); + return S_OK; + } else { + ASSERT(*ppPin == NULL); + return VFW_E_NOT_CONNECTED; + } +} + +#pragma warning(disable:4702) // Unreachable code at return + +/* Return the media type of the connection */ +STDMETHODIMP +CBasePin::ConnectionMediaType( + AM_MEDIA_TYPE *pmt +) +{ + CheckPointer(pmt,E_POINTER); + ValidateReadWritePtr(pmt,sizeof(AM_MEDIA_TYPE)); + CAutoLock cObjectLock(m_pLock); + + /* Copy constructor of m_mt allocates the memory */ + if (IsConnected()) { + CopyMediaType( pmt, &m_mt ); + return S_OK; + } else { + ((CMediaType *)pmt)->InitMediaType(); + return VFW_E_NOT_CONNECTED; + } +} + +#pragma warning(default:4702) // Unreachable code at return + +/* Return information about the filter we are connect to */ + +STDMETHODIMP +CBasePin::QueryPinInfo( + PIN_INFO * pInfo +) +{ + CheckPointer(pInfo,E_POINTER); + ValidateReadWritePtr(pInfo,sizeof(PIN_INFO)); + + pInfo->pFilter = m_pFilter; + if (m_pFilter) { + m_pFilter->AddRef(); + } + + if (m_pName) { + lstrcpynW(pInfo->achName, m_pName, sizeof(pInfo->achName)/sizeof(WCHAR)); + } else { + pInfo->achName[0] = L'\0'; + } + + pInfo->dir = m_dir; + + return NOERROR; +} + +STDMETHODIMP +CBasePin::QueryDirection( + PIN_DIRECTION * pPinDir +) +{ + CheckPointer(pPinDir,E_POINTER); + ValidateReadWritePtr(pPinDir,sizeof(PIN_DIRECTION)); + + *pPinDir = m_dir; + return NOERROR; +} + +// Default QueryId to return the pin's name +STDMETHODIMP +CBasePin::QueryId( + LPWSTR * Id +) +{ + // We're not going away because someone's got a pointer to us + // so there's no need to lock + + return AMGetWideString(Name(), Id); +} + +/* Does this pin support this media type WARNING this interface function does + not lock the main object as it is meant to be asynchronous by nature - if + the media types you support depend on some internal state that is updated + dynamically then you will need to implement locking in a derived class */ + +STDMETHODIMP +CBasePin::QueryAccept( + const AM_MEDIA_TYPE *pmt +) +{ + CheckPointer(pmt,E_POINTER); + ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE)); + + /* The CheckMediaType method is valid to return error codes if the media + type is horrible, an example might be E_INVALIDARG. What we do here + is map all the error codes into either S_OK or S_FALSE regardless */ + + HRESULT hr = CheckMediaType((CMediaType*)pmt); + if (FAILED(hr)) { + return S_FALSE; + } + // note that the only defined success codes should be S_OK and S_FALSE... + return hr; +} + + +/* This can be called to return an enumerator for the pin's list of preferred + media types. An input pin is not obliged to have any preferred formats + although it can do. For example, the window renderer has a preferred type + which describes a video image that matches the current window size. All + output pins should expose at least one preferred format otherwise it is + possible that neither pin has any types and so no connection is possible */ + +STDMETHODIMP +CBasePin::EnumMediaTypes( + IEnumMediaTypes **ppEnum +) +{ + CheckPointer(ppEnum,E_POINTER); + ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *)); + + /* Create a new ref counted enumerator */ + + *ppEnum = new CEnumMediaTypes(this, + NULL); + + if (*ppEnum == NULL) { + return E_OUTOFMEMORY; + } + + return NOERROR; +} + + + +/* This is a virtual function that returns a media type corresponding with + place iPosition in the list. This base class simply returns an error as + we support no media types by default but derived classes should override */ + +HRESULT CBasePin::GetMediaType(int iPosition, CMediaType *pMediaType) +{ + UNREFERENCED_PARAMETER(iPosition); + UNREFERENCED_PARAMETER(pMediaType); + return E_UNEXPECTED; +} + + +/* This is a virtual function that returns the current media type version. + The base class initialises the media type enumerators with the value 1 + By default we always returns that same value. A Derived class may change + the list of media types available and after doing so it should increment + the version either in a method derived from this, or more simply by just + incrementing the m_TypeVersion base pin variable. The type enumerators + call this when they want to see if their enumerations are out of date */ + +LONG CBasePin::GetMediaTypeVersion() +{ + return m_TypeVersion; +} + + +/* Increment the cookie representing the current media type version */ + +void CBasePin::IncrementTypeVersion() +{ + InterlockedIncrement(&m_TypeVersion); +} + + +/* Called by IMediaFilter implementation when the state changes from Stopped + to either paused or running and in derived classes could do things like + commit memory and grab hardware resource (the default is to do nothing) */ + +HRESULT +CBasePin::Active(void) +{ + return NOERROR; +} + +/* Called by IMediaFilter implementation when the state changes from + to either paused to running and in derived classes could do things like + commit memory and grab hardware resource (the default is to do nothing) */ + +HRESULT +CBasePin::Run(REFERENCE_TIME tStart) +{ + UNREFERENCED_PARAMETER(tStart); + return NOERROR; +} + + +/* Also called by the IMediaFilter implementation when the state changes to + Stopped at which point you should decommit allocators and free hardware + resources you grabbed in the Active call (default is also to do nothing) */ + +HRESULT +CBasePin::Inactive(void) +{ + m_bRunTimeError = FALSE; + return NOERROR; +} + + +// Called when no more data will arrive +STDMETHODIMP +CBasePin::EndOfStream(void) +{ + return S_OK; +} + + +STDMETHODIMP +CBasePin::SetSink(IQualityControl * piqc) +{ + CAutoLock cObjectLock(m_pLock); + if (piqc) ValidateReadPtr(piqc,sizeof(IQualityControl)); + m_pQSink = piqc; + return NOERROR; +} // SetSink + + +STDMETHODIMP +CBasePin::Notify(IBaseFilter * pSender, Quality q) +{ + UNREFERENCED_PARAMETER(q); + UNREFERENCED_PARAMETER(pSender); + DbgBreak("IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)"); + return E_NOTIMPL; +} //Notify + + +// NewSegment notifies of the start/stop/rate applying to the data +// about to be received. Default implementation records data and +// returns S_OK. +// Override this to pass downstream. +STDMETHODIMP +CBasePin::NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate) +{ + m_tStart = tStart; + m_tStop = tStop; + m_dRate = dRate; + + return S_OK; +} + + +//===================================================================== +//===================================================================== +// Implements CBaseOutputPin +//===================================================================== +//===================================================================== + + +CBaseOutputPin::CBaseOutputPin(TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT), + m_pAllocator(NULL), + m_pInputPin(NULL) +{ + ASSERT(pFilter); +} + +#ifdef UNICODE +CBaseOutputPin::CBaseOutputPin(CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT), + m_pAllocator(NULL), + m_pInputPin(NULL) +{ + ASSERT(pFilter); +} +#endif + +/* This is called after a media type has been proposed + + Try to complete the connection by agreeing the allocator +*/ +HRESULT +CBaseOutputPin::CompleteConnect(IPin *pReceivePin) +{ + UNREFERENCED_PARAMETER(pReceivePin); + return DecideAllocator(m_pInputPin, &m_pAllocator); +} + + +/* This method is called when the output pin is about to try and connect to + an input pin. It is at this point that you should try and grab any extra + interfaces that you need, in this case IMemInputPin. Because this is + only called if we are not currently connected we do NOT need to call + BreakConnect. This also makes it easier to derive classes from us as + BreakConnect is only called when we actually have to break a connection + (or a partly made connection) and not when we are checking a connection */ + +/* Overriden from CBasePin */ + +HRESULT +CBaseOutputPin::CheckConnect(IPin * pPin) +{ + HRESULT hr = CBasePin::CheckConnect(pPin); + if (FAILED(hr)) { + return hr; + } + + // get an input pin and an allocator interface + hr = pPin->QueryInterface(IID_IMemInputPin, (void **) &m_pInputPin); + if (FAILED(hr)) { + return hr; + } + return NOERROR; +} + + +/* Overriden from CBasePin */ + +HRESULT +CBaseOutputPin::BreakConnect() +{ + /* Release any allocator we hold */ + + if (m_pAllocator) { + // Always decommit the allocator because a downstream filter may or + // may not decommit the connection's allocator. A memory leak could + // occur if the allocator is not decommited when a connection is broken. + HRESULT hr = m_pAllocator->Decommit(); + if( FAILED( hr ) ) { + return hr; + } + + m_pAllocator->Release(); + m_pAllocator = NULL; + } + + /* Release any input pin interface we hold */ + + if (m_pInputPin) { + m_pInputPin->Release(); + m_pInputPin = NULL; + } + return NOERROR; +} + + +/* This is called when the input pin didn't give us a valid allocator */ + +HRESULT +CBaseOutputPin::InitAllocator(IMemAllocator **ppAlloc) +{ + return CreateMemoryAllocator(ppAlloc); +} + + +/* Decide on an allocator, override this if you want to use your own allocator + Override DecideBufferSize to call SetProperties. If the input pin fails + the GetAllocator call then this will construct a CMemAllocator and call + DecideBufferSize on that, and if that fails then we are completely hosed. + If the you succeed the DecideBufferSize call, we will notify the input + pin of the selected allocator. NOTE this is called during Connect() which + therefore looks after grabbing and locking the object's critical section */ + +// We query the input pin for its requested properties and pass this to +// DecideBufferSize to allow it to fulfill requests that it is happy +// with (eg most people don't care about alignment and are thus happy to +// use the downstream pin's alignment request). + +HRESULT +CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, IMemAllocator **ppAlloc) +{ + HRESULT hr = NOERROR; + *ppAlloc = NULL; + + // get downstream prop request + // the derived class may modify this in DecideBufferSize, but + // we assume that he will consistently modify it the same way, + // so we only get it once + ALLOCATOR_PROPERTIES prop; + ZeroMemory(&prop, sizeof(prop)); + + // whatever he returns, we assume prop is either all zeros + // or he has filled it out. + pPin->GetAllocatorRequirements(&prop); + + // if he doesn't care about alignment, then set it to 1 + if (prop.cbAlign == 0) { + prop.cbAlign = 1; + } + + /* Try the allocator provided by the input pin */ + + hr = pPin->GetAllocator(ppAlloc); + if (SUCCEEDED(hr)) { + + hr = DecideBufferSize(*ppAlloc, &prop); + if (SUCCEEDED(hr)) { + hr = pPin->NotifyAllocator(*ppAlloc, FALSE); + if (SUCCEEDED(hr)) { + return NOERROR; + } + } + } + + /* If the GetAllocator failed we may not have an interface */ + + if (*ppAlloc) { + (*ppAlloc)->Release(); + *ppAlloc = NULL; + } + + /* Try the output pin's allocator by the same method */ + + hr = InitAllocator(ppAlloc); + if (SUCCEEDED(hr)) { + + // note - the properties passed here are in the same + // structure as above and may have been modified by + // the previous call to DecideBufferSize + hr = DecideBufferSize(*ppAlloc, &prop); + if (SUCCEEDED(hr)) { + hr = pPin->NotifyAllocator(*ppAlloc, FALSE); + if (SUCCEEDED(hr)) { + return NOERROR; + } + } + } + + /* Likewise we may not have an interface to release */ + + if (*ppAlloc) { + (*ppAlloc)->Release(); + *ppAlloc = NULL; + } + return hr; +} + + +/* This returns an empty sample buffer from the allocator WARNING the same + dangers and restrictions apply here as described below for Deliver() */ + +HRESULT +CBaseOutputPin::GetDeliveryBuffer(IMediaSample ** ppSample, + REFERENCE_TIME * pStartTime, + REFERENCE_TIME * pEndTime, + DWORD dwFlags) +{ + if (m_pAllocator != NULL) { + return m_pAllocator->GetBuffer(ppSample,pStartTime,pEndTime,dwFlags); + } else { + return E_NOINTERFACE; + } +} + + +/* Deliver a filled-in sample to the connected input pin. NOTE the object must + have locked itself before calling us otherwise we may get halfway through + executing this method only to find the filter graph has got in and + disconnected us from the input pin. If the filter has no worker threads + then the lock is best applied on Receive(), otherwise it should be done + when the worker thread is ready to deliver. There is a wee snag to worker + threads that this shows up. The worker thread must lock the object when + it is ready to deliver a sample, but it may have to wait until a state + change has completed, but that may never complete because the state change + is waiting for the worker thread to complete. The way to handle this is for + the state change code to grab the critical section, then set an abort event + for the worker thread, then release the critical section and wait for the + worker thread to see the event we set and then signal that it has finished + (with another event). At which point the state change code can complete */ + +// note (if you've still got any breath left after reading that) that you +// need to release the sample yourself after this call. if the connected +// input pin needs to hold onto the sample beyond the call, it will addref +// the sample itself. + +// of course you must release this one and call GetDeliveryBuffer for the +// next. You cannot reuse it directly. + +HRESULT +CBaseOutputPin::Deliver(IMediaSample * pSample) +{ + if (m_pInputPin == NULL) { + return VFW_E_NOT_CONNECTED; + } + + + return m_pInputPin->Receive(pSample); +} + + +// called from elsewhere in our filter to pass EOS downstream to +// our connected input pin +HRESULT +CBaseOutputPin::DeliverEndOfStream(void) +{ + // remember this is on IPin not IMemInputPin + if (m_Connected == NULL) { + return VFW_E_NOT_CONNECTED; + } + return m_Connected->EndOfStream(); +} + + +/* Commit the allocator's memory, this is called through IMediaFilter + which is responsible for locking the object before calling us */ + +HRESULT +CBaseOutputPin::Active(void) +{ + if (m_pAllocator == NULL) { + return VFW_E_NO_ALLOCATOR; + } + return m_pAllocator->Commit(); +} + + +/* Free up or unprepare allocator's memory, this is called through + IMediaFilter which is responsible for locking the object first */ + +HRESULT +CBaseOutputPin::Inactive(void) +{ + m_bRunTimeError = FALSE; + if (m_pAllocator == NULL) { + return VFW_E_NO_ALLOCATOR; + } + return m_pAllocator->Decommit(); +} + +// we have a default handling of EndOfStream which is to return +// an error, since this should be called on input pins only +STDMETHODIMP +CBaseOutputPin::EndOfStream(void) +{ + return E_UNEXPECTED; +} + + +// BeginFlush should be called on input pins only +STDMETHODIMP +CBaseOutputPin::BeginFlush(void) +{ + return E_UNEXPECTED; +} + +// EndFlush should be called on input pins only +STDMETHODIMP +CBaseOutputPin::EndFlush(void) +{ + return E_UNEXPECTED; +} + +// call BeginFlush on the connected input pin +HRESULT +CBaseOutputPin::DeliverBeginFlush(void) +{ + // remember this is on IPin not IMemInputPin + if (m_Connected == NULL) { + return VFW_E_NOT_CONNECTED; + } + return m_Connected->BeginFlush(); +} + +// call EndFlush on the connected input pin +HRESULT +CBaseOutputPin::DeliverEndFlush(void) +{ + // remember this is on IPin not IMemInputPin + if (m_Connected == NULL) { + return VFW_E_NOT_CONNECTED; + } + return m_Connected->EndFlush(); +} +// deliver NewSegment to connected pin +HRESULT +CBaseOutputPin::DeliverNewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate) +{ + if (m_Connected == NULL) { + return VFW_E_NOT_CONNECTED; + } + return m_Connected->NewSegment(tStart, tStop, dRate); +} + + +//===================================================================== +//===================================================================== +// Implements CBaseInputPin +//===================================================================== +//===================================================================== + + +/* Constructor creates a default allocator object */ + +CBaseInputPin::CBaseInputPin(TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pPinName) : + CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT), + m_pAllocator(NULL), + m_bReadOnly(FALSE), + m_bFlushing(FALSE) +{ + ZeroMemory(&m_SampleProps, sizeof(m_SampleProps)); +} + +#ifdef UNICODE +CBaseInputPin::CBaseInputPin(CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pPinName) : + CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT), + m_pAllocator(NULL), + m_bReadOnly(FALSE), + m_bFlushing(FALSE) +{ + ZeroMemory(&m_SampleProps, sizeof(m_SampleProps)); +} +#endif + +/* Destructor releases it's reference count on the default allocator */ + +CBaseInputPin::~CBaseInputPin() +{ + if (m_pAllocator != NULL) { + m_pAllocator->Release(); + m_pAllocator = NULL; + } +} + + +// override this to publicise our interfaces +STDMETHODIMP +CBaseInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) +{ + /* Do we know about this interface */ + + if (riid == IID_IMemInputPin) { + return GetInterface((IMemInputPin *) this, ppv); + } else { + return CBasePin::NonDelegatingQueryInterface(riid, ppv); + } +} + + +/* Return the allocator interface that this input pin would like the output + pin to use. NOTE subsequent calls to GetAllocator should all return an + interface onto the SAME object so we create one object at the start + + Note: + The allocator is Release()'d on disconnect and replaced on + NotifyAllocator(). + + Override this to provide your own allocator. +*/ + +STDMETHODIMP +CBaseInputPin::GetAllocator( + IMemAllocator **ppAllocator) +{ + CheckPointer(ppAllocator,E_POINTER); + ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *)); + CAutoLock cObjectLock(m_pLock); + + if (m_pAllocator == NULL) { + HRESULT hr = CreateMemoryAllocator(&m_pAllocator); + if (FAILED(hr)) { + return hr; + } + } + ASSERT(m_pAllocator != NULL); + *ppAllocator = m_pAllocator; + m_pAllocator->AddRef(); + return NOERROR; +} + + +/* Tell the input pin which allocator the output pin is actually going to use + Override this if you care - NOTE the locking we do both here and also in + GetAllocator is unnecessary but derived classes that do something useful + will undoubtedly have to lock the object so this might help remind people */ + +STDMETHODIMP +CBaseInputPin::NotifyAllocator( + IMemAllocator * pAllocator, + BOOL bReadOnly) +{ + CheckPointer(pAllocator,E_POINTER); + ValidateReadPtr(pAllocator,sizeof(IMemAllocator)); + CAutoLock cObjectLock(m_pLock); + + IMemAllocator *pOldAllocator = m_pAllocator; + pAllocator->AddRef(); + m_pAllocator = pAllocator; + + if (pOldAllocator != NULL) { + pOldAllocator->Release(); + } + + // the readonly flag indicates whether samples from this allocator should + // be regarded as readonly - if true, then inplace transforms will not be + // allowed. + m_bReadOnly = (BYTE)bReadOnly; + return NOERROR; +} + + +HRESULT +CBaseInputPin::BreakConnect() +{ + /* We don't need our allocator any more */ + if (m_pAllocator) { + // Always decommit the allocator because a downstream filter may or + // may not decommit the connection's allocator. A memory leak could + // occur if the allocator is not decommited when a pin is disconnected. + HRESULT hr = m_pAllocator->Decommit(); + if( FAILED( hr ) ) { + return hr; + } + + m_pAllocator->Release(); + m_pAllocator = NULL; + } + + return S_OK; +} + + +/* Do something with this media sample - this base class checks to see if the + format has changed with this media sample and if so checks that the filter + will accept it, generating a run time error if not. Once we have raised a + run time error we set a flag so that no more samples will be accepted + + It is important that any filter should override this method and implement + synchronization so that samples are not processed when the pin is + disconnected etc +*/ + +STDMETHODIMP +CBaseInputPin::Receive(IMediaSample *pSample) +{ + CheckPointer(pSample,E_POINTER); + ValidateReadPtr(pSample,sizeof(IMediaSample)); + ASSERT(pSample); + + HRESULT hr = CheckStreaming(); + if (S_OK != hr) { + return hr; + } + + + + /* Check for IMediaSample2 */ + IMediaSample2 *pSample2; + if (SUCCEEDED(pSample->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) { + hr = pSample2->GetProperties(sizeof(m_SampleProps), (PBYTE)&m_SampleProps); + pSample2->Release(); + if (FAILED(hr)) { + return hr; + } + } else { + /* Get the properties the hard way */ + m_SampleProps.cbData = sizeof(m_SampleProps); + m_SampleProps.dwTypeSpecificFlags = 0; + m_SampleProps.dwStreamId = AM_STREAM_MEDIA; + m_SampleProps.dwSampleFlags = 0; + if (S_OK == pSample->IsDiscontinuity()) { + m_SampleProps.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY; + } + if (S_OK == pSample->IsPreroll()) { + m_SampleProps.dwSampleFlags |= AM_SAMPLE_PREROLL; + } + if (S_OK == pSample->IsSyncPoint()) { + m_SampleProps.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT; + } + if (SUCCEEDED(pSample->GetTime(&m_SampleProps.tStart, + &m_SampleProps.tStop))) { + m_SampleProps.dwSampleFlags |= AM_SAMPLE_TIMEVALID | + AM_SAMPLE_STOPVALID; + } + if (S_OK == pSample->GetMediaType(&m_SampleProps.pMediaType)) { + m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED; + } + pSample->GetPointer(&m_SampleProps.pbBuffer); + m_SampleProps.lActual = pSample->GetActualDataLength(); + m_SampleProps.cbBuffer = pSample->GetSize(); + } + + /* Has the format changed in this sample */ + + if (!(m_SampleProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED)) { + return NOERROR; + } + + /* Check the derived class accepts this format */ + /* This shouldn't fail as the source must call QueryAccept first */ + + hr = CheckMediaType((CMediaType *)m_SampleProps.pMediaType); + + if (hr == NOERROR) { + return NOERROR; + } + + /* Raise a runtime error if we fail the media type */ + + m_bRunTimeError = TRUE; + EndOfStream(); + m_pFilter->NotifyEvent(EC_ERRORABORT,VFW_E_TYPE_NOT_ACCEPTED,0); + return VFW_E_INVALIDMEDIATYPE; +} + + +/* Receive multiple samples */ +STDMETHODIMP +CBaseInputPin::ReceiveMultiple ( + IMediaSample **pSamples, + long nSamples, + long *nSamplesProcessed) +{ + CheckPointer(pSamples,E_POINTER); + ValidateReadPtr(pSamples,nSamples * sizeof(IMediaSample *)); + + HRESULT hr = S_OK; + *nSamplesProcessed = 0; + while (nSamples-- > 0) { + hr = Receive(pSamples[*nSamplesProcessed]); + + /* S_FALSE means don't send any more */ + if (hr != S_OK) { + break; + } + (*nSamplesProcessed)++; + } + return hr; +} + +/* See if Receive() might block */ +STDMETHODIMP +CBaseInputPin::ReceiveCanBlock() +{ + /* Ask all the output pins if they block + If there are no output pin assume we do block + */ + int cPins = m_pFilter->GetPinCount(); + int cOutputPins = 0; + for (int c = 0; c < cPins; c++) { + CBasePin *pPin = m_pFilter->GetPin(c); + PIN_DIRECTION pd; + HRESULT hr = pPin->QueryDirection(&pd); + if (FAILED(hr)) { + return hr; + } + + if (pd == PINDIR_OUTPUT) { + + IPin *pConnected; + hr = pPin->ConnectedTo(&pConnected); + if (SUCCEEDED(hr)) { + ASSERT(pConnected != NULL); + cOutputPins++; + IMemInputPin *pInputPin; + hr = pConnected->QueryInterface( + IID_IMemInputPin, + (void **)&pInputPin); + pConnected->Release(); + if (SUCCEEDED(hr)) { + hr = pInputPin->ReceiveCanBlock(); + pInputPin->Release(); + if (hr != S_FALSE) { + return S_OK; + } + } else { + /* There's a transport we don't understand here */ + return S_OK; + } + } + } + } + return cOutputPins == 0 ? S_OK : S_FALSE; +} + +// Default handling for BeginFlush - call at the beginning +// of your implementation (makes sure that all Receive calls +// fail). After calling this, you need to free any queued data +// and then call downstream. +STDMETHODIMP +CBaseInputPin::BeginFlush(void) +{ + // BeginFlush is NOT synchronized with streaming but is part of + // a control action - hence we synchronize with the filter + CAutoLock lck(m_pLock); + + // if we are already in mid-flush, this is probably a mistake + // though not harmful - try to pick it up for now so I can think about it + ASSERT(!m_bFlushing); + + // first thing to do is ensure that no further Receive calls succeed + m_bFlushing = TRUE; + + // now discard any data and call downstream - must do that + // in derived classes + return S_OK; +} + +// default handling for EndFlush - call at end of your implementation +// - before calling this, ensure that there is no queued data and no thread +// pushing any more without a further receive, then call downstream, +// then call this method to clear the m_bFlushing flag and re-enable +// receives +STDMETHODIMP +CBaseInputPin::EndFlush(void) +{ + // Endlush is NOT synchronized with streaming but is part of + // a control action - hence we synchronize with the filter + CAutoLock lck(m_pLock); + + // almost certainly a mistake if we are not in mid-flush + ASSERT(m_bFlushing); + + // before calling, sync with pushing thread and ensure + // no more data is going downstream, then call EndFlush on + // downstream pins. + + // now re-enable Receives + m_bFlushing = FALSE; + + // No more errors + m_bRunTimeError = FALSE; + + return S_OK; +} + + +STDMETHODIMP +CBaseInputPin::Notify(IBaseFilter * pSender, Quality q) +{ + UNREFERENCED_PARAMETER(q); + CheckPointer(pSender,E_POINTER); + ValidateReadPtr(pSender,sizeof(IBaseFilter)); + DbgBreak("IQuality::Notify called on an input pin"); + return NOERROR; +} // Notify + +/* Free up or unprepare allocator's memory, this is called through + IMediaFilter which is responsible for locking the object first */ + +HRESULT +CBaseInputPin::Inactive(void) +{ + m_bRunTimeError = FALSE; + if (m_pAllocator == NULL) { + return VFW_E_NO_ALLOCATOR; + } + + m_bFlushing = FALSE; + + return m_pAllocator->Decommit(); +} + +// what requirements do we have of the allocator - override if you want +// to support other people's allocators but need a specific alignment +// or prefix. +STDMETHODIMP +CBaseInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES*pProps) +{ + UNREFERENCED_PARAMETER(pProps); + return E_NOTIMPL; +} + +// Check if it's OK to process data +// +HRESULT +CBaseInputPin::CheckStreaming() +{ + // Shouldn't be able to get any data if we're not connected! + ASSERT(IsConnected()); + + // Don't process stuff in Stopped state + if (IsStopped()) { + return VFW_E_WRONG_STATE; + } + if (m_bFlushing) { + return S_FALSE; + } + if (m_bRunTimeError) { + return VFW_E_RUNTIME_ERROR; + } + return S_OK; +} + +// Pass on the Quality notification q to +// a. Our QualityControl sink (if we have one) or else +// b. to our upstream filter +// and if that doesn't work, throw it away with a bad return code +HRESULT +CBaseInputPin::PassNotify(Quality& q) +{ + // We pass the message on, which means that we find the quality sink + // for our input pin and send it there + + DbgLog((LOG_TRACE,3,TEXT("Passing Quality notification through transform"))); + if (m_pQSink!=NULL) { + return m_pQSink->Notify(m_pFilter, q); + } else { + // no sink set, so pass it upstream + HRESULT hr; + IQualityControl * pIQC; + + hr = VFW_E_NOT_FOUND; // default + if (m_Connected) { + m_Connected->QueryInterface(IID_IQualityControl, (void**)&pIQC); + + if (pIQC!=NULL) { + hr = pIQC->Notify(m_pFilter, q); + pIQC->Release(); + } + } + return hr; + } + +} // PassNotify + +//===================================================================== +//===================================================================== +// Memory allocation class, implements CMediaSample +//===================================================================== +//===================================================================== + + +/* NOTE The implementation of this class calls the CUnknown constructor with + a NULL outer unknown pointer. This has the effect of making us a self + contained class, ie any QueryInterface, AddRef or Release calls will be + routed to the class's NonDelegatingUnknown methods. You will typically + find that the classes that do this then override one or more of these + virtual functions to provide more specialised behaviour. A good example + of this is where a class wants to keep the QueryInterface internal but + still wants it's lifetime controlled by the external object */ + +/* The last two parameters have default values of NULL and zero */ + +CMediaSample::CMediaSample(TCHAR *pName, + CBaseAllocator *pAllocator, + HRESULT *phr, + LPBYTE pBuffer, + LONG length) : + m_pBuffer(pBuffer), // Initialise the buffer + m_cbBuffer(length), // And it's length + m_lActual(length), // By default, actual = length + m_pMediaType(NULL), // No media type change + m_dwFlags(0), // Nothing set + m_cRef(0), // 0 ref count + m_dwTypeSpecificFlags(0), // Type specific flags + m_dwStreamId(AM_STREAM_MEDIA), // Stream id + m_pAllocator(pAllocator) // Allocator +{ + + /* We must have an owner and it must also be derived from class + CBaseAllocator BUT we do not hold a reference count on it */ + + ASSERT(pAllocator); +} + +#ifdef UNICODE +CMediaSample::CMediaSample(CHAR *pName, + CBaseAllocator *pAllocator, + HRESULT *phr, + LPBYTE pBuffer, + LONG length) : + m_pBuffer(pBuffer), // Initialise the buffer + m_cbBuffer(length), // And it's length + m_lActual(length), // By default, actual = length + m_pMediaType(NULL), // No media type change + m_dwFlags(0), // Nothing set + m_cRef(0), // 0 ref count + m_dwTypeSpecificFlags(0), // Type specific flags + m_dwStreamId(AM_STREAM_MEDIA), // Stream id + m_pAllocator(pAllocator) // Allocator +{ + + /* We must have an owner and it must also be derived from class + CBaseAllocator BUT we do not hold a reference count on it */ + + ASSERT(pAllocator); +} +#endif + +/* Destructor deletes the media type memory */ + +CMediaSample::~CMediaSample() +{ + + if (m_pMediaType) { + DeleteMediaType(m_pMediaType); + } +} + +/* Override this to publicise our interfaces */ + +STDMETHODIMP +CMediaSample::QueryInterface(REFIID riid, void **ppv) +{ + if (riid == IID_IMediaSample || + riid == IID_IMediaSample2 || + riid == IID_IUnknown) { + return GetInterface((IMediaSample *) this, ppv); + } else { + return E_NOINTERFACE; + } +} + +STDMETHODIMP_(ULONG) +CMediaSample::AddRef() +{ + return InterlockedIncrement(&m_cRef); +} + + +// -- CMediaSample lifetimes -- +// +// On final release of this sample buffer it is not deleted but +// returned to the freelist of the owning memory allocator +// +// The allocator may be waiting for the last buffer to be placed on the free +// list in order to decommit all the memory, so the ReleaseBuffer() call may +// result in this sample being deleted. We also need to hold a refcount on +// the allocator to stop that going away until we have finished with this. +// However, we cannot release the allocator before the ReleaseBuffer, as the +// release may cause us to be deleted. Similarly we can't do it afterwards. +// +// Thus we must leave it to the allocator to hold an addref on our behalf. +// When he issues us in GetBuffer, he addref's himself. When ReleaseBuffer +// is called, he releases himself, possibly causing us and him to be deleted. + + +STDMETHODIMP_(ULONG) +CMediaSample::Release() +{ + /* Decrement our own private reference count */ + LONG lRef; + if (m_cRef == 1) { + lRef = 0; + m_cRef = 0; + } else { + lRef = InterlockedDecrement(&m_cRef); + } + ASSERT(lRef >= 0); + + DbgLog((LOG_MEMORY,3,TEXT(" Unknown %X ref-- = %d"), + this, m_cRef)); + + /* Did we release our final reference count */ + if (lRef == 0) { + /* Free all resources */ + if (m_dwFlags & Sample_TypeChanged) { + SetMediaType(NULL); + } + ASSERT(m_pMediaType == NULL); + m_dwFlags = 0; + m_dwTypeSpecificFlags = 0; + m_dwStreamId = AM_STREAM_MEDIA; + + /* This may cause us to be deleted */ + // Our refcount is reliably 0 thus no-one will mess with us + m_pAllocator->ReleaseBuffer(this); + } + return (ULONG)lRef; +} + + +// set the buffer pointer and length. Used by allocators that +// want variable sized pointers or pointers into already-read data. +// This is only available through a CMediaSample* not an IMediaSample* +// and so cannot be changed by clients. +HRESULT +CMediaSample::SetPointer(BYTE * ptr, LONG cBytes) +{ + m_pBuffer = ptr; // new buffer area (could be null) + m_cbBuffer = cBytes; // length of buffer + m_lActual = cBytes; // length of data in buffer (assume full) + + return S_OK; +} + + +// get me a read/write pointer to this buffer's memory. I will actually +// want to use sizeUsed bytes. +STDMETHODIMP +CMediaSample::GetPointer(BYTE ** ppBuffer) +{ + ValidateReadWritePtr(ppBuffer,sizeof(BYTE *)); + + // creator must have set pointer either during + // constructor or by SetPointer + ASSERT(m_pBuffer); + + *ppBuffer = m_pBuffer; + return NOERROR; +} + + +// return the size in bytes of this buffer +STDMETHODIMP_(LONG) +CMediaSample::GetSize(void) +{ + return m_cbBuffer; +} + + +// get the stream time at which this sample should start and finish. +STDMETHODIMP +CMediaSample::GetTime( + REFERENCE_TIME * pTimeStart, // put time here + REFERENCE_TIME * pTimeEnd +) +{ + ValidateReadWritePtr(pTimeStart,sizeof(REFERENCE_TIME)); + ValidateReadWritePtr(pTimeEnd,sizeof(REFERENCE_TIME)); + + if (!(m_dwFlags & Sample_StopValid)) { + if (!(m_dwFlags & Sample_TimeValid)) { + return VFW_E_SAMPLE_TIME_NOT_SET; + } else { + *pTimeStart = m_Start; + + // Make sure old stuff works + *pTimeEnd = m_Start + 1; + return VFW_S_NO_STOP_TIME; + } + } + + *pTimeStart = m_Start; + *pTimeEnd = m_End; + return NOERROR; +} + + +// Set the stream time at which this sample should start and finish. +// NULL pointers means the time is reset +STDMETHODIMP +CMediaSample::SetTime( + REFERENCE_TIME * pTimeStart, + REFERENCE_TIME * pTimeEnd +) +{ + if (pTimeStart == NULL) { + ASSERT(pTimeEnd == NULL); + m_dwFlags &= ~(Sample_TimeValid | Sample_StopValid); + } else { + if (pTimeEnd == NULL) { + m_Start = *pTimeStart; + m_dwFlags |= Sample_TimeValid; + m_dwFlags &= ~Sample_StopValid; + } else { + ValidateReadPtr(pTimeStart,sizeof(REFERENCE_TIME)); + ValidateReadPtr(pTimeEnd,sizeof(REFERENCE_TIME)); + ASSERT(*pTimeEnd >= *pTimeStart); + + m_Start = *pTimeStart; + m_End = *pTimeEnd; + m_dwFlags |= Sample_TimeValid | Sample_StopValid; + } + } + return NOERROR; +} + + +// get the media times (eg bytes) for this sample +STDMETHODIMP +CMediaSample::GetMediaTime( + LONGLONG * pTimeStart, + LONGLONG * pTimeEnd +) +{ + ValidateReadWritePtr(pTimeStart,sizeof(LONGLONG)); + ValidateReadWritePtr(pTimeEnd,sizeof(LONGLONG)); + + if (!(m_dwFlags & Sample_MediaTimeValid)) { + return VFW_E_MEDIA_TIME_NOT_SET; + } + + *pTimeStart = m_MediaStart; + *pTimeEnd = (m_MediaStart + m_MediaEnd); + return NOERROR; +} + + +// Set the media times for this sample +STDMETHODIMP +CMediaSample::SetMediaTime( + LONGLONG * pTimeStart, + LONGLONG * pTimeEnd +) +{ + if (pTimeStart == NULL) { + ASSERT(pTimeEnd == NULL); + m_dwFlags &= ~Sample_MediaTimeValid; + } else { + ValidateReadPtr(pTimeStart,sizeof(LONGLONG)); + ValidateReadPtr(pTimeEnd,sizeof(LONGLONG)); + ASSERT(*pTimeEnd >= *pTimeStart); + + m_MediaStart = *pTimeStart; + m_MediaEnd = (LONG)(*pTimeEnd - *pTimeStart); + m_dwFlags |= Sample_MediaTimeValid; + } + return NOERROR; +} + + +STDMETHODIMP +CMediaSample::IsSyncPoint(void) +{ + if (m_dwFlags & Sample_SyncPoint) { + return S_OK; + } else { + return S_FALSE; + } +} + + +STDMETHODIMP +CMediaSample::SetSyncPoint(BOOL bIsSyncPoint) +{ + if (bIsSyncPoint) { + m_dwFlags |= Sample_SyncPoint; + } else { + m_dwFlags &= ~Sample_SyncPoint; + } + return NOERROR; +} + +// returns S_OK if there is a discontinuity in the data (this same is +// not a continuation of the previous stream of data +// - there has been a seek). +STDMETHODIMP +CMediaSample::IsDiscontinuity(void) +{ + if (m_dwFlags & Sample_Discontinuity) { + return S_OK; + } else { + return S_FALSE; + } +} + +// set the discontinuity property - TRUE if this sample is not a +// continuation, but a new sample after a seek. +STDMETHODIMP +CMediaSample::SetDiscontinuity(BOOL bDiscont) +{ + // should be TRUE or FALSE + if (bDiscont) { + m_dwFlags |= Sample_Discontinuity; + } else { + m_dwFlags &= ~Sample_Discontinuity; + } + return S_OK; +} + +STDMETHODIMP +CMediaSample::IsPreroll(void) +{ + if (m_dwFlags & Sample_Preroll) { + return S_OK; + } else { + return S_FALSE; + } +} + + +STDMETHODIMP +CMediaSample::SetPreroll(BOOL bIsPreroll) +{ + if (bIsPreroll) { + m_dwFlags |= Sample_Preroll; + } else { + m_dwFlags &= ~Sample_Preroll; + } + return NOERROR; +} + +STDMETHODIMP_(LONG) +CMediaSample::GetActualDataLength(void) +{ + return m_lActual; +} + + +STDMETHODIMP +CMediaSample::SetActualDataLength(LONG lActual) +{ + if (lActual > m_cbBuffer) { + ASSERT(lActual <= GetSize()); + return VFW_E_BUFFER_OVERFLOW; + } + m_lActual = lActual; + return NOERROR; +} + + +/* These allow for limited format changes in band */ + +STDMETHODIMP +CMediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType) +{ + ValidateReadWritePtr(ppMediaType,sizeof(AM_MEDIA_TYPE *)); + ASSERT(ppMediaType); + + /* Do we have a new media type for them */ + + if (!(m_dwFlags & Sample_TypeChanged)) { + ASSERT(m_pMediaType == NULL); + *ppMediaType = NULL; + return S_FALSE; + } + + ASSERT(m_pMediaType); + + /* Create a copy of our media type */ + + *ppMediaType = CreateMediaType(m_pMediaType); + if (*ppMediaType == NULL) { + return E_OUTOFMEMORY; + } + return NOERROR; +} + + +/* Mark this sample as having a different format type */ + +STDMETHODIMP +CMediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType) +{ + /* Delete the current media type */ + + if (m_pMediaType) { + DeleteMediaType(m_pMediaType); + m_pMediaType = NULL; + } + + /* Mechanism for resetting the format type */ + + if (pMediaType == NULL) { + m_dwFlags &= ~Sample_TypeChanged; + return NOERROR; + } + + ASSERT(pMediaType); + ValidateReadPtr(pMediaType,sizeof(AM_MEDIA_TYPE)); + + /* Take a copy of the media type */ + + m_pMediaType = CreateMediaType(pMediaType); + if (m_pMediaType == NULL) { + m_dwFlags &= ~Sample_TypeChanged; + return E_OUTOFMEMORY; + } + + m_dwFlags |= Sample_TypeChanged; + return NOERROR; +} + +// Set and get properties (IMediaSample2) +STDMETHODIMP CMediaSample::GetProperties( + DWORD cbProperties, + BYTE * pbProperties +) +{ + if (0 != cbProperties) { + CheckPointer(pbProperties, E_POINTER); + // Return generic stuff up to the length + AM_SAMPLE2_PROPERTIES Props; + Props.cbData = min(cbProperties, sizeof(Props)); + Props.dwSampleFlags = m_dwFlags & ~Sample_MediaTimeValid; + Props.dwTypeSpecificFlags = m_dwTypeSpecificFlags; + Props.pbBuffer = m_pBuffer; + Props.cbBuffer = m_cbBuffer; + Props.lActual = m_lActual; + Props.tStart = m_Start; + Props.tStop = m_End; + Props.dwStreamId = m_dwStreamId; + if (m_dwFlags & AM_SAMPLE_TYPECHANGED) { + Props.pMediaType = m_pMediaType; + } else { + Props.pMediaType = NULL; + } + CopyMemory(pbProperties, &Props, Props.cbData); + } + return S_OK; +} + +#define CONTAINS_FIELD(type, field, offset) \ + ((FIELD_OFFSET(type, field) + sizeof(((type *)0)->field)) <= offset) + +HRESULT CMediaSample::SetProperties( + DWORD cbProperties, + const BYTE * pbProperties +) +{ + + /* Generic properties */ + AM_MEDIA_TYPE *pMediaType = NULL; + + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbData, cbProperties)) { + CheckPointer(pbProperties, E_POINTER); + AM_SAMPLE2_PROPERTIES *pProps = + (AM_SAMPLE2_PROPERTIES *)pbProperties; + + /* Don't use more data than is actually there */ + if (pProps->cbData < cbProperties) { + cbProperties = pProps->cbData; + } + /* We only handle IMediaSample2 */ + if (cbProperties > sizeof(*pProps) || + pProps->cbData > sizeof(*pProps)) { + return E_INVALIDARG; + } + /* Do checks first, the assignments (for backout) */ + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) { + /* Check the flags */ + if (pProps->dwSampleFlags & + (~Sample_ValidFlags | Sample_MediaTimeValid)) { + return E_INVALIDARG; + } + /* Check a flag isn't being set for a property + not being provided + */ + if ((pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) && + !(m_dwFlags & AM_SAMPLE_TIMEVALID) && + !CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) { + return E_INVALIDARG; + } + } + /* NB - can't SET the pointer or size */ + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pbBuffer, cbProperties)) { + + /* Check pbBuffer */ + if (pProps->pbBuffer != 0 && pProps->pbBuffer != m_pBuffer) { + return E_INVALIDARG; + } + } + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties)) { + + /* Check cbBuffer */ + if (pProps->cbBuffer != 0 && pProps->cbBuffer != m_cbBuffer) { + return E_INVALIDARG; + } + } + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties) && + CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) { + + /* Check lActual */ + if (pProps->cbBuffer < pProps->lActual) { + return E_INVALIDARG; + } + } + + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) { + + /* Check pMediaType */ + if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) { + CheckPointer(pProps->pMediaType, E_POINTER); + pMediaType = CreateMediaType(pProps->pMediaType); + if (pMediaType == NULL) { + return E_OUTOFMEMORY; + } + } + } + + /* Now do the assignments */ + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwStreamId, cbProperties)) { + m_dwStreamId = pProps->dwStreamId; + } + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) { + /* Set the flags */ + m_dwFlags = pProps->dwSampleFlags | + (m_dwFlags & Sample_MediaTimeValid); + m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; + } else { + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwTypeSpecificFlags, cbProperties)) { + m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; + } + } + + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) { + /* Set lActual */ + m_lActual = pProps->lActual; + } + + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) { + + /* Set the times */ + m_End = pProps->tStop; + } + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStart, cbProperties)) { + + /* Set the times */ + m_Start = pProps->tStart; + } + + if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) { + /* Set pMediaType */ + if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) { + if (m_pMediaType != NULL) { + DeleteMediaType(m_pMediaType); + } + m_pMediaType = pMediaType; + } + } + + /* Fix up the type changed flag to correctly reflect the current state + If, for instance the input contained no type change but the + output does then if we don't do this we'd lose the + output media type. + */ + if (m_pMediaType) { + m_dwFlags |= Sample_TypeChanged; + } else { + m_dwFlags &= ~Sample_TypeChanged; + } + } + + return S_OK; +} + + +// +// The streaming thread calls IPin::NewSegment(), IPin::EndOfStream(), +// IMemInputPin::Receive() and IMemInputPin::ReceiveMultiple() on the +// connected input pin. The application thread calls Block(). The +// following class members can only be called by the streaming thread. +// +// Deliver() +// DeliverNewSegment() +// StartUsingOutputPin() +// StopUsingOutputPin() +// ChangeOutputFormat() +// ChangeMediaType() +// DynamicReconnect() +// +// The following class members can only be called by the application thread. +// +// Block() +// SynchronousBlockOutputPin() +// AsynchronousBlockOutputPin() +// + +CDynamicOutputPin::CDynamicOutputPin( + TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName), + m_hStopEvent(NULL), + m_pGraphConfig(NULL), + m_bPinUsesReadOnlyAllocator(FALSE), + m_BlockState(NOT_BLOCKED), + m_hUnblockOutputPinEvent(NULL), + m_hNotifyCallerPinBlockedEvent(NULL), + m_dwBlockCallerThreadID(0), + m_dwNumOutstandingOutputPinUsers(0) +{ + HRESULT hr = Initialize(); + if( FAILED( hr ) ) { + *phr = hr; + return; + } +} + +#ifdef UNICODE +CDynamicOutputPin::CDynamicOutputPin( + CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName) : + CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName), + m_hStopEvent(NULL), + m_pGraphConfig(NULL), + m_bPinUsesReadOnlyAllocator(FALSE), + m_BlockState(NOT_BLOCKED), + m_hUnblockOutputPinEvent(NULL), + m_hNotifyCallerPinBlockedEvent(NULL), + m_dwBlockCallerThreadID(0), + m_dwNumOutstandingOutputPinUsers(0) +{ + HRESULT hr = Initialize(); + if( FAILED( hr ) ) { + *phr = hr; + return; + } +} +#endif + +CDynamicOutputPin::~CDynamicOutputPin() +{ + if(NULL != m_hUnblockOutputPinEvent) { + // This call should not fail because we have access to m_hUnblockOutputPinEvent + // and m_hUnblockOutputPinEvent is a valid event. + EXECUTE_ASSERT(::CloseHandle(m_hUnblockOutputPinEvent)); + } + + if(NULL != m_hNotifyCallerPinBlockedEvent) { + // This call should not fail because we have access to m_hNotifyCallerPinBlockedEvent + // and m_hNotifyCallerPinBlockedEvent is a valid event. + EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); + } +} + +HRESULT CDynamicOutputPin::Initialize(void) +{ + m_hUnblockOutputPinEvent = ::CreateEvent( NULL, // The event will have the default security descriptor. + TRUE, // This is a manual reset event. + TRUE, // The event is initially signaled. + NULL ); // The event is not named. + + // CreateEvent() returns NULL if an error occurs. + if(NULL == m_hUnblockOutputPinEvent) { + return AmGetLastErrorToHResult(); + } + + // Set flag to say we can reconnect while streaming. + SetReconnectWhenActive(true); + + return S_OK; +} + +STDMETHODIMP CDynamicOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) +{ + if(riid == IID_IPinFlowControl) { + return GetInterface(static_cast(this), ppv); + } else { + return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); + } +} + +STDMETHODIMP CDynamicOutputPin::Disconnect(void) +{ + CAutoLock cObjectLock(m_pLock); + return DisconnectInternal(); +} + +STDMETHODIMP CDynamicOutputPin::Block(DWORD dwBlockFlags, HANDLE hEvent) +{ + const DWORD VALID_FLAGS = AM_PIN_FLOW_CONTROL_BLOCK; + + // Check for illegal flags. + if(dwBlockFlags & ~VALID_FLAGS) { + return E_INVALIDARG; + } + + // Make sure the event is unsignaled. + if((dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) && (NULL != hEvent)) { + if( !::ResetEvent( hEvent ) ) { + return AmGetLastErrorToHResult(); + } + } + + // No flags are set if we are unblocking the output pin. + if(0 == dwBlockFlags) { + + // This parameter should be NULL because unblock operations are always synchronous. + // There is no need to notify the caller when the event is done. + if(NULL != hEvent) { + return E_INVALIDARG; + } + } + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + HRESULT hr; + + if(dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) { + // IPinFlowControl::Block()'s hEvent parameter is NULL if the block is synchronous. + // If hEvent is not NULL, the block is asynchronous. + if(NULL == hEvent) { + hr = SynchronousBlockOutputPin(); + } else { + hr = AsynchronousBlockOutputPin(hEvent); + } + } else { + hr = UnblockOutputPin(); + } + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + if(FAILED(hr)) { + return hr; + } + + return S_OK; +} + +HRESULT CDynamicOutputPin::SynchronousBlockOutputPin(void) +{ + HANDLE hNotifyCallerPinBlockedEvent = :: CreateEvent( NULL, // The event will have the default security attributes. + FALSE, // This is an automatic reset event. + FALSE, // The event is initially unsignaled. + NULL ); // The event is not named. + + // CreateEvent() returns NULL if an error occurs. + if(NULL == hNotifyCallerPinBlockedEvent) { + return AmGetLastErrorToHResult(); + } + + HRESULT hr = AsynchronousBlockOutputPin(hNotifyCallerPinBlockedEvent); + if(FAILED(hr)) { + // This call should not fail because we have access to hNotifyCallerPinBlockedEvent + // and hNotifyCallerPinBlockedEvent is a valid event. + EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent)); + + return hr; + } + + hr = WaitEvent(hNotifyCallerPinBlockedEvent); + + // This call should not fail because we have access to hNotifyCallerPinBlockedEvent + // and hNotifyCallerPinBlockedEvent is a valid event. + EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent)); + + if(FAILED(hr)) { + return hr; + } + + return S_OK; +} + +HRESULT CDynamicOutputPin::AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlockedEvent) +{ + // This function holds the m_BlockStateLock because it uses + // m_dwBlockCallerThreadID, m_BlockState and + // m_hNotifyCallerPinBlockedEvent. + CAutoLock alBlockStateLock(&m_BlockStateLock); + + if(NOT_BLOCKED != m_BlockState) { + if(m_dwBlockCallerThreadID == ::GetCurrentThreadId()) { + return VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD; + } else { + return VFW_E_PIN_ALREADY_BLOCKED; + } + } + + BOOL fSuccess = ::DuplicateHandle( ::GetCurrentProcess(), + hNotifyCallerPinBlockedEvent, + ::GetCurrentProcess(), + &m_hNotifyCallerPinBlockedEvent, + EVENT_MODIFY_STATE, + FALSE, + 0 ); + if( !fSuccess ) { + return AmGetLastErrorToHResult(); + } + + m_BlockState = PENDING; + m_dwBlockCallerThreadID = ::GetCurrentThreadId(); + + // The output pin cannot be blocked if the streaming thread is + // calling IPin::NewSegment(), IPin::EndOfStream(), IMemInputPin::Receive() + // or IMemInputPin::ReceiveMultiple() on the connected input pin. Also, it + // cannot be blocked if the streaming thread is calling DynamicReconnect(), + // ChangeMediaType() or ChangeOutputFormat(). + if(!StreamingThreadUsingOutputPin()) { + + // The output pin can be immediately blocked. + BlockOutputPin(); + } + + return S_OK; +} + +void CDynamicOutputPin::BlockOutputPin(void) +{ + // The caller should always hold the m_BlockStateLock because this function + // uses m_BlockState and m_hNotifyCallerPinBlockedEvent. + ASSERT(CritCheckIn(&m_BlockStateLock)); + + // This function should not be called if the streaming thread is modifying + // the connection state or it's passing data downstream. + ASSERT(!StreamingThreadUsingOutputPin()); + + // This should not fail because we successfully created the event + // and we have the security permissions to change it's state. + EXECUTE_ASSERT(::ResetEvent(m_hUnblockOutputPinEvent)); + + // This event should not fail because AsynchronousBlockOutputPin() successfully + // duplicated this handle and we have the appropriate security permissions. + EXECUTE_ASSERT(::SetEvent(m_hNotifyCallerPinBlockedEvent)); + EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); + + m_BlockState = BLOCKED; + m_hNotifyCallerPinBlockedEvent = NULL; +} + +HRESULT CDynamicOutputPin::UnblockOutputPin(void) +{ + // UnblockOutputPin() holds the m_BlockStateLock because it + // uses m_BlockState, m_dwBlockCallerThreadID and + // m_hNotifyCallerPinBlockedEvent. + CAutoLock alBlockStateLock(&m_BlockStateLock); + + if(NOT_BLOCKED == m_BlockState) { + return S_FALSE; + } + + // This should not fail because we successfully created the event + // and we have the security permissions to change it's state. + EXECUTE_ASSERT(::SetEvent(m_hUnblockOutputPinEvent)); + + // Cancel the block operation if it's still pending. + if(NULL != m_hNotifyCallerPinBlockedEvent) { + // This event should not fail because AsynchronousBlockOutputPin() successfully + // duplicated this handle and we have the appropriate security permissions. + EXECUTE_ASSERT(::SetEvent(m_hNotifyCallerPinBlockedEvent)); + EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent)); + } + + m_BlockState = NOT_BLOCKED; + m_dwBlockCallerThreadID = 0; + m_hNotifyCallerPinBlockedEvent = NULL; + + return S_OK; +} + +HRESULT CDynamicOutputPin::StartUsingOutputPin(void) +{ + // The caller should not hold m_BlockStateLock. If the caller does, + // a deadlock could occur. + ASSERT(CritCheckOut(&m_BlockStateLock)); + + CAutoLock alBlockStateLock(&m_BlockStateLock); + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + // Are we in the middle of a block operation? + while(BLOCKED == m_BlockState) { + m_BlockStateLock.Unlock(); + + // If this ASSERT fires, a deadlock could occur. The caller should make sure + // that this thread never acquires the Block State lock more than once. + ASSERT(CritCheckOut( &m_BlockStateLock )); + + // WaitForMultipleObjects() returns WAIT_OBJECT_0 if the unblock event + // is fired. It returns WAIT_OBJECT_0 + 1 if the stop event if fired. + // See the Windows SDK documentation for more information on + // WaitForMultipleObjects(). + const DWORD UNBLOCK = WAIT_OBJECT_0; + const DWORD STOP = WAIT_OBJECT_0 + 1; + + HANDLE ahWaitEvents[] = { m_hUnblockOutputPinEvent, m_hStopEvent }; + DWORD dwNumWaitEvents = sizeof(ahWaitEvents)/sizeof(HANDLE); + + DWORD dwReturnValue = ::WaitForMultipleObjects( dwNumWaitEvents, ahWaitEvents, FALSE, INFINITE ); + + m_BlockStateLock.Lock(); + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + switch( dwReturnValue ) { + case UNBLOCK: + break; + + case STOP: + return VFW_E_STATE_CHANGED; + + case WAIT_FAILED: + return AmGetLastErrorToHResult(); + + default: + DbgBreak( "An Unexpected case occured in CDynamicOutputPin::StartUsingOutputPin()." ); + return E_UNEXPECTED; + } + } + + m_dwNumOutstandingOutputPinUsers++; + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + return S_OK; +} + +void CDynamicOutputPin::StopUsingOutputPin(void) +{ + CAutoLock alBlockStateLock(&m_BlockStateLock); + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG + + m_dwNumOutstandingOutputPinUsers--; + + if((m_dwNumOutstandingOutputPinUsers == 0) && (NOT_BLOCKED != m_BlockState)) { + BlockOutputPin(); + } + + #ifdef DEBUG + AssertValid(); + #endif // DEBUG +} + +bool CDynamicOutputPin::StreamingThreadUsingOutputPin(void) +{ + CAutoLock alBlockStateLock(&m_BlockStateLock); + + return (m_dwNumOutstandingOutputPinUsers > 0); +} + +void CDynamicOutputPin::SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEvent) +{ + // This pointer is not addrefed because filters are not allowed to + // hold references to the filter graph manager. See the documentation for + // IBaseFilter::JoinFilterGraph() in the Direct Show SDK for more information. + m_pGraphConfig = pGraphConfig; + + m_hStopEvent = hStopEvent; +} + +HRESULT CDynamicOutputPin::Active(void) +{ + // Make sure the user initialized the object by calling SetConfigInfo(). + if((NULL == m_hStopEvent) || (NULL == m_pGraphConfig)) { + DbgBreak( ERROR: CDynamicOutputPin::Active() failed because m_pGraphConfig and m_hStopEvent were not initialized. Call SetConfigInfo() to initialize them. ); + return E_FAIL; + } + + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then Active() is called. An event + // handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + EXECUTE_ASSERT(ResetEvent(m_hStopEvent)); + + return CBaseOutputPin::Active(); +} + +HRESULT CDynamicOutputPin::Inactive(void) +{ + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then Active() is called. An event + // handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + EXECUTE_ASSERT(SetEvent(m_hStopEvent)); + + return CBaseOutputPin::Inactive(); +} + +HRESULT CDynamicOutputPin::DeliverBeginFlush(void) +{ + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. + // An event handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + EXECUTE_ASSERT(SetEvent(m_hStopEvent)); + + return CBaseOutputPin::DeliverBeginFlush(); +} + +HRESULT CDynamicOutputPin::DeliverEndFlush(void) +{ + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. + // An event handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + EXECUTE_ASSERT(ResetEvent(m_hStopEvent)); + + return CBaseOutputPin::DeliverEndFlush(); +} + + +// ChangeOutputFormat() either dynamicly changes the connection's format type or it dynamicly +// reconnects the output pin. +HRESULT CDynamicOutputPin::ChangeOutputFormat + ( + const AM_MEDIA_TYPE *pmt, + REFERENCE_TIME tSegmentStart, + REFERENCE_TIME tSegmentStop, + double dSegmentRate + ) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + // Callers should always pass a valid media type to ChangeOutputFormat() . + ASSERT(NULL != pmt); + + CMediaType cmt(*pmt); + HRESULT hr = ChangeMediaType(&cmt); + if (FAILED(hr)) { + return hr; + } + + hr = DeliverNewSegment(tSegmentStart, tSegmentStop, dSegmentRate); + if( FAILED( hr ) ) { + return hr; + } + + return S_OK; +} + +HRESULT CDynamicOutputPin::ChangeMediaType(const CMediaType *pmt) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + // This function assumes the filter graph is running. + ASSERT(!IsStopped()); + + if(!IsConnected()) { + return VFW_E_NOT_CONNECTED; + } + + /* First check if the downstream pin will accept a dynamic + format change + */ + QzCComPtr pConnection; + + m_Connected->QueryInterface(IID_IPinConnection, (void **)&pConnection); + if(pConnection != NULL) { + + if(S_OK == pConnection->DynamicQueryAccept(pmt)) { + + HRESULT hr = ChangeMediaTypeHelper(pmt); + if(FAILED(hr)) { + return hr; + } + + return S_OK; + } + } + + /* Can't do the dynamic connection */ + return DynamicReconnect(pmt); +} + +HRESULT CDynamicOutputPin::ChangeMediaTypeHelper(const CMediaType *pmt) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + HRESULT hr = m_Connected->ReceiveConnection(this, pmt); + if(FAILED(hr)) { + return hr; + } + + hr = SetMediaType(pmt); + if(FAILED(hr)) { + return hr; + } + + // Does this pin use the local memory transport? + if(NULL != m_pInputPin) { + // This function assumes that m_pInputPin and m_Connected are + // two different interfaces to the same object. + ASSERT(::IsEqualObject(m_Connected, m_pInputPin)); + + ALLOCATOR_PROPERTIES apInputPinRequirements; + apInputPinRequirements.cbAlign = 0; + apInputPinRequirements.cbBuffer = 0; + apInputPinRequirements.cbPrefix = 0; + apInputPinRequirements.cBuffers = 0; + + m_pInputPin->GetAllocatorRequirements(&apInputPinRequirements); + + // A zero allignment does not make any sense. + if(0 == apInputPinRequirements.cbAlign) { + apInputPinRequirements.cbAlign = 1; + } + + hr = m_pAllocator->Decommit(); + if(FAILED(hr)) { + return hr; + } + + hr = DecideBufferSize(m_pAllocator, &apInputPinRequirements); + if(FAILED(hr)) { + return hr; + } + + hr = m_pAllocator->Commit(); + if(FAILED(hr)) { + return hr; + } + + hr = m_pInputPin->NotifyAllocator(m_pAllocator, m_bPinUsesReadOnlyAllocator); + if(FAILED(hr)) { + return hr; + } + } + + return S_OK; +} + +// this method has to be called from the thread that is pushing data, +// and it's the caller's responsibility to make sure that the thread +// has no outstand samples because they cannot be delivered after a +// reconnect +// +HRESULT CDynamicOutputPin::DynamicReconnect( const CMediaType* pmt ) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + if((m_pGraphConfig == NULL) || (NULL == m_hStopEvent)) { + return E_FAIL; + } + + HRESULT hr = m_pGraphConfig->Reconnect( + this, + NULL, + pmt, + NULL, + m_hStopEvent, + AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS ); + + return hr; +} + +HRESULT CDynamicOutputPin::CompleteConnect(IPin *pReceivePin) +{ + HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin); + if(SUCCEEDED(hr)) { + if(!IsStopped() && m_pAllocator) { + hr = m_pAllocator->Commit(); + ASSERT(hr != VFW_E_ALREADY_COMMITTED); + } + } + + return hr; +} + +#ifdef DEBUG +void CDynamicOutputPin::AssertValid(void) +{ + // Make sure the object was correctly initialized. + + // This ASSERT only fires if the object failed to initialize + // and the user ignored the constructor's return code (phr). + ASSERT(NULL != m_hUnblockOutputPinEvent); + + // If either of these ASSERTs fire, the user did not correctly call + // SetConfigInfo(). + ASSERT(NULL != m_hStopEvent); + ASSERT(NULL != m_pGraphConfig); + + // Make sure the block state is consistent. + + CAutoLock alBlockStateLock(&m_BlockStateLock); + + // BLOCK_STATE variables only have three legal values: PENDING, BLOCKED and NOT_BLOCKED. + ASSERT((NOT_BLOCKED == m_BlockState) || (PENDING == m_BlockState) || (BLOCKED == m_BlockState)); + + // m_hNotifyCallerPinBlockedEvent is only needed when a block operation cannot complete + // immediately. + ASSERT(((NULL == m_hNotifyCallerPinBlockedEvent) && (PENDING != m_BlockState)) || + ((NULL != m_hNotifyCallerPinBlockedEvent) && (PENDING == m_BlockState)) ); + + // m_dwBlockCallerThreadID should always be 0 if the pin is not blocked and + // the user is not trying to block the pin. + ASSERT((0 == m_dwBlockCallerThreadID) || (NOT_BLOCKED != m_BlockState)); + + // If this ASSERT fires, the streaming thread is using the output pin and the + // output pin is blocked. + ASSERT(((0 != m_dwNumOutstandingOutputPinUsers) && (BLOCKED != m_BlockState)) || + ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED != m_BlockState)) || + ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED == m_BlockState)) ); +} +#endif // DEBUG + +HRESULT CDynamicOutputPin::WaitEvent(HANDLE hEvent) +{ + const DWORD EVENT_SIGNALED = WAIT_OBJECT_0; + + DWORD dwReturnValue = ::WaitForSingleObject(hEvent, INFINITE); + + switch( dwReturnValue ) { + case EVENT_SIGNALED: + return S_OK; + + case WAIT_FAILED: + return AmGetLastErrorToHResult(); + + default: + DbgBreak( "An Unexpected case occured in CDynamicOutputPin::WaitEvent()." ); + return E_UNEXPECTED; + } +} + +//===================================================================== +//===================================================================== +// Implements CBaseAllocator +//===================================================================== +//===================================================================== + + +/* Constructor overrides the default settings for the free list to request + that it be alertable (ie the list can be cast to a handle which can be + passed to WaitForSingleObject). Both of the allocator lists also ask for + object locking, the all list matches the object default settings but I + have included them here just so it is obvious what kind of list it is */ + +CBaseAllocator::CBaseAllocator(TCHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr, + BOOL bEvent, + BOOL fEnableReleaseCallback + ) : + CUnknown(pName, pUnk), + m_lAllocated(0), + m_bChanged(FALSE), + m_bCommitted(FALSE), + m_bDecommitInProgress(FALSE), + m_lSize(0), + m_lCount(0), + m_lAlignment(0), + m_lPrefix(0), + m_hSem(NULL), + m_lWaiting(0), + m_fEnableReleaseCallback(fEnableReleaseCallback), + m_pNotify(NULL) +{ + + if (bEvent) { + m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); + if (m_hSem == NULL) { + *phr = E_OUTOFMEMORY; + return; + } + } +} + +#ifdef UNICODE +CBaseAllocator::CBaseAllocator(CHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr, + BOOL bEvent, + BOOL fEnableReleaseCallback) : + CUnknown(pName, pUnk), + m_lAllocated(0), + m_bChanged(FALSE), + m_bCommitted(FALSE), + m_bDecommitInProgress(FALSE), + m_lSize(0), + m_lCount(0), + m_lAlignment(0), + m_lPrefix(0), + m_hSem(NULL), + m_lWaiting(0), + m_fEnableReleaseCallback(fEnableReleaseCallback), + m_pNotify(NULL) +{ + + if (bEvent) { + m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); + if (m_hSem == NULL) { + *phr = E_OUTOFMEMORY; + return; + } + } +} +#endif + +/* Destructor */ + +CBaseAllocator::~CBaseAllocator() +{ + // we can't call Decommit here since that would mean a call to a + // pure virtual in destructor. + // We must assume that the derived class has gone into decommit state in + // its destructor. + + ASSERT(!m_bCommitted); + if (m_hSem != NULL) { + EXECUTE_ASSERT(CloseHandle(m_hSem)); + } + if (m_pNotify) { + m_pNotify->Release(); + } +} + + +/* Override this to publicise our interfaces */ + +STDMETHODIMP +CBaseAllocator::NonDelegatingQueryInterface(REFIID riid, void **ppv) +{ + /* Do we know about this interface */ + + if (riid == IID_IMemAllocator || + riid == IID_IMemAllocatorCallbackTemp && m_fEnableReleaseCallback) { + return GetInterface((IMemAllocatorCallbackTemp *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +/* This sets the size and count of the required samples. The memory isn't + actually allocated until Commit() is called, if memory has already been + allocated then assuming no samples are outstanding the user may call us + to change the buffering, the memory will be released in Commit() */ + +STDMETHODIMP +CBaseAllocator::SetProperties( + ALLOCATOR_PROPERTIES* pRequest, + ALLOCATOR_PROPERTIES* pActual) +{ + CheckPointer(pRequest, E_POINTER); + CheckPointer(pActual, E_POINTER); + ValidateReadWritePtr(pActual, sizeof(ALLOCATOR_PROPERTIES)); + CAutoLock cObjectLock(this); + + ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES)); + + ASSERT(pRequest->cbBuffer > 0); + + /* Check the alignment requested */ + if (pRequest->cbAlign != 1) { + DbgLog((LOG_ERROR, 2, TEXT("Alignment requested was 0x%x, not 1"), + pRequest->cbAlign)); + return VFW_E_BADALIGN; + } + + /* Can't do this if already committed, there is an argument that says we + should not reject the SetProperties call if there are buffers still + active. However this is called by the source filter, which is the same + person who is holding the samples. Therefore it is not unreasonable + for them to free all their samples before changing the requirements */ + + if (m_bCommitted) { + return VFW_E_ALREADY_COMMITTED; + } + + /* Must be no outstanding buffers */ + + if (m_lAllocated != m_lFree.GetCount()) { + return VFW_E_BUFFERS_OUTSTANDING; + } + + /* There isn't any real need to check the parameters as they + will just be rejected when the user finally calls Commit */ + + pActual->cbBuffer = m_lSize = pRequest->cbBuffer; + pActual->cBuffers = m_lCount = pRequest->cBuffers; + pActual->cbAlign = m_lAlignment = pRequest->cbAlign; + pActual->cbPrefix = m_lPrefix = pRequest->cbPrefix; + + m_bChanged = TRUE; + return NOERROR; +} + +STDMETHODIMP +CBaseAllocator::GetProperties( + ALLOCATOR_PROPERTIES * pActual) +{ + CheckPointer(pActual,E_POINTER); + ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES)); + + CAutoLock cObjectLock(this); + pActual->cbBuffer = m_lSize; + pActual->cBuffers = m_lCount; + pActual->cbAlign = m_lAlignment; + pActual->cbPrefix = m_lPrefix; + return NOERROR; +} + +// get container for a sample. Blocking, synchronous call to get the +// next free buffer (as represented by an IMediaSample interface). +// on return, the time etc properties will be invalid, but the buffer +// pointer and size will be correct. + +HRESULT CBaseAllocator::GetBuffer(IMediaSample **ppBuffer, + REFERENCE_TIME *pStartTime, + REFERENCE_TIME *pEndTime, + DWORD dwFlags + ) +{ + UNREFERENCED_PARAMETER(pStartTime); + UNREFERENCED_PARAMETER(pEndTime); + UNREFERENCED_PARAMETER(dwFlags); + CMediaSample *pSample; + + *ppBuffer = NULL; + for (;;) + { + { // scope for lock + CAutoLock cObjectLock(this); + + /* Check we are committed */ + if (!m_bCommitted) { + return VFW_E_NOT_COMMITTED; + } + pSample = (CMediaSample *) m_lFree.RemoveHead(); + if (pSample == NULL) { + SetWaiting(); + } + } + + /* If we didn't get a sample then wait for the list to signal */ + + if (pSample) { + break; + } + if (dwFlags & AM_GBF_NOWAIT) { + return VFW_E_TIMEOUT; + } + ASSERT(m_hSem != NULL); + WaitForSingleObject(m_hSem, INFINITE); + } + + /* Addref the buffer up to one. On release + back to zero instead of being deleted, it will requeue itself by + calling the ReleaseBuffer member function. NOTE the owner of a + media sample must always be derived from CBaseAllocator */ + + + ASSERT(pSample->m_cRef == 0); + pSample->m_cRef = 1; + *ppBuffer = pSample; + + + return NOERROR; +} + + +/* Final release of a CMediaSample will call this */ + +STDMETHODIMP +CBaseAllocator::ReleaseBuffer(IMediaSample * pSample) +{ + CheckPointer(pSample,E_POINTER); + ValidateReadPtr(pSample,sizeof(IMediaSample)); + + + + BOOL bRelease = FALSE; + { + CAutoLock cal(this); + + /* Put back on the free list */ + + m_lFree.Add((CMediaSample *)pSample); + if (m_lWaiting != 0) { + NotifySample(); + } + + // if there is a pending Decommit, then we need to complete it by + // calling Free() when the last buffer is placed on the free list + + LONG l1 = m_lFree.GetCount(); + if (m_bDecommitInProgress && (l1 == m_lAllocated)) { + Free(); + m_bDecommitInProgress = FALSE; + bRelease = TRUE; + } + } + + if (m_pNotify) { + + ASSERT(m_fEnableReleaseCallback); + + // + // Note that this is not synchronized with setting up a notification + // method. + // + m_pNotify->NotifyRelease(); + } + + /* For each buffer there is one AddRef, made in GetBuffer and released + here. This may cause the allocator and all samples to be deleted */ + + if (bRelease) { + Release(); + } + return NOERROR; +} + +STDMETHODIMP +CBaseAllocator::SetNotify( + IMemAllocatorNotifyCallbackTemp* pNotify + ) +{ + ASSERT(m_fEnableReleaseCallback); + CAutoLock lck(this); + if (pNotify) { + pNotify->AddRef(); + } + if (m_pNotify) { + m_pNotify->Release(); + } + m_pNotify = pNotify; + return S_OK; +} + +STDMETHODIMP +CBaseAllocator::GetFreeCount( + LONG* plBuffersFree + ) +{ + ASSERT(m_fEnableReleaseCallback); + CAutoLock cObjectLock(this); + *plBuffersFree = m_lCount - m_lAllocated + m_lFree.GetCount(); + return NOERROR; +} + +void +CBaseAllocator::NotifySample() +{ + if (m_lWaiting != 0) { + ASSERT(m_hSem != NULL); + ReleaseSemaphore(m_hSem, m_lWaiting, 0); + m_lWaiting = 0; + } +} + +STDMETHODIMP +CBaseAllocator::Commit() +{ + /* Check we are not decommitted */ + CAutoLock cObjectLock(this); + + // cannot need to alloc or re-alloc if we are committed + if (m_bCommitted) { + return NOERROR; + } + + /* Allow GetBuffer calls */ + + m_bCommitted = TRUE; + + // is there a pending decommit ? if so, just cancel it + if (m_bDecommitInProgress) { + m_bDecommitInProgress = FALSE; + + // don't call Alloc at this point. He cannot allow SetProperties + // between Decommit and the last free, so the buffer size cannot have + // changed. And because some of the buffers are not free yet, he + // cannot re-alloc anyway. + return NOERROR; + } + + DbgLog((LOG_MEMORY, 1, TEXT("Allocating: %ldx%ld"), m_lCount, m_lSize)); + + // actually need to allocate the samples + HRESULT hr = Alloc(); + if (FAILED(hr)) { + m_bCommitted = FALSE; + return hr; + } + AddRef(); + return NOERROR; +} + + +STDMETHODIMP +CBaseAllocator::Decommit() +{ + BOOL bRelease = FALSE; + { + /* Check we are not already decommitted */ + CAutoLock cObjectLock(this); + if (m_bCommitted == FALSE) { + if (m_bDecommitInProgress == FALSE) { + return NOERROR; + } + } + + /* No more GetBuffer calls will succeed */ + m_bCommitted = FALSE; + + // are any buffers outstanding? + if (m_lFree.GetCount() < m_lAllocated) { + // please complete the decommit when last buffer is freed + m_bDecommitInProgress = TRUE; + } else { + m_bDecommitInProgress = FALSE; + + // need to complete the decommit here as there are no + // outstanding buffers + + Free(); + bRelease = TRUE; + } + + // Tell anyone waiting that they can go now so we can + // reject their call + NotifySample(); + } + + if (bRelease) { + Release(); + } + return NOERROR; +} + + +/* Base definition of allocation which checks we are ok to go ahead and do + the full allocation. We return S_FALSE if the requirements are the same */ + +HRESULT +CBaseAllocator::Alloc(void) +{ + /* Error if he hasn't set the size yet */ + if (m_lCount <= 0 || m_lSize <= 0 || m_lAlignment <= 0) { + return VFW_E_SIZENOTSET; + } + + /* should never get here while buffers outstanding */ + ASSERT(m_lFree.GetCount() == m_lAllocated); + + /* If the requirements haven't changed then don't reallocate */ + if (m_bChanged == FALSE) { + return S_FALSE; + } + + return NOERROR; +} + +/* Implement CBaseAllocator::CSampleList::Remove(pSample) + Removes pSample from the list +*/ +void +CBaseAllocator::CSampleList::Remove(CMediaSample * pSample) +{ + CMediaSample **pSearch; + for (pSearch = &m_List; + *pSearch != NULL; + pSearch = &(CBaseAllocator::NextSample(*pSearch))) { + if (*pSearch == pSample) { + *pSearch = CBaseAllocator::NextSample(pSample); + CBaseAllocator::NextSample(pSample) = NULL; + m_nOnList--; + return; + } + } + DbgBreak("Couldn't find sample in list"); +} + +//===================================================================== +//===================================================================== +// Implements CMemAllocator +//===================================================================== +//===================================================================== + + +/* This goes in the factory template table to create new instances */ +CUnknown *CMemAllocator::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) +{ + CUnknown *pUnkRet = new CMemAllocator(NAME("CMemAllocator"), pUnk, phr); + return pUnkRet; +} + +CMemAllocator::CMemAllocator( + TCHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr) + : CBaseAllocator(pName, pUnk, phr, TRUE, TRUE), + m_pBuffer(NULL) +{ +} + +#ifdef UNICODE +CMemAllocator::CMemAllocator( + CHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr) + : CBaseAllocator(pName, pUnk, phr, TRUE, TRUE), + m_pBuffer(NULL) +{ +} +#endif + +/* This sets the size and count of the required samples. The memory isn't + actually allocated until Commit() is called, if memory has already been + allocated then assuming no samples are outstanding the user may call us + to change the buffering, the memory will be released in Commit() */ +STDMETHODIMP +CMemAllocator::SetProperties( + ALLOCATOR_PROPERTIES* pRequest, + ALLOCATOR_PROPERTIES* pActual) +{ + CheckPointer(pActual,E_POINTER); + ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES)); + CAutoLock cObjectLock(this); + + ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES)); + + ASSERT(pRequest->cbBuffer > 0); + + SYSTEM_INFO SysInfo; + GetSystemInfo(&SysInfo); + + /* Check the alignment request is a power of 2 */ + if ((-pRequest->cbAlign & pRequest->cbAlign) != pRequest->cbAlign) { + DbgLog((LOG_ERROR, 1, TEXT("Alignment requested 0x%x not a power of 2!"), + pRequest->cbAlign)); + } + /* Check the alignment requested */ + if (pRequest->cbAlign == 0 || + (SysInfo.dwAllocationGranularity & (pRequest->cbAlign - 1)) != 0) { + DbgLog((LOG_ERROR, 1, TEXT("Invalid alignment 0x%x requested - granularity = 0x%x"), + pRequest->cbAlign, SysInfo.dwAllocationGranularity)); + return VFW_E_BADALIGN; + } + + /* Can't do this if already committed, there is an argument that says we + should not reject the SetProperties call if there are buffers still + active. However this is called by the source filter, which is the same + person who is holding the samples. Therefore it is not unreasonable + for them to free all their samples before changing the requirements */ + + if (m_bCommitted == TRUE) { + return VFW_E_ALREADY_COMMITTED; + } + + /* Must be no outstanding buffers */ + + if (m_lFree.GetCount() < m_lAllocated) { + return VFW_E_BUFFERS_OUTSTANDING; + } + + /* There isn't any real need to check the parameters as they + will just be rejected when the user finally calls Commit */ + + // round length up to alignment - remember that prefix is included in + // the alignment + LONG lSize = pRequest->cbBuffer + pRequest->cbPrefix; + LONG lRemainder = lSize % pRequest->cbAlign; + if (lRemainder != 0) { + lSize = lSize - lRemainder + pRequest->cbAlign; + } + pActual->cbBuffer = m_lSize = (lSize - pRequest->cbPrefix); + + pActual->cBuffers = m_lCount = pRequest->cBuffers; + pActual->cbAlign = m_lAlignment = pRequest->cbAlign; + pActual->cbPrefix = m_lPrefix = pRequest->cbPrefix; + + m_bChanged = TRUE; + return NOERROR; +} + +// override this to allocate our resources when Commit is called. +// +// note that our resources may be already allocated when this is called, +// since we don't free them on Decommit. We will only be called when in +// decommit state with all buffers free. +// +// object locked by caller +HRESULT +CMemAllocator::Alloc(void) +{ + CAutoLock lck(this); + + /* Check he has called SetProperties */ + HRESULT hr = CBaseAllocator::Alloc(); + if (FAILED(hr)) { + return hr; + } + + /* If the requirements haven't changed then don't reallocate */ + if (hr == S_FALSE) { + ASSERT(m_pBuffer); + return NOERROR; + } + ASSERT(hr == S_OK); // we use this fact in the loop below + + /* Free the old resources */ + if (m_pBuffer) { + ReallyFree(); + } + + /* Compute the aligned size */ + LONG lAlignedSize = m_lSize + m_lPrefix; + if (m_lAlignment > 1) { + LONG lRemainder = lAlignedSize % m_lAlignment; + if (lRemainder != 0) { + lAlignedSize += (m_lAlignment - lRemainder); + } + } + + /* Create the contiguous memory block for the samples + making sure it's properly aligned (64K should be enough!) + */ + ASSERT(lAlignedSize % m_lAlignment == 0); + + m_pBuffer = (PBYTE)VirtualAlloc(NULL, + m_lCount * lAlignedSize, + MEM_COMMIT, + PAGE_READWRITE); + + if (m_pBuffer == NULL) { + return E_OUTOFMEMORY; + } + + LPBYTE pNext = m_pBuffer; + CMediaSample *pSample; + + ASSERT(m_lAllocated == 0); + + // Create the new samples - we have allocated m_lSize bytes for each sample + // plus m_lPrefix bytes per sample as a prefix. We set the pointer to + // the memory after the prefix - so that GetPointer() will return a pointer + // to m_lSize bytes. + for (; m_lAllocated < m_lCount; m_lAllocated++, pNext += lAlignedSize) { + + + pSample = new CMediaSample( + NAME("Default memory media sample"), + this, + &hr, + pNext + m_lPrefix, // GetPointer() value + m_lSize); // not including prefix + + ASSERT(SUCCEEDED(hr)); + if (pSample == NULL) { + return E_OUTOFMEMORY; + } + + // This CANNOT fail + m_lFree.Add(pSample); + } + + m_bChanged = FALSE; + return NOERROR; +} + + +// override this to free up any resources we have allocated. +// called from the base class on Decommit when all buffers have been +// returned to the free list. +// +// caller has already locked the object. + +// in our case, we keep the memory until we are deleted, so +// we do nothing here. The memory is deleted in the destructor by +// calling ReallyFree() +void +CMemAllocator::Free(void) +{ + return; +} + + +// called from the destructor (and from Alloc if changing size/count) to +// actually free up the memory +void +CMemAllocator::ReallyFree(void) +{ + /* Should never be deleting this unless all buffers are freed */ + + ASSERT(m_lAllocated == m_lFree.GetCount()); + + /* Free up all the CMediaSamples */ + + CMediaSample *pSample; + for (;;) { + pSample = m_lFree.RemoveHead(); + if (pSample != NULL) { + delete pSample; + } else { + break; + } + } + + m_lAllocated = 0; + + // free the block of buffer memory + if (m_pBuffer) { + EXECUTE_ASSERT(VirtualFree(m_pBuffer, 0, MEM_RELEASE)); + m_pBuffer = NULL; + } +} + + +/* Destructor frees our memory resources */ + +CMemAllocator::~CMemAllocator() +{ + Decommit(); + ReallyFree(); +} + +// ------------------------------------------------------------------------ +// filter registration through IFilterMapper. used if IFilterMapper is +// not found (Quartz 1.0 install) + +STDAPI +AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata + , IFilterMapper * pIFM + , BOOL bRegister ) +{ + DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter"))); + + // check we've got data + // + if( NULL == psetupdata ) return S_FALSE; + + + // unregister filter + // (as pins are subkeys of filter's CLSID key + // they do not need to be removed separately). + // + DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter"))); + HRESULT hr = pIFM->UnregisterFilter( *(psetupdata->clsID) ); + + + if( bRegister ) + { + // register filter + // + DbgLog((LOG_TRACE, 3, TEXT("= = register filter"))); + hr = pIFM->RegisterFilter( *(psetupdata->clsID) + , psetupdata->strName + , psetupdata->dwMerit ); + if( SUCCEEDED(hr) ) + { + // all its pins + // + DbgLog((LOG_TRACE, 3, TEXT("= = register filter pins"))); + for( UINT m1=0; m1 < psetupdata->nPins; m1++ ) + { + hr = pIFM->RegisterPin( *(psetupdata->clsID) + , psetupdata->lpPin[m1].strName + , psetupdata->lpPin[m1].bRendered + , psetupdata->lpPin[m1].bOutput + , psetupdata->lpPin[m1].bZero + , psetupdata->lpPin[m1].bMany + , *(psetupdata->lpPin[m1].clsConnectsToFilter) + , psetupdata->lpPin[m1].strConnectsToPin ); + + if( SUCCEEDED(hr) ) + { + // and each pin's media types + // + DbgLog((LOG_TRACE, 3, TEXT("= = register filter pin types"))); + for( UINT m2=0; m2 < psetupdata->lpPin[m1].nMediaTypes; m2++ ) + { + hr = pIFM->RegisterPinType( *(psetupdata->clsID) + , psetupdata->lpPin[m1].strName + , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMajorType) + , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMinorType) ); + if( FAILED(hr) ) break; + } + if( FAILED(hr) ) break; + } + if( FAILED(hr) ) break; + } + } + } + + // handle one acceptable "error" - that + // of filter not being registered! + // (couldn't find a suitable #define'd + // name for the error!) + // + if( 0x80070002 == hr) + return NOERROR; + else + return hr; +} + +// Remove warnings about unreferenced inline functions +#pragma warning(disable:4514) + diff --git a/src/BaseClasses/amfilter.h b/src/BaseClasses/amfilter.h index 2996c77ac1..5d0f224d90 100644 --- a/src/BaseClasses/amfilter.h +++ b/src/BaseClasses/amfilter.h @@ -1,1589 +1,1589 @@ -//------------------------------------------------------------------------------ -// File: AMFilter.h -// -// Desc: DirectShow base classes - efines class hierarchy for streams -// architecture. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __FILTER__ -#define __FILTER__ - -/* The following classes are declared in this header: */ - -class CBaseMediaFilter; // IMediaFilter support -class CBaseFilter; // IBaseFilter,IMediaFilter support -class CBasePin; // Abstract base class for IPin interface -class CEnumPins; // Enumerate input and output pins -class CEnumMediaTypes; // Enumerate the pin's preferred formats -class CBaseOutputPin; // Adds data provider member functions -class CBaseInputPin; // Implements IMemInputPin interface -class CMediaSample; // Basic transport unit for IMemInputPin -class CBaseAllocator; // General list guff for most allocators -class CMemAllocator; // Implements memory buffer allocation - - -//===================================================================== -//===================================================================== -// -// QueryFilterInfo and QueryPinInfo AddRef the interface pointers -// they return. You can use the macro below to release the interface. -// -//===================================================================== -//===================================================================== - -#define QueryFilterInfoReleaseGraph(fi) if ((fi).pGraph) (fi).pGraph->Release(); - -#define QueryPinInfoReleaseFilter(pi) if ((pi).pFilter) (pi).pFilter->Release(); - -//===================================================================== -//===================================================================== -// Defines CBaseMediaFilter -// -// Abstract base class implementing IMediaFilter. -// -// Typically you will derive your filter from CBaseFilter rather than -// this, unless you are implementing an object such as a plug-in -// distributor that needs to support IMediaFilter but not IBaseFilter. -// -// Note that IMediaFilter is derived from IPersist to allow query of -// class id. -//===================================================================== -//===================================================================== - -class AM_NOVTABLE CBaseMediaFilter : public CUnknown, - public IMediaFilter -{ - -protected: - - FILTER_STATE m_State; // current state: running, paused - IReferenceClock *m_pClock; // this filter's reference clock - // note: all filters in a filter graph use the same clock - - // offset from stream time to reference time - CRefTime m_tStart; - - CLSID m_clsid; // This filters clsid - // used for serialization - CCritSec *m_pLock; // Object we use for locking - -public: - - CBaseMediaFilter( - const TCHAR *pName, - LPUNKNOWN pUnk, - CCritSec *pLock, - REFCLSID clsid); - - virtual ~CBaseMediaFilter(); - - DECLARE_IUNKNOWN - - // override this to say what interfaces we support where - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); - - // - // --- IPersist method --- - // - - STDMETHODIMP GetClassID(CLSID *pClsID); - - // --- IMediaFilter methods --- - - STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State); - - STDMETHODIMP SetSyncSource(IReferenceClock *pClock); - - STDMETHODIMP GetSyncSource(IReferenceClock **pClock); - - // default implementation of Stop and Pause just record the - // state. Override to activate or de-activate your filter. - // Note that Run when called from Stopped state will call Pause - // to ensure activation, so if you are a source or transform - // you will probably not need to override Run. - STDMETHODIMP Stop(); - STDMETHODIMP Pause(); - - - // the start parameter is the difference to be added to the - // sample's stream time to get the reference time for - // its presentation - STDMETHODIMP Run(REFERENCE_TIME tStart); - - // --- helper methods --- - - // return the current stream time - ie find out what - // stream time should be appearing now - virtual HRESULT StreamTime(CRefTime& rtStream); - - // Is the filter currently active? (running or paused) - BOOL IsActive() { - CAutoLock cObjectLock(m_pLock); - return ((m_State == State_Paused) || (m_State == State_Running)); - }; -}; - -//===================================================================== -//===================================================================== -// Defines CBaseFilter -// -// An abstract class providing basic IBaseFilter support for pin -// enumeration and filter information reading. -// -// We cannot derive from CBaseMediaFilter since methods in IMediaFilter -// are also in IBaseFilter and would be ambiguous. Since much of the code -// assumes that they derive from a class that has m_State and other state -// directly available, we duplicate code from CBaseMediaFilter rather than -// having a member variable. -// -// Derive your filter from this, or from a derived object such as -// CTransformFilter. -//===================================================================== -//===================================================================== - - -class AM_NOVTABLE CBaseFilter : public CUnknown, // Handles an IUnknown - public IBaseFilter, // The Filter Interface - public IAMovieSetup // For un/registration -{ - -friend class CBasePin; - -protected: - FILTER_STATE m_State; // current state: running, paused - IReferenceClock *m_pClock; // this graph's ref clock - CRefTime m_tStart; // offset from stream time to reference time - CLSID m_clsid; // This filters clsid - // used for serialization - CCritSec *m_pLock; // Object we use for locking - - WCHAR *m_pName; // Full filter name - IFilterGraph *m_pGraph; // Graph we belong to - IMediaEventSink *m_pSink; // Called with notify events - LONG m_PinVersion; // Current pin version - -public: - - CBaseFilter( - const TCHAR *pName, // Object description - LPUNKNOWN pUnk, // IUnknown of delegating object - CCritSec *pLock, // Object who maintains lock - REFCLSID clsid); // The clsid to be used to serialize this filter - - CBaseFilter( - TCHAR *pName, // Object description - LPUNKNOWN pUnk, // IUnknown of delegating object - CCritSec *pLock, // Object who maintains lock - REFCLSID clsid, // The clsid to be used to serialize this filter - HRESULT *phr); // General OLE return code -#ifdef UNICODE - CBaseFilter( - const CHAR *pName, // Object description - LPUNKNOWN pUnk, // IUnknown of delegating object - CCritSec *pLock, // Object who maintains lock - REFCLSID clsid); // The clsid to be used to serialize this filter - - CBaseFilter( - CHAR *pName, // Object description - LPUNKNOWN pUnk, // IUnknown of delegating object - CCritSec *pLock, // Object who maintains lock - REFCLSID clsid, // The clsid to be used to serialize this filter - HRESULT *phr); // General OLE return code -#endif - ~CBaseFilter(); - - DECLARE_IUNKNOWN - - // override this to say what interfaces we support where - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); -#ifdef DEBUG - STDMETHODIMP_(ULONG) NonDelegatingRelease(); -#endif - - // - // --- IPersist method --- - // - - STDMETHODIMP GetClassID(CLSID *pClsID); - - // --- IMediaFilter methods --- - - STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State); - - STDMETHODIMP SetSyncSource(IReferenceClock *pClock); - - STDMETHODIMP GetSyncSource(IReferenceClock **pClock); - - - // override Stop and Pause so we can activate the pins. - // Note that Run will call Pause first if activation needed. - // Override these if you want to activate your filter rather than - // your pins. - STDMETHODIMP Stop(); - STDMETHODIMP Pause(); - - // the start parameter is the difference to be added to the - // sample's stream time to get the reference time for - // its presentation - STDMETHODIMP Run(REFERENCE_TIME tStart); - - // --- helper methods --- - - // return the current stream time - ie find out what - // stream time should be appearing now - virtual HRESULT StreamTime(CRefTime& rtStream); - - // Is the filter currently active? - BOOL IsActive() { - CAutoLock cObjectLock(m_pLock); - return ((m_State == State_Paused) || (m_State == State_Running)); - }; - - // Is this filter stopped (without locking) - BOOL IsStopped() { - return (m_State == State_Stopped); - }; - - // - // --- IBaseFilter methods --- - // - - // pin enumerator - STDMETHODIMP EnumPins( - IEnumPins ** ppEnum); - - - // default behaviour of FindPin assumes pin ids are their names - STDMETHODIMP FindPin( - LPCWSTR Id, - IPin ** ppPin - ); - - STDMETHODIMP QueryFilterInfo( - FILTER_INFO * pInfo); - - STDMETHODIMP JoinFilterGraph( - IFilterGraph * pGraph, - LPCWSTR pName); - - // return a Vendor information string. Optional - may return E_NOTIMPL. - // memory returned should be freed using CoTaskMemFree - // default implementation returns E_NOTIMPL - STDMETHODIMP QueryVendorInfo( - LPWSTR* pVendorInfo - ); - - // --- helper methods --- - - // send an event notification to the filter graph if we know about it. - // returns S_OK if delivered, S_FALSE if the filter graph does not sink - // events, or an error otherwise. - HRESULT NotifyEvent( - long EventCode, - LONG_PTR EventParam1, - LONG_PTR EventParam2); - - // return the filter graph we belong to - IFilterGraph *GetFilterGraph() { - return m_pGraph; - } - - // Request reconnect - // pPin is the pin to reconnect - // pmt is the type to reconnect with - can be NULL - // Calls ReconnectEx on the filter graph - HRESULT ReconnectPin(IPin *pPin, AM_MEDIA_TYPE const *pmt); - - // find out the current pin version (used by enumerators) - virtual LONG GetPinVersion(); - void IncrementPinVersion(); - - // you need to supply these to access the pins from the enumerator - // and for default Stop and Pause/Run activation. - virtual int GetPinCount() PURE; - virtual CBasePin *GetPin(int n) PURE; - - // --- IAMovieSetup methods --- - - STDMETHODIMP Register(); // ask filter to register itself - STDMETHODIMP Unregister(); // and unregister itself - - // --- setup helper methods --- - // (override to return filters setup data) - - virtual LPAMOVIESETUP_FILTER GetSetupData(){ return NULL; } - -}; - - -//===================================================================== -//===================================================================== -// Defines CBasePin -// -// Abstract class that supports the basics of IPin -//===================================================================== -//===================================================================== - -class AM_NOVTABLE CBasePin : public CUnknown, public IPin, public IQualityControl -{ - -protected: - - WCHAR * m_pName; // This pin's name - IPin *m_Connected; // Pin we have connected to - PIN_DIRECTION m_dir; // Direction of this pin - CCritSec *m_pLock; // Object we use for locking - bool m_bRunTimeError; // Run time error generated - bool m_bCanReconnectWhenActive; // OK to reconnect when active - bool m_bTryMyTypesFirst; // When connecting enumerate - // this pin's types first - CBaseFilter *m_pFilter; // Filter we were created by - IQualityControl *m_pQSink; // Target for Quality messages - LONG m_TypeVersion; // Holds current type version - CMediaType m_mt; // Media type of connection - - CRefTime m_tStart; // time from NewSegment call - CRefTime m_tStop; // time from NewSegment - double m_dRate; // rate from NewSegment - -#ifdef DEBUG - LONG m_cRef; // Ref count tracing -#endif - - // displays pin connection information - -#ifdef DEBUG - void DisplayPinInfo(IPin *pReceivePin); - void DisplayTypeInfo(IPin *pPin, const CMediaType *pmt); -#else - void DisplayPinInfo(IPin *pReceivePin) {}; - void DisplayTypeInfo(IPin *pPin, const CMediaType *pmt) {}; -#endif - - // used to agree a media type for a pin connection - - // given a specific media type, attempt a connection (includes - // checking that the type is acceptable to this pin) - HRESULT - AttemptConnection( - IPin* pReceivePin, // connect to this pin - const CMediaType* pmt // using this type - ); - - // try all the media types in this enumerator - for each that - // we accept, try to connect using ReceiveConnection. - HRESULT TryMediaTypes( - IPin *pReceivePin, // connect to this pin - const CMediaType *pmt, // proposed type from Connect - IEnumMediaTypes *pEnum); // try this enumerator - - // establish a connection with a suitable mediatype. Needs to - // propose a media type if the pmt pointer is null or partially - // specified - use TryMediaTypes on both our and then the other pin's - // enumerator until we find one that works. - HRESULT AgreeMediaType( - IPin *pReceivePin, // connect to this pin - const CMediaType *pmt); // proposed type from Connect - -public: - - CBasePin( - TCHAR *pObjectName, // Object description - CBaseFilter *pFilter, // Owning filter who knows about pins - CCritSec *pLock, // Object who implements the lock - HRESULT *phr, // General OLE return code - LPCWSTR pName, // Pin name for us - PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT -#ifdef UNICODE - CBasePin( - CHAR *pObjectName, // Object description - CBaseFilter *pFilter, // Owning filter who knows about pins - CCritSec *pLock, // Object who implements the lock - HRESULT *phr, // General OLE return code - LPCWSTR pName, // Pin name for us - PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT -#endif - virtual ~CBasePin(); - - DECLARE_IUNKNOWN - - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); - STDMETHODIMP_(ULONG) NonDelegatingRelease(); - STDMETHODIMP_(ULONG) NonDelegatingAddRef(); - - // --- IPin methods --- - - // take lead role in establishing a connection. Media type pointer - // may be null, or may point to partially-specified mediatype - // (subtype or format type may be GUID_NULL). - STDMETHODIMP Connect( - IPin * pReceivePin, - const AM_MEDIA_TYPE *pmt // optional media type - ); - - // (passive) accept a connection from another pin - STDMETHODIMP ReceiveConnection( - IPin * pConnector, // this is the initiating connecting pin - const AM_MEDIA_TYPE *pmt // this is the media type we will exchange - ); - - STDMETHODIMP Disconnect(); - - STDMETHODIMP ConnectedTo(IPin **pPin); - - STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *pmt); - - STDMETHODIMP QueryPinInfo( - PIN_INFO * pInfo - ); - - STDMETHODIMP QueryDirection( - PIN_DIRECTION * pPinDir - ); - - STDMETHODIMP QueryId( - LPWSTR * Id - ); - - // does the pin support this media type - STDMETHODIMP QueryAccept( - const AM_MEDIA_TYPE *pmt - ); - - // return an enumerator for this pins preferred media types - STDMETHODIMP EnumMediaTypes( - IEnumMediaTypes **ppEnum - ); - - // return an array of IPin* - the pins that this pin internally connects to - // All pins put in the array must be AddReffed (but no others) - // Errors: "Can't say" - FAIL, not enough slots - return S_FALSE - // Default: return E_NOTIMPL - // The filter graph will interpret NOT_IMPL as any input pin connects to - // all visible output pins and vice versa. - // apPin can be NULL if nPin==0 (not otherwise). - STDMETHODIMP QueryInternalConnections( - IPin* *apPin, // array of IPin* - ULONG *nPin // on input, the number of slots - // on output the number of pins - ) { return E_NOTIMPL; } - - // Called when no more data will be sent - STDMETHODIMP EndOfStream(void); - - // Begin/EndFlush still PURE - - // NewSegment notifies of the start/stop/rate applying to the data - // about to be received. Default implementation records data and - // returns S_OK. - // Override this to pass downstream. - STDMETHODIMP NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate); - - //================================================================================ - // IQualityControl methods - //================================================================================ - - STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); - - STDMETHODIMP SetSink(IQualityControl * piqc); - - // --- helper methods --- - - // Returns true if the pin is connected. false otherwise. - BOOL IsConnected(void) {return (m_Connected != NULL); }; - // Return the pin this is connected to (if any) - IPin * GetConnected() { return m_Connected; }; - - // Check if our filter is currently stopped - BOOL IsStopped() { - return (m_pFilter->m_State == State_Stopped); - }; - - // find out the current type version (used by enumerators) - virtual LONG GetMediaTypeVersion(); - void IncrementTypeVersion(); - - // switch the pin to active (paused or running) mode - // not an error to call this if already active - virtual HRESULT Active(void); - - // switch the pin to inactive state - may already be inactive - virtual HRESULT Inactive(void); - - // Notify of Run() from filter - virtual HRESULT Run(REFERENCE_TIME tStart); - - // check if the pin can support this specific proposed type and format - virtual HRESULT CheckMediaType(const CMediaType *) PURE; - - // set the connection to use this format (previously agreed) - virtual HRESULT SetMediaType(const CMediaType *); - - // check that the connection is ok before verifying it - // can be overridden eg to check what interfaces will be supported. - virtual HRESULT CheckConnect(IPin *); - - // Set and release resources required for a connection - virtual HRESULT BreakConnect(); - virtual HRESULT CompleteConnect(IPin *pReceivePin); - - // returns the preferred formats for a pin - virtual HRESULT GetMediaType(int iPosition,CMediaType *pMediaType); - - // access to NewSegment values - REFERENCE_TIME CurrentStopTime() { - return m_tStop; - } - REFERENCE_TIME CurrentStartTime() { - return m_tStart; - } - double CurrentRate() { - return m_dRate; - } - - // Access name - LPWSTR Name() { return m_pName; }; - - // Can reconnectwhen active? - void SetReconnectWhenActive(bool bCanReconnect) - { - m_bCanReconnectWhenActive = bCanReconnect; - } - - bool CanReconnectWhenActive() - { - return m_bCanReconnectWhenActive; - } - -protected: - STDMETHODIMP DisconnectInternal(); -}; - - -//===================================================================== -//===================================================================== -// Defines CEnumPins -// -// Pin enumerator class that works by calling CBaseFilter. This interface -// is provided by CBaseFilter::EnumPins and calls GetPinCount() and -// GetPin() to enumerate existing pins. Needs to be a separate object so -// that it can be cloned (creating an existing object at the same -// position in the enumeration) -// -//===================================================================== -//===================================================================== - -class CEnumPins : public IEnumPins // The interface we support -{ - int m_Position; // Current ordinal position - int m_PinCount; // Number of pins available - CBaseFilter *m_pFilter; // The filter who owns us - LONG m_Version; // Pin version information - LONG m_cRef; - - typedef CGenericList CPinList; - - CPinList m_PinCache; // These pointers have not been AddRef'ed and - // so they should not be dereferenced. They are - // merely kept to ID which pins have been enumerated. - -#ifdef DEBUG - DWORD m_dwCookie; -#endif - - /* If while we are retrieving a pin for example from the filter an error - occurs we assume that our internal state is stale with respect to the - filter (someone may have deleted all the pins). We can check before - starting whether or not the operation is likely to fail by asking the - filter what it's current version number is. If the filter has not - overriden the GetPinVersion method then this will always match */ - - BOOL AreWeOutOfSync() { - return (m_pFilter->GetPinVersion() == m_Version ? FALSE : TRUE); - }; - - /* This method performs the same operations as Reset, except is does not clear - the cache of pins already enumerated. */ - - STDMETHODIMP Refresh(); - -public: - - CEnumPins( - CBaseFilter *pFilter, - CEnumPins *pEnumPins); - - virtual ~CEnumPins(); - - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid, void **ppv); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - // IEnumPins - STDMETHODIMP Next( - ULONG cPins, // place this many pins... - IPin ** ppPins, // ...in this array of IPin* - ULONG * pcFetched // actual count passed returned here - ); - - STDMETHODIMP Skip(ULONG cPins); - STDMETHODIMP Reset(); - STDMETHODIMP Clone(IEnumPins **ppEnum); - - -}; - - -//===================================================================== -//===================================================================== -// Defines CEnumMediaTypes -// -// Enumerates the preferred formats for input and output pins -//===================================================================== -//===================================================================== - -class CEnumMediaTypes : public IEnumMediaTypes // The interface we support -{ - int m_Position; // Current ordinal position - CBasePin *m_pPin; // The pin who owns us - LONG m_Version; // Media type version value - LONG m_cRef; -#ifdef DEBUG - DWORD m_dwCookie; -#endif - - /* The media types a filter supports can be quite dynamic so we add to - the general IEnumXXXX interface the ability to be signaled when they - change via an event handle the connected filter supplies. Until the - Reset method is called after the state changes all further calls to - the enumerator (except Reset) will return E_UNEXPECTED error code */ - - BOOL AreWeOutOfSync() { - return (m_pPin->GetMediaTypeVersion() == m_Version ? FALSE : TRUE); - }; - -public: - - CEnumMediaTypes( - CBasePin *pPin, - CEnumMediaTypes *pEnumMediaTypes); - - virtual ~CEnumMediaTypes(); - - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid, void **ppv); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - // IEnumMediaTypes - STDMETHODIMP Next( - ULONG cMediaTypes, // place this many pins... - AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array - ULONG * pcFetched // actual count passed - ); - - STDMETHODIMP Skip(ULONG cMediaTypes); - STDMETHODIMP Reset(); - STDMETHODIMP Clone(IEnumMediaTypes **ppEnum); -}; - - - - -//===================================================================== -//===================================================================== -// Defines CBaseOutputPin -// -// class derived from CBasePin that can pass buffers to a connected pin -// that supports IMemInputPin. Supports IPin. -// -// Derive your output pin from this. -// -//===================================================================== -//===================================================================== - -class AM_NOVTABLE CBaseOutputPin : public CBasePin -{ - -protected: - - IMemAllocator *m_pAllocator; - IMemInputPin *m_pInputPin; // interface on the downstreaminput pin - // set up in CheckConnect when we connect. - -public: - - CBaseOutputPin( - TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#ifdef UNICODE - CBaseOutputPin( - CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#endif - // override CompleteConnect() so we can negotiate an allocator - virtual HRESULT CompleteConnect(IPin *pReceivePin); - - // negotiate the allocator and its buffer size/count and other properties - // Calls DecideBufferSize to set properties - virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc); - - // override this to set the buffer size and count. Return an error - // if the size/count is not to your liking. - // The allocator properties passed in are those requested by the - // input pin - use eg the alignment and prefix members if you have - // no preference on these. - virtual HRESULT DecideBufferSize( - IMemAllocator * pAlloc, - ALLOCATOR_PROPERTIES * ppropInputRequest - ) PURE; - - // returns an empty sample buffer from the allocator - virtual HRESULT GetDeliveryBuffer(IMediaSample ** ppSample, - REFERENCE_TIME * pStartTime, - REFERENCE_TIME * pEndTime, - DWORD dwFlags); - - // deliver a filled-in sample to the connected input pin - // note - you need to release it after calling this. The receiving - // pin will addref the sample if it needs to hold it beyond the - // call. - virtual HRESULT Deliver(IMediaSample *); - - // override this to control the connection - virtual HRESULT InitAllocator(IMemAllocator **ppAlloc); - HRESULT CheckConnect(IPin *pPin); - HRESULT BreakConnect(); - - // override to call Commit and Decommit - HRESULT Active(void); - HRESULT Inactive(void); - - // we have a default handling of EndOfStream which is to return - // an error, since this should be called on input pins only - STDMETHODIMP EndOfStream(void); - - // called from elsewhere in our filter to pass EOS downstream to - // our connected input pin - virtual HRESULT DeliverEndOfStream(void); - - // same for Begin/EndFlush - we handle Begin/EndFlush since it - // is an error on an output pin, and we have Deliver methods to - // call the methods on the connected pin - STDMETHODIMP BeginFlush(void); - STDMETHODIMP EndFlush(void); - virtual HRESULT DeliverBeginFlush(void); - virtual HRESULT DeliverEndFlush(void); - - // deliver NewSegment to connected pin - you will need to - // override this if you queue any data in your output pin. - virtual HRESULT DeliverNewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate); - - //================================================================================ - // IQualityControl methods - //================================================================================ - - // All inherited from CBasePin and not overridden here. - // STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); - // STDMETHODIMP SetSink(IQualityControl * piqc); -}; - - -//===================================================================== -//===================================================================== -// Defines CBaseInputPin -// -// derive your standard input pin from this. -// you need to supply GetMediaType and CheckConnect etc (see CBasePin), -// and you need to supply Receive to do something more useful. -// -//===================================================================== -//===================================================================== - -class AM_NOVTABLE CBaseInputPin : public CBasePin, - public IMemInputPin -{ - -protected: - - IMemAllocator *m_pAllocator; // Default memory allocator - - // allocator is read-only, so received samples - // cannot be modified (probably only relevant to in-place - // transforms - BYTE m_bReadOnly; - -//private: this should really be private... only the MPEG code -// currently looks at it directly and it should use IsFlushing(). - // in flushing state (between BeginFlush and EndFlush) - // if TRUE, all Receives are returned with S_FALSE - BYTE m_bFlushing; - - // Sample properties - initalized in Receive - AM_SAMPLE2_PROPERTIES m_SampleProps; - -public: - - CBaseInputPin( - TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#ifdef UNICODE - CBaseInputPin( - CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#endif - virtual ~CBaseInputPin(); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // return the allocator interface that this input pin - // would like the output pin to use - STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator); - - // tell the input pin which allocator the output pin is actually - // going to use. - STDMETHODIMP NotifyAllocator( - IMemAllocator * pAllocator, - BOOL bReadOnly); - - // do something with this media sample - STDMETHODIMP Receive(IMediaSample *pSample); - - // do something with these media samples - STDMETHODIMP ReceiveMultiple ( - IMediaSample **pSamples, - long nSamples, - long *nSamplesProcessed); - - // See if Receive() blocks - STDMETHODIMP ReceiveCanBlock(); - - // Default handling for BeginFlush - call at the beginning - // of your implementation (makes sure that all Receive calls - // fail). After calling this, you need to free any queued data - // and then call downstream. - STDMETHODIMP BeginFlush(void); - - // default handling for EndFlush - call at end of your implementation - // - before calling this, ensure that there is no queued data and no thread - // pushing any more without a further receive, then call downstream, - // then call this method to clear the m_bFlushing flag and re-enable - // receives - STDMETHODIMP EndFlush(void); - - // this method is optional (can return E_NOTIMPL). - // default implementation returns E_NOTIMPL. Override if you have - // specific alignment or prefix needs, but could use an upstream - // allocator - STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES*pProps); - - // Release the pin's allocator. - HRESULT BreakConnect(); - - // helper method to check the read-only flag - BOOL IsReadOnly() { - return m_bReadOnly; - }; - - // helper method to see if we are flushing - BOOL IsFlushing() { - return m_bFlushing; - }; - - // Override this for checking whether it's OK to process samples - // Also call this from EndOfStream. - virtual HRESULT CheckStreaming(); - - // Pass a Quality notification on to the appropriate sink - HRESULT PassNotify(Quality& q); - - - //================================================================================ - // IQualityControl methods (from CBasePin) - //================================================================================ - - STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); - - // no need to override: - // STDMETHODIMP SetSink(IQualityControl * piqc); - - - // switch the pin to inactive state - may already be inactive - virtual HRESULT Inactive(void); - - // Return sample properties pointer - AM_SAMPLE2_PROPERTIES * SampleProps() { - ASSERT(m_SampleProps.cbData != 0); - return &m_SampleProps; - } - -}; - -/////////////////////////////////////////////////////////////////////////// -// CDynamicOutputPin -// - -class CDynamicOutputPin : public CBaseOutputPin, - public IPinFlowControl -{ -public: -#ifdef UNICODE - CDynamicOutputPin( - CHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); -#endif - - CDynamicOutputPin( - TCHAR *pObjectName, - CBaseFilter *pFilter, - CCritSec *pLock, - HRESULT *phr, - LPCWSTR pName); - - ~CDynamicOutputPin(); - - // IUnknown Methods - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // IPin Methods - STDMETHODIMP Disconnect(void); - - // IPinFlowControl Methods - STDMETHODIMP Block(DWORD dwBlockFlags, HANDLE hEvent); - - // Set graph config info - void SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEvent); - - #ifdef DEBUG - virtual HRESULT Deliver(IMediaSample *pSample); - virtual HRESULT DeliverEndOfStream(void); - virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); - #endif // DEBUG - - HRESULT DeliverBeginFlush(void); - HRESULT DeliverEndFlush(void); - - HRESULT Inactive(void); - HRESULT Active(void); - virtual HRESULT CompleteConnect(IPin *pReceivePin); - - virtual HRESULT StartUsingOutputPin(void); - virtual void StopUsingOutputPin(void); - virtual bool StreamingThreadUsingOutputPin(void); - - HRESULT ChangeOutputFormat - ( - const AM_MEDIA_TYPE *pmt, - REFERENCE_TIME tSegmentStart, - REFERENCE_TIME tSegmentStop, - double dSegmentRate - ); - HRESULT ChangeMediaType(const CMediaType *pmt); - HRESULT DynamicReconnect(const CMediaType *pmt); - -protected: - HRESULT SynchronousBlockOutputPin(void); - HRESULT AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlockedEvent); - HRESULT UnblockOutputPin(void); - - void BlockOutputPin(void); - void ResetBlockState(void); - - static HRESULT WaitEvent(HANDLE hEvent); - - enum BLOCK_STATE - { - NOT_BLOCKED, - PENDING, - BLOCKED - }; - - // This lock should be held when the following class members are - // being used: m_hNotifyCallerPinBlockedEvent, m_BlockState, - // m_dwBlockCallerThreadID and m_dwNumOutstandingOutputPinUsers. - CCritSec m_BlockStateLock; - - // This event should be signaled when the output pin is - // not blocked. This is a manual reset event. For more - // information on events, see the documentation for - // CreateEvent() in the Windows SDK. - HANDLE m_hUnblockOutputPinEvent; - - // This event will be signaled when block operation succeedes or - // when the user cancels the block operation. The block operation - // can be canceled by calling IPinFlowControl2::Block( 0, NULL ) - // while the block operation is pending. - HANDLE m_hNotifyCallerPinBlockedEvent; - - // The state of the current block operation. - BLOCK_STATE m_BlockState; - - // The ID of the thread which last called IPinFlowControl::Block(). - // For more information on thread IDs, see the documentation for - // GetCurrentThreadID() in the Windows SDK. - DWORD m_dwBlockCallerThreadID; - - // The number of times StartUsingOutputPin() has been sucessfully - // called and a corresponding call to StopUsingOutputPin() has not - // been made. When this variable is greater than 0, the streaming - // thread is calling IPin::NewSegment(), IPin::EndOfStream(), - // IMemInputPin::Receive() or IMemInputPin::ReceiveMultiple(). The - // streaming thread could also be calling: DynamicReconnect(), - // ChangeMediaType() or ChangeOutputFormat(). The output pin cannot - // be blocked while the output pin is being used. - DWORD m_dwNumOutstandingOutputPinUsers; - - // This event should be set when the IMediaFilter::Stop() is called. - // This is a manual reset event. It is also set when the output pin - // delivers a flush to the connected input pin. - HANDLE m_hStopEvent; - IGraphConfig* m_pGraphConfig; - - // TRUE if the output pin's allocator's samples are read only. - // Otherwise FALSE. For more information, see the documentation - // for IMemInputPin::NotifyAllocator(). - BOOL m_bPinUsesReadOnlyAllocator; - -private: - HRESULT Initialize(void); - HRESULT ChangeMediaTypeHelper(const CMediaType *pmt); - - #ifdef DEBUG - void AssertValid(void); - #endif // DEBUG -}; - -class CAutoUsingOutputPin -{ -public: - CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr ); - ~CAutoUsingOutputPin(); - -private: - CDynamicOutputPin* m_pOutputPin; -}; - -inline CAutoUsingOutputPin::CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr ) : - m_pOutputPin(NULL) -{ - // The caller should always pass in valid pointers. - ASSERT( NULL != pOutputPin ); - ASSERT( NULL != phr ); - - // Make sure the user initialized phr. - ASSERT( S_OK == *phr ); - - HRESULT hr = pOutputPin->StartUsingOutputPin(); - if( FAILED( hr ) ) - { - *phr = hr; - return; - } - - m_pOutputPin = pOutputPin; -} - -inline CAutoUsingOutputPin::~CAutoUsingOutputPin() -{ - if( NULL != m_pOutputPin ) - { - m_pOutputPin->StopUsingOutputPin(); - } -} - -#ifdef DEBUG - -inline HRESULT CDynamicOutputPin::Deliver(IMediaSample *pSample) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - return CBaseOutputPin::Deliver(pSample); -} - -inline HRESULT CDynamicOutputPin::DeliverEndOfStream(void) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT( StreamingThreadUsingOutputPin() ); - - return CBaseOutputPin::DeliverEndOfStream(); -} - -inline HRESULT CDynamicOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) -{ - // The caller should call StartUsingOutputPin() before calling this - // method. - ASSERT(StreamingThreadUsingOutputPin()); - - return CBaseOutputPin::DeliverNewSegment(tStart, tStop, dRate); -} - -#endif // DEBUG - -//===================================================================== -//===================================================================== -// Memory allocators -// -// the shared memory transport between pins requires the input pin -// to provide a memory allocator that can provide sample objects. A -// sample object supports the IMediaSample interface. -// -// CBaseAllocator handles the management of free and busy samples. It -// allocates CMediaSample objects. CBaseAllocator is an abstract class: -// in particular it has no method of initializing the list of free -// samples. CMemAllocator is derived from CBaseAllocator and initializes -// the list of samples using memory from the standard IMalloc interface. -// -// If you want your buffers to live in some special area of memory, -// derive your allocator object from CBaseAllocator. If you derive your -// IMemInputPin interface object from CBaseMemInputPin, you will get -// CMemAllocator-based allocation etc for free and will just need to -// supply the Receive handling, and media type / format negotiation. -//===================================================================== -//===================================================================== - - -//===================================================================== -//===================================================================== -// Defines CMediaSample -// -// an object of this class supports IMediaSample and represents a buffer -// for media data with some associated properties. Releasing it returns -// it to a freelist managed by a CBaseAllocator derived object. -//===================================================================== -//===================================================================== - -class CMediaSample : public IMediaSample2 // The interface we support -{ - -protected: - - friend class CBaseAllocator; - - /* Values for dwFlags - these are used for backward compatiblity - only now - use AM_SAMPLE_xxx - */ - enum { Sample_SyncPoint = 0x01, /* Is this a sync point */ - Sample_Preroll = 0x02, /* Is this a preroll sample */ - Sample_Discontinuity = 0x04, /* Set if start of new segment */ - Sample_TypeChanged = 0x08, /* Has the type changed */ - Sample_TimeValid = 0x10, /* Set if time is valid */ - Sample_MediaTimeValid = 0x20, /* Is the media time valid */ - Sample_TimeDiscontinuity = 0x40, /* Time discontinuity */ - Sample_StopValid = 0x100, /* Stop time valid */ - Sample_ValidFlags = 0x1FF - }; - - /* Properties, the media sample class can be a container for a format - change in which case we take a copy of a type through the SetMediaType - interface function and then return it when GetMediaType is called. As - we do no internal processing on it we leave it as a pointer */ - - DWORD m_dwFlags; /* Flags for this sample */ - /* Type specific flags are packed - into the top word - */ - DWORD m_dwTypeSpecificFlags; /* Media type specific flags */ - LPBYTE m_pBuffer; /* Pointer to the complete buffer */ - LONG m_lActual; /* Length of data in this sample */ - LONG m_cbBuffer; /* Size of the buffer */ - CBaseAllocator *m_pAllocator; /* The allocator who owns us */ - CMediaSample *m_pNext; /* Chaining in free list */ - REFERENCE_TIME m_Start; /* Start sample time */ - REFERENCE_TIME m_End; /* End sample time */ - LONGLONG m_MediaStart; /* Real media start position */ - LONG m_MediaEnd; /* A difference to get the end */ - AM_MEDIA_TYPE *m_pMediaType; /* Media type change data */ - DWORD m_dwStreamId; /* Stream id */ -public: - LONG m_cRef; /* Reference count */ - - -public: - - CMediaSample( - TCHAR *pName, - CBaseAllocator *pAllocator, - HRESULT *phr, - LPBYTE pBuffer = NULL, - LONG length = 0); -#ifdef UNICODE - CMediaSample( - CHAR *pName, - CBaseAllocator *pAllocator, - HRESULT *phr, - LPBYTE pBuffer = NULL, - LONG length = 0); -#endif - - virtual ~CMediaSample(); - - /* Note the media sample does not delegate to its owner */ - - STDMETHODIMP QueryInterface(REFIID riid, void **ppv); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - // set the buffer pointer and length. Used by allocators that - // want variable sized pointers or pointers into already-read data. - // This is only available through a CMediaSample* not an IMediaSample* - // and so cannot be changed by clients. - HRESULT SetPointer(BYTE * ptr, LONG cBytes); - - // Get me a read/write pointer to this buffer's memory. - STDMETHODIMP GetPointer(BYTE ** ppBuffer); - - STDMETHODIMP_(LONG) GetSize(void); - - // get the stream time at which this sample should start and finish. - STDMETHODIMP GetTime( - REFERENCE_TIME * pTimeStart, // put time here - REFERENCE_TIME * pTimeEnd - ); - - // Set the stream time at which this sample should start and finish. - STDMETHODIMP SetTime( - REFERENCE_TIME * pTimeStart, // put time here - REFERENCE_TIME * pTimeEnd - ); - STDMETHODIMP IsSyncPoint(void); - STDMETHODIMP SetSyncPoint(BOOL bIsSyncPoint); - STDMETHODIMP IsPreroll(void); - STDMETHODIMP SetPreroll(BOOL bIsPreroll); - - STDMETHODIMP_(LONG) GetActualDataLength(void); - STDMETHODIMP SetActualDataLength(LONG lActual); - - // these allow for limited format changes in band - - STDMETHODIMP GetMediaType(AM_MEDIA_TYPE **ppMediaType); - STDMETHODIMP SetMediaType(AM_MEDIA_TYPE *pMediaType); - - // returns S_OK if there is a discontinuity in the data (this same is - // not a continuation of the previous stream of data - // - there has been a seek). - STDMETHODIMP IsDiscontinuity(void); - // set the discontinuity property - TRUE if this sample is not a - // continuation, but a new sample after a seek. - STDMETHODIMP SetDiscontinuity(BOOL bDiscontinuity); - - // get the media times for this sample - STDMETHODIMP GetMediaTime( - LONGLONG * pTimeStart, - LONGLONG * pTimeEnd - ); - - // Set the media times for this sample - STDMETHODIMP SetMediaTime( - LONGLONG * pTimeStart, - LONGLONG * pTimeEnd - ); - - // Set and get properties (IMediaSample2) - STDMETHODIMP GetProperties( - DWORD cbProperties, - BYTE * pbProperties - ); - - STDMETHODIMP SetProperties( - DWORD cbProperties, - const BYTE * pbProperties - ); -}; - - -//===================================================================== -//===================================================================== -// Defines CBaseAllocator -// -// Abstract base class that manages a list of media samples -// -// This class provides support for getting buffers from the free list, -// including handling of commit and (asynchronous) decommit. -// -// Derive from this class and override the Alloc and Free functions to -// allocate your CMediaSample (or derived) objects and add them to the -// free list, preparing them as necessary. -//===================================================================== -//===================================================================== - -class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown - public IMemAllocatorCallbackTemp, // The interface we support - public CCritSec // Provides object locking -{ - class CSampleList; - friend class CSampleList; - - /* Trick to get at protected member in CMediaSample */ - static CMediaSample * &NextSample(CMediaSample *pSample) - { - return pSample->m_pNext; - }; - - /* Mini list class for the free list */ - class CSampleList - { - public: - CSampleList() : m_List(NULL), m_nOnList(0) {}; -#ifdef DEBUG - ~CSampleList() - { - ASSERT(m_nOnList == 0); - }; -#endif - CMediaSample *Head() const { return m_List; }; - CMediaSample *Next(CMediaSample *pSample) const { return CBaseAllocator::NextSample(pSample); }; - int GetCount() const { return m_nOnList; }; - void Add(CMediaSample *pSample) - { - ASSERT(pSample != NULL); - CBaseAllocator::NextSample(pSample) = m_List; - m_List = pSample; - m_nOnList++; - }; - CMediaSample *RemoveHead() - { - CMediaSample *pSample = m_List; - if (pSample != NULL) { - m_List = CBaseAllocator::NextSample(m_List); - m_nOnList--; - } - return pSample; - }; - void Remove(CMediaSample *pSample); - - public: - CMediaSample *m_List; - int m_nOnList; - }; -protected: - - CSampleList m_lFree; // Free list - - /* Note to overriders of CBaseAllocator. - - We use a lazy signalling mechanism for waiting for samples. - This means we don't call the OS if no waits occur. - - In order to implement this: - - 1. When a new sample is added to m_lFree call NotifySample() which - calls ReleaseSemaphore on m_hSem with a count of m_lWaiting and - sets m_lWaiting to 0. - This must all be done holding the allocator's critical section. - - 2. When waiting for a sample call SetWaiting() which increments - m_lWaiting BEFORE leaving the allocator's critical section. - - 3. Actually wait by calling WaitForSingleObject(m_hSem, INFINITE) - having left the allocator's critical section. The effect of - this is to remove 1 from the semaphore's count. You MUST call - this once having incremented m_lWaiting. - - The following are then true when the critical section is not held : - (let nWaiting = number about to wait or waiting) - - (1) if (m_lFree.GetCount() != 0) then (m_lWaiting == 0) - (2) m_lWaiting + Semaphore count == nWaiting - - We would deadlock if - nWaiting != 0 && - m_lFree.GetCount() != 0 && - Semaphore count == 0 - - But from (1) if m_lFree.GetCount() != 0 then m_lWaiting == 0 so - from (2) Semaphore count == nWaiting (which is non-0) so the - deadlock can't happen. - */ - - HANDLE m_hSem; // For signalling - long m_lWaiting; // Waiting for a free element - long m_lCount; // how many buffers we have agreed to provide - long m_lAllocated; // how many buffers are currently allocated - long m_lSize; // agreed size of each buffer - long m_lAlignment; // agreed alignment - long m_lPrefix; // agreed prefix (preceeds GetPointer() value) - BOOL m_bChanged; // Have the buffer requirements changed - - // if true, we are decommitted and can't allocate memory - BOOL m_bCommitted; - // if true, the decommit has happened, but we haven't called Free yet - // as there are still outstanding buffers - BOOL m_bDecommitInProgress; - - // Notification interface - IMemAllocatorNotifyCallbackTemp *m_pNotify; - - BOOL m_fEnableReleaseCallback; - - // called to decommit the memory when the last buffer is freed - // pure virtual - need to override this - virtual void Free(void) PURE; - - // override to allocate the memory when commit called - virtual HRESULT Alloc(void); - -public: - - CBaseAllocator( - TCHAR *, LPUNKNOWN, HRESULT *, - BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE); -#ifdef UNICODE - CBaseAllocator( - CHAR *, LPUNKNOWN, HRESULT *, - BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE); -#endif - virtual ~CBaseAllocator(); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - STDMETHODIMP SetProperties( - ALLOCATOR_PROPERTIES* pRequest, - ALLOCATOR_PROPERTIES* pActual); - - // return the properties actually being used on this allocator - STDMETHODIMP GetProperties( - ALLOCATOR_PROPERTIES* pProps); - - // override Commit to allocate memory. We handle the GetBuffer - //state changes - STDMETHODIMP Commit(); - - // override this to handle the memory freeing. We handle any outstanding - // GetBuffer calls - STDMETHODIMP Decommit(); - - // get container for a sample. Blocking, synchronous call to get the - // next free buffer (as represented by an IMediaSample interface). - // on return, the time etc properties will be invalid, but the buffer - // pointer and size will be correct. The two time parameters are - // optional and either may be NULL, they may alternatively be set to - // the start and end times the sample will have attached to it - // bPrevFramesSkipped is not used (used only by the video renderer's - // allocator where it affects quality management in direct draw). - - STDMETHODIMP GetBuffer(IMediaSample **ppBuffer, - REFERENCE_TIME * pStartTime, - REFERENCE_TIME * pEndTime, - DWORD dwFlags); - - // final release of a CMediaSample will call this - STDMETHODIMP ReleaseBuffer(IMediaSample *pBuffer); - // obsolete:: virtual void PutOnFreeList(CMediaSample * pSample); - - STDMETHODIMP SetNotify(IMemAllocatorNotifyCallbackTemp *pNotify); - - STDMETHODIMP GetFreeCount(LONG *plBuffersFree); - - // Notify that a sample is available - void NotifySample(); - - // Notify that we're waiting for a sample - void SetWaiting() { m_lWaiting++; }; -}; - - -//===================================================================== -//===================================================================== -// Defines CMemAllocator -// -// this is an allocator based on CBaseAllocator that allocates sample -// buffers in main memory (from 'new'). You must call SetProperties -// before calling Commit. -// -// we don't free the memory when going into Decommit state. The simplest -// way to implement this without complicating CBaseAllocator is to -// have a Free() function, called to go into decommit state, that does -// nothing and a ReallyFree function called from our destructor that -// actually frees the memory. -//===================================================================== -//===================================================================== - -// Make me one from quartz.dll -STDAPI CreateMemoryAllocator(IMemAllocator **ppAllocator); - -class CMemAllocator : public CBaseAllocator -{ - -protected: - - LPBYTE m_pBuffer; // combined memory for all buffers - - // override to free the memory when decommit completes - // - we actually do nothing, and save the memory until deletion. - void Free(void); - - // called from the destructor (and from Alloc if changing size/count) to - // actually free up the memory - void ReallyFree(void); - - // overriden to allocate the memory when commit called - HRESULT Alloc(void); - -public: - /* This goes in the factory template table to create new instances */ - static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *); - - STDMETHODIMP SetProperties( - ALLOCATOR_PROPERTIES* pRequest, - ALLOCATOR_PROPERTIES* pActual); - - CMemAllocator(TCHAR *, LPUNKNOWN, HRESULT *); -#ifdef UNICODE - CMemAllocator(CHAR *, LPUNKNOWN, HRESULT *); -#endif - ~CMemAllocator(); -}; - -// helper used by IAMovieSetup implementation -STDAPI -AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata - , IFilterMapper * pIFM - , BOOL bRegister ); - - -/////////////////////////////////////////////////////////////////////////// -// ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ -/////////////////////////////////////////////////////////////////////////// - -#endif /* __FILTER__ */ - - - +//------------------------------------------------------------------------------ +// File: AMFilter.h +// +// Desc: DirectShow base classes - efines class hierarchy for streams +// architecture. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __FILTER__ +#define __FILTER__ + +/* The following classes are declared in this header: */ + +class CBaseMediaFilter; // IMediaFilter support +class CBaseFilter; // IBaseFilter,IMediaFilter support +class CBasePin; // Abstract base class for IPin interface +class CEnumPins; // Enumerate input and output pins +class CEnumMediaTypes; // Enumerate the pin's preferred formats +class CBaseOutputPin; // Adds data provider member functions +class CBaseInputPin; // Implements IMemInputPin interface +class CMediaSample; // Basic transport unit for IMemInputPin +class CBaseAllocator; // General list guff for most allocators +class CMemAllocator; // Implements memory buffer allocation + + +//===================================================================== +//===================================================================== +// +// QueryFilterInfo and QueryPinInfo AddRef the interface pointers +// they return. You can use the macro below to release the interface. +// +//===================================================================== +//===================================================================== + +#define QueryFilterInfoReleaseGraph(fi) if ((fi).pGraph) (fi).pGraph->Release(); + +#define QueryPinInfoReleaseFilter(pi) if ((pi).pFilter) (pi).pFilter->Release(); + +//===================================================================== +//===================================================================== +// Defines CBaseMediaFilter +// +// Abstract base class implementing IMediaFilter. +// +// Typically you will derive your filter from CBaseFilter rather than +// this, unless you are implementing an object such as a plug-in +// distributor that needs to support IMediaFilter but not IBaseFilter. +// +// Note that IMediaFilter is derived from IPersist to allow query of +// class id. +//===================================================================== +//===================================================================== + +class AM_NOVTABLE CBaseMediaFilter : public CUnknown, + public IMediaFilter +{ + +protected: + + FILTER_STATE m_State; // current state: running, paused + IReferenceClock *m_pClock; // this filter's reference clock + // note: all filters in a filter graph use the same clock + + // offset from stream time to reference time + CRefTime m_tStart; + + CLSID m_clsid; // This filters clsid + // used for serialization + CCritSec *m_pLock; // Object we use for locking + +public: + + CBaseMediaFilter( + const TCHAR *pName, + LPUNKNOWN pUnk, + CCritSec *pLock, + REFCLSID clsid); + + virtual ~CBaseMediaFilter(); + + DECLARE_IUNKNOWN + + // override this to say what interfaces we support where + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); + + // + // --- IPersist method --- + // + + STDMETHODIMP GetClassID(CLSID *pClsID); + + // --- IMediaFilter methods --- + + STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State); + + STDMETHODIMP SetSyncSource(IReferenceClock *pClock); + + STDMETHODIMP GetSyncSource(IReferenceClock **pClock); + + // default implementation of Stop and Pause just record the + // state. Override to activate or de-activate your filter. + // Note that Run when called from Stopped state will call Pause + // to ensure activation, so if you are a source or transform + // you will probably not need to override Run. + STDMETHODIMP Stop(); + STDMETHODIMP Pause(); + + + // the start parameter is the difference to be added to the + // sample's stream time to get the reference time for + // its presentation + STDMETHODIMP Run(REFERENCE_TIME tStart); + + // --- helper methods --- + + // return the current stream time - ie find out what + // stream time should be appearing now + virtual HRESULT StreamTime(CRefTime& rtStream); + + // Is the filter currently active? (running or paused) + BOOL IsActive() { + CAutoLock cObjectLock(m_pLock); + return ((m_State == State_Paused) || (m_State == State_Running)); + }; +}; + +//===================================================================== +//===================================================================== +// Defines CBaseFilter +// +// An abstract class providing basic IBaseFilter support for pin +// enumeration and filter information reading. +// +// We cannot derive from CBaseMediaFilter since methods in IMediaFilter +// are also in IBaseFilter and would be ambiguous. Since much of the code +// assumes that they derive from a class that has m_State and other state +// directly available, we duplicate code from CBaseMediaFilter rather than +// having a member variable. +// +// Derive your filter from this, or from a derived object such as +// CTransformFilter. +//===================================================================== +//===================================================================== + + +class AM_NOVTABLE CBaseFilter : public CUnknown, // Handles an IUnknown + public IBaseFilter, // The Filter Interface + public IAMovieSetup // For un/registration +{ + +friend class CBasePin; + +protected: + FILTER_STATE m_State; // current state: running, paused + IReferenceClock *m_pClock; // this graph's ref clock + CRefTime m_tStart; // offset from stream time to reference time + CLSID m_clsid; // This filters clsid + // used for serialization + CCritSec *m_pLock; // Object we use for locking + + WCHAR *m_pName; // Full filter name + IFilterGraph *m_pGraph; // Graph we belong to + IMediaEventSink *m_pSink; // Called with notify events + LONG m_PinVersion; // Current pin version + +public: + + CBaseFilter( + const TCHAR *pName, // Object description + LPUNKNOWN pUnk, // IUnknown of delegating object + CCritSec *pLock, // Object who maintains lock + REFCLSID clsid); // The clsid to be used to serialize this filter + + CBaseFilter( + TCHAR *pName, // Object description + LPUNKNOWN pUnk, // IUnknown of delegating object + CCritSec *pLock, // Object who maintains lock + REFCLSID clsid, // The clsid to be used to serialize this filter + HRESULT *phr); // General OLE return code +#ifdef UNICODE + CBaseFilter( + const CHAR *pName, // Object description + LPUNKNOWN pUnk, // IUnknown of delegating object + CCritSec *pLock, // Object who maintains lock + REFCLSID clsid); // The clsid to be used to serialize this filter + + CBaseFilter( + CHAR *pName, // Object description + LPUNKNOWN pUnk, // IUnknown of delegating object + CCritSec *pLock, // Object who maintains lock + REFCLSID clsid, // The clsid to be used to serialize this filter + HRESULT *phr); // General OLE return code +#endif + ~CBaseFilter(); + + DECLARE_IUNKNOWN + + // override this to say what interfaces we support where + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); +#ifdef DEBUG + STDMETHODIMP_(ULONG) NonDelegatingRelease(); +#endif + + // + // --- IPersist method --- + // + + STDMETHODIMP GetClassID(CLSID *pClsID); + + // --- IMediaFilter methods --- + + STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State); + + STDMETHODIMP SetSyncSource(IReferenceClock *pClock); + + STDMETHODIMP GetSyncSource(IReferenceClock **pClock); + + + // override Stop and Pause so we can activate the pins. + // Note that Run will call Pause first if activation needed. + // Override these if you want to activate your filter rather than + // your pins. + STDMETHODIMP Stop(); + STDMETHODIMP Pause(); + + // the start parameter is the difference to be added to the + // sample's stream time to get the reference time for + // its presentation + STDMETHODIMP Run(REFERENCE_TIME tStart); + + // --- helper methods --- + + // return the current stream time - ie find out what + // stream time should be appearing now + virtual HRESULT StreamTime(CRefTime& rtStream); + + // Is the filter currently active? + BOOL IsActive() { + CAutoLock cObjectLock(m_pLock); + return ((m_State == State_Paused) || (m_State == State_Running)); + }; + + // Is this filter stopped (without locking) + BOOL IsStopped() { + return (m_State == State_Stopped); + }; + + // + // --- IBaseFilter methods --- + // + + // pin enumerator + STDMETHODIMP EnumPins( + IEnumPins ** ppEnum); + + + // default behaviour of FindPin assumes pin ids are their names + STDMETHODIMP FindPin( + LPCWSTR Id, + IPin ** ppPin + ); + + STDMETHODIMP QueryFilterInfo( + FILTER_INFO * pInfo); + + STDMETHODIMP JoinFilterGraph( + IFilterGraph * pGraph, + LPCWSTR pName); + + // return a Vendor information string. Optional - may return E_NOTIMPL. + // memory returned should be freed using CoTaskMemFree + // default implementation returns E_NOTIMPL + STDMETHODIMP QueryVendorInfo( + LPWSTR* pVendorInfo + ); + + // --- helper methods --- + + // send an event notification to the filter graph if we know about it. + // returns S_OK if delivered, S_FALSE if the filter graph does not sink + // events, or an error otherwise. + HRESULT NotifyEvent( + long EventCode, + LONG_PTR EventParam1, + LONG_PTR EventParam2); + + // return the filter graph we belong to + IFilterGraph *GetFilterGraph() { + return m_pGraph; + } + + // Request reconnect + // pPin is the pin to reconnect + // pmt is the type to reconnect with - can be NULL + // Calls ReconnectEx on the filter graph + HRESULT ReconnectPin(IPin *pPin, AM_MEDIA_TYPE const *pmt); + + // find out the current pin version (used by enumerators) + virtual LONG GetPinVersion(); + void IncrementPinVersion(); + + // you need to supply these to access the pins from the enumerator + // and for default Stop and Pause/Run activation. + virtual int GetPinCount() PURE; + virtual CBasePin *GetPin(int n) PURE; + + // --- IAMovieSetup methods --- + + STDMETHODIMP Register(); // ask filter to register itself + STDMETHODIMP Unregister(); // and unregister itself + + // --- setup helper methods --- + // (override to return filters setup data) + + virtual LPAMOVIESETUP_FILTER GetSetupData(){ return NULL; } + +}; + + +//===================================================================== +//===================================================================== +// Defines CBasePin +// +// Abstract class that supports the basics of IPin +//===================================================================== +//===================================================================== + +class AM_NOVTABLE CBasePin : public CUnknown, public IPin, public IQualityControl +{ + +protected: + + WCHAR * m_pName; // This pin's name + IPin *m_Connected; // Pin we have connected to + PIN_DIRECTION m_dir; // Direction of this pin + CCritSec *m_pLock; // Object we use for locking + bool m_bRunTimeError; // Run time error generated + bool m_bCanReconnectWhenActive; // OK to reconnect when active + bool m_bTryMyTypesFirst; // When connecting enumerate + // this pin's types first + CBaseFilter *m_pFilter; // Filter we were created by + IQualityControl *m_pQSink; // Target for Quality messages + LONG m_TypeVersion; // Holds current type version + CMediaType m_mt; // Media type of connection + + CRefTime m_tStart; // time from NewSegment call + CRefTime m_tStop; // time from NewSegment + double m_dRate; // rate from NewSegment + +#ifdef DEBUG + LONG m_cRef; // Ref count tracing +#endif + + // displays pin connection information + +#ifdef DEBUG + void DisplayPinInfo(IPin *pReceivePin); + void DisplayTypeInfo(IPin *pPin, const CMediaType *pmt); +#else + void DisplayPinInfo(IPin *pReceivePin) {}; + void DisplayTypeInfo(IPin *pPin, const CMediaType *pmt) {}; +#endif + + // used to agree a media type for a pin connection + + // given a specific media type, attempt a connection (includes + // checking that the type is acceptable to this pin) + HRESULT + AttemptConnection( + IPin* pReceivePin, // connect to this pin + const CMediaType* pmt // using this type + ); + + // try all the media types in this enumerator - for each that + // we accept, try to connect using ReceiveConnection. + HRESULT TryMediaTypes( + IPin *pReceivePin, // connect to this pin + const CMediaType *pmt, // proposed type from Connect + IEnumMediaTypes *pEnum); // try this enumerator + + // establish a connection with a suitable mediatype. Needs to + // propose a media type if the pmt pointer is null or partially + // specified - use TryMediaTypes on both our and then the other pin's + // enumerator until we find one that works. + HRESULT AgreeMediaType( + IPin *pReceivePin, // connect to this pin + const CMediaType *pmt); // proposed type from Connect + +public: + + CBasePin( + TCHAR *pObjectName, // Object description + CBaseFilter *pFilter, // Owning filter who knows about pins + CCritSec *pLock, // Object who implements the lock + HRESULT *phr, // General OLE return code + LPCWSTR pName, // Pin name for us + PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT +#ifdef UNICODE + CBasePin( + CHAR *pObjectName, // Object description + CBaseFilter *pFilter, // Owning filter who knows about pins + CCritSec *pLock, // Object who implements the lock + HRESULT *phr, // General OLE return code + LPCWSTR pName, // Pin name for us + PIN_DIRECTION dir); // Either PINDIR_INPUT or PINDIR_OUTPUT +#endif + virtual ~CBasePin(); + + DECLARE_IUNKNOWN + + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); + STDMETHODIMP_(ULONG) NonDelegatingRelease(); + STDMETHODIMP_(ULONG) NonDelegatingAddRef(); + + // --- IPin methods --- + + // take lead role in establishing a connection. Media type pointer + // may be null, or may point to partially-specified mediatype + // (subtype or format type may be GUID_NULL). + STDMETHODIMP Connect( + IPin * pReceivePin, + const AM_MEDIA_TYPE *pmt // optional media type + ); + + // (passive) accept a connection from another pin + STDMETHODIMP ReceiveConnection( + IPin * pConnector, // this is the initiating connecting pin + const AM_MEDIA_TYPE *pmt // this is the media type we will exchange + ); + + STDMETHODIMP Disconnect(); + + STDMETHODIMP ConnectedTo(IPin **pPin); + + STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *pmt); + + STDMETHODIMP QueryPinInfo( + PIN_INFO * pInfo + ); + + STDMETHODIMP QueryDirection( + PIN_DIRECTION * pPinDir + ); + + STDMETHODIMP QueryId( + LPWSTR * Id + ); + + // does the pin support this media type + STDMETHODIMP QueryAccept( + const AM_MEDIA_TYPE *pmt + ); + + // return an enumerator for this pins preferred media types + STDMETHODIMP EnumMediaTypes( + IEnumMediaTypes **ppEnum + ); + + // return an array of IPin* - the pins that this pin internally connects to + // All pins put in the array must be AddReffed (but no others) + // Errors: "Can't say" - FAIL, not enough slots - return S_FALSE + // Default: return E_NOTIMPL + // The filter graph will interpret NOT_IMPL as any input pin connects to + // all visible output pins and vice versa. + // apPin can be NULL if nPin==0 (not otherwise). + STDMETHODIMP QueryInternalConnections( + IPin* *apPin, // array of IPin* + ULONG *nPin // on input, the number of slots + // on output the number of pins + ) { return E_NOTIMPL; } + + // Called when no more data will be sent + STDMETHODIMP EndOfStream(void); + + // Begin/EndFlush still PURE + + // NewSegment notifies of the start/stop/rate applying to the data + // about to be received. Default implementation records data and + // returns S_OK. + // Override this to pass downstream. + STDMETHODIMP NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate); + + //================================================================================ + // IQualityControl methods + //================================================================================ + + STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); + + STDMETHODIMP SetSink(IQualityControl * piqc); + + // --- helper methods --- + + // Returns true if the pin is connected. false otherwise. + BOOL IsConnected(void) {return (m_Connected != NULL); }; + // Return the pin this is connected to (if any) + IPin * GetConnected() { return m_Connected; }; + + // Check if our filter is currently stopped + BOOL IsStopped() { + return (m_pFilter->m_State == State_Stopped); + }; + + // find out the current type version (used by enumerators) + virtual LONG GetMediaTypeVersion(); + void IncrementTypeVersion(); + + // switch the pin to active (paused or running) mode + // not an error to call this if already active + virtual HRESULT Active(void); + + // switch the pin to inactive state - may already be inactive + virtual HRESULT Inactive(void); + + // Notify of Run() from filter + virtual HRESULT Run(REFERENCE_TIME tStart); + + // check if the pin can support this specific proposed type and format + virtual HRESULT CheckMediaType(const CMediaType *) PURE; + + // set the connection to use this format (previously agreed) + virtual HRESULT SetMediaType(const CMediaType *); + + // check that the connection is ok before verifying it + // can be overridden eg to check what interfaces will be supported. + virtual HRESULT CheckConnect(IPin *); + + // Set and release resources required for a connection + virtual HRESULT BreakConnect(); + virtual HRESULT CompleteConnect(IPin *pReceivePin); + + // returns the preferred formats for a pin + virtual HRESULT GetMediaType(int iPosition,CMediaType *pMediaType); + + // access to NewSegment values + REFERENCE_TIME CurrentStopTime() { + return m_tStop; + } + REFERENCE_TIME CurrentStartTime() { + return m_tStart; + } + double CurrentRate() { + return m_dRate; + } + + // Access name + LPWSTR Name() { return m_pName; }; + + // Can reconnectwhen active? + void SetReconnectWhenActive(bool bCanReconnect) + { + m_bCanReconnectWhenActive = bCanReconnect; + } + + bool CanReconnectWhenActive() + { + return m_bCanReconnectWhenActive; + } + +protected: + STDMETHODIMP DisconnectInternal(); +}; + + +//===================================================================== +//===================================================================== +// Defines CEnumPins +// +// Pin enumerator class that works by calling CBaseFilter. This interface +// is provided by CBaseFilter::EnumPins and calls GetPinCount() and +// GetPin() to enumerate existing pins. Needs to be a separate object so +// that it can be cloned (creating an existing object at the same +// position in the enumeration) +// +//===================================================================== +//===================================================================== + +class CEnumPins : public IEnumPins // The interface we support +{ + int m_Position; // Current ordinal position + int m_PinCount; // Number of pins available + CBaseFilter *m_pFilter; // The filter who owns us + LONG m_Version; // Pin version information + LONG m_cRef; + + typedef CGenericList CPinList; + + CPinList m_PinCache; // These pointers have not been AddRef'ed and + // so they should not be dereferenced. They are + // merely kept to ID which pins have been enumerated. + +#ifdef DEBUG + DWORD m_dwCookie; +#endif + + /* If while we are retrieving a pin for example from the filter an error + occurs we assume that our internal state is stale with respect to the + filter (someone may have deleted all the pins). We can check before + starting whether or not the operation is likely to fail by asking the + filter what it's current version number is. If the filter has not + overriden the GetPinVersion method then this will always match */ + + BOOL AreWeOutOfSync() { + return (m_pFilter->GetPinVersion() == m_Version ? FALSE : TRUE); + }; + + /* This method performs the same operations as Reset, except is does not clear + the cache of pins already enumerated. */ + + STDMETHODIMP Refresh(); + +public: + + CEnumPins( + CBaseFilter *pFilter, + CEnumPins *pEnumPins); + + virtual ~CEnumPins(); + + // IUnknown + STDMETHODIMP QueryInterface(REFIID riid, void **ppv); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // IEnumPins + STDMETHODIMP Next( + ULONG cPins, // place this many pins... + IPin ** ppPins, // ...in this array of IPin* + ULONG * pcFetched // actual count passed returned here + ); + + STDMETHODIMP Skip(ULONG cPins); + STDMETHODIMP Reset(); + STDMETHODIMP Clone(IEnumPins **ppEnum); + + +}; + + +//===================================================================== +//===================================================================== +// Defines CEnumMediaTypes +// +// Enumerates the preferred formats for input and output pins +//===================================================================== +//===================================================================== + +class CEnumMediaTypes : public IEnumMediaTypes // The interface we support +{ + int m_Position; // Current ordinal position + CBasePin *m_pPin; // The pin who owns us + LONG m_Version; // Media type version value + LONG m_cRef; +#ifdef DEBUG + DWORD m_dwCookie; +#endif + + /* The media types a filter supports can be quite dynamic so we add to + the general IEnumXXXX interface the ability to be signaled when they + change via an event handle the connected filter supplies. Until the + Reset method is called after the state changes all further calls to + the enumerator (except Reset) will return E_UNEXPECTED error code */ + + BOOL AreWeOutOfSync() { + return (m_pPin->GetMediaTypeVersion() == m_Version ? FALSE : TRUE); + }; + +public: + + CEnumMediaTypes( + CBasePin *pPin, + CEnumMediaTypes *pEnumMediaTypes); + + virtual ~CEnumMediaTypes(); + + // IUnknown + STDMETHODIMP QueryInterface(REFIID riid, void **ppv); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // IEnumMediaTypes + STDMETHODIMP Next( + ULONG cMediaTypes, // place this many pins... + AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array + ULONG * pcFetched // actual count passed + ); + + STDMETHODIMP Skip(ULONG cMediaTypes); + STDMETHODIMP Reset(); + STDMETHODIMP Clone(IEnumMediaTypes **ppEnum); +}; + + + + +//===================================================================== +//===================================================================== +// Defines CBaseOutputPin +// +// class derived from CBasePin that can pass buffers to a connected pin +// that supports IMemInputPin. Supports IPin. +// +// Derive your output pin from this. +// +//===================================================================== +//===================================================================== + +class AM_NOVTABLE CBaseOutputPin : public CBasePin +{ + +protected: + + IMemAllocator *m_pAllocator; + IMemInputPin *m_pInputPin; // interface on the downstreaminput pin + // set up in CheckConnect when we connect. + +public: + + CBaseOutputPin( + TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#ifdef UNICODE + CBaseOutputPin( + CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#endif + // override CompleteConnect() so we can negotiate an allocator + virtual HRESULT CompleteConnect(IPin *pReceivePin); + + // negotiate the allocator and its buffer size/count and other properties + // Calls DecideBufferSize to set properties + virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc); + + // override this to set the buffer size and count. Return an error + // if the size/count is not to your liking. + // The allocator properties passed in are those requested by the + // input pin - use eg the alignment and prefix members if you have + // no preference on these. + virtual HRESULT DecideBufferSize( + IMemAllocator * pAlloc, + ALLOCATOR_PROPERTIES * ppropInputRequest + ) PURE; + + // returns an empty sample buffer from the allocator + virtual HRESULT GetDeliveryBuffer(IMediaSample ** ppSample, + REFERENCE_TIME * pStartTime, + REFERENCE_TIME * pEndTime, + DWORD dwFlags); + + // deliver a filled-in sample to the connected input pin + // note - you need to release it after calling this. The receiving + // pin will addref the sample if it needs to hold it beyond the + // call. + virtual HRESULT Deliver(IMediaSample *); + + // override this to control the connection + virtual HRESULT InitAllocator(IMemAllocator **ppAlloc); + HRESULT CheckConnect(IPin *pPin); + HRESULT BreakConnect(); + + // override to call Commit and Decommit + HRESULT Active(void); + HRESULT Inactive(void); + + // we have a default handling of EndOfStream which is to return + // an error, since this should be called on input pins only + STDMETHODIMP EndOfStream(void); + + // called from elsewhere in our filter to pass EOS downstream to + // our connected input pin + virtual HRESULT DeliverEndOfStream(void); + + // same for Begin/EndFlush - we handle Begin/EndFlush since it + // is an error on an output pin, and we have Deliver methods to + // call the methods on the connected pin + STDMETHODIMP BeginFlush(void); + STDMETHODIMP EndFlush(void); + virtual HRESULT DeliverBeginFlush(void); + virtual HRESULT DeliverEndFlush(void); + + // deliver NewSegment to connected pin - you will need to + // override this if you queue any data in your output pin. + virtual HRESULT DeliverNewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate); + + //================================================================================ + // IQualityControl methods + //================================================================================ + + // All inherited from CBasePin and not overridden here. + // STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); + // STDMETHODIMP SetSink(IQualityControl * piqc); +}; + + +//===================================================================== +//===================================================================== +// Defines CBaseInputPin +// +// derive your standard input pin from this. +// you need to supply GetMediaType and CheckConnect etc (see CBasePin), +// and you need to supply Receive to do something more useful. +// +//===================================================================== +//===================================================================== + +class AM_NOVTABLE CBaseInputPin : public CBasePin, + public IMemInputPin +{ + +protected: + + IMemAllocator *m_pAllocator; // Default memory allocator + + // allocator is read-only, so received samples + // cannot be modified (probably only relevant to in-place + // transforms + BYTE m_bReadOnly; + +//private: this should really be private... only the MPEG code +// currently looks at it directly and it should use IsFlushing(). + // in flushing state (between BeginFlush and EndFlush) + // if TRUE, all Receives are returned with S_FALSE + BYTE m_bFlushing; + + // Sample properties - initalized in Receive + AM_SAMPLE2_PROPERTIES m_SampleProps; + +public: + + CBaseInputPin( + TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#ifdef UNICODE + CBaseInputPin( + CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#endif + virtual ~CBaseInputPin(); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // return the allocator interface that this input pin + // would like the output pin to use + STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator); + + // tell the input pin which allocator the output pin is actually + // going to use. + STDMETHODIMP NotifyAllocator( + IMemAllocator * pAllocator, + BOOL bReadOnly); + + // do something with this media sample + STDMETHODIMP Receive(IMediaSample *pSample); + + // do something with these media samples + STDMETHODIMP ReceiveMultiple ( + IMediaSample **pSamples, + long nSamples, + long *nSamplesProcessed); + + // See if Receive() blocks + STDMETHODIMP ReceiveCanBlock(); + + // Default handling for BeginFlush - call at the beginning + // of your implementation (makes sure that all Receive calls + // fail). After calling this, you need to free any queued data + // and then call downstream. + STDMETHODIMP BeginFlush(void); + + // default handling for EndFlush - call at end of your implementation + // - before calling this, ensure that there is no queued data and no thread + // pushing any more without a further receive, then call downstream, + // then call this method to clear the m_bFlushing flag and re-enable + // receives + STDMETHODIMP EndFlush(void); + + // this method is optional (can return E_NOTIMPL). + // default implementation returns E_NOTIMPL. Override if you have + // specific alignment or prefix needs, but could use an upstream + // allocator + STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES*pProps); + + // Release the pin's allocator. + HRESULT BreakConnect(); + + // helper method to check the read-only flag + BOOL IsReadOnly() { + return m_bReadOnly; + }; + + // helper method to see if we are flushing + BOOL IsFlushing() { + return m_bFlushing; + }; + + // Override this for checking whether it's OK to process samples + // Also call this from EndOfStream. + virtual HRESULT CheckStreaming(); + + // Pass a Quality notification on to the appropriate sink + HRESULT PassNotify(Quality& q); + + + //================================================================================ + // IQualityControl methods (from CBasePin) + //================================================================================ + + STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); + + // no need to override: + // STDMETHODIMP SetSink(IQualityControl * piqc); + + + // switch the pin to inactive state - may already be inactive + virtual HRESULT Inactive(void); + + // Return sample properties pointer + AM_SAMPLE2_PROPERTIES * SampleProps() { + ASSERT(m_SampleProps.cbData != 0); + return &m_SampleProps; + } + +}; + +/////////////////////////////////////////////////////////////////////////// +// CDynamicOutputPin +// + +class CDynamicOutputPin : public CBaseOutputPin, + public IPinFlowControl +{ +public: +#ifdef UNICODE + CDynamicOutputPin( + CHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); +#endif + + CDynamicOutputPin( + TCHAR *pObjectName, + CBaseFilter *pFilter, + CCritSec *pLock, + HRESULT *phr, + LPCWSTR pName); + + ~CDynamicOutputPin(); + + // IUnknown Methods + DECLARE_IUNKNOWN + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // IPin Methods + STDMETHODIMP Disconnect(void); + + // IPinFlowControl Methods + STDMETHODIMP Block(DWORD dwBlockFlags, HANDLE hEvent); + + // Set graph config info + void SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEvent); + + #ifdef DEBUG + virtual HRESULT Deliver(IMediaSample *pSample); + virtual HRESULT DeliverEndOfStream(void); + virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); + #endif // DEBUG + + HRESULT DeliverBeginFlush(void); + HRESULT DeliverEndFlush(void); + + HRESULT Inactive(void); + HRESULT Active(void); + virtual HRESULT CompleteConnect(IPin *pReceivePin); + + virtual HRESULT StartUsingOutputPin(void); + virtual void StopUsingOutputPin(void); + virtual bool StreamingThreadUsingOutputPin(void); + + HRESULT ChangeOutputFormat + ( + const AM_MEDIA_TYPE *pmt, + REFERENCE_TIME tSegmentStart, + REFERENCE_TIME tSegmentStop, + double dSegmentRate + ); + HRESULT ChangeMediaType(const CMediaType *pmt); + HRESULT DynamicReconnect(const CMediaType *pmt); + +protected: + HRESULT SynchronousBlockOutputPin(void); + HRESULT AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlockedEvent); + HRESULT UnblockOutputPin(void); + + void BlockOutputPin(void); + void ResetBlockState(void); + + static HRESULT WaitEvent(HANDLE hEvent); + + enum BLOCK_STATE + { + NOT_BLOCKED, + PENDING, + BLOCKED + }; + + // This lock should be held when the following class members are + // being used: m_hNotifyCallerPinBlockedEvent, m_BlockState, + // m_dwBlockCallerThreadID and m_dwNumOutstandingOutputPinUsers. + CCritSec m_BlockStateLock; + + // This event should be signaled when the output pin is + // not blocked. This is a manual reset event. For more + // information on events, see the documentation for + // CreateEvent() in the Windows SDK. + HANDLE m_hUnblockOutputPinEvent; + + // This event will be signaled when block operation succeedes or + // when the user cancels the block operation. The block operation + // can be canceled by calling IPinFlowControl2::Block( 0, NULL ) + // while the block operation is pending. + HANDLE m_hNotifyCallerPinBlockedEvent; + + // The state of the current block operation. + BLOCK_STATE m_BlockState; + + // The ID of the thread which last called IPinFlowControl::Block(). + // For more information on thread IDs, see the documentation for + // GetCurrentThreadID() in the Windows SDK. + DWORD m_dwBlockCallerThreadID; + + // The number of times StartUsingOutputPin() has been sucessfully + // called and a corresponding call to StopUsingOutputPin() has not + // been made. When this variable is greater than 0, the streaming + // thread is calling IPin::NewSegment(), IPin::EndOfStream(), + // IMemInputPin::Receive() or IMemInputPin::ReceiveMultiple(). The + // streaming thread could also be calling: DynamicReconnect(), + // ChangeMediaType() or ChangeOutputFormat(). The output pin cannot + // be blocked while the output pin is being used. + DWORD m_dwNumOutstandingOutputPinUsers; + + // This event should be set when the IMediaFilter::Stop() is called. + // This is a manual reset event. It is also set when the output pin + // delivers a flush to the connected input pin. + HANDLE m_hStopEvent; + IGraphConfig* m_pGraphConfig; + + // TRUE if the output pin's allocator's samples are read only. + // Otherwise FALSE. For more information, see the documentation + // for IMemInputPin::NotifyAllocator(). + BOOL m_bPinUsesReadOnlyAllocator; + +private: + HRESULT Initialize(void); + HRESULT ChangeMediaTypeHelper(const CMediaType *pmt); + + #ifdef DEBUG + void AssertValid(void); + #endif // DEBUG +}; + +class CAutoUsingOutputPin +{ +public: + CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr ); + ~CAutoUsingOutputPin(); + +private: + CDynamicOutputPin* m_pOutputPin; +}; + +inline CAutoUsingOutputPin::CAutoUsingOutputPin( CDynamicOutputPin* pOutputPin, HRESULT* phr ) : + m_pOutputPin(NULL) +{ + // The caller should always pass in valid pointers. + ASSERT( NULL != pOutputPin ); + ASSERT( NULL != phr ); + + // Make sure the user initialized phr. + ASSERT( S_OK == *phr ); + + HRESULT hr = pOutputPin->StartUsingOutputPin(); + if( FAILED( hr ) ) + { + *phr = hr; + return; + } + + m_pOutputPin = pOutputPin; +} + +inline CAutoUsingOutputPin::~CAutoUsingOutputPin() +{ + if( NULL != m_pOutputPin ) + { + m_pOutputPin->StopUsingOutputPin(); + } +} + +#ifdef DEBUG + +inline HRESULT CDynamicOutputPin::Deliver(IMediaSample *pSample) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + return CBaseOutputPin::Deliver(pSample); +} + +inline HRESULT CDynamicOutputPin::DeliverEndOfStream(void) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT( StreamingThreadUsingOutputPin() ); + + return CBaseOutputPin::DeliverEndOfStream(); +} + +inline HRESULT CDynamicOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) +{ + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin()); + + return CBaseOutputPin::DeliverNewSegment(tStart, tStop, dRate); +} + +#endif // DEBUG + +//===================================================================== +//===================================================================== +// Memory allocators +// +// the shared memory transport between pins requires the input pin +// to provide a memory allocator that can provide sample objects. A +// sample object supports the IMediaSample interface. +// +// CBaseAllocator handles the management of free and busy samples. It +// allocates CMediaSample objects. CBaseAllocator is an abstract class: +// in particular it has no method of initializing the list of free +// samples. CMemAllocator is derived from CBaseAllocator and initializes +// the list of samples using memory from the standard IMalloc interface. +// +// If you want your buffers to live in some special area of memory, +// derive your allocator object from CBaseAllocator. If you derive your +// IMemInputPin interface object from CBaseMemInputPin, you will get +// CMemAllocator-based allocation etc for free and will just need to +// supply the Receive handling, and media type / format negotiation. +//===================================================================== +//===================================================================== + + +//===================================================================== +//===================================================================== +// Defines CMediaSample +// +// an object of this class supports IMediaSample and represents a buffer +// for media data with some associated properties. Releasing it returns +// it to a freelist managed by a CBaseAllocator derived object. +//===================================================================== +//===================================================================== + +class CMediaSample : public IMediaSample2 // The interface we support +{ + +protected: + + friend class CBaseAllocator; + + /* Values for dwFlags - these are used for backward compatiblity + only now - use AM_SAMPLE_xxx + */ + enum { Sample_SyncPoint = 0x01, /* Is this a sync point */ + Sample_Preroll = 0x02, /* Is this a preroll sample */ + Sample_Discontinuity = 0x04, /* Set if start of new segment */ + Sample_TypeChanged = 0x08, /* Has the type changed */ + Sample_TimeValid = 0x10, /* Set if time is valid */ + Sample_MediaTimeValid = 0x20, /* Is the media time valid */ + Sample_TimeDiscontinuity = 0x40, /* Time discontinuity */ + Sample_StopValid = 0x100, /* Stop time valid */ + Sample_ValidFlags = 0x1FF + }; + + /* Properties, the media sample class can be a container for a format + change in which case we take a copy of a type through the SetMediaType + interface function and then return it when GetMediaType is called. As + we do no internal processing on it we leave it as a pointer */ + + DWORD m_dwFlags; /* Flags for this sample */ + /* Type specific flags are packed + into the top word + */ + DWORD m_dwTypeSpecificFlags; /* Media type specific flags */ + LPBYTE m_pBuffer; /* Pointer to the complete buffer */ + LONG m_lActual; /* Length of data in this sample */ + LONG m_cbBuffer; /* Size of the buffer */ + CBaseAllocator *m_pAllocator; /* The allocator who owns us */ + CMediaSample *m_pNext; /* Chaining in free list */ + REFERENCE_TIME m_Start; /* Start sample time */ + REFERENCE_TIME m_End; /* End sample time */ + LONGLONG m_MediaStart; /* Real media start position */ + LONG m_MediaEnd; /* A difference to get the end */ + AM_MEDIA_TYPE *m_pMediaType; /* Media type change data */ + DWORD m_dwStreamId; /* Stream id */ +public: + LONG m_cRef; /* Reference count */ + + +public: + + CMediaSample( + TCHAR *pName, + CBaseAllocator *pAllocator, + HRESULT *phr, + LPBYTE pBuffer = NULL, + LONG length = 0); +#ifdef UNICODE + CMediaSample( + CHAR *pName, + CBaseAllocator *pAllocator, + HRESULT *phr, + LPBYTE pBuffer = NULL, + LONG length = 0); +#endif + + virtual ~CMediaSample(); + + /* Note the media sample does not delegate to its owner */ + + STDMETHODIMP QueryInterface(REFIID riid, void **ppv); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // set the buffer pointer and length. Used by allocators that + // want variable sized pointers or pointers into already-read data. + // This is only available through a CMediaSample* not an IMediaSample* + // and so cannot be changed by clients. + HRESULT SetPointer(BYTE * ptr, LONG cBytes); + + // Get me a read/write pointer to this buffer's memory. + STDMETHODIMP GetPointer(BYTE ** ppBuffer); + + STDMETHODIMP_(LONG) GetSize(void); + + // get the stream time at which this sample should start and finish. + STDMETHODIMP GetTime( + REFERENCE_TIME * pTimeStart, // put time here + REFERENCE_TIME * pTimeEnd + ); + + // Set the stream time at which this sample should start and finish. + STDMETHODIMP SetTime( + REFERENCE_TIME * pTimeStart, // put time here + REFERENCE_TIME * pTimeEnd + ); + STDMETHODIMP IsSyncPoint(void); + STDMETHODIMP SetSyncPoint(BOOL bIsSyncPoint); + STDMETHODIMP IsPreroll(void); + STDMETHODIMP SetPreroll(BOOL bIsPreroll); + + STDMETHODIMP_(LONG) GetActualDataLength(void); + STDMETHODIMP SetActualDataLength(LONG lActual); + + // these allow for limited format changes in band + + STDMETHODIMP GetMediaType(AM_MEDIA_TYPE **ppMediaType); + STDMETHODIMP SetMediaType(AM_MEDIA_TYPE *pMediaType); + + // returns S_OK if there is a discontinuity in the data (this same is + // not a continuation of the previous stream of data + // - there has been a seek). + STDMETHODIMP IsDiscontinuity(void); + // set the discontinuity property - TRUE if this sample is not a + // continuation, but a new sample after a seek. + STDMETHODIMP SetDiscontinuity(BOOL bDiscontinuity); + + // get the media times for this sample + STDMETHODIMP GetMediaTime( + LONGLONG * pTimeStart, + LONGLONG * pTimeEnd + ); + + // Set the media times for this sample + STDMETHODIMP SetMediaTime( + LONGLONG * pTimeStart, + LONGLONG * pTimeEnd + ); + + // Set and get properties (IMediaSample2) + STDMETHODIMP GetProperties( + DWORD cbProperties, + BYTE * pbProperties + ); + + STDMETHODIMP SetProperties( + DWORD cbProperties, + const BYTE * pbProperties + ); +}; + + +//===================================================================== +//===================================================================== +// Defines CBaseAllocator +// +// Abstract base class that manages a list of media samples +// +// This class provides support for getting buffers from the free list, +// including handling of commit and (asynchronous) decommit. +// +// Derive from this class and override the Alloc and Free functions to +// allocate your CMediaSample (or derived) objects and add them to the +// free list, preparing them as necessary. +//===================================================================== +//===================================================================== + +class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown + public IMemAllocatorCallbackTemp, // The interface we support + public CCritSec // Provides object locking +{ + class CSampleList; + friend class CSampleList; + + /* Trick to get at protected member in CMediaSample */ + static CMediaSample * &NextSample(CMediaSample *pSample) + { + return pSample->m_pNext; + }; + + /* Mini list class for the free list */ + class CSampleList + { + public: + CSampleList() : m_List(NULL), m_nOnList(0) {}; +#ifdef DEBUG + ~CSampleList() + { + ASSERT(m_nOnList == 0); + }; +#endif + CMediaSample *Head() const { return m_List; }; + CMediaSample *Next(CMediaSample *pSample) const { return CBaseAllocator::NextSample(pSample); }; + int GetCount() const { return m_nOnList; }; + void Add(CMediaSample *pSample) + { + ASSERT(pSample != NULL); + CBaseAllocator::NextSample(pSample) = m_List; + m_List = pSample; + m_nOnList++; + }; + CMediaSample *RemoveHead() + { + CMediaSample *pSample = m_List; + if (pSample != NULL) { + m_List = CBaseAllocator::NextSample(m_List); + m_nOnList--; + } + return pSample; + }; + void Remove(CMediaSample *pSample); + + public: + CMediaSample *m_List; + int m_nOnList; + }; +protected: + + CSampleList m_lFree; // Free list + + /* Note to overriders of CBaseAllocator. + + We use a lazy signalling mechanism for waiting for samples. + This means we don't call the OS if no waits occur. + + In order to implement this: + + 1. When a new sample is added to m_lFree call NotifySample() which + calls ReleaseSemaphore on m_hSem with a count of m_lWaiting and + sets m_lWaiting to 0. + This must all be done holding the allocator's critical section. + + 2. When waiting for a sample call SetWaiting() which increments + m_lWaiting BEFORE leaving the allocator's critical section. + + 3. Actually wait by calling WaitForSingleObject(m_hSem, INFINITE) + having left the allocator's critical section. The effect of + this is to remove 1 from the semaphore's count. You MUST call + this once having incremented m_lWaiting. + + The following are then true when the critical section is not held : + (let nWaiting = number about to wait or waiting) + + (1) if (m_lFree.GetCount() != 0) then (m_lWaiting == 0) + (2) m_lWaiting + Semaphore count == nWaiting + + We would deadlock if + nWaiting != 0 && + m_lFree.GetCount() != 0 && + Semaphore count == 0 + + But from (1) if m_lFree.GetCount() != 0 then m_lWaiting == 0 so + from (2) Semaphore count == nWaiting (which is non-0) so the + deadlock can't happen. + */ + + HANDLE m_hSem; // For signalling + long m_lWaiting; // Waiting for a free element + long m_lCount; // how many buffers we have agreed to provide + long m_lAllocated; // how many buffers are currently allocated + long m_lSize; // agreed size of each buffer + long m_lAlignment; // agreed alignment + long m_lPrefix; // agreed prefix (preceeds GetPointer() value) + BOOL m_bChanged; // Have the buffer requirements changed + + // if true, we are decommitted and can't allocate memory + BOOL m_bCommitted; + // if true, the decommit has happened, but we haven't called Free yet + // as there are still outstanding buffers + BOOL m_bDecommitInProgress; + + // Notification interface + IMemAllocatorNotifyCallbackTemp *m_pNotify; + + BOOL m_fEnableReleaseCallback; + + // called to decommit the memory when the last buffer is freed + // pure virtual - need to override this + virtual void Free(void) PURE; + + // override to allocate the memory when commit called + virtual HRESULT Alloc(void); + +public: + + CBaseAllocator( + TCHAR *, LPUNKNOWN, HRESULT *, + BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE); +#ifdef UNICODE + CBaseAllocator( + CHAR *, LPUNKNOWN, HRESULT *, + BOOL bEvent = TRUE, BOOL fEnableReleaseCallback = FALSE); +#endif + virtual ~CBaseAllocator(); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + STDMETHODIMP SetProperties( + ALLOCATOR_PROPERTIES* pRequest, + ALLOCATOR_PROPERTIES* pActual); + + // return the properties actually being used on this allocator + STDMETHODIMP GetProperties( + ALLOCATOR_PROPERTIES* pProps); + + // override Commit to allocate memory. We handle the GetBuffer + //state changes + STDMETHODIMP Commit(); + + // override this to handle the memory freeing. We handle any outstanding + // GetBuffer calls + STDMETHODIMP Decommit(); + + // get container for a sample. Blocking, synchronous call to get the + // next free buffer (as represented by an IMediaSample interface). + // on return, the time etc properties will be invalid, but the buffer + // pointer and size will be correct. The two time parameters are + // optional and either may be NULL, they may alternatively be set to + // the start and end times the sample will have attached to it + // bPrevFramesSkipped is not used (used only by the video renderer's + // allocator where it affects quality management in direct draw). + + STDMETHODIMP GetBuffer(IMediaSample **ppBuffer, + REFERENCE_TIME * pStartTime, + REFERENCE_TIME * pEndTime, + DWORD dwFlags); + + // final release of a CMediaSample will call this + STDMETHODIMP ReleaseBuffer(IMediaSample *pBuffer); + // obsolete:: virtual void PutOnFreeList(CMediaSample * pSample); + + STDMETHODIMP SetNotify(IMemAllocatorNotifyCallbackTemp *pNotify); + + STDMETHODIMP GetFreeCount(LONG *plBuffersFree); + + // Notify that a sample is available + void NotifySample(); + + // Notify that we're waiting for a sample + void SetWaiting() { m_lWaiting++; }; +}; + + +//===================================================================== +//===================================================================== +// Defines CMemAllocator +// +// this is an allocator based on CBaseAllocator that allocates sample +// buffers in main memory (from 'new'). You must call SetProperties +// before calling Commit. +// +// we don't free the memory when going into Decommit state. The simplest +// way to implement this without complicating CBaseAllocator is to +// have a Free() function, called to go into decommit state, that does +// nothing and a ReallyFree function called from our destructor that +// actually frees the memory. +//===================================================================== +//===================================================================== + +// Make me one from quartz.dll +STDAPI CreateMemoryAllocator(IMemAllocator **ppAllocator); + +class CMemAllocator : public CBaseAllocator +{ + +protected: + + LPBYTE m_pBuffer; // combined memory for all buffers + + // override to free the memory when decommit completes + // - we actually do nothing, and save the memory until deletion. + void Free(void); + + // called from the destructor (and from Alloc if changing size/count) to + // actually free up the memory + void ReallyFree(void); + + // overriden to allocate the memory when commit called + HRESULT Alloc(void); + +public: + /* This goes in the factory template table to create new instances */ + static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *); + + STDMETHODIMP SetProperties( + ALLOCATOR_PROPERTIES* pRequest, + ALLOCATOR_PROPERTIES* pActual); + + CMemAllocator(TCHAR *, LPUNKNOWN, HRESULT *); +#ifdef UNICODE + CMemAllocator(CHAR *, LPUNKNOWN, HRESULT *); +#endif + ~CMemAllocator(); +}; + +// helper used by IAMovieSetup implementation +STDAPI +AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata + , IFilterMapper * pIFM + , BOOL bRegister ); + + +/////////////////////////////////////////////////////////////////////////// +// ------------------------------------------------------------------------ +// ------------------------------------------------------------------------ +// ------------------------------------------------------------------------ +// ------------------------------------------------------------------------ +/////////////////////////////////////////////////////////////////////////// + +#endif /* __FILTER__ */ + + + diff --git a/src/BaseClasses/amvideo.cpp b/src/BaseClasses/amvideo.cpp index 42fe446de6..5c2755d61d 100644 --- a/src/BaseClasses/amvideo.cpp +++ b/src/BaseClasses/amvideo.cpp @@ -1,275 +1,275 @@ -//------------------------------------------------------------------------------ -// File: AMVideo.cpp -// -// Desc: DirectShow base classes - implements helper functions for -// bitmap formats. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - -// These are bit field masks for true colour devices - -const DWORD bits555[] = {0x007C00,0x0003E0,0x00001F}; -const DWORD bits565[] = {0x00F800,0x0007E0,0x00001F}; -const DWORD bits888[] = {0xFF0000,0x00FF00,0x0000FF}; - -// This maps bitmap subtypes into a bits per pixel value and also a -// name. unicode and ansi versions are stored because we have to -// return a pointer to a static string. -const struct { - const GUID *pSubtype; - WORD BitCount; - CHAR *pName; - WCHAR *wszName; -} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome", - &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA", - &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8", - &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)", - &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)", - &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24", - &MEDIASUBTYPE_RGB32, 32, "RGB 32", L"RGB 32", - &MEDIASUBTYPE_ARGB32, 32, "ARGB 32", L"ARGB 32", - &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay", - &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN" -}; - -// Return the size of the bitmap as defined by this header - -STDAPI_(DWORD) GetBitmapSize(const BITMAPINFOHEADER *pHeader) -{ - return DIBSIZE(*pHeader); -} - - -// This is called if the header has a 16 bit colour depth and needs to work -// out the detailed type from the bit fields (either RGB 565 or RGB 555) - -STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader) -{ - BITMAPINFO *pbmInfo = (BITMAPINFO *) pbmiHeader; - ASSERT(pbmiHeader->biBitCount == 16); - - // If its BI_RGB then it's RGB 555 by default - - if (pbmiHeader->biCompression == BI_RGB) { - return MEDIASUBTYPE_RGB555; - } - - // Compare the bit fields with RGB 555 - - DWORD *pMask = (DWORD *) pbmInfo->bmiColors; - if (pMask[0] == bits555[0]) { - if (pMask[1] == bits555[1]) { - if (pMask[2] == bits555[2]) { - return MEDIASUBTYPE_RGB555; - } - } - } - - // Compare the bit fields with RGB 565 - - pMask = (DWORD *) pbmInfo->bmiColors; - if (pMask[0] == bits565[0]) { - if (pMask[1] == bits565[1]) { - if (pMask[2] == bits565[2]) { - return MEDIASUBTYPE_RGB565; - } - } - } - return GUID_NULL; -} - - -// Given a BITMAPINFOHEADER structure this returns the GUID sub type that is -// used to describe it in format negotiations. For example a video codec fills -// in the format block with a VIDEOINFO structure, it also fills in the major -// type with MEDIATYPE_VIDEO and the subtype with a GUID that matches the bit -// count, for example if it is an eight bit image then MEDIASUBTYPE_RGB8 - -STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader) -{ - ASSERT(pbmiHeader); - - // If it's not RGB then create a GUID from the compression type - - if (pbmiHeader->biCompression != BI_RGB) { - if (pbmiHeader->biCompression != BI_BITFIELDS) { - FOURCCMap FourCCMap(pbmiHeader->biCompression); - return (const GUID) FourCCMap; - } - } - - // Map the RGB DIB bit depth to a image GUID - - switch(pbmiHeader->biBitCount) { - case 1 : return MEDIASUBTYPE_RGB1; - case 4 : return MEDIASUBTYPE_RGB4; - case 8 : return MEDIASUBTYPE_RGB8; - case 16 : return GetTrueColorType(pbmiHeader); - case 24 : return MEDIASUBTYPE_RGB24; - case 32 : return MEDIASUBTYPE_RGB32; - } - return GUID_NULL; -} - - -// Given a video bitmap subtype we return the number of bits per pixel it uses -// We return a WORD bit count as thats what the BITMAPINFOHEADER uses. If the -// GUID subtype is not found in the table we return an invalid USHRT_MAX - -STDAPI_(WORD) GetBitCount(const GUID *pSubtype) -{ - ASSERT(pSubtype); - const GUID *pMediaSubtype; - INT iPosition = 0; - - // Scan the mapping list seeing if the source GUID matches any known - // bitmap subtypes, the list is terminated by a GUID_NULL entry - - while (TRUE) { - pMediaSubtype = BitCountMap[iPosition].pSubtype; - if (IsEqualGUID(*pMediaSubtype,GUID_NULL)) { - return USHRT_MAX; - } - if (IsEqualGUID(*pMediaSubtype,*pSubtype)) { - return BitCountMap[iPosition].BitCount; - } - iPosition++; - } -} - - -// Given a bitmap subtype we return a description name that can be used for -// debug purposes. In a retail build this function still returns the names -// If the subtype isn't found in the lookup table we return string UNKNOWN - -int LocateSubtype(const GUID *pSubtype) -{ - ASSERT(pSubtype); - const GUID *pMediaSubtype; - INT iPosition = 0; - - // Scan the mapping list seeing if the source GUID matches any known - // bitmap subtypes, the list is terminated by a GUID_NULL entry - - while (TRUE) { - pMediaSubtype = BitCountMap[iPosition].pSubtype; - if (IsEqualGUID(*pMediaSubtype,*pSubtype) || - IsEqualGUID(*pMediaSubtype,GUID_NULL) - ) - { - break; - } - - iPosition++; - } - - return iPosition; -} - - - -STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype) -{ - return BitCountMap[LocateSubtype(pSubtype)].wszName; -} - -STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype) -{ - return BitCountMap[LocateSubtype(pSubtype)].pName; -} - -#ifndef GetSubtypeName -#error wxutil.h should have defined GetSubtypeName -#endif -#undef GetSubtypeName - -// this is here for people that linked to it directly; most people -// would use the header file that picks the A or W version. -STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype) -{ - return GetSubtypeNameA(pSubtype); -} - - -// The mechanism for describing a bitmap format is with the BITMAPINFOHEADER -// This is really messy to deal with because it invariably has fields that -// follow it holding bit fields, palettes and the rest. This function gives -// the number of bytes required to hold a VIDEOINFO that represents it. This -// count includes the prefix information (like the rcSource rectangle) the -// BITMAPINFOHEADER field, and any other colour information on the end. -// -// WARNING If you want to copy a BITMAPINFOHEADER into a VIDEOINFO always make -// sure that you use the HEADER macro because the BITMAPINFOHEADER field isn't -// right at the start of the VIDEOINFO (there are a number of other fields), -// -// CopyMemory(HEADER(pVideoInfo),pbmi,sizeof(BITMAPINFOHEADER)); -// - -STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) -{ - // Everyone has this to start with this - LONG Size = SIZE_PREHEADER + pHeader->biSize; - - ASSERT(pHeader->biSize >= sizeof(BITMAPINFOHEADER)); - - // Does this format use a palette, if the number of colours actually used - // is zero then it is set to the maximum that are allowed for that colour - // depth (an example is 256 for eight bits). Truecolour formats may also - // pass a palette with them in which case the used count is non zero - - // This would scare me. - ASSERT(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed == 0); - - if (pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed) { - LONG Entries = (DWORD) 1 << pHeader->biBitCount; - if (pHeader->biClrUsed) { - Entries = pHeader->biClrUsed; - } - Size += Entries * sizeof(RGBQUAD); - } - - // Truecolour formats may have a BI_BITFIELDS specifier for compression - // type which means that room for three DWORDs should be allocated that - // specify where in each pixel the RGB colour components may be found - - if (pHeader->biCompression == BI_BITFIELDS) { - Size += SIZE_MASKS; - } - - // A BITMAPINFO for a palettised image may also contain a palette map that - // provides the information to map from a source palette to a destination - // palette during a BitBlt for example, because this information is only - // ever processed during drawing you don't normally store the palette map - // nor have any way of knowing if it is present in the data structure - - return Size; -} - - -// Returns TRUE if the VIDEOINFO contains a palette - -STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo) -{ - if (PALETTISED(pVideoInfo) == FALSE) { - if (pVideoInfo->bmiHeader.biClrUsed == 0) { - return FALSE; - } - } - return TRUE; -} - - -// Return a pointer to the first entry in a palette - -STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo) -{ - if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) { - return TRUECOLOR(pVideoInfo)->bmiColors; - } - return COLORS(pVideoInfo); -} +//------------------------------------------------------------------------------ +// File: AMVideo.cpp +// +// Desc: DirectShow base classes - implements helper functions for +// bitmap formats. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + +// These are bit field masks for true colour devices + +const DWORD bits555[] = {0x007C00,0x0003E0,0x00001F}; +const DWORD bits565[] = {0x00F800,0x0007E0,0x00001F}; +const DWORD bits888[] = {0xFF0000,0x00FF00,0x0000FF}; + +// This maps bitmap subtypes into a bits per pixel value and also a +// name. unicode and ansi versions are stored because we have to +// return a pointer to a static string. +const struct { + const GUID *pSubtype; + WORD BitCount; + CHAR *pName; + WCHAR *wszName; +} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome", + &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA", + &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8", + &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)", + &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)", + &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24", + &MEDIASUBTYPE_RGB32, 32, "RGB 32", L"RGB 32", + &MEDIASUBTYPE_ARGB32, 32, "ARGB 32", L"ARGB 32", + &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay", + &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN" +}; + +// Return the size of the bitmap as defined by this header + +STDAPI_(DWORD) GetBitmapSize(const BITMAPINFOHEADER *pHeader) +{ + return DIBSIZE(*pHeader); +} + + +// This is called if the header has a 16 bit colour depth and needs to work +// out the detailed type from the bit fields (either RGB 565 or RGB 555) + +STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader) +{ + BITMAPINFO *pbmInfo = (BITMAPINFO *) pbmiHeader; + ASSERT(pbmiHeader->biBitCount == 16); + + // If its BI_RGB then it's RGB 555 by default + + if (pbmiHeader->biCompression == BI_RGB) { + return MEDIASUBTYPE_RGB555; + } + + // Compare the bit fields with RGB 555 + + DWORD *pMask = (DWORD *) pbmInfo->bmiColors; + if (pMask[0] == bits555[0]) { + if (pMask[1] == bits555[1]) { + if (pMask[2] == bits555[2]) { + return MEDIASUBTYPE_RGB555; + } + } + } + + // Compare the bit fields with RGB 565 + + pMask = (DWORD *) pbmInfo->bmiColors; + if (pMask[0] == bits565[0]) { + if (pMask[1] == bits565[1]) { + if (pMask[2] == bits565[2]) { + return MEDIASUBTYPE_RGB565; + } + } + } + return GUID_NULL; +} + + +// Given a BITMAPINFOHEADER structure this returns the GUID sub type that is +// used to describe it in format negotiations. For example a video codec fills +// in the format block with a VIDEOINFO structure, it also fills in the major +// type with MEDIATYPE_VIDEO and the subtype with a GUID that matches the bit +// count, for example if it is an eight bit image then MEDIASUBTYPE_RGB8 + +STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader) +{ + ASSERT(pbmiHeader); + + // If it's not RGB then create a GUID from the compression type + + if (pbmiHeader->biCompression != BI_RGB) { + if (pbmiHeader->biCompression != BI_BITFIELDS) { + FOURCCMap FourCCMap(pbmiHeader->biCompression); + return (const GUID) FourCCMap; + } + } + + // Map the RGB DIB bit depth to a image GUID + + switch(pbmiHeader->biBitCount) { + case 1 : return MEDIASUBTYPE_RGB1; + case 4 : return MEDIASUBTYPE_RGB4; + case 8 : return MEDIASUBTYPE_RGB8; + case 16 : return GetTrueColorType(pbmiHeader); + case 24 : return MEDIASUBTYPE_RGB24; + case 32 : return MEDIASUBTYPE_RGB32; + } + return GUID_NULL; +} + + +// Given a video bitmap subtype we return the number of bits per pixel it uses +// We return a WORD bit count as thats what the BITMAPINFOHEADER uses. If the +// GUID subtype is not found in the table we return an invalid USHRT_MAX + +STDAPI_(WORD) GetBitCount(const GUID *pSubtype) +{ + ASSERT(pSubtype); + const GUID *pMediaSubtype; + INT iPosition = 0; + + // Scan the mapping list seeing if the source GUID matches any known + // bitmap subtypes, the list is terminated by a GUID_NULL entry + + while (TRUE) { + pMediaSubtype = BitCountMap[iPosition].pSubtype; + if (IsEqualGUID(*pMediaSubtype,GUID_NULL)) { + return USHRT_MAX; + } + if (IsEqualGUID(*pMediaSubtype,*pSubtype)) { + return BitCountMap[iPosition].BitCount; + } + iPosition++; + } +} + + +// Given a bitmap subtype we return a description name that can be used for +// debug purposes. In a retail build this function still returns the names +// If the subtype isn't found in the lookup table we return string UNKNOWN + +int LocateSubtype(const GUID *pSubtype) +{ + ASSERT(pSubtype); + const GUID *pMediaSubtype; + INT iPosition = 0; + + // Scan the mapping list seeing if the source GUID matches any known + // bitmap subtypes, the list is terminated by a GUID_NULL entry + + while (TRUE) { + pMediaSubtype = BitCountMap[iPosition].pSubtype; + if (IsEqualGUID(*pMediaSubtype,*pSubtype) || + IsEqualGUID(*pMediaSubtype,GUID_NULL) + ) + { + break; + } + + iPosition++; + } + + return iPosition; +} + + + +STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype) +{ + return BitCountMap[LocateSubtype(pSubtype)].wszName; +} + +STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype) +{ + return BitCountMap[LocateSubtype(pSubtype)].pName; +} + +#ifndef GetSubtypeName +#error wxutil.h should have defined GetSubtypeName +#endif +#undef GetSubtypeName + +// this is here for people that linked to it directly; most people +// would use the header file that picks the A or W version. +STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype) +{ + return GetSubtypeNameA(pSubtype); +} + + +// The mechanism for describing a bitmap format is with the BITMAPINFOHEADER +// This is really messy to deal with because it invariably has fields that +// follow it holding bit fields, palettes and the rest. This function gives +// the number of bytes required to hold a VIDEOINFO that represents it. This +// count includes the prefix information (like the rcSource rectangle) the +// BITMAPINFOHEADER field, and any other colour information on the end. +// +// WARNING If you want to copy a BITMAPINFOHEADER into a VIDEOINFO always make +// sure that you use the HEADER macro because the BITMAPINFOHEADER field isn't +// right at the start of the VIDEOINFO (there are a number of other fields), +// +// CopyMemory(HEADER(pVideoInfo),pbmi,sizeof(BITMAPINFOHEADER)); +// + +STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) +{ + // Everyone has this to start with this + LONG Size = SIZE_PREHEADER + pHeader->biSize; + + ASSERT(pHeader->biSize >= sizeof(BITMAPINFOHEADER)); + + // Does this format use a palette, if the number of colours actually used + // is zero then it is set to the maximum that are allowed for that colour + // depth (an example is 256 for eight bits). Truecolour formats may also + // pass a palette with them in which case the used count is non zero + + // This would scare me. + ASSERT(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed == 0); + + if (pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed) { + LONG Entries = (DWORD) 1 << pHeader->biBitCount; + if (pHeader->biClrUsed) { + Entries = pHeader->biClrUsed; + } + Size += Entries * sizeof(RGBQUAD); + } + + // Truecolour formats may have a BI_BITFIELDS specifier for compression + // type which means that room for three DWORDs should be allocated that + // specify where in each pixel the RGB colour components may be found + + if (pHeader->biCompression == BI_BITFIELDS) { + Size += SIZE_MASKS; + } + + // A BITMAPINFO for a palettised image may also contain a palette map that + // provides the information to map from a source palette to a destination + // palette during a BitBlt for example, because this information is only + // ever processed during drawing you don't normally store the palette map + // nor have any way of knowing if it is present in the data structure + + return Size; +} + + +// Returns TRUE if the VIDEOINFO contains a palette + +STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo) +{ + if (PALETTISED(pVideoInfo) == FALSE) { + if (pVideoInfo->bmiHeader.biClrUsed == 0) { + return FALSE; + } + } + return TRUE; +} + + +// Return a pointer to the first entry in a palette + +STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo) +{ + if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) { + return TRUECOLOR(pVideoInfo)->bmiColors; + } + return COLORS(pVideoInfo); +} diff --git a/src/BaseClasses/cache.h b/src/BaseClasses/cache.h index d29e40fd7e..404207b06d 100644 --- a/src/BaseClasses/cache.h +++ b/src/BaseClasses/cache.h @@ -1,74 +1,74 @@ -//------------------------------------------------------------------------------ -// File: Cache.h -// -// Desc: DirectShow base classes - efines a non-MFC generic cache class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -/* This class implements a simple cache. A cache object is instantiated - with the number of items it is to hold. An item is a pointer to an - object derived from CBaseObject (helps reduce memory leaks). The cache - can then have objects added to it and removed from it. The cache size - is fixed at construction time and may therefore run out or be flooded. - If it runs out it returns a NULL pointer, if it fills up it also returns - a NULL pointer instead of a pointer to the object just inserted */ - -/* Making these classes inherit from CBaseObject does nothing for their - functionality but it allows us to check there are no memory leaks */ - -/* WARNING Be very careful when using this class, what it lets you do is - store and retrieve objects so that you can minimise object creation - which in turns improves efficiency. However the object you store is - exactly the same as the object you get back which means that it short - circuits the constructor initialisation phase. This means any class - variables the object has (eg pointers) are highly likely to be invalid. - Therefore ensure you reinitialise the object before using it again */ - - -#ifndef __CACHE__ -#define __CACHE__ - - -class CCache : CBaseObject { - - /* Make copy constructor and assignment operator inaccessible */ - - CCache(const CCache &refCache); - CCache &operator=(const CCache &refCache); - -private: - - /* These are initialised in the constructor. The first variable points to - an array of pointers, each of which points to a CBaseObject derived - object. The m_iCacheSize is the static fixed size for the cache and the - m_iUsed defines the number of places filled with objects at any time. - We fill the array of pointers from the start (ie m_ppObjects[0] first) - and then only add and remove objects from the end position, so in this - respect the array of object pointers should be treated as a stack */ - - CBaseObject **m_ppObjects; - const INT m_iCacheSize; - INT m_iUsed; - -public: - - CCache(TCHAR *pName,INT iItems); - virtual ~CCache(); - - /* Add an item to the cache */ - CBaseObject *AddToCache(CBaseObject *pObject); - - /* Remove an item from the cache */ - CBaseObject *RemoveFromCache(); - - /* Delete all the objects held in the cache */ - void RemoveAll(void); - - /* Return the cache size which is set during construction */ - INT GetCacheSize(void) const {return m_iCacheSize;}; -}; - -#endif /* __CACHE__ */ - +//------------------------------------------------------------------------------ +// File: Cache.h +// +// Desc: DirectShow base classes - efines a non-MFC generic cache class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +/* This class implements a simple cache. A cache object is instantiated + with the number of items it is to hold. An item is a pointer to an + object derived from CBaseObject (helps reduce memory leaks). The cache + can then have objects added to it and removed from it. The cache size + is fixed at construction time and may therefore run out or be flooded. + If it runs out it returns a NULL pointer, if it fills up it also returns + a NULL pointer instead of a pointer to the object just inserted */ + +/* Making these classes inherit from CBaseObject does nothing for their + functionality but it allows us to check there are no memory leaks */ + +/* WARNING Be very careful when using this class, what it lets you do is + store and retrieve objects so that you can minimise object creation + which in turns improves efficiency. However the object you store is + exactly the same as the object you get back which means that it short + circuits the constructor initialisation phase. This means any class + variables the object has (eg pointers) are highly likely to be invalid. + Therefore ensure you reinitialise the object before using it again */ + + +#ifndef __CACHE__ +#define __CACHE__ + + +class CCache : CBaseObject { + + /* Make copy constructor and assignment operator inaccessible */ + + CCache(const CCache &refCache); + CCache &operator=(const CCache &refCache); + +private: + + /* These are initialised in the constructor. The first variable points to + an array of pointers, each of which points to a CBaseObject derived + object. The m_iCacheSize is the static fixed size for the cache and the + m_iUsed defines the number of places filled with objects at any time. + We fill the array of pointers from the start (ie m_ppObjects[0] first) + and then only add and remove objects from the end position, so in this + respect the array of object pointers should be treated as a stack */ + + CBaseObject **m_ppObjects; + const INT m_iCacheSize; + INT m_iUsed; + +public: + + CCache(TCHAR *pName,INT iItems); + virtual ~CCache(); + + /* Add an item to the cache */ + CBaseObject *AddToCache(CBaseObject *pObject); + + /* Remove an item from the cache */ + CBaseObject *RemoveFromCache(); + + /* Delete all the objects held in the cache */ + void RemoveAll(void); + + /* Return the cache size which is set during construction */ + INT GetCacheSize(void) const {return m_iCacheSize;}; +}; + +#endif /* __CACHE__ */ + diff --git a/src/BaseClasses/combase.cpp b/src/BaseClasses/combase.cpp index 23502bf659..536faf28f7 100644 --- a/src/BaseClasses/combase.cpp +++ b/src/BaseClasses/combase.cpp @@ -1,254 +1,254 @@ -//------------------------------------------------------------------------------ -// File: ComBase.cpp -// -// Desc: DirectShow base classes - implements class hierarchy for creating -// COM objects. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#pragma warning( disable : 4514 ) // Disable warnings re unused inline functions - - -/* Define the static member variable */ - -LONG CBaseObject::m_cObjects = 0; - - -/* Constructor */ - -CBaseObject::CBaseObject(const TCHAR *pName) -{ - /* Increment the number of active objects */ - InterlockedIncrement(&m_cObjects); - -#ifdef DEBUG - -#ifdef UNICODE - m_dwCookie = DbgRegisterObjectCreation(0, pName); -#else - m_dwCookie = DbgRegisterObjectCreation(pName, 0); -#endif - -#endif -} - -#ifdef UNICODE -CBaseObject::CBaseObject(const char *pName) -{ - /* Increment the number of active objects */ - InterlockedIncrement(&m_cObjects); - -#ifdef DEBUG - m_dwCookie = DbgRegisterObjectCreation(pName, 0); -#endif -} -#endif - -HINSTANCE hlibOLEAut32; - -/* Destructor */ - -CBaseObject::~CBaseObject() -{ - /* Decrement the number of objects active */ - if (InterlockedDecrement(&m_cObjects) == 0) { - if (hlibOLEAut32) { - FreeLibrary(hlibOLEAut32); - hlibOLEAut32 = 0; - } - }; - - -#ifdef DEBUG - DbgRegisterObjectDestruction(m_dwCookie); -#endif -} - -static const TCHAR szOle32Aut[] = TEXT("OleAut32.dll"); - -HINSTANCE LoadOLEAut32() -{ - if (hlibOLEAut32 == 0) { - hlibOLEAut32 = LoadLibrary(szOle32Aut); - } - - return hlibOLEAut32; -} - - -/* Constructor */ - -// We know we use "this" in the initialization list, we also know we don't modify *phr. -#pragma warning( disable : 4355 4100 ) -CUnknown::CUnknown(const TCHAR *pName, LPUNKNOWN pUnk) -: CBaseObject(pName) -/* Start the object with a reference count of zero - when the */ -/* object is queried for it's first interface this may be */ -/* incremented depending on whether or not this object is */ -/* currently being aggregated upon */ -, m_cRef(0) -/* Set our pointer to our IUnknown interface. */ -/* If we have an outer, use its, otherwise use ours. */ -/* This pointer effectivly points to the owner of */ -/* this object and can be accessed by the GetOwner() method. */ -, m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) - /* Why the double cast? Well, the inner cast is a type-safe cast */ - /* to pointer to a type from which we inherit. The second is */ - /* type-unsafe but works because INonDelegatingUnknown "behaves */ - /* like" IUnknown. (Only the names on the methods change.) */ -{ - // Everything we need to do has been done in the initializer list -} - -// This does the same as above except it has a useless HRESULT argument -// use the previous constructor, this is just left for compatibility... -CUnknown::CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) : - CBaseObject(pName), - m_cRef(0), - m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) -{ -} - -#ifdef UNICODE -CUnknown::CUnknown(const CHAR *pName, LPUNKNOWN pUnk) -: CBaseObject(pName), m_cRef(0), - m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) -{ } - -CUnknown::CUnknown(CHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) : - CBaseObject(pName), m_cRef(0), - m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) -{ } - -#endif - -#pragma warning( default : 4355 4100 ) - - -/* QueryInterface */ - -STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, void ** ppv) -{ - CheckPointer(ppv,E_POINTER); - ValidateReadWritePtr(ppv,sizeof(PVOID)); - - /* We know only about IUnknown */ - - if (riid == IID_IUnknown) { - GetInterface((LPUNKNOWN) (PNDUNKNOWN) this, ppv); - return NOERROR; - } else { - *ppv = NULL; - return E_NOINTERFACE; - } -} - -/* We have to ensure that we DON'T use a max macro, since these will typically */ -/* lead to one of the parameters being evaluated twice. Since we are worried */ -/* about concurrency, we can't afford to access the m_cRef twice since we can't */ -/* afford to run the risk that its value having changed between accesses. */ - -template inline static T ourmax( const T & a, const T & b ) -{ - return a > b ? a : b; -} - -/* AddRef */ - -STDMETHODIMP_(ULONG) CUnknown::NonDelegatingAddRef() -{ - LONG lRef = InterlockedIncrement( &m_cRef ); - ASSERT(lRef > 0); - DbgLog((LOG_MEMORY,3,TEXT(" Obj %d ref++ = %d"), - m_dwCookie, m_cRef)); - return ourmax(ULONG(m_cRef), 1ul); -} - - -/* Release */ - -STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease() -{ - /* If the reference count drops to zero delete ourselves */ - - LONG lRef = InterlockedDecrement( &m_cRef ); - ASSERT(lRef >= 0); - - DbgLog((LOG_MEMORY,3,TEXT(" Object %d ref-- = %d"), - m_dwCookie, m_cRef)); - if (lRef == 0) { - - // COM rules say we must protect against re-entrancy. - // If we are an aggregator and we hold our own interfaces - // on the aggregatee, the QI for these interfaces will - // addref ourselves. So after doing the QI we must release - // a ref count on ourselves. Then, before releasing the - // private interface, we must addref ourselves. When we do - // this from the destructor here it will result in the ref - // count going to 1 and then back to 0 causing us to - // re-enter the destructor. Hence we add an extra refcount here - // once we know we will delete the object. - // for an example aggregator see filgraph\distrib.cpp. - - m_cRef++; - - delete this; - return ULONG(0); - } else { - return ourmax(ULONG(m_cRef), 1ul); - } -} - - -/* Return an interface pointer to a requesting client - performing a thread safe AddRef as necessary */ - -STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv) -{ - CheckPointer(ppv, E_POINTER); - *ppv = pUnk; - pUnk->AddRef(); - return NOERROR; -} - - -/* Compares two interfaces and returns TRUE if they are on the same object */ - -BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond) -{ - /* Different objects can't have the same interface pointer for - any interface - */ - if (pFirst == pSecond) { - return TRUE; - } - /* OK - do it the hard way - check if they have the same - IUnknown pointers - a single object can only have one of these - */ - LPUNKNOWN pUnknown1; // Retrieve the IUnknown interface - LPUNKNOWN pUnknown2; // Retrieve the other IUnknown interface - HRESULT hr; // General OLE return code - - ASSERT(pFirst); - ASSERT(pSecond); - - /* See if the IUnknown pointers match */ - - hr = pFirst->QueryInterface(IID_IUnknown,(void **) &pUnknown1); - ASSERT(SUCCEEDED(hr)); - ASSERT(pUnknown1); - - hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2); - ASSERT(SUCCEEDED(hr)); - ASSERT(pUnknown2); - - /* Release the extra interfaces we hold */ - - pUnknown1->Release(); - pUnknown2->Release(); - return (pUnknown1 == pUnknown2); -} - +//------------------------------------------------------------------------------ +// File: ComBase.cpp +// +// Desc: DirectShow base classes - implements class hierarchy for creating +// COM objects. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#pragma warning( disable : 4514 ) // Disable warnings re unused inline functions + + +/* Define the static member variable */ + +LONG CBaseObject::m_cObjects = 0; + + +/* Constructor */ + +CBaseObject::CBaseObject(const TCHAR *pName) +{ + /* Increment the number of active objects */ + InterlockedIncrement(&m_cObjects); + +#ifdef DEBUG + +#ifdef UNICODE + m_dwCookie = DbgRegisterObjectCreation(0, pName); +#else + m_dwCookie = DbgRegisterObjectCreation(pName, 0); +#endif + +#endif +} + +#ifdef UNICODE +CBaseObject::CBaseObject(const char *pName) +{ + /* Increment the number of active objects */ + InterlockedIncrement(&m_cObjects); + +#ifdef DEBUG + m_dwCookie = DbgRegisterObjectCreation(pName, 0); +#endif +} +#endif + +HINSTANCE hlibOLEAut32; + +/* Destructor */ + +CBaseObject::~CBaseObject() +{ + /* Decrement the number of objects active */ + if (InterlockedDecrement(&m_cObjects) == 0) { + if (hlibOLEAut32) { + FreeLibrary(hlibOLEAut32); + hlibOLEAut32 = 0; + } + }; + + +#ifdef DEBUG + DbgRegisterObjectDestruction(m_dwCookie); +#endif +} + +static const TCHAR szOle32Aut[] = TEXT("OleAut32.dll"); + +HINSTANCE LoadOLEAut32() +{ + if (hlibOLEAut32 == 0) { + hlibOLEAut32 = LoadLibrary(szOle32Aut); + } + + return hlibOLEAut32; +} + + +/* Constructor */ + +// We know we use "this" in the initialization list, we also know we don't modify *phr. +#pragma warning( disable : 4355 4100 ) +CUnknown::CUnknown(const TCHAR *pName, LPUNKNOWN pUnk) +: CBaseObject(pName) +/* Start the object with a reference count of zero - when the */ +/* object is queried for it's first interface this may be */ +/* incremented depending on whether or not this object is */ +/* currently being aggregated upon */ +, m_cRef(0) +/* Set our pointer to our IUnknown interface. */ +/* If we have an outer, use its, otherwise use ours. */ +/* This pointer effectivly points to the owner of */ +/* this object and can be accessed by the GetOwner() method. */ +, m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) + /* Why the double cast? Well, the inner cast is a type-safe cast */ + /* to pointer to a type from which we inherit. The second is */ + /* type-unsafe but works because INonDelegatingUnknown "behaves */ + /* like" IUnknown. (Only the names on the methods change.) */ +{ + // Everything we need to do has been done in the initializer list +} + +// This does the same as above except it has a useless HRESULT argument +// use the previous constructor, this is just left for compatibility... +CUnknown::CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) : + CBaseObject(pName), + m_cRef(0), + m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) +{ +} + +#ifdef UNICODE +CUnknown::CUnknown(const CHAR *pName, LPUNKNOWN pUnk) +: CBaseObject(pName), m_cRef(0), + m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) +{ } + +CUnknown::CUnknown(CHAR *pName, LPUNKNOWN pUnk,HRESULT *phr) : + CBaseObject(pName), m_cRef(0), + m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast( static_cast(this) ) ) +{ } + +#endif + +#pragma warning( default : 4355 4100 ) + + +/* QueryInterface */ + +STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, void ** ppv) +{ + CheckPointer(ppv,E_POINTER); + ValidateReadWritePtr(ppv,sizeof(PVOID)); + + /* We know only about IUnknown */ + + if (riid == IID_IUnknown) { + GetInterface((LPUNKNOWN) (PNDUNKNOWN) this, ppv); + return NOERROR; + } else { + *ppv = NULL; + return E_NOINTERFACE; + } +} + +/* We have to ensure that we DON'T use a max macro, since these will typically */ +/* lead to one of the parameters being evaluated twice. Since we are worried */ +/* about concurrency, we can't afford to access the m_cRef twice since we can't */ +/* afford to run the risk that its value having changed between accesses. */ + +template inline static T ourmax( const T & a, const T & b ) +{ + return a > b ? a : b; +} + +/* AddRef */ + +STDMETHODIMP_(ULONG) CUnknown::NonDelegatingAddRef() +{ + LONG lRef = InterlockedIncrement( &m_cRef ); + ASSERT(lRef > 0); + DbgLog((LOG_MEMORY,3,TEXT(" Obj %d ref++ = %d"), + m_dwCookie, m_cRef)); + return ourmax(ULONG(m_cRef), 1ul); +} + + +/* Release */ + +STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease() +{ + /* If the reference count drops to zero delete ourselves */ + + LONG lRef = InterlockedDecrement( &m_cRef ); + ASSERT(lRef >= 0); + + DbgLog((LOG_MEMORY,3,TEXT(" Object %d ref-- = %d"), + m_dwCookie, m_cRef)); + if (lRef == 0) { + + // COM rules say we must protect against re-entrancy. + // If we are an aggregator and we hold our own interfaces + // on the aggregatee, the QI for these interfaces will + // addref ourselves. So after doing the QI we must release + // a ref count on ourselves. Then, before releasing the + // private interface, we must addref ourselves. When we do + // this from the destructor here it will result in the ref + // count going to 1 and then back to 0 causing us to + // re-enter the destructor. Hence we add an extra refcount here + // once we know we will delete the object. + // for an example aggregator see filgraph\distrib.cpp. + + m_cRef++; + + delete this; + return ULONG(0); + } else { + return ourmax(ULONG(m_cRef), 1ul); + } +} + + +/* Return an interface pointer to a requesting client + performing a thread safe AddRef as necessary */ + +STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv) +{ + CheckPointer(ppv, E_POINTER); + *ppv = pUnk; + pUnk->AddRef(); + return NOERROR; +} + + +/* Compares two interfaces and returns TRUE if they are on the same object */ + +BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond) +{ + /* Different objects can't have the same interface pointer for + any interface + */ + if (pFirst == pSecond) { + return TRUE; + } + /* OK - do it the hard way - check if they have the same + IUnknown pointers - a single object can only have one of these + */ + LPUNKNOWN pUnknown1; // Retrieve the IUnknown interface + LPUNKNOWN pUnknown2; // Retrieve the other IUnknown interface + HRESULT hr; // General OLE return code + + ASSERT(pFirst); + ASSERT(pSecond); + + /* See if the IUnknown pointers match */ + + hr = pFirst->QueryInterface(IID_IUnknown,(void **) &pUnknown1); + ASSERT(SUCCEEDED(hr)); + ASSERT(pUnknown1); + + hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2); + ASSERT(SUCCEEDED(hr)); + ASSERT(pUnknown2); + + /* Release the extra interfaces we hold */ + + pUnknown1->Release(); + pUnknown2->Release(); + return (pUnknown1 == pUnknown2); +} + diff --git a/src/BaseClasses/combase.h b/src/BaseClasses/combase.h index e4dd7db91a..d6197e53f3 100644 --- a/src/BaseClasses/combase.h +++ b/src/BaseClasses/combase.h @@ -1,319 +1,319 @@ -//------------------------------------------------------------------------------ -// File: ComBase.h -// -// Desc: DirectShow base classes - defines a class hierarchy for creating -// COM objects. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -/* - -a. Derive your COM object from CUnknown - -b. Make a static CreateInstance function that takes an LPUNKNOWN, an HRESULT * - and a TCHAR *. The LPUNKNOWN defines the object to delegate IUnknown calls - to. The HRESULT * allows error codes to be passed around constructors and - the TCHAR * is a descriptive name that can be printed on the debugger. - - It is important that constructors only change the HRESULT * if they have - to set an ERROR code, if it was successful then leave it alone or you may - overwrite an error code from an object previously created. - - When you call a constructor the descriptive name should be in static store - as we do not copy the string. To stop large amounts of memory being used - in retail builds by all these static strings use the NAME macro, - - CMyFilter = new CImplFilter(NAME("My filter"),pUnknown,phr); - if (FAILED(hr)) { - return hr; - } - - In retail builds NAME(_x_) compiles to NULL, the base CBaseObject class - knows not to do anything with objects that don't have a name. - -c. Have a constructor for your object that passes the LPUNKNOWN, HRESULT * and - TCHAR * to the CUnknown constructor. You can set the HRESULT if you have an - error, or just simply pass it through to the constructor. - - The object creation will fail in the class factory if the HRESULT indicates - an error (ie FAILED(HRESULT) == TRUE) - -d. Create a FactoryTemplate with your object's class id and CreateInstance - function. - -Then (for each interface) either - -Multiple inheritance - -1. Also derive it from ISomeInterface -2. Include DECLARE_IUNKNOWN in your class definition to declare - implementations of QueryInterface, AddRef and Release that - call the outer unknown -3. Override NonDelegatingQueryInterface to expose ISomeInterface by - code something like - - if (riid == IID_ISomeInterface) { - return GetInterface((ISomeInterface *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - -4. Declare and implement the member functions of ISomeInterface. - -or: Nested interfaces - -1. Declare a class derived from CUnknown -2. Include DECLARE_IUNKNOWN in your class definition -3. Override NonDelegatingQueryInterface to expose ISomeInterface by - code something like - - if (riid == IID_ISomeInterface) { - return GetInterface((ISomeInterface *) this, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - -4. Implement the member functions of ISomeInterface. Use GetOwner() to - access the COM object class. - -And in your COM object class: - -5. Make the nested class a friend of the COM object class, and declare - an instance of the nested class as a member of the COM object class. - - NOTE that because you must always pass the outer unknown and an hResult - to the CUnknown constructor you cannot use a default constructor, in - other words you will have to make the member variable a pointer to the - class and make a NEW call in your constructor to actually create it. - -6. override the NonDelegatingQueryInterface with code like this: - - if (riid == IID_ISomeInterface) { - return m_pImplFilter-> - NonDelegatingQueryInterface(IID_ISomeInterface, ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - -You can have mixed classes which support some interfaces via multiple -inheritance and some via nested classes - -*/ - -#ifndef __COMBASE__ -#define __COMBASE__ - -// Filter Setup data structures no defined in axextend.idl - -typedef REGPINTYPES -AMOVIESETUP_MEDIATYPE, * PAMOVIESETUP_MEDIATYPE, * FAR LPAMOVIESETUP_MEDIATYPE; - -typedef REGFILTERPINS -AMOVIESETUP_PIN, * PAMOVIESETUP_PIN, * FAR LPAMOVIESETUP_PIN; - -typedef struct _AMOVIESETUP_FILTER -{ - const CLSID * clsID; - const WCHAR * strName; - DWORD dwMerit; - UINT nPins; - const AMOVIESETUP_PIN * lpPin; -} -AMOVIESETUP_FILTER, * PAMOVIESETUP_FILTER, * FAR LPAMOVIESETUP_FILTER; - -/* The DLLENTRY module initialises the module handle on loading */ - -extern HINSTANCE g_hInst; - -/* On DLL load remember which platform we are running on */ - -extern DWORD g_amPlatform; -extern OSVERSIONINFO g_osInfo; // Filled in by GetVersionEx - -/* Version of IUnknown that is renamed to allow a class to support both - non delegating and delegating IUnknowns in the same COM object */ - -#ifndef INONDELEGATINGUNKNOWN_DEFINED -DECLARE_INTERFACE(INonDelegatingUnknown) -{ - STDMETHOD(NonDelegatingQueryInterface) (THIS_ REFIID, LPVOID *) PURE; - STDMETHOD_(ULONG, NonDelegatingAddRef)(THIS) PURE; - STDMETHOD_(ULONG, NonDelegatingRelease)(THIS) PURE; -}; -#define INONDELEGATINGUNKNOWN_DEFINED -#endif - -typedef INonDelegatingUnknown *PNDUNKNOWN; - - -/* This is the base object class that supports active object counting. As - part of the debug facilities we trace every time a C++ object is created - or destroyed. The name of the object has to be passed up through the class - derivation list during construction as you cannot call virtual functions - in the constructor. The downside of all this is that every single object - constructor has to take an object name parameter that describes it */ - -class CBaseObject -{ - -private: - - // Disable the copy constructor and assignment by default so you will get - // compiler errors instead of unexpected behaviour if you pass objects - // by value or assign objects. - CBaseObject(const CBaseObject& objectSrc); // no implementation - void operator=(const CBaseObject& objectSrc); // no implementation - -private: - static LONG m_cObjects; /* Total number of objects active */ - -protected: -#ifdef DEBUG - DWORD m_dwCookie; /* Cookie identifying this object */ -#endif - - -public: - - /* These increment and decrement the number of active objects */ - - CBaseObject(const TCHAR *pName); -#ifdef UNICODE - CBaseObject(const char *pName); -#endif - ~CBaseObject(); - - /* Call this to find if there are any CUnknown derived objects active */ - - static LONG ObjectsActive() { - return m_cObjects; - }; -}; - - -/* An object that supports one or more COM interfaces will be based on - this class. It supports counting of total objects for DLLCanUnloadNow - support, and an implementation of the core non delegating IUnknown */ - -class AM_NOVTABLE CUnknown : public INonDelegatingUnknown, - public CBaseObject -{ -private: - const LPUNKNOWN m_pUnknown; /* Owner of this object */ - -protected: /* So we can override NonDelegatingRelease() */ - volatile LONG m_cRef; /* Number of reference counts */ - -public: - - CUnknown(const TCHAR *pName, LPUNKNOWN pUnk); - virtual ~CUnknown() {}; - - // This is redundant, just use the other constructor - // as we never touch the HRESULT in this anyway - CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr); -#ifdef UNICODE - CUnknown(const char *pName, LPUNKNOWN pUnk); - CUnknown(char *pName, LPUNKNOWN pUnk,HRESULT *phr); -#endif - - /* Return the owner of this object */ - - LPUNKNOWN GetOwner() const { - return m_pUnknown; - }; - - /* Called from the class factory to create a new instance, it is - pure virtual so it must be overriden in your derived class */ - - /* static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *) */ - - /* Non delegating unknown implementation */ - - STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **); - STDMETHODIMP_(ULONG) NonDelegatingAddRef(); - STDMETHODIMP_(ULONG) NonDelegatingRelease(); -}; - -#if (_MSC_VER <= 1200) -#pragma warning(disable:4211) - -/* The standard InterlockedXXX functions won't take volatiles */ -static inline LONG WINAPI InterlockedIncrement( volatile LONG * plong ) -{ return InterlockedIncrement( const_cast( plong ) ); } - -static inline LONG WINAPI InterlockedDecrement( volatile LONG * plong ) -{ return InterlockedDecrement( const_cast( plong ) ); } - -#pragma warning(default:4211) -#endif - - -/* Return an interface pointer to a requesting client - performing a thread safe AddRef as necessary */ - -STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv); - -/* A function that can create a new COM object */ - -typedef CUnknown *(CALLBACK *LPFNNewCOMObject)(LPUNKNOWN pUnkOuter, HRESULT *phr); - -/* A function (can be NULL) which is called from the DLL entrypoint - routine for each factory template: - - bLoading - TRUE on DLL load, FALSE on DLL unload - rclsid - the m_ClsID of the entry -*/ -typedef void (CALLBACK *LPFNInitRoutine)(BOOL bLoading, const CLSID *rclsid); - -/* Create one of these per object class in an array so that - the default class factory code can create new instances */ - -class CFactoryTemplate { - -public: - - const WCHAR * m_Name; - const CLSID * m_ClsID; - LPFNNewCOMObject m_lpfnNew; - LPFNInitRoutine m_lpfnInit; - const AMOVIESETUP_FILTER * m_pAMovieSetup_Filter; - - BOOL IsClassID(REFCLSID rclsid) const { - return (IsEqualCLSID(*m_ClsID,rclsid)); - }; - - CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) const { - CheckPointer(phr,NULL); - return m_lpfnNew(pUnk, phr); - }; -}; - - -/* You must override the (pure virtual) NonDelegatingQueryInterface to return - interface pointers (using GetInterface) to the interfaces your derived - class supports (the default implementation only supports IUnknown) */ - -#define DECLARE_IUNKNOWN \ - STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { \ - return GetOwner()->QueryInterface(riid,ppv); \ - }; \ - STDMETHODIMP_(ULONG) AddRef() { \ - return GetOwner()->AddRef(); \ - }; \ - STDMETHODIMP_(ULONG) Release() { \ - return GetOwner()->Release(); \ - }; - - - -HINSTANCE LoadOLEAut32(); - - -#endif /* __COMBASE__ */ - - - - +//------------------------------------------------------------------------------ +// File: ComBase.h +// +// Desc: DirectShow base classes - defines a class hierarchy for creating +// COM objects. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +/* + +a. Derive your COM object from CUnknown + +b. Make a static CreateInstance function that takes an LPUNKNOWN, an HRESULT * + and a TCHAR *. The LPUNKNOWN defines the object to delegate IUnknown calls + to. The HRESULT * allows error codes to be passed around constructors and + the TCHAR * is a descriptive name that can be printed on the debugger. + + It is important that constructors only change the HRESULT * if they have + to set an ERROR code, if it was successful then leave it alone or you may + overwrite an error code from an object previously created. + + When you call a constructor the descriptive name should be in static store + as we do not copy the string. To stop large amounts of memory being used + in retail builds by all these static strings use the NAME macro, + + CMyFilter = new CImplFilter(NAME("My filter"),pUnknown,phr); + if (FAILED(hr)) { + return hr; + } + + In retail builds NAME(_x_) compiles to NULL, the base CBaseObject class + knows not to do anything with objects that don't have a name. + +c. Have a constructor for your object that passes the LPUNKNOWN, HRESULT * and + TCHAR * to the CUnknown constructor. You can set the HRESULT if you have an + error, or just simply pass it through to the constructor. + + The object creation will fail in the class factory if the HRESULT indicates + an error (ie FAILED(HRESULT) == TRUE) + +d. Create a FactoryTemplate with your object's class id and CreateInstance + function. + +Then (for each interface) either + +Multiple inheritance + +1. Also derive it from ISomeInterface +2. Include DECLARE_IUNKNOWN in your class definition to declare + implementations of QueryInterface, AddRef and Release that + call the outer unknown +3. Override NonDelegatingQueryInterface to expose ISomeInterface by + code something like + + if (riid == IID_ISomeInterface) { + return GetInterface((ISomeInterface *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } + +4. Declare and implement the member functions of ISomeInterface. + +or: Nested interfaces + +1. Declare a class derived from CUnknown +2. Include DECLARE_IUNKNOWN in your class definition +3. Override NonDelegatingQueryInterface to expose ISomeInterface by + code something like + + if (riid == IID_ISomeInterface) { + return GetInterface((ISomeInterface *) this, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } + +4. Implement the member functions of ISomeInterface. Use GetOwner() to + access the COM object class. + +And in your COM object class: + +5. Make the nested class a friend of the COM object class, and declare + an instance of the nested class as a member of the COM object class. + + NOTE that because you must always pass the outer unknown and an hResult + to the CUnknown constructor you cannot use a default constructor, in + other words you will have to make the member variable a pointer to the + class and make a NEW call in your constructor to actually create it. + +6. override the NonDelegatingQueryInterface with code like this: + + if (riid == IID_ISomeInterface) { + return m_pImplFilter-> + NonDelegatingQueryInterface(IID_ISomeInterface, ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } + +You can have mixed classes which support some interfaces via multiple +inheritance and some via nested classes + +*/ + +#ifndef __COMBASE__ +#define __COMBASE__ + +// Filter Setup data structures no defined in axextend.idl + +typedef REGPINTYPES +AMOVIESETUP_MEDIATYPE, * PAMOVIESETUP_MEDIATYPE, * FAR LPAMOVIESETUP_MEDIATYPE; + +typedef REGFILTERPINS +AMOVIESETUP_PIN, * PAMOVIESETUP_PIN, * FAR LPAMOVIESETUP_PIN; + +typedef struct _AMOVIESETUP_FILTER +{ + const CLSID * clsID; + const WCHAR * strName; + DWORD dwMerit; + UINT nPins; + const AMOVIESETUP_PIN * lpPin; +} +AMOVIESETUP_FILTER, * PAMOVIESETUP_FILTER, * FAR LPAMOVIESETUP_FILTER; + +/* The DLLENTRY module initialises the module handle on loading */ + +extern HINSTANCE g_hInst; + +/* On DLL load remember which platform we are running on */ + +extern DWORD g_amPlatform; +extern OSVERSIONINFO g_osInfo; // Filled in by GetVersionEx + +/* Version of IUnknown that is renamed to allow a class to support both + non delegating and delegating IUnknowns in the same COM object */ + +#ifndef INONDELEGATINGUNKNOWN_DEFINED +DECLARE_INTERFACE(INonDelegatingUnknown) +{ + STDMETHOD(NonDelegatingQueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG, NonDelegatingAddRef)(THIS) PURE; + STDMETHOD_(ULONG, NonDelegatingRelease)(THIS) PURE; +}; +#define INONDELEGATINGUNKNOWN_DEFINED +#endif + +typedef INonDelegatingUnknown *PNDUNKNOWN; + + +/* This is the base object class that supports active object counting. As + part of the debug facilities we trace every time a C++ object is created + or destroyed. The name of the object has to be passed up through the class + derivation list during construction as you cannot call virtual functions + in the constructor. The downside of all this is that every single object + constructor has to take an object name parameter that describes it */ + +class CBaseObject +{ + +private: + + // Disable the copy constructor and assignment by default so you will get + // compiler errors instead of unexpected behaviour if you pass objects + // by value or assign objects. + CBaseObject(const CBaseObject& objectSrc); // no implementation + void operator=(const CBaseObject& objectSrc); // no implementation + +private: + static LONG m_cObjects; /* Total number of objects active */ + +protected: +#ifdef DEBUG + DWORD m_dwCookie; /* Cookie identifying this object */ +#endif + + +public: + + /* These increment and decrement the number of active objects */ + + CBaseObject(const TCHAR *pName); +#ifdef UNICODE + CBaseObject(const char *pName); +#endif + ~CBaseObject(); + + /* Call this to find if there are any CUnknown derived objects active */ + + static LONG ObjectsActive() { + return m_cObjects; + }; +}; + + +/* An object that supports one or more COM interfaces will be based on + this class. It supports counting of total objects for DLLCanUnloadNow + support, and an implementation of the core non delegating IUnknown */ + +class AM_NOVTABLE CUnknown : public INonDelegatingUnknown, + public CBaseObject +{ +private: + const LPUNKNOWN m_pUnknown; /* Owner of this object */ + +protected: /* So we can override NonDelegatingRelease() */ + volatile LONG m_cRef; /* Number of reference counts */ + +public: + + CUnknown(const TCHAR *pName, LPUNKNOWN pUnk); + virtual ~CUnknown() {}; + + // This is redundant, just use the other constructor + // as we never touch the HRESULT in this anyway + CUnknown(TCHAR *pName, LPUNKNOWN pUnk,HRESULT *phr); +#ifdef UNICODE + CUnknown(const char *pName, LPUNKNOWN pUnk); + CUnknown(char *pName, LPUNKNOWN pUnk,HRESULT *phr); +#endif + + /* Return the owner of this object */ + + LPUNKNOWN GetOwner() const { + return m_pUnknown; + }; + + /* Called from the class factory to create a new instance, it is + pure virtual so it must be overriden in your derived class */ + + /* static CUnknown *CreateInstance(LPUNKNOWN, HRESULT *) */ + + /* Non delegating unknown implementation */ + + STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **); + STDMETHODIMP_(ULONG) NonDelegatingAddRef(); + STDMETHODIMP_(ULONG) NonDelegatingRelease(); +}; + +#if (_MSC_VER <= 1200) +#pragma warning(disable:4211) + +/* The standard InterlockedXXX functions won't take volatiles */ +static inline LONG WINAPI InterlockedIncrement( volatile LONG * plong ) +{ return InterlockedIncrement( const_cast( plong ) ); } + +static inline LONG WINAPI InterlockedDecrement( volatile LONG * plong ) +{ return InterlockedDecrement( const_cast( plong ) ); } + +#pragma warning(default:4211) +#endif + + +/* Return an interface pointer to a requesting client + performing a thread safe AddRef as necessary */ + +STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv); + +/* A function that can create a new COM object */ + +typedef CUnknown *(CALLBACK *LPFNNewCOMObject)(LPUNKNOWN pUnkOuter, HRESULT *phr); + +/* A function (can be NULL) which is called from the DLL entrypoint + routine for each factory template: + + bLoading - TRUE on DLL load, FALSE on DLL unload + rclsid - the m_ClsID of the entry +*/ +typedef void (CALLBACK *LPFNInitRoutine)(BOOL bLoading, const CLSID *rclsid); + +/* Create one of these per object class in an array so that + the default class factory code can create new instances */ + +class CFactoryTemplate { + +public: + + const WCHAR * m_Name; + const CLSID * m_ClsID; + LPFNNewCOMObject m_lpfnNew; + LPFNInitRoutine m_lpfnInit; + const AMOVIESETUP_FILTER * m_pAMovieSetup_Filter; + + BOOL IsClassID(REFCLSID rclsid) const { + return (IsEqualCLSID(*m_ClsID,rclsid)); + }; + + CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) const { + CheckPointer(phr,NULL); + return m_lpfnNew(pUnk, phr); + }; +}; + + +/* You must override the (pure virtual) NonDelegatingQueryInterface to return + interface pointers (using GetInterface) to the interfaces your derived + class supports (the default implementation only supports IUnknown) */ + +#define DECLARE_IUNKNOWN \ + STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { \ + return GetOwner()->QueryInterface(riid,ppv); \ + }; \ + STDMETHODIMP_(ULONG) AddRef() { \ + return GetOwner()->AddRef(); \ + }; \ + STDMETHODIMP_(ULONG) Release() { \ + return GetOwner()->Release(); \ + }; + + + +HINSTANCE LoadOLEAut32(); + + +#endif /* __COMBASE__ */ + + + + diff --git a/src/BaseClasses/cprop.cpp b/src/BaseClasses/cprop.cpp index 89062737b4..f737890afb 100644 --- a/src/BaseClasses/cprop.cpp +++ b/src/BaseClasses/cprop.cpp @@ -1,380 +1,380 @@ -//------------------------------------------------------------------------------ -// File: CProp.cpp -// -// Desc: DirectShow base classes - implements CBasePropertyPage class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - -// Constructor for the base property page class. As described in the header -// file we must be initialised with dialog and title resource identifiers. -// The class supports IPropertyPage and overrides AddRef and Release calls -// to keep track of the reference counts. When the last count is released -// we call SetPageSite(NULL) and SetObjects(0,NULL) to release interfaces -// previously obtained by the property page when it had SetObjects called - -CBasePropertyPage::CBasePropertyPage(TCHAR *pName, // Debug only name - LPUNKNOWN pUnk, // COM Delegator - int DialogId, // Resource ID - int TitleId) : // To get tital - CUnknown(pName,pUnk), - m_DialogId(DialogId), - m_TitleId(TitleId), - m_hwnd(NULL), - m_Dlg(NULL), - m_pPageSite(NULL), - m_bObjectSet(FALSE), - m_bDirty(FALSE) -{ -} - -#ifdef UNICODE -CBasePropertyPage::CBasePropertyPage(CHAR *pName, // Debug only name - LPUNKNOWN pUnk, // COM Delegator - int DialogId, // Resource ID - int TitleId) : // To get tital - CUnknown(pName,pUnk), - m_DialogId(DialogId), - m_TitleId(TitleId), - m_hwnd(NULL), - m_Dlg(NULL), - m_pPageSite(NULL), - m_bObjectSet(FALSE), - m_bDirty(FALSE) -{ -} -#endif - -// Increment our reference count - -STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingAddRef() -{ - LONG lRef = InterlockedIncrement(&m_cRef); - ASSERT(lRef > 0); - return max(ULONG(m_cRef),1ul); -} - - -// Release a reference count and protect against reentrancy - -STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingRelease() -{ - // If the reference count drops to zero delete ourselves - - if (InterlockedDecrement(&m_cRef) == 0) { - m_cRef++; - SetPageSite(NULL); - SetObjects(0,NULL); - delete this; - return ULONG(0); - } else { - return max(ULONG(m_cRef),1ul); - } -} - - -// Expose our IPropertyPage interface - -STDMETHODIMP -CBasePropertyPage::NonDelegatingQueryInterface(REFIID riid,void **ppv) -{ - if (riid == IID_IPropertyPage) { - return GetInterface((IPropertyPage *)this,ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid,ppv); - } -} - - -// Get the page info so that the page site can size itself - -STDMETHODIMP CBasePropertyPage::GetPageInfo(LPPROPPAGEINFO pPageInfo) -{ - CheckPointer(pPageInfo,E_POINTER); - WCHAR wszTitle[STR_MAX_LENGTH]; - WideStringFromResource(wszTitle,m_TitleId); - - // Allocate dynamic memory for the property page title - - LPOLESTR pszTitle; - HRESULT hr = AMGetWideString(wszTitle, &pszTitle); - if (FAILED(hr)) { - NOTE("No caption memory"); - return hr; - } - - pPageInfo->cb = sizeof(PROPPAGEINFO); - pPageInfo->pszTitle = pszTitle; - pPageInfo->pszDocString = NULL; - pPageInfo->pszHelpFile = NULL; - pPageInfo->dwHelpContext = 0; - - // Set defaults in case GetDialogSize fails - pPageInfo->size.cx = 340; - pPageInfo->size.cy = 150; - - GetDialogSize(m_DialogId, DialogProc,0L,&pPageInfo->size); - return NOERROR; -} - - -// Handles the messages for our property window - -INT_PTR CALLBACK CBasePropertyPage::DialogProc(HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - CBasePropertyPage *pPropertyPage; - - switch (uMsg) { - - case WM_INITDIALOG: - - SetWindowLongPtr(hwnd, DWLP_USER, lParam); - - // This pointer may be NULL when calculating size - - pPropertyPage = (CBasePropertyPage *) lParam; - if (pPropertyPage == NULL) { - return (LRESULT) 1; - } - pPropertyPage->m_Dlg = hwnd; - } - - // This pointer may be NULL when calculating size - - pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER); - if (pPropertyPage == NULL) { - return (LRESULT) 1; - } - return pPropertyPage->OnReceiveMessage(hwnd,uMsg,wParam,lParam); -} - - -// Tells us the object that should be informed of the property changes - -STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects,LPUNKNOWN *ppUnk) -{ - if (cObjects == 1) { - - if ((ppUnk == NULL) || (*ppUnk == NULL)) { - return E_POINTER; - } - - // Set a flag to say that we have set the Object - m_bObjectSet = TRUE ; - return OnConnect(*ppUnk); - - } else if (cObjects == 0) { - - // Set a flag to say that we have not set the Object for the page - m_bObjectSet = FALSE ; - return OnDisconnect(); - } - - DbgBreak("No support for more than one object"); - return E_UNEXPECTED; -} - - -// Create the window we will use to edit properties - -STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent, - LPCRECT pRect, - BOOL fModal) -{ - CheckPointer(pRect,E_POINTER); - - // Return failure if SetObject has not been called. - if (m_bObjectSet == FALSE) { - return E_UNEXPECTED; - } - - if (m_hwnd) { - return E_UNEXPECTED; - } - - m_hwnd = CreateDialogParam(g_hInst, - MAKEINTRESOURCE(m_DialogId), - hwndParent, - DialogProc, - (LPARAM) this); - if (m_hwnd == NULL) { - return E_OUTOFMEMORY; - } - - OnActivate(); - Move(pRect); - return Show(SW_SHOWNORMAL); -} - - -// Set the position of the property page - -STDMETHODIMP CBasePropertyPage::Move(LPCRECT pRect) -{ - CheckPointer(pRect,E_POINTER); - - if (m_hwnd == NULL) { - return E_UNEXPECTED; - } - - MoveWindow(m_hwnd, // Property page handle - pRect->left, // x coordinate - pRect->top, // y coordinate - WIDTH(pRect), // Overall window width - HEIGHT(pRect), // And likewise height - TRUE); // Should we repaint it - - return NOERROR; -} - - -// Display the property dialog - -STDMETHODIMP CBasePropertyPage::Show(UINT nCmdShow) -{ - // Have we been activated yet - - if (m_hwnd == NULL) { - return E_UNEXPECTED; - } - - // Ignore wrong show flags - - if ((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE)) { - return E_INVALIDARG; - } - - ShowWindow(m_hwnd,nCmdShow); - InvalidateRect(m_hwnd,NULL,TRUE); - return NOERROR; -} - - -// Destroy the property page dialog - -STDMETHODIMP CBasePropertyPage::Deactivate(void) -{ - if (m_hwnd == NULL) { - return E_UNEXPECTED; - } - - // Remove WS_EX_CONTROLPARENT before DestroyWindow call - - DWORD dwStyle = GetWindowLong(m_hwnd, GWL_EXSTYLE); - dwStyle = dwStyle & (~WS_EX_CONTROLPARENT); - - // Set m_hwnd to be NULL temporarily so the message handler - // for WM_STYLECHANGING doesn't add the WS_EX_CONTROLPARENT - // style back in - HWND hwnd = m_hwnd; - m_hwnd = NULL; - SetWindowLong(hwnd, GWL_EXSTYLE, dwStyle); - m_hwnd = hwnd; - - OnDeactivate(); - - // Destroy the dialog window - - DestroyWindow(m_hwnd); - m_hwnd = NULL; - return NOERROR; -} - - -// Tells the application property page site - -STDMETHODIMP CBasePropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite) -{ - if (pPageSite) { - - if (m_pPageSite) { - return E_UNEXPECTED; - } - - m_pPageSite = pPageSite; - m_pPageSite->AddRef(); - - } else { - - if (m_pPageSite == NULL) { - return E_UNEXPECTED; - } - - m_pPageSite->Release(); - m_pPageSite = NULL; - } - return NOERROR; -} - - -// Apply any changes so far made - -STDMETHODIMP CBasePropertyPage::Apply() -{ - // In ActiveMovie 1.0 we used to check whether we had been activated or - // not. This is too constrictive. Apply should be allowed as long as - // SetObject was called to set an object. So we will no longer check to - // see if we have been activated (ie., m_hWnd != NULL), but instead - // make sure that m_bObjectSet is TRUE (ie., SetObject has been called). - - if (m_bObjectSet == FALSE) { - return E_UNEXPECTED; - } - - // Must have had a site set - - if (m_pPageSite == NULL) { - return E_UNEXPECTED; - } - - // Has anything changed - - if (m_bDirty == FALSE) { - return NOERROR; - } - - // Commit derived class changes - - HRESULT hr = OnApplyChanges(); - if (SUCCEEDED(hr)) { - m_bDirty = FALSE; - } - return hr; -} - - -// Base class definition for message handling - -INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) -{ - // we would like the TAB key to move around the tab stops in our property - // page, but for some reason OleCreatePropertyFrame clears the CONTROLPARENT - // style behind our back, so we need to switch it back on now behind its - // back. Otherwise the tab key will be useless in every page. - // - - CBasePropertyPage *pPropertyPage; - { - pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER); - if (pPropertyPage->m_hwnd == NULL) { - return 0; - } - switch (uMsg) { - case WM_STYLECHANGING: - if (wParam == GWL_EXSTYLE) { - LPSTYLESTRUCT lpss = (LPSTYLESTRUCT)lParam; - lpss->styleNew |= WS_EX_CONTROLPARENT; - return 0; - } - } - } - - return DefWindowProc(hwnd,uMsg,wParam,lParam); -} - +//------------------------------------------------------------------------------ +// File: CProp.cpp +// +// Desc: DirectShow base classes - implements CBasePropertyPage class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + +// Constructor for the base property page class. As described in the header +// file we must be initialised with dialog and title resource identifiers. +// The class supports IPropertyPage and overrides AddRef and Release calls +// to keep track of the reference counts. When the last count is released +// we call SetPageSite(NULL) and SetObjects(0,NULL) to release interfaces +// previously obtained by the property page when it had SetObjects called + +CBasePropertyPage::CBasePropertyPage(TCHAR *pName, // Debug only name + LPUNKNOWN pUnk, // COM Delegator + int DialogId, // Resource ID + int TitleId) : // To get tital + CUnknown(pName,pUnk), + m_DialogId(DialogId), + m_TitleId(TitleId), + m_hwnd(NULL), + m_Dlg(NULL), + m_pPageSite(NULL), + m_bObjectSet(FALSE), + m_bDirty(FALSE) +{ +} + +#ifdef UNICODE +CBasePropertyPage::CBasePropertyPage(CHAR *pName, // Debug only name + LPUNKNOWN pUnk, // COM Delegator + int DialogId, // Resource ID + int TitleId) : // To get tital + CUnknown(pName,pUnk), + m_DialogId(DialogId), + m_TitleId(TitleId), + m_hwnd(NULL), + m_Dlg(NULL), + m_pPageSite(NULL), + m_bObjectSet(FALSE), + m_bDirty(FALSE) +{ +} +#endif + +// Increment our reference count + +STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingAddRef() +{ + LONG lRef = InterlockedIncrement(&m_cRef); + ASSERT(lRef > 0); + return max(ULONG(m_cRef),1ul); +} + + +// Release a reference count and protect against reentrancy + +STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingRelease() +{ + // If the reference count drops to zero delete ourselves + + if (InterlockedDecrement(&m_cRef) == 0) { + m_cRef++; + SetPageSite(NULL); + SetObjects(0,NULL); + delete this; + return ULONG(0); + } else { + return max(ULONG(m_cRef),1ul); + } +} + + +// Expose our IPropertyPage interface + +STDMETHODIMP +CBasePropertyPage::NonDelegatingQueryInterface(REFIID riid,void **ppv) +{ + if (riid == IID_IPropertyPage) { + return GetInterface((IPropertyPage *)this,ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid,ppv); + } +} + + +// Get the page info so that the page site can size itself + +STDMETHODIMP CBasePropertyPage::GetPageInfo(LPPROPPAGEINFO pPageInfo) +{ + CheckPointer(pPageInfo,E_POINTER); + WCHAR wszTitle[STR_MAX_LENGTH]; + WideStringFromResource(wszTitle,m_TitleId); + + // Allocate dynamic memory for the property page title + + LPOLESTR pszTitle; + HRESULT hr = AMGetWideString(wszTitle, &pszTitle); + if (FAILED(hr)) { + NOTE("No caption memory"); + return hr; + } + + pPageInfo->cb = sizeof(PROPPAGEINFO); + pPageInfo->pszTitle = pszTitle; + pPageInfo->pszDocString = NULL; + pPageInfo->pszHelpFile = NULL; + pPageInfo->dwHelpContext = 0; + + // Set defaults in case GetDialogSize fails + pPageInfo->size.cx = 340; + pPageInfo->size.cy = 150; + + GetDialogSize(m_DialogId, DialogProc,0L,&pPageInfo->size); + return NOERROR; +} + + +// Handles the messages for our property window + +INT_PTR CALLBACK CBasePropertyPage::DialogProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + CBasePropertyPage *pPropertyPage; + + switch (uMsg) { + + case WM_INITDIALOG: + + SetWindowLongPtr(hwnd, DWLP_USER, lParam); + + // This pointer may be NULL when calculating size + + pPropertyPage = (CBasePropertyPage *) lParam; + if (pPropertyPage == NULL) { + return (LRESULT) 1; + } + pPropertyPage->m_Dlg = hwnd; + } + + // This pointer may be NULL when calculating size + + pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER); + if (pPropertyPage == NULL) { + return (LRESULT) 1; + } + return pPropertyPage->OnReceiveMessage(hwnd,uMsg,wParam,lParam); +} + + +// Tells us the object that should be informed of the property changes + +STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects,LPUNKNOWN *ppUnk) +{ + if (cObjects == 1) { + + if ((ppUnk == NULL) || (*ppUnk == NULL)) { + return E_POINTER; + } + + // Set a flag to say that we have set the Object + m_bObjectSet = TRUE ; + return OnConnect(*ppUnk); + + } else if (cObjects == 0) { + + // Set a flag to say that we have not set the Object for the page + m_bObjectSet = FALSE ; + return OnDisconnect(); + } + + DbgBreak("No support for more than one object"); + return E_UNEXPECTED; +} + + +// Create the window we will use to edit properties + +STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent, + LPCRECT pRect, + BOOL fModal) +{ + CheckPointer(pRect,E_POINTER); + + // Return failure if SetObject has not been called. + if (m_bObjectSet == FALSE) { + return E_UNEXPECTED; + } + + if (m_hwnd) { + return E_UNEXPECTED; + } + + m_hwnd = CreateDialogParam(g_hInst, + MAKEINTRESOURCE(m_DialogId), + hwndParent, + DialogProc, + (LPARAM) this); + if (m_hwnd == NULL) { + return E_OUTOFMEMORY; + } + + OnActivate(); + Move(pRect); + return Show(SW_SHOWNORMAL); +} + + +// Set the position of the property page + +STDMETHODIMP CBasePropertyPage::Move(LPCRECT pRect) +{ + CheckPointer(pRect,E_POINTER); + + if (m_hwnd == NULL) { + return E_UNEXPECTED; + } + + MoveWindow(m_hwnd, // Property page handle + pRect->left, // x coordinate + pRect->top, // y coordinate + WIDTH(pRect), // Overall window width + HEIGHT(pRect), // And likewise height + TRUE); // Should we repaint it + + return NOERROR; +} + + +// Display the property dialog + +STDMETHODIMP CBasePropertyPage::Show(UINT nCmdShow) +{ + // Have we been activated yet + + if (m_hwnd == NULL) { + return E_UNEXPECTED; + } + + // Ignore wrong show flags + + if ((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE)) { + return E_INVALIDARG; + } + + ShowWindow(m_hwnd,nCmdShow); + InvalidateRect(m_hwnd,NULL,TRUE); + return NOERROR; +} + + +// Destroy the property page dialog + +STDMETHODIMP CBasePropertyPage::Deactivate(void) +{ + if (m_hwnd == NULL) { + return E_UNEXPECTED; + } + + // Remove WS_EX_CONTROLPARENT before DestroyWindow call + + DWORD dwStyle = GetWindowLong(m_hwnd, GWL_EXSTYLE); + dwStyle = dwStyle & (~WS_EX_CONTROLPARENT); + + // Set m_hwnd to be NULL temporarily so the message handler + // for WM_STYLECHANGING doesn't add the WS_EX_CONTROLPARENT + // style back in + HWND hwnd = m_hwnd; + m_hwnd = NULL; + SetWindowLong(hwnd, GWL_EXSTYLE, dwStyle); + m_hwnd = hwnd; + + OnDeactivate(); + + // Destroy the dialog window + + DestroyWindow(m_hwnd); + m_hwnd = NULL; + return NOERROR; +} + + +// Tells the application property page site + +STDMETHODIMP CBasePropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite) +{ + if (pPageSite) { + + if (m_pPageSite) { + return E_UNEXPECTED; + } + + m_pPageSite = pPageSite; + m_pPageSite->AddRef(); + + } else { + + if (m_pPageSite == NULL) { + return E_UNEXPECTED; + } + + m_pPageSite->Release(); + m_pPageSite = NULL; + } + return NOERROR; +} + + +// Apply any changes so far made + +STDMETHODIMP CBasePropertyPage::Apply() +{ + // In ActiveMovie 1.0 we used to check whether we had been activated or + // not. This is too constrictive. Apply should be allowed as long as + // SetObject was called to set an object. So we will no longer check to + // see if we have been activated (ie., m_hWnd != NULL), but instead + // make sure that m_bObjectSet is TRUE (ie., SetObject has been called). + + if (m_bObjectSet == FALSE) { + return E_UNEXPECTED; + } + + // Must have had a site set + + if (m_pPageSite == NULL) { + return E_UNEXPECTED; + } + + // Has anything changed + + if (m_bDirty == FALSE) { + return NOERROR; + } + + // Commit derived class changes + + HRESULT hr = OnApplyChanges(); + if (SUCCEEDED(hr)) { + m_bDirty = FALSE; + } + return hr; +} + + +// Base class definition for message handling + +INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) +{ + // we would like the TAB key to move around the tab stops in our property + // page, but for some reason OleCreatePropertyFrame clears the CONTROLPARENT + // style behind our back, so we need to switch it back on now behind its + // back. Otherwise the tab key will be useless in every page. + // + + CBasePropertyPage *pPropertyPage; + { + pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER); + if (pPropertyPage->m_hwnd == NULL) { + return 0; + } + switch (uMsg) { + case WM_STYLECHANGING: + if (wParam == GWL_EXSTYLE) { + LPSTYLESTRUCT lpss = (LPSTYLESTRUCT)lParam; + lpss->styleNew |= WS_EX_CONTROLPARENT; + return 0; + } + } + } + + return DefWindowProc(hwnd,uMsg,wParam,lParam); +} + diff --git a/src/BaseClasses/cprop.h b/src/BaseClasses/cprop.h index 5163188a2e..034ebc3bdf 100644 --- a/src/BaseClasses/cprop.h +++ b/src/BaseClasses/cprop.h @@ -1,95 +1,95 @@ -//------------------------------------------------------------------------------ -// File: CProp.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __CPROP__ -#define __CPROP__ - -// Base property page class. Filters typically expose custom properties by -// implementing special control interfaces, examples are IDirectDrawVideo -// and IQualProp on renderers. This allows property pages to be built that -// use the given interface. Applications such as the ActiveMovie OCX query -// filters for the property pages they support and expose them to the user -// -// This class provides all the framework for a property page. A property -// page is a COM object that supports IPropertyPage. We should be created -// with a resource ID for the dialog which we will load when required. We -// should also be given in the constructor a resource ID for a title string -// we will load from the DLLs STRINGTABLE. The property page titles must be -// stored in resource files so that they can be easily internationalised -// -// We have a number of virtual methods (not PURE) that may be overriden in -// derived classes to query for interfaces and so on. These functions have -// simple implementations here that just return NOERROR. Derived classes -// will almost definately have to override the message handler method called -// OnReceiveMessage. We have a static dialog procedure that calls the method -// so that derived classes don't have to fiddle around with the this pointer - -class AM_NOVTABLE CBasePropertyPage : public IPropertyPage, public CUnknown -{ -protected: - - LPPROPERTYPAGESITE m_pPageSite; // Details for our property site - HWND m_hwnd; // Window handle for the page - HWND m_Dlg; // Actual dialog window handle - BOOL m_bDirty; // Has anything been changed - int m_TitleId; // Resource identifier for title - int m_DialogId; // Dialog resource identifier - - static INT_PTR CALLBACK DialogProc(HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam); - -private: - BOOL m_bObjectSet ; // SetObject has been called or not. -public: - - CBasePropertyPage(TCHAR *pName, // Debug only name - LPUNKNOWN pUnk, // COM Delegator - int DialogId, // Resource ID - int TitleId); // To get tital - -#ifdef UNICODE - CBasePropertyPage(CHAR *pName, - LPUNKNOWN pUnk, - int DialogId, - int TitleId); -#endif - virtual ~CBasePropertyPage() { }; - DECLARE_IUNKNOWN - - // Override these virtual methods - - virtual HRESULT OnConnect(IUnknown *pUnknown) { return NOERROR; }; - virtual HRESULT OnDisconnect() { return NOERROR; }; - virtual HRESULT OnActivate() { return NOERROR; }; - virtual HRESULT OnDeactivate() { return NOERROR; }; - virtual HRESULT OnApplyChanges() { return NOERROR; }; - virtual INT_PTR OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); - - // These implement an IPropertyPage interface - - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); - STDMETHODIMP_(ULONG) NonDelegatingRelease(); - STDMETHODIMP_(ULONG) NonDelegatingAddRef(); - STDMETHODIMP SetPageSite(LPPROPERTYPAGESITE pPageSite); - STDMETHODIMP Activate(HWND hwndParent,LPCRECT prect,BOOL fModal); - STDMETHODIMP Deactivate(void); - STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo); - STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN *ppUnk); - STDMETHODIMP Show(UINT nCmdShow); - STDMETHODIMP Move(LPCRECT prect); - STDMETHODIMP IsPageDirty(void) { return m_bDirty ? S_OK : S_FALSE; } - STDMETHODIMP Apply(void); - STDMETHODIMP Help(LPCWSTR lpszHelpDir) { return E_NOTIMPL; } - STDMETHODIMP TranslateAccelerator(LPMSG lpMsg) { return E_NOTIMPL; } -}; - -#endif // __CPROP__ - +//------------------------------------------------------------------------------ +// File: CProp.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __CPROP__ +#define __CPROP__ + +// Base property page class. Filters typically expose custom properties by +// implementing special control interfaces, examples are IDirectDrawVideo +// and IQualProp on renderers. This allows property pages to be built that +// use the given interface. Applications such as the ActiveMovie OCX query +// filters for the property pages they support and expose them to the user +// +// This class provides all the framework for a property page. A property +// page is a COM object that supports IPropertyPage. We should be created +// with a resource ID for the dialog which we will load when required. We +// should also be given in the constructor a resource ID for a title string +// we will load from the DLLs STRINGTABLE. The property page titles must be +// stored in resource files so that they can be easily internationalised +// +// We have a number of virtual methods (not PURE) that may be overriden in +// derived classes to query for interfaces and so on. These functions have +// simple implementations here that just return NOERROR. Derived classes +// will almost definately have to override the message handler method called +// OnReceiveMessage. We have a static dialog procedure that calls the method +// so that derived classes don't have to fiddle around with the this pointer + +class AM_NOVTABLE CBasePropertyPage : public IPropertyPage, public CUnknown +{ +protected: + + LPPROPERTYPAGESITE m_pPageSite; // Details for our property site + HWND m_hwnd; // Window handle for the page + HWND m_Dlg; // Actual dialog window handle + BOOL m_bDirty; // Has anything been changed + int m_TitleId; // Resource identifier for title + int m_DialogId; // Dialog resource identifier + + static INT_PTR CALLBACK DialogProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam); + +private: + BOOL m_bObjectSet ; // SetObject has been called or not. +public: + + CBasePropertyPage(TCHAR *pName, // Debug only name + LPUNKNOWN pUnk, // COM Delegator + int DialogId, // Resource ID + int TitleId); // To get tital + +#ifdef UNICODE + CBasePropertyPage(CHAR *pName, + LPUNKNOWN pUnk, + int DialogId, + int TitleId); +#endif + virtual ~CBasePropertyPage() { }; + DECLARE_IUNKNOWN + + // Override these virtual methods + + virtual HRESULT OnConnect(IUnknown *pUnknown) { return NOERROR; }; + virtual HRESULT OnDisconnect() { return NOERROR; }; + virtual HRESULT OnActivate() { return NOERROR; }; + virtual HRESULT OnDeactivate() { return NOERROR; }; + virtual HRESULT OnApplyChanges() { return NOERROR; }; + virtual INT_PTR OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + + // These implement an IPropertyPage interface + + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); + STDMETHODIMP_(ULONG) NonDelegatingRelease(); + STDMETHODIMP_(ULONG) NonDelegatingAddRef(); + STDMETHODIMP SetPageSite(LPPROPERTYPAGESITE pPageSite); + STDMETHODIMP Activate(HWND hwndParent,LPCRECT prect,BOOL fModal); + STDMETHODIMP Deactivate(void); + STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo); + STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN *ppUnk); + STDMETHODIMP Show(UINT nCmdShow); + STDMETHODIMP Move(LPCRECT prect); + STDMETHODIMP IsPageDirty(void) { return m_bDirty ? S_OK : S_FALSE; } + STDMETHODIMP Apply(void); + STDMETHODIMP Help(LPCWSTR lpszHelpDir) { return E_NOTIMPL; } + STDMETHODIMP TranslateAccelerator(LPMSG lpMsg) { return E_NOTIMPL; } +}; + +#endif // __CPROP__ + diff --git a/src/BaseClasses/ctlutil.cpp b/src/BaseClasses/ctlutil.cpp index dcb73e0fd4..8a98c83a08 100644 --- a/src/BaseClasses/ctlutil.cpp +++ b/src/BaseClasses/ctlutil.cpp @@ -1,2378 +1,2378 @@ -//------------------------------------------------------------------------------ -// File: CtlUtil.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// Base classes implementing IDispatch parsing for the basic control dual -// interfaces. Derive from these and implement just the custom method and -// property methods. We also implement CPosPassThru that can be used by -// renderers and transforms to pass by IMediaPosition and IMediaSeeking - - -#include -#include -#include "seekpt.h" - -// 'bool' non standard reserved word -#pragma warning(disable:4237) - - -// --- CBaseDispatch implementation ---------- -CBaseDispatch::~CBaseDispatch() { - if(m_pti) { - m_pti->Release(); - } -} - - -// return 1 if we support GetTypeInfo - -STDMETHODIMP -CBaseDispatch::GetTypeInfoCount(UINT * pctinfo) { - CheckPointer(pctinfo,E_POINTER); - ValidateReadWritePtr(pctinfo,sizeof(UINT *)); - *pctinfo = 1; - return S_OK; -} - - -typedef HRESULT(STDAPICALLTYPE *LPLOADTYPELIB)( - const OLECHAR FAR *szFile, - ITypeLib FAR* FAR* pptlib); - -typedef HRESULT(STDAPICALLTYPE *LPLOADREGTYPELIB)(REFGUID rguid, - WORD wVerMajor, - WORD wVerMinor, - LCID lcid, - ITypeLib FAR* FAR* pptlib); - -// attempt to find our type library - -STDMETHODIMP -CBaseDispatch::GetTypeInfo( - REFIID riid, - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - CheckPointer(pptinfo,E_POINTER); - ValidateReadWritePtr(pptinfo,sizeof(ITypeInfo *)); - HRESULT hr; - - *pptinfo = NULL; - - // we only support one type element - if(0 != itinfo) { - return TYPE_E_ELEMENTNOTFOUND; - } - - // always look for neutral - if(NULL == m_pti) { - - LPLOADTYPELIB lpfnLoadTypeLib; - LPLOADREGTYPELIB lpfnLoadRegTypeLib; - ITypeLib *ptlib; - HINSTANCE hInst; - - static const char szTypeLib[] = "LoadTypeLib"; - static const char szRegTypeLib[] = "LoadRegTypeLib"; - static const WCHAR szControl[] = L"control.tlb"; - - // - // Try to get the Ole32Aut.dll module handle. - // - - hInst = LoadOLEAut32(); - if(hInst == NULL) { - DWORD dwError = GetLastError(); - return AmHresultFromWin32(dwError); - } - lpfnLoadRegTypeLib = (LPLOADREGTYPELIB)GetProcAddress(hInst, - szRegTypeLib); - if(lpfnLoadRegTypeLib == NULL) { - DWORD dwError = GetLastError(); - return AmHresultFromWin32(dwError); - } - - hr = (*lpfnLoadRegTypeLib)(LIBID_QuartzTypeLib, 1, 0, // version 1.0 - lcid, &ptlib); - - if(FAILED(hr)) { - - // attempt to load directly - this will fill the - // registry in if it finds it - - lpfnLoadTypeLib = (LPLOADTYPELIB)GetProcAddress(hInst, szTypeLib); - if(lpfnLoadTypeLib == NULL) { - DWORD dwError = GetLastError(); - return AmHresultFromWin32(dwError); - } - - hr = (*lpfnLoadTypeLib)(szControl, &ptlib); - if(FAILED(hr)) { - return hr; - } - } - - hr = ptlib->GetTypeInfoOfGuid(riid, &m_pti); - - ptlib->Release(); - - if(FAILED(hr)) { - return hr; - } - } - - *pptinfo = m_pti; - m_pti->AddRef(); - return S_OK; -} - - -STDMETHODIMP -CBaseDispatch::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - // although the IDispatch riid is dead, we use this to pass from - // the interface implementation class to us the iid we are talking about. - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(riid, 0, lcid, &pti); - - if(SUCCEEDED(hr)) { - hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid); - - pti->Release(); - } - return hr; -} - - -// --- CMediaControl implementation --------- - -CMediaControl::CMediaControl(const TCHAR * name,LPUNKNOWN pUnk) : - CUnknown(name, pUnk) { -} - -// expose our interfaces IMediaControl and IUnknown - -STDMETHODIMP -CMediaControl::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IMediaControl) { - return GetInterface((IMediaControl *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -// return 1 if we support GetTypeInfo - -STDMETHODIMP -CMediaControl::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -// attempt to find our type library - -STDMETHODIMP -CMediaControl::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IMediaControl, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CMediaControl::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IMediaControl, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CMediaControl::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IMediaControl *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- CMediaEvent implementation ---------- - - -CMediaEvent::CMediaEvent(const TCHAR * name,LPUNKNOWN pUnk) : - CUnknown(name, pUnk) { -} - - -// expose our interfaces IMediaEvent and IUnknown - -STDMETHODIMP -CMediaEvent::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IMediaEvent || riid == IID_IMediaEventEx) { - return GetInterface((IMediaEventEx *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -// return 1 if we support GetTypeInfo - -STDMETHODIMP -CMediaEvent::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -// attempt to find our type library - -STDMETHODIMP -CMediaEvent::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IMediaEvent, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CMediaEvent::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IMediaEvent, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CMediaEvent::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IMediaEvent *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- CMediaPosition implementation ---------- - - -CMediaPosition::CMediaPosition(const TCHAR * name,LPUNKNOWN pUnk) : - CUnknown(name, pUnk) { -} - -CMediaPosition::CMediaPosition(const TCHAR * name, - LPUNKNOWN pUnk, - HRESULT * phr) : - CUnknown(name, pUnk) { - UNREFERENCED_PARAMETER(phr); -} - - -// expose our interfaces IMediaPosition and IUnknown - -STDMETHODIMP -CMediaPosition::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IMediaPosition) { - return GetInterface((IMediaPosition *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -// return 1 if we support GetTypeInfo - -STDMETHODIMP -CMediaPosition::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -// attempt to find our type library - -STDMETHODIMP -CMediaPosition::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IMediaPosition, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CMediaPosition::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IMediaPosition, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CMediaPosition::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IMediaPosition *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- IMediaPosition and IMediaSeeking pass through class ---------- - - -CPosPassThru::CPosPassThru(const TCHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr, - IPin *pPin) : - CMediaPosition(pName,pUnk), - m_pPin(pPin) { - if(pPin == NULL) { - *phr = E_POINTER; - return; - } -} - - -// Expose our IMediaSeeking and IMediaPosition interfaces - -STDMETHODIMP -CPosPassThru::NonDelegatingQueryInterface(REFIID riid,void **ppv) { - CheckPointer(ppv,E_POINTER); - *ppv = NULL; - - if(riid == IID_IMediaSeeking) { - return GetInterface(static_cast(this), ppv); - } - return CMediaPosition::NonDelegatingQueryInterface(riid,ppv); -} - - -// Return the IMediaPosition interface from our peer - -HRESULT -CPosPassThru::GetPeer(IMediaPosition ** ppMP) { - *ppMP = NULL; - - IPin *pConnected; - HRESULT hr = m_pPin->ConnectedTo(&pConnected); - if(FAILED(hr)) { - return E_NOTIMPL; - } - - IMediaPosition * pMP; - hr = pConnected->QueryInterface(IID_IMediaPosition, (void **) &pMP); - pConnected->Release(); - if(FAILED(hr)) { - return E_NOTIMPL; - } - - *ppMP = pMP; - return S_OK; -} - - -// Return the IMediaSeeking interface from our peer - -HRESULT -CPosPassThru::GetPeerSeeking(IMediaSeeking ** ppMS) { - *ppMS = NULL; - - IPin *pConnected; - HRESULT hr = m_pPin->ConnectedTo(&pConnected); - if(FAILED(hr)) { - return E_NOTIMPL; - } - - IMediaSeeking * pMS; - hr = pConnected->QueryInterface(IID_IMediaSeeking, (void **) &pMS); - pConnected->Release(); - if(FAILED(hr)) { - return E_NOTIMPL; - } - - *ppMS = pMS; - return S_OK; -} - - -// --- IMediaSeeking methods ---------- - - -STDMETHODIMP -CPosPassThru::GetCapabilities(DWORD * pCaps) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->GetCapabilities(pCaps); - pMS->Release(); - return hr; -} - -STDMETHODIMP -CPosPassThru::CheckCapabilities(DWORD * pCaps) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->CheckCapabilities(pCaps); - pMS->Release(); - return hr; -} - -STDMETHODIMP -CPosPassThru::IsFormatSupported(const GUID * pFormat) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->IsFormatSupported(pFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::QueryPreferredFormat(GUID *pFormat) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->QueryPreferredFormat(pFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::SetTimeFormat(const GUID * pFormat) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->SetTimeFormat(pFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::GetTimeFormat(GUID *pFormat) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->GetTimeFormat(pFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::IsUsingTimeFormat(const GUID * pFormat) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->IsUsingTimeFormat(pFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat, - LONGLONG Source, const GUID * pSourceFormat ) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags - , LONGLONG * pStop, DWORD StopFlags ) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->SetPositions(pCurrent, CurrentFlags, pStop, StopFlags); - pMS->Release(); - return hr; -} - -STDMETHODIMP -CPosPassThru::GetPositions(LONGLONG *pCurrent, LONGLONG * pStop) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->GetPositions(pCurrent,pStop); - pMS->Release(); - return hr; -} - -HRESULT -CPosPassThru::GetSeekingLongLong -( HRESULT(__stdcall IMediaSeeking::*pMethod)( LONGLONG * ) -, LONGLONG * pll -) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(SUCCEEDED(hr)) { - hr = (pMS->*pMethod)(pll); - pMS->Release(); - } - return hr; -} - -// If we don't have a current position then ask upstream - -STDMETHODIMP -CPosPassThru::GetCurrentPosition(LONGLONG *pCurrent) { - // Can we report the current position - HRESULT hr = GetMediaTime(pCurrent,NULL); - if(SUCCEEDED(hr)) - hr = NOERROR; - else - hr = GetSeekingLongLong(&IMediaSeeking::GetCurrentPosition, pCurrent); - return hr; -} - - -STDMETHODIMP -CPosPassThru::GetStopPosition(LONGLONG *pStop) { - return GetSeekingLongLong(&IMediaSeeking::GetStopPosition, pStop);; -} - -STDMETHODIMP -CPosPassThru::GetDuration(LONGLONG *pDuration) { - return GetSeekingLongLong(&IMediaSeeking::GetDuration, pDuration);; -} - - -STDMETHODIMP -CPosPassThru::GetPreroll(LONGLONG *pllPreroll) { - return GetSeekingLongLong(&IMediaSeeking::GetPreroll, pllPreroll);; -} - - -STDMETHODIMP -CPosPassThru::GetAvailable( LONGLONG *pEarliest, LONGLONG *pLatest ) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - - hr = pMS->GetAvailable(pEarliest, pLatest); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::GetRate(double * pdRate) { - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - hr = pMS->GetRate(pdRate); - pMS->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::SetRate(double dRate) { - if(0.0 == dRate) { - return E_INVALIDARG; - } - - IMediaSeeking* pMS; - HRESULT hr = GetPeerSeeking(&pMS); - if(FAILED(hr)) { - return hr; - } - hr = pMS->SetRate(dRate); - pMS->Release(); - return hr; -} - - - - -// --- IMediaPosition methods ---------- - - -STDMETHODIMP -CPosPassThru::get_Duration(REFTIME * plength) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - - hr = pMP->get_Duration(plength); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::get_CurrentPosition(REFTIME * pllTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->get_CurrentPosition(pllTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::put_CurrentPosition(REFTIME llTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->put_CurrentPosition(llTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::get_StopTime(REFTIME * pllTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->get_StopTime(pllTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::put_StopTime(REFTIME llTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->put_StopTime(llTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::get_PrerollTime(REFTIME * pllTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->get_PrerollTime(pllTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::put_PrerollTime(REFTIME llTime) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->put_PrerollTime(llTime); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::get_Rate(double * pdRate) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->get_Rate(pdRate); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::put_Rate(double dRate) { - if(0.0 == dRate) { - return E_INVALIDARG; - } - - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->put_Rate(dRate); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::CanSeekForward(LONG *pCanSeekForward) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->CanSeekForward(pCanSeekForward); - pMP->Release(); - return hr; -} - - -STDMETHODIMP -CPosPassThru::CanSeekBackward(LONG *pCanSeekBackward) { - IMediaPosition* pMP; - HRESULT hr = GetPeer(&pMP); - if(FAILED(hr)) { - return hr; - } - hr = pMP->CanSeekBackward(pCanSeekBackward); - pMP->Release(); - return hr; -} - - -// --- Implements the CRendererPosPassThru class ---------- - - -// Media times (eg current frame, field, sample etc) are passed through the -// filtergraph in media samples. When a renderer gets a sample with media -// times in it, it will call one of the RegisterMediaTime methods we expose -// (one takes an IMediaSample, the other takes the media times direct). We -// store the media times internally and return them in GetCurrentPosition. - -CRendererPosPassThru::CRendererPosPassThru(const TCHAR *pName, - LPUNKNOWN pUnk, - HRESULT *phr, - IPin *pPin) : - CPosPassThru(pName,pUnk,phr,pPin), - m_StartMedia(0), - m_EndMedia(0), - m_bReset(TRUE) { -} - - -// Sets the media times the object should report - -HRESULT -CRendererPosPassThru::RegisterMediaTime(IMediaSample *pMediaSample) { - ASSERT(pMediaSample); - LONGLONG StartMedia; - LONGLONG EndMedia; - - CAutoLock cAutoLock(&m_PositionLock); - - // Get the media times from the sample - - HRESULT hr = pMediaSample->GetTime(&StartMedia,&EndMedia); - if(FAILED(hr)) { - ASSERT(hr == VFW_E_SAMPLE_TIME_NOT_SET); - return hr; - } - - m_StartMedia = StartMedia; - m_EndMedia = EndMedia; - m_bReset = FALSE; - return NOERROR; -} - - -// Sets the media times the object should report - -HRESULT -CRendererPosPassThru::RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime) { - CAutoLock cAutoLock(&m_PositionLock); - m_StartMedia = StartTime; - m_EndMedia = EndTime; - m_bReset = FALSE; - return NOERROR; -} - - -// Return the current media times registered in the object - -HRESULT -CRendererPosPassThru::GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) { - ASSERT(pStartTime); - - CAutoLock cAutoLock(&m_PositionLock); - if(m_bReset == TRUE) { - return E_FAIL; - } - - // We don't have to return the end time - - HRESULT hr = ConvertTimeFormat(pStartTime, 0, m_StartMedia, &TIME_FORMAT_MEDIA_TIME); - if(pEndTime && SUCCEEDED(hr)) { - hr = ConvertTimeFormat(pEndTime, 0, m_EndMedia, &TIME_FORMAT_MEDIA_TIME); - } - return hr; -} - - -// Resets the media times we hold - -HRESULT -CRendererPosPassThru::ResetMediaTime() { - CAutoLock cAutoLock(&m_PositionLock); - m_StartMedia = 0; - m_EndMedia = 0; - m_bReset = TRUE; - return NOERROR; -} - -// Intended to be called by the owing filter during EOS processing so -// that the media times can be adjusted to the stop time. This ensures -// that the GetCurrentPosition will actully get to the stop position. -HRESULT -CRendererPosPassThru::EOS() { - HRESULT hr; - - if(m_bReset == TRUE) hr = E_FAIL; - else { - LONGLONG llStop; - if (SUCCEEDED(hr=GetStopPosition(&llStop))) { - CAutoLock cAutoLock(&m_PositionLock); - m_StartMedia = m_EndMedia = llStop; - } - } - return hr; -} - -// -- CSourceSeeking implementation ------------ - -CSourceSeeking::CSourceSeeking( - const TCHAR * pName, - LPUNKNOWN pUnk, - HRESULT* phr, - CCritSec * pLock) : - CUnknown(pName, pUnk), - m_pLock(pLock), - m_rtStart((long)0) { - m_rtStop = _I64_MAX / 2; - m_rtDuration = m_rtStop; - m_dRateSeeking = 1.0; - - m_dwSeekingCaps = AM_SEEKING_CanSeekForwards - | AM_SEEKING_CanSeekBackwards - | AM_SEEKING_CanSeekAbsolute - | AM_SEEKING_CanGetStopPos - | AM_SEEKING_CanGetDuration; -} - -HRESULT CSourceSeeking::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - if(riid == IID_IMediaSeeking) { - CheckPointer(ppv, E_POINTER); - return GetInterface(static_cast(this), ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -HRESULT CSourceSeeking::IsFormatSupported(const GUID * pFormat) { - CheckPointer(pFormat, E_POINTER); - // only seeking in time (REFERENCE_TIME units) is supported - return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; -} - -HRESULT CSourceSeeking::QueryPreferredFormat(GUID *pFormat) { - CheckPointer(pFormat, E_POINTER); - *pFormat = TIME_FORMAT_MEDIA_TIME; - return S_OK; -} - -HRESULT CSourceSeeking::SetTimeFormat(const GUID * pFormat) { - CheckPointer(pFormat, E_POINTER); - - // nothing to set; just check that it's TIME_FORMAT_TIME - return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : E_INVALIDARG; -} - -HRESULT CSourceSeeking::IsUsingTimeFormat(const GUID * pFormat) { - CheckPointer(pFormat, E_POINTER); - return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; -} - -HRESULT CSourceSeeking::GetTimeFormat(GUID *pFormat) { - CheckPointer(pFormat, E_POINTER); - *pFormat = TIME_FORMAT_MEDIA_TIME; - return S_OK; -} - -HRESULT CSourceSeeking::GetDuration(LONGLONG *pDuration) { - CheckPointer(pDuration, E_POINTER); - CAutoLock lock(m_pLock); - *pDuration = m_rtDuration; - return S_OK; -} - -HRESULT CSourceSeeking::GetStopPosition(LONGLONG *pStop) { - CheckPointer(pStop, E_POINTER); - CAutoLock lock(m_pLock); - *pStop = m_rtStop; - return S_OK; -} - -HRESULT CSourceSeeking::GetCurrentPosition(LONGLONG *pCurrent) { - // GetCurrentPosition is typically supported only in renderers and - // not in source filters. - return E_NOTIMPL; -} - -HRESULT CSourceSeeking::GetCapabilities( DWORD * pCapabilities ) { - CheckPointer(pCapabilities, E_POINTER); - *pCapabilities = m_dwSeekingCaps; - return S_OK; -} - -HRESULT CSourceSeeking::CheckCapabilities( DWORD * pCapabilities ) { - CheckPointer(pCapabilities, E_POINTER); - - // make sure all requested capabilities are in our mask - return (~m_dwSeekingCaps & *pCapabilities) ? S_FALSE : S_OK; -} - -HRESULT CSourceSeeking::ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat, - LONGLONG Source, const GUID * pSourceFormat ) { - CheckPointer(pTarget, E_POINTER); - // format guids can be null to indicate current format - - // since we only support TIME_FORMAT_MEDIA_TIME, we don't really - // offer any conversions. - if(pTargetFormat == 0 || *pTargetFormat == TIME_FORMAT_MEDIA_TIME) { - if(pSourceFormat == 0 || *pSourceFormat == TIME_FORMAT_MEDIA_TIME) { - *pTarget = Source; - return S_OK; - } - } - - return E_INVALIDARG; -} - - -HRESULT CSourceSeeking::SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags - , LONGLONG * pStop, DWORD StopFlags ) { - DWORD StopPosBits = StopFlags & AM_SEEKING_PositioningBitsMask; - DWORD StartPosBits = CurrentFlags & AM_SEEKING_PositioningBitsMask; - - if(StopFlags) { - CheckPointer(pStop, E_POINTER); - - // accept only relative, incremental, or absolute positioning - if(StopPosBits != StopFlags) { - return E_INVALIDARG; - } - } - - if(CurrentFlags) { - CheckPointer(pCurrent, E_POINTER); - if(StartPosBits != AM_SEEKING_AbsolutePositioning && - StartPosBits != AM_SEEKING_RelativePositioning) { - return E_INVALIDARG; - } - } - - - // scope for autolock - { - CAutoLock lock(m_pLock); - - // set start position - if(StartPosBits == AM_SEEKING_AbsolutePositioning) { - m_rtStart = *pCurrent; - } - else if(StartPosBits == AM_SEEKING_RelativePositioning) { - m_rtStart += *pCurrent; - } - - // set stop position - if(StopPosBits == AM_SEEKING_AbsolutePositioning) { - m_rtStop = *pStop; - } - else if(StopPosBits == AM_SEEKING_IncrementalPositioning) { - m_rtStop = m_rtStart + *pStop; - } - else if(StopPosBits == AM_SEEKING_RelativePositioning) { - m_rtStop = m_rtStop + *pStop; - } - } - - - HRESULT hr = S_OK; - if(SUCCEEDED(hr) && StopPosBits) { - hr = ChangeStop(); - } - if(StartPosBits) { - hr = ChangeStart(); - } - - return hr; -} - - -HRESULT CSourceSeeking::GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ) { - if(pCurrent) { - *pCurrent = m_rtStart; - } - if(pStop) { - *pStop = m_rtStop; - } - - return S_OK;; -} - - -HRESULT CSourceSeeking::GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest ) { - if(pEarliest) { - *pEarliest = 0; - } - if(pLatest) { - CAutoLock lock(m_pLock); - *pLatest = m_rtDuration; - } - return S_OK; -} - -HRESULT CSourceSeeking::SetRate( double dRate) { { - CAutoLock lock(m_pLock); - m_dRateSeeking = dRate; - } - return ChangeRate(); -} - -HRESULT CSourceSeeking::GetRate( double * pdRate) { - CheckPointer(pdRate, E_POINTER); - CAutoLock lock(m_pLock); - *pdRate = m_dRateSeeking; - return S_OK; -} - -HRESULT CSourceSeeking::GetPreroll(LONGLONG *pPreroll) { - CheckPointer(pPreroll, E_POINTER); - *pPreroll = 0; - return S_OK; -} - - - - - -// --- CSourcePosition implementation ---------- - - -CSourcePosition::CSourcePosition(const TCHAR * pName, - LPUNKNOWN pUnk, - HRESULT* phr, - CCritSec * pLock) : - CMediaPosition(pName, pUnk), - m_pLock(pLock), - m_Start(CRefTime((LONGLONG)0)) { - m_Stop = _I64_MAX; - m_Rate = 1.0; -} - - -STDMETHODIMP -CSourcePosition::get_Duration(REFTIME * plength) { - CheckPointer(plength,E_POINTER); - ValidateReadWritePtr(plength,sizeof(REFTIME)); - CAutoLock lock(m_pLock); - - *plength = m_Duration; - return S_OK; -} - - -STDMETHODIMP -CSourcePosition::put_CurrentPosition(REFTIME llTime) { - m_pLock->Lock(); - m_Start = llTime; - m_pLock->Unlock(); - - return ChangeStart(); -} - - -STDMETHODIMP -CSourcePosition::get_StopTime(REFTIME * pllTime) { - CheckPointer(pllTime,E_POINTER); - ValidateReadWritePtr(pllTime,sizeof(REFTIME)); - CAutoLock lock(m_pLock); - - *pllTime = m_Stop; - return S_OK; -} - - -STDMETHODIMP -CSourcePosition::put_StopTime(REFTIME llTime) { - m_pLock->Lock(); - m_Stop = llTime; - m_pLock->Unlock(); - - return ChangeStop(); -} - - -STDMETHODIMP -CSourcePosition::get_PrerollTime(REFTIME * pllTime) { - CheckPointer(pllTime,E_POINTER); - ValidateReadWritePtr(pllTime,sizeof(REFTIME)); - return E_NOTIMPL; -} - - -STDMETHODIMP -CSourcePosition::put_PrerollTime(REFTIME llTime) { - return E_NOTIMPL; -} - - -STDMETHODIMP -CSourcePosition::get_Rate(double * pdRate) { - CheckPointer(pdRate,E_POINTER); - ValidateReadWritePtr(pdRate,sizeof(double)); - CAutoLock lock(m_pLock); - - *pdRate = m_Rate; - return S_OK; -} - - -STDMETHODIMP -CSourcePosition::put_Rate(double dRate) { - m_pLock->Lock(); - m_Rate = dRate; - m_pLock->Unlock(); - - return ChangeRate(); -} - - -// By default we can seek forwards - -STDMETHODIMP -CSourcePosition::CanSeekForward(LONG *pCanSeekForward) { - CheckPointer(pCanSeekForward,E_POINTER); - *pCanSeekForward = OATRUE; - return S_OK; -} - - -// By default we can seek backwards - -STDMETHODIMP -CSourcePosition::CanSeekBackward(LONG *pCanSeekBackward) { - CheckPointer(pCanSeekBackward,E_POINTER); - *pCanSeekBackward = OATRUE; - return S_OK; -} - - -// --- Implementation of CBasicAudio class ---------- - - -CBasicAudio::CBasicAudio(const TCHAR * pName,LPUNKNOWN punk) : - CUnknown(pName, punk) { -} - -// overriden to publicise our interfaces - -STDMETHODIMP -CBasicAudio::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IBasicAudio) { - return GetInterface((IBasicAudio *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -STDMETHODIMP -CBasicAudio::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -STDMETHODIMP -CBasicAudio::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IBasicAudio, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CBasicAudio::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IBasicAudio, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CBasicAudio::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IBasicAudio *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- IVideoWindow implementation ---------- - -CBaseVideoWindow::CBaseVideoWindow(const TCHAR * pName,LPUNKNOWN punk) : - CUnknown(pName, punk) { -} - - -// overriden to publicise our interfaces - -STDMETHODIMP -CBaseVideoWindow::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IVideoWindow) { - return GetInterface((IVideoWindow *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -STDMETHODIMP -CBaseVideoWindow::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -STDMETHODIMP -CBaseVideoWindow::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IVideoWindow, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CBaseVideoWindow::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IVideoWindow, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CBaseVideoWindow::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IVideoWindow *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- IBasicVideo implementation ---------- - - -CBaseBasicVideo::CBaseBasicVideo(const TCHAR * pName,LPUNKNOWN punk) : - CUnknown(pName, punk) { -} - - -// overriden to publicise our interfaces - -STDMETHODIMP -CBaseBasicVideo::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IBasicVideo || riid == IID_IBasicVideo2) { - return GetInterface(static_cast(this), ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -STDMETHODIMP -CBaseBasicVideo::GetTypeInfoCount(UINT * pctinfo) { - return m_basedisp.GetTypeInfoCount(pctinfo); -} - - -STDMETHODIMP -CBaseBasicVideo::GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo) { - return m_basedisp.GetTypeInfo(IID_IBasicVideo, - itinfo, - lcid, - pptinfo); -} - - -STDMETHODIMP -CBaseBasicVideo::GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid) { - return m_basedisp.GetIDsOfNames(IID_IBasicVideo, - rgszNames, - cNames, - lcid, - rgdispid); -} - - -STDMETHODIMP -CBaseBasicVideo::Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr) { - // this parameter is a dead leftover from an earlier interface - if(IID_NULL != riid) { - return DISP_E_UNKNOWNINTERFACE; - } - - ITypeInfo * pti; - HRESULT hr = GetTypeInfo(0, lcid, &pti); - - if(FAILED(hr)) { - return hr; - } - - hr = pti->Invoke((IBasicVideo *)this, - dispidMember, - wFlags, - pdispparams, - pvarResult, - pexcepinfo, - puArgErr); - - pti->Release(); - return hr; -} - - -// --- Implementation of Deferred Commands ---------- - - -CDispParams::CDispParams(UINT nArgs, VARIANT* pArgs, HRESULT *phr) { - cNamedArgs = 0; - rgdispidNamedArgs = NULL; - cArgs = nArgs; - - if(cArgs) { - rgvarg = new VARIANT[cArgs]; - if(NULL == rgvarg) { - cArgs = 0; - if(phr) { - *phr = E_OUTOFMEMORY; - } - return; - } - - for(UINT i = 0; i < cArgs; i++) { - - VARIANT * pDest = &rgvarg[i]; - VARIANT * pSrc = &pArgs[i]; - - pDest->vt = pSrc->vt; - switch(pDest->vt) { - - case VT_I4: - pDest->lVal = pSrc->lVal; - break; - - case VT_UI1: - pDest->bVal = pSrc->bVal; - break; - - case VT_I2: - pDest->iVal = pSrc->iVal; - break; - - case VT_R4: - pDest->fltVal = pSrc->fltVal; - break; - - case VT_R8: - pDest->dblVal = pSrc->dblVal; - break; - - case VT_BOOL: - pDest->boolVal = pSrc->boolVal; - break; - - case VT_ERROR: - pDest->scode = pSrc->scode; - break; - - case VT_CY: - pDest->cyVal = pSrc->cyVal; - break; - - case VT_DATE: - pDest->date = pSrc->date; - break; - - case VT_BSTR: - if(pSrc->bstrVal == NULL) { - pDest->bstrVal = NULL; - } - else { - - // a BSTR is a WORD followed by a UNICODE string. - // the pointer points just after the WORD - - WORD len = * (WORD*) (pSrc->bstrVal - (sizeof(WORD) / sizeof(OLECHAR))); - OLECHAR* pch = new OLECHAR[len + (sizeof(WORD)/sizeof(OLECHAR))]; - if(pch) { - WORD *pui = (WORD*)pch; - *pui = len; - pDest->bstrVal = pch + (sizeof(WORD)/sizeof(OLECHAR)); - CopyMemory(pDest->bstrVal, pSrc->bstrVal, len*sizeof(OLECHAR)); - } - else { - cArgs = i; - if(phr) { - *phr = E_OUTOFMEMORY; - } - } - } - pDest->bstrVal = pSrc->bstrVal; - break; - - case VT_UNKNOWN: - pDest->punkVal = pSrc->punkVal; - pDest->punkVal->AddRef(); - break; - - case VT_DISPATCH: - pDest->pdispVal = pSrc->pdispVal; - pDest->pdispVal->AddRef(); - break; - - default: - // a type we haven't got round to adding yet! - ASSERT(0); - break; - } - } - - } - else { - rgvarg = NULL; - } - -} - - -CDispParams::~CDispParams() { - for(UINT i = 0; i < cArgs; i++) { - switch(rgvarg[i].vt) { - case VT_BSTR: - if(rgvarg[i].bstrVal != NULL) { - OLECHAR * pch = rgvarg[i].bstrVal - (sizeof(WORD)/sizeof(OLECHAR)); - delete pch; - } - break; - - case VT_UNKNOWN: - rgvarg[i].punkVal->Release(); - break; - - case VT_DISPATCH: - rgvarg[i].pdispVal->Release(); - break; - } - } - delete[] rgvarg; -} - - -// lifetime is controlled by refcounts (see defer.h) - -CDeferredCommand::CDeferredCommand( - CCmdQueue * pQ, - LPUNKNOWN pUnk, - HRESULT * phr, - LPUNKNOWN pUnkExecutor, - REFTIME time, - GUID* iid, - long dispidMethod, - short wFlags, - long nArgs, - VARIANT* pDispParams, - VARIANT* pvarResult, - short* puArgErr, - BOOL bStream - ) : - CUnknown(NAME("DeferredCommand"), pUnk), - m_pQueue(pQ), - m_pUnk(pUnkExecutor), - m_iid(iid), - m_dispidMethod(dispidMethod), - m_wFlags(wFlags), - m_DispParams(nArgs, pDispParams, phr), - m_pvarResult(pvarResult), - m_bStream(bStream), - m_hrResult(E_ABORT) { - - // convert REFTIME to REFERENCE_TIME - COARefTime convertor(time); - m_time = convertor; - - // no check of time validity - it's ok to queue a command that's - // already late - - // check iid is supportable on pUnk by QueryInterface for it - IUnknown * pInterface; - HRESULT hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface); - if(FAILED(hr)) { - *phr = hr; - return; - } - pInterface->Release(); - - - // !!! check dispidMethod and param/return types using typelib - ITypeInfo *pti; - hr = m_Dispatch.GetTypeInfo(*iid, 0, 0, &pti); - if(FAILED(hr)) { - *phr = hr; - return; - } - // !!! some sort of ITypeInfo validity check here - pti->Release(); - - - // Fix up the dispid for put and get - if(wFlags == DISPATCH_PROPERTYPUT) { - m_DispParams.cNamedArgs = 1; - m_DispId = DISPID_PROPERTYPUT; - m_DispParams.rgdispidNamedArgs = &m_DispId; - } - - // all checks ok - add to queue - hr = pQ->Insert(this); - if(FAILED(hr)) { - *phr = hr; - } -} - - -// refcounts are held by caller of InvokeAt... and by list. So if -// we get here, we can't be on the list - -#if 0 -CDeferredCommand::~CDeferredCommand() { - // this assert is invalid since if the queue is deleted while we are - // still on the queue, we will have been removed by the queue and this - // m_pQueue will not have been modified. - // ASSERT(m_pQueue == NULL); - - // we don't hold a ref count on pUnk, which is the object that should - // execute the command. - // This is because there would otherwise be a circular refcount problem - // since pUnk probably owns the CmdQueue object that has a refcount - // on us. - // The lifetime of pUnk is guaranteed by it being part of, or lifetime - // controlled by, our parent object. As long as we are on the list, pUnk - // must be valid. Once we are off the list, we do not use pUnk. - -} -#endif - - -// overriden to publicise our interfaces - -STDMETHODIMP -CDeferredCommand::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ValidateReadWritePtr(ppv,sizeof(PVOID)); - if(riid == IID_IDeferredCommand) { - return GetInterface((IDeferredCommand *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} - - -// remove from q. this will reduce the refcount by one (since the q -// holds a count) but can't make us go away since he must have a -// refcount in order to call this method. - -STDMETHODIMP -CDeferredCommand::Cancel() { - if(m_pQueue == NULL) { - return VFW_E_ALREADY_CANCELLED; - } - - HRESULT hr = m_pQueue->Remove(this); - if(FAILED(hr)) { - return hr; - } - - m_pQueue = NULL; - return S_OK; -} - - -STDMETHODIMP -CDeferredCommand::Confidence(LONG* pConfidence) { - return E_NOTIMPL; -} - - -STDMETHODIMP -CDeferredCommand::GetHResult(HRESULT * phrResult) { - CheckPointer(phrResult,E_POINTER); - ValidateReadWritePtr(phrResult,sizeof(HRESULT)); - - if(m_pQueue != NULL) { - return E_ABORT; - } - *phrResult = m_hrResult; - return S_OK; -} - - -// set the time to be a new time (checking that it is valid) and -// then requeue - -STDMETHODIMP -CDeferredCommand::Postpone(REFTIME newtime) { - - // check that this time is not past - // convert REFTIME to REFERENCE_TIME - COARefTime convertor(newtime); - - // check that the time has not passed - if(m_pQueue->CheckTime(convertor, IsStreamTime())) { - return VFW_E_TIME_ALREADY_PASSED; - } - - // extract from list - HRESULT hr = m_pQueue->Remove(this); - if(FAILED(hr)) { - return hr; - } - - // change time - m_time = convertor; - - // requeue - hr = m_pQueue->Insert(this); - - return hr; -} - - -HRESULT -CDeferredCommand::Invoke() { - // check that we are still outstanding - if(m_pQueue == NULL) { - return VFW_E_ALREADY_CANCELLED; - } - - // get the type info - ITypeInfo* pti; - HRESULT hr = m_Dispatch.GetTypeInfo(GetIID(), 0, 0, &pti); - if(FAILED(hr)) { - return hr; - } - - // qi for the expected interface and then invoke it. Note that we have to - // treat the returned interface as IUnknown since we don't know its type. - IUnknown* pInterface; - - hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface); - if(FAILED(hr)) { - pti->Release(); - return hr; - } - - EXCEPINFO expinfo; - UINT uArgErr; - m_hrResult = pti->Invoke(pInterface, - GetMethod(), - GetFlags(), - GetParams(), - GetResult(), - &expinfo, - &uArgErr); - - // release the interface we QI'd for - pInterface->Release(); - pti->Release(); - - - // remove from list whether or not successful - // or we loop indefinitely - hr = m_pQueue->Remove(this); - m_pQueue = NULL; - return hr; -} - - - -// --- CCmdQueue methods ---------- - - -CCmdQueue::CCmdQueue() : - m_listPresentation(NAME("Presentation time command list")), - m_listStream(NAME("Stream time command list")), - m_evDue(TRUE), // manual reset - m_dwAdvise(0), - m_pClock(NULL), - m_bRunning(FALSE) { -} - - -CCmdQueue::~CCmdQueue() { - // empty all our lists - - // we hold a refcount on each, so traverse and Release each - // entry then RemoveAll to empty the list - POSITION pos = m_listPresentation.GetHeadPosition(); - - while(pos) { - CDeferredCommand* pCmd = m_listPresentation.GetNext(pos); - pCmd->Release(); - } - m_listPresentation.RemoveAll(); - - pos = m_listStream.GetHeadPosition(); - - while(pos) { - CDeferredCommand* pCmd = m_listStream.GetNext(pos); - pCmd->Release(); - } - m_listStream.RemoveAll(); - - if(m_pClock) { - if(m_dwAdvise) { - m_pClock->Unadvise(m_dwAdvise); - m_dwAdvise = 0; - } - m_pClock->Release(); - } -} - - -// returns a new CDeferredCommand object that will be initialised with -// the parameters and will be added to the queue during construction. -// returns S_OK if successfully created otherwise an error and -// no object has been queued. - -HRESULT -CCmdQueue::New( - CDeferredCommand **ppCmd, - LPUNKNOWN pUnk, // this object will execute command - REFTIME time, - GUID* iid, - long dispidMethod, - short wFlags, - long cArgs, - VARIANT* pDispParams, - VARIANT* pvarResult, - short* puArgErr, - BOOL bStream -) { - CAutoLock lock(&m_Lock); - - HRESULT hr = S_OK; - *ppCmd = NULL; - - CDeferredCommand* pCmd; - pCmd = new CDeferredCommand(this, - NULL, // not aggregated - &hr, - pUnk, // this guy will execute - time, - iid, - dispidMethod, - wFlags, - cArgs, - pDispParams, - pvarResult, - puArgErr, - bStream); - - if(pCmd == NULL) { - hr = E_OUTOFMEMORY; - } - else { - *ppCmd = pCmd; - } - return hr; -} - - -HRESULT -CCmdQueue::Insert(CDeferredCommand* pCmd) { - CAutoLock lock(&m_Lock); - - // addref the item - pCmd->AddRef(); - - CGenericList * pList; - if(pCmd->IsStreamTime()) { - pList = &m_listStream; - } - else { - pList = &m_listPresentation; - } - POSITION pos = pList->GetHeadPosition(); - - // seek past all items that are before us - while(pos && - (pList->Get(pos)->GetTime() <= pCmd->GetTime())) { - - pList->GetNext(pos); - } - - // now at end of list or in front of items that come later - if(!pos) { - pList->AddTail(pCmd); - } - else { - pList->AddBefore(pos, pCmd); - } - - SetTimeAdvise(); - return S_OK; -} - - -HRESULT -CCmdQueue::Remove(CDeferredCommand* pCmd) { - CAutoLock lock(&m_Lock); - HRESULT hr = S_OK; - - CGenericList * pList; - if(pCmd->IsStreamTime()) { - pList = &m_listStream; - } - else { - pList = &m_listPresentation; - } - POSITION pos = pList->GetHeadPosition(); - - // traverse the list - while(pos && (pList->Get(pos) != pCmd)) { - pList->GetNext(pos); - } - - // did we drop off the end? - if(!pos) { - hr = VFW_E_NOT_FOUND; - } - else { - - // found it - now take off list - pList->Remove(pos); - - // Insert did an AddRef, so release it - pCmd->Release(); - - // check that timer request is still for earliest time - SetTimeAdvise(); - } - return hr; -} - - -// set the clock used for timing - -HRESULT -CCmdQueue::SetSyncSource(IReferenceClock* pClock) { - CAutoLock lock(&m_Lock); - - // addref the new clock first in case they are the same - if(pClock) { - pClock->AddRef(); - } - - // kill any advise on the old clock - if(m_pClock) { - if(m_dwAdvise) { - m_pClock->Unadvise(m_dwAdvise); - m_dwAdvise = 0; - } - m_pClock->Release(); - } - m_pClock = pClock; - - // set up a new advise - SetTimeAdvise(); - return S_OK; -} - - -// set up a timer event with the reference clock - -void -CCmdQueue::SetTimeAdvise(void) { - // make sure we have a clock to use - if(!m_pClock) { - return; - } - - // reset the event whenever we are requesting a new signal - m_evDue.Reset(); - - // time 0 is earliest - CRefTime current; - - // find the earliest presentation time - if(m_listPresentation.GetCount() > 0) { - - POSITION pos = m_listPresentation.GetHeadPosition(); - current = m_listPresentation.Get(pos)->GetTime(); - } - - // if we're running, check the stream times too - if(m_bRunning) { - - CRefTime t; - - if(m_listStream.GetCount() > 0) { - - POSITION pos = m_listStream.GetHeadPosition(); - t = m_listStream.Get(pos)->GetTime(); - - // add on stream time offset to get presentation time - t += m_StreamTimeOffset; - - // is this earlier? - if((current == TimeZero) || (t < current)) { - current = t; - } - } - } - - // need to change? - if((current > TimeZero) && (current != m_tCurrentAdvise)) { - if(m_dwAdvise) { - m_pClock->Unadvise(m_dwAdvise); - // reset the event whenever we are requesting a new signal - m_evDue.Reset(); - } - - // ask for time advice - the first two params are either - // stream time offset and stream time or - // presentation time and 0. we always use the latter - HRESULT hr = m_pClock->AdviseTime((REFERENCE_TIME)current, - TimeZero, - (HEVENT) HANDLE(m_evDue), - &m_dwAdvise); - - ASSERT(SUCCEEDED(hr)); - m_tCurrentAdvise = current; - } -} - - -// switch to run mode. Streamtime to Presentation time mapping known. - -HRESULT -CCmdQueue::Run(REFERENCE_TIME tStreamTimeOffset) { - CAutoLock lock(&m_Lock); - - m_StreamTimeOffset = tStreamTimeOffset; - m_bRunning = TRUE; - - // ensure advise is accurate - SetTimeAdvise(); - return S_OK; -} - - -// switch to Stopped or Paused mode. Time mapping not known. - -HRESULT -CCmdQueue::EndRun() { - CAutoLock lock(&m_Lock); - - m_bRunning = FALSE; - - // check timer setting - stream times - SetTimeAdvise(); - return S_OK; -} - - -// return a pointer to the next due command. Blocks for msTimeout -// milliseconds until there is a due command. -// Stream-time commands will only become due between Run and Endrun calls. -// The command remains queued until invoked or cancelled. -// Returns E_ABORT if timeout occurs, otherwise S_OK (or other error). -// -// returns an AddRef'd object - -HRESULT -CCmdQueue::GetDueCommand(CDeferredCommand ** ppCmd, long msTimeout) { - // loop until we timeout or find a due command - for(;;) { { - CAutoLock lock(&m_Lock); - - - // find the earliest command - CDeferredCommand * pCmd = NULL; - - // check the presentation time and the - // stream time list to find the earliest - - if(m_listPresentation.GetCount() > 0) { - POSITION pos = m_listPresentation.GetHeadPosition(); - pCmd = m_listPresentation.Get(pos); - } - - if(m_bRunning && (m_listStream.GetCount() > 0)) { - POSITION pos = m_listStream.GetHeadPosition(); - CDeferredCommand* pStrm = m_listStream.Get(pos); - - CRefTime t = pStrm->GetTime() + m_StreamTimeOffset; - if(!pCmd || (t < pCmd->GetTime())) { - pCmd = pStrm; - } - } - - // if we have found one, is it due? - if(pCmd) { - if(CheckTime(pCmd->GetTime(), pCmd->IsStreamTime())) { - - // yes it's due - addref it - pCmd->AddRef(); - *ppCmd = pCmd; - return S_OK; - } - } - } - - // block until the advise is signalled - if(WaitForSingleObject(m_evDue, msTimeout) != WAIT_OBJECT_0) { - return E_ABORT; - } - } -} - - -// return a pointer to a command that will be due for a given time. -// Pass in a stream time here. The stream time offset will be passed -// in via the Run method. -// Commands remain queued until invoked or cancelled. -// This method will not block. It will report E_ABORT if there are no -// commands due yet. -// -// returns an AddRef'd object - -HRESULT -CCmdQueue::GetCommandDueFor(REFERENCE_TIME rtStream, CDeferredCommand**ppCmd) { - CAutoLock lock(&m_Lock); - - CRefTime tStream(rtStream); - - // find the earliest stream and presentation time commands - CDeferredCommand* pStream = NULL; - if(m_listStream.GetCount() > 0) { - POSITION pos = m_listStream.GetHeadPosition(); - pStream = m_listStream.Get(pos); - } - CDeferredCommand* pPresent = NULL; - if(m_listPresentation.GetCount() > 0) { - POSITION pos = m_listPresentation.GetHeadPosition(); - pPresent = m_listPresentation.Get(pos); - } - - // is there a presentation time that has passed already - if(pPresent && CheckTime(pPresent->GetTime(), FALSE)) { - pPresent->AddRef(); - *ppCmd = pPresent; - return S_OK; - } - - // is there a stream time command due before this stream time - if(pStream && (pStream->GetTime() <= tStream)) { - pPresent->AddRef(); - *ppCmd = pStream; - return S_OK; - } - - // if we are running, we can map presentation times to - // stream time. In this case, is there a presentation time command - // that will be due before this stream time is presented? - if(m_bRunning && pPresent) { - - // this stream time will appear at... - tStream += m_StreamTimeOffset; - - // due before that? - if(pPresent->GetTime() <= tStream) { - *ppCmd = pPresent; - return S_OK; - } - } - - // no commands due yet - return VFW_E_NOT_FOUND; -} - - +//------------------------------------------------------------------------------ +// File: CtlUtil.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// Base classes implementing IDispatch parsing for the basic control dual +// interfaces. Derive from these and implement just the custom method and +// property methods. We also implement CPosPassThru that can be used by +// renderers and transforms to pass by IMediaPosition and IMediaSeeking + + +#include +#include +#include "seekpt.h" + +// 'bool' non standard reserved word +#pragma warning(disable:4237) + + +// --- CBaseDispatch implementation ---------- +CBaseDispatch::~CBaseDispatch() { + if(m_pti) { + m_pti->Release(); + } +} + + +// return 1 if we support GetTypeInfo + +STDMETHODIMP +CBaseDispatch::GetTypeInfoCount(UINT * pctinfo) { + CheckPointer(pctinfo,E_POINTER); + ValidateReadWritePtr(pctinfo,sizeof(UINT *)); + *pctinfo = 1; + return S_OK; +} + + +typedef HRESULT(STDAPICALLTYPE *LPLOADTYPELIB)( + const OLECHAR FAR *szFile, + ITypeLib FAR* FAR* pptlib); + +typedef HRESULT(STDAPICALLTYPE *LPLOADREGTYPELIB)(REFGUID rguid, + WORD wVerMajor, + WORD wVerMinor, + LCID lcid, + ITypeLib FAR* FAR* pptlib); + +// attempt to find our type library + +STDMETHODIMP +CBaseDispatch::GetTypeInfo( + REFIID riid, + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + CheckPointer(pptinfo,E_POINTER); + ValidateReadWritePtr(pptinfo,sizeof(ITypeInfo *)); + HRESULT hr; + + *pptinfo = NULL; + + // we only support one type element + if(0 != itinfo) { + return TYPE_E_ELEMENTNOTFOUND; + } + + // always look for neutral + if(NULL == m_pti) { + + LPLOADTYPELIB lpfnLoadTypeLib; + LPLOADREGTYPELIB lpfnLoadRegTypeLib; + ITypeLib *ptlib; + HINSTANCE hInst; + + static const char szTypeLib[] = "LoadTypeLib"; + static const char szRegTypeLib[] = "LoadRegTypeLib"; + static const WCHAR szControl[] = L"control.tlb"; + + // + // Try to get the Ole32Aut.dll module handle. + // + + hInst = LoadOLEAut32(); + if(hInst == NULL) { + DWORD dwError = GetLastError(); + return AmHresultFromWin32(dwError); + } + lpfnLoadRegTypeLib = (LPLOADREGTYPELIB)GetProcAddress(hInst, + szRegTypeLib); + if(lpfnLoadRegTypeLib == NULL) { + DWORD dwError = GetLastError(); + return AmHresultFromWin32(dwError); + } + + hr = (*lpfnLoadRegTypeLib)(LIBID_QuartzTypeLib, 1, 0, // version 1.0 + lcid, &ptlib); + + if(FAILED(hr)) { + + // attempt to load directly - this will fill the + // registry in if it finds it + + lpfnLoadTypeLib = (LPLOADTYPELIB)GetProcAddress(hInst, szTypeLib); + if(lpfnLoadTypeLib == NULL) { + DWORD dwError = GetLastError(); + return AmHresultFromWin32(dwError); + } + + hr = (*lpfnLoadTypeLib)(szControl, &ptlib); + if(FAILED(hr)) { + return hr; + } + } + + hr = ptlib->GetTypeInfoOfGuid(riid, &m_pti); + + ptlib->Release(); + + if(FAILED(hr)) { + return hr; + } + } + + *pptinfo = m_pti; + m_pti->AddRef(); + return S_OK; +} + + +STDMETHODIMP +CBaseDispatch::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + // although the IDispatch riid is dead, we use this to pass from + // the interface implementation class to us the iid we are talking about. + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(riid, 0, lcid, &pti); + + if(SUCCEEDED(hr)) { + hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid); + + pti->Release(); + } + return hr; +} + + +// --- CMediaControl implementation --------- + +CMediaControl::CMediaControl(const TCHAR * name,LPUNKNOWN pUnk) : + CUnknown(name, pUnk) { +} + +// expose our interfaces IMediaControl and IUnknown + +STDMETHODIMP +CMediaControl::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IMediaControl) { + return GetInterface((IMediaControl *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +// return 1 if we support GetTypeInfo + +STDMETHODIMP +CMediaControl::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +// attempt to find our type library + +STDMETHODIMP +CMediaControl::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IMediaControl, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CMediaControl::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IMediaControl, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CMediaControl::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IMediaControl *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- CMediaEvent implementation ---------- + + +CMediaEvent::CMediaEvent(const TCHAR * name,LPUNKNOWN pUnk) : + CUnknown(name, pUnk) { +} + + +// expose our interfaces IMediaEvent and IUnknown + +STDMETHODIMP +CMediaEvent::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IMediaEvent || riid == IID_IMediaEventEx) { + return GetInterface((IMediaEventEx *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +// return 1 if we support GetTypeInfo + +STDMETHODIMP +CMediaEvent::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +// attempt to find our type library + +STDMETHODIMP +CMediaEvent::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IMediaEvent, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CMediaEvent::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IMediaEvent, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CMediaEvent::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IMediaEvent *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- CMediaPosition implementation ---------- + + +CMediaPosition::CMediaPosition(const TCHAR * name,LPUNKNOWN pUnk) : + CUnknown(name, pUnk) { +} + +CMediaPosition::CMediaPosition(const TCHAR * name, + LPUNKNOWN pUnk, + HRESULT * phr) : + CUnknown(name, pUnk) { + UNREFERENCED_PARAMETER(phr); +} + + +// expose our interfaces IMediaPosition and IUnknown + +STDMETHODIMP +CMediaPosition::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IMediaPosition) { + return GetInterface((IMediaPosition *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +// return 1 if we support GetTypeInfo + +STDMETHODIMP +CMediaPosition::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +// attempt to find our type library + +STDMETHODIMP +CMediaPosition::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IMediaPosition, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CMediaPosition::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IMediaPosition, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CMediaPosition::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IMediaPosition *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- IMediaPosition and IMediaSeeking pass through class ---------- + + +CPosPassThru::CPosPassThru(const TCHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr, + IPin *pPin) : + CMediaPosition(pName,pUnk), + m_pPin(pPin) { + if(pPin == NULL) { + *phr = E_POINTER; + return; + } +} + + +// Expose our IMediaSeeking and IMediaPosition interfaces + +STDMETHODIMP +CPosPassThru::NonDelegatingQueryInterface(REFIID riid,void **ppv) { + CheckPointer(ppv,E_POINTER); + *ppv = NULL; + + if(riid == IID_IMediaSeeking) { + return GetInterface(static_cast(this), ppv); + } + return CMediaPosition::NonDelegatingQueryInterface(riid,ppv); +} + + +// Return the IMediaPosition interface from our peer + +HRESULT +CPosPassThru::GetPeer(IMediaPosition ** ppMP) { + *ppMP = NULL; + + IPin *pConnected; + HRESULT hr = m_pPin->ConnectedTo(&pConnected); + if(FAILED(hr)) { + return E_NOTIMPL; + } + + IMediaPosition * pMP; + hr = pConnected->QueryInterface(IID_IMediaPosition, (void **) &pMP); + pConnected->Release(); + if(FAILED(hr)) { + return E_NOTIMPL; + } + + *ppMP = pMP; + return S_OK; +} + + +// Return the IMediaSeeking interface from our peer + +HRESULT +CPosPassThru::GetPeerSeeking(IMediaSeeking ** ppMS) { + *ppMS = NULL; + + IPin *pConnected; + HRESULT hr = m_pPin->ConnectedTo(&pConnected); + if(FAILED(hr)) { + return E_NOTIMPL; + } + + IMediaSeeking * pMS; + hr = pConnected->QueryInterface(IID_IMediaSeeking, (void **) &pMS); + pConnected->Release(); + if(FAILED(hr)) { + return E_NOTIMPL; + } + + *ppMS = pMS; + return S_OK; +} + + +// --- IMediaSeeking methods ---------- + + +STDMETHODIMP +CPosPassThru::GetCapabilities(DWORD * pCaps) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->GetCapabilities(pCaps); + pMS->Release(); + return hr; +} + +STDMETHODIMP +CPosPassThru::CheckCapabilities(DWORD * pCaps) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->CheckCapabilities(pCaps); + pMS->Release(); + return hr; +} + +STDMETHODIMP +CPosPassThru::IsFormatSupported(const GUID * pFormat) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->IsFormatSupported(pFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::QueryPreferredFormat(GUID *pFormat) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->QueryPreferredFormat(pFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::SetTimeFormat(const GUID * pFormat) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->SetTimeFormat(pFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::GetTimeFormat(GUID *pFormat) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->GetTimeFormat(pFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::IsUsingTimeFormat(const GUID * pFormat) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->IsUsingTimeFormat(pFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat, + LONGLONG Source, const GUID * pSourceFormat ) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags + , LONGLONG * pStop, DWORD StopFlags ) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->SetPositions(pCurrent, CurrentFlags, pStop, StopFlags); + pMS->Release(); + return hr; +} + +STDMETHODIMP +CPosPassThru::GetPositions(LONGLONG *pCurrent, LONGLONG * pStop) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->GetPositions(pCurrent,pStop); + pMS->Release(); + return hr; +} + +HRESULT +CPosPassThru::GetSeekingLongLong +( HRESULT(__stdcall IMediaSeeking::*pMethod)( LONGLONG * ) +, LONGLONG * pll +) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(SUCCEEDED(hr)) { + hr = (pMS->*pMethod)(pll); + pMS->Release(); + } + return hr; +} + +// If we don't have a current position then ask upstream + +STDMETHODIMP +CPosPassThru::GetCurrentPosition(LONGLONG *pCurrent) { + // Can we report the current position + HRESULT hr = GetMediaTime(pCurrent,NULL); + if(SUCCEEDED(hr)) + hr = NOERROR; + else + hr = GetSeekingLongLong(&IMediaSeeking::GetCurrentPosition, pCurrent); + return hr; +} + + +STDMETHODIMP +CPosPassThru::GetStopPosition(LONGLONG *pStop) { + return GetSeekingLongLong(&IMediaSeeking::GetStopPosition, pStop);; +} + +STDMETHODIMP +CPosPassThru::GetDuration(LONGLONG *pDuration) { + return GetSeekingLongLong(&IMediaSeeking::GetDuration, pDuration);; +} + + +STDMETHODIMP +CPosPassThru::GetPreroll(LONGLONG *pllPreroll) { + return GetSeekingLongLong(&IMediaSeeking::GetPreroll, pllPreroll);; +} + + +STDMETHODIMP +CPosPassThru::GetAvailable( LONGLONG *pEarliest, LONGLONG *pLatest ) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + + hr = pMS->GetAvailable(pEarliest, pLatest); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::GetRate(double * pdRate) { + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + hr = pMS->GetRate(pdRate); + pMS->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::SetRate(double dRate) { + if(0.0 == dRate) { + return E_INVALIDARG; + } + + IMediaSeeking* pMS; + HRESULT hr = GetPeerSeeking(&pMS); + if(FAILED(hr)) { + return hr; + } + hr = pMS->SetRate(dRate); + pMS->Release(); + return hr; +} + + + + +// --- IMediaPosition methods ---------- + + +STDMETHODIMP +CPosPassThru::get_Duration(REFTIME * plength) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + + hr = pMP->get_Duration(plength); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::get_CurrentPosition(REFTIME * pllTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->get_CurrentPosition(pllTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::put_CurrentPosition(REFTIME llTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->put_CurrentPosition(llTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::get_StopTime(REFTIME * pllTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->get_StopTime(pllTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::put_StopTime(REFTIME llTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->put_StopTime(llTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::get_PrerollTime(REFTIME * pllTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->get_PrerollTime(pllTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::put_PrerollTime(REFTIME llTime) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->put_PrerollTime(llTime); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::get_Rate(double * pdRate) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->get_Rate(pdRate); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::put_Rate(double dRate) { + if(0.0 == dRate) { + return E_INVALIDARG; + } + + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->put_Rate(dRate); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::CanSeekForward(LONG *pCanSeekForward) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->CanSeekForward(pCanSeekForward); + pMP->Release(); + return hr; +} + + +STDMETHODIMP +CPosPassThru::CanSeekBackward(LONG *pCanSeekBackward) { + IMediaPosition* pMP; + HRESULT hr = GetPeer(&pMP); + if(FAILED(hr)) { + return hr; + } + hr = pMP->CanSeekBackward(pCanSeekBackward); + pMP->Release(); + return hr; +} + + +// --- Implements the CRendererPosPassThru class ---------- + + +// Media times (eg current frame, field, sample etc) are passed through the +// filtergraph in media samples. When a renderer gets a sample with media +// times in it, it will call one of the RegisterMediaTime methods we expose +// (one takes an IMediaSample, the other takes the media times direct). We +// store the media times internally and return them in GetCurrentPosition. + +CRendererPosPassThru::CRendererPosPassThru(const TCHAR *pName, + LPUNKNOWN pUnk, + HRESULT *phr, + IPin *pPin) : + CPosPassThru(pName,pUnk,phr,pPin), + m_StartMedia(0), + m_EndMedia(0), + m_bReset(TRUE) { +} + + +// Sets the media times the object should report + +HRESULT +CRendererPosPassThru::RegisterMediaTime(IMediaSample *pMediaSample) { + ASSERT(pMediaSample); + LONGLONG StartMedia; + LONGLONG EndMedia; + + CAutoLock cAutoLock(&m_PositionLock); + + // Get the media times from the sample + + HRESULT hr = pMediaSample->GetTime(&StartMedia,&EndMedia); + if(FAILED(hr)) { + ASSERT(hr == VFW_E_SAMPLE_TIME_NOT_SET); + return hr; + } + + m_StartMedia = StartMedia; + m_EndMedia = EndMedia; + m_bReset = FALSE; + return NOERROR; +} + + +// Sets the media times the object should report + +HRESULT +CRendererPosPassThru::RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime) { + CAutoLock cAutoLock(&m_PositionLock); + m_StartMedia = StartTime; + m_EndMedia = EndTime; + m_bReset = FALSE; + return NOERROR; +} + + +// Return the current media times registered in the object + +HRESULT +CRendererPosPassThru::GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) { + ASSERT(pStartTime); + + CAutoLock cAutoLock(&m_PositionLock); + if(m_bReset == TRUE) { + return E_FAIL; + } + + // We don't have to return the end time + + HRESULT hr = ConvertTimeFormat(pStartTime, 0, m_StartMedia, &TIME_FORMAT_MEDIA_TIME); + if(pEndTime && SUCCEEDED(hr)) { + hr = ConvertTimeFormat(pEndTime, 0, m_EndMedia, &TIME_FORMAT_MEDIA_TIME); + } + return hr; +} + + +// Resets the media times we hold + +HRESULT +CRendererPosPassThru::ResetMediaTime() { + CAutoLock cAutoLock(&m_PositionLock); + m_StartMedia = 0; + m_EndMedia = 0; + m_bReset = TRUE; + return NOERROR; +} + +// Intended to be called by the owing filter during EOS processing so +// that the media times can be adjusted to the stop time. This ensures +// that the GetCurrentPosition will actully get to the stop position. +HRESULT +CRendererPosPassThru::EOS() { + HRESULT hr; + + if(m_bReset == TRUE) hr = E_FAIL; + else { + LONGLONG llStop; + if (SUCCEEDED(hr=GetStopPosition(&llStop))) { + CAutoLock cAutoLock(&m_PositionLock); + m_StartMedia = m_EndMedia = llStop; + } + } + return hr; +} + +// -- CSourceSeeking implementation ------------ + +CSourceSeeking::CSourceSeeking( + const TCHAR * pName, + LPUNKNOWN pUnk, + HRESULT* phr, + CCritSec * pLock) : + CUnknown(pName, pUnk), + m_pLock(pLock), + m_rtStart((long)0) { + m_rtStop = _I64_MAX / 2; + m_rtDuration = m_rtStop; + m_dRateSeeking = 1.0; + + m_dwSeekingCaps = AM_SEEKING_CanSeekForwards + | AM_SEEKING_CanSeekBackwards + | AM_SEEKING_CanSeekAbsolute + | AM_SEEKING_CanGetStopPos + | AM_SEEKING_CanGetDuration; +} + +HRESULT CSourceSeeking::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + if(riid == IID_IMediaSeeking) { + CheckPointer(ppv, E_POINTER); + return GetInterface(static_cast(this), ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +HRESULT CSourceSeeking::IsFormatSupported(const GUID * pFormat) { + CheckPointer(pFormat, E_POINTER); + // only seeking in time (REFERENCE_TIME units) is supported + return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; +} + +HRESULT CSourceSeeking::QueryPreferredFormat(GUID *pFormat) { + CheckPointer(pFormat, E_POINTER); + *pFormat = TIME_FORMAT_MEDIA_TIME; + return S_OK; +} + +HRESULT CSourceSeeking::SetTimeFormat(const GUID * pFormat) { + CheckPointer(pFormat, E_POINTER); + + // nothing to set; just check that it's TIME_FORMAT_TIME + return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : E_INVALIDARG; +} + +HRESULT CSourceSeeking::IsUsingTimeFormat(const GUID * pFormat) { + CheckPointer(pFormat, E_POINTER); + return *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE; +} + +HRESULT CSourceSeeking::GetTimeFormat(GUID *pFormat) { + CheckPointer(pFormat, E_POINTER); + *pFormat = TIME_FORMAT_MEDIA_TIME; + return S_OK; +} + +HRESULT CSourceSeeking::GetDuration(LONGLONG *pDuration) { + CheckPointer(pDuration, E_POINTER); + CAutoLock lock(m_pLock); + *pDuration = m_rtDuration; + return S_OK; +} + +HRESULT CSourceSeeking::GetStopPosition(LONGLONG *pStop) { + CheckPointer(pStop, E_POINTER); + CAutoLock lock(m_pLock); + *pStop = m_rtStop; + return S_OK; +} + +HRESULT CSourceSeeking::GetCurrentPosition(LONGLONG *pCurrent) { + // GetCurrentPosition is typically supported only in renderers and + // not in source filters. + return E_NOTIMPL; +} + +HRESULT CSourceSeeking::GetCapabilities( DWORD * pCapabilities ) { + CheckPointer(pCapabilities, E_POINTER); + *pCapabilities = m_dwSeekingCaps; + return S_OK; +} + +HRESULT CSourceSeeking::CheckCapabilities( DWORD * pCapabilities ) { + CheckPointer(pCapabilities, E_POINTER); + + // make sure all requested capabilities are in our mask + return (~m_dwSeekingCaps & *pCapabilities) ? S_FALSE : S_OK; +} + +HRESULT CSourceSeeking::ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat, + LONGLONG Source, const GUID * pSourceFormat ) { + CheckPointer(pTarget, E_POINTER); + // format guids can be null to indicate current format + + // since we only support TIME_FORMAT_MEDIA_TIME, we don't really + // offer any conversions. + if(pTargetFormat == 0 || *pTargetFormat == TIME_FORMAT_MEDIA_TIME) { + if(pSourceFormat == 0 || *pSourceFormat == TIME_FORMAT_MEDIA_TIME) { + *pTarget = Source; + return S_OK; + } + } + + return E_INVALIDARG; +} + + +HRESULT CSourceSeeking::SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags + , LONGLONG * pStop, DWORD StopFlags ) { + DWORD StopPosBits = StopFlags & AM_SEEKING_PositioningBitsMask; + DWORD StartPosBits = CurrentFlags & AM_SEEKING_PositioningBitsMask; + + if(StopFlags) { + CheckPointer(pStop, E_POINTER); + + // accept only relative, incremental, or absolute positioning + if(StopPosBits != StopFlags) { + return E_INVALIDARG; + } + } + + if(CurrentFlags) { + CheckPointer(pCurrent, E_POINTER); + if(StartPosBits != AM_SEEKING_AbsolutePositioning && + StartPosBits != AM_SEEKING_RelativePositioning) { + return E_INVALIDARG; + } + } + + + // scope for autolock + { + CAutoLock lock(m_pLock); + + // set start position + if(StartPosBits == AM_SEEKING_AbsolutePositioning) { + m_rtStart = *pCurrent; + } + else if(StartPosBits == AM_SEEKING_RelativePositioning) { + m_rtStart += *pCurrent; + } + + // set stop position + if(StopPosBits == AM_SEEKING_AbsolutePositioning) { + m_rtStop = *pStop; + } + else if(StopPosBits == AM_SEEKING_IncrementalPositioning) { + m_rtStop = m_rtStart + *pStop; + } + else if(StopPosBits == AM_SEEKING_RelativePositioning) { + m_rtStop = m_rtStop + *pStop; + } + } + + + HRESULT hr = S_OK; + if(SUCCEEDED(hr) && StopPosBits) { + hr = ChangeStop(); + } + if(StartPosBits) { + hr = ChangeStart(); + } + + return hr; +} + + +HRESULT CSourceSeeking::GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ) { + if(pCurrent) { + *pCurrent = m_rtStart; + } + if(pStop) { + *pStop = m_rtStop; + } + + return S_OK;; +} + + +HRESULT CSourceSeeking::GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest ) { + if(pEarliest) { + *pEarliest = 0; + } + if(pLatest) { + CAutoLock lock(m_pLock); + *pLatest = m_rtDuration; + } + return S_OK; +} + +HRESULT CSourceSeeking::SetRate( double dRate) { { + CAutoLock lock(m_pLock); + m_dRateSeeking = dRate; + } + return ChangeRate(); +} + +HRESULT CSourceSeeking::GetRate( double * pdRate) { + CheckPointer(pdRate, E_POINTER); + CAutoLock lock(m_pLock); + *pdRate = m_dRateSeeking; + return S_OK; +} + +HRESULT CSourceSeeking::GetPreroll(LONGLONG *pPreroll) { + CheckPointer(pPreroll, E_POINTER); + *pPreroll = 0; + return S_OK; +} + + + + + +// --- CSourcePosition implementation ---------- + + +CSourcePosition::CSourcePosition(const TCHAR * pName, + LPUNKNOWN pUnk, + HRESULT* phr, + CCritSec * pLock) : + CMediaPosition(pName, pUnk), + m_pLock(pLock), + m_Start(CRefTime((LONGLONG)0)) { + m_Stop = _I64_MAX; + m_Rate = 1.0; +} + + +STDMETHODIMP +CSourcePosition::get_Duration(REFTIME * plength) { + CheckPointer(plength,E_POINTER); + ValidateReadWritePtr(plength,sizeof(REFTIME)); + CAutoLock lock(m_pLock); + + *plength = m_Duration; + return S_OK; +} + + +STDMETHODIMP +CSourcePosition::put_CurrentPosition(REFTIME llTime) { + m_pLock->Lock(); + m_Start = llTime; + m_pLock->Unlock(); + + return ChangeStart(); +} + + +STDMETHODIMP +CSourcePosition::get_StopTime(REFTIME * pllTime) { + CheckPointer(pllTime,E_POINTER); + ValidateReadWritePtr(pllTime,sizeof(REFTIME)); + CAutoLock lock(m_pLock); + + *pllTime = m_Stop; + return S_OK; +} + + +STDMETHODIMP +CSourcePosition::put_StopTime(REFTIME llTime) { + m_pLock->Lock(); + m_Stop = llTime; + m_pLock->Unlock(); + + return ChangeStop(); +} + + +STDMETHODIMP +CSourcePosition::get_PrerollTime(REFTIME * pllTime) { + CheckPointer(pllTime,E_POINTER); + ValidateReadWritePtr(pllTime,sizeof(REFTIME)); + return E_NOTIMPL; +} + + +STDMETHODIMP +CSourcePosition::put_PrerollTime(REFTIME llTime) { + return E_NOTIMPL; +} + + +STDMETHODIMP +CSourcePosition::get_Rate(double * pdRate) { + CheckPointer(pdRate,E_POINTER); + ValidateReadWritePtr(pdRate,sizeof(double)); + CAutoLock lock(m_pLock); + + *pdRate = m_Rate; + return S_OK; +} + + +STDMETHODIMP +CSourcePosition::put_Rate(double dRate) { + m_pLock->Lock(); + m_Rate = dRate; + m_pLock->Unlock(); + + return ChangeRate(); +} + + +// By default we can seek forwards + +STDMETHODIMP +CSourcePosition::CanSeekForward(LONG *pCanSeekForward) { + CheckPointer(pCanSeekForward,E_POINTER); + *pCanSeekForward = OATRUE; + return S_OK; +} + + +// By default we can seek backwards + +STDMETHODIMP +CSourcePosition::CanSeekBackward(LONG *pCanSeekBackward) { + CheckPointer(pCanSeekBackward,E_POINTER); + *pCanSeekBackward = OATRUE; + return S_OK; +} + + +// --- Implementation of CBasicAudio class ---------- + + +CBasicAudio::CBasicAudio(const TCHAR * pName,LPUNKNOWN punk) : + CUnknown(pName, punk) { +} + +// overriden to publicise our interfaces + +STDMETHODIMP +CBasicAudio::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IBasicAudio) { + return GetInterface((IBasicAudio *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +STDMETHODIMP +CBasicAudio::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +STDMETHODIMP +CBasicAudio::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IBasicAudio, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CBasicAudio::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IBasicAudio, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CBasicAudio::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IBasicAudio *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- IVideoWindow implementation ---------- + +CBaseVideoWindow::CBaseVideoWindow(const TCHAR * pName,LPUNKNOWN punk) : + CUnknown(pName, punk) { +} + + +// overriden to publicise our interfaces + +STDMETHODIMP +CBaseVideoWindow::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IVideoWindow) { + return GetInterface((IVideoWindow *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +STDMETHODIMP +CBaseVideoWindow::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +STDMETHODIMP +CBaseVideoWindow::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IVideoWindow, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CBaseVideoWindow::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IVideoWindow, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CBaseVideoWindow::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IVideoWindow *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- IBasicVideo implementation ---------- + + +CBaseBasicVideo::CBaseBasicVideo(const TCHAR * pName,LPUNKNOWN punk) : + CUnknown(pName, punk) { +} + + +// overriden to publicise our interfaces + +STDMETHODIMP +CBaseBasicVideo::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IBasicVideo || riid == IID_IBasicVideo2) { + return GetInterface(static_cast(this), ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +STDMETHODIMP +CBaseBasicVideo::GetTypeInfoCount(UINT * pctinfo) { + return m_basedisp.GetTypeInfoCount(pctinfo); +} + + +STDMETHODIMP +CBaseBasicVideo::GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo) { + return m_basedisp.GetTypeInfo(IID_IBasicVideo, + itinfo, + lcid, + pptinfo); +} + + +STDMETHODIMP +CBaseBasicVideo::GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid) { + return m_basedisp.GetIDsOfNames(IID_IBasicVideo, + rgszNames, + cNames, + lcid, + rgdispid); +} + + +STDMETHODIMP +CBaseBasicVideo::Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr) { + // this parameter is a dead leftover from an earlier interface + if(IID_NULL != riid) { + return DISP_E_UNKNOWNINTERFACE; + } + + ITypeInfo * pti; + HRESULT hr = GetTypeInfo(0, lcid, &pti); + + if(FAILED(hr)) { + return hr; + } + + hr = pti->Invoke((IBasicVideo *)this, + dispidMember, + wFlags, + pdispparams, + pvarResult, + pexcepinfo, + puArgErr); + + pti->Release(); + return hr; +} + + +// --- Implementation of Deferred Commands ---------- + + +CDispParams::CDispParams(UINT nArgs, VARIANT* pArgs, HRESULT *phr) { + cNamedArgs = 0; + rgdispidNamedArgs = NULL; + cArgs = nArgs; + + if(cArgs) { + rgvarg = new VARIANT[cArgs]; + if(NULL == rgvarg) { + cArgs = 0; + if(phr) { + *phr = E_OUTOFMEMORY; + } + return; + } + + for(UINT i = 0; i < cArgs; i++) { + + VARIANT * pDest = &rgvarg[i]; + VARIANT * pSrc = &pArgs[i]; + + pDest->vt = pSrc->vt; + switch(pDest->vt) { + + case VT_I4: + pDest->lVal = pSrc->lVal; + break; + + case VT_UI1: + pDest->bVal = pSrc->bVal; + break; + + case VT_I2: + pDest->iVal = pSrc->iVal; + break; + + case VT_R4: + pDest->fltVal = pSrc->fltVal; + break; + + case VT_R8: + pDest->dblVal = pSrc->dblVal; + break; + + case VT_BOOL: + pDest->boolVal = pSrc->boolVal; + break; + + case VT_ERROR: + pDest->scode = pSrc->scode; + break; + + case VT_CY: + pDest->cyVal = pSrc->cyVal; + break; + + case VT_DATE: + pDest->date = pSrc->date; + break; + + case VT_BSTR: + if(pSrc->bstrVal == NULL) { + pDest->bstrVal = NULL; + } + else { + + // a BSTR is a WORD followed by a UNICODE string. + // the pointer points just after the WORD + + WORD len = * (WORD*) (pSrc->bstrVal - (sizeof(WORD) / sizeof(OLECHAR))); + OLECHAR* pch = new OLECHAR[len + (sizeof(WORD)/sizeof(OLECHAR))]; + if(pch) { + WORD *pui = (WORD*)pch; + *pui = len; + pDest->bstrVal = pch + (sizeof(WORD)/sizeof(OLECHAR)); + CopyMemory(pDest->bstrVal, pSrc->bstrVal, len*sizeof(OLECHAR)); + } + else { + cArgs = i; + if(phr) { + *phr = E_OUTOFMEMORY; + } + } + } + pDest->bstrVal = pSrc->bstrVal; + break; + + case VT_UNKNOWN: + pDest->punkVal = pSrc->punkVal; + pDest->punkVal->AddRef(); + break; + + case VT_DISPATCH: + pDest->pdispVal = pSrc->pdispVal; + pDest->pdispVal->AddRef(); + break; + + default: + // a type we haven't got round to adding yet! + ASSERT(0); + break; + } + } + + } + else { + rgvarg = NULL; + } + +} + + +CDispParams::~CDispParams() { + for(UINT i = 0; i < cArgs; i++) { + switch(rgvarg[i].vt) { + case VT_BSTR: + if(rgvarg[i].bstrVal != NULL) { + OLECHAR * pch = rgvarg[i].bstrVal - (sizeof(WORD)/sizeof(OLECHAR)); + delete pch; + } + break; + + case VT_UNKNOWN: + rgvarg[i].punkVal->Release(); + break; + + case VT_DISPATCH: + rgvarg[i].pdispVal->Release(); + break; + } + } + delete[] rgvarg; +} + + +// lifetime is controlled by refcounts (see defer.h) + +CDeferredCommand::CDeferredCommand( + CCmdQueue * pQ, + LPUNKNOWN pUnk, + HRESULT * phr, + LPUNKNOWN pUnkExecutor, + REFTIME time, + GUID* iid, + long dispidMethod, + short wFlags, + long nArgs, + VARIANT* pDispParams, + VARIANT* pvarResult, + short* puArgErr, + BOOL bStream + ) : + CUnknown(NAME("DeferredCommand"), pUnk), + m_pQueue(pQ), + m_pUnk(pUnkExecutor), + m_iid(iid), + m_dispidMethod(dispidMethod), + m_wFlags(wFlags), + m_DispParams(nArgs, pDispParams, phr), + m_pvarResult(pvarResult), + m_bStream(bStream), + m_hrResult(E_ABORT) { + + // convert REFTIME to REFERENCE_TIME + COARefTime convertor(time); + m_time = convertor; + + // no check of time validity - it's ok to queue a command that's + // already late + + // check iid is supportable on pUnk by QueryInterface for it + IUnknown * pInterface; + HRESULT hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface); + if(FAILED(hr)) { + *phr = hr; + return; + } + pInterface->Release(); + + + // !!! check dispidMethod and param/return types using typelib + ITypeInfo *pti; + hr = m_Dispatch.GetTypeInfo(*iid, 0, 0, &pti); + if(FAILED(hr)) { + *phr = hr; + return; + } + // !!! some sort of ITypeInfo validity check here + pti->Release(); + + + // Fix up the dispid for put and get + if(wFlags == DISPATCH_PROPERTYPUT) { + m_DispParams.cNamedArgs = 1; + m_DispId = DISPID_PROPERTYPUT; + m_DispParams.rgdispidNamedArgs = &m_DispId; + } + + // all checks ok - add to queue + hr = pQ->Insert(this); + if(FAILED(hr)) { + *phr = hr; + } +} + + +// refcounts are held by caller of InvokeAt... and by list. So if +// we get here, we can't be on the list + +#if 0 +CDeferredCommand::~CDeferredCommand() { + // this assert is invalid since if the queue is deleted while we are + // still on the queue, we will have been removed by the queue and this + // m_pQueue will not have been modified. + // ASSERT(m_pQueue == NULL); + + // we don't hold a ref count on pUnk, which is the object that should + // execute the command. + // This is because there would otherwise be a circular refcount problem + // since pUnk probably owns the CmdQueue object that has a refcount + // on us. + // The lifetime of pUnk is guaranteed by it being part of, or lifetime + // controlled by, our parent object. As long as we are on the list, pUnk + // must be valid. Once we are off the list, we do not use pUnk. + +} +#endif + + +// overriden to publicise our interfaces + +STDMETHODIMP +CDeferredCommand::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ValidateReadWritePtr(ppv,sizeof(PVOID)); + if(riid == IID_IDeferredCommand) { + return GetInterface((IDeferredCommand *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} + + +// remove from q. this will reduce the refcount by one (since the q +// holds a count) but can't make us go away since he must have a +// refcount in order to call this method. + +STDMETHODIMP +CDeferredCommand::Cancel() { + if(m_pQueue == NULL) { + return VFW_E_ALREADY_CANCELLED; + } + + HRESULT hr = m_pQueue->Remove(this); + if(FAILED(hr)) { + return hr; + } + + m_pQueue = NULL; + return S_OK; +} + + +STDMETHODIMP +CDeferredCommand::Confidence(LONG* pConfidence) { + return E_NOTIMPL; +} + + +STDMETHODIMP +CDeferredCommand::GetHResult(HRESULT * phrResult) { + CheckPointer(phrResult,E_POINTER); + ValidateReadWritePtr(phrResult,sizeof(HRESULT)); + + if(m_pQueue != NULL) { + return E_ABORT; + } + *phrResult = m_hrResult; + return S_OK; +} + + +// set the time to be a new time (checking that it is valid) and +// then requeue + +STDMETHODIMP +CDeferredCommand::Postpone(REFTIME newtime) { + + // check that this time is not past + // convert REFTIME to REFERENCE_TIME + COARefTime convertor(newtime); + + // check that the time has not passed + if(m_pQueue->CheckTime(convertor, IsStreamTime())) { + return VFW_E_TIME_ALREADY_PASSED; + } + + // extract from list + HRESULT hr = m_pQueue->Remove(this); + if(FAILED(hr)) { + return hr; + } + + // change time + m_time = convertor; + + // requeue + hr = m_pQueue->Insert(this); + + return hr; +} + + +HRESULT +CDeferredCommand::Invoke() { + // check that we are still outstanding + if(m_pQueue == NULL) { + return VFW_E_ALREADY_CANCELLED; + } + + // get the type info + ITypeInfo* pti; + HRESULT hr = m_Dispatch.GetTypeInfo(GetIID(), 0, 0, &pti); + if(FAILED(hr)) { + return hr; + } + + // qi for the expected interface and then invoke it. Note that we have to + // treat the returned interface as IUnknown since we don't know its type. + IUnknown* pInterface; + + hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface); + if(FAILED(hr)) { + pti->Release(); + return hr; + } + + EXCEPINFO expinfo; + UINT uArgErr; + m_hrResult = pti->Invoke(pInterface, + GetMethod(), + GetFlags(), + GetParams(), + GetResult(), + &expinfo, + &uArgErr); + + // release the interface we QI'd for + pInterface->Release(); + pti->Release(); + + + // remove from list whether or not successful + // or we loop indefinitely + hr = m_pQueue->Remove(this); + m_pQueue = NULL; + return hr; +} + + + +// --- CCmdQueue methods ---------- + + +CCmdQueue::CCmdQueue() : + m_listPresentation(NAME("Presentation time command list")), + m_listStream(NAME("Stream time command list")), + m_evDue(TRUE), // manual reset + m_dwAdvise(0), + m_pClock(NULL), + m_bRunning(FALSE) { +} + + +CCmdQueue::~CCmdQueue() { + // empty all our lists + + // we hold a refcount on each, so traverse and Release each + // entry then RemoveAll to empty the list + POSITION pos = m_listPresentation.GetHeadPosition(); + + while(pos) { + CDeferredCommand* pCmd = m_listPresentation.GetNext(pos); + pCmd->Release(); + } + m_listPresentation.RemoveAll(); + + pos = m_listStream.GetHeadPosition(); + + while(pos) { + CDeferredCommand* pCmd = m_listStream.GetNext(pos); + pCmd->Release(); + } + m_listStream.RemoveAll(); + + if(m_pClock) { + if(m_dwAdvise) { + m_pClock->Unadvise(m_dwAdvise); + m_dwAdvise = 0; + } + m_pClock->Release(); + } +} + + +// returns a new CDeferredCommand object that will be initialised with +// the parameters and will be added to the queue during construction. +// returns S_OK if successfully created otherwise an error and +// no object has been queued. + +HRESULT +CCmdQueue::New( + CDeferredCommand **ppCmd, + LPUNKNOWN pUnk, // this object will execute command + REFTIME time, + GUID* iid, + long dispidMethod, + short wFlags, + long cArgs, + VARIANT* pDispParams, + VARIANT* pvarResult, + short* puArgErr, + BOOL bStream +) { + CAutoLock lock(&m_Lock); + + HRESULT hr = S_OK; + *ppCmd = NULL; + + CDeferredCommand* pCmd; + pCmd = new CDeferredCommand(this, + NULL, // not aggregated + &hr, + pUnk, // this guy will execute + time, + iid, + dispidMethod, + wFlags, + cArgs, + pDispParams, + pvarResult, + puArgErr, + bStream); + + if(pCmd == NULL) { + hr = E_OUTOFMEMORY; + } + else { + *ppCmd = pCmd; + } + return hr; +} + + +HRESULT +CCmdQueue::Insert(CDeferredCommand* pCmd) { + CAutoLock lock(&m_Lock); + + // addref the item + pCmd->AddRef(); + + CGenericList * pList; + if(pCmd->IsStreamTime()) { + pList = &m_listStream; + } + else { + pList = &m_listPresentation; + } + POSITION pos = pList->GetHeadPosition(); + + // seek past all items that are before us + while(pos && + (pList->Get(pos)->GetTime() <= pCmd->GetTime())) { + + pList->GetNext(pos); + } + + // now at end of list or in front of items that come later + if(!pos) { + pList->AddTail(pCmd); + } + else { + pList->AddBefore(pos, pCmd); + } + + SetTimeAdvise(); + return S_OK; +} + + +HRESULT +CCmdQueue::Remove(CDeferredCommand* pCmd) { + CAutoLock lock(&m_Lock); + HRESULT hr = S_OK; + + CGenericList * pList; + if(pCmd->IsStreamTime()) { + pList = &m_listStream; + } + else { + pList = &m_listPresentation; + } + POSITION pos = pList->GetHeadPosition(); + + // traverse the list + while(pos && (pList->Get(pos) != pCmd)) { + pList->GetNext(pos); + } + + // did we drop off the end? + if(!pos) { + hr = VFW_E_NOT_FOUND; + } + else { + + // found it - now take off list + pList->Remove(pos); + + // Insert did an AddRef, so release it + pCmd->Release(); + + // check that timer request is still for earliest time + SetTimeAdvise(); + } + return hr; +} + + +// set the clock used for timing + +HRESULT +CCmdQueue::SetSyncSource(IReferenceClock* pClock) { + CAutoLock lock(&m_Lock); + + // addref the new clock first in case they are the same + if(pClock) { + pClock->AddRef(); + } + + // kill any advise on the old clock + if(m_pClock) { + if(m_dwAdvise) { + m_pClock->Unadvise(m_dwAdvise); + m_dwAdvise = 0; + } + m_pClock->Release(); + } + m_pClock = pClock; + + // set up a new advise + SetTimeAdvise(); + return S_OK; +} + + +// set up a timer event with the reference clock + +void +CCmdQueue::SetTimeAdvise(void) { + // make sure we have a clock to use + if(!m_pClock) { + return; + } + + // reset the event whenever we are requesting a new signal + m_evDue.Reset(); + + // time 0 is earliest + CRefTime current; + + // find the earliest presentation time + if(m_listPresentation.GetCount() > 0) { + + POSITION pos = m_listPresentation.GetHeadPosition(); + current = m_listPresentation.Get(pos)->GetTime(); + } + + // if we're running, check the stream times too + if(m_bRunning) { + + CRefTime t; + + if(m_listStream.GetCount() > 0) { + + POSITION pos = m_listStream.GetHeadPosition(); + t = m_listStream.Get(pos)->GetTime(); + + // add on stream time offset to get presentation time + t += m_StreamTimeOffset; + + // is this earlier? + if((current == TimeZero) || (t < current)) { + current = t; + } + } + } + + // need to change? + if((current > TimeZero) && (current != m_tCurrentAdvise)) { + if(m_dwAdvise) { + m_pClock->Unadvise(m_dwAdvise); + // reset the event whenever we are requesting a new signal + m_evDue.Reset(); + } + + // ask for time advice - the first two params are either + // stream time offset and stream time or + // presentation time and 0. we always use the latter + HRESULT hr = m_pClock->AdviseTime((REFERENCE_TIME)current, + TimeZero, + (HEVENT) HANDLE(m_evDue), + &m_dwAdvise); + + ASSERT(SUCCEEDED(hr)); + m_tCurrentAdvise = current; + } +} + + +// switch to run mode. Streamtime to Presentation time mapping known. + +HRESULT +CCmdQueue::Run(REFERENCE_TIME tStreamTimeOffset) { + CAutoLock lock(&m_Lock); + + m_StreamTimeOffset = tStreamTimeOffset; + m_bRunning = TRUE; + + // ensure advise is accurate + SetTimeAdvise(); + return S_OK; +} + + +// switch to Stopped or Paused mode. Time mapping not known. + +HRESULT +CCmdQueue::EndRun() { + CAutoLock lock(&m_Lock); + + m_bRunning = FALSE; + + // check timer setting - stream times + SetTimeAdvise(); + return S_OK; +} + + +// return a pointer to the next due command. Blocks for msTimeout +// milliseconds until there is a due command. +// Stream-time commands will only become due between Run and Endrun calls. +// The command remains queued until invoked or cancelled. +// Returns E_ABORT if timeout occurs, otherwise S_OK (or other error). +// +// returns an AddRef'd object + +HRESULT +CCmdQueue::GetDueCommand(CDeferredCommand ** ppCmd, long msTimeout) { + // loop until we timeout or find a due command + for(;;) { { + CAutoLock lock(&m_Lock); + + + // find the earliest command + CDeferredCommand * pCmd = NULL; + + // check the presentation time and the + // stream time list to find the earliest + + if(m_listPresentation.GetCount() > 0) { + POSITION pos = m_listPresentation.GetHeadPosition(); + pCmd = m_listPresentation.Get(pos); + } + + if(m_bRunning && (m_listStream.GetCount() > 0)) { + POSITION pos = m_listStream.GetHeadPosition(); + CDeferredCommand* pStrm = m_listStream.Get(pos); + + CRefTime t = pStrm->GetTime() + m_StreamTimeOffset; + if(!pCmd || (t < pCmd->GetTime())) { + pCmd = pStrm; + } + } + + // if we have found one, is it due? + if(pCmd) { + if(CheckTime(pCmd->GetTime(), pCmd->IsStreamTime())) { + + // yes it's due - addref it + pCmd->AddRef(); + *ppCmd = pCmd; + return S_OK; + } + } + } + + // block until the advise is signalled + if(WaitForSingleObject(m_evDue, msTimeout) != WAIT_OBJECT_0) { + return E_ABORT; + } + } +} + + +// return a pointer to a command that will be due for a given time. +// Pass in a stream time here. The stream time offset will be passed +// in via the Run method. +// Commands remain queued until invoked or cancelled. +// This method will not block. It will report E_ABORT if there are no +// commands due yet. +// +// returns an AddRef'd object + +HRESULT +CCmdQueue::GetCommandDueFor(REFERENCE_TIME rtStream, CDeferredCommand**ppCmd) { + CAutoLock lock(&m_Lock); + + CRefTime tStream(rtStream); + + // find the earliest stream and presentation time commands + CDeferredCommand* pStream = NULL; + if(m_listStream.GetCount() > 0) { + POSITION pos = m_listStream.GetHeadPosition(); + pStream = m_listStream.Get(pos); + } + CDeferredCommand* pPresent = NULL; + if(m_listPresentation.GetCount() > 0) { + POSITION pos = m_listPresentation.GetHeadPosition(); + pPresent = m_listPresentation.Get(pos); + } + + // is there a presentation time that has passed already + if(pPresent && CheckTime(pPresent->GetTime(), FALSE)) { + pPresent->AddRef(); + *ppCmd = pPresent; + return S_OK; + } + + // is there a stream time command due before this stream time + if(pStream && (pStream->GetTime() <= tStream)) { + pPresent->AddRef(); + *ppCmd = pStream; + return S_OK; + } + + // if we are running, we can map presentation times to + // stream time. In this case, is there a presentation time command + // that will be due before this stream time is presented? + if(m_bRunning && pPresent) { + + // this stream time will appear at... + tStream += m_StreamTimeOffset; + + // due before that? + if(pPresent->GetTime() <= tStream) { + *ppCmd = pPresent; + return S_OK; + } + } + + // no commands due yet + return VFW_E_NOT_FOUND; +} + + diff --git a/src/BaseClasses/ctlutil.h b/src/BaseClasses/ctlutil.h index da4a062506..0a244edc27 100644 --- a/src/BaseClasses/ctlutil.h +++ b/src/BaseClasses/ctlutil.h @@ -1,919 +1,919 @@ -//------------------------------------------------------------------------------ -// File: CtlUtil.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// Base classes implementing IDispatch parsing for the basic control dual -// interfaces. Derive from these and implement just the custom method and -// property methods. We also implement CPosPassThru that can be used by -// renderers and transforms to pass by IMediaPosition and IMediaSeeking - -#ifndef __CTLUTIL__ -#define __CTLUTIL__ - -// OLE Automation has different ideas of TRUE and FALSE - -#define OATRUE (-1) -#define OAFALSE (0) - - -// It's possible that we could replace this class with CreateStdDispatch - -class CBaseDispatch -{ - ITypeInfo * m_pti; - -public: - - CBaseDispatch() : m_pti(NULL) {} - ~CBaseDispatch(); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - REFIID riid, - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); -}; - - -class AM_NOVTABLE CMediaControl : - public IMediaControl, - public CUnknown -{ - CBaseDispatch m_basedisp; - -public: - - CMediaControl(const TCHAR *, LPUNKNOWN); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); -}; - - -class AM_NOVTABLE CMediaEvent : - public IMediaEventEx, - public CUnknown -{ - CBaseDispatch m_basedisp; - -public: - - CMediaEvent(const TCHAR *, LPUNKNOWN); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); -}; - - -class AM_NOVTABLE CMediaPosition : - public IMediaPosition, - public CUnknown -{ - CBaseDispatch m_basedisp; - - -public: - - CMediaPosition(const TCHAR *, LPUNKNOWN); - CMediaPosition(const TCHAR *, LPUNKNOWN, HRESULT *phr); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); - -}; - - -// OA-compatibility means that we must use double as the RefTime value, -// and REFERENCE_TIME (essentially a LONGLONG) within filters. -// this class converts between the two - -class COARefTime : public CRefTime { -public: - - COARefTime() { - }; - - COARefTime(CRefTime t) - : CRefTime(t) - { - }; - - COARefTime(REFERENCE_TIME t) - : CRefTime(t) - { - }; - - COARefTime(double d) { - m_time = (LONGLONG) (d * 10000000); - }; - - operator double() { - return double(m_time) / 10000000; - }; - - operator REFERENCE_TIME() { - return m_time; - }; - - COARefTime& operator=(const double& rd) { - m_time = (LONGLONG) (rd * 10000000); - return *this; - } - - COARefTime& operator=(const REFERENCE_TIME& rt) { - m_time = rt; - return *this; - } - - inline BOOL operator==(const COARefTime& rt) - { - return m_time == rt.m_time; - }; - - inline BOOL operator!=(const COARefTime& rt) - { - return m_time != rt.m_time; - }; - - inline BOOL operator < (const COARefTime& rt) - { - return m_time < rt.m_time; - }; - - inline BOOL operator > (const COARefTime& rt) - { - return m_time > rt.m_time; - }; - - inline BOOL operator >= (const COARefTime& rt) - { - return m_time >= rt.m_time; - }; - - inline BOOL operator <= (const COARefTime& rt) - { - return m_time <= rt.m_time; - }; - - inline COARefTime operator+(const COARefTime& rt) - { - return COARefTime(m_time + rt.m_time); - }; - - inline COARefTime operator-(const COARefTime& rt) - { - return COARefTime(m_time - rt.m_time); - }; - - inline COARefTime operator*(LONG l) - { - return COARefTime(m_time * l); - }; - - inline COARefTime operator/(LONG l) - { - return COARefTime(m_time / l); - }; - -private: - // Prevent bugs from constructing from LONG (which gets - // converted to double and then multiplied by 10000000 - COARefTime(LONG); - COARefTime& operator=(LONG l); -}; - - -// A utility class that handles IMediaPosition and IMediaSeeking on behalf -// of single-input pin renderers, or transform filters. -// -// Renderers will expose this from the filter; transform filters will -// expose it from the output pin and not the renderer. -// -// Create one of these, giving it your IPin* for your input pin, and delegate -// all IMediaPosition methods to it. It will query the input pin for -// IMediaPosition and respond appropriately. -// -// Call ForceRefresh if the pin connection changes. -// -// This class no longer caches the upstream IMediaPosition or IMediaSeeking -// it acquires it on each method call. This means ForceRefresh is not needed. -// The method is kept for source compatibility and to minimise the changes -// if we need to put it back later for performance reasons. - -class CPosPassThru : public IMediaSeeking, public CMediaPosition -{ - IPin *m_pPin; - - HRESULT GetPeer(IMediaPosition **ppMP); - HRESULT GetPeerSeeking(IMediaSeeking **ppMS); - -public: - - CPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *); - DECLARE_IUNKNOWN - - HRESULT ForceRefresh() { - return S_OK; - }; - - // override to return an accurate current position - virtual HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) { - return E_FAIL; - } - - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); - - // IMediaSeeking methods - STDMETHODIMP GetCapabilities( DWORD * pCapabilities ); - STDMETHODIMP CheckCapabilities( DWORD * pCapabilities ); - STDMETHODIMP SetTimeFormat(const GUID * pFormat); - STDMETHODIMP GetTimeFormat(GUID *pFormat); - STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat); - STDMETHODIMP IsFormatSupported( const GUID * pFormat); - STDMETHODIMP QueryPreferredFormat( GUID *pFormat); - STDMETHODIMP ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat, - LONGLONG Source, const GUID * pSourceFormat ); - STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags - , LONGLONG * pStop, DWORD StopFlags ); - - STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ); - STDMETHODIMP GetCurrentPosition( LONGLONG * pCurrent ); - STDMETHODIMP GetStopPosition( LONGLONG * pStop ); - STDMETHODIMP SetRate( double dRate); - STDMETHODIMP GetRate( double * pdRate); - STDMETHODIMP GetDuration( LONGLONG *pDuration); - STDMETHODIMP GetAvailable( LONGLONG *pEarliest, LONGLONG *pLatest ); - STDMETHODIMP GetPreroll( LONGLONG *pllPreroll ); - - // IMediaPosition properties - STDMETHODIMP get_Duration(REFTIME * plength); - STDMETHODIMP put_CurrentPosition(REFTIME llTime); - STDMETHODIMP get_StopTime(REFTIME * pllTime); - STDMETHODIMP put_StopTime(REFTIME llTime); - STDMETHODIMP get_PrerollTime(REFTIME * pllTime); - STDMETHODIMP put_PrerollTime(REFTIME llTime); - STDMETHODIMP get_Rate(double * pdRate); - STDMETHODIMP put_Rate(double dRate); - STDMETHODIMP get_CurrentPosition(REFTIME * pllTime); - STDMETHODIMP CanSeekForward(LONG *pCanSeekForward); - STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward); - -private: - HRESULT GetSeekingLongLong( HRESULT (__stdcall IMediaSeeking::*pMethod)( LONGLONG * ), - LONGLONG * pll ); -}; - - -// Adds the ability to return a current position - -class CRendererPosPassThru : public CPosPassThru -{ - CCritSec m_PositionLock; // Locks access to our position - LONGLONG m_StartMedia; // Start media time last seen - LONGLONG m_EndMedia; // And likewise the end media - BOOL m_bReset; // Have media times been set - -public: - - // Used to help with passing media times through graph - - CRendererPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *); - HRESULT RegisterMediaTime(IMediaSample *pMediaSample); - HRESULT RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime); - HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime); - HRESULT ResetMediaTime(); - HRESULT EOS(); -}; - -STDAPI CreatePosPassThru( - LPUNKNOWN pAgg, - BOOL bRenderer, - IPin *pPin, - IUnknown **ppPassThru -); - -// A class that handles the IDispatch part of IBasicAudio and leaves the -// properties and methods themselves pure virtual. - -class AM_NOVTABLE CBasicAudio : public IBasicAudio, public CUnknown -{ - CBaseDispatch m_basedisp; - -public: - - CBasicAudio(const TCHAR *, LPUNKNOWN); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); -}; - - -// A class that handles the IDispatch part of IBasicVideo and leaves the -// properties and methods themselves pure virtual. - -class AM_NOVTABLE CBaseBasicVideo : public IBasicVideo2, public CUnknown -{ - CBaseDispatch m_basedisp; - -public: - - CBaseBasicVideo(const TCHAR *, LPUNKNOWN); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); - - STDMETHODIMP GetPreferredAspectRatio( - long *plAspectX, - long *plAspectY) - { - return E_NOTIMPL; - } -}; - - -// A class that handles the IDispatch part of IVideoWindow and leaves the -// properties and methods themselves pure virtual. - -class AM_NOVTABLE CBaseVideoWindow : public IVideoWindow, public CUnknown -{ - CBaseDispatch m_basedisp; - -public: - - CBaseVideoWindow(const TCHAR *, LPUNKNOWN); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - /* IDispatch methods */ - STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); - - STDMETHODIMP GetTypeInfo( - UINT itinfo, - LCID lcid, - ITypeInfo ** pptinfo); - - STDMETHODIMP GetIDsOfNames( - REFIID riid, - OLECHAR ** rgszNames, - UINT cNames, - LCID lcid, - DISPID * rgdispid); - - STDMETHODIMP Invoke( - DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - UINT * puArgErr); -}; - - -// abstract class to help source filters with their implementation -// of IMediaPosition. Derive from this and set the duration (and stop -// position). Also override NotifyChange to do something when the properties -// change. - -class AM_NOVTABLE CSourcePosition : public CMediaPosition -{ - -public: - CSourcePosition(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *); - - // IMediaPosition methods - STDMETHODIMP get_Duration(REFTIME * plength); - STDMETHODIMP put_CurrentPosition(REFTIME llTime); - STDMETHODIMP get_StopTime(REFTIME * pllTime); - STDMETHODIMP put_StopTime(REFTIME llTime); - STDMETHODIMP get_PrerollTime(REFTIME * pllTime); - STDMETHODIMP put_PrerollTime(REFTIME llTime); - STDMETHODIMP get_Rate(double * pdRate); - STDMETHODIMP put_Rate(double dRate); - STDMETHODIMP CanSeekForward(LONG *pCanSeekForward); - STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward); - - // override if you can return the data you are actually working on - STDMETHODIMP get_CurrentPosition(REFTIME * pllTime) { - return E_NOTIMPL; - }; - -protected: - - // we call this to notify changes. Override to handle them - virtual HRESULT ChangeStart() PURE; - virtual HRESULT ChangeStop() PURE; - virtual HRESULT ChangeRate() PURE; - - COARefTime m_Duration; - COARefTime m_Start; - COARefTime m_Stop; - double m_Rate; - - CCritSec * m_pLock; -}; - -class AM_NOVTABLE CSourceSeeking : - public IMediaSeeking, - public CUnknown -{ - -public: - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // IMediaSeeking methods - - STDMETHODIMP IsFormatSupported(const GUID * pFormat); - STDMETHODIMP QueryPreferredFormat(GUID *pFormat); - STDMETHODIMP SetTimeFormat(const GUID * pFormat); - STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat); - STDMETHODIMP GetTimeFormat(GUID *pFormat); - STDMETHODIMP GetDuration(LONGLONG *pDuration); - STDMETHODIMP GetStopPosition(LONGLONG *pStop); - STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent); - STDMETHODIMP GetCapabilities( DWORD * pCapabilities ); - STDMETHODIMP CheckCapabilities( DWORD * pCapabilities ); - STDMETHODIMP ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat, - LONGLONG Source, const GUID * pSourceFormat ); - - STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags - , LONGLONG * pStop, DWORD StopFlags ); - - STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ); - - STDMETHODIMP GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest ); - STDMETHODIMP SetRate( double dRate); - STDMETHODIMP GetRate( double * pdRate); - STDMETHODIMP GetPreroll(LONGLONG *pPreroll); - - -protected: - - // ctor - CSourceSeeking(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *); - - // we call this to notify changes. Override to handle them - virtual HRESULT ChangeStart() PURE; - virtual HRESULT ChangeStop() PURE; - virtual HRESULT ChangeRate() PURE; - - CRefTime m_rtDuration; // length of stream - CRefTime m_rtStart; // source will start here - CRefTime m_rtStop; // source will stop here - double m_dRateSeeking; - - // seeking capabilities - DWORD m_dwSeekingCaps; - - CCritSec * m_pLock; -}; - - -// Base classes supporting Deferred commands. - -// Deferred commands are queued by calls to methods on the IQueueCommand -// interface, exposed by the filtergraph and by some filters. A successful -// call to one of these methods will return an IDeferredCommand interface -// representing the queued command. -// -// A CDeferredCommand object represents a single deferred command, and exposes -// the IDeferredCommand interface as well as other methods permitting time -// checks and actual execution. It contains a reference to the CCommandQueue -// object on which it is queued. -// -// CCommandQueue is a base class providing a queue of CDeferredCommand -// objects, and methods to add, remove, check status and invoke the queued -// commands. A CCommandQueue object would be part of an object that -// implemented IQueueCommand. - -class CCmdQueue; - -// take a copy of the params and store them. Release any allocated -// memory in destructor - -class CDispParams : public DISPPARAMS -{ -public: - CDispParams(UINT nArgs, VARIANT* pArgs, HRESULT *phr = NULL); - ~CDispParams(); -}; - - -// CDeferredCommand lifetime is controlled by refcounts. Caller of -// InvokeAt.. gets a refcounted interface pointer, and the CCmdQueue -// object also holds a refcount on us. Calling Cancel or Invoke takes -// us off the CCmdQueue and thus reduces the refcount by 1. Once taken -// off the queue we cannot be put back on the queue. - -class CDeferredCommand - : public CUnknown, - public IDeferredCommand -{ -public: - - CDeferredCommand( - CCmdQueue * pQ, - LPUNKNOWN pUnk, // aggregation outer unk - HRESULT * phr, - LPUNKNOWN pUnkExecutor, // object that will execute this cmd - REFTIME time, - GUID* iid, - long dispidMethod, - short wFlags, - long cArgs, - VARIANT* pDispParams, - VARIANT* pvarResult, - short* puArgErr, - BOOL bStream - ); - - DECLARE_IUNKNOWN - - // override this to publicise our interfaces - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // IDeferredCommand methods - STDMETHODIMP Cancel(); - STDMETHODIMP Confidence( - LONG* pConfidence); - STDMETHODIMP Postpone( - REFTIME newtime); - STDMETHODIMP GetHResult( - HRESULT* phrResult); - - // other public methods - - HRESULT Invoke(); - - // access methods - - // returns TRUE if streamtime, FALSE if presentation time - BOOL IsStreamTime() { - return m_bStream; - }; - - CRefTime GetTime() { - return m_time; - }; - - REFIID GetIID() { - return *m_iid; - }; - - long GetMethod() { - return m_dispidMethod; - }; - - short GetFlags() { - return m_wFlags; - }; - - DISPPARAMS* GetParams() { - return &m_DispParams; - }; - - VARIANT* GetResult() { - return m_pvarResult; - }; - -protected: - - CCmdQueue* m_pQueue; - - // pUnk for the interface that we will execute the command on - LPUNKNOWN m_pUnk; - - // stored command data - REFERENCE_TIME m_time; - GUID* m_iid; - long m_dispidMethod; - short m_wFlags; - VARIANT* m_pvarResult; - BOOL m_bStream; - CDispParams m_DispParams; - DISPID m_DispId; // For get and put - - // we use this for ITypeInfo access - CBaseDispatch m_Dispatch; - - // save retval here - HRESULT m_hrResult; -}; - - -// a list of CDeferredCommand objects. this is a base class providing -// the basics of access to the list. If you want to use CDeferredCommand -// objects then your queue needs to be derived from this class. - -class AM_NOVTABLE CCmdQueue -{ -public: - CCmdQueue(); - virtual ~CCmdQueue(); - - // returns a new CDeferredCommand object that will be initialised with - // the parameters and will be added to the queue during construction. - // returns S_OK if successfully created otherwise an error and - // no object has been queued. - virtual HRESULT New( - CDeferredCommand **ppCmd, - LPUNKNOWN pUnk, - REFTIME time, - GUID* iid, - long dispidMethod, - short wFlags, - long cArgs, - VARIANT* pDispParams, - VARIANT* pvarResult, - short* puArgErr, - BOOL bStream - ); - - // called by the CDeferredCommand object to add and remove itself - // from the queue - virtual HRESULT Insert(CDeferredCommand* pCmd); - virtual HRESULT Remove(CDeferredCommand* pCmd); - - // Command-Due Checking - // - // There are two schemes of synchronisation: coarse and accurate. In - // coarse mode, you wait till the time arrives and then execute the cmd. - // In accurate mode, you wait until you are processing the sample that - // will appear at the time, and then execute the command. It's up to the - // filter which one it will implement. The filtergraph will always - // implement coarse mode for commands queued at the filtergraph. - // - // If you want coarse sync, you probably want to wait until there is a - // command due, and then execute it. You can do this by calling - // GetDueCommand. If you have several things to wait for, get the - // event handle from GetDueHandle() and when this is signalled then call - // GetDueCommand. Stream time will only advance between calls to Run and - // EndRun. Note that to avoid an extra thread there is no guarantee that - // if the handle is set there will be a command ready. Each time the - // event is signalled, call GetDueCommand (probably with a 0 timeout); - // This may return E_ABORT. - // - // If you want accurate sync, you must call GetCommandDueFor, passing - // as a parameter the stream time of the samples you are about to process. - // This will return: - // -- a stream-time command due at or before that stream time - // -- a presentation-time command due at or before the - // time that stream time will be presented (only between Run - // and EndRun calls, since outside of this, the mapping from - // stream time to presentation time is not known. - // -- any presentation-time command due now. - // This means that if you want accurate synchronisation on samples that - // might be processed during Paused mode, you need to use - // stream-time commands. - // - // In all cases, commands remain queued until Invoked or Cancelled. The - // setting and resetting of the event handle is managed entirely by this - // queue object. - - // set the clock used for timing - virtual HRESULT SetSyncSource(IReferenceClock*); - - // switch to run mode. Streamtime to Presentation time mapping known. - virtual HRESULT Run(REFERENCE_TIME tStreamTimeOffset); - - // switch to Stopped or Paused mode. Time mapping not known. - virtual HRESULT EndRun(); - - // return a pointer to the next due command. Blocks for msTimeout - // milliseconds until there is a due command. - // Stream-time commands will only become due between Run and Endrun calls. - // The command remains queued until invoked or cancelled. - // Returns E_ABORT if timeout occurs, otherwise S_OK (or other error). - // Returns an AddRef-ed object - virtual HRESULT GetDueCommand(CDeferredCommand ** ppCmd, long msTimeout); - - // return the event handle that will be signalled whenever - // there are deferred commands due for execution (when GetDueCommand - // will not block). - HANDLE GetDueHandle() { - return HANDLE(m_evDue); - }; - - // return a pointer to a command that will be due for a given time. - // Pass in a stream time here. The stream time offset will be passed - // in via the Run method. - // Commands remain queued until invoked or cancelled. - // This method will not block. It will report VFW_E_NOT_FOUND if there - // are no commands due yet. - // Returns an AddRef-ed object - virtual HRESULT GetCommandDueFor(REFERENCE_TIME tStream, CDeferredCommand**ppCmd); - - // check if a given time is due (TRUE if it is due yet) - BOOL CheckTime(CRefTime time, BOOL bStream) { - - // if no clock, nothing is due! - if (!m_pClock) { - return FALSE; - } - - // stream time - if (bStream) { - - // not valid if not running - if (!m_bRunning) { - return FALSE; - } - // add on known stream time offset to get presentation time - time += m_StreamTimeOffset; - } - - CRefTime Now; - m_pClock->GetTime((REFERENCE_TIME*)&Now); - return (time <= Now); - }; - -protected: - - // protect access to lists etc - CCritSec m_Lock; - - // commands queued in presentation time are stored here - CGenericList m_listPresentation; - - // commands queued in stream time are stored here - CGenericList m_listStream; - - // set when any commands are due - CAMEvent m_evDue; - - // creates an advise for the earliest time required, if any - void SetTimeAdvise(void); - - // advise id from reference clock (0 if no outstanding advise) - DWORD_PTR m_dwAdvise; - - // advise time is for this presentation time - CRefTime m_tCurrentAdvise; - - // the reference clock we are using (addrefed) - IReferenceClock* m_pClock; - - // true when running - BOOL m_bRunning; - - // contains stream time offset when m_bRunning is true - CRefTime m_StreamTimeOffset; -}; - -#endif // __CTLUTIL__ +//------------------------------------------------------------------------------ +// File: CtlUtil.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// Base classes implementing IDispatch parsing for the basic control dual +// interfaces. Derive from these and implement just the custom method and +// property methods. We also implement CPosPassThru that can be used by +// renderers and transforms to pass by IMediaPosition and IMediaSeeking + +#ifndef __CTLUTIL__ +#define __CTLUTIL__ + +// OLE Automation has different ideas of TRUE and FALSE + +#define OATRUE (-1) +#define OAFALSE (0) + + +// It's possible that we could replace this class with CreateStdDispatch + +class CBaseDispatch +{ + ITypeInfo * m_pti; + +public: + + CBaseDispatch() : m_pti(NULL) {} + ~CBaseDispatch(); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + REFIID riid, + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); +}; + + +class AM_NOVTABLE CMediaControl : + public IMediaControl, + public CUnknown +{ + CBaseDispatch m_basedisp; + +public: + + CMediaControl(const TCHAR *, LPUNKNOWN); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); +}; + + +class AM_NOVTABLE CMediaEvent : + public IMediaEventEx, + public CUnknown +{ + CBaseDispatch m_basedisp; + +public: + + CMediaEvent(const TCHAR *, LPUNKNOWN); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); +}; + + +class AM_NOVTABLE CMediaPosition : + public IMediaPosition, + public CUnknown +{ + CBaseDispatch m_basedisp; + + +public: + + CMediaPosition(const TCHAR *, LPUNKNOWN); + CMediaPosition(const TCHAR *, LPUNKNOWN, HRESULT *phr); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); + +}; + + +// OA-compatibility means that we must use double as the RefTime value, +// and REFERENCE_TIME (essentially a LONGLONG) within filters. +// this class converts between the two + +class COARefTime : public CRefTime { +public: + + COARefTime() { + }; + + COARefTime(CRefTime t) + : CRefTime(t) + { + }; + + COARefTime(REFERENCE_TIME t) + : CRefTime(t) + { + }; + + COARefTime(double d) { + m_time = (LONGLONG) (d * 10000000); + }; + + operator double() { + return double(m_time) / 10000000; + }; + + operator REFERENCE_TIME() { + return m_time; + }; + + COARefTime& operator=(const double& rd) { + m_time = (LONGLONG) (rd * 10000000); + return *this; + } + + COARefTime& operator=(const REFERENCE_TIME& rt) { + m_time = rt; + return *this; + } + + inline BOOL operator==(const COARefTime& rt) + { + return m_time == rt.m_time; + }; + + inline BOOL operator!=(const COARefTime& rt) + { + return m_time != rt.m_time; + }; + + inline BOOL operator < (const COARefTime& rt) + { + return m_time < rt.m_time; + }; + + inline BOOL operator > (const COARefTime& rt) + { + return m_time > rt.m_time; + }; + + inline BOOL operator >= (const COARefTime& rt) + { + return m_time >= rt.m_time; + }; + + inline BOOL operator <= (const COARefTime& rt) + { + return m_time <= rt.m_time; + }; + + inline COARefTime operator+(const COARefTime& rt) + { + return COARefTime(m_time + rt.m_time); + }; + + inline COARefTime operator-(const COARefTime& rt) + { + return COARefTime(m_time - rt.m_time); + }; + + inline COARefTime operator*(LONG l) + { + return COARefTime(m_time * l); + }; + + inline COARefTime operator/(LONG l) + { + return COARefTime(m_time / l); + }; + +private: + // Prevent bugs from constructing from LONG (which gets + // converted to double and then multiplied by 10000000 + COARefTime(LONG); + COARefTime& operator=(LONG l); +}; + + +// A utility class that handles IMediaPosition and IMediaSeeking on behalf +// of single-input pin renderers, or transform filters. +// +// Renderers will expose this from the filter; transform filters will +// expose it from the output pin and not the renderer. +// +// Create one of these, giving it your IPin* for your input pin, and delegate +// all IMediaPosition methods to it. It will query the input pin for +// IMediaPosition and respond appropriately. +// +// Call ForceRefresh if the pin connection changes. +// +// This class no longer caches the upstream IMediaPosition or IMediaSeeking +// it acquires it on each method call. This means ForceRefresh is not needed. +// The method is kept for source compatibility and to minimise the changes +// if we need to put it back later for performance reasons. + +class CPosPassThru : public IMediaSeeking, public CMediaPosition +{ + IPin *m_pPin; + + HRESULT GetPeer(IMediaPosition **ppMP); + HRESULT GetPeerSeeking(IMediaSeeking **ppMS); + +public: + + CPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *); + DECLARE_IUNKNOWN + + HRESULT ForceRefresh() { + return S_OK; + }; + + // override to return an accurate current position + virtual HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) { + return E_FAIL; + } + + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); + + // IMediaSeeking methods + STDMETHODIMP GetCapabilities( DWORD * pCapabilities ); + STDMETHODIMP CheckCapabilities( DWORD * pCapabilities ); + STDMETHODIMP SetTimeFormat(const GUID * pFormat); + STDMETHODIMP GetTimeFormat(GUID *pFormat); + STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat); + STDMETHODIMP IsFormatSupported( const GUID * pFormat); + STDMETHODIMP QueryPreferredFormat( GUID *pFormat); + STDMETHODIMP ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat, + LONGLONG Source, const GUID * pSourceFormat ); + STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags + , LONGLONG * pStop, DWORD StopFlags ); + + STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ); + STDMETHODIMP GetCurrentPosition( LONGLONG * pCurrent ); + STDMETHODIMP GetStopPosition( LONGLONG * pStop ); + STDMETHODIMP SetRate( double dRate); + STDMETHODIMP GetRate( double * pdRate); + STDMETHODIMP GetDuration( LONGLONG *pDuration); + STDMETHODIMP GetAvailable( LONGLONG *pEarliest, LONGLONG *pLatest ); + STDMETHODIMP GetPreroll( LONGLONG *pllPreroll ); + + // IMediaPosition properties + STDMETHODIMP get_Duration(REFTIME * plength); + STDMETHODIMP put_CurrentPosition(REFTIME llTime); + STDMETHODIMP get_StopTime(REFTIME * pllTime); + STDMETHODIMP put_StopTime(REFTIME llTime); + STDMETHODIMP get_PrerollTime(REFTIME * pllTime); + STDMETHODIMP put_PrerollTime(REFTIME llTime); + STDMETHODIMP get_Rate(double * pdRate); + STDMETHODIMP put_Rate(double dRate); + STDMETHODIMP get_CurrentPosition(REFTIME * pllTime); + STDMETHODIMP CanSeekForward(LONG *pCanSeekForward); + STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward); + +private: + HRESULT GetSeekingLongLong( HRESULT (__stdcall IMediaSeeking::*pMethod)( LONGLONG * ), + LONGLONG * pll ); +}; + + +// Adds the ability to return a current position + +class CRendererPosPassThru : public CPosPassThru +{ + CCritSec m_PositionLock; // Locks access to our position + LONGLONG m_StartMedia; // Start media time last seen + LONGLONG m_EndMedia; // And likewise the end media + BOOL m_bReset; // Have media times been set + +public: + + // Used to help with passing media times through graph + + CRendererPosPassThru(const TCHAR *, LPUNKNOWN, HRESULT*, IPin *); + HRESULT RegisterMediaTime(IMediaSample *pMediaSample); + HRESULT RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime); + HRESULT GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime); + HRESULT ResetMediaTime(); + HRESULT EOS(); +}; + +STDAPI CreatePosPassThru( + LPUNKNOWN pAgg, + BOOL bRenderer, + IPin *pPin, + IUnknown **ppPassThru +); + +// A class that handles the IDispatch part of IBasicAudio and leaves the +// properties and methods themselves pure virtual. + +class AM_NOVTABLE CBasicAudio : public IBasicAudio, public CUnknown +{ + CBaseDispatch m_basedisp; + +public: + + CBasicAudio(const TCHAR *, LPUNKNOWN); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); +}; + + +// A class that handles the IDispatch part of IBasicVideo and leaves the +// properties and methods themselves pure virtual. + +class AM_NOVTABLE CBaseBasicVideo : public IBasicVideo2, public CUnknown +{ + CBaseDispatch m_basedisp; + +public: + + CBaseBasicVideo(const TCHAR *, LPUNKNOWN); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); + + STDMETHODIMP GetPreferredAspectRatio( + long *plAspectX, + long *plAspectY) + { + return E_NOTIMPL; + } +}; + + +// A class that handles the IDispatch part of IVideoWindow and leaves the +// properties and methods themselves pure virtual. + +class AM_NOVTABLE CBaseVideoWindow : public IVideoWindow, public CUnknown +{ + CBaseDispatch m_basedisp; + +public: + + CBaseVideoWindow(const TCHAR *, LPUNKNOWN); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + /* IDispatch methods */ + STDMETHODIMP GetTypeInfoCount(UINT * pctinfo); + + STDMETHODIMP GetTypeInfo( + UINT itinfo, + LCID lcid, + ITypeInfo ** pptinfo); + + STDMETHODIMP GetIDsOfNames( + REFIID riid, + OLECHAR ** rgszNames, + UINT cNames, + LCID lcid, + DISPID * rgdispid); + + STDMETHODIMP Invoke( + DISPID dispidMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, + EXCEPINFO * pexcepinfo, + UINT * puArgErr); +}; + + +// abstract class to help source filters with their implementation +// of IMediaPosition. Derive from this and set the duration (and stop +// position). Also override NotifyChange to do something when the properties +// change. + +class AM_NOVTABLE CSourcePosition : public CMediaPosition +{ + +public: + CSourcePosition(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *); + + // IMediaPosition methods + STDMETHODIMP get_Duration(REFTIME * plength); + STDMETHODIMP put_CurrentPosition(REFTIME llTime); + STDMETHODIMP get_StopTime(REFTIME * pllTime); + STDMETHODIMP put_StopTime(REFTIME llTime); + STDMETHODIMP get_PrerollTime(REFTIME * pllTime); + STDMETHODIMP put_PrerollTime(REFTIME llTime); + STDMETHODIMP get_Rate(double * pdRate); + STDMETHODIMP put_Rate(double dRate); + STDMETHODIMP CanSeekForward(LONG *pCanSeekForward); + STDMETHODIMP CanSeekBackward(LONG *pCanSeekBackward); + + // override if you can return the data you are actually working on + STDMETHODIMP get_CurrentPosition(REFTIME * pllTime) { + return E_NOTIMPL; + }; + +protected: + + // we call this to notify changes. Override to handle them + virtual HRESULT ChangeStart() PURE; + virtual HRESULT ChangeStop() PURE; + virtual HRESULT ChangeRate() PURE; + + COARefTime m_Duration; + COARefTime m_Start; + COARefTime m_Stop; + double m_Rate; + + CCritSec * m_pLock; +}; + +class AM_NOVTABLE CSourceSeeking : + public IMediaSeeking, + public CUnknown +{ + +public: + + DECLARE_IUNKNOWN; + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // IMediaSeeking methods + + STDMETHODIMP IsFormatSupported(const GUID * pFormat); + STDMETHODIMP QueryPreferredFormat(GUID *pFormat); + STDMETHODIMP SetTimeFormat(const GUID * pFormat); + STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat); + STDMETHODIMP GetTimeFormat(GUID *pFormat); + STDMETHODIMP GetDuration(LONGLONG *pDuration); + STDMETHODIMP GetStopPosition(LONGLONG *pStop); + STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent); + STDMETHODIMP GetCapabilities( DWORD * pCapabilities ); + STDMETHODIMP CheckCapabilities( DWORD * pCapabilities ); + STDMETHODIMP ConvertTimeFormat( LONGLONG * pTarget, const GUID * pTargetFormat, + LONGLONG Source, const GUID * pSourceFormat ); + + STDMETHODIMP SetPositions( LONGLONG * pCurrent, DWORD CurrentFlags + , LONGLONG * pStop, DWORD StopFlags ); + + STDMETHODIMP GetPositions( LONGLONG * pCurrent, LONGLONG * pStop ); + + STDMETHODIMP GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest ); + STDMETHODIMP SetRate( double dRate); + STDMETHODIMP GetRate( double * pdRate); + STDMETHODIMP GetPreroll(LONGLONG *pPreroll); + + +protected: + + // ctor + CSourceSeeking(const TCHAR *, LPUNKNOWN, HRESULT*, CCritSec *); + + // we call this to notify changes. Override to handle them + virtual HRESULT ChangeStart() PURE; + virtual HRESULT ChangeStop() PURE; + virtual HRESULT ChangeRate() PURE; + + CRefTime m_rtDuration; // length of stream + CRefTime m_rtStart; // source will start here + CRefTime m_rtStop; // source will stop here + double m_dRateSeeking; + + // seeking capabilities + DWORD m_dwSeekingCaps; + + CCritSec * m_pLock; +}; + + +// Base classes supporting Deferred commands. + +// Deferred commands are queued by calls to methods on the IQueueCommand +// interface, exposed by the filtergraph and by some filters. A successful +// call to one of these methods will return an IDeferredCommand interface +// representing the queued command. +// +// A CDeferredCommand object represents a single deferred command, and exposes +// the IDeferredCommand interface as well as other methods permitting time +// checks and actual execution. It contains a reference to the CCommandQueue +// object on which it is queued. +// +// CCommandQueue is a base class providing a queue of CDeferredCommand +// objects, and methods to add, remove, check status and invoke the queued +// commands. A CCommandQueue object would be part of an object that +// implemented IQueueCommand. + +class CCmdQueue; + +// take a copy of the params and store them. Release any allocated +// memory in destructor + +class CDispParams : public DISPPARAMS +{ +public: + CDispParams(UINT nArgs, VARIANT* pArgs, HRESULT *phr = NULL); + ~CDispParams(); +}; + + +// CDeferredCommand lifetime is controlled by refcounts. Caller of +// InvokeAt.. gets a refcounted interface pointer, and the CCmdQueue +// object also holds a refcount on us. Calling Cancel or Invoke takes +// us off the CCmdQueue and thus reduces the refcount by 1. Once taken +// off the queue we cannot be put back on the queue. + +class CDeferredCommand + : public CUnknown, + public IDeferredCommand +{ +public: + + CDeferredCommand( + CCmdQueue * pQ, + LPUNKNOWN pUnk, // aggregation outer unk + HRESULT * phr, + LPUNKNOWN pUnkExecutor, // object that will execute this cmd + REFTIME time, + GUID* iid, + long dispidMethod, + short wFlags, + long cArgs, + VARIANT* pDispParams, + VARIANT* pvarResult, + short* puArgErr, + BOOL bStream + ); + + DECLARE_IUNKNOWN + + // override this to publicise our interfaces + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // IDeferredCommand methods + STDMETHODIMP Cancel(); + STDMETHODIMP Confidence( + LONG* pConfidence); + STDMETHODIMP Postpone( + REFTIME newtime); + STDMETHODIMP GetHResult( + HRESULT* phrResult); + + // other public methods + + HRESULT Invoke(); + + // access methods + + // returns TRUE if streamtime, FALSE if presentation time + BOOL IsStreamTime() { + return m_bStream; + }; + + CRefTime GetTime() { + return m_time; + }; + + REFIID GetIID() { + return *m_iid; + }; + + long GetMethod() { + return m_dispidMethod; + }; + + short GetFlags() { + return m_wFlags; + }; + + DISPPARAMS* GetParams() { + return &m_DispParams; + }; + + VARIANT* GetResult() { + return m_pvarResult; + }; + +protected: + + CCmdQueue* m_pQueue; + + // pUnk for the interface that we will execute the command on + LPUNKNOWN m_pUnk; + + // stored command data + REFERENCE_TIME m_time; + GUID* m_iid; + long m_dispidMethod; + short m_wFlags; + VARIANT* m_pvarResult; + BOOL m_bStream; + CDispParams m_DispParams; + DISPID m_DispId; // For get and put + + // we use this for ITypeInfo access + CBaseDispatch m_Dispatch; + + // save retval here + HRESULT m_hrResult; +}; + + +// a list of CDeferredCommand objects. this is a base class providing +// the basics of access to the list. If you want to use CDeferredCommand +// objects then your queue needs to be derived from this class. + +class AM_NOVTABLE CCmdQueue +{ +public: + CCmdQueue(); + virtual ~CCmdQueue(); + + // returns a new CDeferredCommand object that will be initialised with + // the parameters and will be added to the queue during construction. + // returns S_OK if successfully created otherwise an error and + // no object has been queued. + virtual HRESULT New( + CDeferredCommand **ppCmd, + LPUNKNOWN pUnk, + REFTIME time, + GUID* iid, + long dispidMethod, + short wFlags, + long cArgs, + VARIANT* pDispParams, + VARIANT* pvarResult, + short* puArgErr, + BOOL bStream + ); + + // called by the CDeferredCommand object to add and remove itself + // from the queue + virtual HRESULT Insert(CDeferredCommand* pCmd); + virtual HRESULT Remove(CDeferredCommand* pCmd); + + // Command-Due Checking + // + // There are two schemes of synchronisation: coarse and accurate. In + // coarse mode, you wait till the time arrives and then execute the cmd. + // In accurate mode, you wait until you are processing the sample that + // will appear at the time, and then execute the command. It's up to the + // filter which one it will implement. The filtergraph will always + // implement coarse mode for commands queued at the filtergraph. + // + // If you want coarse sync, you probably want to wait until there is a + // command due, and then execute it. You can do this by calling + // GetDueCommand. If you have several things to wait for, get the + // event handle from GetDueHandle() and when this is signalled then call + // GetDueCommand. Stream time will only advance between calls to Run and + // EndRun. Note that to avoid an extra thread there is no guarantee that + // if the handle is set there will be a command ready. Each time the + // event is signalled, call GetDueCommand (probably with a 0 timeout); + // This may return E_ABORT. + // + // If you want accurate sync, you must call GetCommandDueFor, passing + // as a parameter the stream time of the samples you are about to process. + // This will return: + // -- a stream-time command due at or before that stream time + // -- a presentation-time command due at or before the + // time that stream time will be presented (only between Run + // and EndRun calls, since outside of this, the mapping from + // stream time to presentation time is not known. + // -- any presentation-time command due now. + // This means that if you want accurate synchronisation on samples that + // might be processed during Paused mode, you need to use + // stream-time commands. + // + // In all cases, commands remain queued until Invoked or Cancelled. The + // setting and resetting of the event handle is managed entirely by this + // queue object. + + // set the clock used for timing + virtual HRESULT SetSyncSource(IReferenceClock*); + + // switch to run mode. Streamtime to Presentation time mapping known. + virtual HRESULT Run(REFERENCE_TIME tStreamTimeOffset); + + // switch to Stopped or Paused mode. Time mapping not known. + virtual HRESULT EndRun(); + + // return a pointer to the next due command. Blocks for msTimeout + // milliseconds until there is a due command. + // Stream-time commands will only become due between Run and Endrun calls. + // The command remains queued until invoked or cancelled. + // Returns E_ABORT if timeout occurs, otherwise S_OK (or other error). + // Returns an AddRef-ed object + virtual HRESULT GetDueCommand(CDeferredCommand ** ppCmd, long msTimeout); + + // return the event handle that will be signalled whenever + // there are deferred commands due for execution (when GetDueCommand + // will not block). + HANDLE GetDueHandle() { + return HANDLE(m_evDue); + }; + + // return a pointer to a command that will be due for a given time. + // Pass in a stream time here. The stream time offset will be passed + // in via the Run method. + // Commands remain queued until invoked or cancelled. + // This method will not block. It will report VFW_E_NOT_FOUND if there + // are no commands due yet. + // Returns an AddRef-ed object + virtual HRESULT GetCommandDueFor(REFERENCE_TIME tStream, CDeferredCommand**ppCmd); + + // check if a given time is due (TRUE if it is due yet) + BOOL CheckTime(CRefTime time, BOOL bStream) { + + // if no clock, nothing is due! + if (!m_pClock) { + return FALSE; + } + + // stream time + if (bStream) { + + // not valid if not running + if (!m_bRunning) { + return FALSE; + } + // add on known stream time offset to get presentation time + time += m_StreamTimeOffset; + } + + CRefTime Now; + m_pClock->GetTime((REFERENCE_TIME*)&Now); + return (time <= Now); + }; + +protected: + + // protect access to lists etc + CCritSec m_Lock; + + // commands queued in presentation time are stored here + CGenericList m_listPresentation; + + // commands queued in stream time are stored here + CGenericList m_listStream; + + // set when any commands are due + CAMEvent m_evDue; + + // creates an advise for the earliest time required, if any + void SetTimeAdvise(void); + + // advise id from reference clock (0 if no outstanding advise) + DWORD_PTR m_dwAdvise; + + // advise time is for this presentation time + CRefTime m_tCurrentAdvise; + + // the reference clock we are using (addrefed) + IReferenceClock* m_pClock; + + // true when running + BOOL m_bRunning; + + // contains stream time offset when m_bRunning is true + CRefTime m_StreamTimeOffset; +}; + +#endif // __CTLUTIL__ diff --git a/src/BaseClasses/ddmm.cpp b/src/BaseClasses/ddmm.cpp index 97b882a2d0..72afc264a4 100644 --- a/src/BaseClasses/ddmm.cpp +++ b/src/BaseClasses/ddmm.cpp @@ -1,126 +1,126 @@ -//------------------------------------------------------------------------------ -// File: DDMM.cpp -// -// Desc: DirectShow base classes - implements routines for using DirectDraw -// on a multimonitor system. -// -// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include -#include "ddmm.h" - -/* - * FindDeviceCallback - */ -typedef struct { - LPSTR szDevice; - GUID* lpGUID; - GUID GUID; - BOOL fFound; -} FindDeviceData; - -BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam) { - FindDeviceData *p = (FindDeviceData*)lParam; - - if(lstrcmpiA(p->szDevice, szDevice) == 0) { - if(lpGUID) { - p->GUID = *lpGUID; - p->lpGUID = &p->GUID; - } - else { - p->lpGUID = NULL; - } - p->fFound = TRUE; - return FALSE; - } - return TRUE; -} - - -BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam, HMONITOR hMonitor) { - FindDeviceData *p = (FindDeviceData*)lParam; - - if(lstrcmpiA(p->szDevice, szDevice) == 0) { - if(lpGUID) { - p->GUID = *lpGUID; - p->lpGUID = &p->GUID; - } - else { - p->lpGUID = NULL; - } - p->fFound = TRUE; - return FALSE; - } - return TRUE; -} - - -/* - * DirectDrawCreateFromDevice - * - * create a DirectDraw object for a particular device - */ -IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP) { - IDirectDraw* pdd = NULL; - FindDeviceData find; - - if(szDevice == NULL) { - DirectDrawCreateP(NULL, &pdd, NULL); - return pdd; - } - - find.szDevice = szDevice; - find.fFound = FALSE; - DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find); - - if(find.fFound) { - // - // In 4bpp mode the following DDraw call causes a message box to be popped - // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we - // make sure it doesn't happen. - // - UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - DirectDrawCreateP(find.lpGUID, &pdd, NULL); - SetErrorMode(ErrorMode); - } - - return pdd; -} - - -/* - * DirectDrawCreateFromDeviceEx - * - * create a DirectDraw object for a particular device - */ -IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP) { - IDirectDraw* pdd = NULL; - FindDeviceData find; - - if(szDevice == NULL) { - DirectDrawCreateP(NULL, &pdd, NULL); - return pdd; - } - - find.szDevice = szDevice; - find.fFound = FALSE; - DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find, - DDENUM_ATTACHEDSECONDARYDEVICES); - - if(find.fFound) { - // - // In 4bpp mode the following DDraw call causes a message box to be popped - // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we - // make sure it doesn't happen. - // - UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - DirectDrawCreateP(find.lpGUID, &pdd, NULL); - SetErrorMode(ErrorMode); - } - - return pdd; -} - +//------------------------------------------------------------------------------ +// File: DDMM.cpp +// +// Desc: DirectShow base classes - implements routines for using DirectDraw +// on a multimonitor system. +// +// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include +#include "ddmm.h" + +/* + * FindDeviceCallback + */ +typedef struct { + LPSTR szDevice; + GUID* lpGUID; + GUID GUID; + BOOL fFound; +} FindDeviceData; + +BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam) { + FindDeviceData *p = (FindDeviceData*)lParam; + + if(lstrcmpiA(p->szDevice, szDevice) == 0) { + if(lpGUID) { + p->GUID = *lpGUID; + p->lpGUID = &p->GUID; + } + else { + p->lpGUID = NULL; + } + p->fFound = TRUE; + return FALSE; + } + return TRUE; +} + + +BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam, HMONITOR hMonitor) { + FindDeviceData *p = (FindDeviceData*)lParam; + + if(lstrcmpiA(p->szDevice, szDevice) == 0) { + if(lpGUID) { + p->GUID = *lpGUID; + p->lpGUID = &p->GUID; + } + else { + p->lpGUID = NULL; + } + p->fFound = TRUE; + return FALSE; + } + return TRUE; +} + + +/* + * DirectDrawCreateFromDevice + * + * create a DirectDraw object for a particular device + */ +IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP) { + IDirectDraw* pdd = NULL; + FindDeviceData find; + + if(szDevice == NULL) { + DirectDrawCreateP(NULL, &pdd, NULL); + return pdd; + } + + find.szDevice = szDevice; + find.fFound = FALSE; + DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find); + + if(find.fFound) { + // + // In 4bpp mode the following DDraw call causes a message box to be popped + // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we + // make sure it doesn't happen. + // + UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + DirectDrawCreateP(find.lpGUID, &pdd, NULL); + SetErrorMode(ErrorMode); + } + + return pdd; +} + + +/* + * DirectDrawCreateFromDeviceEx + * + * create a DirectDraw object for a particular device + */ +IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP) { + IDirectDraw* pdd = NULL; + FindDeviceData find; + + if(szDevice == NULL) { + DirectDrawCreateP(NULL, &pdd, NULL); + return pdd; + } + + find.szDevice = szDevice; + find.fFound = FALSE; + DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find, + DDENUM_ATTACHEDSECONDARYDEVICES); + + if(find.fFound) { + // + // In 4bpp mode the following DDraw call causes a message box to be popped + // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we + // make sure it doesn't happen. + // + UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + DirectDrawCreateP(find.lpGUID, &pdd, NULL); + SetErrorMode(ErrorMode); + } + + return pdd; +} + diff --git a/src/BaseClasses/ddmm.h b/src/BaseClasses/ddmm.h index 2ab4ddbf90..2bb95deb9b 100644 --- a/src/BaseClasses/ddmm.h +++ b/src/BaseClasses/ddmm.h @@ -1,28 +1,28 @@ -//------------------------------------------------------------------------------ -// File: DDMM.h -// -// Desc: DirectShow base classes - efines routines for using DirectDraw -// on a multimonitor system. -// -// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - -// DDRAW.H might not include these -#ifndef DDENUM_ATTACHEDSECONDARYDEVICES -#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L -#endif - -typedef HRESULT (*PDRAWCREATE)(IID *,LPDIRECTDRAW *,LPUNKNOWN); -typedef HRESULT (*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID); - -IDirectDraw * DirectDrawCreateFromDevice(LPSTR, PDRAWCREATE, PDRAWENUM); -IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +//------------------------------------------------------------------------------ +// File: DDMM.h +// +// Desc: DirectShow base classes - efines routines for using DirectDraw +// on a multimonitor system. +// +// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +// DDRAW.H might not include these +#ifndef DDENUM_ATTACHEDSECONDARYDEVICES +#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L +#endif + +typedef HRESULT (*PDRAWCREATE)(IID *,LPDIRECTDRAW *,LPUNKNOWN); +typedef HRESULT (*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID); + +IDirectDraw * DirectDrawCreateFromDevice(LPSTR, PDRAWCREATE, PDRAWENUM); +IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/src/BaseClasses/dllentry.cpp b/src/BaseClasses/dllentry.cpp index 12bd4bb589..6b74d2e524 100644 --- a/src/BaseClasses/dllentry.cpp +++ b/src/BaseClasses/dllentry.cpp @@ -1,332 +1,332 @@ -//------------------------------------------------------------------------------ -// File: DllEntry.cpp -// -// Desc: DirectShow base classes - implements classes used to support dll -// entry points for COM objects. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - -#ifdef DEBUG -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif // _UNICODE -#endif // UNICODE - -#include -#endif // DEBUG - -extern CFactoryTemplate g_Templates[]; -extern int g_cTemplates; - -HINSTANCE g_hInst; -DWORD g_amPlatform; // VER_PLATFORM_WIN32_WINDOWS etc... (from GetVersionEx) -OSVERSIONINFO g_osInfo; - -// -// an instance of this is created by the DLLGetClassObject entrypoint -// it uses the CFactoryTemplate object it is given to support the -// IClassFactory interface - -class CClassFactory : public IClassFactory, public CBaseObject { - - private: - const CFactoryTemplate *const m_pTemplate; - - ULONG m_cRef; - - static int m_cLocked; - public: - CClassFactory(const CFactoryTemplate *); - - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid, void ** ppv); - STDMETHODIMP_(ULONG)AddRef(); - STDMETHODIMP_(ULONG)Release(); - - // IClassFactory - STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **pv); - STDMETHODIMP LockServer(BOOL fLock); - - // allow DLLGetClassObject to know about global server lock status - static BOOL IsLocked() { - return (m_cLocked > 0); - }; -}; - -// process-wide dll locked state -int CClassFactory::m_cLocked = 0; - -CClassFactory::CClassFactory(const CFactoryTemplate *pTemplate) -: CBaseObject(NAME("Class Factory")) -, m_cRef(0) -, m_pTemplate(pTemplate) { -} - - -STDMETHODIMP -CClassFactory::QueryInterface(REFIID riid,void **ppv) { - CheckPointer(ppv,E_POINTER) - ValidateReadWritePtr(ppv,sizeof(PVOID)); - *ppv = NULL; - - // any interface on this object is the object pointer. - if((riid == IID_IUnknown) || (riid == IID_IClassFactory)) { - *ppv = (LPVOID) this; - // AddRef returned interface pointer - ((LPUNKNOWN) *ppv)->AddRef(); - return NOERROR; - } - - return ResultFromScode(E_NOINTERFACE); -} - - -STDMETHODIMP_(ULONG) -CClassFactory::AddRef() { - return ++m_cRef; -} - -STDMETHODIMP_(ULONG) -CClassFactory::Release() { - if(--m_cRef == 0) { - delete this; - return 0; - } - else { - return m_cRef; - } -} - -STDMETHODIMP -CClassFactory::CreateInstance( - LPUNKNOWN pUnkOuter, - REFIID riid, - void **pv) { - CheckPointer(pv,E_POINTER) - ValidateReadWritePtr(pv,sizeof(void *)); - - /* Enforce the normal OLE rules regarding interfaces and delegation */ - - if(pUnkOuter != NULL) { - if(IsEqualIID(riid,IID_IUnknown) == FALSE) { - return ResultFromScode(E_NOINTERFACE); - } - } - - /* Create the new object through the derived class's create function */ - - HRESULT hr = NOERROR; - CUnknown *pObj = m_pTemplate->CreateInstance(pUnkOuter, &hr); - - if(pObj == NULL) { - if(SUCCEEDED(hr)) { - hr = E_OUTOFMEMORY; - } - return hr; - } - - /* Delete the object if we got a construction error */ - - if(FAILED(hr)) { - delete pObj; - return hr; - } - - /* Get a reference counted interface on the object */ - - /* We wrap the non-delegating QI with NDAddRef & NDRelease. */ - /* This protects any outer object from being prematurely */ - /* released by an inner object that may have to be created */ - /* in order to supply the requested interface. */ - pObj->NonDelegatingAddRef(); - hr = pObj->NonDelegatingQueryInterface(riid, pv); - pObj->NonDelegatingRelease(); - - /* Note that if NonDelegatingQueryInterface fails, it will */ - /* not increment the ref count, so the NonDelegatingRelease */ - /* will drop the ref back to zero and the object will "self-*/ - /* destruct". Hence we don't need additional tidy-up code */ - /* to cope with NonDelegatingQueryInterface failing. */ - - if(SUCCEEDED(hr)) { - ASSERT(*pv); - } - - return hr; -} - -STDMETHODIMP -CClassFactory::LockServer(BOOL fLock) { - if(fLock) { - m_cLocked++; - } - else { - m_cLocked--; - } - return NOERROR; -} - - -// --- COM entrypoints ----------------------------------------- - -//called by COM to get the class factory object for a given class -STDAPI -DllGetClassObject( - REFCLSID rClsID, - REFIID riid, - void **pv) { - if(!(riid == IID_IUnknown) && !(riid == IID_IClassFactory)) { - return E_NOINTERFACE; - } - - // traverse the array of templates looking for one with this - // class id - for(int i = 0; i < g_cTemplates; i++) { - const CFactoryTemplate * pT = &g_Templates[i]; - if(pT->IsClassID(rClsID)) { - - // found a template - make a class factory based on this - // template - - *pv = (LPVOID) (LPUNKNOWN) new CClassFactory(pT); - if(*pv == NULL) { - return E_OUTOFMEMORY; - } - ((LPUNKNOWN)*pv)->AddRef(); - return NOERROR; - } - } - return CLASS_E_CLASSNOTAVAILABLE; -} - -// -// Call any initialization routines -// -void -DllInitClasses(BOOL bLoading) { - int i; - - // traverse the array of templates calling the init routine - // if they have one - for(i = 0; i < g_cTemplates; i++) { - const CFactoryTemplate * pT = &g_Templates[i]; - if(pT->m_lpfnInit != NULL) { - (*pT->m_lpfnInit)(bLoading, pT->m_ClsID); - } - } - -} - -// called by COM to determine if this dll can be unloaded -// return ok unless there are outstanding objects or a lock requested -// by IClassFactory::LockServer -// -// CClassFactory has a static function that can tell us about the locks, -// and CCOMObject has a static function that can tell us about the active -// object count -STDAPI -DllCanUnloadNow() { - DbgLog((LOG_MEMORY,2,TEXT("DLLCanUnloadNow called - IsLocked = %d, Active objects = %d"), - CClassFactory::IsLocked(), - CBaseObject::ObjectsActive())); - - if(CClassFactory::IsLocked() || CBaseObject::ObjectsActive()) { - return S_FALSE; - } - else { - return S_OK; - } -} - - -// --- standard WIN32 entrypoints -------------------------------------- - - -extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID); - -BOOL WINAPI -DllEntryPoint(HINSTANCE hInstance, ULONG ulReason, LPVOID pv) { -#ifdef DEBUG - extern bool g_fDbgInDllEntryPoint; - g_fDbgInDllEntryPoint = true; -#endif - - switch(ulReason) { - - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hInstance); -#ifdef DEBUG - DbgInitialise(hInstance); -#endif - - { - // The platform identifier is used to work out whether - // full unicode support is available or not. Hence the - // default will be the lowest common denominator - i.e. N/A - g_amPlatform = VER_PLATFORM_WIN32_WINDOWS; // win95 assumed in case GetVersionEx fails - - g_osInfo.dwOSVersionInfoSize = sizeof(g_osInfo); - if(GetVersionEx(&g_osInfo)) { - g_amPlatform = g_osInfo.dwPlatformId; - } - else { - DbgLog((LOG_ERROR, 1, TEXT("Failed to get the OS platform, assuming Win95"))); - } - } - - g_hInst = hInstance; - DllInitClasses(TRUE); - break; - - case DLL_PROCESS_DETACH: - DllInitClasses(FALSE); - -#ifdef DEBUG - if(CBaseObject::ObjectsActive()) { - DbgSetModuleLevel(LOG_MEMORY, 2); - TCHAR szInfo[512]; - extern TCHAR m_ModuleName[]; // Cut down module name - - TCHAR FullName[_MAX_PATH]; // Load the full path and module name - TCHAR *pName; // Searches from the end for a backslash - - GetModuleFileName(NULL,FullName,_MAX_PATH); - pName = _tcsrchr(FullName,'\\'); - if(pName == NULL) { - pName = FullName; - } - else { - pName++; - } - - DWORD cch = wsprintf(szInfo, TEXT("Executable: %s Pid %x Tid %x. "), - pName, GetCurrentProcessId(), GetCurrentThreadId()); - - wsprintf(szInfo+cch, TEXT("Module %s, %d objects left active!"), - m_ModuleName, CBaseObject::ObjectsActive()); - DbgAssert(szInfo, TEXT(__FILE__),__LINE__); - - // If running remotely wait for the Assert to be acknowledged - // before dumping out the object register - DbgDumpObjectRegister(); - } - - DbgTerminate(); -#endif - break; - } - -#ifdef DEBUG - g_fDbgInDllEntryPoint = false; -#endif - return TRUE; -} - - - +//------------------------------------------------------------------------------ +// File: DllEntry.cpp +// +// Desc: DirectShow base classes - implements classes used to support dll +// entry points for COM objects. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + +#ifdef DEBUG +#ifdef UNICODE +#ifndef _UNICODE +#define _UNICODE +#endif // _UNICODE +#endif // UNICODE + +#include +#endif // DEBUG + +extern CFactoryTemplate g_Templates[]; +extern int g_cTemplates; + +HINSTANCE g_hInst; +DWORD g_amPlatform; // VER_PLATFORM_WIN32_WINDOWS etc... (from GetVersionEx) +OSVERSIONINFO g_osInfo; + +// +// an instance of this is created by the DLLGetClassObject entrypoint +// it uses the CFactoryTemplate object it is given to support the +// IClassFactory interface + +class CClassFactory : public IClassFactory, public CBaseObject { + + private: + const CFactoryTemplate *const m_pTemplate; + + ULONG m_cRef; + + static int m_cLocked; + public: + CClassFactory(const CFactoryTemplate *); + + // IUnknown + STDMETHODIMP QueryInterface(REFIID riid, void ** ppv); + STDMETHODIMP_(ULONG)AddRef(); + STDMETHODIMP_(ULONG)Release(); + + // IClassFactory + STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **pv); + STDMETHODIMP LockServer(BOOL fLock); + + // allow DLLGetClassObject to know about global server lock status + static BOOL IsLocked() { + return (m_cLocked > 0); + }; +}; + +// process-wide dll locked state +int CClassFactory::m_cLocked = 0; + +CClassFactory::CClassFactory(const CFactoryTemplate *pTemplate) +: CBaseObject(NAME("Class Factory")) +, m_cRef(0) +, m_pTemplate(pTemplate) { +} + + +STDMETHODIMP +CClassFactory::QueryInterface(REFIID riid,void **ppv) { + CheckPointer(ppv,E_POINTER) + ValidateReadWritePtr(ppv,sizeof(PVOID)); + *ppv = NULL; + + // any interface on this object is the object pointer. + if((riid == IID_IUnknown) || (riid == IID_IClassFactory)) { + *ppv = (LPVOID) this; + // AddRef returned interface pointer + ((LPUNKNOWN) *ppv)->AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + + +STDMETHODIMP_(ULONG) +CClassFactory::AddRef() { + return ++m_cRef; +} + +STDMETHODIMP_(ULONG) +CClassFactory::Release() { + if(--m_cRef == 0) { + delete this; + return 0; + } + else { + return m_cRef; + } +} + +STDMETHODIMP +CClassFactory::CreateInstance( + LPUNKNOWN pUnkOuter, + REFIID riid, + void **pv) { + CheckPointer(pv,E_POINTER) + ValidateReadWritePtr(pv,sizeof(void *)); + + /* Enforce the normal OLE rules regarding interfaces and delegation */ + + if(pUnkOuter != NULL) { + if(IsEqualIID(riid,IID_IUnknown) == FALSE) { + return ResultFromScode(E_NOINTERFACE); + } + } + + /* Create the new object through the derived class's create function */ + + HRESULT hr = NOERROR; + CUnknown *pObj = m_pTemplate->CreateInstance(pUnkOuter, &hr); + + if(pObj == NULL) { + if(SUCCEEDED(hr)) { + hr = E_OUTOFMEMORY; + } + return hr; + } + + /* Delete the object if we got a construction error */ + + if(FAILED(hr)) { + delete pObj; + return hr; + } + + /* Get a reference counted interface on the object */ + + /* We wrap the non-delegating QI with NDAddRef & NDRelease. */ + /* This protects any outer object from being prematurely */ + /* released by an inner object that may have to be created */ + /* in order to supply the requested interface. */ + pObj->NonDelegatingAddRef(); + hr = pObj->NonDelegatingQueryInterface(riid, pv); + pObj->NonDelegatingRelease(); + + /* Note that if NonDelegatingQueryInterface fails, it will */ + /* not increment the ref count, so the NonDelegatingRelease */ + /* will drop the ref back to zero and the object will "self-*/ + /* destruct". Hence we don't need additional tidy-up code */ + /* to cope with NonDelegatingQueryInterface failing. */ + + if(SUCCEEDED(hr)) { + ASSERT(*pv); + } + + return hr; +} + +STDMETHODIMP +CClassFactory::LockServer(BOOL fLock) { + if(fLock) { + m_cLocked++; + } + else { + m_cLocked--; + } + return NOERROR; +} + + +// --- COM entrypoints ----------------------------------------- + +//called by COM to get the class factory object for a given class +STDAPI +DllGetClassObject( + REFCLSID rClsID, + REFIID riid, + void **pv) { + if(!(riid == IID_IUnknown) && !(riid == IID_IClassFactory)) { + return E_NOINTERFACE; + } + + // traverse the array of templates looking for one with this + // class id + for(int i = 0; i < g_cTemplates; i++) { + const CFactoryTemplate * pT = &g_Templates[i]; + if(pT->IsClassID(rClsID)) { + + // found a template - make a class factory based on this + // template + + *pv = (LPVOID) (LPUNKNOWN) new CClassFactory(pT); + if(*pv == NULL) { + return E_OUTOFMEMORY; + } + ((LPUNKNOWN)*pv)->AddRef(); + return NOERROR; + } + } + return CLASS_E_CLASSNOTAVAILABLE; +} + +// +// Call any initialization routines +// +void +DllInitClasses(BOOL bLoading) { + int i; + + // traverse the array of templates calling the init routine + // if they have one + for(i = 0; i < g_cTemplates; i++) { + const CFactoryTemplate * pT = &g_Templates[i]; + if(pT->m_lpfnInit != NULL) { + (*pT->m_lpfnInit)(bLoading, pT->m_ClsID); + } + } + +} + +// called by COM to determine if this dll can be unloaded +// return ok unless there are outstanding objects or a lock requested +// by IClassFactory::LockServer +// +// CClassFactory has a static function that can tell us about the locks, +// and CCOMObject has a static function that can tell us about the active +// object count +STDAPI +DllCanUnloadNow() { + DbgLog((LOG_MEMORY,2,TEXT("DLLCanUnloadNow called - IsLocked = %d, Active objects = %d"), + CClassFactory::IsLocked(), + CBaseObject::ObjectsActive())); + + if(CClassFactory::IsLocked() || CBaseObject::ObjectsActive()) { + return S_FALSE; + } + else { + return S_OK; + } +} + + +// --- standard WIN32 entrypoints -------------------------------------- + + +extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID); + +BOOL WINAPI +DllEntryPoint(HINSTANCE hInstance, ULONG ulReason, LPVOID pv) { +#ifdef DEBUG + extern bool g_fDbgInDllEntryPoint; + g_fDbgInDllEntryPoint = true; +#endif + + switch(ulReason) { + + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hInstance); +#ifdef DEBUG + DbgInitialise(hInstance); +#endif + + { + // The platform identifier is used to work out whether + // full unicode support is available or not. Hence the + // default will be the lowest common denominator - i.e. N/A + g_amPlatform = VER_PLATFORM_WIN32_WINDOWS; // win95 assumed in case GetVersionEx fails + + g_osInfo.dwOSVersionInfoSize = sizeof(g_osInfo); + if(GetVersionEx(&g_osInfo)) { + g_amPlatform = g_osInfo.dwPlatformId; + } + else { + DbgLog((LOG_ERROR, 1, TEXT("Failed to get the OS platform, assuming Win95"))); + } + } + + g_hInst = hInstance; + DllInitClasses(TRUE); + break; + + case DLL_PROCESS_DETACH: + DllInitClasses(FALSE); + +#ifdef DEBUG + if(CBaseObject::ObjectsActive()) { + DbgSetModuleLevel(LOG_MEMORY, 2); + TCHAR szInfo[512]; + extern TCHAR m_ModuleName[]; // Cut down module name + + TCHAR FullName[_MAX_PATH]; // Load the full path and module name + TCHAR *pName; // Searches from the end for a backslash + + GetModuleFileName(NULL,FullName,_MAX_PATH); + pName = _tcsrchr(FullName,'\\'); + if(pName == NULL) { + pName = FullName; + } + else { + pName++; + } + + DWORD cch = wsprintf(szInfo, TEXT("Executable: %s Pid %x Tid %x. "), + pName, GetCurrentProcessId(), GetCurrentThreadId()); + + wsprintf(szInfo+cch, TEXT("Module %s, %d objects left active!"), + m_ModuleName, CBaseObject::ObjectsActive()); + DbgAssert(szInfo, TEXT(__FILE__),__LINE__); + + // If running remotely wait for the Assert to be acknowledged + // before dumping out the object register + DbgDumpObjectRegister(); + } + + DbgTerminate(); +#endif + break; + } + +#ifdef DEBUG + g_fDbgInDllEntryPoint = false; +#endif + return TRUE; +} + + + diff --git a/src/BaseClasses/dllsetup.cpp b/src/BaseClasses/dllsetup.cpp index 88b3a2f689..3a0be6f1ab 100644 --- a/src/BaseClasses/dllsetup.cpp +++ b/src/BaseClasses/dllsetup.cpp @@ -1,651 +1,651 @@ -//------------------------------------------------------------------------------ -// File: DllSetup.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - -//--------------------------------------------------------------------------- -// defines - -#define MAX_KEY_LEN 260 - - -//--------------------------------------------------------------------------- -// externally defined functions/variable - -extern int g_cTemplates; -extern CFactoryTemplate g_Templates[]; - -//--------------------------------------------------------------------------- -// -// EliminateSubKey -// -// Try to enumerate all keys under this one. -// if we find anything, delete it completely. -// Otherwise just delete it. -// -// note - this was pinched/duplicated from -// Filgraph\Mapper.cpp - so should it be in -// a lib somewhere? -// -//--------------------------------------------------------------------------- - -STDAPI -EliminateSubKey( HKEY hkey, LPTSTR strSubKey ) { - HKEY hk; - if(0 == lstrlen(strSubKey)) { - // defensive approach - return E_FAIL; - } - - LONG lreturn = RegOpenKeyEx(hkey - , strSubKey - , 0 - , MAXIMUM_ALLOWED - , &hk); - - ASSERT(lreturn == ERROR_SUCCESS - || lreturn == ERROR_FILE_NOT_FOUND - || lreturn == ERROR_INVALID_HANDLE); - - if(ERROR_SUCCESS == lreturn) { - // Keep on enumerating the first (zero-th) - // key and deleting that - - for(; ;) { - TCHAR Buffer[MAX_KEY_LEN]; - DWORD dw = MAX_KEY_LEN; - FILETIME ft; - - lreturn = RegEnumKeyEx(hk - , 0 - , Buffer - , &dw - , NULL - , NULL - , NULL - , &ft); - - ASSERT(lreturn == ERROR_SUCCESS - || lreturn == ERROR_NO_MORE_ITEMS); - - if(ERROR_SUCCESS == lreturn) { - EliminateSubKey(hk, Buffer); - } - else { - break; - } - } - - RegCloseKey(hk); - RegDeleteKey(hkey, strSubKey); - } - - return NOERROR; -} - - -//--------------------------------------------------------------------------- -// -// AMovieSetupRegisterServer() -// -// registers specfied file "szFileName" as server for -// CLSID "clsServer". A description is also required. -// The ThreadingModel and ServerType are optional, as -// they default to InprocServer32 (i.e. dll) and Both. -// -//--------------------------------------------------------------------------- - -STDAPI -AMovieSetupRegisterServer( CLSID clsServer - , LPCWSTR szDescription - , LPCWSTR szFileName - , LPCWSTR szThreadingModel = L"Both" - , LPCWSTR szServerType = L"InprocServer32" ) { - // temp buffer - // - TCHAR achTemp[MAX_PATH]; - - // convert CLSID uuid to string and write - // out subkey as string - CLSID\{} - // - OLECHAR szCLSID[CHARS_IN_GUID]; - HRESULT hr = StringFromGUID2(clsServer - , szCLSID - , CHARS_IN_GUID); - ASSERT(SUCCEEDED(hr)); - - // create key - // - HKEY hkey; - wsprintf(achTemp, TEXT("CLSID\\%ls"), szCLSID); - LONG lreturn = RegCreateKey(HKEY_CLASSES_ROOT - , (LPCTSTR)achTemp - , &hkey); - if(ERROR_SUCCESS != lreturn) { - return AmHresultFromWin32(lreturn); - } - - // set description string - // - - wsprintf(achTemp, TEXT("%ls"), szDescription); - lreturn = RegSetValue(hkey - , (LPCTSTR)NULL - , REG_SZ - , achTemp - , sizeof(achTemp)/sizeof(achTemp[0])); - if(ERROR_SUCCESS != lreturn) { - RegCloseKey(hkey); - return AmHresultFromWin32(lreturn); - } - - // create CLSID\\{"CLSID"}\\"ServerType" key, - // using key to CLSID\\{"CLSID"} passed back by - // last call to RegCreateKey(). - // - HKEY hsubkey; - - wsprintf(achTemp, TEXT("%ls"), szServerType); - lreturn = RegCreateKey(hkey - , achTemp - , &hsubkey); - if(ERROR_SUCCESS != lreturn) { - RegCloseKey(hkey); - return AmHresultFromWin32(lreturn); - } - - // set Server string - // - wsprintf(achTemp, TEXT("%ls"), szFileName); - lreturn = RegSetValue(hsubkey - , (LPCTSTR)NULL - , REG_SZ - , (LPCTSTR)achTemp - , sizeof(TCHAR) * (lstrlen(achTemp)+1)); - if(ERROR_SUCCESS != lreturn) { - RegCloseKey(hkey); - RegCloseKey(hsubkey); - return AmHresultFromWin32(lreturn); - } - - wsprintf(achTemp, TEXT("%ls"), szThreadingModel); - lreturn = RegSetValueEx(hsubkey - , TEXT("ThreadingModel") - , 0L - , REG_SZ - , (CONST BYTE *)achTemp - , sizeof(TCHAR) * (lstrlen(achTemp)+1)); - - // close hkeys - // - RegCloseKey(hkey); - RegCloseKey(hsubkey); - - // and return - // - return HRESULT_FROM_WIN32(lreturn); - -} - - -//--------------------------------------------------------------------------- -// -// AMovieSetupUnregisterServer() -// -// default ActiveMovie dll setup function -// - to use must be called from an exported -// function named DllRegisterServer() -// -//--------------------------------------------------------------------------- - -STDAPI -AMovieSetupUnregisterServer( CLSID clsServer ) { - // convert CLSID uuid to string and write - // out subkey CLSID\{} - // - OLECHAR szCLSID[CHARS_IN_GUID]; - HRESULT hr = StringFromGUID2(clsServer - , szCLSID - , CHARS_IN_GUID); - ASSERT(SUCCEEDED(hr)); - - TCHAR achBuffer[MAX_KEY_LEN]; - wsprintf(achBuffer, TEXT("CLSID\\%ls"), szCLSID); - - // delete subkey - // - - hr = EliminateSubKey(HKEY_CLASSES_ROOT, achBuffer); - ASSERT(SUCCEEDED(hr)); - - // return - // - return NOERROR; -} - - -//--------------------------------------------------------------------------- -// -// AMovieSetupRegisterFilter through IFilterMapper2 -// -//--------------------------------------------------------------------------- - -STDAPI -AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata - , IFilterMapper2 * pIFM2 - , BOOL bRegister ) { - DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter"))); - - // check we've got data - // - if(NULL == psetupdata) return S_FALSE; - - - // unregister filter - // (as pins are subkeys of filter's CLSID key - // they do not need to be removed separately). - // - DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter"))); - HRESULT hr = pIFM2->UnregisterFilter(0, // default category - 0, // default instance name - *psetupdata->clsID); - - - if(bRegister) { - REGFILTER2 rf2; - rf2.dwVersion = 1; - rf2.dwMerit = psetupdata->dwMerit; - rf2.cPins = psetupdata->nPins; - rf2.rgPins = psetupdata->lpPin; - - // register filter - // - DbgLog((LOG_TRACE, 3, TEXT("= = register filter"))); - hr = pIFM2->RegisterFilter(*psetupdata->clsID - , psetupdata->strName - , 0 // moniker - , 0 // category - , NULL // instance - , &rf2); - } - - // handle one acceptable "error" - that - // of filter not being registered! - // (couldn't find a suitable #define'd - // name for the error!) - // - if(0x80070002 == hr) - return NOERROR; - else - return hr; -} - - -//--------------------------------------------------------------------------- -// -// RegisterAllServers() -// -//--------------------------------------------------------------------------- - -STDAPI -RegisterAllServers( LPCWSTR szFileName, BOOL bRegister ) { - HRESULT hr = NOERROR; - - for(int i = 0; i < g_cTemplates; i++) { - // get i'th template - // - const CFactoryTemplate *pT = &g_Templates[i]; - - DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), - (LPCWSTR)pT->m_Name )); - - // register CLSID and InprocServer32 - // - if(bRegister) { - hr = AMovieSetupRegisterServer(*(pT->m_ClsID) - , (LPCWSTR)pT->m_Name - , szFileName); - } - else { - hr = AMovieSetupUnregisterServer(*(pT->m_ClsID)); - } - - // check final error for this pass - // and break loop if we failed - // - if(FAILED(hr)) - break; - } - - return hr; -} - - -//--------------------------------------------------------------------------- -// -// AMovieDllRegisterServer2() -// -// default ActiveMovie dll setup function -// - to use must be called from an exported -// function named DllRegisterServer() -// -// this function is table driven using the -// static members of the CFactoryTemplate -// class defined in the dll. -// -// it registers the Dll as the InprocServer32 -// and then calls the IAMovieSetup.Register -// method. -// -//--------------------------------------------------------------------------- - -STDAPI -AMovieDllRegisterServer2( BOOL bRegister ) { - HRESULT hr = NOERROR; - - DbgLog((LOG_TRACE, 2, TEXT("AMovieDllRegisterServer2()"))); - - // get file name (where g_hInst is the - // instance handle of the filter dll) - // - WCHAR achFileName[MAX_PATH]; - - // WIN95 doesn't support GetModuleFileNameW - // - { - char achTemp[MAX_PATH]; - - DbgLog((LOG_TRACE, 2, TEXT("- get module file name"))); - - // g_hInst handle is set in our dll entry point. Make sure - // DllEntryPoint in dllentry.cpp is called - ASSERT(g_hInst != 0); - - if(0 == GetModuleFileNameA(g_hInst - , achTemp - , sizeof(achTemp))) { - // we've failed! - DWORD dwerr = GetLastError(); - return AmHresultFromWin32(dwerr); - } - - MultiByteToWideChar(CP_ACP - , 0L - , achTemp - , lstrlenA(achTemp) + 1 - , achFileName - , sizeof(achFileName)/sizeof(TCHAR)); - } - - // - // first registering, register all OLE servers - // - if(bRegister) { - DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers"))); - hr = RegisterAllServers(achFileName, TRUE); - } - - // - // next, register/unregister all filters - // - - if(SUCCEEDED(hr)) { - // init is ref counted so call just in case - // we're being called cold. - // - DbgLog((LOG_TRACE, 2, TEXT("- CoInitialize"))); - hr = CoInitialize((LPVOID)NULL); - ASSERT(SUCCEEDED(hr)); - - // get hold of IFilterMapper2 - // - DbgLog((LOG_TRACE, 2, TEXT("- obtain IFilterMapper2"))); - IFilterMapper2 *pIFM2 = 0; - IFilterMapper *pIFM = 0; - hr = CoCreateInstance(CLSID_FilterMapper2 - , NULL - , CLSCTX_INPROC_SERVER - , IID_IFilterMapper2 - , (void **)&pIFM2); - if(FAILED(hr)) { - DbgLog((LOG_TRACE, 2, TEXT("- trying IFilterMapper instead"))); - - hr = CoCreateInstance(CLSID_FilterMapper, - NULL, - CLSCTX_INPROC_SERVER, - IID_IFilterMapper, - (void **)&pIFM); - } - if(SUCCEEDED(hr)) { - // scan through array of CFactoryTemplates - // registering servers and filters. - // - DbgLog((LOG_TRACE, 2, TEXT("- register Filters"))); - for(int i = 0; i < g_cTemplates; i++) { - // get i'th template - // - const CFactoryTemplate *pT = &g_Templates[i]; - - if(NULL != pT->m_pAMovieSetup_Filter) { - DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), (LPCWSTR)pT->m_Name )); - - if(pIFM2) { - hr = AMovieSetupRegisterFilter2(pT->m_pAMovieSetup_Filter, pIFM2, bRegister); - } - else { - hr = AMovieSetupRegisterFilter(pT->m_pAMovieSetup_Filter, pIFM, bRegister); - } - } - - // check final error for this pass - // and break loop if we failed - // - if(FAILED(hr)) - break; - } - - // release interface - // - if(pIFM2) - pIFM2->Release(); - else - pIFM->Release(); - - } - - // and clear up - // - CoFreeUnusedLibraries(); - CoUninitialize(); - } - - // - // if unregistering, unregister all OLE servers - // - if(SUCCEEDED(hr) && !bRegister) { - DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers"))); - hr = RegisterAllServers(achFileName, FALSE); - } - - DbgLog((LOG_TRACE, 2, TEXT("- return %0x"), hr)); - return hr; -} - - -//--------------------------------------------------------------------------- -// -// AMovieDllRegisterServer() -// -// default ActiveMovie dll setup function -// - to use must be called from an exported -// function named DllRegisterServer() -// -// this function is table driven using the -// static members of the CFactoryTemplate -// class defined in the dll. -// -// it registers the Dll as the InprocServer32 -// and then calls the IAMovieSetup.Register -// method. -// -//--------------------------------------------------------------------------- - - -STDAPI -AMovieDllRegisterServer( void ) { - HRESULT hr = NOERROR; - - // get file name (where g_hInst is the - // instance handle of the filter dll) - // - WCHAR achFileName[MAX_PATH]; - - { - // WIN95 doesn't support GetModuleFileNameW - // - char achTemp[MAX_PATH]; - - if(0 == GetModuleFileNameA(g_hInst - , achTemp - , sizeof(achTemp))) { - // we've failed! - DWORD dwerr = GetLastError(); - return AmHresultFromWin32(dwerr); - } - - MultiByteToWideChar(CP_ACP - , 0L - , achTemp - , lstrlenA(achTemp) + 1 - , achFileName - , sizeof(achFileName)/sizeof(TCHAR)); - } - - // scan through array of CFactoryTemplates - // registering servers and filters. - // - for(int i = 0; i < g_cTemplates; i++) { - // get i'th template - // - const CFactoryTemplate *pT = &g_Templates[i]; - - // register CLSID and InprocServer32 - // - hr = AMovieSetupRegisterServer(*(pT->m_ClsID) - , (LPCWSTR)pT->m_Name - , achFileName); - - // instantiate all servers and get hold of - // IAMovieSetup, if implemented, and call - // IAMovieSetup.Register() method - // - if(SUCCEEDED(hr) && (NULL != pT->m_lpfnNew)) { - // instantiate object - // - PAMOVIESETUP psetup; - hr = CoCreateInstance(*(pT->m_ClsID) - , 0 - , CLSCTX_INPROC_SERVER - , IID_IAMovieSetup - , reinterpret_cast(&psetup)); - if(SUCCEEDED(hr)) { - hr = psetup->Unregister(); - if(SUCCEEDED(hr)) - hr = psetup->Register(); - psetup->Release(); - } - else { - if((E_NOINTERFACE == hr ) - || (VFW_E_NEED_OWNER == hr )) - hr = NOERROR; - } - } - - // check final error for this pass - // and break loop if we failed - // - if(FAILED(hr)) - break; - - } // end-for - - return hr; -} - - -//--------------------------------------------------------------------------- -// -// AMovieDllUnregisterServer() -// -// default ActiveMovie dll uninstall function -// - to use must be called from an exported -// function named DllRegisterServer() -// -// this function is table driven using the -// static members of the CFactoryTemplate -// class defined in the dll. -// -// it calls the IAMovieSetup.Unregister -// method and then unregisters the Dll -// as the InprocServer32 -// -//--------------------------------------------------------------------------- - -STDAPI -AMovieDllUnregisterServer() { - // initialize return code - // - HRESULT hr = NOERROR; - - // scan through CFactory template and unregister - // all OLE servers and filters. - // - for(int i = g_cTemplates; i--;) { - // get i'th template - // - const CFactoryTemplate *pT = &g_Templates[i]; - - // check method exists - // - if(NULL != pT->m_lpfnNew) { - // instantiate object - // - PAMOVIESETUP psetup; - hr = CoCreateInstance(*(pT->m_ClsID) - , 0 - , CLSCTX_INPROC_SERVER - , IID_IAMovieSetup - , reinterpret_cast(&psetup)); - if(SUCCEEDED(hr)) { - hr = psetup->Unregister(); - psetup->Release(); - } - else { - if((E_NOINTERFACE == hr ) - || (VFW_E_NEED_OWNER == hr )) - hr = NOERROR; - } - } - - // unregister CLSID and InprocServer32 - // - if(SUCCEEDED(hr)) { - hr = AMovieSetupUnregisterServer(*(pT->m_ClsID)); - } - - // check final error for this pass - // and break loop if we failed - // - if(FAILED(hr)) - break; - } - - return hr; -} - +//------------------------------------------------------------------------------ +// File: DllSetup.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + +//--------------------------------------------------------------------------- +// defines + +#define MAX_KEY_LEN 260 + + +//--------------------------------------------------------------------------- +// externally defined functions/variable + +extern int g_cTemplates; +extern CFactoryTemplate g_Templates[]; + +//--------------------------------------------------------------------------- +// +// EliminateSubKey +// +// Try to enumerate all keys under this one. +// if we find anything, delete it completely. +// Otherwise just delete it. +// +// note - this was pinched/duplicated from +// Filgraph\Mapper.cpp - so should it be in +// a lib somewhere? +// +//--------------------------------------------------------------------------- + +STDAPI +EliminateSubKey( HKEY hkey, LPTSTR strSubKey ) { + HKEY hk; + if(0 == lstrlen(strSubKey)) { + // defensive approach + return E_FAIL; + } + + LONG lreturn = RegOpenKeyEx(hkey + , strSubKey + , 0 + , MAXIMUM_ALLOWED + , &hk); + + ASSERT(lreturn == ERROR_SUCCESS + || lreturn == ERROR_FILE_NOT_FOUND + || lreturn == ERROR_INVALID_HANDLE); + + if(ERROR_SUCCESS == lreturn) { + // Keep on enumerating the first (zero-th) + // key and deleting that + + for(; ;) { + TCHAR Buffer[MAX_KEY_LEN]; + DWORD dw = MAX_KEY_LEN; + FILETIME ft; + + lreturn = RegEnumKeyEx(hk + , 0 + , Buffer + , &dw + , NULL + , NULL + , NULL + , &ft); + + ASSERT(lreturn == ERROR_SUCCESS + || lreturn == ERROR_NO_MORE_ITEMS); + + if(ERROR_SUCCESS == lreturn) { + EliminateSubKey(hk, Buffer); + } + else { + break; + } + } + + RegCloseKey(hk); + RegDeleteKey(hkey, strSubKey); + } + + return NOERROR; +} + + +//--------------------------------------------------------------------------- +// +// AMovieSetupRegisterServer() +// +// registers specfied file "szFileName" as server for +// CLSID "clsServer". A description is also required. +// The ThreadingModel and ServerType are optional, as +// they default to InprocServer32 (i.e. dll) and Both. +// +//--------------------------------------------------------------------------- + +STDAPI +AMovieSetupRegisterServer( CLSID clsServer + , LPCWSTR szDescription + , LPCWSTR szFileName + , LPCWSTR szThreadingModel = L"Both" + , LPCWSTR szServerType = L"InprocServer32" ) { + // temp buffer + // + TCHAR achTemp[MAX_PATH]; + + // convert CLSID uuid to string and write + // out subkey as string - CLSID\{} + // + OLECHAR szCLSID[CHARS_IN_GUID]; + HRESULT hr = StringFromGUID2(clsServer + , szCLSID + , CHARS_IN_GUID); + ASSERT(SUCCEEDED(hr)); + + // create key + // + HKEY hkey; + wsprintf(achTemp, TEXT("CLSID\\%ls"), szCLSID); + LONG lreturn = RegCreateKey(HKEY_CLASSES_ROOT + , (LPCTSTR)achTemp + , &hkey); + if(ERROR_SUCCESS != lreturn) { + return AmHresultFromWin32(lreturn); + } + + // set description string + // + + wsprintf(achTemp, TEXT("%ls"), szDescription); + lreturn = RegSetValue(hkey + , (LPCTSTR)NULL + , REG_SZ + , achTemp + , sizeof(achTemp)/sizeof(achTemp[0])); + if(ERROR_SUCCESS != lreturn) { + RegCloseKey(hkey); + return AmHresultFromWin32(lreturn); + } + + // create CLSID\\{"CLSID"}\\"ServerType" key, + // using key to CLSID\\{"CLSID"} passed back by + // last call to RegCreateKey(). + // + HKEY hsubkey; + + wsprintf(achTemp, TEXT("%ls"), szServerType); + lreturn = RegCreateKey(hkey + , achTemp + , &hsubkey); + if(ERROR_SUCCESS != lreturn) { + RegCloseKey(hkey); + return AmHresultFromWin32(lreturn); + } + + // set Server string + // + wsprintf(achTemp, TEXT("%ls"), szFileName); + lreturn = RegSetValue(hsubkey + , (LPCTSTR)NULL + , REG_SZ + , (LPCTSTR)achTemp + , sizeof(TCHAR) * (lstrlen(achTemp)+1)); + if(ERROR_SUCCESS != lreturn) { + RegCloseKey(hkey); + RegCloseKey(hsubkey); + return AmHresultFromWin32(lreturn); + } + + wsprintf(achTemp, TEXT("%ls"), szThreadingModel); + lreturn = RegSetValueEx(hsubkey + , TEXT("ThreadingModel") + , 0L + , REG_SZ + , (CONST BYTE *)achTemp + , sizeof(TCHAR) * (lstrlen(achTemp)+1)); + + // close hkeys + // + RegCloseKey(hkey); + RegCloseKey(hsubkey); + + // and return + // + return HRESULT_FROM_WIN32(lreturn); + +} + + +//--------------------------------------------------------------------------- +// +// AMovieSetupUnregisterServer() +// +// default ActiveMovie dll setup function +// - to use must be called from an exported +// function named DllRegisterServer() +// +//--------------------------------------------------------------------------- + +STDAPI +AMovieSetupUnregisterServer( CLSID clsServer ) { + // convert CLSID uuid to string and write + // out subkey CLSID\{} + // + OLECHAR szCLSID[CHARS_IN_GUID]; + HRESULT hr = StringFromGUID2(clsServer + , szCLSID + , CHARS_IN_GUID); + ASSERT(SUCCEEDED(hr)); + + TCHAR achBuffer[MAX_KEY_LEN]; + wsprintf(achBuffer, TEXT("CLSID\\%ls"), szCLSID); + + // delete subkey + // + + hr = EliminateSubKey(HKEY_CLASSES_ROOT, achBuffer); + ASSERT(SUCCEEDED(hr)); + + // return + // + return NOERROR; +} + + +//--------------------------------------------------------------------------- +// +// AMovieSetupRegisterFilter through IFilterMapper2 +// +//--------------------------------------------------------------------------- + +STDAPI +AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata + , IFilterMapper2 * pIFM2 + , BOOL bRegister ) { + DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter"))); + + // check we've got data + // + if(NULL == psetupdata) return S_FALSE; + + + // unregister filter + // (as pins are subkeys of filter's CLSID key + // they do not need to be removed separately). + // + DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter"))); + HRESULT hr = pIFM2->UnregisterFilter(0, // default category + 0, // default instance name + *psetupdata->clsID); + + + if(bRegister) { + REGFILTER2 rf2; + rf2.dwVersion = 1; + rf2.dwMerit = psetupdata->dwMerit; + rf2.cPins = psetupdata->nPins; + rf2.rgPins = psetupdata->lpPin; + + // register filter + // + DbgLog((LOG_TRACE, 3, TEXT("= = register filter"))); + hr = pIFM2->RegisterFilter(*psetupdata->clsID + , psetupdata->strName + , 0 // moniker + , 0 // category + , NULL // instance + , &rf2); + } + + // handle one acceptable "error" - that + // of filter not being registered! + // (couldn't find a suitable #define'd + // name for the error!) + // + if(0x80070002 == hr) + return NOERROR; + else + return hr; +} + + +//--------------------------------------------------------------------------- +// +// RegisterAllServers() +// +//--------------------------------------------------------------------------- + +STDAPI +RegisterAllServers( LPCWSTR szFileName, BOOL bRegister ) { + HRESULT hr = NOERROR; + + for(int i = 0; i < g_cTemplates; i++) { + // get i'th template + // + const CFactoryTemplate *pT = &g_Templates[i]; + + DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), + (LPCWSTR)pT->m_Name )); + + // register CLSID and InprocServer32 + // + if(bRegister) { + hr = AMovieSetupRegisterServer(*(pT->m_ClsID) + , (LPCWSTR)pT->m_Name + , szFileName); + } + else { + hr = AMovieSetupUnregisterServer(*(pT->m_ClsID)); + } + + // check final error for this pass + // and break loop if we failed + // + if(FAILED(hr)) + break; + } + + return hr; +} + + +//--------------------------------------------------------------------------- +// +// AMovieDllRegisterServer2() +// +// default ActiveMovie dll setup function +// - to use must be called from an exported +// function named DllRegisterServer() +// +// this function is table driven using the +// static members of the CFactoryTemplate +// class defined in the dll. +// +// it registers the Dll as the InprocServer32 +// and then calls the IAMovieSetup.Register +// method. +// +//--------------------------------------------------------------------------- + +STDAPI +AMovieDllRegisterServer2( BOOL bRegister ) { + HRESULT hr = NOERROR; + + DbgLog((LOG_TRACE, 2, TEXT("AMovieDllRegisterServer2()"))); + + // get file name (where g_hInst is the + // instance handle of the filter dll) + // + WCHAR achFileName[MAX_PATH]; + + // WIN95 doesn't support GetModuleFileNameW + // + { + char achTemp[MAX_PATH]; + + DbgLog((LOG_TRACE, 2, TEXT("- get module file name"))); + + // g_hInst handle is set in our dll entry point. Make sure + // DllEntryPoint in dllentry.cpp is called + ASSERT(g_hInst != 0); + + if(0 == GetModuleFileNameA(g_hInst + , achTemp + , sizeof(achTemp))) { + // we've failed! + DWORD dwerr = GetLastError(); + return AmHresultFromWin32(dwerr); + } + + MultiByteToWideChar(CP_ACP + , 0L + , achTemp + , lstrlenA(achTemp) + 1 + , achFileName + , sizeof(achFileName)/sizeof(TCHAR)); + } + + // + // first registering, register all OLE servers + // + if(bRegister) { + DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers"))); + hr = RegisterAllServers(achFileName, TRUE); + } + + // + // next, register/unregister all filters + // + + if(SUCCEEDED(hr)) { + // init is ref counted so call just in case + // we're being called cold. + // + DbgLog((LOG_TRACE, 2, TEXT("- CoInitialize"))); + hr = CoInitialize((LPVOID)NULL); + ASSERT(SUCCEEDED(hr)); + + // get hold of IFilterMapper2 + // + DbgLog((LOG_TRACE, 2, TEXT("- obtain IFilterMapper2"))); + IFilterMapper2 *pIFM2 = 0; + IFilterMapper *pIFM = 0; + hr = CoCreateInstance(CLSID_FilterMapper2 + , NULL + , CLSCTX_INPROC_SERVER + , IID_IFilterMapper2 + , (void **)&pIFM2); + if(FAILED(hr)) { + DbgLog((LOG_TRACE, 2, TEXT("- trying IFilterMapper instead"))); + + hr = CoCreateInstance(CLSID_FilterMapper, + NULL, + CLSCTX_INPROC_SERVER, + IID_IFilterMapper, + (void **)&pIFM); + } + if(SUCCEEDED(hr)) { + // scan through array of CFactoryTemplates + // registering servers and filters. + // + DbgLog((LOG_TRACE, 2, TEXT("- register Filters"))); + for(int i = 0; i < g_cTemplates; i++) { + // get i'th template + // + const CFactoryTemplate *pT = &g_Templates[i]; + + if(NULL != pT->m_pAMovieSetup_Filter) { + DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), (LPCWSTR)pT->m_Name )); + + if(pIFM2) { + hr = AMovieSetupRegisterFilter2(pT->m_pAMovieSetup_Filter, pIFM2, bRegister); + } + else { + hr = AMovieSetupRegisterFilter(pT->m_pAMovieSetup_Filter, pIFM, bRegister); + } + } + + // check final error for this pass + // and break loop if we failed + // + if(FAILED(hr)) + break; + } + + // release interface + // + if(pIFM2) + pIFM2->Release(); + else + pIFM->Release(); + + } + + // and clear up + // + CoFreeUnusedLibraries(); + CoUninitialize(); + } + + // + // if unregistering, unregister all OLE servers + // + if(SUCCEEDED(hr) && !bRegister) { + DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers"))); + hr = RegisterAllServers(achFileName, FALSE); + } + + DbgLog((LOG_TRACE, 2, TEXT("- return %0x"), hr)); + return hr; +} + + +//--------------------------------------------------------------------------- +// +// AMovieDllRegisterServer() +// +// default ActiveMovie dll setup function +// - to use must be called from an exported +// function named DllRegisterServer() +// +// this function is table driven using the +// static members of the CFactoryTemplate +// class defined in the dll. +// +// it registers the Dll as the InprocServer32 +// and then calls the IAMovieSetup.Register +// method. +// +//--------------------------------------------------------------------------- + + +STDAPI +AMovieDllRegisterServer( void ) { + HRESULT hr = NOERROR; + + // get file name (where g_hInst is the + // instance handle of the filter dll) + // + WCHAR achFileName[MAX_PATH]; + + { + // WIN95 doesn't support GetModuleFileNameW + // + char achTemp[MAX_PATH]; + + if(0 == GetModuleFileNameA(g_hInst + , achTemp + , sizeof(achTemp))) { + // we've failed! + DWORD dwerr = GetLastError(); + return AmHresultFromWin32(dwerr); + } + + MultiByteToWideChar(CP_ACP + , 0L + , achTemp + , lstrlenA(achTemp) + 1 + , achFileName + , sizeof(achFileName)/sizeof(TCHAR)); + } + + // scan through array of CFactoryTemplates + // registering servers and filters. + // + for(int i = 0; i < g_cTemplates; i++) { + // get i'th template + // + const CFactoryTemplate *pT = &g_Templates[i]; + + // register CLSID and InprocServer32 + // + hr = AMovieSetupRegisterServer(*(pT->m_ClsID) + , (LPCWSTR)pT->m_Name + , achFileName); + + // instantiate all servers and get hold of + // IAMovieSetup, if implemented, and call + // IAMovieSetup.Register() method + // + if(SUCCEEDED(hr) && (NULL != pT->m_lpfnNew)) { + // instantiate object + // + PAMOVIESETUP psetup; + hr = CoCreateInstance(*(pT->m_ClsID) + , 0 + , CLSCTX_INPROC_SERVER + , IID_IAMovieSetup + , reinterpret_cast(&psetup)); + if(SUCCEEDED(hr)) { + hr = psetup->Unregister(); + if(SUCCEEDED(hr)) + hr = psetup->Register(); + psetup->Release(); + } + else { + if((E_NOINTERFACE == hr ) + || (VFW_E_NEED_OWNER == hr )) + hr = NOERROR; + } + } + + // check final error for this pass + // and break loop if we failed + // + if(FAILED(hr)) + break; + + } // end-for + + return hr; +} + + +//--------------------------------------------------------------------------- +// +// AMovieDllUnregisterServer() +// +// default ActiveMovie dll uninstall function +// - to use must be called from an exported +// function named DllRegisterServer() +// +// this function is table driven using the +// static members of the CFactoryTemplate +// class defined in the dll. +// +// it calls the IAMovieSetup.Unregister +// method and then unregisters the Dll +// as the InprocServer32 +// +//--------------------------------------------------------------------------- + +STDAPI +AMovieDllUnregisterServer() { + // initialize return code + // + HRESULT hr = NOERROR; + + // scan through CFactory template and unregister + // all OLE servers and filters. + // + for(int i = g_cTemplates; i--;) { + // get i'th template + // + const CFactoryTemplate *pT = &g_Templates[i]; + + // check method exists + // + if(NULL != pT->m_lpfnNew) { + // instantiate object + // + PAMOVIESETUP psetup; + hr = CoCreateInstance(*(pT->m_ClsID) + , 0 + , CLSCTX_INPROC_SERVER + , IID_IAMovieSetup + , reinterpret_cast(&psetup)); + if(SUCCEEDED(hr)) { + hr = psetup->Unregister(); + psetup->Release(); + } + else { + if((E_NOINTERFACE == hr ) + || (VFW_E_NEED_OWNER == hr )) + hr = NOERROR; + } + } + + // unregister CLSID and InprocServer32 + // + if(SUCCEEDED(hr)) { + hr = AMovieSetupUnregisterServer(*(pT->m_ClsID)); + } + + // check final error for this pass + // and break loop if we failed + // + if(FAILED(hr)) + break; + } + + return hr; +} + diff --git a/src/BaseClasses/dllsetup.h b/src/BaseClasses/dllsetup.h index 4e10d3ee36..310d6717be 100644 --- a/src/BaseClasses/dllsetup.h +++ b/src/BaseClasses/dllsetup.h @@ -1,46 +1,46 @@ -//------------------------------------------------------------------------------ -// File: DllSetup.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// To be self registering, OLE servers must -// export functions named DllRegisterServer -// and DllUnregisterServer. To allow use of -// custom and default implementations the -// defaults are named AMovieDllRegisterServer -// and AMovieDllUnregisterServer. -// -// To the use the default implementation you -// must provide stub functions. -// -// i.e. STDAPI DllRegisterServer() -// { -// return AMovieDllRegisterServer(); -// } -// -// STDAPI DllUnregisterServer() -// { -// return AMovieDllUnregisterServer(); -// } -// -// -// AMovieDllRegisterServer calls IAMovieSetup.Register(), and -// AMovieDllUnregisterServer calls IAMovieSetup.Unregister(). - -STDAPI AMovieDllRegisterServer2( BOOL ); -STDAPI AMovieDllRegisterServer(); -STDAPI AMovieDllUnregisterServer(); - -// helper functions -STDAPI EliminateSubKey( HKEY, LPTSTR ); - - -STDAPI -AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata - , IFilterMapper2 * pIFM2 - , BOOL bRegister ); - +//------------------------------------------------------------------------------ +// File: DllSetup.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// To be self registering, OLE servers must +// export functions named DllRegisterServer +// and DllUnregisterServer. To allow use of +// custom and default implementations the +// defaults are named AMovieDllRegisterServer +// and AMovieDllUnregisterServer. +// +// To the use the default implementation you +// must provide stub functions. +// +// i.e. STDAPI DllRegisterServer() +// { +// return AMovieDllRegisterServer(); +// } +// +// STDAPI DllUnregisterServer() +// { +// return AMovieDllUnregisterServer(); +// } +// +// +// AMovieDllRegisterServer calls IAMovieSetup.Register(), and +// AMovieDllUnregisterServer calls IAMovieSetup.Unregister(). + +STDAPI AMovieDllRegisterServer2( BOOL ); +STDAPI AMovieDllRegisterServer(); +STDAPI AMovieDllUnregisterServer(); + +// helper functions +STDAPI EliminateSubKey( HKEY, LPTSTR ); + + +STDAPI +AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata + , IFilterMapper2 * pIFM2 + , BOOL bRegister ); + diff --git a/src/BaseClasses/dsschedule.h b/src/BaseClasses/dsschedule.h index 747bd6ded1..eddb8cd498 100644 --- a/src/BaseClasses/dsschedule.h +++ b/src/BaseClasses/dsschedule.h @@ -1,132 +1,132 @@ -//------------------------------------------------------------------------------ -// File: DSSchedule.h (replaces DX8's schedule.h) -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __CAMSchedule__ -#define __CAMSchedule__ - -class CAMSchedule : private CBaseObject -{ -public: - virtual ~CAMSchedule(); - // ev is the event we should fire if the advise time needs re-evaluating - CAMSchedule( HANDLE ev ); - - DWORD GetAdviseCount(); - REFERENCE_TIME GetNextAdviseTime(); - - // We need a method for derived classes to add advise packets, we return the cookie - DWORD_PTR AddAdvisePacket( const REFERENCE_TIME & time1, const REFERENCE_TIME & time2, HANDLE h, BOOL periodic ); - // And a way to cancel - HRESULT Unadvise(DWORD_PTR dwAdviseCookie); - - // Tell us the time please, and we'll dispatch the expired events. We return the time of the next event. - // NB: The time returned will be "useless" if you start adding extra Advises. But that's the problem of - // whoever is using this helper class (typically a clock). - REFERENCE_TIME Advise( const REFERENCE_TIME & rtTime ); - - // Get the event handle which will be set if advise time requires re-evaluation. - HANDLE GetEvent() const { return m_ev; } - -private: - // We define the nodes that will be used in our singly linked list - // of advise packets. The list is ordered by time, with the - // elements that will expire first at the front. - class CAdvisePacket - { - public: - CAdvisePacket() - {} - - CAdvisePacket * m_next; - DWORD_PTR m_dwAdviseCookie; - REFERENCE_TIME m_rtEventTime; // Time at which event should be set - REFERENCE_TIME m_rtPeriod; // Periodic time - HANDLE m_hNotify; // Handle to event or semephore - BOOL m_bPeriodic; // TRUE => Periodic event - - CAdvisePacket( CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time) - {} - - void InsertAfter( CAdvisePacket * p ) - { - p->m_next = m_next; - m_next = p; - } - - int IsZ() const // That is, is it the node that represents the end of the list - { - return m_next == 0; - } - - CAdvisePacket * RemoveNext() - { - CAdvisePacket *const next = m_next; - CAdvisePacket *const new_next = next->m_next; - m_next = new_next; - return next; - } - - void DeleteNext() - { - delete RemoveNext(); - } - - CAdvisePacket * Next() const - { - CAdvisePacket * result = m_next; - if (result->IsZ()) result = 0; - return result; - } - - DWORD_PTR Cookie() const - { - return m_dwAdviseCookie; - } - }; - - // Structure is: - // head -> elmt1 -> elmt2 -> z -> null - // So an empty list is: head -> z -> null - // Having head & z as links makes insertaion, - // deletion and shunting much easier. - CAdvisePacket head, z; // z is both a tail and a sentry - - volatile DWORD_PTR m_dwNextCookie; // Strictly increasing - volatile DWORD m_dwAdviseCount; // Number of elements on list - - CCritSec m_Serialize; - - // AddAdvisePacket: adds the packet, returns the cookie (0 if failed) - DWORD_PTR AddAdvisePacket( CAdvisePacket * pPacket ); - // Event that we should set if the packed added above will be the next to fire. - const HANDLE m_ev; - - // A Shunt is where we have changed the first element in the - // list and want it re-evaluating (i.e. repositioned) in - // the list. - void ShuntHead(); - - // Rather than delete advise packets, we cache them for future use - CAdvisePacket * m_pAdviseCache; - DWORD m_dwCacheCount; - enum { dwCacheMax = 5 }; // Don't bother caching more than five - - void Delete( CAdvisePacket * pLink );// This "Delete" will cache the Link - -// Attributes and methods for debugging -public: -#ifdef DEBUG - void DumpLinkedList(); -#else - void DumpLinkedList() {} -#endif - -}; - -#endif // __CAMSchedule__ +//------------------------------------------------------------------------------ +// File: DSSchedule.h (replaces DX8's schedule.h) +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __CAMSchedule__ +#define __CAMSchedule__ + +class CAMSchedule : private CBaseObject +{ +public: + virtual ~CAMSchedule(); + // ev is the event we should fire if the advise time needs re-evaluating + CAMSchedule( HANDLE ev ); + + DWORD GetAdviseCount(); + REFERENCE_TIME GetNextAdviseTime(); + + // We need a method for derived classes to add advise packets, we return the cookie + DWORD_PTR AddAdvisePacket( const REFERENCE_TIME & time1, const REFERENCE_TIME & time2, HANDLE h, BOOL periodic ); + // And a way to cancel + HRESULT Unadvise(DWORD_PTR dwAdviseCookie); + + // Tell us the time please, and we'll dispatch the expired events. We return the time of the next event. + // NB: The time returned will be "useless" if you start adding extra Advises. But that's the problem of + // whoever is using this helper class (typically a clock). + REFERENCE_TIME Advise( const REFERENCE_TIME & rtTime ); + + // Get the event handle which will be set if advise time requires re-evaluation. + HANDLE GetEvent() const { return m_ev; } + +private: + // We define the nodes that will be used in our singly linked list + // of advise packets. The list is ordered by time, with the + // elements that will expire first at the front. + class CAdvisePacket + { + public: + CAdvisePacket() + {} + + CAdvisePacket * m_next; + DWORD_PTR m_dwAdviseCookie; + REFERENCE_TIME m_rtEventTime; // Time at which event should be set + REFERENCE_TIME m_rtPeriod; // Periodic time + HANDLE m_hNotify; // Handle to event or semephore + BOOL m_bPeriodic; // TRUE => Periodic event + + CAdvisePacket( CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time) + {} + + void InsertAfter( CAdvisePacket * p ) + { + p->m_next = m_next; + m_next = p; + } + + int IsZ() const // That is, is it the node that represents the end of the list + { + return m_next == 0; + } + + CAdvisePacket * RemoveNext() + { + CAdvisePacket *const next = m_next; + CAdvisePacket *const new_next = next->m_next; + m_next = new_next; + return next; + } + + void DeleteNext() + { + delete RemoveNext(); + } + + CAdvisePacket * Next() const + { + CAdvisePacket * result = m_next; + if (result->IsZ()) result = 0; + return result; + } + + DWORD_PTR Cookie() const + { + return m_dwAdviseCookie; + } + }; + + // Structure is: + // head -> elmt1 -> elmt2 -> z -> null + // So an empty list is: head -> z -> null + // Having head & z as links makes insertaion, + // deletion and shunting much easier. + CAdvisePacket head, z; // z is both a tail and a sentry + + volatile DWORD_PTR m_dwNextCookie; // Strictly increasing + volatile DWORD m_dwAdviseCount; // Number of elements on list + + CCritSec m_Serialize; + + // AddAdvisePacket: adds the packet, returns the cookie (0 if failed) + DWORD_PTR AddAdvisePacket( CAdvisePacket * pPacket ); + // Event that we should set if the packed added above will be the next to fire. + const HANDLE m_ev; + + // A Shunt is where we have changed the first element in the + // list and want it re-evaluating (i.e. repositioned) in + // the list. + void ShuntHead(); + + // Rather than delete advise packets, we cache them for future use + CAdvisePacket * m_pAdviseCache; + DWORD m_dwCacheCount; + enum { dwCacheMax = 5 }; // Don't bother caching more than five + + void Delete( CAdvisePacket * pLink );// This "Delete" will cache the Link + +// Attributes and methods for debugging +public: +#ifdef DEBUG + void DumpLinkedList(); +#else + void DumpLinkedList() {} +#endif + +}; + +#endif // __CAMSchedule__ diff --git a/src/BaseClasses/fourcc.h b/src/BaseClasses/fourcc.h index ce058b8c5c..5f9d66e120 100644 --- a/src/BaseClasses/fourcc.h +++ b/src/BaseClasses/fourcc.h @@ -1,100 +1,100 @@ -//------------------------------------------------------------------------------ -// File: FourCC.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// FOURCCMap -// -// provides a mapping between old-style multimedia format DWORDs -// and new-style GUIDs. -// -// A range of 4 billion GUIDs has been allocated to ensure that this -// mapping can be done straightforwardly one-to-one in both directions. -// -// January 95 - - -#ifndef __FOURCC__ -#define __FOURCC__ - - -// Multimedia format types are marked with DWORDs built from four 8-bit -// chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include -// a subtype GUID. In order to simplify the mapping, GUIDs in the range: -// XXXXXXXX-0000-0010-8000-00AA00389B71 -// are reserved for FOURCCs. - -class FOURCCMap : public GUID -{ - -public: - FOURCCMap(); - FOURCCMap(DWORD Fourcc); - FOURCCMap(const GUID *); - - DWORD GetFOURCC(void); - void SetFOURCC(DWORD fourcc); - void SetFOURCC(const GUID *); - -private: - void InitGUID(); -}; - -#define GUID_Data2 0 -#define GUID_Data3 0x10 -#define GUID_Data4_1 0xaa000080 -#define GUID_Data4_2 0x719b3800 - -inline void -FOURCCMap::InitGUID() { - Data2 = GUID_Data2; - Data3 = GUID_Data3; - ((DWORD *)Data4)[0] = GUID_Data4_1; - ((DWORD *)Data4)[1] = GUID_Data4_2; -} - -inline -FOURCCMap::FOURCCMap() { - InitGUID(); - SetFOURCC( DWORD(0)); -} - -inline -FOURCCMap::FOURCCMap(DWORD fourcc) -{ - InitGUID(); - SetFOURCC(fourcc); -} - -inline -FOURCCMap::FOURCCMap(const GUID * pGuid) -{ - InitGUID(); - SetFOURCC(pGuid); -} - -inline void -FOURCCMap::SetFOURCC(const GUID * pGuid) -{ - FOURCCMap * p = (FOURCCMap*) pGuid; - SetFOURCC(p->GetFOURCC()); -} - -inline void -FOURCCMap::SetFOURCC(DWORD fourcc) -{ - Data1 = fourcc; -} - -inline DWORD -FOURCCMap::GetFOURCC(void) -{ - return Data1; -} - -#endif /* __FOURCC__ */ - +//------------------------------------------------------------------------------ +// File: FourCC.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// FOURCCMap +// +// provides a mapping between old-style multimedia format DWORDs +// and new-style GUIDs. +// +// A range of 4 billion GUIDs has been allocated to ensure that this +// mapping can be done straightforwardly one-to-one in both directions. +// +// January 95 + + +#ifndef __FOURCC__ +#define __FOURCC__ + + +// Multimedia format types are marked with DWORDs built from four 8-bit +// chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include +// a subtype GUID. In order to simplify the mapping, GUIDs in the range: +// XXXXXXXX-0000-0010-8000-00AA00389B71 +// are reserved for FOURCCs. + +class FOURCCMap : public GUID +{ + +public: + FOURCCMap(); + FOURCCMap(DWORD Fourcc); + FOURCCMap(const GUID *); + + DWORD GetFOURCC(void); + void SetFOURCC(DWORD fourcc); + void SetFOURCC(const GUID *); + +private: + void InitGUID(); +}; + +#define GUID_Data2 0 +#define GUID_Data3 0x10 +#define GUID_Data4_1 0xaa000080 +#define GUID_Data4_2 0x719b3800 + +inline void +FOURCCMap::InitGUID() { + Data2 = GUID_Data2; + Data3 = GUID_Data3; + ((DWORD *)Data4)[0] = GUID_Data4_1; + ((DWORD *)Data4)[1] = GUID_Data4_2; +} + +inline +FOURCCMap::FOURCCMap() { + InitGUID(); + SetFOURCC( DWORD(0)); +} + +inline +FOURCCMap::FOURCCMap(DWORD fourcc) +{ + InitGUID(); + SetFOURCC(fourcc); +} + +inline +FOURCCMap::FOURCCMap(const GUID * pGuid) +{ + InitGUID(); + SetFOURCC(pGuid); +} + +inline void +FOURCCMap::SetFOURCC(const GUID * pGuid) +{ + FOURCCMap * p = (FOURCCMap*) pGuid; + SetFOURCC(p->GetFOURCC()); +} + +inline void +FOURCCMap::SetFOURCC(DWORD fourcc) +{ + Data1 = fourcc; +} + +inline DWORD +FOURCCMap::GetFOURCC(void) +{ + return Data1; +} + +#endif /* __FOURCC__ */ + diff --git a/src/BaseClasses/measure.h b/src/BaseClasses/measure.h index 1d197e3653..a34fb62a0e 100644 --- a/src/BaseClasses/measure.h +++ b/src/BaseClasses/measure.h @@ -1,222 +1,222 @@ -//------------------------------------------------------------------------------ -// File: Measure.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -/* - The idea is to pepper the source code with interesting measurements and - have the last few thousand of these recorded in a circular buffer that - can be post-processed to give interesting numbers. - - WHAT THE LOG LOOKS LIKE: - - Time (sec) Type Delta Incident_Name - 0.055,41 NOTE -. Incident Nine - Another note - 0.055,42 NOTE 0.000,01 Incident Nine - Another note - 0.055,44 NOTE 0.000,02 Incident Nine - Another note - 0.055,45 STOP -. Incident Eight - Also random - 0.055,47 START -. Incident Seven - Random - 0.055,49 NOTE 0.000,05 Incident Nine - Another note - ------- ---------------- - 0.125,60 STOP 0.000,03 Msr_Stop - 0.125,62 START -. Msr_Start - 0.125,63 START -. Incident Two - Start/Stop - 0.125,65 STOP 0.000,03 Msr_Start - 0.125,66 START -. Msr_Stop - 0.125,68 STOP 0.000,05 Incident Two - Start/Stop - 0.125,70 STOP 0.000,04 Msr_Stop - 0.125,72 START -. Msr_Start - 0.125,73 START -. Incident Two - Start/Stop - 0.125,75 STOP 0.000,03 Msr_Start - 0.125,77 START -. Msr_Stop - 0.125,78 STOP 0.000,05 Incident Two - Start/Stop - 0.125,80 STOP 0.000,03 Msr_Stop - 0.125,81 NOTE -. Incident Three - single Note - 0.125,83 START -. Incident Four - Start, no stop - 0.125,85 START -. Incident Five - Single Start/Stop - 0.125,87 STOP 0.000,02 Incident Five - Single Start/Stop - -Number Average StdDev Smallest Largest Incident_Name - 10 0.000,58 0.000,10 0.000,55 0.000,85 Incident One - Note - 50 0.000,05 0.000,00 0.000,05 0.000,05 Incident Two - Start/Stop - 1 -. -. -. -. Incident Three - single Note - 0 -. -. -. -. Incident Four - Start, no stop - 1 0.000,02 -. 0.000,02 0.000,02 Incident Five - Single Start/Stop - 0 -. -. -. -. Incident Six - zero occurrences - 100 0.000,25 0.000,12 0.000,02 0.000,62 Incident Seven - Random - 100 0.000,79 0.000,48 0.000,02 0.001,92 Incident Eight - Also random - 5895 0.000,01 0.000,01 0.000,01 0.000,56 Incident Nine - Another note - 10 0.000,03 0.000,00 0.000,03 0.000,04 Msr_Note - 50 0.000,03 0.000,00 0.000,03 0.000,04 Msr_Start - 50 0.000,04 0.000,03 0.000,03 0.000,31 Msr_Stop - - WHAT IT MEANS: - The log shows what happened and when. Each line shows the time at which - something happened (see WHAT YOU CODE below) what it was that happened - and (if approporate) the time since the corresponding previous event - (that's the delta column). - - The statistics show how many times each event occurred, what the average - delta time was, also the standard deviation, largest and smalles delta. - - WHAT YOU CODE: - - Before anything else executes: - register your ids - - int id1 = Msr_Register("Incident One - Note"); - int id2 = Msr_Register("Incident Two - Start/Stop"); - int id3 = Msr_Register("Incident Three - single Note"); - etc. - - At interesting moments: - - // To measure a repetitive event - e.g. end of bitblt to screen - Msr_Note(Id9); // e.g. "video frame hiting the screen NOW!" - - or - - // To measure an elapsed time e.g. time taken to decode an MPEG B-frame - Msr_Start(Id2); // e.g. "Starting to decode MPEG B-frame" - . . . - MsrStop(Id2); // "Finished MPEG decode" - - At the end: - - HANDLE hFile; - hFile = CreateFile("Perf.log", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); - Msr_Dump(hFile); // This writes the log out to the file - CloseHandle(hFile); - - or - - Msr_Dump(NULL); // This writes it to DbgLog((LOG_TRACE,0, ... )); - // but if you are writing it out to the debugger - // then the times are probably all garbage because - // the debugger can make things run awfully slow. - - A given id should be used either for start / stop or Note calls. If Notes - are mixed in with Starts and Stops their statistics will be gibberish. - - If you code the calls in upper case i.e. MSR_START(idMunge); then you get - macros which will turn into nothing unless PERF is defined. - - You can reset the statistical counts for a given id by calling Reset(Id). - They are reset by default at the start. - It logs Reset as a special incident, so you can see it in the log. - - The log is a circular buffer in storage (to try to minimise disk I/O). - It overwrites the oldest entries once full. The statistics include ALL - incidents since the last Reset, whether still visible in the log or not. -*/ - -#ifndef __MEASURE__ -#define __MEASURE__ - -#ifdef PERF -#define MSR_INIT() Msr_Init() -#define MSR_TERMINATE() Msr_Terminate() -#define MSR_REGISTER(a) Msr_Register(a) -#define MSR_RESET(a) Msr_Reset(a) -#define MSR_CONTROL(a) Msr_Control(a) -#define MSR_START(a) Msr_Start(a) -#define MSR_STOP(a) Msr_Stop(a) -#define MSR_NOTE(a) Msr_Note(a) -#define MSR_INTEGER(a,b) Msr_Integer(a,b) -#define MSR_DUMP(a) Msr_Dump(a) -#define MSR_DUMPSTATS(a) Msr_DumpStats(a) -#else -#define MSR_INIT() ((void)0) -#define MSR_TERMINATE() ((void)0) -#define MSR_REGISTER(a) 0 -#define MSR_RESET(a) ((void)0) -#define MSR_CONTROL(a) ((void)0) -#define MSR_START(a) ((void)0) -#define MSR_STOP(a) ((void)0) -#define MSR_NOTE(a) ((void)0) -#define MSR_INTEGER(a,b) ((void)0) -#define MSR_DUMP(a) ((void)0) -#define MSR_DUMPSTATS(a) ((void)0) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// This must be called first - (called by the DllEntry) - -void WINAPI Msr_Init(void); - - -// Call this last to clean up (or just let it fall off the end - who cares?) - -void WINAPI Msr_Terminate(void); - - -// Call this to get an Id for an "incident" that you can pass to Start, Stop or Note -// everything that's logged is called an "incident". - -int WINAPI Msr_Register(LPTSTR Incident); - - -// Reset the statistical counts for an incident - -void WINAPI Msr_Reset(int Id); - - -// Reset all the counts for all incidents -#define MSR_RESET_ALL 0 -#define MSR_PAUSE 1 -#define MSR_RUN 2 - -void WINAPI Msr_Control(int iAction); - - -// log the start of an operation - -void WINAPI Msr_Start(int Id); - - -// log the end of an operation - -void WINAPI Msr_Stop(int Id); - - -// log a one-off or repetitive operation - -void WINAPI Msr_Note(int Id); - - -// log an integer (on which we can see statistics later) -void WINAPI Msr_Integer(int Id, int n); - - -// print out all the vaialable log (it may have wrapped) and then the statistics. -// When the log wraps you lose log but the statistics are still complete. -// hFIle==NULL => use DbgLog -// otherwise hFile must have come from CreateFile or OpenFile. - -void WINAPI Msr_Dump(HANDLE hFile); - - -// just dump the statistics - never mind the log - -void WINAPI Msr_DumpStats(HANDLE hFile); - -// Type definitions in case you want to declare a pointer to the dump functions -// (makes it a trifle easier to do dynamic linking -// i.e. LoadModule, GetProcAddress and call that) - -// Typedefs so can declare MSR_DUMPPROC *MsrDumpStats; or whatever -typedef void WINAPI MSR_DUMPPROC(HANDLE hFile); -typedef void WINAPI MSR_CONTROLPROC(int iAction); - - -#ifdef __cplusplus -} -#endif - -#endif // __MEASURE__ +//------------------------------------------------------------------------------ +// File: Measure.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +/* + The idea is to pepper the source code with interesting measurements and + have the last few thousand of these recorded in a circular buffer that + can be post-processed to give interesting numbers. + + WHAT THE LOG LOOKS LIKE: + + Time (sec) Type Delta Incident_Name + 0.055,41 NOTE -. Incident Nine - Another note + 0.055,42 NOTE 0.000,01 Incident Nine - Another note + 0.055,44 NOTE 0.000,02 Incident Nine - Another note + 0.055,45 STOP -. Incident Eight - Also random + 0.055,47 START -. Incident Seven - Random + 0.055,49 NOTE 0.000,05 Incident Nine - Another note + ------- ---------------- + 0.125,60 STOP 0.000,03 Msr_Stop + 0.125,62 START -. Msr_Start + 0.125,63 START -. Incident Two - Start/Stop + 0.125,65 STOP 0.000,03 Msr_Start + 0.125,66 START -. Msr_Stop + 0.125,68 STOP 0.000,05 Incident Two - Start/Stop + 0.125,70 STOP 0.000,04 Msr_Stop + 0.125,72 START -. Msr_Start + 0.125,73 START -. Incident Two - Start/Stop + 0.125,75 STOP 0.000,03 Msr_Start + 0.125,77 START -. Msr_Stop + 0.125,78 STOP 0.000,05 Incident Two - Start/Stop + 0.125,80 STOP 0.000,03 Msr_Stop + 0.125,81 NOTE -. Incident Three - single Note + 0.125,83 START -. Incident Four - Start, no stop + 0.125,85 START -. Incident Five - Single Start/Stop + 0.125,87 STOP 0.000,02 Incident Five - Single Start/Stop + +Number Average StdDev Smallest Largest Incident_Name + 10 0.000,58 0.000,10 0.000,55 0.000,85 Incident One - Note + 50 0.000,05 0.000,00 0.000,05 0.000,05 Incident Two - Start/Stop + 1 -. -. -. -. Incident Three - single Note + 0 -. -. -. -. Incident Four - Start, no stop + 1 0.000,02 -. 0.000,02 0.000,02 Incident Five - Single Start/Stop + 0 -. -. -. -. Incident Six - zero occurrences + 100 0.000,25 0.000,12 0.000,02 0.000,62 Incident Seven - Random + 100 0.000,79 0.000,48 0.000,02 0.001,92 Incident Eight - Also random + 5895 0.000,01 0.000,01 0.000,01 0.000,56 Incident Nine - Another note + 10 0.000,03 0.000,00 0.000,03 0.000,04 Msr_Note + 50 0.000,03 0.000,00 0.000,03 0.000,04 Msr_Start + 50 0.000,04 0.000,03 0.000,03 0.000,31 Msr_Stop + + WHAT IT MEANS: + The log shows what happened and when. Each line shows the time at which + something happened (see WHAT YOU CODE below) what it was that happened + and (if approporate) the time since the corresponding previous event + (that's the delta column). + + The statistics show how many times each event occurred, what the average + delta time was, also the standard deviation, largest and smalles delta. + + WHAT YOU CODE: + + Before anything else executes: - register your ids + + int id1 = Msr_Register("Incident One - Note"); + int id2 = Msr_Register("Incident Two - Start/Stop"); + int id3 = Msr_Register("Incident Three - single Note"); + etc. + + At interesting moments: + + // To measure a repetitive event - e.g. end of bitblt to screen + Msr_Note(Id9); // e.g. "video frame hiting the screen NOW!" + + or + + // To measure an elapsed time e.g. time taken to decode an MPEG B-frame + Msr_Start(Id2); // e.g. "Starting to decode MPEG B-frame" + . . . + MsrStop(Id2); // "Finished MPEG decode" + + At the end: + + HANDLE hFile; + hFile = CreateFile("Perf.log", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + Msr_Dump(hFile); // This writes the log out to the file + CloseHandle(hFile); + + or + + Msr_Dump(NULL); // This writes it to DbgLog((LOG_TRACE,0, ... )); + // but if you are writing it out to the debugger + // then the times are probably all garbage because + // the debugger can make things run awfully slow. + + A given id should be used either for start / stop or Note calls. If Notes + are mixed in with Starts and Stops their statistics will be gibberish. + + If you code the calls in upper case i.e. MSR_START(idMunge); then you get + macros which will turn into nothing unless PERF is defined. + + You can reset the statistical counts for a given id by calling Reset(Id). + They are reset by default at the start. + It logs Reset as a special incident, so you can see it in the log. + + The log is a circular buffer in storage (to try to minimise disk I/O). + It overwrites the oldest entries once full. The statistics include ALL + incidents since the last Reset, whether still visible in the log or not. +*/ + +#ifndef __MEASURE__ +#define __MEASURE__ + +#ifdef PERF +#define MSR_INIT() Msr_Init() +#define MSR_TERMINATE() Msr_Terminate() +#define MSR_REGISTER(a) Msr_Register(a) +#define MSR_RESET(a) Msr_Reset(a) +#define MSR_CONTROL(a) Msr_Control(a) +#define MSR_START(a) Msr_Start(a) +#define MSR_STOP(a) Msr_Stop(a) +#define MSR_NOTE(a) Msr_Note(a) +#define MSR_INTEGER(a,b) Msr_Integer(a,b) +#define MSR_DUMP(a) Msr_Dump(a) +#define MSR_DUMPSTATS(a) Msr_DumpStats(a) +#else +#define MSR_INIT() ((void)0) +#define MSR_TERMINATE() ((void)0) +#define MSR_REGISTER(a) 0 +#define MSR_RESET(a) ((void)0) +#define MSR_CONTROL(a) ((void)0) +#define MSR_START(a) ((void)0) +#define MSR_STOP(a) ((void)0) +#define MSR_NOTE(a) ((void)0) +#define MSR_INTEGER(a,b) ((void)0) +#define MSR_DUMP(a) ((void)0) +#define MSR_DUMPSTATS(a) ((void)0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// This must be called first - (called by the DllEntry) + +void WINAPI Msr_Init(void); + + +// Call this last to clean up (or just let it fall off the end - who cares?) + +void WINAPI Msr_Terminate(void); + + +// Call this to get an Id for an "incident" that you can pass to Start, Stop or Note +// everything that's logged is called an "incident". + +int WINAPI Msr_Register(LPTSTR Incident); + + +// Reset the statistical counts for an incident + +void WINAPI Msr_Reset(int Id); + + +// Reset all the counts for all incidents +#define MSR_RESET_ALL 0 +#define MSR_PAUSE 1 +#define MSR_RUN 2 + +void WINAPI Msr_Control(int iAction); + + +// log the start of an operation + +void WINAPI Msr_Start(int Id); + + +// log the end of an operation + +void WINAPI Msr_Stop(int Id); + + +// log a one-off or repetitive operation + +void WINAPI Msr_Note(int Id); + + +// log an integer (on which we can see statistics later) +void WINAPI Msr_Integer(int Id, int n); + + +// print out all the vaialable log (it may have wrapped) and then the statistics. +// When the log wraps you lose log but the statistics are still complete. +// hFIle==NULL => use DbgLog +// otherwise hFile must have come from CreateFile or OpenFile. + +void WINAPI Msr_Dump(HANDLE hFile); + + +// just dump the statistics - never mind the log + +void WINAPI Msr_DumpStats(HANDLE hFile); + +// Type definitions in case you want to declare a pointer to the dump functions +// (makes it a trifle easier to do dynamic linking +// i.e. LoadModule, GetProcAddress and call that) + +// Typedefs so can declare MSR_DUMPPROC *MsrDumpStats; or whatever +typedef void WINAPI MSR_DUMPPROC(HANDLE hFile); +typedef void WINAPI MSR_CONTROLPROC(int iAction); + + +#ifdef __cplusplus +} +#endif + +#endif // __MEASURE__ diff --git a/src/BaseClasses/msgthrd.h b/src/BaseClasses/msgthrd.h index 5c380ba508..75ce5cd61d 100644 --- a/src/BaseClasses/msgthrd.h +++ b/src/BaseClasses/msgthrd.h @@ -1,120 +1,120 @@ -//------------------------------------------------------------------------------ -// File: MsgThrd.h -// -// Desc: DirectShow base classes - provides support for a worker thread -// class to which one can asynchronously post messages. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// Message class - really just a structure. -// -class CMsg { -public: - UINT uMsg; - DWORD dwFlags; - LPVOID lpParam; - CAMEvent *pEvent; - - CMsg(UINT u, DWORD dw, LPVOID lp, CAMEvent *pEvnt) - : uMsg(u), dwFlags(dw), lpParam(lp), pEvent(pEvnt) {} - - CMsg() - : uMsg(0), dwFlags(0L), lpParam(NULL), pEvent(NULL) {} -}; - -// This is the actual thread class. It exports all the usual thread control -// functions. The created thread is different from a normal WIN32 thread in -// that it is prompted to perform particaular tasks by responding to messages -// posted to its message queue. -// -class AM_NOVTABLE CMsgThread { -private: - static DWORD WINAPI DefaultThreadProc(LPVOID lpParam); - DWORD m_ThreadId; - HANDLE m_hThread; - -protected: - - // if you want to override GetThreadMsg to block on other things - // as well as this queue, you need access to this - CGenericList m_ThreadQueue; - CCritSec m_Lock; - HANDLE m_hSem; - LONG m_lWaiting; - -public: - CMsgThread() - : m_ThreadId(0), - m_hThread(NULL), - m_lWaiting(0), - m_hSem(NULL), - // make a list with a cache of 5 items - m_ThreadQueue(NAME("MsgThread list"), 5) - { - } - - ~CMsgThread(); - // override this if you want to block on other things as well - // as the message loop - void virtual GetThreadMsg(CMsg *msg); - - // override this if you want to do something on thread startup - virtual void OnThreadInit() { }; - - BOOL CreateThread(); - - BOOL WaitForThreadExit(LPDWORD lpdwExitCode) { - if (m_hThread != NULL) { - WaitForSingleObject(m_hThread, INFINITE); - return GetExitCodeThread(m_hThread, lpdwExitCode); - } - return FALSE; - } - - DWORD ResumeThread() { - return ::ResumeThread(m_hThread); - } - - DWORD SuspendThread() { - return ::SuspendThread(m_hThread); - } - - int GetThreadPriority() { - return ::GetThreadPriority(m_hThread); - } - - BOOL SetThreadPriority(int nPriority) { - return ::SetThreadPriority(m_hThread, nPriority); - } - - HANDLE GetThreadHandle() { - return m_hThread; - } - - DWORD GetThreadId() { - return m_ThreadId; - } - - - void PutThreadMsg(UINT uMsg, DWORD dwMsgFlags, - LPVOID lpMsgParam, CAMEvent *pEvent = NULL) { - CAutoLock lck(&m_Lock); - CMsg* pMsg = new CMsg(uMsg, dwMsgFlags, lpMsgParam, pEvent); - m_ThreadQueue.AddTail(pMsg); - - if (m_lWaiting != 0) { - ReleaseSemaphore(m_hSem, m_lWaiting, 0); - m_lWaiting = 0; - } - } - - // This is the function prototype of the function that the client - // supplies. It is always called on the created thread, never on - // the creator thread. - // - virtual LRESULT ThreadMessageProc( - UINT uMsg, DWORD dwFlags, LPVOID lpParam, CAMEvent *pEvent) = 0; -}; - +//------------------------------------------------------------------------------ +// File: MsgThrd.h +// +// Desc: DirectShow base classes - provides support for a worker thread +// class to which one can asynchronously post messages. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// Message class - really just a structure. +// +class CMsg { +public: + UINT uMsg; + DWORD dwFlags; + LPVOID lpParam; + CAMEvent *pEvent; + + CMsg(UINT u, DWORD dw, LPVOID lp, CAMEvent *pEvnt) + : uMsg(u), dwFlags(dw), lpParam(lp), pEvent(pEvnt) {} + + CMsg() + : uMsg(0), dwFlags(0L), lpParam(NULL), pEvent(NULL) {} +}; + +// This is the actual thread class. It exports all the usual thread control +// functions. The created thread is different from a normal WIN32 thread in +// that it is prompted to perform particaular tasks by responding to messages +// posted to its message queue. +// +class AM_NOVTABLE CMsgThread { +private: + static DWORD WINAPI DefaultThreadProc(LPVOID lpParam); + DWORD m_ThreadId; + HANDLE m_hThread; + +protected: + + // if you want to override GetThreadMsg to block on other things + // as well as this queue, you need access to this + CGenericList m_ThreadQueue; + CCritSec m_Lock; + HANDLE m_hSem; + LONG m_lWaiting; + +public: + CMsgThread() + : m_ThreadId(0), + m_hThread(NULL), + m_lWaiting(0), + m_hSem(NULL), + // make a list with a cache of 5 items + m_ThreadQueue(NAME("MsgThread list"), 5) + { + } + + ~CMsgThread(); + // override this if you want to block on other things as well + // as the message loop + void virtual GetThreadMsg(CMsg *msg); + + // override this if you want to do something on thread startup + virtual void OnThreadInit() { }; + + BOOL CreateThread(); + + BOOL WaitForThreadExit(LPDWORD lpdwExitCode) { + if (m_hThread != NULL) { + WaitForSingleObject(m_hThread, INFINITE); + return GetExitCodeThread(m_hThread, lpdwExitCode); + } + return FALSE; + } + + DWORD ResumeThread() { + return ::ResumeThread(m_hThread); + } + + DWORD SuspendThread() { + return ::SuspendThread(m_hThread); + } + + int GetThreadPriority() { + return ::GetThreadPriority(m_hThread); + } + + BOOL SetThreadPriority(int nPriority) { + return ::SetThreadPriority(m_hThread, nPriority); + } + + HANDLE GetThreadHandle() { + return m_hThread; + } + + DWORD GetThreadId() { + return m_ThreadId; + } + + + void PutThreadMsg(UINT uMsg, DWORD dwMsgFlags, + LPVOID lpMsgParam, CAMEvent *pEvent = NULL) { + CAutoLock lck(&m_Lock); + CMsg* pMsg = new CMsg(uMsg, dwMsgFlags, lpMsgParam, pEvent); + m_ThreadQueue.AddTail(pMsg); + + if (m_lWaiting != 0) { + ReleaseSemaphore(m_hSem, m_lWaiting, 0); + m_lWaiting = 0; + } + } + + // This is the function prototype of the function that the client + // supplies. It is always called on the created thread, never on + // the creator thread. + // + virtual LRESULT ThreadMessageProc( + UINT uMsg, DWORD dwFlags, LPVOID lpParam, CAMEvent *pEvent) = 0; +}; + diff --git a/src/BaseClasses/mtype.cpp b/src/BaseClasses/mtype.cpp index e625d041a8..a69cac44a5 100644 --- a/src/BaseClasses/mtype.cpp +++ b/src/BaseClasses/mtype.cpp @@ -1,478 +1,478 @@ -//------------------------------------------------------------------------------ -// File: MType.cpp -// -// Desc: DirectShow base classes - implements a class that holds and -// manages media type information. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// helper class that derived pin objects can use to compare media -// types etc. Has same data members as the struct AM_MEDIA_TYPE defined -// in the streams IDL file, but also has (non-virtual) functions - -#include -#include - -CMediaType::~CMediaType(){ - FreeMediaType(*this); -} - - -CMediaType::CMediaType() -{ - InitMediaType(); -} - - -CMediaType::CMediaType(const GUID * type) -{ - InitMediaType(); - majortype = *type; -} - - -// copy constructor does a deep copy of the format block - -CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, HRESULT* phr) -{ - HRESULT hr = CopyMediaType(this, &rt); - if (FAILED(hr) && (NULL != phr)) { - *phr = hr; - } -} - - -CMediaType::CMediaType(const CMediaType& rt, HRESULT* phr) -{ - HRESULT hr = CopyMediaType(this, &rt); - if (FAILED(hr) && (NULL != phr)) { - *phr = hr; - } -} - - -// this class inherits publicly from AM_MEDIA_TYPE so the compiler could generate -// the following assignment operator itself, however it could introduce some -// memory conflicts and leaks in the process because the structure contains -// a dynamically allocated block (pbFormat) which it will not copy correctly - -CMediaType& -CMediaType::operator=(const AM_MEDIA_TYPE& rt) -{ - Set(rt); - return *this; -} - -CMediaType& -CMediaType::operator=(const CMediaType& rt) -{ - *this = (AM_MEDIA_TYPE &) rt; - return *this; -} - -BOOL -CMediaType::operator == (const CMediaType& rt) const -{ - // I don't believe we need to check sample size or - // temporal compression flags, since I think these must - // be represented in the type, subtype and format somehow. They - // are pulled out as separate flags so that people who don't understand - // the particular format representation can still see them, but - // they should duplicate information in the format block. - - return ((IsEqualGUID(majortype,rt.majortype) == TRUE) && - (IsEqualGUID(subtype,rt.subtype) == TRUE) && - (IsEqualGUID(formattype,rt.formattype) == TRUE) && - (cbFormat == rt.cbFormat) && - ( (cbFormat == 0) || - (memcmp(pbFormat, rt.pbFormat, cbFormat) == 0))); -} - - -BOOL -CMediaType::operator != (const CMediaType& rt) const -{ - /* Check to see if they are equal */ - - if (*this == rt) { - return FALSE; - } - return TRUE; -} - - -HRESULT -CMediaType::Set(const CMediaType& rt) -{ - return Set((AM_MEDIA_TYPE &) rt); -} - - -HRESULT -CMediaType::Set(const AM_MEDIA_TYPE& rt) -{ - if (&rt != this) { - FreeMediaType(*this); - HRESULT hr = CopyMediaType(this, &rt); - if (FAILED(hr)) { - return E_OUTOFMEMORY; - } - } - - return S_OK; -} - - -BOOL -CMediaType::IsValid() const -{ - return (!IsEqualGUID(majortype,GUID_NULL)); -} - - -void -CMediaType::SetType(const GUID* ptype) -{ - majortype = *ptype; -} - - -void -CMediaType::SetSubtype(const GUID* ptype) -{ - subtype = *ptype; -} - - -ULONG -CMediaType::GetSampleSize() const { - if (IsFixedSize()) { - return lSampleSize; - } else { - return 0; - } -} - - -void -CMediaType::SetSampleSize(ULONG sz) { - if (sz == 0) { - SetVariableSize(); - } else { - bFixedSizeSamples = TRUE; - lSampleSize = sz; - } -} - - -void -CMediaType::SetVariableSize() { - bFixedSizeSamples = FALSE; -} - - -void -CMediaType::SetTemporalCompression(BOOL bCompressed) { - bTemporalCompression = bCompressed; -} - -BOOL -CMediaType::SetFormat(BYTE * pformat, ULONG cb) -{ - if (NULL == AllocFormatBuffer(cb)) - return(FALSE); - - ASSERT(pbFormat); - memcpy(pbFormat, pformat, cb); - return(TRUE); -} - - -// set the type of the media type format block, this type defines what you -// will actually find in the format pointer. For example FORMAT_VideoInfo or -// FORMAT_WaveFormatEx. In the future this may be an interface pointer to a -// property set. Before sending out media types this should be filled in. - -void -CMediaType::SetFormatType(const GUID *pformattype) -{ - formattype = *pformattype; -} - - -// reset the format buffer - -void CMediaType::ResetFormatBuffer() -{ - if (cbFormat) { - CoTaskMemFree((PVOID)pbFormat); - } - cbFormat = 0; - pbFormat = NULL; -} - - -// allocate length bytes for the format and return a read/write pointer -// If we cannot allocate the new block of memory we return NULL leaving -// the original block of memory untouched (as does ReallocFormatBuffer) - -BYTE* -CMediaType::AllocFormatBuffer(ULONG length) -{ - ASSERT(length); - - // do the types have the same buffer size - - if (cbFormat == length) { - return pbFormat; - } - - // allocate the new format buffer - - BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length); - if (pNewFormat == NULL) { - if (length <= cbFormat) return pbFormat; //reuse the old block anyway. - return NULL; - } - - // delete the old format - - if (cbFormat != 0) { - ASSERT(pbFormat); - CoTaskMemFree((PVOID)pbFormat); - } - - cbFormat = length; - pbFormat = pNewFormat; - return pbFormat; -} - - -// reallocate length bytes for the format and return a read/write pointer -// to it. We keep as much information as we can given the new buffer size -// if this fails the original format buffer is left untouched. The caller -// is responsible for ensuring the size of memory required is non zero - -BYTE* -CMediaType::ReallocFormatBuffer(ULONG length) -{ - ASSERT(length); - - // do the types have the same buffer size - - if (cbFormat == length) { - return pbFormat; - } - - // allocate the new format buffer - - BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length); - if (pNewFormat == NULL) { - if (length <= cbFormat) return pbFormat; //reuse the old block anyway. - return NULL; - } - - // copy any previous format (or part of if new is smaller) - // delete the old format and replace with the new one - - if (cbFormat != 0) { - ASSERT(pbFormat); - memcpy(pNewFormat,pbFormat,min(length,cbFormat)); - CoTaskMemFree((PVOID)pbFormat); - } - - cbFormat = length; - pbFormat = pNewFormat; - return pNewFormat; -} - -// initialise a media type structure - -void CMediaType::InitMediaType() -{ - ZeroMemory((PVOID)this, sizeof(*this)); - lSampleSize = 1; - bFixedSizeSamples = TRUE; -} - - -// a partially specified media type can be passed to IPin::Connect -// as a constraint on the media type used in the connection. -// the type, subtype or format type can be null. -BOOL -CMediaType::IsPartiallySpecified(void) const -{ - if ((majortype == GUID_NULL) || - (formattype == GUID_NULL)) { - return TRUE; - } else { - return FALSE; - } -} - -BOOL -CMediaType::MatchesPartial(const CMediaType* ppartial) const -{ - if ((ppartial->majortype != GUID_NULL) && - (majortype != ppartial->majortype)) { - return FALSE; - } - if ((ppartial->subtype != GUID_NULL) && - (subtype != ppartial->subtype)) { - return FALSE; - } - - if (ppartial->formattype != GUID_NULL) { - // if the format block is specified then it must match exactly - if (formattype != ppartial->formattype) { - return FALSE; - } - if (cbFormat != ppartial->cbFormat) { - return FALSE; - } - if ((cbFormat != 0) && - (memcmp(pbFormat, ppartial->pbFormat, cbFormat) != 0)) { - return FALSE; - } - } - - return TRUE; - -} - - - -// general purpose function to delete a heap allocated AM_MEDIA_TYPE structure -// which is useful when calling IEnumMediaTypes::Next as the interface -// implementation allocates the structures which you must later delete -// the format block may also be a pointer to an interface to release - -void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt) -{ - // allow NULL pointers for coding simplicity - - if (pmt == NULL) { - return; - } - - FreeMediaType(*pmt); - CoTaskMemFree((PVOID)pmt); -} - - -// this also comes in useful when using the IEnumMediaTypes interface so -// that you can copy a media type, you can do nearly the same by creating -// a CMediaType object but as soon as it goes out of scope the destructor -// will delete the memory it allocated (this takes a copy of the memory) - -AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc) -{ - ASSERT(pSrc); - - // Allocate a block of memory for the media type - - AM_MEDIA_TYPE *pMediaType = - (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); - - if (pMediaType == NULL) { - return NULL; - } - // Copy the variable length format block - - HRESULT hr = CopyMediaType(pMediaType,pSrc); - if (FAILED(hr)) { - CoTaskMemFree((PVOID)pMediaType); - return NULL; - } - - return pMediaType; -} - - -// Copy 1 media type to another - -HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource) -{ - // We'll leak if we copy onto one that already exists - there's one - // case we can check like that - copying to itself. - ASSERT(pmtSource != pmtTarget); - *pmtTarget = *pmtSource; - if (pmtSource->cbFormat != 0) { - ASSERT(pmtSource->pbFormat != NULL); - pmtTarget->pbFormat = (PBYTE)CoTaskMemAlloc(pmtSource->cbFormat); - if (pmtTarget->pbFormat == NULL) { - pmtTarget->cbFormat = 0; - return E_OUTOFMEMORY; - } else { - CopyMemory((PVOID)pmtTarget->pbFormat, (PVOID)pmtSource->pbFormat, - pmtTarget->cbFormat); - } - } - if (pmtTarget->pUnk != NULL) { - pmtTarget->pUnk->AddRef(); - } - - return S_OK; -} - -// Free an existing media type (ie free resources it holds) - -void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt) -{ - if (mt.cbFormat != 0) { - CoTaskMemFree((PVOID)mt.pbFormat); - - // Strictly unnecessary but tidier - mt.cbFormat = 0; - mt.pbFormat = NULL; - } - if (mt.pUnk != NULL) { - mt.pUnk->Release(); - mt.pUnk = NULL; - } -} - -// Initialize a media type from a WAVEFORMATEX - -STDAPI CreateAudioMediaType( - const WAVEFORMATEX *pwfx, - AM_MEDIA_TYPE *pmt, - BOOL bSetFormat -) -{ - pmt->majortype = MEDIATYPE_Audio; - if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - pmt->subtype = ((PWAVEFORMATEXTENSIBLE)pwfx)->SubFormat; - } else { - pmt->subtype = FOURCCMap(pwfx->wFormatTag); - } - - pmt->formattype = FORMAT_WaveFormatEx; - pmt->bFixedSizeSamples = TRUE; - pmt->bTemporalCompression = FALSE; - pmt->lSampleSize = pwfx->nBlockAlign; - pmt->pUnk = NULL; - if (bSetFormat) { - if (pwfx->wFormatTag == WAVE_FORMAT_PCM) { - pmt->cbFormat = sizeof(WAVEFORMATEX); - } else { - pmt->cbFormat = sizeof(WAVEFORMATEX) + pwfx->cbSize; - } - pmt->pbFormat = (PBYTE)CoTaskMemAlloc(pmt->cbFormat); - if (pmt->pbFormat == NULL) { - return E_OUTOFMEMORY; - } - if (pwfx->wFormatTag == WAVE_FORMAT_PCM) { - CopyMemory(pmt->pbFormat, pwfx, sizeof(PCMWAVEFORMAT)); - ((WAVEFORMATEX *)pmt->pbFormat)->cbSize = 0; - } else { - CopyMemory(pmt->pbFormat, pwfx, pmt->cbFormat); - } - } - return S_OK; -} - -// eliminate very many spurious warnings from MS compiler -#pragma warning(disable:4514) +//------------------------------------------------------------------------------ +// File: MType.cpp +// +// Desc: DirectShow base classes - implements a class that holds and +// manages media type information. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// helper class that derived pin objects can use to compare media +// types etc. Has same data members as the struct AM_MEDIA_TYPE defined +// in the streams IDL file, but also has (non-virtual) functions + +#include +#include + +CMediaType::~CMediaType(){ + FreeMediaType(*this); +} + + +CMediaType::CMediaType() +{ + InitMediaType(); +} + + +CMediaType::CMediaType(const GUID * type) +{ + InitMediaType(); + majortype = *type; +} + + +// copy constructor does a deep copy of the format block + +CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, HRESULT* phr) +{ + HRESULT hr = CopyMediaType(this, &rt); + if (FAILED(hr) && (NULL != phr)) { + *phr = hr; + } +} + + +CMediaType::CMediaType(const CMediaType& rt, HRESULT* phr) +{ + HRESULT hr = CopyMediaType(this, &rt); + if (FAILED(hr) && (NULL != phr)) { + *phr = hr; + } +} + + +// this class inherits publicly from AM_MEDIA_TYPE so the compiler could generate +// the following assignment operator itself, however it could introduce some +// memory conflicts and leaks in the process because the structure contains +// a dynamically allocated block (pbFormat) which it will not copy correctly + +CMediaType& +CMediaType::operator=(const AM_MEDIA_TYPE& rt) +{ + Set(rt); + return *this; +} + +CMediaType& +CMediaType::operator=(const CMediaType& rt) +{ + *this = (AM_MEDIA_TYPE &) rt; + return *this; +} + +BOOL +CMediaType::operator == (const CMediaType& rt) const +{ + // I don't believe we need to check sample size or + // temporal compression flags, since I think these must + // be represented in the type, subtype and format somehow. They + // are pulled out as separate flags so that people who don't understand + // the particular format representation can still see them, but + // they should duplicate information in the format block. + + return ((IsEqualGUID(majortype,rt.majortype) == TRUE) && + (IsEqualGUID(subtype,rt.subtype) == TRUE) && + (IsEqualGUID(formattype,rt.formattype) == TRUE) && + (cbFormat == rt.cbFormat) && + ( (cbFormat == 0) || + (memcmp(pbFormat, rt.pbFormat, cbFormat) == 0))); +} + + +BOOL +CMediaType::operator != (const CMediaType& rt) const +{ + /* Check to see if they are equal */ + + if (*this == rt) { + return FALSE; + } + return TRUE; +} + + +HRESULT +CMediaType::Set(const CMediaType& rt) +{ + return Set((AM_MEDIA_TYPE &) rt); +} + + +HRESULT +CMediaType::Set(const AM_MEDIA_TYPE& rt) +{ + if (&rt != this) { + FreeMediaType(*this); + HRESULT hr = CopyMediaType(this, &rt); + if (FAILED(hr)) { + return E_OUTOFMEMORY; + } + } + + return S_OK; +} + + +BOOL +CMediaType::IsValid() const +{ + return (!IsEqualGUID(majortype,GUID_NULL)); +} + + +void +CMediaType::SetType(const GUID* ptype) +{ + majortype = *ptype; +} + + +void +CMediaType::SetSubtype(const GUID* ptype) +{ + subtype = *ptype; +} + + +ULONG +CMediaType::GetSampleSize() const { + if (IsFixedSize()) { + return lSampleSize; + } else { + return 0; + } +} + + +void +CMediaType::SetSampleSize(ULONG sz) { + if (sz == 0) { + SetVariableSize(); + } else { + bFixedSizeSamples = TRUE; + lSampleSize = sz; + } +} + + +void +CMediaType::SetVariableSize() { + bFixedSizeSamples = FALSE; +} + + +void +CMediaType::SetTemporalCompression(BOOL bCompressed) { + bTemporalCompression = bCompressed; +} + +BOOL +CMediaType::SetFormat(BYTE * pformat, ULONG cb) +{ + if (NULL == AllocFormatBuffer(cb)) + return(FALSE); + + ASSERT(pbFormat); + memcpy(pbFormat, pformat, cb); + return(TRUE); +} + + +// set the type of the media type format block, this type defines what you +// will actually find in the format pointer. For example FORMAT_VideoInfo or +// FORMAT_WaveFormatEx. In the future this may be an interface pointer to a +// property set. Before sending out media types this should be filled in. + +void +CMediaType::SetFormatType(const GUID *pformattype) +{ + formattype = *pformattype; +} + + +// reset the format buffer + +void CMediaType::ResetFormatBuffer() +{ + if (cbFormat) { + CoTaskMemFree((PVOID)pbFormat); + } + cbFormat = 0; + pbFormat = NULL; +} + + +// allocate length bytes for the format and return a read/write pointer +// If we cannot allocate the new block of memory we return NULL leaving +// the original block of memory untouched (as does ReallocFormatBuffer) + +BYTE* +CMediaType::AllocFormatBuffer(ULONG length) +{ + ASSERT(length); + + // do the types have the same buffer size + + if (cbFormat == length) { + return pbFormat; + } + + // allocate the new format buffer + + BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length); + if (pNewFormat == NULL) { + if (length <= cbFormat) return pbFormat; //reuse the old block anyway. + return NULL; + } + + // delete the old format + + if (cbFormat != 0) { + ASSERT(pbFormat); + CoTaskMemFree((PVOID)pbFormat); + } + + cbFormat = length; + pbFormat = pNewFormat; + return pbFormat; +} + + +// reallocate length bytes for the format and return a read/write pointer +// to it. We keep as much information as we can given the new buffer size +// if this fails the original format buffer is left untouched. The caller +// is responsible for ensuring the size of memory required is non zero + +BYTE* +CMediaType::ReallocFormatBuffer(ULONG length) +{ + ASSERT(length); + + // do the types have the same buffer size + + if (cbFormat == length) { + return pbFormat; + } + + // allocate the new format buffer + + BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length); + if (pNewFormat == NULL) { + if (length <= cbFormat) return pbFormat; //reuse the old block anyway. + return NULL; + } + + // copy any previous format (or part of if new is smaller) + // delete the old format and replace with the new one + + if (cbFormat != 0) { + ASSERT(pbFormat); + memcpy(pNewFormat,pbFormat,min(length,cbFormat)); + CoTaskMemFree((PVOID)pbFormat); + } + + cbFormat = length; + pbFormat = pNewFormat; + return pNewFormat; +} + +// initialise a media type structure + +void CMediaType::InitMediaType() +{ + ZeroMemory((PVOID)this, sizeof(*this)); + lSampleSize = 1; + bFixedSizeSamples = TRUE; +} + + +// a partially specified media type can be passed to IPin::Connect +// as a constraint on the media type used in the connection. +// the type, subtype or format type can be null. +BOOL +CMediaType::IsPartiallySpecified(void) const +{ + if ((majortype == GUID_NULL) || + (formattype == GUID_NULL)) { + return TRUE; + } else { + return FALSE; + } +} + +BOOL +CMediaType::MatchesPartial(const CMediaType* ppartial) const +{ + if ((ppartial->majortype != GUID_NULL) && + (majortype != ppartial->majortype)) { + return FALSE; + } + if ((ppartial->subtype != GUID_NULL) && + (subtype != ppartial->subtype)) { + return FALSE; + } + + if (ppartial->formattype != GUID_NULL) { + // if the format block is specified then it must match exactly + if (formattype != ppartial->formattype) { + return FALSE; + } + if (cbFormat != ppartial->cbFormat) { + return FALSE; + } + if ((cbFormat != 0) && + (memcmp(pbFormat, ppartial->pbFormat, cbFormat) != 0)) { + return FALSE; + } + } + + return TRUE; + +} + + + +// general purpose function to delete a heap allocated AM_MEDIA_TYPE structure +// which is useful when calling IEnumMediaTypes::Next as the interface +// implementation allocates the structures which you must later delete +// the format block may also be a pointer to an interface to release + +void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt) +{ + // allow NULL pointers for coding simplicity + + if (pmt == NULL) { + return; + } + + FreeMediaType(*pmt); + CoTaskMemFree((PVOID)pmt); +} + + +// this also comes in useful when using the IEnumMediaTypes interface so +// that you can copy a media type, you can do nearly the same by creating +// a CMediaType object but as soon as it goes out of scope the destructor +// will delete the memory it allocated (this takes a copy of the memory) + +AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc) +{ + ASSERT(pSrc); + + // Allocate a block of memory for the media type + + AM_MEDIA_TYPE *pMediaType = + (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + + if (pMediaType == NULL) { + return NULL; + } + // Copy the variable length format block + + HRESULT hr = CopyMediaType(pMediaType,pSrc); + if (FAILED(hr)) { + CoTaskMemFree((PVOID)pMediaType); + return NULL; + } + + return pMediaType; +} + + +// Copy 1 media type to another + +HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource) +{ + // We'll leak if we copy onto one that already exists - there's one + // case we can check like that - copying to itself. + ASSERT(pmtSource != pmtTarget); + *pmtTarget = *pmtSource; + if (pmtSource->cbFormat != 0) { + ASSERT(pmtSource->pbFormat != NULL); + pmtTarget->pbFormat = (PBYTE)CoTaskMemAlloc(pmtSource->cbFormat); + if (pmtTarget->pbFormat == NULL) { + pmtTarget->cbFormat = 0; + return E_OUTOFMEMORY; + } else { + CopyMemory((PVOID)pmtTarget->pbFormat, (PVOID)pmtSource->pbFormat, + pmtTarget->cbFormat); + } + } + if (pmtTarget->pUnk != NULL) { + pmtTarget->pUnk->AddRef(); + } + + return S_OK; +} + +// Free an existing media type (ie free resources it holds) + +void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt) +{ + if (mt.cbFormat != 0) { + CoTaskMemFree((PVOID)mt.pbFormat); + + // Strictly unnecessary but tidier + mt.cbFormat = 0; + mt.pbFormat = NULL; + } + if (mt.pUnk != NULL) { + mt.pUnk->Release(); + mt.pUnk = NULL; + } +} + +// Initialize a media type from a WAVEFORMATEX + +STDAPI CreateAudioMediaType( + const WAVEFORMATEX *pwfx, + AM_MEDIA_TYPE *pmt, + BOOL bSetFormat +) +{ + pmt->majortype = MEDIATYPE_Audio; + if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + pmt->subtype = ((PWAVEFORMATEXTENSIBLE)pwfx)->SubFormat; + } else { + pmt->subtype = FOURCCMap(pwfx->wFormatTag); + } + + pmt->formattype = FORMAT_WaveFormatEx; + pmt->bFixedSizeSamples = TRUE; + pmt->bTemporalCompression = FALSE; + pmt->lSampleSize = pwfx->nBlockAlign; + pmt->pUnk = NULL; + if (bSetFormat) { + if (pwfx->wFormatTag == WAVE_FORMAT_PCM) { + pmt->cbFormat = sizeof(WAVEFORMATEX); + } else { + pmt->cbFormat = sizeof(WAVEFORMATEX) + pwfx->cbSize; + } + pmt->pbFormat = (PBYTE)CoTaskMemAlloc(pmt->cbFormat); + if (pmt->pbFormat == NULL) { + return E_OUTOFMEMORY; + } + if (pwfx->wFormatTag == WAVE_FORMAT_PCM) { + CopyMemory(pmt->pbFormat, pwfx, sizeof(PCMWAVEFORMAT)); + ((WAVEFORMATEX *)pmt->pbFormat)->cbSize = 0; + } else { + CopyMemory(pmt->pbFormat, pwfx, pmt->cbFormat); + } + } + return S_OK; +} + +// eliminate very many spurious warnings from MS compiler +#pragma warning(disable:4514) diff --git a/src/BaseClasses/mtype.h b/src/BaseClasses/mtype.h index fd10663de4..9bd770a4ea 100644 --- a/src/BaseClasses/mtype.h +++ b/src/BaseClasses/mtype.h @@ -1,89 +1,89 @@ -//------------------------------------------------------------------------------ -// File: MtType.h -// -// Desc: DirectShow base classes - defines a class that holds and manages -// media type information. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __MTYPE__ -#define __MTYPE__ - -/* Helper class that derived pin objects can use to compare media - types etc. Has same data members as the struct AM_MEDIA_TYPE defined - in the streams IDL file, but also has (non-virtual) functions */ - -class CMediaType : public _AMMediaType { - -public: - - ~CMediaType(); - CMediaType(); - CMediaType(const GUID * majortype); - CMediaType(const AM_MEDIA_TYPE&, HRESULT* phr = NULL); - CMediaType(const CMediaType&, HRESULT* phr = NULL); - - CMediaType& operator=(const CMediaType&); - CMediaType& operator=(const AM_MEDIA_TYPE&); - - BOOL operator == (const CMediaType&) const; - BOOL operator != (const CMediaType&) const; - - HRESULT Set(const CMediaType& rt); - HRESULT Set(const AM_MEDIA_TYPE& rt); - - BOOL IsValid() const; - - const GUID *Type() const { return &majortype;} ; - void SetType(const GUID *); - const GUID *Subtype() const { return &subtype;} ; - void SetSubtype(const GUID *); - - BOOL IsFixedSize() const {return bFixedSizeSamples; }; - BOOL IsTemporalCompressed() const {return bTemporalCompression; }; - ULONG GetSampleSize() const; - - void SetSampleSize(ULONG sz); - void SetVariableSize(); - void SetTemporalCompression(BOOL bCompressed); - - // read/write pointer to format - can't change length without - // calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer - - BYTE* Format() const {return pbFormat; }; - ULONG FormatLength() const { return cbFormat; }; - - void SetFormatType(const GUID *); - const GUID *FormatType() const {return &formattype; }; - BOOL SetFormat(BYTE *pFormat, ULONG length); - void ResetFormatBuffer(); - BYTE* AllocFormatBuffer(ULONG length); - BYTE* ReallocFormatBuffer(ULONG length); - - void InitMediaType(); - - BOOL MatchesPartial(const CMediaType* ppartial) const; - BOOL IsPartiallySpecified(void) const; -}; - - -/* General purpose functions to copy and delete a task allocated AM_MEDIA_TYPE - structure which is useful when using the IEnumMediaFormats interface as - the implementation allocates the structures which you must later delete */ - -void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt); -AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc); -HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource); -void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt); - -// Initialize a media type from a WAVEFORMATEX - -STDAPI CreateAudioMediaType( - const WAVEFORMATEX *pwfx, - AM_MEDIA_TYPE *pmt, - BOOL bSetFormat); - -#endif /* __MTYPE__ */ - +//------------------------------------------------------------------------------ +// File: MtType.h +// +// Desc: DirectShow base classes - defines a class that holds and manages +// media type information. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __MTYPE__ +#define __MTYPE__ + +/* Helper class that derived pin objects can use to compare media + types etc. Has same data members as the struct AM_MEDIA_TYPE defined + in the streams IDL file, but also has (non-virtual) functions */ + +class CMediaType : public _AMMediaType { + +public: + + ~CMediaType(); + CMediaType(); + CMediaType(const GUID * majortype); + CMediaType(const AM_MEDIA_TYPE&, HRESULT* phr = NULL); + CMediaType(const CMediaType&, HRESULT* phr = NULL); + + CMediaType& operator=(const CMediaType&); + CMediaType& operator=(const AM_MEDIA_TYPE&); + + BOOL operator == (const CMediaType&) const; + BOOL operator != (const CMediaType&) const; + + HRESULT Set(const CMediaType& rt); + HRESULT Set(const AM_MEDIA_TYPE& rt); + + BOOL IsValid() const; + + const GUID *Type() const { return &majortype;} ; + void SetType(const GUID *); + const GUID *Subtype() const { return &subtype;} ; + void SetSubtype(const GUID *); + + BOOL IsFixedSize() const {return bFixedSizeSamples; }; + BOOL IsTemporalCompressed() const {return bTemporalCompression; }; + ULONG GetSampleSize() const; + + void SetSampleSize(ULONG sz); + void SetVariableSize(); + void SetTemporalCompression(BOOL bCompressed); + + // read/write pointer to format - can't change length without + // calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer + + BYTE* Format() const {return pbFormat; }; + ULONG FormatLength() const { return cbFormat; }; + + void SetFormatType(const GUID *); + const GUID *FormatType() const {return &formattype; }; + BOOL SetFormat(BYTE *pFormat, ULONG length); + void ResetFormatBuffer(); + BYTE* AllocFormatBuffer(ULONG length); + BYTE* ReallocFormatBuffer(ULONG length); + + void InitMediaType(); + + BOOL MatchesPartial(const CMediaType* ppartial) const; + BOOL IsPartiallySpecified(void) const; +}; + + +/* General purpose functions to copy and delete a task allocated AM_MEDIA_TYPE + structure which is useful when using the IEnumMediaFormats interface as + the implementation allocates the structures which you must later delete */ + +void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt); +AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc); +HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource); +void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt); + +// Initialize a media type from a WAVEFORMATEX + +STDAPI CreateAudioMediaType( + const WAVEFORMATEX *pwfx, + AM_MEDIA_TYPE *pmt, + BOOL bSetFormat); + +#endif /* __MTYPE__ */ + diff --git a/src/BaseClasses/outputq.cpp b/src/BaseClasses/outputq.cpp index 4fac305712..d80d84f45e 100644 --- a/src/BaseClasses/outputq.cpp +++ b/src/BaseClasses/outputq.cpp @@ -1,790 +1,790 @@ -//------------------------------------------------------------------------------ -// File: OutputQ.cpp -// -// Desc: DirectShow base classes - implements COutputQueue class used by an -// output pin which may sometimes want to queue output samples on a -// separate thread and sometimes call Receive() directly on the input -// pin. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - - -// -// COutputQueue Constructor : -// -// Determines if a thread is to be created and creates resources -// -// pInputPin - the downstream input pin we're queueing samples to -// -// phr - changed to a failure code if this function fails -// (otherwise unchanges) -// -// bAuto - Ask pInputPin if it can block in Receive by calling -// its ReceiveCanBlock method and create a thread if -// it can block, otherwise not. -// -// bQueue - if bAuto == FALSE then we create a thread if and only -// if bQueue == TRUE -// -// lBatchSize - work in batches of lBatchSize -// -// bBatchEact - Use exact batch sizes so don't send until the -// batch is full or SendAnyway() is called -// -// lListSize - If we create a thread make the list of samples queued -// to the thread have this size cache -// -// dwPriority - If we create a thread set its priority to this -// -COutputQueue::COutputQueue( - IPin *pInputPin, // Pin to send stuff to - HRESULT *phr, // 'Return code' - BOOL bAuto, // Ask pin if queue or not - BOOL bQueue, // Send through queue - LONG lBatchSize, // Batch - BOOL bBatchExact, // Batch exactly to BatchSize - LONG lListSize, - DWORD dwPriority, - bool bFlushingOpt // flushing optimization - ) : m_lBatchSize(lBatchSize), - m_bBatchExact(bBatchExact && (lBatchSize > 1)), - m_hThread(NULL), - m_hSem(NULL), - m_List(NULL), - m_pPin(pInputPin), - m_ppSamples(NULL), - m_lWaiting(0), - m_pInputPin(NULL), - m_bSendAnyway(FALSE), - m_nBatched(0), - m_bFlushing(FALSE), - m_bFlushed(TRUE), - m_bFlushingOpt(bFlushingOpt), - m_bTerminate(FALSE), - m_hEventPop(NULL), - m_hr(S_OK) { - ASSERT(m_lBatchSize > 0); - - - if(FAILED(*phr)) { - return; - } - - // Check the input pin is OK and cache its IMemInputPin interface - - *phr = pInputPin->QueryInterface(IID_IMemInputPin, (void **)&m_pInputPin); - if(FAILED(*phr)) { - return; - } - - // See if we should ask the downstream pin - - if(bAuto) { - HRESULT hr = m_pInputPin->ReceiveCanBlock(); - if(SUCCEEDED(hr)) { - bQueue = hr == S_OK; - } - } - - // Create our sample batch - - m_ppSamples = new PMEDIASAMPLE[m_lBatchSize]; - if(m_ppSamples == NULL) { - *phr = E_OUTOFMEMORY; - return; - } - - // If we're queueing allocate resources - - if(bQueue) { - DbgLog((LOG_TRACE, 2, TEXT("Creating thread for output pin"))); - m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); - if(m_hSem == NULL) { - DWORD dwError = GetLastError(); - *phr = AmHresultFromWin32(dwError); - return; - } - m_List = new CSampleList(NAME("Sample Queue List"), - lListSize, - FALSE // No lock - ); - if(m_List == NULL) { - *phr = E_OUTOFMEMORY; - return; - } - - - DWORD dwThreadId; - m_hThread = CreateThread(NULL, - 0, - InitialThreadProc, - (LPVOID)this, - 0, - &dwThreadId); - if(m_hThread == NULL) { - DWORD dwError = GetLastError(); - *phr = AmHresultFromWin32(dwError); - return; - } - SetThreadPriority(m_hThread, dwPriority); - } - else { - DbgLog((LOG_TRACE, 2, TEXT("Calling input pin directly - no thread"))); - } -} - -// -// COutputQueuee Destructor : -// -// Free all resources - -// -// Thread, -// Batched samples -// -COutputQueue::~COutputQueue() { - DbgLog((LOG_TRACE, 3, TEXT("COutputQueue::~COutputQueue"))); - /* Free our pointer */ - if(m_pInputPin != NULL) { - m_pInputPin->Release(); - } - if(m_hThread != NULL) { { - CAutoLock lck(this); - m_bTerminate = TRUE; - m_hr = S_FALSE; - NotifyThread(); - } - DbgWaitForSingleObject(m_hThread); - EXECUTE_ASSERT(CloseHandle(m_hThread)); - - // The thread frees the samples when asked to terminate - - ASSERT(m_List->GetCount() == 0); - delete m_List; - } - else { - FreeSamples(); - } - if(m_hSem != NULL) { - EXECUTE_ASSERT(CloseHandle(m_hSem)); - } - delete [] m_ppSamples; -} - -// -// Call the real thread proc as a member function -// -DWORD WINAPI COutputQueue::InitialThreadProc(LPVOID pv) { - HRESULT hrCoInit = CAMThread::CoInitializeHelper(); - - COutputQueue *pSampleQueue = (COutputQueue *)pv; - DWORD dwReturn = pSampleQueue->ThreadProc(); - - if(hrCoInit == S_OK) { - CoUninitialize(); - } - - return dwReturn; -} - -// -// Thread sending the samples downstream : -// -// When there is nothing to do the thread sets m_lWaiting (while -// holding the critical section) and then waits for m_hSem to be -// set (not holding the critical section) -// -DWORD COutputQueue::ThreadProc() { - while(TRUE) { - BOOL bWait = FALSE; - IMediaSample *pSample=0; - LONG lNumberToSend=0; // Local copy - NewSegmentPacket* ppacket=0; - - // - // Get a batch of samples and send it if possible - // In any case exit the loop if there is a control action - // requested - // - { - CAutoLock lck(this); - while(TRUE) { - - if(m_bTerminate) { - FreeSamples(); - return 0; - } - if(m_bFlushing) { - FreeSamples(); - SetEvent(m_evFlushComplete); - } - - // Get a sample off the list - - pSample = m_List->RemoveHead(); - // inform derived class we took something off the queue - if(m_hEventPop) { - //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); - SetEvent(m_hEventPop); - } - - if(pSample != NULL && - !IsSpecialSample(pSample)) { - - // If its just a regular sample just add it to the batch - // and exit the loop if the batch is full - - m_ppSamples[m_nBatched++] = pSample; - if(m_nBatched == m_lBatchSize) { - break; - } - } - else { - - // If there was nothing in the queue and there's nothing - // to send (either because there's nothing or the batch - // isn't full) then prepare to wait - - if(pSample == NULL && - (m_bBatchExact || m_nBatched == 0)) { - - // Tell other thread to set the event when there's - // something do to - - ASSERT(m_lWaiting == 0); - m_lWaiting++; - bWait = TRUE; - } - else { - - // We break out of the loop on SEND_PACKET unless - // there's nothing to send - - if(pSample == SEND_PACKET && m_nBatched == 0) { - continue; - } - - if(pSample == NEW_SEGMENT) { - // now we need the parameters - we are - // guaranteed that the next packet contains them - ppacket = (NewSegmentPacket *) m_List->RemoveHead(); - // we took something off the queue - if(m_hEventPop) { - //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); - SetEvent(m_hEventPop); - } - - ASSERT(ppacket); - } - // EOS_PACKET falls through here and we exit the loop - // In this way it acts like SEND_PACKET - } - break; - } - } - if(!bWait) { - // We look at m_nBatched from the client side so keep - // it up to date inside the critical section - lNumberToSend = m_nBatched; // Local copy - m_nBatched = 0; - } - } - - // Wait for some more data - - if(bWait) { - DbgWaitForSingleObject(m_hSem); - continue; - } - - - - // OK - send it if there's anything to send - // We DON'T check m_bBatchExact here because either we've got - // a full batch or we dropped through because we got - // SEND_PACKET or EOS_PACKET - both of which imply we should - // flush our batch - - if(lNumberToSend != 0) { - long nProcessed; - if(m_hr == S_OK) { - ASSERT(!m_bFlushed); - HRESULT hr = m_pInputPin->ReceiveMultiple(m_ppSamples, - lNumberToSend, - &nProcessed); - /* Don't overwrite a flushing state HRESULT */ - CAutoLock lck(this); - if(m_hr == S_OK) { - m_hr = hr; - } - ASSERT(!m_bFlushed); - } - while(lNumberToSend != 0) { - m_ppSamples[--lNumberToSend]->Release(); - } - if(m_hr != S_OK) { - - // In any case wait for more data - S_OK just - // means there wasn't an error - - DbgLog((LOG_ERROR, 2, TEXT("ReceiveMultiple returned %8.8X"), - m_hr)); - } - } - - // Check for end of stream - - if(pSample == EOS_PACKET) { - - // We don't send even end of stream on if we've previously - // returned something other than S_OK - // This is because in that case the pin which returned - // something other than S_OK should have either sent - // EndOfStream() or notified the filter graph - - if(m_hr == S_OK) { - DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()"))); - HRESULT hr = m_pPin->EndOfStream(); - if(FAILED(hr)) { - DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()"))); - } - } - } - - // Data from a new source - - if(pSample == RESET_PACKET) { - m_hr = S_OK; - SetEvent(m_evFlushComplete); - } - - if(pSample == NEW_SEGMENT) { - m_pPin->NewSegment(ppacket->tStart, ppacket->tStop, ppacket->dRate); - delete ppacket; - } - } -} - -// Send batched stuff anyway -void COutputQueue::SendAnyway() { - if(!IsQueued()) { - - // m_bSendAnyway is a private parameter checked in ReceiveMultiple - - m_bSendAnyway = TRUE; - LONG nProcessed; - ReceiveMultiple(NULL, 0, &nProcessed); - m_bSendAnyway = FALSE; - - } - else { - CAutoLock lck(this); - QueueSample(SEND_PACKET); - NotifyThread(); - } -} - -void -COutputQueue::NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate) { - if(!IsQueued()) { - if(S_OK == m_hr) { - if(m_bBatchExact) { - SendAnyway(); - } - m_pPin->NewSegment(tStart, tStop, dRate); - } - } - else { - if(m_hr == S_OK) { - // - // we need to queue the new segment to appear in order in the - // data, but we need to pass parameters to it. Rather than - // take the hit of wrapping every single sample so we can tell - // special ones apart, we queue special pointers to indicate - // special packets, and we guarantee (by holding the - // critical section) that the packet immediately following a - // NEW_SEGMENT value is a NewSegmentPacket containing the - // parameters. - NewSegmentPacket * ppack = new NewSegmentPacket; - if(ppack == NULL) { - return; - } - ppack->tStart = tStart; - ppack->tStop = tStop; - ppack->dRate = dRate; - - CAutoLock lck(this); - QueueSample(NEW_SEGMENT); - QueueSample((IMediaSample*) ppack); - NotifyThread(); - } - } -} - - -// -// End of Stream is queued to output device -// -void COutputQueue::EOS() { - CAutoLock lck(this); - if(!IsQueued()) { - if(m_bBatchExact) { - SendAnyway(); - } - if(m_hr == S_OK) { - DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()"))); - m_bFlushed = FALSE; - HRESULT hr = m_pPin->EndOfStream(); - if(FAILED(hr)) { - DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()"))); - } - } - } - else { - if(m_hr == S_OK) { - m_bFlushed = FALSE; - QueueSample(EOS_PACKET); - NotifyThread(); - } - } -} - -// -// Flush all the samples in the queue -// -void COutputQueue::BeginFlush() { - if(IsQueued()) { { - CAutoLock lck(this); - - // block receives -- we assume this is done by the - // filter in which we are a component - - // discard all queued data - - m_bFlushing = TRUE; - - // Make sure we discard all samples from now on - - if(m_hr == S_OK) { - m_hr = S_FALSE; - } - - // Optimize so we don't keep calling downstream all the time - - if(m_bFlushed && m_bFlushingOpt) { - return; - } - - // Make sure we really wait for the flush to complete - m_evFlushComplete.Reset(); - - NotifyThread(); - } - - // pass this downstream - - m_pPin->BeginFlush(); - } - else { - // pass downstream first to avoid deadlocks - m_pPin->BeginFlush(); - CAutoLock lck(this); - // discard all queued data - - m_bFlushing = TRUE; - - // Make sure we discard all samples from now on - - if(m_hr == S_OK) { - m_hr = S_FALSE; - } - } - -} - -// -// leave flush mode - pass this downstream -void COutputQueue::EndFlush() { { - CAutoLock lck(this); - ASSERT(m_bFlushing); - if(m_bFlushingOpt && m_bFlushed && IsQueued()) { - m_bFlushing = FALSE; - m_hr = S_OK; - return; - } - } - - // sync with pushing thread -- done in BeginFlush - // ensure no more data to go downstream -- done in BeginFlush - // - // Because we are synching here there is no need to hold the critical - // section (in fact we'd deadlock if we did!) - - if(IsQueued()) { - m_evFlushComplete.Wait(); - } - else { - FreeSamples(); - } - - // Be daring - the caller has guaranteed no samples will arrive - // before EndFlush() returns - - m_bFlushing = FALSE; - m_bFlushed = TRUE; - - // call EndFlush on downstream pins - - m_pPin->EndFlush(); - - m_hr = S_OK; -} - -// COutputQueue::QueueSample -// -// private method to Send a sample to the output queue -// The critical section MUST be held when this is called - -void COutputQueue::QueueSample(IMediaSample *pSample) { - if(NULL == m_List->AddTail(pSample)) { - if(!IsSpecialSample(pSample)) { - pSample->Release(); - } - } -} - -// -// COutputQueue::Receive() -// -// Send a single sample by the multiple sample route -// (NOTE - this could be optimized if necessary) -// -// On return the sample will have been Release()'d -// - -HRESULT COutputQueue::Receive(IMediaSample *pSample) { - LONG nProcessed; - return ReceiveMultiple(&pSample, 1, &nProcessed); -} - -// -// COutputQueue::ReceiveMultiple() -// -// Send a set of samples to the downstream pin -// -// ppSamples - array of samples -// nSamples - how many -// nSamplesProcessed - How many were processed -// -// On return all samples will have been Release()'d -// - -HRESULT COutputQueue::ReceiveMultiple( - IMediaSample **ppSamples, - long nSamples, - long *nSamplesProcessed) { - CAutoLock lck(this); - // Either call directly or queue up the samples - - if(!IsQueued()) { - - // If we already had a bad return code then just return - - if(S_OK != m_hr) { - - // If we've never received anything since the last Flush() - // and the sticky return code is not S_OK we must be - // flushing - // ((!A || B) is equivalent to A implies B) - ASSERT(!m_bFlushed || m_bFlushing); - - // We're supposed to Release() them anyway! - *nSamplesProcessed = 0; - for(int i = 0; i < nSamples; i++) { - DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (direct) : Discarding %d samples code 0x%8.8X"), - nSamples, m_hr)); - ppSamples[i]->Release(); - } - - return m_hr; - } - // - // If we're flushing the sticky return code should be S_FALSE - // - ASSERT(!m_bFlushing); - m_bFlushed = FALSE; - - ASSERT(m_nBatched < m_lBatchSize); - ASSERT(m_nBatched == 0 || m_bBatchExact); - - // Loop processing the samples in batches - - LONG iLost = 0; -/*NABIL: I moved this long declaration out of the for loop, incorrect scope*/ - long iDone; - for(iDone = 0; - iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);) { - - //pragma message (REMIND("Implement threshold scheme")) - ASSERT(m_nBatched < m_lBatchSize); - if(iDone < nSamples) { - m_ppSamples[m_nBatched++] = ppSamples[iDone++]; - } - if(m_nBatched == m_lBatchSize || - nSamples == 0 && (m_bSendAnyway || !m_bBatchExact)) { - LONG nDone; - DbgLog((LOG_TRACE, 4, TEXT("Batching %d samples"), - m_nBatched)); - - if(m_hr == S_OK) { - m_hr = m_pInputPin->ReceiveMultiple(m_ppSamples, - m_nBatched, - &nDone); - } - else { - nDone = 0; - } - iLost += m_nBatched - nDone; - for(LONG i = 0; i < m_nBatched; i++) { - m_ppSamples[i]->Release(); - } - m_nBatched = 0; - } - } - *nSamplesProcessed = iDone - iLost; - if(*nSamplesProcessed < 0) { - *nSamplesProcessed = 0; - } - return m_hr; - } - else { - /* We're sending to our thread */ - - if(m_hr != S_OK) { - *nSamplesProcessed = 0; - DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (queued) : Discarding %d samples code 0x%8.8X"), - nSamples, m_hr)); - for(int i = 0; i < nSamples; i++) { - ppSamples[i]->Release(); - } - return m_hr; - } - m_bFlushed = FALSE; - for(long i = 0; i < nSamples; i++) { - QueueSample(ppSamples[i]); - } - *nSamplesProcessed = nSamples; - if(!m_bBatchExact || - m_nBatched + m_List->GetCount() >= m_lBatchSize) { - NotifyThread(); - } - } - - return S_OK; -} - -// Get ready for new data - cancels sticky m_hr -void COutputQueue::Reset() { - if(!IsQueued()) { - m_hr = S_OK; - } - else { - CAutoLock lck(this); - QueueSample(RESET_PACKET); - NotifyThread(); - m_evFlushComplete.Wait(); - } -} - -// Remove and Release() all queued and Batched samples -void COutputQueue::FreeSamples() { - CAutoLock lck(this); - if(IsQueued()) { - while(TRUE) { - IMediaSample *pSample = m_List->RemoveHead(); - // inform derived class we took something off the queue - if(m_hEventPop) { - //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); - SetEvent(m_hEventPop); - } - - if(pSample == NULL) { - break; - } - if(!IsSpecialSample(pSample)) { - pSample->Release(); - } - else { - if(pSample == NEW_SEGMENT) { - // Free NEW_SEGMENT packet - NewSegmentPacket *ppacket = - (NewSegmentPacket *) m_List->RemoveHead(); - // inform derived class we took something off the queue - if(m_hEventPop) { - //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); - SetEvent(m_hEventPop); - } - - ASSERT(ppacket != NULL); - delete ppacket; - } - } - } - } - for(int i = 0; i < m_nBatched; i++) { - m_ppSamples[i]->Release(); - } - m_nBatched = 0; -} - -// Notify the thread if there is something to do -// -// The critical section MUST be held when this is called -void COutputQueue::NotifyThread() { - // Optimize - no need to signal if it's not waiting - ASSERT(IsQueued()); - if(m_lWaiting) { - ReleaseSemaphore(m_hSem, m_lWaiting, NULL); - m_lWaiting = 0; - } -} - -// See if there's any work to do -// Returns -// TRUE if there is nothing on the queue and nothing in the batch -// and all data has been sent -// FALSE otherwise -// -BOOL COutputQueue::IsIdle() { - CAutoLock lck(this); - - // We're idle if - // there is no thread (!IsQueued()) OR - // the thread is waiting for more work (m_lWaiting != 0) - // AND - // there's nothing in the current batch (m_nBatched == 0) - - if(IsQueued() && m_lWaiting == 0 || m_nBatched != 0) { - return FALSE; - } - else { - - // If we're idle it shouldn't be possible for there - // to be anything on the work queue - ASSERT(!IsQueued() || m_List->GetCount() == 0); - } - - return TRUE; -} - - -void COutputQueue::SetPopEvent(HANDLE hEvent) { - m_hEventPop = hEvent; -} - +//------------------------------------------------------------------------------ +// File: OutputQ.cpp +// +// Desc: DirectShow base classes - implements COutputQueue class used by an +// output pin which may sometimes want to queue output samples on a +// separate thread and sometimes call Receive() directly on the input +// pin. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + + +// +// COutputQueue Constructor : +// +// Determines if a thread is to be created and creates resources +// +// pInputPin - the downstream input pin we're queueing samples to +// +// phr - changed to a failure code if this function fails +// (otherwise unchanges) +// +// bAuto - Ask pInputPin if it can block in Receive by calling +// its ReceiveCanBlock method and create a thread if +// it can block, otherwise not. +// +// bQueue - if bAuto == FALSE then we create a thread if and only +// if bQueue == TRUE +// +// lBatchSize - work in batches of lBatchSize +// +// bBatchEact - Use exact batch sizes so don't send until the +// batch is full or SendAnyway() is called +// +// lListSize - If we create a thread make the list of samples queued +// to the thread have this size cache +// +// dwPriority - If we create a thread set its priority to this +// +COutputQueue::COutputQueue( + IPin *pInputPin, // Pin to send stuff to + HRESULT *phr, // 'Return code' + BOOL bAuto, // Ask pin if queue or not + BOOL bQueue, // Send through queue + LONG lBatchSize, // Batch + BOOL bBatchExact, // Batch exactly to BatchSize + LONG lListSize, + DWORD dwPriority, + bool bFlushingOpt // flushing optimization + ) : m_lBatchSize(lBatchSize), + m_bBatchExact(bBatchExact && (lBatchSize > 1)), + m_hThread(NULL), + m_hSem(NULL), + m_List(NULL), + m_pPin(pInputPin), + m_ppSamples(NULL), + m_lWaiting(0), + m_pInputPin(NULL), + m_bSendAnyway(FALSE), + m_nBatched(0), + m_bFlushing(FALSE), + m_bFlushed(TRUE), + m_bFlushingOpt(bFlushingOpt), + m_bTerminate(FALSE), + m_hEventPop(NULL), + m_hr(S_OK) { + ASSERT(m_lBatchSize > 0); + + + if(FAILED(*phr)) { + return; + } + + // Check the input pin is OK and cache its IMemInputPin interface + + *phr = pInputPin->QueryInterface(IID_IMemInputPin, (void **)&m_pInputPin); + if(FAILED(*phr)) { + return; + } + + // See if we should ask the downstream pin + + if(bAuto) { + HRESULT hr = m_pInputPin->ReceiveCanBlock(); + if(SUCCEEDED(hr)) { + bQueue = hr == S_OK; + } + } + + // Create our sample batch + + m_ppSamples = new PMEDIASAMPLE[m_lBatchSize]; + if(m_ppSamples == NULL) { + *phr = E_OUTOFMEMORY; + return; + } + + // If we're queueing allocate resources + + if(bQueue) { + DbgLog((LOG_TRACE, 2, TEXT("Creating thread for output pin"))); + m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); + if(m_hSem == NULL) { + DWORD dwError = GetLastError(); + *phr = AmHresultFromWin32(dwError); + return; + } + m_List = new CSampleList(NAME("Sample Queue List"), + lListSize, + FALSE // No lock + ); + if(m_List == NULL) { + *phr = E_OUTOFMEMORY; + return; + } + + + DWORD dwThreadId; + m_hThread = CreateThread(NULL, + 0, + InitialThreadProc, + (LPVOID)this, + 0, + &dwThreadId); + if(m_hThread == NULL) { + DWORD dwError = GetLastError(); + *phr = AmHresultFromWin32(dwError); + return; + } + SetThreadPriority(m_hThread, dwPriority); + } + else { + DbgLog((LOG_TRACE, 2, TEXT("Calling input pin directly - no thread"))); + } +} + +// +// COutputQueuee Destructor : +// +// Free all resources - +// +// Thread, +// Batched samples +// +COutputQueue::~COutputQueue() { + DbgLog((LOG_TRACE, 3, TEXT("COutputQueue::~COutputQueue"))); + /* Free our pointer */ + if(m_pInputPin != NULL) { + m_pInputPin->Release(); + } + if(m_hThread != NULL) { { + CAutoLock lck(this); + m_bTerminate = TRUE; + m_hr = S_FALSE; + NotifyThread(); + } + DbgWaitForSingleObject(m_hThread); + EXECUTE_ASSERT(CloseHandle(m_hThread)); + + // The thread frees the samples when asked to terminate + + ASSERT(m_List->GetCount() == 0); + delete m_List; + } + else { + FreeSamples(); + } + if(m_hSem != NULL) { + EXECUTE_ASSERT(CloseHandle(m_hSem)); + } + delete [] m_ppSamples; +} + +// +// Call the real thread proc as a member function +// +DWORD WINAPI COutputQueue::InitialThreadProc(LPVOID pv) { + HRESULT hrCoInit = CAMThread::CoInitializeHelper(); + + COutputQueue *pSampleQueue = (COutputQueue *)pv; + DWORD dwReturn = pSampleQueue->ThreadProc(); + + if(hrCoInit == S_OK) { + CoUninitialize(); + } + + return dwReturn; +} + +// +// Thread sending the samples downstream : +// +// When there is nothing to do the thread sets m_lWaiting (while +// holding the critical section) and then waits for m_hSem to be +// set (not holding the critical section) +// +DWORD COutputQueue::ThreadProc() { + while(TRUE) { + BOOL bWait = FALSE; + IMediaSample *pSample=0; + LONG lNumberToSend=0; // Local copy + NewSegmentPacket* ppacket=0; + + // + // Get a batch of samples and send it if possible + // In any case exit the loop if there is a control action + // requested + // + { + CAutoLock lck(this); + while(TRUE) { + + if(m_bTerminate) { + FreeSamples(); + return 0; + } + if(m_bFlushing) { + FreeSamples(); + SetEvent(m_evFlushComplete); + } + + // Get a sample off the list + + pSample = m_List->RemoveHead(); + // inform derived class we took something off the queue + if(m_hEventPop) { + //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); + SetEvent(m_hEventPop); + } + + if(pSample != NULL && + !IsSpecialSample(pSample)) { + + // If its just a regular sample just add it to the batch + // and exit the loop if the batch is full + + m_ppSamples[m_nBatched++] = pSample; + if(m_nBatched == m_lBatchSize) { + break; + } + } + else { + + // If there was nothing in the queue and there's nothing + // to send (either because there's nothing or the batch + // isn't full) then prepare to wait + + if(pSample == NULL && + (m_bBatchExact || m_nBatched == 0)) { + + // Tell other thread to set the event when there's + // something do to + + ASSERT(m_lWaiting == 0); + m_lWaiting++; + bWait = TRUE; + } + else { + + // We break out of the loop on SEND_PACKET unless + // there's nothing to send + + if(pSample == SEND_PACKET && m_nBatched == 0) { + continue; + } + + if(pSample == NEW_SEGMENT) { + // now we need the parameters - we are + // guaranteed that the next packet contains them + ppacket = (NewSegmentPacket *) m_List->RemoveHead(); + // we took something off the queue + if(m_hEventPop) { + //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); + SetEvent(m_hEventPop); + } + + ASSERT(ppacket); + } + // EOS_PACKET falls through here and we exit the loop + // In this way it acts like SEND_PACKET + } + break; + } + } + if(!bWait) { + // We look at m_nBatched from the client side so keep + // it up to date inside the critical section + lNumberToSend = m_nBatched; // Local copy + m_nBatched = 0; + } + } + + // Wait for some more data + + if(bWait) { + DbgWaitForSingleObject(m_hSem); + continue; + } + + + + // OK - send it if there's anything to send + // We DON'T check m_bBatchExact here because either we've got + // a full batch or we dropped through because we got + // SEND_PACKET or EOS_PACKET - both of which imply we should + // flush our batch + + if(lNumberToSend != 0) { + long nProcessed; + if(m_hr == S_OK) { + ASSERT(!m_bFlushed); + HRESULT hr = m_pInputPin->ReceiveMultiple(m_ppSamples, + lNumberToSend, + &nProcessed); + /* Don't overwrite a flushing state HRESULT */ + CAutoLock lck(this); + if(m_hr == S_OK) { + m_hr = hr; + } + ASSERT(!m_bFlushed); + } + while(lNumberToSend != 0) { + m_ppSamples[--lNumberToSend]->Release(); + } + if(m_hr != S_OK) { + + // In any case wait for more data - S_OK just + // means there wasn't an error + + DbgLog((LOG_ERROR, 2, TEXT("ReceiveMultiple returned %8.8X"), + m_hr)); + } + } + + // Check for end of stream + + if(pSample == EOS_PACKET) { + + // We don't send even end of stream on if we've previously + // returned something other than S_OK + // This is because in that case the pin which returned + // something other than S_OK should have either sent + // EndOfStream() or notified the filter graph + + if(m_hr == S_OK) { + DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()"))); + HRESULT hr = m_pPin->EndOfStream(); + if(FAILED(hr)) { + DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()"))); + } + } + } + + // Data from a new source + + if(pSample == RESET_PACKET) { + m_hr = S_OK; + SetEvent(m_evFlushComplete); + } + + if(pSample == NEW_SEGMENT) { + m_pPin->NewSegment(ppacket->tStart, ppacket->tStop, ppacket->dRate); + delete ppacket; + } + } +} + +// Send batched stuff anyway +void COutputQueue::SendAnyway() { + if(!IsQueued()) { + + // m_bSendAnyway is a private parameter checked in ReceiveMultiple + + m_bSendAnyway = TRUE; + LONG nProcessed; + ReceiveMultiple(NULL, 0, &nProcessed); + m_bSendAnyway = FALSE; + + } + else { + CAutoLock lck(this); + QueueSample(SEND_PACKET); + NotifyThread(); + } +} + +void +COutputQueue::NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate) { + if(!IsQueued()) { + if(S_OK == m_hr) { + if(m_bBatchExact) { + SendAnyway(); + } + m_pPin->NewSegment(tStart, tStop, dRate); + } + } + else { + if(m_hr == S_OK) { + // + // we need to queue the new segment to appear in order in the + // data, but we need to pass parameters to it. Rather than + // take the hit of wrapping every single sample so we can tell + // special ones apart, we queue special pointers to indicate + // special packets, and we guarantee (by holding the + // critical section) that the packet immediately following a + // NEW_SEGMENT value is a NewSegmentPacket containing the + // parameters. + NewSegmentPacket * ppack = new NewSegmentPacket; + if(ppack == NULL) { + return; + } + ppack->tStart = tStart; + ppack->tStop = tStop; + ppack->dRate = dRate; + + CAutoLock lck(this); + QueueSample(NEW_SEGMENT); + QueueSample((IMediaSample*) ppack); + NotifyThread(); + } + } +} + + +// +// End of Stream is queued to output device +// +void COutputQueue::EOS() { + CAutoLock lck(this); + if(!IsQueued()) { + if(m_bBatchExact) { + SendAnyway(); + } + if(m_hr == S_OK) { + DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()"))); + m_bFlushed = FALSE; + HRESULT hr = m_pPin->EndOfStream(); + if(FAILED(hr)) { + DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()"))); + } + } + } + else { + if(m_hr == S_OK) { + m_bFlushed = FALSE; + QueueSample(EOS_PACKET); + NotifyThread(); + } + } +} + +// +// Flush all the samples in the queue +// +void COutputQueue::BeginFlush() { + if(IsQueued()) { { + CAutoLock lck(this); + + // block receives -- we assume this is done by the + // filter in which we are a component + + // discard all queued data + + m_bFlushing = TRUE; + + // Make sure we discard all samples from now on + + if(m_hr == S_OK) { + m_hr = S_FALSE; + } + + // Optimize so we don't keep calling downstream all the time + + if(m_bFlushed && m_bFlushingOpt) { + return; + } + + // Make sure we really wait for the flush to complete + m_evFlushComplete.Reset(); + + NotifyThread(); + } + + // pass this downstream + + m_pPin->BeginFlush(); + } + else { + // pass downstream first to avoid deadlocks + m_pPin->BeginFlush(); + CAutoLock lck(this); + // discard all queued data + + m_bFlushing = TRUE; + + // Make sure we discard all samples from now on + + if(m_hr == S_OK) { + m_hr = S_FALSE; + } + } + +} + +// +// leave flush mode - pass this downstream +void COutputQueue::EndFlush() { { + CAutoLock lck(this); + ASSERT(m_bFlushing); + if(m_bFlushingOpt && m_bFlushed && IsQueued()) { + m_bFlushing = FALSE; + m_hr = S_OK; + return; + } + } + + // sync with pushing thread -- done in BeginFlush + // ensure no more data to go downstream -- done in BeginFlush + // + // Because we are synching here there is no need to hold the critical + // section (in fact we'd deadlock if we did!) + + if(IsQueued()) { + m_evFlushComplete.Wait(); + } + else { + FreeSamples(); + } + + // Be daring - the caller has guaranteed no samples will arrive + // before EndFlush() returns + + m_bFlushing = FALSE; + m_bFlushed = TRUE; + + // call EndFlush on downstream pins + + m_pPin->EndFlush(); + + m_hr = S_OK; +} + +// COutputQueue::QueueSample +// +// private method to Send a sample to the output queue +// The critical section MUST be held when this is called + +void COutputQueue::QueueSample(IMediaSample *pSample) { + if(NULL == m_List->AddTail(pSample)) { + if(!IsSpecialSample(pSample)) { + pSample->Release(); + } + } +} + +// +// COutputQueue::Receive() +// +// Send a single sample by the multiple sample route +// (NOTE - this could be optimized if necessary) +// +// On return the sample will have been Release()'d +// + +HRESULT COutputQueue::Receive(IMediaSample *pSample) { + LONG nProcessed; + return ReceiveMultiple(&pSample, 1, &nProcessed); +} + +// +// COutputQueue::ReceiveMultiple() +// +// Send a set of samples to the downstream pin +// +// ppSamples - array of samples +// nSamples - how many +// nSamplesProcessed - How many were processed +// +// On return all samples will have been Release()'d +// + +HRESULT COutputQueue::ReceiveMultiple( + IMediaSample **ppSamples, + long nSamples, + long *nSamplesProcessed) { + CAutoLock lck(this); + // Either call directly or queue up the samples + + if(!IsQueued()) { + + // If we already had a bad return code then just return + + if(S_OK != m_hr) { + + // If we've never received anything since the last Flush() + // and the sticky return code is not S_OK we must be + // flushing + // ((!A || B) is equivalent to A implies B) + ASSERT(!m_bFlushed || m_bFlushing); + + // We're supposed to Release() them anyway! + *nSamplesProcessed = 0; + for(int i = 0; i < nSamples; i++) { + DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (direct) : Discarding %d samples code 0x%8.8X"), + nSamples, m_hr)); + ppSamples[i]->Release(); + } + + return m_hr; + } + // + // If we're flushing the sticky return code should be S_FALSE + // + ASSERT(!m_bFlushing); + m_bFlushed = FALSE; + + ASSERT(m_nBatched < m_lBatchSize); + ASSERT(m_nBatched == 0 || m_bBatchExact); + + // Loop processing the samples in batches + + LONG iLost = 0; +/*NABIL: I moved this long declaration out of the for loop, incorrect scope*/ + long iDone; + for(iDone = 0; + iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);) { + + //pragma message (REMIND("Implement threshold scheme")) + ASSERT(m_nBatched < m_lBatchSize); + if(iDone < nSamples) { + m_ppSamples[m_nBatched++] = ppSamples[iDone++]; + } + if(m_nBatched == m_lBatchSize || + nSamples == 0 && (m_bSendAnyway || !m_bBatchExact)) { + LONG nDone; + DbgLog((LOG_TRACE, 4, TEXT("Batching %d samples"), + m_nBatched)); + + if(m_hr == S_OK) { + m_hr = m_pInputPin->ReceiveMultiple(m_ppSamples, + m_nBatched, + &nDone); + } + else { + nDone = 0; + } + iLost += m_nBatched - nDone; + for(LONG i = 0; i < m_nBatched; i++) { + m_ppSamples[i]->Release(); + } + m_nBatched = 0; + } + } + *nSamplesProcessed = iDone - iLost; + if(*nSamplesProcessed < 0) { + *nSamplesProcessed = 0; + } + return m_hr; + } + else { + /* We're sending to our thread */ + + if(m_hr != S_OK) { + *nSamplesProcessed = 0; + DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (queued) : Discarding %d samples code 0x%8.8X"), + nSamples, m_hr)); + for(int i = 0; i < nSamples; i++) { + ppSamples[i]->Release(); + } + return m_hr; + } + m_bFlushed = FALSE; + for(long i = 0; i < nSamples; i++) { + QueueSample(ppSamples[i]); + } + *nSamplesProcessed = nSamples; + if(!m_bBatchExact || + m_nBatched + m_List->GetCount() >= m_lBatchSize) { + NotifyThread(); + } + } + + return S_OK; +} + +// Get ready for new data - cancels sticky m_hr +void COutputQueue::Reset() { + if(!IsQueued()) { + m_hr = S_OK; + } + else { + CAutoLock lck(this); + QueueSample(RESET_PACKET); + NotifyThread(); + m_evFlushComplete.Wait(); + } +} + +// Remove and Release() all queued and Batched samples +void COutputQueue::FreeSamples() { + CAutoLock lck(this); + if(IsQueued()) { + while(TRUE) { + IMediaSample *pSample = m_List->RemoveHead(); + // inform derived class we took something off the queue + if(m_hEventPop) { + //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); + SetEvent(m_hEventPop); + } + + if(pSample == NULL) { + break; + } + if(!IsSpecialSample(pSample)) { + pSample->Release(); + } + else { + if(pSample == NEW_SEGMENT) { + // Free NEW_SEGMENT packet + NewSegmentPacket *ppacket = + (NewSegmentPacket *) m_List->RemoveHead(); + // inform derived class we took something off the queue + if(m_hEventPop) { + //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT"))); + SetEvent(m_hEventPop); + } + + ASSERT(ppacket != NULL); + delete ppacket; + } + } + } + } + for(int i = 0; i < m_nBatched; i++) { + m_ppSamples[i]->Release(); + } + m_nBatched = 0; +} + +// Notify the thread if there is something to do +// +// The critical section MUST be held when this is called +void COutputQueue::NotifyThread() { + // Optimize - no need to signal if it's not waiting + ASSERT(IsQueued()); + if(m_lWaiting) { + ReleaseSemaphore(m_hSem, m_lWaiting, NULL); + m_lWaiting = 0; + } +} + +// See if there's any work to do +// Returns +// TRUE if there is nothing on the queue and nothing in the batch +// and all data has been sent +// FALSE otherwise +// +BOOL COutputQueue::IsIdle() { + CAutoLock lck(this); + + // We're idle if + // there is no thread (!IsQueued()) OR + // the thread is waiting for more work (m_lWaiting != 0) + // AND + // there's nothing in the current batch (m_nBatched == 0) + + if(IsQueued() && m_lWaiting == 0 || m_nBatched != 0) { + return FALSE; + } + else { + + // If we're idle it shouldn't be possible for there + // to be anything on the work queue + ASSERT(!IsQueued() || m_List->GetCount() == 0); + } + + return TRUE; +} + + +void COutputQueue::SetPopEvent(HANDLE hEvent) { + m_hEventPop = hEvent; +} + diff --git a/src/BaseClasses/outputq.h b/src/BaseClasses/outputq.h index 19d88cb8a5..257700147f 100644 --- a/src/BaseClasses/outputq.h +++ b/src/BaseClasses/outputq.h @@ -1,137 +1,137 @@ -//------------------------------------------------------------------------------ -// File: OutputQ.h -// -// Desc: DirectShow base classes - defines the COutputQueue class, which -// makes a queue of samples and sends them to an output pin. The -// class will optionally send the samples to the pin directly. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -typedef CGenericList CSampleList; - -class COutputQueue : public CCritSec -{ -public: - // Constructor - COutputQueue(IPin *pInputPin, // Pin to send stuff to - HRESULT *phr, // 'Return code' - BOOL bAuto = TRUE, // Ask pin if blocks - BOOL bQueue = TRUE, // Send through queue (ignored if - // bAuto set) - LONG lBatchSize = 1, // Batch - BOOL bBatchExact = FALSE,// Batch exactly to BatchSize - LONG lListSize = // Likely number in the list - DEFAULTCACHE, - DWORD dwPriority = // Priority of thread to create - THREAD_PRIORITY_NORMAL, - bool bFlushingOpt = false // flushing optimization - ); - ~COutputQueue(); - - // enter flush state - discard all data - void BeginFlush(); // Begin flushing samples - - // re-enable receives (pass this downstream) - void EndFlush(); // Complete flush of samples - downstream - // pin guaranteed not to block at this stage - - void EOS(); // Call this on End of stream - - void SendAnyway(); // Send batched samples anyway (if bBatchExact set) - - void NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate); - - HRESULT Receive(IMediaSample *pSample); - - // do something with these media samples - HRESULT ReceiveMultiple ( - IMediaSample **pSamples, - long nSamples, - long *nSamplesProcessed); - - void Reset(); // Reset m_hr ready for more data - - // See if its idle or not - BOOL IsIdle(); - - // give the class an event to fire after everything removed from the queue - void SetPopEvent(HANDLE hEvent); - -protected: - static DWORD WINAPI InitialThreadProc(LPVOID pv); - DWORD ThreadProc(); - BOOL IsQueued() - { - return m_List != NULL; - } - - // The critical section MUST be held when this is called - void QueueSample(IMediaSample *pSample); - - BOOL IsSpecialSample(IMediaSample *pSample) - { - return (DWORD_PTR)pSample > (DWORD_PTR)(LONG_PTR)(-16); - } - - // Remove and Release() batched and queued samples - void FreeSamples(); - - // Notify the thread there is something to do - void NotifyThread(); - - -protected: - // Queue 'messages' - #define SEND_PACKET ((IMediaSample *)(LONG_PTR)(-2)) // Send batch - #define EOS_PACKET ((IMediaSample *)(LONG_PTR)(-3)) // End of stream - #define RESET_PACKET ((IMediaSample *)(LONG_PTR)(-4)) // Reset m_hr - #define NEW_SEGMENT ((IMediaSample *)(LONG_PTR)(-5)) // send NewSegment - - // new segment packet is always followed by one of these - struct NewSegmentPacket { - REFERENCE_TIME tStart; - REFERENCE_TIME tStop; - double dRate; - }; - - // Remember input stuff - IPin * const m_pPin; - IMemInputPin * m_pInputPin; - BOOL const m_bBatchExact; - LONG const m_lBatchSize; - - CSampleList * m_List; - HANDLE m_hSem; - CAMEvent m_evFlushComplete; - HANDLE m_hThread; - IMediaSample ** m_ppSamples; - LONG m_nBatched; - - // Wait optimization - LONG m_lWaiting; - // Flush synchronization - BOOL m_bFlushing; - - // flushing optimization. some downstream filters have trouble - // with the queue's flushing optimization. other rely on it - BOOL m_bFlushed; - bool m_bFlushingOpt; - - // Terminate now - BOOL m_bTerminate; - - // Send anyway flag for batching - BOOL m_bSendAnyway; - - // Deferred 'return code' - BOOL volatile m_hr; - - // an event that can be fired after every deliver - HANDLE m_hEventPop; -}; - +//------------------------------------------------------------------------------ +// File: OutputQ.h +// +// Desc: DirectShow base classes - defines the COutputQueue class, which +// makes a queue of samples and sends them to an output pin. The +// class will optionally send the samples to the pin directly. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +typedef CGenericList CSampleList; + +class COutputQueue : public CCritSec +{ +public: + // Constructor + COutputQueue(IPin *pInputPin, // Pin to send stuff to + HRESULT *phr, // 'Return code' + BOOL bAuto = TRUE, // Ask pin if blocks + BOOL bQueue = TRUE, // Send through queue (ignored if + // bAuto set) + LONG lBatchSize = 1, // Batch + BOOL bBatchExact = FALSE,// Batch exactly to BatchSize + LONG lListSize = // Likely number in the list + DEFAULTCACHE, + DWORD dwPriority = // Priority of thread to create + THREAD_PRIORITY_NORMAL, + bool bFlushingOpt = false // flushing optimization + ); + ~COutputQueue(); + + // enter flush state - discard all data + void BeginFlush(); // Begin flushing samples + + // re-enable receives (pass this downstream) + void EndFlush(); // Complete flush of samples - downstream + // pin guaranteed not to block at this stage + + void EOS(); // Call this on End of stream + + void SendAnyway(); // Send batched samples anyway (if bBatchExact set) + + void NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate); + + HRESULT Receive(IMediaSample *pSample); + + // do something with these media samples + HRESULT ReceiveMultiple ( + IMediaSample **pSamples, + long nSamples, + long *nSamplesProcessed); + + void Reset(); // Reset m_hr ready for more data + + // See if its idle or not + BOOL IsIdle(); + + // give the class an event to fire after everything removed from the queue + void SetPopEvent(HANDLE hEvent); + +protected: + static DWORD WINAPI InitialThreadProc(LPVOID pv); + DWORD ThreadProc(); + BOOL IsQueued() + { + return m_List != NULL; + } + + // The critical section MUST be held when this is called + void QueueSample(IMediaSample *pSample); + + BOOL IsSpecialSample(IMediaSample *pSample) + { + return (DWORD_PTR)pSample > (DWORD_PTR)(LONG_PTR)(-16); + } + + // Remove and Release() batched and queued samples + void FreeSamples(); + + // Notify the thread there is something to do + void NotifyThread(); + + +protected: + // Queue 'messages' + #define SEND_PACKET ((IMediaSample *)(LONG_PTR)(-2)) // Send batch + #define EOS_PACKET ((IMediaSample *)(LONG_PTR)(-3)) // End of stream + #define RESET_PACKET ((IMediaSample *)(LONG_PTR)(-4)) // Reset m_hr + #define NEW_SEGMENT ((IMediaSample *)(LONG_PTR)(-5)) // send NewSegment + + // new segment packet is always followed by one of these + struct NewSegmentPacket { + REFERENCE_TIME tStart; + REFERENCE_TIME tStop; + double dRate; + }; + + // Remember input stuff + IPin * const m_pPin; + IMemInputPin * m_pInputPin; + BOOL const m_bBatchExact; + LONG const m_lBatchSize; + + CSampleList * m_List; + HANDLE m_hSem; + CAMEvent m_evFlushComplete; + HANDLE m_hThread; + IMediaSample ** m_ppSamples; + LONG m_nBatched; + + // Wait optimization + LONG m_lWaiting; + // Flush synchronization + BOOL m_bFlushing; + + // flushing optimization. some downstream filters have trouble + // with the queue's flushing optimization. other rely on it + BOOL m_bFlushed; + bool m_bFlushingOpt; + + // Terminate now + BOOL m_bTerminate; + + // Send anyway flag for batching + BOOL m_bSendAnyway; + + // Deferred 'return code' + BOOL volatile m_hr; + + // an event that can be fired after every deliver + HANDLE m_hEventPop; +}; + diff --git a/src/BaseClasses/pstream.cpp b/src/BaseClasses/pstream.cpp index 7c4e30580a..f7642bf586 100644 --- a/src/BaseClasses/pstream.cpp +++ b/src/BaseClasses/pstream.cpp @@ -1,196 +1,196 @@ -//------------------------------------------------------------------------------ -// File: PStream.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - -#ifdef PERF -#include -#endif -// #include "pstream.h" in streams.h - -// -// Constructor -// -CPersistStream::CPersistStream(IUnknown *punk, HRESULT *phr) - : mPS_fDirty(FALSE) -{ - mPS_dwFileVersion = GetSoftwareVersion(); -} - - -// -// Destructor -// -CPersistStream::~CPersistStream() { - // Nothing to do -} - -#if 0 -SAMPLE CODE TO COPY - not active at the moment - -// -// NonDelegatingQueryInterface -// -// This object supports IPersist & IPersistStream -STDMETHODIMP CPersistStream::NonDelegatingQueryInterface(REFIID riid, void **ppv) -{ - if (riid == IID_IPersist) { - return GetInterface((IPersist *) this, ppv); // ??? - } - else if (riid == IID_IPersistStream) { - return GetInterface((IPersistStream *) this, ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } -} -#endif - - -// -// WriteToStream -// -// Writes to the stream (default action is to write nothing) -HRESULT CPersistStream::WriteToStream(IStream *pStream) -{ - // You can override this to do things like - // hr = pStream->Write(MyStructure, sizeof(MyStructure), NULL); - - return NOERROR; -} - - - -HRESULT CPersistStream::ReadFromStream(IStream * pStream) -{ - // You can override this to do things like - // hr = pStream->Read(MyStructure, sizeof(MyStructure), NULL); - - return NOERROR; -} - - -// -// Load -// -// Load all the data from the given stream -STDMETHODIMP CPersistStream::Load(LPSTREAM pStm) -{ - HRESULT hr; - // Load the version number then the data - mPS_dwFileVersion = ReadInt(pStm, hr); - if (FAILED(hr)) { - return hr; - } - - return ReadFromStream(pStm); -} // Load - - - -// -// Save -// -// Save the contents of this Stream. -STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty) -{ - - HRESULT hr = WriteInt(pStm, GetSoftwareVersion()); - if (FAILED(hr)) { - return hr; - } - - hr = WriteToStream(pStm); - if (FAILED(hr)) { - return hr; - } - - mPS_fDirty = !fClearDirty; - - return hr; -} // Save - - -// WriteInt -// -// Writes an integer to an IStream as 11 UNICODE characters followed by one space. -// You could use this for shorts or unsigneds or anything (up to 32 bits) -// where the value isn't actually truncated by squeezing it into 32 bits. -// Values such as (unsigned) 0x80000000 would come out as -2147483648 -// but would then load as 0x80000000 through ReadInt. Cast as you please. - -STDAPI WriteInt(IStream *pIStream, int n) -{ - WCHAR Buff[13]; // Allows for trailing null that we don't write - wsprintfW(Buff, L"%011d ",n); - return pIStream->Write(&(Buff[0]), 12*sizeof(WCHAR), NULL); -} // WriteInt - - -// ReadInt -// -// Reads an integer from an IStream. -// Read as 4 bytes. You could use this for shorts or unsigneds or anything -// where the value isn't actually truncated by squeezing it into 32 bits -// Striped down subset of what sscanf can do (without dragging in the C runtime) - -STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr) -{ - - int Sign = 1; - unsigned int n = 0; // result wil be n*Sign - WCHAR wch; - - hr = pIStream->Read( &wch, sizeof(wch), NULL); - if (FAILED(hr)) { - return 0; - } - - if (wch==L'-'){ - Sign = -1; - hr = pIStream->Read( &wch, sizeof(wch), NULL); - if (FAILED(hr)) { - return 0; - } - } - - for( ; ; ) { - if (wch>=L'0' && wch<=L'9') { - n = 10*n+(int)(wch-L'0'); - } else if ( wch == L' ' - || wch == L'\t' - || wch == L'\r' - || wch == L'\n' - || wch == L'\0' - ) { - break; - } else { - hr = VFW_E_INVALID_FILE_FORMAT; - return 0; - } - - hr = pIStream->Read( &wch, sizeof(wch), NULL); - if (FAILED(hr)) { - return 0; - } - } - - if (n==0x80000000 && Sign==-1) { - // This is the negative number that has no positive version! - return (int)n; - } - else return (int)n * Sign; -} // ReadInt - - -// The microsoft C/C++ compile generates level 4 warnings to the effect that -// a particular inline function (from some base class) was not needed. -// This line gets rid of hundreds of such unwanted messages and makes -// -W4 compilation feasible: -#pragma warning(disable: 4514) +//------------------------------------------------------------------------------ +// File: PStream.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + +#ifdef PERF +#include +#endif +// #include "pstream.h" in streams.h + +// +// Constructor +// +CPersistStream::CPersistStream(IUnknown *punk, HRESULT *phr) + : mPS_fDirty(FALSE) +{ + mPS_dwFileVersion = GetSoftwareVersion(); +} + + +// +// Destructor +// +CPersistStream::~CPersistStream() { + // Nothing to do +} + +#if 0 +SAMPLE CODE TO COPY - not active at the moment + +// +// NonDelegatingQueryInterface +// +// This object supports IPersist & IPersistStream +STDMETHODIMP CPersistStream::NonDelegatingQueryInterface(REFIID riid, void **ppv) +{ + if (riid == IID_IPersist) { + return GetInterface((IPersist *) this, ppv); // ??? + } + else if (riid == IID_IPersistStream) { + return GetInterface((IPersistStream *) this, ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } +} +#endif + + +// +// WriteToStream +// +// Writes to the stream (default action is to write nothing) +HRESULT CPersistStream::WriteToStream(IStream *pStream) +{ + // You can override this to do things like + // hr = pStream->Write(MyStructure, sizeof(MyStructure), NULL); + + return NOERROR; +} + + + +HRESULT CPersistStream::ReadFromStream(IStream * pStream) +{ + // You can override this to do things like + // hr = pStream->Read(MyStructure, sizeof(MyStructure), NULL); + + return NOERROR; +} + + +// +// Load +// +// Load all the data from the given stream +STDMETHODIMP CPersistStream::Load(LPSTREAM pStm) +{ + HRESULT hr; + // Load the version number then the data + mPS_dwFileVersion = ReadInt(pStm, hr); + if (FAILED(hr)) { + return hr; + } + + return ReadFromStream(pStm); +} // Load + + + +// +// Save +// +// Save the contents of this Stream. +STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty) +{ + + HRESULT hr = WriteInt(pStm, GetSoftwareVersion()); + if (FAILED(hr)) { + return hr; + } + + hr = WriteToStream(pStm); + if (FAILED(hr)) { + return hr; + } + + mPS_fDirty = !fClearDirty; + + return hr; +} // Save + + +// WriteInt +// +// Writes an integer to an IStream as 11 UNICODE characters followed by one space. +// You could use this for shorts or unsigneds or anything (up to 32 bits) +// where the value isn't actually truncated by squeezing it into 32 bits. +// Values such as (unsigned) 0x80000000 would come out as -2147483648 +// but would then load as 0x80000000 through ReadInt. Cast as you please. + +STDAPI WriteInt(IStream *pIStream, int n) +{ + WCHAR Buff[13]; // Allows for trailing null that we don't write + wsprintfW(Buff, L"%011d ",n); + return pIStream->Write(&(Buff[0]), 12*sizeof(WCHAR), NULL); +} // WriteInt + + +// ReadInt +// +// Reads an integer from an IStream. +// Read as 4 bytes. You could use this for shorts or unsigneds or anything +// where the value isn't actually truncated by squeezing it into 32 bits +// Striped down subset of what sscanf can do (without dragging in the C runtime) + +STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr) +{ + + int Sign = 1; + unsigned int n = 0; // result wil be n*Sign + WCHAR wch; + + hr = pIStream->Read( &wch, sizeof(wch), NULL); + if (FAILED(hr)) { + return 0; + } + + if (wch==L'-'){ + Sign = -1; + hr = pIStream->Read( &wch, sizeof(wch), NULL); + if (FAILED(hr)) { + return 0; + } + } + + for( ; ; ) { + if (wch>=L'0' && wch<=L'9') { + n = 10*n+(int)(wch-L'0'); + } else if ( wch == L' ' + || wch == L'\t' + || wch == L'\r' + || wch == L'\n' + || wch == L'\0' + ) { + break; + } else { + hr = VFW_E_INVALID_FILE_FORMAT; + return 0; + } + + hr = pIStream->Read( &wch, sizeof(wch), NULL); + if (FAILED(hr)) { + return 0; + } + } + + if (n==0x80000000 && Sign==-1) { + // This is the negative number that has no positive version! + return (int)n; + } + else return (int)n * Sign; +} // ReadInt + + +// The microsoft C/C++ compile generates level 4 warnings to the effect that +// a particular inline function (from some base class) was not needed. +// This line gets rid of hundreds of such unwanted messages and makes +// -W4 compilation feasible: +#pragma warning(disable: 4514) diff --git a/src/BaseClasses/pstream.h b/src/BaseClasses/pstream.h index 9742dd4e06..088dddb1e1 100644 --- a/src/BaseClasses/pstream.h +++ b/src/BaseClasses/pstream.h @@ -1,114 +1,114 @@ -//------------------------------------------------------------------------------ -// File: PStream.h -// -// Desc: DirectShow base classes - defines a class for persistent properties -// of filters. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __PSTREAM__ -#define __PSTREAM__ - -// Base class for persistent properties of filters -// (i.e. filter properties in saved graphs) - -// The simplest way to use this is: -// 1. Arrange for your filter to inherit this class -// 2. Implement in your class WriteToStream and ReadFromStream -// These will override the "do nothing" functions here. -// 3. Change your NonDelegatingQueryInterface to handle IPersistStream -// 4. Implement SizeMax to return the number of bytes of data you save. -// If you save UNICODE data, don't forget a char is 2 bytes. -// 5. Whenever your data changes, call SetDirty() -// -// At some point you may decide to alter, or extend the format of your data. -// At that point you will wish that you had a version number in all the old -// saved graphs, so that you can tell, when you read them, whether they -// represent the old or new form. To assist you in this, this class -// writes and reads a version number. -// When it writes, it calls GetSoftwareVersion() to enquire what version -// of the software we have at the moment. (In effect this is a version number -// of the data layout in the file). It writes this as the first thing in the data. -// If you want to change the version, implement (override) GetSoftwareVersion(). -// It reads this from the file into mPS_dwFileVersion before calling ReadFromStream, -// so in ReadFromStream you can check mPS_dwFileVersion to see if you are reading -// an old version file. -// Normally you should accept files whose version is no newer than the software -// version that's reading them. - - -// CPersistStream -// -// Implements IPersistStream. -// See 'OLE Programmers Reference (Vol 1):Structured Storage Overview' for -// more implementation information. -class CPersistStream : public IPersistStream { - private: - - // Internal state: - - protected: - DWORD mPS_dwFileVersion; // version number of file (being read) - BOOL mPS_fDirty; - - public: - - // IPersistStream methods - - STDMETHODIMP IsDirty() - {return (mPS_fDirty ? S_OK : S_FALSE);} // note FALSE means clean - STDMETHODIMP Load(LPSTREAM pStm); - STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty); - STDMETHODIMP GetSizeMax(ULARGE_INTEGER * pcbSize) - // Allow 24 bytes for version. - { pcbSize->QuadPart = 12*sizeof(WCHAR)+SizeMax(); return NOERROR; } - - // implementation - - CPersistStream(IUnknown *punk, HRESULT *phr); - ~CPersistStream(); - - HRESULT SetDirty(BOOL fDirty) - { mPS_fDirty = fDirty; return NOERROR;} - - - // override to reveal IPersist & IPersistStream - // STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // --- IPersist --- - - // You must override this to provide your own class id - STDMETHODIMP GetClassID(CLSID *pClsid) PURE; - - // overrideable if you want - // file version number. Override it if you ever change format - virtual DWORD GetSoftwareVersion(void) { return 0; } - - - //========================================================================= - // OVERRIDE THESE to read and write your data - // OVERRIDE THESE to read and write your data - // OVERRIDE THESE to read and write your data - - virtual int SizeMax() {return 0;} - virtual HRESULT WriteToStream(IStream *pStream); - virtual HRESULT ReadFromStream(IStream *pStream); - //========================================================================= - - private: - -}; - - -// --- Useful helpers --- - - -// Writes an int to an IStream as UNICODE. -STDAPI WriteInt(IStream *pIStream, int n); - -// inverse of WriteInt -STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr); - -#endif // __PSTREAM__ +//------------------------------------------------------------------------------ +// File: PStream.h +// +// Desc: DirectShow base classes - defines a class for persistent properties +// of filters. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __PSTREAM__ +#define __PSTREAM__ + +// Base class for persistent properties of filters +// (i.e. filter properties in saved graphs) + +// The simplest way to use this is: +// 1. Arrange for your filter to inherit this class +// 2. Implement in your class WriteToStream and ReadFromStream +// These will override the "do nothing" functions here. +// 3. Change your NonDelegatingQueryInterface to handle IPersistStream +// 4. Implement SizeMax to return the number of bytes of data you save. +// If you save UNICODE data, don't forget a char is 2 bytes. +// 5. Whenever your data changes, call SetDirty() +// +// At some point you may decide to alter, or extend the format of your data. +// At that point you will wish that you had a version number in all the old +// saved graphs, so that you can tell, when you read them, whether they +// represent the old or new form. To assist you in this, this class +// writes and reads a version number. +// When it writes, it calls GetSoftwareVersion() to enquire what version +// of the software we have at the moment. (In effect this is a version number +// of the data layout in the file). It writes this as the first thing in the data. +// If you want to change the version, implement (override) GetSoftwareVersion(). +// It reads this from the file into mPS_dwFileVersion before calling ReadFromStream, +// so in ReadFromStream you can check mPS_dwFileVersion to see if you are reading +// an old version file. +// Normally you should accept files whose version is no newer than the software +// version that's reading them. + + +// CPersistStream +// +// Implements IPersistStream. +// See 'OLE Programmers Reference (Vol 1):Structured Storage Overview' for +// more implementation information. +class CPersistStream : public IPersistStream { + private: + + // Internal state: + + protected: + DWORD mPS_dwFileVersion; // version number of file (being read) + BOOL mPS_fDirty; + + public: + + // IPersistStream methods + + STDMETHODIMP IsDirty() + {return (mPS_fDirty ? S_OK : S_FALSE);} // note FALSE means clean + STDMETHODIMP Load(LPSTREAM pStm); + STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty); + STDMETHODIMP GetSizeMax(ULARGE_INTEGER * pcbSize) + // Allow 24 bytes for version. + { pcbSize->QuadPart = 12*sizeof(WCHAR)+SizeMax(); return NOERROR; } + + // implementation + + CPersistStream(IUnknown *punk, HRESULT *phr); + ~CPersistStream(); + + HRESULT SetDirty(BOOL fDirty) + { mPS_fDirty = fDirty; return NOERROR;} + + + // override to reveal IPersist & IPersistStream + // STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // --- IPersist --- + + // You must override this to provide your own class id + STDMETHODIMP GetClassID(CLSID *pClsid) PURE; + + // overrideable if you want + // file version number. Override it if you ever change format + virtual DWORD GetSoftwareVersion(void) { return 0; } + + + //========================================================================= + // OVERRIDE THESE to read and write your data + // OVERRIDE THESE to read and write your data + // OVERRIDE THESE to read and write your data + + virtual int SizeMax() {return 0;} + virtual HRESULT WriteToStream(IStream *pStream); + virtual HRESULT ReadFromStream(IStream *pStream); + //========================================================================= + + private: + +}; + + +// --- Useful helpers --- + + +// Writes an int to an IStream as UNICODE. +STDAPI WriteInt(IStream *pIStream, int n); + +// inverse of WriteInt +STDAPI_(int) ReadInt(IStream *pIStream, HRESULT &hr); + +#endif // __PSTREAM__ diff --git a/src/BaseClasses/pullpin.cpp b/src/BaseClasses/pullpin.cpp index 260e84a5df..548086f4ec 100644 --- a/src/BaseClasses/pullpin.cpp +++ b/src/BaseClasses/pullpin.cpp @@ -1,510 +1,510 @@ -//------------------------------------------------------------------------------ -// File: PullPin.cpp -// -// Desc: DirectShow base classes - implements CPullPin class that pulls data -// from IAsyncReader. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include "pullpin.h" - - - -CPullPin::CPullPin() - : m_pReader(NULL), - m_pAlloc(NULL), - m_State(TM_Exit) { - -} - -CPullPin::~CPullPin() { - Disconnect(); -} - -// returns S_OK if successfully connected to an IAsyncReader interface -// from this object -// Optional allocator should be proposed as a preferred allocator if -// necessary -HRESULT -CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync) { - CAutoLock lock(&m_AccessLock); - - if(m_pReader) { - return VFW_E_ALREADY_CONNECTED; - } - - HRESULT hr = pUnk->QueryInterface(IID_IAsyncReader, (void**)&m_pReader); - if(FAILED(hr)) { - return(hr); - } - - hr = DecideAllocator(pAlloc, NULL); - if(FAILED(hr)) { - Disconnect(); - return hr; - } - - LONGLONG llTotal, llAvail; - hr = m_pReader->Length(&llTotal, &llAvail); - if(FAILED(hr)) { - Disconnect(); - return hr; - } - - // convert from file position to reference time - m_tDuration = llTotal * UNITS; - m_tStop = m_tDuration; - m_tStart = 0; - m_bSync = bSync; - - return S_OK; -} - -// disconnect any connection made in Connect -HRESULT -CPullPin::Disconnect() { - CAutoLock lock(&m_AccessLock); - - StopThread(); - - if(m_pReader) { - m_pReader->Release(); - m_pReader = NULL; - } - - if(m_pAlloc) { - m_pAlloc->Release(); - m_pAlloc = NULL; - } - - return S_OK; -} - -// agree an allocator using RequestAllocator - optional -// props param specifies your requirements (non-zero fields). -// returns an error code if fail to match requirements. -// optional IMemAllocator interface is offered as a preferred allocator -// but no error occurs if it can't be met. -HRESULT -CPullPin::DecideAllocator( - IMemAllocator * pAlloc, - ALLOCATOR_PROPERTIES * pProps) { - ALLOCATOR_PROPERTIES *pRequest; - ALLOCATOR_PROPERTIES Request; - if(pProps == NULL) { - Request.cBuffers = 3; - Request.cbBuffer = 64*1024; - Request.cbAlign = 0; - Request.cbPrefix = 0; - pRequest = &Request; - } - else { - pRequest = pProps; - } - HRESULT hr = m_pReader->RequestAllocator(pAlloc, - pRequest, - &m_pAlloc); - return hr; -} - -// start pulling data -HRESULT -CPullPin::Active(void) { - ASSERT(!ThreadExists()); - return StartThread(); -} - -// stop pulling data -HRESULT -CPullPin::Inactive(void) { - StopThread(); - - return S_OK; -} - -HRESULT -CPullPin::Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop) { - CAutoLock lock(&m_AccessLock); - - ThreadMsg AtStart = m_State; - - if(AtStart == TM_Start) { - BeginFlush(); - PauseThread(); - EndFlush(); - } - - m_tStart = tStart; - m_tStop = tStop; - - HRESULT hr = S_OK; - if(AtStart == TM_Start) { - hr = StartThread(); - } - - return hr; -} - -HRESULT -CPullPin::Duration(REFERENCE_TIME* ptDuration) { - *ptDuration = m_tDuration; - return S_OK; -} - - -HRESULT -CPullPin::StartThread() { - CAutoLock lock(&m_AccessLock); - - if(!m_pAlloc || !m_pReader) { - return E_UNEXPECTED; - } - - HRESULT hr; - if(!ThreadExists()) { - - // commit allocator - hr = m_pAlloc->Commit(); - if(FAILED(hr)) { - return hr; - } - - // start thread - if(!Create()) { - return E_FAIL; - } - } - - m_State = TM_Start; - hr = (HRESULT) CallWorker(m_State); - return hr; -} - -HRESULT -CPullPin::PauseThread() { - CAutoLock lock(&m_AccessLock); - - if(!ThreadExists()) { - return E_UNEXPECTED; - } - - // need to flush to ensure the thread is not blocked - // in WaitForNext - HRESULT hr = m_pReader->BeginFlush(); - if(FAILED(hr)) { - return hr; - } - - m_State = TM_Pause; - hr = CallWorker(TM_Pause); - - m_pReader->EndFlush(); - return hr; -} - -HRESULT -CPullPin::StopThread() { - CAutoLock lock(&m_AccessLock); - - if(!ThreadExists()) { - return S_FALSE; - } - - // need to flush to ensure the thread is not blocked - // in WaitForNext - HRESULT hr = m_pReader->BeginFlush(); - if(FAILED(hr)) { - return hr; - } - - m_State = TM_Exit; - hr = CallWorker(TM_Exit); - - m_pReader->EndFlush(); - - // wait for thread to completely exit - Close(); - - // decommit allocator - if(m_pAlloc) { - m_pAlloc->Decommit(); - } - - return S_OK; -} - - -DWORD -CPullPin::ThreadProc(void) { - while(1) { - DWORD cmd = GetRequest(); - switch(cmd) { - case TM_Exit: - Reply(S_OK); - return 0; - - case TM_Pause: - // we are paused already - Reply(S_OK); - break; - - case TM_Start: - Reply(S_OK); - Process(); - break; - } - - // at this point, there should be no outstanding requests on the - // upstream filter. - // We should force begin/endflush to ensure that this is true. - // !!!Note that we may currently be inside a BeginFlush/EndFlush pair - // on another thread, but the premature EndFlush will do no harm now - // that we are idle. - m_pReader->BeginFlush(); - CleanupCancelled(); - m_pReader->EndFlush(); - } -} - -HRESULT -CPullPin::QueueSample( - REFERENCE_TIME& tCurrent, - REFERENCE_TIME tAlignStop, - BOOL bDiscontinuity - ) { - IMediaSample* pSample; - - HRESULT hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0); - if(FAILED(hr)) { - return hr; - } - - LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS); - if(tStopThis > tAlignStop) { - tStopThis = tAlignStop; - } - pSample->SetTime(&tCurrent, &tStopThis); - tCurrent = tStopThis; - - pSample->SetDiscontinuity(bDiscontinuity); - - hr = m_pReader->Request(pSample, - 0); - if(FAILED(hr)) { - pSample->Release(); - - CleanupCancelled(); - OnError(hr); - } - return hr; -} - -HRESULT -CPullPin::CollectAndDeliver( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop) { - IMediaSample* pSample = NULL; // better be sure pSample is set - DWORD_PTR dwUnused; - HRESULT hr = m_pReader->WaitForNext(INFINITE, - &pSample, - &dwUnused); - if(FAILED(hr)) { - if(pSample) { - pSample->Release(); - } - } - else { - hr = DeliverSample(pSample, tStart, tStop); - } - if(FAILED(hr)) { - CleanupCancelled(); - OnError(hr); - } - return hr; - -} - -HRESULT -CPullPin::DeliverSample( - IMediaSample* pSample, - REFERENCE_TIME tStart, - REFERENCE_TIME tStop - ) { - // fix up sample if past actual stop (for sector alignment) - REFERENCE_TIME t1, t2; - pSample->GetTime(&t1, &t2); - if(t2 > tStop) { - t2 = tStop; - } - - // adjust times to be relative to (aligned) start time - t1 -= tStart; - t2 -= tStart; - pSample->SetTime(&t1, &t2); - - - HRESULT hr = Receive(pSample); - pSample->Release(); - return hr; -} - -void -CPullPin::Process(void) { - // is there anything to do? - if(m_tStop <= m_tStart) { - EndOfStream(); - return; - } - - BOOL bDiscontinuity = TRUE; - - // if there is more than one sample at the allocator, - // then try to queue 2 at once in order to overlap. - // -- get buffer count and required alignment - ALLOCATOR_PROPERTIES Actual; - HRESULT hr = m_pAlloc->GetProperties(&Actual); - - // align the start position downwards - REFERENCE_TIME tStart = AlignDown(m_tStart / UNITS, Actual.cbAlign) * UNITS; - REFERENCE_TIME tCurrent = tStart; - - REFERENCE_TIME tStop = m_tStop; - if(tStop > m_tDuration) { - tStop = m_tDuration; - } - - // align the stop position - may be past stop, but that - // doesn't matter - REFERENCE_TIME tAlignStop = AlignUp(tStop / UNITS, Actual.cbAlign) * UNITS; - - - DWORD dwRequest; - - if(!m_bSync) { - - // Break out of the loop either if we get to the end or we're asked - // to do something else - while(tCurrent < tAlignStop) { - - // Break out without calling EndOfStream if we're asked to - // do something different - if(CheckRequest(&dwRequest)) { - return; - } - - // queue a first sample - if(Actual.cBuffers > 1) { - - hr = QueueSample(tCurrent, tAlignStop, TRUE); - bDiscontinuity = FALSE; - - if(FAILED(hr)) { - return; - } - } - - - - // loop queueing second and waiting for first.. - while(tCurrent < tAlignStop) { - - hr = QueueSample(tCurrent, tAlignStop, bDiscontinuity); - bDiscontinuity = FALSE; - - if(FAILED(hr)) { - return; - } - - hr = CollectAndDeliver(tStart, tStop); - if(S_OK != hr) { - - // stop if error, or if downstream filter said - // to stop. - return; - } - } - - if(Actual.cBuffers > 1) { - hr = CollectAndDeliver(tStart, tStop); - if(FAILED(hr)) { - return; - } - } - } - } - else { - - // sync version of above loop - while(tCurrent < tAlignStop) { - - // Break out without calling EndOfStream if we're asked to - // do something different - if(CheckRequest(&dwRequest)) { - return; - } - - IMediaSample* pSample; - - hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0); - if(FAILED(hr)) { - OnError(hr); - return; - } - - LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS); - if(tStopThis > tAlignStop) { - tStopThis = tAlignStop; - } - pSample->SetTime(&tCurrent, &tStopThis); - tCurrent = tStopThis; - - if(bDiscontinuity) { - pSample->SetDiscontinuity(TRUE); - bDiscontinuity = FALSE; - } - - hr = m_pReader->SyncReadAligned(pSample); - - if(FAILED(hr)) { - pSample->Release(); - OnError(hr); - return; - } - - hr = DeliverSample(pSample, tStart, tStop); - if(hr != S_OK) { - if(FAILED(hr)) { - OnError(hr); - } - return; - } - } - } - - EndOfStream(); -} - -// after a flush, cancelled i/o will be waiting for collection -// and release -void -CPullPin::CleanupCancelled(void) { - while(1) { - IMediaSample * pSample; - DWORD_PTR dwUnused; - - HRESULT hr = m_pReader->WaitForNext(0, // no wait - &pSample, - &dwUnused); - if(pSample) { - pSample->Release(); - } - else { - // no more samples - return; - } - } -} - +//------------------------------------------------------------------------------ +// File: PullPin.cpp +// +// Desc: DirectShow base classes - implements CPullPin class that pulls data +// from IAsyncReader. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include "pullpin.h" + + + +CPullPin::CPullPin() + : m_pReader(NULL), + m_pAlloc(NULL), + m_State(TM_Exit) { + +} + +CPullPin::~CPullPin() { + Disconnect(); +} + +// returns S_OK if successfully connected to an IAsyncReader interface +// from this object +// Optional allocator should be proposed as a preferred allocator if +// necessary +HRESULT +CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync) { + CAutoLock lock(&m_AccessLock); + + if(m_pReader) { + return VFW_E_ALREADY_CONNECTED; + } + + HRESULT hr = pUnk->QueryInterface(IID_IAsyncReader, (void**)&m_pReader); + if(FAILED(hr)) { + return(hr); + } + + hr = DecideAllocator(pAlloc, NULL); + if(FAILED(hr)) { + Disconnect(); + return hr; + } + + LONGLONG llTotal, llAvail; + hr = m_pReader->Length(&llTotal, &llAvail); + if(FAILED(hr)) { + Disconnect(); + return hr; + } + + // convert from file position to reference time + m_tDuration = llTotal * UNITS; + m_tStop = m_tDuration; + m_tStart = 0; + m_bSync = bSync; + + return S_OK; +} + +// disconnect any connection made in Connect +HRESULT +CPullPin::Disconnect() { + CAutoLock lock(&m_AccessLock); + + StopThread(); + + if(m_pReader) { + m_pReader->Release(); + m_pReader = NULL; + } + + if(m_pAlloc) { + m_pAlloc->Release(); + m_pAlloc = NULL; + } + + return S_OK; +} + +// agree an allocator using RequestAllocator - optional +// props param specifies your requirements (non-zero fields). +// returns an error code if fail to match requirements. +// optional IMemAllocator interface is offered as a preferred allocator +// but no error occurs if it can't be met. +HRESULT +CPullPin::DecideAllocator( + IMemAllocator * pAlloc, + ALLOCATOR_PROPERTIES * pProps) { + ALLOCATOR_PROPERTIES *pRequest; + ALLOCATOR_PROPERTIES Request; + if(pProps == NULL) { + Request.cBuffers = 3; + Request.cbBuffer = 64*1024; + Request.cbAlign = 0; + Request.cbPrefix = 0; + pRequest = &Request; + } + else { + pRequest = pProps; + } + HRESULT hr = m_pReader->RequestAllocator(pAlloc, + pRequest, + &m_pAlloc); + return hr; +} + +// start pulling data +HRESULT +CPullPin::Active(void) { + ASSERT(!ThreadExists()); + return StartThread(); +} + +// stop pulling data +HRESULT +CPullPin::Inactive(void) { + StopThread(); + + return S_OK; +} + +HRESULT +CPullPin::Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop) { + CAutoLock lock(&m_AccessLock); + + ThreadMsg AtStart = m_State; + + if(AtStart == TM_Start) { + BeginFlush(); + PauseThread(); + EndFlush(); + } + + m_tStart = tStart; + m_tStop = tStop; + + HRESULT hr = S_OK; + if(AtStart == TM_Start) { + hr = StartThread(); + } + + return hr; +} + +HRESULT +CPullPin::Duration(REFERENCE_TIME* ptDuration) { + *ptDuration = m_tDuration; + return S_OK; +} + + +HRESULT +CPullPin::StartThread() { + CAutoLock lock(&m_AccessLock); + + if(!m_pAlloc || !m_pReader) { + return E_UNEXPECTED; + } + + HRESULT hr; + if(!ThreadExists()) { + + // commit allocator + hr = m_pAlloc->Commit(); + if(FAILED(hr)) { + return hr; + } + + // start thread + if(!Create()) { + return E_FAIL; + } + } + + m_State = TM_Start; + hr = (HRESULT) CallWorker(m_State); + return hr; +} + +HRESULT +CPullPin::PauseThread() { + CAutoLock lock(&m_AccessLock); + + if(!ThreadExists()) { + return E_UNEXPECTED; + } + + // need to flush to ensure the thread is not blocked + // in WaitForNext + HRESULT hr = m_pReader->BeginFlush(); + if(FAILED(hr)) { + return hr; + } + + m_State = TM_Pause; + hr = CallWorker(TM_Pause); + + m_pReader->EndFlush(); + return hr; +} + +HRESULT +CPullPin::StopThread() { + CAutoLock lock(&m_AccessLock); + + if(!ThreadExists()) { + return S_FALSE; + } + + // need to flush to ensure the thread is not blocked + // in WaitForNext + HRESULT hr = m_pReader->BeginFlush(); + if(FAILED(hr)) { + return hr; + } + + m_State = TM_Exit; + hr = CallWorker(TM_Exit); + + m_pReader->EndFlush(); + + // wait for thread to completely exit + Close(); + + // decommit allocator + if(m_pAlloc) { + m_pAlloc->Decommit(); + } + + return S_OK; +} + + +DWORD +CPullPin::ThreadProc(void) { + while(1) { + DWORD cmd = GetRequest(); + switch(cmd) { + case TM_Exit: + Reply(S_OK); + return 0; + + case TM_Pause: + // we are paused already + Reply(S_OK); + break; + + case TM_Start: + Reply(S_OK); + Process(); + break; + } + + // at this point, there should be no outstanding requests on the + // upstream filter. + // We should force begin/endflush to ensure that this is true. + // !!!Note that we may currently be inside a BeginFlush/EndFlush pair + // on another thread, but the premature EndFlush will do no harm now + // that we are idle. + m_pReader->BeginFlush(); + CleanupCancelled(); + m_pReader->EndFlush(); + } +} + +HRESULT +CPullPin::QueueSample( + REFERENCE_TIME& tCurrent, + REFERENCE_TIME tAlignStop, + BOOL bDiscontinuity + ) { + IMediaSample* pSample; + + HRESULT hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0); + if(FAILED(hr)) { + return hr; + } + + LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS); + if(tStopThis > tAlignStop) { + tStopThis = tAlignStop; + } + pSample->SetTime(&tCurrent, &tStopThis); + tCurrent = tStopThis; + + pSample->SetDiscontinuity(bDiscontinuity); + + hr = m_pReader->Request(pSample, + 0); + if(FAILED(hr)) { + pSample->Release(); + + CleanupCancelled(); + OnError(hr); + } + return hr; +} + +HRESULT +CPullPin::CollectAndDeliver( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop) { + IMediaSample* pSample = NULL; // better be sure pSample is set + DWORD_PTR dwUnused; + HRESULT hr = m_pReader->WaitForNext(INFINITE, + &pSample, + &dwUnused); + if(FAILED(hr)) { + if(pSample) { + pSample->Release(); + } + } + else { + hr = DeliverSample(pSample, tStart, tStop); + } + if(FAILED(hr)) { + CleanupCancelled(); + OnError(hr); + } + return hr; + +} + +HRESULT +CPullPin::DeliverSample( + IMediaSample* pSample, + REFERENCE_TIME tStart, + REFERENCE_TIME tStop + ) { + // fix up sample if past actual stop (for sector alignment) + REFERENCE_TIME t1, t2; + pSample->GetTime(&t1, &t2); + if(t2 > tStop) { + t2 = tStop; + } + + // adjust times to be relative to (aligned) start time + t1 -= tStart; + t2 -= tStart; + pSample->SetTime(&t1, &t2); + + + HRESULT hr = Receive(pSample); + pSample->Release(); + return hr; +} + +void +CPullPin::Process(void) { + // is there anything to do? + if(m_tStop <= m_tStart) { + EndOfStream(); + return; + } + + BOOL bDiscontinuity = TRUE; + + // if there is more than one sample at the allocator, + // then try to queue 2 at once in order to overlap. + // -- get buffer count and required alignment + ALLOCATOR_PROPERTIES Actual; + HRESULT hr = m_pAlloc->GetProperties(&Actual); + + // align the start position downwards + REFERENCE_TIME tStart = AlignDown(m_tStart / UNITS, Actual.cbAlign) * UNITS; + REFERENCE_TIME tCurrent = tStart; + + REFERENCE_TIME tStop = m_tStop; + if(tStop > m_tDuration) { + tStop = m_tDuration; + } + + // align the stop position - may be past stop, but that + // doesn't matter + REFERENCE_TIME tAlignStop = AlignUp(tStop / UNITS, Actual.cbAlign) * UNITS; + + + DWORD dwRequest; + + if(!m_bSync) { + + // Break out of the loop either if we get to the end or we're asked + // to do something else + while(tCurrent < tAlignStop) { + + // Break out without calling EndOfStream if we're asked to + // do something different + if(CheckRequest(&dwRequest)) { + return; + } + + // queue a first sample + if(Actual.cBuffers > 1) { + + hr = QueueSample(tCurrent, tAlignStop, TRUE); + bDiscontinuity = FALSE; + + if(FAILED(hr)) { + return; + } + } + + + + // loop queueing second and waiting for first.. + while(tCurrent < tAlignStop) { + + hr = QueueSample(tCurrent, tAlignStop, bDiscontinuity); + bDiscontinuity = FALSE; + + if(FAILED(hr)) { + return; + } + + hr = CollectAndDeliver(tStart, tStop); + if(S_OK != hr) { + + // stop if error, or if downstream filter said + // to stop. + return; + } + } + + if(Actual.cBuffers > 1) { + hr = CollectAndDeliver(tStart, tStop); + if(FAILED(hr)) { + return; + } + } + } + } + else { + + // sync version of above loop + while(tCurrent < tAlignStop) { + + // Break out without calling EndOfStream if we're asked to + // do something different + if(CheckRequest(&dwRequest)) { + return; + } + + IMediaSample* pSample; + + hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0); + if(FAILED(hr)) { + OnError(hr); + return; + } + + LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS); + if(tStopThis > tAlignStop) { + tStopThis = tAlignStop; + } + pSample->SetTime(&tCurrent, &tStopThis); + tCurrent = tStopThis; + + if(bDiscontinuity) { + pSample->SetDiscontinuity(TRUE); + bDiscontinuity = FALSE; + } + + hr = m_pReader->SyncReadAligned(pSample); + + if(FAILED(hr)) { + pSample->Release(); + OnError(hr); + return; + } + + hr = DeliverSample(pSample, tStart, tStop); + if(hr != S_OK) { + if(FAILED(hr)) { + OnError(hr); + } + return; + } + } + } + + EndOfStream(); +} + +// after a flush, cancelled i/o will be waiting for collection +// and release +void +CPullPin::CleanupCancelled(void) { + while(1) { + IMediaSample * pSample; + DWORD_PTR dwUnused; + + HRESULT hr = m_pReader->WaitForNext(0, // no wait + &pSample, + &dwUnused); + if(pSample) { + pSample->Release(); + } + else { + // no more samples + return; + } + } +} + diff --git a/src/BaseClasses/pullpin.h b/src/BaseClasses/pullpin.h index f2c385a126..3601feb5c1 100644 --- a/src/BaseClasses/pullpin.h +++ b/src/BaseClasses/pullpin.h @@ -1,152 +1,152 @@ -//------------------------------------------------------------------------------ -// File: PullPin.h -// -// Desc: DirectShow base classes - defines CPullPin class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __PULLPIN_H__ -#define __PULLPIN_H__ - -// -// CPullPin -// -// object supporting pulling data from an IAsyncReader interface. -// Given a start/stop position, calls a pure Receive method with each -// IMediaSample received. -// -// This is essentially for use in a MemInputPin when it finds itself -// connected to an IAsyncReader pin instead of a pushing pin. -// - -class CPullPin : public CAMThread -{ - IAsyncReader* m_pReader; - REFERENCE_TIME m_tStart; - REFERENCE_TIME m_tStop; - REFERENCE_TIME m_tDuration; - BOOL m_bSync; - - enum ThreadMsg { - TM_Pause, // stop pulling and wait for next message - TM_Start, // start pulling - TM_Exit, // stop and exit - }; - - ThreadMsg m_State; - - // override pure thread proc from CAMThread - DWORD ThreadProc(void); - - // running pull method (check m_bSync) - void Process(void); - - // clean up any cancelled i/o after a flush - void CleanupCancelled(void); - - // suspend thread from pulling, eg during seek - HRESULT PauseThread(); - - // start thread pulling - create thread if necy - HRESULT StartThread(); - - // stop and close thread - HRESULT StopThread(); - - // called from ProcessAsync to queue and collect requests - HRESULT QueueSample( - REFERENCE_TIME& tCurrent, - REFERENCE_TIME tAlignStop, - BOOL bDiscontinuity); - - HRESULT CollectAndDeliver( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop); - - HRESULT DeliverSample( - IMediaSample* pSample, - REFERENCE_TIME tStart, - REFERENCE_TIME tStop); - -protected: - IMemAllocator * m_pAlloc; - -public: - CPullPin(); - virtual ~CPullPin(); - - // returns S_OK if successfully connected to an IAsyncReader interface - // from this object - // Optional allocator should be proposed as a preferred allocator if - // necessary - // bSync is TRUE if we are to use sync reads instead of the - // async methods. - HRESULT Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync); - - // disconnect any connection made in Connect - HRESULT Disconnect(); - - // agree an allocator using RequestAllocator - optional - // props param specifies your requirements (non-zero fields). - // returns an error code if fail to match requirements. - // optional IMemAllocator interface is offered as a preferred allocator - // but no error occurs if it can't be met. - virtual HRESULT DecideAllocator( - IMemAllocator* pAlloc, - ALLOCATOR_PROPERTIES * pProps); - - // set start and stop position. if active, will start immediately at - // the new position. Default is 0 to duration - HRESULT Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop); - - // return the total duration - HRESULT Duration(REFERENCE_TIME* ptDuration); - - // start pulling data - HRESULT Active(void); - - // stop pulling data - HRESULT Inactive(void); - - // helper functions - LONGLONG AlignDown(LONGLONG ll, LONG lAlign) { - // aligning downwards is just truncation - return ll & ~(lAlign-1); - }; - - LONGLONG AlignUp(LONGLONG ll, LONG lAlign) { - // align up: round up to next boundary - return (ll + (lAlign -1)) & ~(lAlign -1); - }; - - // GetReader returns the (addrefed) IAsyncReader interface - // for SyncRead etc - IAsyncReader* GetReader() { - m_pReader->AddRef(); - return m_pReader; - }; - - // -- pure -- - - // override this to handle data arrival - // return value other than S_OK will stop data - virtual HRESULT Receive(IMediaSample*) PURE; - - // override this to handle end-of-stream - virtual HRESULT EndOfStream(void) PURE; - - // called on runtime errors that will have caused pulling - // to stop - // these errors are all returned from the upstream filter, who - // will have already reported any errors to the filtergraph. - virtual void OnError(HRESULT hr) PURE; - - // flush this pin and all downstream - virtual HRESULT BeginFlush() PURE; - virtual HRESULT EndFlush() PURE; - -}; - -#endif //__PULLPIN_H__ +//------------------------------------------------------------------------------ +// File: PullPin.h +// +// Desc: DirectShow base classes - defines CPullPin class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __PULLPIN_H__ +#define __PULLPIN_H__ + +// +// CPullPin +// +// object supporting pulling data from an IAsyncReader interface. +// Given a start/stop position, calls a pure Receive method with each +// IMediaSample received. +// +// This is essentially for use in a MemInputPin when it finds itself +// connected to an IAsyncReader pin instead of a pushing pin. +// + +class CPullPin : public CAMThread +{ + IAsyncReader* m_pReader; + REFERENCE_TIME m_tStart; + REFERENCE_TIME m_tStop; + REFERENCE_TIME m_tDuration; + BOOL m_bSync; + + enum ThreadMsg { + TM_Pause, // stop pulling and wait for next message + TM_Start, // start pulling + TM_Exit, // stop and exit + }; + + ThreadMsg m_State; + + // override pure thread proc from CAMThread + DWORD ThreadProc(void); + + // running pull method (check m_bSync) + void Process(void); + + // clean up any cancelled i/o after a flush + void CleanupCancelled(void); + + // suspend thread from pulling, eg during seek + HRESULT PauseThread(); + + // start thread pulling - create thread if necy + HRESULT StartThread(); + + // stop and close thread + HRESULT StopThread(); + + // called from ProcessAsync to queue and collect requests + HRESULT QueueSample( + REFERENCE_TIME& tCurrent, + REFERENCE_TIME tAlignStop, + BOOL bDiscontinuity); + + HRESULT CollectAndDeliver( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop); + + HRESULT DeliverSample( + IMediaSample* pSample, + REFERENCE_TIME tStart, + REFERENCE_TIME tStop); + +protected: + IMemAllocator * m_pAlloc; + +public: + CPullPin(); + virtual ~CPullPin(); + + // returns S_OK if successfully connected to an IAsyncReader interface + // from this object + // Optional allocator should be proposed as a preferred allocator if + // necessary + // bSync is TRUE if we are to use sync reads instead of the + // async methods. + HRESULT Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync); + + // disconnect any connection made in Connect + HRESULT Disconnect(); + + // agree an allocator using RequestAllocator - optional + // props param specifies your requirements (non-zero fields). + // returns an error code if fail to match requirements. + // optional IMemAllocator interface is offered as a preferred allocator + // but no error occurs if it can't be met. + virtual HRESULT DecideAllocator( + IMemAllocator* pAlloc, + ALLOCATOR_PROPERTIES * pProps); + + // set start and stop position. if active, will start immediately at + // the new position. Default is 0 to duration + HRESULT Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop); + + // return the total duration + HRESULT Duration(REFERENCE_TIME* ptDuration); + + // start pulling data + HRESULT Active(void); + + // stop pulling data + HRESULT Inactive(void); + + // helper functions + LONGLONG AlignDown(LONGLONG ll, LONG lAlign) { + // aligning downwards is just truncation + return ll & ~(lAlign-1); + }; + + LONGLONG AlignUp(LONGLONG ll, LONG lAlign) { + // align up: round up to next boundary + return (ll + (lAlign -1)) & ~(lAlign -1); + }; + + // GetReader returns the (addrefed) IAsyncReader interface + // for SyncRead etc + IAsyncReader* GetReader() { + m_pReader->AddRef(); + return m_pReader; + }; + + // -- pure -- + + // override this to handle data arrival + // return value other than S_OK will stop data + virtual HRESULT Receive(IMediaSample*) PURE; + + // override this to handle end-of-stream + virtual HRESULT EndOfStream(void) PURE; + + // called on runtime errors that will have caused pulling + // to stop + // these errors are all returned from the upstream filter, who + // will have already reported any errors to the filtergraph. + virtual void OnError(HRESULT hr) PURE; + + // flush this pin and all downstream + virtual HRESULT BeginFlush() PURE; + virtual HRESULT EndFlush() PURE; + +}; + +#endif //__PULLPIN_H__ diff --git a/src/BaseClasses/readme.txt b/src/BaseClasses/readme.txt index b31d3bdf02..b7460677eb 100644 --- a/src/BaseClasses/readme.txt +++ b/src/BaseClasses/readme.txt @@ -1,25 +1,25 @@ -DirectShow Sample -- Base Classes ---------------------------------- - -The Microsoft DirectShow base classes are a set of C++ classes -and utility functions that you can use to implement DirectShow filters. -For complete documentation of the base classes, see "DirectShow Base Classes" -in the DirectShow Reference section of the DirectX SDK documentation. - -NOTE: The BaseClasses header file schedule.h has been renamed to dsschedule.h -to prevent conflicts with the Platform SDK . Only the refclock.h -header in the BaseClasses directory uses this header, so the impact should -be minimal. - -Building for Windows XP ------------------------ -If you want to target Windows XP specifically to use its new features, -you must set WINVER=0x501 in the BaseClasses project file. You must also -install the Windows XP Platform SDK, however, to ensure that you have the -latest header files. For example, wxutil.cpp uses the new TIME_KILL_SYNCHRONOUS flag -only if (WINVER >= 0x501). This flag is conditionally defined in the Windows XP -Platform SDK in mmsystem.h, but only if WINVER is also set to 0x501 when compiling. - - #if (WINVER >= 0x501) - #define TIME_KILL_SYNCHRONOUS 0x0100 - #endif +DirectShow Sample -- Base Classes +--------------------------------- + +The Microsoft DirectShow base classes are a set of C++ classes +and utility functions that you can use to implement DirectShow filters. +For complete documentation of the base classes, see "DirectShow Base Classes" +in the DirectShow Reference section of the DirectX SDK documentation. + +NOTE: The BaseClasses header file schedule.h has been renamed to dsschedule.h +to prevent conflicts with the Platform SDK . Only the refclock.h +header in the BaseClasses directory uses this header, so the impact should +be minimal. + +Building for Windows XP +----------------------- +If you want to target Windows XP specifically to use its new features, +you must set WINVER=0x501 in the BaseClasses project file. You must also +install the Windows XP Platform SDK, however, to ensure that you have the +latest header files. For example, wxutil.cpp uses the new TIME_KILL_SYNCHRONOUS flag +only if (WINVER >= 0x501). This flag is conditionally defined in the Windows XP +Platform SDK in mmsystem.h, but only if WINVER is also set to 0x501 when compiling. + + #if (WINVER >= 0x501) + #define TIME_KILL_SYNCHRONOUS 0x0100 + #endif diff --git a/src/BaseClasses/refclock.cpp b/src/BaseClasses/refclock.cpp index 5fa72876de..2af26dfaee 100644 --- a/src/BaseClasses/refclock.cpp +++ b/src/BaseClasses/refclock.cpp @@ -1,308 +1,308 @@ -//------------------------------------------------------------------------------ -// File: RefClock.cpp -// -// Desc: DirectShow base classes - implements the IReferenceClock interface. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - - - -// 'this' used in constructor list -#pragma warning(disable:4355) - - -STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface( - REFIID riid, - void ** ppv) { - HRESULT hr; - - if(riid == IID_IReferenceClock) { - hr = GetInterface((IReferenceClock *) this, ppv); - } - else { - hr = CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - return hr; -} - -CBaseReferenceClock::~CBaseReferenceClock() { - - if(m_TimerResolution) timeEndPeriod(m_TimerResolution); - - m_pSchedule->DumpLinkedList(); - - if(m_hThread) { - m_bAbort = TRUE; - TriggerThread(); - WaitForSingleObject(m_hThread, INFINITE); - EXECUTE_ASSERT(CloseHandle(m_hThread)); - m_hThread = 0; - EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent())); - delete m_pSchedule; - } -} - -// A derived class may supply a hThreadEvent if it has its own thread that will take care -// of calling the schedulers Advise method. (Refere to CBaseReferenceClock::AdviseThread() -// to see what such a thread has to do.) -CBaseReferenceClock::CBaseReferenceClock( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pShed ) -: CUnknown( pName, pUnk ) -, m_rtLastGotTime(0) -, m_TimerResolution(0) -, m_bAbort( FALSE ) -, m_pSchedule( pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)) ) -, m_hThread(0) { - - - ASSERT(m_pSchedule); - if(!m_pSchedule) { - *phr = E_OUTOFMEMORY; - } - else { - // Set up the highest resolution timer we can manage - TIMECAPS tc; - m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc))) - ? tc.wPeriodMin : 1; - - timeBeginPeriod(m_TimerResolution); - - /* Initialise our system times - the derived clock should set the right values */ - m_dwPrevSystemTime = timeGetTime(); - m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime; - -#ifdef PERF - m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime")); -#endif - - if(!pShed) { - DWORD ThreadID; - m_hThread = ::CreateThread(NULL, // Security attributes - (DWORD) 0, // Initial stack size - AdviseThreadFunction, // Thread start address - (LPVOID) this, // Thread parameter - (DWORD) 0, // Creation flags - &ThreadID); // Thread identifier - - if(m_hThread) { - SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL); - } - else { - *phr = E_FAIL; - EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent())); - delete m_pSchedule; - } - } - } -} - -STDMETHODIMP CBaseReferenceClock::GetTime(REFERENCE_TIME *pTime) { - HRESULT hr; - if(pTime) { - REFERENCE_TIME rtNow; - Lock(); - rtNow = GetPrivateTime(); - if(rtNow > m_rtLastGotTime) { - m_rtLastGotTime = rtNow; - hr = S_OK; - } - else { - hr = S_FALSE; - } - - *pTime = m_rtLastGotTime; - Unlock(); - MSR_INTEGER(m_idGetSystemTime, LONG((*pTime) / (UNITS/MILLISECONDS))); - } - else hr = E_POINTER; - - return hr; -} - -/* Ask for an async notification that a time has elapsed */ - -STDMETHODIMP CBaseReferenceClock::AdviseTime( - REFERENCE_TIME baseTime, // base reference time - REFERENCE_TIME streamTime, // stream offset time - HEVENT hEvent, // advise via this event - DWORD_PTR *pdwAdviseCookie) // where your cookie goes -{ - CheckPointer(pdwAdviseCookie, E_POINTER); - *pdwAdviseCookie = 0; - - // Check that the event is not already set - ASSERT(WAIT_TIMEOUT == WaitForSingleObject(HANDLE(hEvent),0)); - - HRESULT hr; - - const REFERENCE_TIME lRefTime = baseTime + streamTime; - if(lRefTime <= 0 || lRefTime == MAX_TIME) { - hr = E_INVALIDARG; - } - else { - *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(lRefTime, 0, HANDLE(hEvent), FALSE); - hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY; - } - return hr; -} - - -/* Ask for an asynchronous periodic notification that a time has elapsed */ - -STDMETHODIMP CBaseReferenceClock::AdvisePeriodic( - REFERENCE_TIME StartTime, // starting at this time - REFERENCE_TIME PeriodTime, // time between notifications - HSEMAPHORE hSemaphore, // advise via a semaphore - DWORD_PTR *pdwAdviseCookie) // where your cookie goes -{ - CheckPointer(pdwAdviseCookie, E_POINTER); - *pdwAdviseCookie = 0; - - HRESULT hr; - if(StartTime > 0 && PeriodTime > 0 && StartTime != MAX_TIME) { - *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(StartTime, PeriodTime, HANDLE(hSemaphore), TRUE); - hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY; - } - else hr = E_INVALIDARG; - - return hr; -} - - -STDMETHODIMP CBaseReferenceClock::Unadvise(DWORD_PTR dwAdviseCookie) { - return m_pSchedule->Unadvise(dwAdviseCookie); -} - - -REFERENCE_TIME CBaseReferenceClock::GetPrivateTime() { - CAutoLock cObjectLock(this); - - - /* If the clock has wrapped then the current time will be less than - * the last time we were notified so add on the extra milliseconds - * - * The time period is long enough so that the likelihood of - * successive calls spanning the clock cycle is not considered. - */ - - DWORD dwTime = timeGetTime(); { - m_rtPrivateTime += Int32x32To64(UNITS / MILLISECONDS, (DWORD)(dwTime - m_dwPrevSystemTime)); - m_dwPrevSystemTime = dwTime; - } - - return m_rtPrivateTime; -} - - -/* Adjust the current time by the input value. This allows an - external time source to work out some of the latency of the clock - system and adjust the "current" time accordingly. The intent is - that the time returned to the user is synchronised to a clock - source and allows drift to be catered for. - - For example: if the clock source detects a drift it can pass a delta - to the current time rather than having to set an explicit time. -*/ - -STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta) { -#ifdef DEBUG - - // Just break if passed an improper time delta value - LONGLONG llDelta = TimeDelta > 0 ? TimeDelta : -TimeDelta; - if(llDelta > UNITS * 1000) { - DbgLog((LOG_TRACE, 0, TEXT("Bad Time Delta"))); - DebugBreak(); - } - - // We're going to calculate a "severity" for the time change. Max -1 - // min 8. We'll then use this as the debug logging level for a - // debug log message. - const LONG usDelta = LONG(TimeDelta/10); // Delta in micro-secs - - DWORD delta = abs(usDelta); // varying delta - // Severity == 8 - ceil(log(abs( micro-secs delta))) - int Severity = 8; - while(delta > 0) { - delta >>= 3; // div 8 - Severity--; - } - - // Sev == 0 => > 2 second delta! - DbgLog((LOG_TIMING, Severity < 0 ? 0 : Severity, - TEXT("Sev %2i: CSystemClock::SetTimeDelta(%8ld us) %lu -> %lu ms."), - Severity, usDelta, DWORD(ConvertToMilliseconds(m_rtPrivateTime)), - DWORD(ConvertToMilliseconds(TimeDelta+m_rtPrivateTime)) )); - - // Don't want the DbgBreak to fire when running stress on debug-builds. -#ifdef BREAK_ON_SEVERE_TIME_DELTA - if(Severity < 0) - DbgBreakPoint(TEXT("SetTimeDelta > 16 seconds!"), - TEXT(__FILE__),__LINE__); -#endif - -#endif - - CAutoLock cObjectLock(this); - m_rtPrivateTime += TimeDelta; - // If time goes forwards, and we have advises, then we need to - // trigger the thread so that it can re-evaluate its wait time. - // Since we don't want the cost of the thread switches if the change - // is really small, only do it if clock goes forward by more than - // 0.5 millisecond. If the time goes backwards, the thread will - // wake up "early" (relativly speaking) and will re-evaluate at - // that time. - if(TimeDelta > 5000 && m_pSchedule->GetAdviseCount() > 0) TriggerThread(); - return NOERROR; -} - -// Thread stuff - -DWORD __stdcall CBaseReferenceClock::AdviseThreadFunction(LPVOID p) { - return DWORD(reinterpret_cast(p)->AdviseThread()); -} - -HRESULT CBaseReferenceClock::AdviseThread() { - DWORD dwWait = INFINITE; - - // The first thing we do is wait until something interesting happens - // (meaning a first advise or shutdown). This prevents us calling - // GetPrivateTime immediately which is goodness as that is a virtual - // routine and the derived class may not yet be constructed. (This - // thread is created in the base class constructor.) - - while(!m_bAbort) { - // Wait for an interesting event to happen - DbgLog((LOG_TIMING, 3, TEXT("CBaseRefClock::AdviseThread() Delay: %lu ms"), dwWait )); - WaitForSingleObject(m_pSchedule->GetEvent(), dwWait); - if(m_bAbort) break; - - // There are several reasons why we need to work from the internal - // time, mainly to do with what happens when time goes backwards. - // Mainly, it stop us looping madly if an event is just about to - // expire when the clock goes backward (i.e. GetTime stop for a - // while). - const REFERENCE_TIME rtNow = GetPrivateTime(); - - DbgLog((LOG_TIMING, 3, - TEXT("CBaseRefClock::AdviseThread() Woke at = %lu ms"), - ConvertToMilliseconds(rtNow) )); - - // We must add in a millisecond, since this is the resolution of our - // WaitForSingleObject timer. Failure to do so will cause us to loop - // franticly for (approx) 1 a millisecond. - m_rtNextAdvise = m_pSchedule->Advise(10000 + rtNow); - LONGLONG llWait = m_rtNextAdvise - rtNow; - - ASSERT(llWait > 0); - - llWait = ConvertToMilliseconds(llWait); - // DON'T replace this with a max!! (The type's of these things is VERY important) - dwWait = (llWait > REFERENCE_TIME(UINT_MAX)) ? UINT_MAX : DWORD(llWait); - }; - return NOERROR; -} - +//------------------------------------------------------------------------------ +// File: RefClock.cpp +// +// Desc: DirectShow base classes - implements the IReferenceClock interface. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + + + +// 'this' used in constructor list +#pragma warning(disable:4355) + + +STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface( + REFIID riid, + void ** ppv) { + HRESULT hr; + + if(riid == IID_IReferenceClock) { + hr = GetInterface((IReferenceClock *) this, ppv); + } + else { + hr = CUnknown::NonDelegatingQueryInterface(riid, ppv); + } + return hr; +} + +CBaseReferenceClock::~CBaseReferenceClock() { + + if(m_TimerResolution) timeEndPeriod(m_TimerResolution); + + m_pSchedule->DumpLinkedList(); + + if(m_hThread) { + m_bAbort = TRUE; + TriggerThread(); + WaitForSingleObject(m_hThread, INFINITE); + EXECUTE_ASSERT(CloseHandle(m_hThread)); + m_hThread = 0; + EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent())); + delete m_pSchedule; + } +} + +// A derived class may supply a hThreadEvent if it has its own thread that will take care +// of calling the schedulers Advise method. (Refere to CBaseReferenceClock::AdviseThread() +// to see what such a thread has to do.) +CBaseReferenceClock::CBaseReferenceClock( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pShed ) +: CUnknown( pName, pUnk ) +, m_rtLastGotTime(0) +, m_TimerResolution(0) +, m_bAbort( FALSE ) +, m_pSchedule( pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)) ) +, m_hThread(0) { + + + ASSERT(m_pSchedule); + if(!m_pSchedule) { + *phr = E_OUTOFMEMORY; + } + else { + // Set up the highest resolution timer we can manage + TIMECAPS tc; + m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc))) + ? tc.wPeriodMin : 1; + + timeBeginPeriod(m_TimerResolution); + + /* Initialise our system times - the derived clock should set the right values */ + m_dwPrevSystemTime = timeGetTime(); + m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime; + +#ifdef PERF + m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime")); +#endif + + if(!pShed) { + DWORD ThreadID; + m_hThread = ::CreateThread(NULL, // Security attributes + (DWORD) 0, // Initial stack size + AdviseThreadFunction, // Thread start address + (LPVOID) this, // Thread parameter + (DWORD) 0, // Creation flags + &ThreadID); // Thread identifier + + if(m_hThread) { + SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL); + } + else { + *phr = E_FAIL; + EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent())); + delete m_pSchedule; + } + } + } +} + +STDMETHODIMP CBaseReferenceClock::GetTime(REFERENCE_TIME *pTime) { + HRESULT hr; + if(pTime) { + REFERENCE_TIME rtNow; + Lock(); + rtNow = GetPrivateTime(); + if(rtNow > m_rtLastGotTime) { + m_rtLastGotTime = rtNow; + hr = S_OK; + } + else { + hr = S_FALSE; + } + + *pTime = m_rtLastGotTime; + Unlock(); + MSR_INTEGER(m_idGetSystemTime, LONG((*pTime) / (UNITS/MILLISECONDS))); + } + else hr = E_POINTER; + + return hr; +} + +/* Ask for an async notification that a time has elapsed */ + +STDMETHODIMP CBaseReferenceClock::AdviseTime( + REFERENCE_TIME baseTime, // base reference time + REFERENCE_TIME streamTime, // stream offset time + HEVENT hEvent, // advise via this event + DWORD_PTR *pdwAdviseCookie) // where your cookie goes +{ + CheckPointer(pdwAdviseCookie, E_POINTER); + *pdwAdviseCookie = 0; + + // Check that the event is not already set + ASSERT(WAIT_TIMEOUT == WaitForSingleObject(HANDLE(hEvent),0)); + + HRESULT hr; + + const REFERENCE_TIME lRefTime = baseTime + streamTime; + if(lRefTime <= 0 || lRefTime == MAX_TIME) { + hr = E_INVALIDARG; + } + else { + *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(lRefTime, 0, HANDLE(hEvent), FALSE); + hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY; + } + return hr; +} + + +/* Ask for an asynchronous periodic notification that a time has elapsed */ + +STDMETHODIMP CBaseReferenceClock::AdvisePeriodic( + REFERENCE_TIME StartTime, // starting at this time + REFERENCE_TIME PeriodTime, // time between notifications + HSEMAPHORE hSemaphore, // advise via a semaphore + DWORD_PTR *pdwAdviseCookie) // where your cookie goes +{ + CheckPointer(pdwAdviseCookie, E_POINTER); + *pdwAdviseCookie = 0; + + HRESULT hr; + if(StartTime > 0 && PeriodTime > 0 && StartTime != MAX_TIME) { + *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(StartTime, PeriodTime, HANDLE(hSemaphore), TRUE); + hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY; + } + else hr = E_INVALIDARG; + + return hr; +} + + +STDMETHODIMP CBaseReferenceClock::Unadvise(DWORD_PTR dwAdviseCookie) { + return m_pSchedule->Unadvise(dwAdviseCookie); +} + + +REFERENCE_TIME CBaseReferenceClock::GetPrivateTime() { + CAutoLock cObjectLock(this); + + + /* If the clock has wrapped then the current time will be less than + * the last time we were notified so add on the extra milliseconds + * + * The time period is long enough so that the likelihood of + * successive calls spanning the clock cycle is not considered. + */ + + DWORD dwTime = timeGetTime(); { + m_rtPrivateTime += Int32x32To64(UNITS / MILLISECONDS, (DWORD)(dwTime - m_dwPrevSystemTime)); + m_dwPrevSystemTime = dwTime; + } + + return m_rtPrivateTime; +} + + +/* Adjust the current time by the input value. This allows an + external time source to work out some of the latency of the clock + system and adjust the "current" time accordingly. The intent is + that the time returned to the user is synchronised to a clock + source and allows drift to be catered for. + + For example: if the clock source detects a drift it can pass a delta + to the current time rather than having to set an explicit time. +*/ + +STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta) { +#ifdef DEBUG + + // Just break if passed an improper time delta value + LONGLONG llDelta = TimeDelta > 0 ? TimeDelta : -TimeDelta; + if(llDelta > UNITS * 1000) { + DbgLog((LOG_TRACE, 0, TEXT("Bad Time Delta"))); + DebugBreak(); + } + + // We're going to calculate a "severity" for the time change. Max -1 + // min 8. We'll then use this as the debug logging level for a + // debug log message. + const LONG usDelta = LONG(TimeDelta/10); // Delta in micro-secs + + DWORD delta = abs(usDelta); // varying delta + // Severity == 8 - ceil(log(abs( micro-secs delta))) + int Severity = 8; + while(delta > 0) { + delta >>= 3; // div 8 + Severity--; + } + + // Sev == 0 => > 2 second delta! + DbgLog((LOG_TIMING, Severity < 0 ? 0 : Severity, + TEXT("Sev %2i: CSystemClock::SetTimeDelta(%8ld us) %lu -> %lu ms."), + Severity, usDelta, DWORD(ConvertToMilliseconds(m_rtPrivateTime)), + DWORD(ConvertToMilliseconds(TimeDelta+m_rtPrivateTime)) )); + + // Don't want the DbgBreak to fire when running stress on debug-builds. +#ifdef BREAK_ON_SEVERE_TIME_DELTA + if(Severity < 0) + DbgBreakPoint(TEXT("SetTimeDelta > 16 seconds!"), + TEXT(__FILE__),__LINE__); +#endif + +#endif + + CAutoLock cObjectLock(this); + m_rtPrivateTime += TimeDelta; + // If time goes forwards, and we have advises, then we need to + // trigger the thread so that it can re-evaluate its wait time. + // Since we don't want the cost of the thread switches if the change + // is really small, only do it if clock goes forward by more than + // 0.5 millisecond. If the time goes backwards, the thread will + // wake up "early" (relativly speaking) and will re-evaluate at + // that time. + if(TimeDelta > 5000 && m_pSchedule->GetAdviseCount() > 0) TriggerThread(); + return NOERROR; +} + +// Thread stuff + +DWORD __stdcall CBaseReferenceClock::AdviseThreadFunction(LPVOID p) { + return DWORD(reinterpret_cast(p)->AdviseThread()); +} + +HRESULT CBaseReferenceClock::AdviseThread() { + DWORD dwWait = INFINITE; + + // The first thing we do is wait until something interesting happens + // (meaning a first advise or shutdown). This prevents us calling + // GetPrivateTime immediately which is goodness as that is a virtual + // routine and the derived class may not yet be constructed. (This + // thread is created in the base class constructor.) + + while(!m_bAbort) { + // Wait for an interesting event to happen + DbgLog((LOG_TIMING, 3, TEXT("CBaseRefClock::AdviseThread() Delay: %lu ms"), dwWait )); + WaitForSingleObject(m_pSchedule->GetEvent(), dwWait); + if(m_bAbort) break; + + // There are several reasons why we need to work from the internal + // time, mainly to do with what happens when time goes backwards. + // Mainly, it stop us looping madly if an event is just about to + // expire when the clock goes backward (i.e. GetTime stop for a + // while). + const REFERENCE_TIME rtNow = GetPrivateTime(); + + DbgLog((LOG_TIMING, 3, + TEXT("CBaseRefClock::AdviseThread() Woke at = %lu ms"), + ConvertToMilliseconds(rtNow) )); + + // We must add in a millisecond, since this is the resolution of our + // WaitForSingleObject timer. Failure to do so will cause us to loop + // franticly for (approx) 1 a millisecond. + m_rtNextAdvise = m_pSchedule->Advise(10000 + rtNow); + LONGLONG llWait = m_rtNextAdvise - rtNow; + + ASSERT(llWait > 0); + + llWait = ConvertToMilliseconds(llWait); + // DON'T replace this with a max!! (The type's of these things is VERY important) + dwWait = (llWait > REFERENCE_TIME(UINT_MAX)) ? UINT_MAX : DWORD(llWait); + }; + return NOERROR; +} + diff --git a/src/BaseClasses/refclock.h b/src/BaseClasses/refclock.h index d00558b50a..f1ec57592d 100644 --- a/src/BaseClasses/refclock.h +++ b/src/BaseClasses/refclock.h @@ -1,169 +1,169 @@ -//------------------------------------------------------------------------------ -// File: RefClock.h -// -// Desc: DirectShow base classes - defines the IReferenceClock interface. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __BASEREFCLOCK__ -#define __BASEREFCLOCK__ - -#include "dsschedule.h" - -const UINT RESOLUTION = 1; /* High resolution timer */ -const INT ADVISE_CACHE = 4; /* Default cache size */ -const LONGLONG MAX_TIME = 0x7FFFFFFFFFFFFFFF; /* Maximum LONGLONG value */ - -inline LONGLONG WINAPI ConvertToMilliseconds(const REFERENCE_TIME& RT) -{ - /* This converts an arbitrary value representing a reference time - into a MILLISECONDS value for use in subsequent system calls */ - - return (RT / (UNITS / MILLISECONDS)); -} - -/* This class hierarchy will support an IReferenceClock interface so - that an audio card (or other externally driven clock) can update the - system wide clock that everyone uses. - - The interface will be pretty thin with probably just one update method - This interface has not yet been defined. - */ - -/* This abstract base class implements the IReferenceClock - * interface. Classes that actually provide clock signals (from - * whatever source) have to be derived from this class. - * - * The abstract class provides implementations for: - * CUnknown support - * locking support (CCritSec) - * client advise code (creates a thread) - * - * Question: what can we do about quality? Change the timer - * resolution to lower the system load? Up the priority of the - * timer thread to force more responsive signals? - * - * During class construction we create a worker thread that is destroyed during - * destuction. This thread executes a series of WaitForSingleObject calls, - * waking up when a command is given to the thread or the next wake up point - * is reached. The wakeup points are determined by clients making Advise - * calls. - * - * Each advise call defines a point in time when they wish to be notified. A - * periodic advise is a series of these such events. We maintain a list of - * advise links and calculate when the nearest event notification is due for. - * We then call WaitForSingleObject with a timeout equal to this time. The - * handle we wait on is used by the class to signal that something has changed - * and that we must reschedule the next event. This typically happens when - * someone comes in and asks for an advise link while we are waiting for an - * event to timeout. - * - * While we are modifying the list of advise requests we - * are protected from interference through a critical section. Clients are NOT - * advised through callbacks. One shot clients have an event set, while - * periodic clients have a semaphore released for each event notification. A - * semaphore allows a client to be kept up to date with the number of events - * actually triggered and be assured that they can't miss multiple events being - * set. - * - * Keeping track of advises is taken care of by the CAMSchedule class. - */ - -class CBaseReferenceClock -: public CUnknown, public IReferenceClock, public CCritSec -{ -protected: - virtual ~CBaseReferenceClock(); // Don't let me be created on the stack! -public: - CBaseReferenceClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pSched = 0 ); - - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv); - - DECLARE_IUNKNOWN - - /* IReferenceClock methods */ - // Derived classes must implement GetPrivateTime(). All our GetTime - // does is call GetPrivateTime and then check so that time does not - // go backwards. A return code of S_FALSE implies that the internal - // clock has gone backwards and GetTime time has halted until internal - // time has caught up. (Don't know if this will be much use to folk, - // but it seems odd not to use the return code for something useful.) - STDMETHODIMP GetTime(REFERENCE_TIME *pTime); - // When this is called, it sets m_rtLastGotTime to the time it returns. - - /* Provide standard mechanisms for scheduling events */ - - /* Ask for an async notification that a time has elapsed */ - STDMETHODIMP AdviseTime( - REFERENCE_TIME baseTime, // base reference time - REFERENCE_TIME streamTime, // stream offset time - HEVENT hEvent, // advise via this event - DWORD_PTR *pdwAdviseCookie // where your cookie goes - ); - - /* Ask for an asynchronous periodic notification that a time has elapsed */ - STDMETHODIMP AdvisePeriodic( - REFERENCE_TIME StartTime, // starting at this time - REFERENCE_TIME PeriodTime, // time between notifications - HSEMAPHORE hSemaphore, // advise via a semaphore - DWORD_PTR *pdwAdviseCookie // where your cookie goes - ); - - /* Cancel a request for notification(s) - if the notification was - * a one shot timer then this function doesn't need to be called - * as the advise is automatically cancelled, however it does no - * harm to explicitly cancel a one-shot advise. It is REQUIRED that - * clients call Unadvise to clear a Periodic advise setting. - */ - - STDMETHODIMP Unadvise(DWORD_PTR dwAdviseCookie); - - /* Methods for the benefit of derived classes or outer objects */ - - // GetPrivateTime() is the REAL clock. GetTime is just a cover for - // it. Derived classes will probably override this method but not - // GetTime() itself. - // The important point about GetPrivateTime() is it's allowed to go - // backwards. Our GetTime() will keep returning the LastGotTime - // until GetPrivateTime() catches up. - virtual REFERENCE_TIME GetPrivateTime(); - - /* Provide a method for correcting drift */ - STDMETHODIMP SetTimeDelta( const REFERENCE_TIME& TimeDelta ); - - CAMSchedule * GetSchedule() const { return m_pSchedule; } - -private: - REFERENCE_TIME m_rtPrivateTime; // Current best estimate of time - DWORD m_dwPrevSystemTime; // Last vaule we got from timeGetTime - REFERENCE_TIME m_rtLastGotTime; // Last time returned by GetTime - REFERENCE_TIME m_rtNextAdvise; // Time of next advise - UINT m_TimerResolution; - -#ifdef PERF - int m_idGetSystemTime; -#endif - -// Thread stuff -public: - void TriggerThread() // Wakes thread up. Need to do this if - { // time to next advise needs reevaluating. - EXECUTE_ASSERT(SetEvent(m_pSchedule->GetEvent())); - } - - -private: - BOOL m_bAbort; // Flag used for thread shutdown - HANDLE m_hThread; // Thread handle - - HRESULT AdviseThread(); // Method in which the advise thread runs - static DWORD __stdcall AdviseThreadFunction(LPVOID); // Function used to get there - -protected: - CAMSchedule * const m_pSchedule; -}; - -#endif - +//------------------------------------------------------------------------------ +// File: RefClock.h +// +// Desc: DirectShow base classes - defines the IReferenceClock interface. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __BASEREFCLOCK__ +#define __BASEREFCLOCK__ + +#include "dsschedule.h" + +const UINT RESOLUTION = 1; /* High resolution timer */ +const INT ADVISE_CACHE = 4; /* Default cache size */ +const LONGLONG MAX_TIME = 0x7FFFFFFFFFFFFFFF; /* Maximum LONGLONG value */ + +inline LONGLONG WINAPI ConvertToMilliseconds(const REFERENCE_TIME& RT) +{ + /* This converts an arbitrary value representing a reference time + into a MILLISECONDS value for use in subsequent system calls */ + + return (RT / (UNITS / MILLISECONDS)); +} + +/* This class hierarchy will support an IReferenceClock interface so + that an audio card (or other externally driven clock) can update the + system wide clock that everyone uses. + + The interface will be pretty thin with probably just one update method + This interface has not yet been defined. + */ + +/* This abstract base class implements the IReferenceClock + * interface. Classes that actually provide clock signals (from + * whatever source) have to be derived from this class. + * + * The abstract class provides implementations for: + * CUnknown support + * locking support (CCritSec) + * client advise code (creates a thread) + * + * Question: what can we do about quality? Change the timer + * resolution to lower the system load? Up the priority of the + * timer thread to force more responsive signals? + * + * During class construction we create a worker thread that is destroyed during + * destuction. This thread executes a series of WaitForSingleObject calls, + * waking up when a command is given to the thread or the next wake up point + * is reached. The wakeup points are determined by clients making Advise + * calls. + * + * Each advise call defines a point in time when they wish to be notified. A + * periodic advise is a series of these such events. We maintain a list of + * advise links and calculate when the nearest event notification is due for. + * We then call WaitForSingleObject with a timeout equal to this time. The + * handle we wait on is used by the class to signal that something has changed + * and that we must reschedule the next event. This typically happens when + * someone comes in and asks for an advise link while we are waiting for an + * event to timeout. + * + * While we are modifying the list of advise requests we + * are protected from interference through a critical section. Clients are NOT + * advised through callbacks. One shot clients have an event set, while + * periodic clients have a semaphore released for each event notification. A + * semaphore allows a client to be kept up to date with the number of events + * actually triggered and be assured that they can't miss multiple events being + * set. + * + * Keeping track of advises is taken care of by the CAMSchedule class. + */ + +class CBaseReferenceClock +: public CUnknown, public IReferenceClock, public CCritSec +{ +protected: + virtual ~CBaseReferenceClock(); // Don't let me be created on the stack! +public: + CBaseReferenceClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pSched = 0 ); + + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv); + + DECLARE_IUNKNOWN + + /* IReferenceClock methods */ + // Derived classes must implement GetPrivateTime(). All our GetTime + // does is call GetPrivateTime and then check so that time does not + // go backwards. A return code of S_FALSE implies that the internal + // clock has gone backwards and GetTime time has halted until internal + // time has caught up. (Don't know if this will be much use to folk, + // but it seems odd not to use the return code for something useful.) + STDMETHODIMP GetTime(REFERENCE_TIME *pTime); + // When this is called, it sets m_rtLastGotTime to the time it returns. + + /* Provide standard mechanisms for scheduling events */ + + /* Ask for an async notification that a time has elapsed */ + STDMETHODIMP AdviseTime( + REFERENCE_TIME baseTime, // base reference time + REFERENCE_TIME streamTime, // stream offset time + HEVENT hEvent, // advise via this event + DWORD_PTR *pdwAdviseCookie // where your cookie goes + ); + + /* Ask for an asynchronous periodic notification that a time has elapsed */ + STDMETHODIMP AdvisePeriodic( + REFERENCE_TIME StartTime, // starting at this time + REFERENCE_TIME PeriodTime, // time between notifications + HSEMAPHORE hSemaphore, // advise via a semaphore + DWORD_PTR *pdwAdviseCookie // where your cookie goes + ); + + /* Cancel a request for notification(s) - if the notification was + * a one shot timer then this function doesn't need to be called + * as the advise is automatically cancelled, however it does no + * harm to explicitly cancel a one-shot advise. It is REQUIRED that + * clients call Unadvise to clear a Periodic advise setting. + */ + + STDMETHODIMP Unadvise(DWORD_PTR dwAdviseCookie); + + /* Methods for the benefit of derived classes or outer objects */ + + // GetPrivateTime() is the REAL clock. GetTime is just a cover for + // it. Derived classes will probably override this method but not + // GetTime() itself. + // The important point about GetPrivateTime() is it's allowed to go + // backwards. Our GetTime() will keep returning the LastGotTime + // until GetPrivateTime() catches up. + virtual REFERENCE_TIME GetPrivateTime(); + + /* Provide a method for correcting drift */ + STDMETHODIMP SetTimeDelta( const REFERENCE_TIME& TimeDelta ); + + CAMSchedule * GetSchedule() const { return m_pSchedule; } + +private: + REFERENCE_TIME m_rtPrivateTime; // Current best estimate of time + DWORD m_dwPrevSystemTime; // Last vaule we got from timeGetTime + REFERENCE_TIME m_rtLastGotTime; // Last time returned by GetTime + REFERENCE_TIME m_rtNextAdvise; // Time of next advise + UINT m_TimerResolution; + +#ifdef PERF + int m_idGetSystemTime; +#endif + +// Thread stuff +public: + void TriggerThread() // Wakes thread up. Need to do this if + { // time to next advise needs reevaluating. + EXECUTE_ASSERT(SetEvent(m_pSchedule->GetEvent())); + } + + +private: + BOOL m_bAbort; // Flag used for thread shutdown + HANDLE m_hThread; // Thread handle + + HRESULT AdviseThread(); // Method in which the advise thread runs + static DWORD __stdcall AdviseThreadFunction(LPVOID); // Function used to get there + +protected: + CAMSchedule * const m_pSchedule; +}; + +#endif + diff --git a/src/BaseClasses/reftime.h b/src/BaseClasses/reftime.h index 5bc99a6946..0ed32f6e17 100644 --- a/src/BaseClasses/reftime.h +++ b/src/BaseClasses/reftime.h @@ -1,116 +1,116 @@ -//------------------------------------------------------------------------------ -// File: RefTime.h -// -// Desc: DirectShow base classes - defines CRefTime, a class that manages -// reference times. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// -// CRefTime -// -// Manage reference times. -// Shares same data layout as REFERENCE_TIME, but adds some (nonvirtual) -// functions providing simple comparison, conversion and arithmetic. -// -// A reference time (at the moment) is a unit of seconds represented in -// 100ns units as is used in the Win32 FILETIME structure. BUT the time -// a REFERENCE_TIME represents is NOT the time elapsed since 1/1/1601 it -// will either be stream time or reference time depending upon context -// -// This class provides simple arithmetic operations on reference times -// -// keep non-virtual otherwise the data layout will not be the same as -// REFERENCE_TIME - - -// ----- -// note that you are safe to cast a CRefTime* to a REFERENCE_TIME*, but -// you will need to do so explicitly -// ----- - - -#ifndef __REFTIME__ -#define __REFTIME__ - - -const LONGLONG MILLISECONDS = (1000); // 10 ^ 3 -const LONGLONG NANOSECONDS = (1000000000); // 10 ^ 9 -const LONGLONG UNITS = (NANOSECONDS / 100); // 10 ^ 7 - -/* Unfortunately an inline function here generates a call to __allmul - - even for constants! -*/ -#define MILLISECONDS_TO_100NS_UNITS(lMs) \ - Int32x32To64((lMs), (UNITS / MILLISECONDS)) - -class CRefTime -{ -public: - - // *MUST* be the only data member so that this class is exactly - // equivalent to a REFERENCE_TIME. - // Also, must be *no virtual functions* - - REFERENCE_TIME m_time; - - inline CRefTime() - { - // default to 0 time - m_time = 0; - }; - - inline CRefTime(LONG msecs) - { - m_time = MILLISECONDS_TO_100NS_UNITS(msecs); - }; - - inline CRefTime(REFERENCE_TIME rt) - { - m_time = rt; - }; - - inline operator REFERENCE_TIME() const - { - return m_time; - }; - - inline CRefTime& operator=(const CRefTime& rt) - { - m_time = rt.m_time; - return *this; - }; - - inline CRefTime& operator=(const LONGLONG ll) - { - m_time = ll; - return *this; - }; - - inline CRefTime& operator+=(const CRefTime& rt) - { - return (*this = *this + rt); - }; - - inline CRefTime& operator-=(const CRefTime& rt) - { - return (*this = *this - rt); - }; - - inline LONG Millisecs(void) - { - return (LONG)(m_time / (UNITS / MILLISECONDS)); - }; - - inline LONGLONG GetUnits(void) - { - return m_time; - }; -}; - -const LONGLONG TimeZero = 0; - -#endif /* __REFTIME__ */ - +//------------------------------------------------------------------------------ +// File: RefTime.h +// +// Desc: DirectShow base classes - defines CRefTime, a class that manages +// reference times. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// +// CRefTime +// +// Manage reference times. +// Shares same data layout as REFERENCE_TIME, but adds some (nonvirtual) +// functions providing simple comparison, conversion and arithmetic. +// +// A reference time (at the moment) is a unit of seconds represented in +// 100ns units as is used in the Win32 FILETIME structure. BUT the time +// a REFERENCE_TIME represents is NOT the time elapsed since 1/1/1601 it +// will either be stream time or reference time depending upon context +// +// This class provides simple arithmetic operations on reference times +// +// keep non-virtual otherwise the data layout will not be the same as +// REFERENCE_TIME + + +// ----- +// note that you are safe to cast a CRefTime* to a REFERENCE_TIME*, but +// you will need to do so explicitly +// ----- + + +#ifndef __REFTIME__ +#define __REFTIME__ + + +const LONGLONG MILLISECONDS = (1000); // 10 ^ 3 +const LONGLONG NANOSECONDS = (1000000000); // 10 ^ 9 +const LONGLONG UNITS = (NANOSECONDS / 100); // 10 ^ 7 + +/* Unfortunately an inline function here generates a call to __allmul + - even for constants! +*/ +#define MILLISECONDS_TO_100NS_UNITS(lMs) \ + Int32x32To64((lMs), (UNITS / MILLISECONDS)) + +class CRefTime +{ +public: + + // *MUST* be the only data member so that this class is exactly + // equivalent to a REFERENCE_TIME. + // Also, must be *no virtual functions* + + REFERENCE_TIME m_time; + + inline CRefTime() + { + // default to 0 time + m_time = 0; + }; + + inline CRefTime(LONG msecs) + { + m_time = MILLISECONDS_TO_100NS_UNITS(msecs); + }; + + inline CRefTime(REFERENCE_TIME rt) + { + m_time = rt; + }; + + inline operator REFERENCE_TIME() const + { + return m_time; + }; + + inline CRefTime& operator=(const CRefTime& rt) + { + m_time = rt.m_time; + return *this; + }; + + inline CRefTime& operator=(const LONGLONG ll) + { + m_time = ll; + return *this; + }; + + inline CRefTime& operator+=(const CRefTime& rt) + { + return (*this = *this + rt); + }; + + inline CRefTime& operator-=(const CRefTime& rt) + { + return (*this = *this - rt); + }; + + inline LONG Millisecs(void) + { + return (LONG)(m_time / (UNITS / MILLISECONDS)); + }; + + inline LONGLONG GetUnits(void) + { + return m_time; + }; +}; + +const LONGLONG TimeZero = 0; + +#endif /* __REFTIME__ */ + diff --git a/src/BaseClasses/renbase.cpp b/src/BaseClasses/renbase.cpp index 8d4b792034..81cdb60b24 100644 --- a/src/BaseClasses/renbase.cpp +++ b/src/BaseClasses/renbase.cpp @@ -1,2833 +1,2833 @@ -//------------------------------------------------------------------------------ -// File: RenBase.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include // DirectShow base class definitions -#include // Needed for definition of timeGetTime -#include // Standard data type limit definitions -#include // Used for time critical log functions - -#pragma warning(disable:4355) - -// Helper function for clamping time differences -int inline TimeDiff(REFERENCE_TIME rt) -{ - if (rt < - (50 * UNITS)) { - return -(50 * UNITS); - } else - if (rt > 50 * UNITS) { - return 50 * UNITS; - } else return (int)rt; -} - -// Implements the CBaseRenderer class - -CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer - TCHAR *pName, // Debug ONLY description - LPUNKNOWN pUnk, // Aggregated owner object - HRESULT *phr) : // General OLE return code - - CBaseFilter(pName,pUnk,&m_InterfaceLock,RenderClass), - m_evComplete(TRUE), - m_bAbort(FALSE), - m_pPosition(NULL), - m_ThreadSignal(TRUE), - m_bStreaming(FALSE), - m_bEOS(FALSE), - m_bEOSDelivered(FALSE), - m_pMediaSample(NULL), - m_dwAdvise(0), - m_pQSink(NULL), - m_pInputPin(NULL), - m_bRepaintStatus(TRUE), - m_SignalTime(0), - m_bInReceive(FALSE), - m_EndOfStreamTimer(0) -{ - Ready(); -#ifdef PERF - m_idBaseStamp = MSR_REGISTER(TEXT("BaseRenderer: sample time stamp")); - m_idBaseRenderTime = MSR_REGISTER(TEXT("BaseRenderer: draw time (msec)")); - m_idBaseAccuracy = MSR_REGISTER(TEXT("BaseRenderer: Accuracy (msec)")); -#endif -} - - -// Delete the dynamically allocated IMediaPosition and IMediaSeeking helper -// object. The object is created when somebody queries us. These are standard -// control interfaces for seeking and setting start/stop positions and rates. -// We will probably also have made an input pin based on CRendererInputPin -// that has to be deleted, it's created when an enumerator calls our GetPin - -CBaseRenderer::~CBaseRenderer() -{ - ASSERT(m_bStreaming == FALSE); - ASSERT(m_EndOfStreamTimer == 0); - StopStreaming(); - ClearPendingSample(); - - // Delete any IMediaPosition implementation - - if (m_pPosition) { - delete m_pPosition; - m_pPosition = NULL; - } - - // Delete any input pin created - - if (m_pInputPin) { - delete m_pInputPin; - m_pInputPin = NULL; - } - - // Release any Quality sink - - ASSERT(m_pQSink == NULL); -} - - -// This returns the IMediaPosition and IMediaSeeking interfaces - -HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid,void **ppv) -{ - CAutoLock cObjectCreationLock(&m_ObjectCreationLock); - if (m_pPosition) { - return m_pPosition->NonDelegatingQueryInterface(riid,ppv); - } - - HRESULT hr = NOERROR; - - // Create implementation of this dynamically since sometimes we may - // never try and do a seek. The helper object implements a position - // control interface (IMediaPosition) which in fact simply takes the - // calls normally from the filter graph and passes them upstream - - m_pPosition = new CRendererPosPassThru(NAME("Renderer CPosPassThru"), - CBaseFilter::GetOwner(), - (HRESULT *) &hr, - GetPin(0)); - if (m_pPosition == NULL) { - return E_OUTOFMEMORY; - } - - if (FAILED(hr)) { - delete m_pPosition; - m_pPosition = NULL; - return E_NOINTERFACE; - } - return GetMediaPositionInterface(riid,ppv); -} - - -// Overriden to say what interfaces we support and where - -STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid,void **ppv) -{ - // Do we have this interface - - if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) { - return GetMediaPositionInterface(riid,ppv); - } else { - return CBaseFilter::NonDelegatingQueryInterface(riid,ppv); - } -} - - -// This is called whenever we change states, we have a manual reset event that -// is signalled whenever we don't won't the source filter thread to wait in us -// (such as in a stopped state) and likewise is not signalled whenever it can -// wait (during paused and running) this function sets or resets the thread -// event. The event is used to stop source filter threads waiting in Receive - -HRESULT CBaseRenderer::SourceThreadCanWait(BOOL bCanWait) -{ - if (bCanWait == TRUE) { - m_ThreadSignal.Reset(); - } else { - m_ThreadSignal.Set(); - } - return NOERROR; -} - - -#ifdef DEBUG -// Dump the current renderer state to the debug terminal. The hardest part of -// the renderer is the window where we unlock everything to wait for a clock -// to signal it is time to draw or for the application to cancel everything -// by stopping the filter. If we get things wrong we can leave the thread in -// WaitForRenderTime with no way for it to ever get out and we will deadlock - -void CBaseRenderer::DisplayRendererState() -{ - DbgLog((LOG_TIMING, 1, TEXT("\nTimed out in WaitForRenderTime"))); - - // No way should this be signalled at this point - - BOOL bSignalled = m_ThreadSignal.Check(); - DbgLog((LOG_TIMING, 1, TEXT("Signal sanity check %d"),bSignalled)); - - // Now output the current renderer state variables - - DbgLog((LOG_TIMING, 1, TEXT("Filter state %d"),m_State)); - DbgLog((LOG_TIMING, 1, TEXT("Abort flag %d"),m_bAbort)); - DbgLog((LOG_TIMING, 1, TEXT("Streaming flag %d"),m_bStreaming)); - DbgLog((LOG_TIMING, 1, TEXT("Clock advise link %d"),m_dwAdvise)); - DbgLog((LOG_TIMING, 1, TEXT("Current media sample %x"),m_pMediaSample)); - DbgLog((LOG_TIMING, 1, TEXT("EOS signalled %d"),m_bEOS)); - DbgLog((LOG_TIMING, 1, TEXT("EOS delivered %d"),m_bEOSDelivered)); - DbgLog((LOG_TIMING, 1, TEXT("Repaint status %d"),m_bRepaintStatus)); - - - // Output the delayed end of stream timer information - - DbgLog((LOG_TIMING, 1, TEXT("End of stream timer %x"),m_EndOfStreamTimer)); - DbgLog((LOG_TIMING, 1, TEXT("Deliver time %s"),CDisp((LONGLONG)m_SignalTime))); - - - // Should never timeout during a flushing state - - BOOL bFlushing = m_pInputPin->IsFlushing(); - DbgLog((LOG_TIMING, 1, TEXT("Flushing sanity check %d"),bFlushing)); - - // Display the time we were told to start at - DbgLog((LOG_TIMING, 1, TEXT("Last run time %s"),CDisp((LONGLONG)m_tStart.m_time))); - - // Do we have a reference clock? - if (m_pClock == NULL) return; - - // Get the current time from the wall clock - - CRefTime CurrentTime,StartTime,EndTime; - m_pClock->GetTime((REFERENCE_TIME*) &CurrentTime); - CRefTime Offset = CurrentTime - m_tStart; - - // Display the current time from the clock - - DbgLog((LOG_TIMING, 1, TEXT("Clock time %s"),CDisp((LONGLONG)CurrentTime.m_time))); - DbgLog((LOG_TIMING, 1, TEXT("Time difference %dms"),Offset.Millisecs())); - - // Do we have a sample ready to render - if (m_pMediaSample == NULL) return; - - m_pMediaSample->GetTime((REFERENCE_TIME*)&StartTime, (REFERENCE_TIME*)&EndTime); - DbgLog((LOG_TIMING, 1, TEXT("Next sample stream times (Start %d End %d ms)"), - StartTime.Millisecs(),EndTime.Millisecs())); - - // Calculate how long it is until it is due for rendering - CRefTime Wait = (m_tStart + StartTime) - CurrentTime; - DbgLog((LOG_TIMING, 1, TEXT("Wait required %d ms"),Wait.Millisecs())); -} -#endif - - -// Wait until the clock sets the timer event or we're otherwise signalled. We -// set an arbitrary timeout for this wait and if it fires then we display the -// current renderer state on the debugger. It will often fire if the filter's -// left paused in an application however it may also fire during stress tests -// if the synchronisation with application seeks and state changes is faulty - -#define RENDER_TIMEOUT 10000 - -HRESULT CBaseRenderer::WaitForRenderTime() -{ - HANDLE WaitObjects[] = { m_ThreadSignal, m_RenderEvent }; - DWORD Result = WAIT_TIMEOUT; - - // Wait for either the time to arrive or for us to be stopped - - OnWaitStart(); - while (Result == WAIT_TIMEOUT) { - Result = WaitForMultipleObjects(2,WaitObjects,FALSE,RENDER_TIMEOUT); - -#ifdef DEBUG - if (Result == WAIT_TIMEOUT) DisplayRendererState(); -#endif - - } - OnWaitEnd(); - - // We may have been awoken without the timer firing - - if (Result == WAIT_OBJECT_0) { - return VFW_E_STATE_CHANGED; - } - - SignalTimerFired(); - return NOERROR; -} - - -// Poll waiting for Receive to complete. This really matters when -// Receive may set the palette and cause window messages -// The problem is that if we don't really wait for a renderer to -// stop processing we can deadlock waiting for a transform which -// is calling the renderer's Receive() method because the transform's -// Stop method doesn't know to process window messages to unblock -// the renderer's Receive processing -void CBaseRenderer::WaitForReceiveToComplete() -{ - for (;;) { - if (!m_bInReceive) { - break; - } - - MSG msg; - // Receive all interthread sendmessages - PeekMessage(&msg, NULL, WM_NULL, WM_NULL, PM_NOREMOVE); - - Sleep(1); - } - - // If the wakebit for QS_POSTMESSAGE is set, the PeekMessage call - // above just cleared the changebit which will cause some messaging - // calls to block (waitMessage, MsgWaitFor...) now. - // Post a dummy message to set the QS_POSTMESSAGE bit again - if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) { - // Send dummy message - PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); - } -} - -// A filter can have four discrete states, namely Stopped, Running, Paused, -// Intermediate. We are in an intermediate state if we are currently trying -// to pause but haven't yet got the first sample (or if we have been flushed -// in paused state and therefore still have to wait for a sample to arrive) - -// This class contains an event called m_evComplete which is signalled when -// the current state is completed and is not signalled when we are waiting to -// complete the last state transition. As mentioned above the only time we -// use this at the moment is when we wait for a media sample in paused state -// If while we are waiting we receive an end of stream notification from the -// source filter then we know no data is imminent so we can reset the event -// This means that when we transition to paused the source filter must call -// end of stream on us or send us an image otherwise we'll hang indefinately - - -// Simple internal way of getting the real state - -FILTER_STATE CBaseRenderer::GetRealState() { - return m_State; -} - - -// The renderer doesn't complete the full transition to paused states until -// it has got one media sample to render. If you ask it for its state while -// it's waiting it will return the state along with VFW_S_STATE_INTERMEDIATE - -STDMETHODIMP CBaseRenderer::GetState(DWORD dwMSecs,FILTER_STATE *State) -{ - CheckPointer(State,E_POINTER); - - if (WaitDispatchingMessages(m_evComplete, dwMSecs) == WAIT_TIMEOUT) { - *State = m_State; - return VFW_S_STATE_INTERMEDIATE; - } - *State = m_State; - return NOERROR; -} - - -// If we're pausing and we have no samples we don't complete the transition -// to State_Paused and we return S_FALSE. However if the m_bAbort flag has -// been set then all samples are rejected so there is no point waiting for -// one. If we do have a sample then return NOERROR. We will only ever return -// VFW_S_STATE_INTERMEDIATE from GetState after being paused with no sample -// (calling GetState after either being stopped or Run will NOT return this) - -HRESULT CBaseRenderer::CompleteStateChange(FILTER_STATE OldState) -{ - // Allow us to be paused when disconnected - - if (m_pInputPin->IsConnected() == FALSE) { - Ready(); - return S_OK; - } - - // Have we run off the end of stream - - if (IsEndOfStream() == TRUE) { - Ready(); - return S_OK; - } - - // Make sure we get fresh data after being stopped - - if (HaveCurrentSample() == TRUE) { - if (OldState != State_Stopped) { - Ready(); - return S_OK; - } - } - NotReady(); - return S_FALSE; -} - - -// When we stop the filter the things we do are:- - -// Decommit the allocator being used in the connection -// Release the source filter if it's waiting in Receive -// Cancel any advise link we set up with the clock -// Any end of stream signalled is now obsolete so reset -// Allow us to be stopped when we are not connected - -STDMETHODIMP CBaseRenderer::Stop() -{ - CAutoLock cRendererLock(&m_InterfaceLock); - - // Make sure there really is a state change - - if (m_State == State_Stopped) { - return NOERROR; - } - - // Is our input pin connected - - if (m_pInputPin->IsConnected() == FALSE) { - NOTE("Input pin is not connected"); - m_State = State_Stopped; - return NOERROR; - } - - CBaseFilter::Stop(); - - // If we are going into a stopped state then we must decommit whatever - // allocator we are using it so that any source filter waiting in the - // GetBuffer can be released and unlock themselves for a state change - - if (m_pInputPin->Allocator()) { - m_pInputPin->Allocator()->Decommit(); - } - - // Cancel any scheduled rendering - - SetRepaintStatus(TRUE); - StopStreaming(); - SourceThreadCanWait(FALSE); - ResetEndOfStream(); - CancelNotification(); - - // There should be no outstanding clock advise - ASSERT(CancelNotification() == S_FALSE); - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - ASSERT(m_EndOfStreamTimer == 0); - - Ready(); - WaitForReceiveToComplete(); - m_bAbort = FALSE; - - return NOERROR; -} - - -// When we pause the filter the things we do are:- - -// Commit the allocator being used in the connection -// Allow a source filter thread to wait in Receive -// Cancel any clock advise link (we may be running) -// Possibly complete the state change if we have data -// Allow us to be paused when we are not connected - -STDMETHODIMP CBaseRenderer::Pause() -{ - CAutoLock cRendererLock(&m_InterfaceLock); - FILTER_STATE OldState = m_State; - ASSERT(m_pInputPin->IsFlushing() == FALSE); - - // Make sure there really is a state change - - if (m_State == State_Paused) { - return CompleteStateChange(State_Paused); - } - - // Has our input pin been connected - - if (m_pInputPin->IsConnected() == FALSE) { - NOTE("Input pin is not connected"); - m_State = State_Paused; - return CompleteStateChange(State_Paused); - } - - // Pause the base filter class - - HRESULT hr = CBaseFilter::Pause(); - if (FAILED(hr)) { - NOTE("Pause failed"); - return hr; - } - - // Enable EC_REPAINT events again - - SetRepaintStatus(TRUE); - StopStreaming(); - SourceThreadCanWait(TRUE); - CancelNotification(); - ResetEndOfStreamTimer(); - - // If we are going into a paused state then we must commit whatever - // allocator we are using it so that any source filter can call the - // GetBuffer and expect to get a buffer without returning an error - - if (m_pInputPin->Allocator()) { - m_pInputPin->Allocator()->Commit(); - } - - // There should be no outstanding advise - ASSERT(CancelNotification() == S_FALSE); - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - ASSERT(m_EndOfStreamTimer == 0); - ASSERT(m_pInputPin->IsFlushing() == FALSE); - - // When we come out of a stopped state we must clear any image we were - // holding onto for frame refreshing. Since renderers see state changes - // first we can reset ourselves ready to accept the source thread data - // Paused or running after being stopped causes the current position to - // be reset so we're not interested in passing end of stream signals - - if (OldState == State_Stopped) { - m_bAbort = FALSE; - ClearPendingSample(); - } - return CompleteStateChange(OldState); -} - - -// When we run the filter the things we do are:- - -// Commit the allocator being used in the connection -// Allow a source filter thread to wait in Receive -// Signal the render event just to get us going -// Start the base class by calling StartStreaming -// Allow us to be run when we are not connected -// Signal EC_COMPLETE if we are not connected - -STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime) -{ - CAutoLock cRendererLock(&m_InterfaceLock); - FILTER_STATE OldState = m_State; - - // Make sure there really is a state change - - if (m_State == State_Running) { - return NOERROR; - } - - // Send EC_COMPLETE if we're not connected - - if (m_pInputPin->IsConnected() == FALSE) { - NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this); - m_State = State_Running; - return NOERROR; - } - - Ready(); - - // Pause the base filter class - - HRESULT hr = CBaseFilter::Run(StartTime); - if (FAILED(hr)) { - NOTE("Run failed"); - return hr; - } - - // Allow the source thread to wait - ASSERT(m_pInputPin->IsFlushing() == FALSE); - SourceThreadCanWait(TRUE); - SetRepaintStatus(FALSE); - - // There should be no outstanding advise - ASSERT(CancelNotification() == S_FALSE); - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - ASSERT(m_EndOfStreamTimer == 0); - ASSERT(m_pInputPin->IsFlushing() == FALSE); - - // If we are going into a running state then we must commit whatever - // allocator we are using it so that any source filter can call the - // GetBuffer and expect to get a buffer without returning an error - - if (m_pInputPin->Allocator()) { - m_pInputPin->Allocator()->Commit(); - } - - // When we come out of a stopped state we must clear any image we were - // holding onto for frame refreshing. Since renderers see state changes - // first we can reset ourselves ready to accept the source thread data - // Paused or running after being stopped causes the current position to - // be reset so we're not interested in passing end of stream signals - - if (OldState == State_Stopped) { - m_bAbort = FALSE; - ClearPendingSample(); - } - return StartStreaming(); -} - - -// Return the number of input pins we support - -int CBaseRenderer::GetPinCount() -{ - return 1; -} - - -// We only support one input pin and it is numbered zero - -CBasePin *CBaseRenderer::GetPin(int n) -{ - CAutoLock cObjectCreationLock(&m_ObjectCreationLock); - - // Should only ever be called with zero - ASSERT(n == 0); - - if (n != 0) { - return NULL; - } - - // Create the input pin if not already done so - - if (m_pInputPin == NULL) { - - // hr must be initialized to NOERROR because - // CRendererInputPin's constructor only changes - // hr's value if an error occurs. - HRESULT hr = NOERROR; - - m_pInputPin = new CRendererInputPin(this,&hr,L"In"); - if (NULL == m_pInputPin) { - return NULL; - } - - if (FAILED(hr)) { - delete m_pInputPin; - m_pInputPin = NULL; - return NULL; - } - } - return m_pInputPin; -} - - -// If "In" then return the IPin for our input pin, otherwise NULL and error - -STDMETHODIMP CBaseRenderer::FindPin(LPCWSTR Id, IPin **ppPin) -{ - CheckPointer(ppPin,E_POINTER); - - if (0==lstrcmpW(Id,L"In")) { - *ppPin = GetPin(0); - ASSERT(*ppPin); - (*ppPin)->AddRef(); - } else { - *ppPin = NULL; - return VFW_E_NOT_FOUND; - } - return NOERROR; -} - - -// Called when the input pin receives an EndOfStream notification. If we have -// not got a sample, then notify EC_COMPLETE now. If we have samples, then set -// m_bEOS and check for this on completing samples. If we're waiting to pause -// then complete the transition to paused state by setting the state event - -HRESULT CBaseRenderer::EndOfStream() -{ - // Ignore these calls if we are stopped - - if (m_State == State_Stopped) { - return NOERROR; - } - - // If we have a sample then wait for it to be rendered - - m_bEOS = TRUE; - if (m_pMediaSample) { - return NOERROR; - } - - // If we are waiting for pause then we are now ready since we cannot now - // carry on waiting for a sample to arrive since we are being told there - // won't be any. This sets an event that the GetState function picks up - - Ready(); - - // Only signal completion now if we are running otherwise queue it until - // we do run in StartStreaming. This is used when we seek because a seek - // causes a pause where early notification of completion is misleading - - if (m_bStreaming) { - SendEndOfStream(); - } - return NOERROR; -} - - -// When we are told to flush we should release the source thread - -HRESULT CBaseRenderer::BeginFlush() -{ - // If paused then report state intermediate until we get some data - - if (m_State == State_Paused) { - NotReady(); - } - - SourceThreadCanWait(FALSE); - CancelNotification(); - ClearPendingSample(); - // Wait for Receive to complete - WaitForReceiveToComplete(); - - return NOERROR; -} - - -// After flushing the source thread can wait in Receive again - -HRESULT CBaseRenderer::EndFlush() -{ - // Reset the current sample media time - if (m_pPosition) m_pPosition->ResetMediaTime(); - - // There should be no outstanding advise - - ASSERT(CancelNotification() == S_FALSE); - SourceThreadCanWait(TRUE); - return NOERROR; -} - - -// We can now send EC_REPAINTs if so required - -HRESULT CBaseRenderer::CompleteConnect(IPin *pReceivePin) -{ - // The caller should always hold the interface lock because - // the function uses CBaseFilter::m_State. - ASSERT(CritCheckIn(&m_InterfaceLock)); - - m_bAbort = FALSE; - - if (State_Running == GetRealState()) { - HRESULT hr = StartStreaming(); - if (FAILED(hr)) { - return hr; - } - - SetRepaintStatus(FALSE); - } else { - SetRepaintStatus(TRUE); - } - - return NOERROR; -} - - -// Called when we go paused or running - -HRESULT CBaseRenderer::Active() -{ - return NOERROR; -} - - -// Called when we go into a stopped state - -HRESULT CBaseRenderer::Inactive() -{ - if (m_pPosition) { - m_pPosition->ResetMediaTime(); - } - // People who derive from this may want to override this behaviour - // to keep hold of the sample in some circumstances - ClearPendingSample(); - - return NOERROR; -} - - -// Tell derived classes about the media type agreed - -HRESULT CBaseRenderer::SetMediaType(const CMediaType *pmt) -{ - return NOERROR; -} - - -// When we break the input pin connection we should reset the EOS flags. When -// we are asked for either IMediaPosition or IMediaSeeking we will create a -// CPosPassThru object to handles media time pass through. When we're handed -// samples we store (by calling CPosPassThru::RegisterMediaTime) their media -// times so we can then return a real current position of data being rendered - -HRESULT CBaseRenderer::BreakConnect() -{ - // Do we have a quality management sink - - if (m_pQSink) { - m_pQSink->Release(); - m_pQSink = NULL; - } - - // Check we have a valid connection - - if (m_pInputPin->IsConnected() == FALSE) { - return S_FALSE; - } - - // Check we are stopped before disconnecting - if (m_State != State_Stopped && !m_pInputPin->CanReconnectWhenActive()) { - return VFW_E_NOT_STOPPED; - } - - SetRepaintStatus(FALSE); - ResetEndOfStream(); - ClearPendingSample(); - m_bAbort = FALSE; - - if (State_Running == m_State) { - StopStreaming(); - } - - return NOERROR; -} - - -// Retrieves the sample times for this samples (note the sample times are -// passed in by reference not value). We return S_FALSE to say schedule this -// sample according to the times on the sample. We also return S_OK in -// which case the object should simply render the sample data immediately - -HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample, - REFERENCE_TIME *pStartTime, - REFERENCE_TIME *pEndTime) -{ - ASSERT(m_dwAdvise == 0); - ASSERT(pMediaSample); - - // If the stop time for this sample is before or the same as start time, - // then just ignore it (release it) and schedule the next one in line - // Source filters should always fill in the start and end times properly! - - if (SUCCEEDED(pMediaSample->GetTime(pStartTime, pEndTime))) { - if (*pEndTime < *pStartTime) { - return VFW_E_START_TIME_AFTER_END; - } - } else { - // no time set in the sample... draw it now? - return S_OK; - } - - // Can't synchronise without a clock so we return S_OK which tells the - // caller that the sample should be rendered immediately without going - // through the overhead of setting a timer advise link with the clock - - if (m_pClock == NULL) { - return S_OK; - } - return ShouldDrawSampleNow(pMediaSample,pStartTime,pEndTime); -} - - -// By default all samples are drawn according to their time stamps so we -// return S_FALSE. Returning S_OK means draw immediately, this is used -// by the derived video renderer class in its quality management. - -HRESULT CBaseRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample, - REFERENCE_TIME *ptrStart, - REFERENCE_TIME *ptrEnd) -{ - return S_FALSE; -} - - -// We must always reset the current advise time to zero after a timer fires -// because there are several possible ways which lead us not to do any more -// scheduling such as the pending image being cleared after state changes - -void CBaseRenderer::SignalTimerFired() -{ - m_dwAdvise = 0; -} - - -// Cancel any notification currently scheduled. This is called by the owning -// window object when it is told to stop streaming. If there is no timer link -// outstanding then calling this is benign otherwise we go ahead and cancel -// We must always reset the render event as the quality management code can -// signal immediate rendering by setting the event without setting an advise -// link. If we're subsequently stopped and run the first attempt to setup an -// advise link with the reference clock will find the event still signalled - -HRESULT CBaseRenderer::CancelNotification() -{ - ASSERT(m_dwAdvise == 0 || m_pClock); - DWORD_PTR dwAdvise = m_dwAdvise; - - // Have we a live advise link - - if (m_dwAdvise) { - m_pClock->Unadvise(m_dwAdvise); - SignalTimerFired(); - ASSERT(m_dwAdvise == 0); - } - - // Clear the event and return our status - - m_RenderEvent.Reset(); - return (dwAdvise ? S_OK : S_FALSE); -} - - -// Responsible for setting up one shot advise links with the clock -// Return FALSE if the sample is to be dropped (not drawn at all) -// Return TRUE if the sample is to be drawn and in this case also -// arrange for m_RenderEvent to be set at the appropriate time - -BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample) -{ - REFERENCE_TIME StartSample, EndSample; - - // Is someone pulling our leg - - if (pMediaSample == NULL) { - return FALSE; - } - - // Get the next sample due up for rendering. If there aren't any ready - // then GetNextSampleTimes returns an error. If there is one to be done - // then it succeeds and yields the sample times. If it is due now then - // it returns S_OK other if it's to be done when due it returns S_FALSE - - HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample); - if (FAILED(hr)) { - return FALSE; - } - - // If we don't have a reference clock then we cannot set up the advise - // time so we simply set the event indicating an image to render. This - // will cause us to run flat out without any timing or synchronisation - - if (hr == S_OK) { - EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent)); - return TRUE; - } - - ASSERT(m_dwAdvise == 0); - ASSERT(m_pClock); - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - - // We do have a valid reference clock interface so we can ask it to - // set an event when the image comes due for rendering. We pass in - // the reference time we were told to start at and also the current - // stream time which is the offset from the start reference time - - hr = m_pClock->AdviseTime( - (REFERENCE_TIME) m_tStart, // Start run time - StartSample, // Stream time - (HEVENT)(HANDLE) m_RenderEvent, // Render notification - &m_dwAdvise); // Advise cookie - - if (SUCCEEDED(hr)) { - return TRUE; - } - - // We could not schedule the next sample for rendering despite the fact - // we have a valid sample here. This is a fair indication that either - // the system clock is wrong or the time stamp for the sample is duff - - ASSERT(m_dwAdvise == 0); - return FALSE; -} - - -// This is called when a sample comes due for rendering. We pass the sample -// on to the derived class. After rendering we will initialise the timer for -// the next sample, NOTE signal that the last one fired first, if we don't -// do this it thinks there is still one outstanding that hasn't completed - -HRESULT CBaseRenderer::Render(IMediaSample *pMediaSample) -{ - // If the media sample is NULL then we will have been notified by the - // clock that another sample is ready but in the mean time someone has - // stopped us streaming which causes the next sample to be released - - if (pMediaSample == NULL) { - return S_FALSE; - } - - // If we have stopped streaming then don't render any more samples, the - // thread that got in and locked us and then reset this flag does not - // clear the pending sample as we can use it to refresh any output device - - if (m_bStreaming == FALSE) { - return S_FALSE; - } - - // Time how long the rendering takes - - OnRenderStart(pMediaSample); - DoRenderSample(pMediaSample); - OnRenderEnd(pMediaSample); - - return NOERROR; -} - - -// Checks if there is a sample waiting at the renderer - -BOOL CBaseRenderer::HaveCurrentSample() -{ - CAutoLock cRendererLock(&m_RendererLock); - return (m_pMediaSample == NULL ? FALSE : TRUE); -} - - -// Returns the current sample waiting at the video renderer. We AddRef the -// sample before returning so that should it come due for rendering the -// person who called this method will hold the remaining reference count -// that will stop the sample being added back onto the allocator free list - -IMediaSample *CBaseRenderer::GetCurrentSample() -{ - CAutoLock cRendererLock(&m_RendererLock); - if (m_pMediaSample) { - m_pMediaSample->AddRef(); - } - return m_pMediaSample; -} - - -// Called when the source delivers us a sample. We go through a few checks to -// make sure the sample can be rendered. If we are running (streaming) then we -// have the sample scheduled with the reference clock, if we are not streaming -// then we have received an sample in paused mode so we can complete any state -// transition. On leaving this function everything will be unlocked so an app -// thread may get in and change our state to stopped (for example) in which -// case it will also signal the thread event so that our wait call is stopped - -HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample) -{ - CAutoLock cInterfaceLock(&m_InterfaceLock); - m_bInReceive = TRUE; - - // Check our flushing and filter state - - // This function must hold the interface lock because it calls - // CBaseInputPin::Receive() and CBaseInputPin::Receive() uses - // CBasePin::m_bRunTimeError. - HRESULT hr = m_pInputPin->CBaseInputPin::Receive(pMediaSample); - - if (hr != NOERROR) { - m_bInReceive = FALSE; - return E_FAIL; - } - - // Has the type changed on a media sample. We do all rendering - // synchronously on the source thread, which has a side effect - // that only one buffer is ever outstanding. Therefore when we - // have Receive called we can go ahead and change the format - // Since the format change can cause a SendMessage we just don't - // lock - if (m_pInputPin->SampleProps()->pMediaType) { - hr = m_pInputPin->SetMediaType( - (CMediaType *)m_pInputPin->SampleProps()->pMediaType); - if (FAILED(hr)) { - m_bInReceive = FALSE; - return hr; - } - } - - - CAutoLock cSampleLock(&m_RendererLock); - - ASSERT(IsActive() == TRUE); - ASSERT(m_pInputPin->IsFlushing() == FALSE); - ASSERT(m_pInputPin->IsConnected() == TRUE); - ASSERT(m_pMediaSample == NULL); - - // Return an error if we already have a sample waiting for rendering - // source pins must serialise the Receive calls - we also check that - // no data is being sent after the source signalled an end of stream - - if (m_pMediaSample || m_bEOS || m_bAbort) { - Ready(); - m_bInReceive = FALSE; - return E_UNEXPECTED; - } - - // Store the media times from this sample - if (m_pPosition) m_pPosition->RegisterMediaTime(pMediaSample); - - // Schedule the next sample if we are streaming - - if ((m_bStreaming == TRUE) && (ScheduleSample(pMediaSample) == FALSE)) { - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - ASSERT(CancelNotification() == S_FALSE); - m_bInReceive = FALSE; - return VFW_E_SAMPLE_REJECTED; - } - - // Store the sample end time for EC_COMPLETE handling - m_SignalTime = m_pInputPin->SampleProps()->tStop; - - // BEWARE we sometimes keep the sample even after returning the thread to - // the source filter such as when we go into a stopped state (we keep it - // to refresh the device with) so we must AddRef it to keep it safely. If - // we start flushing the source thread is released and any sample waiting - // will be released otherwise GetBuffer may never return (see BeginFlush) - - m_pMediaSample = pMediaSample; - m_pMediaSample->AddRef(); - - if (m_bStreaming == FALSE) { - SetRepaintStatus(TRUE); - } - return NOERROR; -} - - -// Called by the source filter when we have a sample to render. Under normal -// circumstances we set an advise link with the clock, wait for the time to -// arrive and then render the data using the PURE virtual DoRenderSample that -// the derived class will have overriden. After rendering the sample we may -// also signal EOS if it was the last one sent before EndOfStream was called - -HRESULT CBaseRenderer::Receive(IMediaSample *pSample) -{ - ASSERT(pSample); - - // It may return VFW_E_SAMPLE_REJECTED code to say don't bother - - HRESULT hr = PrepareReceive(pSample); - ASSERT(m_bInReceive == SUCCEEDED(hr)); - if (FAILED(hr)) { - if (hr == VFW_E_SAMPLE_REJECTED) { - return NOERROR; - } - return hr; - } - - // We realize the palette in "PrepareRender()" so we have to give away the - // filter lock here. - if (m_State == State_Paused) { - PrepareRender(); - // no need to use InterlockedExchange - m_bInReceive = FALSE; - { - // We must hold both these locks - CAutoLock cRendererLock(&m_InterfaceLock); - if (m_State == State_Stopped) - return NOERROR; - - m_bInReceive = TRUE; - CAutoLock cSampleLock(&m_RendererLock); - OnReceiveFirstSample(pSample); - } - Ready(); - } - // Having set an advise link with the clock we sit and wait. We may be - // awoken by the clock firing or by a state change. The rendering call - // will lock the critical section and check we can still render the data - - hr = WaitForRenderTime(); - if (FAILED(hr)) { - m_bInReceive = FALSE; - return NOERROR; - } - - PrepareRender(); - - // Set this here and poll it until we work out the locking correctly - // It can't be right that the streaming stuff grabs the interface - // lock - after all we want to be able to wait for this stuff - // to complete - m_bInReceive = FALSE; - - // We must hold both these locks - CAutoLock cRendererLock(&m_InterfaceLock); - - // since we gave away the filter wide lock, the sate of the filter could - // have chnaged to Stopped - if (m_State == State_Stopped) - return NOERROR; - - CAutoLock cSampleLock(&m_RendererLock); - - // Deal with this sample - - Render(m_pMediaSample); - ClearPendingSample(); - SendEndOfStream(); - CancelNotification(); - return NOERROR; -} - - -// This is called when we stop or are inactivated to clear the pending sample -// We release the media sample interface so that they can be allocated to the -// source filter again, unless of course we are changing state to inactive in -// which case GetBuffer will return an error. We must also reset the current -// media sample to NULL so that we know we do not currently have an image - -HRESULT CBaseRenderer::ClearPendingSample() -{ - CAutoLock cRendererLock(&m_RendererLock); - if (m_pMediaSample) { - m_pMediaSample->Release(); - m_pMediaSample = NULL; - } - return NOERROR; -} - - -// Used to signal end of stream according to the sample end time - -void CALLBACK EndOfStreamTimer(UINT uID, // Timer identifier - UINT uMsg, // Not currently used - DWORD_PTR dwUser,// User information - DWORD_PTR dw1, // Windows reserved - DWORD_PTR dw2) // is also reserved -{ - CBaseRenderer *pRenderer = (CBaseRenderer *) dwUser; - NOTE1("EndOfStreamTimer called (%d)",uID); - pRenderer->TimerCallback(); -} - -// Do the timer callback work -void CBaseRenderer::TimerCallback() -{ - // Lock for synchronization (but don't hold this lock when calling - // timeKillEvent) - CAutoLock cRendererLock(&m_RendererLock); - - // See if we should signal end of stream now - - if (m_EndOfStreamTimer) { - m_EndOfStreamTimer = 0; - SendEndOfStream(); - } -} - - -// If we are at the end of the stream signal the filter graph but do not set -// the state flag back to FALSE. Once we drop off the end of the stream we -// leave the flag set (until a subsequent ResetEndOfStream). Each sample we -// get delivered will update m_SignalTime to be the last sample's end time. -// We must wait this long before signalling end of stream to the filtergraph - -#define TIMEOUT_DELIVERYWAIT 50 -#define TIMEOUT_RESOLUTION 10 - -HRESULT CBaseRenderer::SendEndOfStream() -{ - ASSERT(CritCheckIn(&m_RendererLock)); - if (m_bEOS == FALSE || m_bEOSDelivered || m_EndOfStreamTimer) { - return NOERROR; - } - - // If there is no clock then signal immediately - if (m_pClock == NULL) { - return NotifyEndOfStream(); - } - - // How long into the future is the delivery time - - REFERENCE_TIME Signal = m_tStart + m_SignalTime; - REFERENCE_TIME CurrentTime; - m_pClock->GetTime(&CurrentTime); - LONG Delay = LONG((Signal - CurrentTime) / 10000); - - // Dump the timing information to the debugger - - NOTE1("Delay until end of stream delivery %d",Delay); - NOTE1("Current %s",(LPCTSTR)CDisp((LONGLONG)CurrentTime)); - NOTE1("Signal %s",(LPCTSTR)CDisp((LONGLONG)Signal)); - - // Wait for the delivery time to arrive - - if (Delay < TIMEOUT_DELIVERYWAIT) { - return NotifyEndOfStream(); - } - - // Signal a timer callback on another worker thread - - m_EndOfStreamTimer = CompatibleTimeSetEvent((UINT) Delay, // Period of timer - TIMEOUT_RESOLUTION, // Timer resolution - EndOfStreamTimer, // Callback function - DWORD_PTR(this), // Used information - TIME_ONESHOT); // Type of callback - if (m_EndOfStreamTimer == 0) { - return NotifyEndOfStream(); - } - return NOERROR; -} - - -// Signals EC_COMPLETE to the filtergraph manager - -HRESULT CBaseRenderer::NotifyEndOfStream() -{ - CAutoLock cRendererLock(&m_RendererLock); - ASSERT(m_bEOSDelivered == FALSE); - ASSERT(m_EndOfStreamTimer == 0); - - // Has the filter changed state - - if (m_bStreaming == FALSE) { - ASSERT(m_EndOfStreamTimer == 0); - return NOERROR; - } - - // Reset the end of stream timer - m_EndOfStreamTimer = 0; - - // If we've been using the IMediaPosition interface, set it's start - // and end media "times" to the stop position by hand. This ensures - // that we actually get to the end, even if the MPEG guestimate has - // been bad or if the quality management dropped the last few frames - - if (m_pPosition) m_pPosition->EOS(); - m_bEOSDelivered = TRUE; - NOTE("Sending EC_COMPLETE..."); - return NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this); -} - - -// Reset the end of stream flag, this is typically called when we transfer to -// stopped states since that resets the current position back to the start so -// we will receive more samples or another EndOfStream if there aren't any. We -// keep two separate flags one to say we have run off the end of the stream -// (this is the m_bEOS flag) and another to say we have delivered EC_COMPLETE -// to the filter graph. We need the latter otherwise we can end up sending an -// EC_COMPLETE every time the source changes state and calls our EndOfStream - -HRESULT CBaseRenderer::ResetEndOfStream() -{ - ResetEndOfStreamTimer(); - CAutoLock cRendererLock(&m_RendererLock); - - m_bEOS = FALSE; - m_bEOSDelivered = FALSE; - m_SignalTime = 0; - - return NOERROR; -} - - -// Kills any outstanding end of stream timer - -void CBaseRenderer::ResetEndOfStreamTimer() -{ - ASSERT(CritCheckOut(&m_RendererLock)); - if (m_EndOfStreamTimer) { - timeKillEvent(m_EndOfStreamTimer); - m_EndOfStreamTimer = 0; - } -} - - -// This is called when we start running so that we can schedule any pending -// image we have with the clock and display any timing information. If we -// don't have any sample but we have queued an EOS flag then we send it. If -// we do have a sample then we wait until that has been rendered before we -// signal the filter graph otherwise we may change state before it's done - -HRESULT CBaseRenderer::StartStreaming() -{ - CAutoLock cRendererLock(&m_RendererLock); - if (m_bStreaming == TRUE) { - return NOERROR; - } - - // Reset the streaming times ready for running - - m_bStreaming = TRUE; - - timeBeginPeriod(1); - OnStartStreaming(); - - // There should be no outstanding advise - ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); - ASSERT(CancelNotification() == S_FALSE); - - // If we have an EOS and no data then deliver it now - - if (m_pMediaSample == NULL) { - return SendEndOfStream(); - } - - // Have the data rendered - - ASSERT(m_pMediaSample); - if (!ScheduleSample(m_pMediaSample)) - m_RenderEvent.Set(); - - return NOERROR; -} - - -// This is called when we stop streaming so that we can set our internal flag -// indicating we are not now to schedule any more samples arriving. The state -// change methods in the filter implementation take care of cancelling any -// clock advise link we have set up and clearing any pending sample we have - -HRESULT CBaseRenderer::StopStreaming() -{ - CAutoLock cRendererLock(&m_RendererLock); - m_bEOSDelivered = FALSE; - - if (m_bStreaming == TRUE) { - m_bStreaming = FALSE; - OnStopStreaming(); - timeEndPeriod(1); - } - return NOERROR; -} - - -// We have a boolean flag that is reset when we have signalled EC_REPAINT to -// the filter graph. We set this when we receive an image so that should any -// conditions arise again we can send another one. By having a flag we ensure -// we don't flood the filter graph with redundant calls. We do not set the -// event when we receive an EndOfStream call since there is no point in us -// sending further EC_REPAINTs. In particular the AutoShowWindow method and -// the DirectDraw object use this method to control the window repainting - -void CBaseRenderer::SetRepaintStatus(BOOL bRepaint) -{ - CAutoLock cSampleLock(&m_RendererLock); - m_bRepaintStatus = bRepaint; -} - - -// Pass the window handle to the upstream filter - -void CBaseRenderer::SendNotifyWindow(IPin *pPin,HWND hwnd) -{ - IMediaEventSink *pSink; - - // Does the pin support IMediaEventSink - HRESULT hr = pPin->QueryInterface(IID_IMediaEventSink,(void **)&pSink); - if (SUCCEEDED(hr)) { - pSink->Notify(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0); - pSink->Release(); - } - NotifyEvent(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0); -} - - -// Signal an EC_REPAINT to the filter graph. This can be used to have data -// sent to us. For example when a video window is first displayed it may -// not have an image to display, at which point it signals EC_REPAINT. The -// filtergraph will either pause the graph if stopped or if already paused -// it will call put_CurrentPosition of the current position. Setting the -// current position to itself has the stream flushed and the image resent - -#define RLOG(_x_) DbgLog((LOG_TRACE,1,TEXT(_x_))); - -void CBaseRenderer::SendRepaint() -{ - CAutoLock cSampleLock(&m_RendererLock); - ASSERT(m_pInputPin); - - // We should not send repaint notifications when... - // - An end of stream has been notified - // - Our input pin is being flushed - // - The input pin is not connected - // - We have aborted a video playback - // - There is a repaint already sent - - if (m_bAbort == FALSE) { - if (m_pInputPin->IsConnected() == TRUE) { - if (m_pInputPin->IsFlushing() == FALSE) { - if (IsEndOfStream() == FALSE) { - if (m_bRepaintStatus == TRUE) { - IPin *pPin = (IPin *) m_pInputPin; - NotifyEvent(EC_REPAINT,(LONG_PTR) pPin,0); - SetRepaintStatus(FALSE); - RLOG("Sending repaint"); - } - } - } - } - } -} - - -// When a video window detects a display change (WM_DISPLAYCHANGE message) it -// can send an EC_DISPLAY_CHANGED event code along with the renderer pin. The -// filtergraph will stop everyone and reconnect our input pin. As we're then -// reconnected we can accept the media type that matches the new display mode -// since we may no longer be able to draw the current image type efficiently - -BOOL CBaseRenderer::OnDisplayChange() -{ - // Ignore if we are not connected yet - - CAutoLock cSampleLock(&m_RendererLock); - if (m_pInputPin->IsConnected() == FALSE) { - return FALSE; - } - - RLOG("Notification of EC_DISPLAY_CHANGE"); - - // Pass our input pin as parameter on the event - - IPin *pPin = (IPin *) m_pInputPin; - m_pInputPin->AddRef(); - NotifyEvent(EC_DISPLAY_CHANGED,(LONG_PTR) pPin,0); - SetAbortSignal(TRUE); - ClearPendingSample(); - m_pInputPin->Release(); - - return TRUE; -} - - -// Called just before we start drawing. -// Store the current time in m_trRenderStart to allow the rendering time to be -// logged. Log the time stamp of the sample and how late it is (neg is early) - -void CBaseRenderer::OnRenderStart(IMediaSample *pMediaSample) -{ -#ifdef PERF - REFERENCE_TIME trStart, trEnd; - pMediaSample->GetTime(&trStart, &trEnd); - - MSR_INTEGER(m_idBaseStamp, (int)trStart); // dump low order 32 bits - - m_pClock->GetTime(&m_trRenderStart); - MSR_INTEGER(0, (int)m_trRenderStart); - REFERENCE_TIME trStream; - trStream = m_trRenderStart-m_tStart; // convert reftime to stream time - MSR_INTEGER(0,(int)trStream); - - const int trLate = (int)(trStream - trStart); - MSR_INTEGER(m_idBaseAccuracy, trLate/10000); // dump in mSec -#endif - -} // OnRenderStart - - -// Called directly after drawing an image. -// calculate the time spent drawing and log it. - -void CBaseRenderer::OnRenderEnd(IMediaSample *pMediaSample) -{ -#ifdef PERF - REFERENCE_TIME trNow; - m_pClock->GetTime(&trNow); - MSR_INTEGER(0,(int)trNow); - int t = (int)((trNow - m_trRenderStart)/10000); // convert UNITS->msec - MSR_INTEGER(m_idBaseRenderTime, t); -#endif -} // OnRenderEnd - - - - -// Constructor must be passed the base renderer object - -CRendererInputPin::CRendererInputPin(CBaseRenderer *pRenderer, - HRESULT *phr, - LPCWSTR pPinName) : - CBaseInputPin(NAME("Renderer pin"), - pRenderer, - &pRenderer->m_InterfaceLock, - (HRESULT *) phr, - pPinName) -{ - m_pRenderer = pRenderer; - ASSERT(m_pRenderer); -} - - -// Signals end of data stream on the input pin - -STDMETHODIMP CRendererInputPin::EndOfStream() -{ - CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); - CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); - - // Make sure we're streaming ok - - HRESULT hr = CheckStreaming(); - if (hr != NOERROR) { - return hr; - } - - // Pass it onto the renderer - - hr = m_pRenderer->EndOfStream(); - if (SUCCEEDED(hr)) { - hr = CBaseInputPin::EndOfStream(); - } - return hr; -} - - -// Signals start of flushing on the input pin - we do the final reset end of -// stream with the renderer lock unlocked but with the interface lock locked -// We must do this because we call timeKillEvent, our timer callback method -// has to take the renderer lock to serialise our state. Therefore holding a -// renderer lock when calling timeKillEvent could cause a deadlock condition - -STDMETHODIMP CRendererInputPin::BeginFlush() -{ - CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); - { - CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); - CBaseInputPin::BeginFlush(); - m_pRenderer->BeginFlush(); - } - return m_pRenderer->ResetEndOfStream(); -} - - -// Signals end of flushing on the input pin - -STDMETHODIMP CRendererInputPin::EndFlush() -{ - CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); - CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); - - HRESULT hr = m_pRenderer->EndFlush(); - if (SUCCEEDED(hr)) { - hr = CBaseInputPin::EndFlush(); - } - return hr; -} - - -// Pass the sample straight through to the renderer object - -STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample) -{ - HRESULT hr = m_pRenderer->Receive(pSample); - if (FAILED(hr)) { - - // A deadlock could occur if the caller holds the renderer lock and - // attempts to acquire the interface lock. - ASSERT(CritCheckOut(&m_pRenderer->m_RendererLock)); - - { - // The interface lock must be held when the filter is calling - // IsStopped() or IsFlushing(). The interface lock must also - // be held because the function uses m_bRunTimeError. - CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); - - // We do not report errors which occur while the filter is stopping, - // flushing or if the m_bAbort flag is set . Errors are expected to - // occur during these operations and the streaming thread correctly - // handles the errors. - if (!IsStopped() && !IsFlushing() && !m_pRenderer->m_bAbort && !m_bRunTimeError) { - - // EC_ERRORABORT's first parameter is the error which caused - // the event and its' last parameter is 0. See the Direct - // Show SDK documentation for more information. - m_pRenderer->NotifyEvent(EC_ERRORABORT,hr,0); - - { - CAutoLock alRendererLock(&m_pRenderer->m_RendererLock); - if (m_pRenderer->IsStreaming() && !m_pRenderer->IsEndOfStreamDelivered()) { - m_pRenderer->NotifyEndOfStream(); - } - } - - m_bRunTimeError = TRUE; - } - } - } - - return hr; -} - - -// Called when the input pin is disconnected - -HRESULT CRendererInputPin::BreakConnect() -{ - HRESULT hr = m_pRenderer->BreakConnect(); - if (FAILED(hr)) { - return hr; - } - return CBaseInputPin::BreakConnect(); -} - - -// Called when the input pin is connected - -HRESULT CRendererInputPin::CompleteConnect(IPin *pReceivePin) -{ - HRESULT hr = m_pRenderer->CompleteConnect(pReceivePin); - if (FAILED(hr)) { - return hr; - } - return CBaseInputPin::CompleteConnect(pReceivePin); -} - - -// Give the pin id of our one and only pin - -STDMETHODIMP CRendererInputPin::QueryId(LPWSTR *Id) -{ - CheckPointer(Id,E_POINTER); - - *Id = (LPWSTR)CoTaskMemAlloc(8); - if (*Id == NULL) { - return E_OUTOFMEMORY; - } - lstrcpyW(*Id, L"In"); - return NOERROR; -} - - -// Will the filter accept this media type - -HRESULT CRendererInputPin::CheckMediaType(const CMediaType *pmt) -{ - return m_pRenderer->CheckMediaType(pmt); -} - - -// Called when we go paused or running - -HRESULT CRendererInputPin::Active() -{ - return m_pRenderer->Active(); -} - - -// Called when we go into a stopped state - -HRESULT CRendererInputPin::Inactive() -{ - // The caller must hold the interface lock because - // this function uses m_bRunTimeError. - ASSERT(CritCheckIn(&m_pRenderer->m_InterfaceLock)); - - m_bRunTimeError = FALSE; - - return m_pRenderer->Inactive(); -} - - -// Tell derived classes about the media type agreed - -HRESULT CRendererInputPin::SetMediaType(const CMediaType *pmt) -{ - HRESULT hr = CBaseInputPin::SetMediaType(pmt); - if (FAILED(hr)) { - return hr; - } - return m_pRenderer->SetMediaType(pmt); -} - - -// We do not keep an event object to use when setting up a timer link with -// the clock but are given a pointer to one by the owning object through the -// SetNotificationObject method - this must be initialised before starting -// We can override the default quality management process to have it always -// draw late frames, this is currently done by having the following registry -// key (actually an INI key) called DrawLateFrames set to 1 (default is 0) - -const TCHAR AMQUALITY[] = TEXT("ActiveMovie"); -const TCHAR DRAWLATEFRAMES[] = TEXT("DrawLateFrames"); - -CBaseVideoRenderer::CBaseVideoRenderer( - REFCLSID RenderClass, // CLSID for this renderer - TCHAR *pName, // Debug ONLY description - LPUNKNOWN pUnk, // Aggregated owner object - HRESULT *phr) : // General OLE return code - - CBaseRenderer(RenderClass,pName,pUnk,phr), - m_cFramesDropped(0), - m_cFramesDrawn(0), - m_bSupplierHandlingQuality(FALSE) -{ - ResetStreamingTimes(); - -#ifdef PERF - m_idTimeStamp = MSR_REGISTER(TEXT("Frame time stamp")); - m_idEarliness = MSR_REGISTER(TEXT("Earliness fudge")); - m_idTarget = MSR_REGISTER(TEXT("Target (mSec)")); - m_idSchLateTime = MSR_REGISTER(TEXT("mSec late when scheduled")); - m_idDecision = MSR_REGISTER(TEXT("Scheduler decision code")); - m_idQualityRate = MSR_REGISTER(TEXT("Quality rate sent")); - m_idQualityTime = MSR_REGISTER(TEXT("Quality time sent")); - m_idWaitReal = MSR_REGISTER(TEXT("Render wait")); - // m_idWait = MSR_REGISTER(TEXT("wait time recorded (msec)")); - m_idFrameAccuracy = MSR_REGISTER(TEXT("Frame accuracy (msecs)")); - m_bDrawLateFrames = GetProfileInt(AMQUALITY, DRAWLATEFRAMES, FALSE); - //m_idSendQuality = MSR_REGISTER(TEXT("Processing Quality message")); - - m_idRenderAvg = MSR_REGISTER(TEXT("Render draw time Avg")); - m_idFrameAvg = MSR_REGISTER(TEXT("FrameAvg")); - m_idWaitAvg = MSR_REGISTER(TEXT("WaitAvg")); - m_idDuration = MSR_REGISTER(TEXT("Duration")); - m_idThrottle = MSR_REGISTER(TEXT("Audio-video throttle wait")); - // m_idDebug = MSR_REGISTER(TEXT("Debug stuff")); -#endif // PERF -} // Constructor - - -// Destructor is just a placeholder - -CBaseVideoRenderer::~CBaseVideoRenderer() -{ - ASSERT(m_dwAdvise == 0); -} - - -// The timing functions in this class are called by the window object and by -// the renderer's allocator. -// The windows object calls timing functions as it receives media sample -// images for drawing using GDI. -// The allocator calls timing functions when it starts passing DCI/DirectDraw -// surfaces which are not rendered in the same way; The decompressor writes -// directly to the surface with no separate rendering, so those code paths -// call direct into us. Since we only ever hand out DCI/DirectDraw surfaces -// when we have allocated one and only one image we know there cannot be any -// conflict between the two. -// -// We use timeGetTime to return the timing counts we use (since it's relative -// performance we are interested in rather than absolute compared to a clock) -// The window object sets the accuracy of the system clock (normally 1ms) by -// calling timeBeginPeriod/timeEndPeriod when it changes streaming states - - -// Reset all times controlling streaming. -// Set them so that -// 1. Frames will not initially be dropped -// 2. The first frame will definitely be drawn (achieved by saying that there -// has not ben a frame drawn for a long time). - -HRESULT CBaseVideoRenderer::ResetStreamingTimes() -{ - m_trLastDraw = -1000; // set up as first frame since ages (1 sec) ago - m_tStreamingStart = timeGetTime(); - m_trRenderAvg = 0; - m_trFrameAvg = -1; // -1000 fps == "unset" - m_trDuration = 0; // 0 - strange value - m_trRenderLast = 0; - m_trWaitAvg = 0; - m_tRenderStart = 0; - m_cFramesDrawn = 0; - m_cFramesDropped = 0; - m_iTotAcc = 0; - m_iSumSqAcc = 0; - m_iSumSqFrameTime = 0; - m_trFrame = 0; // hygeine - not really needed - m_trLate = 0; // hygeine - not really needed - m_iSumFrameTime = 0; - m_nNormal = 0; - m_trEarliness = 0; - m_trTarget = -300000; // 30mSec early - m_trThrottle = 0; - m_trRememberStampForPerf = 0; - -#ifdef PERF - m_trRememberFrameForPerf = 0; -#endif - - return NOERROR; -} // ResetStreamingTimes - - -// Reset all times controlling streaming. Note that we're now streaming. We -// don't need to set the rendering event to have the source filter released -// as it is done during the Run processing. When we are run we immediately -// release the source filter thread and draw any image waiting (that image -// may already have been drawn once as a poster frame while we were paused) - -HRESULT CBaseVideoRenderer::OnStartStreaming() -{ - ResetStreamingTimes(); - return NOERROR; -} // OnStartStreaming - - -// Called at end of streaming. Fixes times for property page report - -HRESULT CBaseVideoRenderer::OnStopStreaming() -{ - m_tStreamingStart = timeGetTime()-m_tStreamingStart; - return NOERROR; -} // OnStopStreaming - - -// Called when we start waiting for a rendering event. -// Used to update times spent waiting and not waiting. - -void CBaseVideoRenderer::OnWaitStart() -{ - MSR_START(m_idWaitReal); -} // OnWaitStart - - -// Called when we are awoken from the wait in the window OR by our allocator -// when it is hanging around until the next sample is due for rendering on a -// DCI/DirectDraw surface. We add the wait time into our rolling average. -// We grab the interface lock so that we're serialised with the application -// thread going through the run code - which in due course ends up calling -// ResetStreaming times - possibly as we run through this section of code - -void CBaseVideoRenderer::OnWaitEnd() -{ -#ifdef PERF - MSR_STOP(m_idWaitReal); - // for a perf build we want to know just exactly how late we REALLY are. - // even if this means that we have to look at the clock again. - - REFERENCE_TIME trRealStream; // the real time now expressed as stream time. -#if 0 - m_pClock->GetTime(&trRealStream); // Calling clock here causes W95 deadlock! -#else - // We will be discarding overflows like mad here! - // This is wrong really because timeGetTime() can wrap but it's - // only for PERF - REFERENCE_TIME tr = timeGetTime()*10000; - trRealStream = tr + m_llTimeOffset; -#endif - trRealStream -= m_tStart; // convert to stream time (this is a reftime) - - if (m_trRememberStampForPerf==0) { - // This is probably the poster frame at the start, and it is not scheduled - // in the usual way at all. Just count it. The rememberstamp gets set - // in ShouldDrawSampleNow, so this does invalid frame recording until we - // actually start playing. - PreparePerformanceData(0, 0); - } else { - int trLate = (int)(trRealStream - m_trRememberStampForPerf); - int trFrame = (int)(tr - m_trRememberFrameForPerf); - PreparePerformanceData(trLate, trFrame); - } - m_trRememberFrameForPerf = tr; -#endif //PERF -} // OnWaitEnd - - -// Put data on one side that describes the lateness of the current frame. -// We don't yet know whether it will actually be drawn. In direct draw mode, -// this decision is up to the filter upstream, and it could change its mind. -// The rules say that if it did draw it must call Receive(). One way or -// another we eventually get into either OnRenderStart or OnDirectRender and -// these both call RecordFrameLateness to update the statistics. - -void CBaseVideoRenderer::PreparePerformanceData(int trLate, int trFrame) -{ - m_trLate = trLate; - m_trFrame = trFrame; -} // PreparePerformanceData - - -// update the statistics: -// m_iTotAcc, m_iSumSqAcc, m_iSumSqFrameTime, m_iSumFrameTime, m_cFramesDrawn -// Note that because the properties page reports using these variables, -// 1. We need to be inside a critical section -// 2. They must all be updated together. Updating the sums here and the count -// elsewhere can result in imaginary jitter (i.e. attempts to find square roots -// of negative numbers) in the property page code. - -void CBaseVideoRenderer::RecordFrameLateness(int trLate, int trFrame) -{ - // Record how timely we are. - int tLate = trLate/10000; - - // Best estimate of moment of appearing on the screen is average of - // start and end draw times. Here we have only the end time. This may - // tend to show us as spuriously late by up to 1/2 frame rate achieved. - // Decoder probably monitors draw time. We don't bother. - MSR_INTEGER( m_idFrameAccuracy, tLate ); - - // This is a kludge - we can get frames that are very late - // especially (at start-up) and they invalidate the statistics. - // So ignore things that are more than 1 sec off. - if (tLate>1000 || tLate<-1000) { - if (m_cFramesDrawn<=1) { - tLate = 0; - } else if (tLate>0) { - tLate = 1000; - } else { - tLate = -1000; - } - } - // The very first frame often has a invalid time, so don't - // count it into the statistics. (???) - if (m_cFramesDrawn>1) { - m_iTotAcc += tLate; - m_iSumSqAcc += (tLate*tLate); - } - - // calculate inter-frame time. Doesn't make sense for first frame - // second frame suffers from invalid first frame stamp. - if (m_cFramesDrawn>2) { - int tFrame = trFrame/10000; // convert to mSec else it overflows - - // This is a kludge. It can overflow anyway (a pause can cause - // a very long inter-frame time) and it overflows at 2**31/10**7 - // or about 215 seconds i.e. 3min 35sec - if (tFrame>1000||tFrame<0) tFrame = 1000; - m_iSumSqFrameTime += tFrame*tFrame; - ASSERT(m_iSumSqFrameTime>=0); - m_iSumFrameTime += tFrame; - } - ++m_cFramesDrawn; - -} // RecordFrameLateness - - -void CBaseVideoRenderer::ThrottleWait() -{ - if (m_trThrottle>0) { - int iThrottle = m_trThrottle/10000; // convert to mSec - MSR_INTEGER( m_idThrottle, iThrottle); - DbgLog((LOG_TRACE, 0, TEXT("Throttle %d ms"), iThrottle)); - Sleep(iThrottle); - } else { - Sleep(0); - } -} // ThrottleWait - - -// Whenever a frame is rendered it goes though either OnRenderStart -// or OnDirectRender. Data that are generated during ShouldDrawSample -// are added to the statistics by calling RecordFrameLateness from both -// these two places. - -// Called in place of OnRenderStart..OnRenderEnd -// When a DirectDraw image is drawn -void CBaseVideoRenderer::OnDirectRender(IMediaSample *pMediaSample) -{ - m_trRenderAvg = 0; - m_trRenderLast = 5000000; // If we mode switch, we do NOT want this - // to inhibit the new average getting going! - // so we set it to half a second - // MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000); - RecordFrameLateness(m_trLate, m_trFrame); - ThrottleWait(); -} // OnDirectRender - - -// Called just before we start drawing. All we do is to get the current clock -// time (from the system) and return. We have to store the start render time -// in a member variable because it isn't used until we complete the drawing -// The rest is just performance logging. - -void CBaseVideoRenderer::OnRenderStart(IMediaSample *pMediaSample) -{ - RecordFrameLateness(m_trLate, m_trFrame); - m_tRenderStart = timeGetTime(); -} // OnRenderStart - - -// Called directly after drawing an image. We calculate the time spent in the -// drawing code and if this doesn't appear to have any odd looking spikes in -// it then we add it to the current average draw time. Measurement spikes may -// occur if the drawing thread is interrupted and switched to somewhere else. - -void CBaseVideoRenderer::OnRenderEnd(IMediaSample *pMediaSample) -{ - // The renderer time can vary erratically if we are interrupted so we do - // some smoothing to help get more sensible figures out but even that is - // not enough as figures can go 9,10,9,9,83,9 and we must disregard 83 - - int tr = (timeGetTime() - m_tRenderStart)*10000; // convert mSec->UNITS - if (tr < m_trRenderAvg*2 || tr < 2 * m_trRenderLast) { - // DO_MOVING_AVG(m_trRenderAvg, tr); - m_trRenderAvg = (tr + (AVGPERIOD-1)*m_trRenderAvg)/AVGPERIOD; - } - m_trRenderLast = tr; - ThrottleWait(); -} // OnRenderEnd - - -STDMETHODIMP CBaseVideoRenderer::SetSink( IQualityControl * piqc) -{ - - m_pQSink = piqc; - - return NOERROR; -} // SetSink - - -STDMETHODIMP CBaseVideoRenderer::Notify( IBaseFilter * pSelf, Quality q) -{ - // NOTE: We are NOT getting any locks here. We could be called - // asynchronously and possibly even on a time critical thread of - // someone else's - so we do the minumum. We only set one state - // variable (an integer) and if that happens to be in the middle - // of another thread reading it they will just get either the new - // or the old value. Locking would achieve no more than this. - - // It might be nice to check that we are being called from m_pGraph, but - // it turns out to be a millisecond or so per throw! - - // This is heuristics, these numbers are aimed at being "what works" - // rather than anything based on some theory. - // We use a hyperbola because it's easy to calculate and it includes - // a panic button asymptote (which we push off just to the left) - // The throttling fits the following table (roughly) - // Proportion Throttle (msec) - // >=1000 0 - // 900 3 - // 800 7 - // 700 11 - // 600 17 - // 500 25 - // 400 35 - // 300 50 - // 200 72 - // 125 100 - // 100 112 - // 50 146 - // 0 200 - - // (some evidence that we could go for a sharper kink - e.g. no throttling - // until below the 750 mark - might give fractionally more frames on a - // P60-ish machine). The easy way to get these coefficients is to use - // Renbase.xls follow the instructions therein using excel solver. - - if (q.Proportion>=1000) { m_trThrottle = 0; } - else { - // The DWORD is to make quite sure I get unsigned arithmetic - // as the constant is between 2**31 and 2**32 - m_trThrottle = -330000 + (388880000/(q.Proportion+167)); - } - return NOERROR; -} // Notify - - -// Send a message to indicate what our supplier should do about quality. -// Theory: -// What a supplier wants to know is "is the frame I'm working on NOW -// going to be late?". -// F1 is the frame at the supplier (as above) -// Tf1 is the due time for F1 -// T1 is the time at that point (NOW!) -// Tr1 is the time that f1 WILL actually be rendered -// L1 is the latency of the graph for frame F1 = Tr1-T1 -// D1 (for delay) is how late F1 will be beyond its due time i.e. -// D1 = (Tr1-Tf1) which is what the supplier really wants to know. -// Unfortunately Tr1 is in the future and is unknown, so is L1 -// -// We could estimate L1 by its value for a previous frame, -// L0 = Tr0-T0 and work off -// D1' = ((T1+L0)-Tf1) = (T1 + (Tr0-T0) -Tf1) -// Rearranging terms: -// D1' = (T1-T0) + (Tr0-Tf1) -// adding (Tf0-Tf0) and rearranging again: -// = (T1-T0) + (Tr0-Tf0) + (Tf0-Tf1) -// = (T1-T0) - (Tf1-Tf0) + (Tr0-Tf0) -// But (Tr0-Tf0) is just D0 - how late frame zero was, and this is the -// Late field in the quality message that we send. -// The other two terms just state what correction should be applied before -// using the lateness of F0 to predict the lateness of F1. -// (T1-T0) says how much time has actually passed (we have lost this much) -// (Tf1-Tf0) says how much time should have passed if we were keeping pace -// (we have gained this much). -// -// Suppliers should therefore work off: -// Quality.Late + (T1-T0) - (Tf1-Tf0) -// and see if this is "acceptably late" or even early (i.e. negative). -// They get T1 and T0 by polling the clock, they get Tf1 and Tf0 from -// the time stamps in the frames. They get Quality.Late from us. -// - -HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate, - REFERENCE_TIME trRealStream) -{ - Quality q; - HRESULT hr; - - // If we are the main user of time, then report this as Flood/Dry. - // If our suppliers are, then report it as Famine/Glut. - // - // We need to take action, but avoid hunting. Hunting is caused by - // 1. Taking too much action too soon and overshooting - // 2. Taking too long to react (so averaging can CAUSE hunting). - // - // The reason why we use trLate as well as Wait is to reduce hunting; - // if the wait time is coming down and about to go into the red, we do - // NOT want to rely on some average which is only telling is that it used - // to be OK once. - - q.TimeStamp = (REFERENCE_TIME)trRealStream; - - if (m_trFrameAvg<0) { - q.Type = Famine; // guess - } - // Is the greater part of the time taken bltting or something else - else if (m_trFrameAvg > 2*m_trRenderAvg) { - q.Type = Famine; // mainly other - } else { - q.Type = Flood; // mainly bltting - } - - q.Proportion = 1000; // default - - if (m_trFrameAvg<0) { - // leave it alone - we don't know enough - } - else if ( trLate> 0 ) { - // try to catch up over the next second - // We could be Really, REALLY late, but rendering all the frames - // anyway, just because it's so cheap. - - q.Proportion = 1000 - (int)((trLate)/(UNITS/1000)); - if (q.Proportion<500) { - q.Proportion = 500; // don't go daft. (could've been negative!) - } else { - } - - } else if ( m_trWaitAvg>20000 - && trLate<-20000 - ){ - // Go cautiously faster - aim at 2mSec wait. - if (m_trWaitAvg>=m_trFrameAvg) { - // This can happen because of some fudges. - // The waitAvg is how long we originally planned to wait - // The frameAvg is more honest. - // It means that we are spending a LOT of time waiting - q.Proportion = 2000; // double. - } else { - if (m_trFrameAvg+20000 > m_trWaitAvg) { - q.Proportion - = 1000 * (m_trFrameAvg / (m_trFrameAvg + 20000 - m_trWaitAvg)); - } else { - // We're apparently spending more than the whole frame time waiting. - // Assume that the averages are slightly out of kilter, but that we - // are indeed doing a lot of waiting. (This leg probably never - // happens, but the code avoids any potential divide by zero). - q.Proportion = 2000; - } - } - - if (q.Proportion>2000) { - q.Proportion = 2000; // don't go crazy. - } - } - - // Tell the supplier how late frames are when they get rendered - // That's how late we are now. - // If we are in directdraw mode then the guy upstream can see the drawing - // times and we'll just report on the start time. He can figure out any - // offset to apply. If we are in DIB Section mode then we will apply an - // extra offset which is half of our drawing time. This is usually small - // but can sometimes be the dominant effect. For this we will use the - // average drawing time rather than the last frame. If the last frame took - // a long time to draw and made us late, that's already in the lateness - // figure. We should not add it in again unless we expect the next frame - // to be the same. We don't, we expect the average to be a better shot. - // In direct draw mode the RenderAvg will be zero. - - q.Late = trLate + m_trRenderAvg/2; - - // log what we're doing - MSR_INTEGER(m_idQualityRate, q.Proportion); - MSR_INTEGER( m_idQualityTime, (int)q.Late / 10000 ); - - // A specific sink interface may be set through IPin - - if (m_pQSink==NULL) { - // Get our input pin's peer. We send quality management messages - // to any nominated receiver of these things (set in the IPin - // interface), or else to our source filter. - - IQualityControl *pQC = NULL; - IPin *pOutputPin = m_pInputPin->GetConnected(); - ASSERT(pOutputPin != NULL); - - // And get an AddRef'd quality control interface - - hr = pOutputPin->QueryInterface(IID_IQualityControl,(void**) &pQC); - if (SUCCEEDED(hr)) { - m_pQSink = pQC; - } - } - if (m_pQSink) { - return m_pQSink->Notify(this,q); - } - - return S_FALSE; - -} // SendQuality - - -// We are called with a valid IMediaSample image to decide whether this is to -// be drawn or not. There must be a reference clock in operation. -// Return S_OK if it is to be drawn Now (as soon as possible) -// Return S_FALSE if it is to be drawn when it's due -// Return an error if we want to drop it -// m_nNormal=-1 indicates that we dropped the previous frame and so this -// one should be drawn early. Respect it and update it. -// Use current stream time plus a number of heuristics (detailed below) -// to make the decision - -HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample, - REFERENCE_TIME *ptrStart, - REFERENCE_TIME *ptrEnd) -{ - - // Don't call us unless there's a clock interface to synchronise with - ASSERT(m_pClock); - - MSR_INTEGER(m_idTimeStamp, (int)((*ptrStart)>>32)); // high order 32 bits - MSR_INTEGER(m_idTimeStamp, (int)(*ptrStart)); // low order 32 bits - - // We lose a bit of time depending on the monitor type waiting for the next - // screen refresh. On average this might be about 8mSec - so it will be - // later than we think when the picture appears. To compensate a bit - // we bias the media samples by -8mSec i.e. 80000 UNITs. - // We don't ever make a stream time negative (call it paranoia) - if (*ptrStart>=80000) { - *ptrStart -= 80000; - *ptrEnd -= 80000; // bias stop to to retain valid frame duration - } - - // Cache the time stamp now. We will want to compare what we did with what - // we started with (after making the monitor allowance). - m_trRememberStampForPerf = *ptrStart; - - // Get reference times (current and late) - REFERENCE_TIME trRealStream; // the real time now expressed as stream time. - m_pClock->GetTime(&trRealStream); -#ifdef PERF - // While the reference clock is expensive: - // Remember the offset from timeGetTime and use that. - // This overflows all over the place, but when we subtract to get - // differences the overflows all cancel out. - m_llTimeOffset = trRealStream-timeGetTime()*10000; -#endif - trRealStream -= m_tStart; // convert to stream time (this is a reftime) - - // We have to wory about two versions of "lateness". The truth, which we - // try to work out here and the one measured against m_trTarget which - // includes long term feedback. We report statistics against the truth - // but for operational decisions we work to the target. - // We use TimeDiff to make sure we get an integer because we - // may actually be late (or more likely early if there is a big time - // gap) by a very long time. - const int trTrueLate = TimeDiff(trRealStream - *ptrStart); - const int trLate = trTrueLate; - - MSR_INTEGER(m_idSchLateTime, trTrueLate/10000); - - // Send quality control messages upstream, measured against target - HRESULT hr = SendQuality(trLate, trRealStream); - // Note: the filter upstream is allowed to this FAIL meaning "you do it". - m_bSupplierHandlingQuality = (hr==S_OK); - - // Decision time! Do we drop, draw when ready or draw immediately? - - const int trDuration = (int)(*ptrEnd - *ptrStart); - { - // We need to see if the frame rate of the file has just changed. - // This would make comparing our previous frame rate with the current - // frame rate inefficent. Hang on a moment though. I've seen files - // where the frames vary between 33 and 34 mSec so as to average - // 30fps. A minor variation like that won't hurt us. - int t = m_trDuration/32; - if ( trDuration > m_trDuration+t - || trDuration < m_trDuration-t - ) { - // There's a major variation. Reset the average frame rate to - // exactly the current rate to disable decision 9002 for this frame, - // and remember the new rate. - m_trFrameAvg = trDuration; - m_trDuration = trDuration; - } - } - - MSR_INTEGER(m_idEarliness, m_trEarliness/10000); - MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000); - MSR_INTEGER(m_idFrameAvg, m_trFrameAvg/10000); - MSR_INTEGER(m_idWaitAvg, m_trWaitAvg/10000); - MSR_INTEGER(m_idDuration, trDuration/10000); - -#ifdef PERF - if (S_OK==pMediaSample->IsDiscontinuity()) { - MSR_INTEGER(m_idDecision, 9000); - } -#endif - - // Control the graceful slide back from slow to fast machine mode. - // After a frame drop accept an early frame and set the earliness to here - // If this frame is already later than the earliness then slide it to here - // otherwise do the standard slide (reduce by about 12% per frame). - // Note: earliness is normally NEGATIVE - BOOL bJustDroppedFrame - = ( m_bSupplierHandlingQuality - // Can't use the pin sample properties because we might - // not be in Receive when we call this - && (S_OK == pMediaSample->IsDiscontinuity()) // he just dropped one - ) - || (m_nNormal==-1); // we just dropped one - - - // Set m_trEarliness (slide back from slow to fast machine mode) - if (trLate>0) { - m_trEarliness = 0; // we are no longer in fast machine mode at all! - } else if ( (trLate>=m_trEarliness) || bJustDroppedFrame) { - m_trEarliness = trLate; // Things have slipped of their own accord - } else { - m_trEarliness = m_trEarliness - m_trEarliness/8; // graceful slide - } - - // prepare the new wait average - but don't pollute the old one until - // we have finished with it. - int trWaitAvg; - { - // We never mix in a negative wait. This causes us to believe in fast machines - // slightly more. - int trL = trLate<0 ? -trLate : 0; - trWaitAvg = (trL + m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD; - } - - - int trFrame; - { - REFERENCE_TIME tr = trRealStream - m_trLastDraw; // Cd be large - 4 min pause! - if (tr>10000000) { - tr = 10000000; // 1 second - arbitrarily. - } - trFrame = int(tr); - } - - // We will DRAW this frame IF... - if ( - // ...the time we are spending drawing is a small fraction of the total - // observed inter-frame time so that dropping it won't help much. - (3*m_trRenderAvg <= m_trFrameAvg) - - // ...or our supplier is NOT handling things and the next frame would - // be less timely than this one or our supplier CLAIMS to be handling - // things, and is now less than a full FOUR frames late. - || ( m_bSupplierHandlingQuality - ? (trLate <= trDuration*4) - : (trLate+trLate < trDuration) - ) - - // ...or we are on average waiting for over eight milliseconds then - // this may be just a glitch. Draw it and we'll hope to catch up. - || (m_trWaitAvg > 80000) - - // ...or we haven't drawn an image for over a second. We will update - // the display, which stops the video looking hung. - // Do this regardless of how late this media sample is. - || ((trRealStream - m_trLastDraw) > UNITS) - - ) { - HRESULT Result; - - // We are going to play this frame. We may want to play it early. - // We will play it early if we think we are in slow machine mode. - // If we think we are NOT in slow machine mode, we will still play - // it early by m_trEarliness as this controls the graceful slide back. - // and in addition we aim at being m_trTarget late rather than "on time". - - BOOL bPlayASAP = FALSE; - - // we will play it AT ONCE (slow machine mode) if... - - // ...we are playing catch-up - if ( bJustDroppedFrame) { - bPlayASAP = TRUE; - MSR_INTEGER(m_idDecision, 9001); - } - - // ...or if we are running below the true frame rate - // exact comparisons are glitchy, for these measurements, - // so add an extra 5% or so - else if ( (m_trFrameAvg > trDuration + trDuration/16) - - // It's possible to get into a state where we are losing ground, but - // are a very long way ahead. To avoid this or recover from it - // we refuse to play early by more than 10 frames. - && (trLate > - trDuration*10) - ){ - bPlayASAP = TRUE; - MSR_INTEGER(m_idDecision, 9002); - } -#if 0 - // ...or if we have been late and are less than one frame early - else if ( (trLate + trDuration > 0) - && (m_trWaitAvg<=20000) - ) { - bPlayASAP = TRUE; - MSR_INTEGER(m_idDecision, 9003); - } -#endif - // We will NOT play it at once if we are grossly early. On very slow frame - // rate movies - e.g. clock.avi - it is not a good idea to leap ahead just - // because we got starved (for instance by the net) and dropped one frame - // some time or other. If we are more than 900mSec early, then wait. - if (trLate<-9000000) { - bPlayASAP = FALSE; - } - - if (bPlayASAP) { - - m_nNormal = 0; - MSR_INTEGER(m_idDecision, 0); - // When we are here, we are in slow-machine mode. trLate may well - // oscillate between negative and positive when the supplier is - // dropping frames to keep sync. We should not let that mislead - // us into thinking that we have as much as zero spare time! - // We just update with a zero wait. - m_trWaitAvg = (m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD; - - // Assume that we draw it immediately. Update inter-frame stats - m_trFrameAvg = (trFrame + m_trFrameAvg*(AVGPERIOD-1))/AVGPERIOD; -#ifndef PERF - // If this is NOT a perf build, then report what we know so far - // without looking at the clock any more. This assumes that we - // actually wait for exactly the time we hope to. It also reports - // how close we get to the manipulated time stamps that we now have - // rather than the ones we originally started with. It will - // therefore be a little optimistic. However it's fast. - PreparePerformanceData(trTrueLate, trFrame); -#endif - m_trLastDraw = trRealStream; - if (m_trEarliness > trLate) { - m_trEarliness = trLate; // if we are actually early, this is neg - } - Result = S_OK; // Draw it now - - } else { - ++m_nNormal; - // Set the average frame rate to EXACTLY the ideal rate. - // If we are exiting slow-machine mode then we will have caught up - // and be running ahead, so as we slide back to exact timing we will - // have a longer than usual gap at this point. If we record this - // real gap then we'll think that we're running slow and go back - // into slow-machine mode and vever get it straight. - m_trFrameAvg = trDuration; - MSR_INTEGER(m_idDecision, 1); - - // Play it early by m_trEarliness and by m_trTarget - - { - int trE = m_trEarliness; - if (trE < -m_trFrameAvg) { - trE = -m_trFrameAvg; - } - *ptrStart += trE; // N.B. earliness is negative - } - - int Delay = -trTrueLate; - Result = Delay<=0 ? S_OK : S_FALSE; // OK = draw now, FALSE = wait - - m_trWaitAvg = trWaitAvg; - - // Predict when it will actually be drawn and update frame stats - - if (Result==S_FALSE) { // We are going to wait - trFrame = TimeDiff(*ptrStart-m_trLastDraw); - m_trLastDraw = *ptrStart; - } else { - // trFrame is already = trRealStream-m_trLastDraw; - m_trLastDraw = trRealStream; - } -#ifndef PERF - int iAccuracy; - if (Delay>0) { - // Report lateness based on when we intend to play it - iAccuracy = TimeDiff(*ptrStart-m_trRememberStampForPerf); - } else { - // Report lateness based on playing it *now*. - iAccuracy = trTrueLate; // trRealStream-RememberStampForPerf; - } - PreparePerformanceData(iAccuracy, trFrame); -#endif - } - return Result; - } - - // We are going to drop this frame! - // Of course in DirectDraw mode the guy upstream may draw it anyway. - - // This will probably give a large negative wack to the wait avg. - m_trWaitAvg = trWaitAvg; - -#ifdef PERF - // Respect registry setting - debug only! - if (m_bDrawLateFrames) { - return S_OK; // draw it when it's ready - } // even though it's late. -#endif - - // We are going to drop this frame so draw the next one early - // n.b. if the supplier is doing direct draw then he may draw it anyway - // but he's doing something funny to arrive here in that case. - - MSR_INTEGER(m_idDecision, 2); - m_nNormal = -1; - return E_FAIL; // drop it - -} // ShouldDrawSampleNow - - -// NOTE we're called by both the window thread and the source filter thread -// so we have to be protected by a critical section (locked before called) -// Also, when the window thread gets signalled to render an image, it always -// does so regardless of how late it is. All the degradation is done when we -// are scheduling the next sample to be drawn. Hence when we start an advise -// link to draw a sample, that sample's time will always become the last one -// drawn - unless of course we stop streaming in which case we cancel links - -BOOL CBaseVideoRenderer::ScheduleSample(IMediaSample *pMediaSample) -{ - // We override ShouldDrawSampleNow to add quality management - - BOOL bDrawImage = CBaseRenderer::ScheduleSample(pMediaSample); - if (bDrawImage == FALSE) { - ++m_cFramesDropped; - return FALSE; - } - - // m_cFramesDrawn must NOT be updated here. It has to be updated - // in RecordFrameLateness at the same time as the other statistics. - return TRUE; -} - - -// Implementation of IQualProp interface needed to support the property page -// This is how the property page gets the data out of the scheduler. We are -// passed into the constructor the owning object in the COM sense, this will -// either be the video renderer or an external IUnknown if we're aggregated. -// We initialise our CUnknown base class with this interface pointer. Then -// all we have to do is to override NonDelegatingQueryInterface to expose -// our IQualProp interface. The AddRef and Release are handled automatically -// by the base class and will be passed on to the appropriate outer object - -STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(int *pcFramesDropped) -{ - CheckPointer(pcFramesDropped,E_POINTER); - CAutoLock cVideoLock(&m_InterfaceLock); - *pcFramesDropped = m_cFramesDropped; - return NOERROR; -} // get_FramesDroppedInRenderer - - -// Set *pcFramesDrawn to the number of frames drawn since -// streaming started. - -STDMETHODIMP CBaseVideoRenderer::get_FramesDrawn( int *pcFramesDrawn) -{ - CheckPointer(pcFramesDrawn,E_POINTER); - CAutoLock cVideoLock(&m_InterfaceLock); - *pcFramesDrawn = m_cFramesDrawn; - return NOERROR; -} // get_FramesDrawn - - -// Set iAvgFrameRate to the frames per hundred secs since -// streaming started. 0 otherwise. - -STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate( int *piAvgFrameRate) -{ - CheckPointer(piAvgFrameRate,E_POINTER); - CAutoLock cVideoLock(&m_InterfaceLock); - - int t; - if (m_bStreaming) { - t = timeGetTime()-m_tStreamingStart; - } else { - t = m_tStreamingStart; - } - - if (t<=0) { - *piAvgFrameRate = 0; - ASSERT(m_cFramesDrawn == 0); - } else { - // i is frames per hundred seconds - *piAvgFrameRate = MulDiv(100000, m_cFramesDrawn, t); - } - return NOERROR; -} // get_AvgFrameRate - - -// Set *piAvg to the average sync offset since streaming started -// in mSec. The sync offset is the time in mSec between when the frame -// should have been drawn and when the frame was actually drawn. - -STDMETHODIMP CBaseVideoRenderer::get_AvgSyncOffset( int *piAvg) -{ - CheckPointer(piAvg,E_POINTER); - CAutoLock cVideoLock(&m_InterfaceLock); - - if (NULL==m_pClock) { - *piAvg = 0; - return NOERROR; - } - - // Note that we didn't gather the stats on the first frame - // so we use m_cFramesDrawn-1 here - if (m_cFramesDrawn<=1) { - *piAvg = 0; - } else { - *piAvg = (int)(m_iTotAcc / (m_cFramesDrawn-1)); - } - return NOERROR; -} // get_AvgSyncOffset - - -// To avoid dragging in the maths library - a cheap -// approximate integer square root. -// We do this by getting a starting guess which is between 1 -// and 2 times too large, followed by THREE iterations of -// Newton Raphson. (That will give accuracy to the nearest mSec -// for the range in question - roughly 0..1000) -// -// It would be faster to use a linear interpolation and ONE NR, but -// who cares. If anyone does - the best linear interpolation is -// to approximates sqrt(x) by -// y = x * (sqrt(2)-1) + 1 - 1/sqrt(2) + 1/(8*(sqrt(2)-1)) -// 0r y = x*0.41421 + 0.59467 -// This minimises the maximal error in the range in question. -// (error is about +0.008883 and then one NR will give error .0000something -// (Of course these are integers, so you can't just multiply by 0.41421 -// you'd have to do some sort of MulDiv). -// Anyone wanna check my maths? (This is only for a property display!) - -int isqrt(int x) -{ - int s = 1; - // Make s an initial guess for sqrt(x) - if (x > 0x40000000) { - s = 0x8000; // prevent any conceivable closed loop - } else { - while (s*s=0) s = (s*s+x)/(2*s); - if (s>=0) s = (s*s+x)/(2*s); - } - } - return s; -} - -// -// Do estimates for standard deviations for per-frame -// statistics -// -HRESULT CBaseVideoRenderer::GetStdDev( - int nSamples, - int *piResult, - LONGLONG llSumSq, - LONGLONG iTot -) -{ - CheckPointer(piResult,E_POINTER); - CAutoLock cVideoLock(&m_InterfaceLock); - - if (NULL==m_pClock) { - *piResult = 0; - return NOERROR; - } - - // If S is the Sum of the Squares of observations and - // T the Total (i.e. sum) of the observations and there were - // N observations, then an estimate of the standard deviation is - // sqrt( (S - T**2/N) / (N-1) ) - - if (nSamples<=1) { - *piResult = 0; - } else { - LONGLONG x; - // First frames have invalid stamps, so we get no stats for them - // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 - - // so we use m_cFramesDrawn-1 here - x = llSumSq - llMulDiv(iTot, iTot, nSamples, 0); - x = x / (nSamples-1); - ASSERT(x>=0); - *piResult = isqrt((LONG)x); - } - return NOERROR; -} - -// Set *piDev to the standard deviation in mSec of the sync offset -// of each frame since streaming started. - -STDMETHODIMP CBaseVideoRenderer::get_DevSyncOffset( int *piDev) -{ - // First frames have invalid stamps, so we get no stats for them - // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 - return GetStdDev(m_cFramesDrawn - 1, - piDev, - m_iSumSqAcc, - m_iTotAcc); -} // get_DevSyncOffset - - -// Set *piJitter to the standard deviation in mSec of the inter-frame time -// of frames since streaming started. - -STDMETHODIMP CBaseVideoRenderer::get_Jitter( int *piJitter) -{ - // First frames have invalid stamps, so we get no stats for them - // So second frame gives invalid inter-frame time - // So we need 3 frames to get 1 datum, so N is cFramesDrawn-2 - return GetStdDev(m_cFramesDrawn - 2, - piJitter, - m_iSumSqFrameTime, - m_iSumFrameTime); -} // get_Jitter - - -// Overidden to return our IQualProp interface - -STDMETHODIMP -CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,VOID **ppv) -{ - // We return IQualProp and delegate everything else - - if (riid == IID_IQualProp) { - return GetInterface( (IQualProp *)this, ppv); - } else if (riid == IID_IQualityControl) { - return GetInterface( (IQualityControl *)this, ppv); - } - return CBaseRenderer::NonDelegatingQueryInterface(riid,ppv); -} - - -// Override JoinFilterGraph so that, just before leaving -// the graph we can send an EC_WINDOW_DESTROYED event - -STDMETHODIMP -CBaseVideoRenderer::JoinFilterGraph(IFilterGraph *pGraph,LPCWSTR pName) -{ - // Since we send EC_ACTIVATE, we also need to ensure - // we send EC_WINDOW_DESTROYED or the resource manager may be - // holding us as a focus object - if (!pGraph && m_pGraph) { - - // We were in a graph and now we're not - // Do this properly in case we are aggregated - IBaseFilter* pFilter; - QueryInterface(IID_IBaseFilter,(void **) &pFilter); - NotifyEvent(EC_WINDOW_DESTROYED, (LPARAM) pFilter, 0); - pFilter->Release(); - } - return CBaseFilter::JoinFilterGraph(pGraph, pName); -} - - -// This removes a large number of level 4 warnings from the -// Microsoft compiler which in this case are not very useful -#pragma warning(disable: 4514) - +//------------------------------------------------------------------------------ +// File: RenBase.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include // DirectShow base class definitions +#include // Needed for definition of timeGetTime +#include // Standard data type limit definitions +#include // Used for time critical log functions + +#pragma warning(disable:4355) + +// Helper function for clamping time differences +int inline TimeDiff(REFERENCE_TIME rt) +{ + if (rt < - (50 * UNITS)) { + return -(50 * UNITS); + } else + if (rt > 50 * UNITS) { + return 50 * UNITS; + } else return (int)rt; +} + +// Implements the CBaseRenderer class + +CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer + TCHAR *pName, // Debug ONLY description + LPUNKNOWN pUnk, // Aggregated owner object + HRESULT *phr) : // General OLE return code + + CBaseFilter(pName,pUnk,&m_InterfaceLock,RenderClass), + m_evComplete(TRUE), + m_bAbort(FALSE), + m_pPosition(NULL), + m_ThreadSignal(TRUE), + m_bStreaming(FALSE), + m_bEOS(FALSE), + m_bEOSDelivered(FALSE), + m_pMediaSample(NULL), + m_dwAdvise(0), + m_pQSink(NULL), + m_pInputPin(NULL), + m_bRepaintStatus(TRUE), + m_SignalTime(0), + m_bInReceive(FALSE), + m_EndOfStreamTimer(0) +{ + Ready(); +#ifdef PERF + m_idBaseStamp = MSR_REGISTER(TEXT("BaseRenderer: sample time stamp")); + m_idBaseRenderTime = MSR_REGISTER(TEXT("BaseRenderer: draw time (msec)")); + m_idBaseAccuracy = MSR_REGISTER(TEXT("BaseRenderer: Accuracy (msec)")); +#endif +} + + +// Delete the dynamically allocated IMediaPosition and IMediaSeeking helper +// object. The object is created when somebody queries us. These are standard +// control interfaces for seeking and setting start/stop positions and rates. +// We will probably also have made an input pin based on CRendererInputPin +// that has to be deleted, it's created when an enumerator calls our GetPin + +CBaseRenderer::~CBaseRenderer() +{ + ASSERT(m_bStreaming == FALSE); + ASSERT(m_EndOfStreamTimer == 0); + StopStreaming(); + ClearPendingSample(); + + // Delete any IMediaPosition implementation + + if (m_pPosition) { + delete m_pPosition; + m_pPosition = NULL; + } + + // Delete any input pin created + + if (m_pInputPin) { + delete m_pInputPin; + m_pInputPin = NULL; + } + + // Release any Quality sink + + ASSERT(m_pQSink == NULL); +} + + +// This returns the IMediaPosition and IMediaSeeking interfaces + +HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid,void **ppv) +{ + CAutoLock cObjectCreationLock(&m_ObjectCreationLock); + if (m_pPosition) { + return m_pPosition->NonDelegatingQueryInterface(riid,ppv); + } + + HRESULT hr = NOERROR; + + // Create implementation of this dynamically since sometimes we may + // never try and do a seek. The helper object implements a position + // control interface (IMediaPosition) which in fact simply takes the + // calls normally from the filter graph and passes them upstream + + m_pPosition = new CRendererPosPassThru(NAME("Renderer CPosPassThru"), + CBaseFilter::GetOwner(), + (HRESULT *) &hr, + GetPin(0)); + if (m_pPosition == NULL) { + return E_OUTOFMEMORY; + } + + if (FAILED(hr)) { + delete m_pPosition; + m_pPosition = NULL; + return E_NOINTERFACE; + } + return GetMediaPositionInterface(riid,ppv); +} + + +// Overriden to say what interfaces we support and where + +STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid,void **ppv) +{ + // Do we have this interface + + if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) { + return GetMediaPositionInterface(riid,ppv); + } else { + return CBaseFilter::NonDelegatingQueryInterface(riid,ppv); + } +} + + +// This is called whenever we change states, we have a manual reset event that +// is signalled whenever we don't won't the source filter thread to wait in us +// (such as in a stopped state) and likewise is not signalled whenever it can +// wait (during paused and running) this function sets or resets the thread +// event. The event is used to stop source filter threads waiting in Receive + +HRESULT CBaseRenderer::SourceThreadCanWait(BOOL bCanWait) +{ + if (bCanWait == TRUE) { + m_ThreadSignal.Reset(); + } else { + m_ThreadSignal.Set(); + } + return NOERROR; +} + + +#ifdef DEBUG +// Dump the current renderer state to the debug terminal. The hardest part of +// the renderer is the window where we unlock everything to wait for a clock +// to signal it is time to draw or for the application to cancel everything +// by stopping the filter. If we get things wrong we can leave the thread in +// WaitForRenderTime with no way for it to ever get out and we will deadlock + +void CBaseRenderer::DisplayRendererState() +{ + DbgLog((LOG_TIMING, 1, TEXT("\nTimed out in WaitForRenderTime"))); + + // No way should this be signalled at this point + + BOOL bSignalled = m_ThreadSignal.Check(); + DbgLog((LOG_TIMING, 1, TEXT("Signal sanity check %d"),bSignalled)); + + // Now output the current renderer state variables + + DbgLog((LOG_TIMING, 1, TEXT("Filter state %d"),m_State)); + DbgLog((LOG_TIMING, 1, TEXT("Abort flag %d"),m_bAbort)); + DbgLog((LOG_TIMING, 1, TEXT("Streaming flag %d"),m_bStreaming)); + DbgLog((LOG_TIMING, 1, TEXT("Clock advise link %d"),m_dwAdvise)); + DbgLog((LOG_TIMING, 1, TEXT("Current media sample %x"),m_pMediaSample)); + DbgLog((LOG_TIMING, 1, TEXT("EOS signalled %d"),m_bEOS)); + DbgLog((LOG_TIMING, 1, TEXT("EOS delivered %d"),m_bEOSDelivered)); + DbgLog((LOG_TIMING, 1, TEXT("Repaint status %d"),m_bRepaintStatus)); + + + // Output the delayed end of stream timer information + + DbgLog((LOG_TIMING, 1, TEXT("End of stream timer %x"),m_EndOfStreamTimer)); + DbgLog((LOG_TIMING, 1, TEXT("Deliver time %s"),CDisp((LONGLONG)m_SignalTime))); + + + // Should never timeout during a flushing state + + BOOL bFlushing = m_pInputPin->IsFlushing(); + DbgLog((LOG_TIMING, 1, TEXT("Flushing sanity check %d"),bFlushing)); + + // Display the time we were told to start at + DbgLog((LOG_TIMING, 1, TEXT("Last run time %s"),CDisp((LONGLONG)m_tStart.m_time))); + + // Do we have a reference clock? + if (m_pClock == NULL) return; + + // Get the current time from the wall clock + + CRefTime CurrentTime,StartTime,EndTime; + m_pClock->GetTime((REFERENCE_TIME*) &CurrentTime); + CRefTime Offset = CurrentTime - m_tStart; + + // Display the current time from the clock + + DbgLog((LOG_TIMING, 1, TEXT("Clock time %s"),CDisp((LONGLONG)CurrentTime.m_time))); + DbgLog((LOG_TIMING, 1, TEXT("Time difference %dms"),Offset.Millisecs())); + + // Do we have a sample ready to render + if (m_pMediaSample == NULL) return; + + m_pMediaSample->GetTime((REFERENCE_TIME*)&StartTime, (REFERENCE_TIME*)&EndTime); + DbgLog((LOG_TIMING, 1, TEXT("Next sample stream times (Start %d End %d ms)"), + StartTime.Millisecs(),EndTime.Millisecs())); + + // Calculate how long it is until it is due for rendering + CRefTime Wait = (m_tStart + StartTime) - CurrentTime; + DbgLog((LOG_TIMING, 1, TEXT("Wait required %d ms"),Wait.Millisecs())); +} +#endif + + +// Wait until the clock sets the timer event or we're otherwise signalled. We +// set an arbitrary timeout for this wait and if it fires then we display the +// current renderer state on the debugger. It will often fire if the filter's +// left paused in an application however it may also fire during stress tests +// if the synchronisation with application seeks and state changes is faulty + +#define RENDER_TIMEOUT 10000 + +HRESULT CBaseRenderer::WaitForRenderTime() +{ + HANDLE WaitObjects[] = { m_ThreadSignal, m_RenderEvent }; + DWORD Result = WAIT_TIMEOUT; + + // Wait for either the time to arrive or for us to be stopped + + OnWaitStart(); + while (Result == WAIT_TIMEOUT) { + Result = WaitForMultipleObjects(2,WaitObjects,FALSE,RENDER_TIMEOUT); + +#ifdef DEBUG + if (Result == WAIT_TIMEOUT) DisplayRendererState(); +#endif + + } + OnWaitEnd(); + + // We may have been awoken without the timer firing + + if (Result == WAIT_OBJECT_0) { + return VFW_E_STATE_CHANGED; + } + + SignalTimerFired(); + return NOERROR; +} + + +// Poll waiting for Receive to complete. This really matters when +// Receive may set the palette and cause window messages +// The problem is that if we don't really wait for a renderer to +// stop processing we can deadlock waiting for a transform which +// is calling the renderer's Receive() method because the transform's +// Stop method doesn't know to process window messages to unblock +// the renderer's Receive processing +void CBaseRenderer::WaitForReceiveToComplete() +{ + for (;;) { + if (!m_bInReceive) { + break; + } + + MSG msg; + // Receive all interthread sendmessages + PeekMessage(&msg, NULL, WM_NULL, WM_NULL, PM_NOREMOVE); + + Sleep(1); + } + + // If the wakebit for QS_POSTMESSAGE is set, the PeekMessage call + // above just cleared the changebit which will cause some messaging + // calls to block (waitMessage, MsgWaitFor...) now. + // Post a dummy message to set the QS_POSTMESSAGE bit again + if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) { + // Send dummy message + PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); + } +} + +// A filter can have four discrete states, namely Stopped, Running, Paused, +// Intermediate. We are in an intermediate state if we are currently trying +// to pause but haven't yet got the first sample (or if we have been flushed +// in paused state and therefore still have to wait for a sample to arrive) + +// This class contains an event called m_evComplete which is signalled when +// the current state is completed and is not signalled when we are waiting to +// complete the last state transition. As mentioned above the only time we +// use this at the moment is when we wait for a media sample in paused state +// If while we are waiting we receive an end of stream notification from the +// source filter then we know no data is imminent so we can reset the event +// This means that when we transition to paused the source filter must call +// end of stream on us or send us an image otherwise we'll hang indefinately + + +// Simple internal way of getting the real state + +FILTER_STATE CBaseRenderer::GetRealState() { + return m_State; +} + + +// The renderer doesn't complete the full transition to paused states until +// it has got one media sample to render. If you ask it for its state while +// it's waiting it will return the state along with VFW_S_STATE_INTERMEDIATE + +STDMETHODIMP CBaseRenderer::GetState(DWORD dwMSecs,FILTER_STATE *State) +{ + CheckPointer(State,E_POINTER); + + if (WaitDispatchingMessages(m_evComplete, dwMSecs) == WAIT_TIMEOUT) { + *State = m_State; + return VFW_S_STATE_INTERMEDIATE; + } + *State = m_State; + return NOERROR; +} + + +// If we're pausing and we have no samples we don't complete the transition +// to State_Paused and we return S_FALSE. However if the m_bAbort flag has +// been set then all samples are rejected so there is no point waiting for +// one. If we do have a sample then return NOERROR. We will only ever return +// VFW_S_STATE_INTERMEDIATE from GetState after being paused with no sample +// (calling GetState after either being stopped or Run will NOT return this) + +HRESULT CBaseRenderer::CompleteStateChange(FILTER_STATE OldState) +{ + // Allow us to be paused when disconnected + + if (m_pInputPin->IsConnected() == FALSE) { + Ready(); + return S_OK; + } + + // Have we run off the end of stream + + if (IsEndOfStream() == TRUE) { + Ready(); + return S_OK; + } + + // Make sure we get fresh data after being stopped + + if (HaveCurrentSample() == TRUE) { + if (OldState != State_Stopped) { + Ready(); + return S_OK; + } + } + NotReady(); + return S_FALSE; +} + + +// When we stop the filter the things we do are:- + +// Decommit the allocator being used in the connection +// Release the source filter if it's waiting in Receive +// Cancel any advise link we set up with the clock +// Any end of stream signalled is now obsolete so reset +// Allow us to be stopped when we are not connected + +STDMETHODIMP CBaseRenderer::Stop() +{ + CAutoLock cRendererLock(&m_InterfaceLock); + + // Make sure there really is a state change + + if (m_State == State_Stopped) { + return NOERROR; + } + + // Is our input pin connected + + if (m_pInputPin->IsConnected() == FALSE) { + NOTE("Input pin is not connected"); + m_State = State_Stopped; + return NOERROR; + } + + CBaseFilter::Stop(); + + // If we are going into a stopped state then we must decommit whatever + // allocator we are using it so that any source filter waiting in the + // GetBuffer can be released and unlock themselves for a state change + + if (m_pInputPin->Allocator()) { + m_pInputPin->Allocator()->Decommit(); + } + + // Cancel any scheduled rendering + + SetRepaintStatus(TRUE); + StopStreaming(); + SourceThreadCanWait(FALSE); + ResetEndOfStream(); + CancelNotification(); + + // There should be no outstanding clock advise + ASSERT(CancelNotification() == S_FALSE); + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + ASSERT(m_EndOfStreamTimer == 0); + + Ready(); + WaitForReceiveToComplete(); + m_bAbort = FALSE; + + return NOERROR; +} + + +// When we pause the filter the things we do are:- + +// Commit the allocator being used in the connection +// Allow a source filter thread to wait in Receive +// Cancel any clock advise link (we may be running) +// Possibly complete the state change if we have data +// Allow us to be paused when we are not connected + +STDMETHODIMP CBaseRenderer::Pause() +{ + CAutoLock cRendererLock(&m_InterfaceLock); + FILTER_STATE OldState = m_State; + ASSERT(m_pInputPin->IsFlushing() == FALSE); + + // Make sure there really is a state change + + if (m_State == State_Paused) { + return CompleteStateChange(State_Paused); + } + + // Has our input pin been connected + + if (m_pInputPin->IsConnected() == FALSE) { + NOTE("Input pin is not connected"); + m_State = State_Paused; + return CompleteStateChange(State_Paused); + } + + // Pause the base filter class + + HRESULT hr = CBaseFilter::Pause(); + if (FAILED(hr)) { + NOTE("Pause failed"); + return hr; + } + + // Enable EC_REPAINT events again + + SetRepaintStatus(TRUE); + StopStreaming(); + SourceThreadCanWait(TRUE); + CancelNotification(); + ResetEndOfStreamTimer(); + + // If we are going into a paused state then we must commit whatever + // allocator we are using it so that any source filter can call the + // GetBuffer and expect to get a buffer without returning an error + + if (m_pInputPin->Allocator()) { + m_pInputPin->Allocator()->Commit(); + } + + // There should be no outstanding advise + ASSERT(CancelNotification() == S_FALSE); + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + ASSERT(m_EndOfStreamTimer == 0); + ASSERT(m_pInputPin->IsFlushing() == FALSE); + + // When we come out of a stopped state we must clear any image we were + // holding onto for frame refreshing. Since renderers see state changes + // first we can reset ourselves ready to accept the source thread data + // Paused or running after being stopped causes the current position to + // be reset so we're not interested in passing end of stream signals + + if (OldState == State_Stopped) { + m_bAbort = FALSE; + ClearPendingSample(); + } + return CompleteStateChange(OldState); +} + + +// When we run the filter the things we do are:- + +// Commit the allocator being used in the connection +// Allow a source filter thread to wait in Receive +// Signal the render event just to get us going +// Start the base class by calling StartStreaming +// Allow us to be run when we are not connected +// Signal EC_COMPLETE if we are not connected + +STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime) +{ + CAutoLock cRendererLock(&m_InterfaceLock); + FILTER_STATE OldState = m_State; + + // Make sure there really is a state change + + if (m_State == State_Running) { + return NOERROR; + } + + // Send EC_COMPLETE if we're not connected + + if (m_pInputPin->IsConnected() == FALSE) { + NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this); + m_State = State_Running; + return NOERROR; + } + + Ready(); + + // Pause the base filter class + + HRESULT hr = CBaseFilter::Run(StartTime); + if (FAILED(hr)) { + NOTE("Run failed"); + return hr; + } + + // Allow the source thread to wait + ASSERT(m_pInputPin->IsFlushing() == FALSE); + SourceThreadCanWait(TRUE); + SetRepaintStatus(FALSE); + + // There should be no outstanding advise + ASSERT(CancelNotification() == S_FALSE); + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + ASSERT(m_EndOfStreamTimer == 0); + ASSERT(m_pInputPin->IsFlushing() == FALSE); + + // If we are going into a running state then we must commit whatever + // allocator we are using it so that any source filter can call the + // GetBuffer and expect to get a buffer without returning an error + + if (m_pInputPin->Allocator()) { + m_pInputPin->Allocator()->Commit(); + } + + // When we come out of a stopped state we must clear any image we were + // holding onto for frame refreshing. Since renderers see state changes + // first we can reset ourselves ready to accept the source thread data + // Paused or running after being stopped causes the current position to + // be reset so we're not interested in passing end of stream signals + + if (OldState == State_Stopped) { + m_bAbort = FALSE; + ClearPendingSample(); + } + return StartStreaming(); +} + + +// Return the number of input pins we support + +int CBaseRenderer::GetPinCount() +{ + return 1; +} + + +// We only support one input pin and it is numbered zero + +CBasePin *CBaseRenderer::GetPin(int n) +{ + CAutoLock cObjectCreationLock(&m_ObjectCreationLock); + + // Should only ever be called with zero + ASSERT(n == 0); + + if (n != 0) { + return NULL; + } + + // Create the input pin if not already done so + + if (m_pInputPin == NULL) { + + // hr must be initialized to NOERROR because + // CRendererInputPin's constructor only changes + // hr's value if an error occurs. + HRESULT hr = NOERROR; + + m_pInputPin = new CRendererInputPin(this,&hr,L"In"); + if (NULL == m_pInputPin) { + return NULL; + } + + if (FAILED(hr)) { + delete m_pInputPin; + m_pInputPin = NULL; + return NULL; + } + } + return m_pInputPin; +} + + +// If "In" then return the IPin for our input pin, otherwise NULL and error + +STDMETHODIMP CBaseRenderer::FindPin(LPCWSTR Id, IPin **ppPin) +{ + CheckPointer(ppPin,E_POINTER); + + if (0==lstrcmpW(Id,L"In")) { + *ppPin = GetPin(0); + ASSERT(*ppPin); + (*ppPin)->AddRef(); + } else { + *ppPin = NULL; + return VFW_E_NOT_FOUND; + } + return NOERROR; +} + + +// Called when the input pin receives an EndOfStream notification. If we have +// not got a sample, then notify EC_COMPLETE now. If we have samples, then set +// m_bEOS and check for this on completing samples. If we're waiting to pause +// then complete the transition to paused state by setting the state event + +HRESULT CBaseRenderer::EndOfStream() +{ + // Ignore these calls if we are stopped + + if (m_State == State_Stopped) { + return NOERROR; + } + + // If we have a sample then wait for it to be rendered + + m_bEOS = TRUE; + if (m_pMediaSample) { + return NOERROR; + } + + // If we are waiting for pause then we are now ready since we cannot now + // carry on waiting for a sample to arrive since we are being told there + // won't be any. This sets an event that the GetState function picks up + + Ready(); + + // Only signal completion now if we are running otherwise queue it until + // we do run in StartStreaming. This is used when we seek because a seek + // causes a pause where early notification of completion is misleading + + if (m_bStreaming) { + SendEndOfStream(); + } + return NOERROR; +} + + +// When we are told to flush we should release the source thread + +HRESULT CBaseRenderer::BeginFlush() +{ + // If paused then report state intermediate until we get some data + + if (m_State == State_Paused) { + NotReady(); + } + + SourceThreadCanWait(FALSE); + CancelNotification(); + ClearPendingSample(); + // Wait for Receive to complete + WaitForReceiveToComplete(); + + return NOERROR; +} + + +// After flushing the source thread can wait in Receive again + +HRESULT CBaseRenderer::EndFlush() +{ + // Reset the current sample media time + if (m_pPosition) m_pPosition->ResetMediaTime(); + + // There should be no outstanding advise + + ASSERT(CancelNotification() == S_FALSE); + SourceThreadCanWait(TRUE); + return NOERROR; +} + + +// We can now send EC_REPAINTs if so required + +HRESULT CBaseRenderer::CompleteConnect(IPin *pReceivePin) +{ + // The caller should always hold the interface lock because + // the function uses CBaseFilter::m_State. + ASSERT(CritCheckIn(&m_InterfaceLock)); + + m_bAbort = FALSE; + + if (State_Running == GetRealState()) { + HRESULT hr = StartStreaming(); + if (FAILED(hr)) { + return hr; + } + + SetRepaintStatus(FALSE); + } else { + SetRepaintStatus(TRUE); + } + + return NOERROR; +} + + +// Called when we go paused or running + +HRESULT CBaseRenderer::Active() +{ + return NOERROR; +} + + +// Called when we go into a stopped state + +HRESULT CBaseRenderer::Inactive() +{ + if (m_pPosition) { + m_pPosition->ResetMediaTime(); + } + // People who derive from this may want to override this behaviour + // to keep hold of the sample in some circumstances + ClearPendingSample(); + + return NOERROR; +} + + +// Tell derived classes about the media type agreed + +HRESULT CBaseRenderer::SetMediaType(const CMediaType *pmt) +{ + return NOERROR; +} + + +// When we break the input pin connection we should reset the EOS flags. When +// we are asked for either IMediaPosition or IMediaSeeking we will create a +// CPosPassThru object to handles media time pass through. When we're handed +// samples we store (by calling CPosPassThru::RegisterMediaTime) their media +// times so we can then return a real current position of data being rendered + +HRESULT CBaseRenderer::BreakConnect() +{ + // Do we have a quality management sink + + if (m_pQSink) { + m_pQSink->Release(); + m_pQSink = NULL; + } + + // Check we have a valid connection + + if (m_pInputPin->IsConnected() == FALSE) { + return S_FALSE; + } + + // Check we are stopped before disconnecting + if (m_State != State_Stopped && !m_pInputPin->CanReconnectWhenActive()) { + return VFW_E_NOT_STOPPED; + } + + SetRepaintStatus(FALSE); + ResetEndOfStream(); + ClearPendingSample(); + m_bAbort = FALSE; + + if (State_Running == m_State) { + StopStreaming(); + } + + return NOERROR; +} + + +// Retrieves the sample times for this samples (note the sample times are +// passed in by reference not value). We return S_FALSE to say schedule this +// sample according to the times on the sample. We also return S_OK in +// which case the object should simply render the sample data immediately + +HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample, + REFERENCE_TIME *pStartTime, + REFERENCE_TIME *pEndTime) +{ + ASSERT(m_dwAdvise == 0); + ASSERT(pMediaSample); + + // If the stop time for this sample is before or the same as start time, + // then just ignore it (release it) and schedule the next one in line + // Source filters should always fill in the start and end times properly! + + if (SUCCEEDED(pMediaSample->GetTime(pStartTime, pEndTime))) { + if (*pEndTime < *pStartTime) { + return VFW_E_START_TIME_AFTER_END; + } + } else { + // no time set in the sample... draw it now? + return S_OK; + } + + // Can't synchronise without a clock so we return S_OK which tells the + // caller that the sample should be rendered immediately without going + // through the overhead of setting a timer advise link with the clock + + if (m_pClock == NULL) { + return S_OK; + } + return ShouldDrawSampleNow(pMediaSample,pStartTime,pEndTime); +} + + +// By default all samples are drawn according to their time stamps so we +// return S_FALSE. Returning S_OK means draw immediately, this is used +// by the derived video renderer class in its quality management. + +HRESULT CBaseRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample, + REFERENCE_TIME *ptrStart, + REFERENCE_TIME *ptrEnd) +{ + return S_FALSE; +} + + +// We must always reset the current advise time to zero after a timer fires +// because there are several possible ways which lead us not to do any more +// scheduling such as the pending image being cleared after state changes + +void CBaseRenderer::SignalTimerFired() +{ + m_dwAdvise = 0; +} + + +// Cancel any notification currently scheduled. This is called by the owning +// window object when it is told to stop streaming. If there is no timer link +// outstanding then calling this is benign otherwise we go ahead and cancel +// We must always reset the render event as the quality management code can +// signal immediate rendering by setting the event without setting an advise +// link. If we're subsequently stopped and run the first attempt to setup an +// advise link with the reference clock will find the event still signalled + +HRESULT CBaseRenderer::CancelNotification() +{ + ASSERT(m_dwAdvise == 0 || m_pClock); + DWORD_PTR dwAdvise = m_dwAdvise; + + // Have we a live advise link + + if (m_dwAdvise) { + m_pClock->Unadvise(m_dwAdvise); + SignalTimerFired(); + ASSERT(m_dwAdvise == 0); + } + + // Clear the event and return our status + + m_RenderEvent.Reset(); + return (dwAdvise ? S_OK : S_FALSE); +} + + +// Responsible for setting up one shot advise links with the clock +// Return FALSE if the sample is to be dropped (not drawn at all) +// Return TRUE if the sample is to be drawn and in this case also +// arrange for m_RenderEvent to be set at the appropriate time + +BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample) +{ + REFERENCE_TIME StartSample, EndSample; + + // Is someone pulling our leg + + if (pMediaSample == NULL) { + return FALSE; + } + + // Get the next sample due up for rendering. If there aren't any ready + // then GetNextSampleTimes returns an error. If there is one to be done + // then it succeeds and yields the sample times. If it is due now then + // it returns S_OK other if it's to be done when due it returns S_FALSE + + HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample); + if (FAILED(hr)) { + return FALSE; + } + + // If we don't have a reference clock then we cannot set up the advise + // time so we simply set the event indicating an image to render. This + // will cause us to run flat out without any timing or synchronisation + + if (hr == S_OK) { + EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent)); + return TRUE; + } + + ASSERT(m_dwAdvise == 0); + ASSERT(m_pClock); + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + + // We do have a valid reference clock interface so we can ask it to + // set an event when the image comes due for rendering. We pass in + // the reference time we were told to start at and also the current + // stream time which is the offset from the start reference time + + hr = m_pClock->AdviseTime( + (REFERENCE_TIME) m_tStart, // Start run time + StartSample, // Stream time + (HEVENT)(HANDLE) m_RenderEvent, // Render notification + &m_dwAdvise); // Advise cookie + + if (SUCCEEDED(hr)) { + return TRUE; + } + + // We could not schedule the next sample for rendering despite the fact + // we have a valid sample here. This is a fair indication that either + // the system clock is wrong or the time stamp for the sample is duff + + ASSERT(m_dwAdvise == 0); + return FALSE; +} + + +// This is called when a sample comes due for rendering. We pass the sample +// on to the derived class. After rendering we will initialise the timer for +// the next sample, NOTE signal that the last one fired first, if we don't +// do this it thinks there is still one outstanding that hasn't completed + +HRESULT CBaseRenderer::Render(IMediaSample *pMediaSample) +{ + // If the media sample is NULL then we will have been notified by the + // clock that another sample is ready but in the mean time someone has + // stopped us streaming which causes the next sample to be released + + if (pMediaSample == NULL) { + return S_FALSE; + } + + // If we have stopped streaming then don't render any more samples, the + // thread that got in and locked us and then reset this flag does not + // clear the pending sample as we can use it to refresh any output device + + if (m_bStreaming == FALSE) { + return S_FALSE; + } + + // Time how long the rendering takes + + OnRenderStart(pMediaSample); + DoRenderSample(pMediaSample); + OnRenderEnd(pMediaSample); + + return NOERROR; +} + + +// Checks if there is a sample waiting at the renderer + +BOOL CBaseRenderer::HaveCurrentSample() +{ + CAutoLock cRendererLock(&m_RendererLock); + return (m_pMediaSample == NULL ? FALSE : TRUE); +} + + +// Returns the current sample waiting at the video renderer. We AddRef the +// sample before returning so that should it come due for rendering the +// person who called this method will hold the remaining reference count +// that will stop the sample being added back onto the allocator free list + +IMediaSample *CBaseRenderer::GetCurrentSample() +{ + CAutoLock cRendererLock(&m_RendererLock); + if (m_pMediaSample) { + m_pMediaSample->AddRef(); + } + return m_pMediaSample; +} + + +// Called when the source delivers us a sample. We go through a few checks to +// make sure the sample can be rendered. If we are running (streaming) then we +// have the sample scheduled with the reference clock, if we are not streaming +// then we have received an sample in paused mode so we can complete any state +// transition. On leaving this function everything will be unlocked so an app +// thread may get in and change our state to stopped (for example) in which +// case it will also signal the thread event so that our wait call is stopped + +HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample) +{ + CAutoLock cInterfaceLock(&m_InterfaceLock); + m_bInReceive = TRUE; + + // Check our flushing and filter state + + // This function must hold the interface lock because it calls + // CBaseInputPin::Receive() and CBaseInputPin::Receive() uses + // CBasePin::m_bRunTimeError. + HRESULT hr = m_pInputPin->CBaseInputPin::Receive(pMediaSample); + + if (hr != NOERROR) { + m_bInReceive = FALSE; + return E_FAIL; + } + + // Has the type changed on a media sample. We do all rendering + // synchronously on the source thread, which has a side effect + // that only one buffer is ever outstanding. Therefore when we + // have Receive called we can go ahead and change the format + // Since the format change can cause a SendMessage we just don't + // lock + if (m_pInputPin->SampleProps()->pMediaType) { + hr = m_pInputPin->SetMediaType( + (CMediaType *)m_pInputPin->SampleProps()->pMediaType); + if (FAILED(hr)) { + m_bInReceive = FALSE; + return hr; + } + } + + + CAutoLock cSampleLock(&m_RendererLock); + + ASSERT(IsActive() == TRUE); + ASSERT(m_pInputPin->IsFlushing() == FALSE); + ASSERT(m_pInputPin->IsConnected() == TRUE); + ASSERT(m_pMediaSample == NULL); + + // Return an error if we already have a sample waiting for rendering + // source pins must serialise the Receive calls - we also check that + // no data is being sent after the source signalled an end of stream + + if (m_pMediaSample || m_bEOS || m_bAbort) { + Ready(); + m_bInReceive = FALSE; + return E_UNEXPECTED; + } + + // Store the media times from this sample + if (m_pPosition) m_pPosition->RegisterMediaTime(pMediaSample); + + // Schedule the next sample if we are streaming + + if ((m_bStreaming == TRUE) && (ScheduleSample(pMediaSample) == FALSE)) { + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + ASSERT(CancelNotification() == S_FALSE); + m_bInReceive = FALSE; + return VFW_E_SAMPLE_REJECTED; + } + + // Store the sample end time for EC_COMPLETE handling + m_SignalTime = m_pInputPin->SampleProps()->tStop; + + // BEWARE we sometimes keep the sample even after returning the thread to + // the source filter such as when we go into a stopped state (we keep it + // to refresh the device with) so we must AddRef it to keep it safely. If + // we start flushing the source thread is released and any sample waiting + // will be released otherwise GetBuffer may never return (see BeginFlush) + + m_pMediaSample = pMediaSample; + m_pMediaSample->AddRef(); + + if (m_bStreaming == FALSE) { + SetRepaintStatus(TRUE); + } + return NOERROR; +} + + +// Called by the source filter when we have a sample to render. Under normal +// circumstances we set an advise link with the clock, wait for the time to +// arrive and then render the data using the PURE virtual DoRenderSample that +// the derived class will have overriden. After rendering the sample we may +// also signal EOS if it was the last one sent before EndOfStream was called + +HRESULT CBaseRenderer::Receive(IMediaSample *pSample) +{ + ASSERT(pSample); + + // It may return VFW_E_SAMPLE_REJECTED code to say don't bother + + HRESULT hr = PrepareReceive(pSample); + ASSERT(m_bInReceive == SUCCEEDED(hr)); + if (FAILED(hr)) { + if (hr == VFW_E_SAMPLE_REJECTED) { + return NOERROR; + } + return hr; + } + + // We realize the palette in "PrepareRender()" so we have to give away the + // filter lock here. + if (m_State == State_Paused) { + PrepareRender(); + // no need to use InterlockedExchange + m_bInReceive = FALSE; + { + // We must hold both these locks + CAutoLock cRendererLock(&m_InterfaceLock); + if (m_State == State_Stopped) + return NOERROR; + + m_bInReceive = TRUE; + CAutoLock cSampleLock(&m_RendererLock); + OnReceiveFirstSample(pSample); + } + Ready(); + } + // Having set an advise link with the clock we sit and wait. We may be + // awoken by the clock firing or by a state change. The rendering call + // will lock the critical section and check we can still render the data + + hr = WaitForRenderTime(); + if (FAILED(hr)) { + m_bInReceive = FALSE; + return NOERROR; + } + + PrepareRender(); + + // Set this here and poll it until we work out the locking correctly + // It can't be right that the streaming stuff grabs the interface + // lock - after all we want to be able to wait for this stuff + // to complete + m_bInReceive = FALSE; + + // We must hold both these locks + CAutoLock cRendererLock(&m_InterfaceLock); + + // since we gave away the filter wide lock, the sate of the filter could + // have chnaged to Stopped + if (m_State == State_Stopped) + return NOERROR; + + CAutoLock cSampleLock(&m_RendererLock); + + // Deal with this sample + + Render(m_pMediaSample); + ClearPendingSample(); + SendEndOfStream(); + CancelNotification(); + return NOERROR; +} + + +// This is called when we stop or are inactivated to clear the pending sample +// We release the media sample interface so that they can be allocated to the +// source filter again, unless of course we are changing state to inactive in +// which case GetBuffer will return an error. We must also reset the current +// media sample to NULL so that we know we do not currently have an image + +HRESULT CBaseRenderer::ClearPendingSample() +{ + CAutoLock cRendererLock(&m_RendererLock); + if (m_pMediaSample) { + m_pMediaSample->Release(); + m_pMediaSample = NULL; + } + return NOERROR; +} + + +// Used to signal end of stream according to the sample end time + +void CALLBACK EndOfStreamTimer(UINT uID, // Timer identifier + UINT uMsg, // Not currently used + DWORD_PTR dwUser,// User information + DWORD_PTR dw1, // Windows reserved + DWORD_PTR dw2) // is also reserved +{ + CBaseRenderer *pRenderer = (CBaseRenderer *) dwUser; + NOTE1("EndOfStreamTimer called (%d)",uID); + pRenderer->TimerCallback(); +} + +// Do the timer callback work +void CBaseRenderer::TimerCallback() +{ + // Lock for synchronization (but don't hold this lock when calling + // timeKillEvent) + CAutoLock cRendererLock(&m_RendererLock); + + // See if we should signal end of stream now + + if (m_EndOfStreamTimer) { + m_EndOfStreamTimer = 0; + SendEndOfStream(); + } +} + + +// If we are at the end of the stream signal the filter graph but do not set +// the state flag back to FALSE. Once we drop off the end of the stream we +// leave the flag set (until a subsequent ResetEndOfStream). Each sample we +// get delivered will update m_SignalTime to be the last sample's end time. +// We must wait this long before signalling end of stream to the filtergraph + +#define TIMEOUT_DELIVERYWAIT 50 +#define TIMEOUT_RESOLUTION 10 + +HRESULT CBaseRenderer::SendEndOfStream() +{ + ASSERT(CritCheckIn(&m_RendererLock)); + if (m_bEOS == FALSE || m_bEOSDelivered || m_EndOfStreamTimer) { + return NOERROR; + } + + // If there is no clock then signal immediately + if (m_pClock == NULL) { + return NotifyEndOfStream(); + } + + // How long into the future is the delivery time + + REFERENCE_TIME Signal = m_tStart + m_SignalTime; + REFERENCE_TIME CurrentTime; + m_pClock->GetTime(&CurrentTime); + LONG Delay = LONG((Signal - CurrentTime) / 10000); + + // Dump the timing information to the debugger + + NOTE1("Delay until end of stream delivery %d",Delay); + NOTE1("Current %s",(LPCTSTR)CDisp((LONGLONG)CurrentTime)); + NOTE1("Signal %s",(LPCTSTR)CDisp((LONGLONG)Signal)); + + // Wait for the delivery time to arrive + + if (Delay < TIMEOUT_DELIVERYWAIT) { + return NotifyEndOfStream(); + } + + // Signal a timer callback on another worker thread + + m_EndOfStreamTimer = CompatibleTimeSetEvent((UINT) Delay, // Period of timer + TIMEOUT_RESOLUTION, // Timer resolution + EndOfStreamTimer, // Callback function + DWORD_PTR(this), // Used information + TIME_ONESHOT); // Type of callback + if (m_EndOfStreamTimer == 0) { + return NotifyEndOfStream(); + } + return NOERROR; +} + + +// Signals EC_COMPLETE to the filtergraph manager + +HRESULT CBaseRenderer::NotifyEndOfStream() +{ + CAutoLock cRendererLock(&m_RendererLock); + ASSERT(m_bEOSDelivered == FALSE); + ASSERT(m_EndOfStreamTimer == 0); + + // Has the filter changed state + + if (m_bStreaming == FALSE) { + ASSERT(m_EndOfStreamTimer == 0); + return NOERROR; + } + + // Reset the end of stream timer + m_EndOfStreamTimer = 0; + + // If we've been using the IMediaPosition interface, set it's start + // and end media "times" to the stop position by hand. This ensures + // that we actually get to the end, even if the MPEG guestimate has + // been bad or if the quality management dropped the last few frames + + if (m_pPosition) m_pPosition->EOS(); + m_bEOSDelivered = TRUE; + NOTE("Sending EC_COMPLETE..."); + return NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this); +} + + +// Reset the end of stream flag, this is typically called when we transfer to +// stopped states since that resets the current position back to the start so +// we will receive more samples or another EndOfStream if there aren't any. We +// keep two separate flags one to say we have run off the end of the stream +// (this is the m_bEOS flag) and another to say we have delivered EC_COMPLETE +// to the filter graph. We need the latter otherwise we can end up sending an +// EC_COMPLETE every time the source changes state and calls our EndOfStream + +HRESULT CBaseRenderer::ResetEndOfStream() +{ + ResetEndOfStreamTimer(); + CAutoLock cRendererLock(&m_RendererLock); + + m_bEOS = FALSE; + m_bEOSDelivered = FALSE; + m_SignalTime = 0; + + return NOERROR; +} + + +// Kills any outstanding end of stream timer + +void CBaseRenderer::ResetEndOfStreamTimer() +{ + ASSERT(CritCheckOut(&m_RendererLock)); + if (m_EndOfStreamTimer) { + timeKillEvent(m_EndOfStreamTimer); + m_EndOfStreamTimer = 0; + } +} + + +// This is called when we start running so that we can schedule any pending +// image we have with the clock and display any timing information. If we +// don't have any sample but we have queued an EOS flag then we send it. If +// we do have a sample then we wait until that has been rendered before we +// signal the filter graph otherwise we may change state before it's done + +HRESULT CBaseRenderer::StartStreaming() +{ + CAutoLock cRendererLock(&m_RendererLock); + if (m_bStreaming == TRUE) { + return NOERROR; + } + + // Reset the streaming times ready for running + + m_bStreaming = TRUE; + + timeBeginPeriod(1); + OnStartStreaming(); + + // There should be no outstanding advise + ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0)); + ASSERT(CancelNotification() == S_FALSE); + + // If we have an EOS and no data then deliver it now + + if (m_pMediaSample == NULL) { + return SendEndOfStream(); + } + + // Have the data rendered + + ASSERT(m_pMediaSample); + if (!ScheduleSample(m_pMediaSample)) + m_RenderEvent.Set(); + + return NOERROR; +} + + +// This is called when we stop streaming so that we can set our internal flag +// indicating we are not now to schedule any more samples arriving. The state +// change methods in the filter implementation take care of cancelling any +// clock advise link we have set up and clearing any pending sample we have + +HRESULT CBaseRenderer::StopStreaming() +{ + CAutoLock cRendererLock(&m_RendererLock); + m_bEOSDelivered = FALSE; + + if (m_bStreaming == TRUE) { + m_bStreaming = FALSE; + OnStopStreaming(); + timeEndPeriod(1); + } + return NOERROR; +} + + +// We have a boolean flag that is reset when we have signalled EC_REPAINT to +// the filter graph. We set this when we receive an image so that should any +// conditions arise again we can send another one. By having a flag we ensure +// we don't flood the filter graph with redundant calls. We do not set the +// event when we receive an EndOfStream call since there is no point in us +// sending further EC_REPAINTs. In particular the AutoShowWindow method and +// the DirectDraw object use this method to control the window repainting + +void CBaseRenderer::SetRepaintStatus(BOOL bRepaint) +{ + CAutoLock cSampleLock(&m_RendererLock); + m_bRepaintStatus = bRepaint; +} + + +// Pass the window handle to the upstream filter + +void CBaseRenderer::SendNotifyWindow(IPin *pPin,HWND hwnd) +{ + IMediaEventSink *pSink; + + // Does the pin support IMediaEventSink + HRESULT hr = pPin->QueryInterface(IID_IMediaEventSink,(void **)&pSink); + if (SUCCEEDED(hr)) { + pSink->Notify(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0); + pSink->Release(); + } + NotifyEvent(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0); +} + + +// Signal an EC_REPAINT to the filter graph. This can be used to have data +// sent to us. For example when a video window is first displayed it may +// not have an image to display, at which point it signals EC_REPAINT. The +// filtergraph will either pause the graph if stopped or if already paused +// it will call put_CurrentPosition of the current position. Setting the +// current position to itself has the stream flushed and the image resent + +#define RLOG(_x_) DbgLog((LOG_TRACE,1,TEXT(_x_))); + +void CBaseRenderer::SendRepaint() +{ + CAutoLock cSampleLock(&m_RendererLock); + ASSERT(m_pInputPin); + + // We should not send repaint notifications when... + // - An end of stream has been notified + // - Our input pin is being flushed + // - The input pin is not connected + // - We have aborted a video playback + // - There is a repaint already sent + + if (m_bAbort == FALSE) { + if (m_pInputPin->IsConnected() == TRUE) { + if (m_pInputPin->IsFlushing() == FALSE) { + if (IsEndOfStream() == FALSE) { + if (m_bRepaintStatus == TRUE) { + IPin *pPin = (IPin *) m_pInputPin; + NotifyEvent(EC_REPAINT,(LONG_PTR) pPin,0); + SetRepaintStatus(FALSE); + RLOG("Sending repaint"); + } + } + } + } + } +} + + +// When a video window detects a display change (WM_DISPLAYCHANGE message) it +// can send an EC_DISPLAY_CHANGED event code along with the renderer pin. The +// filtergraph will stop everyone and reconnect our input pin. As we're then +// reconnected we can accept the media type that matches the new display mode +// since we may no longer be able to draw the current image type efficiently + +BOOL CBaseRenderer::OnDisplayChange() +{ + // Ignore if we are not connected yet + + CAutoLock cSampleLock(&m_RendererLock); + if (m_pInputPin->IsConnected() == FALSE) { + return FALSE; + } + + RLOG("Notification of EC_DISPLAY_CHANGE"); + + // Pass our input pin as parameter on the event + + IPin *pPin = (IPin *) m_pInputPin; + m_pInputPin->AddRef(); + NotifyEvent(EC_DISPLAY_CHANGED,(LONG_PTR) pPin,0); + SetAbortSignal(TRUE); + ClearPendingSample(); + m_pInputPin->Release(); + + return TRUE; +} + + +// Called just before we start drawing. +// Store the current time in m_trRenderStart to allow the rendering time to be +// logged. Log the time stamp of the sample and how late it is (neg is early) + +void CBaseRenderer::OnRenderStart(IMediaSample *pMediaSample) +{ +#ifdef PERF + REFERENCE_TIME trStart, trEnd; + pMediaSample->GetTime(&trStart, &trEnd); + + MSR_INTEGER(m_idBaseStamp, (int)trStart); // dump low order 32 bits + + m_pClock->GetTime(&m_trRenderStart); + MSR_INTEGER(0, (int)m_trRenderStart); + REFERENCE_TIME trStream; + trStream = m_trRenderStart-m_tStart; // convert reftime to stream time + MSR_INTEGER(0,(int)trStream); + + const int trLate = (int)(trStream - trStart); + MSR_INTEGER(m_idBaseAccuracy, trLate/10000); // dump in mSec +#endif + +} // OnRenderStart + + +// Called directly after drawing an image. +// calculate the time spent drawing and log it. + +void CBaseRenderer::OnRenderEnd(IMediaSample *pMediaSample) +{ +#ifdef PERF + REFERENCE_TIME trNow; + m_pClock->GetTime(&trNow); + MSR_INTEGER(0,(int)trNow); + int t = (int)((trNow - m_trRenderStart)/10000); // convert UNITS->msec + MSR_INTEGER(m_idBaseRenderTime, t); +#endif +} // OnRenderEnd + + + + +// Constructor must be passed the base renderer object + +CRendererInputPin::CRendererInputPin(CBaseRenderer *pRenderer, + HRESULT *phr, + LPCWSTR pPinName) : + CBaseInputPin(NAME("Renderer pin"), + pRenderer, + &pRenderer->m_InterfaceLock, + (HRESULT *) phr, + pPinName) +{ + m_pRenderer = pRenderer; + ASSERT(m_pRenderer); +} + + +// Signals end of data stream on the input pin + +STDMETHODIMP CRendererInputPin::EndOfStream() +{ + CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); + CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); + + // Make sure we're streaming ok + + HRESULT hr = CheckStreaming(); + if (hr != NOERROR) { + return hr; + } + + // Pass it onto the renderer + + hr = m_pRenderer->EndOfStream(); + if (SUCCEEDED(hr)) { + hr = CBaseInputPin::EndOfStream(); + } + return hr; +} + + +// Signals start of flushing on the input pin - we do the final reset end of +// stream with the renderer lock unlocked but with the interface lock locked +// We must do this because we call timeKillEvent, our timer callback method +// has to take the renderer lock to serialise our state. Therefore holding a +// renderer lock when calling timeKillEvent could cause a deadlock condition + +STDMETHODIMP CRendererInputPin::BeginFlush() +{ + CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); + { + CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); + CBaseInputPin::BeginFlush(); + m_pRenderer->BeginFlush(); + } + return m_pRenderer->ResetEndOfStream(); +} + + +// Signals end of flushing on the input pin + +STDMETHODIMP CRendererInputPin::EndFlush() +{ + CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); + CAutoLock cSampleLock(&m_pRenderer->m_RendererLock); + + HRESULT hr = m_pRenderer->EndFlush(); + if (SUCCEEDED(hr)) { + hr = CBaseInputPin::EndFlush(); + } + return hr; +} + + +// Pass the sample straight through to the renderer object + +STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample) +{ + HRESULT hr = m_pRenderer->Receive(pSample); + if (FAILED(hr)) { + + // A deadlock could occur if the caller holds the renderer lock and + // attempts to acquire the interface lock. + ASSERT(CritCheckOut(&m_pRenderer->m_RendererLock)); + + { + // The interface lock must be held when the filter is calling + // IsStopped() or IsFlushing(). The interface lock must also + // be held because the function uses m_bRunTimeError. + CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock); + + // We do not report errors which occur while the filter is stopping, + // flushing or if the m_bAbort flag is set . Errors are expected to + // occur during these operations and the streaming thread correctly + // handles the errors. + if (!IsStopped() && !IsFlushing() && !m_pRenderer->m_bAbort && !m_bRunTimeError) { + + // EC_ERRORABORT's first parameter is the error which caused + // the event and its' last parameter is 0. See the Direct + // Show SDK documentation for more information. + m_pRenderer->NotifyEvent(EC_ERRORABORT,hr,0); + + { + CAutoLock alRendererLock(&m_pRenderer->m_RendererLock); + if (m_pRenderer->IsStreaming() && !m_pRenderer->IsEndOfStreamDelivered()) { + m_pRenderer->NotifyEndOfStream(); + } + } + + m_bRunTimeError = TRUE; + } + } + } + + return hr; +} + + +// Called when the input pin is disconnected + +HRESULT CRendererInputPin::BreakConnect() +{ + HRESULT hr = m_pRenderer->BreakConnect(); + if (FAILED(hr)) { + return hr; + } + return CBaseInputPin::BreakConnect(); +} + + +// Called when the input pin is connected + +HRESULT CRendererInputPin::CompleteConnect(IPin *pReceivePin) +{ + HRESULT hr = m_pRenderer->CompleteConnect(pReceivePin); + if (FAILED(hr)) { + return hr; + } + return CBaseInputPin::CompleteConnect(pReceivePin); +} + + +// Give the pin id of our one and only pin + +STDMETHODIMP CRendererInputPin::QueryId(LPWSTR *Id) +{ + CheckPointer(Id,E_POINTER); + + *Id = (LPWSTR)CoTaskMemAlloc(8); + if (*Id == NULL) { + return E_OUTOFMEMORY; + } + lstrcpyW(*Id, L"In"); + return NOERROR; +} + + +// Will the filter accept this media type + +HRESULT CRendererInputPin::CheckMediaType(const CMediaType *pmt) +{ + return m_pRenderer->CheckMediaType(pmt); +} + + +// Called when we go paused or running + +HRESULT CRendererInputPin::Active() +{ + return m_pRenderer->Active(); +} + + +// Called when we go into a stopped state + +HRESULT CRendererInputPin::Inactive() +{ + // The caller must hold the interface lock because + // this function uses m_bRunTimeError. + ASSERT(CritCheckIn(&m_pRenderer->m_InterfaceLock)); + + m_bRunTimeError = FALSE; + + return m_pRenderer->Inactive(); +} + + +// Tell derived classes about the media type agreed + +HRESULT CRendererInputPin::SetMediaType(const CMediaType *pmt) +{ + HRESULT hr = CBaseInputPin::SetMediaType(pmt); + if (FAILED(hr)) { + return hr; + } + return m_pRenderer->SetMediaType(pmt); +} + + +// We do not keep an event object to use when setting up a timer link with +// the clock but are given a pointer to one by the owning object through the +// SetNotificationObject method - this must be initialised before starting +// We can override the default quality management process to have it always +// draw late frames, this is currently done by having the following registry +// key (actually an INI key) called DrawLateFrames set to 1 (default is 0) + +const TCHAR AMQUALITY[] = TEXT("ActiveMovie"); +const TCHAR DRAWLATEFRAMES[] = TEXT("DrawLateFrames"); + +CBaseVideoRenderer::CBaseVideoRenderer( + REFCLSID RenderClass, // CLSID for this renderer + TCHAR *pName, // Debug ONLY description + LPUNKNOWN pUnk, // Aggregated owner object + HRESULT *phr) : // General OLE return code + + CBaseRenderer(RenderClass,pName,pUnk,phr), + m_cFramesDropped(0), + m_cFramesDrawn(0), + m_bSupplierHandlingQuality(FALSE) +{ + ResetStreamingTimes(); + +#ifdef PERF + m_idTimeStamp = MSR_REGISTER(TEXT("Frame time stamp")); + m_idEarliness = MSR_REGISTER(TEXT("Earliness fudge")); + m_idTarget = MSR_REGISTER(TEXT("Target (mSec)")); + m_idSchLateTime = MSR_REGISTER(TEXT("mSec late when scheduled")); + m_idDecision = MSR_REGISTER(TEXT("Scheduler decision code")); + m_idQualityRate = MSR_REGISTER(TEXT("Quality rate sent")); + m_idQualityTime = MSR_REGISTER(TEXT("Quality time sent")); + m_idWaitReal = MSR_REGISTER(TEXT("Render wait")); + // m_idWait = MSR_REGISTER(TEXT("wait time recorded (msec)")); + m_idFrameAccuracy = MSR_REGISTER(TEXT("Frame accuracy (msecs)")); + m_bDrawLateFrames = GetProfileInt(AMQUALITY, DRAWLATEFRAMES, FALSE); + //m_idSendQuality = MSR_REGISTER(TEXT("Processing Quality message")); + + m_idRenderAvg = MSR_REGISTER(TEXT("Render draw time Avg")); + m_idFrameAvg = MSR_REGISTER(TEXT("FrameAvg")); + m_idWaitAvg = MSR_REGISTER(TEXT("WaitAvg")); + m_idDuration = MSR_REGISTER(TEXT("Duration")); + m_idThrottle = MSR_REGISTER(TEXT("Audio-video throttle wait")); + // m_idDebug = MSR_REGISTER(TEXT("Debug stuff")); +#endif // PERF +} // Constructor + + +// Destructor is just a placeholder + +CBaseVideoRenderer::~CBaseVideoRenderer() +{ + ASSERT(m_dwAdvise == 0); +} + + +// The timing functions in this class are called by the window object and by +// the renderer's allocator. +// The windows object calls timing functions as it receives media sample +// images for drawing using GDI. +// The allocator calls timing functions when it starts passing DCI/DirectDraw +// surfaces which are not rendered in the same way; The decompressor writes +// directly to the surface with no separate rendering, so those code paths +// call direct into us. Since we only ever hand out DCI/DirectDraw surfaces +// when we have allocated one and only one image we know there cannot be any +// conflict between the two. +// +// We use timeGetTime to return the timing counts we use (since it's relative +// performance we are interested in rather than absolute compared to a clock) +// The window object sets the accuracy of the system clock (normally 1ms) by +// calling timeBeginPeriod/timeEndPeriod when it changes streaming states + + +// Reset all times controlling streaming. +// Set them so that +// 1. Frames will not initially be dropped +// 2. The first frame will definitely be drawn (achieved by saying that there +// has not ben a frame drawn for a long time). + +HRESULT CBaseVideoRenderer::ResetStreamingTimes() +{ + m_trLastDraw = -1000; // set up as first frame since ages (1 sec) ago + m_tStreamingStart = timeGetTime(); + m_trRenderAvg = 0; + m_trFrameAvg = -1; // -1000 fps == "unset" + m_trDuration = 0; // 0 - strange value + m_trRenderLast = 0; + m_trWaitAvg = 0; + m_tRenderStart = 0; + m_cFramesDrawn = 0; + m_cFramesDropped = 0; + m_iTotAcc = 0; + m_iSumSqAcc = 0; + m_iSumSqFrameTime = 0; + m_trFrame = 0; // hygeine - not really needed + m_trLate = 0; // hygeine - not really needed + m_iSumFrameTime = 0; + m_nNormal = 0; + m_trEarliness = 0; + m_trTarget = -300000; // 30mSec early + m_trThrottle = 0; + m_trRememberStampForPerf = 0; + +#ifdef PERF + m_trRememberFrameForPerf = 0; +#endif + + return NOERROR; +} // ResetStreamingTimes + + +// Reset all times controlling streaming. Note that we're now streaming. We +// don't need to set the rendering event to have the source filter released +// as it is done during the Run processing. When we are run we immediately +// release the source filter thread and draw any image waiting (that image +// may already have been drawn once as a poster frame while we were paused) + +HRESULT CBaseVideoRenderer::OnStartStreaming() +{ + ResetStreamingTimes(); + return NOERROR; +} // OnStartStreaming + + +// Called at end of streaming. Fixes times for property page report + +HRESULT CBaseVideoRenderer::OnStopStreaming() +{ + m_tStreamingStart = timeGetTime()-m_tStreamingStart; + return NOERROR; +} // OnStopStreaming + + +// Called when we start waiting for a rendering event. +// Used to update times spent waiting and not waiting. + +void CBaseVideoRenderer::OnWaitStart() +{ + MSR_START(m_idWaitReal); +} // OnWaitStart + + +// Called when we are awoken from the wait in the window OR by our allocator +// when it is hanging around until the next sample is due for rendering on a +// DCI/DirectDraw surface. We add the wait time into our rolling average. +// We grab the interface lock so that we're serialised with the application +// thread going through the run code - which in due course ends up calling +// ResetStreaming times - possibly as we run through this section of code + +void CBaseVideoRenderer::OnWaitEnd() +{ +#ifdef PERF + MSR_STOP(m_idWaitReal); + // for a perf build we want to know just exactly how late we REALLY are. + // even if this means that we have to look at the clock again. + + REFERENCE_TIME trRealStream; // the real time now expressed as stream time. +#if 0 + m_pClock->GetTime(&trRealStream); // Calling clock here causes W95 deadlock! +#else + // We will be discarding overflows like mad here! + // This is wrong really because timeGetTime() can wrap but it's + // only for PERF + REFERENCE_TIME tr = timeGetTime()*10000; + trRealStream = tr + m_llTimeOffset; +#endif + trRealStream -= m_tStart; // convert to stream time (this is a reftime) + + if (m_trRememberStampForPerf==0) { + // This is probably the poster frame at the start, and it is not scheduled + // in the usual way at all. Just count it. The rememberstamp gets set + // in ShouldDrawSampleNow, so this does invalid frame recording until we + // actually start playing. + PreparePerformanceData(0, 0); + } else { + int trLate = (int)(trRealStream - m_trRememberStampForPerf); + int trFrame = (int)(tr - m_trRememberFrameForPerf); + PreparePerformanceData(trLate, trFrame); + } + m_trRememberFrameForPerf = tr; +#endif //PERF +} // OnWaitEnd + + +// Put data on one side that describes the lateness of the current frame. +// We don't yet know whether it will actually be drawn. In direct draw mode, +// this decision is up to the filter upstream, and it could change its mind. +// The rules say that if it did draw it must call Receive(). One way or +// another we eventually get into either OnRenderStart or OnDirectRender and +// these both call RecordFrameLateness to update the statistics. + +void CBaseVideoRenderer::PreparePerformanceData(int trLate, int trFrame) +{ + m_trLate = trLate; + m_trFrame = trFrame; +} // PreparePerformanceData + + +// update the statistics: +// m_iTotAcc, m_iSumSqAcc, m_iSumSqFrameTime, m_iSumFrameTime, m_cFramesDrawn +// Note that because the properties page reports using these variables, +// 1. We need to be inside a critical section +// 2. They must all be updated together. Updating the sums here and the count +// elsewhere can result in imaginary jitter (i.e. attempts to find square roots +// of negative numbers) in the property page code. + +void CBaseVideoRenderer::RecordFrameLateness(int trLate, int trFrame) +{ + // Record how timely we are. + int tLate = trLate/10000; + + // Best estimate of moment of appearing on the screen is average of + // start and end draw times. Here we have only the end time. This may + // tend to show us as spuriously late by up to 1/2 frame rate achieved. + // Decoder probably monitors draw time. We don't bother. + MSR_INTEGER( m_idFrameAccuracy, tLate ); + + // This is a kludge - we can get frames that are very late + // especially (at start-up) and they invalidate the statistics. + // So ignore things that are more than 1 sec off. + if (tLate>1000 || tLate<-1000) { + if (m_cFramesDrawn<=1) { + tLate = 0; + } else if (tLate>0) { + tLate = 1000; + } else { + tLate = -1000; + } + } + // The very first frame often has a invalid time, so don't + // count it into the statistics. (???) + if (m_cFramesDrawn>1) { + m_iTotAcc += tLate; + m_iSumSqAcc += (tLate*tLate); + } + + // calculate inter-frame time. Doesn't make sense for first frame + // second frame suffers from invalid first frame stamp. + if (m_cFramesDrawn>2) { + int tFrame = trFrame/10000; // convert to mSec else it overflows + + // This is a kludge. It can overflow anyway (a pause can cause + // a very long inter-frame time) and it overflows at 2**31/10**7 + // or about 215 seconds i.e. 3min 35sec + if (tFrame>1000||tFrame<0) tFrame = 1000; + m_iSumSqFrameTime += tFrame*tFrame; + ASSERT(m_iSumSqFrameTime>=0); + m_iSumFrameTime += tFrame; + } + ++m_cFramesDrawn; + +} // RecordFrameLateness + + +void CBaseVideoRenderer::ThrottleWait() +{ + if (m_trThrottle>0) { + int iThrottle = m_trThrottle/10000; // convert to mSec + MSR_INTEGER( m_idThrottle, iThrottle); + DbgLog((LOG_TRACE, 0, TEXT("Throttle %d ms"), iThrottle)); + Sleep(iThrottle); + } else { + Sleep(0); + } +} // ThrottleWait + + +// Whenever a frame is rendered it goes though either OnRenderStart +// or OnDirectRender. Data that are generated during ShouldDrawSample +// are added to the statistics by calling RecordFrameLateness from both +// these two places. + +// Called in place of OnRenderStart..OnRenderEnd +// When a DirectDraw image is drawn +void CBaseVideoRenderer::OnDirectRender(IMediaSample *pMediaSample) +{ + m_trRenderAvg = 0; + m_trRenderLast = 5000000; // If we mode switch, we do NOT want this + // to inhibit the new average getting going! + // so we set it to half a second + // MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000); + RecordFrameLateness(m_trLate, m_trFrame); + ThrottleWait(); +} // OnDirectRender + + +// Called just before we start drawing. All we do is to get the current clock +// time (from the system) and return. We have to store the start render time +// in a member variable because it isn't used until we complete the drawing +// The rest is just performance logging. + +void CBaseVideoRenderer::OnRenderStart(IMediaSample *pMediaSample) +{ + RecordFrameLateness(m_trLate, m_trFrame); + m_tRenderStart = timeGetTime(); +} // OnRenderStart + + +// Called directly after drawing an image. We calculate the time spent in the +// drawing code and if this doesn't appear to have any odd looking spikes in +// it then we add it to the current average draw time. Measurement spikes may +// occur if the drawing thread is interrupted and switched to somewhere else. + +void CBaseVideoRenderer::OnRenderEnd(IMediaSample *pMediaSample) +{ + // The renderer time can vary erratically if we are interrupted so we do + // some smoothing to help get more sensible figures out but even that is + // not enough as figures can go 9,10,9,9,83,9 and we must disregard 83 + + int tr = (timeGetTime() - m_tRenderStart)*10000; // convert mSec->UNITS + if (tr < m_trRenderAvg*2 || tr < 2 * m_trRenderLast) { + // DO_MOVING_AVG(m_trRenderAvg, tr); + m_trRenderAvg = (tr + (AVGPERIOD-1)*m_trRenderAvg)/AVGPERIOD; + } + m_trRenderLast = tr; + ThrottleWait(); +} // OnRenderEnd + + +STDMETHODIMP CBaseVideoRenderer::SetSink( IQualityControl * piqc) +{ + + m_pQSink = piqc; + + return NOERROR; +} // SetSink + + +STDMETHODIMP CBaseVideoRenderer::Notify( IBaseFilter * pSelf, Quality q) +{ + // NOTE: We are NOT getting any locks here. We could be called + // asynchronously and possibly even on a time critical thread of + // someone else's - so we do the minumum. We only set one state + // variable (an integer) and if that happens to be in the middle + // of another thread reading it they will just get either the new + // or the old value. Locking would achieve no more than this. + + // It might be nice to check that we are being called from m_pGraph, but + // it turns out to be a millisecond or so per throw! + + // This is heuristics, these numbers are aimed at being "what works" + // rather than anything based on some theory. + // We use a hyperbola because it's easy to calculate and it includes + // a panic button asymptote (which we push off just to the left) + // The throttling fits the following table (roughly) + // Proportion Throttle (msec) + // >=1000 0 + // 900 3 + // 800 7 + // 700 11 + // 600 17 + // 500 25 + // 400 35 + // 300 50 + // 200 72 + // 125 100 + // 100 112 + // 50 146 + // 0 200 + + // (some evidence that we could go for a sharper kink - e.g. no throttling + // until below the 750 mark - might give fractionally more frames on a + // P60-ish machine). The easy way to get these coefficients is to use + // Renbase.xls follow the instructions therein using excel solver. + + if (q.Proportion>=1000) { m_trThrottle = 0; } + else { + // The DWORD is to make quite sure I get unsigned arithmetic + // as the constant is between 2**31 and 2**32 + m_trThrottle = -330000 + (388880000/(q.Proportion+167)); + } + return NOERROR; +} // Notify + + +// Send a message to indicate what our supplier should do about quality. +// Theory: +// What a supplier wants to know is "is the frame I'm working on NOW +// going to be late?". +// F1 is the frame at the supplier (as above) +// Tf1 is the due time for F1 +// T1 is the time at that point (NOW!) +// Tr1 is the time that f1 WILL actually be rendered +// L1 is the latency of the graph for frame F1 = Tr1-T1 +// D1 (for delay) is how late F1 will be beyond its due time i.e. +// D1 = (Tr1-Tf1) which is what the supplier really wants to know. +// Unfortunately Tr1 is in the future and is unknown, so is L1 +// +// We could estimate L1 by its value for a previous frame, +// L0 = Tr0-T0 and work off +// D1' = ((T1+L0)-Tf1) = (T1 + (Tr0-T0) -Tf1) +// Rearranging terms: +// D1' = (T1-T0) + (Tr0-Tf1) +// adding (Tf0-Tf0) and rearranging again: +// = (T1-T0) + (Tr0-Tf0) + (Tf0-Tf1) +// = (T1-T0) - (Tf1-Tf0) + (Tr0-Tf0) +// But (Tr0-Tf0) is just D0 - how late frame zero was, and this is the +// Late field in the quality message that we send. +// The other two terms just state what correction should be applied before +// using the lateness of F0 to predict the lateness of F1. +// (T1-T0) says how much time has actually passed (we have lost this much) +// (Tf1-Tf0) says how much time should have passed if we were keeping pace +// (we have gained this much). +// +// Suppliers should therefore work off: +// Quality.Late + (T1-T0) - (Tf1-Tf0) +// and see if this is "acceptably late" or even early (i.e. negative). +// They get T1 and T0 by polling the clock, they get Tf1 and Tf0 from +// the time stamps in the frames. They get Quality.Late from us. +// + +HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate, + REFERENCE_TIME trRealStream) +{ + Quality q; + HRESULT hr; + + // If we are the main user of time, then report this as Flood/Dry. + // If our suppliers are, then report it as Famine/Glut. + // + // We need to take action, but avoid hunting. Hunting is caused by + // 1. Taking too much action too soon and overshooting + // 2. Taking too long to react (so averaging can CAUSE hunting). + // + // The reason why we use trLate as well as Wait is to reduce hunting; + // if the wait time is coming down and about to go into the red, we do + // NOT want to rely on some average which is only telling is that it used + // to be OK once. + + q.TimeStamp = (REFERENCE_TIME)trRealStream; + + if (m_trFrameAvg<0) { + q.Type = Famine; // guess + } + // Is the greater part of the time taken bltting or something else + else if (m_trFrameAvg > 2*m_trRenderAvg) { + q.Type = Famine; // mainly other + } else { + q.Type = Flood; // mainly bltting + } + + q.Proportion = 1000; // default + + if (m_trFrameAvg<0) { + // leave it alone - we don't know enough + } + else if ( trLate> 0 ) { + // try to catch up over the next second + // We could be Really, REALLY late, but rendering all the frames + // anyway, just because it's so cheap. + + q.Proportion = 1000 - (int)((trLate)/(UNITS/1000)); + if (q.Proportion<500) { + q.Proportion = 500; // don't go daft. (could've been negative!) + } else { + } + + } else if ( m_trWaitAvg>20000 + && trLate<-20000 + ){ + // Go cautiously faster - aim at 2mSec wait. + if (m_trWaitAvg>=m_trFrameAvg) { + // This can happen because of some fudges. + // The waitAvg is how long we originally planned to wait + // The frameAvg is more honest. + // It means that we are spending a LOT of time waiting + q.Proportion = 2000; // double. + } else { + if (m_trFrameAvg+20000 > m_trWaitAvg) { + q.Proportion + = 1000 * (m_trFrameAvg / (m_trFrameAvg + 20000 - m_trWaitAvg)); + } else { + // We're apparently spending more than the whole frame time waiting. + // Assume that the averages are slightly out of kilter, but that we + // are indeed doing a lot of waiting. (This leg probably never + // happens, but the code avoids any potential divide by zero). + q.Proportion = 2000; + } + } + + if (q.Proportion>2000) { + q.Proportion = 2000; // don't go crazy. + } + } + + // Tell the supplier how late frames are when they get rendered + // That's how late we are now. + // If we are in directdraw mode then the guy upstream can see the drawing + // times and we'll just report on the start time. He can figure out any + // offset to apply. If we are in DIB Section mode then we will apply an + // extra offset which is half of our drawing time. This is usually small + // but can sometimes be the dominant effect. For this we will use the + // average drawing time rather than the last frame. If the last frame took + // a long time to draw and made us late, that's already in the lateness + // figure. We should not add it in again unless we expect the next frame + // to be the same. We don't, we expect the average to be a better shot. + // In direct draw mode the RenderAvg will be zero. + + q.Late = trLate + m_trRenderAvg/2; + + // log what we're doing + MSR_INTEGER(m_idQualityRate, q.Proportion); + MSR_INTEGER( m_idQualityTime, (int)q.Late / 10000 ); + + // A specific sink interface may be set through IPin + + if (m_pQSink==NULL) { + // Get our input pin's peer. We send quality management messages + // to any nominated receiver of these things (set in the IPin + // interface), or else to our source filter. + + IQualityControl *pQC = NULL; + IPin *pOutputPin = m_pInputPin->GetConnected(); + ASSERT(pOutputPin != NULL); + + // And get an AddRef'd quality control interface + + hr = pOutputPin->QueryInterface(IID_IQualityControl,(void**) &pQC); + if (SUCCEEDED(hr)) { + m_pQSink = pQC; + } + } + if (m_pQSink) { + return m_pQSink->Notify(this,q); + } + + return S_FALSE; + +} // SendQuality + + +// We are called with a valid IMediaSample image to decide whether this is to +// be drawn or not. There must be a reference clock in operation. +// Return S_OK if it is to be drawn Now (as soon as possible) +// Return S_FALSE if it is to be drawn when it's due +// Return an error if we want to drop it +// m_nNormal=-1 indicates that we dropped the previous frame and so this +// one should be drawn early. Respect it and update it. +// Use current stream time plus a number of heuristics (detailed below) +// to make the decision + +HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample, + REFERENCE_TIME *ptrStart, + REFERENCE_TIME *ptrEnd) +{ + + // Don't call us unless there's a clock interface to synchronise with + ASSERT(m_pClock); + + MSR_INTEGER(m_idTimeStamp, (int)((*ptrStart)>>32)); // high order 32 bits + MSR_INTEGER(m_idTimeStamp, (int)(*ptrStart)); // low order 32 bits + + // We lose a bit of time depending on the monitor type waiting for the next + // screen refresh. On average this might be about 8mSec - so it will be + // later than we think when the picture appears. To compensate a bit + // we bias the media samples by -8mSec i.e. 80000 UNITs. + // We don't ever make a stream time negative (call it paranoia) + if (*ptrStart>=80000) { + *ptrStart -= 80000; + *ptrEnd -= 80000; // bias stop to to retain valid frame duration + } + + // Cache the time stamp now. We will want to compare what we did with what + // we started with (after making the monitor allowance). + m_trRememberStampForPerf = *ptrStart; + + // Get reference times (current and late) + REFERENCE_TIME trRealStream; // the real time now expressed as stream time. + m_pClock->GetTime(&trRealStream); +#ifdef PERF + // While the reference clock is expensive: + // Remember the offset from timeGetTime and use that. + // This overflows all over the place, but when we subtract to get + // differences the overflows all cancel out. + m_llTimeOffset = trRealStream-timeGetTime()*10000; +#endif + trRealStream -= m_tStart; // convert to stream time (this is a reftime) + + // We have to wory about two versions of "lateness". The truth, which we + // try to work out here and the one measured against m_trTarget which + // includes long term feedback. We report statistics against the truth + // but for operational decisions we work to the target. + // We use TimeDiff to make sure we get an integer because we + // may actually be late (or more likely early if there is a big time + // gap) by a very long time. + const int trTrueLate = TimeDiff(trRealStream - *ptrStart); + const int trLate = trTrueLate; + + MSR_INTEGER(m_idSchLateTime, trTrueLate/10000); + + // Send quality control messages upstream, measured against target + HRESULT hr = SendQuality(trLate, trRealStream); + // Note: the filter upstream is allowed to this FAIL meaning "you do it". + m_bSupplierHandlingQuality = (hr==S_OK); + + // Decision time! Do we drop, draw when ready or draw immediately? + + const int trDuration = (int)(*ptrEnd - *ptrStart); + { + // We need to see if the frame rate of the file has just changed. + // This would make comparing our previous frame rate with the current + // frame rate inefficent. Hang on a moment though. I've seen files + // where the frames vary between 33 and 34 mSec so as to average + // 30fps. A minor variation like that won't hurt us. + int t = m_trDuration/32; + if ( trDuration > m_trDuration+t + || trDuration < m_trDuration-t + ) { + // There's a major variation. Reset the average frame rate to + // exactly the current rate to disable decision 9002 for this frame, + // and remember the new rate. + m_trFrameAvg = trDuration; + m_trDuration = trDuration; + } + } + + MSR_INTEGER(m_idEarliness, m_trEarliness/10000); + MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000); + MSR_INTEGER(m_idFrameAvg, m_trFrameAvg/10000); + MSR_INTEGER(m_idWaitAvg, m_trWaitAvg/10000); + MSR_INTEGER(m_idDuration, trDuration/10000); + +#ifdef PERF + if (S_OK==pMediaSample->IsDiscontinuity()) { + MSR_INTEGER(m_idDecision, 9000); + } +#endif + + // Control the graceful slide back from slow to fast machine mode. + // After a frame drop accept an early frame and set the earliness to here + // If this frame is already later than the earliness then slide it to here + // otherwise do the standard slide (reduce by about 12% per frame). + // Note: earliness is normally NEGATIVE + BOOL bJustDroppedFrame + = ( m_bSupplierHandlingQuality + // Can't use the pin sample properties because we might + // not be in Receive when we call this + && (S_OK == pMediaSample->IsDiscontinuity()) // he just dropped one + ) + || (m_nNormal==-1); // we just dropped one + + + // Set m_trEarliness (slide back from slow to fast machine mode) + if (trLate>0) { + m_trEarliness = 0; // we are no longer in fast machine mode at all! + } else if ( (trLate>=m_trEarliness) || bJustDroppedFrame) { + m_trEarliness = trLate; // Things have slipped of their own accord + } else { + m_trEarliness = m_trEarliness - m_trEarliness/8; // graceful slide + } + + // prepare the new wait average - but don't pollute the old one until + // we have finished with it. + int trWaitAvg; + { + // We never mix in a negative wait. This causes us to believe in fast machines + // slightly more. + int trL = trLate<0 ? -trLate : 0; + trWaitAvg = (trL + m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD; + } + + + int trFrame; + { + REFERENCE_TIME tr = trRealStream - m_trLastDraw; // Cd be large - 4 min pause! + if (tr>10000000) { + tr = 10000000; // 1 second - arbitrarily. + } + trFrame = int(tr); + } + + // We will DRAW this frame IF... + if ( + // ...the time we are spending drawing is a small fraction of the total + // observed inter-frame time so that dropping it won't help much. + (3*m_trRenderAvg <= m_trFrameAvg) + + // ...or our supplier is NOT handling things and the next frame would + // be less timely than this one or our supplier CLAIMS to be handling + // things, and is now less than a full FOUR frames late. + || ( m_bSupplierHandlingQuality + ? (trLate <= trDuration*4) + : (trLate+trLate < trDuration) + ) + + // ...or we are on average waiting for over eight milliseconds then + // this may be just a glitch. Draw it and we'll hope to catch up. + || (m_trWaitAvg > 80000) + + // ...or we haven't drawn an image for over a second. We will update + // the display, which stops the video looking hung. + // Do this regardless of how late this media sample is. + || ((trRealStream - m_trLastDraw) > UNITS) + + ) { + HRESULT Result; + + // We are going to play this frame. We may want to play it early. + // We will play it early if we think we are in slow machine mode. + // If we think we are NOT in slow machine mode, we will still play + // it early by m_trEarliness as this controls the graceful slide back. + // and in addition we aim at being m_trTarget late rather than "on time". + + BOOL bPlayASAP = FALSE; + + // we will play it AT ONCE (slow machine mode) if... + + // ...we are playing catch-up + if ( bJustDroppedFrame) { + bPlayASAP = TRUE; + MSR_INTEGER(m_idDecision, 9001); + } + + // ...or if we are running below the true frame rate + // exact comparisons are glitchy, for these measurements, + // so add an extra 5% or so + else if ( (m_trFrameAvg > trDuration + trDuration/16) + + // It's possible to get into a state where we are losing ground, but + // are a very long way ahead. To avoid this or recover from it + // we refuse to play early by more than 10 frames. + && (trLate > - trDuration*10) + ){ + bPlayASAP = TRUE; + MSR_INTEGER(m_idDecision, 9002); + } +#if 0 + // ...or if we have been late and are less than one frame early + else if ( (trLate + trDuration > 0) + && (m_trWaitAvg<=20000) + ) { + bPlayASAP = TRUE; + MSR_INTEGER(m_idDecision, 9003); + } +#endif + // We will NOT play it at once if we are grossly early. On very slow frame + // rate movies - e.g. clock.avi - it is not a good idea to leap ahead just + // because we got starved (for instance by the net) and dropped one frame + // some time or other. If we are more than 900mSec early, then wait. + if (trLate<-9000000) { + bPlayASAP = FALSE; + } + + if (bPlayASAP) { + + m_nNormal = 0; + MSR_INTEGER(m_idDecision, 0); + // When we are here, we are in slow-machine mode. trLate may well + // oscillate between negative and positive when the supplier is + // dropping frames to keep sync. We should not let that mislead + // us into thinking that we have as much as zero spare time! + // We just update with a zero wait. + m_trWaitAvg = (m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD; + + // Assume that we draw it immediately. Update inter-frame stats + m_trFrameAvg = (trFrame + m_trFrameAvg*(AVGPERIOD-1))/AVGPERIOD; +#ifndef PERF + // If this is NOT a perf build, then report what we know so far + // without looking at the clock any more. This assumes that we + // actually wait for exactly the time we hope to. It also reports + // how close we get to the manipulated time stamps that we now have + // rather than the ones we originally started with. It will + // therefore be a little optimistic. However it's fast. + PreparePerformanceData(trTrueLate, trFrame); +#endif + m_trLastDraw = trRealStream; + if (m_trEarliness > trLate) { + m_trEarliness = trLate; // if we are actually early, this is neg + } + Result = S_OK; // Draw it now + + } else { + ++m_nNormal; + // Set the average frame rate to EXACTLY the ideal rate. + // If we are exiting slow-machine mode then we will have caught up + // and be running ahead, so as we slide back to exact timing we will + // have a longer than usual gap at this point. If we record this + // real gap then we'll think that we're running slow and go back + // into slow-machine mode and vever get it straight. + m_trFrameAvg = trDuration; + MSR_INTEGER(m_idDecision, 1); + + // Play it early by m_trEarliness and by m_trTarget + + { + int trE = m_trEarliness; + if (trE < -m_trFrameAvg) { + trE = -m_trFrameAvg; + } + *ptrStart += trE; // N.B. earliness is negative + } + + int Delay = -trTrueLate; + Result = Delay<=0 ? S_OK : S_FALSE; // OK = draw now, FALSE = wait + + m_trWaitAvg = trWaitAvg; + + // Predict when it will actually be drawn and update frame stats + + if (Result==S_FALSE) { // We are going to wait + trFrame = TimeDiff(*ptrStart-m_trLastDraw); + m_trLastDraw = *ptrStart; + } else { + // trFrame is already = trRealStream-m_trLastDraw; + m_trLastDraw = trRealStream; + } +#ifndef PERF + int iAccuracy; + if (Delay>0) { + // Report lateness based on when we intend to play it + iAccuracy = TimeDiff(*ptrStart-m_trRememberStampForPerf); + } else { + // Report lateness based on playing it *now*. + iAccuracy = trTrueLate; // trRealStream-RememberStampForPerf; + } + PreparePerformanceData(iAccuracy, trFrame); +#endif + } + return Result; + } + + // We are going to drop this frame! + // Of course in DirectDraw mode the guy upstream may draw it anyway. + + // This will probably give a large negative wack to the wait avg. + m_trWaitAvg = trWaitAvg; + +#ifdef PERF + // Respect registry setting - debug only! + if (m_bDrawLateFrames) { + return S_OK; // draw it when it's ready + } // even though it's late. +#endif + + // We are going to drop this frame so draw the next one early + // n.b. if the supplier is doing direct draw then he may draw it anyway + // but he's doing something funny to arrive here in that case. + + MSR_INTEGER(m_idDecision, 2); + m_nNormal = -1; + return E_FAIL; // drop it + +} // ShouldDrawSampleNow + + +// NOTE we're called by both the window thread and the source filter thread +// so we have to be protected by a critical section (locked before called) +// Also, when the window thread gets signalled to render an image, it always +// does so regardless of how late it is. All the degradation is done when we +// are scheduling the next sample to be drawn. Hence when we start an advise +// link to draw a sample, that sample's time will always become the last one +// drawn - unless of course we stop streaming in which case we cancel links + +BOOL CBaseVideoRenderer::ScheduleSample(IMediaSample *pMediaSample) +{ + // We override ShouldDrawSampleNow to add quality management + + BOOL bDrawImage = CBaseRenderer::ScheduleSample(pMediaSample); + if (bDrawImage == FALSE) { + ++m_cFramesDropped; + return FALSE; + } + + // m_cFramesDrawn must NOT be updated here. It has to be updated + // in RecordFrameLateness at the same time as the other statistics. + return TRUE; +} + + +// Implementation of IQualProp interface needed to support the property page +// This is how the property page gets the data out of the scheduler. We are +// passed into the constructor the owning object in the COM sense, this will +// either be the video renderer or an external IUnknown if we're aggregated. +// We initialise our CUnknown base class with this interface pointer. Then +// all we have to do is to override NonDelegatingQueryInterface to expose +// our IQualProp interface. The AddRef and Release are handled automatically +// by the base class and will be passed on to the appropriate outer object + +STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(int *pcFramesDropped) +{ + CheckPointer(pcFramesDropped,E_POINTER); + CAutoLock cVideoLock(&m_InterfaceLock); + *pcFramesDropped = m_cFramesDropped; + return NOERROR; +} // get_FramesDroppedInRenderer + + +// Set *pcFramesDrawn to the number of frames drawn since +// streaming started. + +STDMETHODIMP CBaseVideoRenderer::get_FramesDrawn( int *pcFramesDrawn) +{ + CheckPointer(pcFramesDrawn,E_POINTER); + CAutoLock cVideoLock(&m_InterfaceLock); + *pcFramesDrawn = m_cFramesDrawn; + return NOERROR; +} // get_FramesDrawn + + +// Set iAvgFrameRate to the frames per hundred secs since +// streaming started. 0 otherwise. + +STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate( int *piAvgFrameRate) +{ + CheckPointer(piAvgFrameRate,E_POINTER); + CAutoLock cVideoLock(&m_InterfaceLock); + + int t; + if (m_bStreaming) { + t = timeGetTime()-m_tStreamingStart; + } else { + t = m_tStreamingStart; + } + + if (t<=0) { + *piAvgFrameRate = 0; + ASSERT(m_cFramesDrawn == 0); + } else { + // i is frames per hundred seconds + *piAvgFrameRate = MulDiv(100000, m_cFramesDrawn, t); + } + return NOERROR; +} // get_AvgFrameRate + + +// Set *piAvg to the average sync offset since streaming started +// in mSec. The sync offset is the time in mSec between when the frame +// should have been drawn and when the frame was actually drawn. + +STDMETHODIMP CBaseVideoRenderer::get_AvgSyncOffset( int *piAvg) +{ + CheckPointer(piAvg,E_POINTER); + CAutoLock cVideoLock(&m_InterfaceLock); + + if (NULL==m_pClock) { + *piAvg = 0; + return NOERROR; + } + + // Note that we didn't gather the stats on the first frame + // so we use m_cFramesDrawn-1 here + if (m_cFramesDrawn<=1) { + *piAvg = 0; + } else { + *piAvg = (int)(m_iTotAcc / (m_cFramesDrawn-1)); + } + return NOERROR; +} // get_AvgSyncOffset + + +// To avoid dragging in the maths library - a cheap +// approximate integer square root. +// We do this by getting a starting guess which is between 1 +// and 2 times too large, followed by THREE iterations of +// Newton Raphson. (That will give accuracy to the nearest mSec +// for the range in question - roughly 0..1000) +// +// It would be faster to use a linear interpolation and ONE NR, but +// who cares. If anyone does - the best linear interpolation is +// to approximates sqrt(x) by +// y = x * (sqrt(2)-1) + 1 - 1/sqrt(2) + 1/(8*(sqrt(2)-1)) +// 0r y = x*0.41421 + 0.59467 +// This minimises the maximal error in the range in question. +// (error is about +0.008883 and then one NR will give error .0000something +// (Of course these are integers, so you can't just multiply by 0.41421 +// you'd have to do some sort of MulDiv). +// Anyone wanna check my maths? (This is only for a property display!) + +int isqrt(int x) +{ + int s = 1; + // Make s an initial guess for sqrt(x) + if (x > 0x40000000) { + s = 0x8000; // prevent any conceivable closed loop + } else { + while (s*s=0) s = (s*s+x)/(2*s); + if (s>=0) s = (s*s+x)/(2*s); + } + } + return s; +} + +// +// Do estimates for standard deviations for per-frame +// statistics +// +HRESULT CBaseVideoRenderer::GetStdDev( + int nSamples, + int *piResult, + LONGLONG llSumSq, + LONGLONG iTot +) +{ + CheckPointer(piResult,E_POINTER); + CAutoLock cVideoLock(&m_InterfaceLock); + + if (NULL==m_pClock) { + *piResult = 0; + return NOERROR; + } + + // If S is the Sum of the Squares of observations and + // T the Total (i.e. sum) of the observations and there were + // N observations, then an estimate of the standard deviation is + // sqrt( (S - T**2/N) / (N-1) ) + + if (nSamples<=1) { + *piResult = 0; + } else { + LONGLONG x; + // First frames have invalid stamps, so we get no stats for them + // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 + + // so we use m_cFramesDrawn-1 here + x = llSumSq - llMulDiv(iTot, iTot, nSamples, 0); + x = x / (nSamples-1); + ASSERT(x>=0); + *piResult = isqrt((LONG)x); + } + return NOERROR; +} + +// Set *piDev to the standard deviation in mSec of the sync offset +// of each frame since streaming started. + +STDMETHODIMP CBaseVideoRenderer::get_DevSyncOffset( int *piDev) +{ + // First frames have invalid stamps, so we get no stats for them + // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 + return GetStdDev(m_cFramesDrawn - 1, + piDev, + m_iSumSqAcc, + m_iTotAcc); +} // get_DevSyncOffset + + +// Set *piJitter to the standard deviation in mSec of the inter-frame time +// of frames since streaming started. + +STDMETHODIMP CBaseVideoRenderer::get_Jitter( int *piJitter) +{ + // First frames have invalid stamps, so we get no stats for them + // So second frame gives invalid inter-frame time + // So we need 3 frames to get 1 datum, so N is cFramesDrawn-2 + return GetStdDev(m_cFramesDrawn - 2, + piJitter, + m_iSumSqFrameTime, + m_iSumFrameTime); +} // get_Jitter + + +// Overidden to return our IQualProp interface + +STDMETHODIMP +CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,VOID **ppv) +{ + // We return IQualProp and delegate everything else + + if (riid == IID_IQualProp) { + return GetInterface( (IQualProp *)this, ppv); + } else if (riid == IID_IQualityControl) { + return GetInterface( (IQualityControl *)this, ppv); + } + return CBaseRenderer::NonDelegatingQueryInterface(riid,ppv); +} + + +// Override JoinFilterGraph so that, just before leaving +// the graph we can send an EC_WINDOW_DESTROYED event + +STDMETHODIMP +CBaseVideoRenderer::JoinFilterGraph(IFilterGraph *pGraph,LPCWSTR pName) +{ + // Since we send EC_ACTIVATE, we also need to ensure + // we send EC_WINDOW_DESTROYED or the resource manager may be + // holding us as a focus object + if (!pGraph && m_pGraph) { + + // We were in a graph and now we're not + // Do this properly in case we are aggregated + IBaseFilter* pFilter; + QueryInterface(IID_IBaseFilter,(void **) &pFilter); + NotifyEvent(EC_WINDOW_DESTROYED, (LPARAM) pFilter, 0); + pFilter->Release(); + } + return CBaseFilter::JoinFilterGraph(pGraph, pName); +} + + +// This removes a large number of level 4 warnings from the +// Microsoft compiler which in this case are not very useful +#pragma warning(disable: 4514) + diff --git a/src/BaseClasses/renbase.h b/src/BaseClasses/renbase.h index 8ec192b92c..5a6eb3e2da 100644 --- a/src/BaseClasses/renbase.h +++ b/src/BaseClasses/renbase.h @@ -1,479 +1,479 @@ -//------------------------------------------------------------------------------ -// File: RenBase.h -// -// Desc: DirectShow base classes - defines a generic ActiveX base renderer -// class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __RENBASE__ -#define __RENBASE__ - -// Forward class declarations - -class CBaseRenderer; -class CBaseVideoRenderer; -class CRendererInputPin; - -// This is our input pin class that channels calls to the renderer - -class CRendererInputPin : public CBaseInputPin -{ -protected: - - CBaseRenderer *m_pRenderer; - -public: - - CRendererInputPin(CBaseRenderer *pRenderer, - HRESULT *phr, - LPCWSTR Name); - - // Overriden from the base pin classes - - HRESULT BreakConnect(); - HRESULT CompleteConnect(IPin *pReceivePin); - HRESULT SetMediaType(const CMediaType *pmt); - HRESULT CheckMediaType(const CMediaType *pmt); - HRESULT Active(); - HRESULT Inactive(); - - // Add rendering behaviour to interface functions - - STDMETHODIMP QueryId(LPWSTR *Id); - STDMETHODIMP EndOfStream(); - STDMETHODIMP BeginFlush(); - STDMETHODIMP EndFlush(); - STDMETHODIMP Receive(IMediaSample *pMediaSample); - - // Helper - IMemAllocator inline *Allocator() const - { - return m_pAllocator; - } -}; - -// Main renderer class that handles synchronisation and state changes - -class CBaseRenderer : public CBaseFilter -{ -protected: - - friend class CRendererInputPin; - - friend void CALLBACK EndOfStreamTimer(UINT uID, // Timer identifier - UINT uMsg, // Not currently used - DWORD_PTR dwUser, // User information - DWORD_PTR dw1, // Windows reserved - DWORD_PTR dw2); // Is also reserved - - CRendererPosPassThru *m_pPosition; // Media seeking pass by object - CAMEvent m_RenderEvent; // Used to signal timer events - CAMEvent m_ThreadSignal; // Signalled to release worker thread - CAMEvent m_evComplete; // Signalled when state complete - BOOL m_bAbort; // Stop us from rendering more data - BOOL m_bStreaming; // Are we currently streaming - DWORD_PTR m_dwAdvise; // Timer advise cookie - IMediaSample *m_pMediaSample; // Current image media sample - BOOL m_bEOS; // Any more samples in the stream - BOOL m_bEOSDelivered; // Have we delivered an EC_COMPLETE - CRendererInputPin *m_pInputPin; // Our renderer input pin object - CCritSec m_InterfaceLock; // Critical section for interfaces - CCritSec m_RendererLock; // Controls access to internals - IQualityControl * m_pQSink; // QualityControl sink - BOOL m_bRepaintStatus; // Can we signal an EC_REPAINT - - // Avoid some deadlocks by tracking filter during stop - volatile BOOL m_bInReceive; // Inside Receive between PrepareReceive - // And actually processing the sample - REFERENCE_TIME m_SignalTime; // Time when we signal EC_COMPLETE - UINT m_EndOfStreamTimer; // Used to signal end of stream - CCritSec m_ObjectCreationLock; // This lock protects the creation and - // of m_pPosition and m_pInputPin. It - // ensures that two threads cannot create - // either object simultaneously. - -public: - - CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer - TCHAR *pName, // Debug ONLY description - LPUNKNOWN pUnk, // Aggregated owner object - HRESULT *phr); // General OLE return code - - ~CBaseRenderer(); - - // Overriden to say what interfaces we support and where - - virtual HRESULT GetMediaPositionInterface(REFIID riid,void **ppv); - STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **); - - virtual HRESULT SourceThreadCanWait(BOOL bCanWait); - -#ifdef DEBUG - // Debug only dump of the renderer state - void DisplayRendererState(); -#endif - virtual HRESULT WaitForRenderTime(); - virtual HRESULT CompleteStateChange(FILTER_STATE OldState); - - // Return internal information about this filter - - BOOL IsEndOfStream() { return m_bEOS; }; - BOOL IsEndOfStreamDelivered() { return m_bEOSDelivered; }; - BOOL IsStreaming() { return m_bStreaming; }; - void SetAbortSignal(BOOL bAbort) { m_bAbort = bAbort; }; - virtual void OnReceiveFirstSample(IMediaSample *pMediaSample) { }; - CAMEvent *GetRenderEvent() { return &m_RenderEvent; }; - - // Permit access to the transition state - - void Ready() { m_evComplete.Set(); }; - void NotReady() { m_evComplete.Reset(); }; - BOOL CheckReady() { return m_evComplete.Check(); }; - - virtual int GetPinCount(); - virtual CBasePin *GetPin(int n); - FILTER_STATE GetRealState(); - void SendRepaint(); - void SendNotifyWindow(IPin *pPin,HWND hwnd); - BOOL OnDisplayChange(); - void SetRepaintStatus(BOOL bRepaint); - - // Override the filter and pin interface functions - - STDMETHODIMP Stop(); - STDMETHODIMP Pause(); - STDMETHODIMP Run(REFERENCE_TIME StartTime); - STDMETHODIMP GetState(DWORD dwMSecs,FILTER_STATE *State); - STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin); - - // These are available for a quality management implementation - - virtual void OnRenderStart(IMediaSample *pMediaSample); - virtual void OnRenderEnd(IMediaSample *pMediaSample); - virtual HRESULT OnStartStreaming() { return NOERROR; }; - virtual HRESULT OnStopStreaming() { return NOERROR; }; - virtual void OnWaitStart() { }; - virtual void OnWaitEnd() { }; - virtual void PrepareRender() { }; - -#ifdef PERF - REFERENCE_TIME m_trRenderStart; // Just before we started drawing - // Set in OnRenderStart, Used in OnRenderEnd - int m_idBaseStamp; // MSR_id for frame time stamp - int m_idBaseRenderTime; // MSR_id for true wait time - int m_idBaseAccuracy; // MSR_id for time frame is late (int) -#endif - - // Quality management implementation for scheduling rendering - - virtual BOOL ScheduleSample(IMediaSample *pMediaSample); - virtual HRESULT GetSampleTimes(IMediaSample *pMediaSample, - REFERENCE_TIME *pStartTime, - REFERENCE_TIME *pEndTime); - - virtual HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample, - REFERENCE_TIME *ptrStart, - REFERENCE_TIME *ptrEnd); - - // Lots of end of stream complexities - - void TimerCallback(); - void ResetEndOfStreamTimer(); - HRESULT NotifyEndOfStream(); - virtual HRESULT SendEndOfStream(); - virtual HRESULT ResetEndOfStream(); - virtual HRESULT EndOfStream(); - - // Rendering is based around the clock - - void SignalTimerFired(); - virtual HRESULT CancelNotification(); - virtual HRESULT ClearPendingSample(); - - // Called when the filter changes state - - virtual HRESULT Active(); - virtual HRESULT Inactive(); - virtual HRESULT StartStreaming(); - virtual HRESULT StopStreaming(); - virtual HRESULT BeginFlush(); - virtual HRESULT EndFlush(); - - // Deal with connections and type changes - - virtual HRESULT BreakConnect(); - virtual HRESULT SetMediaType(const CMediaType *pmt); - virtual HRESULT CompleteConnect(IPin *pReceivePin); - - // These look after the handling of data samples - - virtual HRESULT PrepareReceive(IMediaSample *pMediaSample); - virtual HRESULT Receive(IMediaSample *pMediaSample); - virtual BOOL HaveCurrentSample(); - virtual IMediaSample *GetCurrentSample(); - virtual HRESULT Render(IMediaSample *pMediaSample); - - // Derived classes MUST override these - virtual HRESULT DoRenderSample(IMediaSample *pMediaSample) PURE; - virtual HRESULT CheckMediaType(const CMediaType *) PURE; - - // Helper - void WaitForReceiveToComplete(); -}; - - -// CBaseVideoRenderer is a renderer class (see its ancestor class) and -// it handles scheduling of media samples so that they are drawn at the -// correct time by the reference clock. It implements a degradation -// strategy. Possible degradation modes are: -// Drop frames here (only useful if the drawing takes significant time) -// Signal supplier (upstream) to drop some frame(s) - i.e. one-off skip. -// Signal supplier to change the frame rate - i.e. ongoing skipping. -// Or any combination of the above. -// In order to determine what's useful to try we need to know what's going -// on. This is done by timing various operations (including the supplier). -// This timing is done by using timeGetTime as it is accurate enough and -// usually cheaper than calling the reference clock. It also tells the -// truth if there is an audio break and the reference clock stops. -// We provide a number of public entry points (named OnXxxStart, OnXxxEnd) -// which the rest of the renderer calls at significant moments. These do -// the timing. - -// the number of frames that the sliding averages are averaged over. -// the rule is (1024*NewObservation + (AVGPERIOD-1) * PreviousAverage)/AVGPERIOD -#define AVGPERIOD 4 -#define DO_MOVING_AVG(avg,obs) (avg = (1024*obs + (AVGPERIOD-1)*avg)/AVGPERIOD) -// Spot the bug in this macro - I can't. but it doesn't work! - -class CBaseVideoRenderer : public CBaseRenderer, // Base renderer class - public IQualProp, // Property page guff - public IQualityControl // Allow throttling -{ -protected: - - // Hungarian: - // tFoo is the time Foo in mSec (beware m_tStart from filter.h) - // trBar is the time Bar by the reference clock - - //****************************************************************** - // State variables to control synchronisation - //****************************************************************** - - // Control of sending Quality messages. We need to know whether - // we are in trouble (e.g. frames being dropped) and where the time - // is being spent. - - // When we drop a frame we play the next one early. - // The frame after that is likely to wait before drawing and counting this - // wait as spare time is unfair, so we count it as a zero wait. - // We therefore need to know whether we are playing frames early or not. - - int m_nNormal; // The number of consecutive frames - // drawn at their normal time (not early) - // -1 means we just dropped a frame. - -#ifdef PERF - BOOL m_bDrawLateFrames; // Don't drop any frames (debug and I'm - // not keen on people using it!) -#endif - - BOOL m_bSupplierHandlingQuality;// The response to Quality messages says - // our supplier is handling things. - // We will allow things to go extra late - // before dropping frames. We will play - // very early after he has dropped one. - - // Control of scheduling, frame dropping etc. - // We need to know where the time is being spent so as to tell whether - // we should be taking action here, signalling supplier or what. - // The variables are initialised to a mode of NOT dropping frames. - // They will tell the truth after a few frames. - // We typically record a start time for an event, later we get the time - // again and subtract to get the elapsed time, and we average this over - // a few frames. The average is used to tell what mode we are in. - - // Although these are reference times (64 bit) they are all DIFFERENCES - // between times which are small. An int will go up to 214 secs before - // overflow. Avoiding 64 bit multiplications and divisions seems - // worth while. - - - - // Audio-video throttling. If the user has turned up audio quality - // very high (in principle it could be any other stream, not just audio) - // then we can receive cries for help via the graph manager. In this case - // we put in a wait for some time after rendering each frame. - int m_trThrottle; - - // The time taken to render (i.e. BitBlt) frames controls which component - // needs to degrade. If the blt is expensive, the renderer degrades. - // If the blt is cheap it's done anyway and the supplier degrades. - int m_trRenderAvg; // Time frames are taking to blt - int m_trRenderLast; // Time for last frame blt - int m_tRenderStart; // Just before we started drawing (mSec) - // derived from timeGetTime. - - // When frames are dropped we will play the next frame as early as we can. - // If it was a false alarm and the machine is fast we slide gently back to - // normal timing. To do this, we record the offset showing just how early - // we really are. This will normally be negative meaning early or zero. - int m_trEarliness; - - // Target provides slow long-term feedback to try to reduce the - // average sync offset to zero. Whenever a frame is actually rendered - // early we add a msec or two, whenever late we take off a few. - // We add or take off 1/32 of the error time. - // Eventually we should be hovering around zero. For a really bad case - // where we were (say) 300mSec off, it might take 100 odd frames to - // settle down. The rate of change of this is intended to be slower - // than any other mechanism in Quartz, thereby avoiding hunting. - int m_trTarget; - - // The proportion of time spent waiting for the right moment to blt - // controls whether we bother to drop a frame or whether we reckon that - // we're doing well enough that we can stand a one-frame glitch. - int m_trWaitAvg; // Average of last few wait times - // (actually we just average how early - // we were). Negative here means LATE. - - // The average inter-frame time. - // This is used to calculate the proportion of the time used by the - // three operations (supplying us, waiting, rendering) - int m_trFrameAvg; // Average inter-frame time - int m_trDuration; // duration of last frame. - -#ifdef PERF - // Performance logging identifiers - int m_idTimeStamp; // MSR_id for frame time stamp - int m_idEarliness; // MSR_id for earliness fudge - int m_idTarget; // MSR_id for Target fudge - int m_idWaitReal; // MSR_id for true wait time - int m_idWait; // MSR_id for wait time recorded - int m_idFrameAccuracy; // MSR_id for time frame is late (int) - int m_idRenderAvg; // MSR_id for Render time recorded (int) - int m_idSchLateTime; // MSR_id for lateness at scheduler - int m_idQualityRate; // MSR_id for Quality rate requested - int m_idQualityTime; // MSR_id for Quality time requested - int m_idDecision; // MSR_id for decision code - int m_idDuration; // MSR_id for duration of a frame - int m_idThrottle; // MSR_id for audio-video throttling - //int m_idDebug; // MSR_id for trace style debugging - //int m_idSendQuality; // MSR_id for timing the notifications per se -#endif // PERF - REFERENCE_TIME m_trRememberStampForPerf; // original time stamp of frame - // with no earliness fudges etc. -#ifdef PERF - REFERENCE_TIME m_trRememberFrameForPerf; // time when previous frame rendered - - // debug... - int m_idFrameAvg; - int m_idWaitAvg; -#endif - - // PROPERTY PAGE - // This has edit fields that show the user what's happening - // These member variables hold these counts. - - int m_cFramesDropped; // cumulative frames dropped IN THE RENDERER - int m_cFramesDrawn; // Frames since streaming started seen BY THE - // RENDERER (some may be dropped upstream) - - // Next two support average sync offset and standard deviation of sync offset. - LONGLONG m_iTotAcc; // Sum of accuracies in mSec - LONGLONG m_iSumSqAcc; // Sum of squares of (accuracies in mSec) - - // Next two allow jitter calculation. Jitter is std deviation of frame time. - REFERENCE_TIME m_trLastDraw; // Time of prev frame (for inter-frame times) - LONGLONG m_iSumSqFrameTime; // Sum of squares of (inter-frame time in mSec) - LONGLONG m_iSumFrameTime; // Sum of inter-frame times in mSec - - // To get performance statistics on frame rate, jitter etc, we need - // to record the lateness and inter-frame time. What we actually need are the - // data above (sum, sum of squares and number of entries for each) but the data - // is generated just ahead of time and only later do we discover whether the - // frame was actually drawn or not. So we have to hang on to the data - int m_trLate; // hold onto frame lateness - int m_trFrame; // hold onto inter-frame time - - int m_tStreamingStart; // if streaming then time streaming started - // else time of last streaming session - // used for property page statistics -#ifdef PERF - LONGLONG m_llTimeOffset; // timeGetTime()*10000+m_llTimeOffset==ref time -#endif - -public: - - - CBaseVideoRenderer(REFCLSID RenderClass, // CLSID for this renderer - TCHAR *pName, // Debug ONLY description - LPUNKNOWN pUnk, // Aggregated owner object - HRESULT *phr); // General OLE return code - - ~CBaseVideoRenderer(); - - // IQualityControl methods - Notify allows audio-video throttling - - STDMETHODIMP SetSink( IQualityControl * piqc); - STDMETHODIMP Notify( IBaseFilter * pSelf, Quality q); - - // These provide a full video quality management implementation - - void OnRenderStart(IMediaSample *pMediaSample); - void OnRenderEnd(IMediaSample *pMediaSample); - void OnWaitStart(); - void OnWaitEnd(); - HRESULT OnStartStreaming(); - HRESULT OnStopStreaming(); - void ThrottleWait(); - - // Handle the statistics gathering for our quality management - - void PreparePerformanceData(int trLate, int trFrame); - virtual void RecordFrameLateness(int trLate, int trFrame); - virtual void OnDirectRender(IMediaSample *pMediaSample); - virtual HRESULT ResetStreamingTimes(); - BOOL ScheduleSample(IMediaSample *pMediaSample); - HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample, - REFERENCE_TIME *ptrStart, - REFERENCE_TIME *ptrEnd); - - virtual HRESULT SendQuality(REFERENCE_TIME trLate, REFERENCE_TIME trRealStream); - STDMETHODIMP JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName); - - // - // Do estimates for standard deviations for per-frame - // statistics - // - // *piResult = (llSumSq - iTot * iTot / m_cFramesDrawn - 1) / - // (m_cFramesDrawn - 2) - // or 0 if m_cFramesDrawn <= 3 - // - HRESULT GetStdDev( - int nSamples, - int *piResult, - LONGLONG llSumSq, - LONGLONG iTot - ); -public: - - // IQualProp property page support - - STDMETHODIMP get_FramesDroppedInRenderer(int *cFramesDropped); - STDMETHODIMP get_FramesDrawn(int *pcFramesDrawn); - STDMETHODIMP get_AvgFrameRate(int *piAvgFrameRate); - STDMETHODIMP get_Jitter(int *piJitter); - STDMETHODIMP get_AvgSyncOffset(int *piAvg); - STDMETHODIMP get_DevSyncOffset(int *piDev); - - // Implement an IUnknown interface and expose IQualProp - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,VOID **ppv); -}; - -#endif // __RENBASE__ - +//------------------------------------------------------------------------------ +// File: RenBase.h +// +// Desc: DirectShow base classes - defines a generic ActiveX base renderer +// class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __RENBASE__ +#define __RENBASE__ + +// Forward class declarations + +class CBaseRenderer; +class CBaseVideoRenderer; +class CRendererInputPin; + +// This is our input pin class that channels calls to the renderer + +class CRendererInputPin : public CBaseInputPin +{ +protected: + + CBaseRenderer *m_pRenderer; + +public: + + CRendererInputPin(CBaseRenderer *pRenderer, + HRESULT *phr, + LPCWSTR Name); + + // Overriden from the base pin classes + + HRESULT BreakConnect(); + HRESULT CompleteConnect(IPin *pReceivePin); + HRESULT SetMediaType(const CMediaType *pmt); + HRESULT CheckMediaType(const CMediaType *pmt); + HRESULT Active(); + HRESULT Inactive(); + + // Add rendering behaviour to interface functions + + STDMETHODIMP QueryId(LPWSTR *Id); + STDMETHODIMP EndOfStream(); + STDMETHODIMP BeginFlush(); + STDMETHODIMP EndFlush(); + STDMETHODIMP Receive(IMediaSample *pMediaSample); + + // Helper + IMemAllocator inline *Allocator() const + { + return m_pAllocator; + } +}; + +// Main renderer class that handles synchronisation and state changes + +class CBaseRenderer : public CBaseFilter +{ +protected: + + friend class CRendererInputPin; + + friend void CALLBACK EndOfStreamTimer(UINT uID, // Timer identifier + UINT uMsg, // Not currently used + DWORD_PTR dwUser, // User information + DWORD_PTR dw1, // Windows reserved + DWORD_PTR dw2); // Is also reserved + + CRendererPosPassThru *m_pPosition; // Media seeking pass by object + CAMEvent m_RenderEvent; // Used to signal timer events + CAMEvent m_ThreadSignal; // Signalled to release worker thread + CAMEvent m_evComplete; // Signalled when state complete + BOOL m_bAbort; // Stop us from rendering more data + BOOL m_bStreaming; // Are we currently streaming + DWORD_PTR m_dwAdvise; // Timer advise cookie + IMediaSample *m_pMediaSample; // Current image media sample + BOOL m_bEOS; // Any more samples in the stream + BOOL m_bEOSDelivered; // Have we delivered an EC_COMPLETE + CRendererInputPin *m_pInputPin; // Our renderer input pin object + CCritSec m_InterfaceLock; // Critical section for interfaces + CCritSec m_RendererLock; // Controls access to internals + IQualityControl * m_pQSink; // QualityControl sink + BOOL m_bRepaintStatus; // Can we signal an EC_REPAINT + + // Avoid some deadlocks by tracking filter during stop + volatile BOOL m_bInReceive; // Inside Receive between PrepareReceive + // And actually processing the sample + REFERENCE_TIME m_SignalTime; // Time when we signal EC_COMPLETE + UINT m_EndOfStreamTimer; // Used to signal end of stream + CCritSec m_ObjectCreationLock; // This lock protects the creation and + // of m_pPosition and m_pInputPin. It + // ensures that two threads cannot create + // either object simultaneously. + +public: + + CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer + TCHAR *pName, // Debug ONLY description + LPUNKNOWN pUnk, // Aggregated owner object + HRESULT *phr); // General OLE return code + + ~CBaseRenderer(); + + // Overriden to say what interfaces we support and where + + virtual HRESULT GetMediaPositionInterface(REFIID riid,void **ppv); + STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **); + + virtual HRESULT SourceThreadCanWait(BOOL bCanWait); + +#ifdef DEBUG + // Debug only dump of the renderer state + void DisplayRendererState(); +#endif + virtual HRESULT WaitForRenderTime(); + virtual HRESULT CompleteStateChange(FILTER_STATE OldState); + + // Return internal information about this filter + + BOOL IsEndOfStream() { return m_bEOS; }; + BOOL IsEndOfStreamDelivered() { return m_bEOSDelivered; }; + BOOL IsStreaming() { return m_bStreaming; }; + void SetAbortSignal(BOOL bAbort) { m_bAbort = bAbort; }; + virtual void OnReceiveFirstSample(IMediaSample *pMediaSample) { }; + CAMEvent *GetRenderEvent() { return &m_RenderEvent; }; + + // Permit access to the transition state + + void Ready() { m_evComplete.Set(); }; + void NotReady() { m_evComplete.Reset(); }; + BOOL CheckReady() { return m_evComplete.Check(); }; + + virtual int GetPinCount(); + virtual CBasePin *GetPin(int n); + FILTER_STATE GetRealState(); + void SendRepaint(); + void SendNotifyWindow(IPin *pPin,HWND hwnd); + BOOL OnDisplayChange(); + void SetRepaintStatus(BOOL bRepaint); + + // Override the filter and pin interface functions + + STDMETHODIMP Stop(); + STDMETHODIMP Pause(); + STDMETHODIMP Run(REFERENCE_TIME StartTime); + STDMETHODIMP GetState(DWORD dwMSecs,FILTER_STATE *State); + STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin); + + // These are available for a quality management implementation + + virtual void OnRenderStart(IMediaSample *pMediaSample); + virtual void OnRenderEnd(IMediaSample *pMediaSample); + virtual HRESULT OnStartStreaming() { return NOERROR; }; + virtual HRESULT OnStopStreaming() { return NOERROR; }; + virtual void OnWaitStart() { }; + virtual void OnWaitEnd() { }; + virtual void PrepareRender() { }; + +#ifdef PERF + REFERENCE_TIME m_trRenderStart; // Just before we started drawing + // Set in OnRenderStart, Used in OnRenderEnd + int m_idBaseStamp; // MSR_id for frame time stamp + int m_idBaseRenderTime; // MSR_id for true wait time + int m_idBaseAccuracy; // MSR_id for time frame is late (int) +#endif + + // Quality management implementation for scheduling rendering + + virtual BOOL ScheduleSample(IMediaSample *pMediaSample); + virtual HRESULT GetSampleTimes(IMediaSample *pMediaSample, + REFERENCE_TIME *pStartTime, + REFERENCE_TIME *pEndTime); + + virtual HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample, + REFERENCE_TIME *ptrStart, + REFERENCE_TIME *ptrEnd); + + // Lots of end of stream complexities + + void TimerCallback(); + void ResetEndOfStreamTimer(); + HRESULT NotifyEndOfStream(); + virtual HRESULT SendEndOfStream(); + virtual HRESULT ResetEndOfStream(); + virtual HRESULT EndOfStream(); + + // Rendering is based around the clock + + void SignalTimerFired(); + virtual HRESULT CancelNotification(); + virtual HRESULT ClearPendingSample(); + + // Called when the filter changes state + + virtual HRESULT Active(); + virtual HRESULT Inactive(); + virtual HRESULT StartStreaming(); + virtual HRESULT StopStreaming(); + virtual HRESULT BeginFlush(); + virtual HRESULT EndFlush(); + + // Deal with connections and type changes + + virtual HRESULT BreakConnect(); + virtual HRESULT SetMediaType(const CMediaType *pmt); + virtual HRESULT CompleteConnect(IPin *pReceivePin); + + // These look after the handling of data samples + + virtual HRESULT PrepareReceive(IMediaSample *pMediaSample); + virtual HRESULT Receive(IMediaSample *pMediaSample); + virtual BOOL HaveCurrentSample(); + virtual IMediaSample *GetCurrentSample(); + virtual HRESULT Render(IMediaSample *pMediaSample); + + // Derived classes MUST override these + virtual HRESULT DoRenderSample(IMediaSample *pMediaSample) PURE; + virtual HRESULT CheckMediaType(const CMediaType *) PURE; + + // Helper + void WaitForReceiveToComplete(); +}; + + +// CBaseVideoRenderer is a renderer class (see its ancestor class) and +// it handles scheduling of media samples so that they are drawn at the +// correct time by the reference clock. It implements a degradation +// strategy. Possible degradation modes are: +// Drop frames here (only useful if the drawing takes significant time) +// Signal supplier (upstream) to drop some frame(s) - i.e. one-off skip. +// Signal supplier to change the frame rate - i.e. ongoing skipping. +// Or any combination of the above. +// In order to determine what's useful to try we need to know what's going +// on. This is done by timing various operations (including the supplier). +// This timing is done by using timeGetTime as it is accurate enough and +// usually cheaper than calling the reference clock. It also tells the +// truth if there is an audio break and the reference clock stops. +// We provide a number of public entry points (named OnXxxStart, OnXxxEnd) +// which the rest of the renderer calls at significant moments. These do +// the timing. + +// the number of frames that the sliding averages are averaged over. +// the rule is (1024*NewObservation + (AVGPERIOD-1) * PreviousAverage)/AVGPERIOD +#define AVGPERIOD 4 +#define DO_MOVING_AVG(avg,obs) (avg = (1024*obs + (AVGPERIOD-1)*avg)/AVGPERIOD) +// Spot the bug in this macro - I can't. but it doesn't work! + +class CBaseVideoRenderer : public CBaseRenderer, // Base renderer class + public IQualProp, // Property page guff + public IQualityControl // Allow throttling +{ +protected: + + // Hungarian: + // tFoo is the time Foo in mSec (beware m_tStart from filter.h) + // trBar is the time Bar by the reference clock + + //****************************************************************** + // State variables to control synchronisation + //****************************************************************** + + // Control of sending Quality messages. We need to know whether + // we are in trouble (e.g. frames being dropped) and where the time + // is being spent. + + // When we drop a frame we play the next one early. + // The frame after that is likely to wait before drawing and counting this + // wait as spare time is unfair, so we count it as a zero wait. + // We therefore need to know whether we are playing frames early or not. + + int m_nNormal; // The number of consecutive frames + // drawn at their normal time (not early) + // -1 means we just dropped a frame. + +#ifdef PERF + BOOL m_bDrawLateFrames; // Don't drop any frames (debug and I'm + // not keen on people using it!) +#endif + + BOOL m_bSupplierHandlingQuality;// The response to Quality messages says + // our supplier is handling things. + // We will allow things to go extra late + // before dropping frames. We will play + // very early after he has dropped one. + + // Control of scheduling, frame dropping etc. + // We need to know where the time is being spent so as to tell whether + // we should be taking action here, signalling supplier or what. + // The variables are initialised to a mode of NOT dropping frames. + // They will tell the truth after a few frames. + // We typically record a start time for an event, later we get the time + // again and subtract to get the elapsed time, and we average this over + // a few frames. The average is used to tell what mode we are in. + + // Although these are reference times (64 bit) they are all DIFFERENCES + // between times which are small. An int will go up to 214 secs before + // overflow. Avoiding 64 bit multiplications and divisions seems + // worth while. + + + + // Audio-video throttling. If the user has turned up audio quality + // very high (in principle it could be any other stream, not just audio) + // then we can receive cries for help via the graph manager. In this case + // we put in a wait for some time after rendering each frame. + int m_trThrottle; + + // The time taken to render (i.e. BitBlt) frames controls which component + // needs to degrade. If the blt is expensive, the renderer degrades. + // If the blt is cheap it's done anyway and the supplier degrades. + int m_trRenderAvg; // Time frames are taking to blt + int m_trRenderLast; // Time for last frame blt + int m_tRenderStart; // Just before we started drawing (mSec) + // derived from timeGetTime. + + // When frames are dropped we will play the next frame as early as we can. + // If it was a false alarm and the machine is fast we slide gently back to + // normal timing. To do this, we record the offset showing just how early + // we really are. This will normally be negative meaning early or zero. + int m_trEarliness; + + // Target provides slow long-term feedback to try to reduce the + // average sync offset to zero. Whenever a frame is actually rendered + // early we add a msec or two, whenever late we take off a few. + // We add or take off 1/32 of the error time. + // Eventually we should be hovering around zero. For a really bad case + // where we were (say) 300mSec off, it might take 100 odd frames to + // settle down. The rate of change of this is intended to be slower + // than any other mechanism in Quartz, thereby avoiding hunting. + int m_trTarget; + + // The proportion of time spent waiting for the right moment to blt + // controls whether we bother to drop a frame or whether we reckon that + // we're doing well enough that we can stand a one-frame glitch. + int m_trWaitAvg; // Average of last few wait times + // (actually we just average how early + // we were). Negative here means LATE. + + // The average inter-frame time. + // This is used to calculate the proportion of the time used by the + // three operations (supplying us, waiting, rendering) + int m_trFrameAvg; // Average inter-frame time + int m_trDuration; // duration of last frame. + +#ifdef PERF + // Performance logging identifiers + int m_idTimeStamp; // MSR_id for frame time stamp + int m_idEarliness; // MSR_id for earliness fudge + int m_idTarget; // MSR_id for Target fudge + int m_idWaitReal; // MSR_id for true wait time + int m_idWait; // MSR_id for wait time recorded + int m_idFrameAccuracy; // MSR_id for time frame is late (int) + int m_idRenderAvg; // MSR_id for Render time recorded (int) + int m_idSchLateTime; // MSR_id for lateness at scheduler + int m_idQualityRate; // MSR_id for Quality rate requested + int m_idQualityTime; // MSR_id for Quality time requested + int m_idDecision; // MSR_id for decision code + int m_idDuration; // MSR_id for duration of a frame + int m_idThrottle; // MSR_id for audio-video throttling + //int m_idDebug; // MSR_id for trace style debugging + //int m_idSendQuality; // MSR_id for timing the notifications per se +#endif // PERF + REFERENCE_TIME m_trRememberStampForPerf; // original time stamp of frame + // with no earliness fudges etc. +#ifdef PERF + REFERENCE_TIME m_trRememberFrameForPerf; // time when previous frame rendered + + // debug... + int m_idFrameAvg; + int m_idWaitAvg; +#endif + + // PROPERTY PAGE + // This has edit fields that show the user what's happening + // These member variables hold these counts. + + int m_cFramesDropped; // cumulative frames dropped IN THE RENDERER + int m_cFramesDrawn; // Frames since streaming started seen BY THE + // RENDERER (some may be dropped upstream) + + // Next two support average sync offset and standard deviation of sync offset. + LONGLONG m_iTotAcc; // Sum of accuracies in mSec + LONGLONG m_iSumSqAcc; // Sum of squares of (accuracies in mSec) + + // Next two allow jitter calculation. Jitter is std deviation of frame time. + REFERENCE_TIME m_trLastDraw; // Time of prev frame (for inter-frame times) + LONGLONG m_iSumSqFrameTime; // Sum of squares of (inter-frame time in mSec) + LONGLONG m_iSumFrameTime; // Sum of inter-frame times in mSec + + // To get performance statistics on frame rate, jitter etc, we need + // to record the lateness and inter-frame time. What we actually need are the + // data above (sum, sum of squares and number of entries for each) but the data + // is generated just ahead of time and only later do we discover whether the + // frame was actually drawn or not. So we have to hang on to the data + int m_trLate; // hold onto frame lateness + int m_trFrame; // hold onto inter-frame time + + int m_tStreamingStart; // if streaming then time streaming started + // else time of last streaming session + // used for property page statistics +#ifdef PERF + LONGLONG m_llTimeOffset; // timeGetTime()*10000+m_llTimeOffset==ref time +#endif + +public: + + + CBaseVideoRenderer(REFCLSID RenderClass, // CLSID for this renderer + TCHAR *pName, // Debug ONLY description + LPUNKNOWN pUnk, // Aggregated owner object + HRESULT *phr); // General OLE return code + + ~CBaseVideoRenderer(); + + // IQualityControl methods - Notify allows audio-video throttling + + STDMETHODIMP SetSink( IQualityControl * piqc); + STDMETHODIMP Notify( IBaseFilter * pSelf, Quality q); + + // These provide a full video quality management implementation + + void OnRenderStart(IMediaSample *pMediaSample); + void OnRenderEnd(IMediaSample *pMediaSample); + void OnWaitStart(); + void OnWaitEnd(); + HRESULT OnStartStreaming(); + HRESULT OnStopStreaming(); + void ThrottleWait(); + + // Handle the statistics gathering for our quality management + + void PreparePerformanceData(int trLate, int trFrame); + virtual void RecordFrameLateness(int trLate, int trFrame); + virtual void OnDirectRender(IMediaSample *pMediaSample); + virtual HRESULT ResetStreamingTimes(); + BOOL ScheduleSample(IMediaSample *pMediaSample); + HRESULT ShouldDrawSampleNow(IMediaSample *pMediaSample, + REFERENCE_TIME *ptrStart, + REFERENCE_TIME *ptrEnd); + + virtual HRESULT SendQuality(REFERENCE_TIME trLate, REFERENCE_TIME trRealStream); + STDMETHODIMP JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName); + + // + // Do estimates for standard deviations for per-frame + // statistics + // + // *piResult = (llSumSq - iTot * iTot / m_cFramesDrawn - 1) / + // (m_cFramesDrawn - 2) + // or 0 if m_cFramesDrawn <= 3 + // + HRESULT GetStdDev( + int nSamples, + int *piResult, + LONGLONG llSumSq, + LONGLONG iTot + ); +public: + + // IQualProp property page support + + STDMETHODIMP get_FramesDroppedInRenderer(int *cFramesDropped); + STDMETHODIMP get_FramesDrawn(int *pcFramesDrawn); + STDMETHODIMP get_AvgFrameRate(int *piAvgFrameRate); + STDMETHODIMP get_Jitter(int *piJitter); + STDMETHODIMP get_AvgSyncOffset(int *piAvg); + STDMETHODIMP get_DevSyncOffset(int *piDev); + + // Implement an IUnknown interface and expose IQualProp + + DECLARE_IUNKNOWN + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,VOID **ppv); +}; + +#endif // __RENBASE__ + diff --git a/src/BaseClasses/schedule.cpp b/src/BaseClasses/schedule.cpp index 939f52cdae..975fa20321 100644 --- a/src/BaseClasses/schedule.cpp +++ b/src/BaseClasses/schedule.cpp @@ -1,265 +1,265 @@ -//------------------------------------------------------------------------------ -// File: Schedule.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - -#pragma warning(disable:4706) // C4706: assignment within conditional expression - -// DbgLog values (all on LOG_TIMING): -// -// 2 for schedulting, firing and shunting of events -// 3 for wait delays and wake-up times of event thread -// 4 for details of whats on the list when the thread awakes - -/* Construct & destructors */ - -CAMSchedule::CAMSchedule( HANDLE ev ) -: CBaseObject(TEXT("CAMSchedule")) -, head(&z, 0), z(0, MAX_TIME) -, m_dwNextCookie(0), m_dwAdviseCount(0) -, m_pAdviseCache(0), m_dwCacheCount(0) -, m_ev( ev ) { - head.m_dwAdviseCookie = z.m_dwAdviseCookie = 0; -} - -CAMSchedule::~CAMSchedule() { - m_Serialize.Lock(); - - // Delete cache - CAdvisePacket * p = m_pAdviseCache; - while(p) { - CAdvisePacket *const p_next = p->m_next; - delete p; - p = p_next; - } - - ASSERT(m_dwAdviseCount == 0); - // Better to be safe than sorry - if(m_dwAdviseCount > 0) { - DumpLinkedList(); - while(!head.m_next->IsZ()) { - head.DeleteNext(); - --m_dwAdviseCount; - } - } - - // If, in the debug version, we assert twice, it means, not only - // did we have left over advises, but we have also let m_dwAdviseCount - // get out of sync. with the number of advises actually on the list. - ASSERT(m_dwAdviseCount == 0); - - m_Serialize.Unlock(); -} - -/* Public methods */ - -DWORD CAMSchedule::GetAdviseCount() { - // No need to lock, m_dwAdviseCount is 32bits & declared volatile - return m_dwAdviseCount; -} - -REFERENCE_TIME CAMSchedule::GetNextAdviseTime() { - CAutoLock lck(&m_Serialize); // Need to stop the linked list from changing - return head.m_next->m_rtEventTime; -} - -DWORD_PTR CAMSchedule::AddAdvisePacket -( const REFERENCE_TIME & time1 -, const REFERENCE_TIME & time2 -, HANDLE h, BOOL periodic -) { - // Since we use MAX_TIME as a sentry, we can't afford to - // schedule a notification at MAX_TIME - ASSERT(time1 < MAX_TIME); - DWORD_PTR Result; - CAdvisePacket * p; - - m_Serialize.Lock(); - - if(m_pAdviseCache) { - p = m_pAdviseCache; - m_pAdviseCache = p->m_next; - --m_dwCacheCount; - } - else { - p = new CAdvisePacket(); - } - if(p) { - p->m_rtEventTime = time1; p->m_rtPeriod = time2; - p->m_hNotify = h; p->m_bPeriodic = periodic; - Result = AddAdvisePacket(p); - } - else Result = 0; - - m_Serialize.Unlock(); - - return Result; -} - -HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie) { - HRESULT hr = S_FALSE; - CAdvisePacket * p_prev = &head; - CAdvisePacket * p_n; - m_Serialize.Lock(); - while(p_n = p_prev->Next()) // The Next() method returns NULL when it hits z - { - if(p_n->m_dwAdviseCookie == dwAdviseCookie) { - Delete(p_prev->RemoveNext()); - --m_dwAdviseCount; - hr = S_OK; - // Having found one cookie that matches, there should be no more -#ifdef DEBUG - while(p_n = p_prev->Next()) { - ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie); - p_prev = p_n; - } -#endif - break; - } - p_prev = p_n; - }; - m_Serialize.Unlock(); - return hr; -} - -REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime ) { - REFERENCE_TIME rtNextTime; - CAdvisePacket * pAdvise; - - DbgLog((LOG_TIMING, 2, - TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS)))); - - CAutoLock lck(&m_Serialize); - -#ifdef DEBUG - if(DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList(); -#endif - - // Note - DON'T cache the difference, it might overflow - while(rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) && - !pAdvise->IsZ()) { - ASSERT(pAdvise->m_dwAdviseCookie); // If this is zero, its the head or the tail!! - - ASSERT(pAdvise->m_hNotify != INVALID_HANDLE_VALUE); - - if(pAdvise->m_bPeriodic == TRUE) { - ReleaseSemaphore(pAdvise->m_hNotify,1,NULL); - pAdvise->m_rtEventTime += pAdvise->m_rtPeriod; - ShuntHead(); - } - else { - ASSERT(pAdvise->m_bPeriodic == FALSE); - EXECUTE_ASSERT(SetEvent(pAdvise->m_hNotify)); - --m_dwAdviseCount; - Delete(head.RemoveNext()); - } - - } - - DbgLog((LOG_TIMING, 3, - TEXT("CAMSchedule::Advise() Next time stamp: %lu ms, for advise %lu."), - DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie )); - - return rtNextTime; -} - -/* Private methods */ - -DWORD_PTR CAMSchedule::AddAdvisePacket( CAdvisePacket * pPacket ) { - ASSERT(pPacket->m_rtEventTime >= 0 && pPacket->m_rtEventTime < MAX_TIME); - ASSERT(CritCheckIn(&m_Serialize)); - - CAdvisePacket * p_prev = &head; - CAdvisePacket * p_n; - - const DWORD_PTR Result = pPacket->m_dwAdviseCookie = ++m_dwNextCookie; - // This relies on the fact that z is a sentry with a maximal m_rtEventTime - for(;;p_prev = p_n) - { - p_n = p_prev->m_next; - if(p_n->m_rtEventTime >= pPacket->m_rtEventTime) - break; - } - p_prev->InsertAfter( pPacket ); - ++m_dwAdviseCount; - - DbgLog((LOG_TIMING, 2, TEXT("Added advise %lu, for thread 0x%02X, scheduled at %lu"), - pPacket->m_dwAdviseCookie, GetCurrentThreadId(), (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) )); - - // If packet added at the head, then clock needs to re-evaluate wait time. - if(p_prev == &head) SetEvent(m_ev); - - return Result; -} - -void CAMSchedule::Delete( CAdvisePacket * pPacket ) { - if(m_dwCacheCount >= dwCacheMax) delete pPacket; - else { - m_Serialize.Lock(); - pPacket->m_next = m_pAdviseCache; - m_pAdviseCache = pPacket; - ++m_dwCacheCount; - m_Serialize.Unlock(); - } -} - - -// Takes the head of the list & repositions it -void CAMSchedule::ShuntHead() { - CAdvisePacket * p_prev = &head; - CAdvisePacket * p_n; - - m_Serialize.Lock(); - CAdvisePacket *const pPacket = head.m_next; - - // This will catch both an empty list, - // and if somehow a MAX_TIME time gets into the list - // (which would also break this method). - ASSERT(pPacket->m_rtEventTime < MAX_TIME); - - // This relies on the fact that z is a sentry with a maximal m_rtEventTime - for(;;p_prev = p_n) - { - p_n = p_prev->m_next; - if(p_n->m_rtEventTime > pPacket->m_rtEventTime) - break; - } - - // If p_prev == pPacket then we're already in the right place - if(p_prev != pPacket) - { - head.m_next = pPacket->m_next; - (p_prev->m_next = pPacket)->m_next = p_n; - } - #ifdef DEBUG - DbgLog((LOG_TIMING, 2, TEXT("Periodic advise %lu, shunted to %lu"), - pPacket->m_dwAdviseCookie, (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) )); -#endif - m_Serialize.Unlock(); -} - - -#ifdef DEBUG -void CAMSchedule::DumpLinkedList() { - m_Serialize.Lock(); - int i=0; - DbgLog((LOG_TIMING, 1, TEXT("CAMSchedule::DumpLinkedList() this = 0x%p"), this)); - for(CAdvisePacket * p = &head - ; p - ; p = p->m_next , i++) { - DbgLog((LOG_TIMING, 1, TEXT("Advise List # %lu, Cookie %d, RefTime %lu"), - i, - p->m_dwAdviseCookie, - p->m_rtEventTime / (UNITS / MILLISECONDS) - )); - } - m_Serialize.Unlock(); -} -#endif - +//------------------------------------------------------------------------------ +// File: Schedule.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + +#pragma warning(disable:4706) // C4706: assignment within conditional expression + +// DbgLog values (all on LOG_TIMING): +// +// 2 for schedulting, firing and shunting of events +// 3 for wait delays and wake-up times of event thread +// 4 for details of whats on the list when the thread awakes + +/* Construct & destructors */ + +CAMSchedule::CAMSchedule( HANDLE ev ) +: CBaseObject(TEXT("CAMSchedule")) +, head(&z, 0), z(0, MAX_TIME) +, m_dwNextCookie(0), m_dwAdviseCount(0) +, m_pAdviseCache(0), m_dwCacheCount(0) +, m_ev( ev ) { + head.m_dwAdviseCookie = z.m_dwAdviseCookie = 0; +} + +CAMSchedule::~CAMSchedule() { + m_Serialize.Lock(); + + // Delete cache + CAdvisePacket * p = m_pAdviseCache; + while(p) { + CAdvisePacket *const p_next = p->m_next; + delete p; + p = p_next; + } + + ASSERT(m_dwAdviseCount == 0); + // Better to be safe than sorry + if(m_dwAdviseCount > 0) { + DumpLinkedList(); + while(!head.m_next->IsZ()) { + head.DeleteNext(); + --m_dwAdviseCount; + } + } + + // If, in the debug version, we assert twice, it means, not only + // did we have left over advises, but we have also let m_dwAdviseCount + // get out of sync. with the number of advises actually on the list. + ASSERT(m_dwAdviseCount == 0); + + m_Serialize.Unlock(); +} + +/* Public methods */ + +DWORD CAMSchedule::GetAdviseCount() { + // No need to lock, m_dwAdviseCount is 32bits & declared volatile + return m_dwAdviseCount; +} + +REFERENCE_TIME CAMSchedule::GetNextAdviseTime() { + CAutoLock lck(&m_Serialize); // Need to stop the linked list from changing + return head.m_next->m_rtEventTime; +} + +DWORD_PTR CAMSchedule::AddAdvisePacket +( const REFERENCE_TIME & time1 +, const REFERENCE_TIME & time2 +, HANDLE h, BOOL periodic +) { + // Since we use MAX_TIME as a sentry, we can't afford to + // schedule a notification at MAX_TIME + ASSERT(time1 < MAX_TIME); + DWORD_PTR Result; + CAdvisePacket * p; + + m_Serialize.Lock(); + + if(m_pAdviseCache) { + p = m_pAdviseCache; + m_pAdviseCache = p->m_next; + --m_dwCacheCount; + } + else { + p = new CAdvisePacket(); + } + if(p) { + p->m_rtEventTime = time1; p->m_rtPeriod = time2; + p->m_hNotify = h; p->m_bPeriodic = periodic; + Result = AddAdvisePacket(p); + } + else Result = 0; + + m_Serialize.Unlock(); + + return Result; +} + +HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie) { + HRESULT hr = S_FALSE; + CAdvisePacket * p_prev = &head; + CAdvisePacket * p_n; + m_Serialize.Lock(); + while(p_n = p_prev->Next()) // The Next() method returns NULL when it hits z + { + if(p_n->m_dwAdviseCookie == dwAdviseCookie) { + Delete(p_prev->RemoveNext()); + --m_dwAdviseCount; + hr = S_OK; + // Having found one cookie that matches, there should be no more +#ifdef DEBUG + while(p_n = p_prev->Next()) { + ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie); + p_prev = p_n; + } +#endif + break; + } + p_prev = p_n; + }; + m_Serialize.Unlock(); + return hr; +} + +REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime ) { + REFERENCE_TIME rtNextTime; + CAdvisePacket * pAdvise; + + DbgLog((LOG_TIMING, 2, + TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS)))); + + CAutoLock lck(&m_Serialize); + +#ifdef DEBUG + if(DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList(); +#endif + + // Note - DON'T cache the difference, it might overflow + while(rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) && + !pAdvise->IsZ()) { + ASSERT(pAdvise->m_dwAdviseCookie); // If this is zero, its the head or the tail!! + + ASSERT(pAdvise->m_hNotify != INVALID_HANDLE_VALUE); + + if(pAdvise->m_bPeriodic == TRUE) { + ReleaseSemaphore(pAdvise->m_hNotify,1,NULL); + pAdvise->m_rtEventTime += pAdvise->m_rtPeriod; + ShuntHead(); + } + else { + ASSERT(pAdvise->m_bPeriodic == FALSE); + EXECUTE_ASSERT(SetEvent(pAdvise->m_hNotify)); + --m_dwAdviseCount; + Delete(head.RemoveNext()); + } + + } + + DbgLog((LOG_TIMING, 3, + TEXT("CAMSchedule::Advise() Next time stamp: %lu ms, for advise %lu."), + DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie )); + + return rtNextTime; +} + +/* Private methods */ + +DWORD_PTR CAMSchedule::AddAdvisePacket( CAdvisePacket * pPacket ) { + ASSERT(pPacket->m_rtEventTime >= 0 && pPacket->m_rtEventTime < MAX_TIME); + ASSERT(CritCheckIn(&m_Serialize)); + + CAdvisePacket * p_prev = &head; + CAdvisePacket * p_n; + + const DWORD_PTR Result = pPacket->m_dwAdviseCookie = ++m_dwNextCookie; + // This relies on the fact that z is a sentry with a maximal m_rtEventTime + for(;;p_prev = p_n) + { + p_n = p_prev->m_next; + if(p_n->m_rtEventTime >= pPacket->m_rtEventTime) + break; + } + p_prev->InsertAfter( pPacket ); + ++m_dwAdviseCount; + + DbgLog((LOG_TIMING, 2, TEXT("Added advise %lu, for thread 0x%02X, scheduled at %lu"), + pPacket->m_dwAdviseCookie, GetCurrentThreadId(), (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) )); + + // If packet added at the head, then clock needs to re-evaluate wait time. + if(p_prev == &head) SetEvent(m_ev); + + return Result; +} + +void CAMSchedule::Delete( CAdvisePacket * pPacket ) { + if(m_dwCacheCount >= dwCacheMax) delete pPacket; + else { + m_Serialize.Lock(); + pPacket->m_next = m_pAdviseCache; + m_pAdviseCache = pPacket; + ++m_dwCacheCount; + m_Serialize.Unlock(); + } +} + + +// Takes the head of the list & repositions it +void CAMSchedule::ShuntHead() { + CAdvisePacket * p_prev = &head; + CAdvisePacket * p_n; + + m_Serialize.Lock(); + CAdvisePacket *const pPacket = head.m_next; + + // This will catch both an empty list, + // and if somehow a MAX_TIME time gets into the list + // (which would also break this method). + ASSERT(pPacket->m_rtEventTime < MAX_TIME); + + // This relies on the fact that z is a sentry with a maximal m_rtEventTime + for(;;p_prev = p_n) + { + p_n = p_prev->m_next; + if(p_n->m_rtEventTime > pPacket->m_rtEventTime) + break; + } + + // If p_prev == pPacket then we're already in the right place + if(p_prev != pPacket) + { + head.m_next = pPacket->m_next; + (p_prev->m_next = pPacket)->m_next = p_n; + } + #ifdef DEBUG + DbgLog((LOG_TIMING, 2, TEXT("Periodic advise %lu, shunted to %lu"), + pPacket->m_dwAdviseCookie, (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) )); +#endif + m_Serialize.Unlock(); +} + + +#ifdef DEBUG +void CAMSchedule::DumpLinkedList() { + m_Serialize.Lock(); + int i=0; + DbgLog((LOG_TIMING, 1, TEXT("CAMSchedule::DumpLinkedList() this = 0x%p"), this)); + for(CAdvisePacket * p = &head + ; p + ; p = p->m_next , i++) { + DbgLog((LOG_TIMING, 1, TEXT("Advise List # %lu, Cookie %d, RefTime %lu"), + i, + p->m_dwAdviseCookie, + p->m_rtEventTime / (UNITS / MILLISECONDS) + )); + } + m_Serialize.Unlock(); +} +#endif + diff --git a/src/BaseClasses/seekpt.cpp b/src/BaseClasses/seekpt.cpp index 5d445f530b..2f49f6660b 100644 --- a/src/BaseClasses/seekpt.cpp +++ b/src/BaseClasses/seekpt.cpp @@ -1,83 +1,83 @@ -//------------------------------------------------------------------------------ -// File: SeekPT.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include "seekpt.h" - -//================================================================== -// CreateInstance -// This goes in the factory template table to create new instances -// If there is already a mapper instance - return that, else make one -// and save it in a static variable so that forever after we can return that. -//================================================================== - -CUnknown * CSeekingPassThru::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) -{ - return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr); -} - - -STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void ** ppv) -{ - if (riid == IID_ISeekingPassThru) { - return GetInterface((ISeekingPassThru *) this, ppv); - } else { - if (m_pPosPassThru && - (riid == IID_IMediaSeeking || - riid == IID_IMediaPosition)) { - return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv); - } else { - return CUnknown::NonDelegatingQueryInterface(riid, ppv); - } - } -} - - -CSeekingPassThru::CSeekingPassThru( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr ) - : CUnknown(pName, pUnk, phr), - m_pPosPassThru(NULL) -{ -} - - -CSeekingPassThru::~CSeekingPassThru() -{ - delete m_pPosPassThru; -} - -STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin) -{ - HRESULT hr = NOERROR; - if (m_pPosPassThru) { - hr = E_FAIL; - } else { - m_pPosPassThru = - bRendererSeeking ? - new CRendererPosPassThru( - NAME("Render Seeking COM object"), - (IUnknown *)this, - &hr, - pPin) : - new CPosPassThru( - NAME("Render Seeking COM object"), - (IUnknown *)this, - &hr, - pPin); - if (!m_pPosPassThru) { - hr = E_OUTOFMEMORY; - } else { - if (FAILED(hr)) { - delete m_pPosPassThru; - m_pPosPassThru = NULL; - } - } - } - return hr; -} - +//------------------------------------------------------------------------------ +// File: SeekPT.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include "seekpt.h" + +//================================================================== +// CreateInstance +// This goes in the factory template table to create new instances +// If there is already a mapper instance - return that, else make one +// and save it in a static variable so that forever after we can return that. +//================================================================== + +CUnknown * CSeekingPassThru::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) +{ + return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr); +} + + +STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void ** ppv) +{ + if (riid == IID_ISeekingPassThru) { + return GetInterface((ISeekingPassThru *) this, ppv); + } else { + if (m_pPosPassThru && + (riid == IID_IMediaSeeking || + riid == IID_IMediaPosition)) { + return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv); + } else { + return CUnknown::NonDelegatingQueryInterface(riid, ppv); + } + } +} + + +CSeekingPassThru::CSeekingPassThru( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr ) + : CUnknown(pName, pUnk, phr), + m_pPosPassThru(NULL) +{ +} + + +CSeekingPassThru::~CSeekingPassThru() +{ + delete m_pPosPassThru; +} + +STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin) +{ + HRESULT hr = NOERROR; + if (m_pPosPassThru) { + hr = E_FAIL; + } else { + m_pPosPassThru = + bRendererSeeking ? + new CRendererPosPassThru( + NAME("Render Seeking COM object"), + (IUnknown *)this, + &hr, + pPin) : + new CPosPassThru( + NAME("Render Seeking COM object"), + (IUnknown *)this, + &hr, + pPin); + if (!m_pPosPassThru) { + hr = E_OUTOFMEMORY; + } else { + if (FAILED(hr)) { + delete m_pPosPassThru; + m_pPosPassThru = NULL; + } + } + } + return hr; +} + diff --git a/src/BaseClasses/seekpt.h b/src/BaseClasses/seekpt.h index 823724c901..49ba33db3d 100644 --- a/src/BaseClasses/seekpt.h +++ b/src/BaseClasses/seekpt.h @@ -1,30 +1,30 @@ -//------------------------------------------------------------------------------ -// File: SeekPT.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __seekpt_h__ -#define __seekpt_h__ - - -class CSeekingPassThru : public ISeekingPassThru, public CUnknown -{ -public: - static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); - CSeekingPassThru(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr); - ~CSeekingPassThru(); - - DECLARE_IUNKNOWN; - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); - - STDMETHODIMP Init(BOOL bSupportRendering, IPin *pPin); - -private: - CPosPassThru *m_pPosPassThru; -}; - -#endif +//------------------------------------------------------------------------------ +// File: SeekPT.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __seekpt_h__ +#define __seekpt_h__ + + +class CSeekingPassThru : public ISeekingPassThru, public CUnknown +{ +public: + static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); + CSeekingPassThru(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr); + ~CSeekingPassThru(); + + DECLARE_IUNKNOWN; + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); + + STDMETHODIMP Init(BOOL bSupportRendering, IPin *pPin); + +private: + CPosPassThru *m_pPosPassThru; +}; + +#endif diff --git a/src/BaseClasses/source.cpp b/src/BaseClasses/source.cpp index 734181b7e2..f8cb36360a 100644 --- a/src/BaseClasses/source.cpp +++ b/src/BaseClasses/source.cpp @@ -1,519 +1,519 @@ -//------------------------------------------------------------------------------ -// File: Source.cpp -// -// Desc: DirectShow base classes - implements CSource, which is a Quartz -// source filter 'template.' -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// Locking Strategy. -// -// Hold the filter critical section (m_pFilter->pStateLock()) to serialise -// access to functions. Note that, in general, this lock may be held -// by a function when the worker thread may want to hold it. Therefore -// if you wish to access shared state from the worker thread you will -// need to add another critical section object. The execption is during -// the threads processing loop, when it is safe to get the filter critical -// section from within FillBuffer(). - -#include - - -// -// CSource::Constructor -// -// Initialise the pin count for the filter. The user will create the pins in -// the derived class. -CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid) - : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), - m_iPins(0), - m_paStreams(NULL) { -} - -CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr) - : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), - m_iPins(0), - m_paStreams(NULL) { - UNREFERENCED_PARAMETER(phr); -} - -#ifdef UNICODE -CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid) - : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), - m_iPins(0), - m_paStreams(NULL) { -} - -CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr) - : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), - m_iPins(0), - m_paStreams(NULL) { - UNREFERENCED_PARAMETER(phr); -} -#endif - -// -// CSource::Destructor -// -CSource::~CSource() { - /* Free our pins and pin array */ - while(m_iPins != 0) { - // deleting the pins causes them to be removed from the array... - delete m_paStreams[m_iPins - 1]; - } - - ASSERT(m_paStreams == NULL); -} - - -// -// Add a new pin -// -HRESULT CSource::AddPin(CSourceStream *pStream) { - CAutoLock lock(&m_cStateLock); - - /* Allocate space for this pin and the old ones */ - CSourceStream **paStreams = new CSourceStream *[m_iPins + 1]; - if(paStreams == NULL) { - return E_OUTOFMEMORY; - } - if(m_paStreams != NULL) { - CopyMemory((PVOID)paStreams, (PVOID)m_paStreams, - m_iPins * sizeof(m_paStreams[0])); - paStreams[m_iPins] = pStream; - delete [] m_paStreams; - } - m_paStreams = paStreams; - m_paStreams[m_iPins] = pStream; - m_iPins++; - return S_OK; -} - -// -// Remove a pin - pStream is NOT deleted -// -HRESULT CSource::RemovePin(CSourceStream *pStream) { - int i; - for(i = 0; i < m_iPins; i++) { - if(m_paStreams[i] == pStream) { - if(m_iPins == 1) { - delete [] m_paStreams; - m_paStreams = NULL; - } - else { - /* no need to reallocate */ - while(++i < m_iPins) - m_paStreams[i - 1] = m_paStreams[i]; - } - m_iPins--; - return S_OK; - } - } - return S_FALSE; -} - -// -// FindPin -// -// Set *ppPin to the IPin* that has the id Id. -// or to NULL if the Id cannot be matched. -STDMETHODIMP CSource::FindPin(LPCWSTR Id, IPin **ppPin) { - CheckPointer(ppPin,E_POINTER); - ValidateReadWritePtr(ppPin,sizeof(IPin *)); - // The -1 undoes the +1 in QueryId and ensures that totally invalid - // strings (for which WstrToInt delivers 0) give a deliver a NULL pin. - int i = WstrToInt(Id) -1; - *ppPin = GetPin(i); - if(*ppPin!=NULL) { - (*ppPin)->AddRef(); - return NOERROR; - } - else { - return VFW_E_NOT_FOUND; - } -} - -// -// FindPinNumber -// -// return the number of the pin with this IPin* or -1 if none -int CSource::FindPinNumber(IPin *iPin) { - int i; - for(i=0; in && n>=0 it follows that m_iPins>0 - // which is what used to be checked (i.e. checking that we have a pin) - if((n >= 0) && (n < m_iPins)) { - - ASSERT(m_paStreams[n]); - return m_paStreams[n]; - } - return NULL; -} - - -// - - -// * -// * --- CSourceStream ---- -// * - -// -// Set Id to point to a CoTaskMemAlloc'd -STDMETHODIMP CSourceStream::QueryId(LPWSTR *Id) { - CheckPointer(Id,E_POINTER); - ValidateReadWritePtr(Id,sizeof(LPWSTR)); - - // We give the pins id's which are 1,2,... - // FindPinNumber returns -1 for an invalid pin - int i = 1+ m_pFilter->FindPinNumber(this); - if(i<1) return VFW_E_NOT_FOUND; - *Id = (LPWSTR)CoTaskMemAlloc(8); - if(*Id==NULL) { - return E_OUTOFMEMORY; - } - IntToWstr(i, *Id); - return NOERROR; -} - - - -// -// CSourceStream::Constructor -// -// increments the number of pins present on the filter -CSourceStream::CSourceStream( - TCHAR *pObjectName, - HRESULT *phr, - CSource *ps, - LPCWSTR pPinName) - : CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName), - m_pFilter(ps) { - - *phr = m_pFilter->AddPin(this); -} - -#ifdef UNICODE -CSourceStream::CSourceStream( - char *pObjectName, - HRESULT *phr, - CSource *ps, - LPCWSTR pPinName) - : CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName), - m_pFilter(ps) { - - *phr = m_pFilter->AddPin(this); -} -#endif -// -// CSourceStream::Destructor -// -// Decrements the number of pins on this filter -CSourceStream::~CSourceStream(void) { - - m_pFilter->RemovePin(this); -} - - -// -// CheckMediaType -// -// Do we support this type? Provides the default support for 1 type. -HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType) { - - CAutoLock lock(m_pFilter->pStateLock()); - - CMediaType mt; - GetMediaType(&mt); - - if(mt == *pMediaType) { - return NOERROR; - } - - return E_FAIL; -} - - -// -// GetMediaType/3 -// -// By default we support only one type -// iPosition indexes are 0-n -HRESULT CSourceStream::GetMediaType(int iPosition, CMediaType *pMediaType) { - - CAutoLock lock(m_pFilter->pStateLock()); - - if(iPosition<0) { - return E_INVALIDARG; - } - if(iPosition>0) { - return VFW_S_NO_MORE_ITEMS; - } - return GetMediaType(pMediaType); -} - - -// -// Active -// -// The pin is active - start up the worker thread -HRESULT CSourceStream::Active(void) { - - CAutoLock lock(m_pFilter->pStateLock()); - - HRESULT hr; - - if(m_pFilter->IsActive()) { - return S_FALSE; // succeeded, but did not allocate resources (they already exist...) - } - - // do nothing if not connected - its ok not to connect to - // all pins of a source filter - if(!IsConnected()) { - return NOERROR; - } - - hr = CBaseOutputPin::Active(); - if(FAILED(hr)) { - return hr; - } - - ASSERT(!ThreadExists()); - - // start the thread - if(!Create()) { - return E_FAIL; - } - - // Tell thread to initialize. If OnThreadCreate Fails, so does this. - hr = Init(); - if(FAILED(hr)) - return hr; - - return Pause(); -} - - -// -// Inactive -// -// Pin is inactive - shut down the worker thread -// Waits for the worker to exit before returning. -HRESULT CSourceStream::Inactive(void) { - - CAutoLock lock(m_pFilter->pStateLock()); - - HRESULT hr; - - // do nothing if not connected - its ok not to connect to - // all pins of a source filter - if(!IsConnected()) { - return NOERROR; - } - - // !!! need to do this before trying to stop the thread, because - // we may be stuck waiting for our own allocator!!! - - hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator - if(FAILED(hr)) { - return hr; - } - - if(ThreadExists()) { - hr = Stop(); - - if(FAILED(hr)) { - return hr; - } - - hr = Exit(); - if(FAILED(hr)) { - return hr; - } - - Close(); // Wait for the thread to exit, then tidy up. - } - - // hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator - //if (FAILED(hr)) { - // return hr; - //} - - return NOERROR; -} - - -// -// ThreadProc -// -// When this returns the thread exits -// Return codes > 0 indicate an error occured -DWORD CSourceStream::ThreadProc(void) { - - HRESULT hr; // the return code from calls - Command com; - - do { - com = GetRequest(); - if(com != CMD_INIT) { - DbgLog((LOG_ERROR, 1, TEXT("Thread expected init command"))); - Reply((DWORD) E_UNEXPECTED); - } - } while(com != CMD_INIT); - - DbgLog((LOG_TRACE, 1, TEXT("CSourceStream worker thread initializing"))); - - hr = OnThreadCreate(); // perform set up tasks - if(FAILED(hr)) { - DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadCreate failed. Aborting thread."))); - OnThreadDestroy(); - Reply(hr); // send failed return code from OnThreadCreate - return 1; - } - - // Initialisation suceeded - Reply(NOERROR); - - Command cmd; - do { - cmd = GetRequest(); - - switch(cmd) { - - case CMD_EXIT: - Reply(NOERROR); - break; - - case CMD_RUN: - DbgLog((LOG_ERROR, 1, TEXT("CMD_RUN received before a CMD_PAUSE???"))); - // !!! fall through??? - - case CMD_PAUSE: - Reply(NOERROR); - DoBufferProcessingLoop(); - break; - - case CMD_STOP: - Reply(NOERROR); - break; - - default: - DbgLog((LOG_ERROR, 1, TEXT("Unknown command %d received!"), cmd)); - Reply((DWORD) E_NOTIMPL); - break; - } - } while(cmd != CMD_EXIT); - - hr = OnThreadDestroy(); // tidy up. - if(FAILED(hr)) { - DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadDestroy failed. Exiting thread."))); - return 1; - } - - DbgLog((LOG_TRACE, 1, TEXT("CSourceStream worker thread exiting"))); - return 0; -} - - -// -// DoBufferProcessingLoop -// -// Grabs a buffer and calls the users processing function. -// Overridable, so that different delivery styles can be catered for. -HRESULT CSourceStream::DoBufferProcessingLoop(void) { - - Command com; - - OnThreadStartPlay(); - - do { - while(!CheckRequest(&com)) { - - IMediaSample *pSample; - - HRESULT hr = GetDeliveryBuffer(&pSample,NULL,NULL,0); - if(FAILED(hr)) { - Sleep(1); - continue; // go round again. Perhaps the error will go away - // or the allocator is decommited & we will be asked to - // exit soon. - } - - // Virtual function user will override. - hr = FillBuffer(pSample); - - if(hr == S_OK) { - hr = Deliver(pSample); - pSample->Release(); - - // downstream filter returns S_FALSE if it wants us to - // stop or an error if it's reporting an error. - if(hr != S_OK) { - DbgLog((LOG_TRACE, 2, TEXT("Deliver() returned %08x; stopping"), hr)); - return S_OK; - } - - } - else if(hr == S_FALSE) { - // derived class wants us to stop pushing data - pSample->Release(); - DeliverEndOfStream(); - return S_OK; - } - else { - // derived class encountered an error - pSample->Release(); - DbgLog((LOG_ERROR, 1, TEXT("Error %08lX from FillBuffer!!!"), hr)); - DeliverEndOfStream(); - m_pFilter->NotifyEvent(EC_ERRORABORT, hr, 0); - return hr; - } - - // all paths release the sample - } - - // For all commands sent to us there must be a Reply call! - - if(com == CMD_RUN || com == CMD_PAUSE) { - Reply(NOERROR); - } - else if(com != CMD_STOP) { - Reply((DWORD) E_UNEXPECTED); - DbgLog((LOG_ERROR, 1, TEXT("Unexpected command!!!"))); - } - } while(com != CMD_STOP); - - return S_FALSE; -} - - +//------------------------------------------------------------------------------ +// File: Source.cpp +// +// Desc: DirectShow base classes - implements CSource, which is a Quartz +// source filter 'template.' +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// Locking Strategy. +// +// Hold the filter critical section (m_pFilter->pStateLock()) to serialise +// access to functions. Note that, in general, this lock may be held +// by a function when the worker thread may want to hold it. Therefore +// if you wish to access shared state from the worker thread you will +// need to add another critical section object. The execption is during +// the threads processing loop, when it is safe to get the filter critical +// section from within FillBuffer(). + +#include + + +// +// CSource::Constructor +// +// Initialise the pin count for the filter. The user will create the pins in +// the derived class. +CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid) + : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), + m_iPins(0), + m_paStreams(NULL) { +} + +CSource::CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr) + : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), + m_iPins(0), + m_paStreams(NULL) { + UNREFERENCED_PARAMETER(phr); +} + +#ifdef UNICODE +CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid) + : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), + m_iPins(0), + m_paStreams(NULL) { +} + +CSource::CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr) + : CBaseFilter(pName, lpunk, &m_cStateLock, clsid), + m_iPins(0), + m_paStreams(NULL) { + UNREFERENCED_PARAMETER(phr); +} +#endif + +// +// CSource::Destructor +// +CSource::~CSource() { + /* Free our pins and pin array */ + while(m_iPins != 0) { + // deleting the pins causes them to be removed from the array... + delete m_paStreams[m_iPins - 1]; + } + + ASSERT(m_paStreams == NULL); +} + + +// +// Add a new pin +// +HRESULT CSource::AddPin(CSourceStream *pStream) { + CAutoLock lock(&m_cStateLock); + + /* Allocate space for this pin and the old ones */ + CSourceStream **paStreams = new CSourceStream *[m_iPins + 1]; + if(paStreams == NULL) { + return E_OUTOFMEMORY; + } + if(m_paStreams != NULL) { + CopyMemory((PVOID)paStreams, (PVOID)m_paStreams, + m_iPins * sizeof(m_paStreams[0])); + paStreams[m_iPins] = pStream; + delete [] m_paStreams; + } + m_paStreams = paStreams; + m_paStreams[m_iPins] = pStream; + m_iPins++; + return S_OK; +} + +// +// Remove a pin - pStream is NOT deleted +// +HRESULT CSource::RemovePin(CSourceStream *pStream) { + int i; + for(i = 0; i < m_iPins; i++) { + if(m_paStreams[i] == pStream) { + if(m_iPins == 1) { + delete [] m_paStreams; + m_paStreams = NULL; + } + else { + /* no need to reallocate */ + while(++i < m_iPins) + m_paStreams[i - 1] = m_paStreams[i]; + } + m_iPins--; + return S_OK; + } + } + return S_FALSE; +} + +// +// FindPin +// +// Set *ppPin to the IPin* that has the id Id. +// or to NULL if the Id cannot be matched. +STDMETHODIMP CSource::FindPin(LPCWSTR Id, IPin **ppPin) { + CheckPointer(ppPin,E_POINTER); + ValidateReadWritePtr(ppPin,sizeof(IPin *)); + // The -1 undoes the +1 in QueryId and ensures that totally invalid + // strings (for which WstrToInt delivers 0) give a deliver a NULL pin. + int i = WstrToInt(Id) -1; + *ppPin = GetPin(i); + if(*ppPin!=NULL) { + (*ppPin)->AddRef(); + return NOERROR; + } + else { + return VFW_E_NOT_FOUND; + } +} + +// +// FindPinNumber +// +// return the number of the pin with this IPin* or -1 if none +int CSource::FindPinNumber(IPin *iPin) { + int i; + for(i=0; in && n>=0 it follows that m_iPins>0 + // which is what used to be checked (i.e. checking that we have a pin) + if((n >= 0) && (n < m_iPins)) { + + ASSERT(m_paStreams[n]); + return m_paStreams[n]; + } + return NULL; +} + + +// + + +// * +// * --- CSourceStream ---- +// * + +// +// Set Id to point to a CoTaskMemAlloc'd +STDMETHODIMP CSourceStream::QueryId(LPWSTR *Id) { + CheckPointer(Id,E_POINTER); + ValidateReadWritePtr(Id,sizeof(LPWSTR)); + + // We give the pins id's which are 1,2,... + // FindPinNumber returns -1 for an invalid pin + int i = 1+ m_pFilter->FindPinNumber(this); + if(i<1) return VFW_E_NOT_FOUND; + *Id = (LPWSTR)CoTaskMemAlloc(8); + if(*Id==NULL) { + return E_OUTOFMEMORY; + } + IntToWstr(i, *Id); + return NOERROR; +} + + + +// +// CSourceStream::Constructor +// +// increments the number of pins present on the filter +CSourceStream::CSourceStream( + TCHAR *pObjectName, + HRESULT *phr, + CSource *ps, + LPCWSTR pPinName) + : CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName), + m_pFilter(ps) { + + *phr = m_pFilter->AddPin(this); +} + +#ifdef UNICODE +CSourceStream::CSourceStream( + char *pObjectName, + HRESULT *phr, + CSource *ps, + LPCWSTR pPinName) + : CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName), + m_pFilter(ps) { + + *phr = m_pFilter->AddPin(this); +} +#endif +// +// CSourceStream::Destructor +// +// Decrements the number of pins on this filter +CSourceStream::~CSourceStream(void) { + + m_pFilter->RemovePin(this); +} + + +// +// CheckMediaType +// +// Do we support this type? Provides the default support for 1 type. +HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType) { + + CAutoLock lock(m_pFilter->pStateLock()); + + CMediaType mt; + GetMediaType(&mt); + + if(mt == *pMediaType) { + return NOERROR; + } + + return E_FAIL; +} + + +// +// GetMediaType/3 +// +// By default we support only one type +// iPosition indexes are 0-n +HRESULT CSourceStream::GetMediaType(int iPosition, CMediaType *pMediaType) { + + CAutoLock lock(m_pFilter->pStateLock()); + + if(iPosition<0) { + return E_INVALIDARG; + } + if(iPosition>0) { + return VFW_S_NO_MORE_ITEMS; + } + return GetMediaType(pMediaType); +} + + +// +// Active +// +// The pin is active - start up the worker thread +HRESULT CSourceStream::Active(void) { + + CAutoLock lock(m_pFilter->pStateLock()); + + HRESULT hr; + + if(m_pFilter->IsActive()) { + return S_FALSE; // succeeded, but did not allocate resources (they already exist...) + } + + // do nothing if not connected - its ok not to connect to + // all pins of a source filter + if(!IsConnected()) { + return NOERROR; + } + + hr = CBaseOutputPin::Active(); + if(FAILED(hr)) { + return hr; + } + + ASSERT(!ThreadExists()); + + // start the thread + if(!Create()) { + return E_FAIL; + } + + // Tell thread to initialize. If OnThreadCreate Fails, so does this. + hr = Init(); + if(FAILED(hr)) + return hr; + + return Pause(); +} + + +// +// Inactive +// +// Pin is inactive - shut down the worker thread +// Waits for the worker to exit before returning. +HRESULT CSourceStream::Inactive(void) { + + CAutoLock lock(m_pFilter->pStateLock()); + + HRESULT hr; + + // do nothing if not connected - its ok not to connect to + // all pins of a source filter + if(!IsConnected()) { + return NOERROR; + } + + // !!! need to do this before trying to stop the thread, because + // we may be stuck waiting for our own allocator!!! + + hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator + if(FAILED(hr)) { + return hr; + } + + if(ThreadExists()) { + hr = Stop(); + + if(FAILED(hr)) { + return hr; + } + + hr = Exit(); + if(FAILED(hr)) { + return hr; + } + + Close(); // Wait for the thread to exit, then tidy up. + } + + // hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator + //if (FAILED(hr)) { + // return hr; + //} + + return NOERROR; +} + + +// +// ThreadProc +// +// When this returns the thread exits +// Return codes > 0 indicate an error occured +DWORD CSourceStream::ThreadProc(void) { + + HRESULT hr; // the return code from calls + Command com; + + do { + com = GetRequest(); + if(com != CMD_INIT) { + DbgLog((LOG_ERROR, 1, TEXT("Thread expected init command"))); + Reply((DWORD) E_UNEXPECTED); + } + } while(com != CMD_INIT); + + DbgLog((LOG_TRACE, 1, TEXT("CSourceStream worker thread initializing"))); + + hr = OnThreadCreate(); // perform set up tasks + if(FAILED(hr)) { + DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadCreate failed. Aborting thread."))); + OnThreadDestroy(); + Reply(hr); // send failed return code from OnThreadCreate + return 1; + } + + // Initialisation suceeded + Reply(NOERROR); + + Command cmd; + do { + cmd = GetRequest(); + + switch(cmd) { + + case CMD_EXIT: + Reply(NOERROR); + break; + + case CMD_RUN: + DbgLog((LOG_ERROR, 1, TEXT("CMD_RUN received before a CMD_PAUSE???"))); + // !!! fall through??? + + case CMD_PAUSE: + Reply(NOERROR); + DoBufferProcessingLoop(); + break; + + case CMD_STOP: + Reply(NOERROR); + break; + + default: + DbgLog((LOG_ERROR, 1, TEXT("Unknown command %d received!"), cmd)); + Reply((DWORD) E_NOTIMPL); + break; + } + } while(cmd != CMD_EXIT); + + hr = OnThreadDestroy(); // tidy up. + if(FAILED(hr)) { + DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadDestroy failed. Exiting thread."))); + return 1; + } + + DbgLog((LOG_TRACE, 1, TEXT("CSourceStream worker thread exiting"))); + return 0; +} + + +// +// DoBufferProcessingLoop +// +// Grabs a buffer and calls the users processing function. +// Overridable, so that different delivery styles can be catered for. +HRESULT CSourceStream::DoBufferProcessingLoop(void) { + + Command com; + + OnThreadStartPlay(); + + do { + while(!CheckRequest(&com)) { + + IMediaSample *pSample; + + HRESULT hr = GetDeliveryBuffer(&pSample,NULL,NULL,0); + if(FAILED(hr)) { + Sleep(1); + continue; // go round again. Perhaps the error will go away + // or the allocator is decommited & we will be asked to + // exit soon. + } + + // Virtual function user will override. + hr = FillBuffer(pSample); + + if(hr == S_OK) { + hr = Deliver(pSample); + pSample->Release(); + + // downstream filter returns S_FALSE if it wants us to + // stop or an error if it's reporting an error. + if(hr != S_OK) { + DbgLog((LOG_TRACE, 2, TEXT("Deliver() returned %08x; stopping"), hr)); + return S_OK; + } + + } + else if(hr == S_FALSE) { + // derived class wants us to stop pushing data + pSample->Release(); + DeliverEndOfStream(); + return S_OK; + } + else { + // derived class encountered an error + pSample->Release(); + DbgLog((LOG_ERROR, 1, TEXT("Error %08lX from FillBuffer!!!"), hr)); + DeliverEndOfStream(); + m_pFilter->NotifyEvent(EC_ERRORABORT, hr, 0); + return hr; + } + + // all paths release the sample + } + + // For all commands sent to us there must be a Reply call! + + if(com == CMD_RUN || com == CMD_PAUSE) { + Reply(NOERROR); + } + else if(com != CMD_STOP) { + Reply((DWORD) E_UNEXPECTED); + DbgLog((LOG_ERROR, 1, TEXT("Unexpected command!!!"))); + } + } while(com != CMD_STOP); + + return S_FALSE; +} + + diff --git a/src/BaseClasses/source.h b/src/BaseClasses/source.h index 699385c7c7..2f4634e894 100644 --- a/src/BaseClasses/source.h +++ b/src/BaseClasses/source.h @@ -1,172 +1,172 @@ -//------------------------------------------------------------------------------ -// File: Source.h -// -// Desc: DirectShow base classes - defines classes to simplify creation of -// ActiveX source filters that support continuous generation of data. -// No support is provided for IMediaControl or IMediaPosition. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// -// Derive your source filter from CSource. -// During construction either: -// Create some CSourceStream objects to manage your pins -// Provide the user with a means of doing so eg, an IPersistFile interface. -// -// CSource provides: -// IBaseFilter interface management -// IMediaFilter interface management, via CBaseFilter -// Pin counting for CBaseFilter -// -// Derive a class from CSourceStream to manage your output pin types -// Implement GetMediaType/1 to return the type you support. If you support multiple -// types then overide GetMediaType/3, CheckMediaType and GetMediaTypeCount. -// Implement Fillbuffer() to put data into one buffer. -// -// CSourceStream provides: -// IPin management via CBaseOutputPin -// Worker thread management - -#ifndef __CSOURCE__ -#define __CSOURCE__ - -class CSourceStream; // The class that will handle each pin - - -// -// CSource -// -// Override construction to provide a means of creating -// CSourceStream derived objects - ie a way of creating pins. -class CSource : public CBaseFilter { -public: - - CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr); - CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid); -#ifdef UNICODE - CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr); - CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid); -#endif - ~CSource(); - - int GetPinCount(void); - CBasePin *GetPin(int n); - - // -- Utilities -- - - CCritSec* pStateLock(void) { return &m_cStateLock; } // provide our critical section - - HRESULT AddPin(CSourceStream *); - HRESULT RemovePin(CSourceStream *); - - STDMETHODIMP FindPin( - LPCWSTR Id, - IPin ** ppPin - ); - - int FindPinNumber(IPin *iPin); - -protected: - - int m_iPins; // The number of pins on this filter. Updated by CSourceStream - // constructors & destructors. - CSourceStream **m_paStreams; // the pins on this filter. - - CCritSec m_cStateLock; // Lock this to serialize function accesses to the filter state - -}; - - -// -// CSourceStream -// -// Use this class to manage a stream of data that comes from a -// pin. -// Uses a worker thread to put data on the pin. -class CSourceStream : public CAMThread, public CBaseOutputPin { -public: - - CSourceStream(TCHAR *pObjectName, - HRESULT *phr, - CSource *pms, - LPCWSTR pName); -#ifdef UNICODE - CSourceStream(CHAR *pObjectName, - HRESULT *phr, - CSource *pms, - LPCWSTR pName); -#endif - virtual ~CSourceStream(void); // virtual destructor ensures derived class destructors are called too. - -protected: - - CSource *m_pFilter; // The parent of this stream - - // * - // * Data Source - // * - // * The following three functions: FillBuffer, OnThreadCreate/Destroy, are - // * called from within the ThreadProc. They are used in the creation of - // * the media samples this pin will provide - // * - - // Override this to provide the worker thread a means - // of processing a buffer - virtual HRESULT FillBuffer(IMediaSample *pSamp) PURE; - - // Called as the thread is created/destroyed - use to perform - // jobs such as start/stop streaming mode - // If OnThreadCreate returns an error the thread will exit. - virtual HRESULT OnThreadCreate(void) {return NOERROR;}; - virtual HRESULT OnThreadDestroy(void) {return NOERROR;}; - virtual HRESULT OnThreadStartPlay(void) {return NOERROR;}; - - // * - // * Worker Thread - // * - - HRESULT Active(void); // Starts up the worker thread - HRESULT Inactive(void); // Exits the worker thread. - -public: - // thread commands - enum Command {CMD_INIT, CMD_PAUSE, CMD_RUN, CMD_STOP, CMD_EXIT}; - HRESULT Init(void) { return CallWorker(CMD_INIT); } - HRESULT Exit(void) { return CallWorker(CMD_EXIT); } - HRESULT Run(void) { return CallWorker(CMD_RUN); } - HRESULT Pause(void) { return CallWorker(CMD_PAUSE); } - HRESULT Stop(void) { return CallWorker(CMD_STOP); } - -protected: - Command GetRequest(void) { return (Command) CAMThread::GetRequest(); } - BOOL CheckRequest(Command *pCom) { return CAMThread::CheckRequest( (DWORD *) pCom); } - - // override these if you want to add thread commands - virtual DWORD ThreadProc(void); // the thread function - - virtual HRESULT DoBufferProcessingLoop(void); // the loop executed whilst running - - - // * - // * AM_MEDIA_TYPE support - // * - - // If you support more than one media type then override these 2 functions - virtual HRESULT CheckMediaType(const CMediaType *pMediaType); - virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); // List pos. 0-n - - // If you support only one type then override this fn. - // This will only be called by the default implementations - // of CheckMediaType and GetMediaType(int, CMediaType*) - // You must override this fn. or the above 2! - virtual HRESULT GetMediaType(CMediaType *pMediaType) {return E_UNEXPECTED;} - - STDMETHODIMP QueryId( - LPWSTR * Id - ); -}; - -#endif // __CSOURCE__ - +//------------------------------------------------------------------------------ +// File: Source.h +// +// Desc: DirectShow base classes - defines classes to simplify creation of +// ActiveX source filters that support continuous generation of data. +// No support is provided for IMediaControl or IMediaPosition. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// +// Derive your source filter from CSource. +// During construction either: +// Create some CSourceStream objects to manage your pins +// Provide the user with a means of doing so eg, an IPersistFile interface. +// +// CSource provides: +// IBaseFilter interface management +// IMediaFilter interface management, via CBaseFilter +// Pin counting for CBaseFilter +// +// Derive a class from CSourceStream to manage your output pin types +// Implement GetMediaType/1 to return the type you support. If you support multiple +// types then overide GetMediaType/3, CheckMediaType and GetMediaTypeCount. +// Implement Fillbuffer() to put data into one buffer. +// +// CSourceStream provides: +// IPin management via CBaseOutputPin +// Worker thread management + +#ifndef __CSOURCE__ +#define __CSOURCE__ + +class CSourceStream; // The class that will handle each pin + + +// +// CSource +// +// Override construction to provide a means of creating +// CSourceStream derived objects - ie a way of creating pins. +class CSource : public CBaseFilter { +public: + + CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr); + CSource(TCHAR *pName, LPUNKNOWN lpunk, CLSID clsid); +#ifdef UNICODE + CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid, HRESULT *phr); + CSource(CHAR *pName, LPUNKNOWN lpunk, CLSID clsid); +#endif + ~CSource(); + + int GetPinCount(void); + CBasePin *GetPin(int n); + + // -- Utilities -- + + CCritSec* pStateLock(void) { return &m_cStateLock; } // provide our critical section + + HRESULT AddPin(CSourceStream *); + HRESULT RemovePin(CSourceStream *); + + STDMETHODIMP FindPin( + LPCWSTR Id, + IPin ** ppPin + ); + + int FindPinNumber(IPin *iPin); + +protected: + + int m_iPins; // The number of pins on this filter. Updated by CSourceStream + // constructors & destructors. + CSourceStream **m_paStreams; // the pins on this filter. + + CCritSec m_cStateLock; // Lock this to serialize function accesses to the filter state + +}; + + +// +// CSourceStream +// +// Use this class to manage a stream of data that comes from a +// pin. +// Uses a worker thread to put data on the pin. +class CSourceStream : public CAMThread, public CBaseOutputPin { +public: + + CSourceStream(TCHAR *pObjectName, + HRESULT *phr, + CSource *pms, + LPCWSTR pName); +#ifdef UNICODE + CSourceStream(CHAR *pObjectName, + HRESULT *phr, + CSource *pms, + LPCWSTR pName); +#endif + virtual ~CSourceStream(void); // virtual destructor ensures derived class destructors are called too. + +protected: + + CSource *m_pFilter; // The parent of this stream + + // * + // * Data Source + // * + // * The following three functions: FillBuffer, OnThreadCreate/Destroy, are + // * called from within the ThreadProc. They are used in the creation of + // * the media samples this pin will provide + // * + + // Override this to provide the worker thread a means + // of processing a buffer + virtual HRESULT FillBuffer(IMediaSample *pSamp) PURE; + + // Called as the thread is created/destroyed - use to perform + // jobs such as start/stop streaming mode + // If OnThreadCreate returns an error the thread will exit. + virtual HRESULT OnThreadCreate(void) {return NOERROR;}; + virtual HRESULT OnThreadDestroy(void) {return NOERROR;}; + virtual HRESULT OnThreadStartPlay(void) {return NOERROR;}; + + // * + // * Worker Thread + // * + + HRESULT Active(void); // Starts up the worker thread + HRESULT Inactive(void); // Exits the worker thread. + +public: + // thread commands + enum Command {CMD_INIT, CMD_PAUSE, CMD_RUN, CMD_STOP, CMD_EXIT}; + HRESULT Init(void) { return CallWorker(CMD_INIT); } + HRESULT Exit(void) { return CallWorker(CMD_EXIT); } + HRESULT Run(void) { return CallWorker(CMD_RUN); } + HRESULT Pause(void) { return CallWorker(CMD_PAUSE); } + HRESULT Stop(void) { return CallWorker(CMD_STOP); } + +protected: + Command GetRequest(void) { return (Command) CAMThread::GetRequest(); } + BOOL CheckRequest(Command *pCom) { return CAMThread::CheckRequest( (DWORD *) pCom); } + + // override these if you want to add thread commands + virtual DWORD ThreadProc(void); // the thread function + + virtual HRESULT DoBufferProcessingLoop(void); // the loop executed whilst running + + + // * + // * AM_MEDIA_TYPE support + // * + + // If you support more than one media type then override these 2 functions + virtual HRESULT CheckMediaType(const CMediaType *pMediaType); + virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); // List pos. 0-n + + // If you support only one type then override this fn. + // This will only be called by the default implementations + // of CheckMediaType and GetMediaType(int, CMediaType*) + // You must override this fn. or the above 2! + virtual HRESULT GetMediaType(CMediaType *pMediaType) {return E_UNEXPECTED;} + + STDMETHODIMP QueryId( + LPWSTR * Id + ); +}; + +#endif // __CSOURCE__ + diff --git a/src/BaseClasses/streams.h b/src/BaseClasses/streams.h index 927f11396f..8baa6fedf6 100644 --- a/src/BaseClasses/streams.h +++ b/src/BaseClasses/streams.h @@ -1,172 +1,172 @@ -//------------------------------------------------------------------------------ -// File: Streams.h -// -// Desc: DirectShow base classes - defines overall streams architecture. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __STREAMS__ -#define __STREAMS__ - -// disable some level-4 warnings, use #pragma warning(enable:###) to re-enable -#pragma warning(disable:4100) // warning C4100: unreferenced formal parameter -#pragma warning(disable:4127) // warning C4127: conditional expression is constant -#pragma warning(disable:4189) // warning C4189: local variable is initialized but not referenced -#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union -#pragma warning(disable:4511) // warning C4511: copy constructor could not be generated -#pragma warning(disable:4512) // warning C4512: assignment operator could not be generated -#pragma warning(disable:4514) // warning C4514: unreferenced inline function has been removed -#pragma warning(disable:4710) // warning C4710: 'function' not inlined - -#ifdef _MSC_VER -#if _MSC_VER>=1100 -#define AM_NOVTABLE __declspec(novtable) -#else -#define AM_NOVTABLE -#endif -#endif // MSC_VER - - -#include -#include -#include -#include -#include - -#ifndef NUMELMS - #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0])) -#endif - -/////////////////////////////////////////////////////////////////////////// -// The following definitions come from the Platform SDK and are required if -// the applicaiton is being compiled with the headers from Visual C++ 6.0. -/////////////////////////////////////////////////////////////////////////// -#ifndef InterlockedExchangePointer - #define InterlockedExchangePointer(Target, Value) \ - (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)) -#endif - -#ifndef _WAVEFORMATEXTENSIBLE_ -#define _WAVEFORMATEXTENSIBLE_ -typedef struct { - WAVEFORMATEX Format; - union { - WORD wValidBitsPerSample; /* bits of precision */ - WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */ - WORD wReserved; /* If neither applies, set to zero. */ - } Samples; - DWORD dwChannelMask; /* which channels are */ - /* present in stream */ - GUID SubFormat; -} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; -#endif // !_WAVEFORMATEXTENSIBLE_ - -#if !defined(WAVE_FORMAT_EXTENSIBLE) -#define WAVE_FORMAT_EXTENSIBLE 0xFFFE -#endif // !defined(WAVE_FORMAT_EXTENSIBLE) - -#ifndef GetWindowLongPtr - #define GetWindowLongPtrA GetWindowLongA - #define GetWindowLongPtrW GetWindowLongW - #ifdef UNICODE - #define GetWindowLongPtr GetWindowLongPtrW - #else - #define GetWindowLongPtr GetWindowLongPtrA - #endif // !UNICODE -#endif // !GetWindowLongPtr - -#ifndef SetWindowLongPtr - #define SetWindowLongPtrA SetWindowLongA - #define SetWindowLongPtrW SetWindowLongW - #ifdef UNICODE - #define SetWindowLongPtr SetWindowLongPtrW - #else - #define SetWindowLongPtr SetWindowLongPtrA - #endif // !UNICODE -#endif // !SetWindowLongPtr - -#ifndef GWLP_WNDPROC - #define GWLP_WNDPROC (-4) -#endif -#ifndef GWLP_HINSTANCE - #define GWLP_HINSTANCE (-6) -#endif -#ifndef GWLP_HWNDPARENT - #define GWLP_HWNDPARENT (-8) -#endif -#ifndef GWLP_USERDATA - #define GWLP_USERDATA (-21) -#endif -#ifndef GWLP_ID - #define GWLP_ID (-12) -#endif -#ifndef DWLP_MSGRESULT - #define DWLP_MSGRESULT 0 -#endif -#ifndef DWLP_DLGPROC - #define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) -#endif -#ifndef DWLP_USER - #define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) -#endif -/////////////////////////////////////////////////////////////////////////// -// End Platform SDK definitions -/////////////////////////////////////////////////////////////////////////// - - -#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union -#include // Generated IDL header file for streams interfaces - -// -// Modified by Chris to look in local baseclasses directory instead of include path -// -#include "baseclasses/reftime.h" // Helper class for REFERENCE_TIME management -#include "baseclasses/wxdebug.h" // Debug support for logging and ASSERTs -#include "baseclasses/amvideo.h" // ActiveMovie video interfaces and definitions - -//include amaudio.h explicitly if you need it. it requires the DX SDK. -//#include // ActiveMovie audio interfaces and definitions - -#include "baseclasses/wxutil.h" // General helper classes for threads etc -#include "baseclasses/combase.h" // Base COM classes to support IUnknown -#include "baseclasses/dllsetup.h" // Filter registration support functions -#include "baseclasses/measure.h" // Performance measurement -#include // Light weight com function prototypes - -#include "baseclasses/cache.h" // Simple cache container class -#include "baseclasses/wxlist.h" // Non MFC generic list class -#include "baseclasses/msgthrd.h" // CMsgThread -#include "baseclasses/mtype.h" // Helper class for managing media types -#include "baseclasses/fourcc.h" // conversions between FOURCCs and GUIDs -#include // generated from control.odl -#include "baseclasses/ctlutil.h" // control interface utility classes -#include // event code definitions -#include "baseclasses/amfilter.h" // Main streams architecture class hierachy -#include "baseclasses/transfrm.h" // Generic transform filter -#include "baseclasses/transip.h" // Generic transform-in-place filter -#include // declaration of type GUIDs and well-known clsids -#include "baseclasses/source.h" // Generic source filter -#include "baseclasses/outputq.h" // Output pin queueing -#include // HRESULT status and error definitions -#include "baseclasses/renbase.h" // Base class for writing ActiveX renderers -#include "baseclasses/winutil.h" // Helps with filters that manage windows -#include "baseclasses/winctrl.h" // Implements the IVideoWindow interface -#include "baseclasses/videoctl.h" // Specifically video related classes -#include "baseclasses/refclock.h" // Base clock class -#include "baseclasses/sysclock.h" // System clock -#include "baseclasses/pstream.h" // IPersistStream helper class -#include "baseclasses/vtrans.h" // Video Transform Filter base class -#include "baseclasses/amextra.h" -#include "baseclasses/cprop.h" // Base property page class -#include "baseclasses/strmctl.h" // IAMStreamControl support -#include // External device control interface defines -#include // audio filter device error event codes - -#else - #ifdef DEBUG - #pragma message("STREAMS.H included TWICE") - #endif -#endif // __STREAMS__ - +//------------------------------------------------------------------------------ +// File: Streams.h +// +// Desc: DirectShow base classes - defines overall streams architecture. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __STREAMS__ +#define __STREAMS__ + +// disable some level-4 warnings, use #pragma warning(enable:###) to re-enable +#pragma warning(disable:4100) // warning C4100: unreferenced formal parameter +#pragma warning(disable:4127) // warning C4127: conditional expression is constant +#pragma warning(disable:4189) // warning C4189: local variable is initialized but not referenced +#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union +#pragma warning(disable:4511) // warning C4511: copy constructor could not be generated +#pragma warning(disable:4512) // warning C4512: assignment operator could not be generated +#pragma warning(disable:4514) // warning C4514: unreferenced inline function has been removed +#pragma warning(disable:4710) // warning C4710: 'function' not inlined + +#ifdef _MSC_VER +#if _MSC_VER>=1100 +#define AM_NOVTABLE __declspec(novtable) +#else +#define AM_NOVTABLE +#endif +#endif // MSC_VER + + +#include +#include +#include +#include +#include + +#ifndef NUMELMS + #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0])) +#endif + +/////////////////////////////////////////////////////////////////////////// +// The following definitions come from the Platform SDK and are required if +// the applicaiton is being compiled with the headers from Visual C++ 6.0. +/////////////////////////////////////////////////////////////////////////// +#ifndef InterlockedExchangePointer + #define InterlockedExchangePointer(Target, Value) \ + (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)) +#endif + +#ifndef _WAVEFORMATEXTENSIBLE_ +#define _WAVEFORMATEXTENSIBLE_ +typedef struct { + WAVEFORMATEX Format; + union { + WORD wValidBitsPerSample; /* bits of precision */ + WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */ + WORD wReserved; /* If neither applies, set to zero. */ + } Samples; + DWORD dwChannelMask; /* which channels are */ + /* present in stream */ + GUID SubFormat; +} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; +#endif // !_WAVEFORMATEXTENSIBLE_ + +#if !defined(WAVE_FORMAT_EXTENSIBLE) +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#endif // !defined(WAVE_FORMAT_EXTENSIBLE) + +#ifndef GetWindowLongPtr + #define GetWindowLongPtrA GetWindowLongA + #define GetWindowLongPtrW GetWindowLongW + #ifdef UNICODE + #define GetWindowLongPtr GetWindowLongPtrW + #else + #define GetWindowLongPtr GetWindowLongPtrA + #endif // !UNICODE +#endif // !GetWindowLongPtr + +#ifndef SetWindowLongPtr + #define SetWindowLongPtrA SetWindowLongA + #define SetWindowLongPtrW SetWindowLongW + #ifdef UNICODE + #define SetWindowLongPtr SetWindowLongPtrW + #else + #define SetWindowLongPtr SetWindowLongPtrA + #endif // !UNICODE +#endif // !SetWindowLongPtr + +#ifndef GWLP_WNDPROC + #define GWLP_WNDPROC (-4) +#endif +#ifndef GWLP_HINSTANCE + #define GWLP_HINSTANCE (-6) +#endif +#ifndef GWLP_HWNDPARENT + #define GWLP_HWNDPARENT (-8) +#endif +#ifndef GWLP_USERDATA + #define GWLP_USERDATA (-21) +#endif +#ifndef GWLP_ID + #define GWLP_ID (-12) +#endif +#ifndef DWLP_MSGRESULT + #define DWLP_MSGRESULT 0 +#endif +#ifndef DWLP_DLGPROC + #define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) +#endif +#ifndef DWLP_USER + #define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) +#endif +/////////////////////////////////////////////////////////////////////////// +// End Platform SDK definitions +/////////////////////////////////////////////////////////////////////////// + + +#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union +#include // Generated IDL header file for streams interfaces + +// +// Modified by Chris to look in local baseclasses directory instead of include path +// +#include "baseclasses/reftime.h" // Helper class for REFERENCE_TIME management +#include "baseclasses/wxdebug.h" // Debug support for logging and ASSERTs +#include "baseclasses/amvideo.h" // ActiveMovie video interfaces and definitions + +//include amaudio.h explicitly if you need it. it requires the DX SDK. +//#include // ActiveMovie audio interfaces and definitions + +#include "baseclasses/wxutil.h" // General helper classes for threads etc +#include "baseclasses/combase.h" // Base COM classes to support IUnknown +#include "baseclasses/dllsetup.h" // Filter registration support functions +#include "baseclasses/measure.h" // Performance measurement +#include // Light weight com function prototypes + +#include "baseclasses/cache.h" // Simple cache container class +#include "baseclasses/wxlist.h" // Non MFC generic list class +#include "baseclasses/msgthrd.h" // CMsgThread +#include "baseclasses/mtype.h" // Helper class for managing media types +#include "baseclasses/fourcc.h" // conversions between FOURCCs and GUIDs +#include // generated from control.odl +#include "baseclasses/ctlutil.h" // control interface utility classes +#include // event code definitions +#include "baseclasses/amfilter.h" // Main streams architecture class hierachy +#include "baseclasses/transfrm.h" // Generic transform filter +#include "baseclasses/transip.h" // Generic transform-in-place filter +#include // declaration of type GUIDs and well-known clsids +#include "baseclasses/source.h" // Generic source filter +#include "baseclasses/outputq.h" // Output pin queueing +#include // HRESULT status and error definitions +#include "baseclasses/renbase.h" // Base class for writing ActiveX renderers +#include "baseclasses/winutil.h" // Helps with filters that manage windows +#include "baseclasses/winctrl.h" // Implements the IVideoWindow interface +#include "baseclasses/videoctl.h" // Specifically video related classes +#include "baseclasses/refclock.h" // Base clock class +#include "baseclasses/sysclock.h" // System clock +#include "baseclasses/pstream.h" // IPersistStream helper class +#include "baseclasses/vtrans.h" // Video Transform Filter base class +#include "baseclasses/amextra.h" +#include "baseclasses/cprop.h" // Base property page class +#include "baseclasses/strmctl.h" // IAMStreamControl support +#include // External device control interface defines +#include // audio filter device error event codes + +#else + #ifdef DEBUG + #pragma message("STREAMS.H included TWICE") + #endif +#endif // __STREAMS__ + diff --git a/src/BaseClasses/strmctl.cpp b/src/BaseClasses/strmctl.cpp index ef32e2e379..f176c14166 100644 --- a/src/BaseClasses/strmctl.cpp +++ b/src/BaseClasses/strmctl.cpp @@ -1,386 +1,386 @@ -//------------------------------------------------------------------------------ -// File: StrmCtl.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - -CBaseStreamControl::CBaseStreamControl() -: m_StreamState(STREAM_FLOWING) -, m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop -, m_tStartTime(MAX_TIME) -, m_tStopTime(MAX_TIME) -, m_dwStartCookie(0) -, m_dwStopCookie(0) -, m_pRefClock(NULL) -, m_FilterState(State_Stopped) -, m_bIsFlushing(FALSE) -, m_bStopSendExtra(FALSE) { -} - -CBaseStreamControl::~CBaseStreamControl() { - // Make sure we release the clock. - SetSyncSource(NULL); - return; -} - - -STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSendExtra, DWORD dwCookie) { - CAutoLock lck(&m_CritSec); - m_bStopSendExtra = FALSE; // reset - m_bStopExtraSent = FALSE; - if(ptStop) { - if(*ptStop == MAX_TIME) { - DbgLog((LOG_TRACE,2,TEXT("StopAt: Cancel stop"))); - CancelStop(); - // If there's now a command to start in the future, we assume - // they want to be stopped when the graph is first run - if(m_FilterState == State_Stopped && m_tStartTime < MAX_TIME) { - m_StreamState = STREAM_DISCARDING; - DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING"))); - } - return NOERROR; - } - DbgLog((LOG_TRACE,2,TEXT("StopAt: %dms extra=%d"), - (int)(*ptStop/10000), bSendExtra)); - // if the first command is to stop in the future, then we assume they - // want to be started when the graph is first run - if(m_FilterState == State_Stopped && m_tStartTime > *ptStop) { - m_StreamState = STREAM_FLOWING; - DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING"))); - } - m_bStopSendExtra = bSendExtra; - m_tStopTime = *ptStop; - m_dwStopCookie = dwCookie; - m_StreamStateOnStop = STREAM_DISCARDING; - } - else { - DbgLog((LOG_TRACE,2,TEXT("StopAt: now"))); - // sending an extra frame when told to stop now would mess people up - m_bStopSendExtra = FALSE; - m_tStopTime = MAX_TIME; - m_dwStopCookie = 0; - m_StreamState = STREAM_DISCARDING; - m_StreamStateOnStop = STREAM_FLOWING; // no pending stop - } - // we might change our mind what to do with a sample we're blocking - m_StreamEvent.Set(); - return NOERROR; -} - - -STDMETHODIMP CBaseStreamControl::StartAt -( const REFERENCE_TIME *ptStart, DWORD dwCookie ) { - CAutoLock lck(&m_CritSec); - if(ptStart) { - if(*ptStart == MAX_TIME) { - DbgLog((LOG_TRACE,2,TEXT("StartAt: Cancel start"))); - CancelStart(); - // If there's now a command to stop in the future, we assume - // they want to be started when the graph is first run - if(m_FilterState == State_Stopped && m_tStopTime < MAX_TIME) { - DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING"))); - m_StreamState = STREAM_FLOWING; - } - return NOERROR; - } - DbgLog((LOG_TRACE,2,TEXT("StartAt: %dms"), (int)(*ptStart/10000))); - // if the first command is to start in the future, then we assume they - // want to be stopped when the graph is first run - if(m_FilterState == State_Stopped && m_tStopTime >= *ptStart) { - DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING"))); - m_StreamState = STREAM_DISCARDING; - } - m_tStartTime = *ptStart; - m_dwStartCookie = dwCookie; - // if (m_tStopTime == m_tStartTime) CancelStop(); - } - else { - DbgLog((LOG_TRACE,2,TEXT("StartAt: now"))); - m_tStartTime = MAX_TIME; - m_dwStartCookie = 0; - m_StreamState = STREAM_FLOWING; - } - // we might change our mind what to do with a sample we're blocking - m_StreamEvent.Set(); - return NOERROR; -} - - -// Retrieve information about current settings -STDMETHODIMP CBaseStreamControl::GetInfo(AM_STREAM_INFO *pInfo) { - if(pInfo == NULL) - return E_POINTER; - - pInfo->tStart = m_tStartTime; - pInfo->tStop = m_tStopTime; - pInfo->dwStartCookie = m_dwStartCookie; - pInfo->dwStopCookie = m_dwStopCookie; - pInfo->dwFlags = m_bStopSendExtra ? AM_STREAM_INFO_STOP_SEND_EXTRA : 0; - pInfo->dwFlags |= m_tStartTime == MAX_TIME ? 0 : AM_STREAM_INFO_START_DEFINED; - pInfo->dwFlags |= m_tStopTime == MAX_TIME ? 0 : AM_STREAM_INFO_STOP_DEFINED; - switch(m_StreamState) { - default: - DbgBreak("Invalid stream state"); - case STREAM_FLOWING: - break; - case STREAM_DISCARDING: - pInfo->dwFlags |= AM_STREAM_INFO_DISCARDING; - break; - } - return S_OK; -} - - -void CBaseStreamControl::ExecuteStop() { - ASSERT(CritCheckIn(&m_CritSec)); - m_StreamState = m_StreamStateOnStop; - if(m_dwStopCookie && m_pSink) { - DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STOPPED (%d)"), - m_dwStopCookie)); - m_pSink->Notify(EC_STREAM_CONTROL_STOPPED, (LONG_PTR)this, m_dwStopCookie); - } - CancelStop(); // This will do the tidy up -} - -void CBaseStreamControl::ExecuteStart() { - ASSERT(CritCheckIn(&m_CritSec)); - m_StreamState = STREAM_FLOWING; - if(m_dwStartCookie) { - DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STARTED (%d)"), - m_dwStartCookie)); - m_pSink->Notify(EC_STREAM_CONTROL_STARTED, (LONG_PTR)this, m_dwStartCookie); - } - CancelStart(); // This will do the tidy up -} - -void CBaseStreamControl::CancelStop() { - ASSERT(CritCheckIn(&m_CritSec)); - m_tStopTime = MAX_TIME; - m_dwStopCookie = 0; - m_StreamStateOnStop = STREAM_FLOWING; -} - -void CBaseStreamControl::CancelStart() { - ASSERT(CritCheckIn(&m_CritSec)); - m_tStartTime = MAX_TIME; - m_dwStartCookie = 0; -} - - -// This guy will return one of the three StreamControlState's. Here's what the caller -// should do for each one: -// -// STREAM_FLOWING: Proceed as usual (render or pass the sample on) -// STREAM_DISCARDING: Calculate the time 'til *pSampleStart and wait that long -// for the event handle (GetStreamEventHandle()). If the -// wait expires, throw the sample away. If the event -// fires, call me back, I've changed my mind. -// I use pSampleStart (not Stop) so that live sources don't -// block for the duration of their samples, since the clock -// will always read approximately pSampleStart when called - - -// All through this code, you'll notice the following rules: -// - When start and stop time are the same, it's as if start was first -// - An event is considered inside the sample when it's >= sample start time -// but < sample stop time -// - if any part of the sample is supposed to be sent, we'll send the whole -// thing since we don't break it into smaller pieces -// - If we skip over a start or stop without doing it, we still signal the event -// and reset ourselves in case somebody's waiting for the event, and to make -// sure we notice that the event is past and should be forgotten -// Here are the 19 cases that have to be handled (x=start o=stop <-->=sample): -// -// 1. xo<--> start then stop -// 2. ox<--> stop then start -// 3. x start -// 4. o stop then start -// 5. x<-->o start -// 6. o<-->x stop -// 7. o start -// 8. x no change -// 9. start -// 10. stop then start -// 11. <-->xo no change -// 12. <-->ox no change -// 13. x<--> start -// 14. start -// 15. <-->x no change -// 16. o<--> stop -// 17. no change -// 18. <-->o no change -// 19. <--> no change - - -enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes -( const REFERENCE_TIME * pSampleStart, const REFERENCE_TIME * pSampleStop ) { - CAutoLock lck(&m_CritSec); - - ASSERT(!m_bIsFlushing); - ASSERT(pSampleStart && pSampleStop); - - // Don't ask how I came up with the code below to handle all 19 cases... - if(m_tStopTime >= *pSampleStart) { - if(m_tStartTime >= *pSampleStop) - return m_StreamState; // cases 8 11 12 15 17 18 19 - - if(m_tStopTime < m_tStartTime) - ExecuteStop(); // case 10 - - ExecuteStart(); // cases 3 5 7 9 13 14 - return m_StreamState; - } - - if(m_tStartTime >= *pSampleStop) { - ExecuteStop(); // cases 6 16 - return m_StreamState; - } - - if(m_tStartTime <= m_tStopTime) { - ExecuteStart(); - ExecuteStop(); - } - else { - ExecuteStop(); - ExecuteStart(); - } - - return m_StreamState; // case 1, 2, or 4 -} - - -enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckStreamState( IMediaSample * pSample ) { - - REFERENCE_TIME rtBufferStart, rtBufferStop; - const BOOL bNoBufferTimes = - pSample == NULL || - FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop)); - - StreamControlState state; - LONG lWait; - - do { - // something has to break out of the blocking - if(m_bIsFlushing || m_FilterState == State_Stopped) - return STREAM_DISCARDING; - - if(bNoBufferTimes) { - // Can't do anything until we get a time stamp - state = m_StreamState; - break; - } - else { - state = CheckSampleTimes(&rtBufferStart, &rtBufferStop); - if(state == STREAM_FLOWING) - break; - - // we aren't supposed to send this, but we've been - // told to send one more than we were supposed to - // (and the stop isn't still pending and we're streaming) - if(m_bStopSendExtra && !m_bStopExtraSent && - m_tStopTime == MAX_TIME && - m_FilterState != State_Stopped) { - m_bStopExtraSent = TRUE; - DbgLog((LOG_TRACE,2,TEXT("%d sending an EXTRA frame"), - m_dwStopCookie)); - state = STREAM_FLOWING; - break; - } - } - - // We're in discarding mode - - // If we've no clock, discard as fast as we can - if(!m_pRefClock) { - break; - - // If we're paused, we can't discard in a timely manner because - // there's no such thing as stream times. We must block until - // we run or stop, or we'll end up throwing the whole stream away - // as quickly as possible - } - else if(m_FilterState == State_Paused) { - lWait = INFINITE; - - } - else { - // wait until it's time for the sample until we say "discard" - // ("discard in a timely fashion") - REFERENCE_TIME rtNow; - EXECUTE_ASSERT(SUCCEEDED(m_pRefClock->GetTime(&rtNow))); - rtNow -= m_tRunStart; // Into relative ref-time - lWait = LONG((rtBufferStart - rtNow)/10000); // 100ns -> ms - if(lWait < 10) break; // Not worth waiting - discard early - } - - } while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT); - - return state; -} - - -void CBaseStreamControl::NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart ) { - CAutoLock lck(&m_CritSec); - - // or we will get confused - if(m_FilterState == new_state) - return; - - switch(new_state) { - case State_Stopped: - - DbgLog((LOG_TRACE,2,TEXT("Filter is STOPPED"))); - - // execute any pending starts and stops in the right order, - // to make sure all notifications get sent, and we end up - // in the right state to begin next time (??? why not?) - - if(m_tStartTime != MAX_TIME && m_tStopTime == MAX_TIME) { - ExecuteStart(); - } - else if(m_tStopTime != MAX_TIME && m_tStartTime == MAX_TIME) { - ExecuteStop(); - } - else if(m_tStopTime != MAX_TIME && m_tStartTime != MAX_TIME) { - if(m_tStartTime <= m_tStopTime) { - ExecuteStart(); - ExecuteStop(); - } - else { - ExecuteStop(); - ExecuteStart(); - } - } - // always start off flowing when the graph starts streaming - // unless told otherwise - m_StreamState = STREAM_FLOWING; - m_FilterState = new_state; - break; - - case State_Running: - - DbgLog((LOG_TRACE,2,TEXT("Filter is RUNNING"))); - - m_tRunStart = tStart; - // fall-through - - default: // case State_Paused: - m_FilterState = new_state; - } - // unblock! - m_StreamEvent.Set(); -} - - -void CBaseStreamControl::Flushing(BOOL bInProgress) { - CAutoLock lck(&m_CritSec); - m_bIsFlushing = bInProgress; - m_StreamEvent.Set(); -} - +//------------------------------------------------------------------------------ +// File: StrmCtl.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + +CBaseStreamControl::CBaseStreamControl() +: m_StreamState(STREAM_FLOWING) +, m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop +, m_tStartTime(MAX_TIME) +, m_tStopTime(MAX_TIME) +, m_dwStartCookie(0) +, m_dwStopCookie(0) +, m_pRefClock(NULL) +, m_FilterState(State_Stopped) +, m_bIsFlushing(FALSE) +, m_bStopSendExtra(FALSE) { +} + +CBaseStreamControl::~CBaseStreamControl() { + // Make sure we release the clock. + SetSyncSource(NULL); + return; +} + + +STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSendExtra, DWORD dwCookie) { + CAutoLock lck(&m_CritSec); + m_bStopSendExtra = FALSE; // reset + m_bStopExtraSent = FALSE; + if(ptStop) { + if(*ptStop == MAX_TIME) { + DbgLog((LOG_TRACE,2,TEXT("StopAt: Cancel stop"))); + CancelStop(); + // If there's now a command to start in the future, we assume + // they want to be stopped when the graph is first run + if(m_FilterState == State_Stopped && m_tStartTime < MAX_TIME) { + m_StreamState = STREAM_DISCARDING; + DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING"))); + } + return NOERROR; + } + DbgLog((LOG_TRACE,2,TEXT("StopAt: %dms extra=%d"), + (int)(*ptStop/10000), bSendExtra)); + // if the first command is to stop in the future, then we assume they + // want to be started when the graph is first run + if(m_FilterState == State_Stopped && m_tStartTime > *ptStop) { + m_StreamState = STREAM_FLOWING; + DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING"))); + } + m_bStopSendExtra = bSendExtra; + m_tStopTime = *ptStop; + m_dwStopCookie = dwCookie; + m_StreamStateOnStop = STREAM_DISCARDING; + } + else { + DbgLog((LOG_TRACE,2,TEXT("StopAt: now"))); + // sending an extra frame when told to stop now would mess people up + m_bStopSendExtra = FALSE; + m_tStopTime = MAX_TIME; + m_dwStopCookie = 0; + m_StreamState = STREAM_DISCARDING; + m_StreamStateOnStop = STREAM_FLOWING; // no pending stop + } + // we might change our mind what to do with a sample we're blocking + m_StreamEvent.Set(); + return NOERROR; +} + + +STDMETHODIMP CBaseStreamControl::StartAt +( const REFERENCE_TIME *ptStart, DWORD dwCookie ) { + CAutoLock lck(&m_CritSec); + if(ptStart) { + if(*ptStart == MAX_TIME) { + DbgLog((LOG_TRACE,2,TEXT("StartAt: Cancel start"))); + CancelStart(); + // If there's now a command to stop in the future, we assume + // they want to be started when the graph is first run + if(m_FilterState == State_Stopped && m_tStopTime < MAX_TIME) { + DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING"))); + m_StreamState = STREAM_FLOWING; + } + return NOERROR; + } + DbgLog((LOG_TRACE,2,TEXT("StartAt: %dms"), (int)(*ptStart/10000))); + // if the first command is to start in the future, then we assume they + // want to be stopped when the graph is first run + if(m_FilterState == State_Stopped && m_tStopTime >= *ptStart) { + DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING"))); + m_StreamState = STREAM_DISCARDING; + } + m_tStartTime = *ptStart; + m_dwStartCookie = dwCookie; + // if (m_tStopTime == m_tStartTime) CancelStop(); + } + else { + DbgLog((LOG_TRACE,2,TEXT("StartAt: now"))); + m_tStartTime = MAX_TIME; + m_dwStartCookie = 0; + m_StreamState = STREAM_FLOWING; + } + // we might change our mind what to do with a sample we're blocking + m_StreamEvent.Set(); + return NOERROR; +} + + +// Retrieve information about current settings +STDMETHODIMP CBaseStreamControl::GetInfo(AM_STREAM_INFO *pInfo) { + if(pInfo == NULL) + return E_POINTER; + + pInfo->tStart = m_tStartTime; + pInfo->tStop = m_tStopTime; + pInfo->dwStartCookie = m_dwStartCookie; + pInfo->dwStopCookie = m_dwStopCookie; + pInfo->dwFlags = m_bStopSendExtra ? AM_STREAM_INFO_STOP_SEND_EXTRA : 0; + pInfo->dwFlags |= m_tStartTime == MAX_TIME ? 0 : AM_STREAM_INFO_START_DEFINED; + pInfo->dwFlags |= m_tStopTime == MAX_TIME ? 0 : AM_STREAM_INFO_STOP_DEFINED; + switch(m_StreamState) { + default: + DbgBreak("Invalid stream state"); + case STREAM_FLOWING: + break; + case STREAM_DISCARDING: + pInfo->dwFlags |= AM_STREAM_INFO_DISCARDING; + break; + } + return S_OK; +} + + +void CBaseStreamControl::ExecuteStop() { + ASSERT(CritCheckIn(&m_CritSec)); + m_StreamState = m_StreamStateOnStop; + if(m_dwStopCookie && m_pSink) { + DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STOPPED (%d)"), + m_dwStopCookie)); + m_pSink->Notify(EC_STREAM_CONTROL_STOPPED, (LONG_PTR)this, m_dwStopCookie); + } + CancelStop(); // This will do the tidy up +} + +void CBaseStreamControl::ExecuteStart() { + ASSERT(CritCheckIn(&m_CritSec)); + m_StreamState = STREAM_FLOWING; + if(m_dwStartCookie) { + DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STARTED (%d)"), + m_dwStartCookie)); + m_pSink->Notify(EC_STREAM_CONTROL_STARTED, (LONG_PTR)this, m_dwStartCookie); + } + CancelStart(); // This will do the tidy up +} + +void CBaseStreamControl::CancelStop() { + ASSERT(CritCheckIn(&m_CritSec)); + m_tStopTime = MAX_TIME; + m_dwStopCookie = 0; + m_StreamStateOnStop = STREAM_FLOWING; +} + +void CBaseStreamControl::CancelStart() { + ASSERT(CritCheckIn(&m_CritSec)); + m_tStartTime = MAX_TIME; + m_dwStartCookie = 0; +} + + +// This guy will return one of the three StreamControlState's. Here's what the caller +// should do for each one: +// +// STREAM_FLOWING: Proceed as usual (render or pass the sample on) +// STREAM_DISCARDING: Calculate the time 'til *pSampleStart and wait that long +// for the event handle (GetStreamEventHandle()). If the +// wait expires, throw the sample away. If the event +// fires, call me back, I've changed my mind. +// I use pSampleStart (not Stop) so that live sources don't +// block for the duration of their samples, since the clock +// will always read approximately pSampleStart when called + + +// All through this code, you'll notice the following rules: +// - When start and stop time are the same, it's as if start was first +// - An event is considered inside the sample when it's >= sample start time +// but < sample stop time +// - if any part of the sample is supposed to be sent, we'll send the whole +// thing since we don't break it into smaller pieces +// - If we skip over a start or stop without doing it, we still signal the event +// and reset ourselves in case somebody's waiting for the event, and to make +// sure we notice that the event is past and should be forgotten +// Here are the 19 cases that have to be handled (x=start o=stop <-->=sample): +// +// 1. xo<--> start then stop +// 2. ox<--> stop then start +// 3. x start +// 4. o stop then start +// 5. x<-->o start +// 6. o<-->x stop +// 7. o start +// 8. x no change +// 9. start +// 10. stop then start +// 11. <-->xo no change +// 12. <-->ox no change +// 13. x<--> start +// 14. start +// 15. <-->x no change +// 16. o<--> stop +// 17. no change +// 18. <-->o no change +// 19. <--> no change + + +enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes +( const REFERENCE_TIME * pSampleStart, const REFERENCE_TIME * pSampleStop ) { + CAutoLock lck(&m_CritSec); + + ASSERT(!m_bIsFlushing); + ASSERT(pSampleStart && pSampleStop); + + // Don't ask how I came up with the code below to handle all 19 cases... + if(m_tStopTime >= *pSampleStart) { + if(m_tStartTime >= *pSampleStop) + return m_StreamState; // cases 8 11 12 15 17 18 19 + + if(m_tStopTime < m_tStartTime) + ExecuteStop(); // case 10 + + ExecuteStart(); // cases 3 5 7 9 13 14 + return m_StreamState; + } + + if(m_tStartTime >= *pSampleStop) { + ExecuteStop(); // cases 6 16 + return m_StreamState; + } + + if(m_tStartTime <= m_tStopTime) { + ExecuteStart(); + ExecuteStop(); + } + else { + ExecuteStop(); + ExecuteStart(); + } + + return m_StreamState; // case 1, 2, or 4 +} + + +enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckStreamState( IMediaSample * pSample ) { + + REFERENCE_TIME rtBufferStart, rtBufferStop; + const BOOL bNoBufferTimes = + pSample == NULL || + FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop)); + + StreamControlState state; + LONG lWait; + + do { + // something has to break out of the blocking + if(m_bIsFlushing || m_FilterState == State_Stopped) + return STREAM_DISCARDING; + + if(bNoBufferTimes) { + // Can't do anything until we get a time stamp + state = m_StreamState; + break; + } + else { + state = CheckSampleTimes(&rtBufferStart, &rtBufferStop); + if(state == STREAM_FLOWING) + break; + + // we aren't supposed to send this, but we've been + // told to send one more than we were supposed to + // (and the stop isn't still pending and we're streaming) + if(m_bStopSendExtra && !m_bStopExtraSent && + m_tStopTime == MAX_TIME && + m_FilterState != State_Stopped) { + m_bStopExtraSent = TRUE; + DbgLog((LOG_TRACE,2,TEXT("%d sending an EXTRA frame"), + m_dwStopCookie)); + state = STREAM_FLOWING; + break; + } + } + + // We're in discarding mode + + // If we've no clock, discard as fast as we can + if(!m_pRefClock) { + break; + + // If we're paused, we can't discard in a timely manner because + // there's no such thing as stream times. We must block until + // we run or stop, or we'll end up throwing the whole stream away + // as quickly as possible + } + else if(m_FilterState == State_Paused) { + lWait = INFINITE; + + } + else { + // wait until it's time for the sample until we say "discard" + // ("discard in a timely fashion") + REFERENCE_TIME rtNow; + EXECUTE_ASSERT(SUCCEEDED(m_pRefClock->GetTime(&rtNow))); + rtNow -= m_tRunStart; // Into relative ref-time + lWait = LONG((rtBufferStart - rtNow)/10000); // 100ns -> ms + if(lWait < 10) break; // Not worth waiting - discard early + } + + } while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT); + + return state; +} + + +void CBaseStreamControl::NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart ) { + CAutoLock lck(&m_CritSec); + + // or we will get confused + if(m_FilterState == new_state) + return; + + switch(new_state) { + case State_Stopped: + + DbgLog((LOG_TRACE,2,TEXT("Filter is STOPPED"))); + + // execute any pending starts and stops in the right order, + // to make sure all notifications get sent, and we end up + // in the right state to begin next time (??? why not?) + + if(m_tStartTime != MAX_TIME && m_tStopTime == MAX_TIME) { + ExecuteStart(); + } + else if(m_tStopTime != MAX_TIME && m_tStartTime == MAX_TIME) { + ExecuteStop(); + } + else if(m_tStopTime != MAX_TIME && m_tStartTime != MAX_TIME) { + if(m_tStartTime <= m_tStopTime) { + ExecuteStart(); + ExecuteStop(); + } + else { + ExecuteStop(); + ExecuteStart(); + } + } + // always start off flowing when the graph starts streaming + // unless told otherwise + m_StreamState = STREAM_FLOWING; + m_FilterState = new_state; + break; + + case State_Running: + + DbgLog((LOG_TRACE,2,TEXT("Filter is RUNNING"))); + + m_tRunStart = tStart; + // fall-through + + default: // case State_Paused: + m_FilterState = new_state; + } + // unblock! + m_StreamEvent.Set(); +} + + +void CBaseStreamControl::Flushing(BOOL bInProgress) { + CAutoLock lck(&m_CritSec); + m_bIsFlushing = bInProgress; + m_StreamEvent.Set(); +} + diff --git a/src/BaseClasses/strmctl.h b/src/BaseClasses/strmctl.h index 082731ddc8..edb4d78380 100644 --- a/src/BaseClasses/strmctl.h +++ b/src/BaseClasses/strmctl.h @@ -1,158 +1,158 @@ -//------------------------------------------------------------------------------ -// File: StrmCtl.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __strmctl_h__ -#define __strmctl_h__ - -class CBaseStreamControl : public IAMStreamControl -{ -public: - // Used by the implementation - enum StreamControlState - { STREAM_FLOWING = 0x1000, - STREAM_DISCARDING - }; - -private: - enum StreamControlState m_StreamState; // Current stream state - enum StreamControlState m_StreamStateOnStop; // State after next stop - // (i.e.Blocking or Discarding) - - REFERENCE_TIME m_tStartTime; // MAX_TIME implies none - REFERENCE_TIME m_tStopTime; // MAX_TIME implies none - DWORD m_dwStartCookie; // Cookie for notification to app - DWORD m_dwStopCookie; // Cookie for notification to app - volatile BOOL m_bIsFlushing; // No optimization pls! - volatile BOOL m_bStopSendExtra; // bSendExtra was set - volatile BOOL m_bStopExtraSent; // the extra one was sent - - CCritSec m_CritSec; // CritSec to guard above attributes - - // Event to fire when we can come - // out of blocking, or to come out of waiting - // to discard if we change our minds. - // - CAMEvent m_StreamEvent; - - // All of these methods execute immediately. Helpers for others. - // - void ExecuteStop(); - void ExecuteStart(); - void CancelStop(); - void CancelStart(); - - // Some things we need to be told by our owning filter - // Your pin must also expose IAMStreamControl when QI'd for it! - // - IReferenceClock * m_pRefClock; // Need it to set advises - // Filter must tell us via - // SetSyncSource - IMediaEventSink * m_pSink; // Event sink - // Filter must tell us after it - // creates it in JoinFilterGraph() - FILTER_STATE m_FilterState; // Just need it! - // Filter must tell us via - // NotifyFilterState - REFERENCE_TIME m_tRunStart; // Per the Run call to the filter - - // This guy will return one of the three StreamControlState's. Here's what - // the caller should do for each one: - // - // STREAM_FLOWING: Proceed as usual (render or pass the sample on) - // STREAM_DISCARDING: Calculate the time 'til *pSampleStop and wait - // that long for the event handle - // (GetStreamEventHandle()). If the wait - // expires, throw the sample away. If the event - // fires, call me back - I've changed my mind. - // - enum StreamControlState CheckSampleTimes( const REFERENCE_TIME * pSampleStart, - const REFERENCE_TIME * pSampleStop ); - -public: - // You don't have to tell us much when we're created, but there are other - // obligations that must be met. See SetSyncSource & NotifyFilterState - // below. - // - CBaseStreamControl(); - ~CBaseStreamControl(); - - // If you want this class to work properly, there are thing you need to - // (keep) telling it. Filters with pins that use this class - // should ensure that they pass through to this method any calls they - // receive on their SetSyncSource. - - // We need a clock to see what time it is. This is for the - // "discard in a timely fashion" logic. If we discard everything as - // quick as possible, a whole 60 minute file could get discarded in the - // first 10 seconds, and if somebody wants to turn streaming on at 30 - // minutes into the file, and they make the call more than a few seconds - // after the graph is run, it may be too late! - // So we hold every sample until it's time has gone, then we discard it. - // The filter should call this when it gets a SetSyncSource - // - void SetSyncSource( IReferenceClock * pRefClock ) - { - CAutoLock lck(&m_CritSec); - if (m_pRefClock) m_pRefClock->Release(); - m_pRefClock = pRefClock; - if (m_pRefClock) - m_pRefClock->AddRef(); - } - - // Set event sink for notifications - // The filter should call this in its JoinFilterGraph after it creates the - // IMediaEventSink - // - void SetFilterGraph( IMediaEventSink *pSink ) { - m_pSink = pSink; - } - - // Since we schedule in stream time, we need the tStart and must track the - // state of our owning filter. - // The app should call this ever state change - // - void NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart = 0 ); - - // Filter should call Flushing(TRUE) in BeginFlush, - // and Flushing(FALSE) in EndFlush. - // - void Flushing( BOOL bInProgress ); - - - // The two main methods of IAMStreamControl - - // Class adds default values suitable for immediate - // muting and unmuting of the stream. - - STDMETHODIMP StopAt( const REFERENCE_TIME * ptStop = NULL, - BOOL bSendExtra = FALSE, - DWORD dwCookie = 0 ); - STDMETHODIMP StartAt( const REFERENCE_TIME * ptStart = NULL, - DWORD dwCookie = 0 ); - STDMETHODIMP GetInfo( AM_STREAM_INFO *pInfo); - - // Helper function for pin's receive method. Call this with - // the sample and we'll tell you what to do with it. We'll do a - // WaitForSingleObject within this call if one is required. This is - // a "What should I do with this sample?" kind of call. We'll tell the - // caller to either flow it or discard it. - // If pSample is NULL we evaluate based on the current state - // settings - enum StreamControlState CheckStreamState( IMediaSample * pSample ); - -private: - // These don't require locking, but we are relying on the fact that - // m_StreamState can be retrieved with integrity, and is a snap shot that - // may have just been, or may be just about to be, changed. - HANDLE GetStreamEventHandle() const { return m_StreamEvent; } - enum StreamControlState GetStreamState() const { return m_StreamState; } - BOOL IsStreaming() const { return m_StreamState == STREAM_FLOWING; } -}; - -#endif +//------------------------------------------------------------------------------ +// File: StrmCtl.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1996-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __strmctl_h__ +#define __strmctl_h__ + +class CBaseStreamControl : public IAMStreamControl +{ +public: + // Used by the implementation + enum StreamControlState + { STREAM_FLOWING = 0x1000, + STREAM_DISCARDING + }; + +private: + enum StreamControlState m_StreamState; // Current stream state + enum StreamControlState m_StreamStateOnStop; // State after next stop + // (i.e.Blocking or Discarding) + + REFERENCE_TIME m_tStartTime; // MAX_TIME implies none + REFERENCE_TIME m_tStopTime; // MAX_TIME implies none + DWORD m_dwStartCookie; // Cookie for notification to app + DWORD m_dwStopCookie; // Cookie for notification to app + volatile BOOL m_bIsFlushing; // No optimization pls! + volatile BOOL m_bStopSendExtra; // bSendExtra was set + volatile BOOL m_bStopExtraSent; // the extra one was sent + + CCritSec m_CritSec; // CritSec to guard above attributes + + // Event to fire when we can come + // out of blocking, or to come out of waiting + // to discard if we change our minds. + // + CAMEvent m_StreamEvent; + + // All of these methods execute immediately. Helpers for others. + // + void ExecuteStop(); + void ExecuteStart(); + void CancelStop(); + void CancelStart(); + + // Some things we need to be told by our owning filter + // Your pin must also expose IAMStreamControl when QI'd for it! + // + IReferenceClock * m_pRefClock; // Need it to set advises + // Filter must tell us via + // SetSyncSource + IMediaEventSink * m_pSink; // Event sink + // Filter must tell us after it + // creates it in JoinFilterGraph() + FILTER_STATE m_FilterState; // Just need it! + // Filter must tell us via + // NotifyFilterState + REFERENCE_TIME m_tRunStart; // Per the Run call to the filter + + // This guy will return one of the three StreamControlState's. Here's what + // the caller should do for each one: + // + // STREAM_FLOWING: Proceed as usual (render or pass the sample on) + // STREAM_DISCARDING: Calculate the time 'til *pSampleStop and wait + // that long for the event handle + // (GetStreamEventHandle()). If the wait + // expires, throw the sample away. If the event + // fires, call me back - I've changed my mind. + // + enum StreamControlState CheckSampleTimes( const REFERENCE_TIME * pSampleStart, + const REFERENCE_TIME * pSampleStop ); + +public: + // You don't have to tell us much when we're created, but there are other + // obligations that must be met. See SetSyncSource & NotifyFilterState + // below. + // + CBaseStreamControl(); + ~CBaseStreamControl(); + + // If you want this class to work properly, there are thing you need to + // (keep) telling it. Filters with pins that use this class + // should ensure that they pass through to this method any calls they + // receive on their SetSyncSource. + + // We need a clock to see what time it is. This is for the + // "discard in a timely fashion" logic. If we discard everything as + // quick as possible, a whole 60 minute file could get discarded in the + // first 10 seconds, and if somebody wants to turn streaming on at 30 + // minutes into the file, and they make the call more than a few seconds + // after the graph is run, it may be too late! + // So we hold every sample until it's time has gone, then we discard it. + // The filter should call this when it gets a SetSyncSource + // + void SetSyncSource( IReferenceClock * pRefClock ) + { + CAutoLock lck(&m_CritSec); + if (m_pRefClock) m_pRefClock->Release(); + m_pRefClock = pRefClock; + if (m_pRefClock) + m_pRefClock->AddRef(); + } + + // Set event sink for notifications + // The filter should call this in its JoinFilterGraph after it creates the + // IMediaEventSink + // + void SetFilterGraph( IMediaEventSink *pSink ) { + m_pSink = pSink; + } + + // Since we schedule in stream time, we need the tStart and must track the + // state of our owning filter. + // The app should call this ever state change + // + void NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart = 0 ); + + // Filter should call Flushing(TRUE) in BeginFlush, + // and Flushing(FALSE) in EndFlush. + // + void Flushing( BOOL bInProgress ); + + + // The two main methods of IAMStreamControl + + // Class adds default values suitable for immediate + // muting and unmuting of the stream. + + STDMETHODIMP StopAt( const REFERENCE_TIME * ptStop = NULL, + BOOL bSendExtra = FALSE, + DWORD dwCookie = 0 ); + STDMETHODIMP StartAt( const REFERENCE_TIME * ptStart = NULL, + DWORD dwCookie = 0 ); + STDMETHODIMP GetInfo( AM_STREAM_INFO *pInfo); + + // Helper function for pin's receive method. Call this with + // the sample and we'll tell you what to do with it. We'll do a + // WaitForSingleObject within this call if one is required. This is + // a "What should I do with this sample?" kind of call. We'll tell the + // caller to either flow it or discard it. + // If pSample is NULL we evaluate based on the current state + // settings + enum StreamControlState CheckStreamState( IMediaSample * pSample ); + +private: + // These don't require locking, but we are relying on the fact that + // m_StreamState can be retrieved with integrity, and is a snap shot that + // may have just been, or may be just about to be, changed. + HANDLE GetStreamEventHandle() const { return m_StreamEvent; } + enum StreamControlState GetStreamState() const { return m_StreamState; } + BOOL IsStreaming() const { return m_StreamState == STREAM_FLOWING; } +}; + +#endif diff --git a/src/BaseClasses/sysclock.cpp b/src/BaseClasses/sysclock.cpp index 218c935519..b07a2e5cbb 100644 --- a/src/BaseClasses/sysclock.cpp +++ b/src/BaseClasses/sysclock.cpp @@ -1,75 +1,75 @@ -//------------------------------------------------------------------------------ -// File: SysClock.cpp -// -// Desc: DirectShow base classes - implements a system clock based on -// IReferenceClock. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - -/*NABIL: I changed this*/ -//#ifdef FILTER_DLL - -/* List of class IDs and creator functions for the class factory. This - provides the link between the OLE entry point in the DLL and an object - being created. The class factory will call the static CreateInstance - function when it is asked to create a CLSID_SystemClock object */ - -/*NABIL: This was screwed up....(It didn't have the "blah")*/ -CFactoryTemplate g_Templates[1] = { - { (const WCHAR *) "blah", &CLSID_SystemClock, CSystemClock::CreateInstance } -}; - -int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); -//#endif - -/* This goes in the factory template table to create new instances */ -CUnknown * WINAPI CSystemClock::CreateInstance(LPUNKNOWN pUnk,HRESULT *phr) -{ - return new CSystemClock(NAME("System reference clock"),pUnk, phr); -} - - -CSystemClock::CSystemClock(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *phr) : - CBaseReferenceClock(pName, pUnk, phr) -{ -} - -STDMETHODIMP CSystemClock::NonDelegatingQueryInterface( - REFIID riid, - void ** ppv) -{ - if (riid == IID_IPersist) - { - return GetInterface(static_cast(this), ppv); - } - else if (riid == IID_IAMClockAdjust) - { - return GetInterface(static_cast(this), ppv); - } - else - { - return CBaseReferenceClock::NonDelegatingQueryInterface(riid, ppv); - } -} - -/* Return the clock's clsid */ -STDMETHODIMP -CSystemClock::GetClassID(CLSID *pClsID) -{ - CheckPointer(pClsID,E_POINTER); - ValidateReadWritePtr(pClsID,sizeof(CLSID)); - *pClsID = CLSID_SystemClock; - return NOERROR; -} - - -STDMETHODIMP -CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta) -{ - return SetTimeDelta(rtDelta); -} +//------------------------------------------------------------------------------ +// File: SysClock.cpp +// +// Desc: DirectShow base classes - implements a system clock based on +// IReferenceClock. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + +/*NABIL: I changed this*/ +//#ifdef FILTER_DLL + +/* List of class IDs and creator functions for the class factory. This + provides the link between the OLE entry point in the DLL and an object + being created. The class factory will call the static CreateInstance + function when it is asked to create a CLSID_SystemClock object */ + +/*NABIL: This was screwed up....(It didn't have the "blah")*/ +CFactoryTemplate g_Templates[1] = { + { (const WCHAR *) "blah", &CLSID_SystemClock, CSystemClock::CreateInstance } +}; + +int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); +//#endif + +/* This goes in the factory template table to create new instances */ +CUnknown * WINAPI CSystemClock::CreateInstance(LPUNKNOWN pUnk,HRESULT *phr) +{ + return new CSystemClock(NAME("System reference clock"),pUnk, phr); +} + + +CSystemClock::CSystemClock(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *phr) : + CBaseReferenceClock(pName, pUnk, phr) +{ +} + +STDMETHODIMP CSystemClock::NonDelegatingQueryInterface( + REFIID riid, + void ** ppv) +{ + if (riid == IID_IPersist) + { + return GetInterface(static_cast(this), ppv); + } + else if (riid == IID_IAMClockAdjust) + { + return GetInterface(static_cast(this), ppv); + } + else + { + return CBaseReferenceClock::NonDelegatingQueryInterface(riid, ppv); + } +} + +/* Return the clock's clsid */ +STDMETHODIMP +CSystemClock::GetClassID(CLSID *pClsID) +{ + CheckPointer(pClsID,E_POINTER); + ValidateReadWritePtr(pClsID,sizeof(CLSID)); + *pClsID = CLSID_SystemClock; + return NOERROR; +} + + +STDMETHODIMP +CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta) +{ + return SetTimeDelta(rtDelta); +} diff --git a/src/BaseClasses/sysclock.h b/src/BaseClasses/sysclock.h index 2b09cc3247..3fe707b740 100644 --- a/src/BaseClasses/sysclock.h +++ b/src/BaseClasses/sysclock.h @@ -1,39 +1,39 @@ -//------------------------------------------------------------------------------ -// File: SysClock.h -// -// Desc: DirectShow base classes - defines a system clock implementation of -// IReferenceClock. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __SYSTEMCLOCK__ -#define __SYSTEMCLOCK__ - -// -// Base clock. Uses timeGetTime ONLY -// Uses most of the code in the base reference clock. -// Provides GetTime -// - -class CSystemClock : public CBaseReferenceClock, public IAMClockAdjust, public IPersist -{ -public: - // We must be able to create an instance of ourselves - static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); - CSystemClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr); - - DECLARE_IUNKNOWN - - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv); - - // Yield up our class id so that we can be persisted - // Implement required Ipersist method - STDMETHODIMP GetClassID(CLSID *pClsID); - - // IAMClockAdjust methods - STDMETHODIMP SetClockDelta(REFERENCE_TIME rtDelta); -}; //CSystemClock - -#endif /* __SYSTEMCLOCK__ */ +//------------------------------------------------------------------------------ +// File: SysClock.h +// +// Desc: DirectShow base classes - defines a system clock implementation of +// IReferenceClock. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __SYSTEMCLOCK__ +#define __SYSTEMCLOCK__ + +// +// Base clock. Uses timeGetTime ONLY +// Uses most of the code in the base reference clock. +// Provides GetTime +// + +class CSystemClock : public CBaseReferenceClock, public IAMClockAdjust, public IPersist +{ +public: + // We must be able to create an instance of ourselves + static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); + CSystemClock(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr); + + DECLARE_IUNKNOWN + + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void ** ppv); + + // Yield up our class id so that we can be persisted + // Implement required Ipersist method + STDMETHODIMP GetClassID(CLSID *pClsID); + + // IAMClockAdjust methods + STDMETHODIMP SetClockDelta(REFERENCE_TIME rtDelta); +}; //CSystemClock + +#endif /* __SYSTEMCLOCK__ */ diff --git a/src/BaseClasses/transfrm.cpp b/src/BaseClasses/transfrm.cpp index e1e670628e..9e328c9e6e 100644 --- a/src/BaseClasses/transfrm.cpp +++ b/src/BaseClasses/transfrm.cpp @@ -1,974 +1,974 @@ -//------------------------------------------------------------------------------ -// File: Transfrm.cpp -// -// Desc: DirectShow base classes - implements class for simple transform -// filters such as video decompressors. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include - - -// ================================================================= -// Implements the CTransformFilter class -// ================================================================= - -CTransformFilter::CTransformFilter(TCHAR *pName, - LPUNKNOWN pUnk, - REFCLSID clsid) : - CBaseFilter(pName,pUnk,&m_csFilter, clsid), - m_pInput(NULL), - m_pOutput(NULL), - m_bEOSDelivered(FALSE), - m_bQualityChanged(FALSE), - m_bSampleSkipped(FALSE) { -#ifdef PERF - RegisterPerfId(); -#endif // PERF -} - -#ifdef UNICODE -CTransformFilter::CTransformFilter(char *pName, - LPUNKNOWN pUnk, - REFCLSID clsid) : - CBaseFilter(pName,pUnk,&m_csFilter, clsid), - m_pInput(NULL), - m_pOutput(NULL), - m_bEOSDelivered(FALSE), - m_bQualityChanged(FALSE), - m_bSampleSkipped(FALSE) { -#ifdef PERF - RegisterPerfId(); -#endif // PERF -} -#endif - -// destructor - -CTransformFilter::~CTransformFilter() { - // Delete the pins - - delete m_pInput; - delete m_pOutput; -} - - -// Transform place holder - should never be called -HRESULT CTransformFilter::Transform(IMediaSample * pIn, IMediaSample *pOut) { - UNREFERENCED_PARAMETER(pIn); - UNREFERENCED_PARAMETER(pOut); - DbgBreak("CTransformFilter::Transform() should never be called"); - return E_UNEXPECTED; -} - - -// return the number of pins we provide - -int CTransformFilter::GetPinCount() { - return 2; -} - - -// return a non-addrefed CBasePin * for the user to addref if he holds onto it -// for longer than his pointer to us. We create the pins dynamically when they -// are asked for rather than in the constructor. This is because we want to -// give the derived class an oppportunity to return different pin objects - -// We return the objects as and when they are needed. If either of these fails -// then we return NULL, the assumption being that the caller will realise the -// whole deal is off and destroy us - which in turn will delete everything. - -CBasePin * -CTransformFilter::GetPin(int n) { - HRESULT hr = S_OK; - - // Create an input pin if necessary - - if(m_pInput == NULL) { - - m_pInput = new CTransformInputPin(NAME("Transform input pin"), - this, // Owner filter - &hr, // Result code - L"XForm In"); // Pin name - - - // Can't fail - ASSERT(SUCCEEDED(hr)); - if(m_pInput == NULL) { - return NULL; - } - m_pOutput = (CTransformOutputPin *) - new CTransformOutputPin(NAME("Transform output pin"), - this, // Owner filter - &hr, // Result code - L"XForm Out"); // Pin name - - - // Can't fail - ASSERT(SUCCEEDED(hr)); - if(m_pOutput == NULL) { - delete m_pInput; - m_pInput = NULL; - } - } - - // Return the appropriate pin - - if(n == 0) { - return m_pInput; - } - else - if(n == 1) { - return m_pOutput; - } - else { - return NULL; - } -} - - -// -// FindPin -// -// If Id is In or Out then return the IPin* for that pin -// creating the pin if need be. Otherwise return NULL with an error. - -STDMETHODIMP CTransformFilter::FindPin(LPCWSTR Id, IPin **ppPin) { - CheckPointer(ppPin,E_POINTER); - ValidateReadWritePtr(ppPin,sizeof(IPin *)); - - if(0==lstrcmpW(Id,L"In")) { - *ppPin = GetPin(0); - } - else if(0==lstrcmpW(Id,L"Out")) { - *ppPin = GetPin(1); - } - else { - *ppPin = NULL; - return VFW_E_NOT_FOUND; - } - - HRESULT hr = NOERROR; - // AddRef() returned pointer - but GetPin could fail if memory is low. - if(*ppPin) { - (*ppPin)->AddRef(); - } - else { - hr = E_OUTOFMEMORY; // probably. There's no pin anyway. - } - return hr; -} - - -// override these two functions if you want to inform something -// about entry to or exit from streaming state. - -HRESULT -CTransformFilter::StartStreaming() { - return NOERROR; -} - - -HRESULT -CTransformFilter::StopStreaming() { - return NOERROR; -} - - -// override this to grab extra interfaces on connection - -HRESULT -CTransformFilter::CheckConnect(PIN_DIRECTION dir,IPin *pPin) { - UNREFERENCED_PARAMETER(dir); - UNREFERENCED_PARAMETER(pPin); - return NOERROR; -} - - -// place holder to allow derived classes to release any extra interfaces - -HRESULT -CTransformFilter::BreakConnect(PIN_DIRECTION dir) { - UNREFERENCED_PARAMETER(dir); - return NOERROR; -} - - -// Let derived classes know about connection completion - -HRESULT -CTransformFilter::CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin) { - UNREFERENCED_PARAMETER(direction); - UNREFERENCED_PARAMETER(pReceivePin); - return NOERROR; -} - - -// override this to know when the media type is really set - -HRESULT -CTransformFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt) { - UNREFERENCED_PARAMETER(direction); - UNREFERENCED_PARAMETER(pmt); - return NOERROR; -} - - -// Set up our output sample -HRESULT -CTransformFilter::InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample) { - IMediaSample *pOutSample; - - // default - times are the same - - AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); - DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0; - - // This will prevent the image renderer from switching us to DirectDraw - // when we can't do it without skipping frames because we're not on a - // keyframe. If it really has to switch us, it still will, but then we - // will have to wait for the next keyframe - if(!(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) { - dwFlags |= AM_GBF_NOTASYNCPOINT; - } - - ASSERT(m_pOutput->m_pAllocator != NULL); - HRESULT hr = m_pOutput->m_pAllocator->GetBuffer(&pOutSample - , pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID ? - &pProps->tStart : NULL - , pProps->dwSampleFlags & AM_SAMPLE_STOPVALID ? - &pProps->tStop : NULL - , dwFlags); - *ppOutSample = pOutSample; - if(FAILED(hr)) { - return hr; - } - - ASSERT(pOutSample); - IMediaSample2 *pOutSample2; - if(SUCCEEDED(pOutSample->QueryInterface(IID_IMediaSample2, - (void **)&pOutSample2))) { - /* Modify it */ - AM_SAMPLE2_PROPERTIES OutProps; - EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps))); - OutProps.dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; - OutProps.dwSampleFlags = - (OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) | - (pProps->dwSampleFlags & ~AM_SAMPLE_TYPECHANGED); - - OutProps.tStart = pProps->tStart; - OutProps.tStop = pProps->tStop; - OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId); - - hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), - (PBYTE)&OutProps); - if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) { - m_bSampleSkipped = FALSE; - } - pOutSample2->Release(); - } - else { - if(pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) { - pOutSample->SetTime(&pProps->tStart, - &pProps->tStop); - } - if(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT) { - pOutSample->SetSyncPoint(TRUE); - } - if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) { - pOutSample->SetDiscontinuity(TRUE); - m_bSampleSkipped = FALSE; - } - // Copy the media times - - LONGLONG MediaStart, MediaEnd; - if(pSample->GetMediaTime(&MediaStart,&MediaEnd) == NOERROR) { - pOutSample->SetMediaTime(&MediaStart,&MediaEnd); - } - } - return S_OK; -} - -// override this to customize the transform process - -HRESULT -CTransformFilter::Receive(IMediaSample *pSample) { - /* Check for other streams and pass them on */ - AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); - if(pProps->dwStreamId != AM_STREAM_MEDIA) { - return m_pOutput->m_pInputPin->Receive(pSample); - } - HRESULT hr; - ASSERT(pSample); - IMediaSample * pOutSample; - - // If no output to deliver to then no point sending us data - - ASSERT(m_pOutput != NULL) ; - - // Set up the output sample - hr = InitializeOutputSample(pSample, &pOutSample); - - if(FAILED(hr)) { - return hr; - } - - // Start timing the transform (if PERF is defined) - MSR_START(m_idTransform); - - // have the derived class transform the data - - hr = Transform(pSample, pOutSample); - - // Stop the clock and log it (if PERF is defined) - MSR_STOP(m_idTransform); - - if(FAILED(hr)) { - DbgLog((LOG_TRACE,1,TEXT("Error from transform"))); - } - else { - // the Transform() function can return S_FALSE to indicate that the - // sample should not be delivered; we only deliver the sample if it's - // really S_OK (same as NOERROR, of course.) - if(hr == NOERROR) { - hr = m_pOutput->m_pInputPin->Receive(pOutSample); - m_bSampleSkipped = FALSE; // last thing no longer dropped - } - else { - // S_FALSE returned from Transform is a PRIVATE agreement - // We should return NOERROR from Receive() in this cause because returning S_FALSE - // from Receive() means that this is the end of the stream and no more data should - // be sent. - if(S_FALSE == hr) { - - // Release the sample before calling notify to avoid - // deadlocks if the sample holds a lock on the system - // such as DirectDraw buffers do - pOutSample->Release(); - m_bSampleSkipped = TRUE; - if(!m_bQualityChanged) { - NotifyEvent(EC_QUALITY_CHANGE,0,0); - m_bQualityChanged = TRUE; - } - return NOERROR; - } - } - } - - // release the output buffer. If the connected pin still needs it, - // it will have addrefed it itself. - pOutSample->Release(); - - return hr; -} - - -// Return S_FALSE to mean "pass the note on upstream" -// Return NOERROR (Same as S_OK) -// to mean "I've done something about it, don't pass it on" -HRESULT CTransformFilter::AlterQuality(Quality q) { - UNREFERENCED_PARAMETER(q); - return S_FALSE; -} - - -// EndOfStream received. Default behaviour is to deliver straight -// downstream, since we have no queued data. If you overrode Receive -// and have queue data, then you need to handle this and deliver EOS after -// all queued data is sent -HRESULT -CTransformFilter::EndOfStream(void) { - HRESULT hr = NOERROR; - if(m_pOutput != NULL) { - hr = m_pOutput->DeliverEndOfStream(); - } - - return hr; -} - - -// enter flush state. Receives already blocked -// must override this if you have queued data or a worker thread -HRESULT -CTransformFilter::BeginFlush(void) { - HRESULT hr = NOERROR; - if(m_pOutput != NULL) { - // block receives -- done by caller (CBaseInputPin::BeginFlush) - - // discard queued data -- we have no queued data - - // free anyone blocked on receive - not possible in this filter - - // call downstream - hr = m_pOutput->DeliverBeginFlush(); - } - return hr; -} - - -// leave flush state. must override this if you have queued data -// or a worker thread -HRESULT -CTransformFilter::EndFlush(void) { - // sync with pushing thread -- we have no worker thread - - // ensure no more data to go downstream -- we have no queued data - - // call EndFlush on downstream pins - ASSERT(m_pOutput != NULL); - return m_pOutput->DeliverEndFlush(); - - // caller (the input pin's method) will unblock Receives -} - - -// override these so that the derived filter can catch them - -STDMETHODIMP -CTransformFilter::Stop() { - CAutoLock lck1(&m_csFilter); - if(m_State == State_Stopped) { - return NOERROR; - } - - // Succeed the Stop if we are not completely connected - - ASSERT(m_pInput == NULL || m_pOutput != NULL); - if(m_pInput == NULL || m_pInput->IsConnected() == FALSE || - m_pOutput->IsConnected() == FALSE) { - m_State = State_Stopped; - m_bEOSDelivered = FALSE; - return NOERROR; - } - - ASSERT(m_pInput); - ASSERT(m_pOutput); - - // decommit the input pin before locking or we can deadlock - m_pInput->Inactive(); - - // synchronize with Receive calls - - CAutoLock lck2(&m_csReceive); - m_pOutput->Inactive(); - - // allow a class derived from CTransformFilter - // to know about starting and stopping streaming - - HRESULT hr = StopStreaming(); - if(SUCCEEDED(hr)) { - // complete the state transition - m_State = State_Stopped; - m_bEOSDelivered = FALSE; - } - return hr; -} - - -STDMETHODIMP -CTransformFilter::Pause() { - CAutoLock lck(&m_csFilter); - HRESULT hr = NOERROR; - - if(m_State == State_Paused) { - // (This space left deliberately blank) - } - - // If we have no input pin or it isn't yet connected then when we are - // asked to pause we deliver an end of stream to the downstream filter. - // This makes sure that it doesn't sit there forever waiting for - // samples which we cannot ever deliver without an input connection. - - else if(m_pInput == NULL || m_pInput->IsConnected() == FALSE) { - if(m_pOutput && m_bEOSDelivered == FALSE) { - m_pOutput->DeliverEndOfStream(); - m_bEOSDelivered = TRUE; - } - m_State = State_Paused; - } - - // We may have an input connection but no output connection - // However, if we have an input pin we do have an output pin - - else if(m_pOutput->IsConnected() == FALSE) { - m_State = State_Paused; - } - else { - if(m_State == State_Stopped) { - // allow a class derived from CTransformFilter - // to know about starting and stopping streaming - CAutoLock lck2(&m_csReceive); - hr = StartStreaming(); - } - if(SUCCEEDED(hr)) { - hr = CBaseFilter::Pause(); - } - } - - m_bSampleSkipped = FALSE; - m_bQualityChanged = FALSE; - return hr; -} - -HRESULT -CTransformFilter::NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate) { - if(m_pOutput != NULL) { - return m_pOutput->DeliverNewSegment(tStart, tStop, dRate); - } - return S_OK; -} - -// Check streaming status -HRESULT -CTransformInputPin::CheckStreaming() { - ASSERT(m_pTransformFilter->m_pOutput != NULL); - if(!m_pTransformFilter->m_pOutput->IsConnected()) { - return VFW_E_NOT_CONNECTED; - } - else { - // Shouldn't be able to get any data if we're not connected! - ASSERT(IsConnected()); - - // we're flushing - if(m_bFlushing) { - return S_FALSE; - } - // Don't process stuff in Stopped state - if(IsStopped()) { - return VFW_E_WRONG_STATE; - } - if(m_bRunTimeError) { - return VFW_E_RUNTIME_ERROR; - } - return S_OK; - } -} - - -// ================================================================= -// Implements the CTransformInputPin class -// ================================================================= - - -// constructor - -CTransformInputPin::CTransformInputPin( - TCHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName) - : CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName) { - DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin"))); - m_pTransformFilter = pTransformFilter; -} - -#ifdef UNICODE -CTransformInputPin::CTransformInputPin( - CHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName) - : CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName) { - DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin"))); - m_pTransformFilter = pTransformFilter; -} -#endif - -// provides derived filter a chance to grab extra interfaces - -HRESULT -CTransformInputPin::CheckConnect(IPin *pPin) { - HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_INPUT,pPin); - if(FAILED(hr)) { - return hr; - } - return CBaseInputPin::CheckConnect(pPin); -} - - -// provides derived filter a chance to release it's extra interfaces - -HRESULT -CTransformInputPin::BreakConnect() { - // Can't disconnect unless stopped - ASSERT(IsStopped()); - m_pTransformFilter->BreakConnect(PINDIR_INPUT); - return CBaseInputPin::BreakConnect(); -} - - -// Let derived class know when the input pin is connected - -HRESULT -CTransformInputPin::CompleteConnect(IPin *pReceivePin) { - HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_INPUT,pReceivePin); - if(FAILED(hr)) { - return hr; - } - return CBaseInputPin::CompleteConnect(pReceivePin); -} - - -// check that we can support a given media type - -HRESULT -CTransformInputPin::CheckMediaType(const CMediaType* pmt) { - // Check the input type - - HRESULT hr = m_pTransformFilter->CheckInputType(pmt); - if(S_OK != hr) { - return hr; - } - - // if the output pin is still connected, then we have - // to check the transform not just the input format - - if((m_pTransformFilter->m_pOutput != NULL) && - (m_pTransformFilter->m_pOutput->IsConnected())) { - return m_pTransformFilter->CheckTransform(pmt, - &m_pTransformFilter->m_pOutput->CurrentMediaType()); - } - else { - return hr; - } -} - - -// set the media type for this connection - -HRESULT -CTransformInputPin::SetMediaType(const CMediaType* mtIn) { - // Set the base class media type (should always succeed) - HRESULT hr = CBasePin::SetMediaType(mtIn); - if(FAILED(hr)) { - return hr; - } - - // check the transform can be done (should always succeed) - ASSERT(SUCCEEDED(m_pTransformFilter->CheckInputType(mtIn))); - - return m_pTransformFilter->SetMediaType(PINDIR_INPUT,mtIn); -} - - -// ================================================================= -// Implements IMemInputPin interface -// ================================================================= - - -// provide EndOfStream that passes straight downstream -// (there is no queued data) -STDMETHODIMP -CTransformInputPin::EndOfStream(void) { - CAutoLock lck(&m_pTransformFilter->m_csReceive); - HRESULT hr = CheckStreaming(); - if(S_OK == hr) { - hr = m_pTransformFilter->EndOfStream(); - } - return hr; -} - - -// enter flushing state. Call default handler to block Receives, then -// pass to overridable method in filter -STDMETHODIMP -CTransformInputPin::BeginFlush(void) { - CAutoLock lck(&m_pTransformFilter->m_csFilter); - // Are we actually doing anything? - ASSERT(m_pTransformFilter->m_pOutput != NULL); - if(!IsConnected() || - !m_pTransformFilter->m_pOutput->IsConnected()) { - return VFW_E_NOT_CONNECTED; - } - HRESULT hr = CBaseInputPin::BeginFlush(); - if(FAILED(hr)) { - return hr; - } - - return m_pTransformFilter->BeginFlush(); -} - - -// leave flushing state. -// Pass to overridable method in filter, then call base class -// to unblock receives (finally) -STDMETHODIMP -CTransformInputPin::EndFlush(void) { - CAutoLock lck(&m_pTransformFilter->m_csFilter); - // Are we actually doing anything? - ASSERT(m_pTransformFilter->m_pOutput != NULL); - if(!IsConnected() || - !m_pTransformFilter->m_pOutput->IsConnected()) { - return VFW_E_NOT_CONNECTED; - } - - HRESULT hr = m_pTransformFilter->EndFlush(); - if(FAILED(hr)) { - return hr; - } - - return CBaseInputPin::EndFlush(); -} - - -// here's the next block of data from the stream. -// AddRef it yourself if you need to hold it beyond the end -// of this call. - -HRESULT -CTransformInputPin::Receive(IMediaSample * pSample) { - HRESULT hr; - CAutoLock lck(&m_pTransformFilter->m_csReceive); - ASSERT(pSample); - - // check all is well with the base class - hr = CBaseInputPin::Receive(pSample); - if(S_OK == hr) { - hr = m_pTransformFilter->Receive(pSample); - } - return hr; -} - - - - -// override to pass downstream -STDMETHODIMP -CTransformInputPin::NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate) { - // Save the values in the pin - CBasePin::NewSegment(tStart, tStop, dRate); - return m_pTransformFilter->NewSegment(tStart, tStop, dRate); -} - - - - -// ================================================================= -// Implements the CTransformOutputPin class -// ================================================================= - - -// constructor - -CTransformOutputPin::CTransformOutputPin( - TCHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pPinName) - : CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName), - m_pPosition(NULL) { - DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin"))); - m_pTransformFilter = pTransformFilter; - -} - -#ifdef UNICODE -CTransformOutputPin::CTransformOutputPin( - CHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pPinName) - : CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName), - m_pPosition(NULL) { - DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin"))); - m_pTransformFilter = pTransformFilter; - -} -#endif - -// destructor - -CTransformOutputPin::~CTransformOutputPin() { - DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::~CTransformOutputPin"))); - - if(m_pPosition) m_pPosition->Release(); -} - - -// overriden to expose IMediaPosition and IMediaSeeking control interfaces - -STDMETHODIMP -CTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - CheckPointer(ppv,E_POINTER); - ValidateReadWritePtr(ppv,sizeof(PVOID)); - *ppv = NULL; - - if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking) { - - // we should have an input pin by now - - ASSERT(m_pTransformFilter->m_pInput != NULL); - - if(m_pPosition == NULL) { - - HRESULT hr = CreatePosPassThru(GetOwner(), - FALSE, - (IPin *)m_pTransformFilter->m_pInput, - &m_pPosition); - if(FAILED(hr)) { - return hr; - } - } - return m_pPosition->QueryInterface(riid, ppv); - } - else { - return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); - } -} - - -// provides derived filter a chance to grab extra interfaces - -HRESULT -CTransformOutputPin::CheckConnect(IPin *pPin) { - // we should have an input connection first - - ASSERT(m_pTransformFilter->m_pInput != NULL); - if((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) { - return E_UNEXPECTED; - } - - HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_OUTPUT,pPin); - if(FAILED(hr)) { - return hr; - } - return CBaseOutputPin::CheckConnect(pPin); -} - - -// provides derived filter a chance to release it's extra interfaces - -HRESULT -CTransformOutputPin::BreakConnect() { - // Can't disconnect unless stopped - ASSERT(IsStopped()); - m_pTransformFilter->BreakConnect(PINDIR_OUTPUT); - return CBaseOutputPin::BreakConnect(); -} - - -// Let derived class know when the output pin is connected - -HRESULT -CTransformOutputPin::CompleteConnect(IPin *pReceivePin) { - HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT,pReceivePin); - if(FAILED(hr)) { - return hr; - } - return CBaseOutputPin::CompleteConnect(pReceivePin); -} - - -// check a given transform - must have selected input type first - -HRESULT -CTransformOutputPin::CheckMediaType(const CMediaType* pmtOut) { - // must have selected input first - ASSERT(m_pTransformFilter->m_pInput != NULL); - if((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) { - return E_INVALIDARG; - } - - return m_pTransformFilter->CheckTransform(&m_pTransformFilter->m_pInput->CurrentMediaType(), - pmtOut); -} - - -// called after we have agreed a media type to actually set it in which case -// we run the CheckTransform function to get the output format type again - -HRESULT -CTransformOutputPin::SetMediaType(const CMediaType* pmtOut) { - HRESULT hr = NOERROR; - ASSERT(m_pTransformFilter->m_pInput != NULL); - - ASSERT(m_pTransformFilter->m_pInput->CurrentMediaType().IsValid()); - - // Set the base class media type (should always succeed) - hr = CBasePin::SetMediaType(pmtOut); - if(FAILED(hr)) { - return hr; - } - -#ifdef DEBUG - if(FAILED(m_pTransformFilter->CheckTransform(&m_pTransformFilter-> - m_pInput->CurrentMediaType(),pmtOut))) { - DbgLog((LOG_ERROR,0,TEXT("*** This filter is accepting an output media type"))); - DbgLog((LOG_ERROR,0,TEXT(" that it can't currently transform to. I hope"))); - DbgLog((LOG_ERROR,0,TEXT(" it's smart enough to reconnect its input."))); - } -#endif - - return m_pTransformFilter->SetMediaType(PINDIR_OUTPUT,pmtOut); -} - - -// pass the buffer size decision through to the main transform class - -HRESULT -CTransformOutputPin::DecideBufferSize( - IMemAllocator * pAllocator, - ALLOCATOR_PROPERTIES* pProp) { - return m_pTransformFilter->DecideBufferSize(pAllocator, pProp); -} - - - -// return a specific media type indexed by iPosition - -HRESULT -CTransformOutputPin::GetMediaType( - int iPosition, - CMediaType *pMediaType) { - ASSERT(m_pTransformFilter->m_pInput != NULL); - - // We don't have any media types if our input is not connected - - if(m_pTransformFilter->m_pInput->IsConnected()) { - return m_pTransformFilter->GetMediaType(iPosition,pMediaType); - } - else { - return VFW_S_NO_MORE_ITEMS; - } -} - - -// Override this if you can do something constructive to act on the -// quality message. Consider passing it upstream as well - -// Pass the quality mesage on upstream. - -STDMETHODIMP -CTransformOutputPin::Notify(IBaseFilter * pSender, Quality q) { - UNREFERENCED_PARAMETER(pSender); - ValidateReadPtr(pSender,sizeof(IBaseFilter)); - - // First see if we want to handle this ourselves - HRESULT hr = m_pTransformFilter->AlterQuality(q); - if(hr!=S_FALSE) { - return hr; // either S_OK or a failure - } - - // S_FALSE means we pass the message on. - // Find the quality sink for our input pin and send it there - - ASSERT(m_pTransformFilter->m_pInput != NULL); - - return m_pTransformFilter->m_pInput->PassNotify(q); - -} // Notify - - -// the following removes a very large number of level 4 warnings from the microsoft -// compiler output, which are not useful at all in this case. -#pragma warning(disable:4514) - +//------------------------------------------------------------------------------ +// File: Transfrm.cpp +// +// Desc: DirectShow base classes - implements class for simple transform +// filters such as video decompressors. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include + + +// ================================================================= +// Implements the CTransformFilter class +// ================================================================= + +CTransformFilter::CTransformFilter(TCHAR *pName, + LPUNKNOWN pUnk, + REFCLSID clsid) : + CBaseFilter(pName,pUnk,&m_csFilter, clsid), + m_pInput(NULL), + m_pOutput(NULL), + m_bEOSDelivered(FALSE), + m_bQualityChanged(FALSE), + m_bSampleSkipped(FALSE) { +#ifdef PERF + RegisterPerfId(); +#endif // PERF +} + +#ifdef UNICODE +CTransformFilter::CTransformFilter(char *pName, + LPUNKNOWN pUnk, + REFCLSID clsid) : + CBaseFilter(pName,pUnk,&m_csFilter, clsid), + m_pInput(NULL), + m_pOutput(NULL), + m_bEOSDelivered(FALSE), + m_bQualityChanged(FALSE), + m_bSampleSkipped(FALSE) { +#ifdef PERF + RegisterPerfId(); +#endif // PERF +} +#endif + +// destructor + +CTransformFilter::~CTransformFilter() { + // Delete the pins + + delete m_pInput; + delete m_pOutput; +} + + +// Transform place holder - should never be called +HRESULT CTransformFilter::Transform(IMediaSample * pIn, IMediaSample *pOut) { + UNREFERENCED_PARAMETER(pIn); + UNREFERENCED_PARAMETER(pOut); + DbgBreak("CTransformFilter::Transform() should never be called"); + return E_UNEXPECTED; +} + + +// return the number of pins we provide + +int CTransformFilter::GetPinCount() { + return 2; +} + + +// return a non-addrefed CBasePin * for the user to addref if he holds onto it +// for longer than his pointer to us. We create the pins dynamically when they +// are asked for rather than in the constructor. This is because we want to +// give the derived class an oppportunity to return different pin objects + +// We return the objects as and when they are needed. If either of these fails +// then we return NULL, the assumption being that the caller will realise the +// whole deal is off and destroy us - which in turn will delete everything. + +CBasePin * +CTransformFilter::GetPin(int n) { + HRESULT hr = S_OK; + + // Create an input pin if necessary + + if(m_pInput == NULL) { + + m_pInput = new CTransformInputPin(NAME("Transform input pin"), + this, // Owner filter + &hr, // Result code + L"XForm In"); // Pin name + + + // Can't fail + ASSERT(SUCCEEDED(hr)); + if(m_pInput == NULL) { + return NULL; + } + m_pOutput = (CTransformOutputPin *) + new CTransformOutputPin(NAME("Transform output pin"), + this, // Owner filter + &hr, // Result code + L"XForm Out"); // Pin name + + + // Can't fail + ASSERT(SUCCEEDED(hr)); + if(m_pOutput == NULL) { + delete m_pInput; + m_pInput = NULL; + } + } + + // Return the appropriate pin + + if(n == 0) { + return m_pInput; + } + else + if(n == 1) { + return m_pOutput; + } + else { + return NULL; + } +} + + +// +// FindPin +// +// If Id is In or Out then return the IPin* for that pin +// creating the pin if need be. Otherwise return NULL with an error. + +STDMETHODIMP CTransformFilter::FindPin(LPCWSTR Id, IPin **ppPin) { + CheckPointer(ppPin,E_POINTER); + ValidateReadWritePtr(ppPin,sizeof(IPin *)); + + if(0==lstrcmpW(Id,L"In")) { + *ppPin = GetPin(0); + } + else if(0==lstrcmpW(Id,L"Out")) { + *ppPin = GetPin(1); + } + else { + *ppPin = NULL; + return VFW_E_NOT_FOUND; + } + + HRESULT hr = NOERROR; + // AddRef() returned pointer - but GetPin could fail if memory is low. + if(*ppPin) { + (*ppPin)->AddRef(); + } + else { + hr = E_OUTOFMEMORY; // probably. There's no pin anyway. + } + return hr; +} + + +// override these two functions if you want to inform something +// about entry to or exit from streaming state. + +HRESULT +CTransformFilter::StartStreaming() { + return NOERROR; +} + + +HRESULT +CTransformFilter::StopStreaming() { + return NOERROR; +} + + +// override this to grab extra interfaces on connection + +HRESULT +CTransformFilter::CheckConnect(PIN_DIRECTION dir,IPin *pPin) { + UNREFERENCED_PARAMETER(dir); + UNREFERENCED_PARAMETER(pPin); + return NOERROR; +} + + +// place holder to allow derived classes to release any extra interfaces + +HRESULT +CTransformFilter::BreakConnect(PIN_DIRECTION dir) { + UNREFERENCED_PARAMETER(dir); + return NOERROR; +} + + +// Let derived classes know about connection completion + +HRESULT +CTransformFilter::CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin) { + UNREFERENCED_PARAMETER(direction); + UNREFERENCED_PARAMETER(pReceivePin); + return NOERROR; +} + + +// override this to know when the media type is really set + +HRESULT +CTransformFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt) { + UNREFERENCED_PARAMETER(direction); + UNREFERENCED_PARAMETER(pmt); + return NOERROR; +} + + +// Set up our output sample +HRESULT +CTransformFilter::InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample) { + IMediaSample *pOutSample; + + // default - times are the same + + AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); + DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0; + + // This will prevent the image renderer from switching us to DirectDraw + // when we can't do it without skipping frames because we're not on a + // keyframe. If it really has to switch us, it still will, but then we + // will have to wait for the next keyframe + if(!(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) { + dwFlags |= AM_GBF_NOTASYNCPOINT; + } + + ASSERT(m_pOutput->m_pAllocator != NULL); + HRESULT hr = m_pOutput->m_pAllocator->GetBuffer(&pOutSample + , pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID ? + &pProps->tStart : NULL + , pProps->dwSampleFlags & AM_SAMPLE_STOPVALID ? + &pProps->tStop : NULL + , dwFlags); + *ppOutSample = pOutSample; + if(FAILED(hr)) { + return hr; + } + + ASSERT(pOutSample); + IMediaSample2 *pOutSample2; + if(SUCCEEDED(pOutSample->QueryInterface(IID_IMediaSample2, + (void **)&pOutSample2))) { + /* Modify it */ + AM_SAMPLE2_PROPERTIES OutProps; + EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps))); + OutProps.dwTypeSpecificFlags = pProps->dwTypeSpecificFlags; + OutProps.dwSampleFlags = + (OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) | + (pProps->dwSampleFlags & ~AM_SAMPLE_TYPECHANGED); + + OutProps.tStart = pProps->tStart; + OutProps.tStop = pProps->tStop; + OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId); + + hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), + (PBYTE)&OutProps); + if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) { + m_bSampleSkipped = FALSE; + } + pOutSample2->Release(); + } + else { + if(pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) { + pOutSample->SetTime(&pProps->tStart, + &pProps->tStop); + } + if(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT) { + pOutSample->SetSyncPoint(TRUE); + } + if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) { + pOutSample->SetDiscontinuity(TRUE); + m_bSampleSkipped = FALSE; + } + // Copy the media times + + LONGLONG MediaStart, MediaEnd; + if(pSample->GetMediaTime(&MediaStart,&MediaEnd) == NOERROR) { + pOutSample->SetMediaTime(&MediaStart,&MediaEnd); + } + } + return S_OK; +} + +// override this to customize the transform process + +HRESULT +CTransformFilter::Receive(IMediaSample *pSample) { + /* Check for other streams and pass them on */ + AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); + if(pProps->dwStreamId != AM_STREAM_MEDIA) { + return m_pOutput->m_pInputPin->Receive(pSample); + } + HRESULT hr; + ASSERT(pSample); + IMediaSample * pOutSample; + + // If no output to deliver to then no point sending us data + + ASSERT(m_pOutput != NULL) ; + + // Set up the output sample + hr = InitializeOutputSample(pSample, &pOutSample); + + if(FAILED(hr)) { + return hr; + } + + // Start timing the transform (if PERF is defined) + MSR_START(m_idTransform); + + // have the derived class transform the data + + hr = Transform(pSample, pOutSample); + + // Stop the clock and log it (if PERF is defined) + MSR_STOP(m_idTransform); + + if(FAILED(hr)) { + DbgLog((LOG_TRACE,1,TEXT("Error from transform"))); + } + else { + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + if(hr == NOERROR) { + hr = m_pOutput->m_pInputPin->Receive(pOutSample); + m_bSampleSkipped = FALSE; // last thing no longer dropped + } + else { + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this cause because returning S_FALSE + // from Receive() means that this is the end of the stream and no more data should + // be sent. + if(S_FALSE == hr) { + + // Release the sample before calling notify to avoid + // deadlocks if the sample holds a lock on the system + // such as DirectDraw buffers do + pOutSample->Release(); + m_bSampleSkipped = TRUE; + if(!m_bQualityChanged) { + NotifyEvent(EC_QUALITY_CHANGE,0,0); + m_bQualityChanged = TRUE; + } + return NOERROR; + } + } + } + + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + pOutSample->Release(); + + return hr; +} + + +// Return S_FALSE to mean "pass the note on upstream" +// Return NOERROR (Same as S_OK) +// to mean "I've done something about it, don't pass it on" +HRESULT CTransformFilter::AlterQuality(Quality q) { + UNREFERENCED_PARAMETER(q); + return S_FALSE; +} + + +// EndOfStream received. Default behaviour is to deliver straight +// downstream, since we have no queued data. If you overrode Receive +// and have queue data, then you need to handle this and deliver EOS after +// all queued data is sent +HRESULT +CTransformFilter::EndOfStream(void) { + HRESULT hr = NOERROR; + if(m_pOutput != NULL) { + hr = m_pOutput->DeliverEndOfStream(); + } + + return hr; +} + + +// enter flush state. Receives already blocked +// must override this if you have queued data or a worker thread +HRESULT +CTransformFilter::BeginFlush(void) { + HRESULT hr = NOERROR; + if(m_pOutput != NULL) { + // block receives -- done by caller (CBaseInputPin::BeginFlush) + + // discard queued data -- we have no queued data + + // free anyone blocked on receive - not possible in this filter + + // call downstream + hr = m_pOutput->DeliverBeginFlush(); + } + return hr; +} + + +// leave flush state. must override this if you have queued data +// or a worker thread +HRESULT +CTransformFilter::EndFlush(void) { + // sync with pushing thread -- we have no worker thread + + // ensure no more data to go downstream -- we have no queued data + + // call EndFlush on downstream pins + ASSERT(m_pOutput != NULL); + return m_pOutput->DeliverEndFlush(); + + // caller (the input pin's method) will unblock Receives +} + + +// override these so that the derived filter can catch them + +STDMETHODIMP +CTransformFilter::Stop() { + CAutoLock lck1(&m_csFilter); + if(m_State == State_Stopped) { + return NOERROR; + } + + // Succeed the Stop if we are not completely connected + + ASSERT(m_pInput == NULL || m_pOutput != NULL); + if(m_pInput == NULL || m_pInput->IsConnected() == FALSE || + m_pOutput->IsConnected() == FALSE) { + m_State = State_Stopped; + m_bEOSDelivered = FALSE; + return NOERROR; + } + + ASSERT(m_pInput); + ASSERT(m_pOutput); + + // decommit the input pin before locking or we can deadlock + m_pInput->Inactive(); + + // synchronize with Receive calls + + CAutoLock lck2(&m_csReceive); + m_pOutput->Inactive(); + + // allow a class derived from CTransformFilter + // to know about starting and stopping streaming + + HRESULT hr = StopStreaming(); + if(SUCCEEDED(hr)) { + // complete the state transition + m_State = State_Stopped; + m_bEOSDelivered = FALSE; + } + return hr; +} + + +STDMETHODIMP +CTransformFilter::Pause() { + CAutoLock lck(&m_csFilter); + HRESULT hr = NOERROR; + + if(m_State == State_Paused) { + // (This space left deliberately blank) + } + + // If we have no input pin or it isn't yet connected then when we are + // asked to pause we deliver an end of stream to the downstream filter. + // This makes sure that it doesn't sit there forever waiting for + // samples which we cannot ever deliver without an input connection. + + else if(m_pInput == NULL || m_pInput->IsConnected() == FALSE) { + if(m_pOutput && m_bEOSDelivered == FALSE) { + m_pOutput->DeliverEndOfStream(); + m_bEOSDelivered = TRUE; + } + m_State = State_Paused; + } + + // We may have an input connection but no output connection + // However, if we have an input pin we do have an output pin + + else if(m_pOutput->IsConnected() == FALSE) { + m_State = State_Paused; + } + else { + if(m_State == State_Stopped) { + // allow a class derived from CTransformFilter + // to know about starting and stopping streaming + CAutoLock lck2(&m_csReceive); + hr = StartStreaming(); + } + if(SUCCEEDED(hr)) { + hr = CBaseFilter::Pause(); + } + } + + m_bSampleSkipped = FALSE; + m_bQualityChanged = FALSE; + return hr; +} + +HRESULT +CTransformFilter::NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate) { + if(m_pOutput != NULL) { + return m_pOutput->DeliverNewSegment(tStart, tStop, dRate); + } + return S_OK; +} + +// Check streaming status +HRESULT +CTransformInputPin::CheckStreaming() { + ASSERT(m_pTransformFilter->m_pOutput != NULL); + if(!m_pTransformFilter->m_pOutput->IsConnected()) { + return VFW_E_NOT_CONNECTED; + } + else { + // Shouldn't be able to get any data if we're not connected! + ASSERT(IsConnected()); + + // we're flushing + if(m_bFlushing) { + return S_FALSE; + } + // Don't process stuff in Stopped state + if(IsStopped()) { + return VFW_E_WRONG_STATE; + } + if(m_bRunTimeError) { + return VFW_E_RUNTIME_ERROR; + } + return S_OK; + } +} + + +// ================================================================= +// Implements the CTransformInputPin class +// ================================================================= + + +// constructor + +CTransformInputPin::CTransformInputPin( + TCHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName) + : CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName) { + DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin"))); + m_pTransformFilter = pTransformFilter; +} + +#ifdef UNICODE +CTransformInputPin::CTransformInputPin( + CHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName) + : CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName) { + DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin"))); + m_pTransformFilter = pTransformFilter; +} +#endif + +// provides derived filter a chance to grab extra interfaces + +HRESULT +CTransformInputPin::CheckConnect(IPin *pPin) { + HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_INPUT,pPin); + if(FAILED(hr)) { + return hr; + } + return CBaseInputPin::CheckConnect(pPin); +} + + +// provides derived filter a chance to release it's extra interfaces + +HRESULT +CTransformInputPin::BreakConnect() { + // Can't disconnect unless stopped + ASSERT(IsStopped()); + m_pTransformFilter->BreakConnect(PINDIR_INPUT); + return CBaseInputPin::BreakConnect(); +} + + +// Let derived class know when the input pin is connected + +HRESULT +CTransformInputPin::CompleteConnect(IPin *pReceivePin) { + HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_INPUT,pReceivePin); + if(FAILED(hr)) { + return hr; + } + return CBaseInputPin::CompleteConnect(pReceivePin); +} + + +// check that we can support a given media type + +HRESULT +CTransformInputPin::CheckMediaType(const CMediaType* pmt) { + // Check the input type + + HRESULT hr = m_pTransformFilter->CheckInputType(pmt); + if(S_OK != hr) { + return hr; + } + + // if the output pin is still connected, then we have + // to check the transform not just the input format + + if((m_pTransformFilter->m_pOutput != NULL) && + (m_pTransformFilter->m_pOutput->IsConnected())) { + return m_pTransformFilter->CheckTransform(pmt, + &m_pTransformFilter->m_pOutput->CurrentMediaType()); + } + else { + return hr; + } +} + + +// set the media type for this connection + +HRESULT +CTransformInputPin::SetMediaType(const CMediaType* mtIn) { + // Set the base class media type (should always succeed) + HRESULT hr = CBasePin::SetMediaType(mtIn); + if(FAILED(hr)) { + return hr; + } + + // check the transform can be done (should always succeed) + ASSERT(SUCCEEDED(m_pTransformFilter->CheckInputType(mtIn))); + + return m_pTransformFilter->SetMediaType(PINDIR_INPUT,mtIn); +} + + +// ================================================================= +// Implements IMemInputPin interface +// ================================================================= + + +// provide EndOfStream that passes straight downstream +// (there is no queued data) +STDMETHODIMP +CTransformInputPin::EndOfStream(void) { + CAutoLock lck(&m_pTransformFilter->m_csReceive); + HRESULT hr = CheckStreaming(); + if(S_OK == hr) { + hr = m_pTransformFilter->EndOfStream(); + } + return hr; +} + + +// enter flushing state. Call default handler to block Receives, then +// pass to overridable method in filter +STDMETHODIMP +CTransformInputPin::BeginFlush(void) { + CAutoLock lck(&m_pTransformFilter->m_csFilter); + // Are we actually doing anything? + ASSERT(m_pTransformFilter->m_pOutput != NULL); + if(!IsConnected() || + !m_pTransformFilter->m_pOutput->IsConnected()) { + return VFW_E_NOT_CONNECTED; + } + HRESULT hr = CBaseInputPin::BeginFlush(); + if(FAILED(hr)) { + return hr; + } + + return m_pTransformFilter->BeginFlush(); +} + + +// leave flushing state. +// Pass to overridable method in filter, then call base class +// to unblock receives (finally) +STDMETHODIMP +CTransformInputPin::EndFlush(void) { + CAutoLock lck(&m_pTransformFilter->m_csFilter); + // Are we actually doing anything? + ASSERT(m_pTransformFilter->m_pOutput != NULL); + if(!IsConnected() || + !m_pTransformFilter->m_pOutput->IsConnected()) { + return VFW_E_NOT_CONNECTED; + } + + HRESULT hr = m_pTransformFilter->EndFlush(); + if(FAILED(hr)) { + return hr; + } + + return CBaseInputPin::EndFlush(); +} + + +// here's the next block of data from the stream. +// AddRef it yourself if you need to hold it beyond the end +// of this call. + +HRESULT +CTransformInputPin::Receive(IMediaSample * pSample) { + HRESULT hr; + CAutoLock lck(&m_pTransformFilter->m_csReceive); + ASSERT(pSample); + + // check all is well with the base class + hr = CBaseInputPin::Receive(pSample); + if(S_OK == hr) { + hr = m_pTransformFilter->Receive(pSample); + } + return hr; +} + + + + +// override to pass downstream +STDMETHODIMP +CTransformInputPin::NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate) { + // Save the values in the pin + CBasePin::NewSegment(tStart, tStop, dRate); + return m_pTransformFilter->NewSegment(tStart, tStop, dRate); +} + + + + +// ================================================================= +// Implements the CTransformOutputPin class +// ================================================================= + + +// constructor + +CTransformOutputPin::CTransformOutputPin( + TCHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pPinName) + : CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName), + m_pPosition(NULL) { + DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin"))); + m_pTransformFilter = pTransformFilter; + +} + +#ifdef UNICODE +CTransformOutputPin::CTransformOutputPin( + CHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pPinName) + : CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName), + m_pPosition(NULL) { + DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin"))); + m_pTransformFilter = pTransformFilter; + +} +#endif + +// destructor + +CTransformOutputPin::~CTransformOutputPin() { + DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::~CTransformOutputPin"))); + + if(m_pPosition) m_pPosition->Release(); +} + + +// overriden to expose IMediaPosition and IMediaSeeking control interfaces + +STDMETHODIMP +CTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + CheckPointer(ppv,E_POINTER); + ValidateReadWritePtr(ppv,sizeof(PVOID)); + *ppv = NULL; + + if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking) { + + // we should have an input pin by now + + ASSERT(m_pTransformFilter->m_pInput != NULL); + + if(m_pPosition == NULL) { + + HRESULT hr = CreatePosPassThru(GetOwner(), + FALSE, + (IPin *)m_pTransformFilter->m_pInput, + &m_pPosition); + if(FAILED(hr)) { + return hr; + } + } + return m_pPosition->QueryInterface(riid, ppv); + } + else { + return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); + } +} + + +// provides derived filter a chance to grab extra interfaces + +HRESULT +CTransformOutputPin::CheckConnect(IPin *pPin) { + // we should have an input connection first + + ASSERT(m_pTransformFilter->m_pInput != NULL); + if((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) { + return E_UNEXPECTED; + } + + HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_OUTPUT,pPin); + if(FAILED(hr)) { + return hr; + } + return CBaseOutputPin::CheckConnect(pPin); +} + + +// provides derived filter a chance to release it's extra interfaces + +HRESULT +CTransformOutputPin::BreakConnect() { + // Can't disconnect unless stopped + ASSERT(IsStopped()); + m_pTransformFilter->BreakConnect(PINDIR_OUTPUT); + return CBaseOutputPin::BreakConnect(); +} + + +// Let derived class know when the output pin is connected + +HRESULT +CTransformOutputPin::CompleteConnect(IPin *pReceivePin) { + HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT,pReceivePin); + if(FAILED(hr)) { + return hr; + } + return CBaseOutputPin::CompleteConnect(pReceivePin); +} + + +// check a given transform - must have selected input type first + +HRESULT +CTransformOutputPin::CheckMediaType(const CMediaType* pmtOut) { + // must have selected input first + ASSERT(m_pTransformFilter->m_pInput != NULL); + if((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) { + return E_INVALIDARG; + } + + return m_pTransformFilter->CheckTransform(&m_pTransformFilter->m_pInput->CurrentMediaType(), + pmtOut); +} + + +// called after we have agreed a media type to actually set it in which case +// we run the CheckTransform function to get the output format type again + +HRESULT +CTransformOutputPin::SetMediaType(const CMediaType* pmtOut) { + HRESULT hr = NOERROR; + ASSERT(m_pTransformFilter->m_pInput != NULL); + + ASSERT(m_pTransformFilter->m_pInput->CurrentMediaType().IsValid()); + + // Set the base class media type (should always succeed) + hr = CBasePin::SetMediaType(pmtOut); + if(FAILED(hr)) { + return hr; + } + +#ifdef DEBUG + if(FAILED(m_pTransformFilter->CheckTransform(&m_pTransformFilter-> + m_pInput->CurrentMediaType(),pmtOut))) { + DbgLog((LOG_ERROR,0,TEXT("*** This filter is accepting an output media type"))); + DbgLog((LOG_ERROR,0,TEXT(" that it can't currently transform to. I hope"))); + DbgLog((LOG_ERROR,0,TEXT(" it's smart enough to reconnect its input."))); + } +#endif + + return m_pTransformFilter->SetMediaType(PINDIR_OUTPUT,pmtOut); +} + + +// pass the buffer size decision through to the main transform class + +HRESULT +CTransformOutputPin::DecideBufferSize( + IMemAllocator * pAllocator, + ALLOCATOR_PROPERTIES* pProp) { + return m_pTransformFilter->DecideBufferSize(pAllocator, pProp); +} + + + +// return a specific media type indexed by iPosition + +HRESULT +CTransformOutputPin::GetMediaType( + int iPosition, + CMediaType *pMediaType) { + ASSERT(m_pTransformFilter->m_pInput != NULL); + + // We don't have any media types if our input is not connected + + if(m_pTransformFilter->m_pInput->IsConnected()) { + return m_pTransformFilter->GetMediaType(iPosition,pMediaType); + } + else { + return VFW_S_NO_MORE_ITEMS; + } +} + + +// Override this if you can do something constructive to act on the +// quality message. Consider passing it upstream as well + +// Pass the quality mesage on upstream. + +STDMETHODIMP +CTransformOutputPin::Notify(IBaseFilter * pSender, Quality q) { + UNREFERENCED_PARAMETER(pSender); + ValidateReadPtr(pSender,sizeof(IBaseFilter)); + + // First see if we want to handle this ourselves + HRESULT hr = m_pTransformFilter->AlterQuality(q); + if(hr!=S_FALSE) { + return hr; // either S_OK or a failure + } + + // S_FALSE means we pass the message on. + // Find the quality sink for our input pin and send it there + + ASSERT(m_pTransformFilter->m_pInput != NULL); + + return m_pTransformFilter->m_pInput->PassNotify(q); + +} // Notify + + +// the following removes a very large number of level 4 warnings from the microsoft +// compiler output, which are not useful at all in this case. +#pragma warning(disable:4514) + diff --git a/src/BaseClasses/transfrm.h b/src/BaseClasses/transfrm.h index ef71ba1fb2..15cec3765d 100644 --- a/src/BaseClasses/transfrm.h +++ b/src/BaseClasses/transfrm.h @@ -1,304 +1,304 @@ -//------------------------------------------------------------------------------ -// File: Transfrm.h -// -// Desc: DirectShow base classes - defines classes from which simple -// transform codecs may be derived. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// It assumes the codec has one input and one output stream, and has no -// interest in memory management, interface negotiation or anything else. -// -// derive your class from this, and supply Transform and the media type/format -// negotiation functions. Implement that class, compile and link and -// you're done. - - -#ifndef __TRANSFRM__ -#define __TRANSFRM__ - -// ====================================================================== -// This is the com object that represents a simple transform filter. It -// supports IBaseFilter, IMediaFilter and two pins through nested interfaces -// ====================================================================== - -class CTransformFilter; - -// ================================================== -// Implements the input pin -// ================================================== - -class CTransformInputPin : public CBaseInputPin -{ - friend class CTransformFilter; - -protected: - CTransformFilter *m_pTransformFilter; - - -public: - - CTransformInputPin( - TCHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName); -#ifdef UNICODE - CTransformInputPin( - char *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName); -#endif - - STDMETHODIMP QueryId(LPWSTR * Id) - { - return AMGetWideString(L"In", Id); - } - - // Grab and release extra interfaces if required - - HRESULT CheckConnect(IPin *pPin); - HRESULT BreakConnect(); - HRESULT CompleteConnect(IPin *pReceivePin); - - // check that we can support this output type - HRESULT CheckMediaType(const CMediaType* mtIn); - - // set the connection media type - HRESULT SetMediaType(const CMediaType* mt); - - // --- IMemInputPin ----- - - // here's the next block of data from the stream. - // AddRef it yourself if you need to hold it beyond the end - // of this call. - STDMETHODIMP Receive(IMediaSample * pSample); - - // provide EndOfStream that passes straight downstream - // (there is no queued data) - STDMETHODIMP EndOfStream(void); - - // passes it to CTransformFilter::BeginFlush - STDMETHODIMP BeginFlush(void); - - // passes it to CTransformFilter::EndFlush - STDMETHODIMP EndFlush(void); - - STDMETHODIMP NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate); - - // Check if it's OK to process samples - virtual HRESULT CheckStreaming(); - - // Media type -public: - CMediaType& CurrentMediaType() { return m_mt; }; - -}; - -// ================================================== -// Implements the output pin -// ================================================== - -class CTransformOutputPin : public CBaseOutputPin -{ - friend class CTransformFilter; - -protected: - CTransformFilter *m_pTransformFilter; - -public: - - // implement IMediaPosition by passing upstream - IUnknown * m_pPosition; - - CTransformOutputPin( - TCHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName); -#ifdef UNICODE - CTransformOutputPin( - CHAR *pObjectName, - CTransformFilter *pTransformFilter, - HRESULT * phr, - LPCWSTR pName); -#endif - ~CTransformOutputPin(); - - // override to expose IMediaPosition - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); - - // --- CBaseOutputPin ------------ - - STDMETHODIMP QueryId(LPWSTR * Id) - { - return AMGetWideString(L"Out", Id); - } - - // Grab and release extra interfaces if required - - HRESULT CheckConnect(IPin *pPin); - HRESULT BreakConnect(); - HRESULT CompleteConnect(IPin *pReceivePin); - - // check that we can support this output type - HRESULT CheckMediaType(const CMediaType* mtOut); - - // set the connection media type - HRESULT SetMediaType(const CMediaType *pmt); - - // called from CBaseOutputPin during connection to ask for - // the count and size of buffers we need. - HRESULT DecideBufferSize( - IMemAllocator * pAlloc, - ALLOCATOR_PROPERTIES *pProp); - - // returns the preferred formats for a pin - HRESULT GetMediaType(int iPosition,CMediaType *pMediaType); - - // inherited from IQualityControl via CBasePin - STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); - - // Media type -public: - CMediaType& CurrentMediaType() { return m_mt; }; -}; - - -class AM_NOVTABLE CTransformFilter : public CBaseFilter -{ - -public: - - // map getpin/getpincount for base enum of pins to owner - // override this to return more specialised pin objects - - virtual int GetPinCount(); - virtual CBasePin * GetPin(int n); - STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin); - - // override state changes to allow derived transform filter - // to control streaming start/stop - STDMETHODIMP Stop(); - STDMETHODIMP Pause(); - -public: - - CTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid); -#ifdef UNICODE - CTransformFilter(CHAR *, LPUNKNOWN, REFCLSID clsid); -#endif - ~CTransformFilter(); - - // ================================================================= - // ----- override these bits --------------------------------------- - // ================================================================= - - // These must be supplied in a derived class - - virtual HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut); - - // check if you can support mtIn - virtual HRESULT CheckInputType(const CMediaType* mtIn) PURE; - - // check if you can support the transform from this input to this output - virtual HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut) PURE; - - // this goes in the factory template table to create new instances - // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); - - // call the SetProperties function with appropriate arguments - virtual HRESULT DecideBufferSize( - IMemAllocator * pAllocator, - ALLOCATOR_PROPERTIES *pprop) PURE; - - // override to suggest OUTPUT pin media types - virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE; - - - - // ================================================================= - // ----- Optional Override Methods ----------------------- - // ================================================================= - - // you can also override these if you want to know about streaming - virtual HRESULT StartStreaming(); - virtual HRESULT StopStreaming(); - - // override if you can do anything constructive with quality notifications - virtual HRESULT AlterQuality(Quality q); - - // override this to know when the media type is actually set - virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); - - // chance to grab extra interfaces on connection - virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin); - virtual HRESULT BreakConnect(PIN_DIRECTION dir); - virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin); - - // chance to customize the transform process - virtual HRESULT Receive(IMediaSample *pSample); - - // Standard setup for output sample - HRESULT InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample); - - // if you override Receive, you may need to override these three too - virtual HRESULT EndOfStream(void); - virtual HRESULT BeginFlush(void); - virtual HRESULT EndFlush(void); - virtual HRESULT NewSegment( - REFERENCE_TIME tStart, - REFERENCE_TIME tStop, - double dRate); - -#ifdef PERF - // Override to register performance measurement with a less generic string - // You should do this to avoid confusion with other filters - virtual void RegisterPerfId() - {m_idTransform = MSR_REGISTER(TEXT("Transform"));} -#endif // PERF - - -// implementation details - -protected: - -#ifdef PERF - int m_idTransform; // performance measuring id -#endif - BOOL m_bEOSDelivered; // have we sent EndOfStream - BOOL m_bSampleSkipped; // Did we just skip a frame - BOOL m_bQualityChanged; // Have we degraded? - - // critical section protecting filter state. - - CCritSec m_csFilter; - - // critical section stopping state changes (ie Stop) while we're - // processing a sample. - // - // This critical section is held when processing - // events that occur on the receive thread - Receive() and EndOfStream(). - // - // If you want to hold both m_csReceive and m_csFilter then grab - // m_csFilter FIRST - like CTransformFilter::Stop() does. - - CCritSec m_csReceive; - - // these hold our input and output pins - - friend class CTransformInputPin; - friend class CTransformOutputPin; - CTransformInputPin *m_pInput; - CTransformOutputPin *m_pOutput; -}; - -#endif /* __TRANSFRM__ */ - - +//------------------------------------------------------------------------------ +// File: Transfrm.h +// +// Desc: DirectShow base classes - defines classes from which simple +// transform codecs may be derived. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// It assumes the codec has one input and one output stream, and has no +// interest in memory management, interface negotiation or anything else. +// +// derive your class from this, and supply Transform and the media type/format +// negotiation functions. Implement that class, compile and link and +// you're done. + + +#ifndef __TRANSFRM__ +#define __TRANSFRM__ + +// ====================================================================== +// This is the com object that represents a simple transform filter. It +// supports IBaseFilter, IMediaFilter and two pins through nested interfaces +// ====================================================================== + +class CTransformFilter; + +// ================================================== +// Implements the input pin +// ================================================== + +class CTransformInputPin : public CBaseInputPin +{ + friend class CTransformFilter; + +protected: + CTransformFilter *m_pTransformFilter; + + +public: + + CTransformInputPin( + TCHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName); +#ifdef UNICODE + CTransformInputPin( + char *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName); +#endif + + STDMETHODIMP QueryId(LPWSTR * Id) + { + return AMGetWideString(L"In", Id); + } + + // Grab and release extra interfaces if required + + HRESULT CheckConnect(IPin *pPin); + HRESULT BreakConnect(); + HRESULT CompleteConnect(IPin *pReceivePin); + + // check that we can support this output type + HRESULT CheckMediaType(const CMediaType* mtIn); + + // set the connection media type + HRESULT SetMediaType(const CMediaType* mt); + + // --- IMemInputPin ----- + + // here's the next block of data from the stream. + // AddRef it yourself if you need to hold it beyond the end + // of this call. + STDMETHODIMP Receive(IMediaSample * pSample); + + // provide EndOfStream that passes straight downstream + // (there is no queued data) + STDMETHODIMP EndOfStream(void); + + // passes it to CTransformFilter::BeginFlush + STDMETHODIMP BeginFlush(void); + + // passes it to CTransformFilter::EndFlush + STDMETHODIMP EndFlush(void); + + STDMETHODIMP NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate); + + // Check if it's OK to process samples + virtual HRESULT CheckStreaming(); + + // Media type +public: + CMediaType& CurrentMediaType() { return m_mt; }; + +}; + +// ================================================== +// Implements the output pin +// ================================================== + +class CTransformOutputPin : public CBaseOutputPin +{ + friend class CTransformFilter; + +protected: + CTransformFilter *m_pTransformFilter; + +public: + + // implement IMediaPosition by passing upstream + IUnknown * m_pPosition; + + CTransformOutputPin( + TCHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName); +#ifdef UNICODE + CTransformOutputPin( + CHAR *pObjectName, + CTransformFilter *pTransformFilter, + HRESULT * phr, + LPCWSTR pName); +#endif + ~CTransformOutputPin(); + + // override to expose IMediaPosition + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv); + + // --- CBaseOutputPin ------------ + + STDMETHODIMP QueryId(LPWSTR * Id) + { + return AMGetWideString(L"Out", Id); + } + + // Grab and release extra interfaces if required + + HRESULT CheckConnect(IPin *pPin); + HRESULT BreakConnect(); + HRESULT CompleteConnect(IPin *pReceivePin); + + // check that we can support this output type + HRESULT CheckMediaType(const CMediaType* mtOut); + + // set the connection media type + HRESULT SetMediaType(const CMediaType *pmt); + + // called from CBaseOutputPin during connection to ask for + // the count and size of buffers we need. + HRESULT DecideBufferSize( + IMemAllocator * pAlloc, + ALLOCATOR_PROPERTIES *pProp); + + // returns the preferred formats for a pin + HRESULT GetMediaType(int iPosition,CMediaType *pMediaType); + + // inherited from IQualityControl via CBasePin + STDMETHODIMP Notify(IBaseFilter * pSender, Quality q); + + // Media type +public: + CMediaType& CurrentMediaType() { return m_mt; }; +}; + + +class AM_NOVTABLE CTransformFilter : public CBaseFilter +{ + +public: + + // map getpin/getpincount for base enum of pins to owner + // override this to return more specialised pin objects + + virtual int GetPinCount(); + virtual CBasePin * GetPin(int n); + STDMETHODIMP FindPin(LPCWSTR Id, IPin **ppPin); + + // override state changes to allow derived transform filter + // to control streaming start/stop + STDMETHODIMP Stop(); + STDMETHODIMP Pause(); + +public: + + CTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid); +#ifdef UNICODE + CTransformFilter(CHAR *, LPUNKNOWN, REFCLSID clsid); +#endif + ~CTransformFilter(); + + // ================================================================= + // ----- override these bits --------------------------------------- + // ================================================================= + + // These must be supplied in a derived class + + virtual HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut); + + // check if you can support mtIn + virtual HRESULT CheckInputType(const CMediaType* mtIn) PURE; + + // check if you can support the transform from this input to this output + virtual HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut) PURE; + + // this goes in the factory template table to create new instances + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + + // call the SetProperties function with appropriate arguments + virtual HRESULT DecideBufferSize( + IMemAllocator * pAllocator, + ALLOCATOR_PROPERTIES *pprop) PURE; + + // override to suggest OUTPUT pin media types + virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE; + + + + // ================================================================= + // ----- Optional Override Methods ----------------------- + // ================================================================= + + // you can also override these if you want to know about streaming + virtual HRESULT StartStreaming(); + virtual HRESULT StopStreaming(); + + // override if you can do anything constructive with quality notifications + virtual HRESULT AlterQuality(Quality q); + + // override this to know when the media type is actually set + virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); + + // chance to grab extra interfaces on connection + virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin); + virtual HRESULT BreakConnect(PIN_DIRECTION dir); + virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin); + + // chance to customize the transform process + virtual HRESULT Receive(IMediaSample *pSample); + + // Standard setup for output sample + HRESULT InitializeOutputSample(IMediaSample *pSample, IMediaSample **ppOutSample); + + // if you override Receive, you may need to override these three too + virtual HRESULT EndOfStream(void); + virtual HRESULT BeginFlush(void); + virtual HRESULT EndFlush(void); + virtual HRESULT NewSegment( + REFERENCE_TIME tStart, + REFERENCE_TIME tStop, + double dRate); + +#ifdef PERF + // Override to register performance measurement with a less generic string + // You should do this to avoid confusion with other filters + virtual void RegisterPerfId() + {m_idTransform = MSR_REGISTER(TEXT("Transform"));} +#endif // PERF + + +// implementation details + +protected: + +#ifdef PERF + int m_idTransform; // performance measuring id +#endif + BOOL m_bEOSDelivered; // have we sent EndOfStream + BOOL m_bSampleSkipped; // Did we just skip a frame + BOOL m_bQualityChanged; // Have we degraded? + + // critical section protecting filter state. + + CCritSec m_csFilter; + + // critical section stopping state changes (ie Stop) while we're + // processing a sample. + // + // This critical section is held when processing + // events that occur on the receive thread - Receive() and EndOfStream(). + // + // If you want to hold both m_csReceive and m_csFilter then grab + // m_csFilter FIRST - like CTransformFilter::Stop() does. + + CCritSec m_csReceive; + + // these hold our input and output pins + + friend class CTransformInputPin; + friend class CTransformOutputPin; + CTransformInputPin *m_pInput; + CTransformOutputPin *m_pOutput; +}; + +#endif /* __TRANSFRM__ */ + + diff --git a/src/BaseClasses/transip.cpp b/src/BaseClasses/transip.cpp index c0ef17a094..3e87572891 100644 --- a/src/BaseClasses/transip.cpp +++ b/src/BaseClasses/transip.cpp @@ -1,922 +1,922 @@ -//------------------------------------------------------------------------------ -// File: TransIP.cpp -// -// Desc: DirectShow base classes - implements class for simple Transform- -// In-Place filters such as audio. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// How allocators are decided. -// -// An in-place transform tries to do its work in someone else's buffers. -// It tries to persuade the filters on either side to use the same allocator -// (and for that matter the same media type). In desperation, if the downstream -// filter refuses to supply an allocator and the upstream filter offers only -// a read-only one then it will provide an allocator. -// if the upstream filter insists on a read-only allocator then the transform -// filter will (reluctantly) copy the data before transforming it. -// -// In order to pass an allocator through it needs to remember the one it got -// from the first connection to pass it on to the second one. -// -// It is good if we can avoid insisting on a particular order of connection -// (There is a precedent for insisting on the input -// being connected first. Insisting on the output being connected first is -// not allowed. That would break RenderFile.) -// -// The base pin classes (CBaseOutputPin and CBaseInputPin) both have a -// m_pAllocator member which is used in places like -// CBaseOutputPin::GetDeliveryBuffer and CBaseInputPin::Inactive. -// To avoid lots of extra overriding, we should keep these happy -// by using these pointers. -// -// When each pin is connected, it will set the corresponding m_pAllocator -// and will have a single ref-count on that allocator. -// -// Refcounts are acquired by GetAllocator calls which return AddReffed -// allocators and are released in one of: -// CBaseInputPin::Disconnect -// CBaseOutputPin::BreakConect -// In each case m_pAllocator is set to NULL after the release, so this -// is the last chance to ever release it. If there should ever be -// multiple refcounts associated with the same pointer, this had better -// be cleared up before that happens. To avoid such problems, we'll -// stick with one per pointer. - - - -// RECONNECTING and STATE CHANGES -// -// Each pin could be disconnected, connected with a read-only allocator, -// connected with an upstream read/write allocator, connected with an -// allocator from downstream or connected with its own allocator. -// Five states for each pin gives a data space of 25 states. -// -// Notation: -// -// R/W == read/write -// R-O == read-only -// -// -// -// 00 means an unconnected pin. -// <- means using a R/W allocator from the upstream filter -// <= means using a R-O allocator from an upstream filter -// || means using our own (R/W) allocator. -// -> means using a R/W allocator from a downstream filter -// (a R-O allocator from downstream is nonsense, it can't ever work). -// -// -// That makes 25 possible states. Some states are nonsense (two different -// allocators from the same place). These are just an artifact of the notation. -// <= <- Nonsense. -// <- <= Nonsense -// Some states are illegal (the output pin never accepts a R-O allocator): -// 00 <= !! Error !! -// <= <= !! Error !! -// || <= !! Error !! -// -> <= !! Error !! -// Three states appears to be inaccessible: -// -> || Inaccessible -// || -> Inaccessible -// || <- Inaccessible -// Some states only ever occur as intermediates with a pending reconnect which -// is guaranteed to finish in another state. -// -> 00 ?? unstable goes to || 00 -// 00 <- ?? unstable goes to 00 || -// -> <- ?? unstable goes to -> -> -// <- || ?? unstable goes to <- <- -// <- -> ?? unstable goes to <- <- -// And that leaves 11 possible resting states: -// 1 00 00 Nothing connected. -// 2 <- 00 Input pin connected. -// 3 <= 00 Input pin connected using R-O allocator. -// 4 || 00 Needs several state changes to get here. -// 5 00 || Output pin connected using our allocator -// 6 00 -> Downstream only connected -// 7 || || Undesirable but can be forced upon us. -// 8 <= || Copy forced. <= -> is preferable -// 9 <= -> OK - forced to copy. -// 10 <- <- Transform in place (ideal) -// 11 -> -> Transform in place (ideal) -// -// The object of the exercise is to ensure that we finish up in states -// 10 or 11 whenever possible. State 10 is only possible if the upstream -// filter has a R/W allocator (the AVI splitter notoriously -// doesn't) and state 11 is only possible if the downstream filter does -// offer an allocator. -// -// The transition table (entries marked * go via a reconnect) -// -// There are 8 possible transitions: -// A: Connect upstream to filter with R-O allocator that insists on using it. -// B: Connect upstream to filter with R-O allocator but chooses not to use it. -// C: Connect upstream to filter with R/W allocator and insists on using it. -// D: Connect upstream to filter with R/W allocator but chooses not to use it. -// E: Connect downstream to a filter that offers an allocator -// F: Connect downstream to a filter that does not offer an allocator -// G: disconnect upstream -// H: Disconnect downstream -// -// A B C D E F G H -// --------------------------------------------------------- -// 00 00 1 | 3 3 2 2 6 5 . . |1 00 00 -// <- 00 2 | . . . . *10/11 10 1 . |2 <- 00 -// <= 00 3 | . . . . *9/11 *7/8 1 . |3 <= 00 -// || 00 4 | . . . . *8 *7 1 . |4 || 00 -// 00 || 5 | 8 7 *10 7 . . . 1 |5 00 || -// 00 -> 6 | 9 11 *10 11 . . . 1 |6 00 -> -// || || 7 | . . . . . . 5 4 |7 || || -// <= || 8 | . . . . . . 5 3 |8 <= || -// <= -> 9 | . . . . . . 6 3 |9 <= -> -// <- <- 10| . . . . . . *5/6 2 |10 <- <- -// -> -> 11| . . . . . . 6 *2/3 |11 -> -> -// --------------------------------------------------------- -// A B C D E F G H -// -// All these states are accessible without requiring any filter to -// change its behaviour but not all transitions are accessible, for -// instance a transition from state 4 to anywhere other than -// state 8 requires that the upstream filter first offer a R-O allocator -// and then changes its mind and offer R/W. This is NOT allowable - it -// leads to things like the output pin getting a R/W allocator from -// upstream and then the input pin being told it can only have a R-O one. -// Note that you CAN change (say) the upstream filter for a different one, but -// only as a disconnect / connect, not as a Reconnect. (Exercise for -// the reader is to see how you get into state 4). -// -// The reconnection stuff goes as follows (some of the cases shown here as -// "no reconnect" may get one to finalise media type - an old story). -// If there is a reconnect where it says "no reconnect" here then the -// reconnection must not change the allocator choice. -// -// state 2: <- 00 transition E <- <- case C <- <- (no change) -// case D -> <- and then to -> -> -// -// state 2: <- 00 transition F <- <- (no reconnect) -// -// state 3: <= 00 transition E <= -> case A <= -> (no change) -// case B -> -> -// transition F <= || case A <= || (no change) -// case B || || -// -// state 4: || 00 transition E || || case B -> || and then all cases to -> -> -// F || || case B || || (no change) -// -// state 5: 00 || transition A <= || (no reconnect) -// B || || (no reconnect) -// C <- || all cases <- <- -// D || || (unfortunate, but upstream's choice) -// -// state 6: 00 -> transition A <= -> (no reconnect) -// B -> -> (no reconnect) -// C <- -> all cases <- <- -// D -> -> (no reconnect) -// -// state 10:<- <- transition G 00 <- case E 00 -> -// case F 00 || -// -// state 11:-> -> transition H -> 00 case A <= 00 (schizo) -// case B <= 00 -// case C <- 00 (schizo) -// case D <- 00 -// -// The Rules: -// To sort out media types: -// The input is reconnected -// if the input pin is connected and the output pin connects -// The output is reconnected -// If the output pin is connected -// and the input pin connects to a different media type -// -// To sort out allocators: -// The input is reconnected -// if the output disconnects and the input was using a downstream allocator -// The output pin calls SetAllocator to pass on a new allocator -// if the output is connected and -// if the input disconnects and the output was using an upstream allocator -// if the input acquires an allocator different from the output one -// and that new allocator is not R-O -// -// Data is copied (i.e. call getbuffer and copy the data before transforming it) -// if the two allocators are different. - - - -// CHAINS of filters: -// -// We sit between two filters (call them A and Z). We should finish up -// with the same allocator on both of our pins and that should be the -// same one that A and Z would have agreed on if we hadn't been in the -// way. Furthermore, it should not matter how many in-place transforms -// are in the way. Let B, C, D... be in-place transforms ("us"). -// Here's how it goes: -// -// 1. -// A connects to B. They agree on A's allocator. -// A-a->B -// -// 2. -// B connects to C. Same story. There is no point in a reconnect, but -// B will request an input reconnect anyway. -// A-a->B-a->C -// -// 3. -// C connects to Z. -// C insists on using A's allocator, but compromises by requesting a reconnect. -// of C's input. -// A-a->B-?->C-a->Z -// -// We now have pending reconnects on both A--->B and B--->C -// -// 4. -// The A--->B link is reconnected. -// A asks B for an allocator. B sees that it has a downstream connection so -// asks its downstream input pin i.e. C's input pin for an allocator. C sees -// that it too has a downstream connection so asks Z for an allocator. -// -// Even though Z's input pin is connected, it is being asked for an allocator. -// It could refuse, in which case the chain is done and will use A's allocator -// Alternatively, Z may supply one. A chooses either Z's or A's own one. -// B's input pin gets NotifyAllocator called to tell it the decision and it -// propagates this downstream by calling ReceiveAllocator on its output pin -// which calls NotifyAllocator on the next input pin downstream etc. -// If the choice is Z then it goes: -// A-z->B-a->C-a->Z -// A-z->B-z->C-a->Z -// A-z->B-z->C-z->Z -// -// And that's IT!! Any further (essentially spurious) reconnects peter out -// with no change in the chain. - -#include -#include -#include - - -// ================================================================= -// Implements the CTransInPlaceFilter class -// ================================================================= - -CTransInPlaceFilter::CTransInPlaceFilter - ( TCHAR *pName, - LPUNKNOWN pUnk, - REFCLSID clsid, - HRESULT *phr, - bool bModifiesData - ) - : CTransformFilter(pName, pUnk, clsid), - m_bModifiesData(bModifiesData) { -#ifdef PERF - RegisterPerfId(); -#endif // PERF - -} // constructor - -#ifdef UNICODE -CTransInPlaceFilter::CTransInPlaceFilter - ( CHAR *pName, - LPUNKNOWN pUnk, - REFCLSID clsid, - HRESULT *phr, - bool bModifiesData - ) - : CTransformFilter(pName, pUnk, clsid), - m_bModifiesData(bModifiesData) { -#ifdef PERF - RegisterPerfId(); -#endif // PERF - -} // constructor -#endif - -// return a non-addrefed CBasePin * for the user to addref if he holds onto it -// for longer than his pointer to us. We create the pins dynamically when they -// are asked for rather than in the constructor. This is because we want to -// give the derived class an oppportunity to return different pin objects - -// As soon as any pin is needed we create both (this is different from the -// usual transform filter) because enumerators, allocators etc are passed -// through from one pin to another and it becomes very painful if the other -// pin isn't there. If we fail to create either pin we ensure we fail both. - -CBasePin * -CTransInPlaceFilter::GetPin(int n) { - HRESULT hr = S_OK; - - // Create an input pin if not already done - - if(m_pInput == NULL) { - - m_pInput = new CTransInPlaceInputPin(NAME("TransInPlace input pin") - , this // Owner filter - , &hr // Result code - , L"Input" // Pin name - ); - - // Constructor for CTransInPlaceInputPin can't fail - ASSERT(SUCCEEDED(hr)); - } - - // Create an output pin if not already done - - if(m_pInput!=NULL && m_pOutput == NULL) { - - m_pOutput = new CTransInPlaceOutputPin(NAME("TransInPlace output pin") - , this // Owner filter - , &hr // Result code - , L"Output" // Pin name - ); - - // a failed return code should delete the object - - ASSERT(SUCCEEDED(hr)); - if(m_pOutput == NULL) { - delete m_pInput; - m_pInput = NULL; - } - } - - // Return the appropriate pin - - ASSERT(n>=0 && n<=1); - if(n == 0) { - return m_pInput; - } - else if(n==1) { - return m_pOutput; - } - else { - return NULL; - } - -} // GetPin - - - -// dir is the direction of our pin. -// pReceivePin is the pin we are connecting to. -HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin) { - UNREFERENCED_PARAMETER(pReceivePin); - ASSERT(m_pInput); - ASSERT(m_pOutput); - - // if we are not part of a graph, then don't indirect the pointer - // this probably prevents use of the filter without a filtergraph - if(!m_pGraph) { - return VFW_E_NOT_IN_GRAPH; - } - - // Always reconnect the input to account for buffering changes - // - // Because we don't get to suggest a type on ReceiveConnection - // we need another way of making sure the right type gets used. - // - // One way would be to have our EnumMediaTypes return our output - // connection type first but more deterministic and simple is to - // call ReconnectEx passing the type we want to reconnect with - // via the base class ReconeectPin method. - - if(dir == PINDIR_OUTPUT) { - if(m_pInput->IsConnected()) { - return ReconnectPin(m_pInput, &m_pOutput->CurrentMediaType()); - } - return NOERROR; - } - - ASSERT(dir == PINDIR_INPUT); - - // Reconnect output if necessary - - if(m_pOutput->IsConnected()) { - - if(m_pInput->CurrentMediaType() - != m_pOutput->CurrentMediaType()) { - return ReconnectPin(m_pOutput, &m_pInput->CurrentMediaType()); - } - } - return NOERROR; - -} // ComnpleteConnect - - -// -// DecideBufferSize -// -// Tell the output pin's allocator what size buffers we require. -// *pAlloc will be the allocator our output pin is using. -// - -HRESULT CTransInPlaceFilter::DecideBufferSize - ( IMemAllocator *pAlloc - , ALLOCATOR_PROPERTIES *pProperties - ) { - ALLOCATOR_PROPERTIES Request, Actual; - HRESULT hr; - - // If we are connected upstream, get his views - if(m_pInput->IsConnected()) { - // Get the input pin allocator, and get its size and count. - // we don't care about his alignment and prefix. - - hr = InputPin()->PeekAllocator()->GetProperties(&Request); - if(FAILED(hr)) { - // Input connected but with a secretive allocator - enough! - return hr; - } - } - else { - // We're reduced to blind guessing. Let's guess one byte and if - // this isn't enough then when the other pin does get connected - // we can revise it. - ZeroMemory(&Request, sizeof(Request)); - Request.cBuffers = 1; - Request.cbBuffer = 1; - } - - - DbgLog((LOG_MEMORY,1,TEXT("Setting Allocator Requirements"))); - DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d"), - Request.cBuffers, Request.cbBuffer)); - - // Pass the allocator requirements to our output side - // but do a little sanity checking first or we'll just hit - // asserts in the allocator. - - pProperties->cBuffers = Request.cBuffers; - pProperties->cbBuffer = Request.cbBuffer; - if(pProperties->cBuffers<=0) {pProperties->cBuffers = 1; - } - if(pProperties->cbBuffer<=0) {pProperties->cbBuffer = 1; - } - hr = pAlloc->SetProperties(pProperties, &Actual); - - if(FAILED(hr)) { - return hr; - } - - DbgLog((LOG_MEMORY,1,TEXT("Obtained Allocator Requirements"))); - DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d, Alignment %d"), - Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign)); - - // Make sure we got the right alignment and at least the minimum required - - if((Request.cBuffers > Actual.cBuffers) - || (Request.cbBuffer > Actual.cbBuffer) - || (Request.cbAlign > Actual.cbAlign)) { - return E_FAIL; - } - return NOERROR; - -} // DecideBufferSize - -// -// Copy -// -// return a pointer to an identical copy of pSample -IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource) { - IMediaSample * pDest; - - HRESULT hr; - REFERENCE_TIME tStart, tStop; - const BOOL bTime = S_OK == pSource->GetTime(&tStart, &tStop); - - // this may block for an indeterminate amount of time - hr = OutputPin()->PeekAllocator()->GetBuffer(&pDest - , bTime ? &tStart : NULL - , bTime ? &tStop : NULL - , m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0); - - if(FAILED(hr)) { - return NULL; - } - - ASSERT(pDest); - IMediaSample2 *pSample2; - if(SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) { - HRESULT hr = pSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer), - (PBYTE)m_pInput->SampleProps()); - pSample2->Release(); - if(FAILED(hr)) { - pDest->Release(); - return NULL; - } - } - else { - if(bTime) { - pDest->SetTime(&tStart, &tStop); - } - - if(S_OK == pSource->IsSyncPoint()) { - pDest->SetSyncPoint(TRUE); - } - if(S_OK == pSource->IsDiscontinuity() || m_bSampleSkipped) { - pDest->SetDiscontinuity(TRUE); - } - if(S_OK == pSource->IsPreroll()) { - pDest->SetPreroll(TRUE); - } - - // Copy the media type - AM_MEDIA_TYPE *pMediaType; - if(S_OK == pSource->GetMediaType(&pMediaType)) { - pDest->SetMediaType(pMediaType); - DeleteMediaType(pMediaType); - } - - } - - m_bSampleSkipped = FALSE; - - // Copy the sample media times - REFERENCE_TIME TimeStart, TimeEnd; - if(pSource->GetMediaTime(&TimeStart,&TimeEnd) == NOERROR) { - pDest->SetMediaTime(&TimeStart,&TimeEnd); - } - - // Copy the actual data length and the actual data. - { - const long lDataLength = pSource->GetActualDataLength(); - pDest->SetActualDataLength(lDataLength); - - // Copy the sample data - { - BYTE *pSourceBuffer, *pDestBuffer; - long lSourceSize = pSource->GetSize(); - long lDestSize = pDest->GetSize(); - - ASSERT(lDestSize >= lSourceSize && lDestSize >= lDataLength); - - pSource->GetPointer(&pSourceBuffer); - pDest->GetPointer(&pDestBuffer); - ASSERT(lDestSize == 0 || pSourceBuffer != NULL && pDestBuffer != NULL); - - CopyMemory((PVOID) pDestBuffer, (PVOID) pSourceBuffer, lDataLength); - } - } - - return pDest; - -} // Copy - - -// override this to customize the transform process - -HRESULT -CTransInPlaceFilter::Receive(IMediaSample *pSample) { - /* Check for other streams and pass them on */ - AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); - if(pProps->dwStreamId != AM_STREAM_MEDIA) { - return m_pOutput->Deliver(pSample); - } - HRESULT hr; - - // Start timing the TransInPlace (if PERF is defined) - MSR_START(m_idTransInPlace); - - if(UsingDifferentAllocators()) { - - // We have to copy the data. - - pSample = Copy(pSample); - - if(pSample==NULL) { - MSR_STOP(m_idTransInPlace); - return E_UNEXPECTED; - } - } - - // have the derived class transform the data - hr = Transform(pSample); - - // Stop the clock and log it (if PERF is defined) - MSR_STOP(m_idTransInPlace); - - if(FAILED(hr)) { - DbgLog((LOG_TRACE, 1, TEXT("Error from TransInPlace"))); - if(UsingDifferentAllocators()) { - pSample->Release(); - } - return hr; - } - - // the Transform() function can return S_FALSE to indicate that the - // sample should not be delivered; we only deliver the sample if it's - // really S_OK (same as NOERROR, of course.) - if(hr == NOERROR) { - hr = m_pOutput->Deliver(pSample); - } - else { - // But it would be an error to return this private workaround - // to the caller ... - if(S_FALSE == hr) { - // S_FALSE returned from Transform is a PRIVATE agreement - // We should return NOERROR from Receive() in this cause because - // returning S_FALSE from Receive() means that this is the end - // of the stream and no more data should be sent. - m_bSampleSkipped = TRUE; - if(!m_bQualityChanged) { - NotifyEvent(EC_QUALITY_CHANGE,0,0); - m_bQualityChanged = TRUE; - } - hr = NOERROR; - } - } - - // release the output buffer. If the connected pin still needs it, - // it will have addrefed it itself. - if(UsingDifferentAllocators()) { - pSample->Release(); - } - - return hr; - -} // Receive - - - -// ================================================================= -// Implements the CTransInPlaceInputPin class -// ================================================================= - - -// constructor - -CTransInPlaceInputPin::CTransInPlaceInputPin - ( TCHAR *pObjectName - , CTransInPlaceFilter *pFilter - , HRESULT *phr - , LPCWSTR pName - ) - : CTransformInputPin(pObjectName, - pFilter, - phr, - pName) - , m_bReadOnly(FALSE) - , m_pTIPFilter(pFilter) { - - DbgLog((LOG_TRACE, 2 - , TEXT("CTransInPlaceInputPin::CTransInPlaceInputPin"))); - -} // constructor - - -// ================================================================= -// Implements IMemInputPin interface -// ================================================================= - - -// If the downstream filter has one then offer that (even if our own output -// pin is not using it yet. If the upstream filter chooses it then we will -// tell our output pin to ReceiveAllocator). -// Else if our output pin is using an allocator then offer that. -// ( This could mean offering the upstream filter his own allocator, -// it could mean offerring our own -// ) or it could mean offering the one from downstream -// Else fail to offer any allocator at all. - -STDMETHODIMP CTransInPlaceInputPin::GetAllocator(IMemAllocator ** ppAllocator) { - CheckPointer(ppAllocator,E_POINTER); - ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *)); - CAutoLock cObjectLock(m_pLock); - - HRESULT hr; - - if(m_pTIPFilter->m_pOutput->IsConnected()) { - // Store the allocator we got - hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() - ->GetAllocator(ppAllocator); - if(SUCCEEDED(hr)) { - m_pTIPFilter->OutputPin()->SetAllocator(*ppAllocator); - } - } - else { - // Help upstream filter (eg TIP filter which is having to do a copy) - // by providing a temp allocator here - we'll never use - // this allocator because when our output is connected we'll - // reconnect this pin - hr = CTransformInputPin::GetAllocator(ppAllocator); - } - return hr; - -} // GetAllocator - - - -/* Get told which allocator the upstream output pin is actually going to use */ - - -STDMETHODIMP -CTransInPlaceInputPin::NotifyAllocator( - IMemAllocator * pAllocator, - BOOL bReadOnly) { - HRESULT hr = S_OK; - CheckPointer(pAllocator,E_POINTER); - ValidateReadPtr(pAllocator,sizeof(IMemAllocator)); - - CAutoLock cObjectLock(m_pLock); - - m_bReadOnly = bReadOnly; - // If we modify data then don't accept the allocator if it's - // the same as the output pin's allocator - - // If our output is not connected just accept the allocator - // We're never going to use this allocator because when our - // output pin is connected we'll reconnect this pin - if(!m_pTIPFilter->OutputPin()->IsConnected()) { - return CTransformInputPin::NotifyAllocator(pAllocator, bReadOnly); - } - - // If the allocator is read-only and we're modifying data - // and the allocator is the same as the output pin's - // then reject - if(bReadOnly && m_pTIPFilter->m_bModifiesData) { - IMemAllocator *pOutputAllocator = - m_pTIPFilter->OutputPin()->PeekAllocator(); - - // Make sure we have an output allocator - if(pOutputAllocator == NULL) { - hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()-> - GetAllocator(&pOutputAllocator); - if(FAILED(hr)) { - hr = CreateMemoryAllocator(&pOutputAllocator); - } - if(SUCCEEDED(hr)) { - m_pTIPFilter->OutputPin()->SetAllocator(pOutputAllocator); - pOutputAllocator->Release(); - } - } - if(pAllocator == pOutputAllocator) { - hr = E_FAIL; - } - else if(SUCCEEDED(hr)) { - // Must copy so set the allocator properties on the output - ALLOCATOR_PROPERTIES Props, Actual={0}; - hr = pAllocator->GetProperties(&Props); - if(SUCCEEDED(hr)) { - hr = pOutputAllocator->SetProperties(&Props, &Actual); - } - if(SUCCEEDED(hr)) { - if((Props.cBuffers > Actual.cBuffers) - || (Props.cbBuffer > Actual.cbBuffer) - || (Props.cbAlign > Actual.cbAlign)) { - hr = E_FAIL; - } - } - - // Set the allocator on the output pin - if(SUCCEEDED(hr)) { - hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() - ->NotifyAllocator(pOutputAllocator, FALSE); - } - } - } - else { - hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() - ->NotifyAllocator(pAllocator, bReadOnly); - if(SUCCEEDED(hr)) { - m_pTIPFilter->OutputPin()->SetAllocator(pAllocator); - } - } - - if(SUCCEEDED(hr)) { - - // It's possible that the old and the new are the same thing. - // AddRef before release ensures that we don't unload it. - pAllocator->AddRef(); - - if(m_pAllocator != NULL) - m_pAllocator->Release(); - - m_pAllocator = pAllocator; // We have an allocator for the input pin - } - - return hr; - -} // NotifyAllocator - - -// EnumMediaTypes -// - pass through to our downstream filter -STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum ) { - // Can only pass through if connected - if(!m_pTIPFilter->m_pOutput->IsConnected()) - return VFW_E_NOT_CONNECTED; - - return m_pTIPFilter->m_pOutput->GetConnected()->EnumMediaTypes(ppEnum); - -} // EnumMediaTypes - - -// CheckMediaType -// - agree to anything if not connected, -// otherwise pass through to the downstream filter. -// This assumes that the filter does not change the media type. - -HRESULT CTransInPlaceInputPin::CheckMediaType(const CMediaType *pmt ) { - HRESULT hr = m_pTIPFilter->CheckInputType(pmt); - if(hr!=S_OK) return hr; - - if(m_pTIPFilter->m_pOutput->IsConnected()) - return m_pTIPFilter->m_pOutput->GetConnected()->QueryAccept(pmt); - else - return S_OK; - -} // CheckMediaType - - -// If upstream asks us what our requirements are, we will try to ask downstream -// if that doesn't work, we'll just take the defaults. -STDMETHODIMP -CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps) { - - if(m_pTIPFilter->m_pOutput->IsConnected()) - return m_pTIPFilter->OutputPin() - ->ConnectedIMemInputPin()->GetAllocatorRequirements(pProps); - else - return E_NOTIMPL; - -} // GetAllocatorRequirements - - - -// ================================================================= -// Implements the CTransInPlaceOutputPin class -// ================================================================= - - -// constructor - -CTransInPlaceOutputPin::CTransInPlaceOutputPin( - TCHAR *pObjectName, - CTransInPlaceFilter *pFilter, - HRESULT * phr, - LPCWSTR pPinName) - : CTransformOutputPin( pObjectName - , pFilter - , phr - , pPinName), - m_pTIPFilter(pFilter) { - - DbgLog(( LOG_TRACE, 2 - , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin"))); - -} // constructor - - -// EnumMediaTypes -// - pass through to our upstream filter -STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum ) { - // Can only pass through if connected. - if(! m_pTIPFilter->m_pInput->IsConnected()) - return VFW_E_NOT_CONNECTED; - - return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes(ppEnum); - -} // EnumMediaTypes - - - -// CheckMediaType -// - agree to anything if not connected, -// otherwise pass through to the upstream filter. - -HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt ) { - // Don't accept any output pin type changes if we're copying - // between allocators - it's too late to change the input - // allocator size. - if(m_pTIPFilter->UsingDifferentAllocators() && !m_pFilter->IsStopped()) { - if(*pmt == m_mt) { - return S_OK; - } - else { - return VFW_E_TYPE_NOT_ACCEPTED; - } - } - - // Assumes the type does not change. That's why we're calling - // CheckINPUTType here on the OUTPUT pin. - HRESULT hr = m_pTIPFilter->CheckInputType(pmt); - if(hr!=S_OK) - return hr; - - if(m_pTIPFilter->m_pInput->IsConnected()) - return m_pTIPFilter->m_pInput->GetConnected()->QueryAccept(pmt); - else - return S_OK; - -} //CheckMediaType - - -/* Save the allocator pointer in the output pin -*/ -void -CTransInPlaceOutputPin::SetAllocator(IMemAllocator * pAllocator) { - pAllocator->AddRef(); - if(m_pAllocator) { - m_pAllocator->Release(); - } - m_pAllocator = pAllocator; -} // receiveAllocator +//------------------------------------------------------------------------------ +// File: TransIP.cpp +// +// Desc: DirectShow base classes - implements class for simple Transform- +// In-Place filters such as audio. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// How allocators are decided. +// +// An in-place transform tries to do its work in someone else's buffers. +// It tries to persuade the filters on either side to use the same allocator +// (and for that matter the same media type). In desperation, if the downstream +// filter refuses to supply an allocator and the upstream filter offers only +// a read-only one then it will provide an allocator. +// if the upstream filter insists on a read-only allocator then the transform +// filter will (reluctantly) copy the data before transforming it. +// +// In order to pass an allocator through it needs to remember the one it got +// from the first connection to pass it on to the second one. +// +// It is good if we can avoid insisting on a particular order of connection +// (There is a precedent for insisting on the input +// being connected first. Insisting on the output being connected first is +// not allowed. That would break RenderFile.) +// +// The base pin classes (CBaseOutputPin and CBaseInputPin) both have a +// m_pAllocator member which is used in places like +// CBaseOutputPin::GetDeliveryBuffer and CBaseInputPin::Inactive. +// To avoid lots of extra overriding, we should keep these happy +// by using these pointers. +// +// When each pin is connected, it will set the corresponding m_pAllocator +// and will have a single ref-count on that allocator. +// +// Refcounts are acquired by GetAllocator calls which return AddReffed +// allocators and are released in one of: +// CBaseInputPin::Disconnect +// CBaseOutputPin::BreakConect +// In each case m_pAllocator is set to NULL after the release, so this +// is the last chance to ever release it. If there should ever be +// multiple refcounts associated with the same pointer, this had better +// be cleared up before that happens. To avoid such problems, we'll +// stick with one per pointer. + + + +// RECONNECTING and STATE CHANGES +// +// Each pin could be disconnected, connected with a read-only allocator, +// connected with an upstream read/write allocator, connected with an +// allocator from downstream or connected with its own allocator. +// Five states for each pin gives a data space of 25 states. +// +// Notation: +// +// R/W == read/write +// R-O == read-only +// +// +// +// 00 means an unconnected pin. +// <- means using a R/W allocator from the upstream filter +// <= means using a R-O allocator from an upstream filter +// || means using our own (R/W) allocator. +// -> means using a R/W allocator from a downstream filter +// (a R-O allocator from downstream is nonsense, it can't ever work). +// +// +// That makes 25 possible states. Some states are nonsense (two different +// allocators from the same place). These are just an artifact of the notation. +// <= <- Nonsense. +// <- <= Nonsense +// Some states are illegal (the output pin never accepts a R-O allocator): +// 00 <= !! Error !! +// <= <= !! Error !! +// || <= !! Error !! +// -> <= !! Error !! +// Three states appears to be inaccessible: +// -> || Inaccessible +// || -> Inaccessible +// || <- Inaccessible +// Some states only ever occur as intermediates with a pending reconnect which +// is guaranteed to finish in another state. +// -> 00 ?? unstable goes to || 00 +// 00 <- ?? unstable goes to 00 || +// -> <- ?? unstable goes to -> -> +// <- || ?? unstable goes to <- <- +// <- -> ?? unstable goes to <- <- +// And that leaves 11 possible resting states: +// 1 00 00 Nothing connected. +// 2 <- 00 Input pin connected. +// 3 <= 00 Input pin connected using R-O allocator. +// 4 || 00 Needs several state changes to get here. +// 5 00 || Output pin connected using our allocator +// 6 00 -> Downstream only connected +// 7 || || Undesirable but can be forced upon us. +// 8 <= || Copy forced. <= -> is preferable +// 9 <= -> OK - forced to copy. +// 10 <- <- Transform in place (ideal) +// 11 -> -> Transform in place (ideal) +// +// The object of the exercise is to ensure that we finish up in states +// 10 or 11 whenever possible. State 10 is only possible if the upstream +// filter has a R/W allocator (the AVI splitter notoriously +// doesn't) and state 11 is only possible if the downstream filter does +// offer an allocator. +// +// The transition table (entries marked * go via a reconnect) +// +// There are 8 possible transitions: +// A: Connect upstream to filter with R-O allocator that insists on using it. +// B: Connect upstream to filter with R-O allocator but chooses not to use it. +// C: Connect upstream to filter with R/W allocator and insists on using it. +// D: Connect upstream to filter with R/W allocator but chooses not to use it. +// E: Connect downstream to a filter that offers an allocator +// F: Connect downstream to a filter that does not offer an allocator +// G: disconnect upstream +// H: Disconnect downstream +// +// A B C D E F G H +// --------------------------------------------------------- +// 00 00 1 | 3 3 2 2 6 5 . . |1 00 00 +// <- 00 2 | . . . . *10/11 10 1 . |2 <- 00 +// <= 00 3 | . . . . *9/11 *7/8 1 . |3 <= 00 +// || 00 4 | . . . . *8 *7 1 . |4 || 00 +// 00 || 5 | 8 7 *10 7 . . . 1 |5 00 || +// 00 -> 6 | 9 11 *10 11 . . . 1 |6 00 -> +// || || 7 | . . . . . . 5 4 |7 || || +// <= || 8 | . . . . . . 5 3 |8 <= || +// <= -> 9 | . . . . . . 6 3 |9 <= -> +// <- <- 10| . . . . . . *5/6 2 |10 <- <- +// -> -> 11| . . . . . . 6 *2/3 |11 -> -> +// --------------------------------------------------------- +// A B C D E F G H +// +// All these states are accessible without requiring any filter to +// change its behaviour but not all transitions are accessible, for +// instance a transition from state 4 to anywhere other than +// state 8 requires that the upstream filter first offer a R-O allocator +// and then changes its mind and offer R/W. This is NOT allowable - it +// leads to things like the output pin getting a R/W allocator from +// upstream and then the input pin being told it can only have a R-O one. +// Note that you CAN change (say) the upstream filter for a different one, but +// only as a disconnect / connect, not as a Reconnect. (Exercise for +// the reader is to see how you get into state 4). +// +// The reconnection stuff goes as follows (some of the cases shown here as +// "no reconnect" may get one to finalise media type - an old story). +// If there is a reconnect where it says "no reconnect" here then the +// reconnection must not change the allocator choice. +// +// state 2: <- 00 transition E <- <- case C <- <- (no change) +// case D -> <- and then to -> -> +// +// state 2: <- 00 transition F <- <- (no reconnect) +// +// state 3: <= 00 transition E <= -> case A <= -> (no change) +// case B -> -> +// transition F <= || case A <= || (no change) +// case B || || +// +// state 4: || 00 transition E || || case B -> || and then all cases to -> -> +// F || || case B || || (no change) +// +// state 5: 00 || transition A <= || (no reconnect) +// B || || (no reconnect) +// C <- || all cases <- <- +// D || || (unfortunate, but upstream's choice) +// +// state 6: 00 -> transition A <= -> (no reconnect) +// B -> -> (no reconnect) +// C <- -> all cases <- <- +// D -> -> (no reconnect) +// +// state 10:<- <- transition G 00 <- case E 00 -> +// case F 00 || +// +// state 11:-> -> transition H -> 00 case A <= 00 (schizo) +// case B <= 00 +// case C <- 00 (schizo) +// case D <- 00 +// +// The Rules: +// To sort out media types: +// The input is reconnected +// if the input pin is connected and the output pin connects +// The output is reconnected +// If the output pin is connected +// and the input pin connects to a different media type +// +// To sort out allocators: +// The input is reconnected +// if the output disconnects and the input was using a downstream allocator +// The output pin calls SetAllocator to pass on a new allocator +// if the output is connected and +// if the input disconnects and the output was using an upstream allocator +// if the input acquires an allocator different from the output one +// and that new allocator is not R-O +// +// Data is copied (i.e. call getbuffer and copy the data before transforming it) +// if the two allocators are different. + + + +// CHAINS of filters: +// +// We sit between two filters (call them A and Z). We should finish up +// with the same allocator on both of our pins and that should be the +// same one that A and Z would have agreed on if we hadn't been in the +// way. Furthermore, it should not matter how many in-place transforms +// are in the way. Let B, C, D... be in-place transforms ("us"). +// Here's how it goes: +// +// 1. +// A connects to B. They agree on A's allocator. +// A-a->B +// +// 2. +// B connects to C. Same story. There is no point in a reconnect, but +// B will request an input reconnect anyway. +// A-a->B-a->C +// +// 3. +// C connects to Z. +// C insists on using A's allocator, but compromises by requesting a reconnect. +// of C's input. +// A-a->B-?->C-a->Z +// +// We now have pending reconnects on both A--->B and B--->C +// +// 4. +// The A--->B link is reconnected. +// A asks B for an allocator. B sees that it has a downstream connection so +// asks its downstream input pin i.e. C's input pin for an allocator. C sees +// that it too has a downstream connection so asks Z for an allocator. +// +// Even though Z's input pin is connected, it is being asked for an allocator. +// It could refuse, in which case the chain is done and will use A's allocator +// Alternatively, Z may supply one. A chooses either Z's or A's own one. +// B's input pin gets NotifyAllocator called to tell it the decision and it +// propagates this downstream by calling ReceiveAllocator on its output pin +// which calls NotifyAllocator on the next input pin downstream etc. +// If the choice is Z then it goes: +// A-z->B-a->C-a->Z +// A-z->B-z->C-a->Z +// A-z->B-z->C-z->Z +// +// And that's IT!! Any further (essentially spurious) reconnects peter out +// with no change in the chain. + +#include +#include +#include + + +// ================================================================= +// Implements the CTransInPlaceFilter class +// ================================================================= + +CTransInPlaceFilter::CTransInPlaceFilter + ( TCHAR *pName, + LPUNKNOWN pUnk, + REFCLSID clsid, + HRESULT *phr, + bool bModifiesData + ) + : CTransformFilter(pName, pUnk, clsid), + m_bModifiesData(bModifiesData) { +#ifdef PERF + RegisterPerfId(); +#endif // PERF + +} // constructor + +#ifdef UNICODE +CTransInPlaceFilter::CTransInPlaceFilter + ( CHAR *pName, + LPUNKNOWN pUnk, + REFCLSID clsid, + HRESULT *phr, + bool bModifiesData + ) + : CTransformFilter(pName, pUnk, clsid), + m_bModifiesData(bModifiesData) { +#ifdef PERF + RegisterPerfId(); +#endif // PERF + +} // constructor +#endif + +// return a non-addrefed CBasePin * for the user to addref if he holds onto it +// for longer than his pointer to us. We create the pins dynamically when they +// are asked for rather than in the constructor. This is because we want to +// give the derived class an oppportunity to return different pin objects + +// As soon as any pin is needed we create both (this is different from the +// usual transform filter) because enumerators, allocators etc are passed +// through from one pin to another and it becomes very painful if the other +// pin isn't there. If we fail to create either pin we ensure we fail both. + +CBasePin * +CTransInPlaceFilter::GetPin(int n) { + HRESULT hr = S_OK; + + // Create an input pin if not already done + + if(m_pInput == NULL) { + + m_pInput = new CTransInPlaceInputPin(NAME("TransInPlace input pin") + , this // Owner filter + , &hr // Result code + , L"Input" // Pin name + ); + + // Constructor for CTransInPlaceInputPin can't fail + ASSERT(SUCCEEDED(hr)); + } + + // Create an output pin if not already done + + if(m_pInput!=NULL && m_pOutput == NULL) { + + m_pOutput = new CTransInPlaceOutputPin(NAME("TransInPlace output pin") + , this // Owner filter + , &hr // Result code + , L"Output" // Pin name + ); + + // a failed return code should delete the object + + ASSERT(SUCCEEDED(hr)); + if(m_pOutput == NULL) { + delete m_pInput; + m_pInput = NULL; + } + } + + // Return the appropriate pin + + ASSERT(n>=0 && n<=1); + if(n == 0) { + return m_pInput; + } + else if(n==1) { + return m_pOutput; + } + else { + return NULL; + } + +} // GetPin + + + +// dir is the direction of our pin. +// pReceivePin is the pin we are connecting to. +HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin) { + UNREFERENCED_PARAMETER(pReceivePin); + ASSERT(m_pInput); + ASSERT(m_pOutput); + + // if we are not part of a graph, then don't indirect the pointer + // this probably prevents use of the filter without a filtergraph + if(!m_pGraph) { + return VFW_E_NOT_IN_GRAPH; + } + + // Always reconnect the input to account for buffering changes + // + // Because we don't get to suggest a type on ReceiveConnection + // we need another way of making sure the right type gets used. + // + // One way would be to have our EnumMediaTypes return our output + // connection type first but more deterministic and simple is to + // call ReconnectEx passing the type we want to reconnect with + // via the base class ReconeectPin method. + + if(dir == PINDIR_OUTPUT) { + if(m_pInput->IsConnected()) { + return ReconnectPin(m_pInput, &m_pOutput->CurrentMediaType()); + } + return NOERROR; + } + + ASSERT(dir == PINDIR_INPUT); + + // Reconnect output if necessary + + if(m_pOutput->IsConnected()) { + + if(m_pInput->CurrentMediaType() + != m_pOutput->CurrentMediaType()) { + return ReconnectPin(m_pOutput, &m_pInput->CurrentMediaType()); + } + } + return NOERROR; + +} // ComnpleteConnect + + +// +// DecideBufferSize +// +// Tell the output pin's allocator what size buffers we require. +// *pAlloc will be the allocator our output pin is using. +// + +HRESULT CTransInPlaceFilter::DecideBufferSize + ( IMemAllocator *pAlloc + , ALLOCATOR_PROPERTIES *pProperties + ) { + ALLOCATOR_PROPERTIES Request, Actual; + HRESULT hr; + + // If we are connected upstream, get his views + if(m_pInput->IsConnected()) { + // Get the input pin allocator, and get its size and count. + // we don't care about his alignment and prefix. + + hr = InputPin()->PeekAllocator()->GetProperties(&Request); + if(FAILED(hr)) { + // Input connected but with a secretive allocator - enough! + return hr; + } + } + else { + // We're reduced to blind guessing. Let's guess one byte and if + // this isn't enough then when the other pin does get connected + // we can revise it. + ZeroMemory(&Request, sizeof(Request)); + Request.cBuffers = 1; + Request.cbBuffer = 1; + } + + + DbgLog((LOG_MEMORY,1,TEXT("Setting Allocator Requirements"))); + DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d"), + Request.cBuffers, Request.cbBuffer)); + + // Pass the allocator requirements to our output side + // but do a little sanity checking first or we'll just hit + // asserts in the allocator. + + pProperties->cBuffers = Request.cBuffers; + pProperties->cbBuffer = Request.cbBuffer; + if(pProperties->cBuffers<=0) {pProperties->cBuffers = 1; + } + if(pProperties->cbBuffer<=0) {pProperties->cbBuffer = 1; + } + hr = pAlloc->SetProperties(pProperties, &Actual); + + if(FAILED(hr)) { + return hr; + } + + DbgLog((LOG_MEMORY,1,TEXT("Obtained Allocator Requirements"))); + DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d, Alignment %d"), + Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign)); + + // Make sure we got the right alignment and at least the minimum required + + if((Request.cBuffers > Actual.cBuffers) + || (Request.cbBuffer > Actual.cbBuffer) + || (Request.cbAlign > Actual.cbAlign)) { + return E_FAIL; + } + return NOERROR; + +} // DecideBufferSize + +// +// Copy +// +// return a pointer to an identical copy of pSample +IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource) { + IMediaSample * pDest; + + HRESULT hr; + REFERENCE_TIME tStart, tStop; + const BOOL bTime = S_OK == pSource->GetTime(&tStart, &tStop); + + // this may block for an indeterminate amount of time + hr = OutputPin()->PeekAllocator()->GetBuffer(&pDest + , bTime ? &tStart : NULL + , bTime ? &tStop : NULL + , m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0); + + if(FAILED(hr)) { + return NULL; + } + + ASSERT(pDest); + IMediaSample2 *pSample2; + if(SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) { + HRESULT hr = pSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer), + (PBYTE)m_pInput->SampleProps()); + pSample2->Release(); + if(FAILED(hr)) { + pDest->Release(); + return NULL; + } + } + else { + if(bTime) { + pDest->SetTime(&tStart, &tStop); + } + + if(S_OK == pSource->IsSyncPoint()) { + pDest->SetSyncPoint(TRUE); + } + if(S_OK == pSource->IsDiscontinuity() || m_bSampleSkipped) { + pDest->SetDiscontinuity(TRUE); + } + if(S_OK == pSource->IsPreroll()) { + pDest->SetPreroll(TRUE); + } + + // Copy the media type + AM_MEDIA_TYPE *pMediaType; + if(S_OK == pSource->GetMediaType(&pMediaType)) { + pDest->SetMediaType(pMediaType); + DeleteMediaType(pMediaType); + } + + } + + m_bSampleSkipped = FALSE; + + // Copy the sample media times + REFERENCE_TIME TimeStart, TimeEnd; + if(pSource->GetMediaTime(&TimeStart,&TimeEnd) == NOERROR) { + pDest->SetMediaTime(&TimeStart,&TimeEnd); + } + + // Copy the actual data length and the actual data. + { + const long lDataLength = pSource->GetActualDataLength(); + pDest->SetActualDataLength(lDataLength); + + // Copy the sample data + { + BYTE *pSourceBuffer, *pDestBuffer; + long lSourceSize = pSource->GetSize(); + long lDestSize = pDest->GetSize(); + + ASSERT(lDestSize >= lSourceSize && lDestSize >= lDataLength); + + pSource->GetPointer(&pSourceBuffer); + pDest->GetPointer(&pDestBuffer); + ASSERT(lDestSize == 0 || pSourceBuffer != NULL && pDestBuffer != NULL); + + CopyMemory((PVOID) pDestBuffer, (PVOID) pSourceBuffer, lDataLength); + } + } + + return pDest; + +} // Copy + + +// override this to customize the transform process + +HRESULT +CTransInPlaceFilter::Receive(IMediaSample *pSample) { + /* Check for other streams and pass them on */ + AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps(); + if(pProps->dwStreamId != AM_STREAM_MEDIA) { + return m_pOutput->Deliver(pSample); + } + HRESULT hr; + + // Start timing the TransInPlace (if PERF is defined) + MSR_START(m_idTransInPlace); + + if(UsingDifferentAllocators()) { + + // We have to copy the data. + + pSample = Copy(pSample); + + if(pSample==NULL) { + MSR_STOP(m_idTransInPlace); + return E_UNEXPECTED; + } + } + + // have the derived class transform the data + hr = Transform(pSample); + + // Stop the clock and log it (if PERF is defined) + MSR_STOP(m_idTransInPlace); + + if(FAILED(hr)) { + DbgLog((LOG_TRACE, 1, TEXT("Error from TransInPlace"))); + if(UsingDifferentAllocators()) { + pSample->Release(); + } + return hr; + } + + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + if(hr == NOERROR) { + hr = m_pOutput->Deliver(pSample); + } + else { + // But it would be an error to return this private workaround + // to the caller ... + if(S_FALSE == hr) { + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this cause because + // returning S_FALSE from Receive() means that this is the end + // of the stream and no more data should be sent. + m_bSampleSkipped = TRUE; + if(!m_bQualityChanged) { + NotifyEvent(EC_QUALITY_CHANGE,0,0); + m_bQualityChanged = TRUE; + } + hr = NOERROR; + } + } + + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + if(UsingDifferentAllocators()) { + pSample->Release(); + } + + return hr; + +} // Receive + + + +// ================================================================= +// Implements the CTransInPlaceInputPin class +// ================================================================= + + +// constructor + +CTransInPlaceInputPin::CTransInPlaceInputPin + ( TCHAR *pObjectName + , CTransInPlaceFilter *pFilter + , HRESULT *phr + , LPCWSTR pName + ) + : CTransformInputPin(pObjectName, + pFilter, + phr, + pName) + , m_bReadOnly(FALSE) + , m_pTIPFilter(pFilter) { + + DbgLog((LOG_TRACE, 2 + , TEXT("CTransInPlaceInputPin::CTransInPlaceInputPin"))); + +} // constructor + + +// ================================================================= +// Implements IMemInputPin interface +// ================================================================= + + +// If the downstream filter has one then offer that (even if our own output +// pin is not using it yet. If the upstream filter chooses it then we will +// tell our output pin to ReceiveAllocator). +// Else if our output pin is using an allocator then offer that. +// ( This could mean offering the upstream filter his own allocator, +// it could mean offerring our own +// ) or it could mean offering the one from downstream +// Else fail to offer any allocator at all. + +STDMETHODIMP CTransInPlaceInputPin::GetAllocator(IMemAllocator ** ppAllocator) { + CheckPointer(ppAllocator,E_POINTER); + ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *)); + CAutoLock cObjectLock(m_pLock); + + HRESULT hr; + + if(m_pTIPFilter->m_pOutput->IsConnected()) { + // Store the allocator we got + hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() + ->GetAllocator(ppAllocator); + if(SUCCEEDED(hr)) { + m_pTIPFilter->OutputPin()->SetAllocator(*ppAllocator); + } + } + else { + // Help upstream filter (eg TIP filter which is having to do a copy) + // by providing a temp allocator here - we'll never use + // this allocator because when our output is connected we'll + // reconnect this pin + hr = CTransformInputPin::GetAllocator(ppAllocator); + } + return hr; + +} // GetAllocator + + + +/* Get told which allocator the upstream output pin is actually going to use */ + + +STDMETHODIMP +CTransInPlaceInputPin::NotifyAllocator( + IMemAllocator * pAllocator, + BOOL bReadOnly) { + HRESULT hr = S_OK; + CheckPointer(pAllocator,E_POINTER); + ValidateReadPtr(pAllocator,sizeof(IMemAllocator)); + + CAutoLock cObjectLock(m_pLock); + + m_bReadOnly = bReadOnly; + // If we modify data then don't accept the allocator if it's + // the same as the output pin's allocator + + // If our output is not connected just accept the allocator + // We're never going to use this allocator because when our + // output pin is connected we'll reconnect this pin + if(!m_pTIPFilter->OutputPin()->IsConnected()) { + return CTransformInputPin::NotifyAllocator(pAllocator, bReadOnly); + } + + // If the allocator is read-only and we're modifying data + // and the allocator is the same as the output pin's + // then reject + if(bReadOnly && m_pTIPFilter->m_bModifiesData) { + IMemAllocator *pOutputAllocator = + m_pTIPFilter->OutputPin()->PeekAllocator(); + + // Make sure we have an output allocator + if(pOutputAllocator == NULL) { + hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()-> + GetAllocator(&pOutputAllocator); + if(FAILED(hr)) { + hr = CreateMemoryAllocator(&pOutputAllocator); + } + if(SUCCEEDED(hr)) { + m_pTIPFilter->OutputPin()->SetAllocator(pOutputAllocator); + pOutputAllocator->Release(); + } + } + if(pAllocator == pOutputAllocator) { + hr = E_FAIL; + } + else if(SUCCEEDED(hr)) { + // Must copy so set the allocator properties on the output + ALLOCATOR_PROPERTIES Props, Actual={0}; + hr = pAllocator->GetProperties(&Props); + if(SUCCEEDED(hr)) { + hr = pOutputAllocator->SetProperties(&Props, &Actual); + } + if(SUCCEEDED(hr)) { + if((Props.cBuffers > Actual.cBuffers) + || (Props.cbBuffer > Actual.cbBuffer) + || (Props.cbAlign > Actual.cbAlign)) { + hr = E_FAIL; + } + } + + // Set the allocator on the output pin + if(SUCCEEDED(hr)) { + hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() + ->NotifyAllocator(pOutputAllocator, FALSE); + } + } + } + else { + hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin() + ->NotifyAllocator(pAllocator, bReadOnly); + if(SUCCEEDED(hr)) { + m_pTIPFilter->OutputPin()->SetAllocator(pAllocator); + } + } + + if(SUCCEEDED(hr)) { + + // It's possible that the old and the new are the same thing. + // AddRef before release ensures that we don't unload it. + pAllocator->AddRef(); + + if(m_pAllocator != NULL) + m_pAllocator->Release(); + + m_pAllocator = pAllocator; // We have an allocator for the input pin + } + + return hr; + +} // NotifyAllocator + + +// EnumMediaTypes +// - pass through to our downstream filter +STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum ) { + // Can only pass through if connected + if(!m_pTIPFilter->m_pOutput->IsConnected()) + return VFW_E_NOT_CONNECTED; + + return m_pTIPFilter->m_pOutput->GetConnected()->EnumMediaTypes(ppEnum); + +} // EnumMediaTypes + + +// CheckMediaType +// - agree to anything if not connected, +// otherwise pass through to the downstream filter. +// This assumes that the filter does not change the media type. + +HRESULT CTransInPlaceInputPin::CheckMediaType(const CMediaType *pmt ) { + HRESULT hr = m_pTIPFilter->CheckInputType(pmt); + if(hr!=S_OK) return hr; + + if(m_pTIPFilter->m_pOutput->IsConnected()) + return m_pTIPFilter->m_pOutput->GetConnected()->QueryAccept(pmt); + else + return S_OK; + +} // CheckMediaType + + +// If upstream asks us what our requirements are, we will try to ask downstream +// if that doesn't work, we'll just take the defaults. +STDMETHODIMP +CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps) { + + if(m_pTIPFilter->m_pOutput->IsConnected()) + return m_pTIPFilter->OutputPin() + ->ConnectedIMemInputPin()->GetAllocatorRequirements(pProps); + else + return E_NOTIMPL; + +} // GetAllocatorRequirements + + + +// ================================================================= +// Implements the CTransInPlaceOutputPin class +// ================================================================= + + +// constructor + +CTransInPlaceOutputPin::CTransInPlaceOutputPin( + TCHAR *pObjectName, + CTransInPlaceFilter *pFilter, + HRESULT * phr, + LPCWSTR pPinName) + : CTransformOutputPin( pObjectName + , pFilter + , phr + , pPinName), + m_pTIPFilter(pFilter) { + + DbgLog(( LOG_TRACE, 2 + , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin"))); + +} // constructor + + +// EnumMediaTypes +// - pass through to our upstream filter +STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( IEnumMediaTypes **ppEnum ) { + // Can only pass through if connected. + if(! m_pTIPFilter->m_pInput->IsConnected()) + return VFW_E_NOT_CONNECTED; + + return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes(ppEnum); + +} // EnumMediaTypes + + + +// CheckMediaType +// - agree to anything if not connected, +// otherwise pass through to the upstream filter. + +HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt ) { + // Don't accept any output pin type changes if we're copying + // between allocators - it's too late to change the input + // allocator size. + if(m_pTIPFilter->UsingDifferentAllocators() && !m_pFilter->IsStopped()) { + if(*pmt == m_mt) { + return S_OK; + } + else { + return VFW_E_TYPE_NOT_ACCEPTED; + } + } + + // Assumes the type does not change. That's why we're calling + // CheckINPUTType here on the OUTPUT pin. + HRESULT hr = m_pTIPFilter->CheckInputType(pmt); + if(hr!=S_OK) + return hr; + + if(m_pTIPFilter->m_pInput->IsConnected()) + return m_pTIPFilter->m_pInput->GetConnected()->QueryAccept(pmt); + else + return S_OK; + +} //CheckMediaType + + +/* Save the allocator pointer in the output pin +*/ +void +CTransInPlaceOutputPin::SetAllocator(IMemAllocator * pAllocator) { + pAllocator->AddRef(); + if(m_pAllocator) { + m_pAllocator->Release(); + } + m_pAllocator = pAllocator; +} // receiveAllocator diff --git a/src/BaseClasses/transip.h b/src/BaseClasses/transip.h index 6ced36488c..f36a1c4295 100644 --- a/src/BaseClasses/transip.h +++ b/src/BaseClasses/transip.h @@ -1,246 +1,246 @@ -//------------------------------------------------------------------------------ -// File: TransIP.h -// -// Desc: DirectShow base classes - defines classes from which simple -// Transform-In-Place filters may be derived. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// -// The difference between this and Transfrm.h is that Transfrm copies the data. -// -// It assumes the filter has one input and one output stream, and has no -// interest in memory management, interface negotiation or anything else. -// -// Derive your class from this, and supply Transform and the media type/format -// negotiation functions. Implement that class, compile and link and -// you're done. - - -#ifndef __TRANSIP__ -#define __TRANSIP__ - -// ====================================================================== -// This is the com object that represents a simple transform filter. It -// supports IBaseFilter, IMediaFilter and two pins through nested interfaces -// ====================================================================== - -class CTransInPlaceFilter; - -// Several of the pin functions call filter functions to do the work, -// so you can often use the pin classes unaltered, just overriding the -// functions in CTransInPlaceFilter. If that's not enough and you want -// to derive your own pin class, override GetPin in the filter to supply -// your own pin classes to the filter. - -// ================================================== -// Implements the input pin -// ================================================== - -class CTransInPlaceInputPin : public CTransformInputPin -{ - -protected: - CTransInPlaceFilter * const m_pTIPFilter; // our filter - BOOL m_bReadOnly; // incoming stream is read only - -public: - - CTransInPlaceInputPin( - TCHAR *pObjectName, - CTransInPlaceFilter *pFilter, - HRESULT *phr, - LPCWSTR pName); - - // --- IMemInputPin ----- - - // Provide an enumerator for media types by getting one from downstream - STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum ); - - // Say whether media type is acceptable. - HRESULT CheckMediaType(const CMediaType* pmt); - - // Return our upstream allocator - STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator); - - // get told which allocator the upstream output pin is actually - // going to use. - STDMETHODIMP NotifyAllocator(IMemAllocator * pAllocator, - BOOL bReadOnly); - - // Allow the filter to see what allocator we have - // N.B. This does NOT AddRef - IMemAllocator * PeekAllocator() const - { return m_pAllocator; } - - // Pass this on downstream if it ever gets called. - STDMETHODIMP - CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps); - - inline const BOOL ReadOnly() { return m_bReadOnly ; } - -}; // CTransInPlaceInputPin - -// ================================================== -// Implements the output pin -// ================================================== - -class CTransInPlaceOutputPin : public CTransformOutputPin -{ - -protected: - // m_pFilter points to our CBaseFilter - CTransInPlaceFilter * const m_pTIPFilter; - -public: - - CTransInPlaceOutputPin( - TCHAR *pObjectName, - CTransInPlaceFilter *pFilter, - HRESULT *phr, - LPCWSTR pName); - - - // --- CBaseOutputPin ------------ - - // negotiate the allocator and its buffer size/count - // Insists on using our own allocator. (Actually the one upstream of us). - // We don't override this - instead we just agree the default - // then let the upstream filter decide for itself on reconnect - // virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc); - - // Provide a media type enumerator. Get it from upstream. - STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum ); - - // Say whether media type is acceptable. - HRESULT CheckMediaType(const CMediaType* pmt); - - // This just saves the allocator being used on the output pin - // Also called by input pin's GetAllocator() - void SetAllocator(IMemAllocator * pAllocator); - - IMemInputPin * ConnectedIMemInputPin() - { return m_pInputPin; } - - // Allow the filter to see what allocator we have - // N.B. This does NOT AddRef - IMemAllocator * PeekAllocator() const - { return m_pAllocator; } -}; // CTransInPlaceOutputPin - - -class AM_NOVTABLE CTransInPlaceFilter : public CTransformFilter -{ - -public: - - // map getpin/getpincount for base enum of pins to owner - // override this to return more specialised pin objects - - virtual CBasePin *GetPin(int n); - -public: - - // Set bModifiesData == false if your derived filter does - // not modify the data samples (for instance it's just copying - // them somewhere else or looking at the timestamps). - - CTransInPlaceFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *, - bool bModifiesData = true); -#ifdef UNICODE - CTransInPlaceFilter(CHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *, - bool bModifiesData = true); -#endif - // The following are defined to avoid undefined pure virtuals. - // Even if they are never called, they will give linkage warnings/errors - - // We override EnumMediaTypes to bypass the transform class enumerator - // which would otherwise call this. - HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) - { DbgBreak("CTransInPlaceFilter::GetMediaType should never be called"); - return E_UNEXPECTED; - } - - // This is called when we actually have to provide out own allocator. - HRESULT DecideBufferSize(IMemAllocator*, ALLOCATOR_PROPERTIES *); - - // The functions which call this in CTransform are overridden in this - // class to call CheckInputType with the assumption that the type - // does not change. In Debug builds some calls will be made and - // we just ensure that they do not assert. - HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) - { - return S_OK; - }; - - - // ================================================================= - // ----- You may want to override this ----------------------------- - // ================================================================= - - HRESULT CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin); - - // chance to customize the transform process - virtual HRESULT Receive(IMediaSample *pSample); - - // ================================================================= - // ----- You MUST override these ----------------------------------- - // ================================================================= - - virtual HRESULT Transform(IMediaSample *pSample) PURE; - - // this goes in the factory template table to create new instances - // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); - - -#ifdef PERF - // Override to register performance measurement with a less generic string - // You should do this to avoid confusion with other filters - virtual void RegisterPerfId() - {m_idTransInPlace = MSR_REGISTER(TEXT("TransInPlace"));} -#endif // PERF - - -// implementation details - -protected: - - IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource); - -#ifdef PERF - int m_idTransInPlace; // performance measuring id -#endif // PERF - bool m_bModifiesData; // Does this filter change the data? - - // these hold our input and output pins - - friend class CTransInPlaceInputPin; - friend class CTransInPlaceOutputPin; - - CTransInPlaceInputPin *InputPin() const - { - return (CTransInPlaceInputPin *)m_pInput; - }; - CTransInPlaceOutputPin *OutputPin() const - { - return (CTransInPlaceOutputPin *)m_pOutput; - }; - - // Helper to see if the input and output types match - BOOL TypesMatch() - { - return InputPin()->CurrentMediaType() == - OutputPin()->CurrentMediaType(); - } - - // Are the input and output allocators different? - BOOL UsingDifferentAllocators() const - { - return InputPin()->PeekAllocator() != OutputPin()->PeekAllocator(); - } -}; // CTransInPlaceFilter - -#endif /* __TRANSIP__ */ - +//------------------------------------------------------------------------------ +// File: TransIP.h +// +// Desc: DirectShow base classes - defines classes from which simple +// Transform-In-Place filters may be derived. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// +// The difference between this and Transfrm.h is that Transfrm copies the data. +// +// It assumes the filter has one input and one output stream, and has no +// interest in memory management, interface negotiation or anything else. +// +// Derive your class from this, and supply Transform and the media type/format +// negotiation functions. Implement that class, compile and link and +// you're done. + + +#ifndef __TRANSIP__ +#define __TRANSIP__ + +// ====================================================================== +// This is the com object that represents a simple transform filter. It +// supports IBaseFilter, IMediaFilter and two pins through nested interfaces +// ====================================================================== + +class CTransInPlaceFilter; + +// Several of the pin functions call filter functions to do the work, +// so you can often use the pin classes unaltered, just overriding the +// functions in CTransInPlaceFilter. If that's not enough and you want +// to derive your own pin class, override GetPin in the filter to supply +// your own pin classes to the filter. + +// ================================================== +// Implements the input pin +// ================================================== + +class CTransInPlaceInputPin : public CTransformInputPin +{ + +protected: + CTransInPlaceFilter * const m_pTIPFilter; // our filter + BOOL m_bReadOnly; // incoming stream is read only + +public: + + CTransInPlaceInputPin( + TCHAR *pObjectName, + CTransInPlaceFilter *pFilter, + HRESULT *phr, + LPCWSTR pName); + + // --- IMemInputPin ----- + + // Provide an enumerator for media types by getting one from downstream + STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum ); + + // Say whether media type is acceptable. + HRESULT CheckMediaType(const CMediaType* pmt); + + // Return our upstream allocator + STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator); + + // get told which allocator the upstream output pin is actually + // going to use. + STDMETHODIMP NotifyAllocator(IMemAllocator * pAllocator, + BOOL bReadOnly); + + // Allow the filter to see what allocator we have + // N.B. This does NOT AddRef + IMemAllocator * PeekAllocator() const + { return m_pAllocator; } + + // Pass this on downstream if it ever gets called. + STDMETHODIMP + CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps); + + inline const BOOL ReadOnly() { return m_bReadOnly ; } + +}; // CTransInPlaceInputPin + +// ================================================== +// Implements the output pin +// ================================================== + +class CTransInPlaceOutputPin : public CTransformOutputPin +{ + +protected: + // m_pFilter points to our CBaseFilter + CTransInPlaceFilter * const m_pTIPFilter; + +public: + + CTransInPlaceOutputPin( + TCHAR *pObjectName, + CTransInPlaceFilter *pFilter, + HRESULT *phr, + LPCWSTR pName); + + + // --- CBaseOutputPin ------------ + + // negotiate the allocator and its buffer size/count + // Insists on using our own allocator. (Actually the one upstream of us). + // We don't override this - instead we just agree the default + // then let the upstream filter decide for itself on reconnect + // virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc); + + // Provide a media type enumerator. Get it from upstream. + STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum ); + + // Say whether media type is acceptable. + HRESULT CheckMediaType(const CMediaType* pmt); + + // This just saves the allocator being used on the output pin + // Also called by input pin's GetAllocator() + void SetAllocator(IMemAllocator * pAllocator); + + IMemInputPin * ConnectedIMemInputPin() + { return m_pInputPin; } + + // Allow the filter to see what allocator we have + // N.B. This does NOT AddRef + IMemAllocator * PeekAllocator() const + { return m_pAllocator; } +}; // CTransInPlaceOutputPin + + +class AM_NOVTABLE CTransInPlaceFilter : public CTransformFilter +{ + +public: + + // map getpin/getpincount for base enum of pins to owner + // override this to return more specialised pin objects + + virtual CBasePin *GetPin(int n); + +public: + + // Set bModifiesData == false if your derived filter does + // not modify the data samples (for instance it's just copying + // them somewhere else or looking at the timestamps). + + CTransInPlaceFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *, + bool bModifiesData = true); +#ifdef UNICODE + CTransInPlaceFilter(CHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *, + bool bModifiesData = true); +#endif + // The following are defined to avoid undefined pure virtuals. + // Even if they are never called, they will give linkage warnings/errors + + // We override EnumMediaTypes to bypass the transform class enumerator + // which would otherwise call this. + HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) + { DbgBreak("CTransInPlaceFilter::GetMediaType should never be called"); + return E_UNEXPECTED; + } + + // This is called when we actually have to provide out own allocator. + HRESULT DecideBufferSize(IMemAllocator*, ALLOCATOR_PROPERTIES *); + + // The functions which call this in CTransform are overridden in this + // class to call CheckInputType with the assumption that the type + // does not change. In Debug builds some calls will be made and + // we just ensure that they do not assert. + HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut) + { + return S_OK; + }; + + + // ================================================================= + // ----- You may want to override this ----------------------------- + // ================================================================= + + HRESULT CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin); + + // chance to customize the transform process + virtual HRESULT Receive(IMediaSample *pSample); + + // ================================================================= + // ----- You MUST override these ----------------------------------- + // ================================================================= + + virtual HRESULT Transform(IMediaSample *pSample) PURE; + + // this goes in the factory template table to create new instances + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + + +#ifdef PERF + // Override to register performance measurement with a less generic string + // You should do this to avoid confusion with other filters + virtual void RegisterPerfId() + {m_idTransInPlace = MSR_REGISTER(TEXT("TransInPlace"));} +#endif // PERF + + +// implementation details + +protected: + + IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource); + +#ifdef PERF + int m_idTransInPlace; // performance measuring id +#endif // PERF + bool m_bModifiesData; // Does this filter change the data? + + // these hold our input and output pins + + friend class CTransInPlaceInputPin; + friend class CTransInPlaceOutputPin; + + CTransInPlaceInputPin *InputPin() const + { + return (CTransInPlaceInputPin *)m_pInput; + }; + CTransInPlaceOutputPin *OutputPin() const + { + return (CTransInPlaceOutputPin *)m_pOutput; + }; + + // Helper to see if the input and output types match + BOOL TypesMatch() + { + return InputPin()->CurrentMediaType() == + OutputPin()->CurrentMediaType(); + } + + // Are the input and output allocators different? + BOOL UsingDifferentAllocators() const + { + return InputPin()->PeekAllocator() != OutputPin()->PeekAllocator(); + } +}; // CTransInPlaceFilter + +#endif /* __TRANSIP__ */ + diff --git a/src/BaseClasses/videoctl.cpp b/src/BaseClasses/videoctl.cpp index de25ba879e..ca00ce1752 100644 --- a/src/BaseClasses/videoctl.cpp +++ b/src/BaseClasses/videoctl.cpp @@ -1,653 +1,653 @@ -//------------------------------------------------------------------------------ -// File: VideoCtl.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include "ddmm.h" - -// Load a string from the resource file string table. The buffer must be at -// least STR_MAX_LENGTH bytes. The easiest way to use this is to declare a -// buffer in the property page class and use it for all string loading. It -// cannot be static as multiple property pages may be active simultaneously - -TCHAR *WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID) { - if(LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) { - return TEXT(""); - } - return pBuffer; -} - -#ifdef UNICODE -char *WINAPI StringFromResource(char *pBuffer, int iResourceID) { - if(LoadStringA(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) { - return ""; - } - return pBuffer; -} -#endif - - - -// Property pages typically are called through their OLE interfaces. These -// use UNICODE strings regardless of how the binary is built. So when we -// load strings from the resource file we sometimes want to convert them -// to UNICODE. This method is passed the target UNICODE buffer and does a -// convert after loading the string (if built UNICODE this is not needed) -// On WinNT we can explicitly call LoadStringW which saves two conversions - -#ifndef UNICODE - -WCHAR * WINAPI WideStringFromResource(WCHAR *pBuffer, int iResourceID) { - *pBuffer = 0; - - if(g_amPlatform == VER_PLATFORM_WIN32_NT) { - LoadStringW(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH); - } - else { - - CHAR szBuffer[STR_MAX_LENGTH]; - DWORD dwStringLength = LoadString(g_hInst,iResourceID,szBuffer,STR_MAX_LENGTH); - // if we loaded a string convert it to wide characters, ensuring - // that we also null terminate the result. - if(dwStringLength++) { - MultiByteToWideChar(CP_ACP,0,szBuffer,dwStringLength,pBuffer,STR_MAX_LENGTH); - } - } - return pBuffer; -} - -#endif - - -// Helper function to calculate the size of the dialog - -BOOL WINAPI GetDialogSize(int iResourceID, - DLGPROC pDlgProc, - LPARAM lParam, - SIZE *pResult) { - RECT rc; - HWND hwnd; - - // Create a temporary property page - - hwnd = CreateDialogParam(g_hInst, - MAKEINTRESOURCE(iResourceID), - GetDesktopWindow(), - pDlgProc, - lParam); - if(hwnd == NULL) { - return FALSE; - } - - GetWindowRect(hwnd, &rc); - pResult->cx = rc.right - rc.left; - pResult->cy = rc.bottom - rc.top; - - DestroyWindow(hwnd); - return TRUE; -} - - -// Class that aggregates on the IDirectDraw interface. Although DirectDraw -// has the ability in its interfaces to be aggregated they're not currently -// implemented. This makes it difficult for various parts of Quartz that want -// to aggregate these interfaces. In particular the video renderer passes out -// media samples that expose IDirectDraw and IDirectDrawSurface. The filter -// graph manager also exposes IDirectDraw as a plug in distributor. For these -// objects we provide these aggregation classes that republish the interfaces - -STDMETHODIMP CAggDirectDraw::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ASSERT(m_pDirectDraw); - - // Do we have this interface - - if(riid == IID_IDirectDraw) { - return GetInterface((IDirectDraw *)this,ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid,ppv); - } -} - - -STDMETHODIMP CAggDirectDraw::Compact() { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->Compact(); -} - - -STDMETHODIMP CAggDirectDraw::CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter); -} - - -STDMETHODIMP CAggDirectDraw::CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->CreatePalette(dwFlags,lpColorTable,lplpDDPalette,pUnkOuter); -} - - -STDMETHODIMP CAggDirectDraw::CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->CreateSurface(lpDDSurfaceDesc,lplpDDSurface,pUnkOuter); -} - - -STDMETHODIMP CAggDirectDraw::DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->DuplicateSurface(lpDDSurface,lplpDupDDSurface); -} - - -STDMETHODIMP CAggDirectDraw::EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->EnumDisplayModes(dwSurfaceDescCount,lplpDDSurfaceDescList,lpContext,lpEnumCallback); -} - - -STDMETHODIMP CAggDirectDraw::EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->EnumSurfaces(dwFlags,lpDDSD,lpContext,lpEnumCallback); -} - - -STDMETHODIMP CAggDirectDraw::FlipToGDISurface() { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->FlipToGDISurface(); -} - - -STDMETHODIMP CAggDirectDraw::GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetCaps(lpDDDriverCaps,lpDDHELCaps); -} - - -STDMETHODIMP CAggDirectDraw::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetDisplayMode(lpDDSurfaceDesc); -} - - -STDMETHODIMP CAggDirectDraw::GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetFourCCCodes(lpNumCodes,lpCodes); -} - - -STDMETHODIMP CAggDirectDraw::GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetGDISurface(lplpGDIDDSurface); -} - - -STDMETHODIMP CAggDirectDraw::GetMonitorFrequency(LPDWORD lpdwFrequency) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetMonitorFrequency(lpdwFrequency); -} - - -STDMETHODIMP CAggDirectDraw::GetScanLine(LPDWORD lpdwScanLine) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetScanLine(lpdwScanLine); -} - - -STDMETHODIMP CAggDirectDraw::GetVerticalBlankStatus(LPBOOL lpblsInVB) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->GetVerticalBlankStatus(lpblsInVB); -} - - -STDMETHODIMP CAggDirectDraw::Initialize(GUID *lpGUID) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->Initialize(lpGUID); -} - - -STDMETHODIMP CAggDirectDraw::RestoreDisplayMode() { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->RestoreDisplayMode(); -} - - -STDMETHODIMP CAggDirectDraw::SetCooperativeLevel(HWND hWnd,DWORD dwFlags) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->SetCooperativeLevel(hWnd,dwFlags); -} - - -STDMETHODIMP CAggDirectDraw::SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->SetDisplayMode(dwWidth,dwHeight,dwBpp); -} - - -STDMETHODIMP CAggDirectDraw::WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent) { - ASSERT(m_pDirectDraw); - return m_pDirectDraw->WaitForVerticalBlank(dwFlags,hEvent); -} - - -// Class that aggregates an IDirectDrawSurface interface. Although DirectDraw -// has the ability in its interfaces to be aggregated they're not currently -// implemented. This makes it difficult for various parts of Quartz that want -// to aggregate these interfaces. In particular the video renderer passes out -// media samples that expose IDirectDraw and IDirectDrawSurface. The filter -// graph manager also exposes IDirectDraw as a plug in distributor. For these -// objects we provide these aggregation classes that republish the interfaces - -STDMETHODIMP CAggDrawSurface::NonDelegatingQueryInterface(REFIID riid, void **ppv) { - ASSERT(m_pDirectDrawSurface); - - // Do we have this interface - - if(riid == IID_IDirectDrawSurface) { - return GetInterface((IDirectDrawSurface *)this,ppv); - } - else { - return CUnknown::NonDelegatingQueryInterface(riid,ppv); - } -} - - -STDMETHODIMP CAggDrawSurface::AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->AddAttachedSurface(lpDDSAttachedSurface); -} - - -STDMETHODIMP CAggDrawSurface::AddOverlayDirtyRect(LPRECT lpRect) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->AddOverlayDirtyRect(lpRect); -} - - -STDMETHODIMP CAggDrawSurface::Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Blt(lpDestRect,lpDDSrcSurface,lpSrcRect,dwFlags,lpDDBltFx); -} - - -STDMETHODIMP CAggDrawSurface::BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->BltBatch(lpDDBltBatch,dwCount,dwFlags); -} - - -STDMETHODIMP CAggDrawSurface::BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->BltFast(dwX,dwY,lpDDSrcSurface,lpSrcRect,dwTrans); -} - - -STDMETHODIMP CAggDrawSurface::DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->DeleteAttachedSurface(dwFlags,lpDDSAttachedSurface); -} - - -STDMETHODIMP CAggDrawSurface::EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->EnumAttachedSurfaces(lpContext,lpEnumSurfacesCallback); -} - - -STDMETHODIMP CAggDrawSurface::EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->EnumOverlayZOrders(dwFlags,lpContext,lpfnCallback); -} - - -STDMETHODIMP CAggDrawSurface::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Flip(lpDDSurfaceTargetOverride,dwFlags); -} - - -STDMETHODIMP CAggDrawSurface::GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetAttachedSurface(lpDDSCaps,lplpDDAttachedSurface); -} - - -STDMETHODIMP CAggDrawSurface::GetBltStatus(DWORD dwFlags) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetBltStatus(dwFlags); -} - - -STDMETHODIMP CAggDrawSurface::GetCaps(LPDDSCAPS lpDDSCaps) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetCaps(lpDDSCaps); -} - - -STDMETHODIMP CAggDrawSurface::GetClipper(LPDIRECTDRAWCLIPPER *lplpDDClipper) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetClipper(lplpDDClipper); -} - - -STDMETHODIMP CAggDrawSurface::GetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetColorKey(dwFlags,lpDDColorKey); -} - - -STDMETHODIMP CAggDrawSurface::GetDC(HDC *lphDC) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetDC(lphDC); -} - - -STDMETHODIMP CAggDrawSurface::GetFlipStatus(DWORD dwFlags) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetFlipStatus(dwFlags); -} - - -STDMETHODIMP CAggDrawSurface::GetOverlayPosition(LPLONG lpdwX,LPLONG lpdwY) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetOverlayPosition(lpdwX,lpdwY); -} - - -STDMETHODIMP CAggDrawSurface::GetPalette(LPDIRECTDRAWPALETTE *lplpDDPalette) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetPalette(lplpDDPalette); -} - - -STDMETHODIMP CAggDrawSurface::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->GetPixelFormat(lpDDPixelFormat); -} - - -// A bit of a warning here: Our media samples in DirectShow aggregate on -// IDirectDraw and IDirectDrawSurface (ie are available through IMediaSample -// by QueryInterface). Unfortunately the underlying DirectDraw code cannot -// be aggregated so we have to use these classes. The snag is that when we -// call a different surface and pass in this interface as perhaps the source -// surface the call will fail because DirectDraw dereferences the pointer to -// get at its private data structures. Therefore we supply this workaround to give -// access to the real IDirectDraw surface. A filter can call GetSurfaceDesc -// and we will fill in the lpSurface pointer with the real underlying surface - -STDMETHODIMP CAggDrawSurface::GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc) { - ASSERT(m_pDirectDrawSurface); - - // First call down to the underlying DirectDraw - - HRESULT hr = m_pDirectDrawSurface->GetSurfaceDesc(lpDDSurfaceDesc); - if(FAILED(hr)) { - return hr; - } - - // Store the real DirectDrawSurface interface - lpDDSurfaceDesc->lpSurface = m_pDirectDrawSurface; - return hr; -} - - -STDMETHODIMP CAggDrawSurface::Initialize(LPDIRECTDRAW lpDD,LPDDSURFACEDESC lpDDSurfaceDesc) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Initialize(lpDD,lpDDSurfaceDesc); -} - - -STDMETHODIMP CAggDrawSurface::IsLost() { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->IsLost(); -} - - -STDMETHODIMP CAggDrawSurface::Lock(LPRECT lpDestRect,LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent); -} - - -STDMETHODIMP CAggDrawSurface::ReleaseDC(HDC hDC) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->ReleaseDC(hDC); -} - - -STDMETHODIMP CAggDrawSurface::Restore() { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Restore(); -} - - -STDMETHODIMP CAggDrawSurface::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->SetClipper(lpDDClipper); -} - - -STDMETHODIMP CAggDrawSurface::SetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->SetColorKey(dwFlags,lpDDColorKey); -} - - -STDMETHODIMP CAggDrawSurface::SetOverlayPosition(LONG dwX,LONG dwY) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->SetOverlayPosition(dwX,dwY); -} - - -STDMETHODIMP CAggDrawSurface::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->SetPalette(lpDDPalette); -} - - -STDMETHODIMP CAggDrawSurface::Unlock(LPVOID lpSurfaceData) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->Unlock(lpSurfaceData); -} - - -STDMETHODIMP CAggDrawSurface::UpdateOverlay(LPRECT lpSrcRect,LPDIRECTDRAWSURFACE lpDDDestSurface,LPRECT lpDestRect,DWORD dwFlags,LPDDOVERLAYFX lpDDOverlayFX) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->UpdateOverlay(lpSrcRect,lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFX); -} - - -STDMETHODIMP CAggDrawSurface::UpdateOverlayDisplay(DWORD dwFlags) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->UpdateOverlayDisplay(dwFlags); -} - - -STDMETHODIMP CAggDrawSurface::UpdateOverlayZOrder(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSReference) { - ASSERT(m_pDirectDrawSurface); - return m_pDirectDrawSurface->UpdateOverlayZOrder(dwFlags,lpDDSReference); -} - - -// DirectShow must work on multiple platforms. In particular, it also runs on -// Windows NT 3.51 which does not have DirectDraw capabilities. The filters -// cannot therefore link statically to the DirectDraw library. To make their -// lives that little bit easier we provide this class that manages loading -// and unloading the library and creating the initial IDirectDraw interface - -CLoadDirectDraw::CLoadDirectDraw() : - m_pDirectDraw(NULL), - m_hDirectDraw(NULL) { -} - - -// Destructor forces unload - -CLoadDirectDraw::~CLoadDirectDraw() { - ReleaseDirectDraw(); - - if(m_hDirectDraw) { - NOTE("Unloading library"); - FreeLibrary(m_hDirectDraw); - } -} - - -// We can't be sure that DirectDraw is always available so we can't statically -// link to the library. Therefore we load the library, get the function entry -// point addresses and call them to create the driver objects. We return S_OK -// if we manage to load DirectDraw correctly otherwise we return E_NOINTERFACE -// We initialise a DirectDraw instance by explicitely loading the library and -// calling GetProcAddress on the DirectDrawCreate entry point that it exports - -// On a multi monitor system, we can get the DirectDraw object for any -// monitor (device) with the optional szDevice parameter - -HRESULT CLoadDirectDraw::LoadDirectDraw(LPSTR szDevice) { - PDRAWCREATE pDrawCreate; - PDRAWENUM pDrawEnum; - LPDIRECTDRAWENUMERATEEXA pDrawEnumEx; - HRESULT hr = NOERROR; - - NOTE("Entering DoLoadDirectDraw"); - - // Is DirectDraw already loaded - - if(m_pDirectDraw) { - NOTE("Already loaded"); - ASSERT(m_hDirectDraw); - return NOERROR; - } - - // Make sure the library is available - - if(!m_hDirectDraw) { - UINT ErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX); - m_hDirectDraw = LoadLibrary(TEXT("DDRAW.DLL")); - SetErrorMode(ErrorMode); - - if(m_hDirectDraw == NULL) { - DbgLog((LOG_ERROR,1,TEXT("Can't load DDRAW.DLL"))); - NOTE("No library"); - return E_NOINTERFACE; - } - } - - // Get the DLL address for the creator function - - pDrawCreate = (PDRAWCREATE)GetProcAddress(m_hDirectDraw,"DirectDrawCreate"); - // force ANSI, we assume it - pDrawEnum = (PDRAWENUM)GetProcAddress(m_hDirectDraw,"DirectDrawEnumerateA"); - pDrawEnumEx = (LPDIRECTDRAWENUMERATEEXA)GetProcAddress(m_hDirectDraw, - "DirectDrawEnumerateExA"); - - // We don't NEED DirectDrawEnumerateEx, that's just for multimon stuff - if(pDrawCreate == NULL || pDrawEnum == NULL) { - DbgLog((LOG_ERROR,1,TEXT("Can't get functions: Create=%x Enum=%x"), - pDrawCreate, pDrawEnum)); - NOTE("No entry point"); - ReleaseDirectDraw(); - return E_NOINTERFACE; - } - - DbgLog((LOG_TRACE,3,TEXT("Creating DDraw for device %s"), - szDevice ? szDevice : "")); - - // Create a DirectDraw display provider for this device, using the fancy - // multimon-aware version, if it exists - if(pDrawEnumEx) - m_pDirectDraw = DirectDrawCreateFromDeviceEx(szDevice, pDrawCreate, - pDrawEnumEx); - else - m_pDirectDraw = DirectDrawCreateFromDevice(szDevice, pDrawCreate, - pDrawEnum); - - if(m_pDirectDraw == NULL) { - DbgLog((LOG_ERROR,1,TEXT("Can't create DDraw"))); - NOTE("No instance"); - ReleaseDirectDraw(); - return E_NOINTERFACE; - } - return NOERROR; -} - - -// Called to release any DirectDraw provider we previously loaded. We may be -// called at any time especially when something goes horribly wrong and when -// we need to clean up before returning so we can't guarantee that all state -// variables are consistent so free only those really allocated allocated -// This should only be called once all reference counts have been released - -void CLoadDirectDraw::ReleaseDirectDraw() { - NOTE("Releasing DirectDraw driver"); - - // Release any DirectDraw provider interface - - if(m_pDirectDraw) { - NOTE("Releasing instance"); - m_pDirectDraw->Release(); - m_pDirectDraw = NULL; - } - -} - - -// Return NOERROR (S_OK) if DirectDraw has been loaded by this object - -HRESULT CLoadDirectDraw::IsDirectDrawLoaded() { - NOTE("Entering IsDirectDrawLoaded"); - - if(m_pDirectDraw == NULL) { - NOTE("DirectDraw not loaded"); - return S_FALSE; - } - return NOERROR; -} - - -// Return the IDirectDraw interface we look after - -LPDIRECTDRAW CLoadDirectDraw::GetDirectDraw() { - NOTE("Entering GetDirectDraw"); - - if(m_pDirectDraw == NULL) { - NOTE("No DirectDraw"); - return NULL; - } - - NOTE("Returning DirectDraw"); - m_pDirectDraw->AddRef(); - return m_pDirectDraw; -} - - -// Are we running on Direct Draw version 1? We need to find out as -// we rely on specific bug fixes in DirectDraw 2 for fullscreen playback. To -// find out, we simply see if it supports IDirectDraw2. Only version 2 and -// higher support this. - -BOOL CLoadDirectDraw::IsDirectDrawVersion1() { - - if(m_pDirectDraw == NULL) - return FALSE; - - IDirectDraw2 *p = NULL; - HRESULT hr = m_pDirectDraw->QueryInterface(IID_IDirectDraw2, (void **)&p); - if(p) - p->Release(); - if(hr == NOERROR) { - DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 2 or greater"))); - return FALSE; - } - else { - DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 1"))); - return TRUE; - } -} - +//------------------------------------------------------------------------------ +// File: VideoCtl.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include "ddmm.h" + +// Load a string from the resource file string table. The buffer must be at +// least STR_MAX_LENGTH bytes. The easiest way to use this is to declare a +// buffer in the property page class and use it for all string loading. It +// cannot be static as multiple property pages may be active simultaneously + +TCHAR *WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID) { + if(LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) { + return TEXT(""); + } + return pBuffer; +} + +#ifdef UNICODE +char *WINAPI StringFromResource(char *pBuffer, int iResourceID) { + if(LoadStringA(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) { + return ""; + } + return pBuffer; +} +#endif + + + +// Property pages typically are called through their OLE interfaces. These +// use UNICODE strings regardless of how the binary is built. So when we +// load strings from the resource file we sometimes want to convert them +// to UNICODE. This method is passed the target UNICODE buffer and does a +// convert after loading the string (if built UNICODE this is not needed) +// On WinNT we can explicitly call LoadStringW which saves two conversions + +#ifndef UNICODE + +WCHAR * WINAPI WideStringFromResource(WCHAR *pBuffer, int iResourceID) { + *pBuffer = 0; + + if(g_amPlatform == VER_PLATFORM_WIN32_NT) { + LoadStringW(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH); + } + else { + + CHAR szBuffer[STR_MAX_LENGTH]; + DWORD dwStringLength = LoadString(g_hInst,iResourceID,szBuffer,STR_MAX_LENGTH); + // if we loaded a string convert it to wide characters, ensuring + // that we also null terminate the result. + if(dwStringLength++) { + MultiByteToWideChar(CP_ACP,0,szBuffer,dwStringLength,pBuffer,STR_MAX_LENGTH); + } + } + return pBuffer; +} + +#endif + + +// Helper function to calculate the size of the dialog + +BOOL WINAPI GetDialogSize(int iResourceID, + DLGPROC pDlgProc, + LPARAM lParam, + SIZE *pResult) { + RECT rc; + HWND hwnd; + + // Create a temporary property page + + hwnd = CreateDialogParam(g_hInst, + MAKEINTRESOURCE(iResourceID), + GetDesktopWindow(), + pDlgProc, + lParam); + if(hwnd == NULL) { + return FALSE; + } + + GetWindowRect(hwnd, &rc); + pResult->cx = rc.right - rc.left; + pResult->cy = rc.bottom - rc.top; + + DestroyWindow(hwnd); + return TRUE; +} + + +// Class that aggregates on the IDirectDraw interface. Although DirectDraw +// has the ability in its interfaces to be aggregated they're not currently +// implemented. This makes it difficult for various parts of Quartz that want +// to aggregate these interfaces. In particular the video renderer passes out +// media samples that expose IDirectDraw and IDirectDrawSurface. The filter +// graph manager also exposes IDirectDraw as a plug in distributor. For these +// objects we provide these aggregation classes that republish the interfaces + +STDMETHODIMP CAggDirectDraw::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ASSERT(m_pDirectDraw); + + // Do we have this interface + + if(riid == IID_IDirectDraw) { + return GetInterface((IDirectDraw *)this,ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid,ppv); + } +} + + +STDMETHODIMP CAggDirectDraw::Compact() { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->Compact(); +} + + +STDMETHODIMP CAggDirectDraw::CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter); +} + + +STDMETHODIMP CAggDirectDraw::CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->CreatePalette(dwFlags,lpColorTable,lplpDDPalette,pUnkOuter); +} + + +STDMETHODIMP CAggDirectDraw::CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->CreateSurface(lpDDSurfaceDesc,lplpDDSurface,pUnkOuter); +} + + +STDMETHODIMP CAggDirectDraw::DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->DuplicateSurface(lpDDSurface,lplpDupDDSurface); +} + + +STDMETHODIMP CAggDirectDraw::EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->EnumDisplayModes(dwSurfaceDescCount,lplpDDSurfaceDescList,lpContext,lpEnumCallback); +} + + +STDMETHODIMP CAggDirectDraw::EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->EnumSurfaces(dwFlags,lpDDSD,lpContext,lpEnumCallback); +} + + +STDMETHODIMP CAggDirectDraw::FlipToGDISurface() { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->FlipToGDISurface(); +} + + +STDMETHODIMP CAggDirectDraw::GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetCaps(lpDDDriverCaps,lpDDHELCaps); +} + + +STDMETHODIMP CAggDirectDraw::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetDisplayMode(lpDDSurfaceDesc); +} + + +STDMETHODIMP CAggDirectDraw::GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetFourCCCodes(lpNumCodes,lpCodes); +} + + +STDMETHODIMP CAggDirectDraw::GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetGDISurface(lplpGDIDDSurface); +} + + +STDMETHODIMP CAggDirectDraw::GetMonitorFrequency(LPDWORD lpdwFrequency) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetMonitorFrequency(lpdwFrequency); +} + + +STDMETHODIMP CAggDirectDraw::GetScanLine(LPDWORD lpdwScanLine) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetScanLine(lpdwScanLine); +} + + +STDMETHODIMP CAggDirectDraw::GetVerticalBlankStatus(LPBOOL lpblsInVB) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->GetVerticalBlankStatus(lpblsInVB); +} + + +STDMETHODIMP CAggDirectDraw::Initialize(GUID *lpGUID) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->Initialize(lpGUID); +} + + +STDMETHODIMP CAggDirectDraw::RestoreDisplayMode() { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->RestoreDisplayMode(); +} + + +STDMETHODIMP CAggDirectDraw::SetCooperativeLevel(HWND hWnd,DWORD dwFlags) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->SetCooperativeLevel(hWnd,dwFlags); +} + + +STDMETHODIMP CAggDirectDraw::SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->SetDisplayMode(dwWidth,dwHeight,dwBpp); +} + + +STDMETHODIMP CAggDirectDraw::WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent) { + ASSERT(m_pDirectDraw); + return m_pDirectDraw->WaitForVerticalBlank(dwFlags,hEvent); +} + + +// Class that aggregates an IDirectDrawSurface interface. Although DirectDraw +// has the ability in its interfaces to be aggregated they're not currently +// implemented. This makes it difficult for various parts of Quartz that want +// to aggregate these interfaces. In particular the video renderer passes out +// media samples that expose IDirectDraw and IDirectDrawSurface. The filter +// graph manager also exposes IDirectDraw as a plug in distributor. For these +// objects we provide these aggregation classes that republish the interfaces + +STDMETHODIMP CAggDrawSurface::NonDelegatingQueryInterface(REFIID riid, void **ppv) { + ASSERT(m_pDirectDrawSurface); + + // Do we have this interface + + if(riid == IID_IDirectDrawSurface) { + return GetInterface((IDirectDrawSurface *)this,ppv); + } + else { + return CUnknown::NonDelegatingQueryInterface(riid,ppv); + } +} + + +STDMETHODIMP CAggDrawSurface::AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->AddAttachedSurface(lpDDSAttachedSurface); +} + + +STDMETHODIMP CAggDrawSurface::AddOverlayDirtyRect(LPRECT lpRect) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->AddOverlayDirtyRect(lpRect); +} + + +STDMETHODIMP CAggDrawSurface::Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Blt(lpDestRect,lpDDSrcSurface,lpSrcRect,dwFlags,lpDDBltFx); +} + + +STDMETHODIMP CAggDrawSurface::BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->BltBatch(lpDDBltBatch,dwCount,dwFlags); +} + + +STDMETHODIMP CAggDrawSurface::BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->BltFast(dwX,dwY,lpDDSrcSurface,lpSrcRect,dwTrans); +} + + +STDMETHODIMP CAggDrawSurface::DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->DeleteAttachedSurface(dwFlags,lpDDSAttachedSurface); +} + + +STDMETHODIMP CAggDrawSurface::EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->EnumAttachedSurfaces(lpContext,lpEnumSurfacesCallback); +} + + +STDMETHODIMP CAggDrawSurface::EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->EnumOverlayZOrders(dwFlags,lpContext,lpfnCallback); +} + + +STDMETHODIMP CAggDrawSurface::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Flip(lpDDSurfaceTargetOverride,dwFlags); +} + + +STDMETHODIMP CAggDrawSurface::GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetAttachedSurface(lpDDSCaps,lplpDDAttachedSurface); +} + + +STDMETHODIMP CAggDrawSurface::GetBltStatus(DWORD dwFlags) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetBltStatus(dwFlags); +} + + +STDMETHODIMP CAggDrawSurface::GetCaps(LPDDSCAPS lpDDSCaps) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetCaps(lpDDSCaps); +} + + +STDMETHODIMP CAggDrawSurface::GetClipper(LPDIRECTDRAWCLIPPER *lplpDDClipper) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetClipper(lplpDDClipper); +} + + +STDMETHODIMP CAggDrawSurface::GetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetColorKey(dwFlags,lpDDColorKey); +} + + +STDMETHODIMP CAggDrawSurface::GetDC(HDC *lphDC) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetDC(lphDC); +} + + +STDMETHODIMP CAggDrawSurface::GetFlipStatus(DWORD dwFlags) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetFlipStatus(dwFlags); +} + + +STDMETHODIMP CAggDrawSurface::GetOverlayPosition(LPLONG lpdwX,LPLONG lpdwY) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetOverlayPosition(lpdwX,lpdwY); +} + + +STDMETHODIMP CAggDrawSurface::GetPalette(LPDIRECTDRAWPALETTE *lplpDDPalette) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetPalette(lplpDDPalette); +} + + +STDMETHODIMP CAggDrawSurface::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->GetPixelFormat(lpDDPixelFormat); +} + + +// A bit of a warning here: Our media samples in DirectShow aggregate on +// IDirectDraw and IDirectDrawSurface (ie are available through IMediaSample +// by QueryInterface). Unfortunately the underlying DirectDraw code cannot +// be aggregated so we have to use these classes. The snag is that when we +// call a different surface and pass in this interface as perhaps the source +// surface the call will fail because DirectDraw dereferences the pointer to +// get at its private data structures. Therefore we supply this workaround to give +// access to the real IDirectDraw surface. A filter can call GetSurfaceDesc +// and we will fill in the lpSurface pointer with the real underlying surface + +STDMETHODIMP CAggDrawSurface::GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc) { + ASSERT(m_pDirectDrawSurface); + + // First call down to the underlying DirectDraw + + HRESULT hr = m_pDirectDrawSurface->GetSurfaceDesc(lpDDSurfaceDesc); + if(FAILED(hr)) { + return hr; + } + + // Store the real DirectDrawSurface interface + lpDDSurfaceDesc->lpSurface = m_pDirectDrawSurface; + return hr; +} + + +STDMETHODIMP CAggDrawSurface::Initialize(LPDIRECTDRAW lpDD,LPDDSURFACEDESC lpDDSurfaceDesc) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Initialize(lpDD,lpDDSurfaceDesc); +} + + +STDMETHODIMP CAggDrawSurface::IsLost() { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->IsLost(); +} + + +STDMETHODIMP CAggDrawSurface::Lock(LPRECT lpDestRect,LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent); +} + + +STDMETHODIMP CAggDrawSurface::ReleaseDC(HDC hDC) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->ReleaseDC(hDC); +} + + +STDMETHODIMP CAggDrawSurface::Restore() { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Restore(); +} + + +STDMETHODIMP CAggDrawSurface::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->SetClipper(lpDDClipper); +} + + +STDMETHODIMP CAggDrawSurface::SetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->SetColorKey(dwFlags,lpDDColorKey); +} + + +STDMETHODIMP CAggDrawSurface::SetOverlayPosition(LONG dwX,LONG dwY) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->SetOverlayPosition(dwX,dwY); +} + + +STDMETHODIMP CAggDrawSurface::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->SetPalette(lpDDPalette); +} + + +STDMETHODIMP CAggDrawSurface::Unlock(LPVOID lpSurfaceData) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->Unlock(lpSurfaceData); +} + + +STDMETHODIMP CAggDrawSurface::UpdateOverlay(LPRECT lpSrcRect,LPDIRECTDRAWSURFACE lpDDDestSurface,LPRECT lpDestRect,DWORD dwFlags,LPDDOVERLAYFX lpDDOverlayFX) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->UpdateOverlay(lpSrcRect,lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFX); +} + + +STDMETHODIMP CAggDrawSurface::UpdateOverlayDisplay(DWORD dwFlags) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->UpdateOverlayDisplay(dwFlags); +} + + +STDMETHODIMP CAggDrawSurface::UpdateOverlayZOrder(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSReference) { + ASSERT(m_pDirectDrawSurface); + return m_pDirectDrawSurface->UpdateOverlayZOrder(dwFlags,lpDDSReference); +} + + +// DirectShow must work on multiple platforms. In particular, it also runs on +// Windows NT 3.51 which does not have DirectDraw capabilities. The filters +// cannot therefore link statically to the DirectDraw library. To make their +// lives that little bit easier we provide this class that manages loading +// and unloading the library and creating the initial IDirectDraw interface + +CLoadDirectDraw::CLoadDirectDraw() : + m_pDirectDraw(NULL), + m_hDirectDraw(NULL) { +} + + +// Destructor forces unload + +CLoadDirectDraw::~CLoadDirectDraw() { + ReleaseDirectDraw(); + + if(m_hDirectDraw) { + NOTE("Unloading library"); + FreeLibrary(m_hDirectDraw); + } +} + + +// We can't be sure that DirectDraw is always available so we can't statically +// link to the library. Therefore we load the library, get the function entry +// point addresses and call them to create the driver objects. We return S_OK +// if we manage to load DirectDraw correctly otherwise we return E_NOINTERFACE +// We initialise a DirectDraw instance by explicitely loading the library and +// calling GetProcAddress on the DirectDrawCreate entry point that it exports + +// On a multi monitor system, we can get the DirectDraw object for any +// monitor (device) with the optional szDevice parameter + +HRESULT CLoadDirectDraw::LoadDirectDraw(LPSTR szDevice) { + PDRAWCREATE pDrawCreate; + PDRAWENUM pDrawEnum; + LPDIRECTDRAWENUMERATEEXA pDrawEnumEx; + HRESULT hr = NOERROR; + + NOTE("Entering DoLoadDirectDraw"); + + // Is DirectDraw already loaded + + if(m_pDirectDraw) { + NOTE("Already loaded"); + ASSERT(m_hDirectDraw); + return NOERROR; + } + + // Make sure the library is available + + if(!m_hDirectDraw) { + UINT ErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX); + m_hDirectDraw = LoadLibrary(TEXT("DDRAW.DLL")); + SetErrorMode(ErrorMode); + + if(m_hDirectDraw == NULL) { + DbgLog((LOG_ERROR,1,TEXT("Can't load DDRAW.DLL"))); + NOTE("No library"); + return E_NOINTERFACE; + } + } + + // Get the DLL address for the creator function + + pDrawCreate = (PDRAWCREATE)GetProcAddress(m_hDirectDraw,"DirectDrawCreate"); + // force ANSI, we assume it + pDrawEnum = (PDRAWENUM)GetProcAddress(m_hDirectDraw,"DirectDrawEnumerateA"); + pDrawEnumEx = (LPDIRECTDRAWENUMERATEEXA)GetProcAddress(m_hDirectDraw, + "DirectDrawEnumerateExA"); + + // We don't NEED DirectDrawEnumerateEx, that's just for multimon stuff + if(pDrawCreate == NULL || pDrawEnum == NULL) { + DbgLog((LOG_ERROR,1,TEXT("Can't get functions: Create=%x Enum=%x"), + pDrawCreate, pDrawEnum)); + NOTE("No entry point"); + ReleaseDirectDraw(); + return E_NOINTERFACE; + } + + DbgLog((LOG_TRACE,3,TEXT("Creating DDraw for device %s"), + szDevice ? szDevice : "")); + + // Create a DirectDraw display provider for this device, using the fancy + // multimon-aware version, if it exists + if(pDrawEnumEx) + m_pDirectDraw = DirectDrawCreateFromDeviceEx(szDevice, pDrawCreate, + pDrawEnumEx); + else + m_pDirectDraw = DirectDrawCreateFromDevice(szDevice, pDrawCreate, + pDrawEnum); + + if(m_pDirectDraw == NULL) { + DbgLog((LOG_ERROR,1,TEXT("Can't create DDraw"))); + NOTE("No instance"); + ReleaseDirectDraw(); + return E_NOINTERFACE; + } + return NOERROR; +} + + +// Called to release any DirectDraw provider we previously loaded. We may be +// called at any time especially when something goes horribly wrong and when +// we need to clean up before returning so we can't guarantee that all state +// variables are consistent so free only those really allocated allocated +// This should only be called once all reference counts have been released + +void CLoadDirectDraw::ReleaseDirectDraw() { + NOTE("Releasing DirectDraw driver"); + + // Release any DirectDraw provider interface + + if(m_pDirectDraw) { + NOTE("Releasing instance"); + m_pDirectDraw->Release(); + m_pDirectDraw = NULL; + } + +} + + +// Return NOERROR (S_OK) if DirectDraw has been loaded by this object + +HRESULT CLoadDirectDraw::IsDirectDrawLoaded() { + NOTE("Entering IsDirectDrawLoaded"); + + if(m_pDirectDraw == NULL) { + NOTE("DirectDraw not loaded"); + return S_FALSE; + } + return NOERROR; +} + + +// Return the IDirectDraw interface we look after + +LPDIRECTDRAW CLoadDirectDraw::GetDirectDraw() { + NOTE("Entering GetDirectDraw"); + + if(m_pDirectDraw == NULL) { + NOTE("No DirectDraw"); + return NULL; + } + + NOTE("Returning DirectDraw"); + m_pDirectDraw->AddRef(); + return m_pDirectDraw; +} + + +// Are we running on Direct Draw version 1? We need to find out as +// we rely on specific bug fixes in DirectDraw 2 for fullscreen playback. To +// find out, we simply see if it supports IDirectDraw2. Only version 2 and +// higher support this. + +BOOL CLoadDirectDraw::IsDirectDrawVersion1() { + + if(m_pDirectDraw == NULL) + return FALSE; + + IDirectDraw2 *p = NULL; + HRESULT hr = m_pDirectDraw->QueryInterface(IID_IDirectDraw2, (void **)&p); + if(p) + p->Release(); + if(hr == NOERROR) { + DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 2 or greater"))); + return FALSE; + } + else { + DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 1"))); + return TRUE; + } +} + diff --git a/src/BaseClasses/videoctl.h b/src/BaseClasses/videoctl.h index 72b5492c3c..cf2a5e4b2b 100644 --- a/src/BaseClasses/videoctl.h +++ b/src/BaseClasses/videoctl.h @@ -1,178 +1,178 @@ -//------------------------------------------------------------------------------ -// File: VideoCtl.h -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __VIDEOCTL__ -#define __VIDEOCTL__ - -// These help with property page implementations. The first can be used to -// load any string from a resource file. The buffer to load into is passed -// as an input parameter. The same buffer is the return value if the string -// was found otherwise it returns TEXT(""). The GetDialogSize is passed the -// resource ID of a dialog box and returns the size of it in screen pixels - -#define STR_MAX_LENGTH 256 -TCHAR * WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID); - -#ifdef UNICODE -#define WideStringFromResource StringFromResource -char* WINAPI StringFromResource(char*pBuffer, int iResourceID); -#else -WCHAR * WINAPI WideStringFromResource(WCHAR *pBuffer, int iResourceID); -#endif - - -BOOL WINAPI GetDialogSize(int iResourceID, // Dialog box resource identifier - DLGPROC pDlgProc, // Pointer to dialog procedure - LPARAM lParam, // Any user data wanted in pDlgProc - SIZE *pResult); // Returns the size of dialog box - -// Class that aggregates an IDirectDraw interface - -class CAggDirectDraw : public IDirectDraw, public CUnknown -{ -protected: - - LPDIRECTDRAW m_pDirectDraw; - -public: - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); - - // Constructor and destructor - - CAggDirectDraw(TCHAR *pName,LPUNKNOWN pUnk) : - CUnknown(pName,pUnk), - m_pDirectDraw(NULL) { }; - - virtual CAggDirectDraw::~CAggDirectDraw() { }; - - // Set the object we should be aggregating - void SetDirectDraw(LPDIRECTDRAW pDirectDraw) { - m_pDirectDraw = pDirectDraw; - } - - // IDirectDraw methods - - STDMETHODIMP Compact(); - STDMETHODIMP CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter); - STDMETHODIMP CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter); - STDMETHODIMP CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter); - STDMETHODIMP DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface); - STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback); - STDMETHODIMP EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback); - STDMETHODIMP FlipToGDISurface(); - STDMETHODIMP GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps); - STDMETHODIMP GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc); - STDMETHODIMP GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes); - STDMETHODIMP GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface); - STDMETHODIMP GetMonitorFrequency(LPDWORD lpdwFrequency); - STDMETHODIMP GetScanLine(LPDWORD lpdwScanLine); - STDMETHODIMP GetVerticalBlankStatus(LPBOOL lpblsInVB); - STDMETHODIMP Initialize(GUID *lpGUID); - STDMETHODIMP RestoreDisplayMode(); - STDMETHODIMP SetCooperativeLevel(HWND hWnd,DWORD dwFlags); - STDMETHODIMP SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp); - STDMETHODIMP WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent); -}; - - -// Class that aggregates an IDirectDrawSurface interface - -class CAggDrawSurface : public IDirectDrawSurface, public CUnknown -{ -protected: - - LPDIRECTDRAWSURFACE m_pDirectDrawSurface; - -public: - - DECLARE_IUNKNOWN - STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); - - // Constructor and destructor - - CAggDrawSurface(TCHAR *pName,LPUNKNOWN pUnk) : - CUnknown(pName,pUnk), - m_pDirectDrawSurface(NULL) { }; - - virtual ~CAggDrawSurface() { }; - - // Set the object we should be aggregating - void SetDirectDrawSurface(LPDIRECTDRAWSURFACE pDirectDrawSurface) { - m_pDirectDrawSurface = pDirectDrawSurface; - } - - // IDirectDrawSurface methods - - STDMETHODIMP AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface); - STDMETHODIMP AddOverlayDirtyRect(LPRECT lpRect); - STDMETHODIMP Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx); - STDMETHODIMP BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags); - STDMETHODIMP BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans); - STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface); - STDMETHODIMP EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback); - STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback); - STDMETHODIMP Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags); - STDMETHODIMP GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface); - STDMETHODIMP GetBltStatus(DWORD dwFlags); - STDMETHODIMP GetCaps(LPDDSCAPS lpDDSCaps); - STDMETHODIMP GetClipper(LPDIRECTDRAWCLIPPER *lplpDDClipper); - STDMETHODIMP GetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey); - STDMETHODIMP GetDC(HDC *lphDC); - STDMETHODIMP GetFlipStatus(DWORD dwFlags); - STDMETHODIMP GetOverlayPosition(LPLONG lpdwX,LPLONG lpdwY); - STDMETHODIMP GetPalette(LPDIRECTDRAWPALETTE *lplpDDPalette); - STDMETHODIMP GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat); - STDMETHODIMP GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc); - STDMETHODIMP Initialize(LPDIRECTDRAW lpDD,LPDDSURFACEDESC lpDDSurfaceDesc); - STDMETHODIMP IsLost(); - STDMETHODIMP Lock(LPRECT lpDestRect,LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent); - STDMETHODIMP ReleaseDC(HDC hDC); - STDMETHODIMP Restore(); - STDMETHODIMP SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper); - STDMETHODIMP SetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey); - STDMETHODIMP SetOverlayPosition(LONG dwX,LONG dwY); - STDMETHODIMP SetPalette(LPDIRECTDRAWPALETTE lpDDPalette); - STDMETHODIMP Unlock(LPVOID lpSurfaceData); - STDMETHODIMP UpdateOverlay(LPRECT lpSrcRect,LPDIRECTDRAWSURFACE lpDDDestSurface,LPRECT lpDestRect,DWORD dwFlags,LPDDOVERLAYFX lpDDOverlayFX); - STDMETHODIMP UpdateOverlayDisplay(DWORD dwFlags); - STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSReference); -}; - - -// DirectShow must work on multiple platforms. In particular, it also runs on -// Windows NT 3.51 which does not have DirectDraw capabilities. The filters -// cannot therefore link statically to the DirectDraw library. To make their -// lives that little bit easier we provide this class that manages loading -// and unloading the library and creating the initial IDirectDraw interface - -typedef DWORD (WINAPI *PGETFILEVERSIONINFOSIZE)(LPTSTR,LPDWORD); -typedef BOOL (WINAPI *PGETFILEVERSIONINFO)(LPTSTR,DWORD,DWORD,LPVOID); -typedef BOOL (WINAPI *PVERQUERYVALUE)(LPVOID,LPTSTR,LPVOID,PUINT); - -class CLoadDirectDraw -{ - LPDIRECTDRAW m_pDirectDraw; // The DirectDraw driver instance - HINSTANCE m_hDirectDraw; // Handle to the loaded library - -public: - - CLoadDirectDraw(); - ~CLoadDirectDraw(); - - HRESULT LoadDirectDraw(LPSTR szDevice); - void ReleaseDirectDraw(); - HRESULT IsDirectDrawLoaded(); - LPDIRECTDRAW GetDirectDraw(); - BOOL IsDirectDrawVersion1(); -}; - -#endif // __VIDEOCTL__ - +//------------------------------------------------------------------------------ +// File: VideoCtl.h +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __VIDEOCTL__ +#define __VIDEOCTL__ + +// These help with property page implementations. The first can be used to +// load any string from a resource file. The buffer to load into is passed +// as an input parameter. The same buffer is the return value if the string +// was found otherwise it returns TEXT(""). The GetDialogSize is passed the +// resource ID of a dialog box and returns the size of it in screen pixels + +#define STR_MAX_LENGTH 256 +TCHAR * WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID); + +#ifdef UNICODE +#define WideStringFromResource StringFromResource +char* WINAPI StringFromResource(char*pBuffer, int iResourceID); +#else +WCHAR * WINAPI WideStringFromResource(WCHAR *pBuffer, int iResourceID); +#endif + + +BOOL WINAPI GetDialogSize(int iResourceID, // Dialog box resource identifier + DLGPROC pDlgProc, // Pointer to dialog procedure + LPARAM lParam, // Any user data wanted in pDlgProc + SIZE *pResult); // Returns the size of dialog box + +// Class that aggregates an IDirectDraw interface + +class CAggDirectDraw : public IDirectDraw, public CUnknown +{ +protected: + + LPDIRECTDRAW m_pDirectDraw; + +public: + + DECLARE_IUNKNOWN + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); + + // Constructor and destructor + + CAggDirectDraw(TCHAR *pName,LPUNKNOWN pUnk) : + CUnknown(pName,pUnk), + m_pDirectDraw(NULL) { }; + + virtual CAggDirectDraw::~CAggDirectDraw() { }; + + // Set the object we should be aggregating + void SetDirectDraw(LPDIRECTDRAW pDirectDraw) { + m_pDirectDraw = pDirectDraw; + } + + // IDirectDraw methods + + STDMETHODIMP Compact(); + STDMETHODIMP CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter); + STDMETHODIMP CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter); + STDMETHODIMP CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter); + STDMETHODIMP DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface); + STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback); + STDMETHODIMP EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback); + STDMETHODIMP FlipToGDISurface(); + STDMETHODIMP GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps); + STDMETHODIMP GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc); + STDMETHODIMP GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes); + STDMETHODIMP GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface); + STDMETHODIMP GetMonitorFrequency(LPDWORD lpdwFrequency); + STDMETHODIMP GetScanLine(LPDWORD lpdwScanLine); + STDMETHODIMP GetVerticalBlankStatus(LPBOOL lpblsInVB); + STDMETHODIMP Initialize(GUID *lpGUID); + STDMETHODIMP RestoreDisplayMode(); + STDMETHODIMP SetCooperativeLevel(HWND hWnd,DWORD dwFlags); + STDMETHODIMP SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp); + STDMETHODIMP WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent); +}; + + +// Class that aggregates an IDirectDrawSurface interface + +class CAggDrawSurface : public IDirectDrawSurface, public CUnknown +{ +protected: + + LPDIRECTDRAWSURFACE m_pDirectDrawSurface; + +public: + + DECLARE_IUNKNOWN + STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv); + + // Constructor and destructor + + CAggDrawSurface(TCHAR *pName,LPUNKNOWN pUnk) : + CUnknown(pName,pUnk), + m_pDirectDrawSurface(NULL) { }; + + virtual ~CAggDrawSurface() { }; + + // Set the object we should be aggregating + void SetDirectDrawSurface(LPDIRECTDRAWSURFACE pDirectDrawSurface) { + m_pDirectDrawSurface = pDirectDrawSurface; + } + + // IDirectDrawSurface methods + + STDMETHODIMP AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface); + STDMETHODIMP AddOverlayDirtyRect(LPRECT lpRect); + STDMETHODIMP Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx); + STDMETHODIMP BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags); + STDMETHODIMP BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans); + STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface); + STDMETHODIMP EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback); + STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback); + STDMETHODIMP Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags); + STDMETHODIMP GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface); + STDMETHODIMP GetBltStatus(DWORD dwFlags); + STDMETHODIMP GetCaps(LPDDSCAPS lpDDSCaps); + STDMETHODIMP GetClipper(LPDIRECTDRAWCLIPPER *lplpDDClipper); + STDMETHODIMP GetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey); + STDMETHODIMP GetDC(HDC *lphDC); + STDMETHODIMP GetFlipStatus(DWORD dwFlags); + STDMETHODIMP GetOverlayPosition(LPLONG lpdwX,LPLONG lpdwY); + STDMETHODIMP GetPalette(LPDIRECTDRAWPALETTE *lplpDDPalette); + STDMETHODIMP GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat); + STDMETHODIMP GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc); + STDMETHODIMP Initialize(LPDIRECTDRAW lpDD,LPDDSURFACEDESC lpDDSurfaceDesc); + STDMETHODIMP IsLost(); + STDMETHODIMP Lock(LPRECT lpDestRect,LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent); + STDMETHODIMP ReleaseDC(HDC hDC); + STDMETHODIMP Restore(); + STDMETHODIMP SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper); + STDMETHODIMP SetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey); + STDMETHODIMP SetOverlayPosition(LONG dwX,LONG dwY); + STDMETHODIMP SetPalette(LPDIRECTDRAWPALETTE lpDDPalette); + STDMETHODIMP Unlock(LPVOID lpSurfaceData); + STDMETHODIMP UpdateOverlay(LPRECT lpSrcRect,LPDIRECTDRAWSURFACE lpDDDestSurface,LPRECT lpDestRect,DWORD dwFlags,LPDDOVERLAYFX lpDDOverlayFX); + STDMETHODIMP UpdateOverlayDisplay(DWORD dwFlags); + STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSReference); +}; + + +// DirectShow must work on multiple platforms. In particular, it also runs on +// Windows NT 3.51 which does not have DirectDraw capabilities. The filters +// cannot therefore link statically to the DirectDraw library. To make their +// lives that little bit easier we provide this class that manages loading +// and unloading the library and creating the initial IDirectDraw interface + +typedef DWORD (WINAPI *PGETFILEVERSIONINFOSIZE)(LPTSTR,LPDWORD); +typedef BOOL (WINAPI *PGETFILEVERSIONINFO)(LPTSTR,DWORD,DWORD,LPVOID); +typedef BOOL (WINAPI *PVERQUERYVALUE)(LPVOID,LPTSTR,LPVOID,PUINT); + +class CLoadDirectDraw +{ + LPDIRECTDRAW m_pDirectDraw; // The DirectDraw driver instance + HINSTANCE m_hDirectDraw; // Handle to the loaded library + +public: + + CLoadDirectDraw(); + ~CLoadDirectDraw(); + + HRESULT LoadDirectDraw(LPSTR szDevice); + void ReleaseDirectDraw(); + HRESULT IsDirectDrawLoaded(); + LPDIRECTDRAW GetDirectDraw(); + BOOL IsDirectDrawVersion1(); +}; + +#endif // __VIDEOCTL__ + diff --git a/src/BaseClasses/vtrans.cpp b/src/BaseClasses/vtrans.cpp index 8ff52a134a..3e2766de9d 100644 --- a/src/BaseClasses/vtrans.cpp +++ b/src/BaseClasses/vtrans.cpp @@ -1,468 +1,468 @@ -//------------------------------------------------------------------------------ -// File: Vtrans.cpp -// -// Desc: DirectShow base classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include -// #include // now in precomp file streams.h - -CVideoTransformFilter::CVideoTransformFilter - ( TCHAR *pName, LPUNKNOWN pUnk, REFCLSID clsid) - : CTransformFilter(pName, pUnk, clsid) - , m_itrLate(0) - , m_nKeyFramePeriod(0) // No QM until we see at least 2 key frames - , m_nFramesSinceKeyFrame(0) - , m_bSkipping(FALSE) - , m_tDecodeStart(0) - , m_itrAvgDecode(300000) // 30mSec - probably allows skipping - , m_bQualityChanged(FALSE) { -#ifdef PERF - RegisterPerfId(); -#endif // PERF -} - - -CVideoTransformFilter::~CVideoTransformFilter() { - // nothing to do -} - - -// Reset our quality management state - -HRESULT CVideoTransformFilter::StartStreaming() { - m_itrLate = 0; - m_nKeyFramePeriod = 0; // No QM until we see at least 2 key frames - m_nFramesSinceKeyFrame = 0; - m_bSkipping = FALSE; - m_tDecodeStart = 0; - m_itrAvgDecode = 300000; // 30mSec - probably allows skipping - m_bQualityChanged = FALSE; - m_bSampleSkipped = FALSE; - return NOERROR; -} - - -// Overriden to reset quality management information - -HRESULT CVideoTransformFilter::EndFlush() { { - // Synchronize - CAutoLock lck(&m_csReceive); - - // Reset our stats - // - // Note - we don't want to call derived classes here, - // we only want to reset our internal variables and this - // is a convenient way to do it - CVideoTransformFilter::StartStreaming(); - } - return CTransformFilter::EndFlush(); -} - - -HRESULT CVideoTransformFilter::AbortPlayback(HRESULT hr) { - NotifyEvent(EC_ERRORABORT, hr, 0); - m_pOutput->DeliverEndOfStream(); - return hr; -} - - -// Receive() -// -// Accept a sample from upstream, decide whether to process it -// or drop it. If we process it then get a buffer from the -// allocator of the downstream connection, transform it into the -// new buffer and deliver it to the downstream filter. -// If we decide not to process it then we do not get a buffer. - -// Remember that although this code will notice format changes coming into -// the input pin, it will NOT change its output format if that results -// in the filter needing to make a corresponding output format change. Your -// derived filter will have to take care of that. (eg. a palette change if -// the input and output is an 8 bit format). If the input sample is discarded -// and nothing is sent out for this Receive, please remember to put the format -// change on the first output sample that you actually do send. -// If your filter will produce the same output type even when the input type -// changes, then this base class code will do everything you need. - -HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample) { - // If the next filter downstream is the video renderer, then it may - // be able to operate in DirectDraw mode which saves copying the data - // and gives higher performance. In that case the buffer which we - // get from GetDeliveryBuffer will be a DirectDraw buffer, and - // drawing into this buffer draws directly onto the display surface. - // This means that any waiting for the correct time to draw occurs - // during GetDeliveryBuffer, and that once the buffer is given to us - // the video renderer will count it in its statistics as a frame drawn. - // This means that any decision to drop the frame must be taken before - // calling GetDeliveryBuffer. - - ASSERT(CritCheckIn(&m_csReceive)); - AM_MEDIA_TYPE *pmtOut, *pmt; -#ifdef DEBUG - FOURCCMap fccOut; -#endif - HRESULT hr; - ASSERT(pSample); - IMediaSample * pOutSample; - - // If no output pin to deliver to then no point sending us data - ASSERT(m_pOutput != NULL) ; - - // The source filter may dynamically ask us to start transforming from a - // different media type than the one we're using now. If we don't, we'll - // draw garbage. (typically, this is a palette change in the movie, - // but could be something more sinister like the compression type changing, - // or even the video size changing) - -#define rcS1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcSource -#define rcT1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcTarget - - pSample->GetMediaType(&pmt); - if(pmt != NULL && pmt->pbFormat != NULL) { - - // spew some debug output - ASSERT(!IsEqualGUID(pmt->majortype, GUID_NULL)); -#ifdef DEBUG - fccOut.SetFOURCC(&pmt->subtype); - LONG lCompression = HEADER(pmt->pbFormat)->biCompression; - LONG lBitCount = HEADER(pmt->pbFormat)->biBitCount; - LONG lStride = (HEADER(pmt->pbFormat)->biWidth * lBitCount + 7) / 8; - lStride = (lStride + 3) & ~3; - DbgLog((LOG_TRACE,3,TEXT("*Changing input type on the fly to"))); - DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"), - fccOut.GetFOURCC(), lCompression, lBitCount)); - DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"), - HEADER(pmt->pbFormat)->biHeight, - rcT1.left, rcT1.top, rcT1.right, rcT1.bottom)); - DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"), - rcS1.left, rcS1.top, rcS1.right, rcS1.bottom, - lStride)); -#endif - - // now switch to using the new format. I am assuming that the - // derived filter will do the right thing when its media type is - // switched and streaming is restarted. - - StopStreaming(); - m_pInput->CurrentMediaType() = *pmt; - DeleteMediaType(pmt); - // if this fails, playback will stop, so signal an error - hr = StartStreaming(); - if(FAILED(hr)) { - return AbortPlayback(hr); - } - } - - // Now that we have noticed any format changes on the input sample, it's - // OK to discard it. - - if(ShouldSkipFrame(pSample)) { - MSR_NOTE(m_idSkip); - m_bSampleSkipped = TRUE; - return NOERROR; - } - - // Set up the output sample - hr = InitializeOutputSample(pSample, &pOutSample); - - if(FAILED(hr)) { - return hr; - } - - m_bSampleSkipped = FALSE; - - // The renderer may ask us to on-the-fly to start transforming to a - // different format. If we don't obey it, we'll draw garbage - -#define rcS ((VIDEOINFOHEADER *)(pmtOut->pbFormat))->rcSource -#define rcT ((VIDEOINFOHEADER *)(pmtOut->pbFormat))->rcTarget - - pOutSample->GetMediaType(&pmtOut); - if(pmtOut != NULL && pmtOut->pbFormat != NULL) { - - // spew some debug output - ASSERT(!IsEqualGUID(pmtOut->majortype, GUID_NULL)); -#ifdef DEBUG - fccOut.SetFOURCC(&pmtOut->subtype); - LONG lCompression = HEADER(pmtOut->pbFormat)->biCompression; - LONG lBitCount = HEADER(pmtOut->pbFormat)->biBitCount; - LONG lStride = (HEADER(pmtOut->pbFormat)->biWidth * lBitCount + 7) / 8; - lStride = (lStride + 3) & ~3; - DbgLog((LOG_TRACE,3,TEXT("*Changing output type on the fly to"))); - DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"), - fccOut.GetFOURCC(), lCompression, lBitCount)); - DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"), - HEADER(pmtOut->pbFormat)->biHeight, - rcT.left, rcT.top, rcT.right, rcT.bottom)); - DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"), - rcS.left, rcS.top, rcS.right, rcS.bottom, - lStride)); -#endif - - // now switch to using the new format. I am assuming that the - // derived filter will do the right thing when its media type is - // switched and streaming is restarted. - - StopStreaming(); - m_pOutput->CurrentMediaType() = *pmtOut; - DeleteMediaType(pmtOut); - hr = StartStreaming(); - - if(SUCCEEDED(hr)) { - // a new format, means a new empty buffer, so wait for a keyframe - // before passing anything on to the renderer. - // !!! a keyframe may never come, so give up after 30 frames - DbgLog((LOG_TRACE,3,TEXT("Output format change means we must wait for a keyframe"))); - m_nWaitForKey = 30; - - // if this fails, playback will stop, so signal an error - } - else { - - // Must release the sample before calling AbortPlayback - // because we might be holding the win16 lock or - // ddraw lock - pOutSample->Release(); - AbortPlayback(hr); - return hr; - } - } - - // After a discontinuity, we need to wait for the next key frame - if(pSample->IsDiscontinuity() == S_OK) { - DbgLog((LOG_TRACE,3,TEXT("Non-key discontinuity - wait for keyframe"))); - m_nWaitForKey = 30; - } - - // Start timing the transform (and log it if PERF is defined) - - if(SUCCEEDED(hr)) { - m_tDecodeStart = timeGetTime(); - MSR_START(m_idTransform); - - // have the derived class transform the data - hr = Transform(pSample, pOutSample); - - // Stop the clock (and log it if PERF is defined) - MSR_STOP(m_idTransform); - m_tDecodeStart = timeGetTime()-m_tDecodeStart; - m_itrAvgDecode = m_tDecodeStart*(10000/16) + 15*(m_itrAvgDecode/16); - - // Maybe we're waiting for a keyframe still? - if(m_nWaitForKey) - m_nWaitForKey--; - if(m_nWaitForKey && pSample->IsSyncPoint() == S_OK) - m_nWaitForKey = FALSE; - - // if so, then we don't want to pass this on to the renderer - if(m_nWaitForKey && hr == NOERROR) { - DbgLog((LOG_TRACE,3,TEXT("still waiting for a keyframe"))); - hr = S_FALSE; - } - } - - if(FAILED(hr)) { - DbgLog((LOG_TRACE,1,TEXT("Error from video transform"))); - } - else { - // the Transform() function can return S_FALSE to indicate that the - // sample should not be delivered; we only deliver the sample if it's - // really S_OK (same as NOERROR, of course.) - // Try not to return S_FALSE to a direct draw buffer (it's wasteful) - // Try to take the decision earlier - before you get it. - - if(hr == NOERROR) { - hr = m_pOutput->Deliver(pOutSample); - } - else { - // S_FALSE returned from Transform is a PRIVATE agreement - // We should return NOERROR from Receive() in this case because returning S_FALSE - // from Receive() means that this is the end of the stream and no more data should - // be sent. - if(S_FALSE == hr) { - - // We must Release() the sample before doing anything - // like calling the filter graph because having the - // sample means we may have the DirectDraw lock - // (== win16 lock on some versions) - pOutSample->Release(); - m_bSampleSkipped = TRUE; - if(!m_bQualityChanged) { - m_bQualityChanged = TRUE; - NotifyEvent(EC_QUALITY_CHANGE,0,0); - } - return NOERROR; - } - } - } - - // release the output buffer. If the connected pin still needs it, - // it will have addrefed it itself. - pOutSample->Release(); - ASSERT(CritCheckIn(&m_csReceive)); - - return hr; -} - - - -BOOL CVideoTransformFilter::ShouldSkipFrame( IMediaSample * pIn) { - REFERENCE_TIME trStart, trStopAt; - HRESULT hr = pIn->GetTime(&trStart, &trStopAt); - - // Don't skip frames with no timestamps - if(hr != S_OK) - return FALSE; - - int itrFrame = (int)(trStopAt - trStart); // frame duration - - if(S_OK==pIn->IsSyncPoint()) { - MSR_INTEGER(m_idFrameType, 1); - if(m_nKeyFramePeriod < m_nFramesSinceKeyFrame) { - // record the max - m_nKeyFramePeriod = m_nFramesSinceKeyFrame; - } - m_nFramesSinceKeyFrame = 0; - m_bSkipping = FALSE; - } - else { - MSR_INTEGER(m_idFrameType, 2); - if(m_nFramesSinceKeyFrame>m_nKeyFramePeriod - && m_nKeyFramePeriod>0) { - // We haven't seen the key frame yet, but we were clearly being - // overoptimistic about how frequent they are. - m_nKeyFramePeriod = m_nFramesSinceKeyFrame; - } - } - - - // Whatever we might otherwise decide, - // if we are taking only a small fraction of the required frame time to decode - // then any quality problems are actually coming from somewhere else. - // Could be a net problem at the source for instance. In this case there's - // no point in us skipping frames here. - if(m_itrAvgDecode*4>itrFrame) { - - // Don't skip unless we are at least a whole frame late. - // (We would skip B frames if more than 1/2 frame late, but they're safe). - if(m_itrLate > itrFrame) { - - // Don't skip unless the anticipated key frame would be no more than - // 1 frame early. If the renderer has not been waiting (we *guess* - // it hasn't because we're late) then it will allow frames to be - // played early by up to a frame. - - // Let T = Stream time from now to anticipated next key frame - // = (frame duration) * (KeyFramePeriod - FramesSinceKeyFrame) - // So we skip if T - Late < one frame i.e. - // (duration) * (freq - FramesSince) - Late < duration - // or (duration) * (freq - FramesSince - 1) < Late - - // We don't dare skip until we have seen some key frames and have - // some idea how often they occur and they are reasonably frequent. - if(m_nKeyFramePeriod>0) { - // It would be crazy - but we could have a stream with key frames - // a very long way apart - and if they are further than about - // 3.5 minutes apart then we could get arithmetic overflow in - // reference time units. Therefore we switch to mSec at this point - int it = (itrFrame/10000) - * (m_nKeyFramePeriod-m_nFramesSinceKeyFrame - 1); - MSR_INTEGER(m_idTimeTillKey, it); - - // For debug - might want to see the details - dump them as scratch pad -#ifdef VTRANSPERF - MSR_INTEGER(0, itrFrame); - MSR_INTEGER(0, m_nFramesSinceKeyFrame); - MSR_INTEGER(0, m_nKeyFramePeriod); -#endif - if(m_itrLate/10000 > it) { - m_bSkipping = TRUE; - // Now we are committed. Once we start skipping, we - // cannot stop until we hit a key frame. - } - else { -#ifdef VTRANSPERF - MSR_INTEGER(0, 777770); // not near enough to next key -#endif - } - } - else { -#ifdef VTRANSPERF - MSR_INTEGER(0, 777771); // Next key not predictable -#endif - } - } - else { -#ifdef VTRANSPERF - MSR_INTEGER(0, 777772); // Less than one frame late - MSR_INTEGER(0, m_itrLate); - MSR_INTEGER(0, itrFrame); -#endif - } - } - else { -#ifdef VTRANSPERF - MSR_INTEGER(0, 777773); // Decode time short - not not worth skipping - MSR_INTEGER(0, m_itrAvgDecode); - MSR_INTEGER(0, itrFrame); -#endif - } - - ++m_nFramesSinceKeyFrame; - - if(m_bSkipping) { - // We will count down the lateness as we skip each frame. - // We re-assess each frame. The key frame might not arrive when expected. - // We reset m_itrLate if we get a new Quality message, but actually that's - // not likely because we're not sending frames on to the Renderer. In - // fact if we DID get another one it would mean that there's a long - // pipe between us and the renderer and we might need an altogether - // better strategy to avoid hunting! - m_itrLate = m_itrLate - itrFrame; - } - - MSR_INTEGER(m_idLate, (int)m_itrLate/10000); // Note how late we think we are - if(m_bSkipping) { - if(!m_bQualityChanged) { - m_bQualityChanged = TRUE; - NotifyEvent(EC_QUALITY_CHANGE,0,0); - } - } - return m_bSkipping; -} - - -HRESULT CVideoTransformFilter::AlterQuality(Quality q) { - // to reduce the amount of 64 bit arithmetic, m_itrLate is an int. - // +, -, >, == etc are not too bad, but * and / are painful. - if(m_itrLate>300000000) { - // Avoid overflow and silliness - more than 30 secs late is already silly - m_itrLate = 300000000; - } - else { - m_itrLate = (int)q.Late; - } - // We ignore the other fields - - // We're actually not very good at handling this. In non-direct draw mode - // most of the time can be spent in the renderer which can skip any frame. - // In that case we'd rather the renderer handled things. - // Nevertheless we will keep an eye on it and if we really start getting - // a very long way behind then we will actually skip - but we'll still tell - // the renderer (or whoever is downstream) that they should handle quality. - - return E_FAIL; // Tell the renderer to do his thing. - -} - - - -// This will avoid several hundred useless warnings if compiled -W4 by MS VC++ v4 -#pragma warning(disable:4514) - - +//------------------------------------------------------------------------------ +// File: Vtrans.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include +// #include // now in precomp file streams.h + +CVideoTransformFilter::CVideoTransformFilter + ( TCHAR *pName, LPUNKNOWN pUnk, REFCLSID clsid) + : CTransformFilter(pName, pUnk, clsid) + , m_itrLate(0) + , m_nKeyFramePeriod(0) // No QM until we see at least 2 key frames + , m_nFramesSinceKeyFrame(0) + , m_bSkipping(FALSE) + , m_tDecodeStart(0) + , m_itrAvgDecode(300000) // 30mSec - probably allows skipping + , m_bQualityChanged(FALSE) { +#ifdef PERF + RegisterPerfId(); +#endif // PERF +} + + +CVideoTransformFilter::~CVideoTransformFilter() { + // nothing to do +} + + +// Reset our quality management state + +HRESULT CVideoTransformFilter::StartStreaming() { + m_itrLate = 0; + m_nKeyFramePeriod = 0; // No QM until we see at least 2 key frames + m_nFramesSinceKeyFrame = 0; + m_bSkipping = FALSE; + m_tDecodeStart = 0; + m_itrAvgDecode = 300000; // 30mSec - probably allows skipping + m_bQualityChanged = FALSE; + m_bSampleSkipped = FALSE; + return NOERROR; +} + + +// Overriden to reset quality management information + +HRESULT CVideoTransformFilter::EndFlush() { { + // Synchronize + CAutoLock lck(&m_csReceive); + + // Reset our stats + // + // Note - we don't want to call derived classes here, + // we only want to reset our internal variables and this + // is a convenient way to do it + CVideoTransformFilter::StartStreaming(); + } + return CTransformFilter::EndFlush(); +} + + +HRESULT CVideoTransformFilter::AbortPlayback(HRESULT hr) { + NotifyEvent(EC_ERRORABORT, hr, 0); + m_pOutput->DeliverEndOfStream(); + return hr; +} + + +// Receive() +// +// Accept a sample from upstream, decide whether to process it +// or drop it. If we process it then get a buffer from the +// allocator of the downstream connection, transform it into the +// new buffer and deliver it to the downstream filter. +// If we decide not to process it then we do not get a buffer. + +// Remember that although this code will notice format changes coming into +// the input pin, it will NOT change its output format if that results +// in the filter needing to make a corresponding output format change. Your +// derived filter will have to take care of that. (eg. a palette change if +// the input and output is an 8 bit format). If the input sample is discarded +// and nothing is sent out for this Receive, please remember to put the format +// change on the first output sample that you actually do send. +// If your filter will produce the same output type even when the input type +// changes, then this base class code will do everything you need. + +HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample) { + // If the next filter downstream is the video renderer, then it may + // be able to operate in DirectDraw mode which saves copying the data + // and gives higher performance. In that case the buffer which we + // get from GetDeliveryBuffer will be a DirectDraw buffer, and + // drawing into this buffer draws directly onto the display surface. + // This means that any waiting for the correct time to draw occurs + // during GetDeliveryBuffer, and that once the buffer is given to us + // the video renderer will count it in its statistics as a frame drawn. + // This means that any decision to drop the frame must be taken before + // calling GetDeliveryBuffer. + + ASSERT(CritCheckIn(&m_csReceive)); + AM_MEDIA_TYPE *pmtOut, *pmt; +#ifdef DEBUG + FOURCCMap fccOut; +#endif + HRESULT hr; + ASSERT(pSample); + IMediaSample * pOutSample; + + // If no output pin to deliver to then no point sending us data + ASSERT(m_pOutput != NULL) ; + + // The source filter may dynamically ask us to start transforming from a + // different media type than the one we're using now. If we don't, we'll + // draw garbage. (typically, this is a palette change in the movie, + // but could be something more sinister like the compression type changing, + // or even the video size changing) + +#define rcS1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcSource +#define rcT1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcTarget + + pSample->GetMediaType(&pmt); + if(pmt != NULL && pmt->pbFormat != NULL) { + + // spew some debug output + ASSERT(!IsEqualGUID(pmt->majortype, GUID_NULL)); +#ifdef DEBUG + fccOut.SetFOURCC(&pmt->subtype); + LONG lCompression = HEADER(pmt->pbFormat)->biCompression; + LONG lBitCount = HEADER(pmt->pbFormat)->biBitCount; + LONG lStride = (HEADER(pmt->pbFormat)->biWidth * lBitCount + 7) / 8; + lStride = (lStride + 3) & ~3; + DbgLog((LOG_TRACE,3,TEXT("*Changing input type on the fly to"))); + DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"), + fccOut.GetFOURCC(), lCompression, lBitCount)); + DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"), + HEADER(pmt->pbFormat)->biHeight, + rcT1.left, rcT1.top, rcT1.right, rcT1.bottom)); + DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"), + rcS1.left, rcS1.top, rcS1.right, rcS1.bottom, + lStride)); +#endif + + // now switch to using the new format. I am assuming that the + // derived filter will do the right thing when its media type is + // switched and streaming is restarted. + + StopStreaming(); + m_pInput->CurrentMediaType() = *pmt; + DeleteMediaType(pmt); + // if this fails, playback will stop, so signal an error + hr = StartStreaming(); + if(FAILED(hr)) { + return AbortPlayback(hr); + } + } + + // Now that we have noticed any format changes on the input sample, it's + // OK to discard it. + + if(ShouldSkipFrame(pSample)) { + MSR_NOTE(m_idSkip); + m_bSampleSkipped = TRUE; + return NOERROR; + } + + // Set up the output sample + hr = InitializeOutputSample(pSample, &pOutSample); + + if(FAILED(hr)) { + return hr; + } + + m_bSampleSkipped = FALSE; + + // The renderer may ask us to on-the-fly to start transforming to a + // different format. If we don't obey it, we'll draw garbage + +#define rcS ((VIDEOINFOHEADER *)(pmtOut->pbFormat))->rcSource +#define rcT ((VIDEOINFOHEADER *)(pmtOut->pbFormat))->rcTarget + + pOutSample->GetMediaType(&pmtOut); + if(pmtOut != NULL && pmtOut->pbFormat != NULL) { + + // spew some debug output + ASSERT(!IsEqualGUID(pmtOut->majortype, GUID_NULL)); +#ifdef DEBUG + fccOut.SetFOURCC(&pmtOut->subtype); + LONG lCompression = HEADER(pmtOut->pbFormat)->biCompression; + LONG lBitCount = HEADER(pmtOut->pbFormat)->biBitCount; + LONG lStride = (HEADER(pmtOut->pbFormat)->biWidth * lBitCount + 7) / 8; + lStride = (lStride + 3) & ~3; + DbgLog((LOG_TRACE,3,TEXT("*Changing output type on the fly to"))); + DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"), + fccOut.GetFOURCC(), lCompression, lBitCount)); + DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"), + HEADER(pmtOut->pbFormat)->biHeight, + rcT.left, rcT.top, rcT.right, rcT.bottom)); + DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"), + rcS.left, rcS.top, rcS.right, rcS.bottom, + lStride)); +#endif + + // now switch to using the new format. I am assuming that the + // derived filter will do the right thing when its media type is + // switched and streaming is restarted. + + StopStreaming(); + m_pOutput->CurrentMediaType() = *pmtOut; + DeleteMediaType(pmtOut); + hr = StartStreaming(); + + if(SUCCEEDED(hr)) { + // a new format, means a new empty buffer, so wait for a keyframe + // before passing anything on to the renderer. + // !!! a keyframe may never come, so give up after 30 frames + DbgLog((LOG_TRACE,3,TEXT("Output format change means we must wait for a keyframe"))); + m_nWaitForKey = 30; + + // if this fails, playback will stop, so signal an error + } + else { + + // Must release the sample before calling AbortPlayback + // because we might be holding the win16 lock or + // ddraw lock + pOutSample->Release(); + AbortPlayback(hr); + return hr; + } + } + + // After a discontinuity, we need to wait for the next key frame + if(pSample->IsDiscontinuity() == S_OK) { + DbgLog((LOG_TRACE,3,TEXT("Non-key discontinuity - wait for keyframe"))); + m_nWaitForKey = 30; + } + + // Start timing the transform (and log it if PERF is defined) + + if(SUCCEEDED(hr)) { + m_tDecodeStart = timeGetTime(); + MSR_START(m_idTransform); + + // have the derived class transform the data + hr = Transform(pSample, pOutSample); + + // Stop the clock (and log it if PERF is defined) + MSR_STOP(m_idTransform); + m_tDecodeStart = timeGetTime()-m_tDecodeStart; + m_itrAvgDecode = m_tDecodeStart*(10000/16) + 15*(m_itrAvgDecode/16); + + // Maybe we're waiting for a keyframe still? + if(m_nWaitForKey) + m_nWaitForKey--; + if(m_nWaitForKey && pSample->IsSyncPoint() == S_OK) + m_nWaitForKey = FALSE; + + // if so, then we don't want to pass this on to the renderer + if(m_nWaitForKey && hr == NOERROR) { + DbgLog((LOG_TRACE,3,TEXT("still waiting for a keyframe"))); + hr = S_FALSE; + } + } + + if(FAILED(hr)) { + DbgLog((LOG_TRACE,1,TEXT("Error from video transform"))); + } + else { + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + // Try not to return S_FALSE to a direct draw buffer (it's wasteful) + // Try to take the decision earlier - before you get it. + + if(hr == NOERROR) { + hr = m_pOutput->Deliver(pOutSample); + } + else { + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this case because returning S_FALSE + // from Receive() means that this is the end of the stream and no more data should + // be sent. + if(S_FALSE == hr) { + + // We must Release() the sample before doing anything + // like calling the filter graph because having the + // sample means we may have the DirectDraw lock + // (== win16 lock on some versions) + pOutSample->Release(); + m_bSampleSkipped = TRUE; + if(!m_bQualityChanged) { + m_bQualityChanged = TRUE; + NotifyEvent(EC_QUALITY_CHANGE,0,0); + } + return NOERROR; + } + } + } + + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + pOutSample->Release(); + ASSERT(CritCheckIn(&m_csReceive)); + + return hr; +} + + + +BOOL CVideoTransformFilter::ShouldSkipFrame( IMediaSample * pIn) { + REFERENCE_TIME trStart, trStopAt; + HRESULT hr = pIn->GetTime(&trStart, &trStopAt); + + // Don't skip frames with no timestamps + if(hr != S_OK) + return FALSE; + + int itrFrame = (int)(trStopAt - trStart); // frame duration + + if(S_OK==pIn->IsSyncPoint()) { + MSR_INTEGER(m_idFrameType, 1); + if(m_nKeyFramePeriod < m_nFramesSinceKeyFrame) { + // record the max + m_nKeyFramePeriod = m_nFramesSinceKeyFrame; + } + m_nFramesSinceKeyFrame = 0; + m_bSkipping = FALSE; + } + else { + MSR_INTEGER(m_idFrameType, 2); + if(m_nFramesSinceKeyFrame>m_nKeyFramePeriod + && m_nKeyFramePeriod>0) { + // We haven't seen the key frame yet, but we were clearly being + // overoptimistic about how frequent they are. + m_nKeyFramePeriod = m_nFramesSinceKeyFrame; + } + } + + + // Whatever we might otherwise decide, + // if we are taking only a small fraction of the required frame time to decode + // then any quality problems are actually coming from somewhere else. + // Could be a net problem at the source for instance. In this case there's + // no point in us skipping frames here. + if(m_itrAvgDecode*4>itrFrame) { + + // Don't skip unless we are at least a whole frame late. + // (We would skip B frames if more than 1/2 frame late, but they're safe). + if(m_itrLate > itrFrame) { + + // Don't skip unless the anticipated key frame would be no more than + // 1 frame early. If the renderer has not been waiting (we *guess* + // it hasn't because we're late) then it will allow frames to be + // played early by up to a frame. + + // Let T = Stream time from now to anticipated next key frame + // = (frame duration) * (KeyFramePeriod - FramesSinceKeyFrame) + // So we skip if T - Late < one frame i.e. + // (duration) * (freq - FramesSince) - Late < duration + // or (duration) * (freq - FramesSince - 1) < Late + + // We don't dare skip until we have seen some key frames and have + // some idea how often they occur and they are reasonably frequent. + if(m_nKeyFramePeriod>0) { + // It would be crazy - but we could have a stream with key frames + // a very long way apart - and if they are further than about + // 3.5 minutes apart then we could get arithmetic overflow in + // reference time units. Therefore we switch to mSec at this point + int it = (itrFrame/10000) + * (m_nKeyFramePeriod-m_nFramesSinceKeyFrame - 1); + MSR_INTEGER(m_idTimeTillKey, it); + + // For debug - might want to see the details - dump them as scratch pad +#ifdef VTRANSPERF + MSR_INTEGER(0, itrFrame); + MSR_INTEGER(0, m_nFramesSinceKeyFrame); + MSR_INTEGER(0, m_nKeyFramePeriod); +#endif + if(m_itrLate/10000 > it) { + m_bSkipping = TRUE; + // Now we are committed. Once we start skipping, we + // cannot stop until we hit a key frame. + } + else { +#ifdef VTRANSPERF + MSR_INTEGER(0, 777770); // not near enough to next key +#endif + } + } + else { +#ifdef VTRANSPERF + MSR_INTEGER(0, 777771); // Next key not predictable +#endif + } + } + else { +#ifdef VTRANSPERF + MSR_INTEGER(0, 777772); // Less than one frame late + MSR_INTEGER(0, m_itrLate); + MSR_INTEGER(0, itrFrame); +#endif + } + } + else { +#ifdef VTRANSPERF + MSR_INTEGER(0, 777773); // Decode time short - not not worth skipping + MSR_INTEGER(0, m_itrAvgDecode); + MSR_INTEGER(0, itrFrame); +#endif + } + + ++m_nFramesSinceKeyFrame; + + if(m_bSkipping) { + // We will count down the lateness as we skip each frame. + // We re-assess each frame. The key frame might not arrive when expected. + // We reset m_itrLate if we get a new Quality message, but actually that's + // not likely because we're not sending frames on to the Renderer. In + // fact if we DID get another one it would mean that there's a long + // pipe between us and the renderer and we might need an altogether + // better strategy to avoid hunting! + m_itrLate = m_itrLate - itrFrame; + } + + MSR_INTEGER(m_idLate, (int)m_itrLate/10000); // Note how late we think we are + if(m_bSkipping) { + if(!m_bQualityChanged) { + m_bQualityChanged = TRUE; + NotifyEvent(EC_QUALITY_CHANGE,0,0); + } + } + return m_bSkipping; +} + + +HRESULT CVideoTransformFilter::AlterQuality(Quality q) { + // to reduce the amount of 64 bit arithmetic, m_itrLate is an int. + // +, -, >, == etc are not too bad, but * and / are painful. + if(m_itrLate>300000000) { + // Avoid overflow and silliness - more than 30 secs late is already silly + m_itrLate = 300000000; + } + else { + m_itrLate = (int)q.Late; + } + // We ignore the other fields + + // We're actually not very good at handling this. In non-direct draw mode + // most of the time can be spent in the renderer which can skip any frame. + // In that case we'd rather the renderer handled things. + // Nevertheless we will keep an eye on it and if we really start getting + // a very long way behind then we will actually skip - but we'll still tell + // the renderer (or whoever is downstream) that they should handle quality. + + return E_FAIL; // Tell the renderer to do his thing. + +} + + + +// This will avoid several hundred useless warnings if compiled -W4 by MS VC++ v4 +#pragma warning(disable:4514) + + diff --git a/src/BaseClasses/vtrans.h b/src/BaseClasses/vtrans.h index e73dc665db..5135266941 100644 --- a/src/BaseClasses/vtrans.h +++ b/src/BaseClasses/vtrans.h @@ -1,143 +1,143 @@ -//------------------------------------------------------------------------------ -// File: VTrans.h -// -// Desc: DirectShow base classes - defines a video transform class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// This class is derived from CTransformFilter, but is specialised to handle -// the requirements of video quality control by frame dropping. -// This is a non-in-place transform, (i.e. it copies the data) such as a decoder. - -class CVideoTransformFilter : public CTransformFilter -{ - public: - - CVideoTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid); - ~CVideoTransformFilter(); - HRESULT EndFlush(); - - // ================================================================= - // ----- override these bits --------------------------------------- - // ================================================================= - // The following methods are in CTransformFilter which is inherited. - // They are mentioned here for completeness - // - // These MUST be supplied in a derived class - // - // NOTE: - // virtual HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut); - // virtual HRESULT CheckInputType(const CMediaType* mtIn) PURE; - // virtual HRESULT CheckTransform - // (const CMediaType* mtIn, const CMediaType* mtOut) PURE; - // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); - // virtual HRESULT DecideBufferSize - // (IMemAllocator * pAllocator, ALLOCATOR_PROPERTIES *pprop) PURE; - // virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE; - // - // These MAY also be overridden - // - // virtual HRESULT StopStreaming(); - // virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); - // virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin); - // virtual HRESULT BreakConnect(PIN_DIRECTION dir); - // virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin); - // virtual HRESULT EndOfStream(void); - // virtual HRESULT BeginFlush(void); - // virtual HRESULT EndFlush(void); - // virtual HRESULT NewSegment - // (REFERENCE_TIME tStart,REFERENCE_TIME tStop,double dRate); -#ifdef PERF - - // If you override this - ensure that you register all these ids - // as well as any of your own, - virtual void RegisterPerfId() { - m_idSkip = MSR_REGISTER(TEXT("Video Transform Skip frame")); - m_idFrameType = MSR_REGISTER(TEXT("Video transform frame type")); - m_idLate = MSR_REGISTER(TEXT("Video Transform Lateness")); - m_idTimeTillKey = MSR_REGISTER(TEXT("Video Transform Estd. time to next key")); - CTransformFilter::RegisterPerfId(); - } -#endif - - protected: - - // =========== QUALITY MANAGEMENT IMPLEMENTATION ======================== - // Frames are assumed to come in three types: - // Type 1: an AVI key frame or an MPEG I frame. - // This frame can be decoded with no history. - // Dropping this frame means that no further frame can be decoded - // until the next type 1 frame. - // Type 1 frames are sync points. - // Type 2: an AVI non-key frame or an MPEG P frame. - // This frame cannot be decoded unless the previous type 1 frame was - // decoded and all type 2 frames since have been decoded. - // Dropping this frame means that no further frame can be decoded - // until the next type 1 frame. - // Type 3: An MPEG B frame. - // This frame cannot be decoded unless the previous type 1 or 2 frame - // has been decoded AND the subsequent type 1 or 2 frame has also - // been decoded. (This requires decoding the frames out of sequence). - // Dropping this frame affects no other frames. This implementation - // does not allow for these. All non-sync-point frames are treated - // as being type 2. - // - // The spacing of frames of type 1 in a file is not guaranteed. There MUST - // be a type 1 frame at (well, near) the start of the file in order to start - // decoding at all. After that there could be one every half second or so, - // there could be one at the start of each scene (aka "cut", "shot") or - // there could be no more at all. - // If there is only a single type 1 frame then NO FRAMES CAN BE DROPPED - // without losing all the rest of the movie. There is no way to tell whether - // this is the case, so we find that we are in the gambling business. - // To try to improve the odds, we record the greatest interval between type 1s - // that we have seen and we bet on things being no worse than this in the - // future. - - // You can tell if it's a type 1 frame by calling IsSyncPoint(). - // there is no architected way to test for a type 3, so you should override - // the quality management here if you have B-frames. - - int m_nKeyFramePeriod; // the largest observed interval between type 1 frames - // 1 means every frame is type 1, 2 means every other. - - int m_nFramesSinceKeyFrame; // Used to count frames since the last type 1. - // becomes the new m_nKeyFramePeriod if greater. - - BOOL m_bSkipping; // we are skipping to the next type 1 frame - -#ifdef PERF - int m_idFrameType; // MSR id Frame type. 1=Key, 2="non-key" - int m_idSkip; // MSR id skipping - int m_idLate; // MSR id lateness - int m_idTimeTillKey; // MSR id for guessed time till next key frame. -#endif - - virtual HRESULT StartStreaming(); - - HRESULT AbortPlayback(HRESULT hr); // if something bad happens - - HRESULT Receive(IMediaSample *pSample); - - HRESULT AlterQuality(Quality q); - - BOOL ShouldSkipFrame(IMediaSample * pIn); - - int m_itrLate; // lateness from last Quality message - // (this overflows at 214 secs late). - int m_tDecodeStart; // timeGetTime when decode started. - int m_itrAvgDecode; // Average decode time in reference units. - - BOOL m_bNoSkip; // debug - no skipping. - - // We send an EC_QUALITY_CHANGE notification to the app if we have to degrade. - // We send one when we start degrading, not one for every frame, this means - // we track whether we've sent one yet. - BOOL m_bQualityChanged; - - // When non-zero, don't pass anything to renderer until next keyframe - // If there are few keys, give up and eventually draw something - int m_nWaitForKey; -}; +//------------------------------------------------------------------------------ +// File: VTrans.h +// +// Desc: DirectShow base classes - defines a video transform class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// This class is derived from CTransformFilter, but is specialised to handle +// the requirements of video quality control by frame dropping. +// This is a non-in-place transform, (i.e. it copies the data) such as a decoder. + +class CVideoTransformFilter : public CTransformFilter +{ + public: + + CVideoTransformFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid); + ~CVideoTransformFilter(); + HRESULT EndFlush(); + + // ================================================================= + // ----- override these bits --------------------------------------- + // ================================================================= + // The following methods are in CTransformFilter which is inherited. + // They are mentioned here for completeness + // + // These MUST be supplied in a derived class + // + // NOTE: + // virtual HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut); + // virtual HRESULT CheckInputType(const CMediaType* mtIn) PURE; + // virtual HRESULT CheckTransform + // (const CMediaType* mtIn, const CMediaType* mtOut) PURE; + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + // virtual HRESULT DecideBufferSize + // (IMemAllocator * pAllocator, ALLOCATOR_PROPERTIES *pprop) PURE; + // virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE; + // + // These MAY also be overridden + // + // virtual HRESULT StopStreaming(); + // virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); + // virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin); + // virtual HRESULT BreakConnect(PIN_DIRECTION dir); + // virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin); + // virtual HRESULT EndOfStream(void); + // virtual HRESULT BeginFlush(void); + // virtual HRESULT EndFlush(void); + // virtual HRESULT NewSegment + // (REFERENCE_TIME tStart,REFERENCE_TIME tStop,double dRate); +#ifdef PERF + + // If you override this - ensure that you register all these ids + // as well as any of your own, + virtual void RegisterPerfId() { + m_idSkip = MSR_REGISTER(TEXT("Video Transform Skip frame")); + m_idFrameType = MSR_REGISTER(TEXT("Video transform frame type")); + m_idLate = MSR_REGISTER(TEXT("Video Transform Lateness")); + m_idTimeTillKey = MSR_REGISTER(TEXT("Video Transform Estd. time to next key")); + CTransformFilter::RegisterPerfId(); + } +#endif + + protected: + + // =========== QUALITY MANAGEMENT IMPLEMENTATION ======================== + // Frames are assumed to come in three types: + // Type 1: an AVI key frame or an MPEG I frame. + // This frame can be decoded with no history. + // Dropping this frame means that no further frame can be decoded + // until the next type 1 frame. + // Type 1 frames are sync points. + // Type 2: an AVI non-key frame or an MPEG P frame. + // This frame cannot be decoded unless the previous type 1 frame was + // decoded and all type 2 frames since have been decoded. + // Dropping this frame means that no further frame can be decoded + // until the next type 1 frame. + // Type 3: An MPEG B frame. + // This frame cannot be decoded unless the previous type 1 or 2 frame + // has been decoded AND the subsequent type 1 or 2 frame has also + // been decoded. (This requires decoding the frames out of sequence). + // Dropping this frame affects no other frames. This implementation + // does not allow for these. All non-sync-point frames are treated + // as being type 2. + // + // The spacing of frames of type 1 in a file is not guaranteed. There MUST + // be a type 1 frame at (well, near) the start of the file in order to start + // decoding at all. After that there could be one every half second or so, + // there could be one at the start of each scene (aka "cut", "shot") or + // there could be no more at all. + // If there is only a single type 1 frame then NO FRAMES CAN BE DROPPED + // without losing all the rest of the movie. There is no way to tell whether + // this is the case, so we find that we are in the gambling business. + // To try to improve the odds, we record the greatest interval between type 1s + // that we have seen and we bet on things being no worse than this in the + // future. + + // You can tell if it's a type 1 frame by calling IsSyncPoint(). + // there is no architected way to test for a type 3, so you should override + // the quality management here if you have B-frames. + + int m_nKeyFramePeriod; // the largest observed interval between type 1 frames + // 1 means every frame is type 1, 2 means every other. + + int m_nFramesSinceKeyFrame; // Used to count frames since the last type 1. + // becomes the new m_nKeyFramePeriod if greater. + + BOOL m_bSkipping; // we are skipping to the next type 1 frame + +#ifdef PERF + int m_idFrameType; // MSR id Frame type. 1=Key, 2="non-key" + int m_idSkip; // MSR id skipping + int m_idLate; // MSR id lateness + int m_idTimeTillKey; // MSR id for guessed time till next key frame. +#endif + + virtual HRESULT StartStreaming(); + + HRESULT AbortPlayback(HRESULT hr); // if something bad happens + + HRESULT Receive(IMediaSample *pSample); + + HRESULT AlterQuality(Quality q); + + BOOL ShouldSkipFrame(IMediaSample * pIn); + + int m_itrLate; // lateness from last Quality message + // (this overflows at 214 secs late). + int m_tDecodeStart; // timeGetTime when decode started. + int m_itrAvgDecode; // Average decode time in reference units. + + BOOL m_bNoSkip; // debug - no skipping. + + // We send an EC_QUALITY_CHANGE notification to the app if we have to degrade. + // We send one when we start degrading, not one for every frame, this means + // we track whether we've sent one yet. + BOOL m_bQualityChanged; + + // When non-zero, don't pass anything to renderer until next keyframe + // If there are few keys, give up and eventually draw something + int m_nWaitForKey; +}; diff --git a/src/BaseClasses/winctrl.cpp b/src/BaseClasses/winctrl.cpp index 4eb8f1dd85..9998e26a05 100644 --- a/src/BaseClasses/winctrl.cpp +++ b/src/BaseClasses/winctrl.cpp @@ -1,1977 +1,1977 @@ -//------------------------------------------------------------------------------ -// File: WinCtrl.cpp -// -// Desc: DirectShow base classes - implements video control interface class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include - -// The control interface methods require us to be connected - -#define CheckConnected(pin,code) \ -{ \ - if(pin == NULL) { \ - ASSERT(!TEXT("Pin not set")); \ - } \ - else if(pin->IsConnected() == FALSE) { \ - return (code); \ - } \ -} - -// This checks to see whether the window has a drain. An application can in -// most environments set the owner/parent of windows so that they appear in -// a compound document context (for example). In this case, the application -// would probably like to be told of any keyboard/mouse messages. Therefore -// we pass these messages on untranslated, returning TRUE if we're successful - -BOOL WINAPI PossiblyEatMessage(HWND hwndDrain, UINT uMsg, WPARAM wParam, LPARAM lParam) { - if(hwndDrain != NULL && !InSendMessage()) { - switch(uMsg) { - case WM_CHAR: - case WM_DEADCHAR: - case WM_KEYDOWN: - case WM_KEYUP: - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MOUSEACTIVATE: - case WM_MOUSEMOVE: - // If we pass this on we don't get any mouse clicks - //case WM_NCHITTEST: - case WM_NCLBUTTONDBLCLK: - case WM_NCLBUTTONDOWN: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONDBLCLK: - case WM_NCMBUTTONDOWN: - case WM_NCMBUTTONUP: - case WM_NCMOUSEMOVE: - case WM_NCRBUTTONDBLCLK: - case WM_NCRBUTTONDOWN: - case WM_NCRBUTTONUP: - case WM_RBUTTONDBLCLK: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_SYSCHAR: - case WM_SYSDEADCHAR: - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - - DbgLog((LOG_TRACE, 2, TEXT("Forwarding %x to drain"))); - PostMessage(hwndDrain, uMsg, wParam, lParam); - - return TRUE; - } - } - return FALSE; -} - - -// This class implements the IVideoWindow control functions (dual interface) -// we support a large number of properties and methods designed to allow the -// client (whether it be an automation controller or a C/C++ application) to -// set and get a number of window related properties such as it's position. -// We also support some methods that duplicate the properties but provide a -// more direct and efficient mechanism as many values may be changed in one - -CBaseControlWindow::CBaseControlWindow( - CBaseFilter *pFilter, // Owning filter - CCritSec *pInterfaceLock, // Locking object - TCHAR *pName, // Object description - LPUNKNOWN pUnk, // Normal COM ownership - HRESULT *phr) : // OLE return code - - CBaseVideoWindow(pName,pUnk), - m_pInterfaceLock(pInterfaceLock), - m_hwndOwner(NULL), - m_hwndDrain(NULL), - m_bAutoShow(TRUE), - m_pFilter(pFilter), - m_bCursorHidden(FALSE), - m_pPin(NULL) { - ASSERT(m_pFilter); - ASSERT(m_pInterfaceLock); - ASSERT(phr); - m_BorderColour = VIDEO_COLOUR; -} - - -// Set the title caption on the base window, we don't do any field checking -// as we really don't care what title they intend to have. We can always get -// it back again later with GetWindowText. The only other complication is to -// do the necessary string conversions between ANSI and OLE Unicode strings - -STDMETHODIMP CBaseControlWindow::put_Caption(BSTR strCaption) { - CheckPointer(strCaption,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); -#ifdef UNICODE - SetWindowText(m_hwnd, strCaption); -#else - CHAR Caption[CAPTION]; - - WideCharToMultiByte(CP_ACP,0,strCaption,-1,Caption,CAPTION,NULL,NULL); - SetWindowText(m_hwnd, Caption); -#endif - return NOERROR; -} - - -// Get the current base window title caption, once again we do no real field -// checking. We allocate a string for the window title to be filled in with -// which ensures the interface doesn't fiddle around with getting memory. A -// BSTR is a normal C string with the length at position (-1), we use the -// WriteBSTR helper function to create the caption to try and avoid OLE32 - -/* NABIL: I un-commented this entire function...*/ - -STDMETHODIMP CBaseControlWindow::get_Caption(BSTR *pstrCaption) { - CheckPointer(pstrCaption,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - WCHAR WideCaption[CAPTION]; - -#ifdef UNICODE - GetWindowText(m_hwnd,WideCaption,CAPTION); -#else - // Convert the ASCII caption to a UNICODE string - - TCHAR Caption[CAPTION]; - GetWindowText(m_hwnd,Caption,CAPTION); - MultiByteToWideChar(CP_ACP,0,Caption,-1,WideCaption,CAPTION); -#endif - return WriteBSTR(pstrCaption,WideCaption); -} - -/*NABIL: END Un-comment*/ - -// Set the window style using GWL_EXSTYLE - -STDMETHODIMP CBaseControlWindow::put_WindowStyleEx(long WindowStyleEx) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Should we be taking off WS_EX_TOPMOST - - if(GetWindowLong(m_hwnd,GWL_EXSTYLE) & WS_EX_TOPMOST) { - if((WindowStyleEx & WS_EX_TOPMOST) == 0) { - SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) FALSE,(LPARAM) 0); - } - } - - // Likewise should we be adding WS_EX_TOPMOST - - if(WindowStyleEx & WS_EX_TOPMOST) { - SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) TRUE,(LPARAM) 0); - WindowStyleEx &= (~WS_EX_TOPMOST); - if(WindowStyleEx == 0) return NOERROR; - } - return DoSetWindowStyle(WindowStyleEx,GWL_EXSTYLE); -} - - -// Gets the current GWL_EXSTYLE base window style - -STDMETHODIMP CBaseControlWindow::get_WindowStyleEx(long *pWindowStyleEx) { - CheckPointer(pWindowStyleEx,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - return DoGetWindowStyle(pWindowStyleEx,GWL_EXSTYLE); -} - - -// Set the window style using GWL_STYLE - -STDMETHODIMP CBaseControlWindow::put_WindowStyle(long WindowStyle) { - // These styles cannot be changed dynamically - - if((WindowStyle & WS_DISABLED) || - (WindowStyle & WS_ICONIC) || - (WindowStyle & WS_MAXIMIZE) || - (WindowStyle & WS_MINIMIZE) || - (WindowStyle & WS_HSCROLL) || - (WindowStyle & WS_VSCROLL)) { - - return E_INVALIDARG; - } - - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - return DoSetWindowStyle(WindowStyle,GWL_STYLE); -} - - -// Get the current GWL_STYLE base window style - -STDMETHODIMP CBaseControlWindow::get_WindowStyle(long *pWindowStyle) { - CheckPointer(pWindowStyle,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - return DoGetWindowStyle(pWindowStyle,GWL_STYLE); -} - - -// Change the base window style or the extended styles depending on whether -// WindowLong is GWL_STYLE or GWL_EXSTYLE. We must call SetWindowPos to have -// the window displayed in it's new style after the change which is a little -// tricky if the window is not currently visible as we realise it offscreen. -// In most cases the client will call get_WindowStyle before they call this -// and then AND and OR in extra bit settings according to the requirements - -HRESULT CBaseControlWindow::DoSetWindowStyle(long Style,long WindowLong) { - RECT WindowRect; - - // Get the window's visibility before setting the style - BOOL bVisible = IsWindowVisible(m_hwnd); - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - // Set the new style flags for the window - SetWindowLong(m_hwnd,WindowLong,Style); - UINT WindowFlags = SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE; - WindowFlags |= SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; - - // Show the window again in the current position - - if(bVisible == TRUE) { - - SetWindowPos(m_hwnd, // Base window handle - HWND_TOP, // Just a place holder - 0,0,0,0, // Leave size and position - WindowFlags); // Just draw it again - - return NOERROR; - } - - // Move the window offscreen so the user doesn't see the changes - - MoveWindow((HWND) m_hwnd, // Base window handle - GetSystemMetrics(SM_CXSCREEN), // Current desktop width - GetSystemMetrics(SM_CYSCREEN), // Likewise it's height - WIDTH(&WindowRect), // Use the same width - HEIGHT(&WindowRect), // Keep height same to - TRUE); // May as well repaint - - // Now show the previously hidden window - - SetWindowPos(m_hwnd, // Base window handle - HWND_TOP, // Just a place holder - 0,0,0,0, // Leave size and position - WindowFlags); // Just draw it again - - ShowWindow(m_hwnd,SW_HIDE); - - if(GetParent(m_hwnd)) { - - MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); - } - - MoveWindow((HWND) m_hwnd, // Base window handle - WindowRect.left, // Existing x coordinate - WindowRect.top, // Existing y coordinate - WIDTH(&WindowRect), // Use the same width - HEIGHT(&WindowRect), // Keep height same to - TRUE); // May as well repaint - - return NOERROR; -} - - -// Get the current base window style (either GWL_STYLE or GWL_EXSTYLE) - -HRESULT CBaseControlWindow::DoGetWindowStyle(long *pStyle,long WindowLong) { - *pStyle = GetWindowLong(m_hwnd,WindowLong); - return NOERROR; -} - - -// Change the visibility of the base window, this takes the same parameters -// as the ShowWindow Win32 API does, so the client can have the window hidden -// or shown, minimised to an icon, or maximised to play in full screen mode -// We pass the request on to the base window to actually make the change - -STDMETHODIMP CBaseControlWindow::put_WindowState(long WindowState) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - DoShowWindow(WindowState); - return NOERROR; -} - - -// Get the current window state, this function returns a subset of the SW bit -// settings available in ShowWindow, if the window is visible then SW_SHOW is -// set, if it is hidden then the SW_HIDDEN is set, if it is either minimised -// or maximised then the SW_MINIMIZE or SW_MAXIMIZE is set respectively. The -// other SW bit settings are really set commands not readable output values - -STDMETHODIMP CBaseControlWindow::get_WindowState(long *pWindowState) { - CheckPointer(pWindowState,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - ASSERT(pWindowState); - *pWindowState = FALSE; - - // Is the window visible, a window is termed visible if it is somewhere on - // the current desktop even if it is completely obscured by other windows - // so the flag is a style for each window set with the WS_VISIBLE bit - - if(IsWindowVisible(m_hwnd) == TRUE) { - - // Is the base window iconic - if(IsIconic(m_hwnd) == TRUE) { - *pWindowState |= SW_MINIMIZE; - } - - // Has the window been maximised - else if(IsZoomed(m_hwnd) == TRUE) { - *pWindowState |= SW_MAXIMIZE; - } - - // Window is normal - else { - *pWindowState |= SW_SHOW; - } - - } - else { - *pWindowState |= SW_HIDE; - } - return NOERROR; -} - - -// This makes sure that any palette we realise in the base window (through a -// media type or through the overlay interface) is done in the background and -// is therefore mapped to existing device entries rather than taking it over -// as it will do when we this window gets the keyboard focus. An application -// uses this to make sure it doesn't have it's palette removed by the window - -STDMETHODIMP CBaseControlWindow::put_BackgroundPalette(long BackgroundPalette) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cWindowLock(&m_WindowLock); - - // Check this is a valid automation boolean type - - if(BackgroundPalette != OATRUE) { - if(BackgroundPalette != OAFALSE) { - return E_INVALIDARG; - } - } - - // Make sure the window realises any palette it has again - - m_bBackground = (BYTE) (BackgroundPalette == OATRUE ? TRUE : FALSE); - PostMessage(m_hwnd,m_RealizePalette,0,0); - PaintWindow(FALSE); - - return NOERROR; -} - - -// This returns the current background realisation setting - -STDMETHODIMP -CBaseControlWindow::get_BackgroundPalette(long *pBackgroundPalette) { - CheckPointer(pBackgroundPalette,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cWindowLock(&m_WindowLock); - - // Get the current background palette setting - - *pBackgroundPalette = (m_bBackground == TRUE ? OATRUE : OAFALSE); - return NOERROR; -} - - -// Change the visibility of the base window - -STDMETHODIMP CBaseControlWindow::put_Visible(long Visible) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Check this is a valid automation boolean type - - if(Visible != OATRUE) { - if(Visible != OAFALSE) { - return E_INVALIDARG; - } - } - - // Convert the boolean visibility into SW_SHOW and SW_HIDE - - INT Mode = (Visible == OATRUE ? SW_SHOWNORMAL : SW_HIDE); - DoShowWindow(Mode); - return NOERROR; -} - - -// Return OATRUE if the window is currently visible otherwise OAFALSE - -STDMETHODIMP CBaseControlWindow::get_Visible(long *pVisible) { - CheckPointer(pVisible,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // See if the base window has a WS_VISIBLE style - this will return TRUE - // even if the window is completely obscured by other desktop windows, we - // return FALSE if the window is not showing because of earlier calls - - BOOL Mode = IsWindowVisible(m_hwnd); - *pVisible = (Mode == TRUE ? OATRUE : OAFALSE); - return NOERROR; -} - - -// Change the left position of the base window. This keeps the window width -// and height properties the same so it effectively shunts the window left or -// right accordingly - there is the Width property to change that dimension - -STDMETHODIMP CBaseControlWindow::put_Left(long Left) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bSuccess; - RECT WindowRect; - - // Get the current window position in a RECT - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - if(GetParent(m_hwnd)) { - - MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); - } - - // Adjust the coordinates ready for SetWindowPos, the window rectangle we - // get back from GetWindowRect is in left,top,right and bottom while the - // coordinates SetWindowPos wants are left,top,width and height values - - WindowRect.bottom = WindowRect.bottom - WindowRect.top; - WindowRect.right = WindowRect.right - WindowRect.left; - UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; - - bSuccess = SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - Left, // New left position - WindowRect.top, // Leave top alone - WindowRect.right, // The WIDTH (not right) - WindowRect.bottom, // The HEIGHT (not bottom) - WindowFlags); // Show window options - - if(bSuccess == FALSE) { - return E_INVALIDARG; - } - return NOERROR; -} - - -// Return the current base window left position - -STDMETHODIMP CBaseControlWindow::get_Left(long *pLeft) { - CheckPointer(pLeft,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT WindowRect; - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - *pLeft = WindowRect.left; - return NOERROR; -} - - -// Change the current width of the base window. This property complements the -// left position property so we must keep the left edge constant and expand or -// contract to the right, the alternative would be to change the left edge so -// keeping the right edge constant but this is maybe a little more intuitive - -STDMETHODIMP CBaseControlWindow::put_Width(long Width) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bSuccess; - RECT WindowRect; - - // Adjust the coordinates ready for SetWindowPos, the window rectangle we - // get back from GetWindowRect is in left,top,right and bottom while the - // coordinates SetWindowPos wants are left,top,width and height values - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - if(GetParent(m_hwnd)) { - - MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); - } - - WindowRect.bottom = WindowRect.bottom - WindowRect.top; - UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; - - // This seems to have a bug in that calling SetWindowPos on a window with - // just the width changing causes it to ignore the width that you pass in - // and sets it to a mimimum value of 110 pixels wide (Windows NT 3.51) - - bSuccess = SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - WindowRect.left, // Leave left alone - WindowRect.top, // Leave top alone - Width, // New WIDTH dimension - WindowRect.bottom, // The HEIGHT (not bottom) - WindowFlags); // Show window options - - if(bSuccess == FALSE) { - return E_INVALIDARG; - } - return NOERROR; -} - - -// Return the current base window width - -STDMETHODIMP CBaseControlWindow::get_Width(long *pWidth) { - CheckPointer(pWidth,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT WindowRect; - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - *pWidth = WindowRect.right - WindowRect.left; - return NOERROR; -} - - -// This allows the client program to change the top position for the window in -// the same way that changing the left position does not affect the width of -// the image so changing the top position does not affect the window height - -STDMETHODIMP CBaseControlWindow::put_Top(long Top) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bSuccess; - RECT WindowRect; - - // Get the current window position in a RECT - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - if(GetParent(m_hwnd)) { - - MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); - } - - // Adjust the coordinates ready for SetWindowPos, the window rectangle we - // get back from GetWindowRect is in left,top,right and bottom while the - // coordinates SetWindowPos wants are left,top,width and height values - - WindowRect.bottom = WindowRect.bottom - WindowRect.top; - WindowRect.right = WindowRect.right - WindowRect.left; - UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; - - bSuccess = SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - WindowRect.left, // Leave left alone - Top, // New top position - WindowRect.right, // The WIDTH (not right) - WindowRect.bottom, // The HEIGHT (not bottom) - WindowFlags); // Show window flags - - if(bSuccess == FALSE) { - return E_INVALIDARG; - } - return NOERROR; -} - - -// Return the current base window top position - -STDMETHODIMP CBaseControlWindow::get_Top(long *pTop) { - CheckPointer(pTop,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT WindowRect; - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - *pTop = WindowRect.top; - return NOERROR; -} - - -// Change the height of the window, this complements the top property so when -// we change this we must keep the top position for the base window, as said -// before we could keep the bottom and grow upwards although this is perhaps -// a little more intuitive since we already have a top position property - -STDMETHODIMP CBaseControlWindow::put_Height(long Height) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bSuccess; - RECT WindowRect; - - // Adjust the coordinates ready for SetWindowPos, the window rectangle we - // get back from GetWindowRect is in left,top,right and bottom while the - // coordinates SetWindowPos wants are left,top,width and height values - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - if(GetParent(m_hwnd)) { - - MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); - } - - WindowRect.right = WindowRect.right - WindowRect.left; - UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; - - bSuccess = SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - WindowRect.left, // Leave left alone - WindowRect.top, // Leave top alone - WindowRect.right, // The WIDTH (not right) - Height, // New height dimension - WindowFlags); // Show window flags - - if(bSuccess == FALSE) { - return E_INVALIDARG; - } - return NOERROR; -} - - -// Return the current base window height - -STDMETHODIMP CBaseControlWindow::get_Height(long *pHeight) { - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT WindowRect; - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - *pHeight = WindowRect.bottom - WindowRect.top; - return NOERROR; -} - - -// This can be called to change the owning window. Setting the owner is done -// through this function, however to make the window a true child window the -// style must also be set to WS_CHILD. After resetting the owner to NULL an -// application should also set the style to WS_OVERLAPPED | WS_CLIPCHILDREN. - -// We cannot lock the object here because the SetParent causes an interthread -// SendMessage to the owner window. If they are in GetState we will sit here -// incomplete with the critical section locked therefore blocking out source -// filter threads from accessing us. Because the source thread can't enter us -// it can't get buffers or call EndOfStream so the GetState will not complete - -STDMETHODIMP CBaseControlWindow::put_Owner(OAHWND Owner) { - // Check we are connected otherwise reject the call - - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - m_hwndOwner = (HWND) Owner; - HWND hwndParent = m_hwndOwner; - - // Add or remove WS_CHILD as appropriate - - LONG Style = GetWindowLong(m_hwnd,GWL_STYLE); - if(Owner == NULL) { - Style &= (~WS_CHILD); - } - else { - Style |= (WS_CHILD); - } - SetWindowLong(m_hwnd,GWL_STYLE,Style); - - // Don't call this with the filter locked - - SetParent(m_hwnd,hwndParent); - - PaintWindow(TRUE); - NOTE1("Changed parent %lx",hwndParent); - - return NOERROR; -} - - -// This complements the put_Owner to get the current owning window property -// we always return NOERROR although the returned window handle may be NULL -// to indicate no owning window (the desktop window doesn't qualify as one) -// If an application sets the owner we call SetParent, however that returns -// NULL until the WS_CHILD bit is set on, so we store the owner internally - -STDMETHODIMP CBaseControlWindow::get_Owner(OAHWND *Owner) { - CheckPointer(Owner,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - *Owner = (OAHWND) m_hwndOwner; - return NOERROR; -} - - -// And renderer supporting IVideoWindow may have an HWND set who will get any -// keyboard and mouse messages we receive posted on to them. This is separate -// from setting an owning window. By separating the two, applications may get -// messages sent on even when they have set no owner (perhaps it's maximised) - -STDMETHODIMP CBaseControlWindow::put_MessageDrain(OAHWND Drain) { - // Check we are connected otherwise reject the call - - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - m_hwndDrain = (HWND) Drain; - return NOERROR; -} - - -// Return the current message drain - -STDMETHODIMP CBaseControlWindow::get_MessageDrain(OAHWND *Drain) { - CheckPointer(Drain,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - *Drain = (OAHWND) m_hwndDrain; - return NOERROR; -} - - -// This is called by the filter graph to inform us of a message we should know -// is being sent to our owning window. We have this because as a child window -// we do not get certain messages that are only sent to top level windows. We -// must see the palette changed/changing/query messages so that we know if we -// have the foreground palette or not. We pass the message on to our window -// using SendMessage - this will cause an interthread send message to occur - -STDMETHODIMP -CBaseControlWindow::NotifyOwnerMessage(OAHWND hwnd, // Window handle - long uMsg, // Message ID - LONG_PTR wParam, // Parameters - LONG_PTR lParam) // for message -{ - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Only interested in these Windows messages - - switch(uMsg) { - - case WM_SYSCOLORCHANGE: - case WM_PALETTECHANGED: - case WM_PALETTEISCHANGING: - case WM_QUERYNEWPALETTE: - case WM_DEVMODECHANGE: - case WM_DISPLAYCHANGE: - case WM_ACTIVATEAPP: - - // If we do not have an owner then ignore - - if(m_hwndOwner == NULL) { - return NOERROR; - } - SendMessage(m_hwnd,uMsg,(WPARAM)wParam,(LPARAM)lParam); - break; - - // do NOT fwd WM_MOVE. the parameters are the location of the parent - // window, NOT what the renderer should be looking at. But we need - // to make sure the overlay is moved with the parent window, so we - // do this. - case WM_MOVE: - PostMessage(m_hwnd,WM_PAINT,0,0); - break; - } - return NOERROR; -} - - -// Allow an application to have us set the base window in the foreground. We -// have this because it is difficult for one thread to do do this to a window -// owned by another thread. We ask the base window class to do the real work - -STDMETHODIMP CBaseControlWindow::SetWindowForeground(long Focus) { - // Check this is a valid automation boolean type - - if(Focus != OATRUE) { - if(Focus != OAFALSE) { - return E_INVALIDARG; - } - } - - // We shouldn't lock as this sends a message - - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bFocus = (Focus == OATRUE ? TRUE : FALSE); - DoSetWindowForeground(bFocus); - - return NOERROR; -} - - -// This allows a client to set the complete window size and position in one -// atomic operation. The same affect can be had by changing each dimension -// in turn through their individual properties although some flashing will -// occur as each of them gets updated (they are better set at design time) - -STDMETHODIMP -CBaseControlWindow::SetWindowPosition(long Left,long Top,long Width,long Height) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - BOOL bSuccess; - - // Set the new size and position - UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; - - ASSERT(IsWindow(m_hwnd)); - bSuccess = SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - Left, // Left position - Top, // Top position - Width, // Window width - Height, // Window height - WindowFlags); // Show window flags - ASSERT(bSuccess); -#ifdef DEBUG - DbgLog((LOG_TRACE, 1, TEXT("SWP failed error %d"), GetLastError())); -#endif - if(bSuccess == FALSE) { - return E_INVALIDARG; - } - return NOERROR; -} - - -// This complements the SetWindowPosition to return the current window place -// in device coordinates. As before the same information can be retrived by -// calling the property get functions individually but this is atomic and is -// therefore more suitable to a live environment rather than design time - -STDMETHODIMP -CBaseControlWindow::GetWindowPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { - // Should check the pointers are not NULL - - CheckPointer(pLeft,E_POINTER); - CheckPointer(pTop,E_POINTER); - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT WindowRect; - - // Get the current window coordinates - - EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); - - // Convert the RECT into left,top,width and height values - - *pLeft = WindowRect.left; - *pTop = WindowRect.top; - *pWidth = WindowRect.right - WindowRect.left; - *pHeight = WindowRect.bottom - WindowRect.top; - - return NOERROR; -} - - -// When a window is maximised or iconic calling GetWindowPosition will return -// the current window position (likewise for the properties). However if the -// restored size (ie the size we'll return to when normally shown) is needed -// then this should be used. When in a normal position (neither iconic nor -// maximised) then this returns the same coordinates as GetWindowPosition - -STDMETHODIMP -CBaseControlWindow::GetRestorePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { - // Should check the pointers are not NULL - - CheckPointer(pLeft,E_POINTER); - CheckPointer(pTop,E_POINTER); - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Use GetWindowPlacement to find the restore position - - WINDOWPLACEMENT Place; - Place.length = sizeof(WINDOWPLACEMENT); - EXECUTE_ASSERT(GetWindowPlacement(m_hwnd,&Place)); - - RECT WorkArea; - - // We must take into account any task bar present - - if(SystemParametersInfo(SPI_GETWORKAREA,0,&WorkArea,FALSE) == TRUE) { - if(GetParent(m_hwnd) == NULL) { - Place.rcNormalPosition.top += WorkArea.top; - Place.rcNormalPosition.bottom += WorkArea.top; - Place.rcNormalPosition.left += WorkArea.left; - Place.rcNormalPosition.right += WorkArea.left; - } - } - - // Convert the RECT into left,top,width and height values - - *pLeft = Place.rcNormalPosition.left; - *pTop = Place.rcNormalPosition.top; - *pWidth = Place.rcNormalPosition.right - Place.rcNormalPosition.left; - *pHeight = Place.rcNormalPosition.bottom - Place.rcNormalPosition.top; - - return NOERROR; -} - - -// Return the current border colour, if we are playing something to a subset -// of the base window display there is an outside area exposed. The default -// action is to paint this colour in the Windows background colour (defined -// as value COLOR_WINDOW) We reset to this default when we're disconnected - -STDMETHODIMP CBaseControlWindow::get_BorderColor(long *Color) { - CheckPointer(Color,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - *Color = (long) m_BorderColour; - return NOERROR; -} - - -// This can be called to set the current border colour - -STDMETHODIMP CBaseControlWindow::put_BorderColor(long Color) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Have the window repainted with the new border colour - - m_BorderColour = (COLORREF) Color; - PaintWindow(TRUE); - return NOERROR; -} - - -// Delegate fullscreen handling to plug in distributor - -STDMETHODIMP CBaseControlWindow::get_FullScreenMode(long *FullScreenMode) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CheckPointer(FullScreenMode,E_POINTER); - return E_NOTIMPL; -} - - -// Delegate fullscreen handling to plug in distributor - -STDMETHODIMP CBaseControlWindow::put_FullScreenMode(long FullScreenMode) { - return E_NOTIMPL; -} - - -// This sets the auto show property, this property causes the base window to -// be displayed whenever we change state. This allows an application to have -// to do nothing to have the window appear but still allow them to change the -// default behaviour if for example they want to keep it hidden for longer - -STDMETHODIMP CBaseControlWindow::put_AutoShow(long AutoShow) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Check this is a valid automation boolean type - - if(AutoShow != OATRUE) { - if(AutoShow != OAFALSE) { - return E_INVALIDARG; - } - } - - m_bAutoShow = (AutoShow == OATRUE ? TRUE : FALSE); - return NOERROR; -} - - -// This can be called to get the current auto show flag. The flag is updated -// when we connect and disconnect and through this interface all of which are -// controlled and serialised by means of the main renderer critical section - -STDMETHODIMP CBaseControlWindow::get_AutoShow(long *AutoShow) { - CheckPointer(AutoShow,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - *AutoShow = (m_bAutoShow == TRUE ? OATRUE : OAFALSE); - return NOERROR; -} - - -// Return the minimum ideal image size for the current video. This may differ -// to the actual video dimensions because we may be using DirectDraw hardware -// that has specific stretching requirements. For example the Cirrus Logic -// cards have a minimum stretch factor depending on the overlay surface size - -STDMETHODIMP -CBaseControlWindow::GetMinIdealImageSize(long *pWidth,long *pHeight) { - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - FILTER_STATE State; - - // Must not be stopped for this to work correctly - - m_pFilter->GetState(0,&State); - if(State == State_Stopped) { - return VFW_E_WRONG_STATE; - } - - RECT DefaultRect = GetDefaultRect(); - *pWidth = WIDTH(&DefaultRect); - *pHeight = HEIGHT(&DefaultRect); - return NOERROR; -} - - -// Return the maximum ideal image size for the current video. This may differ -// to the actual video dimensions because we may be using DirectDraw hardware -// that has specific stretching requirements. For example the Cirrus Logic -// cards have a maximum stretch factor depending on the overlay surface size - -STDMETHODIMP -CBaseControlWindow::GetMaxIdealImageSize(long *pWidth,long *pHeight) { - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - FILTER_STATE State; - - // Must not be stopped for this to work correctly - - m_pFilter->GetState(0,&State); - if(State == State_Stopped) { - return VFW_E_WRONG_STATE; - } - - RECT DefaultRect = GetDefaultRect(); - *pWidth = WIDTH(&DefaultRect); - *pHeight = HEIGHT(&DefaultRect); - return NOERROR; -} - - -// Allow an application to hide the cursor on our window - -STDMETHODIMP -CBaseControlWindow::HideCursor(long HideCursor) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - - // Check this is a valid automation boolean type - - if(HideCursor != OATRUE) { - if(HideCursor != OAFALSE) { - return E_INVALIDARG; - } - } - - m_bCursorHidden = (HideCursor == OATRUE ? TRUE : FALSE); - return NOERROR; -} - - -// Returns whether we have the cursor hidden or not - -STDMETHODIMP CBaseControlWindow::IsCursorHidden(long *CursorHidden) { - CheckPointer(CursorHidden,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - *CursorHidden = (m_bCursorHidden == TRUE ? OATRUE : OAFALSE); - return NOERROR; -} - - -// This class implements the IBasicVideo control functions (dual interface) -// we support a large number of properties and methods designed to allow the -// client (whether it be an automation controller or a C/C++ application) to -// set and get a number of video related properties such as the native video -// size. We support some methods that duplicate the properties but provide a -// more direct and efficient mechanism as many values may be changed in one - -CBaseControlVideo::CBaseControlVideo( - CBaseFilter *pFilter, // Owning filter - CCritSec *pInterfaceLock, // Locking object - TCHAR *pName, // Object description - LPUNKNOWN pUnk, // Normal COM ownership - HRESULT *phr) : // OLE return code - - CBaseBasicVideo(pName,pUnk), - m_pFilter(pFilter), - m_pInterfaceLock(pInterfaceLock), - m_pPin(NULL) { - ASSERT(m_pFilter); - ASSERT(m_pInterfaceLock); - ASSERT(phr); -} - -// Return an approximate average time per frame - -STDMETHODIMP CBaseControlVideo::get_AvgTimePerFrame(REFTIME *pAvgTimePerFrame) { - CheckPointer(pAvgTimePerFrame,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - COARefTime AvgTime(pVideoInfo->AvgTimePerFrame); - *pAvgTimePerFrame = (REFTIME) AvgTime; - - return NOERROR; -} - - -// Return an approximate bit rate for the video - -STDMETHODIMP CBaseControlVideo::get_BitRate(long *pBitRate) { - CheckPointer(pBitRate,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - *pBitRate = pVideoInfo->dwBitRate; - return NOERROR; -} - - -// Return an approximate bit error rate - -STDMETHODIMP CBaseControlVideo::get_BitErrorRate(long *pBitErrorRate) { - CheckPointer(pBitErrorRate,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - *pBitErrorRate = pVideoInfo->dwBitErrorRate; - return NOERROR; -} - - -// This returns the current video width - -STDMETHODIMP CBaseControlVideo::get_VideoWidth(long *pVideoWidth) { - CheckPointer(pVideoWidth,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - *pVideoWidth = pVideoInfo->bmiHeader.biWidth; - return NOERROR; -} - - -// This returns the current video height - -STDMETHODIMP CBaseControlVideo::get_VideoHeight(long *pVideoHeight) { - CheckPointer(pVideoHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - *pVideoHeight = pVideoInfo->bmiHeader.biHeight; - return NOERROR; -} - - -// This returns the current palette the video is using as an array allocated -// by the user. To remain consistent we use PALETTEENTRY fields to return the -// colours in rather than RGBQUADs that multimedia decided to use. The memory -// is allocated by the user so we simple copy each in turn. We check that the -// number of entries requested and the start position offset are both valid -// If the number of entries evaluates to zero then we return an S_FALSE code - -STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex, - long Entries, - long *pRetrieved, - long *pPalette) { - CheckPointer(pRetrieved,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - CMediaType MediaType; - - // Get the video format from the derived class - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - BITMAPINFOHEADER *pHeader = HEADER(pVideoInfo); - - // Is the current format palettised - - if(PALETTISED(pVideoInfo) == FALSE) { - *pRetrieved = 0; - return VFW_E_NO_PALETTE_AVAILABLE; - } - - // Do they just want to know how many are available - - if(pPalette == NULL) { - *pRetrieved = pHeader->biClrUsed; - return NOERROR; - } - - // Make sure the start position is a valid offset - - if(StartIndex >= (LONG) pHeader->biClrUsed || StartIndex < 0) { - *pRetrieved = 0; - return E_INVALIDARG; - } - - // Correct the number we can retrieve - - LONG Available = (LONG) pHeader->biClrUsed - StartIndex; - *pRetrieved = max(0,min(Available,Entries)); - if(*pRetrieved == 0) { - return S_FALSE; - } - - // Copy the palette entries to the output buffer - - PALETTEENTRY *pEntries = (PALETTEENTRY *) pPalette; - RGBQUAD *pColours = COLORS(pVideoInfo) + StartIndex; - - for(LONG Count = 0;Count < *pRetrieved;Count++) { - pEntries[Count].peRed = pColours[Count].rgbRed; - pEntries[Count].peGreen = pColours[Count].rgbGreen; - pEntries[Count].peBlue = pColours[Count].rgbBlue; - pEntries[Count].peFlags = 0; - } - return NOERROR; -} - - -// This returns the current video dimensions as a method rather than a number -// of individual property get calls. For the same reasons as said before we -// cannot access the renderer media type directly as the window object thread -// may be updating it since dynamic format changes may change these values - -STDMETHODIMP CBaseControlVideo::GetVideoSize(long *pWidth,long *pHeight) { - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - - // Get the video format from the derived class - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - *pWidth = pVideoInfo->bmiHeader.biWidth; - *pHeight = pVideoInfo->bmiHeader.biHeight; - return NOERROR; -} - - -// Set the source video rectangle as left,top,right and bottom coordinates -// rather than left,top,width and height as per OLE automation interfaces -// Then pass the rectangle on to the window object to set the source - -STDMETHODIMP -CBaseControlVideo::SetSourcePosition(long Left,long Top,long Width,long Height) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - SourceRect.left = Left; - SourceRect.top = Top; - SourceRect.right = Left + Width; - SourceRect.bottom = Top + Height; - - // Check the source rectangle is valid - - HRESULT hr = CheckSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the source rectangle - - hr = SetSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the source rectangle in left,top,width and height rather than the -// left,top,right and bottom values that RECT uses (and which the window -// object returns through GetSourceRect) which requires a little work - -STDMETHODIMP -CBaseControlVideo::GetSourcePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { - // Should check the pointers are non NULL - - CheckPointer(pLeft,E_POINTER); - CheckPointer(pTop,E_POINTER); - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT SourceRect; - - CAutoLock cInterfaceLock(m_pInterfaceLock); - GetSourceRect(&SourceRect); - - *pLeft = SourceRect.left; - *pTop = SourceRect.top; - *pWidth = WIDTH(&SourceRect); - *pHeight = HEIGHT(&SourceRect); - - return NOERROR; -} - - -// Set the video destination as left,top,right and bottom coordinates rather -// than the left,top,width and height uses as per OLE automation interfaces -// Then pass the rectangle on to the window object to set the destination - -STDMETHODIMP -CBaseControlVideo::SetDestinationPosition(long Left,long Top,long Width,long Height) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - - DestinationRect.left = Left; - DestinationRect.top = Top; - DestinationRect.right = Left + Width; - DestinationRect.bottom = Top + Height; - - // Check the target rectangle is valid - - HRESULT hr = CheckTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the new target rectangle - - hr = SetTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the destination rectangle in left,top,width and height rather than -// the left,top,right and bottom values that RECT uses (and which the window -// object returns through GetDestinationRect) which requires a little work - -STDMETHODIMP -CBaseControlVideo::GetDestinationPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { - // Should check the pointers are not NULL - - CheckPointer(pLeft,E_POINTER); - CheckPointer(pTop,E_POINTER); - CheckPointer(pWidth,E_POINTER); - CheckPointer(pHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - RECT DestinationRect; - - CAutoLock cInterfaceLock(m_pInterfaceLock); - GetTargetRect(&DestinationRect); - - *pLeft = DestinationRect.left; - *pTop = DestinationRect.top; - *pWidth = WIDTH(&DestinationRect); - *pHeight = HEIGHT(&DestinationRect); - - return NOERROR; -} - - -// Set the source left position, the source rectangle we get back from the -// window object is a true rectangle in left,top,right and bottom positions -// so all we have to do is to update the left position and pass it back. We -// must keep the current width constant when we're updating this property - -STDMETHODIMP CBaseControlVideo::put_SourceLeft(long SourceLeft) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - GetSourceRect(&SourceRect); - SourceRect.right = SourceLeft + WIDTH(&SourceRect); - SourceRect.left = SourceLeft; - - // Check the source rectangle is valid - - HRESULT hr = CheckSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the source rectangle - - hr = SetSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the current left source video position - -STDMETHODIMP CBaseControlVideo::get_SourceLeft(long *pSourceLeft) { - CheckPointer(pSourceLeft,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - - GetSourceRect(&SourceRect); - *pSourceLeft = SourceRect.left; - return NOERROR; -} - - -// Set the source width, we get the current source rectangle and then update -// the right position to be the left position (thereby keeping it constant) -// plus the new source width we are passed in (it expands to the right) - -STDMETHODIMP CBaseControlVideo::put_SourceWidth(long SourceWidth) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - GetSourceRect(&SourceRect); - SourceRect.right = SourceRect.left + SourceWidth; - - // Check the source rectangle is valid - - HRESULT hr = CheckSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the source rectangle - - hr = SetSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the current source width - -STDMETHODIMP CBaseControlVideo::get_SourceWidth(long *pSourceWidth) { - CheckPointer(pSourceWidth,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - - GetSourceRect(&SourceRect); - *pSourceWidth = WIDTH(&SourceRect); - return NOERROR; -} - - -// Set the source top position - changing this property does not affect the -// current source height. So changing this shunts the source rectangle up and -// down appropriately. Changing the height complements this functionality by -// keeping the top position constant and simply changing the source height - -STDMETHODIMP CBaseControlVideo::put_SourceTop(long SourceTop) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - GetSourceRect(&SourceRect); - SourceRect.bottom = SourceTop + HEIGHT(&SourceRect); - SourceRect.top = SourceTop; - - // Check the source rectangle is valid - - HRESULT hr = CheckSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the source rectangle - - hr = SetSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the current top position - -STDMETHODIMP CBaseControlVideo::get_SourceTop(long *pSourceTop) { - CheckPointer(pSourceTop,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - - GetSourceRect(&SourceRect); - *pSourceTop = SourceRect.top; - return NOERROR; -} - - -// Set the source height - -STDMETHODIMP CBaseControlVideo::put_SourceHeight(long SourceHeight) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - GetSourceRect(&SourceRect); - SourceRect.bottom = SourceRect.top + SourceHeight; - - // Check the source rectangle is valid - - HRESULT hr = CheckSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the source rectangle - - hr = SetSourceRect(&SourceRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the current source height - -STDMETHODIMP CBaseControlVideo::get_SourceHeight(long *pSourceHeight) { - CheckPointer(pSourceHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT SourceRect; - - GetSourceRect(&SourceRect); - *pSourceHeight = HEIGHT(&SourceRect); - return NOERROR; -} - - -// Set the target left position, the target rectangle we get back from the -// window object is a true rectangle in left,top,right and bottom positions -// so all we have to do is to update the left position and pass it back. We -// must keep the current width constant when we're updating this property - -STDMETHODIMP CBaseControlVideo::put_DestinationLeft(long DestinationLeft) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - GetTargetRect(&DestinationRect); - DestinationRect.right = DestinationLeft + WIDTH(&DestinationRect); - DestinationRect.left = DestinationLeft; - - // Check the target rectangle is valid - - HRESULT hr = CheckTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the new target rectangle - - hr = SetTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the left position for the destination rectangle - -STDMETHODIMP CBaseControlVideo::get_DestinationLeft(long *pDestinationLeft) { - CheckPointer(pDestinationLeft,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - - GetTargetRect(&DestinationRect); - *pDestinationLeft = DestinationRect.left; - return NOERROR; -} - - -// Set the destination width - -STDMETHODIMP CBaseControlVideo::put_DestinationWidth(long DestinationWidth) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - GetTargetRect(&DestinationRect); - DestinationRect.right = DestinationRect.left + DestinationWidth; - - // Check the target rectangle is valid - - HRESULT hr = CheckTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the new target rectangle - - hr = SetTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the width for the destination rectangle - -STDMETHODIMP CBaseControlVideo::get_DestinationWidth(long *pDestinationWidth) { - CheckPointer(pDestinationWidth,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - - GetTargetRect(&DestinationRect); - *pDestinationWidth = WIDTH(&DestinationRect); - return NOERROR; -} - - -// Set the target top position - changing this property does not affect the -// current target height. So changing this shunts the target rectangle up and -// down appropriately. Changing the height complements this functionality by -// keeping the top position constant and simply changing the target height - -STDMETHODIMP CBaseControlVideo::put_DestinationTop(long DestinationTop) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - GetTargetRect(&DestinationRect); - DestinationRect.bottom = DestinationTop + HEIGHT(&DestinationRect); - DestinationRect.top = DestinationTop; - - // Check the target rectangle is valid - - HRESULT hr = CheckTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the new target rectangle - - hr = SetTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the top position for the destination rectangle - -STDMETHODIMP CBaseControlVideo::get_DestinationTop(long *pDestinationTop) { - CheckPointer(pDestinationTop,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - - GetTargetRect(&DestinationRect); - *pDestinationTop = DestinationRect.top; - return NOERROR; -} - - -// Set the destination height - -STDMETHODIMP CBaseControlVideo::put_DestinationHeight(long DestinationHeight) { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - GetTargetRect(&DestinationRect); - DestinationRect.bottom = DestinationRect.top + DestinationHeight; - - // Check the target rectangle is valid - - HRESULT hr = CheckTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - - // Now set the new target rectangle - - hr = SetTargetRect(&DestinationRect); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return the height for the destination rectangle - -STDMETHODIMP CBaseControlVideo::get_DestinationHeight(long *pDestinationHeight) { - CheckPointer(pDestinationHeight,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - RECT DestinationRect; - - GetTargetRect(&DestinationRect); - *pDestinationHeight = HEIGHT(&DestinationRect); - return NOERROR; -} - - -// Reset the source rectangle to the full video dimensions - -STDMETHODIMP CBaseControlVideo::SetDefaultSourcePosition() { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - HRESULT hr = SetDefaultSourceRect(); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return S_OK if we're using the default source otherwise S_FALSE - -STDMETHODIMP CBaseControlVideo::IsUsingDefaultSource() { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - return IsDefaultSourceRect(); -} - - -// Reset the video renderer to use the entire playback area - -STDMETHODIMP CBaseControlVideo::SetDefaultDestinationPosition() { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - HRESULT hr = SetDefaultTargetRect(); - if(FAILED(hr)) { - return hr; - } - return OnUpdateRectangles(); -} - - -// Return S_OK if we're using the default target otherwise S_FALSE - -STDMETHODIMP CBaseControlVideo::IsUsingDefaultDestination() { - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - return IsDefaultTargetRect(); -} - - -// Return a copy of the current image in the video renderer - -STDMETHODIMP -CBaseControlVideo::GetCurrentImage(long *pBufferSize,long *pVideoImage) { - CheckPointer(pBufferSize,E_POINTER); - CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); - CAutoLock cInterfaceLock(m_pInterfaceLock); - FILTER_STATE State; - - // Make sure we are in a paused state - - if(pVideoImage != NULL) { - m_pFilter->GetState(0,&State); - if(State != State_Paused) { - return VFW_E_NOT_PAUSED; - } - return GetStaticImage(pBufferSize,pVideoImage); - } - - // Just return the memory required - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - RECT SourceRect; - GetSourceRect(&SourceRect); - return GetImageSize(pVideoInfo,pBufferSize,&SourceRect); -} - - -// An application has two ways of using GetCurrentImage, one is to pass a real -// buffer which should be filled with the current image. The other is to pass -// a NULL buffer pointer which is interpreted as asking us to return how much -// memory is required for the image. The constraints for when the latter can -// be called are much looser. To calculate the memory required we synthesize -// a VIDEOINFO that takes into account the source rectangle that's being used - -HRESULT CBaseControlVideo::GetImageSize(VIDEOINFOHEADER *pVideoInfo, - LONG *pBufferSize, - RECT *pSourceRect) { - NOTE("Entering GetImageSize"); - ASSERT(pSourceRect); - - // Check we have the correct input parameters - - if(pSourceRect == NULL || - pVideoInfo == NULL || - pBufferSize == NULL) { - - return E_UNEXPECTED; - } - - // Is the data format compatible - - if(pVideoInfo->bmiHeader.biCompression != BI_RGB) { - if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) { - return E_INVALIDARG; - } - } - - ASSERT(IsRectEmpty(pSourceRect) == FALSE); - - BITMAPINFOHEADER bih; - bih.biWidth = WIDTH(pSourceRect); - bih.biHeight = HEIGHT(pSourceRect); - bih.biBitCount = pVideoInfo->bmiHeader.biBitCount; - LONG Size = DIBSIZE(bih); - Size += GetBitmapFormatSize(HEADER(pVideoInfo)) - SIZE_PREHEADER; - *pBufferSize = Size; - - return NOERROR; -} - - -// Given an IMediaSample containing a linear buffer with an image and a type -// describing the bitmap make a rendering of the image into the output buffer -// This may be called by derived classes who render typical video images to -// handle the IBasicVideo GetCurrentImage method. The pVideoImage pointer may -// be NULL when passed to GetCurrentImage in which case GetImageSize will be -// called instead, which will just do the calculation of the memory required - -HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample, - VIDEOINFOHEADER *pVideoInfo, - LONG *pBufferSize, - BYTE *pVideoImage, - RECT *pSourceRect) { - NOTE("Entering CopyImage"); - ASSERT(pSourceRect); - BYTE *pCurrentImage; - - // Check we have an image to copy - - if(pMediaSample == NULL || pSourceRect == NULL || - pVideoInfo == NULL || pVideoImage == NULL || - pBufferSize == NULL) { - - return E_UNEXPECTED; - } - - // Is the data format compatible - - if(pVideoInfo->bmiHeader.biCompression != BI_RGB) { - if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) { - return E_INVALIDARG; - } - } - - ASSERT(IsRectEmpty(pSourceRect) == FALSE); - - BITMAPINFOHEADER bih; - bih.biWidth = WIDTH(pSourceRect); - bih.biHeight = HEIGHT(pSourceRect); - bih.biBitCount = pVideoInfo->bmiHeader.biBitCount; - LONG Size = GetBitmapFormatSize(HEADER(pVideoInfo)) - SIZE_PREHEADER; - LONG Total = Size + DIBSIZE(bih); - - // Make sure we have a large enough buffer - - if(*pBufferSize < Total) { - return E_OUTOFMEMORY; - } - - // Copy the BITMAPINFO - - CopyMemory((PVOID)pVideoImage, (PVOID)&pVideoInfo->bmiHeader, Size); - ((BITMAPINFOHEADER *)pVideoImage)->biWidth = WIDTH(pSourceRect); - ((BITMAPINFOHEADER *)pVideoImage)->biHeight = HEIGHT(pSourceRect); - ((BITMAPINFOHEADER *)pVideoImage)->biSizeImage = DIBSIZE(bih); - BYTE *pImageData = pVideoImage + Size; - - // Get the pointer to it's image data - - HRESULT hr = pMediaSample->GetPointer(&pCurrentImage); - if(FAILED(hr)) { - return hr; - } - - // Now we are ready to start copying the source scan lines - - LONG ScanLine = (pVideoInfo->bmiHeader.biBitCount / 8) * WIDTH(pSourceRect); - LONG LinesToSkip = pVideoInfo->bmiHeader.biHeight; - LinesToSkip -= pSourceRect->top + HEIGHT(pSourceRect); - pCurrentImage += LinesToSkip * DIBWIDTHBYTES(pVideoInfo->bmiHeader); - pCurrentImage += pSourceRect->left * (pVideoInfo->bmiHeader.biBitCount / 8); - - // Even money on this GP faulting sometime... - - for(LONG Line = 0;Line < HEIGHT(pSourceRect);Line++) { - CopyMemory((PVOID)pImageData, (PVOID)pCurrentImage, ScanLine); - pImageData += DIBWIDTHBYTES(*(BITMAPINFOHEADER *)pVideoImage); - pCurrentImage += DIBWIDTHBYTES(pVideoInfo->bmiHeader); - } - return NOERROR; -} - - -// Called when we change media types either during connection or dynamically -// We inform the filter graph and therefore the application that the video -// size may have changed, we don't bother looking to see if it really has as -// we leave that to the application - the dimensions are the event parameters - -HRESULT CBaseControlVideo::OnVideoSizeChange() { - // Get the video format from the derived class - - VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); - if(pVideoInfo == NULL) - return E_OUTOFMEMORY; - WORD Width = (WORD) pVideoInfo->bmiHeader.biWidth; - WORD Height = (WORD) pVideoInfo->bmiHeader.biHeight; - - return m_pFilter->NotifyEvent(EC_VIDEO_SIZE_CHANGED, - MAKELPARAM(Width,Height), - MAKEWPARAM(0,0)); -} - - -// Set the video source rectangle. We must check the source rectangle against -// the actual video dimensions otherwise when we come to draw the pictures we -// get access violations as GDI tries to touch data outside of the image data -// Although we store the rectangle in left, top, right and bottom coordinates -// instead of left, top, width and height as OLE uses we do take into account -// that the rectangle is used up to, but not including, the right column and -// bottom row of pixels, see the Win32 documentation on RECT for more details - -HRESULT CBaseControlVideo::CheckSourceRect(RECT *pSourceRect) { - CheckPointer(pSourceRect,E_POINTER); - LONG Width,Height; - GetVideoSize(&Width,&Height); - - // Check the coordinates are greater than zero - // and that the rectangle is valid (leftleft >= pSourceRect->right) || - (pSourceRect->left < 0) || - (pSourceRect->top >= pSourceRect->bottom) || - (pSourceRect->top < 0)) { - - return E_INVALIDARG; - } - - // Check the coordinates are less than the extents - - if((pSourceRect->right > Width) || - (pSourceRect->bottom > Height)) { - - return E_INVALIDARG; - } - return NOERROR; -} - - -// Check the target rectangle has some valid coordinates, which amounts to -// little more than checking the destination rectangle isn't empty. Derived -// classes may call this when they have their SetTargetRect method called to -// check the rectangle validity, we do not update the rectangles passed in -// Although we store the rectangle in left, top, right and bottom coordinates -// instead of left, top, width and height as OLE uses we do take into account -// that the rectangle is used up to, but not including, the right column and -// bottom row of pixels, see the Win32 documentation on RECT for more details - -HRESULT CBaseControlVideo::CheckTargetRect(RECT *pTargetRect) { - // Check the pointer is valid - - if(pTargetRect == NULL) { - return E_POINTER; - } - - // These overflow the WIDTH and HEIGHT checks - - if(pTargetRect->left > pTargetRect->right || - pTargetRect->top > pTargetRect->bottom) { - return E_INVALIDARG; - } - - // Check the rectangle has valid coordinates - - if(WIDTH(pTargetRect) <= 0 || HEIGHT(pTargetRect) <= 0) { - return E_INVALIDARG; - } - - ASSERT(IsRectEmpty(pTargetRect) == FALSE); - return NOERROR; -} - - +//------------------------------------------------------------------------------ +// File: WinCtrl.cpp +// +// Desc: DirectShow base classes - implements video control interface class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include + +// The control interface methods require us to be connected + +#define CheckConnected(pin,code) \ +{ \ + if(pin == NULL) { \ + ASSERT(!TEXT("Pin not set")); \ + } \ + else if(pin->IsConnected() == FALSE) { \ + return (code); \ + } \ +} + +// This checks to see whether the window has a drain. An application can in +// most environments set the owner/parent of windows so that they appear in +// a compound document context (for example). In this case, the application +// would probably like to be told of any keyboard/mouse messages. Therefore +// we pass these messages on untranslated, returning TRUE if we're successful + +BOOL WINAPI PossiblyEatMessage(HWND hwndDrain, UINT uMsg, WPARAM wParam, LPARAM lParam) { + if(hwndDrain != NULL && !InSendMessage()) { + switch(uMsg) { + case WM_CHAR: + case WM_DEADCHAR: + case WM_KEYDOWN: + case WM_KEYUP: + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MOUSEACTIVATE: + case WM_MOUSEMOVE: + // If we pass this on we don't get any mouse clicks + //case WM_NCHITTEST: + case WM_NCLBUTTONDBLCLK: + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONUP: + case WM_NCMBUTTONDBLCLK: + case WM_NCMBUTTONDOWN: + case WM_NCMBUTTONUP: + case WM_NCMOUSEMOVE: + case WM_NCRBUTTONDBLCLK: + case WM_NCRBUTTONDOWN: + case WM_NCRBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_SYSCHAR: + case WM_SYSDEADCHAR: + case WM_SYSKEYDOWN: + case WM_SYSKEYUP: + + DbgLog((LOG_TRACE, 2, TEXT("Forwarding %x to drain"))); + PostMessage(hwndDrain, uMsg, wParam, lParam); + + return TRUE; + } + } + return FALSE; +} + + +// This class implements the IVideoWindow control functions (dual interface) +// we support a large number of properties and methods designed to allow the +// client (whether it be an automation controller or a C/C++ application) to +// set and get a number of window related properties such as it's position. +// We also support some methods that duplicate the properties but provide a +// more direct and efficient mechanism as many values may be changed in one + +CBaseControlWindow::CBaseControlWindow( + CBaseFilter *pFilter, // Owning filter + CCritSec *pInterfaceLock, // Locking object + TCHAR *pName, // Object description + LPUNKNOWN pUnk, // Normal COM ownership + HRESULT *phr) : // OLE return code + + CBaseVideoWindow(pName,pUnk), + m_pInterfaceLock(pInterfaceLock), + m_hwndOwner(NULL), + m_hwndDrain(NULL), + m_bAutoShow(TRUE), + m_pFilter(pFilter), + m_bCursorHidden(FALSE), + m_pPin(NULL) { + ASSERT(m_pFilter); + ASSERT(m_pInterfaceLock); + ASSERT(phr); + m_BorderColour = VIDEO_COLOUR; +} + + +// Set the title caption on the base window, we don't do any field checking +// as we really don't care what title they intend to have. We can always get +// it back again later with GetWindowText. The only other complication is to +// do the necessary string conversions between ANSI and OLE Unicode strings + +STDMETHODIMP CBaseControlWindow::put_Caption(BSTR strCaption) { + CheckPointer(strCaption,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); +#ifdef UNICODE + SetWindowText(m_hwnd, strCaption); +#else + CHAR Caption[CAPTION]; + + WideCharToMultiByte(CP_ACP,0,strCaption,-1,Caption,CAPTION,NULL,NULL); + SetWindowText(m_hwnd, Caption); +#endif + return NOERROR; +} + + +// Get the current base window title caption, once again we do no real field +// checking. We allocate a string for the window title to be filled in with +// which ensures the interface doesn't fiddle around with getting memory. A +// BSTR is a normal C string with the length at position (-1), we use the +// WriteBSTR helper function to create the caption to try and avoid OLE32 + +/* NABIL: I un-commented this entire function...*/ + +STDMETHODIMP CBaseControlWindow::get_Caption(BSTR *pstrCaption) { + CheckPointer(pstrCaption,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + WCHAR WideCaption[CAPTION]; + +#ifdef UNICODE + GetWindowText(m_hwnd,WideCaption,CAPTION); +#else + // Convert the ASCII caption to a UNICODE string + + TCHAR Caption[CAPTION]; + GetWindowText(m_hwnd,Caption,CAPTION); + MultiByteToWideChar(CP_ACP,0,Caption,-1,WideCaption,CAPTION); +#endif + return WriteBSTR(pstrCaption,WideCaption); +} + +/*NABIL: END Un-comment*/ + +// Set the window style using GWL_EXSTYLE + +STDMETHODIMP CBaseControlWindow::put_WindowStyleEx(long WindowStyleEx) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Should we be taking off WS_EX_TOPMOST + + if(GetWindowLong(m_hwnd,GWL_EXSTYLE) & WS_EX_TOPMOST) { + if((WindowStyleEx & WS_EX_TOPMOST) == 0) { + SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) FALSE,(LPARAM) 0); + } + } + + // Likewise should we be adding WS_EX_TOPMOST + + if(WindowStyleEx & WS_EX_TOPMOST) { + SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) TRUE,(LPARAM) 0); + WindowStyleEx &= (~WS_EX_TOPMOST); + if(WindowStyleEx == 0) return NOERROR; + } + return DoSetWindowStyle(WindowStyleEx,GWL_EXSTYLE); +} + + +// Gets the current GWL_EXSTYLE base window style + +STDMETHODIMP CBaseControlWindow::get_WindowStyleEx(long *pWindowStyleEx) { + CheckPointer(pWindowStyleEx,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + return DoGetWindowStyle(pWindowStyleEx,GWL_EXSTYLE); +} + + +// Set the window style using GWL_STYLE + +STDMETHODIMP CBaseControlWindow::put_WindowStyle(long WindowStyle) { + // These styles cannot be changed dynamically + + if((WindowStyle & WS_DISABLED) || + (WindowStyle & WS_ICONIC) || + (WindowStyle & WS_MAXIMIZE) || + (WindowStyle & WS_MINIMIZE) || + (WindowStyle & WS_HSCROLL) || + (WindowStyle & WS_VSCROLL)) { + + return E_INVALIDARG; + } + + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + return DoSetWindowStyle(WindowStyle,GWL_STYLE); +} + + +// Get the current GWL_STYLE base window style + +STDMETHODIMP CBaseControlWindow::get_WindowStyle(long *pWindowStyle) { + CheckPointer(pWindowStyle,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + return DoGetWindowStyle(pWindowStyle,GWL_STYLE); +} + + +// Change the base window style or the extended styles depending on whether +// WindowLong is GWL_STYLE or GWL_EXSTYLE. We must call SetWindowPos to have +// the window displayed in it's new style after the change which is a little +// tricky if the window is not currently visible as we realise it offscreen. +// In most cases the client will call get_WindowStyle before they call this +// and then AND and OR in extra bit settings according to the requirements + +HRESULT CBaseControlWindow::DoSetWindowStyle(long Style,long WindowLong) { + RECT WindowRect; + + // Get the window's visibility before setting the style + BOOL bVisible = IsWindowVisible(m_hwnd); + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + // Set the new style flags for the window + SetWindowLong(m_hwnd,WindowLong,Style); + UINT WindowFlags = SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE; + WindowFlags |= SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; + + // Show the window again in the current position + + if(bVisible == TRUE) { + + SetWindowPos(m_hwnd, // Base window handle + HWND_TOP, // Just a place holder + 0,0,0,0, // Leave size and position + WindowFlags); // Just draw it again + + return NOERROR; + } + + // Move the window offscreen so the user doesn't see the changes + + MoveWindow((HWND) m_hwnd, // Base window handle + GetSystemMetrics(SM_CXSCREEN), // Current desktop width + GetSystemMetrics(SM_CYSCREEN), // Likewise it's height + WIDTH(&WindowRect), // Use the same width + HEIGHT(&WindowRect), // Keep height same to + TRUE); // May as well repaint + + // Now show the previously hidden window + + SetWindowPos(m_hwnd, // Base window handle + HWND_TOP, // Just a place holder + 0,0,0,0, // Leave size and position + WindowFlags); // Just draw it again + + ShowWindow(m_hwnd,SW_HIDE); + + if(GetParent(m_hwnd)) { + + MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); + } + + MoveWindow((HWND) m_hwnd, // Base window handle + WindowRect.left, // Existing x coordinate + WindowRect.top, // Existing y coordinate + WIDTH(&WindowRect), // Use the same width + HEIGHT(&WindowRect), // Keep height same to + TRUE); // May as well repaint + + return NOERROR; +} + + +// Get the current base window style (either GWL_STYLE or GWL_EXSTYLE) + +HRESULT CBaseControlWindow::DoGetWindowStyle(long *pStyle,long WindowLong) { + *pStyle = GetWindowLong(m_hwnd,WindowLong); + return NOERROR; +} + + +// Change the visibility of the base window, this takes the same parameters +// as the ShowWindow Win32 API does, so the client can have the window hidden +// or shown, minimised to an icon, or maximised to play in full screen mode +// We pass the request on to the base window to actually make the change + +STDMETHODIMP CBaseControlWindow::put_WindowState(long WindowState) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + DoShowWindow(WindowState); + return NOERROR; +} + + +// Get the current window state, this function returns a subset of the SW bit +// settings available in ShowWindow, if the window is visible then SW_SHOW is +// set, if it is hidden then the SW_HIDDEN is set, if it is either minimised +// or maximised then the SW_MINIMIZE or SW_MAXIMIZE is set respectively. The +// other SW bit settings are really set commands not readable output values + +STDMETHODIMP CBaseControlWindow::get_WindowState(long *pWindowState) { + CheckPointer(pWindowState,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + ASSERT(pWindowState); + *pWindowState = FALSE; + + // Is the window visible, a window is termed visible if it is somewhere on + // the current desktop even if it is completely obscured by other windows + // so the flag is a style for each window set with the WS_VISIBLE bit + + if(IsWindowVisible(m_hwnd) == TRUE) { + + // Is the base window iconic + if(IsIconic(m_hwnd) == TRUE) { + *pWindowState |= SW_MINIMIZE; + } + + // Has the window been maximised + else if(IsZoomed(m_hwnd) == TRUE) { + *pWindowState |= SW_MAXIMIZE; + } + + // Window is normal + else { + *pWindowState |= SW_SHOW; + } + + } + else { + *pWindowState |= SW_HIDE; + } + return NOERROR; +} + + +// This makes sure that any palette we realise in the base window (through a +// media type or through the overlay interface) is done in the background and +// is therefore mapped to existing device entries rather than taking it over +// as it will do when we this window gets the keyboard focus. An application +// uses this to make sure it doesn't have it's palette removed by the window + +STDMETHODIMP CBaseControlWindow::put_BackgroundPalette(long BackgroundPalette) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cWindowLock(&m_WindowLock); + + // Check this is a valid automation boolean type + + if(BackgroundPalette != OATRUE) { + if(BackgroundPalette != OAFALSE) { + return E_INVALIDARG; + } + } + + // Make sure the window realises any palette it has again + + m_bBackground = (BYTE) (BackgroundPalette == OATRUE ? TRUE : FALSE); + PostMessage(m_hwnd,m_RealizePalette,0,0); + PaintWindow(FALSE); + + return NOERROR; +} + + +// This returns the current background realisation setting + +STDMETHODIMP +CBaseControlWindow::get_BackgroundPalette(long *pBackgroundPalette) { + CheckPointer(pBackgroundPalette,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cWindowLock(&m_WindowLock); + + // Get the current background palette setting + + *pBackgroundPalette = (m_bBackground == TRUE ? OATRUE : OAFALSE); + return NOERROR; +} + + +// Change the visibility of the base window + +STDMETHODIMP CBaseControlWindow::put_Visible(long Visible) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Check this is a valid automation boolean type + + if(Visible != OATRUE) { + if(Visible != OAFALSE) { + return E_INVALIDARG; + } + } + + // Convert the boolean visibility into SW_SHOW and SW_HIDE + + INT Mode = (Visible == OATRUE ? SW_SHOWNORMAL : SW_HIDE); + DoShowWindow(Mode); + return NOERROR; +} + + +// Return OATRUE if the window is currently visible otherwise OAFALSE + +STDMETHODIMP CBaseControlWindow::get_Visible(long *pVisible) { + CheckPointer(pVisible,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // See if the base window has a WS_VISIBLE style - this will return TRUE + // even if the window is completely obscured by other desktop windows, we + // return FALSE if the window is not showing because of earlier calls + + BOOL Mode = IsWindowVisible(m_hwnd); + *pVisible = (Mode == TRUE ? OATRUE : OAFALSE); + return NOERROR; +} + + +// Change the left position of the base window. This keeps the window width +// and height properties the same so it effectively shunts the window left or +// right accordingly - there is the Width property to change that dimension + +STDMETHODIMP CBaseControlWindow::put_Left(long Left) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bSuccess; + RECT WindowRect; + + // Get the current window position in a RECT + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + if(GetParent(m_hwnd)) { + + MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); + } + + // Adjust the coordinates ready for SetWindowPos, the window rectangle we + // get back from GetWindowRect is in left,top,right and bottom while the + // coordinates SetWindowPos wants are left,top,width and height values + + WindowRect.bottom = WindowRect.bottom - WindowRect.top; + WindowRect.right = WindowRect.right - WindowRect.left; + UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; + + bSuccess = SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + Left, // New left position + WindowRect.top, // Leave top alone + WindowRect.right, // The WIDTH (not right) + WindowRect.bottom, // The HEIGHT (not bottom) + WindowFlags); // Show window options + + if(bSuccess == FALSE) { + return E_INVALIDARG; + } + return NOERROR; +} + + +// Return the current base window left position + +STDMETHODIMP CBaseControlWindow::get_Left(long *pLeft) { + CheckPointer(pLeft,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT WindowRect; + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + *pLeft = WindowRect.left; + return NOERROR; +} + + +// Change the current width of the base window. This property complements the +// left position property so we must keep the left edge constant and expand or +// contract to the right, the alternative would be to change the left edge so +// keeping the right edge constant but this is maybe a little more intuitive + +STDMETHODIMP CBaseControlWindow::put_Width(long Width) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bSuccess; + RECT WindowRect; + + // Adjust the coordinates ready for SetWindowPos, the window rectangle we + // get back from GetWindowRect is in left,top,right and bottom while the + // coordinates SetWindowPos wants are left,top,width and height values + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + if(GetParent(m_hwnd)) { + + MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); + } + + WindowRect.bottom = WindowRect.bottom - WindowRect.top; + UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; + + // This seems to have a bug in that calling SetWindowPos on a window with + // just the width changing causes it to ignore the width that you pass in + // and sets it to a mimimum value of 110 pixels wide (Windows NT 3.51) + + bSuccess = SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + WindowRect.left, // Leave left alone + WindowRect.top, // Leave top alone + Width, // New WIDTH dimension + WindowRect.bottom, // The HEIGHT (not bottom) + WindowFlags); // Show window options + + if(bSuccess == FALSE) { + return E_INVALIDARG; + } + return NOERROR; +} + + +// Return the current base window width + +STDMETHODIMP CBaseControlWindow::get_Width(long *pWidth) { + CheckPointer(pWidth,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT WindowRect; + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + *pWidth = WindowRect.right - WindowRect.left; + return NOERROR; +} + + +// This allows the client program to change the top position for the window in +// the same way that changing the left position does not affect the width of +// the image so changing the top position does not affect the window height + +STDMETHODIMP CBaseControlWindow::put_Top(long Top) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bSuccess; + RECT WindowRect; + + // Get the current window position in a RECT + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + if(GetParent(m_hwnd)) { + + MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); + } + + // Adjust the coordinates ready for SetWindowPos, the window rectangle we + // get back from GetWindowRect is in left,top,right and bottom while the + // coordinates SetWindowPos wants are left,top,width and height values + + WindowRect.bottom = WindowRect.bottom - WindowRect.top; + WindowRect.right = WindowRect.right - WindowRect.left; + UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; + + bSuccess = SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + WindowRect.left, // Leave left alone + Top, // New top position + WindowRect.right, // The WIDTH (not right) + WindowRect.bottom, // The HEIGHT (not bottom) + WindowFlags); // Show window flags + + if(bSuccess == FALSE) { + return E_INVALIDARG; + } + return NOERROR; +} + + +// Return the current base window top position + +STDMETHODIMP CBaseControlWindow::get_Top(long *pTop) { + CheckPointer(pTop,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT WindowRect; + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + *pTop = WindowRect.top; + return NOERROR; +} + + +// Change the height of the window, this complements the top property so when +// we change this we must keep the top position for the base window, as said +// before we could keep the bottom and grow upwards although this is perhaps +// a little more intuitive since we already have a top position property + +STDMETHODIMP CBaseControlWindow::put_Height(long Height) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bSuccess; + RECT WindowRect; + + // Adjust the coordinates ready for SetWindowPos, the window rectangle we + // get back from GetWindowRect is in left,top,right and bottom while the + // coordinates SetWindowPos wants are left,top,width and height values + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + if(GetParent(m_hwnd)) { + + MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2); + } + + WindowRect.right = WindowRect.right - WindowRect.left; + UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; + + bSuccess = SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + WindowRect.left, // Leave left alone + WindowRect.top, // Leave top alone + WindowRect.right, // The WIDTH (not right) + Height, // New height dimension + WindowFlags); // Show window flags + + if(bSuccess == FALSE) { + return E_INVALIDARG; + } + return NOERROR; +} + + +// Return the current base window height + +STDMETHODIMP CBaseControlWindow::get_Height(long *pHeight) { + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT WindowRect; + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + *pHeight = WindowRect.bottom - WindowRect.top; + return NOERROR; +} + + +// This can be called to change the owning window. Setting the owner is done +// through this function, however to make the window a true child window the +// style must also be set to WS_CHILD. After resetting the owner to NULL an +// application should also set the style to WS_OVERLAPPED | WS_CLIPCHILDREN. + +// We cannot lock the object here because the SetParent causes an interthread +// SendMessage to the owner window. If they are in GetState we will sit here +// incomplete with the critical section locked therefore blocking out source +// filter threads from accessing us. Because the source thread can't enter us +// it can't get buffers or call EndOfStream so the GetState will not complete + +STDMETHODIMP CBaseControlWindow::put_Owner(OAHWND Owner) { + // Check we are connected otherwise reject the call + + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + m_hwndOwner = (HWND) Owner; + HWND hwndParent = m_hwndOwner; + + // Add or remove WS_CHILD as appropriate + + LONG Style = GetWindowLong(m_hwnd,GWL_STYLE); + if(Owner == NULL) { + Style &= (~WS_CHILD); + } + else { + Style |= (WS_CHILD); + } + SetWindowLong(m_hwnd,GWL_STYLE,Style); + + // Don't call this with the filter locked + + SetParent(m_hwnd,hwndParent); + + PaintWindow(TRUE); + NOTE1("Changed parent %lx",hwndParent); + + return NOERROR; +} + + +// This complements the put_Owner to get the current owning window property +// we always return NOERROR although the returned window handle may be NULL +// to indicate no owning window (the desktop window doesn't qualify as one) +// If an application sets the owner we call SetParent, however that returns +// NULL until the WS_CHILD bit is set on, so we store the owner internally + +STDMETHODIMP CBaseControlWindow::get_Owner(OAHWND *Owner) { + CheckPointer(Owner,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + *Owner = (OAHWND) m_hwndOwner; + return NOERROR; +} + + +// And renderer supporting IVideoWindow may have an HWND set who will get any +// keyboard and mouse messages we receive posted on to them. This is separate +// from setting an owning window. By separating the two, applications may get +// messages sent on even when they have set no owner (perhaps it's maximised) + +STDMETHODIMP CBaseControlWindow::put_MessageDrain(OAHWND Drain) { + // Check we are connected otherwise reject the call + + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + m_hwndDrain = (HWND) Drain; + return NOERROR; +} + + +// Return the current message drain + +STDMETHODIMP CBaseControlWindow::get_MessageDrain(OAHWND *Drain) { + CheckPointer(Drain,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + *Drain = (OAHWND) m_hwndDrain; + return NOERROR; +} + + +// This is called by the filter graph to inform us of a message we should know +// is being sent to our owning window. We have this because as a child window +// we do not get certain messages that are only sent to top level windows. We +// must see the palette changed/changing/query messages so that we know if we +// have the foreground palette or not. We pass the message on to our window +// using SendMessage - this will cause an interthread send message to occur + +STDMETHODIMP +CBaseControlWindow::NotifyOwnerMessage(OAHWND hwnd, // Window handle + long uMsg, // Message ID + LONG_PTR wParam, // Parameters + LONG_PTR lParam) // for message +{ + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Only interested in these Windows messages + + switch(uMsg) { + + case WM_SYSCOLORCHANGE: + case WM_PALETTECHANGED: + case WM_PALETTEISCHANGING: + case WM_QUERYNEWPALETTE: + case WM_DEVMODECHANGE: + case WM_DISPLAYCHANGE: + case WM_ACTIVATEAPP: + + // If we do not have an owner then ignore + + if(m_hwndOwner == NULL) { + return NOERROR; + } + SendMessage(m_hwnd,uMsg,(WPARAM)wParam,(LPARAM)lParam); + break; + + // do NOT fwd WM_MOVE. the parameters are the location of the parent + // window, NOT what the renderer should be looking at. But we need + // to make sure the overlay is moved with the parent window, so we + // do this. + case WM_MOVE: + PostMessage(m_hwnd,WM_PAINT,0,0); + break; + } + return NOERROR; +} + + +// Allow an application to have us set the base window in the foreground. We +// have this because it is difficult for one thread to do do this to a window +// owned by another thread. We ask the base window class to do the real work + +STDMETHODIMP CBaseControlWindow::SetWindowForeground(long Focus) { + // Check this is a valid automation boolean type + + if(Focus != OATRUE) { + if(Focus != OAFALSE) { + return E_INVALIDARG; + } + } + + // We shouldn't lock as this sends a message + + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bFocus = (Focus == OATRUE ? TRUE : FALSE); + DoSetWindowForeground(bFocus); + + return NOERROR; +} + + +// This allows a client to set the complete window size and position in one +// atomic operation. The same affect can be had by changing each dimension +// in turn through their individual properties although some flashing will +// occur as each of them gets updated (they are better set at design time) + +STDMETHODIMP +CBaseControlWindow::SetWindowPosition(long Left,long Top,long Width,long Height) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + BOOL bSuccess; + + // Set the new size and position + UINT WindowFlags = SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE; + + ASSERT(IsWindow(m_hwnd)); + bSuccess = SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + Left, // Left position + Top, // Top position + Width, // Window width + Height, // Window height + WindowFlags); // Show window flags + ASSERT(bSuccess); +#ifdef DEBUG + DbgLog((LOG_TRACE, 1, TEXT("SWP failed error %d"), GetLastError())); +#endif + if(bSuccess == FALSE) { + return E_INVALIDARG; + } + return NOERROR; +} + + +// This complements the SetWindowPosition to return the current window place +// in device coordinates. As before the same information can be retrived by +// calling the property get functions individually but this is atomic and is +// therefore more suitable to a live environment rather than design time + +STDMETHODIMP +CBaseControlWindow::GetWindowPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { + // Should check the pointers are not NULL + + CheckPointer(pLeft,E_POINTER); + CheckPointer(pTop,E_POINTER); + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT WindowRect; + + // Get the current window coordinates + + EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect)); + + // Convert the RECT into left,top,width and height values + + *pLeft = WindowRect.left; + *pTop = WindowRect.top; + *pWidth = WindowRect.right - WindowRect.left; + *pHeight = WindowRect.bottom - WindowRect.top; + + return NOERROR; +} + + +// When a window is maximised or iconic calling GetWindowPosition will return +// the current window position (likewise for the properties). However if the +// restored size (ie the size we'll return to when normally shown) is needed +// then this should be used. When in a normal position (neither iconic nor +// maximised) then this returns the same coordinates as GetWindowPosition + +STDMETHODIMP +CBaseControlWindow::GetRestorePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { + // Should check the pointers are not NULL + + CheckPointer(pLeft,E_POINTER); + CheckPointer(pTop,E_POINTER); + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Use GetWindowPlacement to find the restore position + + WINDOWPLACEMENT Place; + Place.length = sizeof(WINDOWPLACEMENT); + EXECUTE_ASSERT(GetWindowPlacement(m_hwnd,&Place)); + + RECT WorkArea; + + // We must take into account any task bar present + + if(SystemParametersInfo(SPI_GETWORKAREA,0,&WorkArea,FALSE) == TRUE) { + if(GetParent(m_hwnd) == NULL) { + Place.rcNormalPosition.top += WorkArea.top; + Place.rcNormalPosition.bottom += WorkArea.top; + Place.rcNormalPosition.left += WorkArea.left; + Place.rcNormalPosition.right += WorkArea.left; + } + } + + // Convert the RECT into left,top,width and height values + + *pLeft = Place.rcNormalPosition.left; + *pTop = Place.rcNormalPosition.top; + *pWidth = Place.rcNormalPosition.right - Place.rcNormalPosition.left; + *pHeight = Place.rcNormalPosition.bottom - Place.rcNormalPosition.top; + + return NOERROR; +} + + +// Return the current border colour, if we are playing something to a subset +// of the base window display there is an outside area exposed. The default +// action is to paint this colour in the Windows background colour (defined +// as value COLOR_WINDOW) We reset to this default when we're disconnected + +STDMETHODIMP CBaseControlWindow::get_BorderColor(long *Color) { + CheckPointer(Color,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + *Color = (long) m_BorderColour; + return NOERROR; +} + + +// This can be called to set the current border colour + +STDMETHODIMP CBaseControlWindow::put_BorderColor(long Color) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Have the window repainted with the new border colour + + m_BorderColour = (COLORREF) Color; + PaintWindow(TRUE); + return NOERROR; +} + + +// Delegate fullscreen handling to plug in distributor + +STDMETHODIMP CBaseControlWindow::get_FullScreenMode(long *FullScreenMode) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CheckPointer(FullScreenMode,E_POINTER); + return E_NOTIMPL; +} + + +// Delegate fullscreen handling to plug in distributor + +STDMETHODIMP CBaseControlWindow::put_FullScreenMode(long FullScreenMode) { + return E_NOTIMPL; +} + + +// This sets the auto show property, this property causes the base window to +// be displayed whenever we change state. This allows an application to have +// to do nothing to have the window appear but still allow them to change the +// default behaviour if for example they want to keep it hidden for longer + +STDMETHODIMP CBaseControlWindow::put_AutoShow(long AutoShow) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Check this is a valid automation boolean type + + if(AutoShow != OATRUE) { + if(AutoShow != OAFALSE) { + return E_INVALIDARG; + } + } + + m_bAutoShow = (AutoShow == OATRUE ? TRUE : FALSE); + return NOERROR; +} + + +// This can be called to get the current auto show flag. The flag is updated +// when we connect and disconnect and through this interface all of which are +// controlled and serialised by means of the main renderer critical section + +STDMETHODIMP CBaseControlWindow::get_AutoShow(long *AutoShow) { + CheckPointer(AutoShow,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + *AutoShow = (m_bAutoShow == TRUE ? OATRUE : OAFALSE); + return NOERROR; +} + + +// Return the minimum ideal image size for the current video. This may differ +// to the actual video dimensions because we may be using DirectDraw hardware +// that has specific stretching requirements. For example the Cirrus Logic +// cards have a minimum stretch factor depending on the overlay surface size + +STDMETHODIMP +CBaseControlWindow::GetMinIdealImageSize(long *pWidth,long *pHeight) { + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + FILTER_STATE State; + + // Must not be stopped for this to work correctly + + m_pFilter->GetState(0,&State); + if(State == State_Stopped) { + return VFW_E_WRONG_STATE; + } + + RECT DefaultRect = GetDefaultRect(); + *pWidth = WIDTH(&DefaultRect); + *pHeight = HEIGHT(&DefaultRect); + return NOERROR; +} + + +// Return the maximum ideal image size for the current video. This may differ +// to the actual video dimensions because we may be using DirectDraw hardware +// that has specific stretching requirements. For example the Cirrus Logic +// cards have a maximum stretch factor depending on the overlay surface size + +STDMETHODIMP +CBaseControlWindow::GetMaxIdealImageSize(long *pWidth,long *pHeight) { + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + FILTER_STATE State; + + // Must not be stopped for this to work correctly + + m_pFilter->GetState(0,&State); + if(State == State_Stopped) { + return VFW_E_WRONG_STATE; + } + + RECT DefaultRect = GetDefaultRect(); + *pWidth = WIDTH(&DefaultRect); + *pHeight = HEIGHT(&DefaultRect); + return NOERROR; +} + + +// Allow an application to hide the cursor on our window + +STDMETHODIMP +CBaseControlWindow::HideCursor(long HideCursor) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + + // Check this is a valid automation boolean type + + if(HideCursor != OATRUE) { + if(HideCursor != OAFALSE) { + return E_INVALIDARG; + } + } + + m_bCursorHidden = (HideCursor == OATRUE ? TRUE : FALSE); + return NOERROR; +} + + +// Returns whether we have the cursor hidden or not + +STDMETHODIMP CBaseControlWindow::IsCursorHidden(long *CursorHidden) { + CheckPointer(CursorHidden,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + *CursorHidden = (m_bCursorHidden == TRUE ? OATRUE : OAFALSE); + return NOERROR; +} + + +// This class implements the IBasicVideo control functions (dual interface) +// we support a large number of properties and methods designed to allow the +// client (whether it be an automation controller or a C/C++ application) to +// set and get a number of video related properties such as the native video +// size. We support some methods that duplicate the properties but provide a +// more direct and efficient mechanism as many values may be changed in one + +CBaseControlVideo::CBaseControlVideo( + CBaseFilter *pFilter, // Owning filter + CCritSec *pInterfaceLock, // Locking object + TCHAR *pName, // Object description + LPUNKNOWN pUnk, // Normal COM ownership + HRESULT *phr) : // OLE return code + + CBaseBasicVideo(pName,pUnk), + m_pFilter(pFilter), + m_pInterfaceLock(pInterfaceLock), + m_pPin(NULL) { + ASSERT(m_pFilter); + ASSERT(m_pInterfaceLock); + ASSERT(phr); +} + +// Return an approximate average time per frame + +STDMETHODIMP CBaseControlVideo::get_AvgTimePerFrame(REFTIME *pAvgTimePerFrame) { + CheckPointer(pAvgTimePerFrame,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + COARefTime AvgTime(pVideoInfo->AvgTimePerFrame); + *pAvgTimePerFrame = (REFTIME) AvgTime; + + return NOERROR; +} + + +// Return an approximate bit rate for the video + +STDMETHODIMP CBaseControlVideo::get_BitRate(long *pBitRate) { + CheckPointer(pBitRate,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + *pBitRate = pVideoInfo->dwBitRate; + return NOERROR; +} + + +// Return an approximate bit error rate + +STDMETHODIMP CBaseControlVideo::get_BitErrorRate(long *pBitErrorRate) { + CheckPointer(pBitErrorRate,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + *pBitErrorRate = pVideoInfo->dwBitErrorRate; + return NOERROR; +} + + +// This returns the current video width + +STDMETHODIMP CBaseControlVideo::get_VideoWidth(long *pVideoWidth) { + CheckPointer(pVideoWidth,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + *pVideoWidth = pVideoInfo->bmiHeader.biWidth; + return NOERROR; +} + + +// This returns the current video height + +STDMETHODIMP CBaseControlVideo::get_VideoHeight(long *pVideoHeight) { + CheckPointer(pVideoHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + *pVideoHeight = pVideoInfo->bmiHeader.biHeight; + return NOERROR; +} + + +// This returns the current palette the video is using as an array allocated +// by the user. To remain consistent we use PALETTEENTRY fields to return the +// colours in rather than RGBQUADs that multimedia decided to use. The memory +// is allocated by the user so we simple copy each in turn. We check that the +// number of entries requested and the start position offset are both valid +// If the number of entries evaluates to zero then we return an S_FALSE code + +STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex, + long Entries, + long *pRetrieved, + long *pPalette) { + CheckPointer(pRetrieved,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + CMediaType MediaType; + + // Get the video format from the derived class + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + BITMAPINFOHEADER *pHeader = HEADER(pVideoInfo); + + // Is the current format palettised + + if(PALETTISED(pVideoInfo) == FALSE) { + *pRetrieved = 0; + return VFW_E_NO_PALETTE_AVAILABLE; + } + + // Do they just want to know how many are available + + if(pPalette == NULL) { + *pRetrieved = pHeader->biClrUsed; + return NOERROR; + } + + // Make sure the start position is a valid offset + + if(StartIndex >= (LONG) pHeader->biClrUsed || StartIndex < 0) { + *pRetrieved = 0; + return E_INVALIDARG; + } + + // Correct the number we can retrieve + + LONG Available = (LONG) pHeader->biClrUsed - StartIndex; + *pRetrieved = max(0,min(Available,Entries)); + if(*pRetrieved == 0) { + return S_FALSE; + } + + // Copy the palette entries to the output buffer + + PALETTEENTRY *pEntries = (PALETTEENTRY *) pPalette; + RGBQUAD *pColours = COLORS(pVideoInfo) + StartIndex; + + for(LONG Count = 0;Count < *pRetrieved;Count++) { + pEntries[Count].peRed = pColours[Count].rgbRed; + pEntries[Count].peGreen = pColours[Count].rgbGreen; + pEntries[Count].peBlue = pColours[Count].rgbBlue; + pEntries[Count].peFlags = 0; + } + return NOERROR; +} + + +// This returns the current video dimensions as a method rather than a number +// of individual property get calls. For the same reasons as said before we +// cannot access the renderer media type directly as the window object thread +// may be updating it since dynamic format changes may change these values + +STDMETHODIMP CBaseControlVideo::GetVideoSize(long *pWidth,long *pHeight) { + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + + // Get the video format from the derived class + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + *pWidth = pVideoInfo->bmiHeader.biWidth; + *pHeight = pVideoInfo->bmiHeader.biHeight; + return NOERROR; +} + + +// Set the source video rectangle as left,top,right and bottom coordinates +// rather than left,top,width and height as per OLE automation interfaces +// Then pass the rectangle on to the window object to set the source + +STDMETHODIMP +CBaseControlVideo::SetSourcePosition(long Left,long Top,long Width,long Height) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + SourceRect.left = Left; + SourceRect.top = Top; + SourceRect.right = Left + Width; + SourceRect.bottom = Top + Height; + + // Check the source rectangle is valid + + HRESULT hr = CheckSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the source rectangle + + hr = SetSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the source rectangle in left,top,width and height rather than the +// left,top,right and bottom values that RECT uses (and which the window +// object returns through GetSourceRect) which requires a little work + +STDMETHODIMP +CBaseControlVideo::GetSourcePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { + // Should check the pointers are non NULL + + CheckPointer(pLeft,E_POINTER); + CheckPointer(pTop,E_POINTER); + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT SourceRect; + + CAutoLock cInterfaceLock(m_pInterfaceLock); + GetSourceRect(&SourceRect); + + *pLeft = SourceRect.left; + *pTop = SourceRect.top; + *pWidth = WIDTH(&SourceRect); + *pHeight = HEIGHT(&SourceRect); + + return NOERROR; +} + + +// Set the video destination as left,top,right and bottom coordinates rather +// than the left,top,width and height uses as per OLE automation interfaces +// Then pass the rectangle on to the window object to set the destination + +STDMETHODIMP +CBaseControlVideo::SetDestinationPosition(long Left,long Top,long Width,long Height) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + + DestinationRect.left = Left; + DestinationRect.top = Top; + DestinationRect.right = Left + Width; + DestinationRect.bottom = Top + Height; + + // Check the target rectangle is valid + + HRESULT hr = CheckTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the new target rectangle + + hr = SetTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the destination rectangle in left,top,width and height rather than +// the left,top,right and bottom values that RECT uses (and which the window +// object returns through GetDestinationRect) which requires a little work + +STDMETHODIMP +CBaseControlVideo::GetDestinationPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight) { + // Should check the pointers are not NULL + + CheckPointer(pLeft,E_POINTER); + CheckPointer(pTop,E_POINTER); + CheckPointer(pWidth,E_POINTER); + CheckPointer(pHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + RECT DestinationRect; + + CAutoLock cInterfaceLock(m_pInterfaceLock); + GetTargetRect(&DestinationRect); + + *pLeft = DestinationRect.left; + *pTop = DestinationRect.top; + *pWidth = WIDTH(&DestinationRect); + *pHeight = HEIGHT(&DestinationRect); + + return NOERROR; +} + + +// Set the source left position, the source rectangle we get back from the +// window object is a true rectangle in left,top,right and bottom positions +// so all we have to do is to update the left position and pass it back. We +// must keep the current width constant when we're updating this property + +STDMETHODIMP CBaseControlVideo::put_SourceLeft(long SourceLeft) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + GetSourceRect(&SourceRect); + SourceRect.right = SourceLeft + WIDTH(&SourceRect); + SourceRect.left = SourceLeft; + + // Check the source rectangle is valid + + HRESULT hr = CheckSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the source rectangle + + hr = SetSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the current left source video position + +STDMETHODIMP CBaseControlVideo::get_SourceLeft(long *pSourceLeft) { + CheckPointer(pSourceLeft,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + + GetSourceRect(&SourceRect); + *pSourceLeft = SourceRect.left; + return NOERROR; +} + + +// Set the source width, we get the current source rectangle and then update +// the right position to be the left position (thereby keeping it constant) +// plus the new source width we are passed in (it expands to the right) + +STDMETHODIMP CBaseControlVideo::put_SourceWidth(long SourceWidth) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + GetSourceRect(&SourceRect); + SourceRect.right = SourceRect.left + SourceWidth; + + // Check the source rectangle is valid + + HRESULT hr = CheckSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the source rectangle + + hr = SetSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the current source width + +STDMETHODIMP CBaseControlVideo::get_SourceWidth(long *pSourceWidth) { + CheckPointer(pSourceWidth,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + + GetSourceRect(&SourceRect); + *pSourceWidth = WIDTH(&SourceRect); + return NOERROR; +} + + +// Set the source top position - changing this property does not affect the +// current source height. So changing this shunts the source rectangle up and +// down appropriately. Changing the height complements this functionality by +// keeping the top position constant and simply changing the source height + +STDMETHODIMP CBaseControlVideo::put_SourceTop(long SourceTop) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + GetSourceRect(&SourceRect); + SourceRect.bottom = SourceTop + HEIGHT(&SourceRect); + SourceRect.top = SourceTop; + + // Check the source rectangle is valid + + HRESULT hr = CheckSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the source rectangle + + hr = SetSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the current top position + +STDMETHODIMP CBaseControlVideo::get_SourceTop(long *pSourceTop) { + CheckPointer(pSourceTop,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + + GetSourceRect(&SourceRect); + *pSourceTop = SourceRect.top; + return NOERROR; +} + + +// Set the source height + +STDMETHODIMP CBaseControlVideo::put_SourceHeight(long SourceHeight) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + GetSourceRect(&SourceRect); + SourceRect.bottom = SourceRect.top + SourceHeight; + + // Check the source rectangle is valid + + HRESULT hr = CheckSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the source rectangle + + hr = SetSourceRect(&SourceRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the current source height + +STDMETHODIMP CBaseControlVideo::get_SourceHeight(long *pSourceHeight) { + CheckPointer(pSourceHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT SourceRect; + + GetSourceRect(&SourceRect); + *pSourceHeight = HEIGHT(&SourceRect); + return NOERROR; +} + + +// Set the target left position, the target rectangle we get back from the +// window object is a true rectangle in left,top,right and bottom positions +// so all we have to do is to update the left position and pass it back. We +// must keep the current width constant when we're updating this property + +STDMETHODIMP CBaseControlVideo::put_DestinationLeft(long DestinationLeft) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + GetTargetRect(&DestinationRect); + DestinationRect.right = DestinationLeft + WIDTH(&DestinationRect); + DestinationRect.left = DestinationLeft; + + // Check the target rectangle is valid + + HRESULT hr = CheckTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the new target rectangle + + hr = SetTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the left position for the destination rectangle + +STDMETHODIMP CBaseControlVideo::get_DestinationLeft(long *pDestinationLeft) { + CheckPointer(pDestinationLeft,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + + GetTargetRect(&DestinationRect); + *pDestinationLeft = DestinationRect.left; + return NOERROR; +} + + +// Set the destination width + +STDMETHODIMP CBaseControlVideo::put_DestinationWidth(long DestinationWidth) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + GetTargetRect(&DestinationRect); + DestinationRect.right = DestinationRect.left + DestinationWidth; + + // Check the target rectangle is valid + + HRESULT hr = CheckTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the new target rectangle + + hr = SetTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the width for the destination rectangle + +STDMETHODIMP CBaseControlVideo::get_DestinationWidth(long *pDestinationWidth) { + CheckPointer(pDestinationWidth,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + + GetTargetRect(&DestinationRect); + *pDestinationWidth = WIDTH(&DestinationRect); + return NOERROR; +} + + +// Set the target top position - changing this property does not affect the +// current target height. So changing this shunts the target rectangle up and +// down appropriately. Changing the height complements this functionality by +// keeping the top position constant and simply changing the target height + +STDMETHODIMP CBaseControlVideo::put_DestinationTop(long DestinationTop) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + GetTargetRect(&DestinationRect); + DestinationRect.bottom = DestinationTop + HEIGHT(&DestinationRect); + DestinationRect.top = DestinationTop; + + // Check the target rectangle is valid + + HRESULT hr = CheckTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the new target rectangle + + hr = SetTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the top position for the destination rectangle + +STDMETHODIMP CBaseControlVideo::get_DestinationTop(long *pDestinationTop) { + CheckPointer(pDestinationTop,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + + GetTargetRect(&DestinationRect); + *pDestinationTop = DestinationRect.top; + return NOERROR; +} + + +// Set the destination height + +STDMETHODIMP CBaseControlVideo::put_DestinationHeight(long DestinationHeight) { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + GetTargetRect(&DestinationRect); + DestinationRect.bottom = DestinationRect.top + DestinationHeight; + + // Check the target rectangle is valid + + HRESULT hr = CheckTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + + // Now set the new target rectangle + + hr = SetTargetRect(&DestinationRect); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return the height for the destination rectangle + +STDMETHODIMP CBaseControlVideo::get_DestinationHeight(long *pDestinationHeight) { + CheckPointer(pDestinationHeight,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + RECT DestinationRect; + + GetTargetRect(&DestinationRect); + *pDestinationHeight = HEIGHT(&DestinationRect); + return NOERROR; +} + + +// Reset the source rectangle to the full video dimensions + +STDMETHODIMP CBaseControlVideo::SetDefaultSourcePosition() { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + HRESULT hr = SetDefaultSourceRect(); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return S_OK if we're using the default source otherwise S_FALSE + +STDMETHODIMP CBaseControlVideo::IsUsingDefaultSource() { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + return IsDefaultSourceRect(); +} + + +// Reset the video renderer to use the entire playback area + +STDMETHODIMP CBaseControlVideo::SetDefaultDestinationPosition() { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + HRESULT hr = SetDefaultTargetRect(); + if(FAILED(hr)) { + return hr; + } + return OnUpdateRectangles(); +} + + +// Return S_OK if we're using the default target otherwise S_FALSE + +STDMETHODIMP CBaseControlVideo::IsUsingDefaultDestination() { + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + return IsDefaultTargetRect(); +} + + +// Return a copy of the current image in the video renderer + +STDMETHODIMP +CBaseControlVideo::GetCurrentImage(long *pBufferSize,long *pVideoImage) { + CheckPointer(pBufferSize,E_POINTER); + CheckConnected(m_pPin,VFW_E_NOT_CONNECTED); + CAutoLock cInterfaceLock(m_pInterfaceLock); + FILTER_STATE State; + + // Make sure we are in a paused state + + if(pVideoImage != NULL) { + m_pFilter->GetState(0,&State); + if(State != State_Paused) { + return VFW_E_NOT_PAUSED; + } + return GetStaticImage(pBufferSize,pVideoImage); + } + + // Just return the memory required + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + RECT SourceRect; + GetSourceRect(&SourceRect); + return GetImageSize(pVideoInfo,pBufferSize,&SourceRect); +} + + +// An application has two ways of using GetCurrentImage, one is to pass a real +// buffer which should be filled with the current image. The other is to pass +// a NULL buffer pointer which is interpreted as asking us to return how much +// memory is required for the image. The constraints for when the latter can +// be called are much looser. To calculate the memory required we synthesize +// a VIDEOINFO that takes into account the source rectangle that's being used + +HRESULT CBaseControlVideo::GetImageSize(VIDEOINFOHEADER *pVideoInfo, + LONG *pBufferSize, + RECT *pSourceRect) { + NOTE("Entering GetImageSize"); + ASSERT(pSourceRect); + + // Check we have the correct input parameters + + if(pSourceRect == NULL || + pVideoInfo == NULL || + pBufferSize == NULL) { + + return E_UNEXPECTED; + } + + // Is the data format compatible + + if(pVideoInfo->bmiHeader.biCompression != BI_RGB) { + if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) { + return E_INVALIDARG; + } + } + + ASSERT(IsRectEmpty(pSourceRect) == FALSE); + + BITMAPINFOHEADER bih; + bih.biWidth = WIDTH(pSourceRect); + bih.biHeight = HEIGHT(pSourceRect); + bih.biBitCount = pVideoInfo->bmiHeader.biBitCount; + LONG Size = DIBSIZE(bih); + Size += GetBitmapFormatSize(HEADER(pVideoInfo)) - SIZE_PREHEADER; + *pBufferSize = Size; + + return NOERROR; +} + + +// Given an IMediaSample containing a linear buffer with an image and a type +// describing the bitmap make a rendering of the image into the output buffer +// This may be called by derived classes who render typical video images to +// handle the IBasicVideo GetCurrentImage method. The pVideoImage pointer may +// be NULL when passed to GetCurrentImage in which case GetImageSize will be +// called instead, which will just do the calculation of the memory required + +HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample, + VIDEOINFOHEADER *pVideoInfo, + LONG *pBufferSize, + BYTE *pVideoImage, + RECT *pSourceRect) { + NOTE("Entering CopyImage"); + ASSERT(pSourceRect); + BYTE *pCurrentImage; + + // Check we have an image to copy + + if(pMediaSample == NULL || pSourceRect == NULL || + pVideoInfo == NULL || pVideoImage == NULL || + pBufferSize == NULL) { + + return E_UNEXPECTED; + } + + // Is the data format compatible + + if(pVideoInfo->bmiHeader.biCompression != BI_RGB) { + if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) { + return E_INVALIDARG; + } + } + + ASSERT(IsRectEmpty(pSourceRect) == FALSE); + + BITMAPINFOHEADER bih; + bih.biWidth = WIDTH(pSourceRect); + bih.biHeight = HEIGHT(pSourceRect); + bih.biBitCount = pVideoInfo->bmiHeader.biBitCount; + LONG Size = GetBitmapFormatSize(HEADER(pVideoInfo)) - SIZE_PREHEADER; + LONG Total = Size + DIBSIZE(bih); + + // Make sure we have a large enough buffer + + if(*pBufferSize < Total) { + return E_OUTOFMEMORY; + } + + // Copy the BITMAPINFO + + CopyMemory((PVOID)pVideoImage, (PVOID)&pVideoInfo->bmiHeader, Size); + ((BITMAPINFOHEADER *)pVideoImage)->biWidth = WIDTH(pSourceRect); + ((BITMAPINFOHEADER *)pVideoImage)->biHeight = HEIGHT(pSourceRect); + ((BITMAPINFOHEADER *)pVideoImage)->biSizeImage = DIBSIZE(bih); + BYTE *pImageData = pVideoImage + Size; + + // Get the pointer to it's image data + + HRESULT hr = pMediaSample->GetPointer(&pCurrentImage); + if(FAILED(hr)) { + return hr; + } + + // Now we are ready to start copying the source scan lines + + LONG ScanLine = (pVideoInfo->bmiHeader.biBitCount / 8) * WIDTH(pSourceRect); + LONG LinesToSkip = pVideoInfo->bmiHeader.biHeight; + LinesToSkip -= pSourceRect->top + HEIGHT(pSourceRect); + pCurrentImage += LinesToSkip * DIBWIDTHBYTES(pVideoInfo->bmiHeader); + pCurrentImage += pSourceRect->left * (pVideoInfo->bmiHeader.biBitCount / 8); + + // Even money on this GP faulting sometime... + + for(LONG Line = 0;Line < HEIGHT(pSourceRect);Line++) { + CopyMemory((PVOID)pImageData, (PVOID)pCurrentImage, ScanLine); + pImageData += DIBWIDTHBYTES(*(BITMAPINFOHEADER *)pVideoImage); + pCurrentImage += DIBWIDTHBYTES(pVideoInfo->bmiHeader); + } + return NOERROR; +} + + +// Called when we change media types either during connection or dynamically +// We inform the filter graph and therefore the application that the video +// size may have changed, we don't bother looking to see if it really has as +// we leave that to the application - the dimensions are the event parameters + +HRESULT CBaseControlVideo::OnVideoSizeChange() { + // Get the video format from the derived class + + VIDEOINFOHEADER *pVideoInfo = GetVideoFormat(); + if(pVideoInfo == NULL) + return E_OUTOFMEMORY; + WORD Width = (WORD) pVideoInfo->bmiHeader.biWidth; + WORD Height = (WORD) pVideoInfo->bmiHeader.biHeight; + + return m_pFilter->NotifyEvent(EC_VIDEO_SIZE_CHANGED, + MAKELPARAM(Width,Height), + MAKEWPARAM(0,0)); +} + + +// Set the video source rectangle. We must check the source rectangle against +// the actual video dimensions otherwise when we come to draw the pictures we +// get access violations as GDI tries to touch data outside of the image data +// Although we store the rectangle in left, top, right and bottom coordinates +// instead of left, top, width and height as OLE uses we do take into account +// that the rectangle is used up to, but not including, the right column and +// bottom row of pixels, see the Win32 documentation on RECT for more details + +HRESULT CBaseControlVideo::CheckSourceRect(RECT *pSourceRect) { + CheckPointer(pSourceRect,E_POINTER); + LONG Width,Height; + GetVideoSize(&Width,&Height); + + // Check the coordinates are greater than zero + // and that the rectangle is valid (leftleft >= pSourceRect->right) || + (pSourceRect->left < 0) || + (pSourceRect->top >= pSourceRect->bottom) || + (pSourceRect->top < 0)) { + + return E_INVALIDARG; + } + + // Check the coordinates are less than the extents + + if((pSourceRect->right > Width) || + (pSourceRect->bottom > Height)) { + + return E_INVALIDARG; + } + return NOERROR; +} + + +// Check the target rectangle has some valid coordinates, which amounts to +// little more than checking the destination rectangle isn't empty. Derived +// classes may call this when they have their SetTargetRect method called to +// check the rectangle validity, we do not update the rectangles passed in +// Although we store the rectangle in left, top, right and bottom coordinates +// instead of left, top, width and height as OLE uses we do take into account +// that the rectangle is used up to, but not including, the right column and +// bottom row of pixels, see the Win32 documentation on RECT for more details + +HRESULT CBaseControlVideo::CheckTargetRect(RECT *pTargetRect) { + // Check the pointer is valid + + if(pTargetRect == NULL) { + return E_POINTER; + } + + // These overflow the WIDTH and HEIGHT checks + + if(pTargetRect->left > pTargetRect->right || + pTargetRect->top > pTargetRect->bottom) { + return E_INVALIDARG; + } + + // Check the rectangle has valid coordinates + + if(WIDTH(pTargetRect) <= 0 || HEIGHT(pTargetRect) <= 0) { + return E_INVALIDARG; + } + + ASSERT(IsRectEmpty(pTargetRect) == FALSE); + return NOERROR; +} + + diff --git a/src/BaseClasses/winctrl.h b/src/BaseClasses/winctrl.h index 11d2ed42d3..cd90697869 100644 --- a/src/BaseClasses/winctrl.h +++ b/src/BaseClasses/winctrl.h @@ -1,224 +1,224 @@ -//------------------------------------------------------------------------------ -// File: WinCtrl.h -// -// Desc: DirectShow base classes - defines classes for video control -// interfaces. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __WINCTRL__ -#define __WINCTRL__ - -#define ABSOL(x) (x < 0 ? -x : x) -#define NEGAT(x) (x > 0 ? -x : x) - -// Helper -BOOL WINAPI PossiblyEatMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - -class CBaseControlWindow : public CBaseVideoWindow, public CBaseWindow -{ -protected: - - CBaseFilter *m_pFilter; // Pointer to owning media filter - CBasePin *m_pPin; // Controls media types for connection - CCritSec *m_pInterfaceLock; // Externally defined critical section - COLORREF m_BorderColour; // Current window border colour - BOOL m_bAutoShow; // What happens when the state changes - HWND m_hwndOwner; // Owner window that we optionally have - HWND m_hwndDrain; // HWND to post any messages received - BOOL m_bCursorHidden; // Should we hide the window cursor - -public: - - // Internal methods for other objects to get information out - - HRESULT DoSetWindowStyle(long Style,long WindowLong); - HRESULT DoGetWindowStyle(long *pStyle,long WindowLong); - BOOL IsAutoShowEnabled() { return m_bAutoShow; }; - COLORREF GetBorderColour() { return m_BorderColour; }; - HWND GetOwnerWindow() { return m_hwndOwner; }; - BOOL IsCursorHidden() { return m_bCursorHidden; }; - - inline BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) - { - return ::PossiblyEatMessage(m_hwndDrain, uMsg, wParam, lParam); - } - - // Derived classes must call this to set the pin the filter is using - // We don't have the pin passed in to the constructor (as we do with - // the CBaseFilter object) because filters typically create the - // pins dynamically when requested in CBaseFilter::GetPin. This can - // not be called from our constructor because is is a virtual method - - void SetControlWindowPin(CBasePin *pPin) { - m_pPin = pPin; - } - -public: - - CBaseControlWindow(CBaseFilter *pFilter, // Owning media filter - CCritSec *pInterfaceLock, // Locking object - TCHAR *pName, // Object description - LPUNKNOWN pUnk, // Normal COM ownership - HRESULT *phr); // OLE return code - - // These are the properties we support - - STDMETHODIMP put_Caption(BSTR strCaption); - STDMETHODIMP get_Caption(BSTR *pstrCaption); - STDMETHODIMP put_AutoShow(long AutoShow); - STDMETHODIMP get_AutoShow(long *AutoShow); - STDMETHODIMP put_WindowStyle(long WindowStyle); - STDMETHODIMP get_WindowStyle(long *pWindowStyle); - STDMETHODIMP put_WindowStyleEx(long WindowStyleEx); - STDMETHODIMP get_WindowStyleEx(long *pWindowStyleEx); - STDMETHODIMP put_WindowState(long WindowState); - STDMETHODIMP get_WindowState(long *pWindowState); - STDMETHODIMP put_BackgroundPalette(long BackgroundPalette); - STDMETHODIMP get_BackgroundPalette(long *pBackgroundPalette); - STDMETHODIMP put_Visible(long Visible); - STDMETHODIMP get_Visible(long *pVisible); - STDMETHODIMP put_Left(long Left); - STDMETHODIMP get_Left(long *pLeft); - STDMETHODIMP put_Width(long Width); - STDMETHODIMP get_Width(long *pWidth); - STDMETHODIMP put_Top(long Top); - STDMETHODIMP get_Top(long *pTop); - STDMETHODIMP put_Height(long Height); - STDMETHODIMP get_Height(long *pHeight); - STDMETHODIMP put_Owner(OAHWND Owner); - STDMETHODIMP get_Owner(OAHWND *Owner); - STDMETHODIMP put_MessageDrain(OAHWND Drain); - STDMETHODIMP get_MessageDrain(OAHWND *Drain); - STDMETHODIMP get_BorderColor(long *Color); - STDMETHODIMP put_BorderColor(long Color); - STDMETHODIMP get_FullScreenMode(long *FullScreenMode); - STDMETHODIMP put_FullScreenMode(long FullScreenMode); - - // And these are the methods - - STDMETHODIMP SetWindowForeground(long Focus); - STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd,long uMsg,LONG_PTR wParam,LONG_PTR lParam); - STDMETHODIMP GetMinIdealImageSize(long *pWidth,long *pHeight); - STDMETHODIMP GetMaxIdealImageSize(long *pWidth,long *pHeight); - STDMETHODIMP SetWindowPosition(long Left,long Top,long Width,long Height); - STDMETHODIMP GetWindowPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); - STDMETHODIMP GetRestorePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); - STDMETHODIMP HideCursor(long HideCursor); - STDMETHODIMP IsCursorHidden(long *CursorHidden); -}; - -// This class implements the IBasicVideo interface - -class CBaseControlVideo : public CBaseBasicVideo -{ -protected: - - CBaseFilter *m_pFilter; // Pointer to owning media filter - CBasePin *m_pPin; // Controls media types for connection - CCritSec *m_pInterfaceLock; // Externally defined critical section - -public: - - // Derived classes must provide these for the implementation - - virtual HRESULT IsDefaultTargetRect() PURE; - virtual HRESULT SetDefaultTargetRect() PURE; - virtual HRESULT SetTargetRect(RECT *pTargetRect) PURE; - virtual HRESULT GetTargetRect(RECT *pTargetRect) PURE; - virtual HRESULT IsDefaultSourceRect() PURE; - virtual HRESULT SetDefaultSourceRect() PURE; - virtual HRESULT SetSourceRect(RECT *pSourceRect) PURE; - virtual HRESULT GetSourceRect(RECT *pSourceRect) PURE; - virtual HRESULT GetStaticImage(long *pBufferSize,long *pDIBImage) PURE; - - // Derived classes must override this to return a VIDEOINFO representing - // the video format. We cannot call IPin ConnectionMediaType to get this - // format because various filters dynamically change the type when using - // DirectDraw such that the format shows the position of the logical - // bitmap in a frame buffer surface, so the size might be returned as - // 1024x768 pixels instead of 320x240 which is the real video dimensions - - virtual VIDEOINFOHEADER *GetVideoFormat() PURE; - - // Helper functions for creating memory renderings of a DIB image - - HRESULT GetImageSize(VIDEOINFOHEADER *pVideoInfo, - LONG *pBufferSize, - RECT *pSourceRect); - - HRESULT CopyImage(IMediaSample *pMediaSample, - VIDEOINFOHEADER *pVideoInfo, - LONG *pBufferSize, - BYTE *pVideoImage, - RECT *pSourceRect); - - // Override this if you want notifying when the rectangles change - virtual HRESULT OnUpdateRectangles() { return NOERROR; }; - virtual HRESULT OnVideoSizeChange(); - - // Derived classes must call this to set the pin the filter is using - // We don't have the pin passed in to the constructor (as we do with - // the CBaseFilter object) because filters typically create the - // pins dynamically when requested in CBaseFilter::GetPin. This can - // not be called from our constructor because is is a virtual method - - void SetControlVideoPin(CBasePin *pPin) { - m_pPin = pPin; - } - - // Helper methods for checking rectangles - virtual HRESULT CheckSourceRect(RECT *pSourceRect); - virtual HRESULT CheckTargetRect(RECT *pTargetRect); - -public: - - CBaseControlVideo(CBaseFilter *pFilter, // Owning media filter - CCritSec *pInterfaceLock, // Serialise interface - TCHAR *pName, // Object description - LPUNKNOWN pUnk, // Normal COM ownership - HRESULT *phr); // OLE return code - - // These are the properties we support - - STDMETHODIMP get_AvgTimePerFrame(REFTIME *pAvgTimePerFrame); - STDMETHODIMP get_BitRate(long *pBitRate); - STDMETHODIMP get_BitErrorRate(long *pBitErrorRate); - STDMETHODIMP get_VideoWidth(long *pVideoWidth); - STDMETHODIMP get_VideoHeight(long *pVideoHeight); - STDMETHODIMP put_SourceLeft(long SourceLeft); - STDMETHODIMP get_SourceLeft(long *pSourceLeft); - STDMETHODIMP put_SourceWidth(long SourceWidth); - STDMETHODIMP get_SourceWidth(long *pSourceWidth); - STDMETHODIMP put_SourceTop(long SourceTop); - STDMETHODIMP get_SourceTop(long *pSourceTop); - STDMETHODIMP put_SourceHeight(long SourceHeight); - STDMETHODIMP get_SourceHeight(long *pSourceHeight); - STDMETHODIMP put_DestinationLeft(long DestinationLeft); - STDMETHODIMP get_DestinationLeft(long *pDestinationLeft); - STDMETHODIMP put_DestinationWidth(long DestinationWidth); - STDMETHODIMP get_DestinationWidth(long *pDestinationWidth); - STDMETHODIMP put_DestinationTop(long DestinationTop); - STDMETHODIMP get_DestinationTop(long *pDestinationTop); - STDMETHODIMP put_DestinationHeight(long DestinationHeight); - STDMETHODIMP get_DestinationHeight(long *pDestinationHeight); - - // And these are the methods - - STDMETHODIMP GetVideoSize(long *pWidth,long *pHeight); - STDMETHODIMP SetSourcePosition(long Left,long Top,long Width,long Height); - STDMETHODIMP GetSourcePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); - STDMETHODIMP GetVideoPaletteEntries(long StartIndex,long Entries,long *pRetrieved,long *pPalette); - STDMETHODIMP SetDefaultSourcePosition(); - STDMETHODIMP IsUsingDefaultSource(); - STDMETHODIMP SetDestinationPosition(long Left,long Top,long Width,long Height); - STDMETHODIMP GetDestinationPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); - STDMETHODIMP SetDefaultDestinationPosition(); - STDMETHODIMP IsUsingDefaultDestination(); - STDMETHODIMP GetCurrentImage(long *pBufferSize,long *pVideoImage); -}; - -#endif // __WINCTRL__ - +//------------------------------------------------------------------------------ +// File: WinCtrl.h +// +// Desc: DirectShow base classes - defines classes for video control +// interfaces. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __WINCTRL__ +#define __WINCTRL__ + +#define ABSOL(x) (x < 0 ? -x : x) +#define NEGAT(x) (x > 0 ? -x : x) + +// Helper +BOOL WINAPI PossiblyEatMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +class CBaseControlWindow : public CBaseVideoWindow, public CBaseWindow +{ +protected: + + CBaseFilter *m_pFilter; // Pointer to owning media filter + CBasePin *m_pPin; // Controls media types for connection + CCritSec *m_pInterfaceLock; // Externally defined critical section + COLORREF m_BorderColour; // Current window border colour + BOOL m_bAutoShow; // What happens when the state changes + HWND m_hwndOwner; // Owner window that we optionally have + HWND m_hwndDrain; // HWND to post any messages received + BOOL m_bCursorHidden; // Should we hide the window cursor + +public: + + // Internal methods for other objects to get information out + + HRESULT DoSetWindowStyle(long Style,long WindowLong); + HRESULT DoGetWindowStyle(long *pStyle,long WindowLong); + BOOL IsAutoShowEnabled() { return m_bAutoShow; }; + COLORREF GetBorderColour() { return m_BorderColour; }; + HWND GetOwnerWindow() { return m_hwndOwner; }; + BOOL IsCursorHidden() { return m_bCursorHidden; }; + + inline BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) + { + return ::PossiblyEatMessage(m_hwndDrain, uMsg, wParam, lParam); + } + + // Derived classes must call this to set the pin the filter is using + // We don't have the pin passed in to the constructor (as we do with + // the CBaseFilter object) because filters typically create the + // pins dynamically when requested in CBaseFilter::GetPin. This can + // not be called from our constructor because is is a virtual method + + void SetControlWindowPin(CBasePin *pPin) { + m_pPin = pPin; + } + +public: + + CBaseControlWindow(CBaseFilter *pFilter, // Owning media filter + CCritSec *pInterfaceLock, // Locking object + TCHAR *pName, // Object description + LPUNKNOWN pUnk, // Normal COM ownership + HRESULT *phr); // OLE return code + + // These are the properties we support + + STDMETHODIMP put_Caption(BSTR strCaption); + STDMETHODIMP get_Caption(BSTR *pstrCaption); + STDMETHODIMP put_AutoShow(long AutoShow); + STDMETHODIMP get_AutoShow(long *AutoShow); + STDMETHODIMP put_WindowStyle(long WindowStyle); + STDMETHODIMP get_WindowStyle(long *pWindowStyle); + STDMETHODIMP put_WindowStyleEx(long WindowStyleEx); + STDMETHODIMP get_WindowStyleEx(long *pWindowStyleEx); + STDMETHODIMP put_WindowState(long WindowState); + STDMETHODIMP get_WindowState(long *pWindowState); + STDMETHODIMP put_BackgroundPalette(long BackgroundPalette); + STDMETHODIMP get_BackgroundPalette(long *pBackgroundPalette); + STDMETHODIMP put_Visible(long Visible); + STDMETHODIMP get_Visible(long *pVisible); + STDMETHODIMP put_Left(long Left); + STDMETHODIMP get_Left(long *pLeft); + STDMETHODIMP put_Width(long Width); + STDMETHODIMP get_Width(long *pWidth); + STDMETHODIMP put_Top(long Top); + STDMETHODIMP get_Top(long *pTop); + STDMETHODIMP put_Height(long Height); + STDMETHODIMP get_Height(long *pHeight); + STDMETHODIMP put_Owner(OAHWND Owner); + STDMETHODIMP get_Owner(OAHWND *Owner); + STDMETHODIMP put_MessageDrain(OAHWND Drain); + STDMETHODIMP get_MessageDrain(OAHWND *Drain); + STDMETHODIMP get_BorderColor(long *Color); + STDMETHODIMP put_BorderColor(long Color); + STDMETHODIMP get_FullScreenMode(long *FullScreenMode); + STDMETHODIMP put_FullScreenMode(long FullScreenMode); + + // And these are the methods + + STDMETHODIMP SetWindowForeground(long Focus); + STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd,long uMsg,LONG_PTR wParam,LONG_PTR lParam); + STDMETHODIMP GetMinIdealImageSize(long *pWidth,long *pHeight); + STDMETHODIMP GetMaxIdealImageSize(long *pWidth,long *pHeight); + STDMETHODIMP SetWindowPosition(long Left,long Top,long Width,long Height); + STDMETHODIMP GetWindowPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); + STDMETHODIMP GetRestorePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); + STDMETHODIMP HideCursor(long HideCursor); + STDMETHODIMP IsCursorHidden(long *CursorHidden); +}; + +// This class implements the IBasicVideo interface + +class CBaseControlVideo : public CBaseBasicVideo +{ +protected: + + CBaseFilter *m_pFilter; // Pointer to owning media filter + CBasePin *m_pPin; // Controls media types for connection + CCritSec *m_pInterfaceLock; // Externally defined critical section + +public: + + // Derived classes must provide these for the implementation + + virtual HRESULT IsDefaultTargetRect() PURE; + virtual HRESULT SetDefaultTargetRect() PURE; + virtual HRESULT SetTargetRect(RECT *pTargetRect) PURE; + virtual HRESULT GetTargetRect(RECT *pTargetRect) PURE; + virtual HRESULT IsDefaultSourceRect() PURE; + virtual HRESULT SetDefaultSourceRect() PURE; + virtual HRESULT SetSourceRect(RECT *pSourceRect) PURE; + virtual HRESULT GetSourceRect(RECT *pSourceRect) PURE; + virtual HRESULT GetStaticImage(long *pBufferSize,long *pDIBImage) PURE; + + // Derived classes must override this to return a VIDEOINFO representing + // the video format. We cannot call IPin ConnectionMediaType to get this + // format because various filters dynamically change the type when using + // DirectDraw such that the format shows the position of the logical + // bitmap in a frame buffer surface, so the size might be returned as + // 1024x768 pixels instead of 320x240 which is the real video dimensions + + virtual VIDEOINFOHEADER *GetVideoFormat() PURE; + + // Helper functions for creating memory renderings of a DIB image + + HRESULT GetImageSize(VIDEOINFOHEADER *pVideoInfo, + LONG *pBufferSize, + RECT *pSourceRect); + + HRESULT CopyImage(IMediaSample *pMediaSample, + VIDEOINFOHEADER *pVideoInfo, + LONG *pBufferSize, + BYTE *pVideoImage, + RECT *pSourceRect); + + // Override this if you want notifying when the rectangles change + virtual HRESULT OnUpdateRectangles() { return NOERROR; }; + virtual HRESULT OnVideoSizeChange(); + + // Derived classes must call this to set the pin the filter is using + // We don't have the pin passed in to the constructor (as we do with + // the CBaseFilter object) because filters typically create the + // pins dynamically when requested in CBaseFilter::GetPin. This can + // not be called from our constructor because is is a virtual method + + void SetControlVideoPin(CBasePin *pPin) { + m_pPin = pPin; + } + + // Helper methods for checking rectangles + virtual HRESULT CheckSourceRect(RECT *pSourceRect); + virtual HRESULT CheckTargetRect(RECT *pTargetRect); + +public: + + CBaseControlVideo(CBaseFilter *pFilter, // Owning media filter + CCritSec *pInterfaceLock, // Serialise interface + TCHAR *pName, // Object description + LPUNKNOWN pUnk, // Normal COM ownership + HRESULT *phr); // OLE return code + + // These are the properties we support + + STDMETHODIMP get_AvgTimePerFrame(REFTIME *pAvgTimePerFrame); + STDMETHODIMP get_BitRate(long *pBitRate); + STDMETHODIMP get_BitErrorRate(long *pBitErrorRate); + STDMETHODIMP get_VideoWidth(long *pVideoWidth); + STDMETHODIMP get_VideoHeight(long *pVideoHeight); + STDMETHODIMP put_SourceLeft(long SourceLeft); + STDMETHODIMP get_SourceLeft(long *pSourceLeft); + STDMETHODIMP put_SourceWidth(long SourceWidth); + STDMETHODIMP get_SourceWidth(long *pSourceWidth); + STDMETHODIMP put_SourceTop(long SourceTop); + STDMETHODIMP get_SourceTop(long *pSourceTop); + STDMETHODIMP put_SourceHeight(long SourceHeight); + STDMETHODIMP get_SourceHeight(long *pSourceHeight); + STDMETHODIMP put_DestinationLeft(long DestinationLeft); + STDMETHODIMP get_DestinationLeft(long *pDestinationLeft); + STDMETHODIMP put_DestinationWidth(long DestinationWidth); + STDMETHODIMP get_DestinationWidth(long *pDestinationWidth); + STDMETHODIMP put_DestinationTop(long DestinationTop); + STDMETHODIMP get_DestinationTop(long *pDestinationTop); + STDMETHODIMP put_DestinationHeight(long DestinationHeight); + STDMETHODIMP get_DestinationHeight(long *pDestinationHeight); + + // And these are the methods + + STDMETHODIMP GetVideoSize(long *pWidth,long *pHeight); + STDMETHODIMP SetSourcePosition(long Left,long Top,long Width,long Height); + STDMETHODIMP GetSourcePosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); + STDMETHODIMP GetVideoPaletteEntries(long StartIndex,long Entries,long *pRetrieved,long *pPalette); + STDMETHODIMP SetDefaultSourcePosition(); + STDMETHODIMP IsUsingDefaultSource(); + STDMETHODIMP SetDestinationPosition(long Left,long Top,long Width,long Height); + STDMETHODIMP GetDestinationPosition(long *pLeft,long *pTop,long *pWidth,long *pHeight); + STDMETHODIMP SetDefaultDestinationPosition(); + STDMETHODIMP IsUsingDefaultDestination(); + STDMETHODIMP GetCurrentImage(long *pBufferSize,long *pVideoImage); +}; + +#endif // __WINCTRL__ + diff --git a/src/BaseClasses/winutil.cpp b/src/BaseClasses/winutil.cpp index 3899dba24f..df9c10dc0d 100644 --- a/src/BaseClasses/winutil.cpp +++ b/src/BaseClasses/winutil.cpp @@ -1,2696 +1,2696 @@ -//------------------------------------------------------------------------------ -// File: WinUtil.cpp -// -// Desc: DirectShow base classes - implements generic window handler class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#include -#include -#include -#include - -static UINT MsgDestroy; - -// Constructor - -CBaseWindow::CBaseWindow(BOOL bDoGetDC, bool bDoPostToDestroy) : - m_hInstance(g_hInst), - m_hwnd(NULL), - m_hdc(NULL), - m_bActivated(FALSE), - m_pClassName(NULL), - m_ClassStyles(0), - m_WindowStyles(0), - m_WindowStylesEx(0), - m_ShowStageMessage(0), - m_ShowStageTop(0), - m_MemoryDC(NULL), - m_hPalette(NULL), - m_bBackground(FALSE), -#ifdef DEBUG - m_bRealizing(FALSE), -#endif - m_bNoRealize(FALSE), - m_bDoPostToDestroy(bDoPostToDestroy) -{ - m_bDoGetDC = bDoGetDC; -} - - -// Prepare a window by spinning off a worker thread to do the creation and -// also poll the message input queue. We leave this to be called by derived -// classes because they might want to override methods like MessageLoop and -// InitialiseWindow, if we do this during construction they'll ALWAYS call -// this base class methods. We make the worker thread create the window so -// it owns it rather than the filter graph thread which is constructing us - -HRESULT CBaseWindow::PrepareWindow() -{ - if (m_hwnd) return NOERROR; - ASSERT(m_hwnd == NULL); - ASSERT(m_hdc == NULL); - - // Get the derived object's window and class styles - - m_pClassName = GetClassWindowStyles(&m_ClassStyles, - &m_WindowStyles, - &m_WindowStylesEx); - if (m_pClassName == NULL) { - return E_FAIL; - } - - // Register our special private messages - m_ShowStageMessage = RegisterWindowMessage(SHOWSTAGE); - - // RegisterWindowMessage() returns 0 if an error occurs. - if (0 == m_ShowStageMessage) { - return AmGetLastErrorToHResult(); - } - - m_ShowStageTop = RegisterWindowMessage(SHOWSTAGETOP); - if (0 == m_ShowStageTop) { - return AmGetLastErrorToHResult(); - } - - m_RealizePalette = RegisterWindowMessage(REALIZEPALETTE); - if (0 == m_RealizePalette) { - return AmGetLastErrorToHResult(); - } - - MsgDestroy = RegisterWindowMessage(TEXT("AM_DESTROY")); - if (0 == MsgDestroy) { - return AmGetLastErrorToHResult(); - } - - return DoCreateWindow(); -} - - -// Destructor just a placeholder so that we know it becomes virtual -// Derived classes MUST call DoneWithWindow in their destructors so -// that no messages arrive after the derived class constructor ends - -#ifdef DEBUG -CBaseWindow::~CBaseWindow() -{ - ASSERT(m_hwnd == NULL); - ASSERT(m_hdc == NULL); -} -#endif - - -// We use the sync worker event to have the window destroyed. All we do is -// signal the event and wait on the window thread handle. Trying to send it -// messages causes too many problems, furthermore to be on the safe side we -// just wait on the thread handle while it returns WAIT_TIMEOUT or there is -// a sent message to process on this thread. If the constructor failed to -// create the thread in the first place then the loop will get terminated - -HRESULT CBaseWindow::DoneWithWindow() -{ - // - // Before doing anything, check that someone has not already killed the - // Video Renderer window. If it has been killed we need to tidy up - // a DC that the window was using. If we don't do this check - // the following GetWindowThreadProcessId test fails, but the SendMessage - // goes nowhere and we leak the DC. - // - if (!IsWindow(m_hwnd)) { - - // - // This is not a leak, the window manager automatically free's - // hdc's that were got via GetDC, which is the case here. - // We set it to NULL so that we don't get any asserts later. - // - m_hdc = NULL; - - // - // We need to free this DC though because USER32 does not know - // anything about it. - // - if (m_MemoryDC) - { - EXECUTE_ASSERT(DeleteDC(m_MemoryDC)); - m_MemoryDC = NULL; - } - - // Reset the window variables - m_hwnd = NULL; - return NOERROR; - } - - - if (GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId()) { - - if (m_bDoPostToDestroy) { - - CAMEvent m_evDone; - - // We must post a message to destroy the window - // That way we can't be in the middle of processing a - // message posted to our window when we do go away - // Sending a message gives less synchronization. - PostMessage(m_hwnd, MsgDestroy, (WPARAM)(HANDLE)m_evDone, 0); - WaitDispatchingMessages(m_evDone, INFINITE); - } else { - SendMessage(m_hwnd, MsgDestroy, 0, 0); - } - return NOERROR; - } - const HWND hwnd = m_hwnd; - if (hwnd == NULL) { - return NOERROR; - } - - InactivateWindow(); - NOTE("Inactivated"); - - // Reset the window styles before destruction - - SetWindowLong(hwnd,GWL_STYLE,m_WindowStyles); - ASSERT(GetParent(hwnd) == NULL); - NOTE1("Reset window styles %d",m_WindowStyles); - - // UnintialiseWindow sets m_hwnd to NULL so save a copy - UninitialiseWindow(); - DbgLog((LOG_TRACE, 2, TEXT("Destroying 0x%8.8X"), hwnd)); - if (!DestroyWindow(hwnd)) { - DbgLog((LOG_TRACE, 0, TEXT("DestroyWindow %8.8X failed code %d"), - hwnd, GetLastError())); - DbgBreak(""); - } - - // Reset our state so we can be prepared again - - m_pClassName = NULL; - m_ClassStyles = 0; - m_WindowStyles = 0; - m_WindowStylesEx = 0; - m_ShowStageMessage = 0; - m_ShowStageTop = 0; - - return NOERROR; -} - - -// Called at the end to put the window in an inactive state. The pending list -// will always have been cleared by this time so event if the worker thread -// gets has been signaled and gets in to render something it will find both -// the state has been changed and that there are no available sample images -// Since we wait on the window thread to complete we don't lock the object - -HRESULT CBaseWindow::InactivateWindow() -{ - // Has the window been activated - if (m_bActivated == FALSE) { - return S_FALSE; - } - - m_bActivated = FALSE; - ShowWindow(m_hwnd,SW_HIDE); - return NOERROR; -} - - -HRESULT CBaseWindow::CompleteConnect() -{ - m_bActivated = FALSE; - return NOERROR; -} - -// This displays a normal window. We ask the base window class for default -// sizes which unless overriden will return DEFWIDTH and DEFHEIGHT. We go -// through a couple of extra hoops to get the client area the right size -// as the object specifies which accounts for the AdjustWindowRectEx calls -// We also DWORD align the left and top coordinates of the window here to -// maximise the chance of being able to use DCI/DirectDraw primary surface - -HRESULT CBaseWindow::ActivateWindow() -{ - // Has the window been sized and positioned already - - if (m_bActivated == TRUE || GetParent(m_hwnd) != NULL) { - - SetWindowPos(m_hwnd, // Our window handle - HWND_TOP, // Put it at the top - 0, 0, 0, 0, // Leave in current position - SWP_NOMOVE | // Don't change it's place - SWP_NOSIZE); // Change Z-order only - - m_bActivated = TRUE; - return S_FALSE; - } - - // Calculate the desired client rectangle - - RECT WindowRect, ClientRect = GetDefaultRect(); - GetWindowRect(m_hwnd,&WindowRect); - AdjustWindowRectEx(&ClientRect,GetWindowLong(m_hwnd,GWL_STYLE), - FALSE,GetWindowLong(m_hwnd,GWL_EXSTYLE)); - - // Align left and top edges on DWORD boundaries - - UINT WindowFlags = (SWP_NOACTIVATE | SWP_FRAMECHANGED); - WindowRect.left -= (WindowRect.left & 3); - WindowRect.top -= (WindowRect.top & 3); - - SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - WindowRect.left, // Align left edge - WindowRect.top, // And also top place - WIDTH(&ClientRect), // Horizontal size - HEIGHT(&ClientRect), // Vertical size - WindowFlags); // Don't show window - - m_bActivated = TRUE; - return NOERROR; -} - - -// This can be used to DWORD align the window for maximum performance - -HRESULT CBaseWindow::PerformanceAlignWindow() -{ - RECT ClientRect,WindowRect; - GetWindowRect(m_hwnd,&WindowRect); - ASSERT(m_bActivated == TRUE); - - // Don't do this if we're owned - - if (GetParent(m_hwnd)) { - return NOERROR; - } - - // Align left and top edges on DWORD boundaries - - GetClientRect(m_hwnd, &ClientRect); - MapWindowPoints(m_hwnd, HWND_DESKTOP, (LPPOINT) &ClientRect, 2); - WindowRect.left -= (ClientRect.left & 3); - WindowRect.top -= (ClientRect.top & 3); - UINT WindowFlags = (SWP_NOACTIVATE | SWP_NOSIZE); - - SetWindowPos(m_hwnd, // Window handle - HWND_TOP, // Put it at the top - WindowRect.left, // Align left edge - WindowRect.top, // And also top place - (int) 0,(int) 0, // Ignore these sizes - WindowFlags); // Don't show window - - return NOERROR; -} - - -// Install a palette into the base window - we may be called by a different -// thread to the one that owns the window. We have to be careful how we do -// the palette realisation as we could be a different thread to the window -// which would cause an inter thread send message. Therefore we realise the -// palette by sending it a special message but without the window locked - -HRESULT CBaseWindow::SetPalette(HPALETTE hPalette) -{ - // We must own the window lock during the change - { - CAutoLock cWindowLock(&m_WindowLock); - CAutoLock cPaletteLock(&m_PaletteLock); - ASSERT(hPalette); - m_hPalette = hPalette; - } - return SetPalette(); -} - - -HRESULT CBaseWindow::SetPalette() -{ - if (!m_bNoRealize) { - SendMessage(m_hwnd, m_RealizePalette, 0, 0); - return S_OK; - } else { - // Just select the palette - ASSERT(m_hdc); - ASSERT(m_MemoryDC); - - CAutoLock cPaletteLock(&m_PaletteLock); - SelectPalette(m_hdc,m_hPalette,m_bBackground); - SelectPalette(m_MemoryDC,m_hPalette,m_bBackground); - - return S_OK; - } -} - - -void CBaseWindow::UnsetPalette() -{ - CAutoLock cWindowLock(&m_WindowLock); - CAutoLock cPaletteLock(&m_PaletteLock); - - // Get a standard VGA colour palette - - HPALETTE hPalette = (HPALETTE) GetStockObject(DEFAULT_PALETTE); - ASSERT(hPalette); - - SelectPalette(GetWindowHDC(), hPalette, TRUE); - SelectPalette(GetMemoryHDC(), hPalette, TRUE); - - m_hPalette = NULL; -} - - -void CBaseWindow::LockPaletteLock() -{ - m_PaletteLock.Lock(); -} - - -void CBaseWindow::UnlockPaletteLock() -{ - m_PaletteLock.Unlock(); -} - - -// Realise our palettes in the window and device contexts - -HRESULT CBaseWindow::DoRealisePalette(BOOL bForceBackground) -{ - { - CAutoLock cPaletteLock(&m_PaletteLock); - - if (m_hPalette == NULL) { - return NOERROR; - } - - // Realize the palette on the window thread - ASSERT(m_hdc); - ASSERT(m_MemoryDC); - - SelectPalette(m_hdc,m_hPalette,m_bBackground || bForceBackground); - SelectPalette(m_MemoryDC,m_hPalette,m_bBackground); - } - - // If we grab a critical section here we can deadlock - // with the window thread because one of the side effects - // of RealizePalette is to send a WM_PALETTECHANGED message - // to every window in the system. In our handling - // of WM_PALETTECHANGED we used to grab this CS too. - // The really bad case is when our renderer calls DoRealisePalette() - // while we're in the middle of processing a palette change - // for another window. - // So don't hold the critical section while actually realising - // the palette. In any case USER is meant to manage palette - // handling - we shouldn't have to serialize everything as well - ASSERT(CritCheckOut(&m_WindowLock)); - ASSERT(CritCheckOut(&m_PaletteLock)); - - EXECUTE_ASSERT(RealizePalette(m_hdc) != GDI_ERROR); - EXECUTE_ASSERT(RealizePalette(m_MemoryDC) != GDI_ERROR); - - return (GdiFlush() == FALSE ? S_FALSE : S_OK); -} - - -// This is the global window procedure - -LRESULT CALLBACK WndProc(HWND hwnd, // Window handle - UINT uMsg, // Message ID - WPARAM wParam, // First parameter - LPARAM lParam) // Other parameter -{ - - // Get the window long that holds our window object pointer - // If it is NULL then we are initialising the window in which - // case the object pointer has been passed in the window creation - // structure. IF we get any messages before WM_NCCREATE we will - // pass them to DefWindowProc. - - CBaseWindow *pBaseWindow = (CBaseWindow *)GetWindowLongPtr(hwnd,0); - if (pBaseWindow == NULL) { - - // Get the structure pointer from the create struct. - // We can only do this for WM_NCCREATE which should be one of - // the first messages we receive. Anything before this will - // have to be passed to DefWindowProc (i.e. WM_GETMINMAXINFO) - - // If the message is WM_NCCREATE we set our pBaseWindow pointer - // and will then place it in the window structure - - // turn off WS_EX_LAYOUTRTL style for quartz windows - if (uMsg == WM_NCCREATE) { - SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~0x400000); - } - - if ((uMsg != WM_NCCREATE) - || (NULL == (pBaseWindow = *(CBaseWindow**) ((LPCREATESTRUCT)lParam)->lpCreateParams))) - { - return(DefWindowProc(hwnd, uMsg, wParam, lParam)); - } - - // Set the window LONG to be the object who created us -#ifdef DEBUG - SetLastError(0); // because of the way SetWindowLong works -#endif - LONG_PTR rc = SetWindowLongPtr(hwnd, (DWORD) 0, (LONG_PTR) pBaseWindow); -#ifdef DEBUG - if (0 == rc) { - // SetWindowLong MIGHT have failed. (Read the docs which admit - // that it is awkward to work out if you have had an error.) - LONG lasterror = GetLastError(); - ASSERT(0 == lasterror); - // If this is not the case we have not set the pBaseWindow pointer - // into the window structure and we will blow up. - } -#endif - - } - // See if this is the packet of death - if (uMsg == MsgDestroy && uMsg != 0) { - pBaseWindow->DoneWithWindow(); - if (pBaseWindow->m_bDoPostToDestroy) { - EXECUTE_ASSERT(SetEvent((HANDLE)wParam)); - } - return 0; - } - return pBaseWindow->OnReceiveMessage(hwnd,uMsg,wParam,lParam); -} - - -// When the window size changes we adjust our member variables that -// contain the dimensions of the client rectangle for our window so -// that we come to render an image we will know whether to stretch - -BOOL CBaseWindow::OnSize(LONG Width, LONG Height) -{ - m_Width = Width; - m_Height = Height; - return TRUE; -} - - -// This function handles the WM_CLOSE message - -BOOL CBaseWindow::OnClose() -{ - ShowWindow(m_hwnd,SW_HIDE); - return TRUE; -} - - -// This is called by the worker window thread when it receives a terminate -// message from the window object destructor to delete all the resources we -// allocated during initialisation. By the time the worker thread exits all -// processing will have been completed as the source filter disconnection -// flushes the image pending sample, therefore the GdiFlush should succeed - -HRESULT CBaseWindow::UninitialiseWindow() -{ - // Have we already cleaned up - - if (m_hwnd == NULL) { - ASSERT(m_hdc == NULL); - ASSERT(m_MemoryDC == NULL); - return NOERROR; - } - - // Release the window resources - - EXECUTE_ASSERT(GdiFlush()); - - if (m_hdc) - { - EXECUTE_ASSERT(ReleaseDC(m_hwnd,m_hdc)); - m_hdc = NULL; - } - - if (m_MemoryDC) - { - EXECUTE_ASSERT(DeleteDC(m_MemoryDC)); - m_MemoryDC = NULL; - } - - // Reset the window variables - m_hwnd = NULL; - - return NOERROR; -} - - -// This is called by the worker window thread after it has created the main -// window and it wants to initialise the rest of the owner objects window -// variables such as the device contexts. We execute this function with the -// critical section still locked. Nothing in this function must generate any -// SendMessage calls to the window because this is executing on the window -// thread so the message will never be processed and we will deadlock - -#pragma warning(disable:4706) // C4706: assignment within conditional expression - -HRESULT CBaseWindow::InitialiseWindow(HWND hwnd) -{ - // Initialise the window variables - - ASSERT(IsWindow(hwnd)); - m_hwnd = hwnd; - - if (m_bDoGetDC) - { - EXECUTE_ASSERT(m_hdc = GetDC(hwnd)); - EXECUTE_ASSERT(m_MemoryDC = CreateCompatibleDC(m_hdc)); - - EXECUTE_ASSERT(SetStretchBltMode(m_hdc,COLORONCOLOR)); - EXECUTE_ASSERT(SetStretchBltMode(m_MemoryDC,COLORONCOLOR)); - } - - return NOERROR; -} - -#pragma warning(default:4706) // C4706: assignment within conditional expression - - -HRESULT CBaseWindow::DoCreateWindow() -{ - WNDCLASS wndclass; // Used to register classes - BOOL bRegistered; // Is this class registered - HWND hwnd; // Handle to our window - - bRegistered = GetClassInfo(m_hInstance, // Module instance - m_pClassName, // Window class - &wndclass); // Info structure - - // if the window is to be used for drawing puposes and we are getting a DC - // for the entire lifetime of the window then changes the class style to do - // say so. If we don't set this flag then the DC comes from the cache and is - // really bad. - if (m_bDoGetDC) - { - m_ClassStyles |= CS_OWNDC; - } - - if (bRegistered == FALSE) { - - // Register the renderer window class - - wndclass.lpszClassName = m_pClassName; - wndclass.style = m_ClassStyles; - wndclass.lpfnWndProc = WndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = sizeof(CBaseWindow *); - wndclass.hInstance = m_hInstance; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH) NULL; - wndclass.lpszMenuName = NULL; - - RegisterClass(&wndclass); - } - - // Create the frame window. Pass the pBaseWindow information in the - // CreateStruct which allows our message handling loop to get hold of - // the pBaseWindow pointer. - - CBaseWindow *pBaseWindow = this; // The owner window object - hwnd = CreateWindowEx(m_WindowStylesEx, // Extended styles - m_pClassName, // Registered name - TEXT("ActiveMovie Window"), // Window title - m_WindowStyles, // Window styles - CW_USEDEFAULT, // Start x position - CW_USEDEFAULT, // Start y position - DEFWIDTH, // Window width - DEFHEIGHT, // Window height - NULL, // Parent handle - NULL, // Menu handle - m_hInstance, // Instance handle - &pBaseWindow); // Creation data - - // If we failed signal an error to the object constructor (based on the - // last Win32 error on this thread) then signal the constructor thread - // to continue, release the mutex to let others have a go and exit - - if (hwnd == NULL) { - DWORD Error = GetLastError(); - return AmHresultFromWin32(Error); - } - - // Check the window LONG is the object who created us - ASSERT(GetWindowLongPtr(hwnd, 0) == (LONG_PTR)this); - - // Initialise the window and then signal the constructor so that it can - // continue and then finally unlock the object's critical section. The - // window class is left registered even after we terminate the thread - // as we don't know when the last window has been closed. So we allow - // the operating system to free the class resources as appropriate - - InitialiseWindow(hwnd); - - DbgLog((LOG_TRACE, 2, TEXT("Created window class (%s) HWND(%8.8X)"), - m_pClassName, hwnd)); - - return S_OK; -} - - -// The base class provides some default handling and calls DefWindowProc - -LRESULT CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle - UINT uMsg, // Message ID - WPARAM wParam, // First parameter - LPARAM lParam) // Other parameter -{ - ASSERT(IsWindow(hwnd)); - - if (PossiblyEatMessage(uMsg, wParam, lParam)) - return 0; - - // This is sent by the IVideoWindow SetWindowForeground method. If the - // window is invisible we will show it and make it topmost without the - // foreground focus. If the window is visible it will also be made the - // topmost window without the foreground focus. If wParam is TRUE then - // for both cases the window will be forced into the foreground focus - - if (uMsg == m_ShowStageMessage) { - - BOOL bVisible = IsWindowVisible(hwnd); - SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | - (bVisible ? SWP_NOACTIVATE : 0)); - - // Should we bring the window to the foreground - if (wParam == TRUE) { - SetForegroundWindow(hwnd); - } - return (LRESULT) 1; - } - - // When we go fullscreen we have to add the WS_EX_TOPMOST style to the - // video window so that it comes out above any task bar (this is more - // relevant to WindowsNT than Windows95). However the SetWindowPos call - // must be on the same thread as that which created the window. The - // wParam parameter can be TRUE or FALSE to set and reset the topmost - - if (uMsg == m_ShowStageTop) { - HWND HwndTop = (wParam == TRUE ? HWND_TOPMOST : HWND_NOTOPMOST); - BOOL bVisible = IsWindowVisible(hwnd); - SetWindowPos(hwnd, HwndTop, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | - (wParam == TRUE ? SWP_SHOWWINDOW : 0) | - (bVisible ? SWP_NOACTIVATE : 0)); - return (LRESULT) 1; - } - - // New palette stuff - if (uMsg == m_RealizePalette) { - ASSERT(m_hwnd == hwnd); - return OnPaletteChange(m_hwnd,WM_QUERYNEWPALETTE); - } - - switch (uMsg) { - - // Repaint the window if the system colours change - - case WM_SYSCOLORCHANGE: - - InvalidateRect(hwnd,NULL,FALSE); - return (LRESULT) 1; - - // Somebody has changed the palette - case WM_PALETTECHANGED: - - OnPaletteChange((HWND)wParam,uMsg); - return (LRESULT) 0; - - // We are about to receive the keyboard focus so we ask GDI to realise - // our logical palette again and hopefully it will be fully installed - // without any mapping having to be done during any picture rendering - - case WM_QUERYNEWPALETTE: - ASSERT(m_hwnd == hwnd); - return OnPaletteChange(m_hwnd,uMsg); - - // do NOT fwd WM_MOVE. the parameters are the location of the parent - // window, NOT what the renderer should be looking at. But we need - // to make sure the overlay is moved with the parent window, so we - // do this. - case WM_MOVE: - if (IsWindowVisible(m_hwnd)) { - PostMessage(m_hwnd,WM_PAINT,0,0); - } - break; - - // Store the width and height as useful base class members - - case WM_SIZE: - - OnSize(LOWORD(lParam), HIWORD(lParam)); - return (LRESULT) 0; - - // Intercept the WM_CLOSE messages to hide the window - - case WM_CLOSE: - - OnClose(); - return (LRESULT) 0; - } - return DefWindowProc(hwnd,uMsg,wParam,lParam); -} - - -// This handles the Windows palette change messages - if we do realise our -// palette then we return TRUE otherwise we return FALSE. If our window is -// foreground application then we should get first choice of colours in the -// system palette entries. We get best performance when our logical palette -// includes the standard VGA colours (at the beginning and end) otherwise -// GDI may have to map from our palette to the device palette while drawing - -LRESULT CBaseWindow::OnPaletteChange(HWND hwnd,UINT Message) -{ - // First check we are not changing the palette during closedown - - if (m_hwnd == NULL || hwnd == NULL) { - return (LRESULT) 0; - } - ASSERT(!m_bRealizing); - - // Should we realise our palette again - - if ((Message == WM_QUERYNEWPALETTE || hwnd != m_hwnd)) { - // It seems that even if we're invisible that we can get asked - // to realize our palette and this can cause really ugly side-effects - // Seems like there's another bug but this masks it a least for the - // shutting down case. - if (!IsWindowVisible(m_hwnd)) { - DbgLog((LOG_TRACE, 1, TEXT("Realizing when invisible!"))); - return (LRESULT) 0; - } - - // Avoid recursion with multiple graphs in the same app -#ifdef DEBUG - m_bRealizing = TRUE; -#endif - DoRealisePalette(Message != WM_QUERYNEWPALETTE); -#ifdef DEBUG - m_bRealizing = FALSE; -#endif - - // Should we redraw the window with the new palette - if (Message == WM_PALETTECHANGED) { - InvalidateRect(m_hwnd,NULL,FALSE); - } - } - - return (LRESULT) 1; -} - - -// Determine if the window exists. - -bool CBaseWindow::WindowExists() -{ - return !!IsWindow(m_hwnd); -} - - -// Return the default window rectangle - -RECT CBaseWindow::GetDefaultRect() -{ - RECT DefaultRect = {0,0,DEFWIDTH,DEFHEIGHT}; - ASSERT(m_hwnd); - // ASSERT(m_hdc); - return DefaultRect; -} - - -// Return the current window width - -LONG CBaseWindow::GetWindowWidth() -{ - ASSERT(m_hwnd); - // ASSERT(m_hdc); - return m_Width; -} - - -// Return the current window height - -LONG CBaseWindow::GetWindowHeight() -{ - ASSERT(m_hwnd); - // ASSERT(m_hdc); - return m_Height; -} - - -// Return the window handle - -HWND CBaseWindow::GetWindowHWND() -{ - ASSERT(m_hwnd); - // ASSERT(m_hdc); - return m_hwnd; -} - - -// Return the window drawing device context - -HDC CBaseWindow::GetWindowHDC() -{ - ASSERT(m_hwnd); - ASSERT(m_hdc); - return m_hdc; -} - - -// Return the offscreen window drawing device context - -HDC CBaseWindow::GetMemoryHDC() -{ - ASSERT(m_hwnd); - ASSERT(m_MemoryDC); - return m_MemoryDC; -} - - -#ifdef DEBUG -HPALETTE CBaseWindow::GetPalette() -{ - // The palette lock should always be held when accessing - // m_hPalette. - ASSERT(CritCheckIn(&m_PaletteLock)); - return m_hPalette; -} -#endif // DEBUG - - -// This is available to clients who want to change the window visiblity. It's -// little more than an indirection to the Win32 ShowWindow although these is -// some benefit in going through here as this function may change sometime - -HRESULT CBaseWindow::DoShowWindow(LONG ShowCmd) -{ - ShowWindow(m_hwnd,ShowCmd); - return NOERROR; -} - - -// Generate a WM_PAINT message for the video window - -void CBaseWindow::PaintWindow(BOOL bErase) -{ - InvalidateRect(m_hwnd,NULL,bErase); -} - - -// Allow an application to have us set the video window in the foreground. We -// have this because it is difficult for one thread to do do this to a window -// owned by another thread. Rather than expose the message we use to execute -// the inter thread send message we provide the interface function. All we do -// is to SendMessage to the video window renderer thread with a WM_SHOWSTAGE - -void CBaseWindow::DoSetWindowForeground(BOOL bFocus) -{ - SendMessage(m_hwnd,m_ShowStageMessage,(WPARAM) bFocus,(LPARAM) 0); -} - - -// Constructor initialises the owning object pointer. Since we are a worker -// class for the main window object we have relatively few state variables to -// look after. We are given device context handles to use later on as well as -// the source and destination rectangles (but reset them here just in case) - -CDrawImage::CDrawImage(CBaseWindow *pBaseWindow) : - m_pBaseWindow(pBaseWindow), - m_hdc(NULL), - m_MemoryDC(NULL), - m_bStretch(FALSE), - m_pMediaType(NULL), - m_bUsingImageAllocator(FALSE) -{ - ASSERT(pBaseWindow); - ResetPaletteVersion(); - SetRectEmpty(&m_TargetRect); - SetRectEmpty(&m_SourceRect); - - m_perfidRenderTime = MSR_REGISTER(TEXT("Single Blt time")); -} - - -// Overlay the image time stamps on the picture. Access to this method is -// serialised by the caller. We display the sample start and end times on -// top of the video using TextOut on the device context we are handed. If -// there isn't enough room in the window for the times we don't show them - -void CDrawImage::DisplaySampleTimes(IMediaSample *pSample) -{ -#ifdef DEBUG - // - // Only allow the "annoying" time messages if the users has turned the - // logging "way up" - // - BOOL bAccept = DbgCheckModuleLevel(LOG_TRACE, 5); - if (bAccept == FALSE) { - return; - } -#endif - - TCHAR szTimes[TIMELENGTH]; // Time stamp strings - ASSERT(pSample); // Quick sanity check - RECT ClientRect; // Client window size - SIZE Size; // Size of text output - - // Get the time stamps and window size - - pSample->GetTime((REFERENCE_TIME*)&m_StartSample, (REFERENCE_TIME*)&m_EndSample); - HWND hwnd = m_pBaseWindow->GetWindowHWND(); - EXECUTE_ASSERT(GetClientRect(hwnd,&ClientRect)); - - // Format the sample time stamps - - wsprintf(szTimes,TEXT("%08d : %08d"), - m_StartSample.Millisecs(), - m_EndSample.Millisecs()); - - ASSERT(lstrlen(szTimes) < TIMELENGTH); - - // Put the times in the middle at the bottom of the window - - GetTextExtentPoint32(m_hdc,szTimes,lstrlen(szTimes),&Size); - INT XPos = ((ClientRect.right - ClientRect.left) - Size.cx) / 2; - INT YPos = ((ClientRect.bottom - ClientRect.top) - Size.cy) * 4 / 5; - - // Check the window is big enough to have sample times displayed - - if ((XPos > 0) && (YPos > 0)) { - TextOut(m_hdc,XPos,YPos,szTimes,lstrlen(szTimes)); - } -} - - -// This is called when the drawing code sees that the image has a down level -// palette cookie. We simply call the SetDIBColorTable Windows API with the -// palette that is found after the BITMAPINFOHEADER - we return no errors - -void CDrawImage::UpdateColourTable(HDC hdc,BITMAPINFOHEADER *pbmi) -{ - ASSERT(pbmi->biClrUsed); - RGBQUAD *pColourTable = (RGBQUAD *)(pbmi+1); - - // Set the new palette in the device context - - UINT uiReturn = SetDIBColorTable(hdc,(UINT) 0, - pbmi->biClrUsed, - pColourTable); - - // Should always succeed but check in debug builds - ASSERT(uiReturn == pbmi->biClrUsed); -} - - -// No source rectangle scaling is done by the base class - -RECT CDrawImage::ScaleSourceRect(const RECT *pSource) -{ - ASSERT(pSource); - return *pSource; -} - - -// This is called when the funky output pin uses our allocator. The samples we -// allocate are special because the memory is shared between us and GDI thus -// removing one copy when we ask for the image to be rendered. The source type -// information is in the main renderer m_mtIn field which is initialised when -// the media type is agreed in SetMediaType, the media type may be changed on -// the fly if, for example, the source filter needs to change the palette - -void CDrawImage::FastRender(IMediaSample *pMediaSample) -{ - BITMAPINFOHEADER *pbmi; // Image format data - DIBDATA *pDibData; // Stores DIB information - BYTE *pImage; // Pointer to image data - HBITMAP hOldBitmap; // Store the old bitmap - CImageSample *pSample; // Pointer to C++ object - - ASSERT(m_pMediaType); - - // From the untyped source format block get the VIDEOINFO and subsequently - // the BITMAPINFOHEADER structure. We can cast the IMediaSample interface - // to a CImageSample object so we can retrieve it's DIBSECTION details - - pbmi = HEADER(m_pMediaType->Format()); - pSample = (CImageSample *) pMediaSample; - pDibData = pSample->GetDIBData(); - hOldBitmap = (HBITMAP) SelectObject(m_MemoryDC,pDibData->hBitmap); - - // Get a pointer to the real image data - - HRESULT hr = pMediaSample->GetPointer(&pImage); - if (FAILED(hr)) { - return; - } - - // Do we need to update the colour table, we increment our palette cookie - // each time we get a dynamic format change. The sample palette cookie is - // stored in the DIBDATA structure so we try to keep the fields in sync - // By the time we get to draw the images the format change will be done - // so all we do is ask the renderer for what it's palette version is - - if (pDibData->PaletteVersion < GetPaletteVersion()) { - ASSERT(pbmi->biBitCount <= iPALETTE); - UpdateColourTable(m_MemoryDC,pbmi); - pDibData->PaletteVersion = GetPaletteVersion(); - } - - // This allows derived classes to change the source rectangle that we do - // the drawing with. For example a renderer may ask a codec to stretch - // the video from 320x240 to 640x480, in which case the source we see in - // here will still be 320x240, although the source we want to draw with - // should be scaled up to 640x480. The base class implementation of this - // method does nothing but return the same rectangle as we are passed in - - RECT SourceRect = ScaleSourceRect(&m_SourceRect); - - // Is the window the same size as the video - - if (m_bStretch == FALSE) { - - // Put the image straight into the window - - BitBlt( - (HDC) m_hdc, // Target device HDC - m_TargetRect.left, // X sink position - m_TargetRect.top, // Y sink position - m_TargetRect.right - m_TargetRect.left, // Destination width - m_TargetRect.bottom - m_TargetRect.top, // Destination height - m_MemoryDC, // Source device context - SourceRect.left, // X source position - SourceRect.top, // Y source position - SRCCOPY); // Simple copy - - } else { - - // Stretch the image when copying to the window - - StretchBlt( - (HDC) m_hdc, // Target device HDC - m_TargetRect.left, // X sink position - m_TargetRect.top, // Y sink position - m_TargetRect.right - m_TargetRect.left, // Destination width - m_TargetRect.bottom - m_TargetRect.top, // Destination height - m_MemoryDC, // Source device HDC - SourceRect.left, // X source position - SourceRect.top, // Y source position - SourceRect.right - SourceRect.left, // Source width - SourceRect.bottom - SourceRect.top, // Source height - SRCCOPY); // Simple copy - } - - // This displays the sample times over the top of the image. This used to - // draw the times into the offscreen device context however that actually - // writes the text into the image data buffer which may not be writable - - #ifdef DEBUG - DisplaySampleTimes(pMediaSample); - #endif - - // Put the old bitmap back into the device context so we don't leak - SelectObject(m_MemoryDC,hOldBitmap); -} - - -// This is called when there is a sample ready to be drawn, unfortunately the -// output pin was being rotten and didn't choose our super excellent shared -// memory DIB allocator so we have to do this slow render using boring old GDI -// SetDIBitsToDevice and StretchDIBits. The down side of using these GDI -// functions is that the image data has to be copied across from our address -// space into theirs before going to the screen (although in reality the cost -// is small because all they do is to map the buffer into their address space) - -void CDrawImage::SlowRender(IMediaSample *pMediaSample) -{ - // Get the BITMAPINFOHEADER for the connection - - ASSERT(m_pMediaType); - BITMAPINFOHEADER *pbmi = HEADER(m_pMediaType->Format()); - BYTE *pImage; - - // Get the image data buffer - - HRESULT hr = pMediaSample->GetPointer(&pImage); - if (FAILED(hr)) { - return; - } - - // This allows derived classes to change the source rectangle that we do - // the drawing with. For example a renderer may ask a codec to stretch - // the video from 320x240 to 640x480, in which case the source we see in - // here will still be 320x240, although the source we want to draw with - // should be scaled up to 640x480. The base class implementation of this - // method does nothing but return the same rectangle as we are passed in - - RECT SourceRect = ScaleSourceRect(&m_SourceRect); - - LONG lAdjustedSourceTop = SourceRect.top; - // if the origin of bitmap is bottom-left, adjust soruce_rect_top - // to be the bottom-left corner instead of the top-left. - if (pbmi->biHeight > 0) { - lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom; - } - // Is the window the same size as the video - - if (m_bStretch == FALSE) { - - // Put the image straight into the window - - SetDIBitsToDevice( - (HDC) m_hdc, // Target device HDC - m_TargetRect.left, // X sink position - m_TargetRect.top, // Y sink position - m_TargetRect.right - m_TargetRect.left, // Destination width - m_TargetRect.bottom - m_TargetRect.top, // Destination height - SourceRect.left, // X source position - lAdjustedSourceTop, // Adjusted Y source position - (UINT) 0, // Start scan line - pbmi->biHeight, // Scan lines present - pImage, // Image data - (BITMAPINFO *) pbmi, // DIB header - DIB_RGB_COLORS); // Type of palette - - } else { - - // Stretch the image when copying to the window - - StretchDIBits( - (HDC) m_hdc, // Target device HDC - m_TargetRect.left, // X sink position - m_TargetRect.top, // Y sink position - m_TargetRect.right - m_TargetRect.left, // Destination width - m_TargetRect.bottom - m_TargetRect.top, // Destination height - SourceRect.left, // X source position - lAdjustedSourceTop, // Adjusted Y source position - SourceRect.right - SourceRect.left, // Source width - SourceRect.bottom - SourceRect.top, // Source height - pImage, // Image data - (BITMAPINFO *) pbmi, // DIB header - DIB_RGB_COLORS, // Type of palette - SRCCOPY); // Simple image copy - } - - // This shows the sample reference times over the top of the image which - // looks a little flickery. I tried using GdiSetBatchLimit and GdiFlush to - // control the screen updates but it doesn't quite work as expected and - // only partially reduces the flicker. I also tried using a memory context - // and combining the two in that before doing a final BitBlt operation to - // the screen, unfortunately this has considerable performance penalties - // and also means that this code is not executed when compiled retail - - #ifdef DEBUG - DisplaySampleTimes(pMediaSample); - #endif -} - - -// This is called with an IMediaSample interface on the image to be drawn. We -// decide on the drawing mechanism based on who's allocator we are using. We -// may be called when the window wants an image painted by WM_PAINT messages -// We can't realise the palette here because we have the renderer lock, any -// call to realise may cause an interthread send message to the window thread -// which may in turn be waiting to get the renderer lock before servicing it - -BOOL CDrawImage::DrawImage(IMediaSample *pMediaSample) -{ - ASSERT(m_hdc); - ASSERT(m_MemoryDC); - NotifyStartDraw(); - - // If the output pin used our allocator then the samples passed are in - // fact CVideoSample objects that contain CreateDIBSection data that we - // use to do faster image rendering, they may optionally also contain a - // DirectDraw surface pointer in which case we do not do the drawing - - if (m_bUsingImageAllocator == FALSE) { - SlowRender(pMediaSample); - EXECUTE_ASSERT(GdiFlush()); - NotifyEndDraw(); - return TRUE; - } - - // This is a DIBSECTION buffer - - FastRender(pMediaSample); - EXECUTE_ASSERT(GdiFlush()); - NotifyEndDraw(); - return TRUE; -} - - -BOOL CDrawImage::DrawVideoImageHere( - HDC hdc, - IMediaSample *pMediaSample, - LPRECT lprcSrc, - LPRECT lprcDst - ) -{ - ASSERT(m_pMediaType); - BITMAPINFOHEADER *pbmi = HEADER(m_pMediaType->Format()); - BYTE *pImage; - - // Get the image data buffer - - HRESULT hr = pMediaSample->GetPointer(&pImage); - if (FAILED(hr)) { - return FALSE; - } - - RECT SourceRect; - RECT TargetRect; - - if (lprcSrc) - SourceRect = *lprcSrc; - else - SourceRect = ScaleSourceRect(&m_SourceRect); - - if (lprcDst) - TargetRect = *lprcDst; - else - TargetRect = m_TargetRect; - - LONG lAdjustedSourceTop = SourceRect.top; - // if the origin of bitmap is bottom-left, adjust soruce_rect_top - // to be the bottom-left corner instead of the top-left. - if (pbmi->biHeight > 0) { - lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom; - } - - - // Stretch the image when copying to the DC - - BOOL bRet = (0 != StretchDIBits(hdc, - TargetRect.left, - TargetRect.top, - TargetRect.right - TargetRect.left, - TargetRect.bottom - TargetRect.top, - SourceRect.left, - lAdjustedSourceTop, - SourceRect.right - SourceRect.left, - SourceRect.bottom - SourceRect.top, - pImage, - (BITMAPINFO *)pbmi, - DIB_RGB_COLORS, - SRCCOPY)); - return bRet; -} - - -// This is called by the owning window object after it has created the window -// and it's drawing contexts. We are constructed with the base window we'll -// be drawing into so when given the notification we retrive the device HDCs -// to draw with. We cannot call these in our constructor as they are virtual - -void CDrawImage::SetDrawContext() -{ - m_MemoryDC = m_pBaseWindow->GetMemoryHDC(); - m_hdc = m_pBaseWindow->GetWindowHDC(); -} - - -// This is called to set the target rectangle in the video window, it will be -// called whenever a WM_SIZE message is retrieved from the message queue. We -// simply store the rectangle and use it later when we do the drawing calls - -void CDrawImage::SetTargetRect(RECT *pTargetRect) -{ - ASSERT(pTargetRect); - m_TargetRect = *pTargetRect; - SetStretchMode(); -} - - -// Return the current target rectangle - -void CDrawImage::GetTargetRect(RECT *pTargetRect) -{ - ASSERT(pTargetRect); - *pTargetRect = m_TargetRect; -} - - -// This is called when we want to change the section of the image to draw. We -// use this information in the drawing operation calls later on. We must also -// see if the source and destination rectangles have the same dimensions. If -// not we must stretch during the drawing rather than a direct pixel copy - -void CDrawImage::SetSourceRect(RECT *pSourceRect) -{ - ASSERT(pSourceRect); - m_SourceRect = *pSourceRect; - SetStretchMode(); -} - - -// Return the current source rectangle - -void CDrawImage::GetSourceRect(RECT *pSourceRect) -{ - ASSERT(pSourceRect); - *pSourceRect = m_SourceRect; -} - - -// This is called when either the source or destination rectanges change so we -// can update the stretch flag. If the rectangles don't match we stretch the -// video during the drawing otherwise we call the fast pixel copy functions -// NOTE the source and/or the destination rectangle may be completely empty - -void CDrawImage::SetStretchMode() -{ - // Calculate the overall rectangle dimensions - - LONG SourceWidth = m_SourceRect.right - m_SourceRect.left; - LONG SinkWidth = m_TargetRect.right - m_TargetRect.left; - LONG SourceHeight = m_SourceRect.bottom - m_SourceRect.top; - LONG SinkHeight = m_TargetRect.bottom - m_TargetRect.top; - - m_bStretch = TRUE; - if (SourceWidth == SinkWidth) { - if (SourceHeight == SinkHeight) { - m_bStretch = FALSE; - } - } -} - - -// Tell us whose allocator we are using. This should be called with TRUE if -// the filter agrees to use an allocator based around the CImageAllocator -// SDK base class - whose image buffers are made through CreateDIBSection. -// Otherwise this should be called with FALSE and we will draw the images -// using SetDIBitsToDevice and StretchDIBitsToDevice. None of these calls -// can handle buffers which have non zero strides (like DirectDraw uses) - -void CDrawImage::NotifyAllocator(BOOL bUsingImageAllocator) -{ - m_bUsingImageAllocator = bUsingImageAllocator; -} - - -// Are we using the image DIBSECTION allocator - -BOOL CDrawImage::UsingImageAllocator() -{ - return m_bUsingImageAllocator; -} - - -// We need the media type of the connection so that we can get the BITMAPINFO -// from it. We use that in the calls to draw the image such as StretchDIBits -// and also when updating the colour table held in shared memory DIBSECTIONs - -void CDrawImage::NotifyMediaType(CMediaType *pMediaType) -{ - m_pMediaType = pMediaType; -} - - -// We store in this object a cookie maintaining the current palette version. -// Each time a palettised format is changed we increment this value so that -// when we come to draw the images we look at the colour table value they -// have and if less than the current we know to update it. This version is -// only needed and indeed used when working with shared memory DIBSECTIONs - -LONG CDrawImage::GetPaletteVersion() -{ - return m_PaletteVersion; -} - - -// Resets the current palette version number - -void CDrawImage::ResetPaletteVersion() -{ - m_PaletteVersion = PALETTE_VERSION; -} - - -// Increment the current palette version - -void CDrawImage::IncrementPaletteVersion() -{ - m_PaletteVersion++; -} - - -// Constructor must initialise the base allocator. Each sample we create has a -// palette version cookie on board. When the source filter changes the palette -// during streaming the window object increments an internal cookie counter it -// keeps as well. When it comes to render the samples it looks at the cookie -// values and if they don't match then it knows to update the sample's colour -// table. However we always create samples with a cookie of PALETTE_VERSION -// If there have been multiple format changes and we disconnect and reconnect -// thereby causing the samples to be reallocated we will create them with a -// cookie much lower than the current version, this isn't a problem since it -// will be seen by the window object and the versions will then be updated - -CImageAllocator::CImageAllocator(CBaseFilter *pFilter, - TCHAR *pName, - HRESULT *phr) : - CBaseAllocator(pName,NULL,phr,TRUE,TRUE), - m_pFilter(pFilter) -{ - ASSERT(phr); - ASSERT(pFilter); -} - - -// Check our DIB buffers have been released - -#ifdef DEBUG -CImageAllocator::~CImageAllocator() -{ - ASSERT(m_bCommitted == FALSE); -} -#endif - - -// Called from destructor and also from base class to free resources. We work -// our way through the list of media samples deleting the DIBSECTION created -// for each. All samples should be back in our list so there is no chance a -// filter is still using one to write on the display or hold on a pending list - -void CImageAllocator::Free() -{ - ASSERT(m_lAllocated == m_lFree.GetCount()); - EXECUTE_ASSERT(GdiFlush()); - CImageSample *pSample; - DIBDATA *pDibData; - - while (m_lFree.GetCount() != 0) { - pSample = (CImageSample *) m_lFree.RemoveHead(); - pDibData = pSample->GetDIBData(); - EXECUTE_ASSERT(DeleteObject(pDibData->hBitmap)); - EXECUTE_ASSERT(CloseHandle(pDibData->hMapping)); - delete pSample; - } - - m_lAllocated = 0; -} - - -// Prepare the allocator by checking all the input parameters - -STDMETHODIMP CImageAllocator::CheckSizes(ALLOCATOR_PROPERTIES *pRequest) -{ - // Check we have a valid connection - - if (m_pMediaType == NULL) { - return VFW_E_NOT_CONNECTED; - } - - // NOTE We always create a DIB section with the source format type which - // may contain a source palette. When we do the BitBlt drawing operation - // the target display device may contain a different palette (we may not - // have the focus) in which case GDI will do after the palette mapping - - VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *) m_pMediaType->Format(); - - // When we call CreateDIBSection it implicitly maps only enough memory - // for the image as defined by thee BITMAPINFOHEADER. If the user asks - // for an image smaller than this then we reject the call, if they ask - // for an image larger than this then we return what they can have - - if ((DWORD) pRequest->cbBuffer < pVideoInfo->bmiHeader.biSizeImage) { - return E_INVALIDARG; - } - - // Reject buffer prefixes - - if (pRequest->cbPrefix > 0) { - return E_INVALIDARG; - } - - pRequest->cbBuffer = pVideoInfo->bmiHeader.biSizeImage; - return NOERROR; -} - - -// Agree the number of media sample buffers and their sizes. The base class -// this allocator is derived from allows samples to be aligned only on byte -// boundaries NOTE the buffers are not allocated until the Commit call - -STDMETHODIMP CImageAllocator::SetProperties( - ALLOCATOR_PROPERTIES * pRequest, - ALLOCATOR_PROPERTIES * pActual) -{ - ALLOCATOR_PROPERTIES Adjusted = *pRequest; - - // Check the parameters fit with the current connection - - HRESULT hr = CheckSizes(&Adjusted); - if (FAILED(hr)) { - return hr; - } - return CBaseAllocator::SetProperties(&Adjusted, pActual); -} - - -// Commit the memory by allocating the agreed number of media samples. For -// each sample we are committed to creating we have a CImageSample object -// that we use to manage it's resources. This is initialised with a DIBDATA -// structure that contains amongst other things the GDI DIBSECTION handle -// We will access the renderer media type during this so we must have locked -// (to prevent the format changing for example). The class overrides Commit -// and Decommit to do this locking (base class Commit in turn calls Alloc) - -HRESULT CImageAllocator::Alloc(void) -{ - ASSERT(m_pMediaType); - CImageSample *pSample; - DIBDATA DibData; - - // Check the base allocator says it's ok to continue - - HRESULT hr = CBaseAllocator::Alloc(); - if (FAILED(hr)) { - return hr; - } - - // We create a new memory mapped object although we don't map it into our - // address space because GDI does that in CreateDIBSection. It is possible - // that we run out of resources before creating all the samples in which - // case the available sample list is left with those already created - - ASSERT(m_lAllocated == 0); - while (m_lAllocated < m_lCount) { - - // Create and initialise a shared memory GDI buffer - - HRESULT hr = CreateDIB(m_lSize,DibData); - if (FAILED(hr)) { - return hr; - } - - // Create the sample object and pass it the DIBDATA - - pSample = CreateImageSample(DibData.pBase,m_lSize); - if (pSample == NULL) { - EXECUTE_ASSERT(DeleteObject(DibData.hBitmap)); - EXECUTE_ASSERT(CloseHandle(DibData.hMapping)); - return E_OUTOFMEMORY; - } - - // Add the completed sample to the available list - - pSample->SetDIBData(&DibData); - m_lFree.Add(pSample); - m_lAllocated++; - } - return NOERROR; -} - - -// We have a virtual method that allocates the samples so that a derived class -// may override it and allocate more specialised sample objects. So long as it -// derives its samples from CImageSample then all this code will still work ok - -CImageSample *CImageAllocator::CreateImageSample(LPBYTE pData,LONG Length) -{ - HRESULT hr = NOERROR; - CImageSample *pSample; - - // Allocate the new sample and check the return codes - - pSample = new CImageSample((CBaseAllocator *) this, // Base class - NAME("Video sample"), // DEBUG name - (HRESULT *) &hr, // Return code - (LPBYTE) pData, // DIB address - (LONG) Length); // Size of DIB - - if (pSample == NULL || FAILED(hr)) { - delete pSample; - return NULL; - } - return pSample; -} - - -// This function allocates a shared memory block for use by the source filter -// generating DIBs for us to render. The memory block is created in shared -// memory so that GDI doesn't have to copy the memory when we do a BitBlt - -HRESULT CImageAllocator::CreateDIB(LONG InSize,DIBDATA &DibData) -{ - BITMAPINFO *pbmi; // Format information for pin - BYTE *pBase; // Pointer to the actual image - HANDLE hMapping; // Handle to mapped object - HBITMAP hBitmap; // DIB section bitmap handle - - // Create a file mapping object and map into our address space - - hMapping = CreateFileMapping(hMEMORY, // Use system page file - NULL, // No security attributes - PAGE_READWRITE, // Full access to memory - (DWORD) 0, // Less than 4Gb in size - InSize, // Size of buffer - NULL); // No name to section - if (hMapping == NULL) { - DWORD Error = GetLastError(); - return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error); - } - - // NOTE We always create a DIB section with the source format type which - // may contain a source palette. When we do the BitBlt drawing operation - // the target display device may contain a different palette (we may not - // have the focus) in which case GDI will do after the palette mapping - - pbmi = (BITMAPINFO *) HEADER(m_pMediaType->Format()); - if (m_pMediaType == NULL) { - DbgBreak("Invalid media type"); - } - - hBitmap = CreateDIBSection((HDC) NULL, // NO device context - pbmi, // Format information - DIB_RGB_COLORS, // Use the palette - (VOID **) &pBase, // Pointer to image data - hMapping, // Mapped memory handle - (DWORD) 0); // Offset into memory - - if (hBitmap == NULL || pBase == NULL) { - EXECUTE_ASSERT(CloseHandle(hMapping)); - DWORD Error = GetLastError(); - return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error); - } - - // Initialise the DIB information structure - - DibData.hBitmap = hBitmap; - DibData.hMapping = hMapping; - DibData.pBase = pBase; - DibData.PaletteVersion = PALETTE_VERSION; - GetObject(hBitmap,sizeof(DIBSECTION),(VOID *)&DibData.DibSection); - - return NOERROR; -} - - -// We use the media type during the DIBSECTION creation - -void CImageAllocator::NotifyMediaType(CMediaType *pMediaType) -{ - m_pMediaType = pMediaType; -} - - -// Overriden to increment the owning object's reference count - -STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingAddRef() -{ - return m_pFilter->AddRef(); -} - - -// Overriden to decrement the owning object's reference count - -STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingRelease() -{ - return m_pFilter->Release(); -} - - -// If you derive a class from CMediaSample that has to transport specialised -// member variables and entry points then there are three alternate solutions -// The first is to create a memory buffer larger than actually required by the -// sample and store your information either at the beginning of it or at the -// end, the former being moderately safer allowing for misbehaving transform -// filters. You then adjust the buffer address when you create the base media -// sample. This has the disadvantage of breaking up the memory allocated to -// the samples into separate blocks. The second solution is to implement a -// class derived from CMediaSample and support additional interface(s) that -// convey your private data. This means defining a custom interface. The final -// alternative is to create a class that inherits from CMediaSample and adds -// the private data structures, when you get an IMediaSample in your Receive() -// call check to see if your allocator is being used, and if it is then cast -// the IMediaSample into one of your objects. Additional checks can be made -// to ensure the sample's this pointer is known to be one of your own objects - -CImageSample::CImageSample(CBaseAllocator *pAllocator, - TCHAR *pName, - HRESULT *phr, - LPBYTE pBuffer, - LONG length) : - CMediaSample(pName,pAllocator,phr,pBuffer,length), - m_bInit(FALSE) -{ - ASSERT(pAllocator); - ASSERT(pBuffer); -} - - -// Set the shared memory DIB information - -void CImageSample::SetDIBData(DIBDATA *pDibData) -{ - ASSERT(pDibData); - m_DibData = *pDibData; - m_bInit = TRUE; -} - - -// Retrieve the shared memory DIB data - -DIBDATA *CImageSample::GetDIBData() -{ - ASSERT(m_bInit == TRUE); - return &m_DibData; -} - - -// This class handles the creation of a palette. It is fairly specialist and -// is intended to simplify palette management for video renderer filters. It -// is for this reason that the constructor requires three other objects with -// which it interacts, namely a base media filter, a base window and a base -// drawing object although the base window or the draw object may be NULL to -// ignore that part of us. We try not to create and install palettes unless -// absolutely necessary as they typically require WM_PALETTECHANGED messages -// to be sent to every window thread in the system which is very expensive - -CImagePalette::CImagePalette(CBaseFilter *pBaseFilter, - CBaseWindow *pBaseWindow, - CDrawImage *pDrawImage) : - m_pBaseWindow(pBaseWindow), - m_pFilter(pBaseFilter), - m_pDrawImage(pDrawImage), - m_hPalette(NULL) -{ - ASSERT(m_pFilter); -} - - -// Destructor - -#ifdef DEBUG -CImagePalette::~CImagePalette() -{ - ASSERT(m_hPalette == NULL); -} -#endif - - -// We allow dynamic format changes of the palette but rather than change the -// palette every time we call this to work out whether an update is required. -// If the original type didn't use a palette and the new one does (or vica -// versa) then we return TRUE. If neither formats use a palette we'll return -// FALSE. If both formats use a palette we compare their colours and return -// FALSE if they match. This therefore short circuits palette creation unless -// absolutely necessary since installing palettes is an expensive operation - -BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo, - const VIDEOINFOHEADER *pOldInfo) -{ - // We may not have a current format yet - - if (pOldInfo == NULL) { - return TRUE; - } - - // Do both formats not require a palette - - if (ContainsPalette(pNewInfo) == FALSE) { - if (ContainsPalette(pOldInfo) == FALSE) { - return FALSE; - } - } - - // Compare the colours to see if they match - - DWORD VideoEntries = pNewInfo->bmiHeader.biClrUsed; - if (ContainsPalette(pNewInfo) == TRUE) - if (ContainsPalette(pOldInfo) == TRUE) - if (pOldInfo->bmiHeader.biClrUsed == VideoEntries) - if (pOldInfo->bmiHeader.biClrUsed > 0) - if (memcmp((PVOID) GetBitmapPalette(pNewInfo), - (PVOID) GetBitmapPalette(pOldInfo), - VideoEntries * sizeof(RGBQUAD)) == 0) { - - return FALSE; - } - return TRUE; -} - - -// This is normally called when the input pin type is set to install a palette -// We will typically be called from two different places. The first is when we -// have negotiated a palettised media type after connection, the other is when -// we receive a new type during processing with an updated palette in which -// case we must remove and release the resources held by the current palette - -// We can be passed an optional device name if we wish to prepare a palette -// for a specific monitor on a multi monitor system - -HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew, - const CMediaType *pmtOld, - LPSTR szDevice) -{ - const VIDEOINFOHEADER *pNewInfo = (VIDEOINFOHEADER *) pmtNew->Format(); - const VIDEOINFOHEADER *pOldInfo = (VIDEOINFOHEADER *) pmtOld->Format(); - ASSERT(pNewInfo); - - // This is an performance optimisation, when we get a media type we check - // to see if the format requires a palette change. If either we need one - // when previously we didn't or vica versa then this returns TRUE, if we - // previously needed a palette and we do now it compares their colours - - if (ShouldUpdate(pNewInfo,pOldInfo) == FALSE) { - NOTE("No update needed"); - return S_FALSE; - } - - // We must notify the filter graph that the application may have changed - // the palette although in practice we don't bother checking to see if it - // is really different. If it tries to get the palette either the window - // or renderer lock will ensure it doesn't get in until we are finished - - RemovePalette(); - m_pFilter->NotifyEvent(EC_PALETTE_CHANGED,0,0); - - // Do we need a palette for the new format - - if (ContainsPalette(pNewInfo) == FALSE) { - NOTE("New has no palette"); - return S_FALSE; - } - - if (m_pBaseWindow) { - m_pBaseWindow->LockPaletteLock(); - } - - // If we're changing the palette on the fly then we increment our palette - // cookie which is compared against the cookie also stored in all of our - // DIBSECTION media samples. If they don't match when we come to draw it - // then we know the sample is out of date and we'll update it's palette - - NOTE("Making new colour palette"); - m_hPalette = MakePalette(pNewInfo, szDevice); - ASSERT(m_hPalette != NULL); - - if (m_pBaseWindow) { - m_pBaseWindow->UnlockPaletteLock(); - } - - // The window in which the new palette is to be realised may be a NULL - // pointer to signal that no window is in use, if so we don't call it - // Some filters just want to use this object to create/manage palettes - - if (m_pBaseWindow) m_pBaseWindow->SetPalette(m_hPalette); - - // This is the only time where we need access to the draw object to say - // to it that a new palette will be arriving on a sample real soon. The - // constructor may take a NULL pointer in which case we don't call this - - if (m_pDrawImage) m_pDrawImage->IncrementPaletteVersion(); - return NOERROR; -} - - -// Helper function to copy a palette out of any kind of VIDEOINFO (ie it may -// be YUV or true colour) into a palettised VIDEOINFO. We use this changing -// palettes on DirectDraw samples as a source filter can attach a palette to -// any buffer (eg YUV) and hand it back. We make a new palette out of that -// format and then copy the palette colours into the current connection type - -HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc,CMediaType *pDest) -{ - // Reset the destination palette before starting - - VIDEOINFOHEADER *pDestInfo = (VIDEOINFOHEADER *) pDest->Format(); - pDestInfo->bmiHeader.biClrUsed = 0; - pDestInfo->bmiHeader.biClrImportant = 0; - - // Does the destination have a palette - - if (PALETTISED(pDestInfo) == FALSE) { - NOTE("No destination palette"); - return S_FALSE; - } - - // Does the source contain a palette - - const VIDEOINFOHEADER *pSrcInfo = (VIDEOINFOHEADER *) pSrc->Format(); - if (ContainsPalette(pSrcInfo) == FALSE) { - NOTE("No source palette"); - return S_FALSE; - } - - // The number of colours may be zero filled - - DWORD PaletteEntries = pSrcInfo->bmiHeader.biClrUsed; - if (PaletteEntries == 0) { - DWORD Maximum = (1 << pSrcInfo->bmiHeader.biBitCount); - NOTE1("Setting maximum colours (%d)",Maximum); - PaletteEntries = Maximum; - } - - // Make sure the destination has enough room for the palette - - ASSERT(pSrcInfo->bmiHeader.biClrUsed <= iPALETTE_COLORS); - ASSERT(pSrcInfo->bmiHeader.biClrImportant <= PaletteEntries); - ASSERT(COLORS(pDestInfo) == GetBitmapPalette(pDestInfo)); - pDestInfo->bmiHeader.biClrUsed = PaletteEntries; - pDestInfo->bmiHeader.biClrImportant = pSrcInfo->bmiHeader.biClrImportant; - ULONG BitmapSize = GetBitmapFormatSize(HEADER(pSrcInfo)); - - if (pDest->FormatLength() < BitmapSize) { - NOTE("Reallocating destination"); - pDest->ReallocFormatBuffer(BitmapSize); - } - - // Now copy the palette colours across - - CopyMemory((PVOID) COLORS(pDestInfo), - (PVOID) GetBitmapPalette(pSrcInfo), - PaletteEntries * sizeof(RGBQUAD)); - - return NOERROR; -} - - -// This is normally called when the palette is changed (typically during a -// dynamic format change) to remove any palette we previously installed. We -// replace it (if necessary) in the video window with a standard VGA palette -// that should always be available even if this is a true colour display - -HRESULT CImagePalette::RemovePalette() -{ - if (m_pBaseWindow) { - m_pBaseWindow->LockPaletteLock(); - } - - // Do we have a palette to remove - - if (m_hPalette != NULL) { - - if (m_pBaseWindow) { - // Make sure that the window's palette handle matches - // our palette handle. - ASSERT(m_hPalette == m_pBaseWindow->GetPalette()); - - m_pBaseWindow->UnsetPalette(); - } - - EXECUTE_ASSERT(DeleteObject(m_hPalette)); - m_hPalette = NULL; - } - - if (m_pBaseWindow) { - m_pBaseWindow->UnlockPaletteLock(); - } - - return NOERROR; -} - - -// Called to create a palette for the object, the data structure used by GDI -// to describe a palette is a LOGPALETTE, this includes a variable number of -// PALETTEENTRY fields which are the colours, we have to convert the RGBQUAD -// colour fields we are handed in a BITMAPINFO from the media type into these -// This handles extraction of palettes from true colour and YUV media formats - -// We can be passed an optional device name if we wish to prepare a palette -// for a specific monitor on a multi monitor system - -HPALETTE CImagePalette::MakePalette(const VIDEOINFOHEADER *pVideoInfo, LPSTR szDevice) -{ - ASSERT(ContainsPalette(pVideoInfo) == TRUE); - ASSERT(pVideoInfo->bmiHeader.biClrUsed <= iPALETTE_COLORS); - BITMAPINFOHEADER *pHeader = HEADER(pVideoInfo); - - const RGBQUAD *pColours; // Pointer to the palette - LOGPALETTE *lp; // Used to create a palette - HPALETTE hPalette; // Logical palette object - - lp = (LOGPALETTE *) new BYTE[sizeof(LOGPALETTE) + SIZE_PALETTE]; - if (lp == NULL) { - return NULL; - } - - // Unfortunately for some hare brained reason a GDI palette entry (a - // PALETTEENTRY structure) is different to a palette entry from a DIB - // format (a RGBQUAD structure) so we have to do the field conversion - // The VIDEOINFO containing the palette may be a true colour type so - // we use GetBitmapPalette to skip over any bit fields if they exist - - lp->palVersion = PALVERSION; - lp->palNumEntries = (USHORT) pHeader->biClrUsed; - if (lp->palNumEntries == 0) - lp->palNumEntries = (WORD) (1 << pHeader->biBitCount); - pColours = GetBitmapPalette(pVideoInfo); - - for (DWORD dwCount = 0;dwCount < lp->palNumEntries;dwCount++) { - lp->palPalEntry[dwCount].peRed = pColours[dwCount].rgbRed; - lp->palPalEntry[dwCount].peGreen = pColours[dwCount].rgbGreen; - lp->palPalEntry[dwCount].peBlue = pColours[dwCount].rgbBlue; - lp->palPalEntry[dwCount].peFlags = 0; - } - - MakeIdentityPalette(lp->palPalEntry, lp->palNumEntries, szDevice); - - // Create a logical palette - - hPalette = CreatePalette(lp); - ASSERT(hPalette != NULL); - delete[] lp; - return hPalette; -} - - -// GDI does a fair job of compressing the palette entries you give it, so for -// example if you have five entries with an RGB colour (0,0,0) it will remove -// all but one of them. When you subsequently draw an image it will map from -// your logical palette to the compressed device palette. This function looks -// to see if it is trying to be an identity palette and if so sets the flags -// field in the PALETTEENTRYs so they remain expanded to boost performance - -// We can be passed an optional device name if we wish to prepare a palette -// for a specific monitor on a multi monitor system - -HRESULT CImagePalette::MakeIdentityPalette(PALETTEENTRY *pEntry,INT iColours, LPSTR szDevice) -{ - PALETTEENTRY SystemEntries[10]; // System palette entries - BOOL bIdentityPalette = TRUE; // Is an identity palette - ASSERT(iColours <= iPALETTE_COLORS); // Should have a palette - const int PalLoCount = 10; // First ten reserved colours - const int PalHiStart = 246; // Last VGA palette entries - - // Does this have the full colour range - - if (iColours < 10) { - return S_FALSE; - } - - // Apparently some displays have odd numbers of system colours - - // Get a DC on the right monitor - it's ugly, but this is the way you have - // to do it - HDC hdc; - if (szDevice == NULL || lstrcmpiA(szDevice, "DISPLAY") == 0) - hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); - else - hdc = CreateDCA(NULL, szDevice, NULL, NULL); - if (NULL == hdc) { - return E_OUTOFMEMORY; - } - INT Reserved = GetDeviceCaps(hdc,NUMRESERVED); - if (Reserved != 20) { - DeleteDC(hdc); - return S_FALSE; - } - - // Compare our palette against the first ten system entries. The reason I - // don't do a memory compare between our two arrays of colours is because - // I am not sure what will be in the flags fields for the system entries - - UINT Result = GetSystemPaletteEntries(hdc,0,PalLoCount,SystemEntries); - UINT Count; - for (Count = 0;Count < Result;Count++) { - if (SystemEntries[Count].peRed != pEntry[Count].peRed || - SystemEntries[Count].peGreen != pEntry[Count].peGreen || - SystemEntries[Count].peBlue != pEntry[Count].peBlue) { - bIdentityPalette = FALSE; - } - } - - // And likewise compare against the last ten entries - - Result = GetSystemPaletteEntries(hdc,PalHiStart,PalLoCount,SystemEntries); - for (Count = 0;Count < Result;Count++) { - if (INT(Count) + PalHiStart < iColours) { - if (SystemEntries[Count].peRed != pEntry[PalHiStart + Count].peRed || - SystemEntries[Count].peGreen != pEntry[PalHiStart + Count].peGreen || - SystemEntries[Count].peBlue != pEntry[PalHiStart + Count].peBlue) { - bIdentityPalette = FALSE; - } - } - } - - // If not an identity palette then return S_FALSE - - DeleteDC(hdc); - if (bIdentityPalette == FALSE) { - return S_FALSE; - } - - // Set the non VGA entries so that GDI doesn't map them - - for (Count = PalLoCount;INT(Count) < min(PalHiStart,iColours);Count++) { - pEntry[Count].peFlags = PC_NOCOLLAPSE; - } - return NOERROR; -} - - -// Constructor initialises the VIDEOINFO we keep storing the current display -// format. The format can be changed at any time, to reset the format held -// by us call the RefreshDisplayType directly (it's a public method). Since -// more than one thread will typically call us (ie window threads resetting -// the type and source threads in the type checking methods) we have a lock - -CImageDisplay::CImageDisplay() -{ - RefreshDisplayType(NULL); -} - - - -// This initialises the format we hold which contains the display device type -// We do a conversion on the display device type in here so that when we start -// type checking input formats we can assume that certain fields have been set -// correctly, an example is when we make the 16 bit mask fields explicit. This -// is normally called when we receive WM_DEVMODECHANGED device change messages - -// The optional szDeviceName parameter tells us which monitor we are interested -// in for a multi monitor system - -HRESULT CImageDisplay::RefreshDisplayType(LPSTR szDeviceName) -{ - CAutoLock cDisplayLock(this); - - // Set the preferred format type - - ZeroMemory((PVOID)&m_Display,sizeof(VIDEOINFOHEADER)+sizeof(TRUECOLORINFO)); - m_Display.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - m_Display.bmiHeader.biBitCount = FALSE; - - // Get the bit depth of a device compatible bitmap - - // get caps of whichever monitor they are interested in (multi monitor) - HDC hdcDisplay; - // it's ugly, but this is the way you have to do it - if (szDeviceName == NULL || lstrcmpiA(szDeviceName, "DISPLAY") == 0) - hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL); - else - hdcDisplay = CreateDCA(NULL, szDeviceName, NULL, NULL); - if (hdcDisplay == NULL) { - ASSERT(FALSE); - DbgLog((LOG_ERROR,1,TEXT("ACK! Can't get a DC for %hs"), - szDeviceName ? szDeviceName : "")); - return E_FAIL; - } else { - DbgLog((LOG_TRACE,3,TEXT("Created a DC for %s"), - szDeviceName ? szDeviceName : "")); - } - HBITMAP hbm = CreateCompatibleBitmap(hdcDisplay,1,1); - if ( hbm ) - { - GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS); - - // This call will get the colour table or the proper bitfields - GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS); - DeleteObject(hbm); - } - DeleteDC(hdcDisplay); - - // Complete the display type initialisation - - ASSERT(CheckHeaderValidity(&m_Display)); - UpdateFormat(&m_Display); - DbgLog((LOG_TRACE,3,TEXT("New DISPLAY bit depth =%d"), - m_Display.bmiHeader.biBitCount)); - return NOERROR; -} - - -// We assume throughout this code that any bitfields masks are allowed no -// more than eight bits to store a colour component. This checks that the -// bit count assumption is enforced and also makes sure that all the bits -// set are contiguous. We return a boolean TRUE if the field checks out ok - -BOOL CImageDisplay::CheckBitFields(const VIDEOINFO *pInput) -{ - DWORD *pBitFields = (DWORD *) BITMASKS(pInput); - - for (INT iColour = iRED;iColour <= iBLUE;iColour++) { - - // First of all work out how many bits are set - - DWORD SetBits = CountSetBits(pBitFields[iColour]); - if (SetBits > iMAXBITS || SetBits == 0) { - NOTE1("Bit fields for component %d invalid",iColour); - return FALSE; - } - - // Next work out the number of zero bits prefix - DWORD PrefixBits = CountPrefixBits(pBitFields[iColour]); - - // This is going to see if all the bits set are contiguous (as they - // should be). We know how much to shift them right by from the - // count of prefix bits. The number of bits set defines a mask, we - // invert this (ones complement) and AND it with the shifted bit - // fields. If the result is NON zero then there are bit(s) sticking - // out the left hand end which means they are not contiguous - - DWORD TestField = pBitFields[iColour] >> PrefixBits; - DWORD Mask = ULONG_MAX << SetBits; - if (TestField & Mask) { - NOTE1("Bit fields for component %d not contiguous",iColour); - return FALSE; - } - } - return TRUE; -} - - -// This counts the number of bits set in the input field - -DWORD CImageDisplay::CountSetBits(DWORD Field) -{ - // This is a relatively well known bit counting algorithm - - DWORD Count = 0; - DWORD init = Field; - - // Until the input is exhausted, count the number of bits - - while (init) { - init = init & (init - 1); // Turn off the bottommost bit - Count++; - } - return Count; -} - - -// This counts the number of zero bits upto the first one set NOTE the input -// field should have been previously checked to ensure there is at least one -// set although if we don't find one set we return the impossible value 32 - -DWORD CImageDisplay::CountPrefixBits(DWORD Field) -{ - DWORD Mask = 1; - DWORD Count = 0; - - while (TRUE) { - if (Field & Mask) { - return Count; - } - Count++; - - ASSERT(Mask != 0x80000000); - if (Mask == 0x80000000) { - return Count; - } - Mask <<= 1; - } -} - - -// This is called to check the BITMAPINFOHEADER for the input type. There are -// many implicit dependancies between the fields in a header structure which -// if we validate now make for easier manipulation in subsequent handling. We -// also check that the BITMAPINFOHEADER matches it's specification such that -// fields likes the number of planes is one, that it's structure size is set -// correctly and that the bitmap dimensions have not been set as negative - -BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput) -{ - // Check the bitmap width and height are not negative. - - if (pInput->bmiHeader.biWidth <= 0 || - pInput->bmiHeader.biHeight <= 0) { - NOTE("Invalid bitmap dimensions"); - return FALSE; - } - - // Check the compression is either BI_RGB or BI_BITFIELDS - - if (pInput->bmiHeader.biCompression != BI_RGB) { - if (pInput->bmiHeader.biCompression != BI_BITFIELDS) { - NOTE("Invalid compression format"); - return FALSE; - } - } - - // If BI_BITFIELDS compression format check the colour depth - - if (pInput->bmiHeader.biCompression == BI_BITFIELDS) { - if (pInput->bmiHeader.biBitCount != 16) { - if (pInput->bmiHeader.biBitCount != 32) { - NOTE("BI_BITFIELDS not 16/32 bit depth"); - return FALSE; - } - } - } - - // Check the assumptions about the layout of the bit fields - - if (pInput->bmiHeader.biCompression == BI_BITFIELDS) { - if (CheckBitFields(pInput) == FALSE) { - NOTE("Bit fields are not valid"); - return FALSE; - } - } - - // Are the number of planes equal to one - - if (pInput->bmiHeader.biPlanes != 1) { - NOTE("Number of planes not one"); - return FALSE; - } - - // Check the image size is consistent (it can be zero) - - if (pInput->bmiHeader.biSizeImage != GetBitmapSize(&pInput->bmiHeader)) { - if (pInput->bmiHeader.biSizeImage) { - NOTE("Image size incorrectly set"); - return FALSE; - } - } - - // Check the size of the structure - - if (pInput->bmiHeader.biSize != sizeof(BITMAPINFOHEADER)) { - NOTE("Size of BITMAPINFOHEADER wrong"); - return FALSE; - } - return CheckPaletteHeader(pInput); -} - - -// This runs a few simple tests against the palette fields in the input to -// see if it looks vaguely correct. The tests look at the number of palette -// colours present, the number considered important and the biCompression -// field which should always be BI_RGB as no other formats are meaningful - -BOOL CImageDisplay::CheckPaletteHeader(const VIDEOINFO *pInput) -{ - // The checks here are for palettised videos only - - if (PALETTISED(pInput) == FALSE) { - if (pInput->bmiHeader.biClrUsed) { - NOTE("Invalid palette entries"); - return FALSE; - } - return TRUE; - } - - // Compression type of BI_BITFIELDS is meaningless for palette video - - if (pInput->bmiHeader.biCompression != BI_RGB) { - NOTE("Palettised video must be BI_RGB"); - return FALSE; - } - - // Check the number of palette colours is correct - - if (pInput->bmiHeader.biClrUsed > PALETTE_ENTRIES(pInput)) { - NOTE("Too many colours in palette"); - return FALSE; - } - - // The number of important colours shouldn't exceed the number used - - if (pInput->bmiHeader.biClrImportant > pInput->bmiHeader.biClrUsed) { - NOTE("Too many important colours"); - return FALSE; - } - return TRUE; -} - - -// Return the format of the video display - -const VIDEOINFO *CImageDisplay::GetDisplayFormat() -{ - return &m_Display; -} - - -// Return TRUE if the display uses a palette - -BOOL CImageDisplay::IsPalettised() -{ - return PALETTISED(&m_Display); -} - - -// Return the bit depth of the current display setting - -WORD CImageDisplay::GetDisplayDepth() -{ - return m_Display.bmiHeader.biBitCount; -} - - -// Initialise the optional fields in a VIDEOINFO. These are mainly to do with -// the source and destination rectangles and palette information such as the -// number of colours present. It simplifies our code just a little if we don't -// have to keep checking for all the different valid permutations in a header -// every time we want to do anything with it (an example would be creating a -// palette). We set the base class media type before calling this function so -// that the media types between the pins match after a connection is made - -HRESULT CImageDisplay::UpdateFormat(VIDEOINFO *pVideoInfo) -{ - ASSERT(pVideoInfo); - - BITMAPINFOHEADER *pbmi = HEADER(pVideoInfo); - SetRectEmpty(&pVideoInfo->rcSource); - SetRectEmpty(&pVideoInfo->rcTarget); - - // Set the number of colours explicitly - - if (PALETTISED(pVideoInfo)) { - if (pVideoInfo->bmiHeader.biClrUsed == 0) { - pVideoInfo->bmiHeader.biClrUsed = PALETTE_ENTRIES(pVideoInfo); - } - } - - // The number of important colours shouldn't exceed the number used, on - // some displays the number of important colours is not initialised when - // retrieving the display type so we set the colours used correctly - - if (pVideoInfo->bmiHeader.biClrImportant > pVideoInfo->bmiHeader.biClrUsed) { - pVideoInfo->bmiHeader.biClrImportant = PALETTE_ENTRIES(pVideoInfo); - } - - // Change the image size field to be explicit - - if (pVideoInfo->bmiHeader.biSizeImage == 0) { - pVideoInfo->bmiHeader.biSizeImage = GetBitmapSize(&pVideoInfo->bmiHeader); - } - return NOERROR; -} - - -// Lots of video rendering filters want code to check proposed formats are ok -// This checks the VIDEOINFO we are passed as a media type. If the media type -// is a valid media type then we return NOERROR otherwise E_INVALIDARG. Note -// however we only accept formats that can be easily displayed in the display -// so if we are on a 16 bit device we will not accept 24 bit images. The one -// complexity is that most displays draw 8 bit palettised images efficiently -// Also if the input format is less colour bits per pixel then we also accept - -HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput) -{ - // First of all check the VIDEOINFOHEADER looks correct - - if (CheckHeaderValidity(pInput) == FALSE) { - return E_INVALIDARG; - } - - // Virtually all devices support palettised images efficiently - - if (m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount) { - if (PALETTISED(pInput) == TRUE) { - ASSERT(PALETTISED(&m_Display) == TRUE); - NOTE("(Video) Type connection ACCEPTED"); - return NOERROR; - } - } - - - // Is the display depth greater than the input format - - if (m_Display.bmiHeader.biBitCount > pInput->bmiHeader.biBitCount) { - NOTE("(Video) Mismatch agreed"); - return NOERROR; - } - - // Is the display depth less than the input format - - if (m_Display.bmiHeader.biBitCount < pInput->bmiHeader.biBitCount) { - NOTE("(Video) Format mismatch"); - return E_INVALIDARG; - } - - - // Both input and display formats are either BI_RGB or BI_BITFIELDS - - ASSERT(m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount); - ASSERT(PALETTISED(pInput) == FALSE); - ASSERT(PALETTISED(&m_Display) == FALSE); - - // BI_RGB 16 bit representation is implicitly RGB555, and likewise BI_RGB - // 24 bit representation is RGB888. So we initialise a pointer to the bit - // fields they really mean and check against the display device format - // This is only going to be called when both formats are equal bits pixel - - const DWORD *pInputMask = GetBitMasks(pInput); - const DWORD *pDisplayMask = GetBitMasks((VIDEOINFO *)&m_Display); - - if (pInputMask[iRED] != pDisplayMask[iRED] || - pInputMask[iGREEN] != pDisplayMask[iGREEN] || - pInputMask[iBLUE] != pDisplayMask[iBLUE]) { - - NOTE("(Video) Bit field mismatch"); - return E_INVALIDARG; - } - - NOTE("(Video) Type connection ACCEPTED"); - return NOERROR; -} - - -// Return the bit masks for the true colour VIDEOINFO provided - -const DWORD *CImageDisplay::GetBitMasks(const VIDEOINFO *pVideoInfo) -{ - static const DWORD FailMasks[] = {0,0,0}; - - if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) { - return BITMASKS(pVideoInfo); - } - - ASSERT(pVideoInfo->bmiHeader.biCompression == BI_RGB); - - switch (pVideoInfo->bmiHeader.biBitCount) { - case 16: return bits555; - case 24: return bits888; - case 32: return bits888; - default: return FailMasks; - } -} - - -// Check to see if we can support media type pmtIn as proposed by the output -// pin - We first check that the major media type is video and also identify -// the media sub type. Then we thoroughly check the VIDEOINFO type provided -// As well as the contained VIDEOINFO being correct the major type must be -// video, the subtype a recognised video format and the type GUID correct - -HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn) -{ - // Does this have a VIDEOINFOHEADER format block - - const GUID *pFormatType = pmtIn->FormatType(); - if (*pFormatType != FORMAT_VideoInfo) { - NOTE("Format GUID not a VIDEOINFOHEADER"); - return E_INVALIDARG; - } - ASSERT(pmtIn->Format()); - - // Check the format looks reasonably ok - - ULONG Length = pmtIn->FormatLength(); - if (Length < SIZE_VIDEOHEADER) { - NOTE("Format smaller than a VIDEOHEADER"); - return E_FAIL; - } - - VIDEOINFO *pInput = (VIDEOINFO *) pmtIn->Format(); - - // Check the major type is MEDIATYPE_Video - - const GUID *pMajorType = pmtIn->Type(); - if (*pMajorType != MEDIATYPE_Video) { - NOTE("Major type not MEDIATYPE_Video"); - return E_INVALIDARG; - } - - // Check we can identify the media subtype - - const GUID *pSubType = pmtIn->Subtype(); - if (GetBitCount(pSubType) == USHRT_MAX) { - NOTE("Invalid video media subtype"); - return E_INVALIDARG; - } - return CheckVideoType(pInput); -} - - -// Given a video format described by a VIDEOINFO structure we return the mask -// that is used to obtain the range of acceptable colours for this type, for -// example, the mask for a 24 bit true colour format is 0xFF in all cases. A -// 16 bit 5:6:5 display format uses 0xF8, 0xFC and 0xF8, therefore given any -// RGB triplets we can AND them with these fields to find one that is valid - -BOOL CImageDisplay::GetColourMask(DWORD *pMaskRed, - DWORD *pMaskGreen, - DWORD *pMaskBlue) -{ - CAutoLock cDisplayLock(this); - *pMaskRed = 0xFF; - *pMaskGreen = 0xFF; - *pMaskBlue = 0xFF; - - // If this format is palettised then it doesn't have bit fields - - if (m_Display.bmiHeader.biBitCount < 16) { - return FALSE; - } - - // If this is a 24 bit true colour display then it can handle all the - // possible colour component ranges described by a byte. It is never - // allowed for a 24 bit colour depth image to have BI_BITFIELDS set - - if (m_Display.bmiHeader.biBitCount == 24) { - ASSERT(m_Display.bmiHeader.biCompression == BI_RGB); - return TRUE; - } - - // Calculate the mask based on the format's bit fields - - const DWORD *pBitFields = (DWORD *) GetBitMasks((VIDEOINFO *)&m_Display); - DWORD *pOutputMask[] = { pMaskRed, pMaskGreen, pMaskBlue }; - - // We know from earlier testing that there are no more than iMAXBITS - // bits set in the mask and that they are all contiguous. All that - // therefore remains is to shift them into the correct position - - for (INT iColour = iRED;iColour <= iBLUE;iColour++) { - - // This works out how many bits there are and where they live - - DWORD PrefixBits = CountPrefixBits(pBitFields[iColour]); - DWORD SetBits = CountSetBits(pBitFields[iColour]); - - // The first shift moves the bit field so that it is right justified - // in the DWORD, after which we then shift it back left which then - // puts the leading bit in the bytes most significant bit position - - *(pOutputMask[iColour]) = pBitFields[iColour] >> PrefixBits; - *(pOutputMask[iColour]) <<= (iMAXBITS - SetBits); - } - return TRUE; -} - - -/* Helper to convert to VIDEOINFOHEADER2 -*/ -STDAPI ConvertVideoInfoToVideoInfo2(AM_MEDIA_TYPE *pmt) -{ - ASSERT(pmt->formattype == FORMAT_VideoInfo); - VIDEOINFO *pVideoInfo = (VIDEOINFO *)pmt->pbFormat; - PVOID pvNew = CoTaskMemAlloc(pmt->cbFormat + sizeof(VIDEOINFOHEADER2) - - sizeof(VIDEOINFOHEADER)); - if (pvNew == NULL) { - return E_OUTOFMEMORY; - } - CopyMemory(pvNew, pmt->pbFormat, FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader)); - ZeroMemory((PBYTE)pvNew + FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader), - sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER)); - CopyMemory((PBYTE)pvNew + FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader), - pmt->pbFormat + FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader), - pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader)); - VIDEOINFOHEADER2 *pVideoInfo2 = (VIDEOINFOHEADER2 *)pvNew; - pVideoInfo2->dwPictAspectRatioX = (DWORD)pVideoInfo2->bmiHeader.biWidth; - pVideoInfo2->dwPictAspectRatioY = (DWORD)pVideoInfo2->bmiHeader.biHeight; - pmt->formattype = FORMAT_VideoInfo2; - CoTaskMemFree(pmt->pbFormat); - pmt->pbFormat = (PBYTE)pvNew; - pmt->cbFormat += sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER); - return S_OK; -} +//------------------------------------------------------------------------------ +// File: WinUtil.cpp +// +// Desc: DirectShow base classes - implements generic window handler class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#include +#include +#include +#include + +static UINT MsgDestroy; + +// Constructor + +CBaseWindow::CBaseWindow(BOOL bDoGetDC, bool bDoPostToDestroy) : + m_hInstance(g_hInst), + m_hwnd(NULL), + m_hdc(NULL), + m_bActivated(FALSE), + m_pClassName(NULL), + m_ClassStyles(0), + m_WindowStyles(0), + m_WindowStylesEx(0), + m_ShowStageMessage(0), + m_ShowStageTop(0), + m_MemoryDC(NULL), + m_hPalette(NULL), + m_bBackground(FALSE), +#ifdef DEBUG + m_bRealizing(FALSE), +#endif + m_bNoRealize(FALSE), + m_bDoPostToDestroy(bDoPostToDestroy) +{ + m_bDoGetDC = bDoGetDC; +} + + +// Prepare a window by spinning off a worker thread to do the creation and +// also poll the message input queue. We leave this to be called by derived +// classes because they might want to override methods like MessageLoop and +// InitialiseWindow, if we do this during construction they'll ALWAYS call +// this base class methods. We make the worker thread create the window so +// it owns it rather than the filter graph thread which is constructing us + +HRESULT CBaseWindow::PrepareWindow() +{ + if (m_hwnd) return NOERROR; + ASSERT(m_hwnd == NULL); + ASSERT(m_hdc == NULL); + + // Get the derived object's window and class styles + + m_pClassName = GetClassWindowStyles(&m_ClassStyles, + &m_WindowStyles, + &m_WindowStylesEx); + if (m_pClassName == NULL) { + return E_FAIL; + } + + // Register our special private messages + m_ShowStageMessage = RegisterWindowMessage(SHOWSTAGE); + + // RegisterWindowMessage() returns 0 if an error occurs. + if (0 == m_ShowStageMessage) { + return AmGetLastErrorToHResult(); + } + + m_ShowStageTop = RegisterWindowMessage(SHOWSTAGETOP); + if (0 == m_ShowStageTop) { + return AmGetLastErrorToHResult(); + } + + m_RealizePalette = RegisterWindowMessage(REALIZEPALETTE); + if (0 == m_RealizePalette) { + return AmGetLastErrorToHResult(); + } + + MsgDestroy = RegisterWindowMessage(TEXT("AM_DESTROY")); + if (0 == MsgDestroy) { + return AmGetLastErrorToHResult(); + } + + return DoCreateWindow(); +} + + +// Destructor just a placeholder so that we know it becomes virtual +// Derived classes MUST call DoneWithWindow in their destructors so +// that no messages arrive after the derived class constructor ends + +#ifdef DEBUG +CBaseWindow::~CBaseWindow() +{ + ASSERT(m_hwnd == NULL); + ASSERT(m_hdc == NULL); +} +#endif + + +// We use the sync worker event to have the window destroyed. All we do is +// signal the event and wait on the window thread handle. Trying to send it +// messages causes too many problems, furthermore to be on the safe side we +// just wait on the thread handle while it returns WAIT_TIMEOUT or there is +// a sent message to process on this thread. If the constructor failed to +// create the thread in the first place then the loop will get terminated + +HRESULT CBaseWindow::DoneWithWindow() +{ + // + // Before doing anything, check that someone has not already killed the + // Video Renderer window. If it has been killed we need to tidy up + // a DC that the window was using. If we don't do this check + // the following GetWindowThreadProcessId test fails, but the SendMessage + // goes nowhere and we leak the DC. + // + if (!IsWindow(m_hwnd)) { + + // + // This is not a leak, the window manager automatically free's + // hdc's that were got via GetDC, which is the case here. + // We set it to NULL so that we don't get any asserts later. + // + m_hdc = NULL; + + // + // We need to free this DC though because USER32 does not know + // anything about it. + // + if (m_MemoryDC) + { + EXECUTE_ASSERT(DeleteDC(m_MemoryDC)); + m_MemoryDC = NULL; + } + + // Reset the window variables + m_hwnd = NULL; + return NOERROR; + } + + + if (GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId()) { + + if (m_bDoPostToDestroy) { + + CAMEvent m_evDone; + + // We must post a message to destroy the window + // That way we can't be in the middle of processing a + // message posted to our window when we do go away + // Sending a message gives less synchronization. + PostMessage(m_hwnd, MsgDestroy, (WPARAM)(HANDLE)m_evDone, 0); + WaitDispatchingMessages(m_evDone, INFINITE); + } else { + SendMessage(m_hwnd, MsgDestroy, 0, 0); + } + return NOERROR; + } + const HWND hwnd = m_hwnd; + if (hwnd == NULL) { + return NOERROR; + } + + InactivateWindow(); + NOTE("Inactivated"); + + // Reset the window styles before destruction + + SetWindowLong(hwnd,GWL_STYLE,m_WindowStyles); + ASSERT(GetParent(hwnd) == NULL); + NOTE1("Reset window styles %d",m_WindowStyles); + + // UnintialiseWindow sets m_hwnd to NULL so save a copy + UninitialiseWindow(); + DbgLog((LOG_TRACE, 2, TEXT("Destroying 0x%8.8X"), hwnd)); + if (!DestroyWindow(hwnd)) { + DbgLog((LOG_TRACE, 0, TEXT("DestroyWindow %8.8X failed code %d"), + hwnd, GetLastError())); + DbgBreak(""); + } + + // Reset our state so we can be prepared again + + m_pClassName = NULL; + m_ClassStyles = 0; + m_WindowStyles = 0; + m_WindowStylesEx = 0; + m_ShowStageMessage = 0; + m_ShowStageTop = 0; + + return NOERROR; +} + + +// Called at the end to put the window in an inactive state. The pending list +// will always have been cleared by this time so event if the worker thread +// gets has been signaled and gets in to render something it will find both +// the state has been changed and that there are no available sample images +// Since we wait on the window thread to complete we don't lock the object + +HRESULT CBaseWindow::InactivateWindow() +{ + // Has the window been activated + if (m_bActivated == FALSE) { + return S_FALSE; + } + + m_bActivated = FALSE; + ShowWindow(m_hwnd,SW_HIDE); + return NOERROR; +} + + +HRESULT CBaseWindow::CompleteConnect() +{ + m_bActivated = FALSE; + return NOERROR; +} + +// This displays a normal window. We ask the base window class for default +// sizes which unless overriden will return DEFWIDTH and DEFHEIGHT. We go +// through a couple of extra hoops to get the client area the right size +// as the object specifies which accounts for the AdjustWindowRectEx calls +// We also DWORD align the left and top coordinates of the window here to +// maximise the chance of being able to use DCI/DirectDraw primary surface + +HRESULT CBaseWindow::ActivateWindow() +{ + // Has the window been sized and positioned already + + if (m_bActivated == TRUE || GetParent(m_hwnd) != NULL) { + + SetWindowPos(m_hwnd, // Our window handle + HWND_TOP, // Put it at the top + 0, 0, 0, 0, // Leave in current position + SWP_NOMOVE | // Don't change it's place + SWP_NOSIZE); // Change Z-order only + + m_bActivated = TRUE; + return S_FALSE; + } + + // Calculate the desired client rectangle + + RECT WindowRect, ClientRect = GetDefaultRect(); + GetWindowRect(m_hwnd,&WindowRect); + AdjustWindowRectEx(&ClientRect,GetWindowLong(m_hwnd,GWL_STYLE), + FALSE,GetWindowLong(m_hwnd,GWL_EXSTYLE)); + + // Align left and top edges on DWORD boundaries + + UINT WindowFlags = (SWP_NOACTIVATE | SWP_FRAMECHANGED); + WindowRect.left -= (WindowRect.left & 3); + WindowRect.top -= (WindowRect.top & 3); + + SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + WindowRect.left, // Align left edge + WindowRect.top, // And also top place + WIDTH(&ClientRect), // Horizontal size + HEIGHT(&ClientRect), // Vertical size + WindowFlags); // Don't show window + + m_bActivated = TRUE; + return NOERROR; +} + + +// This can be used to DWORD align the window for maximum performance + +HRESULT CBaseWindow::PerformanceAlignWindow() +{ + RECT ClientRect,WindowRect; + GetWindowRect(m_hwnd,&WindowRect); + ASSERT(m_bActivated == TRUE); + + // Don't do this if we're owned + + if (GetParent(m_hwnd)) { + return NOERROR; + } + + // Align left and top edges on DWORD boundaries + + GetClientRect(m_hwnd, &ClientRect); + MapWindowPoints(m_hwnd, HWND_DESKTOP, (LPPOINT) &ClientRect, 2); + WindowRect.left -= (ClientRect.left & 3); + WindowRect.top -= (ClientRect.top & 3); + UINT WindowFlags = (SWP_NOACTIVATE | SWP_NOSIZE); + + SetWindowPos(m_hwnd, // Window handle + HWND_TOP, // Put it at the top + WindowRect.left, // Align left edge + WindowRect.top, // And also top place + (int) 0,(int) 0, // Ignore these sizes + WindowFlags); // Don't show window + + return NOERROR; +} + + +// Install a palette into the base window - we may be called by a different +// thread to the one that owns the window. We have to be careful how we do +// the palette realisation as we could be a different thread to the window +// which would cause an inter thread send message. Therefore we realise the +// palette by sending it a special message but without the window locked + +HRESULT CBaseWindow::SetPalette(HPALETTE hPalette) +{ + // We must own the window lock during the change + { + CAutoLock cWindowLock(&m_WindowLock); + CAutoLock cPaletteLock(&m_PaletteLock); + ASSERT(hPalette); + m_hPalette = hPalette; + } + return SetPalette(); +} + + +HRESULT CBaseWindow::SetPalette() +{ + if (!m_bNoRealize) { + SendMessage(m_hwnd, m_RealizePalette, 0, 0); + return S_OK; + } else { + // Just select the palette + ASSERT(m_hdc); + ASSERT(m_MemoryDC); + + CAutoLock cPaletteLock(&m_PaletteLock); + SelectPalette(m_hdc,m_hPalette,m_bBackground); + SelectPalette(m_MemoryDC,m_hPalette,m_bBackground); + + return S_OK; + } +} + + +void CBaseWindow::UnsetPalette() +{ + CAutoLock cWindowLock(&m_WindowLock); + CAutoLock cPaletteLock(&m_PaletteLock); + + // Get a standard VGA colour palette + + HPALETTE hPalette = (HPALETTE) GetStockObject(DEFAULT_PALETTE); + ASSERT(hPalette); + + SelectPalette(GetWindowHDC(), hPalette, TRUE); + SelectPalette(GetMemoryHDC(), hPalette, TRUE); + + m_hPalette = NULL; +} + + +void CBaseWindow::LockPaletteLock() +{ + m_PaletteLock.Lock(); +} + + +void CBaseWindow::UnlockPaletteLock() +{ + m_PaletteLock.Unlock(); +} + + +// Realise our palettes in the window and device contexts + +HRESULT CBaseWindow::DoRealisePalette(BOOL bForceBackground) +{ + { + CAutoLock cPaletteLock(&m_PaletteLock); + + if (m_hPalette == NULL) { + return NOERROR; + } + + // Realize the palette on the window thread + ASSERT(m_hdc); + ASSERT(m_MemoryDC); + + SelectPalette(m_hdc,m_hPalette,m_bBackground || bForceBackground); + SelectPalette(m_MemoryDC,m_hPalette,m_bBackground); + } + + // If we grab a critical section here we can deadlock + // with the window thread because one of the side effects + // of RealizePalette is to send a WM_PALETTECHANGED message + // to every window in the system. In our handling + // of WM_PALETTECHANGED we used to grab this CS too. + // The really bad case is when our renderer calls DoRealisePalette() + // while we're in the middle of processing a palette change + // for another window. + // So don't hold the critical section while actually realising + // the palette. In any case USER is meant to manage palette + // handling - we shouldn't have to serialize everything as well + ASSERT(CritCheckOut(&m_WindowLock)); + ASSERT(CritCheckOut(&m_PaletteLock)); + + EXECUTE_ASSERT(RealizePalette(m_hdc) != GDI_ERROR); + EXECUTE_ASSERT(RealizePalette(m_MemoryDC) != GDI_ERROR); + + return (GdiFlush() == FALSE ? S_FALSE : S_OK); +} + + +// This is the global window procedure + +LRESULT CALLBACK WndProc(HWND hwnd, // Window handle + UINT uMsg, // Message ID + WPARAM wParam, // First parameter + LPARAM lParam) // Other parameter +{ + + // Get the window long that holds our window object pointer + // If it is NULL then we are initialising the window in which + // case the object pointer has been passed in the window creation + // structure. IF we get any messages before WM_NCCREATE we will + // pass them to DefWindowProc. + + CBaseWindow *pBaseWindow = (CBaseWindow *)GetWindowLongPtr(hwnd,0); + if (pBaseWindow == NULL) { + + // Get the structure pointer from the create struct. + // We can only do this for WM_NCCREATE which should be one of + // the first messages we receive. Anything before this will + // have to be passed to DefWindowProc (i.e. WM_GETMINMAXINFO) + + // If the message is WM_NCCREATE we set our pBaseWindow pointer + // and will then place it in the window structure + + // turn off WS_EX_LAYOUTRTL style for quartz windows + if (uMsg == WM_NCCREATE) { + SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~0x400000); + } + + if ((uMsg != WM_NCCREATE) + || (NULL == (pBaseWindow = *(CBaseWindow**) ((LPCREATESTRUCT)lParam)->lpCreateParams))) + { + return(DefWindowProc(hwnd, uMsg, wParam, lParam)); + } + + // Set the window LONG to be the object who created us +#ifdef DEBUG + SetLastError(0); // because of the way SetWindowLong works +#endif + LONG_PTR rc = SetWindowLongPtr(hwnd, (DWORD) 0, (LONG_PTR) pBaseWindow); +#ifdef DEBUG + if (0 == rc) { + // SetWindowLong MIGHT have failed. (Read the docs which admit + // that it is awkward to work out if you have had an error.) + LONG lasterror = GetLastError(); + ASSERT(0 == lasterror); + // If this is not the case we have not set the pBaseWindow pointer + // into the window structure and we will blow up. + } +#endif + + } + // See if this is the packet of death + if (uMsg == MsgDestroy && uMsg != 0) { + pBaseWindow->DoneWithWindow(); + if (pBaseWindow->m_bDoPostToDestroy) { + EXECUTE_ASSERT(SetEvent((HANDLE)wParam)); + } + return 0; + } + return pBaseWindow->OnReceiveMessage(hwnd,uMsg,wParam,lParam); +} + + +// When the window size changes we adjust our member variables that +// contain the dimensions of the client rectangle for our window so +// that we come to render an image we will know whether to stretch + +BOOL CBaseWindow::OnSize(LONG Width, LONG Height) +{ + m_Width = Width; + m_Height = Height; + return TRUE; +} + + +// This function handles the WM_CLOSE message + +BOOL CBaseWindow::OnClose() +{ + ShowWindow(m_hwnd,SW_HIDE); + return TRUE; +} + + +// This is called by the worker window thread when it receives a terminate +// message from the window object destructor to delete all the resources we +// allocated during initialisation. By the time the worker thread exits all +// processing will have been completed as the source filter disconnection +// flushes the image pending sample, therefore the GdiFlush should succeed + +HRESULT CBaseWindow::UninitialiseWindow() +{ + // Have we already cleaned up + + if (m_hwnd == NULL) { + ASSERT(m_hdc == NULL); + ASSERT(m_MemoryDC == NULL); + return NOERROR; + } + + // Release the window resources + + EXECUTE_ASSERT(GdiFlush()); + + if (m_hdc) + { + EXECUTE_ASSERT(ReleaseDC(m_hwnd,m_hdc)); + m_hdc = NULL; + } + + if (m_MemoryDC) + { + EXECUTE_ASSERT(DeleteDC(m_MemoryDC)); + m_MemoryDC = NULL; + } + + // Reset the window variables + m_hwnd = NULL; + + return NOERROR; +} + + +// This is called by the worker window thread after it has created the main +// window and it wants to initialise the rest of the owner objects window +// variables such as the device contexts. We execute this function with the +// critical section still locked. Nothing in this function must generate any +// SendMessage calls to the window because this is executing on the window +// thread so the message will never be processed and we will deadlock + +#pragma warning(disable:4706) // C4706: assignment within conditional expression + +HRESULT CBaseWindow::InitialiseWindow(HWND hwnd) +{ + // Initialise the window variables + + ASSERT(IsWindow(hwnd)); + m_hwnd = hwnd; + + if (m_bDoGetDC) + { + EXECUTE_ASSERT(m_hdc = GetDC(hwnd)); + EXECUTE_ASSERT(m_MemoryDC = CreateCompatibleDC(m_hdc)); + + EXECUTE_ASSERT(SetStretchBltMode(m_hdc,COLORONCOLOR)); + EXECUTE_ASSERT(SetStretchBltMode(m_MemoryDC,COLORONCOLOR)); + } + + return NOERROR; +} + +#pragma warning(default:4706) // C4706: assignment within conditional expression + + +HRESULT CBaseWindow::DoCreateWindow() +{ + WNDCLASS wndclass; // Used to register classes + BOOL bRegistered; // Is this class registered + HWND hwnd; // Handle to our window + + bRegistered = GetClassInfo(m_hInstance, // Module instance + m_pClassName, // Window class + &wndclass); // Info structure + + // if the window is to be used for drawing puposes and we are getting a DC + // for the entire lifetime of the window then changes the class style to do + // say so. If we don't set this flag then the DC comes from the cache and is + // really bad. + if (m_bDoGetDC) + { + m_ClassStyles |= CS_OWNDC; + } + + if (bRegistered == FALSE) { + + // Register the renderer window class + + wndclass.lpszClassName = m_pClassName; + wndclass.style = m_ClassStyles; + wndclass.lpfnWndProc = WndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = sizeof(CBaseWindow *); + wndclass.hInstance = m_hInstance; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); + wndclass.hbrBackground = (HBRUSH) NULL; + wndclass.lpszMenuName = NULL; + + RegisterClass(&wndclass); + } + + // Create the frame window. Pass the pBaseWindow information in the + // CreateStruct which allows our message handling loop to get hold of + // the pBaseWindow pointer. + + CBaseWindow *pBaseWindow = this; // The owner window object + hwnd = CreateWindowEx(m_WindowStylesEx, // Extended styles + m_pClassName, // Registered name + TEXT("ActiveMovie Window"), // Window title + m_WindowStyles, // Window styles + CW_USEDEFAULT, // Start x position + CW_USEDEFAULT, // Start y position + DEFWIDTH, // Window width + DEFHEIGHT, // Window height + NULL, // Parent handle + NULL, // Menu handle + m_hInstance, // Instance handle + &pBaseWindow); // Creation data + + // If we failed signal an error to the object constructor (based on the + // last Win32 error on this thread) then signal the constructor thread + // to continue, release the mutex to let others have a go and exit + + if (hwnd == NULL) { + DWORD Error = GetLastError(); + return AmHresultFromWin32(Error); + } + + // Check the window LONG is the object who created us + ASSERT(GetWindowLongPtr(hwnd, 0) == (LONG_PTR)this); + + // Initialise the window and then signal the constructor so that it can + // continue and then finally unlock the object's critical section. The + // window class is left registered even after we terminate the thread + // as we don't know when the last window has been closed. So we allow + // the operating system to free the class resources as appropriate + + InitialiseWindow(hwnd); + + DbgLog((LOG_TRACE, 2, TEXT("Created window class (%s) HWND(%8.8X)"), + m_pClassName, hwnd)); + + return S_OK; +} + + +// The base class provides some default handling and calls DefWindowProc + +LRESULT CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle + UINT uMsg, // Message ID + WPARAM wParam, // First parameter + LPARAM lParam) // Other parameter +{ + ASSERT(IsWindow(hwnd)); + + if (PossiblyEatMessage(uMsg, wParam, lParam)) + return 0; + + // This is sent by the IVideoWindow SetWindowForeground method. If the + // window is invisible we will show it and make it topmost without the + // foreground focus. If the window is visible it will also be made the + // topmost window without the foreground focus. If wParam is TRUE then + // for both cases the window will be forced into the foreground focus + + if (uMsg == m_ShowStageMessage) { + + BOOL bVisible = IsWindowVisible(hwnd); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | + (bVisible ? SWP_NOACTIVATE : 0)); + + // Should we bring the window to the foreground + if (wParam == TRUE) { + SetForegroundWindow(hwnd); + } + return (LRESULT) 1; + } + + // When we go fullscreen we have to add the WS_EX_TOPMOST style to the + // video window so that it comes out above any task bar (this is more + // relevant to WindowsNT than Windows95). However the SetWindowPos call + // must be on the same thread as that which created the window. The + // wParam parameter can be TRUE or FALSE to set and reset the topmost + + if (uMsg == m_ShowStageTop) { + HWND HwndTop = (wParam == TRUE ? HWND_TOPMOST : HWND_NOTOPMOST); + BOOL bVisible = IsWindowVisible(hwnd); + SetWindowPos(hwnd, HwndTop, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | + (wParam == TRUE ? SWP_SHOWWINDOW : 0) | + (bVisible ? SWP_NOACTIVATE : 0)); + return (LRESULT) 1; + } + + // New palette stuff + if (uMsg == m_RealizePalette) { + ASSERT(m_hwnd == hwnd); + return OnPaletteChange(m_hwnd,WM_QUERYNEWPALETTE); + } + + switch (uMsg) { + + // Repaint the window if the system colours change + + case WM_SYSCOLORCHANGE: + + InvalidateRect(hwnd,NULL,FALSE); + return (LRESULT) 1; + + // Somebody has changed the palette + case WM_PALETTECHANGED: + + OnPaletteChange((HWND)wParam,uMsg); + return (LRESULT) 0; + + // We are about to receive the keyboard focus so we ask GDI to realise + // our logical palette again and hopefully it will be fully installed + // without any mapping having to be done during any picture rendering + + case WM_QUERYNEWPALETTE: + ASSERT(m_hwnd == hwnd); + return OnPaletteChange(m_hwnd,uMsg); + + // do NOT fwd WM_MOVE. the parameters are the location of the parent + // window, NOT what the renderer should be looking at. But we need + // to make sure the overlay is moved with the parent window, so we + // do this. + case WM_MOVE: + if (IsWindowVisible(m_hwnd)) { + PostMessage(m_hwnd,WM_PAINT,0,0); + } + break; + + // Store the width and height as useful base class members + + case WM_SIZE: + + OnSize(LOWORD(lParam), HIWORD(lParam)); + return (LRESULT) 0; + + // Intercept the WM_CLOSE messages to hide the window + + case WM_CLOSE: + + OnClose(); + return (LRESULT) 0; + } + return DefWindowProc(hwnd,uMsg,wParam,lParam); +} + + +// This handles the Windows palette change messages - if we do realise our +// palette then we return TRUE otherwise we return FALSE. If our window is +// foreground application then we should get first choice of colours in the +// system palette entries. We get best performance when our logical palette +// includes the standard VGA colours (at the beginning and end) otherwise +// GDI may have to map from our palette to the device palette while drawing + +LRESULT CBaseWindow::OnPaletteChange(HWND hwnd,UINT Message) +{ + // First check we are not changing the palette during closedown + + if (m_hwnd == NULL || hwnd == NULL) { + return (LRESULT) 0; + } + ASSERT(!m_bRealizing); + + // Should we realise our palette again + + if ((Message == WM_QUERYNEWPALETTE || hwnd != m_hwnd)) { + // It seems that even if we're invisible that we can get asked + // to realize our palette and this can cause really ugly side-effects + // Seems like there's another bug but this masks it a least for the + // shutting down case. + if (!IsWindowVisible(m_hwnd)) { + DbgLog((LOG_TRACE, 1, TEXT("Realizing when invisible!"))); + return (LRESULT) 0; + } + + // Avoid recursion with multiple graphs in the same app +#ifdef DEBUG + m_bRealizing = TRUE; +#endif + DoRealisePalette(Message != WM_QUERYNEWPALETTE); +#ifdef DEBUG + m_bRealizing = FALSE; +#endif + + // Should we redraw the window with the new palette + if (Message == WM_PALETTECHANGED) { + InvalidateRect(m_hwnd,NULL,FALSE); + } + } + + return (LRESULT) 1; +} + + +// Determine if the window exists. + +bool CBaseWindow::WindowExists() +{ + return !!IsWindow(m_hwnd); +} + + +// Return the default window rectangle + +RECT CBaseWindow::GetDefaultRect() +{ + RECT DefaultRect = {0,0,DEFWIDTH,DEFHEIGHT}; + ASSERT(m_hwnd); + // ASSERT(m_hdc); + return DefaultRect; +} + + +// Return the current window width + +LONG CBaseWindow::GetWindowWidth() +{ + ASSERT(m_hwnd); + // ASSERT(m_hdc); + return m_Width; +} + + +// Return the current window height + +LONG CBaseWindow::GetWindowHeight() +{ + ASSERT(m_hwnd); + // ASSERT(m_hdc); + return m_Height; +} + + +// Return the window handle + +HWND CBaseWindow::GetWindowHWND() +{ + ASSERT(m_hwnd); + // ASSERT(m_hdc); + return m_hwnd; +} + + +// Return the window drawing device context + +HDC CBaseWindow::GetWindowHDC() +{ + ASSERT(m_hwnd); + ASSERT(m_hdc); + return m_hdc; +} + + +// Return the offscreen window drawing device context + +HDC CBaseWindow::GetMemoryHDC() +{ + ASSERT(m_hwnd); + ASSERT(m_MemoryDC); + return m_MemoryDC; +} + + +#ifdef DEBUG +HPALETTE CBaseWindow::GetPalette() +{ + // The palette lock should always be held when accessing + // m_hPalette. + ASSERT(CritCheckIn(&m_PaletteLock)); + return m_hPalette; +} +#endif // DEBUG + + +// This is available to clients who want to change the window visiblity. It's +// little more than an indirection to the Win32 ShowWindow although these is +// some benefit in going through here as this function may change sometime + +HRESULT CBaseWindow::DoShowWindow(LONG ShowCmd) +{ + ShowWindow(m_hwnd,ShowCmd); + return NOERROR; +} + + +// Generate a WM_PAINT message for the video window + +void CBaseWindow::PaintWindow(BOOL bErase) +{ + InvalidateRect(m_hwnd,NULL,bErase); +} + + +// Allow an application to have us set the video window in the foreground. We +// have this because it is difficult for one thread to do do this to a window +// owned by another thread. Rather than expose the message we use to execute +// the inter thread send message we provide the interface function. All we do +// is to SendMessage to the video window renderer thread with a WM_SHOWSTAGE + +void CBaseWindow::DoSetWindowForeground(BOOL bFocus) +{ + SendMessage(m_hwnd,m_ShowStageMessage,(WPARAM) bFocus,(LPARAM) 0); +} + + +// Constructor initialises the owning object pointer. Since we are a worker +// class for the main window object we have relatively few state variables to +// look after. We are given device context handles to use later on as well as +// the source and destination rectangles (but reset them here just in case) + +CDrawImage::CDrawImage(CBaseWindow *pBaseWindow) : + m_pBaseWindow(pBaseWindow), + m_hdc(NULL), + m_MemoryDC(NULL), + m_bStretch(FALSE), + m_pMediaType(NULL), + m_bUsingImageAllocator(FALSE) +{ + ASSERT(pBaseWindow); + ResetPaletteVersion(); + SetRectEmpty(&m_TargetRect); + SetRectEmpty(&m_SourceRect); + + m_perfidRenderTime = MSR_REGISTER(TEXT("Single Blt time")); +} + + +// Overlay the image time stamps on the picture. Access to this method is +// serialised by the caller. We display the sample start and end times on +// top of the video using TextOut on the device context we are handed. If +// there isn't enough room in the window for the times we don't show them + +void CDrawImage::DisplaySampleTimes(IMediaSample *pSample) +{ +#ifdef DEBUG + // + // Only allow the "annoying" time messages if the users has turned the + // logging "way up" + // + BOOL bAccept = DbgCheckModuleLevel(LOG_TRACE, 5); + if (bAccept == FALSE) { + return; + } +#endif + + TCHAR szTimes[TIMELENGTH]; // Time stamp strings + ASSERT(pSample); // Quick sanity check + RECT ClientRect; // Client window size + SIZE Size; // Size of text output + + // Get the time stamps and window size + + pSample->GetTime((REFERENCE_TIME*)&m_StartSample, (REFERENCE_TIME*)&m_EndSample); + HWND hwnd = m_pBaseWindow->GetWindowHWND(); + EXECUTE_ASSERT(GetClientRect(hwnd,&ClientRect)); + + // Format the sample time stamps + + wsprintf(szTimes,TEXT("%08d : %08d"), + m_StartSample.Millisecs(), + m_EndSample.Millisecs()); + + ASSERT(lstrlen(szTimes) < TIMELENGTH); + + // Put the times in the middle at the bottom of the window + + GetTextExtentPoint32(m_hdc,szTimes,lstrlen(szTimes),&Size); + INT XPos = ((ClientRect.right - ClientRect.left) - Size.cx) / 2; + INT YPos = ((ClientRect.bottom - ClientRect.top) - Size.cy) * 4 / 5; + + // Check the window is big enough to have sample times displayed + + if ((XPos > 0) && (YPos > 0)) { + TextOut(m_hdc,XPos,YPos,szTimes,lstrlen(szTimes)); + } +} + + +// This is called when the drawing code sees that the image has a down level +// palette cookie. We simply call the SetDIBColorTable Windows API with the +// palette that is found after the BITMAPINFOHEADER - we return no errors + +void CDrawImage::UpdateColourTable(HDC hdc,BITMAPINFOHEADER *pbmi) +{ + ASSERT(pbmi->biClrUsed); + RGBQUAD *pColourTable = (RGBQUAD *)(pbmi+1); + + // Set the new palette in the device context + + UINT uiReturn = SetDIBColorTable(hdc,(UINT) 0, + pbmi->biClrUsed, + pColourTable); + + // Should always succeed but check in debug builds + ASSERT(uiReturn == pbmi->biClrUsed); +} + + +// No source rectangle scaling is done by the base class + +RECT CDrawImage::ScaleSourceRect(const RECT *pSource) +{ + ASSERT(pSource); + return *pSource; +} + + +// This is called when the funky output pin uses our allocator. The samples we +// allocate are special because the memory is shared between us and GDI thus +// removing one copy when we ask for the image to be rendered. The source type +// information is in the main renderer m_mtIn field which is initialised when +// the media type is agreed in SetMediaType, the media type may be changed on +// the fly if, for example, the source filter needs to change the palette + +void CDrawImage::FastRender(IMediaSample *pMediaSample) +{ + BITMAPINFOHEADER *pbmi; // Image format data + DIBDATA *pDibData; // Stores DIB information + BYTE *pImage; // Pointer to image data + HBITMAP hOldBitmap; // Store the old bitmap + CImageSample *pSample; // Pointer to C++ object + + ASSERT(m_pMediaType); + + // From the untyped source format block get the VIDEOINFO and subsequently + // the BITMAPINFOHEADER structure. We can cast the IMediaSample interface + // to a CImageSample object so we can retrieve it's DIBSECTION details + + pbmi = HEADER(m_pMediaType->Format()); + pSample = (CImageSample *) pMediaSample; + pDibData = pSample->GetDIBData(); + hOldBitmap = (HBITMAP) SelectObject(m_MemoryDC,pDibData->hBitmap); + + // Get a pointer to the real image data + + HRESULT hr = pMediaSample->GetPointer(&pImage); + if (FAILED(hr)) { + return; + } + + // Do we need to update the colour table, we increment our palette cookie + // each time we get a dynamic format change. The sample palette cookie is + // stored in the DIBDATA structure so we try to keep the fields in sync + // By the time we get to draw the images the format change will be done + // so all we do is ask the renderer for what it's palette version is + + if (pDibData->PaletteVersion < GetPaletteVersion()) { + ASSERT(pbmi->biBitCount <= iPALETTE); + UpdateColourTable(m_MemoryDC,pbmi); + pDibData->PaletteVersion = GetPaletteVersion(); + } + + // This allows derived classes to change the source rectangle that we do + // the drawing with. For example a renderer may ask a codec to stretch + // the video from 320x240 to 640x480, in which case the source we see in + // here will still be 320x240, although the source we want to draw with + // should be scaled up to 640x480. The base class implementation of this + // method does nothing but return the same rectangle as we are passed in + + RECT SourceRect = ScaleSourceRect(&m_SourceRect); + + // Is the window the same size as the video + + if (m_bStretch == FALSE) { + + // Put the image straight into the window + + BitBlt( + (HDC) m_hdc, // Target device HDC + m_TargetRect.left, // X sink position + m_TargetRect.top, // Y sink position + m_TargetRect.right - m_TargetRect.left, // Destination width + m_TargetRect.bottom - m_TargetRect.top, // Destination height + m_MemoryDC, // Source device context + SourceRect.left, // X source position + SourceRect.top, // Y source position + SRCCOPY); // Simple copy + + } else { + + // Stretch the image when copying to the window + + StretchBlt( + (HDC) m_hdc, // Target device HDC + m_TargetRect.left, // X sink position + m_TargetRect.top, // Y sink position + m_TargetRect.right - m_TargetRect.left, // Destination width + m_TargetRect.bottom - m_TargetRect.top, // Destination height + m_MemoryDC, // Source device HDC + SourceRect.left, // X source position + SourceRect.top, // Y source position + SourceRect.right - SourceRect.left, // Source width + SourceRect.bottom - SourceRect.top, // Source height + SRCCOPY); // Simple copy + } + + // This displays the sample times over the top of the image. This used to + // draw the times into the offscreen device context however that actually + // writes the text into the image data buffer which may not be writable + + #ifdef DEBUG + DisplaySampleTimes(pMediaSample); + #endif + + // Put the old bitmap back into the device context so we don't leak + SelectObject(m_MemoryDC,hOldBitmap); +} + + +// This is called when there is a sample ready to be drawn, unfortunately the +// output pin was being rotten and didn't choose our super excellent shared +// memory DIB allocator so we have to do this slow render using boring old GDI +// SetDIBitsToDevice and StretchDIBits. The down side of using these GDI +// functions is that the image data has to be copied across from our address +// space into theirs before going to the screen (although in reality the cost +// is small because all they do is to map the buffer into their address space) + +void CDrawImage::SlowRender(IMediaSample *pMediaSample) +{ + // Get the BITMAPINFOHEADER for the connection + + ASSERT(m_pMediaType); + BITMAPINFOHEADER *pbmi = HEADER(m_pMediaType->Format()); + BYTE *pImage; + + // Get the image data buffer + + HRESULT hr = pMediaSample->GetPointer(&pImage); + if (FAILED(hr)) { + return; + } + + // This allows derived classes to change the source rectangle that we do + // the drawing with. For example a renderer may ask a codec to stretch + // the video from 320x240 to 640x480, in which case the source we see in + // here will still be 320x240, although the source we want to draw with + // should be scaled up to 640x480. The base class implementation of this + // method does nothing but return the same rectangle as we are passed in + + RECT SourceRect = ScaleSourceRect(&m_SourceRect); + + LONG lAdjustedSourceTop = SourceRect.top; + // if the origin of bitmap is bottom-left, adjust soruce_rect_top + // to be the bottom-left corner instead of the top-left. + if (pbmi->biHeight > 0) { + lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom; + } + // Is the window the same size as the video + + if (m_bStretch == FALSE) { + + // Put the image straight into the window + + SetDIBitsToDevice( + (HDC) m_hdc, // Target device HDC + m_TargetRect.left, // X sink position + m_TargetRect.top, // Y sink position + m_TargetRect.right - m_TargetRect.left, // Destination width + m_TargetRect.bottom - m_TargetRect.top, // Destination height + SourceRect.left, // X source position + lAdjustedSourceTop, // Adjusted Y source position + (UINT) 0, // Start scan line + pbmi->biHeight, // Scan lines present + pImage, // Image data + (BITMAPINFO *) pbmi, // DIB header + DIB_RGB_COLORS); // Type of palette + + } else { + + // Stretch the image when copying to the window + + StretchDIBits( + (HDC) m_hdc, // Target device HDC + m_TargetRect.left, // X sink position + m_TargetRect.top, // Y sink position + m_TargetRect.right - m_TargetRect.left, // Destination width + m_TargetRect.bottom - m_TargetRect.top, // Destination height + SourceRect.left, // X source position + lAdjustedSourceTop, // Adjusted Y source position + SourceRect.right - SourceRect.left, // Source width + SourceRect.bottom - SourceRect.top, // Source height + pImage, // Image data + (BITMAPINFO *) pbmi, // DIB header + DIB_RGB_COLORS, // Type of palette + SRCCOPY); // Simple image copy + } + + // This shows the sample reference times over the top of the image which + // looks a little flickery. I tried using GdiSetBatchLimit and GdiFlush to + // control the screen updates but it doesn't quite work as expected and + // only partially reduces the flicker. I also tried using a memory context + // and combining the two in that before doing a final BitBlt operation to + // the screen, unfortunately this has considerable performance penalties + // and also means that this code is not executed when compiled retail + + #ifdef DEBUG + DisplaySampleTimes(pMediaSample); + #endif +} + + +// This is called with an IMediaSample interface on the image to be drawn. We +// decide on the drawing mechanism based on who's allocator we are using. We +// may be called when the window wants an image painted by WM_PAINT messages +// We can't realise the palette here because we have the renderer lock, any +// call to realise may cause an interthread send message to the window thread +// which may in turn be waiting to get the renderer lock before servicing it + +BOOL CDrawImage::DrawImage(IMediaSample *pMediaSample) +{ + ASSERT(m_hdc); + ASSERT(m_MemoryDC); + NotifyStartDraw(); + + // If the output pin used our allocator then the samples passed are in + // fact CVideoSample objects that contain CreateDIBSection data that we + // use to do faster image rendering, they may optionally also contain a + // DirectDraw surface pointer in which case we do not do the drawing + + if (m_bUsingImageAllocator == FALSE) { + SlowRender(pMediaSample); + EXECUTE_ASSERT(GdiFlush()); + NotifyEndDraw(); + return TRUE; + } + + // This is a DIBSECTION buffer + + FastRender(pMediaSample); + EXECUTE_ASSERT(GdiFlush()); + NotifyEndDraw(); + return TRUE; +} + + +BOOL CDrawImage::DrawVideoImageHere( + HDC hdc, + IMediaSample *pMediaSample, + LPRECT lprcSrc, + LPRECT lprcDst + ) +{ + ASSERT(m_pMediaType); + BITMAPINFOHEADER *pbmi = HEADER(m_pMediaType->Format()); + BYTE *pImage; + + // Get the image data buffer + + HRESULT hr = pMediaSample->GetPointer(&pImage); + if (FAILED(hr)) { + return FALSE; + } + + RECT SourceRect; + RECT TargetRect; + + if (lprcSrc) + SourceRect = *lprcSrc; + else + SourceRect = ScaleSourceRect(&m_SourceRect); + + if (lprcDst) + TargetRect = *lprcDst; + else + TargetRect = m_TargetRect; + + LONG lAdjustedSourceTop = SourceRect.top; + // if the origin of bitmap is bottom-left, adjust soruce_rect_top + // to be the bottom-left corner instead of the top-left. + if (pbmi->biHeight > 0) { + lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom; + } + + + // Stretch the image when copying to the DC + + BOOL bRet = (0 != StretchDIBits(hdc, + TargetRect.left, + TargetRect.top, + TargetRect.right - TargetRect.left, + TargetRect.bottom - TargetRect.top, + SourceRect.left, + lAdjustedSourceTop, + SourceRect.right - SourceRect.left, + SourceRect.bottom - SourceRect.top, + pImage, + (BITMAPINFO *)pbmi, + DIB_RGB_COLORS, + SRCCOPY)); + return bRet; +} + + +// This is called by the owning window object after it has created the window +// and it's drawing contexts. We are constructed with the base window we'll +// be drawing into so when given the notification we retrive the device HDCs +// to draw with. We cannot call these in our constructor as they are virtual + +void CDrawImage::SetDrawContext() +{ + m_MemoryDC = m_pBaseWindow->GetMemoryHDC(); + m_hdc = m_pBaseWindow->GetWindowHDC(); +} + + +// This is called to set the target rectangle in the video window, it will be +// called whenever a WM_SIZE message is retrieved from the message queue. We +// simply store the rectangle and use it later when we do the drawing calls + +void CDrawImage::SetTargetRect(RECT *pTargetRect) +{ + ASSERT(pTargetRect); + m_TargetRect = *pTargetRect; + SetStretchMode(); +} + + +// Return the current target rectangle + +void CDrawImage::GetTargetRect(RECT *pTargetRect) +{ + ASSERT(pTargetRect); + *pTargetRect = m_TargetRect; +} + + +// This is called when we want to change the section of the image to draw. We +// use this information in the drawing operation calls later on. We must also +// see if the source and destination rectangles have the same dimensions. If +// not we must stretch during the drawing rather than a direct pixel copy + +void CDrawImage::SetSourceRect(RECT *pSourceRect) +{ + ASSERT(pSourceRect); + m_SourceRect = *pSourceRect; + SetStretchMode(); +} + + +// Return the current source rectangle + +void CDrawImage::GetSourceRect(RECT *pSourceRect) +{ + ASSERT(pSourceRect); + *pSourceRect = m_SourceRect; +} + + +// This is called when either the source or destination rectanges change so we +// can update the stretch flag. If the rectangles don't match we stretch the +// video during the drawing otherwise we call the fast pixel copy functions +// NOTE the source and/or the destination rectangle may be completely empty + +void CDrawImage::SetStretchMode() +{ + // Calculate the overall rectangle dimensions + + LONG SourceWidth = m_SourceRect.right - m_SourceRect.left; + LONG SinkWidth = m_TargetRect.right - m_TargetRect.left; + LONG SourceHeight = m_SourceRect.bottom - m_SourceRect.top; + LONG SinkHeight = m_TargetRect.bottom - m_TargetRect.top; + + m_bStretch = TRUE; + if (SourceWidth == SinkWidth) { + if (SourceHeight == SinkHeight) { + m_bStretch = FALSE; + } + } +} + + +// Tell us whose allocator we are using. This should be called with TRUE if +// the filter agrees to use an allocator based around the CImageAllocator +// SDK base class - whose image buffers are made through CreateDIBSection. +// Otherwise this should be called with FALSE and we will draw the images +// using SetDIBitsToDevice and StretchDIBitsToDevice. None of these calls +// can handle buffers which have non zero strides (like DirectDraw uses) + +void CDrawImage::NotifyAllocator(BOOL bUsingImageAllocator) +{ + m_bUsingImageAllocator = bUsingImageAllocator; +} + + +// Are we using the image DIBSECTION allocator + +BOOL CDrawImage::UsingImageAllocator() +{ + return m_bUsingImageAllocator; +} + + +// We need the media type of the connection so that we can get the BITMAPINFO +// from it. We use that in the calls to draw the image such as StretchDIBits +// and also when updating the colour table held in shared memory DIBSECTIONs + +void CDrawImage::NotifyMediaType(CMediaType *pMediaType) +{ + m_pMediaType = pMediaType; +} + + +// We store in this object a cookie maintaining the current palette version. +// Each time a palettised format is changed we increment this value so that +// when we come to draw the images we look at the colour table value they +// have and if less than the current we know to update it. This version is +// only needed and indeed used when working with shared memory DIBSECTIONs + +LONG CDrawImage::GetPaletteVersion() +{ + return m_PaletteVersion; +} + + +// Resets the current palette version number + +void CDrawImage::ResetPaletteVersion() +{ + m_PaletteVersion = PALETTE_VERSION; +} + + +// Increment the current palette version + +void CDrawImage::IncrementPaletteVersion() +{ + m_PaletteVersion++; +} + + +// Constructor must initialise the base allocator. Each sample we create has a +// palette version cookie on board. When the source filter changes the palette +// during streaming the window object increments an internal cookie counter it +// keeps as well. When it comes to render the samples it looks at the cookie +// values and if they don't match then it knows to update the sample's colour +// table. However we always create samples with a cookie of PALETTE_VERSION +// If there have been multiple format changes and we disconnect and reconnect +// thereby causing the samples to be reallocated we will create them with a +// cookie much lower than the current version, this isn't a problem since it +// will be seen by the window object and the versions will then be updated + +CImageAllocator::CImageAllocator(CBaseFilter *pFilter, + TCHAR *pName, + HRESULT *phr) : + CBaseAllocator(pName,NULL,phr,TRUE,TRUE), + m_pFilter(pFilter) +{ + ASSERT(phr); + ASSERT(pFilter); +} + + +// Check our DIB buffers have been released + +#ifdef DEBUG +CImageAllocator::~CImageAllocator() +{ + ASSERT(m_bCommitted == FALSE); +} +#endif + + +// Called from destructor and also from base class to free resources. We work +// our way through the list of media samples deleting the DIBSECTION created +// for each. All samples should be back in our list so there is no chance a +// filter is still using one to write on the display or hold on a pending list + +void CImageAllocator::Free() +{ + ASSERT(m_lAllocated == m_lFree.GetCount()); + EXECUTE_ASSERT(GdiFlush()); + CImageSample *pSample; + DIBDATA *pDibData; + + while (m_lFree.GetCount() != 0) { + pSample = (CImageSample *) m_lFree.RemoveHead(); + pDibData = pSample->GetDIBData(); + EXECUTE_ASSERT(DeleteObject(pDibData->hBitmap)); + EXECUTE_ASSERT(CloseHandle(pDibData->hMapping)); + delete pSample; + } + + m_lAllocated = 0; +} + + +// Prepare the allocator by checking all the input parameters + +STDMETHODIMP CImageAllocator::CheckSizes(ALLOCATOR_PROPERTIES *pRequest) +{ + // Check we have a valid connection + + if (m_pMediaType == NULL) { + return VFW_E_NOT_CONNECTED; + } + + // NOTE We always create a DIB section with the source format type which + // may contain a source palette. When we do the BitBlt drawing operation + // the target display device may contain a different palette (we may not + // have the focus) in which case GDI will do after the palette mapping + + VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *) m_pMediaType->Format(); + + // When we call CreateDIBSection it implicitly maps only enough memory + // for the image as defined by thee BITMAPINFOHEADER. If the user asks + // for an image smaller than this then we reject the call, if they ask + // for an image larger than this then we return what they can have + + if ((DWORD) pRequest->cbBuffer < pVideoInfo->bmiHeader.biSizeImage) { + return E_INVALIDARG; + } + + // Reject buffer prefixes + + if (pRequest->cbPrefix > 0) { + return E_INVALIDARG; + } + + pRequest->cbBuffer = pVideoInfo->bmiHeader.biSizeImage; + return NOERROR; +} + + +// Agree the number of media sample buffers and their sizes. The base class +// this allocator is derived from allows samples to be aligned only on byte +// boundaries NOTE the buffers are not allocated until the Commit call + +STDMETHODIMP CImageAllocator::SetProperties( + ALLOCATOR_PROPERTIES * pRequest, + ALLOCATOR_PROPERTIES * pActual) +{ + ALLOCATOR_PROPERTIES Adjusted = *pRequest; + + // Check the parameters fit with the current connection + + HRESULT hr = CheckSizes(&Adjusted); + if (FAILED(hr)) { + return hr; + } + return CBaseAllocator::SetProperties(&Adjusted, pActual); +} + + +// Commit the memory by allocating the agreed number of media samples. For +// each sample we are committed to creating we have a CImageSample object +// that we use to manage it's resources. This is initialised with a DIBDATA +// structure that contains amongst other things the GDI DIBSECTION handle +// We will access the renderer media type during this so we must have locked +// (to prevent the format changing for example). The class overrides Commit +// and Decommit to do this locking (base class Commit in turn calls Alloc) + +HRESULT CImageAllocator::Alloc(void) +{ + ASSERT(m_pMediaType); + CImageSample *pSample; + DIBDATA DibData; + + // Check the base allocator says it's ok to continue + + HRESULT hr = CBaseAllocator::Alloc(); + if (FAILED(hr)) { + return hr; + } + + // We create a new memory mapped object although we don't map it into our + // address space because GDI does that in CreateDIBSection. It is possible + // that we run out of resources before creating all the samples in which + // case the available sample list is left with those already created + + ASSERT(m_lAllocated == 0); + while (m_lAllocated < m_lCount) { + + // Create and initialise a shared memory GDI buffer + + HRESULT hr = CreateDIB(m_lSize,DibData); + if (FAILED(hr)) { + return hr; + } + + // Create the sample object and pass it the DIBDATA + + pSample = CreateImageSample(DibData.pBase,m_lSize); + if (pSample == NULL) { + EXECUTE_ASSERT(DeleteObject(DibData.hBitmap)); + EXECUTE_ASSERT(CloseHandle(DibData.hMapping)); + return E_OUTOFMEMORY; + } + + // Add the completed sample to the available list + + pSample->SetDIBData(&DibData); + m_lFree.Add(pSample); + m_lAllocated++; + } + return NOERROR; +} + + +// We have a virtual method that allocates the samples so that a derived class +// may override it and allocate more specialised sample objects. So long as it +// derives its samples from CImageSample then all this code will still work ok + +CImageSample *CImageAllocator::CreateImageSample(LPBYTE pData,LONG Length) +{ + HRESULT hr = NOERROR; + CImageSample *pSample; + + // Allocate the new sample and check the return codes + + pSample = new CImageSample((CBaseAllocator *) this, // Base class + NAME("Video sample"), // DEBUG name + (HRESULT *) &hr, // Return code + (LPBYTE) pData, // DIB address + (LONG) Length); // Size of DIB + + if (pSample == NULL || FAILED(hr)) { + delete pSample; + return NULL; + } + return pSample; +} + + +// This function allocates a shared memory block for use by the source filter +// generating DIBs for us to render. The memory block is created in shared +// memory so that GDI doesn't have to copy the memory when we do a BitBlt + +HRESULT CImageAllocator::CreateDIB(LONG InSize,DIBDATA &DibData) +{ + BITMAPINFO *pbmi; // Format information for pin + BYTE *pBase; // Pointer to the actual image + HANDLE hMapping; // Handle to mapped object + HBITMAP hBitmap; // DIB section bitmap handle + + // Create a file mapping object and map into our address space + + hMapping = CreateFileMapping(hMEMORY, // Use system page file + NULL, // No security attributes + PAGE_READWRITE, // Full access to memory + (DWORD) 0, // Less than 4Gb in size + InSize, // Size of buffer + NULL); // No name to section + if (hMapping == NULL) { + DWORD Error = GetLastError(); + return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error); + } + + // NOTE We always create a DIB section with the source format type which + // may contain a source palette. When we do the BitBlt drawing operation + // the target display device may contain a different palette (we may not + // have the focus) in which case GDI will do after the palette mapping + + pbmi = (BITMAPINFO *) HEADER(m_pMediaType->Format()); + if (m_pMediaType == NULL) { + DbgBreak("Invalid media type"); + } + + hBitmap = CreateDIBSection((HDC) NULL, // NO device context + pbmi, // Format information + DIB_RGB_COLORS, // Use the palette + (VOID **) &pBase, // Pointer to image data + hMapping, // Mapped memory handle + (DWORD) 0); // Offset into memory + + if (hBitmap == NULL || pBase == NULL) { + EXECUTE_ASSERT(CloseHandle(hMapping)); + DWORD Error = GetLastError(); + return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error); + } + + // Initialise the DIB information structure + + DibData.hBitmap = hBitmap; + DibData.hMapping = hMapping; + DibData.pBase = pBase; + DibData.PaletteVersion = PALETTE_VERSION; + GetObject(hBitmap,sizeof(DIBSECTION),(VOID *)&DibData.DibSection); + + return NOERROR; +} + + +// We use the media type during the DIBSECTION creation + +void CImageAllocator::NotifyMediaType(CMediaType *pMediaType) +{ + m_pMediaType = pMediaType; +} + + +// Overriden to increment the owning object's reference count + +STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingAddRef() +{ + return m_pFilter->AddRef(); +} + + +// Overriden to decrement the owning object's reference count + +STDMETHODIMP_(ULONG) CImageAllocator::NonDelegatingRelease() +{ + return m_pFilter->Release(); +} + + +// If you derive a class from CMediaSample that has to transport specialised +// member variables and entry points then there are three alternate solutions +// The first is to create a memory buffer larger than actually required by the +// sample and store your information either at the beginning of it or at the +// end, the former being moderately safer allowing for misbehaving transform +// filters. You then adjust the buffer address when you create the base media +// sample. This has the disadvantage of breaking up the memory allocated to +// the samples into separate blocks. The second solution is to implement a +// class derived from CMediaSample and support additional interface(s) that +// convey your private data. This means defining a custom interface. The final +// alternative is to create a class that inherits from CMediaSample and adds +// the private data structures, when you get an IMediaSample in your Receive() +// call check to see if your allocator is being used, and if it is then cast +// the IMediaSample into one of your objects. Additional checks can be made +// to ensure the sample's this pointer is known to be one of your own objects + +CImageSample::CImageSample(CBaseAllocator *pAllocator, + TCHAR *pName, + HRESULT *phr, + LPBYTE pBuffer, + LONG length) : + CMediaSample(pName,pAllocator,phr,pBuffer,length), + m_bInit(FALSE) +{ + ASSERT(pAllocator); + ASSERT(pBuffer); +} + + +// Set the shared memory DIB information + +void CImageSample::SetDIBData(DIBDATA *pDibData) +{ + ASSERT(pDibData); + m_DibData = *pDibData; + m_bInit = TRUE; +} + + +// Retrieve the shared memory DIB data + +DIBDATA *CImageSample::GetDIBData() +{ + ASSERT(m_bInit == TRUE); + return &m_DibData; +} + + +// This class handles the creation of a palette. It is fairly specialist and +// is intended to simplify palette management for video renderer filters. It +// is for this reason that the constructor requires three other objects with +// which it interacts, namely a base media filter, a base window and a base +// drawing object although the base window or the draw object may be NULL to +// ignore that part of us. We try not to create and install palettes unless +// absolutely necessary as they typically require WM_PALETTECHANGED messages +// to be sent to every window thread in the system which is very expensive + +CImagePalette::CImagePalette(CBaseFilter *pBaseFilter, + CBaseWindow *pBaseWindow, + CDrawImage *pDrawImage) : + m_pBaseWindow(pBaseWindow), + m_pFilter(pBaseFilter), + m_pDrawImage(pDrawImage), + m_hPalette(NULL) +{ + ASSERT(m_pFilter); +} + + +// Destructor + +#ifdef DEBUG +CImagePalette::~CImagePalette() +{ + ASSERT(m_hPalette == NULL); +} +#endif + + +// We allow dynamic format changes of the palette but rather than change the +// palette every time we call this to work out whether an update is required. +// If the original type didn't use a palette and the new one does (or vica +// versa) then we return TRUE. If neither formats use a palette we'll return +// FALSE. If both formats use a palette we compare their colours and return +// FALSE if they match. This therefore short circuits palette creation unless +// absolutely necessary since installing palettes is an expensive operation + +BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo, + const VIDEOINFOHEADER *pOldInfo) +{ + // We may not have a current format yet + + if (pOldInfo == NULL) { + return TRUE; + } + + // Do both formats not require a palette + + if (ContainsPalette(pNewInfo) == FALSE) { + if (ContainsPalette(pOldInfo) == FALSE) { + return FALSE; + } + } + + // Compare the colours to see if they match + + DWORD VideoEntries = pNewInfo->bmiHeader.biClrUsed; + if (ContainsPalette(pNewInfo) == TRUE) + if (ContainsPalette(pOldInfo) == TRUE) + if (pOldInfo->bmiHeader.biClrUsed == VideoEntries) + if (pOldInfo->bmiHeader.biClrUsed > 0) + if (memcmp((PVOID) GetBitmapPalette(pNewInfo), + (PVOID) GetBitmapPalette(pOldInfo), + VideoEntries * sizeof(RGBQUAD)) == 0) { + + return FALSE; + } + return TRUE; +} + + +// This is normally called when the input pin type is set to install a palette +// We will typically be called from two different places. The first is when we +// have negotiated a palettised media type after connection, the other is when +// we receive a new type during processing with an updated palette in which +// case we must remove and release the resources held by the current palette + +// We can be passed an optional device name if we wish to prepare a palette +// for a specific monitor on a multi monitor system + +HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew, + const CMediaType *pmtOld, + LPSTR szDevice) +{ + const VIDEOINFOHEADER *pNewInfo = (VIDEOINFOHEADER *) pmtNew->Format(); + const VIDEOINFOHEADER *pOldInfo = (VIDEOINFOHEADER *) pmtOld->Format(); + ASSERT(pNewInfo); + + // This is an performance optimisation, when we get a media type we check + // to see if the format requires a palette change. If either we need one + // when previously we didn't or vica versa then this returns TRUE, if we + // previously needed a palette and we do now it compares their colours + + if (ShouldUpdate(pNewInfo,pOldInfo) == FALSE) { + NOTE("No update needed"); + return S_FALSE; + } + + // We must notify the filter graph that the application may have changed + // the palette although in practice we don't bother checking to see if it + // is really different. If it tries to get the palette either the window + // or renderer lock will ensure it doesn't get in until we are finished + + RemovePalette(); + m_pFilter->NotifyEvent(EC_PALETTE_CHANGED,0,0); + + // Do we need a palette for the new format + + if (ContainsPalette(pNewInfo) == FALSE) { + NOTE("New has no palette"); + return S_FALSE; + } + + if (m_pBaseWindow) { + m_pBaseWindow->LockPaletteLock(); + } + + // If we're changing the palette on the fly then we increment our palette + // cookie which is compared against the cookie also stored in all of our + // DIBSECTION media samples. If they don't match when we come to draw it + // then we know the sample is out of date and we'll update it's palette + + NOTE("Making new colour palette"); + m_hPalette = MakePalette(pNewInfo, szDevice); + ASSERT(m_hPalette != NULL); + + if (m_pBaseWindow) { + m_pBaseWindow->UnlockPaletteLock(); + } + + // The window in which the new palette is to be realised may be a NULL + // pointer to signal that no window is in use, if so we don't call it + // Some filters just want to use this object to create/manage palettes + + if (m_pBaseWindow) m_pBaseWindow->SetPalette(m_hPalette); + + // This is the only time where we need access to the draw object to say + // to it that a new palette will be arriving on a sample real soon. The + // constructor may take a NULL pointer in which case we don't call this + + if (m_pDrawImage) m_pDrawImage->IncrementPaletteVersion(); + return NOERROR; +} + + +// Helper function to copy a palette out of any kind of VIDEOINFO (ie it may +// be YUV or true colour) into a palettised VIDEOINFO. We use this changing +// palettes on DirectDraw samples as a source filter can attach a palette to +// any buffer (eg YUV) and hand it back. We make a new palette out of that +// format and then copy the palette colours into the current connection type + +HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc,CMediaType *pDest) +{ + // Reset the destination palette before starting + + VIDEOINFOHEADER *pDestInfo = (VIDEOINFOHEADER *) pDest->Format(); + pDestInfo->bmiHeader.biClrUsed = 0; + pDestInfo->bmiHeader.biClrImportant = 0; + + // Does the destination have a palette + + if (PALETTISED(pDestInfo) == FALSE) { + NOTE("No destination palette"); + return S_FALSE; + } + + // Does the source contain a palette + + const VIDEOINFOHEADER *pSrcInfo = (VIDEOINFOHEADER *) pSrc->Format(); + if (ContainsPalette(pSrcInfo) == FALSE) { + NOTE("No source palette"); + return S_FALSE; + } + + // The number of colours may be zero filled + + DWORD PaletteEntries = pSrcInfo->bmiHeader.biClrUsed; + if (PaletteEntries == 0) { + DWORD Maximum = (1 << pSrcInfo->bmiHeader.biBitCount); + NOTE1("Setting maximum colours (%d)",Maximum); + PaletteEntries = Maximum; + } + + // Make sure the destination has enough room for the palette + + ASSERT(pSrcInfo->bmiHeader.biClrUsed <= iPALETTE_COLORS); + ASSERT(pSrcInfo->bmiHeader.biClrImportant <= PaletteEntries); + ASSERT(COLORS(pDestInfo) == GetBitmapPalette(pDestInfo)); + pDestInfo->bmiHeader.biClrUsed = PaletteEntries; + pDestInfo->bmiHeader.biClrImportant = pSrcInfo->bmiHeader.biClrImportant; + ULONG BitmapSize = GetBitmapFormatSize(HEADER(pSrcInfo)); + + if (pDest->FormatLength() < BitmapSize) { + NOTE("Reallocating destination"); + pDest->ReallocFormatBuffer(BitmapSize); + } + + // Now copy the palette colours across + + CopyMemory((PVOID) COLORS(pDestInfo), + (PVOID) GetBitmapPalette(pSrcInfo), + PaletteEntries * sizeof(RGBQUAD)); + + return NOERROR; +} + + +// This is normally called when the palette is changed (typically during a +// dynamic format change) to remove any palette we previously installed. We +// replace it (if necessary) in the video window with a standard VGA palette +// that should always be available even if this is a true colour display + +HRESULT CImagePalette::RemovePalette() +{ + if (m_pBaseWindow) { + m_pBaseWindow->LockPaletteLock(); + } + + // Do we have a palette to remove + + if (m_hPalette != NULL) { + + if (m_pBaseWindow) { + // Make sure that the window's palette handle matches + // our palette handle. + ASSERT(m_hPalette == m_pBaseWindow->GetPalette()); + + m_pBaseWindow->UnsetPalette(); + } + + EXECUTE_ASSERT(DeleteObject(m_hPalette)); + m_hPalette = NULL; + } + + if (m_pBaseWindow) { + m_pBaseWindow->UnlockPaletteLock(); + } + + return NOERROR; +} + + +// Called to create a palette for the object, the data structure used by GDI +// to describe a palette is a LOGPALETTE, this includes a variable number of +// PALETTEENTRY fields which are the colours, we have to convert the RGBQUAD +// colour fields we are handed in a BITMAPINFO from the media type into these +// This handles extraction of palettes from true colour and YUV media formats + +// We can be passed an optional device name if we wish to prepare a palette +// for a specific monitor on a multi monitor system + +HPALETTE CImagePalette::MakePalette(const VIDEOINFOHEADER *pVideoInfo, LPSTR szDevice) +{ + ASSERT(ContainsPalette(pVideoInfo) == TRUE); + ASSERT(pVideoInfo->bmiHeader.biClrUsed <= iPALETTE_COLORS); + BITMAPINFOHEADER *pHeader = HEADER(pVideoInfo); + + const RGBQUAD *pColours; // Pointer to the palette + LOGPALETTE *lp; // Used to create a palette + HPALETTE hPalette; // Logical palette object + + lp = (LOGPALETTE *) new BYTE[sizeof(LOGPALETTE) + SIZE_PALETTE]; + if (lp == NULL) { + return NULL; + } + + // Unfortunately for some hare brained reason a GDI palette entry (a + // PALETTEENTRY structure) is different to a palette entry from a DIB + // format (a RGBQUAD structure) so we have to do the field conversion + // The VIDEOINFO containing the palette may be a true colour type so + // we use GetBitmapPalette to skip over any bit fields if they exist + + lp->palVersion = PALVERSION; + lp->palNumEntries = (USHORT) pHeader->biClrUsed; + if (lp->palNumEntries == 0) + lp->palNumEntries = (WORD) (1 << pHeader->biBitCount); + pColours = GetBitmapPalette(pVideoInfo); + + for (DWORD dwCount = 0;dwCount < lp->palNumEntries;dwCount++) { + lp->palPalEntry[dwCount].peRed = pColours[dwCount].rgbRed; + lp->palPalEntry[dwCount].peGreen = pColours[dwCount].rgbGreen; + lp->palPalEntry[dwCount].peBlue = pColours[dwCount].rgbBlue; + lp->palPalEntry[dwCount].peFlags = 0; + } + + MakeIdentityPalette(lp->palPalEntry, lp->palNumEntries, szDevice); + + // Create a logical palette + + hPalette = CreatePalette(lp); + ASSERT(hPalette != NULL); + delete[] lp; + return hPalette; +} + + +// GDI does a fair job of compressing the palette entries you give it, so for +// example if you have five entries with an RGB colour (0,0,0) it will remove +// all but one of them. When you subsequently draw an image it will map from +// your logical palette to the compressed device palette. This function looks +// to see if it is trying to be an identity palette and if so sets the flags +// field in the PALETTEENTRYs so they remain expanded to boost performance + +// We can be passed an optional device name if we wish to prepare a palette +// for a specific monitor on a multi monitor system + +HRESULT CImagePalette::MakeIdentityPalette(PALETTEENTRY *pEntry,INT iColours, LPSTR szDevice) +{ + PALETTEENTRY SystemEntries[10]; // System palette entries + BOOL bIdentityPalette = TRUE; // Is an identity palette + ASSERT(iColours <= iPALETTE_COLORS); // Should have a palette + const int PalLoCount = 10; // First ten reserved colours + const int PalHiStart = 246; // Last VGA palette entries + + // Does this have the full colour range + + if (iColours < 10) { + return S_FALSE; + } + + // Apparently some displays have odd numbers of system colours + + // Get a DC on the right monitor - it's ugly, but this is the way you have + // to do it + HDC hdc; + if (szDevice == NULL || lstrcmpiA(szDevice, "DISPLAY") == 0) + hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); + else + hdc = CreateDCA(NULL, szDevice, NULL, NULL); + if (NULL == hdc) { + return E_OUTOFMEMORY; + } + INT Reserved = GetDeviceCaps(hdc,NUMRESERVED); + if (Reserved != 20) { + DeleteDC(hdc); + return S_FALSE; + } + + // Compare our palette against the first ten system entries. The reason I + // don't do a memory compare between our two arrays of colours is because + // I am not sure what will be in the flags fields for the system entries + + UINT Result = GetSystemPaletteEntries(hdc,0,PalLoCount,SystemEntries); + UINT Count; + for (Count = 0;Count < Result;Count++) { + if (SystemEntries[Count].peRed != pEntry[Count].peRed || + SystemEntries[Count].peGreen != pEntry[Count].peGreen || + SystemEntries[Count].peBlue != pEntry[Count].peBlue) { + bIdentityPalette = FALSE; + } + } + + // And likewise compare against the last ten entries + + Result = GetSystemPaletteEntries(hdc,PalHiStart,PalLoCount,SystemEntries); + for (Count = 0;Count < Result;Count++) { + if (INT(Count) + PalHiStart < iColours) { + if (SystemEntries[Count].peRed != pEntry[PalHiStart + Count].peRed || + SystemEntries[Count].peGreen != pEntry[PalHiStart + Count].peGreen || + SystemEntries[Count].peBlue != pEntry[PalHiStart + Count].peBlue) { + bIdentityPalette = FALSE; + } + } + } + + // If not an identity palette then return S_FALSE + + DeleteDC(hdc); + if (bIdentityPalette == FALSE) { + return S_FALSE; + } + + // Set the non VGA entries so that GDI doesn't map them + + for (Count = PalLoCount;INT(Count) < min(PalHiStart,iColours);Count++) { + pEntry[Count].peFlags = PC_NOCOLLAPSE; + } + return NOERROR; +} + + +// Constructor initialises the VIDEOINFO we keep storing the current display +// format. The format can be changed at any time, to reset the format held +// by us call the RefreshDisplayType directly (it's a public method). Since +// more than one thread will typically call us (ie window threads resetting +// the type and source threads in the type checking methods) we have a lock + +CImageDisplay::CImageDisplay() +{ + RefreshDisplayType(NULL); +} + + + +// This initialises the format we hold which contains the display device type +// We do a conversion on the display device type in here so that when we start +// type checking input formats we can assume that certain fields have been set +// correctly, an example is when we make the 16 bit mask fields explicit. This +// is normally called when we receive WM_DEVMODECHANGED device change messages + +// The optional szDeviceName parameter tells us which monitor we are interested +// in for a multi monitor system + +HRESULT CImageDisplay::RefreshDisplayType(LPSTR szDeviceName) +{ + CAutoLock cDisplayLock(this); + + // Set the preferred format type + + ZeroMemory((PVOID)&m_Display,sizeof(VIDEOINFOHEADER)+sizeof(TRUECOLORINFO)); + m_Display.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + m_Display.bmiHeader.biBitCount = FALSE; + + // Get the bit depth of a device compatible bitmap + + // get caps of whichever monitor they are interested in (multi monitor) + HDC hdcDisplay; + // it's ugly, but this is the way you have to do it + if (szDeviceName == NULL || lstrcmpiA(szDeviceName, "DISPLAY") == 0) + hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL); + else + hdcDisplay = CreateDCA(NULL, szDeviceName, NULL, NULL); + if (hdcDisplay == NULL) { + ASSERT(FALSE); + DbgLog((LOG_ERROR,1,TEXT("ACK! Can't get a DC for %hs"), + szDeviceName ? szDeviceName : "")); + return E_FAIL; + } else { + DbgLog((LOG_TRACE,3,TEXT("Created a DC for %s"), + szDeviceName ? szDeviceName : "")); + } + HBITMAP hbm = CreateCompatibleBitmap(hdcDisplay,1,1); + if ( hbm ) + { + GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS); + + // This call will get the colour table or the proper bitfields + GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS); + DeleteObject(hbm); + } + DeleteDC(hdcDisplay); + + // Complete the display type initialisation + + ASSERT(CheckHeaderValidity(&m_Display)); + UpdateFormat(&m_Display); + DbgLog((LOG_TRACE,3,TEXT("New DISPLAY bit depth =%d"), + m_Display.bmiHeader.biBitCount)); + return NOERROR; +} + + +// We assume throughout this code that any bitfields masks are allowed no +// more than eight bits to store a colour component. This checks that the +// bit count assumption is enforced and also makes sure that all the bits +// set are contiguous. We return a boolean TRUE if the field checks out ok + +BOOL CImageDisplay::CheckBitFields(const VIDEOINFO *pInput) +{ + DWORD *pBitFields = (DWORD *) BITMASKS(pInput); + + for (INT iColour = iRED;iColour <= iBLUE;iColour++) { + + // First of all work out how many bits are set + + DWORD SetBits = CountSetBits(pBitFields[iColour]); + if (SetBits > iMAXBITS || SetBits == 0) { + NOTE1("Bit fields for component %d invalid",iColour); + return FALSE; + } + + // Next work out the number of zero bits prefix + DWORD PrefixBits = CountPrefixBits(pBitFields[iColour]); + + // This is going to see if all the bits set are contiguous (as they + // should be). We know how much to shift them right by from the + // count of prefix bits. The number of bits set defines a mask, we + // invert this (ones complement) and AND it with the shifted bit + // fields. If the result is NON zero then there are bit(s) sticking + // out the left hand end which means they are not contiguous + + DWORD TestField = pBitFields[iColour] >> PrefixBits; + DWORD Mask = ULONG_MAX << SetBits; + if (TestField & Mask) { + NOTE1("Bit fields for component %d not contiguous",iColour); + return FALSE; + } + } + return TRUE; +} + + +// This counts the number of bits set in the input field + +DWORD CImageDisplay::CountSetBits(DWORD Field) +{ + // This is a relatively well known bit counting algorithm + + DWORD Count = 0; + DWORD init = Field; + + // Until the input is exhausted, count the number of bits + + while (init) { + init = init & (init - 1); // Turn off the bottommost bit + Count++; + } + return Count; +} + + +// This counts the number of zero bits upto the first one set NOTE the input +// field should have been previously checked to ensure there is at least one +// set although if we don't find one set we return the impossible value 32 + +DWORD CImageDisplay::CountPrefixBits(DWORD Field) +{ + DWORD Mask = 1; + DWORD Count = 0; + + while (TRUE) { + if (Field & Mask) { + return Count; + } + Count++; + + ASSERT(Mask != 0x80000000); + if (Mask == 0x80000000) { + return Count; + } + Mask <<= 1; + } +} + + +// This is called to check the BITMAPINFOHEADER for the input type. There are +// many implicit dependancies between the fields in a header structure which +// if we validate now make for easier manipulation in subsequent handling. We +// also check that the BITMAPINFOHEADER matches it's specification such that +// fields likes the number of planes is one, that it's structure size is set +// correctly and that the bitmap dimensions have not been set as negative + +BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput) +{ + // Check the bitmap width and height are not negative. + + if (pInput->bmiHeader.biWidth <= 0 || + pInput->bmiHeader.biHeight <= 0) { + NOTE("Invalid bitmap dimensions"); + return FALSE; + } + + // Check the compression is either BI_RGB or BI_BITFIELDS + + if (pInput->bmiHeader.biCompression != BI_RGB) { + if (pInput->bmiHeader.biCompression != BI_BITFIELDS) { + NOTE("Invalid compression format"); + return FALSE; + } + } + + // If BI_BITFIELDS compression format check the colour depth + + if (pInput->bmiHeader.biCompression == BI_BITFIELDS) { + if (pInput->bmiHeader.biBitCount != 16) { + if (pInput->bmiHeader.biBitCount != 32) { + NOTE("BI_BITFIELDS not 16/32 bit depth"); + return FALSE; + } + } + } + + // Check the assumptions about the layout of the bit fields + + if (pInput->bmiHeader.biCompression == BI_BITFIELDS) { + if (CheckBitFields(pInput) == FALSE) { + NOTE("Bit fields are not valid"); + return FALSE; + } + } + + // Are the number of planes equal to one + + if (pInput->bmiHeader.biPlanes != 1) { + NOTE("Number of planes not one"); + return FALSE; + } + + // Check the image size is consistent (it can be zero) + + if (pInput->bmiHeader.biSizeImage != GetBitmapSize(&pInput->bmiHeader)) { + if (pInput->bmiHeader.biSizeImage) { + NOTE("Image size incorrectly set"); + return FALSE; + } + } + + // Check the size of the structure + + if (pInput->bmiHeader.biSize != sizeof(BITMAPINFOHEADER)) { + NOTE("Size of BITMAPINFOHEADER wrong"); + return FALSE; + } + return CheckPaletteHeader(pInput); +} + + +// This runs a few simple tests against the palette fields in the input to +// see if it looks vaguely correct. The tests look at the number of palette +// colours present, the number considered important and the biCompression +// field which should always be BI_RGB as no other formats are meaningful + +BOOL CImageDisplay::CheckPaletteHeader(const VIDEOINFO *pInput) +{ + // The checks here are for palettised videos only + + if (PALETTISED(pInput) == FALSE) { + if (pInput->bmiHeader.biClrUsed) { + NOTE("Invalid palette entries"); + return FALSE; + } + return TRUE; + } + + // Compression type of BI_BITFIELDS is meaningless for palette video + + if (pInput->bmiHeader.biCompression != BI_RGB) { + NOTE("Palettised video must be BI_RGB"); + return FALSE; + } + + // Check the number of palette colours is correct + + if (pInput->bmiHeader.biClrUsed > PALETTE_ENTRIES(pInput)) { + NOTE("Too many colours in palette"); + return FALSE; + } + + // The number of important colours shouldn't exceed the number used + + if (pInput->bmiHeader.biClrImportant > pInput->bmiHeader.biClrUsed) { + NOTE("Too many important colours"); + return FALSE; + } + return TRUE; +} + + +// Return the format of the video display + +const VIDEOINFO *CImageDisplay::GetDisplayFormat() +{ + return &m_Display; +} + + +// Return TRUE if the display uses a palette + +BOOL CImageDisplay::IsPalettised() +{ + return PALETTISED(&m_Display); +} + + +// Return the bit depth of the current display setting + +WORD CImageDisplay::GetDisplayDepth() +{ + return m_Display.bmiHeader.biBitCount; +} + + +// Initialise the optional fields in a VIDEOINFO. These are mainly to do with +// the source and destination rectangles and palette information such as the +// number of colours present. It simplifies our code just a little if we don't +// have to keep checking for all the different valid permutations in a header +// every time we want to do anything with it (an example would be creating a +// palette). We set the base class media type before calling this function so +// that the media types between the pins match after a connection is made + +HRESULT CImageDisplay::UpdateFormat(VIDEOINFO *pVideoInfo) +{ + ASSERT(pVideoInfo); + + BITMAPINFOHEADER *pbmi = HEADER(pVideoInfo); + SetRectEmpty(&pVideoInfo->rcSource); + SetRectEmpty(&pVideoInfo->rcTarget); + + // Set the number of colours explicitly + + if (PALETTISED(pVideoInfo)) { + if (pVideoInfo->bmiHeader.biClrUsed == 0) { + pVideoInfo->bmiHeader.biClrUsed = PALETTE_ENTRIES(pVideoInfo); + } + } + + // The number of important colours shouldn't exceed the number used, on + // some displays the number of important colours is not initialised when + // retrieving the display type so we set the colours used correctly + + if (pVideoInfo->bmiHeader.biClrImportant > pVideoInfo->bmiHeader.biClrUsed) { + pVideoInfo->bmiHeader.biClrImportant = PALETTE_ENTRIES(pVideoInfo); + } + + // Change the image size field to be explicit + + if (pVideoInfo->bmiHeader.biSizeImage == 0) { + pVideoInfo->bmiHeader.biSizeImage = GetBitmapSize(&pVideoInfo->bmiHeader); + } + return NOERROR; +} + + +// Lots of video rendering filters want code to check proposed formats are ok +// This checks the VIDEOINFO we are passed as a media type. If the media type +// is a valid media type then we return NOERROR otherwise E_INVALIDARG. Note +// however we only accept formats that can be easily displayed in the display +// so if we are on a 16 bit device we will not accept 24 bit images. The one +// complexity is that most displays draw 8 bit palettised images efficiently +// Also if the input format is less colour bits per pixel then we also accept + +HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput) +{ + // First of all check the VIDEOINFOHEADER looks correct + + if (CheckHeaderValidity(pInput) == FALSE) { + return E_INVALIDARG; + } + + // Virtually all devices support palettised images efficiently + + if (m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount) { + if (PALETTISED(pInput) == TRUE) { + ASSERT(PALETTISED(&m_Display) == TRUE); + NOTE("(Video) Type connection ACCEPTED"); + return NOERROR; + } + } + + + // Is the display depth greater than the input format + + if (m_Display.bmiHeader.biBitCount > pInput->bmiHeader.biBitCount) { + NOTE("(Video) Mismatch agreed"); + return NOERROR; + } + + // Is the display depth less than the input format + + if (m_Display.bmiHeader.biBitCount < pInput->bmiHeader.biBitCount) { + NOTE("(Video) Format mismatch"); + return E_INVALIDARG; + } + + + // Both input and display formats are either BI_RGB or BI_BITFIELDS + + ASSERT(m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount); + ASSERT(PALETTISED(pInput) == FALSE); + ASSERT(PALETTISED(&m_Display) == FALSE); + + // BI_RGB 16 bit representation is implicitly RGB555, and likewise BI_RGB + // 24 bit representation is RGB888. So we initialise a pointer to the bit + // fields they really mean and check against the display device format + // This is only going to be called when both formats are equal bits pixel + + const DWORD *pInputMask = GetBitMasks(pInput); + const DWORD *pDisplayMask = GetBitMasks((VIDEOINFO *)&m_Display); + + if (pInputMask[iRED] != pDisplayMask[iRED] || + pInputMask[iGREEN] != pDisplayMask[iGREEN] || + pInputMask[iBLUE] != pDisplayMask[iBLUE]) { + + NOTE("(Video) Bit field mismatch"); + return E_INVALIDARG; + } + + NOTE("(Video) Type connection ACCEPTED"); + return NOERROR; +} + + +// Return the bit masks for the true colour VIDEOINFO provided + +const DWORD *CImageDisplay::GetBitMasks(const VIDEOINFO *pVideoInfo) +{ + static const DWORD FailMasks[] = {0,0,0}; + + if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) { + return BITMASKS(pVideoInfo); + } + + ASSERT(pVideoInfo->bmiHeader.biCompression == BI_RGB); + + switch (pVideoInfo->bmiHeader.biBitCount) { + case 16: return bits555; + case 24: return bits888; + case 32: return bits888; + default: return FailMasks; + } +} + + +// Check to see if we can support media type pmtIn as proposed by the output +// pin - We first check that the major media type is video and also identify +// the media sub type. Then we thoroughly check the VIDEOINFO type provided +// As well as the contained VIDEOINFO being correct the major type must be +// video, the subtype a recognised video format and the type GUID correct + +HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn) +{ + // Does this have a VIDEOINFOHEADER format block + + const GUID *pFormatType = pmtIn->FormatType(); + if (*pFormatType != FORMAT_VideoInfo) { + NOTE("Format GUID not a VIDEOINFOHEADER"); + return E_INVALIDARG; + } + ASSERT(pmtIn->Format()); + + // Check the format looks reasonably ok + + ULONG Length = pmtIn->FormatLength(); + if (Length < SIZE_VIDEOHEADER) { + NOTE("Format smaller than a VIDEOHEADER"); + return E_FAIL; + } + + VIDEOINFO *pInput = (VIDEOINFO *) pmtIn->Format(); + + // Check the major type is MEDIATYPE_Video + + const GUID *pMajorType = pmtIn->Type(); + if (*pMajorType != MEDIATYPE_Video) { + NOTE("Major type not MEDIATYPE_Video"); + return E_INVALIDARG; + } + + // Check we can identify the media subtype + + const GUID *pSubType = pmtIn->Subtype(); + if (GetBitCount(pSubType) == USHRT_MAX) { + NOTE("Invalid video media subtype"); + return E_INVALIDARG; + } + return CheckVideoType(pInput); +} + + +// Given a video format described by a VIDEOINFO structure we return the mask +// that is used to obtain the range of acceptable colours for this type, for +// example, the mask for a 24 bit true colour format is 0xFF in all cases. A +// 16 bit 5:6:5 display format uses 0xF8, 0xFC and 0xF8, therefore given any +// RGB triplets we can AND them with these fields to find one that is valid + +BOOL CImageDisplay::GetColourMask(DWORD *pMaskRed, + DWORD *pMaskGreen, + DWORD *pMaskBlue) +{ + CAutoLock cDisplayLock(this); + *pMaskRed = 0xFF; + *pMaskGreen = 0xFF; + *pMaskBlue = 0xFF; + + // If this format is palettised then it doesn't have bit fields + + if (m_Display.bmiHeader.biBitCount < 16) { + return FALSE; + } + + // If this is a 24 bit true colour display then it can handle all the + // possible colour component ranges described by a byte. It is never + // allowed for a 24 bit colour depth image to have BI_BITFIELDS set + + if (m_Display.bmiHeader.biBitCount == 24) { + ASSERT(m_Display.bmiHeader.biCompression == BI_RGB); + return TRUE; + } + + // Calculate the mask based on the format's bit fields + + const DWORD *pBitFields = (DWORD *) GetBitMasks((VIDEOINFO *)&m_Display); + DWORD *pOutputMask[] = { pMaskRed, pMaskGreen, pMaskBlue }; + + // We know from earlier testing that there are no more than iMAXBITS + // bits set in the mask and that they are all contiguous. All that + // therefore remains is to shift them into the correct position + + for (INT iColour = iRED;iColour <= iBLUE;iColour++) { + + // This works out how many bits there are and where they live + + DWORD PrefixBits = CountPrefixBits(pBitFields[iColour]); + DWORD SetBits = CountSetBits(pBitFields[iColour]); + + // The first shift moves the bit field so that it is right justified + // in the DWORD, after which we then shift it back left which then + // puts the leading bit in the bytes most significant bit position + + *(pOutputMask[iColour]) = pBitFields[iColour] >> PrefixBits; + *(pOutputMask[iColour]) <<= (iMAXBITS - SetBits); + } + return TRUE; +} + + +/* Helper to convert to VIDEOINFOHEADER2 +*/ +STDAPI ConvertVideoInfoToVideoInfo2(AM_MEDIA_TYPE *pmt) +{ + ASSERT(pmt->formattype == FORMAT_VideoInfo); + VIDEOINFO *pVideoInfo = (VIDEOINFO *)pmt->pbFormat; + PVOID pvNew = CoTaskMemAlloc(pmt->cbFormat + sizeof(VIDEOINFOHEADER2) - + sizeof(VIDEOINFOHEADER)); + if (pvNew == NULL) { + return E_OUTOFMEMORY; + } + CopyMemory(pvNew, pmt->pbFormat, FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader)); + ZeroMemory((PBYTE)pvNew + FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader), + sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER)); + CopyMemory((PBYTE)pvNew + FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader), + pmt->pbFormat + FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader), + pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader)); + VIDEOINFOHEADER2 *pVideoInfo2 = (VIDEOINFOHEADER2 *)pvNew; + pVideoInfo2->dwPictAspectRatioX = (DWORD)pVideoInfo2->bmiHeader.biWidth; + pVideoInfo2->dwPictAspectRatioY = (DWORD)pVideoInfo2->bmiHeader.biHeight; + pmt->formattype = FORMAT_VideoInfo2; + CoTaskMemFree(pmt->pbFormat); + pmt->pbFormat = (PBYTE)pvNew; + pmt->cbFormat += sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER); + return S_OK; +} diff --git a/src/BaseClasses/winutil.h b/src/BaseClasses/winutil.h index 1f8b9de6d7..cb002c9324 100644 --- a/src/BaseClasses/winutil.h +++ b/src/BaseClasses/winutil.h @@ -1,414 +1,414 @@ -//------------------------------------------------------------------------------ -// File: WinUtil.h -// -// Desc: DirectShow base classes - defines generic handler classes. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -// Make sure that you call PrepareWindow to initialise the window after -// the object has been constructed. It is a separate method so that -// derived classes can override useful methods like MessageLoop. Also -// any derived class must call DoneWithWindow in its destructor. If it -// doesn't a message may be retrieved and call a derived class member -// function while a thread is executing the base class destructor code - -#ifndef __WINUTIL__ -#define __WINUTIL__ - -const int DEFWIDTH = 320; // Initial window width -const int DEFHEIGHT = 240; // Initial window height -const int CAPTION = 256; // Maximum length of caption -const int TIMELENGTH = 50; // Maximum length of times -const int PROFILESTR = 128; // Normal profile string -const WORD PALVERSION = 0x300; // GDI palette version -const LONG PALETTE_VERSION = (LONG) 1; // Initial palette version -const COLORREF VIDEO_COLOUR = 0; // Defaults to black background -const HANDLE hMEMORY = (HANDLE) (-1); // Says to open as memory file - -#define WIDTH(x) ((*(x)).right - (*(x)).left) -#define HEIGHT(x) ((*(x)).bottom - (*(x)).top) -#define SHOWSTAGE TEXT("WM_SHOWSTAGE") -#define SHOWSTAGETOP TEXT("WM_SHOWSTAGETOP") -#define REALIZEPALETTE TEXT("WM_REALIZEPALETTE") - -class AM_NOVTABLE CBaseWindow -{ -protected: - - HINSTANCE m_hInstance; // Global module instance handle - HWND m_hwnd; // Handle for our window - HDC m_hdc; // Device context for the window - LONG m_Width; // Client window width - LONG m_Height; // Client window height - BOOL m_bActivated; // Has the window been activated - LPTSTR m_pClassName; // Static string holding class name - DWORD m_ClassStyles; // Passed in to our constructor - DWORD m_WindowStyles; // Likewise the initial window styles - DWORD m_WindowStylesEx; // And the extended window styles - UINT m_ShowStageMessage; // Have the window shown with focus - UINT m_ShowStageTop; // Makes the window WS_EX_TOPMOST - UINT m_RealizePalette; // Makes us realize our new palette - HDC m_MemoryDC; // Used for fast BitBlt operations - HPALETTE m_hPalette; // Handle to any palette we may have - BYTE m_bNoRealize; // Don't realize palette now - BYTE m_bBackground; // Should we realise in background - BYTE m_bRealizing; // already realizing the palette - CCritSec m_WindowLock; // Serialise window object access - BOOL m_bDoGetDC; // Should this window get a DC - bool m_bDoPostToDestroy; // Use PostMessage to destroy - CCritSec m_PaletteLock; // This lock protects m_hPalette. - // It should be held anytime the - // program use the value of m_hPalette. - - // Maps windows message procedure into C++ methods - friend LRESULT CALLBACK WndProc(HWND hwnd, // Window handle - UINT uMsg, // Message ID - WPARAM wParam, // First parameter - LPARAM lParam); // Other parameter - - virtual LRESULT OnPaletteChange(HWND hwnd, UINT Message); - -public: - - CBaseWindow(BOOL bDoGetDC = TRUE, bool bPostToDestroy = false); - -#ifdef DEBUG - virtual ~CBaseWindow(); -#endif - - virtual HRESULT DoneWithWindow(); - virtual HRESULT PrepareWindow(); - virtual HRESULT InactivateWindow(); - virtual HRESULT ActivateWindow(); - virtual BOOL OnSize(LONG Width, LONG Height); - virtual BOOL OnClose(); - virtual RECT GetDefaultRect(); - virtual HRESULT UninitialiseWindow(); - virtual HRESULT InitialiseWindow(HWND hwnd); - - HRESULT CompleteConnect(); - HRESULT DoCreateWindow(); - - HRESULT PerformanceAlignWindow(); - HRESULT DoShowWindow(LONG ShowCmd); - void PaintWindow(BOOL bErase); - void DoSetWindowForeground(BOOL bFocus); - virtual HRESULT SetPalette(HPALETTE hPalette); - - void SetRealize(BOOL bRealize) - { - m_bNoRealize = !bRealize; - } - - // Jump over to the window thread to set the current palette - HRESULT SetPalette(); - void UnsetPalette(void); - virtual HRESULT DoRealisePalette(BOOL bForceBackground = FALSE); - - void LockPaletteLock(); - void UnlockPaletteLock(); - - virtual BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) - { return FALSE; }; - - // Access our window information - - bool WindowExists(); - LONG GetWindowWidth(); - LONG GetWindowHeight(); - HWND GetWindowHWND(); - HDC GetMemoryHDC(); - HDC GetWindowHDC(); - - #ifdef DEBUG - HPALETTE GetPalette(); - #endif // DEBUG - - // This is the window procedure the derived object should override - - virtual LRESULT OnReceiveMessage(HWND hwnd, // Window handle - UINT uMsg, // Message ID - WPARAM wParam, // First parameter - LPARAM lParam); // Other parameter - - // Must be overriden to return class and window styles - - virtual LPTSTR GetClassWindowStyles( - DWORD *pClassStyles, // Class styles - DWORD *pWindowStyles, // Window styles - DWORD *pWindowStylesEx) PURE; // Extended styles -}; - - -// This helper class is entirely subservient to the owning CBaseWindow object -// All this object does is to split out the actual drawing operation from the -// main object (because it was becoming too large). We have a number of entry -// points to set things like the draw device contexts, to implement the actual -// drawing and to set the destination rectangle in the client window. We have -// no critical section locking in this class because we are used exclusively -// by the owning window object which looks after serialising calls into us - -// If you want to use this class make sure you call NotifyAllocator once the -// allocate has been agreed, also call NotifyMediaType with a pointer to a -// NON stack based CMediaType once that has been set (we keep a pointer to -// the original rather than taking a copy). When the palette changes call -// IncrementPaletteVersion (easiest thing to do is to also call this method -// in the SetMediaType method most filters implement). Finally before you -// start rendering anything call SetDrawContext so that we can get the HDCs -// for drawing from the CBaseWindow object we are given during construction - -class CDrawImage -{ -protected: - - CBaseWindow *m_pBaseWindow; // Owning video window object - CRefTime m_StartSample; // Start time for the current sample - CRefTime m_EndSample; // And likewise it's end sample time - HDC m_hdc; // Main window device context - HDC m_MemoryDC; // Offscreen draw device context - RECT m_TargetRect; // Target destination rectangle - RECT m_SourceRect; // Source image rectangle - BOOL m_bStretch; // Do we have to stretch the images - BOOL m_bUsingImageAllocator; // Are the samples shared DIBSECTIONs - CMediaType *m_pMediaType; // Pointer to the current format - int m_perfidRenderTime; // Time taken to render an image - LONG m_PaletteVersion; // Current palette version cookie - - // Draw the video images in the window - - void SlowRender(IMediaSample *pMediaSample); - void FastRender(IMediaSample *pMediaSample); - void DisplaySampleTimes(IMediaSample *pSample); - void UpdateColourTable(HDC hdc,BITMAPINFOHEADER *pbmi); - void SetStretchMode(); - -public: - - // Used to control the image drawing - - CDrawImage(CBaseWindow *pBaseWindow); - BOOL DrawImage(IMediaSample *pMediaSample); - BOOL DrawVideoImageHere(HDC hdc, IMediaSample *pMediaSample, - LPRECT lprcSrc, LPRECT lprcDst); - void SetDrawContext(); - void SetTargetRect(RECT *pTargetRect); - void SetSourceRect(RECT *pSourceRect); - void GetTargetRect(RECT *pTargetRect); - void GetSourceRect(RECT *pSourceRect); - virtual RECT ScaleSourceRect(const RECT *pSource); - - // Handle updating palettes as they change - - LONG GetPaletteVersion(); - void ResetPaletteVersion(); - void IncrementPaletteVersion(); - - // Tell us media types and allocator assignments - - void NotifyAllocator(BOOL bUsingImageAllocator); - void NotifyMediaType(CMediaType *pMediaType); - BOOL UsingImageAllocator(); - - // Called when we are about to draw an image - - void NotifyStartDraw() { - MSR_START(m_perfidRenderTime); - }; - - // Called when we complete an image rendering - - void NotifyEndDraw() { - MSR_STOP(m_perfidRenderTime); - }; -}; - - -// This is the structure used to keep information about each GDI DIB. All the -// samples we create from our allocator will have a DIBSECTION allocated to -// them. When we receive the sample we know we can BitBlt straight to an HDC - -typedef struct tagDIBDATA { - - LONG PaletteVersion; // Current palette version in use - DIBSECTION DibSection; // Details of DIB section allocated - HBITMAP hBitmap; // Handle to bitmap for drawing - HANDLE hMapping; // Handle to shared memory block - BYTE *pBase; // Pointer to base memory address - -} DIBDATA; - - -// This class inherits from CMediaSample and uses all of it's methods but it -// overrides the constructor to initialise itself with the DIBDATA structure -// When we come to render an IMediaSample we will know if we are using our own -// allocator, and if we are, we can cast the IMediaSample to a pointer to one -// of these are retrieve the DIB section information and hence the HBITMAP - -class CImageSample : public CMediaSample -{ -protected: - - DIBDATA m_DibData; // Information about the DIBSECTION - BOOL m_bInit; // Is the DIB information setup - -public: - - // Constructor - - CImageSample(CBaseAllocator *pAllocator, - TCHAR *pName, - HRESULT *phr, - LPBYTE pBuffer, - LONG length); - - // Maintain the DIB/DirectDraw state - - void SetDIBData(DIBDATA *pDibData); - DIBDATA *GetDIBData(); -}; - - -// This is an allocator based on the abstract CBaseAllocator base class that -// allocates sample buffers in shared memory. The number and size of these -// are determined when the output pin calls Prepare on us. The shared memory -// blocks are used in subsequent calls to GDI CreateDIBSection, once that -// has been done the output pin can fill the buffers with data which will -// then be handed to GDI through BitBlt calls and thereby remove one copy - -class CImageAllocator : public CBaseAllocator -{ -protected: - - CBaseFilter *m_pFilter; // Delegate reference counts to - CMediaType *m_pMediaType; // Pointer to the current format - - // Used to create and delete samples - - HRESULT Alloc(); - void Free(); - - // Manage the shared DIBSECTION and DCI/DirectDraw buffers - - HRESULT CreateDIB(LONG InSize,DIBDATA &DibData); - STDMETHODIMP CheckSizes(ALLOCATOR_PROPERTIES *pRequest); - virtual CImageSample *CreateImageSample(LPBYTE pData,LONG Length); - -public: - - // Constructor and destructor - - CImageAllocator(CBaseFilter *pFilter,TCHAR *pName,HRESULT *phr); -#ifdef DEBUG - ~CImageAllocator(); -#endif - - STDMETHODIMP_(ULONG) NonDelegatingAddRef(); - STDMETHODIMP_(ULONG) NonDelegatingRelease(); - void NotifyMediaType(CMediaType *pMediaType); - - // Agree the number of buffers to be used and their size - - STDMETHODIMP SetProperties( - ALLOCATOR_PROPERTIES *pRequest, - ALLOCATOR_PROPERTIES *pActual); -}; - - -// This class is a fairly specialised helper class for image renderers that -// have to create and manage palettes. The CBaseWindow class looks after -// realising palettes once they have been installed. This class can be used -// to create the palette handles from a media format (which must contain a -// VIDEOINFO structure in the format block). We try to make the palette an -// identity palette to maximise performance and also only change palettes -// if actually required to (we compare palette colours before updating). -// All the methods are virtual so that they can be overriden if so required - -class CImagePalette -{ -protected: - - CBaseWindow *m_pBaseWindow; // Window to realise palette in - CBaseFilter *m_pFilter; // Media filter to send events - CDrawImage *m_pDrawImage; // Object who will be drawing - HPALETTE m_hPalette; // The palette handle we own - -public: - - CImagePalette(CBaseFilter *pBaseFilter, - CBaseWindow *pBaseWindow, - CDrawImage *pDrawImage); - -#ifdef DEBUG - virtual ~CImagePalette(); -#endif - - static HPALETTE MakePalette(const VIDEOINFOHEADER *pVideoInfo, LPSTR szDevice); - HRESULT RemovePalette(); - static HRESULT MakeIdentityPalette(PALETTEENTRY *pEntry,INT iColours, LPSTR szDevice); - HRESULT CopyPalette(const CMediaType *pSrc,CMediaType *pDest); - BOOL ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,const VIDEOINFOHEADER *pOldInfo); - HRESULT PreparePalette(const CMediaType *pmtNew,const CMediaType *pmtOld,LPSTR szDevice); - - BOOL DrawVideoImageHere(HDC hdc, IMediaSample *pMediaSample, LPRECT lprcSrc, LPRECT lprcDst) - { - return m_pDrawImage->DrawVideoImageHere(hdc, pMediaSample, lprcSrc,lprcDst); - } -}; - - -// Another helper class really for video based renderers. Most such renderers -// need to know what the display format is to some degree or another. This -// class initialises itself with the display format. The format can be asked -// for through GetDisplayFormat and various other accessor functions. If a -// filter detects a display format change (perhaps it gets a WM_DEVMODECHANGE -// message then it can call RefreshDisplayType to reset that format). Also -// many video renderers will want to check formats as they are proposed by -// source filters. This class provides methods to check formats and only -// accept those video formats that can be efficiently drawn using GDI calls - -class CImageDisplay : public CCritSec -{ -protected: - - // This holds the display format; biSize should not be too big, so we can - // safely use the VIDEOINFO structure - VIDEOINFO m_Display; - - static DWORD CountSetBits(const DWORD Field); - static DWORD CountPrefixBits(const DWORD Field); - static BOOL CheckBitFields(const VIDEOINFO *pInput); - -public: - - // Constructor and destructor - - CImageDisplay(); - - // Used to manage BITMAPINFOHEADERs and the display format - - const VIDEOINFO *GetDisplayFormat(); - HRESULT RefreshDisplayType(LPSTR szDeviceName); - static BOOL CheckHeaderValidity(const VIDEOINFO *pInput); - static BOOL CheckPaletteHeader(const VIDEOINFO *pInput); - BOOL IsPalettised(); - WORD GetDisplayDepth(); - - // Provide simple video format type checking - - HRESULT CheckMediaType(const CMediaType *pmtIn); - HRESULT CheckVideoType(const VIDEOINFO *pInput); - HRESULT UpdateFormat(VIDEOINFO *pVideoInfo); - const DWORD *GetBitMasks(const VIDEOINFO *pVideoInfo); - - BOOL GetColourMask(DWORD *pMaskRed, - DWORD *pMaskGreen, - DWORD *pMaskBlue); -}; - -// Convert a FORMAT_VideoInfo to FORMAT_VideoInfo2 -STDAPI ConvertVideoInfoToVideoInfo2(AM_MEDIA_TYPE *pmt); - -#endif // __WINUTIL__ - +//------------------------------------------------------------------------------ +// File: WinUtil.h +// +// Desc: DirectShow base classes - defines generic handler classes. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// Make sure that you call PrepareWindow to initialise the window after +// the object has been constructed. It is a separate method so that +// derived classes can override useful methods like MessageLoop. Also +// any derived class must call DoneWithWindow in its destructor. If it +// doesn't a message may be retrieved and call a derived class member +// function while a thread is executing the base class destructor code + +#ifndef __WINUTIL__ +#define __WINUTIL__ + +const int DEFWIDTH = 320; // Initial window width +const int DEFHEIGHT = 240; // Initial window height +const int CAPTION = 256; // Maximum length of caption +const int TIMELENGTH = 50; // Maximum length of times +const int PROFILESTR = 128; // Normal profile string +const WORD PALVERSION = 0x300; // GDI palette version +const LONG PALETTE_VERSION = (LONG) 1; // Initial palette version +const COLORREF VIDEO_COLOUR = 0; // Defaults to black background +const HANDLE hMEMORY = (HANDLE) (-1); // Says to open as memory file + +#define WIDTH(x) ((*(x)).right - (*(x)).left) +#define HEIGHT(x) ((*(x)).bottom - (*(x)).top) +#define SHOWSTAGE TEXT("WM_SHOWSTAGE") +#define SHOWSTAGETOP TEXT("WM_SHOWSTAGETOP") +#define REALIZEPALETTE TEXT("WM_REALIZEPALETTE") + +class AM_NOVTABLE CBaseWindow +{ +protected: + + HINSTANCE m_hInstance; // Global module instance handle + HWND m_hwnd; // Handle for our window + HDC m_hdc; // Device context for the window + LONG m_Width; // Client window width + LONG m_Height; // Client window height + BOOL m_bActivated; // Has the window been activated + LPTSTR m_pClassName; // Static string holding class name + DWORD m_ClassStyles; // Passed in to our constructor + DWORD m_WindowStyles; // Likewise the initial window styles + DWORD m_WindowStylesEx; // And the extended window styles + UINT m_ShowStageMessage; // Have the window shown with focus + UINT m_ShowStageTop; // Makes the window WS_EX_TOPMOST + UINT m_RealizePalette; // Makes us realize our new palette + HDC m_MemoryDC; // Used for fast BitBlt operations + HPALETTE m_hPalette; // Handle to any palette we may have + BYTE m_bNoRealize; // Don't realize palette now + BYTE m_bBackground; // Should we realise in background + BYTE m_bRealizing; // already realizing the palette + CCritSec m_WindowLock; // Serialise window object access + BOOL m_bDoGetDC; // Should this window get a DC + bool m_bDoPostToDestroy; // Use PostMessage to destroy + CCritSec m_PaletteLock; // This lock protects m_hPalette. + // It should be held anytime the + // program use the value of m_hPalette. + + // Maps windows message procedure into C++ methods + friend LRESULT CALLBACK WndProc(HWND hwnd, // Window handle + UINT uMsg, // Message ID + WPARAM wParam, // First parameter + LPARAM lParam); // Other parameter + + virtual LRESULT OnPaletteChange(HWND hwnd, UINT Message); + +public: + + CBaseWindow(BOOL bDoGetDC = TRUE, bool bPostToDestroy = false); + +#ifdef DEBUG + virtual ~CBaseWindow(); +#endif + + virtual HRESULT DoneWithWindow(); + virtual HRESULT PrepareWindow(); + virtual HRESULT InactivateWindow(); + virtual HRESULT ActivateWindow(); + virtual BOOL OnSize(LONG Width, LONG Height); + virtual BOOL OnClose(); + virtual RECT GetDefaultRect(); + virtual HRESULT UninitialiseWindow(); + virtual HRESULT InitialiseWindow(HWND hwnd); + + HRESULT CompleteConnect(); + HRESULT DoCreateWindow(); + + HRESULT PerformanceAlignWindow(); + HRESULT DoShowWindow(LONG ShowCmd); + void PaintWindow(BOOL bErase); + void DoSetWindowForeground(BOOL bFocus); + virtual HRESULT SetPalette(HPALETTE hPalette); + + void SetRealize(BOOL bRealize) + { + m_bNoRealize = !bRealize; + } + + // Jump over to the window thread to set the current palette + HRESULT SetPalette(); + void UnsetPalette(void); + virtual HRESULT DoRealisePalette(BOOL bForceBackground = FALSE); + + void LockPaletteLock(); + void UnlockPaletteLock(); + + virtual BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) + { return FALSE; }; + + // Access our window information + + bool WindowExists(); + LONG GetWindowWidth(); + LONG GetWindowHeight(); + HWND GetWindowHWND(); + HDC GetMemoryHDC(); + HDC GetWindowHDC(); + + #ifdef DEBUG + HPALETTE GetPalette(); + #endif // DEBUG + + // This is the window procedure the derived object should override + + virtual LRESULT OnReceiveMessage(HWND hwnd, // Window handle + UINT uMsg, // Message ID + WPARAM wParam, // First parameter + LPARAM lParam); // Other parameter + + // Must be overriden to return class and window styles + + virtual LPTSTR GetClassWindowStyles( + DWORD *pClassStyles, // Class styles + DWORD *pWindowStyles, // Window styles + DWORD *pWindowStylesEx) PURE; // Extended styles +}; + + +// This helper class is entirely subservient to the owning CBaseWindow object +// All this object does is to split out the actual drawing operation from the +// main object (because it was becoming too large). We have a number of entry +// points to set things like the draw device contexts, to implement the actual +// drawing and to set the destination rectangle in the client window. We have +// no critical section locking in this class because we are used exclusively +// by the owning window object which looks after serialising calls into us + +// If you want to use this class make sure you call NotifyAllocator once the +// allocate has been agreed, also call NotifyMediaType with a pointer to a +// NON stack based CMediaType once that has been set (we keep a pointer to +// the original rather than taking a copy). When the palette changes call +// IncrementPaletteVersion (easiest thing to do is to also call this method +// in the SetMediaType method most filters implement). Finally before you +// start rendering anything call SetDrawContext so that we can get the HDCs +// for drawing from the CBaseWindow object we are given during construction + +class CDrawImage +{ +protected: + + CBaseWindow *m_pBaseWindow; // Owning video window object + CRefTime m_StartSample; // Start time for the current sample + CRefTime m_EndSample; // And likewise it's end sample time + HDC m_hdc; // Main window device context + HDC m_MemoryDC; // Offscreen draw device context + RECT m_TargetRect; // Target destination rectangle + RECT m_SourceRect; // Source image rectangle + BOOL m_bStretch; // Do we have to stretch the images + BOOL m_bUsingImageAllocator; // Are the samples shared DIBSECTIONs + CMediaType *m_pMediaType; // Pointer to the current format + int m_perfidRenderTime; // Time taken to render an image + LONG m_PaletteVersion; // Current palette version cookie + + // Draw the video images in the window + + void SlowRender(IMediaSample *pMediaSample); + void FastRender(IMediaSample *pMediaSample); + void DisplaySampleTimes(IMediaSample *pSample); + void UpdateColourTable(HDC hdc,BITMAPINFOHEADER *pbmi); + void SetStretchMode(); + +public: + + // Used to control the image drawing + + CDrawImage(CBaseWindow *pBaseWindow); + BOOL DrawImage(IMediaSample *pMediaSample); + BOOL DrawVideoImageHere(HDC hdc, IMediaSample *pMediaSample, + LPRECT lprcSrc, LPRECT lprcDst); + void SetDrawContext(); + void SetTargetRect(RECT *pTargetRect); + void SetSourceRect(RECT *pSourceRect); + void GetTargetRect(RECT *pTargetRect); + void GetSourceRect(RECT *pSourceRect); + virtual RECT ScaleSourceRect(const RECT *pSource); + + // Handle updating palettes as they change + + LONG GetPaletteVersion(); + void ResetPaletteVersion(); + void IncrementPaletteVersion(); + + // Tell us media types and allocator assignments + + void NotifyAllocator(BOOL bUsingImageAllocator); + void NotifyMediaType(CMediaType *pMediaType); + BOOL UsingImageAllocator(); + + // Called when we are about to draw an image + + void NotifyStartDraw() { + MSR_START(m_perfidRenderTime); + }; + + // Called when we complete an image rendering + + void NotifyEndDraw() { + MSR_STOP(m_perfidRenderTime); + }; +}; + + +// This is the structure used to keep information about each GDI DIB. All the +// samples we create from our allocator will have a DIBSECTION allocated to +// them. When we receive the sample we know we can BitBlt straight to an HDC + +typedef struct tagDIBDATA { + + LONG PaletteVersion; // Current palette version in use + DIBSECTION DibSection; // Details of DIB section allocated + HBITMAP hBitmap; // Handle to bitmap for drawing + HANDLE hMapping; // Handle to shared memory block + BYTE *pBase; // Pointer to base memory address + +} DIBDATA; + + +// This class inherits from CMediaSample and uses all of it's methods but it +// overrides the constructor to initialise itself with the DIBDATA structure +// When we come to render an IMediaSample we will know if we are using our own +// allocator, and if we are, we can cast the IMediaSample to a pointer to one +// of these are retrieve the DIB section information and hence the HBITMAP + +class CImageSample : public CMediaSample +{ +protected: + + DIBDATA m_DibData; // Information about the DIBSECTION + BOOL m_bInit; // Is the DIB information setup + +public: + + // Constructor + + CImageSample(CBaseAllocator *pAllocator, + TCHAR *pName, + HRESULT *phr, + LPBYTE pBuffer, + LONG length); + + // Maintain the DIB/DirectDraw state + + void SetDIBData(DIBDATA *pDibData); + DIBDATA *GetDIBData(); +}; + + +// This is an allocator based on the abstract CBaseAllocator base class that +// allocates sample buffers in shared memory. The number and size of these +// are determined when the output pin calls Prepare on us. The shared memory +// blocks are used in subsequent calls to GDI CreateDIBSection, once that +// has been done the output pin can fill the buffers with data which will +// then be handed to GDI through BitBlt calls and thereby remove one copy + +class CImageAllocator : public CBaseAllocator +{ +protected: + + CBaseFilter *m_pFilter; // Delegate reference counts to + CMediaType *m_pMediaType; // Pointer to the current format + + // Used to create and delete samples + + HRESULT Alloc(); + void Free(); + + // Manage the shared DIBSECTION and DCI/DirectDraw buffers + + HRESULT CreateDIB(LONG InSize,DIBDATA &DibData); + STDMETHODIMP CheckSizes(ALLOCATOR_PROPERTIES *pRequest); + virtual CImageSample *CreateImageSample(LPBYTE pData,LONG Length); + +public: + + // Constructor and destructor + + CImageAllocator(CBaseFilter *pFilter,TCHAR *pName,HRESULT *phr); +#ifdef DEBUG + ~CImageAllocator(); +#endif + + STDMETHODIMP_(ULONG) NonDelegatingAddRef(); + STDMETHODIMP_(ULONG) NonDelegatingRelease(); + void NotifyMediaType(CMediaType *pMediaType); + + // Agree the number of buffers to be used and their size + + STDMETHODIMP SetProperties( + ALLOCATOR_PROPERTIES *pRequest, + ALLOCATOR_PROPERTIES *pActual); +}; + + +// This class is a fairly specialised helper class for image renderers that +// have to create and manage palettes. The CBaseWindow class looks after +// realising palettes once they have been installed. This class can be used +// to create the palette handles from a media format (which must contain a +// VIDEOINFO structure in the format block). We try to make the palette an +// identity palette to maximise performance and also only change palettes +// if actually required to (we compare palette colours before updating). +// All the methods are virtual so that they can be overriden if so required + +class CImagePalette +{ +protected: + + CBaseWindow *m_pBaseWindow; // Window to realise palette in + CBaseFilter *m_pFilter; // Media filter to send events + CDrawImage *m_pDrawImage; // Object who will be drawing + HPALETTE m_hPalette; // The palette handle we own + +public: + + CImagePalette(CBaseFilter *pBaseFilter, + CBaseWindow *pBaseWindow, + CDrawImage *pDrawImage); + +#ifdef DEBUG + virtual ~CImagePalette(); +#endif + + static HPALETTE MakePalette(const VIDEOINFOHEADER *pVideoInfo, LPSTR szDevice); + HRESULT RemovePalette(); + static HRESULT MakeIdentityPalette(PALETTEENTRY *pEntry,INT iColours, LPSTR szDevice); + HRESULT CopyPalette(const CMediaType *pSrc,CMediaType *pDest); + BOOL ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,const VIDEOINFOHEADER *pOldInfo); + HRESULT PreparePalette(const CMediaType *pmtNew,const CMediaType *pmtOld,LPSTR szDevice); + + BOOL DrawVideoImageHere(HDC hdc, IMediaSample *pMediaSample, LPRECT lprcSrc, LPRECT lprcDst) + { + return m_pDrawImage->DrawVideoImageHere(hdc, pMediaSample, lprcSrc,lprcDst); + } +}; + + +// Another helper class really for video based renderers. Most such renderers +// need to know what the display format is to some degree or another. This +// class initialises itself with the display format. The format can be asked +// for through GetDisplayFormat and various other accessor functions. If a +// filter detects a display format change (perhaps it gets a WM_DEVMODECHANGE +// message then it can call RefreshDisplayType to reset that format). Also +// many video renderers will want to check formats as they are proposed by +// source filters. This class provides methods to check formats and only +// accept those video formats that can be efficiently drawn using GDI calls + +class CImageDisplay : public CCritSec +{ +protected: + + // This holds the display format; biSize should not be too big, so we can + // safely use the VIDEOINFO structure + VIDEOINFO m_Display; + + static DWORD CountSetBits(const DWORD Field); + static DWORD CountPrefixBits(const DWORD Field); + static BOOL CheckBitFields(const VIDEOINFO *pInput); + +public: + + // Constructor and destructor + + CImageDisplay(); + + // Used to manage BITMAPINFOHEADERs and the display format + + const VIDEOINFO *GetDisplayFormat(); + HRESULT RefreshDisplayType(LPSTR szDeviceName); + static BOOL CheckHeaderValidity(const VIDEOINFO *pInput); + static BOOL CheckPaletteHeader(const VIDEOINFO *pInput); + BOOL IsPalettised(); + WORD GetDisplayDepth(); + + // Provide simple video format type checking + + HRESULT CheckMediaType(const CMediaType *pmtIn); + HRESULT CheckVideoType(const VIDEOINFO *pInput); + HRESULT UpdateFormat(VIDEOINFO *pVideoInfo); + const DWORD *GetBitMasks(const VIDEOINFO *pVideoInfo); + + BOOL GetColourMask(DWORD *pMaskRed, + DWORD *pMaskGreen, + DWORD *pMaskBlue); +}; + +// Convert a FORMAT_VideoInfo to FORMAT_VideoInfo2 +STDAPI ConvertVideoInfoToVideoInfo2(AM_MEDIA_TYPE *pmt); + +#endif // __WINUTIL__ + diff --git a/src/BaseClasses/wxdebug.cpp b/src/BaseClasses/wxdebug.cpp index deb06e6031..b8087ae922 100644 --- a/src/BaseClasses/wxdebug.cpp +++ b/src/BaseClasses/wxdebug.cpp @@ -1,1311 +1,1311 @@ -//------------------------------------------------------------------------------ -// File: WXDebug.cpp -// -// Desc: DirectShow base classes - implements ActiveX system debugging -// facilities. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#define _WINDLL - -#include -#include -#include - -#ifdef DEBUG -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif // _UNICODE -#endif // UNICODE -#endif // DEBUG - -#include - -#ifdef DEBUG - -// The Win32 wsprintf() function writes a maximum of 1024 characters to it's output buffer. -// See the documentation for wsprintf()'s lpOut parameter for more information. -const INT iDEBUGINFO = 1024; // Used to format strings - -/* For every module and executable we store a debugging level for each of - the five categories (eg LOG_ERROR and LOG_TIMING). This makes it easy - to isolate and debug individual modules without seeing everybody elses - spurious debug output. The keys are stored in the registry under the - HKEY_LOCAL_MACHINE\SOFTWARE\Debug\\ key values - NOTE these must be in the same order as their enumeration definition */ - -TCHAR *pKeyNames[] = { - TEXT("TIMING"), // Timing and performance measurements - TEXT("TRACE"), // General step point call tracing - TEXT("MEMORY"), // Memory and object allocation/destruction - TEXT("LOCKING"), // Locking/unlocking of critical sections - TEXT("ERROR"), // Debug error notification - TEXT("CUSTOM1"), - TEXT("CUSTOM2"), - TEXT("CUSTOM3"), - TEXT("CUSTOM4"), - TEXT("CUSTOM5") - }; - -const TCHAR CAutoTrace::_szEntering[] = TEXT("Entering: %s"); -const TCHAR CAutoTrace::_szLeaving[] = TEXT("Leaving: %s"); - -const INT iMAXLEVELS = NUMELMS(pKeyNames); // Maximum debug categories - -HINSTANCE m_hInst; // Module instance handle -TCHAR m_ModuleName[iDEBUGINFO]; // Cut down module name -DWORD m_Levels[iMAXLEVELS]; // Debug level per category -CRITICAL_SECTION m_CSDebug; // Controls access to list -DWORD m_dwNextCookie; // Next active object ID -ObjectDesc *pListHead = NULL; // First active object -DWORD m_dwObjectCount; // Active object count -BOOL m_bInit = FALSE; // Have we been initialised -HANDLE m_hOutput = INVALID_HANDLE_VALUE; // Optional output written here -DWORD dwWaitTimeout = INFINITE; // Default timeout value -DWORD dwTimeOffset; // Time of first DbgLog call -bool g_fUseKASSERT = false; // don't create messagebox -bool g_fDbgInDllEntryPoint = false; -bool g_fAutoRefreshLevels = false; - -const TCHAR *pBaseKey = TEXT("SOFTWARE\\Debug"); -const TCHAR *pGlobalKey = TEXT("GLOBAL"); -static CHAR *pUnknownName = "UNKNOWN"; - -TCHAR *TimeoutName = TEXT("TIMEOUT"); - -/* This sets the instance handle that the debug library uses to find - the module's file name from the Win32 GetModuleFileName function */ - -void WINAPI DbgInitialise(HINSTANCE hInst) { - InitializeCriticalSection(&m_CSDebug); - m_bInit = TRUE; - - m_hInst = hInst; - DbgInitModuleName(); - if(GetProfileInt(m_ModuleName, TEXT("BreakOnLoad"), 0)) - DebugBreak(); - DbgInitModuleSettings(false); - DbgInitGlobalSettings(true); - dwTimeOffset = timeGetTime(); -} - - -/* This is called to clear up any resources the debug library uses - at the - moment we delete our critical section and the object list. The values we - retrieve from the registry are all done during initialisation but we don't - go looking for update notifications while we are running, if the values - are changed then the application has to be restarted to pick them up */ - -void WINAPI DbgTerminate() { - if(m_hOutput != INVALID_HANDLE_VALUE) { - EXECUTE_ASSERT(CloseHandle(m_hOutput)); - m_hOutput = INVALID_HANDLE_VALUE; - } - DeleteCriticalSection(&m_CSDebug); - m_bInit = FALSE; -} - - -/* This is called by DbgInitLogLevels to read the debug settings - for each logging category for this module from the registry */ - -void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax) { - LONG lReturn; // Create key return value - LONG lKeyPos; // Current key category - DWORD dwKeySize; // Size of the key value - DWORD dwKeyType; // Receives it's type - DWORD dwKeyValue; // This fields value - - /* Try and read a value for each key position in turn */ - for(lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) { - - dwKeySize = sizeof(DWORD); - lReturn = RegQueryValueEx(hKey, // Handle to an open key - pKeyNames[lKeyPos], // Subkey name derivation - NULL, // Reserved field - &dwKeyType, // Returns the field type - (LPBYTE) &dwKeyValue, // Returns the field's value - &dwKeySize); // Number of bytes transferred - - /* If either the key was not available or it was not a DWORD value - then we ensure only the high priority debug logging is output - but we try and update the field to a zero filled DWORD value */ - - if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) { - - dwKeyValue = 0; - lReturn = RegSetValueEx(hKey, // Handle of an open key - pKeyNames[lKeyPos], // Address of subkey name - (DWORD) 0, // Reserved field - REG_DWORD, // Type of the key field - (PBYTE) &dwKeyValue, // Value for the field - sizeof(DWORD)); // Size of the field buffer - - if(lReturn != ERROR_SUCCESS) { - DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos])); - dwKeyValue = 0; - } - } - if(fTakeMax) { - m_Levels[lKeyPos] = max(dwKeyValue,m_Levels[lKeyPos]); - } - else { - if((m_Levels[lKeyPos] & LOG_FORCIBLY_SET) == 0) { - m_Levels[lKeyPos] = dwKeyValue; - } - } - } - - /* Read the timeout value for catching hangs */ - dwKeySize = sizeof(DWORD); - lReturn = RegQueryValueEx(hKey, // Handle to an open key - TimeoutName, // Subkey name derivation - NULL, // Reserved field - &dwKeyType, // Returns the field type - (LPBYTE) &dwWaitTimeout, // Returns the field's value - &dwKeySize); // Number of bytes transferred - - /* If either the key was not available or it was not a DWORD value - then we ensure only the high priority debug logging is output - but we try and update the field to a zero filled DWORD value */ - - if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) { - - dwWaitTimeout = INFINITE; - lReturn = RegSetValueEx(hKey, // Handle of an open key - TimeoutName, // Address of subkey name - (DWORD) 0, // Reserved field - REG_DWORD, // Type of the key field - (PBYTE) &dwWaitTimeout, // Value for the field - sizeof(DWORD)); // Size of the field buffer - - if(lReturn != ERROR_SUCCESS) { - DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos])); - dwWaitTimeout = INFINITE; - } - } -} - -void WINAPI DbgOutString(LPCTSTR psz) { - if(m_hOutput != INVALID_HANDLE_VALUE) { - UINT cb = lstrlen(psz); - DWORD dw; -#ifdef UNICODE - CHAR szDest[2048]; - WideCharToMultiByte(CP_ACP, 0, psz, -1, szDest, NUMELMS(szDest), 0, 0); - WriteFile(m_hOutput, szDest, cb, &dw, NULL); -#else - WriteFile(m_hOutput, psz, cb, &dw, NULL); -#endif - } - else { - OutputDebugString(psz); - } -} - -/* Called by DbgInitGlobalSettings to setup alternate logging destinations - */ - -void WINAPI DbgInitLogTo( - HKEY hKey) { - LONG lReturn; - DWORD dwKeyType; - DWORD dwKeySize; - TCHAR szFile[MAX_PATH] = {0}; - static const TCHAR cszKey[] = TEXT("LogToFile"); - - dwKeySize = MAX_PATH; - lReturn = RegQueryValueEx(hKey, // Handle to an open key - cszKey, // Subkey name derivation - NULL, // Reserved field - &dwKeyType, // Returns the field type - (LPBYTE) szFile, // Returns the field's value - &dwKeySize); // Number of bytes transferred - - // create an empty key if it does not already exist - // - if(lReturn != ERROR_SUCCESS || dwKeyType != REG_SZ) { - dwKeySize = sizeof(TCHAR); - lReturn = RegSetValueEx(hKey, // Handle of an open key - cszKey, // Address of subkey name - (DWORD) 0, // Reserved field - REG_SZ, // Type of the key field - (PBYTE)szFile, // Value for the field - dwKeySize); // Size of the field buffer - } - - // if an output-to was specified. try to open it. - // - if(m_hOutput != INVALID_HANDLE_VALUE) { - EXECUTE_ASSERT(CloseHandle(m_hOutput)); - m_hOutput = INVALID_HANDLE_VALUE; - } - if(szFile[0] != 0) { - if(!lstrcmpi(szFile, TEXT("Console"))) { - m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE); - if(m_hOutput == INVALID_HANDLE_VALUE) { - AllocConsole(); - m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE); - } - SetConsoleTitle(TEXT("ActiveX Debug Output")); - } - else if(szFile[0] && - lstrcmpi(szFile, TEXT("Debug")) && - lstrcmpi(szFile, TEXT("Debugger")) && - lstrcmpi(szFile, TEXT("Deb"))) { - m_hOutput = CreateFile(szFile, GENERIC_WRITE, - FILE_SHARE_READ, - NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - if(INVALID_HANDLE_VALUE != m_hOutput) { - static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n"); - SetFilePointer(m_hOutput, 0, NULL, FILE_END); - DbgOutString(cszBar); - } - } - } -} - - - -/* This is called by DbgInitLogLevels to read the global debug settings for - each logging category for this module from the registry. Normally each - module has it's own values set for it's different debug categories but - setting the global SOFTWARE\Debug\Global applies them to ALL modules */ - -void WINAPI DbgInitGlobalSettings(bool fTakeMax) { - LONG lReturn; // Create key return value - TCHAR szInfo[iDEBUGINFO]; // Constructs key names - HKEY hGlobalKey; // Global override key - - /* Construct the global base key name */ - wsprintf(szInfo,TEXT("%s\\%s"),pBaseKey,pGlobalKey); - - /* Create or open the key for this module */ - lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key - szInfo, // Address of subkey name - (DWORD) 0, // Reserved value - NULL, // Address of class name - (DWORD) 0, // Special options flags - KEY_ALL_ACCESS, // Desired security access - NULL, // Key security descriptor - &hGlobalKey, // Opened handle buffer - NULL); // What really happened - - if(lReturn != ERROR_SUCCESS) { - DbgLog((LOG_ERROR,0,TEXT("Could not access GLOBAL module key"))); - return; - } - - DbgInitKeyLevels(hGlobalKey, fTakeMax); - RegCloseKey(hGlobalKey); -} - - -/* This sets the debugging log levels for the different categories. We start - by opening (or creating if not already available) the SOFTWARE\Debug key - that all these settings live under. We then look at the global values - set under SOFTWARE\Debug\Global which apply on top of the individual - module settings. We then load the individual module registry settings */ - -void WINAPI DbgInitModuleSettings(bool fTakeMax) { - LONG lReturn; // Create key return value - TCHAR szInfo[iDEBUGINFO]; // Constructs key names - HKEY hModuleKey; // Module key handle - - /* Construct the base key name */ - wsprintf(szInfo,TEXT("%s\\%s"),pBaseKey,m_ModuleName); - - /* Create or open the key for this module */ - lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key - szInfo, // Address of subkey name - (DWORD) 0, // Reserved value - NULL, // Address of class name - (DWORD) 0, // Special options flags - KEY_ALL_ACCESS, // Desired security access - NULL, // Key security descriptor - &hModuleKey, // Opened handle buffer - NULL); // What really happened - - if(lReturn != ERROR_SUCCESS) { - DbgLog((LOG_ERROR,0,TEXT("Could not access module key"))); - return; - } - - DbgInitLogTo(hModuleKey); - DbgInitKeyLevels(hModuleKey, fTakeMax); - RegCloseKey(hModuleKey); -} - - -/* Initialise the module file name */ - -void WINAPI DbgInitModuleName() { - TCHAR FullName[iDEBUGINFO]; // Load the full path and module name - TCHAR *pName; // Searches from the end for a backslash - - GetModuleFileName(m_hInst,FullName,iDEBUGINFO); - pName = _tcsrchr(FullName,'\\'); - if(pName == NULL) { - pName = FullName; - } - else { - pName++; - } - lstrcpy(m_ModuleName,pName); -} - -struct MsgBoxMsg { - HWND hwnd; - TCHAR *szTitle; - TCHAR *szMessage; - DWORD dwFlags; - INT iResult; -}; - -// -// create a thread to call MessageBox(). calling MessageBox() on -// random threads at bad times can confuse the host (eg IE). -// -DWORD WINAPI MsgBoxThread( - LPVOID lpParameter // thread data - ) -{ - MsgBoxMsg *pmsg = (MsgBoxMsg *)lpParameter; - pmsg->iResult = MessageBox(pmsg->hwnd, - pmsg->szTitle, - pmsg->szMessage, - pmsg->dwFlags); - - return 0; -} - -INT MessageBoxOtherThread( - HWND hwnd, - TCHAR *szTitle, - TCHAR *szMessage, - DWORD dwFlags) { - if(g_fDbgInDllEntryPoint) { - // can't wait on another thread because we have the loader - // lock held in the dll entry point. - return MessageBox(hwnd, szTitle, szMessage, dwFlags); - } - else { - MsgBoxMsg msg = {hwnd, szTitle, szMessage, dwFlags, 0}; - DWORD dwid; - HANDLE hThread = CreateThread(0, // security - 0, // stack size - MsgBoxThread, - (void *)&msg, // arg - 0, // flags - &dwid); - if(hThread) { - WaitForSingleObject(hThread, INFINITE); - CloseHandle(hThread); - return msg.iResult; - } - - // break into debugger on failure. - return IDCANCEL; - } -} - -/* Displays a message box if the condition evaluated to FALSE */ - -void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine) { - if(g_fUseKASSERT) { - DbgKernelAssert(pCondition, pFileName, iLine); - } - else { - - TCHAR szInfo[iDEBUGINFO]; - - wsprintf(szInfo, TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"), - pCondition, iLine, pFileName); - - INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"), - MB_SYSTEMMODAL | - MB_ICONHAND | - MB_YESNOCANCEL | - MB_SETFOREGROUND); - - switch(MsgId) { - case IDNO: /* Kill the application */ - FatalAppExit(FALSE, TEXT("Application terminated")); - break; - - case IDCANCEL: /* Break into the debugger */ - DebugBreak(); - break; - - case IDYES: /* Ignore assertion continue execution */ - break; - } - } -} - -/* Displays a message box at a break point */ - -void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine) { - if(g_fUseKASSERT) { - DbgKernelAssert(pCondition, pFileName, iLine); - } - else { - TCHAR szInfo[iDEBUGINFO]; - - wsprintf(szInfo, TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"), - pCondition, iLine, pFileName); - - INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"), - MB_SYSTEMMODAL | - MB_ICONHAND | - MB_YESNOCANCEL | - MB_SETFOREGROUND); - - switch(MsgId) { - case IDNO: /* Kill the application */ - FatalAppExit(FALSE, TEXT("Application terminated")); - break; - - case IDCANCEL: /* Break into the debugger */ - DebugBreak(); - break; - - case IDYES: /* Ignore break point continue execution */ - break; - } - } -} - -void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...) { - // A debug break point message can have at most 2000 characters if - // ANSI or UNICODE characters are being used. A debug break point message - // can have between 1000 and 2000 double byte characters in it. If a - // particular message needs more characters, then the value of this constant - // should be increased. - const DWORD MAX_BREAK_POINT_MESSAGE_SIZE = 2000; - - TCHAR szBreakPointMessage[MAX_BREAK_POINT_MESSAGE_SIZE]; - - const DWORD MAX_CHARS_IN_BREAK_POINT_MESSAGE = sizeof(szBreakPointMessage) / sizeof(TCHAR); - - va_list va; - va_start(va, szFormatString); - - int nReturnValue = _vsntprintf(szBreakPointMessage, MAX_CHARS_IN_BREAK_POINT_MESSAGE, szFormatString, va); - - va_end(va); - - // _vsnprintf() returns -1 if an error occurs. - if(-1 == nReturnValue) { - DbgBreak("ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because _vsnprintf() failed."); - return; - } - - ::DbgBreakPoint(szBreakPointMessage, pFileName, iLine); -} - - -/* When we initialised the library we stored in the m_Levels array the current - debug output level for this module for each of the five categories. When - some debug logging is sent to us it can be sent with a combination of the - categories (if it is applicable to many for example) in which case we map - the type's categories into their current debug levels and see if any of - them can be accepted. The function looks at each bit position in turn from - the input type field and then compares it's debug level with the modules. - - A level of 0 means that output is always sent to the debugger. This is - due to producing output if the input level is <= m_Levels. -*/ - - -BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level) { - if(g_fAutoRefreshLevels) { - // re-read the registry every second. We cannot use RegNotify() to - // notice registry changes because it's not available on win9x. - /*NABIL: This needed to be a static int, not ust static*/ - static int g_dwLastRefresh = 0; - DWORD dwTime = timeGetTime(); - if(dwTime - g_dwLastRefresh > 1000) { - g_dwLastRefresh = dwTime; - - // there's a race condition: multiple threads could update the - // values. plus read and write not synchronized. no harm - // though. - DbgInitModuleSettings(false); - } - } - - - DWORD Mask = 0x01; - - // If no valid bits are set return FALSE - if((Type & ((1<m_szName = szObjectName; - pObject->m_wszName = wszObjectName; - pObject->m_dwCookie = ++m_dwNextCookie; - pObject->m_pNext = pListHead; - - pListHead = pObject; - m_dwObjectCount++; - - DWORD ObjectCookie = pObject->m_dwCookie; - ASSERT(ObjectCookie); - - if(wszObjectName) { - DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%ls) %d Active"), - pObject->m_dwCookie, wszObjectName, m_dwObjectCount)); - } - else { - DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%hs) %d Active"), - pObject->m_dwCookie, szObjectName, m_dwObjectCount)); - } - - LeaveCriticalSection(&m_CSDebug); - return ObjectCookie; -} - - -/* This is called by the CBaseObject destructor when an object is about to be - destroyed, we are passed the cookie we returned during construction that - identifies this object. We scan the object list for a matching cookie and - remove the object if successful. We also update the active object count */ - -BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie) { - /* Grab the list critical section */ - EnterCriticalSection(&m_CSDebug); - - ObjectDesc *pObject = pListHead; - ObjectDesc *pPrevious = NULL; - - /* Scan the object list looking for a cookie match */ - - while(pObject) { - if(pObject->m_dwCookie == dwCookie) { - break; - } - pPrevious = pObject; - pObject = pObject->m_pNext; - } - - if(pObject == NULL) { - DbgBreak("Apparently destroying a bogus object"); - LeaveCriticalSection(&m_CSDebug); - return FALSE; - } - - /* Is the object at the head of the list */ - - if(pPrevious == NULL) { - pListHead = pObject->m_pNext; - } - else { - pPrevious->m_pNext = pObject->m_pNext; - } - - /* Delete the object and update the housekeeping information */ - - m_dwObjectCount--; - - if(pObject->m_wszName) { - DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%ls) %d Active"), - pObject->m_dwCookie, pObject->m_wszName, m_dwObjectCount)); - } - else { - DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%hs) %d Active"), - pObject->m_dwCookie, pObject->m_szName, m_dwObjectCount)); - } - - delete pObject; - LeaveCriticalSection(&m_CSDebug); - return TRUE; -} - - -/* This runs through the active object list displaying their details */ - -void WINAPI DbgDumpObjectRegister() { - TCHAR szInfo[iDEBUGINFO]; - - /* Grab the list critical section */ - - EnterCriticalSection(&m_CSDebug); - ObjectDesc *pObject = pListHead; - - /* Scan the object list displaying the name and cookie */ - - DbgLog((LOG_MEMORY,2,TEXT(""))); - DbgLog((LOG_MEMORY,2,TEXT(" ID Object Description"))); - DbgLog((LOG_MEMORY,2,TEXT(""))); - - while(pObject) { - if(pObject->m_wszName) { - wsprintf(szInfo,TEXT("%5d (%8x) %30ls"),pObject->m_dwCookie, &pObject, pObject->m_wszName); - } - else { - wsprintf(szInfo,TEXT("%5d (%8x) %30hs"),pObject->m_dwCookie, &pObject, pObject->m_szName); - } - DbgLog((LOG_MEMORY,2,szInfo)); - pObject = pObject->m_pNext; - } - - wsprintf(szInfo,TEXT("Total object count %5d"),m_dwObjectCount); - DbgLog((LOG_MEMORY,2,TEXT(""))); - DbgLog((LOG_MEMORY,1,szInfo)); - LeaveCriticalSection(&m_CSDebug); -} - -/* Debug infinite wait stuff */ -DWORD WINAPI DbgWaitForSingleObject(HANDLE h) { - DWORD dwWaitResult; - do { - dwWaitResult = WaitForSingleObject(h, dwWaitTimeout); - ASSERT(dwWaitResult == WAIT_OBJECT_0); - } while(dwWaitResult == WAIT_TIMEOUT); - return dwWaitResult; -} -DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount, - CONST HANDLE *lpHandles, - BOOL bWaitAll) { - DWORD dwWaitResult; - do { - dwWaitResult = WaitForMultipleObjects(nCount, - lpHandles, - bWaitAll, - dwWaitTimeout); - ASSERT((DWORD)(dwWaitResult - WAIT_OBJECT_0) < MAXIMUM_WAIT_OBJECTS); - } while(dwWaitResult == WAIT_TIMEOUT); - return dwWaitResult; -} - -void WINAPI DbgSetWaitTimeout(DWORD dwTimeout) { - dwWaitTimeout = dwTimeout; -} - -#endif /* DEBUG */ - -#ifdef _OBJBASE_H_ - - /* Stuff for printing out our GUID names */ - - GUID_STRING_ENTRY g_GuidNames[] = { - #define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - { #name, { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } }, - #include - }; - - CGuidNameList GuidNames; - int g_cGuidNames = sizeof(g_GuidNames) / sizeof(g_GuidNames[0]); - - char *CGuidNameList::operator [] (const GUID &guid) { - for(int i = 0; i < g_cGuidNames; i++) { - if(g_GuidNames[i].guid == guid) { - return g_GuidNames[i].szName; - } - } - if(guid == GUID_NULL) { - return "GUID_NULL"; - } - - // !!! add something to print FOURCC guids? - - // shouldn't this print the hex CLSID? - return "Unknown GUID Name"; -} - -#endif /* _OBJBASE_H_ */ - -/* CDisp class - display our data types */ - -// clashes with REFERENCE_TIME -CDisp::CDisp(LONGLONG ll, int Format) { - // note: this could be combined with CDisp(LONGLONG) by - // introducing a default format of CDISP_REFTIME - LARGE_INTEGER li; - li.QuadPart = ll; - switch(Format) { - case CDISP_DEC: { - TCHAR temp[20]; - int pos=20; - temp[--pos] = 0; - int digit; - // always output at least one digit - do { - // Get the rightmost digit - we only need the low word - digit = li.LowPart % 10; - li.QuadPart /= 10; - temp[--pos] = (TCHAR) (digit+TEXT('0')); - } while(li.QuadPart); - wsprintf(m_String, TEXT("%s"), temp+pos); - break; - } - case CDISP_HEX: - default: - wsprintf(m_String, TEXT("0x%X%8.8X"), li.HighPart, li.LowPart); - } -}; - -CDisp::CDisp(REFCLSID clsid) { - WCHAR strClass[CHARS_IN_GUID+1]; - StringFromGUID2(clsid, strClass, sizeof(strClass) / sizeof(strClass[0])); - ASSERT(sizeof(m_String)/sizeof(m_String[0]) >= CHARS_IN_GUID+1); - wsprintf(m_String, TEXT("%ls"), strClass); -}; - -#ifdef __STREAMS__ -/* Display stuff */ -CDisp::CDisp(CRefTime llTime) { - LPTSTR lpsz = m_String; - LONGLONG llDiv; - if(llTime < 0) { - llTime = -llTime; - lpsz += wsprintf(lpsz, TEXT("-")); - } - llDiv = (LONGLONG)24 * 3600 * 10000000; - if(llTime >= llDiv) { - lpsz += wsprintf(lpsz, TEXT("%d days "), (LONG)(llTime / llDiv)); - llTime = llTime % llDiv; - } - llDiv = (LONGLONG)3600 * 10000000; - if(llTime >= llDiv) { - lpsz += wsprintf(lpsz, TEXT("%d hrs "), (LONG)(llTime / llDiv)); - llTime = llTime % llDiv; - } - llDiv = (LONGLONG)60 * 10000000; - if(llTime >= llDiv) { - lpsz += wsprintf(lpsz, TEXT("%d mins "), (LONG)(llTime / llDiv)); - llTime = llTime % llDiv; - } - wsprintf(lpsz, TEXT("%d.%3.3d sec"), - (LONG)llTime / 10000000, - (LONG)((llTime % 10000000) / 10000)); -}; - -#endif // __STREAMS__ - - -/* Display pin */ -CDisp::CDisp(IPin *pPin) { - PIN_INFO pi; - TCHAR str[MAX_PIN_NAME]; - CLSID clsid; - - if(pPin) { - pPin->QueryPinInfo(&pi); - pi.pFilter->GetClassID(&clsid); - QueryPinInfoReleaseFilter(pi); -#ifndef UNICODE - WideCharToMultiByte(GetACP(), 0, pi.achName, lstrlenW(pi.achName) + 1, - str, MAX_PIN_NAME, NULL, NULL); -#else - lstrcpy(str, pi.achName); -#endif - } - else { - lstrcpy(str, TEXT("NULL IPin")); - } - - m_pString = (PTCHAR) new TCHAR[lstrlen(str)+64]; - if(!m_pString) { - return; - } - - wsprintf(m_pString, TEXT("%hs(%s)"), GuidNames[clsid], str); -} - -/* Display filter or pin */ -CDisp::CDisp(IUnknown *pUnk) { - IBaseFilter *pf; - HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (void **)&pf); - if(SUCCEEDED(hr)) { - FILTER_INFO fi; - hr = pf->QueryFilterInfo(&fi); - if(SUCCEEDED(hr)) { - QueryFilterInfoReleaseGraph(fi); - - m_pString = new TCHAR[lstrlenW(fi.achName) + 1]; - if(m_pString) { - wsprintf(m_pString, TEXT("%ls"), fi.achName); - } - } - - pf->Release(); - - return; - } - - IPin *pp; - hr = pUnk->QueryInterface(IID_IPin, (void **)&pp); - if(SUCCEEDED(hr)) { - CDisp::CDisp(pp); - pp->Release(); - return; - } -} - - -CDisp::~CDisp() { -} - -CDispBasic::~CDispBasic() { - if(m_pString != m_String) { - delete [] m_pString; - } -} - -CDisp::CDisp(double d) { -#ifdef DEBUG - _stprintf(m_String, TEXT("%.16g"), d); -#else - wsprintf(m_String, TEXT("%d.%03d"), (int) d, (int) ((d - (int) d) * 1000)); -#endif -} - - -/* If built for debug this will display the media type details. We convert the - major and subtypes into strings and also ask the base classes for a string - description of the subtype, so MEDIASUBTYPE_RGB565 becomes RGB 565 16 bit - We also display the fields in the BITMAPINFOHEADER structure, this should - succeed as we do not accept input types unless the format is big enough */ - -#ifdef DEBUG -void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn) { - - /* Dump the GUID types and a short description */ - - DbgLog((LOG_TRACE,5,TEXT(""))); - DbgLog((LOG_TRACE,2,TEXT("%s M type %s S type %s"), label, - GuidNames[pmtIn->majortype], - GuidNames[pmtIn->subtype])); - DbgLog((LOG_TRACE,5,TEXT("Subtype description %s"),GetSubtypeName(&pmtIn->subtype))); - - /* Dump the generic media types */ - - if(pmtIn->bTemporalCompression) { - DbgLog((LOG_TRACE,5,TEXT("Temporally compressed"))); - } - else { - DbgLog((LOG_TRACE,5,TEXT("Not temporally compressed"))); - } - - if(pmtIn->bFixedSizeSamples) { - DbgLog((LOG_TRACE,5,TEXT("Sample size %d"),pmtIn->lSampleSize)); - } - else { - DbgLog((LOG_TRACE,5,TEXT("Variable size samples"))); - } - - if(pmtIn->formattype == FORMAT_VideoInfo) { - /* Dump the contents of the BITMAPINFOHEADER structure */ - BITMAPINFOHEADER *pbmi = HEADER(pmtIn->pbFormat); - VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *)pmtIn->pbFormat; - - DbgLog((LOG_TRACE,5,TEXT("Source rectangle (Left %d Top %d Right %d Bottom %d)"), - pVideoInfo->rcSource.left, - pVideoInfo->rcSource.top, - pVideoInfo->rcSource.right, - pVideoInfo->rcSource.bottom)); - - DbgLog((LOG_TRACE,5,TEXT("Target rectangle (Left %d Top %d Right %d Bottom %d)"), - pVideoInfo->rcTarget.left, - pVideoInfo->rcTarget.top, - pVideoInfo->rcTarget.right, - pVideoInfo->rcTarget.bottom)); - - DbgLog((LOG_TRACE,5,TEXT("Size of BITMAPINFO structure %d"),pbmi->biSize)); - if(pbmi->biCompression < 256) { - DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit (%d)"), - pbmi->biWidth, pbmi->biHeight, - pbmi->biBitCount, pbmi->biCompression)); - } - else { - DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit '%4.4hs'"), - pbmi->biWidth, pbmi->biHeight, - pbmi->biBitCount, &pbmi->biCompression)); - } - - DbgLog((LOG_TRACE,2,TEXT("Image size %d"),pbmi->biSizeImage)); - DbgLog((LOG_TRACE,5,TEXT("Planes %d"),pbmi->biPlanes)); - DbgLog((LOG_TRACE,5,TEXT("X Pels per metre %d"),pbmi->biXPelsPerMeter)); - DbgLog((LOG_TRACE,5,TEXT("Y Pels per metre %d"),pbmi->biYPelsPerMeter)); - DbgLog((LOG_TRACE,5,TEXT("Colours used %d"),pbmi->biClrUsed)); - - } - else if(pmtIn->majortype == MEDIATYPE_Audio) { - DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"), - GuidNames[pmtIn->formattype])); - DbgLog((LOG_TRACE,2,TEXT(" Subtype %hs"), - GuidNames[pmtIn->subtype])); - - if((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet) - && (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT))) { - /* Dump the contents of the WAVEFORMATEX type-specific format structure */ - - WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmtIn->pbFormat; - DbgLog((LOG_TRACE,2,TEXT("wFormatTag %u"), pwfx->wFormatTag)); - DbgLog((LOG_TRACE,2,TEXT("nChannels %u"), pwfx->nChannels)); - DbgLog((LOG_TRACE,2,TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec)); - DbgLog((LOG_TRACE,2,TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec)); - DbgLog((LOG_TRACE,2,TEXT("nBlockAlign %u"), pwfx->nBlockAlign)); - DbgLog((LOG_TRACE,2,TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample)); - - /* PCM uses a WAVEFORMAT and does not have the extra size field */ - - if(pmtIn->cbFormat >= sizeof(WAVEFORMATEX)) { - DbgLog((LOG_TRACE,2,TEXT("cbSize %u"), pwfx->cbSize)); - } - } - else { - } - - } - else { - DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"), - GuidNames[pmtIn->formattype])); - // !!!! should add code to dump wave format, others - } -} - - -void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel) { - if(!pGraph) { - return; - } - - IEnumFilters *pFilters; - - DbgLog((LOG_TRACE,dwLevel,TEXT("DumpGraph [%x]"), pGraph)); - - if(FAILED(pGraph->EnumFilters(&pFilters))) { - DbgLog((LOG_TRACE,dwLevel,TEXT("EnumFilters failed!"))); - } - - IBaseFilter *pFilter; - ULONG n; - while(pFilters->Next(1, &pFilter, &n) == S_OK) { - FILTER_INFO info; - - if(FAILED(pFilter->QueryFilterInfo(&info))) { - DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] -- failed QueryFilterInfo"), pFilter)); - } - else { - QueryFilterInfoReleaseGraph(info); - - // !!! should QueryVendorInfo here! - - DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] '%ls'"), pFilter, info.achName)); - - IEnumPins *pins; - - if(FAILED(pFilter->EnumPins(&pins))) { - DbgLog((LOG_TRACE,dwLevel,TEXT("EnumPins failed!"))); - } - else { - - IPin *pPin; - while(pins->Next(1, &pPin, &n) == S_OK) { - PIN_INFO info; - - if(FAILED(pPin->QueryPinInfo(&info))) { - DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] -- failed QueryPinInfo"), pPin)); - } - else { - QueryPinInfoReleaseFilter(info); - - IPin *pPinConnected = NULL; - - HRESULT hr = pPin->ConnectedTo(&pPinConnected); - - if(pPinConnected) { - DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] '%ls' [%sput]") - TEXT(" Connected to pin [%x]"), - pPin, info.achName, - info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"), - pPinConnected)); - - pPinConnected->Release(); - - // perhaps we should really dump the type both ways as a sanity - // check? - if(info.dir == PINDIR_OUTPUT) { - AM_MEDIA_TYPE mt; - - hr = pPin->ConnectionMediaType(&mt); - - if(SUCCEEDED(hr)) { - DisplayType(TEXT("Connection type"), &mt); - - FreeMediaType(mt); - } - } - } - else { - DbgLog((LOG_TRACE,dwLevel, - TEXT(" Pin [%x] '%ls' [%sput]"), - pPin, info.achName, - info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"))); - - } - } - - pPin->Release(); - - } - - pins->Release(); - } - - } - - pFilter->Release(); - } - - pFilters->Release(); - -} - -#endif - - +//------------------------------------------------------------------------------ +// File: WXDebug.cpp +// +// Desc: DirectShow base classes - implements ActiveX system debugging +// facilities. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#define _WINDLL + +#include +#include +#include + +#ifdef DEBUG +#ifdef UNICODE +#ifndef _UNICODE +#define _UNICODE +#endif // _UNICODE +#endif // UNICODE +#endif // DEBUG + +#include + +#ifdef DEBUG + +// The Win32 wsprintf() function writes a maximum of 1024 characters to it's output buffer. +// See the documentation for wsprintf()'s lpOut parameter for more information. +const INT iDEBUGINFO = 1024; // Used to format strings + +/* For every module and executable we store a debugging level for each of + the five categories (eg LOG_ERROR and LOG_TIMING). This makes it easy + to isolate and debug individual modules without seeing everybody elses + spurious debug output. The keys are stored in the registry under the + HKEY_LOCAL_MACHINE\SOFTWARE\Debug\\ key values + NOTE these must be in the same order as their enumeration definition */ + +TCHAR *pKeyNames[] = { + TEXT("TIMING"), // Timing and performance measurements + TEXT("TRACE"), // General step point call tracing + TEXT("MEMORY"), // Memory and object allocation/destruction + TEXT("LOCKING"), // Locking/unlocking of critical sections + TEXT("ERROR"), // Debug error notification + TEXT("CUSTOM1"), + TEXT("CUSTOM2"), + TEXT("CUSTOM3"), + TEXT("CUSTOM4"), + TEXT("CUSTOM5") + }; + +const TCHAR CAutoTrace::_szEntering[] = TEXT("Entering: %s"); +const TCHAR CAutoTrace::_szLeaving[] = TEXT("Leaving: %s"); + +const INT iMAXLEVELS = NUMELMS(pKeyNames); // Maximum debug categories + +HINSTANCE m_hInst; // Module instance handle +TCHAR m_ModuleName[iDEBUGINFO]; // Cut down module name +DWORD m_Levels[iMAXLEVELS]; // Debug level per category +CRITICAL_SECTION m_CSDebug; // Controls access to list +DWORD m_dwNextCookie; // Next active object ID +ObjectDesc *pListHead = NULL; // First active object +DWORD m_dwObjectCount; // Active object count +BOOL m_bInit = FALSE; // Have we been initialised +HANDLE m_hOutput = INVALID_HANDLE_VALUE; // Optional output written here +DWORD dwWaitTimeout = INFINITE; // Default timeout value +DWORD dwTimeOffset; // Time of first DbgLog call +bool g_fUseKASSERT = false; // don't create messagebox +bool g_fDbgInDllEntryPoint = false; +bool g_fAutoRefreshLevels = false; + +const TCHAR *pBaseKey = TEXT("SOFTWARE\\Debug"); +const TCHAR *pGlobalKey = TEXT("GLOBAL"); +static CHAR *pUnknownName = "UNKNOWN"; + +TCHAR *TimeoutName = TEXT("TIMEOUT"); + +/* This sets the instance handle that the debug library uses to find + the module's file name from the Win32 GetModuleFileName function */ + +void WINAPI DbgInitialise(HINSTANCE hInst) { + InitializeCriticalSection(&m_CSDebug); + m_bInit = TRUE; + + m_hInst = hInst; + DbgInitModuleName(); + if(GetProfileInt(m_ModuleName, TEXT("BreakOnLoad"), 0)) + DebugBreak(); + DbgInitModuleSettings(false); + DbgInitGlobalSettings(true); + dwTimeOffset = timeGetTime(); +} + + +/* This is called to clear up any resources the debug library uses - at the + moment we delete our critical section and the object list. The values we + retrieve from the registry are all done during initialisation but we don't + go looking for update notifications while we are running, if the values + are changed then the application has to be restarted to pick them up */ + +void WINAPI DbgTerminate() { + if(m_hOutput != INVALID_HANDLE_VALUE) { + EXECUTE_ASSERT(CloseHandle(m_hOutput)); + m_hOutput = INVALID_HANDLE_VALUE; + } + DeleteCriticalSection(&m_CSDebug); + m_bInit = FALSE; +} + + +/* This is called by DbgInitLogLevels to read the debug settings + for each logging category for this module from the registry */ + +void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax) { + LONG lReturn; // Create key return value + LONG lKeyPos; // Current key category + DWORD dwKeySize; // Size of the key value + DWORD dwKeyType; // Receives it's type + DWORD dwKeyValue; // This fields value + + /* Try and read a value for each key position in turn */ + for(lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) { + + dwKeySize = sizeof(DWORD); + lReturn = RegQueryValueEx(hKey, // Handle to an open key + pKeyNames[lKeyPos], // Subkey name derivation + NULL, // Reserved field + &dwKeyType, // Returns the field type + (LPBYTE) &dwKeyValue, // Returns the field's value + &dwKeySize); // Number of bytes transferred + + /* If either the key was not available or it was not a DWORD value + then we ensure only the high priority debug logging is output + but we try and update the field to a zero filled DWORD value */ + + if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) { + + dwKeyValue = 0; + lReturn = RegSetValueEx(hKey, // Handle of an open key + pKeyNames[lKeyPos], // Address of subkey name + (DWORD) 0, // Reserved field + REG_DWORD, // Type of the key field + (PBYTE) &dwKeyValue, // Value for the field + sizeof(DWORD)); // Size of the field buffer + + if(lReturn != ERROR_SUCCESS) { + DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos])); + dwKeyValue = 0; + } + } + if(fTakeMax) { + m_Levels[lKeyPos] = max(dwKeyValue,m_Levels[lKeyPos]); + } + else { + if((m_Levels[lKeyPos] & LOG_FORCIBLY_SET) == 0) { + m_Levels[lKeyPos] = dwKeyValue; + } + } + } + + /* Read the timeout value for catching hangs */ + dwKeySize = sizeof(DWORD); + lReturn = RegQueryValueEx(hKey, // Handle to an open key + TimeoutName, // Subkey name derivation + NULL, // Reserved field + &dwKeyType, // Returns the field type + (LPBYTE) &dwWaitTimeout, // Returns the field's value + &dwKeySize); // Number of bytes transferred + + /* If either the key was not available or it was not a DWORD value + then we ensure only the high priority debug logging is output + but we try and update the field to a zero filled DWORD value */ + + if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) { + + dwWaitTimeout = INFINITE; + lReturn = RegSetValueEx(hKey, // Handle of an open key + TimeoutName, // Address of subkey name + (DWORD) 0, // Reserved field + REG_DWORD, // Type of the key field + (PBYTE) &dwWaitTimeout, // Value for the field + sizeof(DWORD)); // Size of the field buffer + + if(lReturn != ERROR_SUCCESS) { + DbgLog((LOG_ERROR,0,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos])); + dwWaitTimeout = INFINITE; + } + } +} + +void WINAPI DbgOutString(LPCTSTR psz) { + if(m_hOutput != INVALID_HANDLE_VALUE) { + UINT cb = lstrlen(psz); + DWORD dw; +#ifdef UNICODE + CHAR szDest[2048]; + WideCharToMultiByte(CP_ACP, 0, psz, -1, szDest, NUMELMS(szDest), 0, 0); + WriteFile(m_hOutput, szDest, cb, &dw, NULL); +#else + WriteFile(m_hOutput, psz, cb, &dw, NULL); +#endif + } + else { + OutputDebugString(psz); + } +} + +/* Called by DbgInitGlobalSettings to setup alternate logging destinations + */ + +void WINAPI DbgInitLogTo( + HKEY hKey) { + LONG lReturn; + DWORD dwKeyType; + DWORD dwKeySize; + TCHAR szFile[MAX_PATH] = {0}; + static const TCHAR cszKey[] = TEXT("LogToFile"); + + dwKeySize = MAX_PATH; + lReturn = RegQueryValueEx(hKey, // Handle to an open key + cszKey, // Subkey name derivation + NULL, // Reserved field + &dwKeyType, // Returns the field type + (LPBYTE) szFile, // Returns the field's value + &dwKeySize); // Number of bytes transferred + + // create an empty key if it does not already exist + // + if(lReturn != ERROR_SUCCESS || dwKeyType != REG_SZ) { + dwKeySize = sizeof(TCHAR); + lReturn = RegSetValueEx(hKey, // Handle of an open key + cszKey, // Address of subkey name + (DWORD) 0, // Reserved field + REG_SZ, // Type of the key field + (PBYTE)szFile, // Value for the field + dwKeySize); // Size of the field buffer + } + + // if an output-to was specified. try to open it. + // + if(m_hOutput != INVALID_HANDLE_VALUE) { + EXECUTE_ASSERT(CloseHandle(m_hOutput)); + m_hOutput = INVALID_HANDLE_VALUE; + } + if(szFile[0] != 0) { + if(!lstrcmpi(szFile, TEXT("Console"))) { + m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE); + if(m_hOutput == INVALID_HANDLE_VALUE) { + AllocConsole(); + m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE); + } + SetConsoleTitle(TEXT("ActiveX Debug Output")); + } + else if(szFile[0] && + lstrcmpi(szFile, TEXT("Debug")) && + lstrcmpi(szFile, TEXT("Debugger")) && + lstrcmpi(szFile, TEXT("Deb"))) { + m_hOutput = CreateFile(szFile, GENERIC_WRITE, + FILE_SHARE_READ, + NULL, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + if(INVALID_HANDLE_VALUE != m_hOutput) { + static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n"); + SetFilePointer(m_hOutput, 0, NULL, FILE_END); + DbgOutString(cszBar); + } + } + } +} + + + +/* This is called by DbgInitLogLevels to read the global debug settings for + each logging category for this module from the registry. Normally each + module has it's own values set for it's different debug categories but + setting the global SOFTWARE\Debug\Global applies them to ALL modules */ + +void WINAPI DbgInitGlobalSettings(bool fTakeMax) { + LONG lReturn; // Create key return value + TCHAR szInfo[iDEBUGINFO]; // Constructs key names + HKEY hGlobalKey; // Global override key + + /* Construct the global base key name */ + wsprintf(szInfo,TEXT("%s\\%s"),pBaseKey,pGlobalKey); + + /* Create or open the key for this module */ + lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key + szInfo, // Address of subkey name + (DWORD) 0, // Reserved value + NULL, // Address of class name + (DWORD) 0, // Special options flags + KEY_ALL_ACCESS, // Desired security access + NULL, // Key security descriptor + &hGlobalKey, // Opened handle buffer + NULL); // What really happened + + if(lReturn != ERROR_SUCCESS) { + DbgLog((LOG_ERROR,0,TEXT("Could not access GLOBAL module key"))); + return; + } + + DbgInitKeyLevels(hGlobalKey, fTakeMax); + RegCloseKey(hGlobalKey); +} + + +/* This sets the debugging log levels for the different categories. We start + by opening (or creating if not already available) the SOFTWARE\Debug key + that all these settings live under. We then look at the global values + set under SOFTWARE\Debug\Global which apply on top of the individual + module settings. We then load the individual module registry settings */ + +void WINAPI DbgInitModuleSettings(bool fTakeMax) { + LONG lReturn; // Create key return value + TCHAR szInfo[iDEBUGINFO]; // Constructs key names + HKEY hModuleKey; // Module key handle + + /* Construct the base key name */ + wsprintf(szInfo,TEXT("%s\\%s"),pBaseKey,m_ModuleName); + + /* Create or open the key for this module */ + lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key + szInfo, // Address of subkey name + (DWORD) 0, // Reserved value + NULL, // Address of class name + (DWORD) 0, // Special options flags + KEY_ALL_ACCESS, // Desired security access + NULL, // Key security descriptor + &hModuleKey, // Opened handle buffer + NULL); // What really happened + + if(lReturn != ERROR_SUCCESS) { + DbgLog((LOG_ERROR,0,TEXT("Could not access module key"))); + return; + } + + DbgInitLogTo(hModuleKey); + DbgInitKeyLevels(hModuleKey, fTakeMax); + RegCloseKey(hModuleKey); +} + + +/* Initialise the module file name */ + +void WINAPI DbgInitModuleName() { + TCHAR FullName[iDEBUGINFO]; // Load the full path and module name + TCHAR *pName; // Searches from the end for a backslash + + GetModuleFileName(m_hInst,FullName,iDEBUGINFO); + pName = _tcsrchr(FullName,'\\'); + if(pName == NULL) { + pName = FullName; + } + else { + pName++; + } + lstrcpy(m_ModuleName,pName); +} + +struct MsgBoxMsg { + HWND hwnd; + TCHAR *szTitle; + TCHAR *szMessage; + DWORD dwFlags; + INT iResult; +}; + +// +// create a thread to call MessageBox(). calling MessageBox() on +// random threads at bad times can confuse the host (eg IE). +// +DWORD WINAPI MsgBoxThread( + LPVOID lpParameter // thread data + ) +{ + MsgBoxMsg *pmsg = (MsgBoxMsg *)lpParameter; + pmsg->iResult = MessageBox(pmsg->hwnd, + pmsg->szTitle, + pmsg->szMessage, + pmsg->dwFlags); + + return 0; +} + +INT MessageBoxOtherThread( + HWND hwnd, + TCHAR *szTitle, + TCHAR *szMessage, + DWORD dwFlags) { + if(g_fDbgInDllEntryPoint) { + // can't wait on another thread because we have the loader + // lock held in the dll entry point. + return MessageBox(hwnd, szTitle, szMessage, dwFlags); + } + else { + MsgBoxMsg msg = {hwnd, szTitle, szMessage, dwFlags, 0}; + DWORD dwid; + HANDLE hThread = CreateThread(0, // security + 0, // stack size + MsgBoxThread, + (void *)&msg, // arg + 0, // flags + &dwid); + if(hThread) { + WaitForSingleObject(hThread, INFINITE); + CloseHandle(hThread); + return msg.iResult; + } + + // break into debugger on failure. + return IDCANCEL; + } +} + +/* Displays a message box if the condition evaluated to FALSE */ + +void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine) { + if(g_fUseKASSERT) { + DbgKernelAssert(pCondition, pFileName, iLine); + } + else { + + TCHAR szInfo[iDEBUGINFO]; + + wsprintf(szInfo, TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"), + pCondition, iLine, pFileName); + + INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"), + MB_SYSTEMMODAL | + MB_ICONHAND | + MB_YESNOCANCEL | + MB_SETFOREGROUND); + + switch(MsgId) { + case IDNO: /* Kill the application */ + FatalAppExit(FALSE, TEXT("Application terminated")); + break; + + case IDCANCEL: /* Break into the debugger */ + DebugBreak(); + break; + + case IDYES: /* Ignore assertion continue execution */ + break; + } + } +} + +/* Displays a message box at a break point */ + +void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine) { + if(g_fUseKASSERT) { + DbgKernelAssert(pCondition, pFileName, iLine); + } + else { + TCHAR szInfo[iDEBUGINFO]; + + wsprintf(szInfo, TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"), + pCondition, iLine, pFileName); + + INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"), + MB_SYSTEMMODAL | + MB_ICONHAND | + MB_YESNOCANCEL | + MB_SETFOREGROUND); + + switch(MsgId) { + case IDNO: /* Kill the application */ + FatalAppExit(FALSE, TEXT("Application terminated")); + break; + + case IDCANCEL: /* Break into the debugger */ + DebugBreak(); + break; + + case IDYES: /* Ignore break point continue execution */ + break; + } + } +} + +void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...) { + // A debug break point message can have at most 2000 characters if + // ANSI or UNICODE characters are being used. A debug break point message + // can have between 1000 and 2000 double byte characters in it. If a + // particular message needs more characters, then the value of this constant + // should be increased. + const DWORD MAX_BREAK_POINT_MESSAGE_SIZE = 2000; + + TCHAR szBreakPointMessage[MAX_BREAK_POINT_MESSAGE_SIZE]; + + const DWORD MAX_CHARS_IN_BREAK_POINT_MESSAGE = sizeof(szBreakPointMessage) / sizeof(TCHAR); + + va_list va; + va_start(va, szFormatString); + + int nReturnValue = _vsntprintf(szBreakPointMessage, MAX_CHARS_IN_BREAK_POINT_MESSAGE, szFormatString, va); + + va_end(va); + + // _vsnprintf() returns -1 if an error occurs. + if(-1 == nReturnValue) { + DbgBreak("ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because _vsnprintf() failed."); + return; + } + + ::DbgBreakPoint(szBreakPointMessage, pFileName, iLine); +} + + +/* When we initialised the library we stored in the m_Levels array the current + debug output level for this module for each of the five categories. When + some debug logging is sent to us it can be sent with a combination of the + categories (if it is applicable to many for example) in which case we map + the type's categories into their current debug levels and see if any of + them can be accepted. The function looks at each bit position in turn from + the input type field and then compares it's debug level with the modules. + + A level of 0 means that output is always sent to the debugger. This is + due to producing output if the input level is <= m_Levels. +*/ + + +BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level) { + if(g_fAutoRefreshLevels) { + // re-read the registry every second. We cannot use RegNotify() to + // notice registry changes because it's not available on win9x. + /*NABIL: This needed to be a static int, not ust static*/ + static int g_dwLastRefresh = 0; + DWORD dwTime = timeGetTime(); + if(dwTime - g_dwLastRefresh > 1000) { + g_dwLastRefresh = dwTime; + + // there's a race condition: multiple threads could update the + // values. plus read and write not synchronized. no harm + // though. + DbgInitModuleSettings(false); + } + } + + + DWORD Mask = 0x01; + + // If no valid bits are set return FALSE + if((Type & ((1<m_szName = szObjectName; + pObject->m_wszName = wszObjectName; + pObject->m_dwCookie = ++m_dwNextCookie; + pObject->m_pNext = pListHead; + + pListHead = pObject; + m_dwObjectCount++; + + DWORD ObjectCookie = pObject->m_dwCookie; + ASSERT(ObjectCookie); + + if(wszObjectName) { + DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%ls) %d Active"), + pObject->m_dwCookie, wszObjectName, m_dwObjectCount)); + } + else { + DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%hs) %d Active"), + pObject->m_dwCookie, szObjectName, m_dwObjectCount)); + } + + LeaveCriticalSection(&m_CSDebug); + return ObjectCookie; +} + + +/* This is called by the CBaseObject destructor when an object is about to be + destroyed, we are passed the cookie we returned during construction that + identifies this object. We scan the object list for a matching cookie and + remove the object if successful. We also update the active object count */ + +BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie) { + /* Grab the list critical section */ + EnterCriticalSection(&m_CSDebug); + + ObjectDesc *pObject = pListHead; + ObjectDesc *pPrevious = NULL; + + /* Scan the object list looking for a cookie match */ + + while(pObject) { + if(pObject->m_dwCookie == dwCookie) { + break; + } + pPrevious = pObject; + pObject = pObject->m_pNext; + } + + if(pObject == NULL) { + DbgBreak("Apparently destroying a bogus object"); + LeaveCriticalSection(&m_CSDebug); + return FALSE; + } + + /* Is the object at the head of the list */ + + if(pPrevious == NULL) { + pListHead = pObject->m_pNext; + } + else { + pPrevious->m_pNext = pObject->m_pNext; + } + + /* Delete the object and update the housekeeping information */ + + m_dwObjectCount--; + + if(pObject->m_wszName) { + DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%ls) %d Active"), + pObject->m_dwCookie, pObject->m_wszName, m_dwObjectCount)); + } + else { + DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%hs) %d Active"), + pObject->m_dwCookie, pObject->m_szName, m_dwObjectCount)); + } + + delete pObject; + LeaveCriticalSection(&m_CSDebug); + return TRUE; +} + + +/* This runs through the active object list displaying their details */ + +void WINAPI DbgDumpObjectRegister() { + TCHAR szInfo[iDEBUGINFO]; + + /* Grab the list critical section */ + + EnterCriticalSection(&m_CSDebug); + ObjectDesc *pObject = pListHead; + + /* Scan the object list displaying the name and cookie */ + + DbgLog((LOG_MEMORY,2,TEXT(""))); + DbgLog((LOG_MEMORY,2,TEXT(" ID Object Description"))); + DbgLog((LOG_MEMORY,2,TEXT(""))); + + while(pObject) { + if(pObject->m_wszName) { + wsprintf(szInfo,TEXT("%5d (%8x) %30ls"),pObject->m_dwCookie, &pObject, pObject->m_wszName); + } + else { + wsprintf(szInfo,TEXT("%5d (%8x) %30hs"),pObject->m_dwCookie, &pObject, pObject->m_szName); + } + DbgLog((LOG_MEMORY,2,szInfo)); + pObject = pObject->m_pNext; + } + + wsprintf(szInfo,TEXT("Total object count %5d"),m_dwObjectCount); + DbgLog((LOG_MEMORY,2,TEXT(""))); + DbgLog((LOG_MEMORY,1,szInfo)); + LeaveCriticalSection(&m_CSDebug); +} + +/* Debug infinite wait stuff */ +DWORD WINAPI DbgWaitForSingleObject(HANDLE h) { + DWORD dwWaitResult; + do { + dwWaitResult = WaitForSingleObject(h, dwWaitTimeout); + ASSERT(dwWaitResult == WAIT_OBJECT_0); + } while(dwWaitResult == WAIT_TIMEOUT); + return dwWaitResult; +} +DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount, + CONST HANDLE *lpHandles, + BOOL bWaitAll) { + DWORD dwWaitResult; + do { + dwWaitResult = WaitForMultipleObjects(nCount, + lpHandles, + bWaitAll, + dwWaitTimeout); + ASSERT((DWORD)(dwWaitResult - WAIT_OBJECT_0) < MAXIMUM_WAIT_OBJECTS); + } while(dwWaitResult == WAIT_TIMEOUT); + return dwWaitResult; +} + +void WINAPI DbgSetWaitTimeout(DWORD dwTimeout) { + dwWaitTimeout = dwTimeout; +} + +#endif /* DEBUG */ + +#ifdef _OBJBASE_H_ + + /* Stuff for printing out our GUID names */ + + GUID_STRING_ENTRY g_GuidNames[] = { + #define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + { #name, { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } }, + #include + }; + + CGuidNameList GuidNames; + int g_cGuidNames = sizeof(g_GuidNames) / sizeof(g_GuidNames[0]); + + char *CGuidNameList::operator [] (const GUID &guid) { + for(int i = 0; i < g_cGuidNames; i++) { + if(g_GuidNames[i].guid == guid) { + return g_GuidNames[i].szName; + } + } + if(guid == GUID_NULL) { + return "GUID_NULL"; + } + + // !!! add something to print FOURCC guids? + + // shouldn't this print the hex CLSID? + return "Unknown GUID Name"; +} + +#endif /* _OBJBASE_H_ */ + +/* CDisp class - display our data types */ + +// clashes with REFERENCE_TIME +CDisp::CDisp(LONGLONG ll, int Format) { + // note: this could be combined with CDisp(LONGLONG) by + // introducing a default format of CDISP_REFTIME + LARGE_INTEGER li; + li.QuadPart = ll; + switch(Format) { + case CDISP_DEC: { + TCHAR temp[20]; + int pos=20; + temp[--pos] = 0; + int digit; + // always output at least one digit + do { + // Get the rightmost digit - we only need the low word + digit = li.LowPart % 10; + li.QuadPart /= 10; + temp[--pos] = (TCHAR) (digit+TEXT('0')); + } while(li.QuadPart); + wsprintf(m_String, TEXT("%s"), temp+pos); + break; + } + case CDISP_HEX: + default: + wsprintf(m_String, TEXT("0x%X%8.8X"), li.HighPart, li.LowPart); + } +}; + +CDisp::CDisp(REFCLSID clsid) { + WCHAR strClass[CHARS_IN_GUID+1]; + StringFromGUID2(clsid, strClass, sizeof(strClass) / sizeof(strClass[0])); + ASSERT(sizeof(m_String)/sizeof(m_String[0]) >= CHARS_IN_GUID+1); + wsprintf(m_String, TEXT("%ls"), strClass); +}; + +#ifdef __STREAMS__ +/* Display stuff */ +CDisp::CDisp(CRefTime llTime) { + LPTSTR lpsz = m_String; + LONGLONG llDiv; + if(llTime < 0) { + llTime = -llTime; + lpsz += wsprintf(lpsz, TEXT("-")); + } + llDiv = (LONGLONG)24 * 3600 * 10000000; + if(llTime >= llDiv) { + lpsz += wsprintf(lpsz, TEXT("%d days "), (LONG)(llTime / llDiv)); + llTime = llTime % llDiv; + } + llDiv = (LONGLONG)3600 * 10000000; + if(llTime >= llDiv) { + lpsz += wsprintf(lpsz, TEXT("%d hrs "), (LONG)(llTime / llDiv)); + llTime = llTime % llDiv; + } + llDiv = (LONGLONG)60 * 10000000; + if(llTime >= llDiv) { + lpsz += wsprintf(lpsz, TEXT("%d mins "), (LONG)(llTime / llDiv)); + llTime = llTime % llDiv; + } + wsprintf(lpsz, TEXT("%d.%3.3d sec"), + (LONG)llTime / 10000000, + (LONG)((llTime % 10000000) / 10000)); +}; + +#endif // __STREAMS__ + + +/* Display pin */ +CDisp::CDisp(IPin *pPin) { + PIN_INFO pi; + TCHAR str[MAX_PIN_NAME]; + CLSID clsid; + + if(pPin) { + pPin->QueryPinInfo(&pi); + pi.pFilter->GetClassID(&clsid); + QueryPinInfoReleaseFilter(pi); +#ifndef UNICODE + WideCharToMultiByte(GetACP(), 0, pi.achName, lstrlenW(pi.achName) + 1, + str, MAX_PIN_NAME, NULL, NULL); +#else + lstrcpy(str, pi.achName); +#endif + } + else { + lstrcpy(str, TEXT("NULL IPin")); + } + + m_pString = (PTCHAR) new TCHAR[lstrlen(str)+64]; + if(!m_pString) { + return; + } + + wsprintf(m_pString, TEXT("%hs(%s)"), GuidNames[clsid], str); +} + +/* Display filter or pin */ +CDisp::CDisp(IUnknown *pUnk) { + IBaseFilter *pf; + HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (void **)&pf); + if(SUCCEEDED(hr)) { + FILTER_INFO fi; + hr = pf->QueryFilterInfo(&fi); + if(SUCCEEDED(hr)) { + QueryFilterInfoReleaseGraph(fi); + + m_pString = new TCHAR[lstrlenW(fi.achName) + 1]; + if(m_pString) { + wsprintf(m_pString, TEXT("%ls"), fi.achName); + } + } + + pf->Release(); + + return; + } + + IPin *pp; + hr = pUnk->QueryInterface(IID_IPin, (void **)&pp); + if(SUCCEEDED(hr)) { + CDisp::CDisp(pp); + pp->Release(); + return; + } +} + + +CDisp::~CDisp() { +} + +CDispBasic::~CDispBasic() { + if(m_pString != m_String) { + delete [] m_pString; + } +} + +CDisp::CDisp(double d) { +#ifdef DEBUG + _stprintf(m_String, TEXT("%.16g"), d); +#else + wsprintf(m_String, TEXT("%d.%03d"), (int) d, (int) ((d - (int) d) * 1000)); +#endif +} + + +/* If built for debug this will display the media type details. We convert the + major and subtypes into strings and also ask the base classes for a string + description of the subtype, so MEDIASUBTYPE_RGB565 becomes RGB 565 16 bit + We also display the fields in the BITMAPINFOHEADER structure, this should + succeed as we do not accept input types unless the format is big enough */ + +#ifdef DEBUG +void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn) { + + /* Dump the GUID types and a short description */ + + DbgLog((LOG_TRACE,5,TEXT(""))); + DbgLog((LOG_TRACE,2,TEXT("%s M type %s S type %s"), label, + GuidNames[pmtIn->majortype], + GuidNames[pmtIn->subtype])); + DbgLog((LOG_TRACE,5,TEXT("Subtype description %s"),GetSubtypeName(&pmtIn->subtype))); + + /* Dump the generic media types */ + + if(pmtIn->bTemporalCompression) { + DbgLog((LOG_TRACE,5,TEXT("Temporally compressed"))); + } + else { + DbgLog((LOG_TRACE,5,TEXT("Not temporally compressed"))); + } + + if(pmtIn->bFixedSizeSamples) { + DbgLog((LOG_TRACE,5,TEXT("Sample size %d"),pmtIn->lSampleSize)); + } + else { + DbgLog((LOG_TRACE,5,TEXT("Variable size samples"))); + } + + if(pmtIn->formattype == FORMAT_VideoInfo) { + /* Dump the contents of the BITMAPINFOHEADER structure */ + BITMAPINFOHEADER *pbmi = HEADER(pmtIn->pbFormat); + VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *)pmtIn->pbFormat; + + DbgLog((LOG_TRACE,5,TEXT("Source rectangle (Left %d Top %d Right %d Bottom %d)"), + pVideoInfo->rcSource.left, + pVideoInfo->rcSource.top, + pVideoInfo->rcSource.right, + pVideoInfo->rcSource.bottom)); + + DbgLog((LOG_TRACE,5,TEXT("Target rectangle (Left %d Top %d Right %d Bottom %d)"), + pVideoInfo->rcTarget.left, + pVideoInfo->rcTarget.top, + pVideoInfo->rcTarget.right, + pVideoInfo->rcTarget.bottom)); + + DbgLog((LOG_TRACE,5,TEXT("Size of BITMAPINFO structure %d"),pbmi->biSize)); + if(pbmi->biCompression < 256) { + DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit (%d)"), + pbmi->biWidth, pbmi->biHeight, + pbmi->biBitCount, pbmi->biCompression)); + } + else { + DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit '%4.4hs'"), + pbmi->biWidth, pbmi->biHeight, + pbmi->biBitCount, &pbmi->biCompression)); + } + + DbgLog((LOG_TRACE,2,TEXT("Image size %d"),pbmi->biSizeImage)); + DbgLog((LOG_TRACE,5,TEXT("Planes %d"),pbmi->biPlanes)); + DbgLog((LOG_TRACE,5,TEXT("X Pels per metre %d"),pbmi->biXPelsPerMeter)); + DbgLog((LOG_TRACE,5,TEXT("Y Pels per metre %d"),pbmi->biYPelsPerMeter)); + DbgLog((LOG_TRACE,5,TEXT("Colours used %d"),pbmi->biClrUsed)); + + } + else if(pmtIn->majortype == MEDIATYPE_Audio) { + DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"), + GuidNames[pmtIn->formattype])); + DbgLog((LOG_TRACE,2,TEXT(" Subtype %hs"), + GuidNames[pmtIn->subtype])); + + if((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet) + && (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT))) { + /* Dump the contents of the WAVEFORMATEX type-specific format structure */ + + WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmtIn->pbFormat; + DbgLog((LOG_TRACE,2,TEXT("wFormatTag %u"), pwfx->wFormatTag)); + DbgLog((LOG_TRACE,2,TEXT("nChannels %u"), pwfx->nChannels)); + DbgLog((LOG_TRACE,2,TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec)); + DbgLog((LOG_TRACE,2,TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec)); + DbgLog((LOG_TRACE,2,TEXT("nBlockAlign %u"), pwfx->nBlockAlign)); + DbgLog((LOG_TRACE,2,TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample)); + + /* PCM uses a WAVEFORMAT and does not have the extra size field */ + + if(pmtIn->cbFormat >= sizeof(WAVEFORMATEX)) { + DbgLog((LOG_TRACE,2,TEXT("cbSize %u"), pwfx->cbSize)); + } + } + else { + } + + } + else { + DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"), + GuidNames[pmtIn->formattype])); + // !!!! should add code to dump wave format, others + } +} + + +void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel) { + if(!pGraph) { + return; + } + + IEnumFilters *pFilters; + + DbgLog((LOG_TRACE,dwLevel,TEXT("DumpGraph [%x]"), pGraph)); + + if(FAILED(pGraph->EnumFilters(&pFilters))) { + DbgLog((LOG_TRACE,dwLevel,TEXT("EnumFilters failed!"))); + } + + IBaseFilter *pFilter; + ULONG n; + while(pFilters->Next(1, &pFilter, &n) == S_OK) { + FILTER_INFO info; + + if(FAILED(pFilter->QueryFilterInfo(&info))) { + DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] -- failed QueryFilterInfo"), pFilter)); + } + else { + QueryFilterInfoReleaseGraph(info); + + // !!! should QueryVendorInfo here! + + DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%x] '%ls'"), pFilter, info.achName)); + + IEnumPins *pins; + + if(FAILED(pFilter->EnumPins(&pins))) { + DbgLog((LOG_TRACE,dwLevel,TEXT("EnumPins failed!"))); + } + else { + + IPin *pPin; + while(pins->Next(1, &pPin, &n) == S_OK) { + PIN_INFO info; + + if(FAILED(pPin->QueryPinInfo(&info))) { + DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] -- failed QueryPinInfo"), pPin)); + } + else { + QueryPinInfoReleaseFilter(info); + + IPin *pPinConnected = NULL; + + HRESULT hr = pPin->ConnectedTo(&pPinConnected); + + if(pPinConnected) { + DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] '%ls' [%sput]") + TEXT(" Connected to pin [%x]"), + pPin, info.achName, + info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"), + pPinConnected)); + + pPinConnected->Release(); + + // perhaps we should really dump the type both ways as a sanity + // check? + if(info.dir == PINDIR_OUTPUT) { + AM_MEDIA_TYPE mt; + + hr = pPin->ConnectionMediaType(&mt); + + if(SUCCEEDED(hr)) { + DisplayType(TEXT("Connection type"), &mt); + + FreeMediaType(mt); + } + } + } + else { + DbgLog((LOG_TRACE,dwLevel, + TEXT(" Pin [%x] '%ls' [%sput]"), + pPin, info.achName, + info.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"))); + + } + } + + pPin->Release(); + + } + + pins->Release(); + } + + } + + pFilter->Release(); + } + + pFilters->Release(); + +} + +#endif + + diff --git a/src/BaseClasses/wxdebug.h b/src/BaseClasses/wxdebug.h index 2e784c0f35..4addf00c74 100644 --- a/src/BaseClasses/wxdebug.h +++ b/src/BaseClasses/wxdebug.h @@ -1,379 +1,379 @@ -//------------------------------------------------------------------------------ -// File: WXDebug.h -// -// Desc: DirectShow base classes - provides debugging facilities. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __WXDEBUG__ -#define __WXDEBUG__ - -// This library provides fairly straight forward debugging functionality, this -// is split into two main sections. The first is assertion handling, there are -// three types of assertions provided here. The most commonly used one is the -// ASSERT(condition) macro which will pop up a message box including the file -// and line number if the condition evaluates to FALSE. Then there is the -// EXECUTE_ASSERT macro which is the same as ASSERT except the condition will -// still be executed in NON debug builds. The final type of assertion is the -// KASSERT macro which is more suitable for pure (perhaps kernel) filters as -// the condition is printed onto the debugger rather than in a message box. -// -// The other part of the debug module facilties is general purpose logging. -// This is accessed by calling DbgLog(). The function takes a type and level -// field which define the type of informational string you are presenting and -// it's relative importance. The type field can be a combination (one or more) -// of LOG_TIMING, LOG_TRACE, LOG_MEMORY, LOG_LOCKING and LOG_ERROR. The level -// is a DWORD value where zero defines highest important. Use of zero as the -// debug logging level is to be encouraged ONLY for major errors or events as -// they will ALWAYS be displayed on the debugger. Other debug output has it's -// level matched against the current debug output level stored in the registry -// for this module and if less than the current setting it will be displayed. -// -// Each module or executable has it's own debug output level for each of the -// five types. These are read in when the DbgInitialise function is called -// for DLLs linking to STRMBASE.LIB this is done automatically when the DLL -// is loaded, executables must call it explicitely with the module instance -// handle given to them through the WINMAIN entry point. An executable must -// also call DbgTerminate when they have finished to clean up the resources -// the debug library uses, once again this is done automatically for DLLs - -// These are the five different categories of logging information - -enum { LOG_TIMING = 0x01, // Timing and performance measurements - LOG_TRACE = 0x02, // General step point call tracing - LOG_MEMORY = 0x04, // Memory and object allocation/destruction - LOG_LOCKING = 0x08, // Locking/unlocking of critical sections - LOG_ERROR = 0x10, // Debug error notification - LOG_CUSTOM1 = 0x20, - LOG_CUSTOM2 = 0x40, - LOG_CUSTOM3 = 0x80, - LOG_CUSTOM4 = 0x100, - LOG_CUSTOM5 = 0x200, -}; - -#define LOG_FORCIBLY_SET 0x80000000 - -enum { CDISP_HEX = 0x01, - CDISP_DEC = 0x02}; - -// For each object created derived from CBaseObject (in debug builds) we -// create a descriptor that holds it's name (statically allocated memory) -// and a cookie we assign it. We keep a list of all the active objects -// we have registered so that we can dump a list of remaining objects - -typedef struct tag_ObjectDesc { - const CHAR *m_szName; - const WCHAR *m_wszName; - DWORD m_dwCookie; - tag_ObjectDesc *m_pNext; -} ObjectDesc; - -#define DLLIMPORT __declspec(dllimport) -#define DLLEXPORT __declspec(dllexport) - -#ifdef DEBUG - - #define NAME(x) TEXT(x) - - // These are used internally by the debug library (PRIVATE) - - void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax); - void WINAPI DbgInitGlobalSettings(bool fTakeMax); - void WINAPI DbgInitModuleSettings(bool fTakeMax); - void WINAPI DbgInitModuleName(); - DWORD WINAPI DbgRegisterObjectCreation( - const CHAR *szObjectName, const WCHAR *wszObjectName); - - BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie); - - // These are the PUBLIC entry points - - BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level); - void WINAPI DbgSetModuleLevel(DWORD Type,DWORD Level); - void WINAPI DbgSetAutoRefreshLevels(bool fAuto); - - // Initialise the library with the module handle - - void WINAPI DbgInitialise(HINSTANCE hInst); - void WINAPI DbgTerminate(); - - void WINAPI DbgDumpObjectRegister(); - - // Display error and logging to the user - - void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); - void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); - void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...); - - void WINAPI DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); - void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...); -#ifdef UNICODE - void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...); - void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine); - void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine); - void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine); -#endif - void WINAPI DbgOutString(LPCTSTR psz); - - // Debug infinite wait stuff - DWORD WINAPI DbgWaitForSingleObject(HANDLE h); - DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount, - CONST HANDLE *lpHandles, - BOOL bWaitAll); - void WINAPI DbgSetWaitTimeout(DWORD dwTimeout); - -#ifdef __strmif_h__ - // Display a media type: Terse at level 2, verbose at level 5 - void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn); - - // Dump lots of information about a filter graph - void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel); -#endif - - #define KASSERT(_x_) if (!(_x_)) \ - DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) - - // Break on the debugger without putting up a message box - // message goes to debugger instead - - #define KDbgBreak(_x_) \ - DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) - - // We chose a common name for our ASSERT macro, MFC also uses this name - // So long as the implementation evaluates the condition and handles it - // then we will be ok. Rather than override the behaviour expected we - // will leave whatever first defines ASSERT as the handler (i.e. MFC) - #ifndef ASSERT - #define ASSERT(_x_) if (!(_x_)) \ - DbgAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) - #endif - - #define DbgAssertAligned( _ptr_, _alignment_ ) ASSERT( ((DWORD_PTR) (_ptr_)) % (_alignment_) == 0) - - // Put up a message box informing the user of a halt - // condition in the program - - #define DbgBreak(_x_) \ - DbgBreakPoint(TEXT(#_x_),TEXT(__FILE__),__LINE__) - - #define EXECUTE_ASSERT(_x_) ASSERT(_x_) - #define DbgLog(_x_) DbgLogInfo _x_ - // MFC style trace macros - - #define NOTE(_x_) DbgLog((LOG_TRACE,5,TEXT(_x_))) - #define NOTE1(_x_,a) DbgLog((LOG_TRACE,5,TEXT(_x_),a)) - #define NOTE2(_x_,a,b) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b)) - #define NOTE3(_x_,a,b,c) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c)) - #define NOTE4(_x_,a,b,c,d) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d)) - #define NOTE5(_x_,a,b,c,d,e) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d,e)) - -#else - - // Retail builds make public debug functions inert - WARNING the source - // files do not define or build any of the entry points in debug builds - // (public entry points compile to nothing) so if you go trying to call - // any of the private entry points in your source they won't compile - - #define NAME(_x_) ((TCHAR *) NULL) - - #define DbgInitialise(hInst) - #define DbgTerminate() - #define DbgLog(_x_) 0 - #define DbgOutString(psz) - #define DbgAssertAligned( _ptr_, _alignment_ ) 0 - - #define DbgRegisterObjectCreation(pObjectName) - #define DbgRegisterObjectDestruction(dwCookie) - #define DbgDumpObjectRegister() - - #define DbgCheckModuleLevel(Type,Level) - #define DbgSetModuleLevel(Type,Level) - #define DbgSetAutoRefreshLevels(fAuto) - - #define DbgWaitForSingleObject(h) WaitForSingleObject(h, INFINITE) - #define DbgWaitForMultipleObjects(nCount, lpHandles, bWaitAll) \ - WaitForMultipleObjects(nCount, lpHandles, bWaitAll, INFINITE) - #define DbgSetWaitTimeout(dwTimeout) - - #define KDbgBreak(_x_) - #define DbgBreak(_x_) - - #define KASSERT(_x_) ((void)0) - #ifndef ASSERT - #define ASSERT(_x_) ((void)0) - #endif - #define EXECUTE_ASSERT(_x_) ((void)(_x_)) - - // MFC style trace macros - - #define NOTE(_x_) ((void)0) - #define NOTE1(_x_,a) ((void)0) - #define NOTE2(_x_,a,b) ((void)0) - #define NOTE3(_x_,a,b,c) ((void)0) - #define NOTE4(_x_,a,b,c,d) ((void)0) - #define NOTE5(_x_,a,b,c,d,e) ((void)0) - - #define DisplayType(label, pmtIn) ((void)0) - #define DumpGraph(pGraph, label) ((void)0) -#endif - - -// Checks a pointer which should be non NULL - can be used as follows. - -#define CheckPointer(p,ret) {if((p)==NULL) return (ret);} - -// HRESULT Foo(VOID *pBar) -// { -// CheckPointer(pBar,E_INVALIDARG) -// } -// -// Or if the function returns a boolean -// -// BOOL Foo(VOID *pBar) -// { -// CheckPointer(pBar,FALSE) -// } - -// These validate pointers when symbol VFWROBUST is defined -// This will normally be defined in debug not retail builds - -#ifdef DEBUG - #define VFWROBUST -#endif - -#ifdef VFWROBUST - - #define ValidateReadPtr(p,cb) \ - {if(IsBadReadPtr((PVOID)p,cb) == TRUE) \ - DbgBreak("Invalid read pointer");} - - #define ValidateWritePtr(p,cb) \ - {if(IsBadWritePtr((PVOID)p,cb) == TRUE) \ - DbgBreak("Invalid write pointer");} - - #define ValidateReadWritePtr(p,cb) \ - {ValidateReadPtr(p,cb) ValidateWritePtr(p,cb)} - - #define ValidateStringPtr(p) \ - {if(IsBadStringPtr((LPCTSTR)p,INFINITE) == TRUE) \ - DbgBreak("Invalid string pointer");} - - #define ValidateStringPtrA(p) \ - {if(IsBadStringPtrA((LPCSTR)p,INFINITE) == TRUE) \ - DbgBreak("Invalid ANSI string pointer");} - - #define ValidateStringPtrW(p) \ - {if(IsBadStringPtrW((LPCWSTR)p,INFINITE) == TRUE) \ - DbgBreak("Invalid UNICODE string pointer");} - -#else - #define ValidateReadPtr(p,cb) 0 - #define ValidateWritePtr(p,cb) 0 - #define ValidateReadWritePtr(p,cb) 0 - #define ValidateStringPtr(p) 0 - #define ValidateStringPtrA(p) 0 - #define ValidateStringPtrW(p) 0 -#endif - - -#ifdef _OBJBASE_H_ - - // Outputting GUID names. If you want to include the name - // associated with a GUID (eg CLSID_...) then - // - // GuidNames[yourGUID] - // - // Returns the name defined in uuids.h as a string - - typedef struct { - CHAR *szName; - GUID guid; - } GUID_STRING_ENTRY; - - class CGuidNameList { - public: - CHAR *operator [] (const GUID& guid); - }; - - extern CGuidNameList GuidNames; - -#endif - -#ifndef REMIND - // REMIND macro - generates warning as reminder to complete coding - // (eg) usage: - // - // #pragma message (REMIND("Add automation support")) - - - #define QUOTE(x) #x - #define QQUOTE(y) QUOTE(y) - #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str -#endif - -// Method to display objects in a useful format -// -// eg If you want to display a LONGLONG ll in a debug string do (eg) -// -// DbgLog((LOG_TRACE, n, TEXT("Value is %s"), (LPCTSTR)CDisp(ll, CDISP_HEX))); - - -class CDispBasic -{ -public: - CDispBasic() { m_pString = m_String; }; - ~CDispBasic(); -protected: - PTCHAR m_pString; // normally points to m_String... unless too much data - TCHAR m_String[50]; -}; -class CDisp : public CDispBasic -{ -public: - CDisp(LONGLONG ll, int Format = CDISP_HEX); // Display a LONGLONG in CDISP_HEX or CDISP_DEC form - CDisp(REFCLSID clsid); // Display a GUID - CDisp(double d); // Display a floating point number -#ifdef __strmif_h__ -#ifdef __STREAMS__ - CDisp(CRefTime t); // Display a Reference Time -#endif - CDisp(IPin *pPin); // Display a pin as {filter clsid}(pin name) - CDisp(IUnknown *pUnk); // Display a filter or pin -#endif // __strmif_h__ - ~CDisp(); - - // Implement cast to (LPCTSTR) as parameter to logger - operator LPCTSTR() - { - return (LPCTSTR)m_pString; - }; -}; - - -#if defined(DEBUG) -class CAutoTrace -{ -private: - const TCHAR* _szBlkName; - const int _level; - static const TCHAR _szEntering[]; - static const TCHAR _szLeaving[]; -public: - CAutoTrace(const TCHAR* szBlkName, const int level = 15) - : _szBlkName(szBlkName), _level(level) - {DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));} - - ~CAutoTrace() - {DbgLog((LOG_TRACE, _level, _szLeaving, _szBlkName));} -}; - -#define AMTRACE(_x_) CAutoTrace __trace _x_ -#else -#define AMTRACE(_x_) -#endif - -#endif // __WXDEBUG__ - - +//------------------------------------------------------------------------------ +// File: WXDebug.h +// +// Desc: DirectShow base classes - provides debugging facilities. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __WXDEBUG__ +#define __WXDEBUG__ + +// This library provides fairly straight forward debugging functionality, this +// is split into two main sections. The first is assertion handling, there are +// three types of assertions provided here. The most commonly used one is the +// ASSERT(condition) macro which will pop up a message box including the file +// and line number if the condition evaluates to FALSE. Then there is the +// EXECUTE_ASSERT macro which is the same as ASSERT except the condition will +// still be executed in NON debug builds. The final type of assertion is the +// KASSERT macro which is more suitable for pure (perhaps kernel) filters as +// the condition is printed onto the debugger rather than in a message box. +// +// The other part of the debug module facilties is general purpose logging. +// This is accessed by calling DbgLog(). The function takes a type and level +// field which define the type of informational string you are presenting and +// it's relative importance. The type field can be a combination (one or more) +// of LOG_TIMING, LOG_TRACE, LOG_MEMORY, LOG_LOCKING and LOG_ERROR. The level +// is a DWORD value where zero defines highest important. Use of zero as the +// debug logging level is to be encouraged ONLY for major errors or events as +// they will ALWAYS be displayed on the debugger. Other debug output has it's +// level matched against the current debug output level stored in the registry +// for this module and if less than the current setting it will be displayed. +// +// Each module or executable has it's own debug output level for each of the +// five types. These are read in when the DbgInitialise function is called +// for DLLs linking to STRMBASE.LIB this is done automatically when the DLL +// is loaded, executables must call it explicitely with the module instance +// handle given to them through the WINMAIN entry point. An executable must +// also call DbgTerminate when they have finished to clean up the resources +// the debug library uses, once again this is done automatically for DLLs + +// These are the five different categories of logging information + +enum { LOG_TIMING = 0x01, // Timing and performance measurements + LOG_TRACE = 0x02, // General step point call tracing + LOG_MEMORY = 0x04, // Memory and object allocation/destruction + LOG_LOCKING = 0x08, // Locking/unlocking of critical sections + LOG_ERROR = 0x10, // Debug error notification + LOG_CUSTOM1 = 0x20, + LOG_CUSTOM2 = 0x40, + LOG_CUSTOM3 = 0x80, + LOG_CUSTOM4 = 0x100, + LOG_CUSTOM5 = 0x200, +}; + +#define LOG_FORCIBLY_SET 0x80000000 + +enum { CDISP_HEX = 0x01, + CDISP_DEC = 0x02}; + +// For each object created derived from CBaseObject (in debug builds) we +// create a descriptor that holds it's name (statically allocated memory) +// and a cookie we assign it. We keep a list of all the active objects +// we have registered so that we can dump a list of remaining objects + +typedef struct tag_ObjectDesc { + const CHAR *m_szName; + const WCHAR *m_wszName; + DWORD m_dwCookie; + tag_ObjectDesc *m_pNext; +} ObjectDesc; + +#define DLLIMPORT __declspec(dllimport) +#define DLLEXPORT __declspec(dllexport) + +#ifdef DEBUG + + #define NAME(x) TEXT(x) + + // These are used internally by the debug library (PRIVATE) + + void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax); + void WINAPI DbgInitGlobalSettings(bool fTakeMax); + void WINAPI DbgInitModuleSettings(bool fTakeMax); + void WINAPI DbgInitModuleName(); + DWORD WINAPI DbgRegisterObjectCreation( + const CHAR *szObjectName, const WCHAR *wszObjectName); + + BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie); + + // These are the PUBLIC entry points + + BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level); + void WINAPI DbgSetModuleLevel(DWORD Type,DWORD Level); + void WINAPI DbgSetAutoRefreshLevels(bool fAuto); + + // Initialise the library with the module handle + + void WINAPI DbgInitialise(HINSTANCE hInst); + void WINAPI DbgTerminate(); + + void WINAPI DbgDumpObjectRegister(); + + // Display error and logging to the user + + void WINAPI DbgAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); + void WINAPI DbgBreakPoint(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); + void WINAPI DbgBreakPoint(const TCHAR *pFileName,INT iLine,const TCHAR* szFormatString,...); + + void WINAPI DbgKernelAssert(const TCHAR *pCondition,const TCHAR *pFileName,INT iLine); + void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const TCHAR *pFormat,...); +#ifdef UNICODE + void WINAPI DbgLogInfo(DWORD Type,DWORD Level,const CHAR *pFormat,...); + void WINAPI DbgAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine); + void WINAPI DbgBreakPoint(const CHAR *pCondition,const CHAR *pFileName,INT iLine); + void WINAPI DbgKernelAssert(const CHAR *pCondition,const CHAR *pFileName,INT iLine); +#endif + void WINAPI DbgOutString(LPCTSTR psz); + + // Debug infinite wait stuff + DWORD WINAPI DbgWaitForSingleObject(HANDLE h); + DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount, + CONST HANDLE *lpHandles, + BOOL bWaitAll); + void WINAPI DbgSetWaitTimeout(DWORD dwTimeout); + +#ifdef __strmif_h__ + // Display a media type: Terse at level 2, verbose at level 5 + void WINAPI DisplayType(LPTSTR label, const AM_MEDIA_TYPE *pmtIn); + + // Dump lots of information about a filter graph + void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel); +#endif + + #define KASSERT(_x_) if (!(_x_)) \ + DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) + + // Break on the debugger without putting up a message box + // message goes to debugger instead + + #define KDbgBreak(_x_) \ + DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) + + // We chose a common name for our ASSERT macro, MFC also uses this name + // So long as the implementation evaluates the condition and handles it + // then we will be ok. Rather than override the behaviour expected we + // will leave whatever first defines ASSERT as the handler (i.e. MFC) + #ifndef ASSERT + #define ASSERT(_x_) if (!(_x_)) \ + DbgAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__) + #endif + + #define DbgAssertAligned( _ptr_, _alignment_ ) ASSERT( ((DWORD_PTR) (_ptr_)) % (_alignment_) == 0) + + // Put up a message box informing the user of a halt + // condition in the program + + #define DbgBreak(_x_) \ + DbgBreakPoint(TEXT(#_x_),TEXT(__FILE__),__LINE__) + + #define EXECUTE_ASSERT(_x_) ASSERT(_x_) + #define DbgLog(_x_) DbgLogInfo _x_ + // MFC style trace macros + + #define NOTE(_x_) DbgLog((LOG_TRACE,5,TEXT(_x_))) + #define NOTE1(_x_,a) DbgLog((LOG_TRACE,5,TEXT(_x_),a)) + #define NOTE2(_x_,a,b) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b)) + #define NOTE3(_x_,a,b,c) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c)) + #define NOTE4(_x_,a,b,c,d) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d)) + #define NOTE5(_x_,a,b,c,d,e) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d,e)) + +#else + + // Retail builds make public debug functions inert - WARNING the source + // files do not define or build any of the entry points in debug builds + // (public entry points compile to nothing) so if you go trying to call + // any of the private entry points in your source they won't compile + + #define NAME(_x_) ((TCHAR *) NULL) + + #define DbgInitialise(hInst) + #define DbgTerminate() + #define DbgLog(_x_) 0 + #define DbgOutString(psz) + #define DbgAssertAligned( _ptr_, _alignment_ ) 0 + + #define DbgRegisterObjectCreation(pObjectName) + #define DbgRegisterObjectDestruction(dwCookie) + #define DbgDumpObjectRegister() + + #define DbgCheckModuleLevel(Type,Level) + #define DbgSetModuleLevel(Type,Level) + #define DbgSetAutoRefreshLevels(fAuto) + + #define DbgWaitForSingleObject(h) WaitForSingleObject(h, INFINITE) + #define DbgWaitForMultipleObjects(nCount, lpHandles, bWaitAll) \ + WaitForMultipleObjects(nCount, lpHandles, bWaitAll, INFINITE) + #define DbgSetWaitTimeout(dwTimeout) + + #define KDbgBreak(_x_) + #define DbgBreak(_x_) + + #define KASSERT(_x_) ((void)0) + #ifndef ASSERT + #define ASSERT(_x_) ((void)0) + #endif + #define EXECUTE_ASSERT(_x_) ((void)(_x_)) + + // MFC style trace macros + + #define NOTE(_x_) ((void)0) + #define NOTE1(_x_,a) ((void)0) + #define NOTE2(_x_,a,b) ((void)0) + #define NOTE3(_x_,a,b,c) ((void)0) + #define NOTE4(_x_,a,b,c,d) ((void)0) + #define NOTE5(_x_,a,b,c,d,e) ((void)0) + + #define DisplayType(label, pmtIn) ((void)0) + #define DumpGraph(pGraph, label) ((void)0) +#endif + + +// Checks a pointer which should be non NULL - can be used as follows. + +#define CheckPointer(p,ret) {if((p)==NULL) return (ret);} + +// HRESULT Foo(VOID *pBar) +// { +// CheckPointer(pBar,E_INVALIDARG) +// } +// +// Or if the function returns a boolean +// +// BOOL Foo(VOID *pBar) +// { +// CheckPointer(pBar,FALSE) +// } + +// These validate pointers when symbol VFWROBUST is defined +// This will normally be defined in debug not retail builds + +#ifdef DEBUG + #define VFWROBUST +#endif + +#ifdef VFWROBUST + + #define ValidateReadPtr(p,cb) \ + {if(IsBadReadPtr((PVOID)p,cb) == TRUE) \ + DbgBreak("Invalid read pointer");} + + #define ValidateWritePtr(p,cb) \ + {if(IsBadWritePtr((PVOID)p,cb) == TRUE) \ + DbgBreak("Invalid write pointer");} + + #define ValidateReadWritePtr(p,cb) \ + {ValidateReadPtr(p,cb) ValidateWritePtr(p,cb)} + + #define ValidateStringPtr(p) \ + {if(IsBadStringPtr((LPCTSTR)p,INFINITE) == TRUE) \ + DbgBreak("Invalid string pointer");} + + #define ValidateStringPtrA(p) \ + {if(IsBadStringPtrA((LPCSTR)p,INFINITE) == TRUE) \ + DbgBreak("Invalid ANSI string pointer");} + + #define ValidateStringPtrW(p) \ + {if(IsBadStringPtrW((LPCWSTR)p,INFINITE) == TRUE) \ + DbgBreak("Invalid UNICODE string pointer");} + +#else + #define ValidateReadPtr(p,cb) 0 + #define ValidateWritePtr(p,cb) 0 + #define ValidateReadWritePtr(p,cb) 0 + #define ValidateStringPtr(p) 0 + #define ValidateStringPtrA(p) 0 + #define ValidateStringPtrW(p) 0 +#endif + + +#ifdef _OBJBASE_H_ + + // Outputting GUID names. If you want to include the name + // associated with a GUID (eg CLSID_...) then + // + // GuidNames[yourGUID] + // + // Returns the name defined in uuids.h as a string + + typedef struct { + CHAR *szName; + GUID guid; + } GUID_STRING_ENTRY; + + class CGuidNameList { + public: + CHAR *operator [] (const GUID& guid); + }; + + extern CGuidNameList GuidNames; + +#endif + +#ifndef REMIND + // REMIND macro - generates warning as reminder to complete coding + // (eg) usage: + // + // #pragma message (REMIND("Add automation support")) + + + #define QUOTE(x) #x + #define QQUOTE(y) QUOTE(y) + #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str +#endif + +// Method to display objects in a useful format +// +// eg If you want to display a LONGLONG ll in a debug string do (eg) +// +// DbgLog((LOG_TRACE, n, TEXT("Value is %s"), (LPCTSTR)CDisp(ll, CDISP_HEX))); + + +class CDispBasic +{ +public: + CDispBasic() { m_pString = m_String; }; + ~CDispBasic(); +protected: + PTCHAR m_pString; // normally points to m_String... unless too much data + TCHAR m_String[50]; +}; +class CDisp : public CDispBasic +{ +public: + CDisp(LONGLONG ll, int Format = CDISP_HEX); // Display a LONGLONG in CDISP_HEX or CDISP_DEC form + CDisp(REFCLSID clsid); // Display a GUID + CDisp(double d); // Display a floating point number +#ifdef __strmif_h__ +#ifdef __STREAMS__ + CDisp(CRefTime t); // Display a Reference Time +#endif + CDisp(IPin *pPin); // Display a pin as {filter clsid}(pin name) + CDisp(IUnknown *pUnk); // Display a filter or pin +#endif // __strmif_h__ + ~CDisp(); + + // Implement cast to (LPCTSTR) as parameter to logger + operator LPCTSTR() + { + return (LPCTSTR)m_pString; + }; +}; + + +#if defined(DEBUG) +class CAutoTrace +{ +private: + const TCHAR* _szBlkName; + const int _level; + static const TCHAR _szEntering[]; + static const TCHAR _szLeaving[]; +public: + CAutoTrace(const TCHAR* szBlkName, const int level = 15) + : _szBlkName(szBlkName), _level(level) + {DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));} + + ~CAutoTrace() + {DbgLog((LOG_TRACE, _level, _szLeaving, _szBlkName));} +}; + +#define AMTRACE(_x_) CAutoTrace __trace _x_ +#else +#define AMTRACE(_x_) +#endif + +#endif // __WXDEBUG__ + + diff --git a/src/BaseClasses/wxlist.cpp b/src/BaseClasses/wxlist.cpp index 81db050365..214d096969 100644 --- a/src/BaseClasses/wxlist.cpp +++ b/src/BaseClasses/wxlist.cpp @@ -1,885 +1,885 @@ -//------------------------------------------------------------------------------ -// File: WXList.cpp -// -// Desc: DirectShow base classes - implements a non-MFC based generic list -// template class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -/* A generic list of pointers to objects. - Objectives: avoid using MFC libraries in ndm kernel mode and - provide a really useful list type. - - The class is thread safe in that separate threads may add and - delete items in the list concurrently although the application - must ensure that constructor and destructor access is suitably - synchronised. - - The list name must not conflict with MFC classes as an - application may use both - - The nodes form a doubly linked, NULL terminated chain with an anchor - block (the list object per se) holding pointers to the first and last - nodes and a count of the nodes. - There is a node cache to reduce the allocation and freeing overhead. - It optionally (determined at construction time) has an Event which is - set whenever the list becomes non-empty and reset whenever it becomes - empty. - It optionally (determined at construction time) has a Critical Section - which is entered during the important part of each operation. (About - all you can do outside it is some parameter checking). - - The node cache is a repository of nodes that are NOT in the list to speed - up storage allocation. Each list has its own cache to reduce locking and - serialising. The list accesses are serialised anyway for a given list - a - common cache would mean that we would have to separately serialise access - of all lists within the cache. Because the cache only stores nodes that are - not in the list, releasing the cache does not release any list nodes. This - means that list nodes can be copied or rechained from one list to another - without danger of creating a dangling reference if the original cache goes - away. - - Questionable design decisions: - 1. Retaining the warts for compatibility - 2. Keeping an element count -i.e. counting whenever we do anything - instead of only when we want the count. - 3. Making the chain pointers NULL terminated. If the list object - itself looks just like a node and the list is kept as a ring then - it reduces the number of special cases. All inserts look the same. -*/ - - -#include - -/* set cursor to the position of each element of list in turn */ -#define INTERNALTRAVERSELIST(list, cursor) \ -for ( cursor = (list).GetHeadPositionI() \ - ; cursor!=NULL \ - ; cursor = (list).Next(cursor) \ - ) - - -/* set cursor to the position of each element of list in turn - in reverse order -*/ -#define INTERNALREVERSETRAVERSELIST(list, cursor) \ -for ( cursor = (list).GetTailPositionI() \ - ; cursor!=NULL \ - ; cursor = (list).Prev(cursor) \ - ) - -/* Constructor calls a separate initialisation function that - creates a node cache, optionally creates a lock object - and optionally creates a signaling object. - - By default we create a locking object, a DEFAULTCACHE sized - cache but no event object so the list cannot be used in calls - to WaitForSingleObject -*/ -CBaseList::CBaseList(TCHAR *pName, // Descriptive list name - INT iItems) : // Node cache size -#ifdef DEBUG - CBaseObject(pName), -#endif - m_pFirst(NULL), - m_pLast(NULL), - m_Count(0), - m_Cache(iItems) -{ -} // constructor - -CBaseList::CBaseList(TCHAR *pName) : // Descriptive list name -#ifdef DEBUG - CBaseObject(pName), -#endif - m_pFirst(NULL), - m_pLast(NULL), - m_Count(0), - m_Cache(DEFAULTCACHE) -{ -} // constructor - -#ifdef UNICODE -CBaseList::CBaseList(CHAR *pName, // Descriptive list name - INT iItems) : // Node cache size -#ifdef DEBUG - CBaseObject(pName), -#endif - m_pFirst(NULL), - m_pLast(NULL), - m_Count(0), - m_Cache(iItems) -{ -} // constructor - -CBaseList::CBaseList(CHAR *pName) : // Descriptive list name -#ifdef DEBUG - CBaseObject(pName), -#endif - m_pFirst(NULL), - m_pLast(NULL), - m_Count(0), - m_Cache(DEFAULTCACHE) -{ -} // constructor - -#endif - -/* The destructor enumerates all the node objects in the list and - in the cache deleting each in turn. We do not do any processing - on the objects that the list holds (i.e. points to) so if they - represent interfaces for example the creator of the list should - ensure that each of them is released before deleting us -*/ -CBaseList::~CBaseList() -{ - /* Delete all our list nodes */ - - RemoveAll(); - -} // destructor - -/* Remove all the nodes from the list but don't do anything - with the objects that each node looks after (this is the - responsibility of the creator). - Aa a last act we reset the signalling event - (if available) to indicate to clients that the list - does not have any entries in it. -*/ -void CBaseList::RemoveAll() -{ - /* Free up all the CNode objects NOTE we don't bother putting the - deleted nodes into the cache as this method is only really called - in serious times of change such as when we are being deleted at - which point the cache will be deleted anway */ - - CNode *pn = m_pFirst; - while (pn) { - CNode *op = pn; - pn = pn->Next(); - delete op; - } - - /* Reset the object count and the list pointers */ - - m_Count = 0; - m_pFirst = m_pLast = NULL; - -} // RemoveAll - - - -/* Return a position enumerator for the entire list. - A position enumerator is a pointer to a node object cast to a - transparent type so all we do is return the head/tail node - pointer in the list. - WARNING because the position is a pointer to a node there is - an implicit assumption for users a the list class that after - deleting an object from the list that any other position - enumerators that you have may be invalid (since the node - may be gone). -*/ -POSITION CBaseList::GetHeadPositionI() const -{ - return (POSITION) m_pFirst; -} // GetHeadPosition - - - -POSITION CBaseList::GetTailPositionI() const -{ - return (POSITION) m_pLast; -} // GetTailPosition - - - -/* Get the number of objects in the list, - Get the lock before accessing the count. - Locking may not be entirely necessary but it has the side effect - of making sure that all operations are complete before we get it. - So for example if a list is being added to this list then that - will have completed in full before we continue rather than seeing - an intermediate albeit valid state -*/ -int CBaseList::GetCountI() const -{ - return m_Count; -} // GetCount - - - -/* Return the object at rp, update rp to the next object from - the list or NULL if you have moved over the last object. - You may still call this function once we return NULL but - we will continue to return a NULL position value -*/ -void *CBaseList::GetNextI(POSITION& rp) const -{ - /* have we reached the end of the list */ - - if (rp == NULL) { - return NULL; - } - - /* Lock the object before continuing */ - - void *pObject; - - /* Copy the original position then step on */ - - CNode *pn = (CNode *) rp; - ASSERT(pn != NULL); - rp = (POSITION) pn->Next(); - - /* Get the object at the original position from the list */ - - pObject = pn->GetData(); - // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. - return pObject; -} //GetNext - - - -/* Return the object at p. - Asking for the object at NULL ASSERTs then returns NULL - The object is NOT locked. The list is not being changed - in any way. If another thread is busy deleting the object - then locking would only result in a change from one bad - behaviour to another. -*/ -void *CBaseList::GetI(POSITION p) const -{ - if (p == NULL) { - return NULL; - } - - CNode * pn = (CNode *) p; - void *pObject = pn->GetData(); - // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. - return pObject; -} //Get - - - -/* Return the first position in the list which holds the given pointer. - Return NULL if it's not found. -*/ -POSITION CBaseList::FindI( void * pObj) const -{ - POSITION pn; - INTERNALTRAVERSELIST(*this, pn){ - if (GetI(pn)==pObj) { - return pn; - } - } - return NULL; -} // Find - - - -/* Remove the first node in the list (deletes the pointer to its object - from the list, does not free the object itself). - Return the pointer to its object or NULL if empty -*/ -void *CBaseList::RemoveHeadI() -{ - /* All we do is get the head position and ask for that to be deleted. - We could special case this since some of the code path checking - in Remove() is redundant as we know there is no previous - node for example but it seems to gain little over the - added complexity - */ - - return RemoveI((POSITION)m_pFirst); -} // RemoveHead - - - -/* Remove the last node in the list (deletes the pointer to its object - from the list, does not free the object itself). - Return the pointer to its object or NULL if empty -*/ -void *CBaseList::RemoveTailI() -{ - /* All we do is get the tail position and ask for that to be deleted. - We could special case this since some of the code path checking - in Remove() is redundant as we know there is no previous - node for example but it seems to gain little over the - added complexity - */ - - return RemoveI((POSITION)m_pLast); -} // RemoveTail - - - -/* Remove the pointer to the object in this position from the list. - Deal with all the chain pointers - Return a pointer to the object removed from the list. - The node object that is freed as a result - of this operation is added to the node cache where - it can be used again. - Remove(NULL) is a harmless no-op - but probably is a wart. -*/ -void *CBaseList::RemoveI(POSITION pos) -{ - /* Lock the critical section before continuing */ - - // ASSERT (pos!=NULL); // Removing NULL is to be harmless! - if (pos==NULL) return NULL; - - - CNode *pCurrent = (CNode *) pos; - ASSERT(pCurrent != NULL); - - /* Update the previous node */ - - CNode *pNode = pCurrent->Prev(); - if (pNode == NULL) { - m_pFirst = pCurrent->Next(); - } else { - pNode->SetNext(pCurrent->Next()); - } - - /* Update the following node */ - - pNode = pCurrent->Next(); - if (pNode == NULL) { - m_pLast = pCurrent->Prev(); - } else { - pNode->SetPrev(pCurrent->Prev()); - } - - /* Get the object this node was looking after */ - - void *pObject = pCurrent->GetData(); - - // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. - - /* Try and add the node object to the cache - - a NULL return code from the cache means we ran out of room. - The cache size is fixed by a constructor argument when the - list is created and defaults to DEFAULTCACHE. - This means that the cache will have room for this many - node objects. So if you have a list of media samples - and you know there will never be more than five active at - any given time of them for example then override the default - constructor - */ - - m_Cache.AddToCache(pCurrent); - - /* If the list is empty then reset the list event */ - - --m_Count; - ASSERT(m_Count >= 0); - return pObject; -} // Remove - - - -/* Add this object to the tail end of our list - Return the new tail position. -*/ - -POSITION CBaseList::AddTailI(void *pObject) -{ - /* Lock the critical section before continuing */ - - CNode *pNode; - // ASSERT(pObject); // NULL pointers in the list are allowed. - - /* If there is a node objects in the cache then use - that otherwise we will have to create a new one */ - - pNode = (CNode *) m_Cache.RemoveFromCache(); - if (pNode == NULL) { - pNode = new CNode; - } - - /* Check we have a valid object */ - - if (pNode == NULL) { - return NULL; - } - - /* Initialise all the CNode object - just in case it came from the cache - */ - - pNode->SetData(pObject); - pNode->SetNext(NULL); - pNode->SetPrev(m_pLast); - - if (m_pLast == NULL) { - m_pFirst = pNode; - } else { - m_pLast->SetNext(pNode); - } - - /* Set the new last node pointer and also increment the number - of list entries, the critical section is unlocked when we - exit the function - */ - - m_pLast = pNode; - ++m_Count; - - return (POSITION) pNode; -} // AddTail(object) - - - -/* Add this object to the head end of our list - Return the new head position. -*/ -POSITION CBaseList::AddHeadI(void *pObject) -{ - CNode *pNode; - // ASSERT(pObject); // NULL pointers in the list are allowed. - - /* If there is a node objects in the cache then use - that otherwise we will have to create a new one */ - - pNode = (CNode *) m_Cache.RemoveFromCache(); - if (pNode == NULL) { - pNode = new CNode; - } - - /* Check we have a valid object */ - - if (pNode == NULL) { - return NULL; - } - - /* Initialise all the CNode object - just in case it came from the cache - */ - - pNode->SetData(pObject); - - /* chain it in (set four pointers) */ - pNode->SetPrev(NULL); - pNode->SetNext(m_pFirst); - - if (m_pFirst == NULL) { - m_pLast = pNode; - } else { - m_pFirst->SetPrev(pNode); - } - m_pFirst = pNode; - - ++m_Count; - - return (POSITION) pNode; -} // AddHead(object) - - - -/* Add all the elements in *pList to the tail of this list. - Return TRUE if it all worked, FALSE if it didn't. - If it fails some elements may have been added. -*/ -BOOL CBaseList::AddTail(CBaseList *pList) -{ - /* lock the object before starting then enumerate - each entry in the source list and add them one by one to - our list (while still holding the object lock) - Lock the other list too. - */ - POSITION pos = pList->GetHeadPositionI(); - - while (pos) { - if (NULL == AddTailI(pList->GetNextI(pos))) { - return FALSE; - } - } - return TRUE; -} // AddTail(list) - - - -/* Add all the elements in *pList to the head of this list. - Return TRUE if it all worked, FALSE if it didn't. - If it fails some elements may have been added. -*/ -BOOL CBaseList::AddHead(CBaseList *pList) -{ - /* lock the object before starting then enumerate - each entry in the source list and add them one by one to - our list (while still holding the object lock) - Lock the other list too. - - To avoid reversing the list, traverse it backwards. - */ - - POSITION pos; - - INTERNALREVERSETRAVERSELIST(*pList, pos) { - if (NULL== AddHeadI(pList->GetI(pos))){ - return FALSE; - } - } - return TRUE; -} // AddHead(list) - - - -/* Add the object after position p - p is still valid after the operation. - AddAfter(NULL,x) adds x to the start - same as AddHead - Return the position of the new object, NULL if it failed -*/ -POSITION CBaseList::AddAfterI(POSITION pos, void * pObj) -{ - if (pos==NULL) - return AddHeadI(pObj); - - /* As someone else might be furkling with the list - - Lock the critical section before continuing - */ - CNode *pAfter = (CNode *) pos; - ASSERT(pAfter != NULL); - if (pAfter==m_pLast) - return AddTailI(pObj); - - /* set pnode to point to a new node, preferably from the cache */ - - CNode *pNode = (CNode *) m_Cache.RemoveFromCache(); - if (pNode == NULL) { - pNode = new CNode; - } - - /* Check we have a valid object */ - - if (pNode == NULL) { - return NULL; - } - - /* Initialise all the CNode object - just in case it came from the cache - */ - - pNode->SetData(pObj); - - /* It is to be added to the middle of the list - there is a before - and after node. Chain it after pAfter, before pBefore. - */ - CNode * pBefore = pAfter->Next(); - ASSERT(pBefore != NULL); - - /* chain it in (set four pointers) */ - pNode->SetPrev(pAfter); - pNode->SetNext(pBefore); - pBefore->SetPrev(pNode); - pAfter->SetNext(pNode); - - ++m_Count; - - return (POSITION) pNode; - -} // AddAfter(object) - - - -BOOL CBaseList::AddAfter(POSITION p, CBaseList *pList) -{ - POSITION pos; - INTERNALTRAVERSELIST(*pList, pos) { - /* p follows along the elements being added */ - p = AddAfterI(p, pList->GetI(pos)); - if (p==NULL) return FALSE; - } - return TRUE; -} // AddAfter(list) - - - -/* Mirror images: - Add the element or list after position p. - p is still valid after the operation. - AddBefore(NULL,x) adds x to the end - same as AddTail -*/ -POSITION CBaseList::AddBeforeI(POSITION pos, void * pObj) -{ - if (pos==NULL) - return AddTailI(pObj); - - /* set pnode to point to a new node, preferably from the cache */ - - CNode *pBefore = (CNode *) pos; - ASSERT(pBefore != NULL); - if (pBefore==m_pFirst) - return AddHeadI(pObj); - - CNode * pNode = (CNode *) m_Cache.RemoveFromCache(); - if (pNode == NULL) { - pNode = new CNode; - } - - /* Check we have a valid object */ - - if (pNode == NULL) { - return NULL; - } - - /* Initialise all the CNode object - just in case it came from the cache - */ - - pNode->SetData(pObj); - - /* It is to be added to the middle of the list - there is a before - and after node. Chain it after pAfter, before pBefore. - */ - - CNode * pAfter = pBefore->Prev(); - ASSERT(pAfter != NULL); - - /* chain it in (set four pointers) */ - pNode->SetPrev(pAfter); - pNode->SetNext(pBefore); - pBefore->SetPrev(pNode); - pAfter->SetNext(pNode); - - ++m_Count; - - return (POSITION) pNode; - -} // Addbefore(object) - - - -BOOL CBaseList::AddBefore(POSITION p, CBaseList *pList) -{ - POSITION pos; - INTERNALREVERSETRAVERSELIST(*pList, pos) { - /* p follows along the elements being added */ - p = AddBeforeI(p, pList->GetI(pos)); - if (p==NULL) return FALSE; - } - return TRUE; -} // AddBefore(list) - - - -/* Split *this after position p in *this - Retain as *this the tail portion of the original *this - Add the head portion to the tail end of *pList - Return TRUE if it all worked, FALSE if it didn't. - - e.g. - foo->MoveToTail(foo->GetHeadPosition(), bar); - moves one element from the head of foo to the tail of bar - foo->MoveToTail(NULL, bar); - is a no-op - foo->MoveToTail(foo->GetTailPosition, bar); - concatenates foo onto the end of bar and empties foo. - - A better, except excessively long name might be - MoveElementsFromHeadThroughPositionToOtherTail -*/ -BOOL CBaseList::MoveToTail - (POSITION pos, CBaseList *pList) -{ - /* Algorithm: - Note that the elements (including their order) in the concatenation - of *pList to the head of *this is invariant. - 1. Count elements to be moved - 2. Join *pList onto the head of this to make one long chain - 3. Set first/Last pointers in *this and *pList - 4. Break the chain at the new place - 5. Adjust counts - 6. Set/Reset any events - */ - - if (pos==NULL) return TRUE; // no-op. Eliminates special cases later. - - - /* Make cMove the number of nodes to move */ - CNode * p = (CNode *)pos; - int cMove = 0; // number of nodes to move - while(p!=NULL) { - p = p->Prev(); - ++cMove; - } - - - /* Join the two chains together */ - if (pList->m_pLast!=NULL) - pList->m_pLast->SetNext(m_pFirst); - if (m_pFirst!=NULL) - m_pFirst->SetPrev(pList->m_pLast); - - - /* set first and last pointers */ - p = (CNode *)pos; - - if (pList->m_pFirst==NULL) - pList->m_pFirst = m_pFirst; - m_pFirst = p->Next(); - if (m_pFirst==NULL) - m_pLast = NULL; - pList->m_pLast = p; - - - /* Break the chain after p to create the new pieces */ - if (m_pFirst!=NULL) - m_pFirst->SetPrev(NULL); - p->SetNext(NULL); - - - /* Adjust the counts */ - m_Count -= cMove; - pList->m_Count += cMove; - - return TRUE; - -} // MoveToTail - - - -/* Mirror image of MoveToTail: - Split *this before position p in *this. - Retain in *this the head portion of the original *this - Add the tail portion to the start (i.e. head) of *pList - Return TRUE if it all worked, FALSE if it didn't. - - e.g. - foo->MoveToHead(foo->GetTailPosition(), bar); - moves one element from the tail of foo to the head of bar - foo->MoveToHead(NULL, bar); - is a no-op - foo->MoveToHead(foo->GetHeadPosition, bar); - concatenates foo onto the start of bar and empties foo. -*/ -BOOL CBaseList::MoveToHead - (POSITION pos, CBaseList *pList) -{ - - /* See the comments on the algorithm in MoveToTail */ - - if (pos==NULL) return TRUE; // no-op. Eliminates special cases later. - - /* Make cMove the number of nodes to move */ - CNode * p = (CNode *)pos; - int cMove = 0; // number of nodes to move - while(p!=NULL) { - p = p->Next(); - ++cMove; - } - - - /* Join the two chains together */ - if (pList->m_pFirst!=NULL) - pList->m_pFirst->SetPrev(m_pLast); - if (m_pLast!=NULL) - m_pLast->SetNext(pList->m_pFirst); - - - /* set first and last pointers */ - p = (CNode *)pos; - - - if (pList->m_pLast==NULL) - pList->m_pLast = m_pLast; - - m_pLast = p->Prev(); - if (m_pLast==NULL) - m_pFirst = NULL; - pList->m_pFirst = p; - - - /* Break the chain after p to create the new pieces */ - if (m_pLast!=NULL) - m_pLast->SetNext(NULL); - p->SetPrev(NULL); - - - /* Adjust the counts */ - m_Count -= cMove; - pList->m_Count += cMove; - - return TRUE; - -} // MoveToHead - - - -/* Reverse the order of the [pointers to] objects in *this -*/ -void CBaseList::Reverse() -{ - /* algorithm: - The obvious booby trap is that you flip pointers around and lose - addressability to the node that you are going to process next. - The easy way to avoid this is do do one chain at a time. - - Run along the forward chain, - For each node, set the reverse pointer to the one ahead of us. - The reverse chain is now a copy of the old forward chain, including - the NULL termination. - - Run along the reverse chain (i.e. old forward chain again) - For each node set the forward pointer of the node ahead to point back - to the one we're standing on. - The first node needs special treatment, - it's new forward pointer is NULL. - Finally set the First/Last pointers - - */ - CNode * p; - - // Yes we COULD use a traverse, but it would look funny! - p = m_pFirst; - while (p!=NULL) { - CNode * q; - q = p->Next(); - p->SetNext(p->Prev()); - p->SetPrev(q); - p = q; - } - - p = m_pFirst; - m_pFirst = m_pLast; - m_pLast = p; - - -#if 0 // old version - - if (m_pFirst==NULL) return; // empty list - if (m_pFirst->Next()==NULL) return; // single node list - - - /* run along forward chain */ - for ( p = m_pFirst - ; p!=NULL - ; p = p->Next() - ){ - p->SetPrev(p->Next()); - } - - - /* special case first element */ - m_pFirst->SetNext(NULL); // fix the old first element - - - /* run along new reverse chain i.e. old forward chain again */ - for ( p = m_pFirst // start at the old first element - ; p->Prev()!=NULL // while there's a node still to be set - ; p = p->Prev() // work in the same direction as before - ){ - p->Prev()->SetNext(p); - } - - - /* fix forward and reverse pointers - - the triple XOR swap would work but all the casts look hideous */ - p = m_pFirst; - m_pFirst = m_pLast; - m_pLast = p; -#endif - -} // Reverse +//------------------------------------------------------------------------------ +// File: WXList.cpp +// +// Desc: DirectShow base classes - implements a non-MFC based generic list +// template class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +/* A generic list of pointers to objects. + Objectives: avoid using MFC libraries in ndm kernel mode and + provide a really useful list type. + + The class is thread safe in that separate threads may add and + delete items in the list concurrently although the application + must ensure that constructor and destructor access is suitably + synchronised. + + The list name must not conflict with MFC classes as an + application may use both + + The nodes form a doubly linked, NULL terminated chain with an anchor + block (the list object per se) holding pointers to the first and last + nodes and a count of the nodes. + There is a node cache to reduce the allocation and freeing overhead. + It optionally (determined at construction time) has an Event which is + set whenever the list becomes non-empty and reset whenever it becomes + empty. + It optionally (determined at construction time) has a Critical Section + which is entered during the important part of each operation. (About + all you can do outside it is some parameter checking). + + The node cache is a repository of nodes that are NOT in the list to speed + up storage allocation. Each list has its own cache to reduce locking and + serialising. The list accesses are serialised anyway for a given list - a + common cache would mean that we would have to separately serialise access + of all lists within the cache. Because the cache only stores nodes that are + not in the list, releasing the cache does not release any list nodes. This + means that list nodes can be copied or rechained from one list to another + without danger of creating a dangling reference if the original cache goes + away. + + Questionable design decisions: + 1. Retaining the warts for compatibility + 2. Keeping an element count -i.e. counting whenever we do anything + instead of only when we want the count. + 3. Making the chain pointers NULL terminated. If the list object + itself looks just like a node and the list is kept as a ring then + it reduces the number of special cases. All inserts look the same. +*/ + + +#include + +/* set cursor to the position of each element of list in turn */ +#define INTERNALTRAVERSELIST(list, cursor) \ +for ( cursor = (list).GetHeadPositionI() \ + ; cursor!=NULL \ + ; cursor = (list).Next(cursor) \ + ) + + +/* set cursor to the position of each element of list in turn + in reverse order +*/ +#define INTERNALREVERSETRAVERSELIST(list, cursor) \ +for ( cursor = (list).GetTailPositionI() \ + ; cursor!=NULL \ + ; cursor = (list).Prev(cursor) \ + ) + +/* Constructor calls a separate initialisation function that + creates a node cache, optionally creates a lock object + and optionally creates a signaling object. + + By default we create a locking object, a DEFAULTCACHE sized + cache but no event object so the list cannot be used in calls + to WaitForSingleObject +*/ +CBaseList::CBaseList(TCHAR *pName, // Descriptive list name + INT iItems) : // Node cache size +#ifdef DEBUG + CBaseObject(pName), +#endif + m_pFirst(NULL), + m_pLast(NULL), + m_Count(0), + m_Cache(iItems) +{ +} // constructor + +CBaseList::CBaseList(TCHAR *pName) : // Descriptive list name +#ifdef DEBUG + CBaseObject(pName), +#endif + m_pFirst(NULL), + m_pLast(NULL), + m_Count(0), + m_Cache(DEFAULTCACHE) +{ +} // constructor + +#ifdef UNICODE +CBaseList::CBaseList(CHAR *pName, // Descriptive list name + INT iItems) : // Node cache size +#ifdef DEBUG + CBaseObject(pName), +#endif + m_pFirst(NULL), + m_pLast(NULL), + m_Count(0), + m_Cache(iItems) +{ +} // constructor + +CBaseList::CBaseList(CHAR *pName) : // Descriptive list name +#ifdef DEBUG + CBaseObject(pName), +#endif + m_pFirst(NULL), + m_pLast(NULL), + m_Count(0), + m_Cache(DEFAULTCACHE) +{ +} // constructor + +#endif + +/* The destructor enumerates all the node objects in the list and + in the cache deleting each in turn. We do not do any processing + on the objects that the list holds (i.e. points to) so if they + represent interfaces for example the creator of the list should + ensure that each of them is released before deleting us +*/ +CBaseList::~CBaseList() +{ + /* Delete all our list nodes */ + + RemoveAll(); + +} // destructor + +/* Remove all the nodes from the list but don't do anything + with the objects that each node looks after (this is the + responsibility of the creator). + Aa a last act we reset the signalling event + (if available) to indicate to clients that the list + does not have any entries in it. +*/ +void CBaseList::RemoveAll() +{ + /* Free up all the CNode objects NOTE we don't bother putting the + deleted nodes into the cache as this method is only really called + in serious times of change such as when we are being deleted at + which point the cache will be deleted anway */ + + CNode *pn = m_pFirst; + while (pn) { + CNode *op = pn; + pn = pn->Next(); + delete op; + } + + /* Reset the object count and the list pointers */ + + m_Count = 0; + m_pFirst = m_pLast = NULL; + +} // RemoveAll + + + +/* Return a position enumerator for the entire list. + A position enumerator is a pointer to a node object cast to a + transparent type so all we do is return the head/tail node + pointer in the list. + WARNING because the position is a pointer to a node there is + an implicit assumption for users a the list class that after + deleting an object from the list that any other position + enumerators that you have may be invalid (since the node + may be gone). +*/ +POSITION CBaseList::GetHeadPositionI() const +{ + return (POSITION) m_pFirst; +} // GetHeadPosition + + + +POSITION CBaseList::GetTailPositionI() const +{ + return (POSITION) m_pLast; +} // GetTailPosition + + + +/* Get the number of objects in the list, + Get the lock before accessing the count. + Locking may not be entirely necessary but it has the side effect + of making sure that all operations are complete before we get it. + So for example if a list is being added to this list then that + will have completed in full before we continue rather than seeing + an intermediate albeit valid state +*/ +int CBaseList::GetCountI() const +{ + return m_Count; +} // GetCount + + + +/* Return the object at rp, update rp to the next object from + the list or NULL if you have moved over the last object. + You may still call this function once we return NULL but + we will continue to return a NULL position value +*/ +void *CBaseList::GetNextI(POSITION& rp) const +{ + /* have we reached the end of the list */ + + if (rp == NULL) { + return NULL; + } + + /* Lock the object before continuing */ + + void *pObject; + + /* Copy the original position then step on */ + + CNode *pn = (CNode *) rp; + ASSERT(pn != NULL); + rp = (POSITION) pn->Next(); + + /* Get the object at the original position from the list */ + + pObject = pn->GetData(); + // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. + return pObject; +} //GetNext + + + +/* Return the object at p. + Asking for the object at NULL ASSERTs then returns NULL + The object is NOT locked. The list is not being changed + in any way. If another thread is busy deleting the object + then locking would only result in a change from one bad + behaviour to another. +*/ +void *CBaseList::GetI(POSITION p) const +{ + if (p == NULL) { + return NULL; + } + + CNode * pn = (CNode *) p; + void *pObject = pn->GetData(); + // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. + return pObject; +} //Get + + + +/* Return the first position in the list which holds the given pointer. + Return NULL if it's not found. +*/ +POSITION CBaseList::FindI( void * pObj) const +{ + POSITION pn; + INTERNALTRAVERSELIST(*this, pn){ + if (GetI(pn)==pObj) { + return pn; + } + } + return NULL; +} // Find + + + +/* Remove the first node in the list (deletes the pointer to its object + from the list, does not free the object itself). + Return the pointer to its object or NULL if empty +*/ +void *CBaseList::RemoveHeadI() +{ + /* All we do is get the head position and ask for that to be deleted. + We could special case this since some of the code path checking + in Remove() is redundant as we know there is no previous + node for example but it seems to gain little over the + added complexity + */ + + return RemoveI((POSITION)m_pFirst); +} // RemoveHead + + + +/* Remove the last node in the list (deletes the pointer to its object + from the list, does not free the object itself). + Return the pointer to its object or NULL if empty +*/ +void *CBaseList::RemoveTailI() +{ + /* All we do is get the tail position and ask for that to be deleted. + We could special case this since some of the code path checking + in Remove() is redundant as we know there is no previous + node for example but it seems to gain little over the + added complexity + */ + + return RemoveI((POSITION)m_pLast); +} // RemoveTail + + + +/* Remove the pointer to the object in this position from the list. + Deal with all the chain pointers + Return a pointer to the object removed from the list. + The node object that is freed as a result + of this operation is added to the node cache where + it can be used again. + Remove(NULL) is a harmless no-op - but probably is a wart. +*/ +void *CBaseList::RemoveI(POSITION pos) +{ + /* Lock the critical section before continuing */ + + // ASSERT (pos!=NULL); // Removing NULL is to be harmless! + if (pos==NULL) return NULL; + + + CNode *pCurrent = (CNode *) pos; + ASSERT(pCurrent != NULL); + + /* Update the previous node */ + + CNode *pNode = pCurrent->Prev(); + if (pNode == NULL) { + m_pFirst = pCurrent->Next(); + } else { + pNode->SetNext(pCurrent->Next()); + } + + /* Update the following node */ + + pNode = pCurrent->Next(); + if (pNode == NULL) { + m_pLast = pCurrent->Prev(); + } else { + pNode->SetPrev(pCurrent->Prev()); + } + + /* Get the object this node was looking after */ + + void *pObject = pCurrent->GetData(); + + // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. + + /* Try and add the node object to the cache - + a NULL return code from the cache means we ran out of room. + The cache size is fixed by a constructor argument when the + list is created and defaults to DEFAULTCACHE. + This means that the cache will have room for this many + node objects. So if you have a list of media samples + and you know there will never be more than five active at + any given time of them for example then override the default + constructor + */ + + m_Cache.AddToCache(pCurrent); + + /* If the list is empty then reset the list event */ + + --m_Count; + ASSERT(m_Count >= 0); + return pObject; +} // Remove + + + +/* Add this object to the tail end of our list + Return the new tail position. +*/ + +POSITION CBaseList::AddTailI(void *pObject) +{ + /* Lock the critical section before continuing */ + + CNode *pNode; + // ASSERT(pObject); // NULL pointers in the list are allowed. + + /* If there is a node objects in the cache then use + that otherwise we will have to create a new one */ + + pNode = (CNode *) m_Cache.RemoveFromCache(); + if (pNode == NULL) { + pNode = new CNode; + } + + /* Check we have a valid object */ + + if (pNode == NULL) { + return NULL; + } + + /* Initialise all the CNode object + just in case it came from the cache + */ + + pNode->SetData(pObject); + pNode->SetNext(NULL); + pNode->SetPrev(m_pLast); + + if (m_pLast == NULL) { + m_pFirst = pNode; + } else { + m_pLast->SetNext(pNode); + } + + /* Set the new last node pointer and also increment the number + of list entries, the critical section is unlocked when we + exit the function + */ + + m_pLast = pNode; + ++m_Count; + + return (POSITION) pNode; +} // AddTail(object) + + + +/* Add this object to the head end of our list + Return the new head position. +*/ +POSITION CBaseList::AddHeadI(void *pObject) +{ + CNode *pNode; + // ASSERT(pObject); // NULL pointers in the list are allowed. + + /* If there is a node objects in the cache then use + that otherwise we will have to create a new one */ + + pNode = (CNode *) m_Cache.RemoveFromCache(); + if (pNode == NULL) { + pNode = new CNode; + } + + /* Check we have a valid object */ + + if (pNode == NULL) { + return NULL; + } + + /* Initialise all the CNode object + just in case it came from the cache + */ + + pNode->SetData(pObject); + + /* chain it in (set four pointers) */ + pNode->SetPrev(NULL); + pNode->SetNext(m_pFirst); + + if (m_pFirst == NULL) { + m_pLast = pNode; + } else { + m_pFirst->SetPrev(pNode); + } + m_pFirst = pNode; + + ++m_Count; + + return (POSITION) pNode; +} // AddHead(object) + + + +/* Add all the elements in *pList to the tail of this list. + Return TRUE if it all worked, FALSE if it didn't. + If it fails some elements may have been added. +*/ +BOOL CBaseList::AddTail(CBaseList *pList) +{ + /* lock the object before starting then enumerate + each entry in the source list and add them one by one to + our list (while still holding the object lock) + Lock the other list too. + */ + POSITION pos = pList->GetHeadPositionI(); + + while (pos) { + if (NULL == AddTailI(pList->GetNextI(pos))) { + return FALSE; + } + } + return TRUE; +} // AddTail(list) + + + +/* Add all the elements in *pList to the head of this list. + Return TRUE if it all worked, FALSE if it didn't. + If it fails some elements may have been added. +*/ +BOOL CBaseList::AddHead(CBaseList *pList) +{ + /* lock the object before starting then enumerate + each entry in the source list and add them one by one to + our list (while still holding the object lock) + Lock the other list too. + + To avoid reversing the list, traverse it backwards. + */ + + POSITION pos; + + INTERNALREVERSETRAVERSELIST(*pList, pos) { + if (NULL== AddHeadI(pList->GetI(pos))){ + return FALSE; + } + } + return TRUE; +} // AddHead(list) + + + +/* Add the object after position p + p is still valid after the operation. + AddAfter(NULL,x) adds x to the start - same as AddHead + Return the position of the new object, NULL if it failed +*/ +POSITION CBaseList::AddAfterI(POSITION pos, void * pObj) +{ + if (pos==NULL) + return AddHeadI(pObj); + + /* As someone else might be furkling with the list - + Lock the critical section before continuing + */ + CNode *pAfter = (CNode *) pos; + ASSERT(pAfter != NULL); + if (pAfter==m_pLast) + return AddTailI(pObj); + + /* set pnode to point to a new node, preferably from the cache */ + + CNode *pNode = (CNode *) m_Cache.RemoveFromCache(); + if (pNode == NULL) { + pNode = new CNode; + } + + /* Check we have a valid object */ + + if (pNode == NULL) { + return NULL; + } + + /* Initialise all the CNode object + just in case it came from the cache + */ + + pNode->SetData(pObj); + + /* It is to be added to the middle of the list - there is a before + and after node. Chain it after pAfter, before pBefore. + */ + CNode * pBefore = pAfter->Next(); + ASSERT(pBefore != NULL); + + /* chain it in (set four pointers) */ + pNode->SetPrev(pAfter); + pNode->SetNext(pBefore); + pBefore->SetPrev(pNode); + pAfter->SetNext(pNode); + + ++m_Count; + + return (POSITION) pNode; + +} // AddAfter(object) + + + +BOOL CBaseList::AddAfter(POSITION p, CBaseList *pList) +{ + POSITION pos; + INTERNALTRAVERSELIST(*pList, pos) { + /* p follows along the elements being added */ + p = AddAfterI(p, pList->GetI(pos)); + if (p==NULL) return FALSE; + } + return TRUE; +} // AddAfter(list) + + + +/* Mirror images: + Add the element or list after position p. + p is still valid after the operation. + AddBefore(NULL,x) adds x to the end - same as AddTail +*/ +POSITION CBaseList::AddBeforeI(POSITION pos, void * pObj) +{ + if (pos==NULL) + return AddTailI(pObj); + + /* set pnode to point to a new node, preferably from the cache */ + + CNode *pBefore = (CNode *) pos; + ASSERT(pBefore != NULL); + if (pBefore==m_pFirst) + return AddHeadI(pObj); + + CNode * pNode = (CNode *) m_Cache.RemoveFromCache(); + if (pNode == NULL) { + pNode = new CNode; + } + + /* Check we have a valid object */ + + if (pNode == NULL) { + return NULL; + } + + /* Initialise all the CNode object + just in case it came from the cache + */ + + pNode->SetData(pObj); + + /* It is to be added to the middle of the list - there is a before + and after node. Chain it after pAfter, before pBefore. + */ + + CNode * pAfter = pBefore->Prev(); + ASSERT(pAfter != NULL); + + /* chain it in (set four pointers) */ + pNode->SetPrev(pAfter); + pNode->SetNext(pBefore); + pBefore->SetPrev(pNode); + pAfter->SetNext(pNode); + + ++m_Count; + + return (POSITION) pNode; + +} // Addbefore(object) + + + +BOOL CBaseList::AddBefore(POSITION p, CBaseList *pList) +{ + POSITION pos; + INTERNALREVERSETRAVERSELIST(*pList, pos) { + /* p follows along the elements being added */ + p = AddBeforeI(p, pList->GetI(pos)); + if (p==NULL) return FALSE; + } + return TRUE; +} // AddBefore(list) + + + +/* Split *this after position p in *this + Retain as *this the tail portion of the original *this + Add the head portion to the tail end of *pList + Return TRUE if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToTail(foo->GetHeadPosition(), bar); + moves one element from the head of foo to the tail of bar + foo->MoveToTail(NULL, bar); + is a no-op + foo->MoveToTail(foo->GetTailPosition, bar); + concatenates foo onto the end of bar and empties foo. + + A better, except excessively long name might be + MoveElementsFromHeadThroughPositionToOtherTail +*/ +BOOL CBaseList::MoveToTail + (POSITION pos, CBaseList *pList) +{ + /* Algorithm: + Note that the elements (including their order) in the concatenation + of *pList to the head of *this is invariant. + 1. Count elements to be moved + 2. Join *pList onto the head of this to make one long chain + 3. Set first/Last pointers in *this and *pList + 4. Break the chain at the new place + 5. Adjust counts + 6. Set/Reset any events + */ + + if (pos==NULL) return TRUE; // no-op. Eliminates special cases later. + + + /* Make cMove the number of nodes to move */ + CNode * p = (CNode *)pos; + int cMove = 0; // number of nodes to move + while(p!=NULL) { + p = p->Prev(); + ++cMove; + } + + + /* Join the two chains together */ + if (pList->m_pLast!=NULL) + pList->m_pLast->SetNext(m_pFirst); + if (m_pFirst!=NULL) + m_pFirst->SetPrev(pList->m_pLast); + + + /* set first and last pointers */ + p = (CNode *)pos; + + if (pList->m_pFirst==NULL) + pList->m_pFirst = m_pFirst; + m_pFirst = p->Next(); + if (m_pFirst==NULL) + m_pLast = NULL; + pList->m_pLast = p; + + + /* Break the chain after p to create the new pieces */ + if (m_pFirst!=NULL) + m_pFirst->SetPrev(NULL); + p->SetNext(NULL); + + + /* Adjust the counts */ + m_Count -= cMove; + pList->m_Count += cMove; + + return TRUE; + +} // MoveToTail + + + +/* Mirror image of MoveToTail: + Split *this before position p in *this. + Retain in *this the head portion of the original *this + Add the tail portion to the start (i.e. head) of *pList + Return TRUE if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToHead(foo->GetTailPosition(), bar); + moves one element from the tail of foo to the head of bar + foo->MoveToHead(NULL, bar); + is a no-op + foo->MoveToHead(foo->GetHeadPosition, bar); + concatenates foo onto the start of bar and empties foo. +*/ +BOOL CBaseList::MoveToHead + (POSITION pos, CBaseList *pList) +{ + + /* See the comments on the algorithm in MoveToTail */ + + if (pos==NULL) return TRUE; // no-op. Eliminates special cases later. + + /* Make cMove the number of nodes to move */ + CNode * p = (CNode *)pos; + int cMove = 0; // number of nodes to move + while(p!=NULL) { + p = p->Next(); + ++cMove; + } + + + /* Join the two chains together */ + if (pList->m_pFirst!=NULL) + pList->m_pFirst->SetPrev(m_pLast); + if (m_pLast!=NULL) + m_pLast->SetNext(pList->m_pFirst); + + + /* set first and last pointers */ + p = (CNode *)pos; + + + if (pList->m_pLast==NULL) + pList->m_pLast = m_pLast; + + m_pLast = p->Prev(); + if (m_pLast==NULL) + m_pFirst = NULL; + pList->m_pFirst = p; + + + /* Break the chain after p to create the new pieces */ + if (m_pLast!=NULL) + m_pLast->SetNext(NULL); + p->SetPrev(NULL); + + + /* Adjust the counts */ + m_Count -= cMove; + pList->m_Count += cMove; + + return TRUE; + +} // MoveToHead + + + +/* Reverse the order of the [pointers to] objects in *this +*/ +void CBaseList::Reverse() +{ + /* algorithm: + The obvious booby trap is that you flip pointers around and lose + addressability to the node that you are going to process next. + The easy way to avoid this is do do one chain at a time. + + Run along the forward chain, + For each node, set the reverse pointer to the one ahead of us. + The reverse chain is now a copy of the old forward chain, including + the NULL termination. + + Run along the reverse chain (i.e. old forward chain again) + For each node set the forward pointer of the node ahead to point back + to the one we're standing on. + The first node needs special treatment, + it's new forward pointer is NULL. + Finally set the First/Last pointers + + */ + CNode * p; + + // Yes we COULD use a traverse, but it would look funny! + p = m_pFirst; + while (p!=NULL) { + CNode * q; + q = p->Next(); + p->SetNext(p->Prev()); + p->SetPrev(q); + p = q; + } + + p = m_pFirst; + m_pFirst = m_pLast; + m_pLast = p; + + +#if 0 // old version + + if (m_pFirst==NULL) return; // empty list + if (m_pFirst->Next()==NULL) return; // single node list + + + /* run along forward chain */ + for ( p = m_pFirst + ; p!=NULL + ; p = p->Next() + ){ + p->SetPrev(p->Next()); + } + + + /* special case first element */ + m_pFirst->SetNext(NULL); // fix the old first element + + + /* run along new reverse chain i.e. old forward chain again */ + for ( p = m_pFirst // start at the old first element + ; p->Prev()!=NULL // while there's a node still to be set + ; p = p->Prev() // work in the same direction as before + ){ + p->Prev()->SetNext(p); + } + + + /* fix forward and reverse pointers + - the triple XOR swap would work but all the casts look hideous */ + p = m_pFirst; + m_pFirst = m_pLast; + m_pLast = p; +#endif + +} // Reverse diff --git a/src/BaseClasses/wxlist.h b/src/BaseClasses/wxlist.h index 75a7959edf..3f4c190435 100644 --- a/src/BaseClasses/wxlist.h +++ b/src/BaseClasses/wxlist.h @@ -1,551 +1,551 @@ -//------------------------------------------------------------------------------ -// File: WXList.h -// -// Desc: DirectShow base classes - defines a non-MFC generic template list -// class. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -/* A generic list of pointers to objects. - No storage management or copying is done on the objects pointed to. - Objectives: avoid using MFC libraries in ndm kernel mode and - provide a really useful list type. - - The class is thread safe in that separate threads may add and - delete items in the list concurrently although the application - must ensure that constructor and destructor access is suitably - synchronised. An application can cause deadlock with operations - which use two lists by simultaneously calling - list1->Operation(list2) and list2->Operation(list1). So don't! - - The names must not conflict with MFC classes as an application - may use both. - */ - -#ifndef __WXLIST__ -#define __WXLIST__ - - /* A POSITION represents (in some fashion that's opaque) a cursor - on the list that can be set to identify any element. NULL is - a valid value and several operations regard NULL as the position - "one step off the end of the list". (In an n element list there - are n+1 places to insert and NULL is that "n+1-th" value). - The POSITION of an element in the list is only invalidated if - that element is deleted. Move operations may mean that what - was a valid POSITION in one list is now a valid POSITION in - a different list. - - Some operations which at first sight are illegal are allowed as - harmless no-ops. For instance RemoveHead is legal on an empty - list and it returns NULL. This allows an atomic way to test if - there is an element there, and if so, get it. The two operations - AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper). - - Single element operations return POSITIONs, non-NULL means it worked. - whole list operations return a BOOL. TRUE means it all worked. - - This definition is the same as the POSITION type for MFCs, so we must - avoid defining it twice. - */ -#ifndef __AFX_H__ -struct __POSITION { int unused; }; -typedef __POSITION* POSITION; -#endif - -const int DEFAULTCACHE = 10; /* Default node object cache size */ - -/* A class representing one node in a list. - Each node knows a pointer to it's adjacent nodes and also a pointer - to the object that it looks after. - All of these pointers can be retrieved or set through member functions. -*/ -class CBaseList -#ifdef DEBUG - : public CBaseObject -#endif -{ - /* Making these classes inherit from CBaseObject does nothing - functionally but it allows us to check there are no memory - leaks in debug builds. - */ - -public: - -#ifdef DEBUG - class CNode : public CBaseObject { -#else - class CNode { -#endif - - CNode *m_pPrev; /* Previous node in the list */ - CNode *m_pNext; /* Next node in the list */ - void *m_pObject; /* Pointer to the object */ - - public: - - /* Constructor - initialise the object's pointers */ - CNode() -#ifdef DEBUG - : CBaseObject(NAME("List node")) -#endif - { - }; - - - /* Return the previous node before this one */ - CNode *Prev() const { return m_pPrev; }; - - - /* Return the next node after this one */ - CNode *Next() const { return m_pNext; }; - - - /* Set the previous node before this one */ - void SetPrev(CNode *p) { m_pPrev = p; }; - - - /* Set the next node after this one */ - void SetNext(CNode *p) { m_pNext = p; }; - - - /* Get the pointer to the object for this node */ - void *GetData() const { return m_pObject; }; - - - /* Set the pointer to the object for this node */ - void SetData(void *p) { m_pObject = p; }; - }; - - class CNodeCache - { - public: - CNodeCache(INT iCacheSize) : m_iCacheSize(iCacheSize), - m_pHead(NULL), - m_iUsed(0) - {}; - ~CNodeCache() { - CNode *pNode = m_pHead; - while (pNode) { - CNode *pCurrent = pNode; - pNode = pNode->Next(); - delete pCurrent; - } - }; - void AddToCache(CNode *pNode) - { - if (m_iUsed < m_iCacheSize) { - pNode->SetNext(m_pHead); - m_pHead = pNode; - m_iUsed++; - } else { - delete pNode; - } - }; - CNode *RemoveFromCache() - { - CNode *pNode = m_pHead; - if (pNode != NULL) { - m_pHead = pNode->Next(); - m_iUsed--; - ASSERT(m_iUsed >= 0); - } else { - ASSERT(m_iUsed == 0); - } - return pNode; - }; - private: - INT m_iCacheSize; - INT m_iUsed; - CNode *m_pHead; - }; - -protected: - - CNode* m_pFirst; /* Pointer to first node in the list */ - CNode* m_pLast; /* Pointer to the last node in the list */ - LONG m_Count; /* Number of nodes currently in the list */ - -private: - - CNodeCache m_Cache; /* Cache of unused node pointers */ - -private: - - /* These override the default copy constructor and assignment - operator for all list classes. They are in the private class - declaration section so that anybody trying to pass a list - object by value will generate a compile time error of - "cannot access the private member function". If these were - not here then the compiler will create default constructors - and assignment operators which when executed first take a - copy of all member variables and then during destruction - delete them all. This must not be done for any heap - allocated data. - */ - CBaseList(const CBaseList &refList); - CBaseList &operator=(const CBaseList &refList); - -public: - - CBaseList(TCHAR *pName, - INT iItems); - - CBaseList(TCHAR *pName); -#ifdef UNICODE - CBaseList(CHAR *pName, - INT iItems); - - CBaseList(CHAR *pName); -#endif - ~CBaseList(); - - /* Remove all the nodes from *this i.e. make the list empty */ - void RemoveAll(); - - - /* Return a cursor which identifies the first element of *this */ - POSITION GetHeadPositionI() const; - - - /* Return a cursor which identifies the last element of *this */ - POSITION GetTailPositionI() const; - - - /* Return the number of objects in *this */ - int GetCountI() const; - -protected: - /* Return the pointer to the object at rp, - Update rp to the next node in *this - but make it NULL if it was at the end of *this. - This is a wart retained for backwards compatibility. - GetPrev is not implemented. - Use Next, Prev and Get separately. - */ - void *GetNextI(POSITION& rp) const; - - - /* Return a pointer to the object at p - Asking for the object at NULL will return NULL harmlessly. - */ - void *GetI(POSITION p) const; - -public: - /* return the next / prev position in *this - return NULL when going past the end/start. - Next(NULL) is same as GetHeadPosition() - Prev(NULL) is same as GetTailPosition() - An n element list therefore behaves like a n+1 element - cycle with NULL at the start/end. - - !!WARNING!! - This handling of NULL is DIFFERENT from GetNext. - - Some reasons are: - 1. For a list of n items there are n+1 positions to insert - These are conveniently encoded as the n POSITIONs and NULL. - 2. If you are keeping a list sorted (fairly common) and you - search forward for an element to insert before and don't - find it you finish up with NULL as the element before which - to insert. You then want that NULL to be a valid POSITION - so that you can insert before it and you want that insertion - point to mean the (n+1)-th one that doesn't have a POSITION. - (symmetrically if you are working backwards through the list). - 3. It simplifies the algebra which the methods generate. - e.g. AddBefore(p,x) is identical to AddAfter(Prev(p),x) - in ALL cases. All the other arguments probably are reflections - of the algebraic point. - */ - POSITION Next(POSITION pos) const - { - if (pos == NULL) { - return (POSITION) m_pFirst; - } - CNode *pn = (CNode *) pos; - return (POSITION) pn->Next(); - } //Next - - // See Next - POSITION Prev(POSITION pos) const - { - if (pos == NULL) { - return (POSITION) m_pLast; - } - CNode *pn = (CNode *) pos; - return (POSITION) pn->Prev(); - } //Prev - - - /* Return the first position in *this which holds the given - pointer. Return NULL if the pointer was not not found. - */ -protected: - POSITION FindI( void * pObj) const; - - // ??? Should there be (or even should there be only) - // ??? POSITION FindNextAfter(void * pObj, POSITION p) - // ??? And of course FindPrevBefore too. - // ??? List.Find(&Obj) then becomes List.FindNextAfter(&Obj, NULL) - - - /* Remove the first node in *this (deletes the pointer to its - object from the list, does not free the object itself). - Return the pointer to its object. - If *this was already empty it will harmlessly return NULL. - */ - void *RemoveHeadI(); - - - /* Remove the last node in *this (deletes the pointer to its - object from the list, does not free the object itself). - Return the pointer to its object. - If *this was already empty it will harmlessly return NULL. - */ - void *RemoveTailI(); - - - /* Remove the node identified by p from the list (deletes the pointer - to its object from the list, does not free the object itself). - Asking to Remove the object at NULL will harmlessly return NULL. - Return the pointer to the object removed. - */ - void *RemoveI(POSITION p); - - /* Add single object *pObj to become a new last element of the list. - Return the new tail position, NULL if it fails. - If you are adding a COM objects, you might want AddRef it first. - Other existing POSITIONs in *this are still valid - */ - POSITION AddTailI(void * pObj); -public: - - - /* Add all the elements in *pList to the tail of *this. - This duplicates all the nodes in *pList (i.e. duplicates - all its pointers to objects). It does not duplicate the objects. - If you are adding a list of pointers to a COM object into the list - it's a good idea to AddRef them all it when you AddTail it. - Return TRUE if it all worked, FALSE if it didn't. - If it fails some elements may have been added. - Existing POSITIONs in *this are still valid - - If you actually want to MOVE the elements, use MoveToTail instead. - */ - BOOL AddTail(CBaseList *pList); - - - /* Mirror images of AddHead: */ - - /* Add single object to become a new first element of the list. - Return the new head position, NULL if it fails. - Existing POSITIONs in *this are still valid - */ -protected: - POSITION AddHeadI(void * pObj); -public: - - /* Add all the elements in *pList to the head of *this. - Same warnings apply as for AddTail. - Return TRUE if it all worked, FALSE if it didn't. - If it fails some of the objects may have been added. - - If you actually want to MOVE the elements, use MoveToHead instead. - */ - BOOL AddHead(CBaseList *pList); - - - /* Add the object *pObj to *this after position p in *this. - AddAfter(NULL,x) adds x to the start - equivalent to AddHead - Return the position of the object added, NULL if it failed. - Existing POSITIONs in *this are undisturbed, including p. - */ -protected: - POSITION AddAfterI(POSITION p, void * pObj); -public: - - /* Add the list *pList to *this after position p in *this - AddAfter(NULL,x) adds x to the start - equivalent to AddHead - Return TRUE if it all worked, FALSE if it didn't. - If it fails, some of the objects may be added - Existing POSITIONs in *this are undisturbed, including p. - */ - BOOL AddAfter(POSITION p, CBaseList *pList); - - - /* Mirror images: - Add the object *pObj to this-List after position p in *this. - AddBefore(NULL,x) adds x to the end - equivalent to AddTail - Return the position of the new object, NULL if it fails - Existing POSITIONs in *this are undisturbed, including p. - */ - protected: - POSITION AddBeforeI(POSITION p, void * pObj); - public: - - /* Add the list *pList to *this before position p in *this - AddAfter(NULL,x) adds x to the start - equivalent to AddHead - Return TRUE if it all worked, FALSE if it didn't. - If it fails, some of the objects may be added - Existing POSITIONs in *this are undisturbed, including p. - */ - BOOL AddBefore(POSITION p, CBaseList *pList); - - - /* Note that AddAfter(p,x) is equivalent to AddBefore(Next(p),x) - even in cases where p is NULL or Next(p) is NULL. - Similarly for mirror images etc. - This may make it easier to argue about programs. - */ - - - - /* The following operations do not copy any elements. - They move existing blocks of elements around by switching pointers. - They are fairly efficient for long lists as for short lists. - (Alas, the Count slows things down). - - They split the list into two parts. - One part remains as the original list, the other part - is appended to the second list. There are eight possible - variations: - Split the list {after/before} a given element - keep the {head/tail} portion in the original list - append the rest to the {head/tail} of the new list. - - Since After is strictly equivalent to Before Next - we are not in serious need of the Before/After variants. - That leaves only four. - - If you are processing a list left to right and dumping - the bits that you have processed into another list as - you go, the Tail/Tail variant gives the most natural result. - If you are processing in reverse order, Head/Head is best. - - By using NULL positions and empty lists judiciously either - of the other two can be built up in two operations. - - The definition of NULL (see Next/Prev etc) means that - degenerate cases include - "move all elements to new list" - "Split a list into two lists" - "Concatenate two lists" - (and quite a few no-ops) - - !!WARNING!! The type checking won't buy you much if you get list - positions muddled up - e.g. use a POSITION that's in a different - list and see what a mess you get! - */ - - /* Split *this after position p in *this - Retain as *this the tail portion of the original *this - Add the head portion to the tail end of *pList - Return TRUE if it all worked, FALSE if it didn't. - - e.g. - foo->MoveToTail(foo->GetHeadPosition(), bar); - moves one element from the head of foo to the tail of bar - foo->MoveToTail(NULL, bar); - is a no-op, returns NULL - foo->MoveToTail(foo->GetTailPosition, bar); - concatenates foo onto the end of bar and empties foo. - - A better, except excessively long name might be - MoveElementsFromHeadThroughPositionToOtherTail - */ - BOOL MoveToTail(POSITION pos, CBaseList *pList); - - - /* Mirror image: - Split *this before position p in *this. - Retain in *this the head portion of the original *this - Add the tail portion to the start (i.e. head) of *pList - - e.g. - foo->MoveToHead(foo->GetTailPosition(), bar); - moves one element from the tail of foo to the head of bar - foo->MoveToHead(NULL, bar); - is a no-op, returns NULL - foo->MoveToHead(foo->GetHeadPosition, bar); - concatenates foo onto the start of bar and empties foo. - */ - BOOL MoveToHead(POSITION pos, CBaseList *pList); - - - /* Reverse the order of the [pointers to] objects in *this - */ - void Reverse(); - - - /* set cursor to the position of each element of list in turn */ - #define TRAVERSELIST(list, cursor) \ - for ( cursor = (list).GetHeadPosition() \ - ; cursor!=NULL \ - ; cursor = (list).Next(cursor) \ - ) - - - /* set cursor to the position of each element of list in turn - in reverse order - */ - #define REVERSETRAVERSELIST(list, cursor) \ - for ( cursor = (list).GetTailPosition() \ - ; cursor!=NULL \ - ; cursor = (list).Prev(cursor) \ - ) - -}; // end of class declaration - -template class CGenericList : public CBaseList -{ -public: - CGenericList(TCHAR *pName, - INT iItems, - BOOL bLock = TRUE, - BOOL bAlert = FALSE) : - CBaseList(pName, iItems) { - UNREFERENCED_PARAMETER(bAlert); - UNREFERENCED_PARAMETER(bLock); - }; - CGenericList(TCHAR *pName) : - CBaseList(pName) { - }; - - POSITION GetHeadPosition() const { return (POSITION)m_pFirst; } - POSITION GetTailPosition() const { return (POSITION)m_pLast; } - int GetCount() const { return m_Count; } - - OBJECT *GetNext(POSITION& rp) const { return (OBJECT *) GetNextI(rp); } - - OBJECT *Get(POSITION p) const { return (OBJECT *) GetI(p); } - OBJECT *GetHead() const { return Get(GetHeadPosition()); } - - OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); } - - OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); } - - OBJECT *Remove(POSITION p) { return (OBJECT *) RemoveI(p); } - POSITION AddBefore(POSITION p, OBJECT * pObj) { return AddBeforeI(p, pObj); } - POSITION AddAfter(POSITION p, OBJECT * pObj) { return AddAfterI(p, pObj); } - POSITION AddHead(OBJECT * pObj) { return AddHeadI(pObj); } - POSITION AddTail(OBJECT * pObj) { return AddTailI(pObj); } - BOOL AddTail(CGenericList *pList) - { return CBaseList::AddTail((CBaseList *) pList); } - BOOL AddHead(CGenericList *pList) - { return CBaseList::AddHead((CBaseList *) pList); } - BOOL AddAfter(POSITION p, CGenericList *pList) - { return CBaseList::AddAfter(p, (CBaseList *) pList); }; - BOOL AddBefore(POSITION p, CGenericList *pList) - { return CBaseList::AddBefore(p, (CBaseList *) pList); }; - POSITION Find( OBJECT * pObj) const { return FindI(pObj); } -}; // end of class declaration - - - -/* These define the standard list types */ - -typedef CGenericList CBaseObjectList; -typedef CGenericList CBaseInterfaceList; - -#endif /* __WXLIST__ */ - +//------------------------------------------------------------------------------ +// File: WXList.h +// +// Desc: DirectShow base classes - defines a non-MFC generic template list +// class. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +/* A generic list of pointers to objects. + No storage management or copying is done on the objects pointed to. + Objectives: avoid using MFC libraries in ndm kernel mode and + provide a really useful list type. + + The class is thread safe in that separate threads may add and + delete items in the list concurrently although the application + must ensure that constructor and destructor access is suitably + synchronised. An application can cause deadlock with operations + which use two lists by simultaneously calling + list1->Operation(list2) and list2->Operation(list1). So don't! + + The names must not conflict with MFC classes as an application + may use both. + */ + +#ifndef __WXLIST__ +#define __WXLIST__ + + /* A POSITION represents (in some fashion that's opaque) a cursor + on the list that can be set to identify any element. NULL is + a valid value and several operations regard NULL as the position + "one step off the end of the list". (In an n element list there + are n+1 places to insert and NULL is that "n+1-th" value). + The POSITION of an element in the list is only invalidated if + that element is deleted. Move operations may mean that what + was a valid POSITION in one list is now a valid POSITION in + a different list. + + Some operations which at first sight are illegal are allowed as + harmless no-ops. For instance RemoveHead is legal on an empty + list and it returns NULL. This allows an atomic way to test if + there is an element there, and if so, get it. The two operations + AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper). + + Single element operations return POSITIONs, non-NULL means it worked. + whole list operations return a BOOL. TRUE means it all worked. + + This definition is the same as the POSITION type for MFCs, so we must + avoid defining it twice. + */ +#ifndef __AFX_H__ +struct __POSITION { int unused; }; +typedef __POSITION* POSITION; +#endif + +const int DEFAULTCACHE = 10; /* Default node object cache size */ + +/* A class representing one node in a list. + Each node knows a pointer to it's adjacent nodes and also a pointer + to the object that it looks after. + All of these pointers can be retrieved or set through member functions. +*/ +class CBaseList +#ifdef DEBUG + : public CBaseObject +#endif +{ + /* Making these classes inherit from CBaseObject does nothing + functionally but it allows us to check there are no memory + leaks in debug builds. + */ + +public: + +#ifdef DEBUG + class CNode : public CBaseObject { +#else + class CNode { +#endif + + CNode *m_pPrev; /* Previous node in the list */ + CNode *m_pNext; /* Next node in the list */ + void *m_pObject; /* Pointer to the object */ + + public: + + /* Constructor - initialise the object's pointers */ + CNode() +#ifdef DEBUG + : CBaseObject(NAME("List node")) +#endif + { + }; + + + /* Return the previous node before this one */ + CNode *Prev() const { return m_pPrev; }; + + + /* Return the next node after this one */ + CNode *Next() const { return m_pNext; }; + + + /* Set the previous node before this one */ + void SetPrev(CNode *p) { m_pPrev = p; }; + + + /* Set the next node after this one */ + void SetNext(CNode *p) { m_pNext = p; }; + + + /* Get the pointer to the object for this node */ + void *GetData() const { return m_pObject; }; + + + /* Set the pointer to the object for this node */ + void SetData(void *p) { m_pObject = p; }; + }; + + class CNodeCache + { + public: + CNodeCache(INT iCacheSize) : m_iCacheSize(iCacheSize), + m_pHead(NULL), + m_iUsed(0) + {}; + ~CNodeCache() { + CNode *pNode = m_pHead; + while (pNode) { + CNode *pCurrent = pNode; + pNode = pNode->Next(); + delete pCurrent; + } + }; + void AddToCache(CNode *pNode) + { + if (m_iUsed < m_iCacheSize) { + pNode->SetNext(m_pHead); + m_pHead = pNode; + m_iUsed++; + } else { + delete pNode; + } + }; + CNode *RemoveFromCache() + { + CNode *pNode = m_pHead; + if (pNode != NULL) { + m_pHead = pNode->Next(); + m_iUsed--; + ASSERT(m_iUsed >= 0); + } else { + ASSERT(m_iUsed == 0); + } + return pNode; + }; + private: + INT m_iCacheSize; + INT m_iUsed; + CNode *m_pHead; + }; + +protected: + + CNode* m_pFirst; /* Pointer to first node in the list */ + CNode* m_pLast; /* Pointer to the last node in the list */ + LONG m_Count; /* Number of nodes currently in the list */ + +private: + + CNodeCache m_Cache; /* Cache of unused node pointers */ + +private: + + /* These override the default copy constructor and assignment + operator for all list classes. They are in the private class + declaration section so that anybody trying to pass a list + object by value will generate a compile time error of + "cannot access the private member function". If these were + not here then the compiler will create default constructors + and assignment operators which when executed first take a + copy of all member variables and then during destruction + delete them all. This must not be done for any heap + allocated data. + */ + CBaseList(const CBaseList &refList); + CBaseList &operator=(const CBaseList &refList); + +public: + + CBaseList(TCHAR *pName, + INT iItems); + + CBaseList(TCHAR *pName); +#ifdef UNICODE + CBaseList(CHAR *pName, + INT iItems); + + CBaseList(CHAR *pName); +#endif + ~CBaseList(); + + /* Remove all the nodes from *this i.e. make the list empty */ + void RemoveAll(); + + + /* Return a cursor which identifies the first element of *this */ + POSITION GetHeadPositionI() const; + + + /* Return a cursor which identifies the last element of *this */ + POSITION GetTailPositionI() const; + + + /* Return the number of objects in *this */ + int GetCountI() const; + +protected: + /* Return the pointer to the object at rp, + Update rp to the next node in *this + but make it NULL if it was at the end of *this. + This is a wart retained for backwards compatibility. + GetPrev is not implemented. + Use Next, Prev and Get separately. + */ + void *GetNextI(POSITION& rp) const; + + + /* Return a pointer to the object at p + Asking for the object at NULL will return NULL harmlessly. + */ + void *GetI(POSITION p) const; + +public: + /* return the next / prev position in *this + return NULL when going past the end/start. + Next(NULL) is same as GetHeadPosition() + Prev(NULL) is same as GetTailPosition() + An n element list therefore behaves like a n+1 element + cycle with NULL at the start/end. + + !!WARNING!! - This handling of NULL is DIFFERENT from GetNext. + + Some reasons are: + 1. For a list of n items there are n+1 positions to insert + These are conveniently encoded as the n POSITIONs and NULL. + 2. If you are keeping a list sorted (fairly common) and you + search forward for an element to insert before and don't + find it you finish up with NULL as the element before which + to insert. You then want that NULL to be a valid POSITION + so that you can insert before it and you want that insertion + point to mean the (n+1)-th one that doesn't have a POSITION. + (symmetrically if you are working backwards through the list). + 3. It simplifies the algebra which the methods generate. + e.g. AddBefore(p,x) is identical to AddAfter(Prev(p),x) + in ALL cases. All the other arguments probably are reflections + of the algebraic point. + */ + POSITION Next(POSITION pos) const + { + if (pos == NULL) { + return (POSITION) m_pFirst; + } + CNode *pn = (CNode *) pos; + return (POSITION) pn->Next(); + } //Next + + // See Next + POSITION Prev(POSITION pos) const + { + if (pos == NULL) { + return (POSITION) m_pLast; + } + CNode *pn = (CNode *) pos; + return (POSITION) pn->Prev(); + } //Prev + + + /* Return the first position in *this which holds the given + pointer. Return NULL if the pointer was not not found. + */ +protected: + POSITION FindI( void * pObj) const; + + // ??? Should there be (or even should there be only) + // ??? POSITION FindNextAfter(void * pObj, POSITION p) + // ??? And of course FindPrevBefore too. + // ??? List.Find(&Obj) then becomes List.FindNextAfter(&Obj, NULL) + + + /* Remove the first node in *this (deletes the pointer to its + object from the list, does not free the object itself). + Return the pointer to its object. + If *this was already empty it will harmlessly return NULL. + */ + void *RemoveHeadI(); + + + /* Remove the last node in *this (deletes the pointer to its + object from the list, does not free the object itself). + Return the pointer to its object. + If *this was already empty it will harmlessly return NULL. + */ + void *RemoveTailI(); + + + /* Remove the node identified by p from the list (deletes the pointer + to its object from the list, does not free the object itself). + Asking to Remove the object at NULL will harmlessly return NULL. + Return the pointer to the object removed. + */ + void *RemoveI(POSITION p); + + /* Add single object *pObj to become a new last element of the list. + Return the new tail position, NULL if it fails. + If you are adding a COM objects, you might want AddRef it first. + Other existing POSITIONs in *this are still valid + */ + POSITION AddTailI(void * pObj); +public: + + + /* Add all the elements in *pList to the tail of *this. + This duplicates all the nodes in *pList (i.e. duplicates + all its pointers to objects). It does not duplicate the objects. + If you are adding a list of pointers to a COM object into the list + it's a good idea to AddRef them all it when you AddTail it. + Return TRUE if it all worked, FALSE if it didn't. + If it fails some elements may have been added. + Existing POSITIONs in *this are still valid + + If you actually want to MOVE the elements, use MoveToTail instead. + */ + BOOL AddTail(CBaseList *pList); + + + /* Mirror images of AddHead: */ + + /* Add single object to become a new first element of the list. + Return the new head position, NULL if it fails. + Existing POSITIONs in *this are still valid + */ +protected: + POSITION AddHeadI(void * pObj); +public: + + /* Add all the elements in *pList to the head of *this. + Same warnings apply as for AddTail. + Return TRUE if it all worked, FALSE if it didn't. + If it fails some of the objects may have been added. + + If you actually want to MOVE the elements, use MoveToHead instead. + */ + BOOL AddHead(CBaseList *pList); + + + /* Add the object *pObj to *this after position p in *this. + AddAfter(NULL,x) adds x to the start - equivalent to AddHead + Return the position of the object added, NULL if it failed. + Existing POSITIONs in *this are undisturbed, including p. + */ +protected: + POSITION AddAfterI(POSITION p, void * pObj); +public: + + /* Add the list *pList to *this after position p in *this + AddAfter(NULL,x) adds x to the start - equivalent to AddHead + Return TRUE if it all worked, FALSE if it didn't. + If it fails, some of the objects may be added + Existing POSITIONs in *this are undisturbed, including p. + */ + BOOL AddAfter(POSITION p, CBaseList *pList); + + + /* Mirror images: + Add the object *pObj to this-List after position p in *this. + AddBefore(NULL,x) adds x to the end - equivalent to AddTail + Return the position of the new object, NULL if it fails + Existing POSITIONs in *this are undisturbed, including p. + */ + protected: + POSITION AddBeforeI(POSITION p, void * pObj); + public: + + /* Add the list *pList to *this before position p in *this + AddAfter(NULL,x) adds x to the start - equivalent to AddHead + Return TRUE if it all worked, FALSE if it didn't. + If it fails, some of the objects may be added + Existing POSITIONs in *this are undisturbed, including p. + */ + BOOL AddBefore(POSITION p, CBaseList *pList); + + + /* Note that AddAfter(p,x) is equivalent to AddBefore(Next(p),x) + even in cases where p is NULL or Next(p) is NULL. + Similarly for mirror images etc. + This may make it easier to argue about programs. + */ + + + + /* The following operations do not copy any elements. + They move existing blocks of elements around by switching pointers. + They are fairly efficient for long lists as for short lists. + (Alas, the Count slows things down). + + They split the list into two parts. + One part remains as the original list, the other part + is appended to the second list. There are eight possible + variations: + Split the list {after/before} a given element + keep the {head/tail} portion in the original list + append the rest to the {head/tail} of the new list. + + Since After is strictly equivalent to Before Next + we are not in serious need of the Before/After variants. + That leaves only four. + + If you are processing a list left to right and dumping + the bits that you have processed into another list as + you go, the Tail/Tail variant gives the most natural result. + If you are processing in reverse order, Head/Head is best. + + By using NULL positions and empty lists judiciously either + of the other two can be built up in two operations. + + The definition of NULL (see Next/Prev etc) means that + degenerate cases include + "move all elements to new list" + "Split a list into two lists" + "Concatenate two lists" + (and quite a few no-ops) + + !!WARNING!! The type checking won't buy you much if you get list + positions muddled up - e.g. use a POSITION that's in a different + list and see what a mess you get! + */ + + /* Split *this after position p in *this + Retain as *this the tail portion of the original *this + Add the head portion to the tail end of *pList + Return TRUE if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToTail(foo->GetHeadPosition(), bar); + moves one element from the head of foo to the tail of bar + foo->MoveToTail(NULL, bar); + is a no-op, returns NULL + foo->MoveToTail(foo->GetTailPosition, bar); + concatenates foo onto the end of bar and empties foo. + + A better, except excessively long name might be + MoveElementsFromHeadThroughPositionToOtherTail + */ + BOOL MoveToTail(POSITION pos, CBaseList *pList); + + + /* Mirror image: + Split *this before position p in *this. + Retain in *this the head portion of the original *this + Add the tail portion to the start (i.e. head) of *pList + + e.g. + foo->MoveToHead(foo->GetTailPosition(), bar); + moves one element from the tail of foo to the head of bar + foo->MoveToHead(NULL, bar); + is a no-op, returns NULL + foo->MoveToHead(foo->GetHeadPosition, bar); + concatenates foo onto the start of bar and empties foo. + */ + BOOL MoveToHead(POSITION pos, CBaseList *pList); + + + /* Reverse the order of the [pointers to] objects in *this + */ + void Reverse(); + + + /* set cursor to the position of each element of list in turn */ + #define TRAVERSELIST(list, cursor) \ + for ( cursor = (list).GetHeadPosition() \ + ; cursor!=NULL \ + ; cursor = (list).Next(cursor) \ + ) + + + /* set cursor to the position of each element of list in turn + in reverse order + */ + #define REVERSETRAVERSELIST(list, cursor) \ + for ( cursor = (list).GetTailPosition() \ + ; cursor!=NULL \ + ; cursor = (list).Prev(cursor) \ + ) + +}; // end of class declaration + +template class CGenericList : public CBaseList +{ +public: + CGenericList(TCHAR *pName, + INT iItems, + BOOL bLock = TRUE, + BOOL bAlert = FALSE) : + CBaseList(pName, iItems) { + UNREFERENCED_PARAMETER(bAlert); + UNREFERENCED_PARAMETER(bLock); + }; + CGenericList(TCHAR *pName) : + CBaseList(pName) { + }; + + POSITION GetHeadPosition() const { return (POSITION)m_pFirst; } + POSITION GetTailPosition() const { return (POSITION)m_pLast; } + int GetCount() const { return m_Count; } + + OBJECT *GetNext(POSITION& rp) const { return (OBJECT *) GetNextI(rp); } + + OBJECT *Get(POSITION p) const { return (OBJECT *) GetI(p); } + OBJECT *GetHead() const { return Get(GetHeadPosition()); } + + OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); } + + OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); } + + OBJECT *Remove(POSITION p) { return (OBJECT *) RemoveI(p); } + POSITION AddBefore(POSITION p, OBJECT * pObj) { return AddBeforeI(p, pObj); } + POSITION AddAfter(POSITION p, OBJECT * pObj) { return AddAfterI(p, pObj); } + POSITION AddHead(OBJECT * pObj) { return AddHeadI(pObj); } + POSITION AddTail(OBJECT * pObj) { return AddTailI(pObj); } + BOOL AddTail(CGenericList *pList) + { return CBaseList::AddTail((CBaseList *) pList); } + BOOL AddHead(CGenericList *pList) + { return CBaseList::AddHead((CBaseList *) pList); } + BOOL AddAfter(POSITION p, CGenericList *pList) + { return CBaseList::AddAfter(p, (CBaseList *) pList); }; + BOOL AddBefore(POSITION p, CGenericList *pList) + { return CBaseList::AddBefore(p, (CBaseList *) pList); }; + POSITION Find( OBJECT * pObj) const { return FindI(pObj); } +}; // end of class declaration + + + +/* These define the standard list types */ + +typedef CGenericList CBaseObjectList; +typedef CGenericList CBaseInterfaceList; + +#endif /* __WXLIST__ */ + diff --git a/src/BaseClasses/wxutil.cpp b/src/BaseClasses/wxutil.cpp index f38c5f5781..065d84e346 100644 --- a/src/BaseClasses/wxutil.cpp +++ b/src/BaseClasses/wxutil.cpp @@ -1,1210 +1,1210 @@ -//------------------------------------------------------------------------------ -// File: WXUtil.cpp -// -// Desc: DirectShow base classes - implements helper classes for building -// multimedia filters. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ -#include -#include - -// -// Declare function from largeint.h we need so that PPC can build -// - -// -// Enlarged integer divide - 64-bits / 32-bits > 32-bits -// - -#ifndef _X86_ - -#define LLtoU64(x) (*(unsigned __int64*)(void*)(&(x))) - -__inline -ULONG -WINAPI -EnlargedUnsignedDivide( - IN ULARGE_INTEGER Dividend, - IN ULONG Divisor, - IN PULONG Remainder - ) { - // return remainder if necessary - if(Remainder != NULL) - *Remainder = (ULONG)(LLtoU64(Dividend) % Divisor); - return (ULONG)(LLtoU64(Dividend) / Divisor); -} - -#else -__inline -ULONG -WINAPI -EnlargedUnsignedDivide( - IN ULARGE_INTEGER Dividend, - IN ULONG Divisor, - IN PULONG Remainder - ) { - ULONG ulResult; - _asm { - mov eax,Dividend.LowPart - mov edx,Dividend.HighPart - mov ecx,Remainder - div Divisor - or ecx,ecx - jz short label - mov [ecx],edx - label: - mov ulResult,eax - } - return ulResult; -} -#endif - -// --- CAMEvent ----------------------- -CAMEvent::CAMEvent(BOOL fManualReset) { - m_hEvent = CreateEvent(NULL, fManualReset, FALSE, NULL); -} - -CAMEvent::~CAMEvent() { - if(m_hEvent) { - EXECUTE_ASSERT(CloseHandle(m_hEvent)); - } -} - - -// --- CAMMsgEvent ----------------------- -// One routine. The rest is handled in CAMEvent - -BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout) { - // wait for the event to be signalled, or for the - // timeout (in MS) to expire. allow SENT messages - // to be processed while we wait - DWORD dwWait; - DWORD dwStartTime=0; - - // set the waiting period. - DWORD dwWaitTime = dwTimeout; - - // the timeout will eventually run down as we iterate - // processing messages. grab the start time so that - // we can calculate elapsed times. - if(dwWaitTime != INFINITE) { - dwStartTime = timeGetTime(); - } - - do { - dwWait = MsgWaitForMultipleObjects(1,&m_hEvent,FALSE, dwWaitTime, QS_SENDMESSAGE); - if(dwWait == WAIT_OBJECT_0 + 1) { - MSG Message; - PeekMessage(&Message,NULL,0,0,PM_NOREMOVE); - - // If we have an explicit length of time to wait calculate - // the next wake up point - which might be now. - // If dwTimeout is INFINITE, it stays INFINITE - if(dwWaitTime != INFINITE) { - - DWORD dwElapsed = timeGetTime()-dwStartTime; - - dwWaitTime = - (dwElapsed >= dwTimeout) - ? 0 // wake up with WAIT_TIMEOUT - : dwTimeout-dwElapsed; - } - } - } while(dwWait == WAIT_OBJECT_0 + 1); - - // return TRUE if we woke on the event handle, - // FALSE if we timed out. - return (dwWait == WAIT_OBJECT_0); -} - -// --- CAMThread ---------------------- - - -CAMThread::CAMThread() - : m_EventSend(TRUE) // must be manual-reset for CheckRequest() -{ - m_hThread = NULL; -} - -CAMThread::~CAMThread() { - Close(); -} - - -// when the thread starts, it calls this function. We unwrap the 'this' -//pointer and call ThreadProc. -DWORD WINAPI -CAMThread::InitialThreadProc(LPVOID pv) { - HRESULT hrCoInit = CAMThread::CoInitializeHelper(); - if(FAILED(hrCoInit)) { - DbgLog((LOG_ERROR, 1, TEXT("CoInitializeEx failed."))); - } - - CAMThread * pThread = (CAMThread *) pv; - - HRESULT hr = pThread->ThreadProc(); - - if(SUCCEEDED(hrCoInit)) { - CoUninitialize(); - } - - return hr; -} - -BOOL -CAMThread::Create() { - DWORD threadid; - - CAutoLock lock(&m_AccessLock); - - if(ThreadExists()) { - return FALSE; - } - - m_hThread = CreateThread(NULL, - 0, - CAMThread::InitialThreadProc, - this, - 0, - &threadid); - - if(!m_hThread) { - return FALSE; - } - - return TRUE; -} - -DWORD -CAMThread::CallWorker(DWORD dwParam) { - // lock access to the worker thread for scope of this object - CAutoLock lock(&m_AccessLock); - - if(!ThreadExists()) { - return (DWORD) E_FAIL; - } - - // set the parameter - m_dwParam = dwParam; - - // signal the worker thread - m_EventSend.Set(); - - // wait for the completion to be signalled - m_EventComplete.Wait(); - - // done - this is the thread's return value - return m_dwReturnVal; -} - -// Wait for a request from the client -DWORD -CAMThread::GetRequest() { - m_EventSend.Wait(); - return m_dwParam; -} - -// is there a request? -BOOL -CAMThread::CheckRequest(DWORD * pParam) { - if(!m_EventSend.Check()) { - return FALSE; - } - else { - if(pParam) { - *pParam = m_dwParam; - } - return TRUE; - } -} - -// reply to the request -void -CAMThread::Reply(DWORD dw) { - m_dwReturnVal = dw; - - // The request is now complete so CheckRequest should fail from - // now on - // - // This event should be reset BEFORE we signal the client or - // the client may Set it before we reset it and we'll then - // reset it (!) - - m_EventSend.Reset(); - - // Tell the client we're finished - - m_EventComplete.Set(); -} - -HRESULT CAMThread::CoInitializeHelper() { - // call CoInitializeEx and tell OLE not to create a window (this - // thread probably won't dispatch messages and will hang on - // broadcast msgs o/w). - // - // If CoInitEx is not available, threads that don't call CoCreate - // aren't affected. Threads that do will have to handle the - // failure. Perhaps we should fall back to CoInitialize and risk - // hanging? - // - - // older versions of ole32.dll don't have CoInitializeEx - - HRESULT hr = E_FAIL; - HINSTANCE hOle = GetModuleHandle(TEXT("ole32.dll")); - if(hOle) { - typedef HRESULT(STDAPICALLTYPE *PCoInitializeEx)( - LPVOID pvReserved, DWORD dwCoInit); - PCoInitializeEx pCoInitializeEx = - (PCoInitializeEx)(GetProcAddress(hOle, "CoInitializeEx")); - if(pCoInitializeEx) { - hr = (*pCoInitializeEx)(0, 0x4 ); /*NABIL: Changed this to the constant, rather than the Variable...*/ - } - } - else { - // caller must load ole32.dll - DbgBreak("couldn't locate ole32.dll"); - } - - return hr; -} - - -// destructor for CMsgThread - cleans up any messages left in the -// queue when the thread exited -CMsgThread::~CMsgThread() { - if(m_hThread != NULL) { - WaitForSingleObject(m_hThread, INFINITE); - EXECUTE_ASSERT(CloseHandle(m_hThread)); - } - - POSITION pos = m_ThreadQueue.GetHeadPosition(); - while(pos) { - CMsg * pMsg = m_ThreadQueue.GetNext(pos); - delete pMsg; - } - m_ThreadQueue.RemoveAll(); - - if(m_hSem != NULL) { - EXECUTE_ASSERT(CloseHandle(m_hSem)); - } -} - -BOOL -CMsgThread::CreateThread( - ) { - m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); - if(m_hSem == NULL) { - return FALSE; - } - - m_hThread = ::CreateThread(NULL, 0, DefaultThreadProc, - (LPVOID)this, 0, &m_ThreadId); - return m_hThread != NULL; -} - - -// This is the threads message pump. Here we get and dispatch messages to -// clients thread proc until the client refuses to process a message. -// The client returns a non-zero value to stop the message pump, this -// value becomes the threads exit code. - -DWORD WINAPI -CMsgThread::DefaultThreadProc( - LPVOID lpParam - ) { - CMsgThread *lpThis = (CMsgThread *)lpParam; - CMsg msg; - LRESULT lResult; - - // !!! - CoInitialize(NULL); - - // allow a derived class to handle thread startup - lpThis->OnThreadInit(); - - do { - lpThis->GetThreadMsg(&msg); - lResult = lpThis->ThreadMessageProc(msg.uMsg,msg.dwFlags, - msg.lpParam, msg.pEvent); - } while(lResult == 0L); - - // !!! - CoUninitialize(); - - return (DWORD)lResult; -} - - -// Block until the next message is placed on the list m_ThreadQueue. -// copies the message to the message pointed to by *pmsg -void -CMsgThread::GetThreadMsg(CMsg *msg) { - CMsg * pmsg = NULL; - - // keep trying until a message appears - while(TRUE) { { - CAutoLock lck(&m_Lock); - pmsg = m_ThreadQueue.RemoveHead(); - if(pmsg == NULL) { - m_lWaiting++; - } - else { - break; - } - } - // the semaphore will be signalled when it is non-empty - WaitForSingleObject(m_hSem, INFINITE); - } - // copy fields to caller's CMsg - *msg = *pmsg; - - // this CMsg was allocated by the 'new' in PutThreadMsg - delete pmsg; - -} - - -// NOTE: as we need to use the same binaries on Win95 as on NT this code should -// be compiled WITHOUT unicode being defined. Otherwise we will not pick up -// these internal routines and the binary will not run on Win95. - -#ifndef UNICODE - -#pragma warning(disable:4706) // C4706: assignment within conditional expression - -// Windows 95 doesn't implement this, so we provide an implementation. -LPWSTR -WINAPI -lstrcpyWInternal( - LPWSTR lpString1, - LPCWSTR lpString2 - ) { - LPWSTR lpReturn = lpString1; - while(*lpString1++ = *lpString2++); - - return lpReturn; -} - -// Windows 95 doesn't implement this, so we provide an implementation. -LPWSTR -WINAPI -lstrcpynWInternal( - LPWSTR lpString1, - LPCWSTR lpString2, - int iMaxLength - ) { - ASSERT(iMaxLength); - LPWSTR lpReturn = lpString1; - if(iMaxLength) { - while(--iMaxLength && (*lpString1++ = *lpString2++)); - - // If we ran out of room (which will be the case if - // iMaxLength is now 0) we still need to terminate the - // string. - if(!iMaxLength) *lpString1 = L'\0'; - } - return lpReturn; -} - -#pragma warning(default:4706) // C4706: assignment within conditional expression - -int -WINAPI -lstrcmpWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ) { - do { - WCHAR c1 = *lpString1; - WCHAR c2 = *lpString2; - if(c1 != c2) - return (int) c1 - (int) c2; - } while(*lpString1++ && *lpString2++); - return 0; -} - - -int -WINAPI -lstrcmpiWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ) { - do { - WCHAR c1 = *lpString1; - WCHAR c2 = *lpString2; - if(c1 >= L'A' && c1 <= L'Z') - c1 -= (WCHAR) (L'A' - L'a'); - if(c2 >= L'A' && c2 <= L'Z') - c2 -= (WCHAR) (L'A' - L'a'); - - if(c1 != c2) - return (int) c1 - (int) c2; - } while(*lpString1++ && *lpString2++); - - return 0; -} - - -int -WINAPI -lstrlenWInternal( - LPCWSTR lpString - ) { - int i = -1; - while(*(lpString+(++i))) - ; - return i; -} - - -int WINAPIV wsprintfWInternal(LPWSTR wszOut, LPCWSTR pszFmt, ...) { - char fmt[256]; // !!! - char ach[256]; // !!! - int i; - - va_list va; - va_start(va, pszFmt); - WideCharToMultiByte(GetACP(), 0, pszFmt, -1, fmt, 256, NULL, NULL); - i = wvsprintfA(ach, fmt, va); - va_end(va); - - MultiByteToWideChar(CP_ACP, 0, ach, -1, wszOut, i+1); - - return i; -} -#else - -// need to provide the implementations in unicode for non-unicode -// builds linking with the unicode strmbase.lib -LPWSTR WINAPI lstrcpyWInternal( - LPWSTR lpString1, - LPCWSTR lpString2 - ) { - return lstrcpyW(lpString1, lpString2); -} - -LPWSTR WINAPI lstrcpynWInternal( - LPWSTR lpString1, - LPCWSTR lpString2, - int iMaxLength - ) { - return lstrcpynW(lpString1, lpString2, iMaxLength); -} - -int WINAPI lstrcmpWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ) { - return lstrcmpW(lpString1, lpString2); -} - - -int WINAPI lstrcmpiWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ) { - return lstrcmpiW(lpString1, lpString2); -} - - -int WINAPI lstrlenWInternal( - LPCWSTR lpString - ) { - return lstrlenW(lpString); -} - - -int WINAPIV wsprintfWInternal( - LPWSTR wszOut, LPCWSTR pszFmt, ...) { - va_list va; - va_start(va, pszFmt); - int i = wvsprintfW(wszOut, pszFmt, va); - va_end(va); - return i; -} -#endif - - -// Helper function - convert int to WSTR -void WINAPI IntToWstr(int i, LPWSTR wstr) { -#ifdef UNICODE - wsprintf(wstr, L"%d", i); -#else - TCHAR temp[32]; - wsprintf(temp, "%d", i); - MultiByteToWideChar(CP_ACP, 0, temp, -1, wstr, 32); -#endif -} // IntToWstr - - -#if 0 -void * memchrInternal(const void *pv, int c, size_t sz) { - BYTE *pb = (BYTE *) pv; - while(sz--) { - if(*pb == c) - return (void *) pb; - pb++; - } - return NULL; -} -#endif - - -#define MEMORY_ALIGNMENT 4 -#define MEMORY_ALIGNMENT_LOG2 2 -#define MEMORY_ALIGNMENT_MASK MEMORY_ALIGNMENT - 1 - -void * __stdcall memmoveInternal(void * dst, const void * src, size_t count) { - void * ret = dst; - -#ifdef _X86_ - if(dst <= src || (char *)dst >= ((char *)src + count)) { - - /* - * Non-Overlapping Buffers - * copy from lower addresses to higher addresses - */ - _asm { - mov esi,src - mov edi,dst - mov ecx,count - cld - mov edx,ecx - and edx,MEMORY_ALIGNMENT_MASK - shr ecx,MEMORY_ALIGNMENT_LOG2 - rep movsd - or ecx,edx - jz memmove_done - rep movsb - memmove_done: - } - } - else { - - /* - * Overlapping Buffers - * copy from higher addresses to lower addresses - */ - _asm { - mov esi,src - mov edi,dst - mov ecx,count - std - add esi,ecx - add edi,ecx - dec esi - dec edi - rep movsb - cld - } - } -#else - MoveMemory(dst, src, count); -#endif - - return ret; -} - -/* Arithmetic functions to help with time format conversions -*/ - -#ifdef _M_ALPHA -// work around bug in version 12.00.8385 of the alpha compiler where -// UInt32x32To64 sign-extends its arguments (?) -#undef UInt32x32To64 -#define UInt32x32To64(a, b) (((ULONGLONG)((ULONG)(a)) & 0xffffffff) * ((ULONGLONG)((ULONG)(b)) & 0xffffffff)) -#endif - -/* Compute (a * b + d) / c */ -LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d) { - /* Compute the absolute values to avoid signed arithmetic problems */ - ULARGE_INTEGER ua, ub; - DWORDLONG uc; - - ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a); - ub.QuadPart = (DWORDLONG)(b >= 0 ? b : -b); - uc = (DWORDLONG)(c >= 0 ? c : -c); - BOOL bSign = (a < 0) ^ (b < 0); - - /* Do long multiplication */ - ULARGE_INTEGER p[2]; - p[0].QuadPart = UInt32x32To64(ua.LowPart, ub.LowPart); - - /* This next computation cannot overflow into p[1].HighPart because - the max number we can compute here is: - - (2 ** 32 - 1) * (2 ** 32 - 1) + // ua.LowPart * ub.LowPart - (2 ** 32) * (2 ** 31) * (2 ** 32 - 1) * 2 // x.LowPart * y.HighPart * 2 - - == 2 ** 96 - 2 ** 64 + (2 ** 64 - 2 ** 33 + 1) - == 2 ** 96 - 2 ** 33 + 1 - < 2 ** 96 - */ - - ULARGE_INTEGER x; - x.QuadPart = UInt32x32To64(ua.LowPart, ub.HighPart) + - UInt32x32To64(ua.HighPart, ub.LowPart) + - p[0].HighPart; - p[0].HighPart = x.LowPart; - p[1].QuadPart = UInt32x32To64(ua.HighPart, ub.HighPart) + x.HighPart; - - if(d != 0) { - ULARGE_INTEGER ud[2]; - if(bSign) { - ud[0].QuadPart = (DWORDLONG)(-d); - if(d > 0) { - /* -d < 0 */ - ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1; - } - else { - ud[1].QuadPart = (DWORDLONG)0; - } - } - else { - ud[0].QuadPart = (DWORDLONG)d; - if(d < 0) { - ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1; - } - else { - ud[1].QuadPart = (DWORDLONG)0; - } - } - /* Now do extended addition */ - ULARGE_INTEGER uliTotal; - - /* Add ls DWORDs */ - uliTotal.QuadPart = (DWORDLONG)ud[0].LowPart + p[0].LowPart; - p[0].LowPart = uliTotal.LowPart; - - /* Propagate carry */ - uliTotal.LowPart = uliTotal.HighPart; - uliTotal.HighPart = 0; - - /* Add 2nd most ls DWORDs */ - uliTotal.QuadPart += (DWORDLONG)ud[0].HighPart + p[0].HighPart; - p[0].HighPart = uliTotal.LowPart; - - /* Propagate carry */ - uliTotal.LowPart = uliTotal.HighPart; - uliTotal.HighPart = 0; - - /* Add MS DWORDLONGs - no carry expected */ - p[1].QuadPart += ud[1].QuadPart + uliTotal.QuadPart; - - /* Now see if we got a sign change from the addition */ - if((LONG)p[1].HighPart < 0) { - bSign = !bSign; - - /* Negate the current value (ugh!) */ - p[0].QuadPart = ~p[0].QuadPart; - p[1].QuadPart = ~p[1].QuadPart; - p[0].QuadPart += 1; - p[1].QuadPart += (p[0].QuadPart == 0); - } - } - - /* Now for the division */ - if(c < 0) { - bSign = !bSign; - } - - - /* This will catch c == 0 and overflow */ - if(uc <= p[1].QuadPart) { - return bSign ? (LONGLONG)0x8000000000000000 : - (LONGLONG)0x7FFFFFFFFFFFFFFF; - } - - DWORDLONG ullResult; - - /* Do the division */ - /* If the dividend is a DWORD_LONG use the compiler */ - if(p[1].QuadPart == 0) { - ullResult = p[0].QuadPart / uc; - return bSign ? -(LONGLONG)ullResult : (LONGLONG)ullResult; - } - - /* If the divisor is a DWORD then its simpler */ - ULARGE_INTEGER ulic; - ulic.QuadPart = uc; - if(ulic.HighPart == 0) { - ULARGE_INTEGER uliDividend; - ULARGE_INTEGER uliResult; - DWORD dwDivisor = (DWORD)uc; - // ASSERT(p[1].HighPart == 0 && p[1].LowPart < dwDivisor); - uliDividend.HighPart = p[1].LowPart; - uliDividend.LowPart = p[0].HighPart; -#ifndef USE_LARGEINT - uliResult.HighPart = (DWORD)(uliDividend.QuadPart / dwDivisor); - p[0].HighPart = (DWORD)(uliDividend.QuadPart % dwDivisor); - uliResult.LowPart = 0; - uliResult.QuadPart = p[0].QuadPart / dwDivisor + uliResult.QuadPart; -#else - /* NOTE - this routine will take exceptions if - the result does not fit in a DWORD - */ - if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor) { - uliResult.HighPart = EnlargedUnsignedDivide(uliDividend, - dwDivisor, - &p[0].HighPart); - } - else { - uliResult.HighPart = 0; - } - uliResult.LowPart = EnlargedUnsignedDivide(p[0], - dwDivisor, - NULL); -#endif - return bSign ? -(LONGLONG)uliResult.QuadPart : - (LONGLONG)uliResult.QuadPart; - } - - - ullResult = 0; - - /* OK - do long division */ - for(int i = 0; i < 64; i++) { - ullResult <<= 1; - - /* Shift 128 bit p left 1 */ - p[1].QuadPart <<= 1; - if((p[0].HighPart & 0x80000000) != 0) { - p[1].LowPart++; - } - p[0].QuadPart <<= 1; - - /* Compare */ - if(uc <= p[1].QuadPart) { - p[1].QuadPart -= uc; - ullResult += 1; - } - } - - return bSign ? - (LONGLONG)ullResult : (LONGLONG)ullResult; -} - -LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d) { - ULARGE_INTEGER ua; - DWORD ub; - DWORD uc; - - /* Compute the absolute values to avoid signed arithmetic problems */ - ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a); - ub = (DWORD)(b >= 0 ? b : -b); - uc = (DWORD)(c >= 0 ? c : -c); - BOOL bSign = (a < 0) ^ (b < 0); - - /* Do long multiplication */ - ULARGE_INTEGER p0; - DWORD p1; - p0.QuadPart = UInt32x32To64(ua.LowPart, ub); - - if(ua.HighPart != 0) { - ULARGE_INTEGER x; - x.QuadPart = UInt32x32To64(ua.HighPart, ub) + p0.HighPart; - p0.HighPart = x.LowPart; - p1 = x.HighPart; - } - else { - p1 = 0; - } - - if(d != 0) { - ULARGE_INTEGER ud0; - DWORD ud1; - - if(bSign) { - // - // Cast d to LONGLONG first otherwise -0x80000000 sign extends - // incorrectly - // - ud0.QuadPart = (DWORDLONG)(-(LONGLONG)d); - if(d > 0) { - /* -d < 0 */ - ud1 = (DWORD)-1; - } - else { - ud1 = (DWORD)0; - } - } - else { - ud0.QuadPart = (DWORDLONG)d; - if(d < 0) { - ud1 = (DWORD)-1; - } - else { - ud1 = (DWORD)0; - } - } - /* Now do extended addition */ - ULARGE_INTEGER uliTotal; - - /* Add ls DWORDs */ - uliTotal.QuadPart = (DWORDLONG)ud0.LowPart + p0.LowPart; - p0.LowPart = uliTotal.LowPart; - - /* Propagate carry */ - uliTotal.LowPart = uliTotal.HighPart; - uliTotal.HighPart = 0; - - /* Add 2nd most ls DWORDs */ - uliTotal.QuadPart += (DWORDLONG)ud0.HighPart + p0.HighPart; - p0.HighPart = uliTotal.LowPart; - - /* Add MS DWORDLONGs - no carry expected */ - p1 += ud1 + uliTotal.HighPart; - - /* Now see if we got a sign change from the addition */ - if((LONG)p1 < 0) { - bSign = !bSign; - - /* Negate the current value (ugh!) */ - p0.QuadPart = ~p0.QuadPart; - p1 = ~p1; - p0.QuadPart += 1; - p1 += (p0.QuadPart == 0); - } - } - - /* Now for the division */ - if(c < 0) { - bSign = !bSign; - } - - - /* This will catch c == 0 and overflow */ - if(uc <= p1) { - return bSign ? (LONGLONG)0x8000000000000000 : - (LONGLONG)0x7FFFFFFFFFFFFFFF; - } - - /* Do the division */ - - /* If the divisor is a DWORD then its simpler */ - ULARGE_INTEGER uliDividend; - ULARGE_INTEGER uliResult; - DWORD dwDivisor = uc; - uliDividend.HighPart = p1; - uliDividend.LowPart = p0.HighPart; - /* NOTE - this routine will take exceptions if - the result does not fit in a DWORD - */ - if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor) { - uliResult.HighPart = EnlargedUnsignedDivide(uliDividend, - dwDivisor, - &p0.HighPart); - } - else { - uliResult.HighPart = 0; - } - uliResult.LowPart = EnlargedUnsignedDivide(p0, - dwDivisor, - NULL); - return bSign ? -(LONGLONG)uliResult.QuadPart : - (LONGLONG)uliResult.QuadPart; -} - -#ifdef DEBUG -/******************************Public*Routine******************************\ -* Debug CCritSec helpers -* -* We provide debug versions of the Constructor, destructor, Lock and Unlock -* routines. The debug code tracks who owns each critical section by -* maintaining a depth count. -* -* History: -* -\**************************************************************************/ - -CCritSec::CCritSec() { - InitializeCriticalSection(&m_CritSec); - m_currentOwner = m_lockCount = 0; - m_fTrace = FALSE; -} - -CCritSec::~CCritSec() { - DeleteCriticalSection(&m_CritSec); -} - -void CCritSec::Lock() { - UINT tracelevel=3; - DWORD us = GetCurrentThreadId(); - DWORD currentOwner = m_currentOwner; - if(currentOwner && (currentOwner != us)) { - // already owned, but not by us - if(m_fTrace) { - DbgLog((LOG_LOCKING, 2, TEXT("Thread %d about to wait for lock %x owned by %d"), - GetCurrentThreadId(), &m_CritSec, currentOwner)); - tracelevel=2; - // if we saw the message about waiting for the critical - // section we ensure we see the message when we get the - // critical section - } - } - EnterCriticalSection(&m_CritSec); - if(0 == m_lockCount++) { - // we now own it for the first time. Set owner information - m_currentOwner = us; - - if(m_fTrace) { - DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec)); - } - } -} - -void CCritSec::Unlock() { - if(0 == --m_lockCount) { - // about to be unowned - if(m_fTrace) { - DbgLog((LOG_LOCKING, 3, TEXT("Thread %d releasing lock %x"), m_currentOwner, &m_CritSec)); - } - - m_currentOwner = 0; - } - LeaveCriticalSection(&m_CritSec); -} - -void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace) { - pcCrit->m_fTrace = fTrace; -} - -BOOL WINAPI CritCheckIn(CCritSec * pcCrit) { - return (GetCurrentThreadId() == pcCrit->m_currentOwner); -} - -BOOL WINAPI CritCheckIn(const CCritSec * pcCrit) { - return (GetCurrentThreadId() == pcCrit->m_currentOwner); -} - -BOOL WINAPI CritCheckOut(CCritSec * pcCrit) { - return (GetCurrentThreadId() != pcCrit->m_currentOwner); -} - -BOOL WINAPI CritCheckOut(const CCritSec * pcCrit) { - return (GetCurrentThreadId() != pcCrit->m_currentOwner); -} -#endif - -/*NABIL: I un-commented this...*/ -STDAPI WriteBSTR(BSTR *pstrDest, LPCWSTR szSrc) { - *pstrDest = SysAllocString(szSrc); - if(!(*pstrDest)) return E_OUTOFMEMORY; - return NOERROR; -} -/*END un-comment*/ - -/* -STDAPI FreeBSTR(BSTR* pstr) { - if(*pstr == NULL) return S_FALSE; - SysFreeString(*pstr); - return NOERROR; -} -*/ - -// Return a wide string - allocating memory for it -// Returns: -// S_OK - no error -// E_POINTER - ppszReturn == NULL -// E_OUTOFMEMORY - can't allocate memory for returned string -STDAPI AMGetWideString(LPCWSTR psz, LPWSTR *ppszReturn) { - CheckPointer(ppszReturn, E_POINTER); - ValidateReadWritePtr(ppszReturn, sizeof(LPWSTR)); - DWORD nameLen = sizeof(WCHAR) * (lstrlenW(psz)+1); - *ppszReturn = (LPWSTR)CoTaskMemAlloc(nameLen); - if(*ppszReturn == NULL) { - return E_OUTOFMEMORY; - } - CopyMemory(*ppszReturn, psz, nameLen); - return NOERROR; -} - -// Waits for the HANDLE hObject. While waiting messages sent -// to windows on our thread by SendMessage will be processed. -// Using this function to do waits and mutual exclusion -// avoids some deadlocks in objects with windows. -// Return codes are the same as for WaitForSingleObject -DWORD WINAPI WaitDispatchingMessages( - HANDLE hObject, - DWORD dwWait, - HWND hwnd, - UINT uMsg, - HANDLE hEvent) { - BOOL bPeeked = FALSE; - DWORD dwResult; - DWORD dwStart=0; - DWORD dwThreadPriority=0; - - static UINT uMsgId = 0; - - HANDLE hObjects[2] = { hObject, hEvent }; - if(dwWait != INFINITE && dwWait != 0) { - dwStart = GetTickCount(); - } - for(; ;) { - DWORD nCount = NULL != hEvent ? 2 : 1; - - // Minimize the chance of actually dispatching any messages - // by seeing if we can lock immediately. - dwResult = WaitForMultipleObjects(nCount, hObjects, FALSE, 0); - if(dwResult < WAIT_OBJECT_0 + nCount) { - break; - } - - DWORD dwTimeOut = dwWait; - if(dwTimeOut > 10) { - dwTimeOut = 10; - } - dwResult = MsgWaitForMultipleObjects(nCount, - hObjects, - FALSE, - dwTimeOut, - hwnd == NULL ? QS_SENDMESSAGE : - QS_SENDMESSAGE + QS_POSTMESSAGE); - if(dwResult == WAIT_OBJECT_0 + nCount || - dwResult == WAIT_TIMEOUT && dwTimeOut != dwWait) { - MSG msg; - if(hwnd != NULL) { - while(PeekMessage(&msg, hwnd, uMsg, uMsg, PM_REMOVE)) { - DispatchMessage(&msg); - } - } - // Do this anyway - the previous peek doesn't flush out the - // messages - PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); - - if(dwWait != INFINITE && dwWait != 0) { - DWORD dwNow = GetTickCount(); - - // Working with differences handles wrap-around - DWORD dwDiff = dwNow - dwStart; - if(dwDiff > dwWait) { - dwWait = 0; - } - else { - dwWait -= dwDiff; - } - dwStart = dwNow; - } - if(!bPeeked) { - // Raise our priority to prevent our message queue - // building up - dwThreadPriority = GetThreadPriority(GetCurrentThread()); - if(dwThreadPriority < THREAD_PRIORITY_HIGHEST) { - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); - } - bPeeked = TRUE; - } - } - else { - break; - } - } - if(bPeeked) { - SetThreadPriority(GetCurrentThread(), dwThreadPriority); - if(HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) { - if(uMsgId == 0) { - uMsgId = RegisterWindowMessage(TEXT("AMUnblock")); - } - if(uMsgId != 0) { - MSG msg; - // Remove old ones - while(PeekMessage(&msg, (HWND)-1, uMsgId, uMsgId, PM_REMOVE)) { - } - } - PostThreadMessage(GetCurrentThreadId(), uMsgId, 0, 0); - } - } - return dwResult; -} - -HRESULT AmGetLastErrorToHResult() { - DWORD dwLastError = GetLastError(); - if(dwLastError != 0) { - return HRESULT_FROM_WIN32(dwLastError); - } - else { - return E_FAIL; - } -} - -IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp) { - if(lp != NULL) - lp->AddRef(); - if(*pp) - (*pp)->Release(); - *pp = lp; - return lp; -} - -/****************************************************************************** - -CompatibleTimeSetEvent - - CompatibleTimeSetEvent() sets the TIME_KILL_SYNCHRONOUS flag before calling -timeSetEvent() if the current operating system supports it. TIME_KILL_SYNCHRONOUS -is supported on Windows XP and later operating systems. - -Parameters: -- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in -the Platform SDK for more information. - -Return Value: -- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in -the Platform SDK for more information. - -******************************************************************************/ -MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent ) { - // - // Building for Windows XP - // ----------------------- - // If you want to target Windows XP specifically to use its new features, - // you must set WINVER=0x501 in the sample project file. You must also - // install the Windows XP Platform SDK, however, to ensure that you have the - // latest header files. For example, this CompatibleTimeSetEvent() method - // uses the new TIME_KILL_SYNCHRONOUS flag only if (WINVER >= 0x501). This flag - // is conditionally defined in the Windows XP Platform SDK in mmsystem.h, - // but only if WINVER is also set to 0x501 when compiling. To prevent build - // issues, upgrade to the latest version of the Platform SDK. - // - -#if WINVER >= 0x0501 - { - static bool fCheckedVersion = false; - static bool fTimeKillSynchronousFlagAvailable = false; - - if(!fCheckedVersion) { - fTimeKillSynchronousFlagAvailable = TimeKillSynchronousFlagAvailable(); - fCheckedVersion = true; - } - - if(fTimeKillSynchronousFlagAvailable) { - fuEvent = fuEvent | TIME_KILL_SYNCHRONOUS; - } - } -#endif // WINVER >= 0x0501 - - return timeSetEvent(uDelay, uResolution, lpTimeProc, dwUser, fuEvent); -} - -bool TimeKillSynchronousFlagAvailable( void ) { - OSVERSIONINFO osverinfo; - - osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); - - if(GetVersionEx(&osverinfo)) { - - // Windows XP's major version is 5 and its' minor version is 1. - // timeSetEvent() started supporting the TIME_KILL_SYNCHRONOUS flag - // in Windows XP. - if((osverinfo.dwMajorVersion > 5) || - ( (osverinfo.dwMajorVersion == 5) && (osverinfo.dwMinorVersion >= 1) )) { - return true; - } - } - - return false; -} - +//------------------------------------------------------------------------------ +// File: WXUtil.cpp +// +// Desc: DirectShow base classes - implements helper classes for building +// multimedia filters. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ +#include +#include + +// +// Declare function from largeint.h we need so that PPC can build +// + +// +// Enlarged integer divide - 64-bits / 32-bits > 32-bits +// + +#ifndef _X86_ + +#define LLtoU64(x) (*(unsigned __int64*)(void*)(&(x))) + +__inline +ULONG +WINAPI +EnlargedUnsignedDivide( + IN ULARGE_INTEGER Dividend, + IN ULONG Divisor, + IN PULONG Remainder + ) { + // return remainder if necessary + if(Remainder != NULL) + *Remainder = (ULONG)(LLtoU64(Dividend) % Divisor); + return (ULONG)(LLtoU64(Dividend) / Divisor); +} + +#else +__inline +ULONG +WINAPI +EnlargedUnsignedDivide( + IN ULARGE_INTEGER Dividend, + IN ULONG Divisor, + IN PULONG Remainder + ) { + ULONG ulResult; + _asm { + mov eax,Dividend.LowPart + mov edx,Dividend.HighPart + mov ecx,Remainder + div Divisor + or ecx,ecx + jz short label + mov [ecx],edx + label: + mov ulResult,eax + } + return ulResult; +} +#endif + +// --- CAMEvent ----------------------- +CAMEvent::CAMEvent(BOOL fManualReset) { + m_hEvent = CreateEvent(NULL, fManualReset, FALSE, NULL); +} + +CAMEvent::~CAMEvent() { + if(m_hEvent) { + EXECUTE_ASSERT(CloseHandle(m_hEvent)); + } +} + + +// --- CAMMsgEvent ----------------------- +// One routine. The rest is handled in CAMEvent + +BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout) { + // wait for the event to be signalled, or for the + // timeout (in MS) to expire. allow SENT messages + // to be processed while we wait + DWORD dwWait; + DWORD dwStartTime=0; + + // set the waiting period. + DWORD dwWaitTime = dwTimeout; + + // the timeout will eventually run down as we iterate + // processing messages. grab the start time so that + // we can calculate elapsed times. + if(dwWaitTime != INFINITE) { + dwStartTime = timeGetTime(); + } + + do { + dwWait = MsgWaitForMultipleObjects(1,&m_hEvent,FALSE, dwWaitTime, QS_SENDMESSAGE); + if(dwWait == WAIT_OBJECT_0 + 1) { + MSG Message; + PeekMessage(&Message,NULL,0,0,PM_NOREMOVE); + + // If we have an explicit length of time to wait calculate + // the next wake up point - which might be now. + // If dwTimeout is INFINITE, it stays INFINITE + if(dwWaitTime != INFINITE) { + + DWORD dwElapsed = timeGetTime()-dwStartTime; + + dwWaitTime = + (dwElapsed >= dwTimeout) + ? 0 // wake up with WAIT_TIMEOUT + : dwTimeout-dwElapsed; + } + } + } while(dwWait == WAIT_OBJECT_0 + 1); + + // return TRUE if we woke on the event handle, + // FALSE if we timed out. + return (dwWait == WAIT_OBJECT_0); +} + +// --- CAMThread ---------------------- + + +CAMThread::CAMThread() + : m_EventSend(TRUE) // must be manual-reset for CheckRequest() +{ + m_hThread = NULL; +} + +CAMThread::~CAMThread() { + Close(); +} + + +// when the thread starts, it calls this function. We unwrap the 'this' +//pointer and call ThreadProc. +DWORD WINAPI +CAMThread::InitialThreadProc(LPVOID pv) { + HRESULT hrCoInit = CAMThread::CoInitializeHelper(); + if(FAILED(hrCoInit)) { + DbgLog((LOG_ERROR, 1, TEXT("CoInitializeEx failed."))); + } + + CAMThread * pThread = (CAMThread *) pv; + + HRESULT hr = pThread->ThreadProc(); + + if(SUCCEEDED(hrCoInit)) { + CoUninitialize(); + } + + return hr; +} + +BOOL +CAMThread::Create() { + DWORD threadid; + + CAutoLock lock(&m_AccessLock); + + if(ThreadExists()) { + return FALSE; + } + + m_hThread = CreateThread(NULL, + 0, + CAMThread::InitialThreadProc, + this, + 0, + &threadid); + + if(!m_hThread) { + return FALSE; + } + + return TRUE; +} + +DWORD +CAMThread::CallWorker(DWORD dwParam) { + // lock access to the worker thread for scope of this object + CAutoLock lock(&m_AccessLock); + + if(!ThreadExists()) { + return (DWORD) E_FAIL; + } + + // set the parameter + m_dwParam = dwParam; + + // signal the worker thread + m_EventSend.Set(); + + // wait for the completion to be signalled + m_EventComplete.Wait(); + + // done - this is the thread's return value + return m_dwReturnVal; +} + +// Wait for a request from the client +DWORD +CAMThread::GetRequest() { + m_EventSend.Wait(); + return m_dwParam; +} + +// is there a request? +BOOL +CAMThread::CheckRequest(DWORD * pParam) { + if(!m_EventSend.Check()) { + return FALSE; + } + else { + if(pParam) { + *pParam = m_dwParam; + } + return TRUE; + } +} + +// reply to the request +void +CAMThread::Reply(DWORD dw) { + m_dwReturnVal = dw; + + // The request is now complete so CheckRequest should fail from + // now on + // + // This event should be reset BEFORE we signal the client or + // the client may Set it before we reset it and we'll then + // reset it (!) + + m_EventSend.Reset(); + + // Tell the client we're finished + + m_EventComplete.Set(); +} + +HRESULT CAMThread::CoInitializeHelper() { + // call CoInitializeEx and tell OLE not to create a window (this + // thread probably won't dispatch messages and will hang on + // broadcast msgs o/w). + // + // If CoInitEx is not available, threads that don't call CoCreate + // aren't affected. Threads that do will have to handle the + // failure. Perhaps we should fall back to CoInitialize and risk + // hanging? + // + + // older versions of ole32.dll don't have CoInitializeEx + + HRESULT hr = E_FAIL; + HINSTANCE hOle = GetModuleHandle(TEXT("ole32.dll")); + if(hOle) { + typedef HRESULT(STDAPICALLTYPE *PCoInitializeEx)( + LPVOID pvReserved, DWORD dwCoInit); + PCoInitializeEx pCoInitializeEx = + (PCoInitializeEx)(GetProcAddress(hOle, "CoInitializeEx")); + if(pCoInitializeEx) { + hr = (*pCoInitializeEx)(0, 0x4 ); /*NABIL: Changed this to the constant, rather than the Variable...*/ + } + } + else { + // caller must load ole32.dll + DbgBreak("couldn't locate ole32.dll"); + } + + return hr; +} + + +// destructor for CMsgThread - cleans up any messages left in the +// queue when the thread exited +CMsgThread::~CMsgThread() { + if(m_hThread != NULL) { + WaitForSingleObject(m_hThread, INFINITE); + EXECUTE_ASSERT(CloseHandle(m_hThread)); + } + + POSITION pos = m_ThreadQueue.GetHeadPosition(); + while(pos) { + CMsg * pMsg = m_ThreadQueue.GetNext(pos); + delete pMsg; + } + m_ThreadQueue.RemoveAll(); + + if(m_hSem != NULL) { + EXECUTE_ASSERT(CloseHandle(m_hSem)); + } +} + +BOOL +CMsgThread::CreateThread( + ) { + m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL); + if(m_hSem == NULL) { + return FALSE; + } + + m_hThread = ::CreateThread(NULL, 0, DefaultThreadProc, + (LPVOID)this, 0, &m_ThreadId); + return m_hThread != NULL; +} + + +// This is the threads message pump. Here we get and dispatch messages to +// clients thread proc until the client refuses to process a message. +// The client returns a non-zero value to stop the message pump, this +// value becomes the threads exit code. + +DWORD WINAPI +CMsgThread::DefaultThreadProc( + LPVOID lpParam + ) { + CMsgThread *lpThis = (CMsgThread *)lpParam; + CMsg msg; + LRESULT lResult; + + // !!! + CoInitialize(NULL); + + // allow a derived class to handle thread startup + lpThis->OnThreadInit(); + + do { + lpThis->GetThreadMsg(&msg); + lResult = lpThis->ThreadMessageProc(msg.uMsg,msg.dwFlags, + msg.lpParam, msg.pEvent); + } while(lResult == 0L); + + // !!! + CoUninitialize(); + + return (DWORD)lResult; +} + + +// Block until the next message is placed on the list m_ThreadQueue. +// copies the message to the message pointed to by *pmsg +void +CMsgThread::GetThreadMsg(CMsg *msg) { + CMsg * pmsg = NULL; + + // keep trying until a message appears + while(TRUE) { { + CAutoLock lck(&m_Lock); + pmsg = m_ThreadQueue.RemoveHead(); + if(pmsg == NULL) { + m_lWaiting++; + } + else { + break; + } + } + // the semaphore will be signalled when it is non-empty + WaitForSingleObject(m_hSem, INFINITE); + } + // copy fields to caller's CMsg + *msg = *pmsg; + + // this CMsg was allocated by the 'new' in PutThreadMsg + delete pmsg; + +} + + +// NOTE: as we need to use the same binaries on Win95 as on NT this code should +// be compiled WITHOUT unicode being defined. Otherwise we will not pick up +// these internal routines and the binary will not run on Win95. + +#ifndef UNICODE + +#pragma warning(disable:4706) // C4706: assignment within conditional expression + +// Windows 95 doesn't implement this, so we provide an implementation. +LPWSTR +WINAPI +lstrcpyWInternal( + LPWSTR lpString1, + LPCWSTR lpString2 + ) { + LPWSTR lpReturn = lpString1; + while(*lpString1++ = *lpString2++); + + return lpReturn; +} + +// Windows 95 doesn't implement this, so we provide an implementation. +LPWSTR +WINAPI +lstrcpynWInternal( + LPWSTR lpString1, + LPCWSTR lpString2, + int iMaxLength + ) { + ASSERT(iMaxLength); + LPWSTR lpReturn = lpString1; + if(iMaxLength) { + while(--iMaxLength && (*lpString1++ = *lpString2++)); + + // If we ran out of room (which will be the case if + // iMaxLength is now 0) we still need to terminate the + // string. + if(!iMaxLength) *lpString1 = L'\0'; + } + return lpReturn; +} + +#pragma warning(default:4706) // C4706: assignment within conditional expression + +int +WINAPI +lstrcmpWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) { + do { + WCHAR c1 = *lpString1; + WCHAR c2 = *lpString2; + if(c1 != c2) + return (int) c1 - (int) c2; + } while(*lpString1++ && *lpString2++); + return 0; +} + + +int +WINAPI +lstrcmpiWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) { + do { + WCHAR c1 = *lpString1; + WCHAR c2 = *lpString2; + if(c1 >= L'A' && c1 <= L'Z') + c1 -= (WCHAR) (L'A' - L'a'); + if(c2 >= L'A' && c2 <= L'Z') + c2 -= (WCHAR) (L'A' - L'a'); + + if(c1 != c2) + return (int) c1 - (int) c2; + } while(*lpString1++ && *lpString2++); + + return 0; +} + + +int +WINAPI +lstrlenWInternal( + LPCWSTR lpString + ) { + int i = -1; + while(*(lpString+(++i))) + ; + return i; +} + + +int WINAPIV wsprintfWInternal(LPWSTR wszOut, LPCWSTR pszFmt, ...) { + char fmt[256]; // !!! + char ach[256]; // !!! + int i; + + va_list va; + va_start(va, pszFmt); + WideCharToMultiByte(GetACP(), 0, pszFmt, -1, fmt, 256, NULL, NULL); + i = wvsprintfA(ach, fmt, va); + va_end(va); + + MultiByteToWideChar(CP_ACP, 0, ach, -1, wszOut, i+1); + + return i; +} +#else + +// need to provide the implementations in unicode for non-unicode +// builds linking with the unicode strmbase.lib +LPWSTR WINAPI lstrcpyWInternal( + LPWSTR lpString1, + LPCWSTR lpString2 + ) { + return lstrcpyW(lpString1, lpString2); +} + +LPWSTR WINAPI lstrcpynWInternal( + LPWSTR lpString1, + LPCWSTR lpString2, + int iMaxLength + ) { + return lstrcpynW(lpString1, lpString2, iMaxLength); +} + +int WINAPI lstrcmpWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) { + return lstrcmpW(lpString1, lpString2); +} + + +int WINAPI lstrcmpiWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) { + return lstrcmpiW(lpString1, lpString2); +} + + +int WINAPI lstrlenWInternal( + LPCWSTR lpString + ) { + return lstrlenW(lpString); +} + + +int WINAPIV wsprintfWInternal( + LPWSTR wszOut, LPCWSTR pszFmt, ...) { + va_list va; + va_start(va, pszFmt); + int i = wvsprintfW(wszOut, pszFmt, va); + va_end(va); + return i; +} +#endif + + +// Helper function - convert int to WSTR +void WINAPI IntToWstr(int i, LPWSTR wstr) { +#ifdef UNICODE + wsprintf(wstr, L"%d", i); +#else + TCHAR temp[32]; + wsprintf(temp, "%d", i); + MultiByteToWideChar(CP_ACP, 0, temp, -1, wstr, 32); +#endif +} // IntToWstr + + +#if 0 +void * memchrInternal(const void *pv, int c, size_t sz) { + BYTE *pb = (BYTE *) pv; + while(sz--) { + if(*pb == c) + return (void *) pb; + pb++; + } + return NULL; +} +#endif + + +#define MEMORY_ALIGNMENT 4 +#define MEMORY_ALIGNMENT_LOG2 2 +#define MEMORY_ALIGNMENT_MASK MEMORY_ALIGNMENT - 1 + +void * __stdcall memmoveInternal(void * dst, const void * src, size_t count) { + void * ret = dst; + +#ifdef _X86_ + if(dst <= src || (char *)dst >= ((char *)src + count)) { + + /* + * Non-Overlapping Buffers + * copy from lower addresses to higher addresses + */ + _asm { + mov esi,src + mov edi,dst + mov ecx,count + cld + mov edx,ecx + and edx,MEMORY_ALIGNMENT_MASK + shr ecx,MEMORY_ALIGNMENT_LOG2 + rep movsd + or ecx,edx + jz memmove_done + rep movsb + memmove_done: + } + } + else { + + /* + * Overlapping Buffers + * copy from higher addresses to lower addresses + */ + _asm { + mov esi,src + mov edi,dst + mov ecx,count + std + add esi,ecx + add edi,ecx + dec esi + dec edi + rep movsb + cld + } + } +#else + MoveMemory(dst, src, count); +#endif + + return ret; +} + +/* Arithmetic functions to help with time format conversions +*/ + +#ifdef _M_ALPHA +// work around bug in version 12.00.8385 of the alpha compiler where +// UInt32x32To64 sign-extends its arguments (?) +#undef UInt32x32To64 +#define UInt32x32To64(a, b) (((ULONGLONG)((ULONG)(a)) & 0xffffffff) * ((ULONGLONG)((ULONG)(b)) & 0xffffffff)) +#endif + +/* Compute (a * b + d) / c */ +LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d) { + /* Compute the absolute values to avoid signed arithmetic problems */ + ULARGE_INTEGER ua, ub; + DWORDLONG uc; + + ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a); + ub.QuadPart = (DWORDLONG)(b >= 0 ? b : -b); + uc = (DWORDLONG)(c >= 0 ? c : -c); + BOOL bSign = (a < 0) ^ (b < 0); + + /* Do long multiplication */ + ULARGE_INTEGER p[2]; + p[0].QuadPart = UInt32x32To64(ua.LowPart, ub.LowPart); + + /* This next computation cannot overflow into p[1].HighPart because + the max number we can compute here is: + + (2 ** 32 - 1) * (2 ** 32 - 1) + // ua.LowPart * ub.LowPart + (2 ** 32) * (2 ** 31) * (2 ** 32 - 1) * 2 // x.LowPart * y.HighPart * 2 + + == 2 ** 96 - 2 ** 64 + (2 ** 64 - 2 ** 33 + 1) + == 2 ** 96 - 2 ** 33 + 1 + < 2 ** 96 + */ + + ULARGE_INTEGER x; + x.QuadPart = UInt32x32To64(ua.LowPart, ub.HighPart) + + UInt32x32To64(ua.HighPart, ub.LowPart) + + p[0].HighPart; + p[0].HighPart = x.LowPart; + p[1].QuadPart = UInt32x32To64(ua.HighPart, ub.HighPart) + x.HighPart; + + if(d != 0) { + ULARGE_INTEGER ud[2]; + if(bSign) { + ud[0].QuadPart = (DWORDLONG)(-d); + if(d > 0) { + /* -d < 0 */ + ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1; + } + else { + ud[1].QuadPart = (DWORDLONG)0; + } + } + else { + ud[0].QuadPart = (DWORDLONG)d; + if(d < 0) { + ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1; + } + else { + ud[1].QuadPart = (DWORDLONG)0; + } + } + /* Now do extended addition */ + ULARGE_INTEGER uliTotal; + + /* Add ls DWORDs */ + uliTotal.QuadPart = (DWORDLONG)ud[0].LowPart + p[0].LowPart; + p[0].LowPart = uliTotal.LowPart; + + /* Propagate carry */ + uliTotal.LowPart = uliTotal.HighPart; + uliTotal.HighPart = 0; + + /* Add 2nd most ls DWORDs */ + uliTotal.QuadPart += (DWORDLONG)ud[0].HighPart + p[0].HighPart; + p[0].HighPart = uliTotal.LowPart; + + /* Propagate carry */ + uliTotal.LowPart = uliTotal.HighPart; + uliTotal.HighPart = 0; + + /* Add MS DWORDLONGs - no carry expected */ + p[1].QuadPart += ud[1].QuadPart + uliTotal.QuadPart; + + /* Now see if we got a sign change from the addition */ + if((LONG)p[1].HighPart < 0) { + bSign = !bSign; + + /* Negate the current value (ugh!) */ + p[0].QuadPart = ~p[0].QuadPart; + p[1].QuadPart = ~p[1].QuadPart; + p[0].QuadPart += 1; + p[1].QuadPart += (p[0].QuadPart == 0); + } + } + + /* Now for the division */ + if(c < 0) { + bSign = !bSign; + } + + + /* This will catch c == 0 and overflow */ + if(uc <= p[1].QuadPart) { + return bSign ? (LONGLONG)0x8000000000000000 : + (LONGLONG)0x7FFFFFFFFFFFFFFF; + } + + DWORDLONG ullResult; + + /* Do the division */ + /* If the dividend is a DWORD_LONG use the compiler */ + if(p[1].QuadPart == 0) { + ullResult = p[0].QuadPart / uc; + return bSign ? -(LONGLONG)ullResult : (LONGLONG)ullResult; + } + + /* If the divisor is a DWORD then its simpler */ + ULARGE_INTEGER ulic; + ulic.QuadPart = uc; + if(ulic.HighPart == 0) { + ULARGE_INTEGER uliDividend; + ULARGE_INTEGER uliResult; + DWORD dwDivisor = (DWORD)uc; + // ASSERT(p[1].HighPart == 0 && p[1].LowPart < dwDivisor); + uliDividend.HighPart = p[1].LowPart; + uliDividend.LowPart = p[0].HighPart; +#ifndef USE_LARGEINT + uliResult.HighPart = (DWORD)(uliDividend.QuadPart / dwDivisor); + p[0].HighPart = (DWORD)(uliDividend.QuadPart % dwDivisor); + uliResult.LowPart = 0; + uliResult.QuadPart = p[0].QuadPart / dwDivisor + uliResult.QuadPart; +#else + /* NOTE - this routine will take exceptions if + the result does not fit in a DWORD + */ + if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor) { + uliResult.HighPart = EnlargedUnsignedDivide(uliDividend, + dwDivisor, + &p[0].HighPart); + } + else { + uliResult.HighPart = 0; + } + uliResult.LowPart = EnlargedUnsignedDivide(p[0], + dwDivisor, + NULL); +#endif + return bSign ? -(LONGLONG)uliResult.QuadPart : + (LONGLONG)uliResult.QuadPart; + } + + + ullResult = 0; + + /* OK - do long division */ + for(int i = 0; i < 64; i++) { + ullResult <<= 1; + + /* Shift 128 bit p left 1 */ + p[1].QuadPart <<= 1; + if((p[0].HighPart & 0x80000000) != 0) { + p[1].LowPart++; + } + p[0].QuadPart <<= 1; + + /* Compare */ + if(uc <= p[1].QuadPart) { + p[1].QuadPart -= uc; + ullResult += 1; + } + } + + return bSign ? - (LONGLONG)ullResult : (LONGLONG)ullResult; +} + +LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d) { + ULARGE_INTEGER ua; + DWORD ub; + DWORD uc; + + /* Compute the absolute values to avoid signed arithmetic problems */ + ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a); + ub = (DWORD)(b >= 0 ? b : -b); + uc = (DWORD)(c >= 0 ? c : -c); + BOOL bSign = (a < 0) ^ (b < 0); + + /* Do long multiplication */ + ULARGE_INTEGER p0; + DWORD p1; + p0.QuadPart = UInt32x32To64(ua.LowPart, ub); + + if(ua.HighPart != 0) { + ULARGE_INTEGER x; + x.QuadPart = UInt32x32To64(ua.HighPart, ub) + p0.HighPart; + p0.HighPart = x.LowPart; + p1 = x.HighPart; + } + else { + p1 = 0; + } + + if(d != 0) { + ULARGE_INTEGER ud0; + DWORD ud1; + + if(bSign) { + // + // Cast d to LONGLONG first otherwise -0x80000000 sign extends + // incorrectly + // + ud0.QuadPart = (DWORDLONG)(-(LONGLONG)d); + if(d > 0) { + /* -d < 0 */ + ud1 = (DWORD)-1; + } + else { + ud1 = (DWORD)0; + } + } + else { + ud0.QuadPart = (DWORDLONG)d; + if(d < 0) { + ud1 = (DWORD)-1; + } + else { + ud1 = (DWORD)0; + } + } + /* Now do extended addition */ + ULARGE_INTEGER uliTotal; + + /* Add ls DWORDs */ + uliTotal.QuadPart = (DWORDLONG)ud0.LowPart + p0.LowPart; + p0.LowPart = uliTotal.LowPart; + + /* Propagate carry */ + uliTotal.LowPart = uliTotal.HighPart; + uliTotal.HighPart = 0; + + /* Add 2nd most ls DWORDs */ + uliTotal.QuadPart += (DWORDLONG)ud0.HighPart + p0.HighPart; + p0.HighPart = uliTotal.LowPart; + + /* Add MS DWORDLONGs - no carry expected */ + p1 += ud1 + uliTotal.HighPart; + + /* Now see if we got a sign change from the addition */ + if((LONG)p1 < 0) { + bSign = !bSign; + + /* Negate the current value (ugh!) */ + p0.QuadPart = ~p0.QuadPart; + p1 = ~p1; + p0.QuadPart += 1; + p1 += (p0.QuadPart == 0); + } + } + + /* Now for the division */ + if(c < 0) { + bSign = !bSign; + } + + + /* This will catch c == 0 and overflow */ + if(uc <= p1) { + return bSign ? (LONGLONG)0x8000000000000000 : + (LONGLONG)0x7FFFFFFFFFFFFFFF; + } + + /* Do the division */ + + /* If the divisor is a DWORD then its simpler */ + ULARGE_INTEGER uliDividend; + ULARGE_INTEGER uliResult; + DWORD dwDivisor = uc; + uliDividend.HighPart = p1; + uliDividend.LowPart = p0.HighPart; + /* NOTE - this routine will take exceptions if + the result does not fit in a DWORD + */ + if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor) { + uliResult.HighPart = EnlargedUnsignedDivide(uliDividend, + dwDivisor, + &p0.HighPart); + } + else { + uliResult.HighPart = 0; + } + uliResult.LowPart = EnlargedUnsignedDivide(p0, + dwDivisor, + NULL); + return bSign ? -(LONGLONG)uliResult.QuadPart : + (LONGLONG)uliResult.QuadPart; +} + +#ifdef DEBUG +/******************************Public*Routine******************************\ +* Debug CCritSec helpers +* +* We provide debug versions of the Constructor, destructor, Lock and Unlock +* routines. The debug code tracks who owns each critical section by +* maintaining a depth count. +* +* History: +* +\**************************************************************************/ + +CCritSec::CCritSec() { + InitializeCriticalSection(&m_CritSec); + m_currentOwner = m_lockCount = 0; + m_fTrace = FALSE; +} + +CCritSec::~CCritSec() { + DeleteCriticalSection(&m_CritSec); +} + +void CCritSec::Lock() { + UINT tracelevel=3; + DWORD us = GetCurrentThreadId(); + DWORD currentOwner = m_currentOwner; + if(currentOwner && (currentOwner != us)) { + // already owned, but not by us + if(m_fTrace) { + DbgLog((LOG_LOCKING, 2, TEXT("Thread %d about to wait for lock %x owned by %d"), + GetCurrentThreadId(), &m_CritSec, currentOwner)); + tracelevel=2; + // if we saw the message about waiting for the critical + // section we ensure we see the message when we get the + // critical section + } + } + EnterCriticalSection(&m_CritSec); + if(0 == m_lockCount++) { + // we now own it for the first time. Set owner information + m_currentOwner = us; + + if(m_fTrace) { + DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec)); + } + } +} + +void CCritSec::Unlock() { + if(0 == --m_lockCount) { + // about to be unowned + if(m_fTrace) { + DbgLog((LOG_LOCKING, 3, TEXT("Thread %d releasing lock %x"), m_currentOwner, &m_CritSec)); + } + + m_currentOwner = 0; + } + LeaveCriticalSection(&m_CritSec); +} + +void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace) { + pcCrit->m_fTrace = fTrace; +} + +BOOL WINAPI CritCheckIn(CCritSec * pcCrit) { + return (GetCurrentThreadId() == pcCrit->m_currentOwner); +} + +BOOL WINAPI CritCheckIn(const CCritSec * pcCrit) { + return (GetCurrentThreadId() == pcCrit->m_currentOwner); +} + +BOOL WINAPI CritCheckOut(CCritSec * pcCrit) { + return (GetCurrentThreadId() != pcCrit->m_currentOwner); +} + +BOOL WINAPI CritCheckOut(const CCritSec * pcCrit) { + return (GetCurrentThreadId() != pcCrit->m_currentOwner); +} +#endif + +/*NABIL: I un-commented this...*/ +STDAPI WriteBSTR(BSTR *pstrDest, LPCWSTR szSrc) { + *pstrDest = SysAllocString(szSrc); + if(!(*pstrDest)) return E_OUTOFMEMORY; + return NOERROR; +} +/*END un-comment*/ + +/* +STDAPI FreeBSTR(BSTR* pstr) { + if(*pstr == NULL) return S_FALSE; + SysFreeString(*pstr); + return NOERROR; +} +*/ + +// Return a wide string - allocating memory for it +// Returns: +// S_OK - no error +// E_POINTER - ppszReturn == NULL +// E_OUTOFMEMORY - can't allocate memory for returned string +STDAPI AMGetWideString(LPCWSTR psz, LPWSTR *ppszReturn) { + CheckPointer(ppszReturn, E_POINTER); + ValidateReadWritePtr(ppszReturn, sizeof(LPWSTR)); + DWORD nameLen = sizeof(WCHAR) * (lstrlenW(psz)+1); + *ppszReturn = (LPWSTR)CoTaskMemAlloc(nameLen); + if(*ppszReturn == NULL) { + return E_OUTOFMEMORY; + } + CopyMemory(*ppszReturn, psz, nameLen); + return NOERROR; +} + +// Waits for the HANDLE hObject. While waiting messages sent +// to windows on our thread by SendMessage will be processed. +// Using this function to do waits and mutual exclusion +// avoids some deadlocks in objects with windows. +// Return codes are the same as for WaitForSingleObject +DWORD WINAPI WaitDispatchingMessages( + HANDLE hObject, + DWORD dwWait, + HWND hwnd, + UINT uMsg, + HANDLE hEvent) { + BOOL bPeeked = FALSE; + DWORD dwResult; + DWORD dwStart=0; + DWORD dwThreadPriority=0; + + static UINT uMsgId = 0; + + HANDLE hObjects[2] = { hObject, hEvent }; + if(dwWait != INFINITE && dwWait != 0) { + dwStart = GetTickCount(); + } + for(; ;) { + DWORD nCount = NULL != hEvent ? 2 : 1; + + // Minimize the chance of actually dispatching any messages + // by seeing if we can lock immediately. + dwResult = WaitForMultipleObjects(nCount, hObjects, FALSE, 0); + if(dwResult < WAIT_OBJECT_0 + nCount) { + break; + } + + DWORD dwTimeOut = dwWait; + if(dwTimeOut > 10) { + dwTimeOut = 10; + } + dwResult = MsgWaitForMultipleObjects(nCount, + hObjects, + FALSE, + dwTimeOut, + hwnd == NULL ? QS_SENDMESSAGE : + QS_SENDMESSAGE + QS_POSTMESSAGE); + if(dwResult == WAIT_OBJECT_0 + nCount || + dwResult == WAIT_TIMEOUT && dwTimeOut != dwWait) { + MSG msg; + if(hwnd != NULL) { + while(PeekMessage(&msg, hwnd, uMsg, uMsg, PM_REMOVE)) { + DispatchMessage(&msg); + } + } + // Do this anyway - the previous peek doesn't flush out the + // messages + PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); + + if(dwWait != INFINITE && dwWait != 0) { + DWORD dwNow = GetTickCount(); + + // Working with differences handles wrap-around + DWORD dwDiff = dwNow - dwStart; + if(dwDiff > dwWait) { + dwWait = 0; + } + else { + dwWait -= dwDiff; + } + dwStart = dwNow; + } + if(!bPeeked) { + // Raise our priority to prevent our message queue + // building up + dwThreadPriority = GetThreadPriority(GetCurrentThread()); + if(dwThreadPriority < THREAD_PRIORITY_HIGHEST) { + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + } + bPeeked = TRUE; + } + } + else { + break; + } + } + if(bPeeked) { + SetThreadPriority(GetCurrentThread(), dwThreadPriority); + if(HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) { + if(uMsgId == 0) { + uMsgId = RegisterWindowMessage(TEXT("AMUnblock")); + } + if(uMsgId != 0) { + MSG msg; + // Remove old ones + while(PeekMessage(&msg, (HWND)-1, uMsgId, uMsgId, PM_REMOVE)) { + } + } + PostThreadMessage(GetCurrentThreadId(), uMsgId, 0, 0); + } + } + return dwResult; +} + +HRESULT AmGetLastErrorToHResult() { + DWORD dwLastError = GetLastError(); + if(dwLastError != 0) { + return HRESULT_FROM_WIN32(dwLastError); + } + else { + return E_FAIL; + } +} + +IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp) { + if(lp != NULL) + lp->AddRef(); + if(*pp) + (*pp)->Release(); + *pp = lp; + return lp; +} + +/****************************************************************************** + +CompatibleTimeSetEvent + + CompatibleTimeSetEvent() sets the TIME_KILL_SYNCHRONOUS flag before calling +timeSetEvent() if the current operating system supports it. TIME_KILL_SYNCHRONOUS +is supported on Windows XP and later operating systems. + +Parameters: +- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in +the Platform SDK for more information. + +Return Value: +- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in +the Platform SDK for more information. + +******************************************************************************/ +MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent ) { + // + // Building for Windows XP + // ----------------------- + // If you want to target Windows XP specifically to use its new features, + // you must set WINVER=0x501 in the sample project file. You must also + // install the Windows XP Platform SDK, however, to ensure that you have the + // latest header files. For example, this CompatibleTimeSetEvent() method + // uses the new TIME_KILL_SYNCHRONOUS flag only if (WINVER >= 0x501). This flag + // is conditionally defined in the Windows XP Platform SDK in mmsystem.h, + // but only if WINVER is also set to 0x501 when compiling. To prevent build + // issues, upgrade to the latest version of the Platform SDK. + // + +#if WINVER >= 0x0501 + { + static bool fCheckedVersion = false; + static bool fTimeKillSynchronousFlagAvailable = false; + + if(!fCheckedVersion) { + fTimeKillSynchronousFlagAvailable = TimeKillSynchronousFlagAvailable(); + fCheckedVersion = true; + } + + if(fTimeKillSynchronousFlagAvailable) { + fuEvent = fuEvent | TIME_KILL_SYNCHRONOUS; + } + } +#endif // WINVER >= 0x0501 + + return timeSetEvent(uDelay, uResolution, lpTimeProc, dwUser, fuEvent); +} + +bool TimeKillSynchronousFlagAvailable( void ) { + OSVERSIONINFO osverinfo; + + osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); + + if(GetVersionEx(&osverinfo)) { + + // Windows XP's major version is 5 and its' minor version is 1. + // timeSetEvent() started supporting the TIME_KILL_SYNCHRONOUS flag + // in Windows XP. + if((osverinfo.dwMajorVersion > 5) || + ( (osverinfo.dwMajorVersion == 5) && (osverinfo.dwMinorVersion >= 1) )) { + return true; + } + } + + return false; +} + diff --git a/src/BaseClasses/wxutil.h b/src/BaseClasses/wxutil.h index 0217c404e9..92941e87dd 100644 --- a/src/BaseClasses/wxutil.h +++ b/src/BaseClasses/wxutil.h @@ -1,533 +1,533 @@ -//------------------------------------------------------------------------------ -// File: WXUtil.h -// -// Desc: DirectShow base classes - defines helper classes and functions for -// building multimedia filters. -// -// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef __WXUTIL__ -#define __WXUTIL__ - -// eliminate spurious "statement has no effect" warnings. -#pragma warning(disable: 4705) - -// wrapper for whatever critical section we have -class CCritSec { - - // make copy constructor and assignment operator inaccessible - - CCritSec(const CCritSec &refCritSec); - CCritSec &operator=(const CCritSec &refCritSec); - - CRITICAL_SECTION m_CritSec; - -#ifdef DEBUG -public: - DWORD m_currentOwner; - DWORD m_lockCount; - BOOL m_fTrace; // Trace this one -public: - CCritSec(); - ~CCritSec(); - void Lock(); - void Unlock(); -#else - -public: - CCritSec() { - InitializeCriticalSection(&m_CritSec); - }; - - ~CCritSec() { - DeleteCriticalSection(&m_CritSec); - }; - - void Lock() { - EnterCriticalSection(&m_CritSec); - }; - - void Unlock() { - LeaveCriticalSection(&m_CritSec); - }; -#endif -}; - -// -// To make deadlocks easier to track it is useful to insert in the -// code an assertion that says whether we own a critical section or -// not. We make the routines that do the checking globals to avoid -// having different numbers of member functions in the debug and -// retail class implementations of CCritSec. In addition we provide -// a routine that allows usage of specific critical sections to be -// traced. This is NOT on by default - there are far too many. -// - -#ifdef DEBUG - BOOL WINAPI CritCheckIn(CCritSec * pcCrit); - BOOL WINAPI CritCheckIn(const CCritSec * pcCrit); - BOOL WINAPI CritCheckOut(CCritSec * pcCrit); - BOOL WINAPI CritCheckOut(const CCritSec * pcCrit); - void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace); -#else - #define CritCheckIn(x) TRUE - #define CritCheckOut(x) TRUE - #define DbgLockTrace(pc, fT) -#endif - - -// locks a critical section, and unlocks it automatically -// when the lock goes out of scope -class CAutoLock { - - // make copy constructor and assignment operator inaccessible - - CAutoLock(const CAutoLock &refAutoLock); - CAutoLock &operator=(const CAutoLock &refAutoLock); - -protected: - CCritSec * m_pLock; - -public: - CAutoLock(CCritSec * plock) - { - m_pLock = plock; - m_pLock->Lock(); - }; - - ~CAutoLock() { - m_pLock->Unlock(); - }; -}; - - - -// wrapper for event objects -class CAMEvent -{ - - // make copy constructor and assignment operator inaccessible - - CAMEvent(const CAMEvent &refEvent); - CAMEvent &operator=(const CAMEvent &refEvent); - -protected: - HANDLE m_hEvent; -public: - CAMEvent(BOOL fManualReset = FALSE); - ~CAMEvent(); - - // Cast to HANDLE - we don't support this as an lvalue - operator HANDLE () const { return m_hEvent; }; - - void Set() {EXECUTE_ASSERT(SetEvent(m_hEvent));}; - BOOL Wait(DWORD dwTimeout = INFINITE) { - return (WaitForSingleObject(m_hEvent, dwTimeout) == WAIT_OBJECT_0); - }; - void Reset() { ResetEvent(m_hEvent); }; - BOOL Check() { return Wait(0); }; -}; - - -// wrapper for event objects that do message processing -// This adds ONE method to the CAMEvent object to allow sent -// messages to be processed while waiting - -class CAMMsgEvent : public CAMEvent -{ - -public: - - // Allow SEND messages to be processed while waiting - BOOL WaitMsg(DWORD dwTimeout = INFINITE); -}; - -// old name supported for the time being -#define CTimeoutEvent CAMEvent - -// support for a worker thread - -// simple thread class supports creation of worker thread, synchronization -// and communication. Can be derived to simplify parameter passing -class AM_NOVTABLE CAMThread { - - // make copy constructor and assignment operator inaccessible - - CAMThread(const CAMThread &refThread); - CAMThread &operator=(const CAMThread &refThread); - - CAMEvent m_EventSend; - CAMEvent m_EventComplete; - - DWORD m_dwParam; - DWORD m_dwReturnVal; - -protected: - HANDLE m_hThread; - - // thread will run this function on startup - // must be supplied by derived class - virtual DWORD ThreadProc() = 0; - -public: - CAMThread(); - virtual ~CAMThread(); - - CCritSec m_AccessLock; // locks access by client threads - CCritSec m_WorkerLock; // locks access to shared objects - - // thread initially runs this. param is actually 'this'. function - // just gets this and calls ThreadProc - static DWORD WINAPI InitialThreadProc(LPVOID pv); - - // start thread running - error if already running - BOOL Create(); - - // signal the thread, and block for a response - // - DWORD CallWorker(DWORD); - - // accessor thread calls this when done with thread (having told thread - // to exit) - void Close() { - HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hThread, 0); - if (hThread) { - WaitForSingleObject(hThread, INFINITE); - CloseHandle(hThread); - } - }; - - // ThreadExists - // Return TRUE if the thread exists. FALSE otherwise - BOOL ThreadExists(void) const - { - if (m_hThread == 0) { - return FALSE; - } else { - return TRUE; - } - } - - // wait for the next request - DWORD GetRequest(); - - // is there a request? - BOOL CheckRequest(DWORD * pParam); - - // reply to the request - void Reply(DWORD); - - // If you want to do WaitForMultipleObjects you'll need to include - // this handle in your wait list or you won't be responsive - HANDLE GetRequestHandle() const { return m_EventSend; }; - - // Find out what the request was - DWORD GetRequestParam() const { return m_dwParam; }; - - // call CoInitializeEx (COINIT_DISABLE_OLE1DDE) if - // available. S_FALSE means it's not available. - static HRESULT CoInitializeHelper(); -}; - - -// CQueue -// -// Implements a simple Queue ADT. The queue contains a finite number of -// objects, access to which is controlled by a semaphore. The semaphore -// is created with an initial count (N). Each time an object is added -// a call to WaitForSingleObject is made on the semaphore's handle. When -// this function returns a slot has been reserved in the queue for the new -// object. If no slots are available the function blocks until one becomes -// available. Each time an object is removed from the queue ReleaseSemaphore -// is called on the semaphore's handle, thus freeing a slot in the queue. -// If no objects are present in the queue the function blocks until an -// object has been added. - -#define DEFAULT_QUEUESIZE 2 - -template class CQueue { -private: - HANDLE hSemPut; // Semaphore controlling queue "putting" - HANDLE hSemGet; // Semaphore controlling queue "getting" - CRITICAL_SECTION CritSect; // Thread seriallization - int nMax; // Max objects allowed in queue - int iNextPut; // Array index of next "PutMsg" - int iNextGet; // Array index of next "GetMsg" - T *QueueObjects; // Array of objects (ptr's to void) - - void Initialize(int n) { - iNextPut = iNextGet = 0; - nMax = n; - InitializeCriticalSection(&CritSect); - hSemPut = CreateSemaphore(NULL, n, n, NULL); - hSemGet = CreateSemaphore(NULL, 0, n, NULL); - QueueObjects = new T[n]; - } - - -public: - CQueue(int n) { - Initialize(n); - } - - CQueue() { - Initialize(DEFAULT_QUEUESIZE); - } - - ~CQueue() { - delete [] QueueObjects; - DeleteCriticalSection(&CritSect); - CloseHandle(hSemPut); - CloseHandle(hSemGet); - } - - T GetQueueObject() { - int iSlot; - T Object; - LONG lPrevious; - - // Wait for someone to put something on our queue, returns straight - // away is there is already an object on the queue. - // - WaitForSingleObject(hSemGet, INFINITE); - - EnterCriticalSection(&CritSect); - iSlot = iNextGet++ % nMax; - Object = QueueObjects[iSlot]; - LeaveCriticalSection(&CritSect); - - // Release anyone waiting to put an object onto our queue as there - // is now space available in the queue. - // - ReleaseSemaphore(hSemPut, 1L, &lPrevious); - return Object; - } - - void PutQueueObject(T Object) { - int iSlot; - LONG lPrevious; - - // Wait for someone to get something from our queue, returns straight - // away is there is already an empty slot on the queue. - // - WaitForSingleObject(hSemPut, INFINITE); - - EnterCriticalSection(&CritSect); - iSlot = iNextPut++ % nMax; - QueueObjects[iSlot] = Object; - LeaveCriticalSection(&CritSect); - - // Release anyone waiting to remove an object from our queue as there - // is now an object available to be removed. - // - ReleaseSemaphore(hSemGet, 1L, &lPrevious); - } -}; - -// miscellaneous string conversion functions -// NOTE: as we need to use the same binaries on Win95 as on NT this code should -// be compiled WITHOUT unicode being defined. Otherwise we will not pick up -// these internal routines and the binary will not run on Win95. - -int WINAPIV wsprintfWInternal(LPWSTR, LPCWSTR, ...); - -LPWSTR -WINAPI -lstrcpyWInternal( - LPWSTR lpString1, - LPCWSTR lpString2 - ); -LPWSTR -WINAPI -lstrcpynWInternal( - LPWSTR lpString1, - LPCWSTR lpString2, - int iMaxLength - ); -int -WINAPI -lstrcmpWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ); -int -WINAPI -lstrcmpiWInternal( - LPCWSTR lpString1, - LPCWSTR lpString2 - ); -int -WINAPI -lstrlenWInternal( - LPCWSTR lpString - ); - -#ifndef UNICODE -#define wsprintfW wsprintfWInternal -#define lstrcpyW lstrcpyWInternal -#define lstrcpynW lstrcpynWInternal -#define lstrcmpW lstrcmpWInternal -#define lstrcmpiW lstrcmpiWInternal -#define lstrlenW lstrlenWInternal -#endif - -extern "C" -void * __stdcall memmoveInternal(void *, const void *, size_t); - -inline void * __cdecl memchrInternal(const void *buf, int chr, size_t cnt) -{ -#ifdef _X86_ - void *pRet = NULL; - - _asm { - cld // make sure we get the direction right - mov ecx, cnt // num of bytes to scan - mov edi, buf // pointer byte stream - mov eax, chr // byte to scan for - repne scasb // look for the byte in the byte stream - jnz exit_memchr // Z flag set if byte found - dec edi // scasb always increments edi even when it - // finds the required byte - mov pRet, edi -exit_memchr: - } - return pRet; - -#else - while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) { - buf = (unsigned char *)buf + 1; - cnt--; - } - - return(cnt ? (void *)buf : NULL); -#endif -} - -void WINAPI IntToWstr(int i, LPWSTR wstr); - -#define WstrToInt(sz) _wtoi(sz) -#define atoiW(sz) _wtoi(sz) -#define atoiA(sz) atoi(sz) - -// These are available to help managing bitmap VIDEOINFOHEADER media structures - -extern const DWORD bits555[3]; -extern const DWORD bits565[3]; -extern const DWORD bits888[3]; - -// These help convert between VIDEOINFOHEADER and BITMAPINFO structures - -STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader); -STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader); -STDAPI_(WORD) GetBitCount(const GUID *pSubtype); - -// strmbase.lib implements this for compatibility with people who -// managed to link to this directly. we don't want to advertise it. -// -// STDAPI_(/* T */ CHAR *) GetSubtypeName(const GUID *pSubtype); - -STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype); -STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype); - -#ifdef UNICODE -#define GetSubtypeName GetSubtypeNameW -#else -#define GetSubtypeName GetSubtypeNameA -#endif - -STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader); -STDAPI_(DWORD) GetBitmapSize(const BITMAPINFOHEADER *pHeader); -STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo); -STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo); - - -// Compares two interfaces and returns TRUE if they are on the same object -BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond); - -// This is for comparing pins -#define EqualPins(pPin1, pPin2) IsEqualObject(pPin1, pPin2) - - -// Arithmetic helper functions - -// Compute (a * b + rnd) / c -LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG rnd); -LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG rnd); - - -// Avoids us dyna-linking to SysAllocString to copy BSTR strings -STDAPI WriteBSTR(BSTR * pstrDest, LPCWSTR szSrc); -STDAPI FreeBSTR(BSTR* pstr); - -// Return a wide string - allocating memory for it -// Returns: -// S_OK - no error -// E_POINTER - ppszReturn == NULL -// E_OUTOFMEMORY - can't allocate memory for returned string -STDAPI AMGetWideString(LPCWSTR pszString, LPWSTR *ppszReturn); - -// Special wait for objects owning windows -DWORD WINAPI WaitDispatchingMessages( - HANDLE hObject, - DWORD dwWait, - HWND hwnd = NULL, - UINT uMsg = 0, - HANDLE hEvent = NULL); - -// HRESULT_FROM_WIN32 converts ERROR_SUCCESS to a success code, but in -// our use of HRESULT_FROM_WIN32, it typically means a function failed -// to call SetLastError(), and we still want a failure code. -// -#define AmHresultFromWin32(x) (MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, x)) - -// call GetLastError and return an HRESULT value that will fail the -// SUCCEEDED() macro. -HRESULT AmGetLastErrorToHResult(void); - -// duplicate of ATL's CComPtr to avoid linker conflicts. - -IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp); - -template -class QzCComPtr -{ -public: - typedef T _PtrClass; - QzCComPtr() {p=NULL;} - QzCComPtr(T* lp) - { - if ((p = lp) != NULL) - p->AddRef(); - } - QzCComPtr(const QzCComPtr& lp) - { - if ((p = lp.p) != NULL) - p->AddRef(); - } - ~QzCComPtr() {if (p) p->Release();} - void Release() {if (p) p->Release(); p=NULL;} - operator T*() {return (T*)p;} - T& operator*() {ASSERT(p!=NULL); return *p; } - //The assert on operator& usually indicates a bug. If this is really - //what is needed, however, take the address of the p member explicitly. - T** operator&() { ASSERT(p==NULL); return &p; } - T* operator->() { ASSERT(p!=NULL); return p; } - T* operator=(T* lp){return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp);} - T* operator=(const QzCComPtr& lp) - { - return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp.p); - } -#if _MSC_VER>1020 - bool operator!(){return (p == NULL);} -#else - BOOL operator!(){return (p == NULL) ? TRUE : FALSE;} -#endif - T* p; -}; - -MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent ); -bool TimeKillSynchronousFlagAvailable( void ); - -#endif /* __WXUTIL__ */ +//------------------------------------------------------------------------------ +// File: WXUtil.h +// +// Desc: DirectShow base classes - defines helper classes and functions for +// building multimedia filters. +// +// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef __WXUTIL__ +#define __WXUTIL__ + +// eliminate spurious "statement has no effect" warnings. +#pragma warning(disable: 4705) + +// wrapper for whatever critical section we have +class CCritSec { + + // make copy constructor and assignment operator inaccessible + + CCritSec(const CCritSec &refCritSec); + CCritSec &operator=(const CCritSec &refCritSec); + + CRITICAL_SECTION m_CritSec; + +#ifdef DEBUG +public: + DWORD m_currentOwner; + DWORD m_lockCount; + BOOL m_fTrace; // Trace this one +public: + CCritSec(); + ~CCritSec(); + void Lock(); + void Unlock(); +#else + +public: + CCritSec() { + InitializeCriticalSection(&m_CritSec); + }; + + ~CCritSec() { + DeleteCriticalSection(&m_CritSec); + }; + + void Lock() { + EnterCriticalSection(&m_CritSec); + }; + + void Unlock() { + LeaveCriticalSection(&m_CritSec); + }; +#endif +}; + +// +// To make deadlocks easier to track it is useful to insert in the +// code an assertion that says whether we own a critical section or +// not. We make the routines that do the checking globals to avoid +// having different numbers of member functions in the debug and +// retail class implementations of CCritSec. In addition we provide +// a routine that allows usage of specific critical sections to be +// traced. This is NOT on by default - there are far too many. +// + +#ifdef DEBUG + BOOL WINAPI CritCheckIn(CCritSec * pcCrit); + BOOL WINAPI CritCheckIn(const CCritSec * pcCrit); + BOOL WINAPI CritCheckOut(CCritSec * pcCrit); + BOOL WINAPI CritCheckOut(const CCritSec * pcCrit); + void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace); +#else + #define CritCheckIn(x) TRUE + #define CritCheckOut(x) TRUE + #define DbgLockTrace(pc, fT) +#endif + + +// locks a critical section, and unlocks it automatically +// when the lock goes out of scope +class CAutoLock { + + // make copy constructor and assignment operator inaccessible + + CAutoLock(const CAutoLock &refAutoLock); + CAutoLock &operator=(const CAutoLock &refAutoLock); + +protected: + CCritSec * m_pLock; + +public: + CAutoLock(CCritSec * plock) + { + m_pLock = plock; + m_pLock->Lock(); + }; + + ~CAutoLock() { + m_pLock->Unlock(); + }; +}; + + + +// wrapper for event objects +class CAMEvent +{ + + // make copy constructor and assignment operator inaccessible + + CAMEvent(const CAMEvent &refEvent); + CAMEvent &operator=(const CAMEvent &refEvent); + +protected: + HANDLE m_hEvent; +public: + CAMEvent(BOOL fManualReset = FALSE); + ~CAMEvent(); + + // Cast to HANDLE - we don't support this as an lvalue + operator HANDLE () const { return m_hEvent; }; + + void Set() {EXECUTE_ASSERT(SetEvent(m_hEvent));}; + BOOL Wait(DWORD dwTimeout = INFINITE) { + return (WaitForSingleObject(m_hEvent, dwTimeout) == WAIT_OBJECT_0); + }; + void Reset() { ResetEvent(m_hEvent); }; + BOOL Check() { return Wait(0); }; +}; + + +// wrapper for event objects that do message processing +// This adds ONE method to the CAMEvent object to allow sent +// messages to be processed while waiting + +class CAMMsgEvent : public CAMEvent +{ + +public: + + // Allow SEND messages to be processed while waiting + BOOL WaitMsg(DWORD dwTimeout = INFINITE); +}; + +// old name supported for the time being +#define CTimeoutEvent CAMEvent + +// support for a worker thread + +// simple thread class supports creation of worker thread, synchronization +// and communication. Can be derived to simplify parameter passing +class AM_NOVTABLE CAMThread { + + // make copy constructor and assignment operator inaccessible + + CAMThread(const CAMThread &refThread); + CAMThread &operator=(const CAMThread &refThread); + + CAMEvent m_EventSend; + CAMEvent m_EventComplete; + + DWORD m_dwParam; + DWORD m_dwReturnVal; + +protected: + HANDLE m_hThread; + + // thread will run this function on startup + // must be supplied by derived class + virtual DWORD ThreadProc() = 0; + +public: + CAMThread(); + virtual ~CAMThread(); + + CCritSec m_AccessLock; // locks access by client threads + CCritSec m_WorkerLock; // locks access to shared objects + + // thread initially runs this. param is actually 'this'. function + // just gets this and calls ThreadProc + static DWORD WINAPI InitialThreadProc(LPVOID pv); + + // start thread running - error if already running + BOOL Create(); + + // signal the thread, and block for a response + // + DWORD CallWorker(DWORD); + + // accessor thread calls this when done with thread (having told thread + // to exit) + void Close() { + HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hThread, 0); + if (hThread) { + WaitForSingleObject(hThread, INFINITE); + CloseHandle(hThread); + } + }; + + // ThreadExists + // Return TRUE if the thread exists. FALSE otherwise + BOOL ThreadExists(void) const + { + if (m_hThread == 0) { + return FALSE; + } else { + return TRUE; + } + } + + // wait for the next request + DWORD GetRequest(); + + // is there a request? + BOOL CheckRequest(DWORD * pParam); + + // reply to the request + void Reply(DWORD); + + // If you want to do WaitForMultipleObjects you'll need to include + // this handle in your wait list or you won't be responsive + HANDLE GetRequestHandle() const { return m_EventSend; }; + + // Find out what the request was + DWORD GetRequestParam() const { return m_dwParam; }; + + // call CoInitializeEx (COINIT_DISABLE_OLE1DDE) if + // available. S_FALSE means it's not available. + static HRESULT CoInitializeHelper(); +}; + + +// CQueue +// +// Implements a simple Queue ADT. The queue contains a finite number of +// objects, access to which is controlled by a semaphore. The semaphore +// is created with an initial count (N). Each time an object is added +// a call to WaitForSingleObject is made on the semaphore's handle. When +// this function returns a slot has been reserved in the queue for the new +// object. If no slots are available the function blocks until one becomes +// available. Each time an object is removed from the queue ReleaseSemaphore +// is called on the semaphore's handle, thus freeing a slot in the queue. +// If no objects are present in the queue the function blocks until an +// object has been added. + +#define DEFAULT_QUEUESIZE 2 + +template class CQueue { +private: + HANDLE hSemPut; // Semaphore controlling queue "putting" + HANDLE hSemGet; // Semaphore controlling queue "getting" + CRITICAL_SECTION CritSect; // Thread seriallization + int nMax; // Max objects allowed in queue + int iNextPut; // Array index of next "PutMsg" + int iNextGet; // Array index of next "GetMsg" + T *QueueObjects; // Array of objects (ptr's to void) + + void Initialize(int n) { + iNextPut = iNextGet = 0; + nMax = n; + InitializeCriticalSection(&CritSect); + hSemPut = CreateSemaphore(NULL, n, n, NULL); + hSemGet = CreateSemaphore(NULL, 0, n, NULL); + QueueObjects = new T[n]; + } + + +public: + CQueue(int n) { + Initialize(n); + } + + CQueue() { + Initialize(DEFAULT_QUEUESIZE); + } + + ~CQueue() { + delete [] QueueObjects; + DeleteCriticalSection(&CritSect); + CloseHandle(hSemPut); + CloseHandle(hSemGet); + } + + T GetQueueObject() { + int iSlot; + T Object; + LONG lPrevious; + + // Wait for someone to put something on our queue, returns straight + // away is there is already an object on the queue. + // + WaitForSingleObject(hSemGet, INFINITE); + + EnterCriticalSection(&CritSect); + iSlot = iNextGet++ % nMax; + Object = QueueObjects[iSlot]; + LeaveCriticalSection(&CritSect); + + // Release anyone waiting to put an object onto our queue as there + // is now space available in the queue. + // + ReleaseSemaphore(hSemPut, 1L, &lPrevious); + return Object; + } + + void PutQueueObject(T Object) { + int iSlot; + LONG lPrevious; + + // Wait for someone to get something from our queue, returns straight + // away is there is already an empty slot on the queue. + // + WaitForSingleObject(hSemPut, INFINITE); + + EnterCriticalSection(&CritSect); + iSlot = iNextPut++ % nMax; + QueueObjects[iSlot] = Object; + LeaveCriticalSection(&CritSect); + + // Release anyone waiting to remove an object from our queue as there + // is now an object available to be removed. + // + ReleaseSemaphore(hSemGet, 1L, &lPrevious); + } +}; + +// miscellaneous string conversion functions +// NOTE: as we need to use the same binaries on Win95 as on NT this code should +// be compiled WITHOUT unicode being defined. Otherwise we will not pick up +// these internal routines and the binary will not run on Win95. + +int WINAPIV wsprintfWInternal(LPWSTR, LPCWSTR, ...); + +LPWSTR +WINAPI +lstrcpyWInternal( + LPWSTR lpString1, + LPCWSTR lpString2 + ); +LPWSTR +WINAPI +lstrcpynWInternal( + LPWSTR lpString1, + LPCWSTR lpString2, + int iMaxLength + ); +int +WINAPI +lstrcmpWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ); +int +WINAPI +lstrcmpiWInternal( + LPCWSTR lpString1, + LPCWSTR lpString2 + ); +int +WINAPI +lstrlenWInternal( + LPCWSTR lpString + ); + +#ifndef UNICODE +#define wsprintfW wsprintfWInternal +#define lstrcpyW lstrcpyWInternal +#define lstrcpynW lstrcpynWInternal +#define lstrcmpW lstrcmpWInternal +#define lstrcmpiW lstrcmpiWInternal +#define lstrlenW lstrlenWInternal +#endif + +extern "C" +void * __stdcall memmoveInternal(void *, const void *, size_t); + +inline void * __cdecl memchrInternal(const void *buf, int chr, size_t cnt) +{ +#ifdef _X86_ + void *pRet = NULL; + + _asm { + cld // make sure we get the direction right + mov ecx, cnt // num of bytes to scan + mov edi, buf // pointer byte stream + mov eax, chr // byte to scan for + repne scasb // look for the byte in the byte stream + jnz exit_memchr // Z flag set if byte found + dec edi // scasb always increments edi even when it + // finds the required byte + mov pRet, edi +exit_memchr: + } + return pRet; + +#else + while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) { + buf = (unsigned char *)buf + 1; + cnt--; + } + + return(cnt ? (void *)buf : NULL); +#endif +} + +void WINAPI IntToWstr(int i, LPWSTR wstr); + +#define WstrToInt(sz) _wtoi(sz) +#define atoiW(sz) _wtoi(sz) +#define atoiA(sz) atoi(sz) + +// These are available to help managing bitmap VIDEOINFOHEADER media structures + +extern const DWORD bits555[3]; +extern const DWORD bits565[3]; +extern const DWORD bits888[3]; + +// These help convert between VIDEOINFOHEADER and BITMAPINFO structures + +STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader); +STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader); +STDAPI_(WORD) GetBitCount(const GUID *pSubtype); + +// strmbase.lib implements this for compatibility with people who +// managed to link to this directly. we don't want to advertise it. +// +// STDAPI_(/* T */ CHAR *) GetSubtypeName(const GUID *pSubtype); + +STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype); +STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype); + +#ifdef UNICODE +#define GetSubtypeName GetSubtypeNameW +#else +#define GetSubtypeName GetSubtypeNameA +#endif + +STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader); +STDAPI_(DWORD) GetBitmapSize(const BITMAPINFOHEADER *pHeader); +STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo); +STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo); + + +// Compares two interfaces and returns TRUE if they are on the same object +BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond); + +// This is for comparing pins +#define EqualPins(pPin1, pPin2) IsEqualObject(pPin1, pPin2) + + +// Arithmetic helper functions + +// Compute (a * b + rnd) / c +LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG rnd); +LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG rnd); + + +// Avoids us dyna-linking to SysAllocString to copy BSTR strings +STDAPI WriteBSTR(BSTR * pstrDest, LPCWSTR szSrc); +STDAPI FreeBSTR(BSTR* pstr); + +// Return a wide string - allocating memory for it +// Returns: +// S_OK - no error +// E_POINTER - ppszReturn == NULL +// E_OUTOFMEMORY - can't allocate memory for returned string +STDAPI AMGetWideString(LPCWSTR pszString, LPWSTR *ppszReturn); + +// Special wait for objects owning windows +DWORD WINAPI WaitDispatchingMessages( + HANDLE hObject, + DWORD dwWait, + HWND hwnd = NULL, + UINT uMsg = 0, + HANDLE hEvent = NULL); + +// HRESULT_FROM_WIN32 converts ERROR_SUCCESS to a success code, but in +// our use of HRESULT_FROM_WIN32, it typically means a function failed +// to call SetLastError(), and we still want a failure code. +// +#define AmHresultFromWin32(x) (MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, x)) + +// call GetLastError and return an HRESULT value that will fail the +// SUCCEEDED() macro. +HRESULT AmGetLastErrorToHResult(void); + +// duplicate of ATL's CComPtr to avoid linker conflicts. + +IUnknown* QzAtlComPtrAssign(IUnknown** pp, IUnknown* lp); + +template +class QzCComPtr +{ +public: + typedef T _PtrClass; + QzCComPtr() {p=NULL;} + QzCComPtr(T* lp) + { + if ((p = lp) != NULL) + p->AddRef(); + } + QzCComPtr(const QzCComPtr& lp) + { + if ((p = lp.p) != NULL) + p->AddRef(); + } + ~QzCComPtr() {if (p) p->Release();} + void Release() {if (p) p->Release(); p=NULL;} + operator T*() {return (T*)p;} + T& operator*() {ASSERT(p!=NULL); return *p; } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the p member explicitly. + T** operator&() { ASSERT(p==NULL); return &p; } + T* operator->() { ASSERT(p!=NULL); return p; } + T* operator=(T* lp){return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp);} + T* operator=(const QzCComPtr& lp) + { + return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp.p); + } +#if _MSC_VER>1020 + bool operator!(){return (p == NULL);} +#else + BOOL operator!(){return (p == NULL) ? TRUE : FALSE;} +#endif + T* p; +}; + +MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent ); +bool TimeKillSynchronousFlagAvailable( void ); + +#endif /* __WXUTIL__ */ diff --git a/src/BeginnerHelper.cpp b/src/BeginnerHelper.cpp index 1154b0b96c..f696ad108c 100644 --- a/src/BeginnerHelper.cpp +++ b/src/BeginnerHelper.cpp @@ -1,396 +1,396 @@ -#include "global.h" - -#include "ActorUtil.h" -#include "BeginnerHelper.h" -#include "GameState.h" -#include "PrefsManager.h" -#include "RageLog.h" -#include "RageDisplay.h" -#include "Steps.h" -#include "Style.h" -#include "Model.h" -#include "ScreenDimensions.h" -#include "ThemeManager.h" - -// "PLAYER_X" offsets are relative to the pad.. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310 -#define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1)) -#define PLAYER_ANGLE THEME->GetMetricF("BeginnerHelper","PlayerAngle") -#define DANCEPAD_ANGLE THEME->GetMetricF("BeginnerHelper","DancePadAngle") - -// "HELPER" offsets effect the pad/dancer as a whole.. Their relative Y cooridinates are hard-coded for eachother. -#define HELPER_X THEME->GetMetricF("BeginnerHelper","HelperX") -#define HELPER_Y THEME->GetMetricF("BeginnerHelper","HelperY") - -#define ST_LEFT 0x01 -#define ST_DOWN 0x02 -#define ST_UP 0x04 -#define ST_RIGHT 0x08 -#define ST_JUMPLR (ST_LEFT | ST_RIGHT) -#define ST_JUMPUD (ST_UP | ST_DOWN) - -enum Animation -{ - ANIM_DANCE_PAD, - ANIM_DANCE_PADS, - ANIM_UP, - ANIM_DOWN, - ANIM_LEFT, - ANIM_RIGHT, - ANIM_JUMPLR, - NUM_ANIMATIONS -}; - -static const char *anims[NUM_ANIMATIONS] = -{ - "DancePad.txt", - "DancePads.txt", - "BeginnerHelper_step-up.bones.txt", - "BeginnerHelper_step-down.bones.txt", - "BeginnerHelper_step-left.bones.txt", - "BeginnerHelper_step-right.bones.txt", - "BeginnerHelper_step-jumplr.bones.txt" -}; - -static RString GetAnimPath( Animation a ) -{ - return RString( "Characters/" ) + anims[a]; -} - -BeginnerHelper::BeginnerHelper() -{ - m_bShowBackground = true; - m_bInitialized = false; - m_iLastRowChecked = m_iLastRowFlashed = 0; - FOREACH_PlayerNumber( pn ) - m_bPlayerEnabled[pn] = false; - FOREACH_PlayerNumber( pn ) - m_pDancer[pn] = new Model; - m_pDancePad = new Model; -} - -BeginnerHelper::~BeginnerHelper() -{ - FOREACH_PlayerNumber( pn ) - delete m_pDancer[pn]; - delete m_pDancePad; -} - -void BeginnerHelper::ShowStepCircle( PlayerNumber pn, int CSTEP ) -{ - int isc=0; // Save OR issues within array boundries.. it's worth the extra few bytes of memory. - switch(CSTEP) - { - case ST_LEFT: isc=0; break; - case ST_RIGHT: isc=1; break; - case ST_UP: isc=2; break; - case ST_DOWN: isc=3; break; - } - - m_sStepCircle[pn][isc].StopEffect(); - m_sStepCircle[pn][isc].SetZoom( 2 ); - m_sStepCircle[pn][isc].StopTweening(); - m_sStepCircle[pn][isc].BeginTweening( GAMESTATE->m_fCurBPS/3, TWEEN_LINEAR ); - m_sStepCircle[pn][isc].SetZoom( 0 ); -} - -void BeginnerHelper::AddPlayer( PlayerNumber pn, const NoteData &ns ) -{ - ASSERT( !m_bInitialized ); - ASSERT( pn >= 0 && pn < NUM_PLAYERS ); - ASSERT( GAMESTATE->IsHumanPlayer(pn) ); - - if( !CanUse() ) - return; - - const Character *Character = GAMESTATE->m_pCurCharacters[pn]; - ASSERT( Character != NULL ); - if( !DoesFileExist(Character->GetModelPath()) ) - return; - - m_NoteData[pn].CopyAll( ns ); - m_bPlayerEnabled[pn] = true; -} - -bool BeginnerHelper::CanUse() -{ - for (int i=0; iGetCurrentStyle()->m_bCanUseBeginnerHelper; -} - -bool BeginnerHelper::Initialize( int iDancePadType ) -{ - ASSERT( !m_bInitialized ); - if( !CanUse() ) - return false; - - // If no players were successfully added, bail. - { - bool bAnyLoaded = false; - for( int pn=0; pnGetPathG("BeginnerHelper","background") ); - this->AddChild( &m_sBackground ); - m_sBackground.SetXY( 1, 1 ); - m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") ); - m_sFlash.SetXY( 0, 0 ); - m_sFlash.SetDiffuseAlpha( 0 ); - } - - // Load StepCircle graphics - for( int lsc=0; lscGetPathG("BeginnerHelper","stepcircle") ); - m_sStepCircle[lsc][lsce].SetZoom( 0 ); // Hide until needed. - this->AddChild(&m_sStepCircle[lsc][lsce]); - - // Set coordinates of StepCircle - switch( lsce ) - { - case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y); break; // Left - case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y); break; // Right - case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60)); break; // Up - case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60)); break; // Down - } - } - } - - // Load the DancePad - switch( iDancePadType ) - { - case 0: break; // No pad - case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break; - case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break; - } - - m_pDancePad->SetHorizAlign( align_left ); - m_pDancePad->SetRotationX( DANCEPAD_ANGLE ); - m_pDancePad->SetX( HELPER_X ); - m_pDancePad->SetY( HELPER_Y ); - m_pDancePad->SetZoom( 23 ); // Pad should always be 3 units bigger in zoom than the dancer. - - for( int pl=0; plm_pCurCharacters[pl]; - ASSERT( Character != NULL ); - - // Load textures - m_pDancer[pl]->SetHorizAlign( align_left ); - m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() ); - - // Load needed animations - m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath(ANIM_LEFT) ); - m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath(ANIM_DOWN) ); - m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath(ANIM_UP) ); - m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath(ANIM_RIGHT) ); - m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath(ANIM_JUMPLR) ); - m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest", Character->GetRestAnimationPath() ); - m_pDancer[pl]->SetDefaultAnimation( "rest" ); // Stay bouncing after a step has finished animating - m_pDancer[pl]->PlayAnimation( "rest" ); - m_pDancer[pl]->SetRotationX( PLAYER_ANGLE ); - m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) ); - m_pDancer[pl]->SetY( HELPER_Y+10 ); - m_pDancer[pl]->SetZoom( 20 ); - m_pDancer[pl]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped - } - - m_bInitialized = true; - return true; -} - -void BeginnerHelper::DrawPrimitives() -{ - // If not initialized, don't bother with this - if( !m_bInitialized ) - return; - - ActorFrame::DrawPrimitives(); - m_sFlash.Draw(); - - bool DrawCelShaded = PREFSMAN->m_bCelShadeModels; - if( DrawCelShaded ) - m_pDancePad->DrawCelShaded(); - else - { - DISPLAY->SetLighting( true ); - DISPLAY->SetLightDirectional( - 0, - RageColor(0.5,0.5,0.5,1), - RageColor(1,1,1,1), - RageColor(0,0,0,1), - RageVector3(0, 0, 1) ); - - m_pDancePad->Draw(); - DISPLAY->ClearZBuffer(); // So character doesn't step "into" the dance pad. - DISPLAY->SetLightOff( 0 ); - DISPLAY->SetLighting( false ); - } - - // Draw StepCircles - for(int scd=0; scdIsHumanPlayer(pn) ) - m_pDancer[pn]->DrawCelShaded(); - } - else - { - DISPLAY->SetLighting( true ); - DISPLAY->SetLightDirectional( - 0, - RageColor(0.5,0.5,0.5,1), - RageColor(1,1,1,1), - RageColor(0,0,0,1), - RageVector3(0, 0, 1) ); - - FOREACH_PlayerNumber( pn ) // Draw each dancer - if( GAMESTATE->IsHumanPlayer(pn) ) - m_pDancer[pn]->Draw(); - - DISPLAY->SetLightOff( 0 ); - DISPLAY->SetLighting( false ); - } -} - -void BeginnerHelper::Step( PlayerNumber pn, int CSTEP ) -{ - m_pDancer[pn]->StopTweening(); - m_pDancer[pn]->SetRotationY( 0 ); // Make sure we're not still inside of a JUMPUD tween. - - switch(CSTEP) - { - case ST_LEFT: - ShowStepCircle( pn, ST_LEFT ); - m_pDancer[pn]->PlayAnimation( "Step-LEFT", 1.5f ); - break; - case ST_RIGHT: - ShowStepCircle( pn, ST_RIGHT ); - m_pDancer[pn]->PlayAnimation( "Step-RIGHT", 1.5f ); - break; - case ST_UP: - ShowStepCircle( pn, ST_UP ); - m_pDancer[pn]->PlayAnimation( "Step-UP", 1.5f ); - break; - case ST_DOWN: - ShowStepCircle( pn, ST_DOWN ); - m_pDancer[pn]->PlayAnimation( "Step-DOWN", 1.5f ); - break; - case ST_JUMPLR: - ShowStepCircle( pn, ST_LEFT ); - ShowStepCircle( pn, ST_RIGHT ); - m_pDancer[pn]->PlayAnimation( "Step-JUMPLR", 1.5f ); - break; - case ST_JUMPUD: - ShowStepCircle( pn, ST_UP ); - ShowStepCircle( pn, ST_DOWN ); - m_pDancer[pn]->StopTweening(); - m_pDancer[pn]->PlayAnimation( "Step-JUMPLR", 1.5f ); - m_pDancer[pn]->BeginTweening( GAMESTATE->m_fCurBPS/8, TWEEN_LINEAR ); - m_pDancer[pn]->SetRotationY( 90 ); - m_pDancer[pn]->BeginTweening( 1/(GAMESTATE->m_fCurBPS * 2) ); //sleep between jump-frames - m_pDancer[pn]->BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR ); - m_pDancer[pn]->SetRotationY( 0 ); - break; - } - - m_sFlash.StopEffect(); - m_sFlash.StopTweening(); - m_sFlash.Sleep( GAMESTATE->m_fCurBPS/16 ); - m_sFlash.SetDiffuseAlpha( 1 ); - m_sFlash.BeginTweening( 1/GAMESTATE->m_fCurBPS * 0.5f ); - m_sFlash.SetDiffuseAlpha( 0 ); -} - -void BeginnerHelper::Update( float fDeltaTime ) -{ - if( !m_bInitialized ) - return; - - // the row we want to check on this update - int iCurRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat + 0.4f ); - FOREACH_EnabledPlayer( pn ) - { - for( int iRow=m_iLastRowChecked; iRowStep( pn, iStep ); - } - } - - // Make sure we don't accidentally scan a row 2x - m_iLastRowChecked = iCurRow; - - // Update animations - ActorFrame::Update( fDeltaTime ); - m_pDancePad->Update( fDeltaTime ); - m_sFlash.Update( fDeltaTime ); - - float beat = fDeltaTime*GAMESTATE->m_fCurBPS; - // If this is not a human player, the dancer is not shown - FOREACH_HumanPlayer( pu ) - { - // Update dancer's animation and StepCircles - m_pDancer[pu]->Update( beat ); - for( int scu=0; scuGetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1)) +#define PLAYER_ANGLE THEME->GetMetricF("BeginnerHelper","PlayerAngle") +#define DANCEPAD_ANGLE THEME->GetMetricF("BeginnerHelper","DancePadAngle") + +// "HELPER" offsets effect the pad/dancer as a whole.. Their relative Y cooridinates are hard-coded for eachother. +#define HELPER_X THEME->GetMetricF("BeginnerHelper","HelperX") +#define HELPER_Y THEME->GetMetricF("BeginnerHelper","HelperY") + +#define ST_LEFT 0x01 +#define ST_DOWN 0x02 +#define ST_UP 0x04 +#define ST_RIGHT 0x08 +#define ST_JUMPLR (ST_LEFT | ST_RIGHT) +#define ST_JUMPUD (ST_UP | ST_DOWN) + +enum Animation +{ + ANIM_DANCE_PAD, + ANIM_DANCE_PADS, + ANIM_UP, + ANIM_DOWN, + ANIM_LEFT, + ANIM_RIGHT, + ANIM_JUMPLR, + NUM_ANIMATIONS +}; + +static const char *anims[NUM_ANIMATIONS] = +{ + "DancePad.txt", + "DancePads.txt", + "BeginnerHelper_step-up.bones.txt", + "BeginnerHelper_step-down.bones.txt", + "BeginnerHelper_step-left.bones.txt", + "BeginnerHelper_step-right.bones.txt", + "BeginnerHelper_step-jumplr.bones.txt" +}; + +static RString GetAnimPath( Animation a ) +{ + return RString( "Characters/" ) + anims[a]; +} + +BeginnerHelper::BeginnerHelper() +{ + m_bShowBackground = true; + m_bInitialized = false; + m_iLastRowChecked = m_iLastRowFlashed = 0; + FOREACH_PlayerNumber( pn ) + m_bPlayerEnabled[pn] = false; + FOREACH_PlayerNumber( pn ) + m_pDancer[pn] = new Model; + m_pDancePad = new Model; +} + +BeginnerHelper::~BeginnerHelper() +{ + FOREACH_PlayerNumber( pn ) + delete m_pDancer[pn]; + delete m_pDancePad; +} + +void BeginnerHelper::ShowStepCircle( PlayerNumber pn, int CSTEP ) +{ + int isc=0; // Save OR issues within array boundries.. it's worth the extra few bytes of memory. + switch(CSTEP) + { + case ST_LEFT: isc=0; break; + case ST_RIGHT: isc=1; break; + case ST_UP: isc=2; break; + case ST_DOWN: isc=3; break; + } + + m_sStepCircle[pn][isc].StopEffect(); + m_sStepCircle[pn][isc].SetZoom( 2 ); + m_sStepCircle[pn][isc].StopTweening(); + m_sStepCircle[pn][isc].BeginTweening( GAMESTATE->m_fCurBPS/3, TWEEN_LINEAR ); + m_sStepCircle[pn][isc].SetZoom( 0 ); +} + +void BeginnerHelper::AddPlayer( PlayerNumber pn, const NoteData &ns ) +{ + ASSERT( !m_bInitialized ); + ASSERT( pn >= 0 && pn < NUM_PLAYERS ); + ASSERT( GAMESTATE->IsHumanPlayer(pn) ); + + if( !CanUse() ) + return; + + const Character *Character = GAMESTATE->m_pCurCharacters[pn]; + ASSERT( Character != NULL ); + if( !DoesFileExist(Character->GetModelPath()) ) + return; + + m_NoteData[pn].CopyAll( ns ); + m_bPlayerEnabled[pn] = true; +} + +bool BeginnerHelper::CanUse() +{ + for (int i=0; iGetCurrentStyle()->m_bCanUseBeginnerHelper; +} + +bool BeginnerHelper::Initialize( int iDancePadType ) +{ + ASSERT( !m_bInitialized ); + if( !CanUse() ) + return false; + + // If no players were successfully added, bail. + { + bool bAnyLoaded = false; + for( int pn=0; pnGetPathG("BeginnerHelper","background") ); + this->AddChild( &m_sBackground ); + m_sBackground.SetXY( 1, 1 ); + m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") ); + m_sFlash.SetXY( 0, 0 ); + m_sFlash.SetDiffuseAlpha( 0 ); + } + + // Load StepCircle graphics + for( int lsc=0; lscGetPathG("BeginnerHelper","stepcircle") ); + m_sStepCircle[lsc][lsce].SetZoom( 0 ); // Hide until needed. + this->AddChild(&m_sStepCircle[lsc][lsce]); + + // Set coordinates of StepCircle + switch( lsce ) + { + case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y); break; // Left + case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y); break; // Right + case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60)); break; // Up + case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60)); break; // Down + } + } + } + + // Load the DancePad + switch( iDancePadType ) + { + case 0: break; // No pad + case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break; + case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break; + } + + m_pDancePad->SetHorizAlign( align_left ); + m_pDancePad->SetRotationX( DANCEPAD_ANGLE ); + m_pDancePad->SetX( HELPER_X ); + m_pDancePad->SetY( HELPER_Y ); + m_pDancePad->SetZoom( 23 ); // Pad should always be 3 units bigger in zoom than the dancer. + + for( int pl=0; plm_pCurCharacters[pl]; + ASSERT( Character != NULL ); + + // Load textures + m_pDancer[pl]->SetHorizAlign( align_left ); + m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() ); + + // Load needed animations + m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath(ANIM_LEFT) ); + m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath(ANIM_DOWN) ); + m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath(ANIM_UP) ); + m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath(ANIM_RIGHT) ); + m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath(ANIM_JUMPLR) ); + m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest", Character->GetRestAnimationPath() ); + m_pDancer[pl]->SetDefaultAnimation( "rest" ); // Stay bouncing after a step has finished animating + m_pDancer[pl]->PlayAnimation( "rest" ); + m_pDancer[pl]->SetRotationX( PLAYER_ANGLE ); + m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) ); + m_pDancer[pl]->SetY( HELPER_Y+10 ); + m_pDancer[pl]->SetZoom( 20 ); + m_pDancer[pl]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped + } + + m_bInitialized = true; + return true; +} + +void BeginnerHelper::DrawPrimitives() +{ + // If not initialized, don't bother with this + if( !m_bInitialized ) + return; + + ActorFrame::DrawPrimitives(); + m_sFlash.Draw(); + + bool DrawCelShaded = PREFSMAN->m_bCelShadeModels; + if( DrawCelShaded ) + m_pDancePad->DrawCelShaded(); + else + { + DISPLAY->SetLighting( true ); + DISPLAY->SetLightDirectional( + 0, + RageColor(0.5,0.5,0.5,1), + RageColor(1,1,1,1), + RageColor(0,0,0,1), + RageVector3(0, 0, 1) ); + + m_pDancePad->Draw(); + DISPLAY->ClearZBuffer(); // So character doesn't step "into" the dance pad. + DISPLAY->SetLightOff( 0 ); + DISPLAY->SetLighting( false ); + } + + // Draw StepCircles + for(int scd=0; scdIsHumanPlayer(pn) ) + m_pDancer[pn]->DrawCelShaded(); + } + else + { + DISPLAY->SetLighting( true ); + DISPLAY->SetLightDirectional( + 0, + RageColor(0.5,0.5,0.5,1), + RageColor(1,1,1,1), + RageColor(0,0,0,1), + RageVector3(0, 0, 1) ); + + FOREACH_PlayerNumber( pn ) // Draw each dancer + if( GAMESTATE->IsHumanPlayer(pn) ) + m_pDancer[pn]->Draw(); + + DISPLAY->SetLightOff( 0 ); + DISPLAY->SetLighting( false ); + } +} + +void BeginnerHelper::Step( PlayerNumber pn, int CSTEP ) +{ + m_pDancer[pn]->StopTweening(); + m_pDancer[pn]->SetRotationY( 0 ); // Make sure we're not still inside of a JUMPUD tween. + + switch(CSTEP) + { + case ST_LEFT: + ShowStepCircle( pn, ST_LEFT ); + m_pDancer[pn]->PlayAnimation( "Step-LEFT", 1.5f ); + break; + case ST_RIGHT: + ShowStepCircle( pn, ST_RIGHT ); + m_pDancer[pn]->PlayAnimation( "Step-RIGHT", 1.5f ); + break; + case ST_UP: + ShowStepCircle( pn, ST_UP ); + m_pDancer[pn]->PlayAnimation( "Step-UP", 1.5f ); + break; + case ST_DOWN: + ShowStepCircle( pn, ST_DOWN ); + m_pDancer[pn]->PlayAnimation( "Step-DOWN", 1.5f ); + break; + case ST_JUMPLR: + ShowStepCircle( pn, ST_LEFT ); + ShowStepCircle( pn, ST_RIGHT ); + m_pDancer[pn]->PlayAnimation( "Step-JUMPLR", 1.5f ); + break; + case ST_JUMPUD: + ShowStepCircle( pn, ST_UP ); + ShowStepCircle( pn, ST_DOWN ); + m_pDancer[pn]->StopTweening(); + m_pDancer[pn]->PlayAnimation( "Step-JUMPLR", 1.5f ); + m_pDancer[pn]->BeginTweening( GAMESTATE->m_fCurBPS/8, TWEEN_LINEAR ); + m_pDancer[pn]->SetRotationY( 90 ); + m_pDancer[pn]->BeginTweening( 1/(GAMESTATE->m_fCurBPS * 2) ); //sleep between jump-frames + m_pDancer[pn]->BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR ); + m_pDancer[pn]->SetRotationY( 0 ); + break; + } + + m_sFlash.StopEffect(); + m_sFlash.StopTweening(); + m_sFlash.Sleep( GAMESTATE->m_fCurBPS/16 ); + m_sFlash.SetDiffuseAlpha( 1 ); + m_sFlash.BeginTweening( 1/GAMESTATE->m_fCurBPS * 0.5f ); + m_sFlash.SetDiffuseAlpha( 0 ); +} + +void BeginnerHelper::Update( float fDeltaTime ) +{ + if( !m_bInitialized ) + return; + + // the row we want to check on this update + int iCurRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat + 0.4f ); + FOREACH_EnabledPlayer( pn ) + { + for( int iRow=m_iLastRowChecked; iRowStep( pn, iStep ); + } + } + + // Make sure we don't accidentally scan a row 2x + m_iLastRowChecked = iCurRow; + + // Update animations + ActorFrame::Update( fDeltaTime ); + m_pDancePad->Update( fDeltaTime ); + m_sFlash.Update( fDeltaTime ); + + float beat = fDeltaTime*GAMESTATE->m_fCurBPS; + // If this is not a human player, the dancer is not shown + FOREACH_HumanPlayer( pu ) + { + // Update dancer's animation and StepCircles + m_pDancer[pu]->Update( beat ); + for( int scu=0; scuGetMetricI("BitmapText","NumRainbowColors") -#define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1)) - -static vector RAINBOW_COLORS; - -BitmapText::BitmapText() -{ - // Loading these theme metrics is slow, so only do it every 20th time. - // todo: why not check to see if you need to bother updating this at all? -aj - static int iReloadCounter = 0; - if( iReloadCounter % 20==0 ) - { - RAINBOW_COLORS.resize( NUM_RAINBOW_COLORS ); - for( unsigned i = 0; i < RAINBOW_COLORS.size(); ++i ) - RAINBOW_COLORS[i] = RAINBOW_COLOR(i); - } - iReloadCounter++; - - m_pFont = NULL; - m_bUppercase = false; - - m_bRainbowScroll = false; - m_bJitter = false; - - m_iWrapWidthPixels = -1; - m_fMaxWidth = 0; - m_fMaxHeight = 0; - m_iVertSpacing = 0; - m_bHasGlowAttribute = false; - // We'd be better off not adding strokes to things we can't control - // themewise (ScreenDebugOverlay for example). -Midiman - m_StrokeColor = RageColor(0,0,0,0); - // Never, this way we dont have awkward settings between themes. -Midiman - SetShadowLength( 0 ); - // SM4SVN r28328, "draw glow using stroke texture" forces the BitmapText to - // glow both the inner and stroke elements. This makes BitmapText elements - // with an invisible stroke have a glowing stroke instead. Not good. -aj - m_TextGlowMode = TextGlowMode_Both; // Both used for compatibility with SM4 -} - -BitmapText::~BitmapText() -{ - if( m_pFont ) - FONT->UnloadFont( m_pFont ); -} - -BitmapText & BitmapText::operator=(const BitmapText &cpy) -{ - Actor::operator=(cpy); - -#define CPY(a) a = cpy.a - CPY( m_bUppercase ); - CPY( m_sText ); - CPY( m_wTextLines ); - CPY( m_iLineWidths ); - CPY( m_iWrapWidthPixels ); - CPY( m_fMaxWidth ); - CPY( m_fMaxHeight ); - CPY( m_bRainbowScroll ); - CPY( m_bJitter ); - CPY( m_iVertSpacing ); - CPY( m_aVertices ); - CPY( m_vpFontPageTextures ); - CPY( m_mAttributes ); - CPY( m_bHasGlowAttribute ); - CPY( m_StrokeColor ); -#undef CPY - - if( m_pFont ) - FONT->UnloadFont( m_pFont ); - - if( cpy.m_pFont != NULL ) - m_pFont = FONT->CopyFont( cpy.m_pFont ); - else - m_pFont = NULL; - - return *this; -} - -BitmapText::BitmapText( const BitmapText &cpy ): - Actor( cpy ) -{ - m_pFont = NULL; - - *this = cpy; -} - -void BitmapText::LoadFromNode( const XNode* pNode ) -{ - RString sText; - pNode->GetAttrValue( "Text", sText ); - RString sAltText; - pNode->GetAttrValue( "AltText", sAltText ); - - ThemeManager::EvaluateString( sText ); - ThemeManager::EvaluateString( sAltText ); - - RString sFont; - if( !ActorUtil::GetAttrPath(pNode, "File", sFont) ) - { - if( !pNode->GetAttrValue("Font", sFont) ) // accept "File" for backward compatibility - RageException::Throw( "%s: BitmapText: missing the File attribute", - ActorUtil::GetWhere(pNode).c_str() ); - sFont = THEME->GetPathF( "", sFont ); - } - - LoadFromFont( sFont ); - - SetText( sText, sAltText ); - Actor::LoadFromNode( pNode ); -} - -bool BitmapText::LoadFromFont( const RString& sFontFilePath ) -{ - CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) ); - - if( m_pFont ) - { - FONT->UnloadFont( m_pFont ); - m_pFont = NULL; - } - - m_pFont = FONT->LoadFont( sFontFilePath ); - - this->SetStrokeColor( m_pFont->GetDefaultStrokeColor() ); - - BuildChars(); - - return true; -} - -bool BitmapText::LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ) -{ - CHECKPOINT_M( ssprintf("BitmapText::LoadFromTextureAndChars(\"%s\",\"%s\")", sTexturePath.c_str(), sChars.c_str()) ); - - if( m_pFont ) - { - FONT->UnloadFont( m_pFont ); - m_pFont = NULL; - } - - m_pFont = FONT->LoadFont( sTexturePath, sChars ); - - BuildChars(); - - return true; -} - -void BitmapText::BuildChars() -{ - // If we don't have a font yet, we'll do this when it loads. - if( m_pFont == NULL ) - return; - - // calculate line lengths and widths - m_size.x = 0; - - m_iLineWidths.clear(); - for( unsigned l=0; lGetLineWidthInSourcePixels( m_wTextLines[l] )); - m_size.x = max( m_size.x, m_iLineWidths.back() ); - } - - /* Ensure that the width is always even. This maintains pixel alignment; - * fX below will always be an integer. */ - m_size.x = QuantizeUp( m_size.x, 2.0f ); - - m_aVertices.clear(); - m_vpFontPageTextures.clear(); - - if( m_wTextLines.empty() ) - return; - - m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size()); - - // The height (from the origin to the baseline): - int iPadding = m_pFont->GetLineSpacing() - m_pFont->GetHeight(); - iPadding += m_iVertSpacing; - - // There's padding between every line: - m_size.y += iPadding * int(m_wTextLines.size()-1); - - // the top position of the first row of characters - int iY = lrintf(-m_size.y/2.0f); - - for( unsigned i=0; iGetHeight(); - - wstring sLine = m_wTextLines[i]; - if( m_pFont->IsRightToLeft() ) - reverse( sLine.begin(), sLine.end() ); - const int iLineWidth = m_iLineWidths[i]; - - float fX = SCALE( m_fHorizAlign, 0.0f, 1.0f, -m_size.x/2.0f, +m_size.x/2.0f - iLineWidth ); - int iX = lrintf( fX ); - - for( unsigned j = 0; j < sLine.size(); ++j ) - { - RageSpriteVertex v[4]; - const glyph &g = m_pFont->GetGlyph( sLine[j] ); - - if( m_pFont->IsRightToLeft() ) - iX -= g.m_iHadvance; - - // set vertex positions - v[0].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift, 0 ); // top left - v[1].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift+g.m_fHeight, 0 ); // bottom left - v[2].p = RageVector3( iX+g.m_fHshift+g.m_fWidth, iY+g.m_pPage->m_fVshift+g.m_fHeight, 0 ); // bottom right - v[3].p = RageVector3( iX+g.m_fHshift+g.m_fWidth, iY+g.m_pPage->m_fVshift, 0 ); // top right - - // Advance the cursor. - iX += g.m_iHadvance; - - // set texture coordinates - v[0].t = RageVector2( g.m_TexRect.left, g.m_TexRect.top ); - v[1].t = RageVector2( g.m_TexRect.left, g.m_TexRect.bottom ); - v[2].t = RageVector2( g.m_TexRect.right, g.m_TexRect.bottom ); - v[3].t = RageVector2( g.m_TexRect.right, g.m_TexRect.top ); - - m_aVertices.insert( m_aVertices.end(), &v[0], &v[4] ); - m_vpFontPageTextures.push_back( g.GetFontPageTextures() ); - } - - // The amount of padding a line needs: - iY += iPadding; - } -} - -void BitmapText::DrawChars( bool bUseStrokeTexture ) -{ - // bail if cropped all the way - if( m_pTempState->crop.left + m_pTempState->crop.right >= 1 || - m_pTempState->crop.top + m_pTempState->crop.bottom >= 1 ) - return; - - const int iNumGlyphs = m_vpFontPageTextures.size(); - int iStartGlyph = lrintf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) ); - int iEndGlyph = lrintf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) ); - iStartGlyph = clamp( iStartGlyph, 0, iNumGlyphs ); - iEndGlyph = clamp( iEndGlyph, 0, iNumGlyphs ); - - if( m_pTempState->fade.top > 0 || - m_pTempState->fade.bottom > 0 || - m_pTempState->fade.left > 0 || - m_pTempState->fade.right > 0 ) - { - // Handle fading by tweaking the alpha values of the vertices. - - // Actual size of the fade on each side: - const RectF &FadeDist = m_pTempState->fade; - RectF FadeSize = FadeDist; - - // If the cropped size is less than the fade distance, clamp. - const float fHorizRemaining = 1.0f - (m_pTempState->crop.left + m_pTempState->crop.right); - if( FadeDist.left+FadeDist.right > 0 && - fHorizRemaining < FadeDist.left+FadeDist.right ) - { - const float LeftPercent = FadeDist.left/(FadeDist.left+FadeDist.right); - FadeSize.left = LeftPercent * fHorizRemaining; - FadeSize.right = (1.0f-LeftPercent) * fHorizRemaining; - } - - /* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade - * all the way to 0 if the crop is beyond the outer edge.) */ - const float fRightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 ); - const float fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 ); - - const float fStartFadeLeftPercent = m_pTempState->crop.left; - const float fStopFadeLeftPercent = m_pTempState->crop.left + FadeSize.left; - const float fLeftFadeStartGlyph = SCALE( fStartFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); - const float fLeftFadeStopGlyph = SCALE( fStopFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); - - const float fStartFadeRightPercent = 1-(m_pTempState->crop.right + FadeSize.right); - const float fStopFadeRightPercent = 1-(m_pTempState->crop.right); - const float fRightFadeStartGlyph = SCALE( fStartFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); - const float fRightFadeStopGlyph = SCALE( fStopFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); - - for( int start = iStartGlyph; start < iEndGlyph; ++start ) - { - int i = start*4; - - float fAlpha = 1.0f; - if( FadeSize.left > 0.001f ) - { - // Add .5, so we fade wrt. the center of the vert, not the left side. - float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f ); - fPercent = clamp( fPercent, 0.0f, 1.0f ); - fAlpha *= fPercent * fLeftAlpha; - } - - if( FadeSize.right > 0.001f ) - { - float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f ); - fPercent = clamp( fPercent, 0.0f, 1.0f ); - fAlpha *= fPercent * fRightAlpha; - } - - for( int j = 0; j < 4; ++j ) - m_aVertices[i+j].c.a = (unsigned char)( m_aVertices[i+j].c.a * fAlpha ); - } - } - - for( int start = iStartGlyph; start < iEndGlyph; ) - { - int end = start; - while( end < iEndGlyph && m_vpFontPageTextures[end] == m_vpFontPageTextures[start] ) - end++; - - bool bHaveATexture = !bUseStrokeTexture || (bUseStrokeTexture && m_vpFontPageTextures[start]->m_pTextureStroke); - if( bHaveATexture ) - { - DISPLAY->ClearAllTextures(); - if( bUseStrokeTexture ) - DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() ); - else - DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() ); - - // Don't bother setting texture render states for text. We never go outside of 0..1. - /* We should call SetTextureRenderStates because it does more than just setting - * the texture wrapping state. If setting the wrapping state is found to be slow, - * there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */ - - // This is SLOW. We need to do something else about this. -Colby - //Actor::SetTextureRenderStates(); - - DISPLAY->DrawQuads( &m_aVertices[start*4], (end-start)*4); - } - - start = end; - } -} - -/* sText is UTF-8. If not all of the characters in sText are available in the - * font, sAlternateText will be used instead. If there are unavailable characters - * in sAlternateText, too, just use sText. */ -void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels ) -{ - ASSERT( m_pFont ); - - RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText; - - if( m_bUppercase ) - sNewText.MakeUpper(); - - if( iWrapWidthPixels == -1 ) // wrap not specified - iWrapWidthPixels = m_iWrapWidthPixels; - - if( m_sText == sNewText && iWrapWidthPixels==m_iWrapWidthPixels ) - return; - - m_sText = sNewText; - m_iWrapWidthPixels = iWrapWidthPixels; - ClearAttributes(); - SetTextInternal(); -} - -void BitmapText::SetTextInternal() -{ - // Break the string into lines. - - m_wTextLines.clear(); - - if( m_iWrapWidthPixels == -1 ) - { - split( RStringToWstring(m_sText), L"\n", m_wTextLines, false ); - } - else - { - // Break sText into lines that don't exceed iWrapWidthPixels. (if only - // one word fits on the line, it may be larger than iWrapWidthPixels). - - // This does not work in all languages: - /* "...I can add Japanese wrapping, at least. We could handle hyphens - * and soft hyphens and pretty easily, too." -glenn */ - // TODO: Move this wrapping logic into Font. - vector asLines; - split( m_sText, "\n", asLines, false ); - - for( unsigned line = 0; line < asLines.size(); ++line ) - { - vector asWords; - split( asLines[line], " ", asWords ); - - RString sCurLine; - int iCurLineWidth = 0; - - for( unsigned i=0; iGetLineWidthInSourcePixels( RStringToWstring(sWord) ); - - if( sCurLine.empty() ) - { - sCurLine = sWord; - iCurLineWidth = iWidthWord; - continue; - } - - RString sToAdd = " " + sWord; - int iWidthToAdd = m_pFont->GetLineWidthInSourcePixels(L" ") + iWidthWord; - if( iCurLineWidth + iWidthToAdd <= m_iWrapWidthPixels ) // will fit on current line - { - sCurLine += sToAdd; - iCurLineWidth += iWidthToAdd; - } - else - { - m_wTextLines.push_back( RStringToWstring(sCurLine) ); - sCurLine = sWord; - iCurLineWidth = iWidthWord; - } - } - m_wTextLines.push_back( RStringToWstring(sCurLine) ); - } - } - - BuildChars(); - UpdateBaseZoom(); -} - -void BitmapText::SetVertSpacing( int iSpacing ) -{ - m_iVertSpacing = iSpacing; - BuildChars(); -} - -void BitmapText::SetMaxWidth( float fMaxWidth ) -{ - m_fMaxWidth = fMaxWidth; - UpdateBaseZoom(); -} - -void BitmapText::SetMaxHeight( float fMaxHeight ) -{ - m_fMaxHeight = fMaxHeight; - UpdateBaseZoom(); -} - -void BitmapText::SetUppercase( bool b ) -{ - m_bUppercase = b; - BuildChars(); -} - -void BitmapText::UpdateBaseZoom() -{ - if( m_fMaxWidth == 0 ) - { - this->SetBaseZoomX( 1 ); - } - else - { - const float fWidth = GetUnzoomedWidth(); - if( fWidth != 0 ) // don't divide by 0 - { - // Never decrease the zoom. - const float fZoom = min( 1, m_fMaxWidth/fWidth ); - this->SetBaseZoomX( fZoom ); - } - } - - if( m_fMaxHeight == 0 ) - { - this->SetBaseZoomY( 1 ); - } - else - { - const float fHeight = GetUnzoomedHeight(); - if( fHeight != 0 ) // don't divide by 0 - { - // Never decrease the zoom. - const float fZoom = min( 1, m_fMaxHeight/fHeight ); - this->SetBaseZoomY( fZoom ); - } - } -} - -bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const -{ - ASSERT( m_pFont ); - - // Can't use the alternate if there isn't one. - if( !sAlternateText.size() ) - return false; - - // False if the alternate isn't needed. - if( m_pFont->FontCompleteForString(RStringToWstring(sText)) ) - return false; - - // False if the alternate is also incomplete. - if( !m_pFont->FontCompleteForString(RStringToWstring(sAlternateText)) ) - return false; - - return true; -} - -void BitmapText::CropToWidth( int iMaxWidthInSourcePixels ) -{ - iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels ); - - for( unsigned l=0; l iMaxWidthInSourcePixels ) - { - m_wTextLines[l].erase( m_wTextLines[l].end()-1, m_wTextLines[l].end() ); - m_iLineWidths[l] = m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] ); - } - } - - BuildChars(); -} - -bool BitmapText::EarlyAbortDraw() const -{ - return m_wTextLines.empty(); -} - -// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale -void BitmapText::DrawPrimitives() -{ - Actor::SetGlobalRenderStates(); // set Actor-specified render states - DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Modulate ); - - // Draw if we're not fully transparent or the zbuffer is enabled - if( m_pTempState->diffuse[0].a != 0 ) - { - // render the shadow - if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 ) - { - DISPLAY->PushMatrix(); - DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); - - RageColor c = m_ShadowColor; - c.a *= m_pTempState->diffuse[0].a; - for( unsigned i=0; iPopMatrix(); - } - - // render the stroke - if( m_StrokeColor.a > 0 ) - { - RageColor c = m_StrokeColor; - c.a *= m_pTempState->diffuse[0].a; - for( unsigned i=0; i::const_iterator iter = m_mAttributes.begin(); - while( i < m_aVertices.size() ) - { - // Set the colors up to the next attribute. - size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; - iEnd = min( iEnd, m_aVertices.size() ); - for( ; i < iEnd; i += 4 ) - { - m_aVertices[i+0].c = m_pTempState->diffuse[0]; // top left - m_aVertices[i+1].c = m_pTempState->diffuse[2]; // bottom left - m_aVertices[i+2].c = m_pTempState->diffuse[3]; // bottom right - m_aVertices[i+3].c = m_pTempState->diffuse[1]; // top right - } - if( iter == m_mAttributes.end() ) - break; - // Set the colors according to this attribute. - const Attribute &attr = iter->second; - ++iter; - if( attr.length < 0 ) - iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; - else - iEnd = i + attr.length*4; - iEnd = min( iEnd, m_aVertices.size() ); - for( ; i < iEnd; i += 4 ) - { - m_aVertices[i+0].c = attr.diffuse[0]; // top left - m_aVertices[i+1].c = attr.diffuse[2]; // bottom left - m_aVertices[i+2].c = attr.diffuse[3]; // bottom right - m_aVertices[i+3].c = attr.diffuse[1]; // top right - } - } - } - - // apply jitter to verts - vector vGlyphJitter; - if( m_bJitter ) - { - int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 ); - RandomGen rnd( iSeed ); - - for( unsigned i=0; iglow.a > 0.0001f || m_bHasGlowAttribute ) - { - DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow ); - - size_t i = 0; - map::const_iterator iter = m_mAttributes.begin(); - while( i < m_aVertices.size() ) - { - // Set the glow up to the next attribute. - size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; - iEnd = min( iEnd, m_aVertices.size() ); - for( ; i < iEnd; ++i ) - m_aVertices[i].c = m_pTempState->glow; - if( iter == m_mAttributes.end() ) - break; - // Set the glow according to this attribute. - const Attribute &attr = iter->second; - ++iter; - if( attr.length < 0 ) - iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; - else - iEnd = i + attr.length*4; - iEnd = min( iEnd, m_aVertices.size() ); - for( ; i < iEnd; ++i ) - m_aVertices[i].c = attr.glow; - } - /* Draw glow using the base texture and the glow texture. Otherwise, - * glow looks too tame on BitmapText that has a stroke. - Chris Danford */ - /* This doesn't work well if the font is using an invisible stroke, as - * the invisible stroke will glow as well. Time for TextGlowMode. - * Only draw the strokes if the glow mode is not inner only. -aj */ - DrawChars(m_TextGlowMode != TextGlowMode_Inner); - } -} - -// Rebuild when these change. -void BitmapText::SetHorizAlign( float f ) -{ - float fHorizAlign = m_fHorizAlign; - Actor::SetHorizAlign(f); - if( fHorizAlign == m_fHorizAlign ) - return; - BuildChars(); -} - -void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels ) -{ - ASSERT( m_pFont ); // always load a font first - if( m_iWrapWidthPixels == iWrapWidthPixels ) - return; - m_iWrapWidthPixels = iWrapWidthPixels; - SetTextInternal(); -} - -BitmapText::Attribute BitmapText::GetDefaultAttribute() const -{ - Attribute attr; - for( int i = 0; i < 4; ++i ) - attr.diffuse[i] = GetDiffuses( i ); - attr.glow = GetGlow(); - return attr; -} - -void BitmapText::AddAttribute( size_t iPos, const Attribute &attr ) -{ - // Fixup position for new lines. - int iLines = 0; - size_t iAdjustedPos = iPos; - - FOREACH_CONST( wstring, m_wTextLines, line ) - { - size_t length = line->length(); - if( length >= iAdjustedPos ) - break; - iAdjustedPos -= length; - ++iLines; - } - m_mAttributes[iPos-iLines] = attr; - m_bHasGlowAttribute = m_bHasGlowAttribute || attr.glow.a > 0.0001f; -} - -void BitmapText::ClearAttributes() -{ - m_mAttributes.clear(); - m_bHasGlowAttribute = false; -} - -void BitmapText::Attribute::FromStack( lua_State *L, int iPos ) -{ - if( lua_type(L, iPos) != LUA_TTABLE ) - return; - - lua_pushvalue( L, iPos ); - const int iTab = lua_gettop( L ); - - // Get the length. - lua_getfield( L, iTab, "Length" ); - length = lua_tointeger( L, -1 ); - lua_settop( L, iTab ); - - // Get the diffuse colors. - lua_getfield( L, iTab, "Diffuses" ); - if( !lua_isnil(L, -1) ) - { - for( int i = 1; i <= 4; ++i ) - { - lua_rawgeti( L, -i, i ); - diffuse[i-1].FromStack( L, -1 ); - } - } - lua_settop( L, iTab ); - - // Get a single diffuse color. - lua_getfield( L, iTab, "Diffuse" ); - if( !lua_isnil(L, -1) ) - { - diffuse[0].FromStack( L, -1 ); - diffuse[1] = diffuse[2] = diffuse[3] = diffuse[0]; - } - lua_settop( L, iTab ); - - // Get the glow color. - lua_getfield( L, iTab, "Glow" ); - glow.FromStack( L, -1 ); - - lua_settop( L, iTab - 1 ); -} - -// lua start -#include "FontCharAliases.h" - -/** @brief Allow Lua to have access to the BitmapText. */ -class LunaBitmapText: public Luna -{ -public: - static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } - static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } - static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } - static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; } - static int settext( T* p, lua_State *L ) - { - RString s = SArg(1); - RString sAlt; - /* XXX: Lua strings should simply use "\n" natively. However, some - * settext calls may be made from GetMetric() calls to other strings, and - * it's confusing for :: to work in some strings and not others. - * Eventually, all strings should be Lua expressions, but until then, - * continue to support this. */ - s.Replace("::","\n"); - FontCharAliases::ReplaceMarkers( s ); - - if( lua_gettop(L) > 1 ) - { - sAlt = SArg(2); - sAlt.Replace("::","\n"); - FontCharAliases::ReplaceMarkers( sAlt ); - } - - p->SetText( s, sAlt ); - return 0; - } - static int rainbowscroll( T* p, lua_State *L ) { p->SetRainbowScroll( BArg(1) ); return 0; } - static int jitter( T* p, lua_State *L ) { p->SetJitter( BArg(1) ); return 0; } - static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } - static int AddAttribute( T* p, lua_State *L ) - { - size_t iPos = IArg(1); - BitmapText::Attribute attr = p->GetDefaultAttribute(); - - attr.FromStack( L, 2 ); - p->AddAttribute( iPos, attr ); - return 0; - } - static int ClearAttributes( T* p, lua_State *L ) { p->ClearAttributes(); return 0; } - static int strokecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetStrokeColor( c ); return 0; } - static int uppercase( T* p, lua_State *L ) { p->SetUppercase( BArg(1) ); return 0; } - static int textglowmode( T* p, lua_State *L ) { p->SetTextGlowMode( Enum::Check(L, 1) ); return 0; } - - LunaBitmapText() - { - ADD_METHOD( wrapwidthpixels ); - ADD_METHOD( maxwidth ); - ADD_METHOD( maxheight ); - ADD_METHOD( vertspacing ); - ADD_METHOD( settext ); - ADD_METHOD( rainbowscroll ); - ADD_METHOD( jitter ); - ADD_METHOD( GetText ); - ADD_METHOD( AddAttribute ); - ADD_METHOD( ClearAttributes ); - ADD_METHOD( strokecolor ); - ADD_METHOD( uppercase ); - ADD_METHOD( textglowmode ); - //ADD_METHOD( LoadFromFont ); - //ADD_METHOD( LoadFromTextureAndChars ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( BitmapText, Actor ) - -// lua end - -/* - * (c) 2003-2007 Chris Danford, Charles Lohr, Steve Checkoway - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "BitmapText.h" +#include "XmlFile.h" +#include "FontManager.h" +#include "RageLog.h" +#include "RageTimer.h" +#include "RageDisplay.h" +#include "ThemeManager.h" +#include "Font.h" +#include "ActorUtil.h" +#include "LuaBinding.h" +#include "Foreach.h" + +REGISTER_ACTOR_CLASS( BitmapText ); + +/* XXX: + * We need some kind of font modifier string for metrics. For example, + * "valign=top;spacing = x+5,y+2" + * + * Better, we could go all the way, drop all of the actor-specific font aliases, + * and do "font=header2;valign=top;...". */ + + /* XXX: Changing a whole array of diffuse colors every frame (several times) is + * a waste, when we're usually setting them all to the same value. Rainbow and + * fading are annoying to optimize, but rarely used. Iterating over every + * character in Draw() is dumb. */ +#define NUM_RAINBOW_COLORS THEME->GetMetricI("BitmapText","NumRainbowColors") +#define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1)) + +static vector RAINBOW_COLORS; + +BitmapText::BitmapText() +{ + // Loading these theme metrics is slow, so only do it every 20th time. + // todo: why not check to see if you need to bother updating this at all? -aj + static int iReloadCounter = 0; + if( iReloadCounter % 20==0 ) + { + RAINBOW_COLORS.resize( NUM_RAINBOW_COLORS ); + for( unsigned i = 0; i < RAINBOW_COLORS.size(); ++i ) + RAINBOW_COLORS[i] = RAINBOW_COLOR(i); + } + iReloadCounter++; + + m_pFont = NULL; + m_bUppercase = false; + + m_bRainbowScroll = false; + m_bJitter = false; + + m_iWrapWidthPixels = -1; + m_fMaxWidth = 0; + m_fMaxHeight = 0; + m_iVertSpacing = 0; + m_bHasGlowAttribute = false; + // We'd be better off not adding strokes to things we can't control + // themewise (ScreenDebugOverlay for example). -Midiman + m_StrokeColor = RageColor(0,0,0,0); + // Never, this way we dont have awkward settings between themes. -Midiman + SetShadowLength( 0 ); + // SM4SVN r28328, "draw glow using stroke texture" forces the BitmapText to + // glow both the inner and stroke elements. This makes BitmapText elements + // with an invisible stroke have a glowing stroke instead. Not good. -aj + m_TextGlowMode = TextGlowMode_Both; // Both used for compatibility with SM4 +} + +BitmapText::~BitmapText() +{ + if( m_pFont ) + FONT->UnloadFont( m_pFont ); +} + +BitmapText & BitmapText::operator=(const BitmapText &cpy) +{ + Actor::operator=(cpy); + +#define CPY(a) a = cpy.a + CPY( m_bUppercase ); + CPY( m_sText ); + CPY( m_wTextLines ); + CPY( m_iLineWidths ); + CPY( m_iWrapWidthPixels ); + CPY( m_fMaxWidth ); + CPY( m_fMaxHeight ); + CPY( m_bRainbowScroll ); + CPY( m_bJitter ); + CPY( m_iVertSpacing ); + CPY( m_aVertices ); + CPY( m_vpFontPageTextures ); + CPY( m_mAttributes ); + CPY( m_bHasGlowAttribute ); + CPY( m_StrokeColor ); +#undef CPY + + if( m_pFont ) + FONT->UnloadFont( m_pFont ); + + if( cpy.m_pFont != NULL ) + m_pFont = FONT->CopyFont( cpy.m_pFont ); + else + m_pFont = NULL; + + return *this; +} + +BitmapText::BitmapText( const BitmapText &cpy ): + Actor( cpy ) +{ + m_pFont = NULL; + + *this = cpy; +} + +void BitmapText::LoadFromNode( const XNode* pNode ) +{ + RString sText; + pNode->GetAttrValue( "Text", sText ); + RString sAltText; + pNode->GetAttrValue( "AltText", sAltText ); + + ThemeManager::EvaluateString( sText ); + ThemeManager::EvaluateString( sAltText ); + + RString sFont; + if( !ActorUtil::GetAttrPath(pNode, "File", sFont) ) + { + if( !pNode->GetAttrValue("Font", sFont) ) // accept "File" for backward compatibility + RageException::Throw( "%s: BitmapText: missing the File attribute", + ActorUtil::GetWhere(pNode).c_str() ); + sFont = THEME->GetPathF( "", sFont ); + } + + LoadFromFont( sFont ); + + SetText( sText, sAltText ); + Actor::LoadFromNode( pNode ); +} + +bool BitmapText::LoadFromFont( const RString& sFontFilePath ) +{ + CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) ); + + if( m_pFont ) + { + FONT->UnloadFont( m_pFont ); + m_pFont = NULL; + } + + m_pFont = FONT->LoadFont( sFontFilePath ); + + this->SetStrokeColor( m_pFont->GetDefaultStrokeColor() ); + + BuildChars(); + + return true; +} + +bool BitmapText::LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ) +{ + CHECKPOINT_M( ssprintf("BitmapText::LoadFromTextureAndChars(\"%s\",\"%s\")", sTexturePath.c_str(), sChars.c_str()) ); + + if( m_pFont ) + { + FONT->UnloadFont( m_pFont ); + m_pFont = NULL; + } + + m_pFont = FONT->LoadFont( sTexturePath, sChars ); + + BuildChars(); + + return true; +} + +void BitmapText::BuildChars() +{ + // If we don't have a font yet, we'll do this when it loads. + if( m_pFont == NULL ) + return; + + // calculate line lengths and widths + m_size.x = 0; + + m_iLineWidths.clear(); + for( unsigned l=0; lGetLineWidthInSourcePixels( m_wTextLines[l] )); + m_size.x = max( m_size.x, m_iLineWidths.back() ); + } + + /* Ensure that the width is always even. This maintains pixel alignment; + * fX below will always be an integer. */ + m_size.x = QuantizeUp( m_size.x, 2.0f ); + + m_aVertices.clear(); + m_vpFontPageTextures.clear(); + + if( m_wTextLines.empty() ) + return; + + m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size()); + + // The height (from the origin to the baseline): + int iPadding = m_pFont->GetLineSpacing() - m_pFont->GetHeight(); + iPadding += m_iVertSpacing; + + // There's padding between every line: + m_size.y += iPadding * int(m_wTextLines.size()-1); + + // the top position of the first row of characters + int iY = lrintf(-m_size.y/2.0f); + + for( unsigned i=0; iGetHeight(); + + wstring sLine = m_wTextLines[i]; + if( m_pFont->IsRightToLeft() ) + reverse( sLine.begin(), sLine.end() ); + const int iLineWidth = m_iLineWidths[i]; + + float fX = SCALE( m_fHorizAlign, 0.0f, 1.0f, -m_size.x/2.0f, +m_size.x/2.0f - iLineWidth ); + int iX = lrintf( fX ); + + for( unsigned j = 0; j < sLine.size(); ++j ) + { + RageSpriteVertex v[4]; + const glyph &g = m_pFont->GetGlyph( sLine[j] ); + + if( m_pFont->IsRightToLeft() ) + iX -= g.m_iHadvance; + + // set vertex positions + v[0].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift, 0 ); // top left + v[1].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift+g.m_fHeight, 0 ); // bottom left + v[2].p = RageVector3( iX+g.m_fHshift+g.m_fWidth, iY+g.m_pPage->m_fVshift+g.m_fHeight, 0 ); // bottom right + v[3].p = RageVector3( iX+g.m_fHshift+g.m_fWidth, iY+g.m_pPage->m_fVshift, 0 ); // top right + + // Advance the cursor. + iX += g.m_iHadvance; + + // set texture coordinates + v[0].t = RageVector2( g.m_TexRect.left, g.m_TexRect.top ); + v[1].t = RageVector2( g.m_TexRect.left, g.m_TexRect.bottom ); + v[2].t = RageVector2( g.m_TexRect.right, g.m_TexRect.bottom ); + v[3].t = RageVector2( g.m_TexRect.right, g.m_TexRect.top ); + + m_aVertices.insert( m_aVertices.end(), &v[0], &v[4] ); + m_vpFontPageTextures.push_back( g.GetFontPageTextures() ); + } + + // The amount of padding a line needs: + iY += iPadding; + } +} + +void BitmapText::DrawChars( bool bUseStrokeTexture ) +{ + // bail if cropped all the way + if( m_pTempState->crop.left + m_pTempState->crop.right >= 1 || + m_pTempState->crop.top + m_pTempState->crop.bottom >= 1 ) + return; + + const int iNumGlyphs = m_vpFontPageTextures.size(); + int iStartGlyph = lrintf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) ); + int iEndGlyph = lrintf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) ); + iStartGlyph = clamp( iStartGlyph, 0, iNumGlyphs ); + iEndGlyph = clamp( iEndGlyph, 0, iNumGlyphs ); + + if( m_pTempState->fade.top > 0 || + m_pTempState->fade.bottom > 0 || + m_pTempState->fade.left > 0 || + m_pTempState->fade.right > 0 ) + { + // Handle fading by tweaking the alpha values of the vertices. + + // Actual size of the fade on each side: + const RectF &FadeDist = m_pTempState->fade; + RectF FadeSize = FadeDist; + + // If the cropped size is less than the fade distance, clamp. + const float fHorizRemaining = 1.0f - (m_pTempState->crop.left + m_pTempState->crop.right); + if( FadeDist.left+FadeDist.right > 0 && + fHorizRemaining < FadeDist.left+FadeDist.right ) + { + const float LeftPercent = FadeDist.left/(FadeDist.left+FadeDist.right); + FadeSize.left = LeftPercent * fHorizRemaining; + FadeSize.right = (1.0f-LeftPercent) * fHorizRemaining; + } + + /* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade + * all the way to 0 if the crop is beyond the outer edge.) */ + const float fRightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 ); + const float fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 ); + + const float fStartFadeLeftPercent = m_pTempState->crop.left; + const float fStopFadeLeftPercent = m_pTempState->crop.left + FadeSize.left; + const float fLeftFadeStartGlyph = SCALE( fStartFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); + const float fLeftFadeStopGlyph = SCALE( fStopFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); + + const float fStartFadeRightPercent = 1-(m_pTempState->crop.right + FadeSize.right); + const float fStopFadeRightPercent = 1-(m_pTempState->crop.right); + const float fRightFadeStartGlyph = SCALE( fStartFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); + const float fRightFadeStopGlyph = SCALE( fStopFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs ); + + for( int start = iStartGlyph; start < iEndGlyph; ++start ) + { + int i = start*4; + + float fAlpha = 1.0f; + if( FadeSize.left > 0.001f ) + { + // Add .5, so we fade wrt. the center of the vert, not the left side. + float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f ); + fPercent = clamp( fPercent, 0.0f, 1.0f ); + fAlpha *= fPercent * fLeftAlpha; + } + + if( FadeSize.right > 0.001f ) + { + float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f ); + fPercent = clamp( fPercent, 0.0f, 1.0f ); + fAlpha *= fPercent * fRightAlpha; + } + + for( int j = 0; j < 4; ++j ) + m_aVertices[i+j].c.a = (unsigned char)( m_aVertices[i+j].c.a * fAlpha ); + } + } + + for( int start = iStartGlyph; start < iEndGlyph; ) + { + int end = start; + while( end < iEndGlyph && m_vpFontPageTextures[end] == m_vpFontPageTextures[start] ) + end++; + + bool bHaveATexture = !bUseStrokeTexture || (bUseStrokeTexture && m_vpFontPageTextures[start]->m_pTextureStroke); + if( bHaveATexture ) + { + DISPLAY->ClearAllTextures(); + if( bUseStrokeTexture ) + DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() ); + else + DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() ); + + // Don't bother setting texture render states for text. We never go outside of 0..1. + /* We should call SetTextureRenderStates because it does more than just setting + * the texture wrapping state. If setting the wrapping state is found to be slow, + * there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */ + + // This is SLOW. We need to do something else about this. -Colby + //Actor::SetTextureRenderStates(); + + DISPLAY->DrawQuads( &m_aVertices[start*4], (end-start)*4); + } + + start = end; + } +} + +/* sText is UTF-8. If not all of the characters in sText are available in the + * font, sAlternateText will be used instead. If there are unavailable characters + * in sAlternateText, too, just use sText. */ +void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels ) +{ + ASSERT( m_pFont ); + + RString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText; + + if( m_bUppercase ) + sNewText.MakeUpper(); + + if( iWrapWidthPixels == -1 ) // wrap not specified + iWrapWidthPixels = m_iWrapWidthPixels; + + if( m_sText == sNewText && iWrapWidthPixels==m_iWrapWidthPixels ) + return; + + m_sText = sNewText; + m_iWrapWidthPixels = iWrapWidthPixels; + ClearAttributes(); + SetTextInternal(); +} + +void BitmapText::SetTextInternal() +{ + // Break the string into lines. + + m_wTextLines.clear(); + + if( m_iWrapWidthPixels == -1 ) + { + split( RStringToWstring(m_sText), L"\n", m_wTextLines, false ); + } + else + { + // Break sText into lines that don't exceed iWrapWidthPixels. (if only + // one word fits on the line, it may be larger than iWrapWidthPixels). + + // This does not work in all languages: + /* "...I can add Japanese wrapping, at least. We could handle hyphens + * and soft hyphens and pretty easily, too." -glenn */ + // TODO: Move this wrapping logic into Font. + vector asLines; + split( m_sText, "\n", asLines, false ); + + for( unsigned line = 0; line < asLines.size(); ++line ) + { + vector asWords; + split( asLines[line], " ", asWords ); + + RString sCurLine; + int iCurLineWidth = 0; + + for( unsigned i=0; iGetLineWidthInSourcePixels( RStringToWstring(sWord) ); + + if( sCurLine.empty() ) + { + sCurLine = sWord; + iCurLineWidth = iWidthWord; + continue; + } + + RString sToAdd = " " + sWord; + int iWidthToAdd = m_pFont->GetLineWidthInSourcePixels(L" ") + iWidthWord; + if( iCurLineWidth + iWidthToAdd <= m_iWrapWidthPixels ) // will fit on current line + { + sCurLine += sToAdd; + iCurLineWidth += iWidthToAdd; + } + else + { + m_wTextLines.push_back( RStringToWstring(sCurLine) ); + sCurLine = sWord; + iCurLineWidth = iWidthWord; + } + } + m_wTextLines.push_back( RStringToWstring(sCurLine) ); + } + } + + BuildChars(); + UpdateBaseZoom(); +} + +void BitmapText::SetVertSpacing( int iSpacing ) +{ + m_iVertSpacing = iSpacing; + BuildChars(); +} + +void BitmapText::SetMaxWidth( float fMaxWidth ) +{ + m_fMaxWidth = fMaxWidth; + UpdateBaseZoom(); +} + +void BitmapText::SetMaxHeight( float fMaxHeight ) +{ + m_fMaxHeight = fMaxHeight; + UpdateBaseZoom(); +} + +void BitmapText::SetUppercase( bool b ) +{ + m_bUppercase = b; + BuildChars(); +} + +void BitmapText::UpdateBaseZoom() +{ + if( m_fMaxWidth == 0 ) + { + this->SetBaseZoomX( 1 ); + } + else + { + const float fWidth = GetUnzoomedWidth(); + if( fWidth != 0 ) // don't divide by 0 + { + // Never decrease the zoom. + const float fZoom = min( 1, m_fMaxWidth/fWidth ); + this->SetBaseZoomX( fZoom ); + } + } + + if( m_fMaxHeight == 0 ) + { + this->SetBaseZoomY( 1 ); + } + else + { + const float fHeight = GetUnzoomedHeight(); + if( fHeight != 0 ) // don't divide by 0 + { + // Never decrease the zoom. + const float fZoom = min( 1, m_fMaxHeight/fHeight ); + this->SetBaseZoomY( fZoom ); + } + } +} + +bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const +{ + ASSERT( m_pFont ); + + // Can't use the alternate if there isn't one. + if( !sAlternateText.size() ) + return false; + + // False if the alternate isn't needed. + if( m_pFont->FontCompleteForString(RStringToWstring(sText)) ) + return false; + + // False if the alternate is also incomplete. + if( !m_pFont->FontCompleteForString(RStringToWstring(sAlternateText)) ) + return false; + + return true; +} + +void BitmapText::CropToWidth( int iMaxWidthInSourcePixels ) +{ + iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels ); + + for( unsigned l=0; l iMaxWidthInSourcePixels ) + { + m_wTextLines[l].erase( m_wTextLines[l].end()-1, m_wTextLines[l].end() ); + m_iLineWidths[l] = m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] ); + } + } + + BuildChars(); +} + +bool BitmapText::EarlyAbortDraw() const +{ + return m_wTextLines.empty(); +} + +// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale +void BitmapText::DrawPrimitives() +{ + Actor::SetGlobalRenderStates(); // set Actor-specified render states + DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Modulate ); + + // Draw if we're not fully transparent or the zbuffer is enabled + if( m_pTempState->diffuse[0].a != 0 ) + { + // render the shadow + if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 ) + { + DISPLAY->PushMatrix(); + DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); + + RageColor c = m_ShadowColor; + c.a *= m_pTempState->diffuse[0].a; + for( unsigned i=0; iPopMatrix(); + } + + // render the stroke + if( m_StrokeColor.a > 0 ) + { + RageColor c = m_StrokeColor; + c.a *= m_pTempState->diffuse[0].a; + for( unsigned i=0; i::const_iterator iter = m_mAttributes.begin(); + while( i < m_aVertices.size() ) + { + // Set the colors up to the next attribute. + size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; + iEnd = min( iEnd, m_aVertices.size() ); + for( ; i < iEnd; i += 4 ) + { + m_aVertices[i+0].c = m_pTempState->diffuse[0]; // top left + m_aVertices[i+1].c = m_pTempState->diffuse[2]; // bottom left + m_aVertices[i+2].c = m_pTempState->diffuse[3]; // bottom right + m_aVertices[i+3].c = m_pTempState->diffuse[1]; // top right + } + if( iter == m_mAttributes.end() ) + break; + // Set the colors according to this attribute. + const Attribute &attr = iter->second; + ++iter; + if( attr.length < 0 ) + iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; + else + iEnd = i + attr.length*4; + iEnd = min( iEnd, m_aVertices.size() ); + for( ; i < iEnd; i += 4 ) + { + m_aVertices[i+0].c = attr.diffuse[0]; // top left + m_aVertices[i+1].c = attr.diffuse[2]; // bottom left + m_aVertices[i+2].c = attr.diffuse[3]; // bottom right + m_aVertices[i+3].c = attr.diffuse[1]; // top right + } + } + } + + // apply jitter to verts + vector vGlyphJitter; + if( m_bJitter ) + { + int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 ); + RandomGen rnd( iSeed ); + + for( unsigned i=0; iglow.a > 0.0001f || m_bHasGlowAttribute ) + { + DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow ); + + size_t i = 0; + map::const_iterator iter = m_mAttributes.begin(); + while( i < m_aVertices.size() ) + { + // Set the glow up to the next attribute. + size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; + iEnd = min( iEnd, m_aVertices.size() ); + for( ; i < iEnd; ++i ) + m_aVertices[i].c = m_pTempState->glow; + if( iter == m_mAttributes.end() ) + break; + // Set the glow according to this attribute. + const Attribute &attr = iter->second; + ++iter; + if( attr.length < 0 ) + iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4; + else + iEnd = i + attr.length*4; + iEnd = min( iEnd, m_aVertices.size() ); + for( ; i < iEnd; ++i ) + m_aVertices[i].c = attr.glow; + } + /* Draw glow using the base texture and the glow texture. Otherwise, + * glow looks too tame on BitmapText that has a stroke. - Chris Danford */ + /* This doesn't work well if the font is using an invisible stroke, as + * the invisible stroke will glow as well. Time for TextGlowMode. + * Only draw the strokes if the glow mode is not inner only. -aj */ + DrawChars(m_TextGlowMode != TextGlowMode_Inner); + } +} + +// Rebuild when these change. +void BitmapText::SetHorizAlign( float f ) +{ + float fHorizAlign = m_fHorizAlign; + Actor::SetHorizAlign(f); + if( fHorizAlign == m_fHorizAlign ) + return; + BuildChars(); +} + +void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels ) +{ + ASSERT( m_pFont ); // always load a font first + if( m_iWrapWidthPixels == iWrapWidthPixels ) + return; + m_iWrapWidthPixels = iWrapWidthPixels; + SetTextInternal(); +} + +BitmapText::Attribute BitmapText::GetDefaultAttribute() const +{ + Attribute attr; + for( int i = 0; i < 4; ++i ) + attr.diffuse[i] = GetDiffuses( i ); + attr.glow = GetGlow(); + return attr; +} + +void BitmapText::AddAttribute( size_t iPos, const Attribute &attr ) +{ + // Fixup position for new lines. + int iLines = 0; + size_t iAdjustedPos = iPos; + + FOREACH_CONST( wstring, m_wTextLines, line ) + { + size_t length = line->length(); + if( length >= iAdjustedPos ) + break; + iAdjustedPos -= length; + ++iLines; + } + m_mAttributes[iPos-iLines] = attr; + m_bHasGlowAttribute = m_bHasGlowAttribute || attr.glow.a > 0.0001f; +} + +void BitmapText::ClearAttributes() +{ + m_mAttributes.clear(); + m_bHasGlowAttribute = false; +} + +void BitmapText::Attribute::FromStack( lua_State *L, int iPos ) +{ + if( lua_type(L, iPos) != LUA_TTABLE ) + return; + + lua_pushvalue( L, iPos ); + const int iTab = lua_gettop( L ); + + // Get the length. + lua_getfield( L, iTab, "Length" ); + length = lua_tointeger( L, -1 ); + lua_settop( L, iTab ); + + // Get the diffuse colors. + lua_getfield( L, iTab, "Diffuses" ); + if( !lua_isnil(L, -1) ) + { + for( int i = 1; i <= 4; ++i ) + { + lua_rawgeti( L, -i, i ); + diffuse[i-1].FromStack( L, -1 ); + } + } + lua_settop( L, iTab ); + + // Get a single diffuse color. + lua_getfield( L, iTab, "Diffuse" ); + if( !lua_isnil(L, -1) ) + { + diffuse[0].FromStack( L, -1 ); + diffuse[1] = diffuse[2] = diffuse[3] = diffuse[0]; + } + lua_settop( L, iTab ); + + // Get the glow color. + lua_getfield( L, iTab, "Glow" ); + glow.FromStack( L, -1 ); + + lua_settop( L, iTab - 1 ); +} + +// lua start +#include "FontCharAliases.h" + +/** @brief Allow Lua to have access to the BitmapText. */ +class LunaBitmapText: public Luna +{ +public: + static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } + static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } + static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } + static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; } + static int settext( T* p, lua_State *L ) + { + RString s = SArg(1); + RString sAlt; + /* XXX: Lua strings should simply use "\n" natively. However, some + * settext calls may be made from GetMetric() calls to other strings, and + * it's confusing for :: to work in some strings and not others. + * Eventually, all strings should be Lua expressions, but until then, + * continue to support this. */ + s.Replace("::","\n"); + FontCharAliases::ReplaceMarkers( s ); + + if( lua_gettop(L) > 1 ) + { + sAlt = SArg(2); + sAlt.Replace("::","\n"); + FontCharAliases::ReplaceMarkers( sAlt ); + } + + p->SetText( s, sAlt ); + return 0; + } + static int rainbowscroll( T* p, lua_State *L ) { p->SetRainbowScroll( BArg(1) ); return 0; } + static int jitter( T* p, lua_State *L ) { p->SetJitter( BArg(1) ); return 0; } + static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } + static int AddAttribute( T* p, lua_State *L ) + { + size_t iPos = IArg(1); + BitmapText::Attribute attr = p->GetDefaultAttribute(); + + attr.FromStack( L, 2 ); + p->AddAttribute( iPos, attr ); + return 0; + } + static int ClearAttributes( T* p, lua_State *L ) { p->ClearAttributes(); return 0; } + static int strokecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetStrokeColor( c ); return 0; } + static int uppercase( T* p, lua_State *L ) { p->SetUppercase( BArg(1) ); return 0; } + static int textglowmode( T* p, lua_State *L ) { p->SetTextGlowMode( Enum::Check(L, 1) ); return 0; } + + LunaBitmapText() + { + ADD_METHOD( wrapwidthpixels ); + ADD_METHOD( maxwidth ); + ADD_METHOD( maxheight ); + ADD_METHOD( vertspacing ); + ADD_METHOD( settext ); + ADD_METHOD( rainbowscroll ); + ADD_METHOD( jitter ); + ADD_METHOD( GetText ); + ADD_METHOD( AddAttribute ); + ADD_METHOD( ClearAttributes ); + ADD_METHOD( strokecolor ); + ADD_METHOD( uppercase ); + ADD_METHOD( textglowmode ); + //ADD_METHOD( LoadFromFont ); + //ADD_METHOD( LoadFromTextureAndChars ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( BitmapText, Actor ) + +// lua end + +/* + * (c) 2003-2007 Chris Danford, Charles Lohr, Steve Checkoway + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/BitmapText.h b/src/BitmapText.h index 5ef89562a7..2647dda970 100644 --- a/src/BitmapText.h +++ b/src/BitmapText.h @@ -1,127 +1,127 @@ -#ifndef BITMAP_TEXT_H -#define BITMAP_TEXT_H - -#include "Actor.h" -#include - -class RageTexture; -class Font; -struct FontPageTextures; -/** @brief An actor that holds a Font and draws text to the screen. */ -class BitmapText : public Actor -{ -public: - BitmapText(); - BitmapText( const BitmapText &cpy ); - BitmapText &operator=(const BitmapText &cpy); - virtual ~BitmapText(); - - virtual void LoadFromNode( const XNode* pNode ); - virtual BitmapText *Copy() const; - - bool LoadFromFont( const RString& sFontName ); - bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ); - virtual void SetText( const RString& sText, const RString& sAlternateText = "", int iWrapWidthPixels = -1 ); - void SetVertSpacing( int iSpacing ); - void SetMaxWidth( float fMaxWidth ); - void SetMaxHeight( float fMaxHeight ); - void SetWrapWidthPixels( int iWrapWidthPixels ); - void CropToWidth( int iWidthInSourcePixels ); - - virtual bool EarlyAbortDraw() const; - virtual void DrawPrimitives(); - - void SetUppercase( bool b ); - void SetRainbowScroll( bool b ) { m_bRainbowScroll = b; } - void SetJitter( bool b ) { m_bJitter = b; } - - void SetHorizAlign( float f ); - - void SetStrokeColor( RageColor c ) { m_StrokeColor = c; } - RageColor GetStrokeColor() { return m_StrokeColor; } - - void SetTextGlowMode( TextGlowMode tgm ) { m_TextGlowMode = tgm; } - - void GetLines( vector &wTextLines ) const { wTextLines = m_wTextLines; } - const vector &GetLines() const { return m_wTextLines; } - - RString GetText() const { return m_sText; } - // Return true if the string 's' will use an alternate string, if available. - bool StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const; - - struct Attribute - { - Attribute() : length(-1) { } - int length; - RageColor diffuse[4]; - RageColor glow; - - void FromStack( lua_State *L, int iPos ); - }; - - Attribute GetDefaultAttribute() const; - void AddAttribute( size_t iPos, const Attribute &attr ); - void ClearAttributes(); - - // Commands - virtual void PushSelf( lua_State *L ); - -protected: - Font *m_pFont; - bool m_bUppercase; - RString m_sText; - vector m_wTextLines; - vector m_iLineWidths; // in source pixels - int m_iWrapWidthPixels; // -1 = no wrap - float m_fMaxWidth; // 0 = no max - float m_fMaxHeight; // 0 = no max - bool m_bRainbowScroll; - bool m_bJitter; - int m_iVertSpacing; - - vector m_aVertices; - - vector m_vpFontPageTextures; - map m_mAttributes; - bool m_bHasGlowAttribute; - - RageColor m_StrokeColor; - TextGlowMode m_TextGlowMode; - - // recalculate the items in SetText() - void BuildChars(); - void DrawChars( bool bUseStrokeTexture ); - void UpdateBaseZoom(); - -private: - void SetTextInternal(); -}; - -#endif - -/** - * @file - * @author Chris Danford, Charles Lohr, Steve Checkoway (c) 2001-2007 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef BITMAP_TEXT_H +#define BITMAP_TEXT_H + +#include "Actor.h" +#include + +class RageTexture; +class Font; +struct FontPageTextures; +/** @brief An actor that holds a Font and draws text to the screen. */ +class BitmapText : public Actor +{ +public: + BitmapText(); + BitmapText( const BitmapText &cpy ); + BitmapText &operator=(const BitmapText &cpy); + virtual ~BitmapText(); + + virtual void LoadFromNode( const XNode* pNode ); + virtual BitmapText *Copy() const; + + bool LoadFromFont( const RString& sFontName ); + bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ); + virtual void SetText( const RString& sText, const RString& sAlternateText = "", int iWrapWidthPixels = -1 ); + void SetVertSpacing( int iSpacing ); + void SetMaxWidth( float fMaxWidth ); + void SetMaxHeight( float fMaxHeight ); + void SetWrapWidthPixels( int iWrapWidthPixels ); + void CropToWidth( int iWidthInSourcePixels ); + + virtual bool EarlyAbortDraw() const; + virtual void DrawPrimitives(); + + void SetUppercase( bool b ); + void SetRainbowScroll( bool b ) { m_bRainbowScroll = b; } + void SetJitter( bool b ) { m_bJitter = b; } + + void SetHorizAlign( float f ); + + void SetStrokeColor( RageColor c ) { m_StrokeColor = c; } + RageColor GetStrokeColor() { return m_StrokeColor; } + + void SetTextGlowMode( TextGlowMode tgm ) { m_TextGlowMode = tgm; } + + void GetLines( vector &wTextLines ) const { wTextLines = m_wTextLines; } + const vector &GetLines() const { return m_wTextLines; } + + RString GetText() const { return m_sText; } + // Return true if the string 's' will use an alternate string, if available. + bool StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const; + + struct Attribute + { + Attribute() : length(-1) { } + int length; + RageColor diffuse[4]; + RageColor glow; + + void FromStack( lua_State *L, int iPos ); + }; + + Attribute GetDefaultAttribute() const; + void AddAttribute( size_t iPos, const Attribute &attr ); + void ClearAttributes(); + + // Commands + virtual void PushSelf( lua_State *L ); + +protected: + Font *m_pFont; + bool m_bUppercase; + RString m_sText; + vector m_wTextLines; + vector m_iLineWidths; // in source pixels + int m_iWrapWidthPixels; // -1 = no wrap + float m_fMaxWidth; // 0 = no max + float m_fMaxHeight; // 0 = no max + bool m_bRainbowScroll; + bool m_bJitter; + int m_iVertSpacing; + + vector m_aVertices; + + vector m_vpFontPageTextures; + map m_mAttributes; + bool m_bHasGlowAttribute; + + RageColor m_StrokeColor; + TextGlowMode m_TextGlowMode; + + // recalculate the items in SetText() + void BuildChars(); + void DrawChars( bool bUseStrokeTexture ); + void UpdateBaseZoom(); + +private: + void SetTextInternal(); +}; + +#endif + +/** + * @file + * @author Chris Danford, Charles Lohr, Steve Checkoway (c) 2001-2007 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Bookkeeper.cpp b/src/Bookkeeper.cpp index 3798a26d17..e1137f52f5 100644 --- a/src/Bookkeeper.cpp +++ b/src/Bookkeeper.cpp @@ -1,261 +1,261 @@ -#include "global.h" -#include "Bookkeeper.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "IniFile.h" -#include "GameConstantsAndTypes.h" -#include "SongManager.h" -#include "RageFile.h" -#include "XmlFile.h" -#include "XmlFileUtil.h" -#include - -Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program - -static const RString COINS_DAT = "Save/Coins.xml"; - -Bookkeeper::Bookkeeper() -{ - ClearAll(); - ReadFromDisk(); -} - -Bookkeeper::~Bookkeeper() -{ - WriteToDisk(); -} - -#define WARN_AND_RETURN { LOG->Warn("Error parsing at %s:%d",__FILE__,__LINE__); return; } - -void Bookkeeper::ClearAll() -{ - m_mapCoinsForHour.clear(); -} - -bool Bookkeeper::Date::operator<( const Date &rhs ) const -{ - if( m_iYear != rhs.m_iYear ) - return m_iYear < rhs.m_iYear; - if( m_iDayOfYear != rhs.m_iDayOfYear ) - return m_iDayOfYear < rhs.m_iDayOfYear; - return m_iHour < rhs.m_iHour; -} - -void Bookkeeper::Date::Set( time_t t ) -{ - tm ltime; - localtime_r( &t, <ime ); - - Set( ltime ); -} - -void Bookkeeper::Date::Set( tm pTime ) -{ - m_iHour = pTime.tm_hour; - m_iDayOfYear = pTime.tm_yday; - m_iYear = pTime.tm_year + 1900; -} - -void Bookkeeper::LoadFromNode( const XNode *pNode ) -{ - if( pNode->GetName() != "Bookkeeping" ) - { - LOG->Warn( "Error loading bookkeeping: unexpected \"%s\"", pNode->GetName().c_str() ); - return; - } - - const XNode *pData = pNode->GetChild( "Data" ); - if( pData == NULL ) - { - LOG->Warn( "Error loading bookkeeping: Data node missing" ); - return; - } - - FOREACH_CONST_Child( pData, day ) - { - Date d; - if( !day->GetAttrValue( "Hour", d.m_iHour ) || - !day->GetAttrValue( "Day", d.m_iDayOfYear ) || - !day->GetAttrValue( "Year", d.m_iYear ) ) - { - LOG->Warn( "Incomplete date field" ); - continue; - } - - int iCoins; - day->GetTextValue( iCoins ); - - m_mapCoinsForHour[d] = iCoins; - } -} - -XNode* Bookkeeper::CreateNode() const -{ - XNode *xml = new XNode( "Bookkeeping" ); - - { - XNode* pData = xml->AppendChild("Data"); - - for( map::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) - { - int iCoins = it->second; - XNode *pDay = pData->AppendChild( "Coins", iCoins ); - - const Date &d = it->first; - pDay->AppendAttr( "Hour", d.m_iHour ); - pDay->AppendAttr( "Day", d.m_iDayOfYear ); - pDay->AppendAttr( "Year", d.m_iYear ); - } - } - - return xml; -} - -void Bookkeeper::ReadFromDisk() -{ - if( !IsAFile(COINS_DAT) ) - return; - - XNode xml; - if( !XmlFileUtil::LoadFromFileShowErrors(xml, COINS_DAT) ) - return; - - LoadFromNode( &xml ); -} - -void Bookkeeper::WriteToDisk() -{ - // Write data. Use SLOW_FLUSH, to help ensure that we don't lose coin data. - RageFile f; - if( !f.Open(COINS_DAT, RageFile::WRITE|RageFile::SLOW_FLUSH) ) - { - LOG->Warn( "Couldn't open file \"%s\" for writing: %s", COINS_DAT.c_str(), f.GetError().c_str() ); - return; - } - - auto_ptr xml( CreateNode() ); - XmlFileUtil::SaveToFile( xml.get(), f ); -} - -void Bookkeeper::CoinInserted() -{ - Date d; - d.Set( time(NULL) ); - - ++m_mapCoinsForHour[d]; -} - -// Return the number of coins between [beginning,ending). -int Bookkeeper::GetNumCoinsInRange( map::const_iterator begin, map::const_iterator end ) const -{ - int iCoins = 0; - - while( begin != end ) - { - iCoins += begin->second; - ++begin; - } - - return iCoins; -} - -int Bookkeeper::GetNumCoins( Date beginning, Date ending ) const -{ - return GetNumCoinsInRange( m_mapCoinsForHour.lower_bound( beginning ), - m_mapCoinsForHour.lower_bound( ending ) ); -} - -int Bookkeeper::GetCoinsTotal() const -{ - return GetNumCoinsInRange( m_mapCoinsForHour.begin(), m_mapCoinsForHour.end() ); -} - -void Bookkeeper::GetCoinsLastDays( int coins[NUM_LAST_DAYS] ) const -{ - time_t lOldTime = time(NULL); - tm time; - localtime_r( &lOldTime, &time ); - - time.tm_hour = 0; - - for( int i=0; i::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) - { - const Date &d = it->first; - int iDayOfWeek = GetDayInYearAndYear( d.m_iDayOfYear, d.m_iYear ).tm_wday; - coins[iDayOfWeek] += it->second; - } -} - -void Bookkeeper::GetCoinsByHour( int coins[HOURS_IN_DAY] ) const -{ - memset( coins, 0, sizeof(int) * HOURS_IN_DAY ); - for( map::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) - { - const Date &d = it->first; - - if( d.m_iHour >= HOURS_IN_DAY ) - { - LOG->Warn( "Hour %i >= %i", d.m_iHour, HOURS_IN_DAY ); - continue; - } - - coins[d.m_iHour] += it->second; - } -} - -/* - * (c) 2003-2005 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Bookkeeper.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "IniFile.h" +#include "GameConstantsAndTypes.h" +#include "SongManager.h" +#include "RageFile.h" +#include "XmlFile.h" +#include "XmlFileUtil.h" +#include + +Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program + +static const RString COINS_DAT = "Save/Coins.xml"; + +Bookkeeper::Bookkeeper() +{ + ClearAll(); + ReadFromDisk(); +} + +Bookkeeper::~Bookkeeper() +{ + WriteToDisk(); +} + +#define WARN_AND_RETURN { LOG->Warn("Error parsing at %s:%d",__FILE__,__LINE__); return; } + +void Bookkeeper::ClearAll() +{ + m_mapCoinsForHour.clear(); +} + +bool Bookkeeper::Date::operator<( const Date &rhs ) const +{ + if( m_iYear != rhs.m_iYear ) + return m_iYear < rhs.m_iYear; + if( m_iDayOfYear != rhs.m_iDayOfYear ) + return m_iDayOfYear < rhs.m_iDayOfYear; + return m_iHour < rhs.m_iHour; +} + +void Bookkeeper::Date::Set( time_t t ) +{ + tm ltime; + localtime_r( &t, <ime ); + + Set( ltime ); +} + +void Bookkeeper::Date::Set( tm pTime ) +{ + m_iHour = pTime.tm_hour; + m_iDayOfYear = pTime.tm_yday; + m_iYear = pTime.tm_year + 1900; +} + +void Bookkeeper::LoadFromNode( const XNode *pNode ) +{ + if( pNode->GetName() != "Bookkeeping" ) + { + LOG->Warn( "Error loading bookkeeping: unexpected \"%s\"", pNode->GetName().c_str() ); + return; + } + + const XNode *pData = pNode->GetChild( "Data" ); + if( pData == NULL ) + { + LOG->Warn( "Error loading bookkeeping: Data node missing" ); + return; + } + + FOREACH_CONST_Child( pData, day ) + { + Date d; + if( !day->GetAttrValue( "Hour", d.m_iHour ) || + !day->GetAttrValue( "Day", d.m_iDayOfYear ) || + !day->GetAttrValue( "Year", d.m_iYear ) ) + { + LOG->Warn( "Incomplete date field" ); + continue; + } + + int iCoins; + day->GetTextValue( iCoins ); + + m_mapCoinsForHour[d] = iCoins; + } +} + +XNode* Bookkeeper::CreateNode() const +{ + XNode *xml = new XNode( "Bookkeeping" ); + + { + XNode* pData = xml->AppendChild("Data"); + + for( map::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) + { + int iCoins = it->second; + XNode *pDay = pData->AppendChild( "Coins", iCoins ); + + const Date &d = it->first; + pDay->AppendAttr( "Hour", d.m_iHour ); + pDay->AppendAttr( "Day", d.m_iDayOfYear ); + pDay->AppendAttr( "Year", d.m_iYear ); + } + } + + return xml; +} + +void Bookkeeper::ReadFromDisk() +{ + if( !IsAFile(COINS_DAT) ) + return; + + XNode xml; + if( !XmlFileUtil::LoadFromFileShowErrors(xml, COINS_DAT) ) + return; + + LoadFromNode( &xml ); +} + +void Bookkeeper::WriteToDisk() +{ + // Write data. Use SLOW_FLUSH, to help ensure that we don't lose coin data. + RageFile f; + if( !f.Open(COINS_DAT, RageFile::WRITE|RageFile::SLOW_FLUSH) ) + { + LOG->Warn( "Couldn't open file \"%s\" for writing: %s", COINS_DAT.c_str(), f.GetError().c_str() ); + return; + } + + auto_ptr xml( CreateNode() ); + XmlFileUtil::SaveToFile( xml.get(), f ); +} + +void Bookkeeper::CoinInserted() +{ + Date d; + d.Set( time(NULL) ); + + ++m_mapCoinsForHour[d]; +} + +// Return the number of coins between [beginning,ending). +int Bookkeeper::GetNumCoinsInRange( map::const_iterator begin, map::const_iterator end ) const +{ + int iCoins = 0; + + while( begin != end ) + { + iCoins += begin->second; + ++begin; + } + + return iCoins; +} + +int Bookkeeper::GetNumCoins( Date beginning, Date ending ) const +{ + return GetNumCoinsInRange( m_mapCoinsForHour.lower_bound( beginning ), + m_mapCoinsForHour.lower_bound( ending ) ); +} + +int Bookkeeper::GetCoinsTotal() const +{ + return GetNumCoinsInRange( m_mapCoinsForHour.begin(), m_mapCoinsForHour.end() ); +} + +void Bookkeeper::GetCoinsLastDays( int coins[NUM_LAST_DAYS] ) const +{ + time_t lOldTime = time(NULL); + tm time; + localtime_r( &lOldTime, &time ); + + time.tm_hour = 0; + + for( int i=0; i::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) + { + const Date &d = it->first; + int iDayOfWeek = GetDayInYearAndYear( d.m_iDayOfYear, d.m_iYear ).tm_wday; + coins[iDayOfWeek] += it->second; + } +} + +void Bookkeeper::GetCoinsByHour( int coins[HOURS_IN_DAY] ) const +{ + memset( coins, 0, sizeof(int) * HOURS_IN_DAY ); + for( map::const_iterator it = m_mapCoinsForHour.begin(); it != m_mapCoinsForHour.end(); ++it ) + { + const Date &d = it->first; + + if( d.m_iHour >= HOURS_IN_DAY ) + { + LOG->Warn( "Hour %i >= %i", d.m_iHour, HOURS_IN_DAY ); + continue; + } + + coins[d.m_iHour] += it->second; + } +} + +/* + * (c) 2003-2005 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Bookkeeper.h b/src/Bookkeeper.h index b1014c04f5..cddef0b9f6 100644 --- a/src/Bookkeeper.h +++ b/src/Bookkeeper.h @@ -1,93 +1,93 @@ -#ifndef Bookkeeper_H -#define Bookkeeper_H - -#include "DateTime.h" -#include -class XNode; - -/** @brief Track when coins were put into the machine. */ -class Bookkeeper -{ -public: - Bookkeeper(); - ~Bookkeeper(); - - void ClearAll(); - - void CoinInserted(); - - int GetCoinsTotal() const; - void GetCoinsLastDays( int coins[NUM_LAST_DAYS] ) const; - void GetCoinsLastWeeks( int coins[NUM_LAST_WEEKS] ) const; - void GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] ) const; - void GetCoinsByHour( int coins[HOURS_IN_DAY] ) const; - - void LoadFromNode( const XNode *pNode ); - XNode* CreateNode() const; - - void ReadFromDisk(); - void WriteToDisk(); - -private: - /** @brief A simple way of handling the date. */ - struct Date - { - /** - * @brief The hour of the date. - * - * The value 0 is defined to be midnight. */ - int m_iHour; - /** - * @brief The day of the year of the date. - * - * The value 0 is defined to be January 1st. */ - int m_iDayOfYear; - /** @brief The year of the date (e.g., 2005). */ - int m_iYear; - /** @brief Set up a date with initial values. */ - Date() { m_iHour = m_iDayOfYear = m_iYear = 0; } - /** - * @brief Set up a date based on the given time. - * @param time the time to turn into a Date. */ - Date( tm time ) { Set(time); } - void Set( time_t t ); - void Set( tm pTime ); - bool operator<( const Date &rhs ) const; - }; - int GetNumCoins( Date beginning, Date ending ) const; - int GetNumCoinsInRange( map::const_iterator begin, map::const_iterator end ) const; - - int m_iLastSeenTime; - map m_mapCoinsForHour; -}; - -extern Bookkeeper* BOOKKEEPER; // global and accessable from anywhere in our program - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef Bookkeeper_H +#define Bookkeeper_H + +#include "DateTime.h" +#include +class XNode; + +/** @brief Track when coins were put into the machine. */ +class Bookkeeper +{ +public: + Bookkeeper(); + ~Bookkeeper(); + + void ClearAll(); + + void CoinInserted(); + + int GetCoinsTotal() const; + void GetCoinsLastDays( int coins[NUM_LAST_DAYS] ) const; + void GetCoinsLastWeeks( int coins[NUM_LAST_WEEKS] ) const; + void GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] ) const; + void GetCoinsByHour( int coins[HOURS_IN_DAY] ) const; + + void LoadFromNode( const XNode *pNode ); + XNode* CreateNode() const; + + void ReadFromDisk(); + void WriteToDisk(); + +private: + /** @brief A simple way of handling the date. */ + struct Date + { + /** + * @brief The hour of the date. + * + * The value 0 is defined to be midnight. */ + int m_iHour; + /** + * @brief The day of the year of the date. + * + * The value 0 is defined to be January 1st. */ + int m_iDayOfYear; + /** @brief The year of the date (e.g., 2005). */ + int m_iYear; + /** @brief Set up a date with initial values. */ + Date() { m_iHour = m_iDayOfYear = m_iYear = 0; } + /** + * @brief Set up a date based on the given time. + * @param time the time to turn into a Date. */ + Date( tm time ) { Set(time); } + void Set( time_t t ); + void Set( tm pTime ); + bool operator<( const Date &rhs ) const; + }; + int GetNumCoins( Date beginning, Date ending ) const; + int GetNumCoinsInRange( map::const_iterator begin, map::const_iterator end ) const; + + int m_iLastSeenTime; + map m_mapCoinsForHour; +}; + +extern Bookkeeper* BOOKKEEPER; // global and accessable from anywhere in our program + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Character.cpp b/src/Character.cpp index 82146c5b69..209d3c7fa3 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -1,259 +1,259 @@ -#include "global.h" -#include "Character.h" -#include "IniFile.h" -#include "RageUtil.h" -#include "RageTextureID.h" -#include "ActorUtil.h" - -Character::Character(): m_sCharDir(""), m_sCharacterID(""), - m_sDisplayName(""), m_sCardPath(""), m_sIconPath(""), - m_bUsableInRave(false), m_iPreloadRefcount(0) {} - -bool Character::Load( RString sCharDir ) -{ - // Save character directory - if( sCharDir.Right(1) != "/" ) - sCharDir += "/"; - m_sCharDir = sCharDir; - - // save ID - { - vector as; - split( sCharDir, "/", as ); - m_sCharacterID = as.back(); - } - - { - vector as; - GetDirListing( m_sCharDir+"card.png", as, false, true ); - GetDirListing( m_sCharDir+"card.jpg", as, false, true ); - GetDirListing( m_sCharDir+"card.gif", as, false, true ); - GetDirListing( m_sCharDir+"card.bmp", as, false, true ); - if( as.empty() ) - m_sCardPath = ""; - else - m_sCardPath = as[0]; - } - - { - vector as; - GetDirListing( m_sCharDir+"icon.png", as, false, true ); - GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); - GetDirListing( m_sCharDir+"icon.gif", as, false, true ); - GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); - if( as.empty() ) - m_sIconPath = ""; - else - m_sIconPath = as[0]; - } - - // Save attacks - IniFile ini; - if( !ini.ReadFile( sCharDir+"character.ini" ) ) - return false; - for( int i=0; i asFiles; - GetDirListing( sDir, asFiles, false, true ); - if( asFiles.empty() ) - return RString(); - else - return asFiles[RandomInt(asFiles.size())]; -} - -RString Character::GetModelPath() const -{ - RString s = m_sCharDir + "model.txt"; - if( DoesFileExist(s) ) - return s; - else - return RString(); -} - -RString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); } -RString Character::GetWarmUpAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp/")); } -RString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); } -RString Character::GetTakingABreakPath() const -{ - vector as; - GetDirListing( m_sCharDir+"break.png", as, false, true ); - GetDirListing( m_sCharDir+"break.jpg", as, false, true ); - GetDirListing( m_sCharDir+"break.gif", as, false, true ); - GetDirListing( m_sCharDir+"break.bmp", as, false, true ); - if( as.empty() ) - return RString(); - else - return as[0]; -} - -RString Character::GetSongSelectIconPath() const -{ - vector as; - // first try and find an icon specific to the select music screen - // so you can have different icons for music select / char select - GetDirListing( m_sCharDir+"selectmusicicon.png", as, false, true ); - GetDirListing( m_sCharDir+"selectmusicicon.jpg", as, false, true ); - GetDirListing( m_sCharDir+"selectmusicicon.gif", as, false, true ); - GetDirListing( m_sCharDir+"selectmusicicon.bmp", as, false, true ); - - if( as.empty() ) - { - // if that failed, try using the regular icon - GetDirListing( m_sCharDir+"icon.png", as, false, true ); - GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); - GetDirListing( m_sCharDir+"icon.gif", as, false, true ); - GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); - if( as.empty() ) - return RString(); - else - return as[0]; - } - else - return as[0]; -} - -RString Character::GetStageIconPath() const -{ - vector as; - // first try and find an icon specific to the select music screen - // so you can have different icons for music select / char select - GetDirListing( m_sCharDir+"stageicon.png", as, false, true ); - GetDirListing( m_sCharDir+"stageicon.jpg", as, false, true ); - GetDirListing( m_sCharDir+"stageicon.gif", as, false, true ); - GetDirListing( m_sCharDir+"stageicon.bmp", as, false, true ); - - if( as.empty() ) - { - // if that failed, try using the regular icon - GetDirListing( m_sCharDir+"card.png", as, false, true ); - GetDirListing( m_sCharDir+"card.jpg", as, false, true ); - GetDirListing( m_sCharDir+"card.gif", as, false, true ); - GetDirListing( m_sCharDir+"card.bmp", as, false, true ); - if( as.empty() ) - return RString(); - else - return as[0]; - } - else - return as[0]; -} - -bool Character::Has2DElems() -{ - if( DoesFileExist(m_sCharDir + "2DFail/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DFever/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DGood/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DMiss/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DWin/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DWinFever/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DGreat/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - if( DoesFileExist(m_sCharDir + "2DIdle/BGAnimation.ini") ) // check 2D Idle BGAnim exists - return true; - return false; -} - -void Character::DemandGraphics() -{ - ++m_iPreloadRefcount; - if( m_iPreloadRefcount == 1 ) - { - RString s = GetIconPath(); - if( !s.empty() ) - m_Preload.Load( s ); - } -} - -void Character::UndemandGraphics() -{ - --m_iPreloadRefcount; - if( m_iPreloadRefcount == 0 ) - m_Preload.UnloadAll(); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the Character. */ -class LunaCharacter: public Luna -{ -public: - static int GetCardPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetCardPath() ); return 1; } - static int GetIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetIconPath() ); return 1; } - static int GetSongSelectIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetSongSelectIconPath() ); return 1; } - static int GetStageIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetStageIconPath() ); return 1; } - static int GetModelPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetModelPath() ); return 1; } - static int GetRestAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetRestAnimationPath() ); return 1; } - static int GetWarmUpAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetWarmUpAnimationPath() ); return 1; } - static int GetDanceAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetDanceAnimationPath() ); return 1; } - static int GetCharacterDir( T* p, lua_State *L ) { lua_pushstring(L, p->m_sCharDir ); return 1; } - static int GetCharacterID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sCharacterID ); return 1; } - static int GetDisplayName( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayName() ); return 1; } - - LunaCharacter() - { - ADD_METHOD( GetCardPath ); - ADD_METHOD( GetIconPath ); - ADD_METHOD( GetSongSelectIconPath ); - ADD_METHOD( GetStageIconPath ); - // sm-ssc adds: - ADD_METHOD( GetModelPath ); - ADD_METHOD( GetRestAnimationPath ); - ADD_METHOD( GetWarmUpAnimationPath ); - ADD_METHOD( GetDanceAnimationPath ); - ADD_METHOD( GetCharacterDir ); - ADD_METHOD( GetCharacterID ); - ADD_METHOD( GetDisplayName ); - } -}; - -LUA_REGISTER_CLASS( Character ) -// lua end - -/* - * (c) 2003 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Character.h" +#include "IniFile.h" +#include "RageUtil.h" +#include "RageTextureID.h" +#include "ActorUtil.h" + +Character::Character(): m_sCharDir(""), m_sCharacterID(""), + m_sDisplayName(""), m_sCardPath(""), m_sIconPath(""), + m_bUsableInRave(false), m_iPreloadRefcount(0) {} + +bool Character::Load( RString sCharDir ) +{ + // Save character directory + if( sCharDir.Right(1) != "/" ) + sCharDir += "/"; + m_sCharDir = sCharDir; + + // save ID + { + vector as; + split( sCharDir, "/", as ); + m_sCharacterID = as.back(); + } + + { + vector as; + GetDirListing( m_sCharDir+"card.png", as, false, true ); + GetDirListing( m_sCharDir+"card.jpg", as, false, true ); + GetDirListing( m_sCharDir+"card.gif", as, false, true ); + GetDirListing( m_sCharDir+"card.bmp", as, false, true ); + if( as.empty() ) + m_sCardPath = ""; + else + m_sCardPath = as[0]; + } + + { + vector as; + GetDirListing( m_sCharDir+"icon.png", as, false, true ); + GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"icon.gif", as, false, true ); + GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); + if( as.empty() ) + m_sIconPath = ""; + else + m_sIconPath = as[0]; + } + + // Save attacks + IniFile ini; + if( !ini.ReadFile( sCharDir+"character.ini" ) ) + return false; + for( int i=0; i asFiles; + GetDirListing( sDir, asFiles, false, true ); + if( asFiles.empty() ) + return RString(); + else + return asFiles[RandomInt(asFiles.size())]; +} + +RString Character::GetModelPath() const +{ + RString s = m_sCharDir + "model.txt"; + if( DoesFileExist(s) ) + return s; + else + return RString(); +} + +RString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); } +RString Character::GetWarmUpAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp/")); } +RString Character::GetDanceAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); } +RString Character::GetTakingABreakPath() const +{ + vector as; + GetDirListing( m_sCharDir+"break.png", as, false, true ); + GetDirListing( m_sCharDir+"break.jpg", as, false, true ); + GetDirListing( m_sCharDir+"break.gif", as, false, true ); + GetDirListing( m_sCharDir+"break.bmp", as, false, true ); + if( as.empty() ) + return RString(); + else + return as[0]; +} + +RString Character::GetSongSelectIconPath() const +{ + vector as; + // first try and find an icon specific to the select music screen + // so you can have different icons for music select / char select + GetDirListing( m_sCharDir+"selectmusicicon.png", as, false, true ); + GetDirListing( m_sCharDir+"selectmusicicon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"selectmusicicon.gif", as, false, true ); + GetDirListing( m_sCharDir+"selectmusicicon.bmp", as, false, true ); + + if( as.empty() ) + { + // if that failed, try using the regular icon + GetDirListing( m_sCharDir+"icon.png", as, false, true ); + GetDirListing( m_sCharDir+"icon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"icon.gif", as, false, true ); + GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); + if( as.empty() ) + return RString(); + else + return as[0]; + } + else + return as[0]; +} + +RString Character::GetStageIconPath() const +{ + vector as; + // first try and find an icon specific to the select music screen + // so you can have different icons for music select / char select + GetDirListing( m_sCharDir+"stageicon.png", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.jpg", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.gif", as, false, true ); + GetDirListing( m_sCharDir+"stageicon.bmp", as, false, true ); + + if( as.empty() ) + { + // if that failed, try using the regular icon + GetDirListing( m_sCharDir+"card.png", as, false, true ); + GetDirListing( m_sCharDir+"card.jpg", as, false, true ); + GetDirListing( m_sCharDir+"card.gif", as, false, true ); + GetDirListing( m_sCharDir+"card.bmp", as, false, true ); + if( as.empty() ) + return RString(); + else + return as[0]; + } + else + return as[0]; +} + +bool Character::Has2DElems() +{ + if( DoesFileExist(m_sCharDir + "2DFail/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DFever/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DGood/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DMiss/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DWin/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DWinFever/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DGreat/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + if( DoesFileExist(m_sCharDir + "2DIdle/BGAnimation.ini") ) // check 2D Idle BGAnim exists + return true; + return false; +} + +void Character::DemandGraphics() +{ + ++m_iPreloadRefcount; + if( m_iPreloadRefcount == 1 ) + { + RString s = GetIconPath(); + if( !s.empty() ) + m_Preload.Load( s ); + } +} + +void Character::UndemandGraphics() +{ + --m_iPreloadRefcount; + if( m_iPreloadRefcount == 0 ) + m_Preload.UnloadAll(); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the Character. */ +class LunaCharacter: public Luna +{ +public: + static int GetCardPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetCardPath() ); return 1; } + static int GetIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetIconPath() ); return 1; } + static int GetSongSelectIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetSongSelectIconPath() ); return 1; } + static int GetStageIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetStageIconPath() ); return 1; } + static int GetModelPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetModelPath() ); return 1; } + static int GetRestAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetRestAnimationPath() ); return 1; } + static int GetWarmUpAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetWarmUpAnimationPath() ); return 1; } + static int GetDanceAnimationPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetDanceAnimationPath() ); return 1; } + static int GetCharacterDir( T* p, lua_State *L ) { lua_pushstring(L, p->m_sCharDir ); return 1; } + static int GetCharacterID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sCharacterID ); return 1; } + static int GetDisplayName( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayName() ); return 1; } + + LunaCharacter() + { + ADD_METHOD( GetCardPath ); + ADD_METHOD( GetIconPath ); + ADD_METHOD( GetSongSelectIconPath ); + ADD_METHOD( GetStageIconPath ); + // sm-ssc adds: + ADD_METHOD( GetModelPath ); + ADD_METHOD( GetRestAnimationPath ); + ADD_METHOD( GetWarmUpAnimationPath ); + ADD_METHOD( GetDanceAnimationPath ); + ADD_METHOD( GetCharacterDir ); + ADD_METHOD( GetCharacterID ); + ADD_METHOD( GetDisplayName ); + } +}; + +LUA_REGISTER_CLASS( Character ) +// lua end + +/* + * (c) 2003 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Character.h b/src/Character.h index 15a0a78f24..d8c7f9fba2 100644 --- a/src/Character.h +++ b/src/Character.h @@ -1,92 +1,92 @@ -#ifndef Character_H -#define Character_H - -#include "GameConstantsAndTypes.h" -#include "RageTexturePreloader.h" -#include "LuaReference.h" -struct lua_State; -typedef lua_State Lua; - -/** @brief A persona that defines attacks for use in battle. */ -class Character -{ -public: - Character(); - ~Character() { } - - bool Load( RString sCharDir ); // return true if successful - - RString GetTakingABreakPath() const; - RString GetCardPath() const { return m_sCardPath; } - RString GetIconPath() const { return m_sIconPath; } - - RString GetModelPath() const; - RString GetRestAnimationPath() const; - RString GetWarmUpAnimationPath() const; - RString GetDanceAnimationPath() const; - RString GetSongSelectIconPath() const; - RString GetStageIconPath() const; - bool Has2DElems(); - - bool IsDefaultCharacter() const - { - return m_sCharacterID.CompareNoCase("default") == 0; - } - - void DemandGraphics(); - void UndemandGraphics(); - - // Lua - void PushSelf( Lua *L ); - - // smart accessor - const RString &GetDisplayName() { return !m_sDisplayName.empty() ? m_sDisplayName : m_sCharacterID; } - - RString m_sCharDir; - RString m_sCharacterID; - -private: - RString m_sDisplayName; - RString m_sCardPath; - RString m_sIconPath; - -public: - apActorCommands m_cmdInit; - - /** - * @brief Is this character playable in the Rave mode? - * - * All of the variables listed below here will be filled in if true. */ - bool m_bUsableInRave; - - RString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; - RageTexturePreloader m_Preload; - int m_iPreloadRefcount; -}; - -#endif - -/* - * (c) 2003 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef Character_H +#define Character_H + +#include "GameConstantsAndTypes.h" +#include "RageTexturePreloader.h" +#include "LuaReference.h" +struct lua_State; +typedef lua_State Lua; + +/** @brief A persona that defines attacks for use in battle. */ +class Character +{ +public: + Character(); + ~Character() { } + + bool Load( RString sCharDir ); // return true if successful + + RString GetTakingABreakPath() const; + RString GetCardPath() const { return m_sCardPath; } + RString GetIconPath() const { return m_sIconPath; } + + RString GetModelPath() const; + RString GetRestAnimationPath() const; + RString GetWarmUpAnimationPath() const; + RString GetDanceAnimationPath() const; + RString GetSongSelectIconPath() const; + RString GetStageIconPath() const; + bool Has2DElems(); + + bool IsDefaultCharacter() const + { + return m_sCharacterID.CompareNoCase("default") == 0; + } + + void DemandGraphics(); + void UndemandGraphics(); + + // Lua + void PushSelf( Lua *L ); + + // smart accessor + const RString &GetDisplayName() { return !m_sDisplayName.empty() ? m_sDisplayName : m_sCharacterID; } + + RString m_sCharDir; + RString m_sCharacterID; + +private: + RString m_sDisplayName; + RString m_sCardPath; + RString m_sIconPath; + +public: + apActorCommands m_cmdInit; + + /** + * @brief Is this character playable in the Rave mode? + * + * All of the variables listed below here will be filled in if true. */ + bool m_bUsableInRave; + + RString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; + RageTexturePreloader m_Preload; + int m_iPreloadRefcount; +}; + +#endif + +/* + * (c) 2003 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CharacterManager.cpp b/src/CharacterManager.cpp index f00522ec7c..10cf6a26d6 100644 --- a/src/CharacterManager.cpp +++ b/src/CharacterManager.cpp @@ -1,192 +1,192 @@ -#include "global.h" -#include "CharacterManager.h" -#include "Character.h" -#include "GameState.h" -#include "Foreach.h" -#include "LuaManager.h" - -#define CHARACTERS_DIR "/Characters/" - -CharacterManager* CHARMAN = NULL; // global object accessable from anywhere in the program - -CharacterManager::CharacterManager() -{ - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "CHARMAN" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } - - for( unsigned i=0; i as; - GetDirListing( CHARACTERS_DIR "*", as, true, true ); - StripCvsAndSvn( as ); - StripMacResourceForks( as ); - - bool FoundDefault = false; - for( unsigned i=0; iLoad( as[i] ) ) - m_pCharacters.push_back( pChar ); - else - delete pChar; - } - - if( !FoundDefault ) - RageException::Throw( "'Characters/default' is missing." ); - - // If FoundDefault, then we're not empty. -Chris -// if( m_pCharacters.empty() ) -// RageException::Throw( "Couldn't find any character definitions" ); -} - -CharacterManager::~CharacterManager() -{ - for( unsigned i=0; iUnsetGlobal( "CHARMAN" ); -} - -void CharacterManager::GetCharacters( vector &apCharactersOut ) -{ - for( unsigned i=0; iIsDefaultCharacter() ) - apCharactersOut.push_back( m_pCharacters[i] ); -} - -Character* CharacterManager::GetRandomCharacter() -{ - vector apCharacters; - GetCharacters( apCharacters ); - if( apCharacters.size() ) - return apCharacters[RandomInt(apCharacters.size())]; - else - return GetDefaultCharacter(); -} - -Character* CharacterManager::GetDefaultCharacter() -{ - for( unsigned i=0; iIsDefaultCharacter() ) - return m_pCharacters[i]; - } - - /* We always have the default character. */ - ASSERT(0); - return NULL; -} - -void CharacterManager::DemandGraphics() -{ - FOREACH( Character*, m_pCharacters, c ) - (*c)->DemandGraphics(); -} - -void CharacterManager::UndemandGraphics() -{ - FOREACH( Character*, m_pCharacters, c ) - (*c)->UndemandGraphics(); -} - -Character* CharacterManager::GetCharacterFromID( RString sCharacterID ) -{ - for( unsigned i=0; im_sCharacterID == sCharacterID ) - return m_pCharacters[i]; - } - - return NULL; -} - - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the CharacterManager. */ -class LunaCharacterManager: public Luna -{ -public: - static int GetCharacter( T* p, lua_State *L ) - { - Character *pCharacter = p->GetCharacterFromID(SArg(1)); - if( pCharacter != NULL ) - pCharacter->PushSelf( L ); - else - lua_pushnil( L ); - - return 1; - } - static int GetRandomCharacter( T* p, lua_State *L ) - { - Character *pCharacter = p->GetRandomCharacter(); - if( pCharacter != NULL ) - pCharacter->PushSelf( L ); - else - lua_pushnil( L ); - - return 1; - } - static int GetAllCharacters( T* p, lua_State *L ) - { - vector vChars; - p->GetCharacters(vChars); - - LuaHelpers::CreateTableFromArray(vChars, L); - return 1; - } - - LunaCharacterManager() - { - ADD_METHOD( GetCharacter ); - // sm-ssc adds: - ADD_METHOD( GetRandomCharacter ); - ADD_METHOD( GetAllCharacters ); - } -}; - -LUA_REGISTER_CLASS( CharacterManager ) -// lua end - - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CharacterManager.h" +#include "Character.h" +#include "GameState.h" +#include "Foreach.h" +#include "LuaManager.h" + +#define CHARACTERS_DIR "/Characters/" + +CharacterManager* CHARMAN = NULL; // global object accessable from anywhere in the program + +CharacterManager::CharacterManager() +{ + // Register with Lua. + { + Lua *L = LUA->Get(); + lua_pushstring( L, "CHARMAN" ); + this->PushSelf( L ); + lua_settable( L, LUA_GLOBALSINDEX ); + LUA->Release( L ); + } + + for( unsigned i=0; i as; + GetDirListing( CHARACTERS_DIR "*", as, true, true ); + StripCvsAndSvn( as ); + StripMacResourceForks( as ); + + bool FoundDefault = false; + for( unsigned i=0; iLoad( as[i] ) ) + m_pCharacters.push_back( pChar ); + else + delete pChar; + } + + if( !FoundDefault ) + RageException::Throw( "'Characters/default' is missing." ); + + // If FoundDefault, then we're not empty. -Chris +// if( m_pCharacters.empty() ) +// RageException::Throw( "Couldn't find any character definitions" ); +} + +CharacterManager::~CharacterManager() +{ + for( unsigned i=0; iUnsetGlobal( "CHARMAN" ); +} + +void CharacterManager::GetCharacters( vector &apCharactersOut ) +{ + for( unsigned i=0; iIsDefaultCharacter() ) + apCharactersOut.push_back( m_pCharacters[i] ); +} + +Character* CharacterManager::GetRandomCharacter() +{ + vector apCharacters; + GetCharacters( apCharacters ); + if( apCharacters.size() ) + return apCharacters[RandomInt(apCharacters.size())]; + else + return GetDefaultCharacter(); +} + +Character* CharacterManager::GetDefaultCharacter() +{ + for( unsigned i=0; iIsDefaultCharacter() ) + return m_pCharacters[i]; + } + + /* We always have the default character. */ + ASSERT(0); + return NULL; +} + +void CharacterManager::DemandGraphics() +{ + FOREACH( Character*, m_pCharacters, c ) + (*c)->DemandGraphics(); +} + +void CharacterManager::UndemandGraphics() +{ + FOREACH( Character*, m_pCharacters, c ) + (*c)->UndemandGraphics(); +} + +Character* CharacterManager::GetCharacterFromID( RString sCharacterID ) +{ + for( unsigned i=0; im_sCharacterID == sCharacterID ) + return m_pCharacters[i]; + } + + return NULL; +} + + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the CharacterManager. */ +class LunaCharacterManager: public Luna +{ +public: + static int GetCharacter( T* p, lua_State *L ) + { + Character *pCharacter = p->GetCharacterFromID(SArg(1)); + if( pCharacter != NULL ) + pCharacter->PushSelf( L ); + else + lua_pushnil( L ); + + return 1; + } + static int GetRandomCharacter( T* p, lua_State *L ) + { + Character *pCharacter = p->GetRandomCharacter(); + if( pCharacter != NULL ) + pCharacter->PushSelf( L ); + else + lua_pushnil( L ); + + return 1; + } + static int GetAllCharacters( T* p, lua_State *L ) + { + vector vChars; + p->GetCharacters(vChars); + + LuaHelpers::CreateTableFromArray(vChars, L); + return 1; + } + + LunaCharacterManager() + { + ADD_METHOD( GetCharacter ); + // sm-ssc adds: + ADD_METHOD( GetRandomCharacter ); + ADD_METHOD( GetAllCharacters ); + } +}; + +LUA_REGISTER_CLASS( CharacterManager ) +// lua end + + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CharacterManager.h b/src/CharacterManager.h index f6d383201c..bd49c20c5e 100644 --- a/src/CharacterManager.h +++ b/src/CharacterManager.h @@ -1,59 +1,59 @@ -/* CharacterManager - Manage characters. */ - -#ifndef CHARACTER_MANAGER_H -#define CHARACTER_MANAGER_H - -class Character; -struct lua_State; - -class CharacterManager -{ -public: - CharacterManager(); - ~CharacterManager(); - - void GetCharacters( vector &vpCharactersOut ); - Character* GetRandomCharacter(); - Character* GetDefaultCharacter(); - Character* GetCharacterFromID( RString sCharacterID ); - - void DemandGraphics(); - void UndemandGraphics(); - - // Lua - void PushSelf( lua_State *L ); - -private: - vector m_pCharacters; - -}; - - -extern CharacterManager* CHARMAN; // global and accessable from anywhere in our program - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* CharacterManager - Manage characters. */ + +#ifndef CHARACTER_MANAGER_H +#define CHARACTER_MANAGER_H + +class Character; +struct lua_State; + +class CharacterManager +{ +public: + CharacterManager(); + ~CharacterManager(); + + void GetCharacters( vector &vpCharactersOut ); + Character* GetRandomCharacter(); + Character* GetDefaultCharacter(); + Character* GetCharacterFromID( RString sCharacterID ); + + void DemandGraphics(); + void UndemandGraphics(); + + // Lua + void PushSelf( lua_State *L ); + +private: + vector m_pCharacters; + +}; + + +extern CharacterManager* CHARMAN; // global and accessable from anywhere in our program + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CodeDetector.cpp b/src/CodeDetector.cpp index 7584739ec2..5630894b91 100644 --- a/src/CodeDetector.cpp +++ b/src/CodeDetector.cpp @@ -1,263 +1,263 @@ -#include "global.h" -#include "CodeDetector.h" -#include "PlayerOptions.h" -#include "GameState.h" -#include "InputQueue.h" -#include "ThemeManager.h" -#include "RageLog.h" -#include "Game.h" -#include "RageUtil.h" -#include "PlayerState.h" -#include "InputEventPlus.h" -#include "OptionRowHandler.h" - -const char *CodeNames[] = { - "PrevSteps1", - "PrevSteps2", - "NextSteps1", - "NextSteps2", - "NextSort1", - "NextSort2", - "NextSort3", - "NextSort4", - "ModeMenu1", - "ModeMenu2", - "Mirror", - "Left", - "Right", - "Shuffle", - "SuperShuffle", - "NextTransform", - "NextScrollSpeed", - "PreviousScrollSpeed", - "NextAccel", - "NextEffect", - "NextAppearance", - "NextTurn", - "Reverse", - "HoldNotes", - "Mines", - "Dark", - "Hidden", - "RandomVanish", - "CancelAll", - "NextTheme", - "NextTheme2", - "NextAnnouncer", - "NextAnnouncer2", - "NextGroup", - "PrevGroup", - "SaveScreenshot1", - "SaveScreenshot2", - "CancelAllPlayerOptions", - "BackInEventMode", - "CloseCurrentFolder", -}; -XToString( Code ); - -static InputQueueCode g_CodeItems[NUM_Code]; - -bool CodeDetector::EnteredCode( GameController controller, Code code ) -{ - return g_CodeItems[code].EnteredCode( controller ); -} - - -void CodeDetector::RefreshCacheItems( RString sClass ) -{ - if( sClass == "" ) - sClass = "CodeDetector"; - FOREACH_ENUM( Code, c ) - { - InputQueueCode& item = g_CodeItems[c]; - const RString sCodeName = CodeToString(c); - const RString sButtonsNames = THEME->GetMetric(sClass,sCodeName); - - item.Load( sButtonsNames ); - } -} - -bool CodeDetector::EnteredCloseFolder( GameController controller ) -{ - return EnteredCode(controller,CODE_CLOSE_CURRENT_FOLDER); -} - -bool CodeDetector::EnteredNextGroup( GameController controller ) -{ - return EnteredCode(controller,CODE_NEXT_GROUP); -} - -bool CodeDetector::EnteredPrevGroup( GameController controller ) -{ - return EnteredCode(controller,CODE_PREV_GROUP); -} - -bool CodeDetector::EnteredPrevSteps( GameController controller ) -{ - return EnteredCode(controller,Code_PrevSteps1) || EnteredCode(controller,Code_PrevSteps2); -} - -bool CodeDetector::EnteredNextSteps( GameController controller ) -{ - return EnteredCode(controller,Code_NextSteps1) || EnteredCode(controller,Code_NextSteps2); -} - -bool CodeDetector::EnteredNextSort( GameController controller ) -{ - return EnteredCode(controller,CODE_NEXT_SORT1) || - EnteredCode(controller,CODE_NEXT_SORT2) || - EnteredCode(controller,CODE_NEXT_SORT3) || - EnteredCode(controller,CODE_NEXT_SORT4); -} - -bool CodeDetector::EnteredModeMenu( GameController controller ) -{ - return EnteredCode(controller,CODE_MODE_MENU1) || EnteredCode(controller,CODE_MODE_MENU2); -} - -#define TOGGLE(v,a,b) if(v!=a) v=a; else v=b; -#define FLOAT_TOGGLE(v) if(v!=1.f) v=1.f; else v=0.f; -// XXX: Read the metrics file instead! -// Using this can give us unlisted scroll speeds on the Options screen. -// Zmey: done. -// AJ: thanks Zmey! :D -#define INCREMENT_SCROLL_SPEED(s) (s==0.5f) ? s=0.75f : (s==0.75f) ? s=1.0f : (s==1.0f) ? s=1.5f : (s==1.5f) ? s=2.0f : (s==2.0f) ? s=3.0f : (s==3.0f) ? s=4.0f : (s==4.0f) ? s=5.0f : (s==5.0f) ? s=8.0f : s=0.5f; -#define DECREMENT_SCROLL_SPEED(s) (s==0.75f) ? s=0.5f : (s==1.0f) ? s=0.75f : (s==1.5f) ? s=1.0f : (s==2.0f) ? s=1.5f : (s==3.0f) ? s=2.0f : (s==4.0f) ? s=3.0f : (s==5.0f) ? s=4.0f : (s==8.0f) ? s=4.0f : s=8.0f; - -// from Pumpmania -void CodeDetector::ChangeScrollSpeed( GameController controller, bool bIncrement ) -{ - // this doesn't compile, hence the #if 0 below. - // also I bet this code actually belongs in PlayerOptions.cpp - // on further inspection. -aj - // p.s. it's m_fScrollSpeed you'll want to mess with. -#if 0 - // opt = PlayerOptions - // setup - PlayerNumber pn = INPUTMAPPER->ControllerToPlayerNumber( controller ); - PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); - - /* what this code seems to be doing is: - * 1) getting the Speed line from the theme - * 2) throwing it into a vector - * 3) getting the current scroll speed (fallback on 1x) - * 4) loop through the entries until you find the current mod - * 5) check if it's increment/decrement, act accordingly - * 6) set mod and return. - * 7) "Current SpeedMod not found in Theme, revert to default" - * although I'd rather have it move to the next possible value at - * that point. If it's invalid, then revert to the default. - */ - - OptionRowData row; - OptionRowHandler hand; - - RString sTitleOut; - ScreenOptionsMaster::SetList( row, hand, "Speed", sTitleOut ); - - vector& entries = hand.ListEntries; - - RString sScrollSpeed = po.GetScrollSpeedAsString(); - if (sScrollSpeed.empty()) - sScrollSpeed = "1x"; - - for ( vector::iterator it = entries.begin(); it != entries.end(); ++it ) - { - ModeChoice& modeChoice = *it; - if ( modeChoice.m_sModifiers == sScrollSpeed ) { - if (bIncrement) { - if ( &modeChoice == &entries.back() ) - po.FromString( entries.front().m_sModifiers ); - else - po.FromString( (++it)->m_sModifiers ); - } else { // Decrement - if ( &modeChoice == &entries.front() ) - po.FromString( entries.back().m_sModifiers ); - else - po.FromString( (--it)->m_sModifiers ); - } - return; - } - } - // Current SpeedMod not found in Theme, revert to default: - ModeChoice& defaultChoice = hand.Default; - po.FromString(defaultChoice.m_sModifiers); -#endif -} - -bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) -{ - PlayerNumber pn = INPUTMAPPER->ControllerToPlayerNumber( controller ); - - for( int c=CODE_MIRROR; c<=CODE_CANCEL_ALL; c++ ) - { - Code code = (Code)c; - - PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); - - if( EnteredCode(controller,code) ) - { - switch( code ) - { - case CODE_MIRROR: po.ToggleOneTurn( PlayerOptions::TURN_MIRROR ); break; - case CODE_LEFT: po.ToggleOneTurn( PlayerOptions::TURN_LEFT ); break; - case CODE_RIGHT: po.ToggleOneTurn( PlayerOptions::TURN_RIGHT ); break; - case CODE_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SHUFFLE ); break; - case CODE_SUPER_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SUPER_SHUFFLE ); break; - case CODE_NEXT_TRANSFORM: po.NextTransform(); break; - case CODE_NEXT_SCROLL_SPEED: INCREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break; - case CODE_PREVIOUS_SCROLL_SPEED: DECREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break; - case CODE_NEXT_ACCEL: po.NextAccel(); break; - case CODE_NEXT_EFFECT: po.NextEffect(); break; - case CODE_NEXT_APPEARANCE: po.NextAppearance(); break; - case CODE_NEXT_TURN: po.NextTurn(); break; - case CODE_REVERSE: po.NextScroll(); break; - case CODE_HOLDS: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break; - case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break; - case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break; - case CODE_CANCEL_ALL: GAMESTATE->GetDefaultPlayerOptions( po ); break; - case CODE_HIDDEN: - ZERO(po.m_fAppearances); - po.m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] = 1; - break; - case CODE_RANDOMVANISH: - ZERO(po.m_fAppearances); - po.m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] = 1; - break; - default: break; - } - - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); - - - return true; // don't check any more - } - } - - return false; -} - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CodeDetector.h" +#include "PlayerOptions.h" +#include "GameState.h" +#include "InputQueue.h" +#include "ThemeManager.h" +#include "RageLog.h" +#include "Game.h" +#include "RageUtil.h" +#include "PlayerState.h" +#include "InputEventPlus.h" +#include "OptionRowHandler.h" + +const char *CodeNames[] = { + "PrevSteps1", + "PrevSteps2", + "NextSteps1", + "NextSteps2", + "NextSort1", + "NextSort2", + "NextSort3", + "NextSort4", + "ModeMenu1", + "ModeMenu2", + "Mirror", + "Left", + "Right", + "Shuffle", + "SuperShuffle", + "NextTransform", + "NextScrollSpeed", + "PreviousScrollSpeed", + "NextAccel", + "NextEffect", + "NextAppearance", + "NextTurn", + "Reverse", + "HoldNotes", + "Mines", + "Dark", + "Hidden", + "RandomVanish", + "CancelAll", + "NextTheme", + "NextTheme2", + "NextAnnouncer", + "NextAnnouncer2", + "NextGroup", + "PrevGroup", + "SaveScreenshot1", + "SaveScreenshot2", + "CancelAllPlayerOptions", + "BackInEventMode", + "CloseCurrentFolder", +}; +XToString( Code ); + +static InputQueueCode g_CodeItems[NUM_Code]; + +bool CodeDetector::EnteredCode( GameController controller, Code code ) +{ + return g_CodeItems[code].EnteredCode( controller ); +} + + +void CodeDetector::RefreshCacheItems( RString sClass ) +{ + if( sClass == "" ) + sClass = "CodeDetector"; + FOREACH_ENUM( Code, c ) + { + InputQueueCode& item = g_CodeItems[c]; + const RString sCodeName = CodeToString(c); + const RString sButtonsNames = THEME->GetMetric(sClass,sCodeName); + + item.Load( sButtonsNames ); + } +} + +bool CodeDetector::EnteredCloseFolder( GameController controller ) +{ + return EnteredCode(controller,CODE_CLOSE_CURRENT_FOLDER); +} + +bool CodeDetector::EnteredNextGroup( GameController controller ) +{ + return EnteredCode(controller,CODE_NEXT_GROUP); +} + +bool CodeDetector::EnteredPrevGroup( GameController controller ) +{ + return EnteredCode(controller,CODE_PREV_GROUP); +} + +bool CodeDetector::EnteredPrevSteps( GameController controller ) +{ + return EnteredCode(controller,Code_PrevSteps1) || EnteredCode(controller,Code_PrevSteps2); +} + +bool CodeDetector::EnteredNextSteps( GameController controller ) +{ + return EnteredCode(controller,Code_NextSteps1) || EnteredCode(controller,Code_NextSteps2); +} + +bool CodeDetector::EnteredNextSort( GameController controller ) +{ + return EnteredCode(controller,CODE_NEXT_SORT1) || + EnteredCode(controller,CODE_NEXT_SORT2) || + EnteredCode(controller,CODE_NEXT_SORT3) || + EnteredCode(controller,CODE_NEXT_SORT4); +} + +bool CodeDetector::EnteredModeMenu( GameController controller ) +{ + return EnteredCode(controller,CODE_MODE_MENU1) || EnteredCode(controller,CODE_MODE_MENU2); +} + +#define TOGGLE(v,a,b) if(v!=a) v=a; else v=b; +#define FLOAT_TOGGLE(v) if(v!=1.f) v=1.f; else v=0.f; +// XXX: Read the metrics file instead! +// Using this can give us unlisted scroll speeds on the Options screen. +// Zmey: done. +// AJ: thanks Zmey! :D +#define INCREMENT_SCROLL_SPEED(s) (s==0.5f) ? s=0.75f : (s==0.75f) ? s=1.0f : (s==1.0f) ? s=1.5f : (s==1.5f) ? s=2.0f : (s==2.0f) ? s=3.0f : (s==3.0f) ? s=4.0f : (s==4.0f) ? s=5.0f : (s==5.0f) ? s=8.0f : s=0.5f; +#define DECREMENT_SCROLL_SPEED(s) (s==0.75f) ? s=0.5f : (s==1.0f) ? s=0.75f : (s==1.5f) ? s=1.0f : (s==2.0f) ? s=1.5f : (s==3.0f) ? s=2.0f : (s==4.0f) ? s=3.0f : (s==5.0f) ? s=4.0f : (s==8.0f) ? s=4.0f : s=8.0f; + +// from Pumpmania +void CodeDetector::ChangeScrollSpeed( GameController controller, bool bIncrement ) +{ + // this doesn't compile, hence the #if 0 below. + // also I bet this code actually belongs in PlayerOptions.cpp + // on further inspection. -aj + // p.s. it's m_fScrollSpeed you'll want to mess with. +#if 0 + // opt = PlayerOptions + // setup + PlayerNumber pn = INPUTMAPPER->ControllerToPlayerNumber( controller ); + PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + + /* what this code seems to be doing is: + * 1) getting the Speed line from the theme + * 2) throwing it into a vector + * 3) getting the current scroll speed (fallback on 1x) + * 4) loop through the entries until you find the current mod + * 5) check if it's increment/decrement, act accordingly + * 6) set mod and return. + * 7) "Current SpeedMod not found in Theme, revert to default" + * although I'd rather have it move to the next possible value at + * that point. If it's invalid, then revert to the default. + */ + + OptionRowData row; + OptionRowHandler hand; + + RString sTitleOut; + ScreenOptionsMaster::SetList( row, hand, "Speed", sTitleOut ); + + vector& entries = hand.ListEntries; + + RString sScrollSpeed = po.GetScrollSpeedAsString(); + if (sScrollSpeed.empty()) + sScrollSpeed = "1x"; + + for ( vector::iterator it = entries.begin(); it != entries.end(); ++it ) + { + ModeChoice& modeChoice = *it; + if ( modeChoice.m_sModifiers == sScrollSpeed ) { + if (bIncrement) { + if ( &modeChoice == &entries.back() ) + po.FromString( entries.front().m_sModifiers ); + else + po.FromString( (++it)->m_sModifiers ); + } else { // Decrement + if ( &modeChoice == &entries.front() ) + po.FromString( entries.back().m_sModifiers ); + else + po.FromString( (--it)->m_sModifiers ); + } + return; + } + } + // Current SpeedMod not found in Theme, revert to default: + ModeChoice& defaultChoice = hand.Default; + po.FromString(defaultChoice.m_sModifiers); +#endif +} + +bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) +{ + PlayerNumber pn = INPUTMAPPER->ControllerToPlayerNumber( controller ); + + for( int c=CODE_MIRROR; c<=CODE_CANCEL_ALL; c++ ) + { + Code code = (Code)c; + + PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + + if( EnteredCode(controller,code) ) + { + switch( code ) + { + case CODE_MIRROR: po.ToggleOneTurn( PlayerOptions::TURN_MIRROR ); break; + case CODE_LEFT: po.ToggleOneTurn( PlayerOptions::TURN_LEFT ); break; + case CODE_RIGHT: po.ToggleOneTurn( PlayerOptions::TURN_RIGHT ); break; + case CODE_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SHUFFLE ); break; + case CODE_SUPER_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SUPER_SHUFFLE ); break; + case CODE_NEXT_TRANSFORM: po.NextTransform(); break; + case CODE_NEXT_SCROLL_SPEED: INCREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break; + case CODE_PREVIOUS_SCROLL_SPEED: DECREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break; + case CODE_NEXT_ACCEL: po.NextAccel(); break; + case CODE_NEXT_EFFECT: po.NextEffect(); break; + case CODE_NEXT_APPEARANCE: po.NextAppearance(); break; + case CODE_NEXT_TURN: po.NextTurn(); break; + case CODE_REVERSE: po.NextScroll(); break; + case CODE_HOLDS: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break; + case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break; + case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break; + case CODE_CANCEL_ALL: GAMESTATE->GetDefaultPlayerOptions( po ); break; + case CODE_HIDDEN: + ZERO(po.m_fAppearances); + po.m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] = 1; + break; + case CODE_RANDOMVANISH: + ZERO(po.m_fAppearances); + po.m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] = 1; + break; + default: break; + } + + GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); + + + return true; // don't check any more + } + } + + return false; +} + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CodeDetector.h b/src/CodeDetector.h index 5458d1f1b3..e636a8830c 100644 --- a/src/CodeDetector.h +++ b/src/CodeDetector.h @@ -1,95 +1,95 @@ -/* CodeDetector - Uses InputQueue to detect input of codes. */ - -#ifndef CODE_DETECTOR_H -#define CODE_DETECTOR_H - -#include "GameInput.h" - -enum Code { - Code_PrevSteps1, - Code_PrevSteps2, - Code_NextSteps1, - Code_NextSteps2, - CODE_NEXT_SORT1, - CODE_NEXT_SORT2, - CODE_NEXT_SORT3, - CODE_NEXT_SORT4, - CODE_MODE_MENU1, - CODE_MODE_MENU2, - CODE_MIRROR, - CODE_LEFT, - CODE_RIGHT, - CODE_SHUFFLE, - CODE_SUPER_SHUFFLE, - CODE_NEXT_TRANSFORM, - CODE_NEXT_SCROLL_SPEED, - CODE_PREVIOUS_SCROLL_SPEED, - CODE_NEXT_ACCEL, - CODE_NEXT_EFFECT, - CODE_NEXT_APPEARANCE, - CODE_NEXT_TURN, - CODE_REVERSE, - CODE_HOLDS, - CODE_MINES, - CODE_DARK, - CODE_HIDDEN, - CODE_RANDOMVANISH, - CODE_CANCEL_ALL, - CODE_NEXT_THEME, - CODE_NEXT_THEME2, - CODE_NEXT_ANNOUNCER, - CODE_NEXT_ANNOUNCER2, - CODE_NEXT_GROUP, - CODE_PREV_GROUP, - CODE_SAVE_SCREENSHOT1, - CODE_SAVE_SCREENSHOT2, - CODE_CANCEL_ALL_PLAYER_OPTIONS, - CODE_BACK_IN_EVENT_MODE, - CODE_CLOSE_CURRENT_FOLDER, - NUM_Code // leave this at the end -}; - -class CodeDetector -{ -public: - static void RefreshCacheItems( RString sClass="" ); // call this before checking codes, but call infrequently - static bool EnteredPrevSteps( GameController controller ); - static bool EnteredNextSteps( GameController controller ); - static bool EnteredNextSort( GameController controller ); - static bool EnteredModeMenu( GameController controller ); - static bool DetectAndAdjustMusicOptions( GameController controller ); - static bool EnteredCode( GameController controller, Code code ); - static bool EnteredPrevGroup( GameController controller ); - static bool EnteredNextGroup( GameController controller ); - static bool EnteredCloseFolder( GameController controller ); - - // todo: move to PlayerOptions.h -aj - void ChangeScrollSpeed( GameController controller, bool bIncrement ); -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* CodeDetector - Uses InputQueue to detect input of codes. */ + +#ifndef CODE_DETECTOR_H +#define CODE_DETECTOR_H + +#include "GameInput.h" + +enum Code { + Code_PrevSteps1, + Code_PrevSteps2, + Code_NextSteps1, + Code_NextSteps2, + CODE_NEXT_SORT1, + CODE_NEXT_SORT2, + CODE_NEXT_SORT3, + CODE_NEXT_SORT4, + CODE_MODE_MENU1, + CODE_MODE_MENU2, + CODE_MIRROR, + CODE_LEFT, + CODE_RIGHT, + CODE_SHUFFLE, + CODE_SUPER_SHUFFLE, + CODE_NEXT_TRANSFORM, + CODE_NEXT_SCROLL_SPEED, + CODE_PREVIOUS_SCROLL_SPEED, + CODE_NEXT_ACCEL, + CODE_NEXT_EFFECT, + CODE_NEXT_APPEARANCE, + CODE_NEXT_TURN, + CODE_REVERSE, + CODE_HOLDS, + CODE_MINES, + CODE_DARK, + CODE_HIDDEN, + CODE_RANDOMVANISH, + CODE_CANCEL_ALL, + CODE_NEXT_THEME, + CODE_NEXT_THEME2, + CODE_NEXT_ANNOUNCER, + CODE_NEXT_ANNOUNCER2, + CODE_NEXT_GROUP, + CODE_PREV_GROUP, + CODE_SAVE_SCREENSHOT1, + CODE_SAVE_SCREENSHOT2, + CODE_CANCEL_ALL_PLAYER_OPTIONS, + CODE_BACK_IN_EVENT_MODE, + CODE_CLOSE_CURRENT_FOLDER, + NUM_Code // leave this at the end +}; + +class CodeDetector +{ +public: + static void RefreshCacheItems( RString sClass="" ); // call this before checking codes, but call infrequently + static bool EnteredPrevSteps( GameController controller ); + static bool EnteredNextSteps( GameController controller ); + static bool EnteredNextSort( GameController controller ); + static bool EnteredModeMenu( GameController controller ); + static bool DetectAndAdjustMusicOptions( GameController controller ); + static bool EnteredCode( GameController controller, Code code ); + static bool EnteredPrevGroup( GameController controller ); + static bool EnteredNextGroup( GameController controller ); + static bool EnteredCloseFolder( GameController controller ); + + // todo: move to PlayerOptions.h -aj + void ChangeScrollSpeed( GameController controller, bool bIncrement ); +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CodeSet.cpp b/src/CodeSet.cpp index 7d4355b7e3..1917594e82 100644 --- a/src/CodeSet.cpp +++ b/src/CodeSet.cpp @@ -1,79 +1,79 @@ -#include "global.h" -#include "CodeSet.h" -#include "ThemeManager.h" -#include "InputEventPlus.h" -#include "MessageManager.h" - -#define CODE_NAMES THEME->GetMetric (sType,"CodeNames") -#define CODE( s ) THEME->GetMetric (sType,ssprintf("Code%s",s.c_str())) -void InputQueueCodeSet::Load( const RString &sType ) -{ - // - // Load codes - // - split( CODE_NAMES, ",", m_asCodeNames, true ); - - for( unsigned c=0; c asBits; - split( m_asCodeNames[c], "=", asBits, true ); - RString sCodeName = asBits[0]; - if( asBits.size() > 1 ) - m_asCodeNames[c] = asBits[1]; - - InputQueueCode code; - if( !code.Load(CODE(sCodeName)) ) - continue; - - m_aCodes.push_back( code ); - } -} - -RString InputQueueCodeSet::Input( const InputEventPlus &input ) const -{ - for( unsigned i = 0; i < m_aCodes.size(); ++i ) - { - if( !m_aCodes[i].EnteredCode(input.GameI.controller) ) - continue; - - return m_asCodeNames[i]; - } - return ""; -} - -bool InputQueueCodeSet::InputMessage( const InputEventPlus &input, Message &msg ) const -{ - RString sCodeName = Input( input ); - if( sCodeName.empty() ) - return false; - - msg.SetName("Code"); - msg.SetParam( "PlayerNumber", input.pn ); - msg.SetParam( "Name", sCodeName ); - return true; -} - -/* - * (c) 2007 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CodeSet.h" +#include "ThemeManager.h" +#include "InputEventPlus.h" +#include "MessageManager.h" + +#define CODE_NAMES THEME->GetMetric (sType,"CodeNames") +#define CODE( s ) THEME->GetMetric (sType,ssprintf("Code%s",s.c_str())) +void InputQueueCodeSet::Load( const RString &sType ) +{ + // + // Load codes + // + split( CODE_NAMES, ",", m_asCodeNames, true ); + + for( unsigned c=0; c asBits; + split( m_asCodeNames[c], "=", asBits, true ); + RString sCodeName = asBits[0]; + if( asBits.size() > 1 ) + m_asCodeNames[c] = asBits[1]; + + InputQueueCode code; + if( !code.Load(CODE(sCodeName)) ) + continue; + + m_aCodes.push_back( code ); + } +} + +RString InputQueueCodeSet::Input( const InputEventPlus &input ) const +{ + for( unsigned i = 0; i < m_aCodes.size(); ++i ) + { + if( !m_aCodes[i].EnteredCode(input.GameI.controller) ) + continue; + + return m_asCodeNames[i]; + } + return ""; +} + +bool InputQueueCodeSet::InputMessage( const InputEventPlus &input, Message &msg ) const +{ + RString sCodeName = Input( input ); + if( sCodeName.empty() ) + return false; + + msg.SetName("Code"); + msg.SetParam( "PlayerNumber", input.pn ); + msg.SetParam( "Name", sCodeName ); + return true; +} + +/* + * (c) 2007 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CodeSet.h b/src/CodeSet.h index 60ee0c880f..9da45ad45a 100644 --- a/src/CodeSet.h +++ b/src/CodeSet.h @@ -1,44 +1,44 @@ -#ifndef CODE_SET_H -#define CODE_SET_H - -#include "InputQueue.h" - -struct Message; -class InputQueueCodeSet -{ -public: - void Load( const RString &sType ); - RString Input( const InputEventPlus &input ) const; - bool InputMessage( const InputEventPlus &input, Message &msg ) const; - -private: - vector m_aCodes; - vector m_asCodeNames; -}; - -#endif - -/* - * (c) 2007 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef CODE_SET_H +#define CODE_SET_H + +#include "InputQueue.h" + +struct Message; +class InputQueueCodeSet +{ +public: + void Load( const RString &sType ); + RString Input( const InputEventPlus &input ) const; + bool InputMessage( const InputEventPlus &input, Message &msg ) const; + +private: + vector m_aCodes; + vector m_asCodeNames; +}; + +#endif + +/* + * (c) 2007 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CombinedLifeMeter.h b/src/CombinedLifeMeter.h index 695a7fb800..ea2d2233d7 100644 --- a/src/CombinedLifeMeter.h +++ b/src/CombinedLifeMeter.h @@ -1,61 +1,61 @@ -#ifndef COMBINEDLIFEMETER_H -#define COMBINEDLIFEMETER_H - -#include "PlayerNumber.h" -#include "GameConstantsAndTypes.h" -#include "ActorFrame.h" - -/** @brief Multiple Players sharing one LifeMeter. */ -class CombinedLifeMeter : public ActorFrame -{ -public: - CombinedLifeMeter() {}; - virtual ~CombinedLifeMeter() {}; - - virtual void OnLoadSong() {}; - /** - * @brief Change life after receiving a tap note grade. - * - * Note that this *is* called for the head of hold/roll notes. - * @param pn the PlayerNumber that hit the TapNote. - * @param tns the score received from the TapNote. */ - virtual void ChangeLife( PlayerNumber pn, TapNoteScore tns ) = 0; - /** - * @brief Change life after receiving a hold note grade. - * @param pn the PlayerNumber that received the hold note score. - * @param hns the hold note score recently received. - * @param tns the score from the initial TapNote. */ - virtual void ChangeLife( PlayerNumber pn, HoldNoteScore hns, TapNoteScore tns ) = 0; - virtual void HandleTapScoreNone( PlayerNumber pn ) = 0; -}; - - - -#endif - -/** - * @file - * @author Chris Danford (c) 2003 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef COMBINEDLIFEMETER_H +#define COMBINEDLIFEMETER_H + +#include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" +#include "ActorFrame.h" + +/** @brief Multiple Players sharing one LifeMeter. */ +class CombinedLifeMeter : public ActorFrame +{ +public: + CombinedLifeMeter() {}; + virtual ~CombinedLifeMeter() {}; + + virtual void OnLoadSong() {}; + /** + * @brief Change life after receiving a tap note grade. + * + * Note that this *is* called for the head of hold/roll notes. + * @param pn the PlayerNumber that hit the TapNote. + * @param tns the score received from the TapNote. */ + virtual void ChangeLife( PlayerNumber pn, TapNoteScore tns ) = 0; + /** + * @brief Change life after receiving a hold note grade. + * @param pn the PlayerNumber that received the hold note score. + * @param hns the hold note score recently received. + * @param tns the score from the initial TapNote. */ + virtual void ChangeLife( PlayerNumber pn, HoldNoteScore hns, TapNoteScore tns ) = 0; + virtual void HandleTapScoreNone( PlayerNumber pn ) = 0; +}; + + + +#endif + +/** + * @file + * @author Chris Danford (c) 2003 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CombinedLifeMeterTug.cpp b/src/CombinedLifeMeterTug.cpp index fac75b96f5..ca3d20c987 100644 --- a/src/CombinedLifeMeterTug.cpp +++ b/src/CombinedLifeMeterTug.cpp @@ -1,152 +1,152 @@ -#include "global.h" -#include "CombinedLifeMeterTug.h" -#include "ThemeManager.h" -#include "GameState.h" -#include "PrefsManager.h" -#include "ThemeMetric.h" - - -ThemeMetric METER_WIDTH ("CombinedLifeMeterTug","MeterWidth"); - -static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut ) -{ - sNameOut = "TugMeterPercentChange" + ScoreEventToString( (ScoreEvent)i ); - switch( i ) - { - default: ASSERT(0); - case SE_W1: defaultValueOut = +0.010f; break; - case SE_W2: defaultValueOut = +0.008f; break; - case SE_W3: defaultValueOut = +0.004f; break; - case SE_W4: defaultValueOut = +0.000f; break; - case SE_W5: defaultValueOut = -0.010f; break; - case SE_Miss: defaultValueOut = -0.020f; break; - case SE_HitMine: defaultValueOut = -0.040f; break; - case SE_CheckpointHit: defaultValueOut = +0.002f; break; - case SE_CheckpointMiss: defaultValueOut = -0.002f; break; - case SE_Held: defaultValueOut = +0.008f; break; - case SE_LetGo: defaultValueOut = -0.020f; break; - } -} - -static Preference1D g_fTugMeterPercentChange( TugMeterPercentChangeInit, NUM_ScoreEvent ); - -CombinedLifeMeterTug::CombinedLifeMeterTug() -{ - FOREACH_PlayerNumber( p ) - { - RString sStreamPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("stream p%d",p+1)); - RString sTipPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("tip p%d",p+1)); - m_Stream[p].Load( sStreamPath, METER_WIDTH, sTipPath ); - this->AddChild( &m_Stream[p] ); - } - m_Stream[PLAYER_2].SetZoomX( -1 ); - - m_sprSeparator.Load( THEME->GetPathG("CombinedLifeMeterTug","separator") ); - this->AddChild( m_sprSeparator ); - - m_sprFrame.Load( THEME->GetPathG("CombinedLifeMeterTug","frame") ); - this->AddChild( m_sprFrame ); -} - -void CombinedLifeMeterTug::Update( float fDelta ) -{ - float fPercentToShow = GAMESTATE->m_fTugLifePercentP1; - CLAMP( fPercentToShow, 0.f, 1.f ); - - m_Stream[PLAYER_1].SetPercent( fPercentToShow ); - m_Stream[PLAYER_2].SetPercent( 1-fPercentToShow ); - - float fSeparatorX = SCALE( fPercentToShow, 0.f, 1.f, -METER_WIDTH/2.f, +METER_WIDTH/2.f ); - - m_sprSeparator->SetX( fSeparatorX ); - - ActorFrame::Update( fDelta ); -} - -void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, TapNoteScore score ) -{ - float fPercentToMove = 0; - switch( score ) - { - case TNS_W1: fPercentToMove = g_fTugMeterPercentChange[SE_W1]; break; - case TNS_W2: fPercentToMove = g_fTugMeterPercentChange[SE_W2]; break; - case TNS_W3: fPercentToMove = g_fTugMeterPercentChange[SE_W3]; break; - case TNS_W4: fPercentToMove = g_fTugMeterPercentChange[SE_W4]; break; - case TNS_W5: fPercentToMove = g_fTugMeterPercentChange[SE_W5]; break; - case TNS_Miss: fPercentToMove = g_fTugMeterPercentChange[SE_Miss]; break; - case TNS_HitMine: fPercentToMove = g_fTugMeterPercentChange[SE_HitMine]; break; - case TNS_CheckpointHit: fPercentToMove = g_fTugMeterPercentChange[SE_CheckpointHit]; break; - case TNS_CheckpointMiss:fPercentToMove = g_fTugMeterPercentChange[SE_CheckpointMiss]; break; - default: ASSERT(0); break; - } - - ChangeLife( pn, fPercentToMove ); -} - -void CombinedLifeMeterTug::HandleTapScoreNone( PlayerNumber pn ) -{ - -} - -void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, HoldNoteScore score, TapNoteScore tscore ) -{ - float fPercentToMove = 0; - switch( score ) - { - case HNS_Held: fPercentToMove = g_fTugMeterPercentChange[SE_Held]; break; - case HNS_LetGo: fPercentToMove = g_fTugMeterPercentChange[SE_LetGo]; break; - default: ASSERT(0); break; - } - - ChangeLife( pn, fPercentToMove ); -} - -void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, float fPercentToMove ) -{ - if( PREFSMAN->m_bMercifulDrain && fPercentToMove < 0 ) - { - float fLifePercentage = 0; - switch( pn ) - { - case PLAYER_1: fLifePercentage = GAMESTATE->m_fTugLifePercentP1; break; - case PLAYER_2: fLifePercentage = 1 - GAMESTATE->m_fTugLifePercentP1; break; - default: ASSERT(0); - } - - /* Clamp the life meter only for calculating the multiplier. */ - fLifePercentage = clamp( fLifePercentage, 0.0f, 1.0f ); - fPercentToMove *= SCALE( fLifePercentage, 0.f, 1.f, 0.2f, 1.f); - } - - switch( pn ) - { - case PLAYER_1: GAMESTATE->m_fTugLifePercentP1 += fPercentToMove; break; - case PLAYER_2: GAMESTATE->m_fTugLifePercentP1 -= fPercentToMove; break; - default: ASSERT(0); - } -} - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CombinedLifeMeterTug.h" +#include "ThemeManager.h" +#include "GameState.h" +#include "PrefsManager.h" +#include "ThemeMetric.h" + + +ThemeMetric METER_WIDTH ("CombinedLifeMeterTug","MeterWidth"); + +static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut ) +{ + sNameOut = "TugMeterPercentChange" + ScoreEventToString( (ScoreEvent)i ); + switch( i ) + { + default: ASSERT(0); + case SE_W1: defaultValueOut = +0.010f; break; + case SE_W2: defaultValueOut = +0.008f; break; + case SE_W3: defaultValueOut = +0.004f; break; + case SE_W4: defaultValueOut = +0.000f; break; + case SE_W5: defaultValueOut = -0.010f; break; + case SE_Miss: defaultValueOut = -0.020f; break; + case SE_HitMine: defaultValueOut = -0.040f; break; + case SE_CheckpointHit: defaultValueOut = +0.002f; break; + case SE_CheckpointMiss: defaultValueOut = -0.002f; break; + case SE_Held: defaultValueOut = +0.008f; break; + case SE_LetGo: defaultValueOut = -0.020f; break; + } +} + +static Preference1D g_fTugMeterPercentChange( TugMeterPercentChangeInit, NUM_ScoreEvent ); + +CombinedLifeMeterTug::CombinedLifeMeterTug() +{ + FOREACH_PlayerNumber( p ) + { + RString sStreamPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("stream p%d",p+1)); + RString sTipPath = THEME->GetPathG("CombinedLifeMeterTug",ssprintf("tip p%d",p+1)); + m_Stream[p].Load( sStreamPath, METER_WIDTH, sTipPath ); + this->AddChild( &m_Stream[p] ); + } + m_Stream[PLAYER_2].SetZoomX( -1 ); + + m_sprSeparator.Load( THEME->GetPathG("CombinedLifeMeterTug","separator") ); + this->AddChild( m_sprSeparator ); + + m_sprFrame.Load( THEME->GetPathG("CombinedLifeMeterTug","frame") ); + this->AddChild( m_sprFrame ); +} + +void CombinedLifeMeterTug::Update( float fDelta ) +{ + float fPercentToShow = GAMESTATE->m_fTugLifePercentP1; + CLAMP( fPercentToShow, 0.f, 1.f ); + + m_Stream[PLAYER_1].SetPercent( fPercentToShow ); + m_Stream[PLAYER_2].SetPercent( 1-fPercentToShow ); + + float fSeparatorX = SCALE( fPercentToShow, 0.f, 1.f, -METER_WIDTH/2.f, +METER_WIDTH/2.f ); + + m_sprSeparator->SetX( fSeparatorX ); + + ActorFrame::Update( fDelta ); +} + +void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, TapNoteScore score ) +{ + float fPercentToMove = 0; + switch( score ) + { + case TNS_W1: fPercentToMove = g_fTugMeterPercentChange[SE_W1]; break; + case TNS_W2: fPercentToMove = g_fTugMeterPercentChange[SE_W2]; break; + case TNS_W3: fPercentToMove = g_fTugMeterPercentChange[SE_W3]; break; + case TNS_W4: fPercentToMove = g_fTugMeterPercentChange[SE_W4]; break; + case TNS_W5: fPercentToMove = g_fTugMeterPercentChange[SE_W5]; break; + case TNS_Miss: fPercentToMove = g_fTugMeterPercentChange[SE_Miss]; break; + case TNS_HitMine: fPercentToMove = g_fTugMeterPercentChange[SE_HitMine]; break; + case TNS_CheckpointHit: fPercentToMove = g_fTugMeterPercentChange[SE_CheckpointHit]; break; + case TNS_CheckpointMiss:fPercentToMove = g_fTugMeterPercentChange[SE_CheckpointMiss]; break; + default: ASSERT(0); break; + } + + ChangeLife( pn, fPercentToMove ); +} + +void CombinedLifeMeterTug::HandleTapScoreNone( PlayerNumber pn ) +{ + +} + +void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, HoldNoteScore score, TapNoteScore tscore ) +{ + float fPercentToMove = 0; + switch( score ) + { + case HNS_Held: fPercentToMove = g_fTugMeterPercentChange[SE_Held]; break; + case HNS_LetGo: fPercentToMove = g_fTugMeterPercentChange[SE_LetGo]; break; + default: ASSERT(0); break; + } + + ChangeLife( pn, fPercentToMove ); +} + +void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, float fPercentToMove ) +{ + if( PREFSMAN->m_bMercifulDrain && fPercentToMove < 0 ) + { + float fLifePercentage = 0; + switch( pn ) + { + case PLAYER_1: fLifePercentage = GAMESTATE->m_fTugLifePercentP1; break; + case PLAYER_2: fLifePercentage = 1 - GAMESTATE->m_fTugLifePercentP1; break; + default: ASSERT(0); + } + + /* Clamp the life meter only for calculating the multiplier. */ + fLifePercentage = clamp( fLifePercentage, 0.0f, 1.0f ); + fPercentToMove *= SCALE( fLifePercentage, 0.f, 1.f, 0.2f, 1.f); + } + + switch( pn ) + { + case PLAYER_1: GAMESTATE->m_fTugLifePercentP1 += fPercentToMove; break; + case PLAYER_2: GAMESTATE->m_fTugLifePercentP1 -= fPercentToMove; break; + default: ASSERT(0); + } +} + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CombinedLifeMeterTug.h b/src/CombinedLifeMeterTug.h index c0d295c375..7ce56eb7ed 100644 --- a/src/CombinedLifeMeterTug.h +++ b/src/CombinedLifeMeterTug.h @@ -1,53 +1,53 @@ -#ifndef CombinedLifeMeterTug_H -#define CombinedLifeMeterTug_H - -#include "CombinedLifeMeter.h" -#include "MeterDisplay.h" - -/** @brief Dance Magic-like tug-o-war life meter. */ -class CombinedLifeMeterTug : public CombinedLifeMeter -{ -public: - CombinedLifeMeterTug(); - virtual void Update( float fDelta ); - - virtual void ChangeLife( PlayerNumber pn, TapNoteScore score ); - virtual void ChangeLife( PlayerNumber pn, HoldNoteScore score, TapNoteScore tscore ); - virtual void HandleTapScoreNone( PlayerNumber pn ); - -protected: - void ChangeLife( PlayerNumber pn, float fPercentToMove ); - - MeterDisplay m_Stream[NUM_PLAYERS]; - AutoActor m_sprSeparator; - AutoActor m_sprFrame; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef CombinedLifeMeterTug_H +#define CombinedLifeMeterTug_H + +#include "CombinedLifeMeter.h" +#include "MeterDisplay.h" + +/** @brief Dance Magic-like tug-o-war life meter. */ +class CombinedLifeMeterTug : public CombinedLifeMeter +{ +public: + CombinedLifeMeterTug(); + virtual void Update( float fDelta ); + + virtual void ChangeLife( PlayerNumber pn, TapNoteScore score ); + virtual void ChangeLife( PlayerNumber pn, HoldNoteScore score, TapNoteScore tscore ); + virtual void HandleTapScoreNone( PlayerNumber pn ); + +protected: + void ChangeLife( PlayerNumber pn, float fPercentToMove ); + + MeterDisplay m_Stream[NUM_PLAYERS]; + AutoActor m_sprSeparator; + AutoActor m_sprFrame; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ComboGraph.cpp b/src/ComboGraph.cpp index 01f22e373a..3912789d46 100644 --- a/src/ComboGraph.cpp +++ b/src/ComboGraph.cpp @@ -1,165 +1,165 @@ -#include "global.h" -#include "ComboGraph.h" -#include "RageLog.h" -#include "StageStats.h" -#include "ActorUtil.h" -#include "BitmapText.h" -#include "XmlFile.h" - -const int MinComboSizeToShow = 5; - -REGISTER_ACTOR_CLASS( ComboGraph ); - -ComboGraph::ComboGraph() -{ - DeleteChildrenWhenDone( true ); - - m_pNormalCombo = NULL; - m_pMaxCombo = NULL; - m_pComboNumber = NULL; -} - -void ComboGraph::Load( RString sMetricsGroup ) -{ - BODY_WIDTH.Load( sMetricsGroup, "BodyWidth" ); - - Actor *pActor = NULL; - - m_pBacking = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"Backing") ); - m_pBacking->ZoomToWidth( BODY_WIDTH ); - this->AddChild( m_pBacking ); - - m_pNormalCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"NormalCombo") ); - m_pNormalCombo->ZoomToWidth( BODY_WIDTH ); - this->AddChild( m_pNormalCombo ); - - m_pMaxCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"MaxCombo") ); - m_pMaxCombo->ZoomToWidth( BODY_WIDTH ); - this->AddChild( m_pMaxCombo ); - - pActor = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"ComboNumber") ); - m_pComboNumber = dynamic_cast( pActor ); - if( m_pComboNumber == NULL ) - RageException::Throw( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" ); - this->AddChild( m_pComboNumber ); -} - -void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss ) -{ - const float fFirstSecond = 0; - const float fLastSecond = s.GetTotalPossibleStepsSeconds(); - - // Find the largest combo. - int iMaxComboSize = 0; - for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) - iMaxComboSize = max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() ); - - for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) - { - const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i]; - if( combo.GetStageCnt() < MinComboSizeToShow ) - continue; // too small - - const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize); - - LOG->Trace( "combo %i is %f+%f of %f", i, combo.m_fStartSecond, combo.m_fSizeSeconds, fLastSecond ); - Actor *pSprite = bIsMax? m_pMaxCombo->Copy() : m_pNormalCombo->Copy(); - - const float fStart = SCALE( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f ); - const float fSize = SCALE( combo.m_fSizeSeconds, 0, fLastSecond-fFirstSecond, 0.0f, 1.0f ); - pSprite->SetCropLeft ( SCALE( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) ); - pSprite->SetCropRight( SCALE( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) ); - - pSprite->SetCropLeft( fStart ); - pSprite->SetCropRight( 1 - (fSize + fStart) ); - - this->AddChild( pSprite ); - } - - for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) - { - const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i]; - if( combo.GetStageCnt() < MinComboSizeToShow ) - continue; // too small - - if( !iMaxComboSize ) - continue; - - const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize); - if( !bIsMax ) - continue; - - BitmapText *pText = m_pComboNumber->Copy(); - - const float fStart = SCALE( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f ); - const float fSize = SCALE( combo.m_fSizeSeconds, 0, fLastSecond-fFirstSecond, 0.0f, 1.0f ); - - const float fCenterPercent = fStart + fSize/2; - const float fCenterXPos = SCALE( fCenterPercent, 0.0f, 1.0f, -BODY_WIDTH/2.0f, BODY_WIDTH/2.0f ); - pText->SetX( fCenterXPos ); - - pText->SetText( ssprintf("%i",combo.GetStageCnt()) ); - - this->AddChild( pText ); - } - - // Hide the templates. - m_pNormalCombo->SetVisible( false ); - m_pMaxCombo->SetVisible( false ); - m_pComboNumber->SetVisible( false ); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ComboGraph. */ -class LunaComboGraph: public Luna -{ -public: - static int Load( T* p, lua_State *L ) - { - p->Load( SArg(1) ); - return 0; - } - static int Set( T* p, lua_State *L ) - { - StageStats *pStageStats = Luna::check( L, 1 ); - PlayerStageStats *pPlayerStageStats = Luna::check( L, 2 ); - p->Set( *pStageStats, *pPlayerStageStats ); - return 0; - } - - LunaComboGraph() - { - ADD_METHOD( Load ); - ADD_METHOD( Set ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ComboGraph, ActorFrame ) -// lua end - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ComboGraph.h" +#include "RageLog.h" +#include "StageStats.h" +#include "ActorUtil.h" +#include "BitmapText.h" +#include "XmlFile.h" + +const int MinComboSizeToShow = 5; + +REGISTER_ACTOR_CLASS( ComboGraph ); + +ComboGraph::ComboGraph() +{ + DeleteChildrenWhenDone( true ); + + m_pNormalCombo = NULL; + m_pMaxCombo = NULL; + m_pComboNumber = NULL; +} + +void ComboGraph::Load( RString sMetricsGroup ) +{ + BODY_WIDTH.Load( sMetricsGroup, "BodyWidth" ); + + Actor *pActor = NULL; + + m_pBacking = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"Backing") ); + m_pBacking->ZoomToWidth( BODY_WIDTH ); + this->AddChild( m_pBacking ); + + m_pNormalCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"NormalCombo") ); + m_pNormalCombo->ZoomToWidth( BODY_WIDTH ); + this->AddChild( m_pNormalCombo ); + + m_pMaxCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"MaxCombo") ); + m_pMaxCombo->ZoomToWidth( BODY_WIDTH ); + this->AddChild( m_pMaxCombo ); + + pActor = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"ComboNumber") ); + m_pComboNumber = dynamic_cast( pActor ); + if( m_pComboNumber == NULL ) + RageException::Throw( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" ); + this->AddChild( m_pComboNumber ); +} + +void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss ) +{ + const float fFirstSecond = 0; + const float fLastSecond = s.GetTotalPossibleStepsSeconds(); + + // Find the largest combo. + int iMaxComboSize = 0; + for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) + iMaxComboSize = max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() ); + + for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) + { + const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i]; + if( combo.GetStageCnt() < MinComboSizeToShow ) + continue; // too small + + const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize); + + LOG->Trace( "combo %i is %f+%f of %f", i, combo.m_fStartSecond, combo.m_fSizeSeconds, fLastSecond ); + Actor *pSprite = bIsMax? m_pMaxCombo->Copy() : m_pNormalCombo->Copy(); + + const float fStart = SCALE( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f ); + const float fSize = SCALE( combo.m_fSizeSeconds, 0, fLastSecond-fFirstSecond, 0.0f, 1.0f ); + pSprite->SetCropLeft ( SCALE( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) ); + pSprite->SetCropRight( SCALE( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) ); + + pSprite->SetCropLeft( fStart ); + pSprite->SetCropRight( 1 - (fSize + fStart) ); + + this->AddChild( pSprite ); + } + + for( unsigned i = 0; i < pss.m_ComboList.size(); ++i ) + { + const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i]; + if( combo.GetStageCnt() < MinComboSizeToShow ) + continue; // too small + + if( !iMaxComboSize ) + continue; + + const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize); + if( !bIsMax ) + continue; + + BitmapText *pText = m_pComboNumber->Copy(); + + const float fStart = SCALE( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f ); + const float fSize = SCALE( combo.m_fSizeSeconds, 0, fLastSecond-fFirstSecond, 0.0f, 1.0f ); + + const float fCenterPercent = fStart + fSize/2; + const float fCenterXPos = SCALE( fCenterPercent, 0.0f, 1.0f, -BODY_WIDTH/2.0f, BODY_WIDTH/2.0f ); + pText->SetX( fCenterXPos ); + + pText->SetText( ssprintf("%i",combo.GetStageCnt()) ); + + this->AddChild( pText ); + } + + // Hide the templates. + m_pNormalCombo->SetVisible( false ); + m_pMaxCombo->SetVisible( false ); + m_pComboNumber->SetVisible( false ); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the ComboGraph. */ +class LunaComboGraph: public Luna +{ +public: + static int Load( T* p, lua_State *L ) + { + p->Load( SArg(1) ); + return 0; + } + static int Set( T* p, lua_State *L ) + { + StageStats *pStageStats = Luna::check( L, 1 ); + PlayerStageStats *pPlayerStageStats = Luna::check( L, 2 ); + p->Set( *pStageStats, *pPlayerStageStats ); + return 0; + } + + LunaComboGraph() + { + ADD_METHOD( Load ); + ADD_METHOD( Set ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ComboGraph, ActorFrame ) +// lua end + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ComboGraph.h b/src/ComboGraph.h index 2d2f9b01b4..b679c7043b 100644 --- a/src/ComboGraph.h +++ b/src/ComboGraph.h @@ -1,58 +1,58 @@ -/* ComboGraph - A bar displaying the player's combo on Evaluation. */ -#ifndef COMBO_GRAPH_H -#define COMBO_GRAPH_H - -#include "ActorFrame.h" -#include "PlayerNumber.h" -#include "ThemeMetric.h" - -class StageStats; -class PlayerStageStats; -class BitmapText; - -class ComboGraph: public ActorFrame -{ -public: - ComboGraph(); - void Load( RString sMetricsGroup ); - void Set( const StageStats &s, const PlayerStageStats &pss ); - virtual ComboGraph *Copy() const; - virtual bool AutoLoadChildren() const { return true; } - - // Commands - virtual void PushSelf( lua_State *L ); - -private: - ThemeMetric BODY_WIDTH; - Actor *m_pBacking; - Actor *m_pNormalCombo; - Actor *m_pMaxCombo; - BitmapText *m_pComboNumber; -}; - -#endif - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* ComboGraph - A bar displaying the player's combo on Evaluation. */ +#ifndef COMBO_GRAPH_H +#define COMBO_GRAPH_H + +#include "ActorFrame.h" +#include "PlayerNumber.h" +#include "ThemeMetric.h" + +class StageStats; +class PlayerStageStats; +class BitmapText; + +class ComboGraph: public ActorFrame +{ +public: + ComboGraph(); + void Load( RString sMetricsGroup ); + void Set( const StageStats &s, const PlayerStageStats &pss ); + virtual ComboGraph *Copy() const; + virtual bool AutoLoadChildren() const { return true; } + + // Commands + virtual void PushSelf( lua_State *L ); + +private: + ThemeMetric BODY_WIDTH; + Actor *m_pBacking; + Actor *m_pNormalCombo; + Actor *m_pMaxCombo; + BitmapText *m_pComboNumber; +}; + +#endif + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Command.cpp b/src/Command.cpp index c8d30126a8..74ef49c8c4 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -1,133 +1,133 @@ -#include "global.h" -#include "Command.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "arch/Dialog/Dialog.h" -#include "Foreach.h" - - -RString Command::GetName() const -{ - if( m_vsArgs.empty() ) - return RString(); - RString s = m_vsArgs[0]; - Trim( s ); - return s; -} - -Command::Arg Command::GetArg( unsigned index ) const -{ - Arg a; - if( index < m_vsArgs.size() ) - a.s = m_vsArgs[index]; - return a; -} - -void Command::Load( const RString &sCommand ) -{ - m_vsArgs.clear(); - split( sCommand, ",", m_vsArgs, false ); // don't ignore empty -} - -RString Command::GetOriginalCommandString() const -{ - return join( ",", m_vsArgs ); -} - -static void SplitWithQuotes( const RString sSource, const char Delimitor, vector &asOut, const bool bIgnoreEmpty ) -{ - /* Short-circuit if the source is empty; we want to return an empty vector if - * the string is empty, even if bIgnoreEmpty is true. */ - if( sSource.empty() ) - return; - - size_t startpos = 0; - do { - size_t pos = startpos; - while( pos < sSource.size() ) - { - if( sSource[pos] == Delimitor ) - break; - - if( sSource[pos] == '"' || sSource[pos] == '\'' ) - { - /* We've found a quote. Search for the close. */ - pos = sSource.find( sSource[pos], pos+1 ); - if( pos == string::npos ) - pos = sSource.size(); - else - ++pos; - } - else - ++pos; - } - - if( pos-startpos > 0 || !bIgnoreEmpty ) - { - /* Optimization: if we're copying the whole string, avoid substr; this - * allows this copy to be refcounted, which is much faster. */ - if( startpos == 0 && pos-startpos == sSource.size() ) - asOut.push_back( sSource ); - else - { - const RString AddCString = sSource.substr( startpos, pos-startpos ); - asOut.push_back( AddCString ); - } - } - - startpos = pos+1; - } while( startpos <= sSource.size() ); -} - -RString Commands::GetOriginalCommandString() const -{ - RString s; - FOREACH_CONST( Command, v, c ) - s += c->GetOriginalCommandString(); - return s; -} - -void ParseCommands( const RString &sCommands, Commands &vCommandsOut ) -{ - vector vsCommands; - SplitWithQuotes( sCommands, ';', vsCommands, true ); // do ignore empty - vCommandsOut.v.resize( vsCommands.size() ); - - for( unsigned i=0; i &asOut, const bool bIgnoreEmpty ) +{ + /* Short-circuit if the source is empty; we want to return an empty vector if + * the string is empty, even if bIgnoreEmpty is true. */ + if( sSource.empty() ) + return; + + size_t startpos = 0; + do { + size_t pos = startpos; + while( pos < sSource.size() ) + { + if( sSource[pos] == Delimitor ) + break; + + if( sSource[pos] == '"' || sSource[pos] == '\'' ) + { + /* We've found a quote. Search for the close. */ + pos = sSource.find( sSource[pos], pos+1 ); + if( pos == string::npos ) + pos = sSource.size(); + else + ++pos; + } + else + ++pos; + } + + if( pos-startpos > 0 || !bIgnoreEmpty ) + { + /* Optimization: if we're copying the whole string, avoid substr; this + * allows this copy to be refcounted, which is much faster. */ + if( startpos == 0 && pos-startpos == sSource.size() ) + asOut.push_back( sSource ); + else + { + const RString AddCString = sSource.substr( startpos, pos-startpos ); + asOut.push_back( AddCString ); + } + } + + startpos = pos+1; + } while( startpos <= sSource.size() ); +} + +RString Commands::GetOriginalCommandString() const +{ + RString s; + FOREACH_CONST( Command, v, c ) + s += c->GetOriginalCommandString(); + return s; +} + +void ParseCommands( const RString &sCommands, Commands &vCommandsOut ) +{ + vector vsCommands; + SplitWithQuotes( sCommands, ';', vsCommands, true ); // do ignore empty + vCommandsOut.v.resize( vsCommands.size() ); + + for( unsigned i=0; i m_vsArgs; -}; - -class Commands -{ -public: - vector v; - - RString GetOriginalCommandString() const; // used when reporting an error in number of args -}; - -// Take a command list string and return pointers to each of the tokens in the -// string. sCommand list is a list of commands separated by ';'. -// TODO: This is expensive to do during the game. Eventually, move all calls to -// ParseCommands to happen during load, then execute from the parsed Command structures. -void ParseCommands( const RString &sCmds, Commands &vCmdsOut ); -Commands ParseCommands( const RString &sCmds ); - -#endif - -/* - * (c) 2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* Commands - Actor command parsing and reading helpers. */ + +#ifndef Commands_H +#define Commands_H + +class Command +{ +public: + void Load( const RString &sCommand ); + + RString GetOriginalCommandString() const; // used when reporting an error in number of args + RString GetName() const; // the command name is the first argument in all-lowercase + + void Clear() { m_vsArgs.clear(); } + + struct Arg + { + RString s; + }; + Arg GetArg( unsigned index ) const; + + vector m_vsArgs; +}; + +class Commands +{ +public: + vector v; + + RString GetOriginalCommandString() const; // used when reporting an error in number of args +}; + +// Take a command list string and return pointers to each of the tokens in the +// string. sCommand list is a list of commands separated by ';'. +// TODO: This is expensive to do during the game. Eventually, move all calls to +// ParseCommands to happen during load, then execute from the parsed Command structures. +void ParseCommands( const RString &sCmds, Commands &vCmdsOut ); +Commands ParseCommands( const RString &sCmds ); + +#endif + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CommandLineActions.cpp b/src/CommandLineActions.cpp index 7d852d1f76..ef5f26b10c 100644 --- a/src/CommandLineActions.cpp +++ b/src/CommandLineActions.cpp @@ -1,162 +1,162 @@ -#include "global.h" -#include "CommandLineActions.h" -#include "RageFile.h" -#include "RageUtil.h" -#include "IniFile.h" -#include "XmlFile.h" -#include "XmlFileUtil.h" -#include "LuaManager.h" -#include "ProductInfo.h" -#include "DateTime.h" -#include "Foreach.h" -#include "arch/Dialog/Dialog.h" -#include "RageFileManager.h" -#include "SpecialFiles.h" -#include "FileDownload.h" -#include "arch/LoadingWindow/LoadingWindow.h" -#include "Preference.h" -#include "JsonUtil.h" -#include "ScreenInstallOverlay.h" - -// only used for Version() -#if defined(_WINDOWS) -#include -#include -#endif - -/** @brief The directory where languages should be installed. */ -const RString INSTALLER_LANGUAGES_DIR = "Themes/_Installer/Languages/"; - -vector CommandLineActions::ToProcess; - -static void Nsis() -{ - RageFile out; - if(!out.Open("nsis_strings_temp.inc", RageFile::WRITE)) - RageException::Throw("Error opening file for write."); - - vector vs; - GetDirListing(INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false); - FOREACH_CONST(RString, vs, s) - { - RString sThrowAway, sLangCode; - splitpath(*s, sThrowAway, sLangCode, sThrowAway); - const LanguageInfo *pLI = GetLanguageInfo(sLangCode); - - RString sLangNameUpper = pLI->szEnglishName; - sLangNameUpper.MakeUpper(); - - IniFile ini; - if(!ini.ReadFile(INSTALLER_LANGUAGES_DIR + *s)) - RageException::Throw("Error opening file for read."); - FOREACH_CONST_Child(&ini, child) - { - FOREACH_CONST_Attr(child, attr) - { - RString sName = attr->first; - RString sValue = attr->second->GetValue(); - sValue.Replace("\\n", "$\\n"); - RString sLine = ssprintf("LangString %s ${LANG_%s} \"%s\"", sName.c_str(), sLangNameUpper.c_str(), sValue.c_str()); - out.PutLine(sLine); - } - } - } -} -static void LuaInformation() -{ - XNode *pNode = LuaHelpers::GetLuaInformation(); - pNode->AppendAttr("xmlns", "http://www.stepmania.com"); - pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); - pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd"); - - pNode->AppendChild("Version", PRODUCT_ID_VER); - pNode->AppendChild("Date", DateTime::GetNowDate().GetString()); - - XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl"); - - delete pNode; -} - -#if defined(HAVE_VERSION_INFO) -extern unsigned long version_num; -extern const char *const version_date; -extern const char *const version_time; -#endif - -/** - * @brief Print out version information. - * - * HACK: This function is primarily needed for Windows users. - * Mac OS X and Linux print out version information on the command line - * regardless of any preferences (tested by shakesoda on Mac). -aj */ -static void Version() -{ - #if defined(WIN32) - RString sProductID = ssprintf("%s", PRODUCT_ID_VER); - RString sVersion = "(sm-ssc was built without HAVE_VERSION_INFO)"; - #if defined(HAVE_VERSION_INFO) - sVersion = ssprintf("build %lu\nCompile Date: %s @ %s", version_num, version_date, version_time); - #endif // HAVE_VERSION_INFO - - AllocConsole(); - freopen("CONOUT$","wb", stdout); - freopen("CONOUT$","wb", stderr); - - fprintf(stdout, "Version Information:\n%s %s\n", sProductID.c_str(), sVersion.c_str()); - fprintf(stdout, "Press any key to exit."); - _getch(); - #endif // WIN32 -} - -void CommandLineActions::Handle(LoadingWindow* pLW) -{ - CommandLineArgs args; - for(int i=0; i +#include +#endif + +/** @brief The directory where languages should be installed. */ +const RString INSTALLER_LANGUAGES_DIR = "Themes/_Installer/Languages/"; + +vector CommandLineActions::ToProcess; + +static void Nsis() +{ + RageFile out; + if(!out.Open("nsis_strings_temp.inc", RageFile::WRITE)) + RageException::Throw("Error opening file for write."); + + vector vs; + GetDirListing(INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false); + FOREACH_CONST(RString, vs, s) + { + RString sThrowAway, sLangCode; + splitpath(*s, sThrowAway, sLangCode, sThrowAway); + const LanguageInfo *pLI = GetLanguageInfo(sLangCode); + + RString sLangNameUpper = pLI->szEnglishName; + sLangNameUpper.MakeUpper(); + + IniFile ini; + if(!ini.ReadFile(INSTALLER_LANGUAGES_DIR + *s)) + RageException::Throw("Error opening file for read."); + FOREACH_CONST_Child(&ini, child) + { + FOREACH_CONST_Attr(child, attr) + { + RString sName = attr->first; + RString sValue = attr->second->GetValue(); + sValue.Replace("\\n", "$\\n"); + RString sLine = ssprintf("LangString %s ${LANG_%s} \"%s\"", sName.c_str(), sLangNameUpper.c_str(), sValue.c_str()); + out.PutLine(sLine); + } + } + } +} +static void LuaInformation() +{ + XNode *pNode = LuaHelpers::GetLuaInformation(); + pNode->AppendAttr("xmlns", "http://www.stepmania.com"); + pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd"); + + pNode->AppendChild("Version", PRODUCT_ID_VER); + pNode->AppendChild("Date", DateTime::GetNowDate().GetString()); + + XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl"); + + delete pNode; +} + +#if defined(HAVE_VERSION_INFO) +extern unsigned long version_num; +extern const char *const version_date; +extern const char *const version_time; +#endif + +/** + * @brief Print out version information. + * + * HACK: This function is primarily needed for Windows users. + * Mac OS X and Linux print out version information on the command line + * regardless of any preferences (tested by shakesoda on Mac). -aj */ +static void Version() +{ + #if defined(WIN32) + RString sProductID = ssprintf("%s", PRODUCT_ID_VER); + RString sVersion = "(sm-ssc was built without HAVE_VERSION_INFO)"; + #if defined(HAVE_VERSION_INFO) + sVersion = ssprintf("build %lu\nCompile Date: %s @ %s", version_num, version_date, version_time); + #endif // HAVE_VERSION_INFO + + AllocConsole(); + freopen("CONOUT$","wb", stdout); + freopen("CONOUT$","wb", stderr); + + fprintf(stdout, "Version Information:\n%s %s\n", sProductID.c_str(), sVersion.c_str()); + fprintf(stdout, "Press any key to exit."); + _getch(); + #endif // WIN32 +} + +void CommandLineActions::Handle(LoadingWindow* pLW) +{ + CommandLineArgs args; + for(int i=0; i argv; - }; - /** - * @brief A list of command line arguemnts to process while the game is running. - * These args could have come from this process or passed to this process - * from another process. */ - extern vector ToProcess; -} - -#endif - -/** - * @file - * @author Chris Danford, Steve Checkoway (c) 2006 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - +#ifndef CommandLineActions_H +#define CommandLineActions_H + +class LoadingWindow; + +/** @brief The collection of command line actions. */ +namespace CommandLineActions +{ + /** + * @brief Perform a utility function, then exit. + * @param pLW the LoadingWindow that is presently not used? */ + void Handle(LoadingWindow* pLW); + + /** @brief The housing for the command line arguments. */ + class CommandLineArgs + { + public: + /** @brief the arguments in question. */ + vector argv; + }; + /** + * @brief A list of command line arguemnts to process while the game is running. + * These args could have come from this process or passed to this process + * from another process. */ + extern vector ToProcess; +} + +#endif + +/** + * @file + * @author Chris Danford, Steve Checkoway (c) 2006 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + diff --git a/src/CommonMetrics.cpp b/src/CommonMetrics.cpp index 02629cb1eb..f756ef3321 100644 --- a/src/CommonMetrics.cpp +++ b/src/CommonMetrics.cpp @@ -1,157 +1,157 @@ -#include "global.h" -#include "CommonMetrics.h" -#include "RageUtil.h" -#include "Foreach.h" -#include "GameManager.h" -#include "RageLog.h" -#include "GameState.h" -#include "ProductInfo.h" -#include "LuaManager.h" - -ThemeMetric CommonMetrics::OPERATOR_MENU_SCREEN ("Common","OperatorMenuScreen"); -ThemeMetric CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen"); -ThemeMetric CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); -LocalizedString CommonMetrics::WINDOW_TITLE ("Common","WindowTitle"); -ThemeMetric CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS("Common","MaxCourseEntriesBeforeShowVarious"); -ThemeMetric CommonMetrics::TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds"); -ThemeMetric CommonMetrics::DEFAULT_NOTESKIN_NAME ("Common","DefaultNoteSkinName"); -ThemeMetricDifficultiesToShow CommonMetrics::DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow"); -ThemeMetricCourseDifficultiesToShow CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW ("Common","CourseDifficultiesToShow"); -ThemeMetricStepsTypesToShow CommonMetrics::STEPS_TYPES_TO_SHOW ("Common","StepsTypesToHide"); -ThemeMetric CommonMetrics::AUTO_SET_STYLE ("Common","AutoSetStyle"); -ThemeMetric CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES ("Common","PercentScoreDecimalPlaces"); - -ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ) : - ThemeMetric(sGroup,sName) -{ - // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one - if( IsLoaded() ) - Read(); -} -void ThemeMetricDifficultiesToShow::Read() -{ - ASSERT( GetName().Right(6) == "ToShow" ); - - ThemeMetric::Read(); - - m_v.clear(); - - vector v; - split( ThemeMetric::GetValue(), ",", v ); - ASSERT( v.size() > 0 ); - - FOREACH_CONST( RString, v, i ) - { - Difficulty d = StringToDifficulty( *i ); - if( d == Difficulty_Invalid ) - RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() ); - m_v.push_back( d ); - } -} -const vector& ThemeMetricDifficultiesToShow::GetValue() const { return m_v; } - - -ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ) : - ThemeMetric(sGroup,sName) -{ - // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one - if( IsLoaded() ) - Read(); -} -void ThemeMetricCourseDifficultiesToShow::Read() -{ - ASSERT( GetName().Right(6) == "ToShow" ); - - ThemeMetric::Read(); - - m_v.clear(); - - vector v; - split( ThemeMetric::GetValue(), ",", v ); - ASSERT( v.size() > 0 ); - - FOREACH_CONST( RString, v, i ) - { - CourseDifficulty d = StringToDifficulty( *i ); - if( d == Difficulty_Invalid ) - RageException::Throw( "Unknown CourseDifficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() ); - m_v.push_back( d ); - } -} -const vector& ThemeMetricCourseDifficultiesToShow::GetValue() const { return m_v; } - -static void RemoveStepsTypes( vector& inout, RString sStepsTypesToRemove ) -{ - vector v; - split( sStepsTypesToRemove, ",", v ); - ASSERT( v.size() > 0 ); - - // subtract StepsTypes - FOREACH_CONST( RString, v, i ) - { - StepsType st = GAMEMAN->StringToStepsType(*i); - if( st == StepsType_Invalid ) - { - LOG->Warn( "Invalid StepsType value '%s' in '%s'", i->c_str(), sStepsTypesToRemove.c_str() ); - continue; - } - - const vector::iterator iter = find( inout.begin(), inout.end(), st ); - if( iter != inout.end() ) - inout.erase( iter ); - } -} -ThemeMetricStepsTypesToShow::ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ) : - ThemeMetric(sGroup,sName) -{ - // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one - if( IsLoaded() ) - Read(); -} -void ThemeMetricStepsTypesToShow::Read() -{ - ASSERT( GetName().Right(6) == "ToHide" ); - - ThemeMetric::Read(); - - m_v.clear(); - GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, m_v ); - - RemoveStepsTypes( m_v, ThemeMetric::GetValue() ); -} -const vector& ThemeMetricStepsTypesToShow::GetValue() const { return m_v; } - - -RString CommonMetrics::LocalizeOptionItem( const RString &s, bool bOptional ) -{ - if( bOptional && !THEME->HasString("OptionNames",s) ) - return s; - return THEME->GetString( "OptionNames", s ); -} - -LuaFunction( LocalizeOptionItem, CommonMetrics::LocalizeOptionItem(SArg(1),true) ); - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CommonMetrics.h" +#include "RageUtil.h" +#include "Foreach.h" +#include "GameManager.h" +#include "RageLog.h" +#include "GameState.h" +#include "ProductInfo.h" +#include "LuaManager.h" + +ThemeMetric CommonMetrics::OPERATOR_MENU_SCREEN ("Common","OperatorMenuScreen"); +ThemeMetric CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen"); +ThemeMetric CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); +LocalizedString CommonMetrics::WINDOW_TITLE ("Common","WindowTitle"); +ThemeMetric CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS("Common","MaxCourseEntriesBeforeShowVarious"); +ThemeMetric CommonMetrics::TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds"); +ThemeMetric CommonMetrics::DEFAULT_NOTESKIN_NAME ("Common","DefaultNoteSkinName"); +ThemeMetricDifficultiesToShow CommonMetrics::DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow"); +ThemeMetricCourseDifficultiesToShow CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW ("Common","CourseDifficultiesToShow"); +ThemeMetricStepsTypesToShow CommonMetrics::STEPS_TYPES_TO_SHOW ("Common","StepsTypesToHide"); +ThemeMetric CommonMetrics::AUTO_SET_STYLE ("Common","AutoSetStyle"); +ThemeMetric CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES ("Common","PercentScoreDecimalPlaces"); + +ThemeMetricDifficultiesToShow::ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ) : + ThemeMetric(sGroup,sName) +{ + // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one + if( IsLoaded() ) + Read(); +} +void ThemeMetricDifficultiesToShow::Read() +{ + ASSERT( GetName().Right(6) == "ToShow" ); + + ThemeMetric::Read(); + + m_v.clear(); + + vector v; + split( ThemeMetric::GetValue(), ",", v ); + ASSERT( v.size() > 0 ); + + FOREACH_CONST( RString, v, i ) + { + Difficulty d = StringToDifficulty( *i ); + if( d == Difficulty_Invalid ) + RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() ); + m_v.push_back( d ); + } +} +const vector& ThemeMetricDifficultiesToShow::GetValue() const { return m_v; } + + +ThemeMetricCourseDifficultiesToShow::ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ) : + ThemeMetric(sGroup,sName) +{ + // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one + if( IsLoaded() ) + Read(); +} +void ThemeMetricCourseDifficultiesToShow::Read() +{ + ASSERT( GetName().Right(6) == "ToShow" ); + + ThemeMetric::Read(); + + m_v.clear(); + + vector v; + split( ThemeMetric::GetValue(), ",", v ); + ASSERT( v.size() > 0 ); + + FOREACH_CONST( RString, v, i ) + { + CourseDifficulty d = StringToDifficulty( *i ); + if( d == Difficulty_Invalid ) + RageException::Throw( "Unknown CourseDifficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() ); + m_v.push_back( d ); + } +} +const vector& ThemeMetricCourseDifficultiesToShow::GetValue() const { return m_v; } + +static void RemoveStepsTypes( vector& inout, RString sStepsTypesToRemove ) +{ + vector v; + split( sStepsTypesToRemove, ",", v ); + ASSERT( v.size() > 0 ); + + // subtract StepsTypes + FOREACH_CONST( RString, v, i ) + { + StepsType st = GAMEMAN->StringToStepsType(*i); + if( st == StepsType_Invalid ) + { + LOG->Warn( "Invalid StepsType value '%s' in '%s'", i->c_str(), sStepsTypesToRemove.c_str() ); + continue; + } + + const vector::iterator iter = find( inout.begin(), inout.end(), st ); + if( iter != inout.end() ) + inout.erase( iter ); + } +} +ThemeMetricStepsTypesToShow::ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ) : + ThemeMetric(sGroup,sName) +{ + // re-read because ThemeMetric::ThemeMetric calls ThemeMetric::Read, not the derived one + if( IsLoaded() ) + Read(); +} +void ThemeMetricStepsTypesToShow::Read() +{ + ASSERT( GetName().Right(6) == "ToHide" ); + + ThemeMetric::Read(); + + m_v.clear(); + GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, m_v ); + + RemoveStepsTypes( m_v, ThemeMetric::GetValue() ); +} +const vector& ThemeMetricStepsTypesToShow::GetValue() const { return m_v; } + + +RString CommonMetrics::LocalizeOptionItem( const RString &s, bool bOptional ) +{ + if( bOptional && !THEME->HasString("OptionNames",s) ) + return s; + return THEME->GetString( "OptionNames", s ); +} + +LuaFunction( LocalizeOptionItem, CommonMetrics::LocalizeOptionItem(SArg(1),true) ); + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CommonMetrics.h b/src/CommonMetrics.h index 91de9df8e0..f2e4e629c5 100644 --- a/src/CommonMetrics.h +++ b/src/CommonMetrics.h @@ -1,108 +1,108 @@ -#ifndef COMMON_METRICS_H -#define COMMON_METRICS_H - -#include "ThemeMetric.h" -#include "PlayerNumber.h" -#include "Difficulty.h" -#include "GameConstantsAndTypes.h" -#include "LocalizedString.h" - -// Types -class ThemeMetricDifficultiesToShow : public ThemeMetric -{ -public: - ThemeMetricDifficultiesToShow() { } - ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ); - void Read(); - const vector &GetValue() const; -private: - vector m_v; -}; -class ThemeMetricCourseDifficultiesToShow : public ThemeMetric -{ -public: - ThemeMetricCourseDifficultiesToShow() { } - ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ); - void Read(); - const vector &GetValue() const; -private: - vector m_v; -}; -class ThemeMetricStepsTypesToShow : public ThemeMetric -{ -public: - ThemeMetricStepsTypesToShow() { } - ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ); - void Read(); - const vector &GetValue() const; -private: - vector m_v; -}; - - -/** - * @brief Definitions of metrics that are in the "Common" group. - * - * These metrics are used throughout the metrics file. */ -namespace CommonMetrics -{ - /** @brief The first screen in the attract loop. */ - extern ThemeMetric FIRST_ATTRACT_SCREEN; - /** @brief The screen that appears when pressing the operator button. */ - extern ThemeMetric OPERATOR_MENU_SCREEN; - /** @brief The default modifiers to apply. */ - extern ThemeMetric DEFAULT_MODIFIERS; - /** @brief The caption on the title bar. */ - extern LocalizedString WINDOW_TITLE; - /** @brief How many entries should be shown before showing "Various" instead. */ - extern ThemeMetric MAX_COURSE_ENTRIES_BEFORE_VARIOUS; - /** @brief Adjusts the assist tick sound's playback time. */ - extern ThemeMetric TICK_EARLY_SECONDS; - /** @brief the name of the default noteskin. */ - extern ThemeMetric DEFAULT_NOTESKIN_NAME; - /** @brief Which difficulties are to be shown? */ - extern ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW; - /** @brief Which course difficulties are to be shown? */ - extern ThemeMetricCourseDifficultiesToShow COURSE_DIFFICULTIES_TO_SHOW; - /** - * @brief Which step types are to be shown? - * - * This metric (StepsTypesToHide) takes a list of StepsTypes to hide and - * returns a list of StepsTypes to show. */ - extern ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW; - /** @brief Does the player need to explicitly set a style? */ - extern ThemeMetric AUTO_SET_STYLE; - /** @brief How many decimal places are used? */ - extern ThemeMetric PERCENT_SCORE_DECIMAL_PLACES; - - RString LocalizeOptionItem( const RString &s, bool bOptional ); -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef COMMON_METRICS_H +#define COMMON_METRICS_H + +#include "ThemeMetric.h" +#include "PlayerNumber.h" +#include "Difficulty.h" +#include "GameConstantsAndTypes.h" +#include "LocalizedString.h" + +// Types +class ThemeMetricDifficultiesToShow : public ThemeMetric +{ +public: + ThemeMetricDifficultiesToShow() { } + ThemeMetricDifficultiesToShow( const RString& sGroup, const RString& sName ); + void Read(); + const vector &GetValue() const; +private: + vector m_v; +}; +class ThemeMetricCourseDifficultiesToShow : public ThemeMetric +{ +public: + ThemeMetricCourseDifficultiesToShow() { } + ThemeMetricCourseDifficultiesToShow( const RString& sGroup, const RString& sName ); + void Read(); + const vector &GetValue() const; +private: + vector m_v; +}; +class ThemeMetricStepsTypesToShow : public ThemeMetric +{ +public: + ThemeMetricStepsTypesToShow() { } + ThemeMetricStepsTypesToShow( const RString& sGroup, const RString& sName ); + void Read(); + const vector &GetValue() const; +private: + vector m_v; +}; + + +/** + * @brief Definitions of metrics that are in the "Common" group. + * + * These metrics are used throughout the metrics file. */ +namespace CommonMetrics +{ + /** @brief The first screen in the attract loop. */ + extern ThemeMetric FIRST_ATTRACT_SCREEN; + /** @brief The screen that appears when pressing the operator button. */ + extern ThemeMetric OPERATOR_MENU_SCREEN; + /** @brief The default modifiers to apply. */ + extern ThemeMetric DEFAULT_MODIFIERS; + /** @brief The caption on the title bar. */ + extern LocalizedString WINDOW_TITLE; + /** @brief How many entries should be shown before showing "Various" instead. */ + extern ThemeMetric MAX_COURSE_ENTRIES_BEFORE_VARIOUS; + /** @brief Adjusts the assist tick sound's playback time. */ + extern ThemeMetric TICK_EARLY_SECONDS; + /** @brief the name of the default noteskin. */ + extern ThemeMetric DEFAULT_NOTESKIN_NAME; + /** @brief Which difficulties are to be shown? */ + extern ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW; + /** @brief Which course difficulties are to be shown? */ + extern ThemeMetricCourseDifficultiesToShow COURSE_DIFFICULTIES_TO_SHOW; + /** + * @brief Which step types are to be shown? + * + * This metric (StepsTypesToHide) takes a list of StepsTypes to hide and + * returns a list of StepsTypes to show. */ + extern ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW; + /** @brief Does the player need to explicitly set a style? */ + extern ThemeMetric AUTO_SET_STYLE; + /** @brief How many decimal places are used? */ + extern ThemeMetric PERCENT_SCORE_DECIMAL_PLACES; + + RString LocalizeOptionItem( const RString &s, bool bOptional ); +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ControllerStateDisplay.cpp b/src/ControllerStateDisplay.cpp index d97c664b64..ebeb68b38f 100644 --- a/src/ControllerStateDisplay.cpp +++ b/src/ControllerStateDisplay.cpp @@ -1,138 +1,138 @@ -#include "global.h" -#include "ControllerStateDisplay.h" -#include "EnumHelper.h" -#include "RageUtil.h" -#include "RageInputDevice.h" -#include "ThemeManager.h" -#include "InputMapper.h" -#include "InputFilter.h" -#include "RageLog.h" -#include "LuaBinding.h" - -static const char *ControllerStateButtonNames[] = { - "UpLeft", - "UpRight", - "Center", - "DownLeft", - "DownRight", -}; -XToString( ControllerStateButton ); - -// TODO: Generalize for all game types -static const GameButton ControllerStateButtonToGameButton[] = { - PUMP_BUTTON_UPLEFT, - PUMP_BUTTON_UPRIGHT, - PUMP_BUTTON_CENTER, - PUMP_BUTTON_DOWNLEFT, - PUMP_BUTTON_DOWNRIGHT, -}; - -REGISTER_ACTOR_CLASS( ControllerStateDisplay ); - -ControllerStateDisplay::ControllerStateDisplay() -{ - m_bIsLoaded = false; - m_mp = MultiPlayer_Invalid; - m_idsLast = InputDeviceState_Invalid; -} - -void ControllerStateDisplay::LoadMultiPlayer( RString sType, MultiPlayer mp ) -{ - LoadInternal( sType, mp, GameController_1 ); -} - -void ControllerStateDisplay::LoadGameController( RString sType, GameController gc ) -{ - LoadInternal( sType, MultiPlayer_Invalid, gc ); -} - -void ControllerStateDisplay::LoadInternal( RString sType, MultiPlayer mp, GameController gc ) -{ - ASSERT( !m_bIsLoaded ); - m_bIsLoaded = true; - m_mp = mp; - - LuaThreadVariable varElement( "MultiPlayer", LuaReference::Create(m_mp) ); - m_sprFrame.Load( THEME->GetPathG(sType, "frame") ); - this->AddChild( m_sprFrame ); - - FOREACH_ENUM( ControllerStateButton, b ) - { - Button &button = m_Buttons[ b ]; - - RString sPath = THEME->GetPathG( sType, ControllerStateButtonToString(b) ); - button.spr.Load( sPath ); - this->AddChild( m_Buttons[b].spr ); - - button.gi = GameInput( gc, ControllerStateButtonToGameButton[b] ); - } -} - -void ControllerStateDisplay::Update( float fDelta ) -{ - ActorFrame::Update( fDelta ); - - if( m_mp != MultiPlayer_Invalid ) - { - InputDevice id = InputMapper::MultiPlayerToInputDevice( m_mp ); - InputDeviceState ids = INPUTMAN->GetInputDeviceState(id); - if( ids != m_idsLast ) - { - PlayCommand( InputDeviceStateToString(ids) ); - } - m_idsLast = ids; - } - - FOREACH_ENUM( ControllerStateButton, b ) - { - Button &button = m_Buttons[ b ]; - if( !button.spr.IsLoaded() ) - continue; - - bool bVisible = INPUTMAPPER->IsBeingPressed( button.gi, m_mp ); - - button.spr->SetVisible( bVisible ); - } -} - - -/** @brief Allow Lua to have access to the ControllerStateDisplay. */ -class LunaControllerStateDisplay: public Luna -{ -public: - static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), Enum::Check(L, 2) ); return 0; } - static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check(L, 2) ); return 0; } - - LunaControllerStateDisplay() - { - ADD_METHOD( LoadGameController ); - ADD_METHOD( LoadMultiPlayer ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ControllerStateDisplay, ActorFrame ) - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "ControllerStateDisplay.h" +#include "EnumHelper.h" +#include "RageUtil.h" +#include "RageInputDevice.h" +#include "ThemeManager.h" +#include "InputMapper.h" +#include "InputFilter.h" +#include "RageLog.h" +#include "LuaBinding.h" + +static const char *ControllerStateButtonNames[] = { + "UpLeft", + "UpRight", + "Center", + "DownLeft", + "DownRight", +}; +XToString( ControllerStateButton ); + +// TODO: Generalize for all game types +static const GameButton ControllerStateButtonToGameButton[] = { + PUMP_BUTTON_UPLEFT, + PUMP_BUTTON_UPRIGHT, + PUMP_BUTTON_CENTER, + PUMP_BUTTON_DOWNLEFT, + PUMP_BUTTON_DOWNRIGHT, +}; + +REGISTER_ACTOR_CLASS( ControllerStateDisplay ); + +ControllerStateDisplay::ControllerStateDisplay() +{ + m_bIsLoaded = false; + m_mp = MultiPlayer_Invalid; + m_idsLast = InputDeviceState_Invalid; +} + +void ControllerStateDisplay::LoadMultiPlayer( RString sType, MultiPlayer mp ) +{ + LoadInternal( sType, mp, GameController_1 ); +} + +void ControllerStateDisplay::LoadGameController( RString sType, GameController gc ) +{ + LoadInternal( sType, MultiPlayer_Invalid, gc ); +} + +void ControllerStateDisplay::LoadInternal( RString sType, MultiPlayer mp, GameController gc ) +{ + ASSERT( !m_bIsLoaded ); + m_bIsLoaded = true; + m_mp = mp; + + LuaThreadVariable varElement( "MultiPlayer", LuaReference::Create(m_mp) ); + m_sprFrame.Load( THEME->GetPathG(sType, "frame") ); + this->AddChild( m_sprFrame ); + + FOREACH_ENUM( ControllerStateButton, b ) + { + Button &button = m_Buttons[ b ]; + + RString sPath = THEME->GetPathG( sType, ControllerStateButtonToString(b) ); + button.spr.Load( sPath ); + this->AddChild( m_Buttons[b].spr ); + + button.gi = GameInput( gc, ControllerStateButtonToGameButton[b] ); + } +} + +void ControllerStateDisplay::Update( float fDelta ) +{ + ActorFrame::Update( fDelta ); + + if( m_mp != MultiPlayer_Invalid ) + { + InputDevice id = InputMapper::MultiPlayerToInputDevice( m_mp ); + InputDeviceState ids = INPUTMAN->GetInputDeviceState(id); + if( ids != m_idsLast ) + { + PlayCommand( InputDeviceStateToString(ids) ); + } + m_idsLast = ids; + } + + FOREACH_ENUM( ControllerStateButton, b ) + { + Button &button = m_Buttons[ b ]; + if( !button.spr.IsLoaded() ) + continue; + + bool bVisible = INPUTMAPPER->IsBeingPressed( button.gi, m_mp ); + + button.spr->SetVisible( bVisible ); + } +} + + +/** @brief Allow Lua to have access to the ControllerStateDisplay. */ +class LunaControllerStateDisplay: public Luna +{ +public: + static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), Enum::Check(L, 2) ); return 0; } + static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check(L, 2) ); return 0; } + + LunaControllerStateDisplay() + { + ADD_METHOD( LoadGameController ); + ADD_METHOD( LoadMultiPlayer ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ControllerStateDisplay, ActorFrame ) + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/ControllerStateDisplay.h b/src/ControllerStateDisplay.h index 8607330815..9a78f2a3d4 100644 --- a/src/ControllerStateDisplay.h +++ b/src/ControllerStateDisplay.h @@ -1,86 +1,86 @@ -/* ControllerStateDisplay - Show the button state of a controller. */ - -#ifndef ControllerStateDisplay_H -#define ControllerStateDisplay_H - -#include "ActorFrame.h" -#include "ActorUtil.h" -#include "PlayerNumber.h" -#include "AutoActor.h" -#include "RageInput.h" -#include "GameInput.h" - -enum ControllerStateButton -{ - ControllerStateButton_UpLeft, - ControllerStateButton_UpRight, - ControllerStateButton_Center, - ControllerStateButton_DownLeft, - ControllerStateButton_DownRight, - NUM_ControllerStateButton -}; - - -class ControllerStateDisplay : public ActorFrame -{ -public: - ControllerStateDisplay(); - void LoadMultiPlayer( RString sType, MultiPlayer mp ); - void LoadGameController( RString sType, GameController gc ); - virtual void Update( float fDelta ); - bool IsLoaded() const { return m_bIsLoaded; } - - virtual ControllerStateDisplay *Copy() const; - - // Lua - virtual void PushSelf( lua_State *L ); - -protected: - void LoadInternal( RString sType, MultiPlayer mp, GameController gc ); - MultiPlayer m_mp; - - bool m_bIsLoaded; - AutoActor m_sprFrame; - struct Button - { - Button() - { - di.MakeInvalid(); - gi.MakeInvalid(); - } - - AutoActor spr; - DeviceInput di; - GameInput gi; - }; - Button m_Buttons[NUM_ControllerStateButton]; - - InputDeviceState m_idsLast; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* ControllerStateDisplay - Show the button state of a controller. */ + +#ifndef ControllerStateDisplay_H +#define ControllerStateDisplay_H + +#include "ActorFrame.h" +#include "ActorUtil.h" +#include "PlayerNumber.h" +#include "AutoActor.h" +#include "RageInput.h" +#include "GameInput.h" + +enum ControllerStateButton +{ + ControllerStateButton_UpLeft, + ControllerStateButton_UpRight, + ControllerStateButton_Center, + ControllerStateButton_DownLeft, + ControllerStateButton_DownRight, + NUM_ControllerStateButton +}; + + +class ControllerStateDisplay : public ActorFrame +{ +public: + ControllerStateDisplay(); + void LoadMultiPlayer( RString sType, MultiPlayer mp ); + void LoadGameController( RString sType, GameController gc ); + virtual void Update( float fDelta ); + bool IsLoaded() const { return m_bIsLoaded; } + + virtual ControllerStateDisplay *Copy() const; + + // Lua + virtual void PushSelf( lua_State *L ); + +protected: + void LoadInternal( RString sType, MultiPlayer mp, GameController gc ); + MultiPlayer m_mp; + + bool m_bIsLoaded; + AutoActor m_sprFrame; + struct Button + { + Button() + { + di.MakeInvalid(); + gi.MakeInvalid(); + } + + AutoActor spr; + DeviceInput di; + GameInput gi; + }; + Button m_Buttons[NUM_ControllerStateButton]; + + InputDeviceState m_idsLast; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Course.cpp b/src/Course.cpp index 50c75ec04f..10dc2c7f0f 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -1,1155 +1,1155 @@ -#include -#include "global.h" -#include "Course.h" -#include "CourseLoaderCRS.h" -#include "Foreach.h" -#include "GameManager.h" -#include "GameState.h" -#include "LocalizedString.h" -#include "LuaManager.h" -#include "Preference.h" -#include "PrefsManager.h" -#include "ProfileManager.h" -#include "RageLog.h" -#include "Song.h" -#include "SongCacheIndex.h" -#include "Steps.h" -#include "ThemeManager.h" -#include "UnlockManager.h" -#include "Game.h" -#include "Style.h" - -static Preference MAX_SONGS_IN_EDIT_COURSE( "MaxSongsInEditCourse", -1 ); - -static const char *SongSortNames[] = { - "Randomize", - "MostPlays", - "FewestPlays", - "TopGrades", - "LowestGrades", -}; -XToString( SongSort ); -XToLocalizedString( SongSort ); - - -/* Maximum lower value of ranges when difficult: */ -const int MAX_BOTTOM_RANGE = 10; - -#define SORT_PREFERRED_COLOR THEME->GetMetricC("Course","SortPreferredColor") -#define SORT_LEVEL1_COLOR THEME->GetMetricC("Course","SortLevel1Color") -#define SORT_LEVEL2_COLOR THEME->GetMetricC("Course","SortLevel2Color") -#define SORT_LEVEL3_COLOR THEME->GetMetricC("Course","SortLevel3Color") -#define SORT_LEVEL4_COLOR THEME->GetMetricC("Course","SortLevel4Color") -#define SORT_LEVEL5_COLOR THEME->GetMetricC("Course","SortLevel5Color") - -//#define INCLUDE_BEGINNER_STEPS THEME->GetMetricB( "Course","IncludeBeginnerSteps" ); - -RString CourseEntry::GetTextDescription() const -{ - vector vsEntryDescription; - Song *pSong = songID.ToSong(); - if( pSong ) - vsEntryDescription.push_back( pSong->GetTranslitFullTitle() ); - else - vsEntryDescription.push_back( "Random" ); - if( !songCriteria.m_sGroupName.empty() ) - vsEntryDescription.push_back( songCriteria.m_sGroupName ); - if( songCriteria.m_bUseSongGenreAllowedList ) - vsEntryDescription.push_back( join(",",songCriteria.m_vsSongGenreAllowedList) ); - if( stepsCriteria.m_difficulty != Difficulty_Invalid && stepsCriteria.m_difficulty != Difficulty_Medium ) - vsEntryDescription.push_back( CourseDifficultyToLocalizedString(stepsCriteria.m_difficulty) ); - if( stepsCriteria.m_iLowMeter != -1 ) - vsEntryDescription.push_back( ssprintf("Low meter: %d", stepsCriteria.m_iLowMeter) ); - if( stepsCriteria.m_iHighMeter != -1 ) - vsEntryDescription.push_back( ssprintf("High meter: %d", stepsCriteria.m_iHighMeter) ); - if( songSort != SongSort_Randomize ) - vsEntryDescription.push_back( "Sort: %d" + SongSortToLocalizedString(songSort) ); - if( songSort != SongSort_Randomize && iChooseIndex != 0 ) - vsEntryDescription.push_back( "Choose " + FormatNumberAndSuffix(iChooseIndex) + " match" ); - int iNumModChanges = GetNumModChanges(); - if( iNumModChanges != 0 ) - vsEntryDescription.push_back( ssprintf("%d mod changes", iNumModChanges) ); - if( fGainSeconds != 0 ) - vsEntryDescription.push_back( ssprintf("Low meter: %.0f", fGainSeconds) ); - - RString s = join( ",", vsEntryDescription ); - return s; -} - -int CourseEntry::GetNumModChanges() const -{ - int iNumModChanges = 0; - if( !sModifiers.empty() ) - iNumModChanges++; - iNumModChanges += attacks.size(); - return iNumModChanges; -} - - - - -Course::Course() -{ - Init(); -} - -CourseType Course::GetCourseType() const -{ - if( m_bRepeat ) - return COURSE_TYPE_ENDLESS; - if( m_iLives > 0 ) - return COURSE_TYPE_ONI; - if( !m_vEntries.empty() && m_vEntries[0].fGainSeconds > 0 ) - return COURSE_TYPE_SURVIVAL; - return COURSE_TYPE_NONSTOP; -} - -void Course::SetCourseType( CourseType ct ) -{ - if( GetCourseType() == ct ) - return; - - m_bRepeat = false; - m_iLives = -1; - if( !m_vEntries.empty() ) - m_vEntries[0].fGainSeconds = 0; - - switch( ct ) - { - default: ASSERT(0); - case COURSE_TYPE_NONSTOP: - break; - case COURSE_TYPE_ONI: - m_iLives = 4; - break; - case COURSE_TYPE_ENDLESS: - m_bRepeat = true; - break; - case COURSE_TYPE_SURVIVAL: - if( !m_vEntries.empty() ) - m_vEntries[0].fGainSeconds = 120; - break; - } -} - -PlayMode Course::GetPlayMode() const -{ - switch( GetCourseType() ) - { - case COURSE_TYPE_ENDLESS: return PLAY_MODE_ENDLESS; - case COURSE_TYPE_ONI: return PLAY_MODE_ONI; - case COURSE_TYPE_SURVIVAL: return PLAY_MODE_ONI; - case COURSE_TYPE_NONSTOP: return PLAY_MODE_NONSTOP; - default: ASSERT(0); return PlayMode_Invalid; - } -} - -void Course::RevertFromDisk() -{ - // trying to catch invalid an Course - ASSERT( !m_sPath.empty() ); - - CourseLoaderCRS::LoadFromCRSFile( m_sPath, *this ); -} - -RString Course::GetCacheFilePath() const -{ - return SongCacheIndex::GetCacheFilePath( "Courses", m_sPath ); -} - -void Course::Init() -{ - m_bIsAutogen = false; - m_sPath = ""; - - m_sMainTitle = ""; - m_sMainTitleTranslit = ""; - m_sSubTitle = ""; - m_sSubTitleTranslit = ""; - - m_sBannerPath = ""; - m_sBackgroundPath = ""; - m_sCDTitlePath = ""; - m_sGroupName = ""; - - m_bRepeat = false; - m_fGoalSeconds = 0; - m_bShuffle = false; - - m_iLives = -1; - FOREACH_ENUM( Difficulty,dc) - m_iCustomMeter[dc] = -1; - m_bSortByMeter = false; - - m_vEntries.clear(); - - m_SortOrder_TotalDifficulty = 0; - m_SortOrder_Ranking = 0; - - m_LoadedFromProfile = ProfileSlot_Invalid; - m_bIncomplete = false; - m_TrailCache.clear(); - m_iTrailCacheSeed = 0; - m_RadarCache.clear(); -} - -bool Course::IsPlayableIn( StepsType st ) const -{ - // Stripped down version of GetTrailUnsorted - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - SongCriteria soc = e->songCriteria; - - Song *pSong = e->songID.ToSong(); - if( pSong ) - { - soc.m_bUseSongAllowedList = true; - soc.m_vpSongAllowedList.push_back( pSong ); - } - soc.m_Tutorial = SongCriteria::Tutorial_No; - soc.m_Locked = SongCriteria::Locked_Unlocked; - if( !soc.m_bUseSongAllowedList ) - soc.m_iMaxStagesForSong = 1; - - StepsCriteria stc = e->stepsCriteria; - stc.m_st = st; - stc.m_Locked = StepsCriteria::Locked_Unlocked; - - const bool bSameSongCriteria = e != m_vEntries.begin() && (e-1)->songCriteria == soc; - const bool bSameStepsCriteria = e != m_vEntries.begin() && (e-1)->stepsCriteria == stc; - - if( pSong ) - { - if( StepsUtil::HasMatching(pSong, stc) ) - return true; - } - else if( !(bSameSongCriteria && bSameStepsCriteria) ) - { - if( StepsUtil::HasMatching(soc, stc) ) - return true; - } - - } - - return false; -} - - -struct SortTrailEntry -{ - TrailEntry entry; - int SortMeter; - bool operator< ( const SortTrailEntry &rhs ) const { return SortMeter < rhs.SortMeter; } -}; - -RString Course::GetDisplayMainTitle() const -{ - if( !PREFSMAN->m_bShowNativeLanguage ) - return GetTranslitMainTitle(); - return m_sMainTitle; -} - -RString Course::GetDisplaySubTitle() const -{ - if( !PREFSMAN->m_bShowNativeLanguage ) - return GetTranslitSubTitle(); - return m_sSubTitle; -} - -RString Course::GetDisplayFullTitle() const -{ - RString sTitle = GetDisplayMainTitle(); - RString sSubTitle = GetDisplaySubTitle(); - - if( !sSubTitle.empty() ) - sTitle += " " + sSubTitle; - return sTitle; -} - -RString Course::GetTranslitFullTitle() const -{ - RString sTitle = GetTranslitMainTitle(); - RString sSubTitle = GetTranslitSubTitle(); - - if( !sSubTitle.empty() ) - sTitle += " " + sSubTitle; - return sTitle; -} - -/* This is called by many simple functions, like Course::GetTotalSeconds, and may - * be called on all songs to sort. It can take time to execute, so we cache the - * results. Returned pointers remain valid for the lifetime of the Course. If the - * course difficulty doesn't exist, NULL is returned. */ -Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const -{ - ASSERT( cd != Difficulty_Invalid ); - - // Check to see if the Trail cache is out of date - if( m_iTrailCacheSeed != GAMESTATE->m_iStageSeed ) - { - RegenerateNonFixedTrails(); - m_iTrailCacheSeed = GAMESTATE->m_iStageSeed; - } - - // Look in the Trail cache - { - TrailCache_t::iterator it = m_TrailCache.find( CacheEntry(st, cd) ); - if( it != m_TrailCache.end() ) - { - CacheData &cache = it->second; - if( cache.null ) - return NULL; - return &cache.trail; - } - } - - return GetTrailForceRegenCache( st, cd ); -} - -Trail* Course::GetTrailForceRegenCache( StepsType st, CourseDifficulty cd ) const -{ - // Construct a new Trail, add it to the cache, then return it. - CacheData &cache = m_TrailCache[ CacheEntry(st, cd) ]; - Trail &trail = cache.trail; - trail.Init(); - if( !GetTrailSorted(st, cd, trail) ) - { - // This course difficulty doesn't exist. - cache.null = true; - return NULL; - } - - // If we have cached RadarValues for this trail, insert them. - { - RadarCache_t::const_iterator it = m_RadarCache.find( CacheEntry( st, cd ) ); - if( it != m_RadarCache.end() ) - { - const RadarValues &rv = it->second; - trail.SetRadarValues(rv); - } - } - - cache.null = false; - return &cache.trail; -} - -bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const -{ - if( !GetTrailUnsorted( st, cd, trail ) ) - return false; - - if( this->m_bSortByMeter ) - { - /* Sort according to Difficulty_Medium, since the order of songs - * must not change across difficulties. */ - Trail SortTrail; - if( cd == Difficulty_Medium ) - SortTrail = trail; - else - { - bool bOK = GetTrailUnsorted( st, Difficulty_Medium, SortTrail ); - - /* If we have any other difficulty, we must have Difficulty_Medium. */ - ASSERT( bOK ); - } - ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(), - ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) ); - - vector entries; - for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) - { - SortTrailEntry ste; - ste.entry = trail.m_vEntries[i]; - ste.SortMeter = SortTrail.m_vEntries[i].pSteps->GetMeter(); - entries.push_back( ste ); - } - - stable_sort( entries.begin(), entries.end() ); - for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) - trail.m_vEntries[i] = entries[i].entry; - } - - if( trail.m_vEntries.empty() ) - return false; - return true; -} - -// TODO: Move Course initialization after PROFILEMAN is created -static void CourseSortSongs( SongSort sort, vector &vpPossibleSongs, RandomGen &rnd ) -{ - switch( sort ) - { - DEFAULT_FAIL(sort); - case SongSort_Randomize: - random_shuffle( vpPossibleSongs.begin(), vpPossibleSongs.end(), rnd ); - break; - case SongSort_MostPlays: - if( PROFILEMAN ) - SongUtil::SortSongPointerArrayByNumPlays( vpPossibleSongs, PROFILEMAN->GetMachineProfile(), true ); // descending - break; - case SongSort_FewestPlays: - if( PROFILEMAN ) - SongUtil::SortSongPointerArrayByNumPlays( vpPossibleSongs, PROFILEMAN->GetMachineProfile(), false ); // ascending - break; - case SongSort_TopGrades: - if( PROFILEMAN ) - SongUtil::SortSongPointerArrayByGrades( vpPossibleSongs, true ); // descending - break; - case SongSort_LowestGrades: - if( PROFILEMAN ) - SongUtil::SortSongPointerArrayByGrades( vpPossibleSongs, false ); // ascending - break; - } -} - -namespace -{ - struct SongIsEqual - { - const Song *m_pSong; - SongIsEqual( const Song *pSong ) : m_pSong(pSong) { } - bool operator()( const SongAndSteps &sas ) const { return sas.pSong == m_pSong; } - }; -} - -bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const -{ - trail.Init(); - - switch( cd ) - { - case Difficulty_Beginner: - return false; - case Difficulty_Challenge: - return false; - } - - // Construct a new Trail, add it to the cache, then return it. - // Different seed for each course, but the same for the whole round: - RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) ); - - vector tmp_entries; - if( m_bShuffle ) - { - /* Always randomize the same way per round. Otherwise, the displayed course - * will change every time it's viewed, and the displayed order will have no - * bearing on what you'll actually play. */ - tmp_entries = m_vEntries; - random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd ); - } - - const vector &entries = m_bShuffle ? tmp_entries:m_vEntries; - - // This can take some time, so don't fill it out unless we need it. - vector vSongsByMostPlayed; - vector AllSongsShuffled; - - trail.m_StepsType = st; - trail.m_CourseType = GetCourseType(); - trail.m_CourseDifficulty = cd; - - // Set to true if CourseDifficulty is able to change something. - bool bCourseDifficultyIsSignificant = (cd == Difficulty_Medium); - - vector vpAllPossibleSongs; - vector vSongAndSteps; - - // Resolve each entry to a Song and Steps. - FOREACH_CONST( CourseEntry, entries, e ) - { - SongAndSteps resolved; // fill this in - SongCriteria soc = e->songCriteria; - - Song *pSong = e->songID.ToSong(); - if( pSong ) - { - soc.m_bUseSongAllowedList = true; - soc.m_vpSongAllowedList.push_back( pSong ); - } - soc.m_Tutorial = SongCriteria::Tutorial_No; - soc.m_Locked = SongCriteria::Locked_Unlocked; - if( !soc.m_bUseSongAllowedList ) - soc.m_iMaxStagesForSong = 1; - - StepsCriteria stc = e->stepsCriteria; - stc.m_st = st; - stc.m_Locked = StepsCriteria::Locked_Unlocked; - - const bool bSameSongCriteria = e != entries.begin() && (e-1)->songCriteria == soc; - const bool bSameStepsCriteria = e != entries.begin() && (e-1)->stepsCriteria == stc; - - if( pSong ) - { - StepsUtil::GetAllMatching( pSong, stc, vSongAndSteps ); - } - else if( vSongAndSteps.empty() || !(bSameSongCriteria && bSameStepsCriteria) ) - { - vSongAndSteps.clear(); - StepsUtil::GetAllMatching( soc, stc, vSongAndSteps ); - } - - // It looks bad to have the same song 2x in a row in a randomly generated course. - // Don't allow the same song to be played 2x in a row, unless there's only - // one song in vpPossibleSongs. - if( trail.m_vEntries.size() > 0 && vSongAndSteps.size() > 1 ) - { - const TrailEntry &teLast = trail.m_vEntries.back(); - RemoveIf( vSongAndSteps, SongIsEqual(teLast.pSong) ); - } - - // if there are no songs to choose from, abort this CourseEntry - if( vSongAndSteps.empty() ) - continue; - - vector vpSongs; - typedef vector StepsVector; - map mapSongToSteps; - FOREACH_CONST( SongAndSteps, vSongAndSteps, sas ) - { - StepsVector &v = mapSongToSteps[sas->pSong]; - - v.push_back( sas->pSteps ); - if( v.size() == 1 ) - vpSongs.push_back( sas->pSong ); - } - - CourseSortSongs( e->songSort, vpSongs, rnd ); - - ASSERT( e->iChooseIndex >= 0 ); - if( e->iChooseIndex < int(vSongAndSteps.size()) ) - { - resolved.pSong = vpSongs[e->iChooseIndex]; - const vector &mappedSongs = mapSongToSteps[resolved.pSong]; - resolved.pSteps = mappedSongs[ RandomInt(mappedSongs.size()) ]; - } - else - { - continue; - } - - /* If we're not COURSE_DIFFICULTY_REGULAR, then we should be choosing steps that are - * either easier or harder than the base difficulty. If no such steps exist, then - * just use the one we already have. */ - Difficulty dc = resolved.pSteps->GetDifficulty(); - int iLowMeter = e->stepsCriteria.m_iLowMeter; - int iHighMeter = e->stepsCriteria.m_iHighMeter; - if( cd != Difficulty_Medium && !e->bNoDifficult ) - { - Difficulty new_dc = (Difficulty)(dc + cd - Difficulty_Medium); - new_dc = clamp( new_dc, (Difficulty)0, (Difficulty)(Difficulty_Edit-1) ); - /* - // re-edit this code to work using the metric. - Difficulty new_dc; - if( INCLUDE_BEGINNER_STEPS ) - { - // don't factor in the course difficulty if we're including - // beginner steps -aj - new_dc = clamp( dc, Difficulty_Beginner, (Difficulty)(Difficulty_Edit-1) ); - } - else - { - new_dc = (Difficulty)(dc + cd - Difficulty_Medium); - new_dc = clamp( new_dc, (Difficulty)0, (Difficulty)(Difficulty_Edit-1) ); - } - */ - - bool bChangedDifficulty = false; - if( new_dc != dc ) - { - Steps* pNewSteps = SongUtil::GetStepsByDifficulty( resolved.pSong, st, new_dc ); - if( pNewSteps ) - { - dc = new_dc; - resolved.pSteps = pNewSteps; - bChangedDifficulty = true; - bCourseDifficultyIsSignificant = true; - } - } - - /* Hack: We used to adjust low_meter/high_meter above while searching for - * songs. However, that results in a different song being chosen for - * difficult courses, which is bad when LockCourseDifficulties is disabled; - * each player can end up with a different song. Instead, choose based - * on the original range, bump the steps based on course difficulty, and - * then retroactively tweak the low_meter/high_meter so course displays - * line up. */ - if( e->stepsCriteria.m_difficulty == Difficulty_Invalid && bChangedDifficulty ) - { - /* Minimum and maximum to add to make the meter range contain the actual - * meter: */ - int iMinDist = resolved.pSteps->GetMeter() - iHighMeter; - int iMaxDist = resolved.pSteps->GetMeter() - iLowMeter; - - /* Clamp the possible adjustments to try to avoid going under 1 or over - * MAX_BOTTOM_RANGE. */ - iMinDist = min( max( iMinDist, -iLowMeter+1 ), iMaxDist ); - iMaxDist = max( min( iMaxDist, MAX_BOTTOM_RANGE-iHighMeter ), iMinDist ); - - int iAdd; - if( iMaxDist == iMinDist ) - iAdd = iMaxDist; - else - iAdd = rnd(iMaxDist-iMinDist) + iMinDist; - iLowMeter += iAdd; - iHighMeter += iAdd; - } - } - - TrailEntry te; - te.pSong = resolved.pSong; - te.pSteps = resolved.pSteps; - te.Modifiers = e->sModifiers; - te.Attacks = e->attacks; - te.bSecret = e->bSecret; - te.iLowMeter = iLowMeter; - te.iHighMeter = iHighMeter; - - /* If we chose based on meter (not difficulty), then store Difficulty_Invalid, so - * other classes can tell that we used meter. */ - if( e->stepsCriteria.m_difficulty == Difficulty_Invalid ) - { - te.dc = Difficulty_Invalid; - } - else - { - /* Otherwise, store the actual difficulty we got (post-course-difficulty). - * This may or may not be the same as e.difficulty. */ - te.dc = dc; - } - trail.m_vEntries.push_back( te ); - - // LOG->Trace( "Chose: %s, %d", te.pSong->GetSongDir().c_str(), te.pSteps->GetMeter() ); - - if( IsAnEdit() && MAX_SONGS_IN_EDIT_COURSE > 0 && - int(trail.m_vEntries.size()) >= MAX_SONGS_IN_EDIT_COURSE ) - { - break; - } - } - - /* Hack: If any entry was non-FIXED, or m_bShuffle is set, then radar values - * for this trail will be meaningless as they'll change every time. Pre-cache - * empty data. XXX: How can we do this cleanly, without propagating lots of - * otherwise unnecessary data (course entry types, m_bShuffle) to Trail, or - * storing a Course pointer in Trail (yuck)? */ - if( !AllSongsAreFixed() || m_bShuffle ) - { - trail.m_bRadarValuesCached = true; - trail.m_CachedRadarValues = RadarValues(); - } - - /* If we have a manually-entered meter for this difficulty, use it. */ - if( m_iCustomMeter[cd] != -1 ) - trail.m_iSpecifiedMeter = m_iCustomMeter[cd]; - - /* If the course difficulty never actually changed anything, then this difficulty - * is equivalent to Difficulty_Medium; it doesn't exist. */ - return bCourseDifficultyIsSignificant; -} - -void Course::GetTrails( vector &AddTo, StepsType st ) const -{ - FOREACH_ShownCourseDifficulty( cd ) - { - Trail *pTrail = GetTrail( st, cd ); - if( pTrail == NULL ) - continue; - AddTo.push_back( pTrail ); - } -} - -void Course::GetAllTrails( vector &AddTo ) const -{ - vector vStepsTypesToShow; - GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vStepsTypesToShow ); - FOREACH( StepsType, vStepsTypesToShow, st ) - { - GetTrails( AddTo, *st ); - } -} - -int Course::GetMeter( StepsType st, CourseDifficulty cd ) const -{ - if( m_iCustomMeter[cd] != -1 ) - return m_iCustomMeter[cd]; - const Trail* pTrail = GetTrail( st ); - if( pTrail != NULL ) - return pTrail->GetMeter(); - return 0; -} - -bool Course::HasMods() const -{ - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - if( !e->attacks.empty() ) - return true; - } - - return false; -} - -bool Course::HasTimedMods() const -{ - // What makes this different from the SM4 implementation is that - // HasTimedMods now searches for bGlobal in the attacks; if one of - // them is false, it has timed mods. Also returning false will probably - // take longer than expected. -aj - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - if( !e->attacks.empty() ) - { - for( unsigned s=0; s < e->attacks.size(); s++ ) - { - const Attack attack = e->attacks[s]; - if(!attack.bGlobal) - return true; - } - } - } - return false; -} - -bool Course::AllSongsAreFixed() const -{ - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - if( !e->IsFixedSong() ) - return false; - } - return true; -} - -const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const -{ - vector vpStyles; - GAMEMAN->GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); - - for( int s=0; s < (int) vpStyles.size(); ++s ) - { - const Style *pStyle = vpStyles[s]; - FOREACHS_CONST( RString, m_setStyles, style ) - { - if( !style->CompareNoCase(pStyle->m_szName) ) - return pStyle; - } - } - return NULL; -} - -void Course::InvalidateTrailCache() -{ - m_TrailCache.clear(); -} - -void Course::Invalidate( const Song *pStaleSong ) -{ - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - Song *pSong = e->songID.ToSong(); - if( pSong == pStaleSong ) // a fixed entry that references the stale Song - { - RevertFromDisk(); - return; - } - } - - // Invalidate any Trails that contain this song. - // If we find a Trail that contains this song, then it's part of a - // non-fixed entry. So, regenerating the Trail will force different - // songs to be chosen. - FOREACH_ENUM( StepsType,st ) - { - FOREACH_ShownCourseDifficulty( cd ) - { - TrailCache_t::iterator it = m_TrailCache.find( CacheEntry(st, cd) ); - if( it == m_TrailCache.end() ) - continue; - CacheData &cache = it->second; - if( !cache.null ) - if( GetTrail( st, cd )->ContainsSong( pStaleSong ) ) - m_TrailCache.erase( it ); - } - } -} - -void Course::RegenerateNonFixedTrails() const -{ - // Only need to regen Trails if the Course has a random entry. - // We can create these Trails on demand because we don't - // calculate RadarValues for Trails with one or more non-fixed - // entry. - if( AllSongsAreFixed() ) - return; - - FOREACHM( CacheEntry, CacheData, m_TrailCache, e ) - { - const CacheEntry &ce = e->first; - GetTrailForceRegenCache( ce.first, ce.second ); - } -} - -RageColor Course::GetColor() const -{ - // FIXME: Calculate the meter. - int iMeter = 5; - - switch( PREFSMAN->m_CourseSortOrder ) - { - case COURSE_SORT_PREFERRED: - return SORT_PREFERRED_COLOR; //This will also be used for autogen'd courses in some cases. - - case COURSE_SORT_SONGS: - if( m_vEntries.size() >= 7 ) return SORT_LEVEL2_COLOR; - else if( m_vEntries.size() >= 4 ) return SORT_LEVEL4_COLOR; - else return SORT_LEVEL5_COLOR; - - case COURSE_SORT_METER: - if( !AllSongsAreFixed() ) return SORT_LEVEL1_COLOR; - else if( iMeter > 9 ) return SORT_LEVEL2_COLOR; - else if( iMeter >= 7 ) return SORT_LEVEL3_COLOR; - else if( iMeter >= 5 ) return SORT_LEVEL4_COLOR; - else return SORT_LEVEL5_COLOR; - - case COURSE_SORT_METER_SUM: - if( !AllSongsAreFixed() ) return SORT_LEVEL1_COLOR; - if( m_SortOrder_TotalDifficulty >= 40 ) return SORT_LEVEL2_COLOR; - if( m_SortOrder_TotalDifficulty >= 30 ) return SORT_LEVEL3_COLOR; - if( m_SortOrder_TotalDifficulty >= 20 ) return SORT_LEVEL4_COLOR; - else return SORT_LEVEL5_COLOR; - - case COURSE_SORT_RANK: - if( m_SortOrder_Ranking == 3 ) return SORT_LEVEL1_COLOR; - else if( m_SortOrder_Ranking == 2 ) return SORT_LEVEL3_COLOR; - else if( m_SortOrder_Ranking == 1 ) return SORT_LEVEL5_COLOR; - else return SORT_LEVEL4_COLOR; - default: - FAIL_M( ssprintf("Invalid course sort %d.", int(PREFSMAN->m_CourseSortOrder)) ); - return RageColor(1,1,1,1); // white; should never reach here - } -} - -bool Course::GetTotalSeconds( StepsType st, float& fSecondsOut ) const -{ - if( !AllSongsAreFixed() ) - return false; - - Trail* pTrail = GetTrail( st, Difficulty_Medium ); - - fSecondsOut = pTrail->GetLengthSeconds(); - return true; -} - -bool Course::CourseHasBestOrWorst() const -{ - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - if( e->iChooseIndex == SongSort_MostPlays && e->iChooseIndex != -1 ) - return true; - if( e->iChooseIndex == SongSort_FewestPlays && e->iChooseIndex != -1 ) - return true; - } - - return false; -} - -RString Course::GetBannerPath() const -{ - if( m_sBannerPath.empty() ) - return RString(); - if( m_sBannerPath[0] == '/' ) - return m_sBannerPath; - return Dirname(m_sPath) + m_sBannerPath; -} - -RString Course::GetBackgroundPath() const -{ - if( m_sBackgroundPath.empty() ) - return RString(); - if( m_sBackgroundPath[0] == '/' ) - return m_sBackgroundPath; - // add "-bg" on the end to differentiate the background from the banner. - // This is based on traditional file naming found in most song files. -aj - return Dirname(m_sPath) + m_sBackgroundPath + RString("-bg"); -} - -bool Course::HasBanner() const -{ - return GetBannerPath() != "" && IsAFile(GetBannerPath()); -} - -bool Course::HasBackground() const -{ - return GetBackgroundPath() != "" && IsAFile(GetBackgroundPath()); -} - -void Course::UpdateCourseStats( StepsType st ) -{ - m_SortOrder_TotalDifficulty = 0; - - // courses with random/players best-worst songs should go at the end - for(unsigned i = 0; i < m_vEntries.size(); i++) - { - Song *pSong = m_vEntries[i].songID.ToSong(); - if( pSong != NULL ) - continue; - - if ( m_SortOrder_Ranking == 2 ) - m_SortOrder_Ranking = 3; - m_SortOrder_TotalDifficulty = INT_MAX; - return; - } - - const Trail* pTrail = GetTrail( st, Difficulty_Medium ); - - m_SortOrder_TotalDifficulty += pTrail != NULL? pTrail->GetTotalMeter():0; - - // OPTIMIZATION: Ranking info isn't dependent on style, so call it - // sparingly. It's handled on startup and when themes change. - - LOG->Trace("%s: Total feet: %d", - this->m_sMainTitle.c_str(), - m_SortOrder_TotalDifficulty ); -} - -bool Course::IsRanking() const -{ - vector rankingsongs; - - split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs); - - for(unsigned i=0; i < rankingsongs.size(); i++) - if (rankingsongs[i].CompareNoCase(m_sPath)) - return true; - - return false; -} - -const CourseEntry *Course::FindFixedSong( const Song *pSong ) const -{ - FOREACH_CONST( CourseEntry, m_vEntries, e ) - { - const CourseEntry &entry = *e; - Song *lSong = entry.songID.ToSong(); - if( pSong == lSong ) - return &entry; - } - - return NULL; -} - -void Course::GetAllCachedTrails( vector &out ) -{ - TrailCache_t::iterator it; - for( it = m_TrailCache.begin(); it != m_TrailCache.end(); ++it ) - { - CacheData &cd = it->second; - if( !cd.null ) - out.push_back( &cd.trail ); - } -} - -bool Course::ShowInDemonstrationAndRanking() const -{ - // Don't show endless courses in Ranking. - // todo: make this a metric of course types not to show? -aj - return !IsEndless(); -} - -void Course::CalculateRadarValues() -{ - FOREACH_ENUM( StepsType,st ) - { - FOREACH_ENUM( CourseDifficulty,cd ) - { - // For courses that aren't fixed, the radar values are meaningless. - // Makes non-fixed courses have unknown radar values. - if( AllSongsAreFixed() ) - { - Trail *pTrail = GetTrail( st, cd ); - if( pTrail == NULL ) - continue; - RadarValues rv = pTrail->GetRadarValues(); - m_RadarCache[CacheEntry(st, cd)] = rv; - } - else - { - m_RadarCache[CacheEntry(st, cd)] = RadarValues(); - } - } - } -} - -bool Course::Matches( RString sGroup, RString sCourse ) const -{ - if( sGroup.size() && sGroup.CompareNoCase(this->m_sGroupName) != 0) - return false; - - RString sFile = m_sPath; - if( !sFile.empty() ) - { - sFile.Replace("\\","/"); - vector bits; - split( sFile, "/", bits ); - const RString &sLastBit = bits[bits.size()-1]; - if( sCourse.EqualsNoCase(sLastBit) ) - return true; - } - - if( sCourse.EqualsNoCase(this->GetTranslitFullTitle()) ) - return true; - - return false; -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the CourseEntry. */ -class LunaCourseEntry: public Luna -{ -public: - static int GetSong( T* p, lua_State *L ) - { - if( p->songID.ToSong() ) - p->songID.ToSong()->PushSelf(L); - else - lua_pushnil(L); - return 1; - } - DEFINE_METHOD( IsSecret, bSecret ); - DEFINE_METHOD( IsFixedSong, IsFixedSong() ); - DEFINE_METHOD( GetGainSeconds, fGainSeconds ); - DEFINE_METHOD( GetGainLives, iGainLives ); - DEFINE_METHOD( GetNormalModifiers, sModifiers ); - // GetTimedModifiers - table - DEFINE_METHOD( GetNumModChanges, GetNumModChanges() ); - DEFINE_METHOD( GetTextDescription, GetTextDescription() ); - - LunaCourseEntry() - { - ADD_METHOD( GetSong ); - // sm-ssc additions: - ADD_METHOD( IsSecret ); - ADD_METHOD( IsFixedSong ); - ADD_METHOD( GetGainSeconds ); - ADD_METHOD( GetGainLives ); - ADD_METHOD( GetNormalModifiers ); - //ADD_METHOD( GetTimedModifiers ); - ADD_METHOD( GetNumModChanges ); - ADD_METHOD( GetTextDescription ); - } -}; - -LUA_REGISTER_CLASS( CourseEntry ) - -// Not done with lua yet: still another class. - -/** @brief Allow Lua to have access to the Course. */ -class LunaCourse: public Luna -{ -public: - DEFINE_METHOD( GetPlayMode, GetPlayMode() ) - static int GetDisplayFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayFullTitle() ); return 1; } - static int GetTranslitFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetTranslitFullTitle() ); return 1; } - static int HasMods( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMods() ); return 1; } - static int HasTimedMods( T* p, lua_State *L ) { lua_pushboolean( L, p->HasTimedMods() ); return 1; } - DEFINE_METHOD( GetCourseType, GetCourseType() ) - static int GetCourseEntry( T* p, lua_State *L ) { CourseEntry &ce = p->m_vEntries[IArg(1)]; ce.PushSelf(L); return 1; } - static int GetCourseEntries( T* p, lua_State *L ) - { - vector v; - for( unsigned i = 0; i < p->m_vEntries.size(); ++i ) - { - v.push_back(&p->m_vEntries[i]); - } - LuaHelpers::CreateTableFromArray( v, L ); - return 1; - } - static int GetAllTrails( T* p, lua_State *L ) - { - vector v; - p->GetAllTrails( v ); - LuaHelpers::CreateTableFromArray( v, L ); - return 1; - } - static int GetBannerPath( T* p, lua_State *L ) { RString s = p->GetBannerPath(); if( s.empty() ) return 0; LuaHelpers::Push(L, s); return 1; } - static int GetBackgroundPath( T* p, lua_State *L ) { RString s = p->GetBackgroundPath(); if( s.empty() ) return 0; LuaHelpers::Push(L, s); return 1; } - static int GetCourseDir( T* p, lua_State *L ) { lua_pushstring(L, p->m_sPath ); return 1; } - static int GetGroupName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sGroupName ); return 1; } - static int IsAutogen( T* p, lua_State *L ) { lua_pushboolean(L, p->m_bIsAutogen ); return 1; } - static int GetEstimatedNumStages( T* p, lua_State *L ) { lua_pushnumber(L, p->GetEstimatedNumStages() ); return 1; } - static int GetTotalSeconds( T* p, lua_State *L ) - { - StepsType st = Enum::Check(L, 1); - float fTotalSeconds; - if( !p->GetTotalSeconds(st, fTotalSeconds) ) - lua_pushnil( L ); - else - lua_pushnumber( L, fTotalSeconds ); - return 1; - } - DEFINE_METHOD( IsEndless, IsEndless() ) - DEFINE_METHOD( IsNonstop, IsNonstop() ) - DEFINE_METHOD( IsOni, IsOni() ) - DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds ) - static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner() ); return 1; } - static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground() ); return 1; } - DEFINE_METHOD( IsAnEdit, IsAnEdit() ) - - LunaCourse() - { - ADD_METHOD( GetPlayMode ); // [sm-ssc] returns PlayMode enum now - ADD_METHOD( GetDisplayFullTitle ); - ADD_METHOD( GetTranslitFullTitle ); - ADD_METHOD( HasMods ); - ADD_METHOD( HasTimedMods ); - ADD_METHOD( GetCourseType ); // [sm-ssc] returns CourseType enum now - ADD_METHOD( GetCourseEntry ); - ADD_METHOD( GetCourseEntries ); - ADD_METHOD( GetAllTrails ); - ADD_METHOD( GetBannerPath ); - ADD_METHOD( GetBackgroundPath ); // sm-ssc addition - ADD_METHOD( GetCourseDir ); // sm-ssc addition - ADD_METHOD( GetGroupName ); - ADD_METHOD( IsAutogen ); - ADD_METHOD( GetEstimatedNumStages ); - ADD_METHOD( GetTotalSeconds ); - ADD_METHOD( IsEndless ); - ADD_METHOD( IsNonstop ); // sm-ssc addition - ADD_METHOD( IsOni ); // sm-ssc addition - ADD_METHOD( GetGoalSeconds ); - ADD_METHOD( HasBanner ); // sm-ssc addition - ADD_METHOD( HasBackground ); // sm-ssc addition - ADD_METHOD( IsAnEdit ); - } -}; - -LUA_REGISTER_CLASS( Course ) -// lua end - - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include +#include "global.h" +#include "Course.h" +#include "CourseLoaderCRS.h" +#include "Foreach.h" +#include "GameManager.h" +#include "GameState.h" +#include "LocalizedString.h" +#include "LuaManager.h" +#include "Preference.h" +#include "PrefsManager.h" +#include "ProfileManager.h" +#include "RageLog.h" +#include "Song.h" +#include "SongCacheIndex.h" +#include "Steps.h" +#include "ThemeManager.h" +#include "UnlockManager.h" +#include "Game.h" +#include "Style.h" + +static Preference MAX_SONGS_IN_EDIT_COURSE( "MaxSongsInEditCourse", -1 ); + +static const char *SongSortNames[] = { + "Randomize", + "MostPlays", + "FewestPlays", + "TopGrades", + "LowestGrades", +}; +XToString( SongSort ); +XToLocalizedString( SongSort ); + + +/* Maximum lower value of ranges when difficult: */ +const int MAX_BOTTOM_RANGE = 10; + +#define SORT_PREFERRED_COLOR THEME->GetMetricC("Course","SortPreferredColor") +#define SORT_LEVEL1_COLOR THEME->GetMetricC("Course","SortLevel1Color") +#define SORT_LEVEL2_COLOR THEME->GetMetricC("Course","SortLevel2Color") +#define SORT_LEVEL3_COLOR THEME->GetMetricC("Course","SortLevel3Color") +#define SORT_LEVEL4_COLOR THEME->GetMetricC("Course","SortLevel4Color") +#define SORT_LEVEL5_COLOR THEME->GetMetricC("Course","SortLevel5Color") + +//#define INCLUDE_BEGINNER_STEPS THEME->GetMetricB( "Course","IncludeBeginnerSteps" ); + +RString CourseEntry::GetTextDescription() const +{ + vector vsEntryDescription; + Song *pSong = songID.ToSong(); + if( pSong ) + vsEntryDescription.push_back( pSong->GetTranslitFullTitle() ); + else + vsEntryDescription.push_back( "Random" ); + if( !songCriteria.m_sGroupName.empty() ) + vsEntryDescription.push_back( songCriteria.m_sGroupName ); + if( songCriteria.m_bUseSongGenreAllowedList ) + vsEntryDescription.push_back( join(",",songCriteria.m_vsSongGenreAllowedList) ); + if( stepsCriteria.m_difficulty != Difficulty_Invalid && stepsCriteria.m_difficulty != Difficulty_Medium ) + vsEntryDescription.push_back( CourseDifficultyToLocalizedString(stepsCriteria.m_difficulty) ); + if( stepsCriteria.m_iLowMeter != -1 ) + vsEntryDescription.push_back( ssprintf("Low meter: %d", stepsCriteria.m_iLowMeter) ); + if( stepsCriteria.m_iHighMeter != -1 ) + vsEntryDescription.push_back( ssprintf("High meter: %d", stepsCriteria.m_iHighMeter) ); + if( songSort != SongSort_Randomize ) + vsEntryDescription.push_back( "Sort: %d" + SongSortToLocalizedString(songSort) ); + if( songSort != SongSort_Randomize && iChooseIndex != 0 ) + vsEntryDescription.push_back( "Choose " + FormatNumberAndSuffix(iChooseIndex) + " match" ); + int iNumModChanges = GetNumModChanges(); + if( iNumModChanges != 0 ) + vsEntryDescription.push_back( ssprintf("%d mod changes", iNumModChanges) ); + if( fGainSeconds != 0 ) + vsEntryDescription.push_back( ssprintf("Low meter: %.0f", fGainSeconds) ); + + RString s = join( ",", vsEntryDescription ); + return s; +} + +int CourseEntry::GetNumModChanges() const +{ + int iNumModChanges = 0; + if( !sModifiers.empty() ) + iNumModChanges++; + iNumModChanges += attacks.size(); + return iNumModChanges; +} + + + + +Course::Course() +{ + Init(); +} + +CourseType Course::GetCourseType() const +{ + if( m_bRepeat ) + return COURSE_TYPE_ENDLESS; + if( m_iLives > 0 ) + return COURSE_TYPE_ONI; + if( !m_vEntries.empty() && m_vEntries[0].fGainSeconds > 0 ) + return COURSE_TYPE_SURVIVAL; + return COURSE_TYPE_NONSTOP; +} + +void Course::SetCourseType( CourseType ct ) +{ + if( GetCourseType() == ct ) + return; + + m_bRepeat = false; + m_iLives = -1; + if( !m_vEntries.empty() ) + m_vEntries[0].fGainSeconds = 0; + + switch( ct ) + { + default: ASSERT(0); + case COURSE_TYPE_NONSTOP: + break; + case COURSE_TYPE_ONI: + m_iLives = 4; + break; + case COURSE_TYPE_ENDLESS: + m_bRepeat = true; + break; + case COURSE_TYPE_SURVIVAL: + if( !m_vEntries.empty() ) + m_vEntries[0].fGainSeconds = 120; + break; + } +} + +PlayMode Course::GetPlayMode() const +{ + switch( GetCourseType() ) + { + case COURSE_TYPE_ENDLESS: return PLAY_MODE_ENDLESS; + case COURSE_TYPE_ONI: return PLAY_MODE_ONI; + case COURSE_TYPE_SURVIVAL: return PLAY_MODE_ONI; + case COURSE_TYPE_NONSTOP: return PLAY_MODE_NONSTOP; + default: ASSERT(0); return PlayMode_Invalid; + } +} + +void Course::RevertFromDisk() +{ + // trying to catch invalid an Course + ASSERT( !m_sPath.empty() ); + + CourseLoaderCRS::LoadFromCRSFile( m_sPath, *this ); +} + +RString Course::GetCacheFilePath() const +{ + return SongCacheIndex::GetCacheFilePath( "Courses", m_sPath ); +} + +void Course::Init() +{ + m_bIsAutogen = false; + m_sPath = ""; + + m_sMainTitle = ""; + m_sMainTitleTranslit = ""; + m_sSubTitle = ""; + m_sSubTitleTranslit = ""; + + m_sBannerPath = ""; + m_sBackgroundPath = ""; + m_sCDTitlePath = ""; + m_sGroupName = ""; + + m_bRepeat = false; + m_fGoalSeconds = 0; + m_bShuffle = false; + + m_iLives = -1; + FOREACH_ENUM( Difficulty,dc) + m_iCustomMeter[dc] = -1; + m_bSortByMeter = false; + + m_vEntries.clear(); + + m_SortOrder_TotalDifficulty = 0; + m_SortOrder_Ranking = 0; + + m_LoadedFromProfile = ProfileSlot_Invalid; + m_bIncomplete = false; + m_TrailCache.clear(); + m_iTrailCacheSeed = 0; + m_RadarCache.clear(); +} + +bool Course::IsPlayableIn( StepsType st ) const +{ + // Stripped down version of GetTrailUnsorted + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + SongCriteria soc = e->songCriteria; + + Song *pSong = e->songID.ToSong(); + if( pSong ) + { + soc.m_bUseSongAllowedList = true; + soc.m_vpSongAllowedList.push_back( pSong ); + } + soc.m_Tutorial = SongCriteria::Tutorial_No; + soc.m_Locked = SongCriteria::Locked_Unlocked; + if( !soc.m_bUseSongAllowedList ) + soc.m_iMaxStagesForSong = 1; + + StepsCriteria stc = e->stepsCriteria; + stc.m_st = st; + stc.m_Locked = StepsCriteria::Locked_Unlocked; + + const bool bSameSongCriteria = e != m_vEntries.begin() && (e-1)->songCriteria == soc; + const bool bSameStepsCriteria = e != m_vEntries.begin() && (e-1)->stepsCriteria == stc; + + if( pSong ) + { + if( StepsUtil::HasMatching(pSong, stc) ) + return true; + } + else if( !(bSameSongCriteria && bSameStepsCriteria) ) + { + if( StepsUtil::HasMatching(soc, stc) ) + return true; + } + + } + + return false; +} + + +struct SortTrailEntry +{ + TrailEntry entry; + int SortMeter; + bool operator< ( const SortTrailEntry &rhs ) const { return SortMeter < rhs.SortMeter; } +}; + +RString Course::GetDisplayMainTitle() const +{ + if( !PREFSMAN->m_bShowNativeLanguage ) + return GetTranslitMainTitle(); + return m_sMainTitle; +} + +RString Course::GetDisplaySubTitle() const +{ + if( !PREFSMAN->m_bShowNativeLanguage ) + return GetTranslitSubTitle(); + return m_sSubTitle; +} + +RString Course::GetDisplayFullTitle() const +{ + RString sTitle = GetDisplayMainTitle(); + RString sSubTitle = GetDisplaySubTitle(); + + if( !sSubTitle.empty() ) + sTitle += " " + sSubTitle; + return sTitle; +} + +RString Course::GetTranslitFullTitle() const +{ + RString sTitle = GetTranslitMainTitle(); + RString sSubTitle = GetTranslitSubTitle(); + + if( !sSubTitle.empty() ) + sTitle += " " + sSubTitle; + return sTitle; +} + +/* This is called by many simple functions, like Course::GetTotalSeconds, and may + * be called on all songs to sort. It can take time to execute, so we cache the + * results. Returned pointers remain valid for the lifetime of the Course. If the + * course difficulty doesn't exist, NULL is returned. */ +Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const +{ + ASSERT( cd != Difficulty_Invalid ); + + // Check to see if the Trail cache is out of date + if( m_iTrailCacheSeed != GAMESTATE->m_iStageSeed ) + { + RegenerateNonFixedTrails(); + m_iTrailCacheSeed = GAMESTATE->m_iStageSeed; + } + + // Look in the Trail cache + { + TrailCache_t::iterator it = m_TrailCache.find( CacheEntry(st, cd) ); + if( it != m_TrailCache.end() ) + { + CacheData &cache = it->second; + if( cache.null ) + return NULL; + return &cache.trail; + } + } + + return GetTrailForceRegenCache( st, cd ); +} + +Trail* Course::GetTrailForceRegenCache( StepsType st, CourseDifficulty cd ) const +{ + // Construct a new Trail, add it to the cache, then return it. + CacheData &cache = m_TrailCache[ CacheEntry(st, cd) ]; + Trail &trail = cache.trail; + trail.Init(); + if( !GetTrailSorted(st, cd, trail) ) + { + // This course difficulty doesn't exist. + cache.null = true; + return NULL; + } + + // If we have cached RadarValues for this trail, insert them. + { + RadarCache_t::const_iterator it = m_RadarCache.find( CacheEntry( st, cd ) ); + if( it != m_RadarCache.end() ) + { + const RadarValues &rv = it->second; + trail.SetRadarValues(rv); + } + } + + cache.null = false; + return &cache.trail; +} + +bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const +{ + if( !GetTrailUnsorted( st, cd, trail ) ) + return false; + + if( this->m_bSortByMeter ) + { + /* Sort according to Difficulty_Medium, since the order of songs + * must not change across difficulties. */ + Trail SortTrail; + if( cd == Difficulty_Medium ) + SortTrail = trail; + else + { + bool bOK = GetTrailUnsorted( st, Difficulty_Medium, SortTrail ); + + /* If we have any other difficulty, we must have Difficulty_Medium. */ + ASSERT( bOK ); + } + ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(), + ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) ); + + vector entries; + for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) + { + SortTrailEntry ste; + ste.entry = trail.m_vEntries[i]; + ste.SortMeter = SortTrail.m_vEntries[i].pSteps->GetMeter(); + entries.push_back( ste ); + } + + stable_sort( entries.begin(), entries.end() ); + for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) + trail.m_vEntries[i] = entries[i].entry; + } + + if( trail.m_vEntries.empty() ) + return false; + return true; +} + +// TODO: Move Course initialization after PROFILEMAN is created +static void CourseSortSongs( SongSort sort, vector &vpPossibleSongs, RandomGen &rnd ) +{ + switch( sort ) + { + DEFAULT_FAIL(sort); + case SongSort_Randomize: + random_shuffle( vpPossibleSongs.begin(), vpPossibleSongs.end(), rnd ); + break; + case SongSort_MostPlays: + if( PROFILEMAN ) + SongUtil::SortSongPointerArrayByNumPlays( vpPossibleSongs, PROFILEMAN->GetMachineProfile(), true ); // descending + break; + case SongSort_FewestPlays: + if( PROFILEMAN ) + SongUtil::SortSongPointerArrayByNumPlays( vpPossibleSongs, PROFILEMAN->GetMachineProfile(), false ); // ascending + break; + case SongSort_TopGrades: + if( PROFILEMAN ) + SongUtil::SortSongPointerArrayByGrades( vpPossibleSongs, true ); // descending + break; + case SongSort_LowestGrades: + if( PROFILEMAN ) + SongUtil::SortSongPointerArrayByGrades( vpPossibleSongs, false ); // ascending + break; + } +} + +namespace +{ + struct SongIsEqual + { + const Song *m_pSong; + SongIsEqual( const Song *pSong ) : m_pSong(pSong) { } + bool operator()( const SongAndSteps &sas ) const { return sas.pSong == m_pSong; } + }; +} + +bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const +{ + trail.Init(); + + switch( cd ) + { + case Difficulty_Beginner: + return false; + case Difficulty_Challenge: + return false; + } + + // Construct a new Trail, add it to the cache, then return it. + // Different seed for each course, but the same for the whole round: + RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) ); + + vector tmp_entries; + if( m_bShuffle ) + { + /* Always randomize the same way per round. Otherwise, the displayed course + * will change every time it's viewed, and the displayed order will have no + * bearing on what you'll actually play. */ + tmp_entries = m_vEntries; + random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd ); + } + + const vector &entries = m_bShuffle ? tmp_entries:m_vEntries; + + // This can take some time, so don't fill it out unless we need it. + vector vSongsByMostPlayed; + vector AllSongsShuffled; + + trail.m_StepsType = st; + trail.m_CourseType = GetCourseType(); + trail.m_CourseDifficulty = cd; + + // Set to true if CourseDifficulty is able to change something. + bool bCourseDifficultyIsSignificant = (cd == Difficulty_Medium); + + vector vpAllPossibleSongs; + vector vSongAndSteps; + + // Resolve each entry to a Song and Steps. + FOREACH_CONST( CourseEntry, entries, e ) + { + SongAndSteps resolved; // fill this in + SongCriteria soc = e->songCriteria; + + Song *pSong = e->songID.ToSong(); + if( pSong ) + { + soc.m_bUseSongAllowedList = true; + soc.m_vpSongAllowedList.push_back( pSong ); + } + soc.m_Tutorial = SongCriteria::Tutorial_No; + soc.m_Locked = SongCriteria::Locked_Unlocked; + if( !soc.m_bUseSongAllowedList ) + soc.m_iMaxStagesForSong = 1; + + StepsCriteria stc = e->stepsCriteria; + stc.m_st = st; + stc.m_Locked = StepsCriteria::Locked_Unlocked; + + const bool bSameSongCriteria = e != entries.begin() && (e-1)->songCriteria == soc; + const bool bSameStepsCriteria = e != entries.begin() && (e-1)->stepsCriteria == stc; + + if( pSong ) + { + StepsUtil::GetAllMatching( pSong, stc, vSongAndSteps ); + } + else if( vSongAndSteps.empty() || !(bSameSongCriteria && bSameStepsCriteria) ) + { + vSongAndSteps.clear(); + StepsUtil::GetAllMatching( soc, stc, vSongAndSteps ); + } + + // It looks bad to have the same song 2x in a row in a randomly generated course. + // Don't allow the same song to be played 2x in a row, unless there's only + // one song in vpPossibleSongs. + if( trail.m_vEntries.size() > 0 && vSongAndSteps.size() > 1 ) + { + const TrailEntry &teLast = trail.m_vEntries.back(); + RemoveIf( vSongAndSteps, SongIsEqual(teLast.pSong) ); + } + + // if there are no songs to choose from, abort this CourseEntry + if( vSongAndSteps.empty() ) + continue; + + vector vpSongs; + typedef vector StepsVector; + map mapSongToSteps; + FOREACH_CONST( SongAndSteps, vSongAndSteps, sas ) + { + StepsVector &v = mapSongToSteps[sas->pSong]; + + v.push_back( sas->pSteps ); + if( v.size() == 1 ) + vpSongs.push_back( sas->pSong ); + } + + CourseSortSongs( e->songSort, vpSongs, rnd ); + + ASSERT( e->iChooseIndex >= 0 ); + if( e->iChooseIndex < int(vSongAndSteps.size()) ) + { + resolved.pSong = vpSongs[e->iChooseIndex]; + const vector &mappedSongs = mapSongToSteps[resolved.pSong]; + resolved.pSteps = mappedSongs[ RandomInt(mappedSongs.size()) ]; + } + else + { + continue; + } + + /* If we're not COURSE_DIFFICULTY_REGULAR, then we should be choosing steps that are + * either easier or harder than the base difficulty. If no such steps exist, then + * just use the one we already have. */ + Difficulty dc = resolved.pSteps->GetDifficulty(); + int iLowMeter = e->stepsCriteria.m_iLowMeter; + int iHighMeter = e->stepsCriteria.m_iHighMeter; + if( cd != Difficulty_Medium && !e->bNoDifficult ) + { + Difficulty new_dc = (Difficulty)(dc + cd - Difficulty_Medium); + new_dc = clamp( new_dc, (Difficulty)0, (Difficulty)(Difficulty_Edit-1) ); + /* + // re-edit this code to work using the metric. + Difficulty new_dc; + if( INCLUDE_BEGINNER_STEPS ) + { + // don't factor in the course difficulty if we're including + // beginner steps -aj + new_dc = clamp( dc, Difficulty_Beginner, (Difficulty)(Difficulty_Edit-1) ); + } + else + { + new_dc = (Difficulty)(dc + cd - Difficulty_Medium); + new_dc = clamp( new_dc, (Difficulty)0, (Difficulty)(Difficulty_Edit-1) ); + } + */ + + bool bChangedDifficulty = false; + if( new_dc != dc ) + { + Steps* pNewSteps = SongUtil::GetStepsByDifficulty( resolved.pSong, st, new_dc ); + if( pNewSteps ) + { + dc = new_dc; + resolved.pSteps = pNewSteps; + bChangedDifficulty = true; + bCourseDifficultyIsSignificant = true; + } + } + + /* Hack: We used to adjust low_meter/high_meter above while searching for + * songs. However, that results in a different song being chosen for + * difficult courses, which is bad when LockCourseDifficulties is disabled; + * each player can end up with a different song. Instead, choose based + * on the original range, bump the steps based on course difficulty, and + * then retroactively tweak the low_meter/high_meter so course displays + * line up. */ + if( e->stepsCriteria.m_difficulty == Difficulty_Invalid && bChangedDifficulty ) + { + /* Minimum and maximum to add to make the meter range contain the actual + * meter: */ + int iMinDist = resolved.pSteps->GetMeter() - iHighMeter; + int iMaxDist = resolved.pSteps->GetMeter() - iLowMeter; + + /* Clamp the possible adjustments to try to avoid going under 1 or over + * MAX_BOTTOM_RANGE. */ + iMinDist = min( max( iMinDist, -iLowMeter+1 ), iMaxDist ); + iMaxDist = max( min( iMaxDist, MAX_BOTTOM_RANGE-iHighMeter ), iMinDist ); + + int iAdd; + if( iMaxDist == iMinDist ) + iAdd = iMaxDist; + else + iAdd = rnd(iMaxDist-iMinDist) + iMinDist; + iLowMeter += iAdd; + iHighMeter += iAdd; + } + } + + TrailEntry te; + te.pSong = resolved.pSong; + te.pSteps = resolved.pSteps; + te.Modifiers = e->sModifiers; + te.Attacks = e->attacks; + te.bSecret = e->bSecret; + te.iLowMeter = iLowMeter; + te.iHighMeter = iHighMeter; + + /* If we chose based on meter (not difficulty), then store Difficulty_Invalid, so + * other classes can tell that we used meter. */ + if( e->stepsCriteria.m_difficulty == Difficulty_Invalid ) + { + te.dc = Difficulty_Invalid; + } + else + { + /* Otherwise, store the actual difficulty we got (post-course-difficulty). + * This may or may not be the same as e.difficulty. */ + te.dc = dc; + } + trail.m_vEntries.push_back( te ); + + // LOG->Trace( "Chose: %s, %d", te.pSong->GetSongDir().c_str(), te.pSteps->GetMeter() ); + + if( IsAnEdit() && MAX_SONGS_IN_EDIT_COURSE > 0 && + int(trail.m_vEntries.size()) >= MAX_SONGS_IN_EDIT_COURSE ) + { + break; + } + } + + /* Hack: If any entry was non-FIXED, or m_bShuffle is set, then radar values + * for this trail will be meaningless as they'll change every time. Pre-cache + * empty data. XXX: How can we do this cleanly, without propagating lots of + * otherwise unnecessary data (course entry types, m_bShuffle) to Trail, or + * storing a Course pointer in Trail (yuck)? */ + if( !AllSongsAreFixed() || m_bShuffle ) + { + trail.m_bRadarValuesCached = true; + trail.m_CachedRadarValues = RadarValues(); + } + + /* If we have a manually-entered meter for this difficulty, use it. */ + if( m_iCustomMeter[cd] != -1 ) + trail.m_iSpecifiedMeter = m_iCustomMeter[cd]; + + /* If the course difficulty never actually changed anything, then this difficulty + * is equivalent to Difficulty_Medium; it doesn't exist. */ + return bCourseDifficultyIsSignificant; +} + +void Course::GetTrails( vector &AddTo, StepsType st ) const +{ + FOREACH_ShownCourseDifficulty( cd ) + { + Trail *pTrail = GetTrail( st, cd ); + if( pTrail == NULL ) + continue; + AddTo.push_back( pTrail ); + } +} + +void Course::GetAllTrails( vector &AddTo ) const +{ + vector vStepsTypesToShow; + GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vStepsTypesToShow ); + FOREACH( StepsType, vStepsTypesToShow, st ) + { + GetTrails( AddTo, *st ); + } +} + +int Course::GetMeter( StepsType st, CourseDifficulty cd ) const +{ + if( m_iCustomMeter[cd] != -1 ) + return m_iCustomMeter[cd]; + const Trail* pTrail = GetTrail( st ); + if( pTrail != NULL ) + return pTrail->GetMeter(); + return 0; +} + +bool Course::HasMods() const +{ + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + if( !e->attacks.empty() ) + return true; + } + + return false; +} + +bool Course::HasTimedMods() const +{ + // What makes this different from the SM4 implementation is that + // HasTimedMods now searches for bGlobal in the attacks; if one of + // them is false, it has timed mods. Also returning false will probably + // take longer than expected. -aj + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + if( !e->attacks.empty() ) + { + for( unsigned s=0; s < e->attacks.size(); s++ ) + { + const Attack attack = e->attacks[s]; + if(!attack.bGlobal) + return true; + } + } + } + return false; +} + +bool Course::AllSongsAreFixed() const +{ + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + if( !e->IsFixedSong() ) + return false; + } + return true; +} + +const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const +{ + vector vpStyles; + GAMEMAN->GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); + + for( int s=0; s < (int) vpStyles.size(); ++s ) + { + const Style *pStyle = vpStyles[s]; + FOREACHS_CONST( RString, m_setStyles, style ) + { + if( !style->CompareNoCase(pStyle->m_szName) ) + return pStyle; + } + } + return NULL; +} + +void Course::InvalidateTrailCache() +{ + m_TrailCache.clear(); +} + +void Course::Invalidate( const Song *pStaleSong ) +{ + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + Song *pSong = e->songID.ToSong(); + if( pSong == pStaleSong ) // a fixed entry that references the stale Song + { + RevertFromDisk(); + return; + } + } + + // Invalidate any Trails that contain this song. + // If we find a Trail that contains this song, then it's part of a + // non-fixed entry. So, regenerating the Trail will force different + // songs to be chosen. + FOREACH_ENUM( StepsType,st ) + { + FOREACH_ShownCourseDifficulty( cd ) + { + TrailCache_t::iterator it = m_TrailCache.find( CacheEntry(st, cd) ); + if( it == m_TrailCache.end() ) + continue; + CacheData &cache = it->second; + if( !cache.null ) + if( GetTrail( st, cd )->ContainsSong( pStaleSong ) ) + m_TrailCache.erase( it ); + } + } +} + +void Course::RegenerateNonFixedTrails() const +{ + // Only need to regen Trails if the Course has a random entry. + // We can create these Trails on demand because we don't + // calculate RadarValues for Trails with one or more non-fixed + // entry. + if( AllSongsAreFixed() ) + return; + + FOREACHM( CacheEntry, CacheData, m_TrailCache, e ) + { + const CacheEntry &ce = e->first; + GetTrailForceRegenCache( ce.first, ce.second ); + } +} + +RageColor Course::GetColor() const +{ + // FIXME: Calculate the meter. + int iMeter = 5; + + switch( PREFSMAN->m_CourseSortOrder ) + { + case COURSE_SORT_PREFERRED: + return SORT_PREFERRED_COLOR; //This will also be used for autogen'd courses in some cases. + + case COURSE_SORT_SONGS: + if( m_vEntries.size() >= 7 ) return SORT_LEVEL2_COLOR; + else if( m_vEntries.size() >= 4 ) return SORT_LEVEL4_COLOR; + else return SORT_LEVEL5_COLOR; + + case COURSE_SORT_METER: + if( !AllSongsAreFixed() ) return SORT_LEVEL1_COLOR; + else if( iMeter > 9 ) return SORT_LEVEL2_COLOR; + else if( iMeter >= 7 ) return SORT_LEVEL3_COLOR; + else if( iMeter >= 5 ) return SORT_LEVEL4_COLOR; + else return SORT_LEVEL5_COLOR; + + case COURSE_SORT_METER_SUM: + if( !AllSongsAreFixed() ) return SORT_LEVEL1_COLOR; + if( m_SortOrder_TotalDifficulty >= 40 ) return SORT_LEVEL2_COLOR; + if( m_SortOrder_TotalDifficulty >= 30 ) return SORT_LEVEL3_COLOR; + if( m_SortOrder_TotalDifficulty >= 20 ) return SORT_LEVEL4_COLOR; + else return SORT_LEVEL5_COLOR; + + case COURSE_SORT_RANK: + if( m_SortOrder_Ranking == 3 ) return SORT_LEVEL1_COLOR; + else if( m_SortOrder_Ranking == 2 ) return SORT_LEVEL3_COLOR; + else if( m_SortOrder_Ranking == 1 ) return SORT_LEVEL5_COLOR; + else return SORT_LEVEL4_COLOR; + default: + FAIL_M( ssprintf("Invalid course sort %d.", int(PREFSMAN->m_CourseSortOrder)) ); + return RageColor(1,1,1,1); // white; should never reach here + } +} + +bool Course::GetTotalSeconds( StepsType st, float& fSecondsOut ) const +{ + if( !AllSongsAreFixed() ) + return false; + + Trail* pTrail = GetTrail( st, Difficulty_Medium ); + + fSecondsOut = pTrail->GetLengthSeconds(); + return true; +} + +bool Course::CourseHasBestOrWorst() const +{ + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + if( e->iChooseIndex == SongSort_MostPlays && e->iChooseIndex != -1 ) + return true; + if( e->iChooseIndex == SongSort_FewestPlays && e->iChooseIndex != -1 ) + return true; + } + + return false; +} + +RString Course::GetBannerPath() const +{ + if( m_sBannerPath.empty() ) + return RString(); + if( m_sBannerPath[0] == '/' ) + return m_sBannerPath; + return Dirname(m_sPath) + m_sBannerPath; +} + +RString Course::GetBackgroundPath() const +{ + if( m_sBackgroundPath.empty() ) + return RString(); + if( m_sBackgroundPath[0] == '/' ) + return m_sBackgroundPath; + // add "-bg" on the end to differentiate the background from the banner. + // This is based on traditional file naming found in most song files. -aj + return Dirname(m_sPath) + m_sBackgroundPath + RString("-bg"); +} + +bool Course::HasBanner() const +{ + return GetBannerPath() != "" && IsAFile(GetBannerPath()); +} + +bool Course::HasBackground() const +{ + return GetBackgroundPath() != "" && IsAFile(GetBackgroundPath()); +} + +void Course::UpdateCourseStats( StepsType st ) +{ + m_SortOrder_TotalDifficulty = 0; + + // courses with random/players best-worst songs should go at the end + for(unsigned i = 0; i < m_vEntries.size(); i++) + { + Song *pSong = m_vEntries[i].songID.ToSong(); + if( pSong != NULL ) + continue; + + if ( m_SortOrder_Ranking == 2 ) + m_SortOrder_Ranking = 3; + m_SortOrder_TotalDifficulty = INT_MAX; + return; + } + + const Trail* pTrail = GetTrail( st, Difficulty_Medium ); + + m_SortOrder_TotalDifficulty += pTrail != NULL? pTrail->GetTotalMeter():0; + + // OPTIMIZATION: Ranking info isn't dependent on style, so call it + // sparingly. It's handled on startup and when themes change. + + LOG->Trace("%s: Total feet: %d", + this->m_sMainTitle.c_str(), + m_SortOrder_TotalDifficulty ); +} + +bool Course::IsRanking() const +{ + vector rankingsongs; + + split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs); + + for(unsigned i=0; i < rankingsongs.size(); i++) + if (rankingsongs[i].CompareNoCase(m_sPath)) + return true; + + return false; +} + +const CourseEntry *Course::FindFixedSong( const Song *pSong ) const +{ + FOREACH_CONST( CourseEntry, m_vEntries, e ) + { + const CourseEntry &entry = *e; + Song *lSong = entry.songID.ToSong(); + if( pSong == lSong ) + return &entry; + } + + return NULL; +} + +void Course::GetAllCachedTrails( vector &out ) +{ + TrailCache_t::iterator it; + for( it = m_TrailCache.begin(); it != m_TrailCache.end(); ++it ) + { + CacheData &cd = it->second; + if( !cd.null ) + out.push_back( &cd.trail ); + } +} + +bool Course::ShowInDemonstrationAndRanking() const +{ + // Don't show endless courses in Ranking. + // todo: make this a metric of course types not to show? -aj + return !IsEndless(); +} + +void Course::CalculateRadarValues() +{ + FOREACH_ENUM( StepsType,st ) + { + FOREACH_ENUM( CourseDifficulty,cd ) + { + // For courses that aren't fixed, the radar values are meaningless. + // Makes non-fixed courses have unknown radar values. + if( AllSongsAreFixed() ) + { + Trail *pTrail = GetTrail( st, cd ); + if( pTrail == NULL ) + continue; + RadarValues rv = pTrail->GetRadarValues(); + m_RadarCache[CacheEntry(st, cd)] = rv; + } + else + { + m_RadarCache[CacheEntry(st, cd)] = RadarValues(); + } + } + } +} + +bool Course::Matches( RString sGroup, RString sCourse ) const +{ + if( sGroup.size() && sGroup.CompareNoCase(this->m_sGroupName) != 0) + return false; + + RString sFile = m_sPath; + if( !sFile.empty() ) + { + sFile.Replace("\\","/"); + vector bits; + split( sFile, "/", bits ); + const RString &sLastBit = bits[bits.size()-1]; + if( sCourse.EqualsNoCase(sLastBit) ) + return true; + } + + if( sCourse.EqualsNoCase(this->GetTranslitFullTitle()) ) + return true; + + return false; +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the CourseEntry. */ +class LunaCourseEntry: public Luna +{ +public: + static int GetSong( T* p, lua_State *L ) + { + if( p->songID.ToSong() ) + p->songID.ToSong()->PushSelf(L); + else + lua_pushnil(L); + return 1; + } + DEFINE_METHOD( IsSecret, bSecret ); + DEFINE_METHOD( IsFixedSong, IsFixedSong() ); + DEFINE_METHOD( GetGainSeconds, fGainSeconds ); + DEFINE_METHOD( GetGainLives, iGainLives ); + DEFINE_METHOD( GetNormalModifiers, sModifiers ); + // GetTimedModifiers - table + DEFINE_METHOD( GetNumModChanges, GetNumModChanges() ); + DEFINE_METHOD( GetTextDescription, GetTextDescription() ); + + LunaCourseEntry() + { + ADD_METHOD( GetSong ); + // sm-ssc additions: + ADD_METHOD( IsSecret ); + ADD_METHOD( IsFixedSong ); + ADD_METHOD( GetGainSeconds ); + ADD_METHOD( GetGainLives ); + ADD_METHOD( GetNormalModifiers ); + //ADD_METHOD( GetTimedModifiers ); + ADD_METHOD( GetNumModChanges ); + ADD_METHOD( GetTextDescription ); + } +}; + +LUA_REGISTER_CLASS( CourseEntry ) + +// Not done with lua yet: still another class. + +/** @brief Allow Lua to have access to the Course. */ +class LunaCourse: public Luna +{ +public: + DEFINE_METHOD( GetPlayMode, GetPlayMode() ) + static int GetDisplayFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayFullTitle() ); return 1; } + static int GetTranslitFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetTranslitFullTitle() ); return 1; } + static int HasMods( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMods() ); return 1; } + static int HasTimedMods( T* p, lua_State *L ) { lua_pushboolean( L, p->HasTimedMods() ); return 1; } + DEFINE_METHOD( GetCourseType, GetCourseType() ) + static int GetCourseEntry( T* p, lua_State *L ) { CourseEntry &ce = p->m_vEntries[IArg(1)]; ce.PushSelf(L); return 1; } + static int GetCourseEntries( T* p, lua_State *L ) + { + vector v; + for( unsigned i = 0; i < p->m_vEntries.size(); ++i ) + { + v.push_back(&p->m_vEntries[i]); + } + LuaHelpers::CreateTableFromArray( v, L ); + return 1; + } + static int GetAllTrails( T* p, lua_State *L ) + { + vector v; + p->GetAllTrails( v ); + LuaHelpers::CreateTableFromArray( v, L ); + return 1; + } + static int GetBannerPath( T* p, lua_State *L ) { RString s = p->GetBannerPath(); if( s.empty() ) return 0; LuaHelpers::Push(L, s); return 1; } + static int GetBackgroundPath( T* p, lua_State *L ) { RString s = p->GetBackgroundPath(); if( s.empty() ) return 0; LuaHelpers::Push(L, s); return 1; } + static int GetCourseDir( T* p, lua_State *L ) { lua_pushstring(L, p->m_sPath ); return 1; } + static int GetGroupName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sGroupName ); return 1; } + static int IsAutogen( T* p, lua_State *L ) { lua_pushboolean(L, p->m_bIsAutogen ); return 1; } + static int GetEstimatedNumStages( T* p, lua_State *L ) { lua_pushnumber(L, p->GetEstimatedNumStages() ); return 1; } + static int GetTotalSeconds( T* p, lua_State *L ) + { + StepsType st = Enum::Check(L, 1); + float fTotalSeconds; + if( !p->GetTotalSeconds(st, fTotalSeconds) ) + lua_pushnil( L ); + else + lua_pushnumber( L, fTotalSeconds ); + return 1; + } + DEFINE_METHOD( IsEndless, IsEndless() ) + DEFINE_METHOD( IsNonstop, IsNonstop() ) + DEFINE_METHOD( IsOni, IsOni() ) + DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds ) + static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner() ); return 1; } + static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground() ); return 1; } + DEFINE_METHOD( IsAnEdit, IsAnEdit() ) + + LunaCourse() + { + ADD_METHOD( GetPlayMode ); // [sm-ssc] returns PlayMode enum now + ADD_METHOD( GetDisplayFullTitle ); + ADD_METHOD( GetTranslitFullTitle ); + ADD_METHOD( HasMods ); + ADD_METHOD( HasTimedMods ); + ADD_METHOD( GetCourseType ); // [sm-ssc] returns CourseType enum now + ADD_METHOD( GetCourseEntry ); + ADD_METHOD( GetCourseEntries ); + ADD_METHOD( GetAllTrails ); + ADD_METHOD( GetBannerPath ); + ADD_METHOD( GetBackgroundPath ); // sm-ssc addition + ADD_METHOD( GetCourseDir ); // sm-ssc addition + ADD_METHOD( GetGroupName ); + ADD_METHOD( IsAutogen ); + ADD_METHOD( GetEstimatedNumStages ); + ADD_METHOD( GetTotalSeconds ); + ADD_METHOD( IsEndless ); + ADD_METHOD( IsNonstop ); // sm-ssc addition + ADD_METHOD( IsOni ); // sm-ssc addition + ADD_METHOD( GetGoalSeconds ); + ADD_METHOD( HasBanner ); // sm-ssc addition + ADD_METHOD( HasBackground ); // sm-ssc addition + ADD_METHOD( IsAnEdit ); + } +}; + +LUA_REGISTER_CLASS( Course ) +// lua end + + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Course.h b/src/Course.h index 772871ab30..25864c12f6 100644 --- a/src/Course.h +++ b/src/Course.h @@ -1,229 +1,229 @@ -#ifndef COURSE_H -#define COURSE_H - -#include "GameConstantsAndTypes.h" -#include "Attack.h" -#include "EnumHelper.h" -#include "Trail.h" -#include "RageTypes.h" -#include "RageUtil_CachedObject.h" -#include "SongUtil.h" -#include "StepsUtil.h" -#include -#include - -struct lua_State; -class Style; -class Game; - -const int MAX_EDIT_COURSE_TITLE_LENGTH = 12; - -inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); } -inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); } - - -enum SongSort -{ - SongSort_Randomize, - SongSort_MostPlays, - SongSort_FewestPlays, - SongSort_TopGrades, - SongSort_LowestGrades, - NUM_SongSort, -}; -/** @brief Loop through the various Song Sorts. */ -#define FOREACH_SongSort( i ) FOREACH_ENUM( SongSort, i ) -const RString& SongSortToString( SongSort ss ); -const RString& SongSortToLocalizedString( SongSort ss ); - -class CourseEntry -{ -public: - bool bSecret; // show "??????" instead of an exact song - - // filter criteria, applied from top to bottom - SongID songID; // don't filter if unset - SongCriteria songCriteria; - StepsCriteria stepsCriteria; - bool bNoDifficult; // if true, CourseDifficulty doesn't affect this entry - - SongSort songSort; // sort by this after filtering - int iChooseIndex; // - - RString sModifiers; // set player and song options using these - AttackArray attacks; // timed sModifiers - float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only. - int iGainLives; // lives gained back at the beginning of the next song - - CourseEntry(): bSecret(false), bNoDifficult(false), - songSort(SongSort_Randomize), iChooseIndex(0), - sModifiers(RString("")), fGainSeconds(0), iGainLives(-1) {} - - bool IsFixedSong() const { return songID.IsValid(); } - - RString GetTextDescription() const; - int GetNumModChanges() const; - - // Lua - void PushSelf( lua_State *L ); -}; - -/** @brief A queue of songs and notes. */ -class Course -{ -public: - Course(); - - RString GetBannerPath() const; - RString GetBackgroundPath() const; - bool HasBanner() const; - bool HasBackground() const; - - /* If PREFSMAN->m_bShowNative is off, these are the same as GetTranslit* below. - * Otherwise, they return the main titles. */ - RString GetDisplayMainTitle() const; - RString GetDisplaySubTitle() const; - - // Returns the transliterated titles, if any; otherwise returns the main titles. - RString GetTranslitMainTitle() const { return m_sMainTitleTranslit.size()? m_sMainTitleTranslit: m_sMainTitle; } - RString GetTranslitSubTitle() const { return m_sSubTitleTranslit.size()? m_sSubTitleTranslit: m_sSubTitle; } - - // "title subtitle" - RString GetDisplayFullTitle() const; - RString GetTranslitFullTitle() const; - - // Dereferences course_entries and returns only the playable Songs and Steps - Trail* GetTrail( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; - Trail* GetTrailForceRegenCache( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; - void GetTrails( vector &AddTo, StepsType st ) const; - void GetAllTrails( vector &AddTo ) const; - int GetMeter( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; - bool HasMods() const; - bool HasTimedMods() const; - bool AllSongsAreFixed() const; - const Style *GetCourseStyle( const Game *pGame, int iNumPlayers ) const; - - int GetEstimatedNumStages() const { return m_vEntries.size(); } - bool IsPlayableIn( StepsType st ) const; - bool CourseHasBestOrWorst() const; - RageColor GetColor() const; - bool GetTotalSeconds( StepsType st, float& fSecondsOut ) const; - - bool IsNonstop() const { return GetPlayMode() == PLAY_MODE_NONSTOP; } - bool IsOni() const { return GetPlayMode() == PLAY_MODE_ONI; } - bool IsEndless() const { return GetPlayMode() == PLAY_MODE_ENDLESS; } - CourseType GetCourseType() const; - void SetCourseType( CourseType ct ); - PlayMode GetPlayMode() const; - - bool ShowInDemonstrationAndRanking() const; - - void RevertFromDisk(); - void Init(); - - bool IsRanking() const; - - void UpdateCourseStats( StepsType st ); - - // Call to regenerate Trails with random entries - void RegenerateNonFixedTrails() const; - - void InvalidateTrailCache(); - - // Call when a Song or its Steps are deleted/changed. - void Invalidate( const Song *pStaleSong ); - - void GetAllCachedTrails( vector &out ); - RString GetCacheFilePath() const; - - const CourseEntry *FindFixedSong( const Song *pSong ) const; - - ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; } - void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } - - bool Matches(RString sGroup, RString sCourse) const; - - // Lua - void PushSelf( lua_State *L ); - - void CalculateRadarValues(); - - bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; - bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; - - bool IsAnEdit() const { return m_LoadedFromProfile != ProfileSlot_Invalid; } - - - bool m_bIsAutogen; // was this created by AutoGen? - RString m_sPath; - - RString m_sMainTitle, m_sMainTitleTranslit; - RString m_sSubTitle, m_sSubTitleTranslit; - - RString m_sBannerPath; - RString m_sBackgroundPath; // after 9 years yes finally -aj - RString m_sCDTitlePath; - RString m_sGroupName; - - bool m_bRepeat; // repeat after last song? "Endless" - float m_fGoalSeconds; // if not 0, stop play after this number of seconds - bool m_bShuffle; - int m_iLives; // -1 means use bar life meter - int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified - bool m_bSortByMeter; - - bool m_bIncomplete; - - vector m_vEntries; - - // sorting values - int m_SortOrder_TotalDifficulty; - int m_SortOrder_Ranking; - - ProfileSlot m_LoadedFromProfile; // ProfileSlot_Invalid if wasn't loaded from a profile - - typedef pair CacheEntry; - struct CacheData - { - Trail trail; - bool null; - }; - typedef map TrailCache_t; - mutable TrailCache_t m_TrailCache; - mutable int m_iTrailCacheSeed; - - typedef map RadarCache_t; - RadarCache_t m_RadarCache; - - // Preferred styles: - set m_setStyles; - - CachedObject m_CachedObject; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef COURSE_H +#define COURSE_H + +#include "GameConstantsAndTypes.h" +#include "Attack.h" +#include "EnumHelper.h" +#include "Trail.h" +#include "RageTypes.h" +#include "RageUtil_CachedObject.h" +#include "SongUtil.h" +#include "StepsUtil.h" +#include +#include + +struct lua_State; +class Style; +class Game; + +const int MAX_EDIT_COURSE_TITLE_LENGTH = 12; + +inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); } +inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); } + + +enum SongSort +{ + SongSort_Randomize, + SongSort_MostPlays, + SongSort_FewestPlays, + SongSort_TopGrades, + SongSort_LowestGrades, + NUM_SongSort, +}; +/** @brief Loop through the various Song Sorts. */ +#define FOREACH_SongSort( i ) FOREACH_ENUM( SongSort, i ) +const RString& SongSortToString( SongSort ss ); +const RString& SongSortToLocalizedString( SongSort ss ); + +class CourseEntry +{ +public: + bool bSecret; // show "??????" instead of an exact song + + // filter criteria, applied from top to bottom + SongID songID; // don't filter if unset + SongCriteria songCriteria; + StepsCriteria stepsCriteria; + bool bNoDifficult; // if true, CourseDifficulty doesn't affect this entry + + SongSort songSort; // sort by this after filtering + int iChooseIndex; // + + RString sModifiers; // set player and song options using these + AttackArray attacks; // timed sModifiers + float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only. + int iGainLives; // lives gained back at the beginning of the next song + + CourseEntry(): bSecret(false), bNoDifficult(false), + songSort(SongSort_Randomize), iChooseIndex(0), + sModifiers(RString("")), fGainSeconds(0), iGainLives(-1) {} + + bool IsFixedSong() const { return songID.IsValid(); } + + RString GetTextDescription() const; + int GetNumModChanges() const; + + // Lua + void PushSelf( lua_State *L ); +}; + +/** @brief A queue of songs and notes. */ +class Course +{ +public: + Course(); + + RString GetBannerPath() const; + RString GetBackgroundPath() const; + bool HasBanner() const; + bool HasBackground() const; + + /* If PREFSMAN->m_bShowNative is off, these are the same as GetTranslit* below. + * Otherwise, they return the main titles. */ + RString GetDisplayMainTitle() const; + RString GetDisplaySubTitle() const; + + // Returns the transliterated titles, if any; otherwise returns the main titles. + RString GetTranslitMainTitle() const { return m_sMainTitleTranslit.size()? m_sMainTitleTranslit: m_sMainTitle; } + RString GetTranslitSubTitle() const { return m_sSubTitleTranslit.size()? m_sSubTitleTranslit: m_sSubTitle; } + + // "title subtitle" + RString GetDisplayFullTitle() const; + RString GetTranslitFullTitle() const; + + // Dereferences course_entries and returns only the playable Songs and Steps + Trail* GetTrail( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; + Trail* GetTrailForceRegenCache( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; + void GetTrails( vector &AddTo, StepsType st ) const; + void GetAllTrails( vector &AddTo ) const; + int GetMeter( StepsType st, CourseDifficulty cd=Difficulty_Medium ) const; + bool HasMods() const; + bool HasTimedMods() const; + bool AllSongsAreFixed() const; + const Style *GetCourseStyle( const Game *pGame, int iNumPlayers ) const; + + int GetEstimatedNumStages() const { return m_vEntries.size(); } + bool IsPlayableIn( StepsType st ) const; + bool CourseHasBestOrWorst() const; + RageColor GetColor() const; + bool GetTotalSeconds( StepsType st, float& fSecondsOut ) const; + + bool IsNonstop() const { return GetPlayMode() == PLAY_MODE_NONSTOP; } + bool IsOni() const { return GetPlayMode() == PLAY_MODE_ONI; } + bool IsEndless() const { return GetPlayMode() == PLAY_MODE_ENDLESS; } + CourseType GetCourseType() const; + void SetCourseType( CourseType ct ); + PlayMode GetPlayMode() const; + + bool ShowInDemonstrationAndRanking() const; + + void RevertFromDisk(); + void Init(); + + bool IsRanking() const; + + void UpdateCourseStats( StepsType st ); + + // Call to regenerate Trails with random entries + void RegenerateNonFixedTrails() const; + + void InvalidateTrailCache(); + + // Call when a Song or its Steps are deleted/changed. + void Invalidate( const Song *pStaleSong ); + + void GetAllCachedTrails( vector &out ); + RString GetCacheFilePath() const; + + const CourseEntry *FindFixedSong( const Song *pSong ) const; + + ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; } + void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } + + bool Matches(RString sGroup, RString sCourse) const; + + // Lua + void PushSelf( lua_State *L ); + + void CalculateRadarValues(); + + bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; + bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; + + bool IsAnEdit() const { return m_LoadedFromProfile != ProfileSlot_Invalid; } + + + bool m_bIsAutogen; // was this created by AutoGen? + RString m_sPath; + + RString m_sMainTitle, m_sMainTitleTranslit; + RString m_sSubTitle, m_sSubTitleTranslit; + + RString m_sBannerPath; + RString m_sBackgroundPath; // after 9 years yes finally -aj + RString m_sCDTitlePath; + RString m_sGroupName; + + bool m_bRepeat; // repeat after last song? "Endless" + float m_fGoalSeconds; // if not 0, stop play after this number of seconds + bool m_bShuffle; + int m_iLives; // -1 means use bar life meter + int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified + bool m_bSortByMeter; + + bool m_bIncomplete; + + vector m_vEntries; + + // sorting values + int m_SortOrder_TotalDifficulty; + int m_SortOrder_Ranking; + + ProfileSlot m_LoadedFromProfile; // ProfileSlot_Invalid if wasn't loaded from a profile + + typedef pair CacheEntry; + struct CacheData + { + Trail trail; + bool null; + }; + typedef map TrailCache_t; + mutable TrailCache_t m_TrailCache; + mutable int m_iTrailCacheSeed; + + typedef map RadarCache_t; + RadarCache_t m_RadarCache; + + // Preferred styles: + set m_setStyles; + + CachedObject m_CachedObject; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseContentsList.cpp b/src/CourseContentsList.cpp index 7b03b083c2..a4e09474c5 100644 --- a/src/CourseContentsList.cpp +++ b/src/CourseContentsList.cpp @@ -1,186 +1,186 @@ -#include "global.h" -#include "CourseContentsList.h" -#include "GameConstantsAndTypes.h" -#include "RageLog.h" -#include "Course.h" -#include "Trail.h" -#include "GameState.h" -#include "XmlFile.h" -#include "ActorUtil.h" -#include "RageUtil.h" -#include "Steps.h" - -REGISTER_ACTOR_CLASS( CourseContentsList ); - -CourseContentsList::~CourseContentsList() -{ - FOREACH( Actor *, m_vpDisplay, d ) - delete *d; - m_vpDisplay.clear(); -} - -void CourseContentsList::LoadFromNode( const XNode* pNode ) -{ - int iMaxSongs = 5; - pNode->GetAttrValue( "MaxSongs", iMaxSongs ); - - const XNode *pDisplayNode = pNode->GetChild( "Display" ); - if( pDisplayNode == NULL ) - RageException::Throw( "%s: CourseContentsList: missing the Display child", ActorUtil::GetWhere(pNode).c_str() ); - - for( int i=0; iSetUseZBuffer( true ); - m_vpDisplay.push_back( pDisplay ); - } - - ActorScroller::LoadFromNode( pNode ); -} - -void CourseContentsList::SetFromGameState() -{ - RemoveAllChildren(); - - if( GAMESTATE->m_MasterPlayerNumber == PlayerNumber_Invalid ) - return; - const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; - if( pMasterTrail == NULL ) - return; - unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size(); - CLAMP( uNumEntriesToShow, 0, m_vpDisplay.size() ); - - for( int i=0; i<(int)uNumEntriesToShow; i++ ) - { - Actor *pDisplay = m_vpDisplay[i]; - SetItemFromGameState( pDisplay, i ); - this->AddChild( pDisplay ); - } - - bool bLoop = pMasterTrail->m_vEntries.size() > uNumEntriesToShow; - - this->SetLoop( bLoop ); - this->Load2(); - this->SetTransformFromHeight( m_vpDisplay[0]->GetUnzoomedHeight() ); - this->EnableMask( m_vpDisplay[0]->GetUnzoomedWidth(), m_vpDisplay[0]->GetUnzoomedHeight() ); - - if( bLoop ) - { - SetPauseCountdownSeconds( 1.5f ); - this->SetDestinationItem( m_vpDisplay.size()+1 ); // loop forever - } -} - -void CourseContentsList::SetItemFromGameState( Actor *pActor, int iCourseEntryIndex ) -{ - const Course *pCourse = GAMESTATE->m_pCurCourse; - - FOREACH_HumanPlayer(pn) - { - const Trail *pTrail = GAMESTATE->m_pCurTrail[pn]; - if( pTrail == NULL || iCourseEntryIndex >= (int) pTrail->m_vEntries.size() ) - continue; - - const TrailEntry *te = &pTrail->m_vEntries[iCourseEntryIndex]; - const CourseEntry *ce = &pCourse->m_vEntries[iCourseEntryIndex]; - if( te == NULL ) - continue; - - RString s; - Difficulty dc; - if( te->bSecret ) - { - if( ce == NULL ) - continue; - - int iLow = ce->stepsCriteria.m_iLowMeter; - int iHigh = ce->stepsCriteria.m_iHighMeter; - - bool bLowIsSet = iLow != -1; - bool bHighIsSet = iHigh != -1; - - if( !bLowIsSet && !bHighIsSet ) - { - s = "?"; - } - if( !bLowIsSet && bHighIsSet ) - { - s = ssprintf( ">=%d", iHigh ); - } - else if( bLowIsSet && !bHighIsSet ) - { - s = ssprintf( "<=%d", iLow ); - } - else if( bLowIsSet && bHighIsSet ) - { - if( iLow == iHigh ) - s = ssprintf( "%d", iLow ); - else - s = ssprintf( "%d-%d", iLow, iHigh ); - } - - dc = te->dc; - if( dc == Difficulty_Invalid ) - dc = Difficulty_Edit; - } - else - { - s = ssprintf("%d", te->pSteps->GetMeter()); - dc = te->pSteps->GetDifficulty(); - } - - Message msg("SetSong"); - msg.SetParam( "PlayerNumber", pn ); - msg.SetParam( "Song", te->pSong ); - msg.SetParam( "Steps", te->pSteps ); - msg.SetParam( "Difficulty", dc ); - msg.SetParam( "Meter", s ); - msg.SetParam( "Number", iCourseEntryIndex+1 ); - msg.SetParam( "Modifiers", te->Modifiers ); - msg.SetParam( "Secret", te->bSecret ); - pActor->HandleMessage( msg ); - } -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the CourseContentsList. */ -class LunaCourseContentsList: public Luna -{ -public: - static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } - - LunaCourseContentsList() - { - ADD_METHOD( SetFromGameState ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( CourseContentsList, ActorScroller ) -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CourseContentsList.h" +#include "GameConstantsAndTypes.h" +#include "RageLog.h" +#include "Course.h" +#include "Trail.h" +#include "GameState.h" +#include "XmlFile.h" +#include "ActorUtil.h" +#include "RageUtil.h" +#include "Steps.h" + +REGISTER_ACTOR_CLASS( CourseContentsList ); + +CourseContentsList::~CourseContentsList() +{ + FOREACH( Actor *, m_vpDisplay, d ) + delete *d; + m_vpDisplay.clear(); +} + +void CourseContentsList::LoadFromNode( const XNode* pNode ) +{ + int iMaxSongs = 5; + pNode->GetAttrValue( "MaxSongs", iMaxSongs ); + + const XNode *pDisplayNode = pNode->GetChild( "Display" ); + if( pDisplayNode == NULL ) + RageException::Throw( "%s: CourseContentsList: missing the Display child", ActorUtil::GetWhere(pNode).c_str() ); + + for( int i=0; iSetUseZBuffer( true ); + m_vpDisplay.push_back( pDisplay ); + } + + ActorScroller::LoadFromNode( pNode ); +} + +void CourseContentsList::SetFromGameState() +{ + RemoveAllChildren(); + + if( GAMESTATE->m_MasterPlayerNumber == PlayerNumber_Invalid ) + return; + const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; + if( pMasterTrail == NULL ) + return; + unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size(); + CLAMP( uNumEntriesToShow, 0, m_vpDisplay.size() ); + + for( int i=0; i<(int)uNumEntriesToShow; i++ ) + { + Actor *pDisplay = m_vpDisplay[i]; + SetItemFromGameState( pDisplay, i ); + this->AddChild( pDisplay ); + } + + bool bLoop = pMasterTrail->m_vEntries.size() > uNumEntriesToShow; + + this->SetLoop( bLoop ); + this->Load2(); + this->SetTransformFromHeight( m_vpDisplay[0]->GetUnzoomedHeight() ); + this->EnableMask( m_vpDisplay[0]->GetUnzoomedWidth(), m_vpDisplay[0]->GetUnzoomedHeight() ); + + if( bLoop ) + { + SetPauseCountdownSeconds( 1.5f ); + this->SetDestinationItem( m_vpDisplay.size()+1 ); // loop forever + } +} + +void CourseContentsList::SetItemFromGameState( Actor *pActor, int iCourseEntryIndex ) +{ + const Course *pCourse = GAMESTATE->m_pCurCourse; + + FOREACH_HumanPlayer(pn) + { + const Trail *pTrail = GAMESTATE->m_pCurTrail[pn]; + if( pTrail == NULL || iCourseEntryIndex >= (int) pTrail->m_vEntries.size() ) + continue; + + const TrailEntry *te = &pTrail->m_vEntries[iCourseEntryIndex]; + const CourseEntry *ce = &pCourse->m_vEntries[iCourseEntryIndex]; + if( te == NULL ) + continue; + + RString s; + Difficulty dc; + if( te->bSecret ) + { + if( ce == NULL ) + continue; + + int iLow = ce->stepsCriteria.m_iLowMeter; + int iHigh = ce->stepsCriteria.m_iHighMeter; + + bool bLowIsSet = iLow != -1; + bool bHighIsSet = iHigh != -1; + + if( !bLowIsSet && !bHighIsSet ) + { + s = "?"; + } + if( !bLowIsSet && bHighIsSet ) + { + s = ssprintf( ">=%d", iHigh ); + } + else if( bLowIsSet && !bHighIsSet ) + { + s = ssprintf( "<=%d", iLow ); + } + else if( bLowIsSet && bHighIsSet ) + { + if( iLow == iHigh ) + s = ssprintf( "%d", iLow ); + else + s = ssprintf( "%d-%d", iLow, iHigh ); + } + + dc = te->dc; + if( dc == Difficulty_Invalid ) + dc = Difficulty_Edit; + } + else + { + s = ssprintf("%d", te->pSteps->GetMeter()); + dc = te->pSteps->GetDifficulty(); + } + + Message msg("SetSong"); + msg.SetParam( "PlayerNumber", pn ); + msg.SetParam( "Song", te->pSong ); + msg.SetParam( "Steps", te->pSteps ); + msg.SetParam( "Difficulty", dc ); + msg.SetParam( "Meter", s ); + msg.SetParam( "Number", iCourseEntryIndex+1 ); + msg.SetParam( "Modifiers", te->Modifiers ); + msg.SetParam( "Secret", te->bSecret ); + pActor->HandleMessage( msg ); + } +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the CourseContentsList. */ +class LunaCourseContentsList: public Luna +{ +public: + static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + + LunaCourseContentsList() + { + ADD_METHOD( SetFromGameState ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( CourseContentsList, ActorScroller ) +// lua end + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseContentsList.h b/src/CourseContentsList.h index 7d11a09df4..11faae7443 100644 --- a/src/CourseContentsList.h +++ b/src/CourseContentsList.h @@ -1,51 +1,51 @@ -#ifndef COURSE_CONTENTS_LIST_H -#define COURSE_CONTENTS_LIST_H - -#include "ActorScroller.h" -class CourseEntryDisplay; -/** @brief Holds course name and banner. */ -class CourseContentsList : public ActorScroller -{ -public: - ~CourseContentsList(); - virtual CourseContentsList *Copy() const; - - void LoadFromNode( const XNode* pNode ); - - void SetFromGameState(); - - // Lua - void PushSelf( lua_State *L ); - -protected: - void SetItemFromGameState( Actor *pActor, int iCourseEntryIndex ); - - vector m_vpDisplay; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef COURSE_CONTENTS_LIST_H +#define COURSE_CONTENTS_LIST_H + +#include "ActorScroller.h" +class CourseEntryDisplay; +/** @brief Holds course name and banner. */ +class CourseContentsList : public ActorScroller +{ +public: + ~CourseContentsList(); + virtual CourseContentsList *Copy() const; + + void LoadFromNode( const XNode* pNode ); + + void SetFromGameState(); + + // Lua + void PushSelf( lua_State *L ); + +protected: + void SetItemFromGameState( Actor *pActor, int iCourseEntryIndex ); + + vector m_vpDisplay; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseLoaderCRS.cpp b/src/CourseLoaderCRS.cpp index e780b7b0d1..d0bd999294 100644 --- a/src/CourseLoaderCRS.cpp +++ b/src/CourseLoaderCRS.cpp @@ -1,497 +1,497 @@ -#include "global.h" -#include "CourseLoaderCRS.h" -#include "RageLog.h" -#include "Course.h" -#include "RageUtil.h" -#include "SongCacheIndex.h" -#include "PrefsManager.h" -#include "MsdFile.h" -#include "PlayerOptions.h" -#include "SongManager.h" -#include "TitleSubstitution.h" -#include "BannerCache.h" -#include "RageFileManager.h" -#include "CourseWriterCRS.h" -#include "RageUtil.h" -#include "CourseUtil.h" -#include - -/** @brief Edit courses can only be so big before they are rejected. */ -const int MAX_EDIT_COURSE_SIZE_BYTES = 32*1024; // 32KB - -/** @brief The list of difficulty names for courses. */ -const char *g_CRSDifficultyNames[] = -{ - "Beginner", - "Easy", - "Regular", - "Difficult", - "Challenge", - "Edit", -}; - -/** - * @brief Retrieve the course difficulty based on the string name. - * @param s the name of the difficulty. - * @return the course difficulty. - */ -static CourseDifficulty CRSStringToDifficulty( const RString& s ) -{ - FOREACH_ENUM( Difficulty,i) - if( !s.CompareNoCase(g_CRSDifficultyNames[i]) ) - return i; - return Difficulty_Invalid; -} - - -bool CourseLoaderCRS::LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out ) -{ - MsdFile msd; - msd.ReadFromString( sBuffer, false ); // don't unescape - return LoadFromMsd( sPath, msd, out, true ); -} - -bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache ) -{ - AttackArray attacks; - float fGainSeconds = 0; - for( unsigned i=0; iUserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() ); - continue; - } - out.m_iCustomMeter[cd] = max( atoi(sParams[2]), 0 ); - } - } - // todo: add COMBO and COMBOMODE from DWI CRS files? -aj - - else if( 0 == stricmp(sValueName, "MODS") ) - { - Attack attack; - float end = -9999; - for( unsigned j = 1; j < sParams.params.size(); ++j ) - { - vector sBits; - split( sParams[j], "=", sBits, false ); - if( sBits.size() < 2 ) - continue; - - Trim( sBits[0] ); - if( !sBits[0].CompareNoCase("TIME") ) - attack.fStartSecond = max( StringToFloat(sBits[1]), 0.0f ); - else if( !sBits[0].CompareNoCase("LEN") ) - attack.fSecsRemaining = StringToFloat( sBits[1] ); - else if( !sBits[0].CompareNoCase("END") ) - end = StringToFloat( sBits[1] ); - else if( !sBits[0].CompareNoCase("MODS") ) - { - attack.sModifiers = sBits[1]; - - if( end != -9999 ) - { - attack.fSecsRemaining = end - attack.fStartSecond; - end = -9999; - } - - if( attack.fSecsRemaining <= 0.0f) - { - LOG->UserLog( "Course file", sPath, "has an attack with a nonpositive length: %s", sBits[1].c_str() ); - attack.fSecsRemaining = 0.0f; - } - - // warn on invalid so we catch typos on load - CourseUtil::WarnOnInvalidMods( attack.sModifiers ); - - attacks.push_back( attack ); - } - else - { - LOG->UserLog( "Course file", sPath, "has an unexpected value named '%s'", sBits[0].c_str() ); - } - } - - } - else if( 0 == stricmp(sValueName, "SONG") ) - { - CourseEntry new_entry; - - // infer entry::Type from the first param - // todo: make sure these aren't generating bogus entries due - // to a lack of songs. -aj - // most played - if( sParams[1].Left(strlen("BEST")) == "BEST" ) - { - new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1; - CLAMP( new_entry.iChooseIndex, 0, 500 ); - new_entry.songSort = SongSort_MostPlays; - } - // least played - else if( sParams[1].Left(strlen("WORST")) == "WORST" ) - { - new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1; - CLAMP( new_entry.iChooseIndex, 0, 500 ); - new_entry.songSort = SongSort_FewestPlays; - } - // best grades - if( sParams[1].Left(strlen("GRADEBEST")) == "GRADEBEST" ) - { - new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEBEST")) ) - 1; - CLAMP( new_entry.iChooseIndex, 0, 500 ); - new_entry.songSort = SongSort_TopGrades; - } - // worst grades - else if( sParams[1].Left(strlen("GRADEWORST")) == "GRADEWORST" ) - { - new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEWORST")) ) - 1; - CLAMP( new_entry.iChooseIndex, 0, 500 ); - new_entry.songSort = SongSort_LowestGrades; - } - else if( sParams[1] == "*" ) - { - //new_entry.bSecret = true; - } - // group random - else if( sParams[1].Right(1) == "*" ) - { - //new_entry.bSecret = true; - RString sSong = sParams[1]; - sSong.Replace( "\\", "/" ); - vector bits; - split( sSong, "/", bits ); - if( bits.size() == 2 ) - { - new_entry.songCriteria.m_sGroupName = bits[0]; - } - else - { - LOG->UserLog( "Course file", sPath, "contains a random_within_group entry \"%s\" that is invalid. " - "Song should be in the format \"/*\".", sSong.c_str() ); - } - - if( !SONGMAN->DoesSongGroupExist(new_entry.songCriteria.m_sGroupName) ) - { - LOG->UserLog( "Course file", sPath, "random_within_group entry \"%s\" specifies a group that doesn't exist. " - "This entry will be ignored.", sSong.c_str() ); - out.m_bIncomplete = true; - continue; // skip this #SONG - } - } - else - { - RString sSong = sParams[1]; - sSong.Replace( "\\", "/" ); - vector bits; - split( sSong, "/", bits ); - - Song *pSong = NULL; - if( bits.size() == 2 ) - { - new_entry.songCriteria.m_sGroupName = bits[0]; - pSong = SONGMAN->FindSong( bits[0], bits[1] ); - } - else if( bits.size() == 1 ) - { - pSong = SONGMAN->FindSong( "", sSong ); - } - new_entry.songID.FromSong( pSong ); - - if( pSong == NULL ) - { - LOG->UserLog( "Course file", sPath, "contains a fixed song entry \"%s\" that does not exist. " - "This entry will be ignored.", sSong.c_str()); - out.m_bIncomplete = true; - continue; // skip this #SONG - } - } - - new_entry.stepsCriteria.m_difficulty = StringToDifficulty( sParams[2] ); - if( new_entry.stepsCriteria.m_difficulty == Difficulty_Invalid ) - { - int retval = sscanf( sParams[2], "%d..%d", &new_entry.stepsCriteria.m_iLowMeter, &new_entry.stepsCriteria.m_iHighMeter ); - if( retval == 1 ) - new_entry.stepsCriteria.m_iHighMeter = new_entry.stepsCriteria.m_iLowMeter; - else if( retval != 2 ) - { - LOG->UserLog( "Course file", sPath, "contains an invalid difficulty setting: \"%s\", 3..6 used instead", - sParams[2].c_str() ); - new_entry.stepsCriteria.m_iLowMeter = 3; - new_entry.stepsCriteria.m_iHighMeter = 6; - } - new_entry.stepsCriteria.m_iLowMeter = max( new_entry.stepsCriteria.m_iLowMeter, 1 ); - new_entry.stepsCriteria.m_iHighMeter = max( new_entry.stepsCriteria.m_iHighMeter, new_entry.stepsCriteria.m_iLowMeter ); - } - - { - // If "showcourse" or "noshowcourse" is in the list, force - // new_entry.secret on or off. - vector mods; - split( sParams[3], ",", mods, true ); - for( int j = (int) mods.size()-1; j >= 0 ; --j ) - { - RString &sMod = mods[j]; - TrimLeft( sMod ); - TrimRight( sMod ); - if( !sMod.CompareNoCase("showcourse") ) - new_entry.bSecret = false; - else if( !sMod.CompareNoCase("noshowcourse") ) - new_entry.bSecret = true; - else if( !sMod.CompareNoCase("nodifficult") ) - new_entry.bNoDifficult = true; - else if( sMod.length() > 5 && !sMod.Left(5).CompareNoCase("award") ) - new_entry.iGainLives = atoi( sMod.substr(5).c_str() ); - else - continue; - mods.erase( mods.begin() + j ); - } - new_entry.sModifiers = join( ",", mods ); - } - - new_entry.attacks = attacks; - new_entry.fGainSeconds = fGainSeconds; - attacks.clear(); - - out.m_vEntries.push_back( new_entry ); - } - else if( !stricmp(sValueName, "DISPLAYCOURSE") || !stricmp(sValueName, "COMBO") || - !stricmp(sValueName, "COMBOMODE") ) - { - // Ignore - } - - else if( bFromCache && !stricmp(sValueName, "RADAR") ) - { - StepsType st = (StepsType) atoi(sParams[1]); - CourseDifficulty cd = (CourseDifficulty) atoi( sParams[2] ); - - RadarValues rv; - rv.FromString( sParams[3] ); - out.m_RadarCache[Course::CacheEntry(st, cd)] = rv; - } - else if( 0 == stricmp(sValueName, "STYLE") ) - { - RString sStyles = sParams[1]; - vector asStyles; - split( sStyles, ",", asStyles ); - FOREACH( RString, asStyles, s ) - out.m_setStyles.insert( *s ); - - } - else - { - LOG->UserLog( "Course file", sPath, "contains an unexpected value named \"%s\"", sValueName.c_str() ); - } - } - - if( out.m_sBannerPath.empty() ) - { - const RString sFName = SetExtension( out.m_sPath, "" ); - - vector arrayPossibleBanners; - GetDirListing( sFName + "*.png", arrayPossibleBanners, false, false ); - GetDirListing( sFName + "*.jpg", arrayPossibleBanners, false, false ); - GetDirListing( sFName + "*.bmp", arrayPossibleBanners, false, false ); - GetDirListing( sFName + "*.gif", arrayPossibleBanners, false, false ); - if( !arrayPossibleBanners.empty() ) - out.m_sBannerPath = arrayPossibleBanners[0]; - } - - static TitleSubst tsub("Courses"); - - TitleFields title; - title.Title = out.m_sMainTitle; - title.TitleTranslit = out.m_sMainTitleTranslit; - tsub.Subst( title ); - out.m_sMainTitle = title.Title; - out.m_sMainTitleTranslit = title.TitleTranslit; - - /* Cache and load the course banner. Only bother doing this if at least one - * song was found in the course. */ - if( out.m_vEntries.empty() ) - return true; - if( out.m_sBannerPath != "" ) - BANNERCACHE->CacheBanner( out.GetBannerPath() ); - - /* Cache each trail RadarValues that's slow to load, so we - * don't have to do it at runtime. */ - if( !bFromCache ) - out.CalculateRadarValues(); - - return true; -} - -bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out ) -{ - RString sPath = _sPath; - - out.Init(); - - out.m_sPath = sPath; // save path - - // save group name - { - vector parts; - split( sPath, "/", parts, false ); - if( parts.size() >= 4 ) // e.g. "/Courses/blah/fun.crs" - out.m_sGroupName = parts[parts.size()-2]; - } - - - bool bUseCache = true; - { - /* First look in the cache for this course. Don't bother honoring - * FastLoad for checking the course hash, since courses are normally - * grouped into a few directories, not one directory per course. */ - unsigned uHash = SONGINDEX->GetCacheHash( out.m_sPath ); - if( !DoesFileExist(out.GetCacheFilePath()) ) - bUseCache = false; - // XXX: if !FastLoad, regen cache if the used songs have changed - if( !PREFSMAN->m_bFastLoad && GetHashForFile(out.m_sPath) != uHash ) - bUseCache = false; // this cache is out of date - } - - if( bUseCache ) - { - RString sCacheFile = out.GetCacheFilePath(); - LOG->Trace( "CourseLoaderCRS::LoadFromCRSFile(\"%s\") (\"%s\")", sPath.c_str(), sCacheFile.c_str() ); - sPath = sCacheFile; - } - else - { - LOG->Trace( "CourseLoaderCRS::LoadFromCRSFile(\"%s\")", sPath.c_str() ); - } - - MsdFile msd; - if( !msd.ReadFile( sPath, false ) ) // don't unescape - { - LOG->UserLog( "Course file", sPath, "couldn't be opened: %s.", msd.GetError().c_str() ); - return false; - } - - if( !LoadFromMsd(sPath, msd, out, bUseCache) ) - return false; - - if( !bUseCache ) - { - // If we have any cache data, write the cache file. - if( out.m_RadarCache.size() ) - { - RString sCachePath = out.GetCacheFilePath(); - if( CourseWriterCRS::Write(out, sCachePath, true) ) - SONGINDEX->AddCacheIndex( out.m_sPath, GetHashForFile(out.m_sPath) ); - } - } - - return true; -} - -bool CourseLoaderCRS::LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot ) -{ - LOG->Trace( "CourseLoaderCRS::LoadEdit(%s)", sEditFilePath.c_str() ); - - int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath ); - if( iBytes > MAX_EDIT_COURSE_SIZE_BYTES ) - { - LOG->UserLog( "Edit file", sEditFilePath, "is unreasonably large. It won't be loaded." ); - return false; - } - - MsdFile msd; - if( !msd.ReadFile( sEditFilePath, false ) ) // don't unescape - { - LOG->UserLog( "Edit file", sEditFilePath, "couldn't be opened: %s", msd.GetError().c_str() ); - return false; - } - Course *pCourse = new Course; - - pCourse->m_sPath = sEditFilePath; - LoadFromMsd( sEditFilePath, msd, *pCourse, true ); - - pCourse->m_LoadedFromProfile = slot; - - SONGMAN->AddCourse( pCourse ); - return true; -} - -bool CourseLoaderCRS::LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot ) -{ - Course *pCourse = new Course; - if( !LoadFromBuffer(sPath, sBuffer, *pCourse) ) - { - delete pCourse; - return false; - } - - pCourse->m_LoadedFromProfile = slot; - - SONGMAN->AddCourse( pCourse ); - return true; -} - - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CourseLoaderCRS.h" +#include "RageLog.h" +#include "Course.h" +#include "RageUtil.h" +#include "SongCacheIndex.h" +#include "PrefsManager.h" +#include "MsdFile.h" +#include "PlayerOptions.h" +#include "SongManager.h" +#include "TitleSubstitution.h" +#include "BannerCache.h" +#include "RageFileManager.h" +#include "CourseWriterCRS.h" +#include "RageUtil.h" +#include "CourseUtil.h" +#include + +/** @brief Edit courses can only be so big before they are rejected. */ +const int MAX_EDIT_COURSE_SIZE_BYTES = 32*1024; // 32KB + +/** @brief The list of difficulty names for courses. */ +const char *g_CRSDifficultyNames[] = +{ + "Beginner", + "Easy", + "Regular", + "Difficult", + "Challenge", + "Edit", +}; + +/** + * @brief Retrieve the course difficulty based on the string name. + * @param s the name of the difficulty. + * @return the course difficulty. + */ +static CourseDifficulty CRSStringToDifficulty( const RString& s ) +{ + FOREACH_ENUM( Difficulty,i) + if( !s.CompareNoCase(g_CRSDifficultyNames[i]) ) + return i; + return Difficulty_Invalid; +} + + +bool CourseLoaderCRS::LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out ) +{ + MsdFile msd; + msd.ReadFromString( sBuffer, false ); // don't unescape + return LoadFromMsd( sPath, msd, out, true ); +} + +bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache ) +{ + AttackArray attacks; + float fGainSeconds = 0; + for( unsigned i=0; iUserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() ); + continue; + } + out.m_iCustomMeter[cd] = max( atoi(sParams[2]), 0 ); + } + } + // todo: add COMBO and COMBOMODE from DWI CRS files? -aj + + else if( 0 == stricmp(sValueName, "MODS") ) + { + Attack attack; + float end = -9999; + for( unsigned j = 1; j < sParams.params.size(); ++j ) + { + vector sBits; + split( sParams[j], "=", sBits, false ); + if( sBits.size() < 2 ) + continue; + + Trim( sBits[0] ); + if( !sBits[0].CompareNoCase("TIME") ) + attack.fStartSecond = max( StringToFloat(sBits[1]), 0.0f ); + else if( !sBits[0].CompareNoCase("LEN") ) + attack.fSecsRemaining = StringToFloat( sBits[1] ); + else if( !sBits[0].CompareNoCase("END") ) + end = StringToFloat( sBits[1] ); + else if( !sBits[0].CompareNoCase("MODS") ) + { + attack.sModifiers = sBits[1]; + + if( end != -9999 ) + { + attack.fSecsRemaining = end - attack.fStartSecond; + end = -9999; + } + + if( attack.fSecsRemaining <= 0.0f) + { + LOG->UserLog( "Course file", sPath, "has an attack with a nonpositive length: %s", sBits[1].c_str() ); + attack.fSecsRemaining = 0.0f; + } + + // warn on invalid so we catch typos on load + CourseUtil::WarnOnInvalidMods( attack.sModifiers ); + + attacks.push_back( attack ); + } + else + { + LOG->UserLog( "Course file", sPath, "has an unexpected value named '%s'", sBits[0].c_str() ); + } + } + + } + else if( 0 == stricmp(sValueName, "SONG") ) + { + CourseEntry new_entry; + + // infer entry::Type from the first param + // todo: make sure these aren't generating bogus entries due + // to a lack of songs. -aj + // most played + if( sParams[1].Left(strlen("BEST")) == "BEST" ) + { + new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1; + CLAMP( new_entry.iChooseIndex, 0, 500 ); + new_entry.songSort = SongSort_MostPlays; + } + // least played + else if( sParams[1].Left(strlen("WORST")) == "WORST" ) + { + new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1; + CLAMP( new_entry.iChooseIndex, 0, 500 ); + new_entry.songSort = SongSort_FewestPlays; + } + // best grades + if( sParams[1].Left(strlen("GRADEBEST")) == "GRADEBEST" ) + { + new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEBEST")) ) - 1; + CLAMP( new_entry.iChooseIndex, 0, 500 ); + new_entry.songSort = SongSort_TopGrades; + } + // worst grades + else if( sParams[1].Left(strlen("GRADEWORST")) == "GRADEWORST" ) + { + new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEWORST")) ) - 1; + CLAMP( new_entry.iChooseIndex, 0, 500 ); + new_entry.songSort = SongSort_LowestGrades; + } + else if( sParams[1] == "*" ) + { + //new_entry.bSecret = true; + } + // group random + else if( sParams[1].Right(1) == "*" ) + { + //new_entry.bSecret = true; + RString sSong = sParams[1]; + sSong.Replace( "\\", "/" ); + vector bits; + split( sSong, "/", bits ); + if( bits.size() == 2 ) + { + new_entry.songCriteria.m_sGroupName = bits[0]; + } + else + { + LOG->UserLog( "Course file", sPath, "contains a random_within_group entry \"%s\" that is invalid. " + "Song should be in the format \"/*\".", sSong.c_str() ); + } + + if( !SONGMAN->DoesSongGroupExist(new_entry.songCriteria.m_sGroupName) ) + { + LOG->UserLog( "Course file", sPath, "random_within_group entry \"%s\" specifies a group that doesn't exist. " + "This entry will be ignored.", sSong.c_str() ); + out.m_bIncomplete = true; + continue; // skip this #SONG + } + } + else + { + RString sSong = sParams[1]; + sSong.Replace( "\\", "/" ); + vector bits; + split( sSong, "/", bits ); + + Song *pSong = NULL; + if( bits.size() == 2 ) + { + new_entry.songCriteria.m_sGroupName = bits[0]; + pSong = SONGMAN->FindSong( bits[0], bits[1] ); + } + else if( bits.size() == 1 ) + { + pSong = SONGMAN->FindSong( "", sSong ); + } + new_entry.songID.FromSong( pSong ); + + if( pSong == NULL ) + { + LOG->UserLog( "Course file", sPath, "contains a fixed song entry \"%s\" that does not exist. " + "This entry will be ignored.", sSong.c_str()); + out.m_bIncomplete = true; + continue; // skip this #SONG + } + } + + new_entry.stepsCriteria.m_difficulty = StringToDifficulty( sParams[2] ); + if( new_entry.stepsCriteria.m_difficulty == Difficulty_Invalid ) + { + int retval = sscanf( sParams[2], "%d..%d", &new_entry.stepsCriteria.m_iLowMeter, &new_entry.stepsCriteria.m_iHighMeter ); + if( retval == 1 ) + new_entry.stepsCriteria.m_iHighMeter = new_entry.stepsCriteria.m_iLowMeter; + else if( retval != 2 ) + { + LOG->UserLog( "Course file", sPath, "contains an invalid difficulty setting: \"%s\", 3..6 used instead", + sParams[2].c_str() ); + new_entry.stepsCriteria.m_iLowMeter = 3; + new_entry.stepsCriteria.m_iHighMeter = 6; + } + new_entry.stepsCriteria.m_iLowMeter = max( new_entry.stepsCriteria.m_iLowMeter, 1 ); + new_entry.stepsCriteria.m_iHighMeter = max( new_entry.stepsCriteria.m_iHighMeter, new_entry.stepsCriteria.m_iLowMeter ); + } + + { + // If "showcourse" or "noshowcourse" is in the list, force + // new_entry.secret on or off. + vector mods; + split( sParams[3], ",", mods, true ); + for( int j = (int) mods.size()-1; j >= 0 ; --j ) + { + RString &sMod = mods[j]; + TrimLeft( sMod ); + TrimRight( sMod ); + if( !sMod.CompareNoCase("showcourse") ) + new_entry.bSecret = false; + else if( !sMod.CompareNoCase("noshowcourse") ) + new_entry.bSecret = true; + else if( !sMod.CompareNoCase("nodifficult") ) + new_entry.bNoDifficult = true; + else if( sMod.length() > 5 && !sMod.Left(5).CompareNoCase("award") ) + new_entry.iGainLives = atoi( sMod.substr(5).c_str() ); + else + continue; + mods.erase( mods.begin() + j ); + } + new_entry.sModifiers = join( ",", mods ); + } + + new_entry.attacks = attacks; + new_entry.fGainSeconds = fGainSeconds; + attacks.clear(); + + out.m_vEntries.push_back( new_entry ); + } + else if( !stricmp(sValueName, "DISPLAYCOURSE") || !stricmp(sValueName, "COMBO") || + !stricmp(sValueName, "COMBOMODE") ) + { + // Ignore + } + + else if( bFromCache && !stricmp(sValueName, "RADAR") ) + { + StepsType st = (StepsType) atoi(sParams[1]); + CourseDifficulty cd = (CourseDifficulty) atoi( sParams[2] ); + + RadarValues rv; + rv.FromString( sParams[3] ); + out.m_RadarCache[Course::CacheEntry(st, cd)] = rv; + } + else if( 0 == stricmp(sValueName, "STYLE") ) + { + RString sStyles = sParams[1]; + vector asStyles; + split( sStyles, ",", asStyles ); + FOREACH( RString, asStyles, s ) + out.m_setStyles.insert( *s ); + + } + else + { + LOG->UserLog( "Course file", sPath, "contains an unexpected value named \"%s\"", sValueName.c_str() ); + } + } + + if( out.m_sBannerPath.empty() ) + { + const RString sFName = SetExtension( out.m_sPath, "" ); + + vector arrayPossibleBanners; + GetDirListing( sFName + "*.png", arrayPossibleBanners, false, false ); + GetDirListing( sFName + "*.jpg", arrayPossibleBanners, false, false ); + GetDirListing( sFName + "*.bmp", arrayPossibleBanners, false, false ); + GetDirListing( sFName + "*.gif", arrayPossibleBanners, false, false ); + if( !arrayPossibleBanners.empty() ) + out.m_sBannerPath = arrayPossibleBanners[0]; + } + + static TitleSubst tsub("Courses"); + + TitleFields title; + title.Title = out.m_sMainTitle; + title.TitleTranslit = out.m_sMainTitleTranslit; + tsub.Subst( title ); + out.m_sMainTitle = title.Title; + out.m_sMainTitleTranslit = title.TitleTranslit; + + /* Cache and load the course banner. Only bother doing this if at least one + * song was found in the course. */ + if( out.m_vEntries.empty() ) + return true; + if( out.m_sBannerPath != "" ) + BANNERCACHE->CacheBanner( out.GetBannerPath() ); + + /* Cache each trail RadarValues that's slow to load, so we + * don't have to do it at runtime. */ + if( !bFromCache ) + out.CalculateRadarValues(); + + return true; +} + +bool CourseLoaderCRS::LoadFromCRSFile( const RString &_sPath, Course &out ) +{ + RString sPath = _sPath; + + out.Init(); + + out.m_sPath = sPath; // save path + + // save group name + { + vector parts; + split( sPath, "/", parts, false ); + if( parts.size() >= 4 ) // e.g. "/Courses/blah/fun.crs" + out.m_sGroupName = parts[parts.size()-2]; + } + + + bool bUseCache = true; + { + /* First look in the cache for this course. Don't bother honoring + * FastLoad for checking the course hash, since courses are normally + * grouped into a few directories, not one directory per course. */ + unsigned uHash = SONGINDEX->GetCacheHash( out.m_sPath ); + if( !DoesFileExist(out.GetCacheFilePath()) ) + bUseCache = false; + // XXX: if !FastLoad, regen cache if the used songs have changed + if( !PREFSMAN->m_bFastLoad && GetHashForFile(out.m_sPath) != uHash ) + bUseCache = false; // this cache is out of date + } + + if( bUseCache ) + { + RString sCacheFile = out.GetCacheFilePath(); + LOG->Trace( "CourseLoaderCRS::LoadFromCRSFile(\"%s\") (\"%s\")", sPath.c_str(), sCacheFile.c_str() ); + sPath = sCacheFile; + } + else + { + LOG->Trace( "CourseLoaderCRS::LoadFromCRSFile(\"%s\")", sPath.c_str() ); + } + + MsdFile msd; + if( !msd.ReadFile( sPath, false ) ) // don't unescape + { + LOG->UserLog( "Course file", sPath, "couldn't be opened: %s.", msd.GetError().c_str() ); + return false; + } + + if( !LoadFromMsd(sPath, msd, out, bUseCache) ) + return false; + + if( !bUseCache ) + { + // If we have any cache data, write the cache file. + if( out.m_RadarCache.size() ) + { + RString sCachePath = out.GetCacheFilePath(); + if( CourseWriterCRS::Write(out, sCachePath, true) ) + SONGINDEX->AddCacheIndex( out.m_sPath, GetHashForFile(out.m_sPath) ); + } + } + + return true; +} + +bool CourseLoaderCRS::LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot ) +{ + LOG->Trace( "CourseLoaderCRS::LoadEdit(%s)", sEditFilePath.c_str() ); + + int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath ); + if( iBytes > MAX_EDIT_COURSE_SIZE_BYTES ) + { + LOG->UserLog( "Edit file", sEditFilePath, "is unreasonably large. It won't be loaded." ); + return false; + } + + MsdFile msd; + if( !msd.ReadFile( sEditFilePath, false ) ) // don't unescape + { + LOG->UserLog( "Edit file", sEditFilePath, "couldn't be opened: %s", msd.GetError().c_str() ); + return false; + } + Course *pCourse = new Course; + + pCourse->m_sPath = sEditFilePath; + LoadFromMsd( sEditFilePath, msd, *pCourse, true ); + + pCourse->m_LoadedFromProfile = slot; + + SONGMAN->AddCourse( pCourse ); + return true; +} + +bool CourseLoaderCRS::LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot ) +{ + Course *pCourse = new Course; + if( !LoadFromBuffer(sPath, sBuffer, *pCourse) ) + { + delete pCourse; + return false; + } + + pCourse->m_LoadedFromProfile = slot; + + SONGMAN->AddCourse( pCourse ); + return true; +} + + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseLoaderCRS.h b/src/CourseLoaderCRS.h index e03081a3f4..5bf8db4369 100644 --- a/src/CourseLoaderCRS.h +++ b/src/CourseLoaderCRS.h @@ -1,81 +1,81 @@ -/** @brief CourseLoaderCRS - Reads a Course from an .CRS file. */ - -#ifndef COURSE_LOADER_CRS_H -#define COURSE_LOADER_CRS_H - -#include "GameConstantsAndTypes.h" -class Course; -class MsdFile; - -/** @brief The Course Loader handles parsing the .crs files. */ -namespace CourseLoaderCRS -{ - /** - * @brief Attempt to load a course file from a particular path. - * @param sPath the path to the file. - * @param out the course file. - * @return its success or failure. - */ - bool LoadFromCRSFile( const RString &sPath, Course &out ); - /** - * @brief Attempt to load the course information from the msd context. - * @param sPath the path to the file. - * @param msd the MSD context. - * @param out the course file. - * @param bFromCache true if loading from the cache area. - * @return its success or failure. - */ - bool LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache ); - /** - * @brief Attempt to load the course file from the buffer. - * @param sPath the path to the file. - * @param sBuffer the path to the buffer. - * @param out the course file. - * @return its success or failure. - */ - bool LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out ); - /** - * @brief Attempt to load an edit course from the hard drive. - * @param sEditFilePath a path on the hard drive to check. - * @param slot the Profile of the user with the edit course. - * @return its success or failure. - */ - bool LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot ); - /** - * @brief Attempt to load an edit course from the buffer. - * @param sBuffer the path to the buffer. - * @param sPath the path to the file. - * @param slot the individual's profile. - * @return its success or failure. - */ - bool LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot ); -} - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief CourseLoaderCRS - Reads a Course from an .CRS file. */ + +#ifndef COURSE_LOADER_CRS_H +#define COURSE_LOADER_CRS_H + +#include "GameConstantsAndTypes.h" +class Course; +class MsdFile; + +/** @brief The Course Loader handles parsing the .crs files. */ +namespace CourseLoaderCRS +{ + /** + * @brief Attempt to load a course file from a particular path. + * @param sPath the path to the file. + * @param out the course file. + * @return its success or failure. + */ + bool LoadFromCRSFile( const RString &sPath, Course &out ); + /** + * @brief Attempt to load the course information from the msd context. + * @param sPath the path to the file. + * @param msd the MSD context. + * @param out the course file. + * @param bFromCache true if loading from the cache area. + * @return its success or failure. + */ + bool LoadFromMsd( const RString &sPath, const MsdFile &msd, Course &out, bool bFromCache ); + /** + * @brief Attempt to load the course file from the buffer. + * @param sPath the path to the file. + * @param sBuffer the path to the buffer. + * @param out the course file. + * @return its success or failure. + */ + bool LoadFromBuffer( const RString &sPath, const RString &sBuffer, Course &out ); + /** + * @brief Attempt to load an edit course from the hard drive. + * @param sEditFilePath a path on the hard drive to check. + * @param slot the Profile of the user with the edit course. + * @return its success or failure. + */ + bool LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot ); + /** + * @brief Attempt to load an edit course from the buffer. + * @param sBuffer the path to the buffer. + * @param sPath the path to the file. + * @param slot the individual's profile. + * @return its success or failure. + */ + bool LoadEditFromBuffer( const RString &sBuffer, const RString &sPath, ProfileSlot slot ); +} + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseUtil.cpp b/src/CourseUtil.cpp index 23a74dbe23..06c6448b3d 100644 --- a/src/CourseUtil.cpp +++ b/src/CourseUtil.cpp @@ -1,633 +1,633 @@ -#include "global.h" -#include "CourseUtil.h" -#include "Course.h" -#include "RageTimer.h" -#include "ProfileManager.h" -#include "Profile.h" -#include "SongManager.h" -#include "XmlFile.h" -#include "GameState.h" -#include "Style.h" -#include "Foreach.h" -#include "GameState.h" -#include "LocalizedString.h" -#include "RageLog.h" -#include "arch/Dialog/Dialog.h" -#include "RageFileManager.h" -#include "CourseWriterCRS.h" - -// Sorting stuff -static bool CompareCoursePointersByName( const Course* pCourse1, const Course* pCourse2 ) -{ - RString sName1 = pCourse1->GetDisplayFullTitle(); - RString sName2 = pCourse2->GetDisplayFullTitle(); - return sName1.CompareNoCase( sName2 ) < 0; -} - -static bool CompareCoursePointersByAutogen( const Course* pCourse1, const Course* pCourse2 ) -{ - int b1 = pCourse1->m_bIsAutogen; - int b2 = pCourse2->m_bIsAutogen; - if( b1 < b2 ) - return true; - else if( b1 > b2 ) - return false; - else - return CompareCoursePointersByName(pCourse1,pCourse2); -} - -static bool CompareCoursePointersByDifficulty( const Course* pCourse1, const Course* pCourse2 ) -{ - int iNum1 = pCourse1->GetEstimatedNumStages(); - int iNum2 = pCourse2->GetEstimatedNumStages(); - if( iNum1 < iNum2 ) - return true; - else if( iNum1 > iNum2 ) - return false; - else // iNum1 == iNum2 - return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); -} - -static bool CompareCoursePointersByTotalDifficulty( const Course* pCourse1, const Course* pCourse2 ) -{ - int iNum1 = pCourse1->m_SortOrder_TotalDifficulty; - int iNum2 = pCourse2->m_SortOrder_TotalDifficulty; - - if( iNum1 == iNum2 ) - return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); - return iNum1 < iNum2; -} - -static bool MovePlayersBestToEnd( const Course* pCourse1, const Course* pCourse2 ) -{ - bool C1HasBest = pCourse1->CourseHasBestOrWorst(); - bool C2HasBest = pCourse2->CourseHasBestOrWorst(); - if( !C1HasBest && !C2HasBest ) - return false; - if( C1HasBest && !C2HasBest ) - return false; - if( !C1HasBest && C2HasBest ) - return true; - - return CompareCoursePointersByName( pCourse1, pCourse2 ); -} - -static bool CompareRandom( const Course* pCourse1, const Course* pCourse2 ) -{ - return ( pCourse1->AllSongsAreFixed() && !pCourse2->AllSongsAreFixed() ); -} - -static bool CompareCoursePointersByRanking( const Course* pCourse1, const Course* pCourse2 ) -{ - int iNum1 = pCourse1->m_SortOrder_Ranking; - int iNum2 = pCourse2->m_SortOrder_Ranking; - - if( iNum1 == iNum2 ) - return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); - return iNum1 < iNum2; -} - -void CourseUtil::SortCoursePointerArrayByDifficulty( vector &vpCoursesInOut ) -{ - sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByDifficulty ); -} - -void CourseUtil::SortCoursePointerArrayByRanking( vector &vpCoursesInOut ) -{ - for( unsigned i=0; iUpdateCourseStats( GAMESTATE->GetCurrentStyle()->m_StepsType ); - sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByRanking ); -} - -void CourseUtil::SortCoursePointerArrayByTotalDifficulty( vector &vpCoursesInOut ) -{ - for( unsigned i=0; iUpdateCourseStats( GAMESTATE->GetCurrentStyle()->m_StepsType ); - sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTotalDifficulty ); -} - -// this code isn't ready yet!! -#if 0 -RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so ) -{ - if( pCourse == NULL ) - return RString(); - // more code here -} - -void SortCoursePointerArrayBySectionName( vector &vpCoursesInOut, SortOrder so ) -{ - RString sOther = SORT_OTHER.GetValue(); - for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) - { - RString val = GetSectionNameFromCourseAndSort( vpCoursesInOut[i], so ); - - /* Make sure 0-9 comes first and OTHER comes last. */ - if( val == "0-9" ) val = "0"; - else if( val == sOther ) val = "2"; - else val = "1" + MakeSortString(val); - - //g_mapSongSortVal[vpSongsInOut[i]] = val; - } -} -#endif -// ok real code begins again - -static bool CompareCoursePointersByType( const Course* pCourse1, const Course* pCourse2 ) -{ - return pCourse1->GetPlayMode() < pCourse2->GetPlayMode(); -} - -void CourseUtil::SortCoursePointerArrayByType( vector &vpCoursesInOut ) -{ - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByType ); -} - -void CourseUtil::MoveRandomToEnd( vector &vpCoursesInOut ) -{ - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareRandom ); -} - -static map course_sort_val; - -bool CompareCoursePointersBySortValueAscending( const Course *pSong1, const Course *pSong2 ) -{ - return course_sort_val[pSong1] < course_sort_val[pSong2]; -} - -bool CompareCoursePointersBySortValueDescending( const Course *pSong1, const Course *pSong2 ) -{ - return course_sort_val[pSong1] > course_sort_val[pSong2]; -} - -bool CompareCoursePointersByTitle( const Course *pCourse1, const Course *pCourse2 ) -{ - return CompareCoursePointersByName( pCourse1, pCourse2 ); -} - -void CourseUtil::SortCoursePointerArrayByTitle( vector &vpCoursesInOut ) -{ - sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle ); -} - -void CourseUtil::SortCoursePointerArrayByAvgDifficulty( vector &vpCoursesInOut ) -{ - RageTimer foo; - course_sort_val.clear(); - for( unsigned i = 0; i < vpCoursesInOut.size(); ++i ) - { - int iMeter = vpCoursesInOut[i]->GetMeter( GAMESTATE->GetCurrentStyle()->m_StepsType, Difficulty_Medium ); - course_sort_val[vpCoursesInOut[i]] = ssprintf( "%06i", iMeter ); - } - sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle ); - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersBySortValueAscending ); - - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), MovePlayersBestToEnd ); -} - -void CourseUtil::SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, ProfileSlot slot, bool bDescending ) -{ - if( !PROFILEMAN->IsPersistentProfile(slot) ) - return; // nothing to do since we don't have data - Profile* pProfile = PROFILEMAN->GetProfile(slot); - SortCoursePointerArrayByNumPlays( vpCoursesInOut, pProfile, bDescending ); -} - -void CourseUtil::SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, const Profile* pProfile, bool bDescending ) -{ - ASSERT( pProfile ); - for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) - course_sort_val[vpCoursesInOut[i]] = ssprintf( "%09i", pProfile->GetCourseNumTimesPlayed(vpCoursesInOut[i]) ); - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending ); - course_sort_val.clear(); -} - -void CourseUtil::SortByMostRecentlyPlayedForMachine( vector &vpCoursesInOut ) -{ - Profile *pProfile = PROFILEMAN->GetMachineProfile(); - - FOREACH_CONST( Course*, vpCoursesInOut, c ) - { - int iNumTimesPlayed = pProfile->GetCourseNumTimesPlayed( *c ); - RString val = iNumTimesPlayed ? pProfile->GetCourseLastPlayedDateTime(*c).GetString() : "9999999999999"; - course_sort_val[*c] = val; - } - - stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersBySortValueAscending ); - course_sort_val.clear(); -} - -void CourseUtil::MakeDefaultEditCourseEntry( CourseEntry& out ) -{ - out.songID.FromSong( GAMESTATE->GetDefaultSong() ); - out.stepsCriteria.m_difficulty = Difficulty_Medium; -} - -////////////////////////////////// -// Autogen -////////////////////////////////// - -void CourseUtil::AutogenEndlessFromGroup( const RString &sGroupName, Difficulty diff, Course &out ) -{ - out.m_bIsAutogen = true; - out.m_bRepeat = true; - out.m_bShuffle = true; - out.m_iLives = -1; - FOREACH_ENUM( Difficulty,dc) - out.m_iCustomMeter[dc] = -1; - - if( sGroupName == "" ) - { - out.m_sMainTitle = "All Songs"; - // this sounds reasonable... -aj - out.m_sBannerPath = THEME->GetPathG("Banner","all music"); - } - else - { - out.m_sMainTitle = SONGMAN->ShortenGroupName( sGroupName ); - out.m_sBannerPath = SONGMAN->GetSongGroupBannerPath( sGroupName ); - } - - // We want multiple songs, so we can try to prevent repeats during - // gameplay. (We might still get a repeat at the repeat boundary, - // but that'd be rare.) -glenn - CourseEntry e; - e.songCriteria.m_sGroupName = sGroupName; - e.stepsCriteria.m_difficulty = diff; - e.bSecret = true; - - // Insert a copy of e for each song in the group. - out.m_vEntries.insert( out.m_vEntries.end(), SONGMAN->GetSongs(sGroupName).size(), e ); -} - -void CourseUtil::AutogenNonstopFromGroup( const RString &sGroupName, Difficulty diff, Course &out ) -{ - AutogenEndlessFromGroup( sGroupName, diff, out ); - - out.m_bRepeat = false; - - out.m_sMainTitle += " Random"; - - // resize to 4 - while( out.m_vEntries.size() < 4 ) - out.m_vEntries.push_back( out.m_vEntries[0] ); - while( out.m_vEntries.size() > 4 ) - out.m_vEntries.pop_back(); -} - -void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector aSongs, Difficulty dc, Course &out ) -{ - out.m_bIsAutogen = true; - out.m_bRepeat = false; - out.m_bShuffle = true; - out.m_bSortByMeter = true; - - out.m_iLives = 4; - FOREACH_ENUM( Difficulty,cd) - out.m_iCustomMeter[cd] = -1; - - ASSERT( sArtistName != "" ); - ASSERT( aSongs.size() > 0 ); - - /* "Artist Oni" is a little repetitive; "by Artist" stands out less, and - * lowercasing "by" puts more emphasis on the artist's name. It also sorts - * them together. */ - out.m_sMainTitle = "by " + sArtistName; - if( sArtistNameTranslit != sArtistName ) - out.m_sMainTitleTranslit = "by " + sArtistNameTranslit; - - // How would we handle Artist Oni course banners, anyways? -aj - // m_sBannerPath = ""; // XXX - - /* Shuffle the list to determine which songs we'll use. Shuffle it - * deterministically, so we always get the same set of songs unless the - * song set changes. */ - { - RandomGen rng( GetHashForString( sArtistName ) + aSongs.size() ); - random_shuffle( aSongs.begin(), aSongs.end(), rng ); - } - - // Only use up to four songs. - if( aSongs.size() > 4 ) - aSongs.erase( aSongs.begin()+4, aSongs.end() ); - - CourseEntry e; - e.stepsCriteria.m_difficulty = dc; - - for( unsigned i = 0; i < aSongs.size(); ++i ) - { - e.songID.FromSong( aSongs[i] ); - out.m_vEntries.push_back( e ); - } -} - -void CourseUtil::WarnOnInvalidMods( RString sMods ) -{ - PlayerOptions po; - SongOptions so; - vector vs; - split( sMods, ",", vs, true ); - FOREACH_CONST( RString, vs, s ) - { - bool bValid = false; - RString sErrorDetail; - bValid |= po.FromOneModString( *s, sErrorDetail ); - bValid |= so.FromOneModString( *s, sErrorDetail ); - /* ==Invalid options that used to be valid== - * all noteskins (solo, note, foon, &c.) - * protiming (done in Lua now) - * ==Things I've seen in real course files== - * 900% BRINK (damnit japan) - * TISPY - * 9000% OVERCOMING (what?) - * 9200% TORNADE (it's like a grenade but a tornado) - * 50% PROTIMING (HOW THE HELL DOES 50% PROTIMING EVEN WORK) - * BREAK - */ - if( !bValid ) - { - RString sFullError = ssprintf("Error processing '%s' in '%s'", (*s).c_str(), sMods.c_str() ); - if( !sErrorDetail.empty() ) - sFullError += ": " + sErrorDetail; - LOG->UserLog( "", "", "%s", sFullError.c_str() ); - Dialog::OK( sFullError, "INVALID_PLAYER_OPTION_WARNING" ); - } - } -} - -int EditCourseUtil::MAX_NAME_LENGTH = 16; -int EditCourseUtil::MAX_PER_PROFILE = 32; -int EditCourseUtil::MIN_WORKOUT_MINUTES = 4; -int EditCourseUtil::MAX_WORKOUT_MINUTES = 90; -bool EditCourseUtil::s_bNewCourseNeedsName = false; - -bool EditCourseUtil::Save( Course *pCourse ) -{ - return EditCourseUtil::RenameAndSave( pCourse, pCourse->GetDisplayFullTitle() ); -} - -bool EditCourseUtil::RenameAndSave( Course *pCourse, RString sNewName ) -{ - ASSERT( !sNewName.empty() ); - - EditCourseUtil::s_bNewCourseNeedsName = false; - - RString sNewFilePath; - if( pCourse->IsAnEdit() ) - { - sNewFilePath = PROFILEMAN->GetProfileDir(ProfileSlot_Machine) + EDIT_COURSES_SUBDIR + sNewName + ".crs"; - } - else - { - RString sDir, sName, sExt; - splitpath( pCourse->m_sPath, sDir, sName, sExt ); - sNewFilePath = sDir + sNewName + sExt; - } - - // remove the old file if the name is changing - if( !pCourse->m_sPath.empty() && sNewFilePath != pCourse->m_sPath ) - FILEMAN->Remove( pCourse->m_sPath ); // not fatal if this fails - - pCourse->m_sMainTitle = sNewName; - pCourse->m_sPath = sNewFilePath; - return CourseWriterCRS::Write( *pCourse, pCourse->m_sPath, false ); -} - -bool EditCourseUtil::RemoveAndDeleteFile( Course *pCourse ) -{ - if( !FILEMAN->Remove( pCourse->m_sPath ) ) - return false; - FILEMAN->Remove( pCourse->GetCacheFilePath() ); - if( pCourse->IsAnEdit() ) - { - PROFILEMAN->LoadMachineProfile(); - } - else - { - SONGMAN->DeleteCourse( pCourse ); - delete pCourse; - } - return true; -} - -static LocalizedString YOU_MUST_SUPPLY_NAME ( "CourseUtil", "You must supply a name for your course." ); -static LocalizedString EDIT_NAME_CONFLICTS ( "CourseUtil", "The name you chose conflicts with another course. Please use a different name." ); -static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "CourseUtil", "The course name cannot contain any of the following characters: %s" ); -bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ) -{ - if( sAnswer.empty() ) - { - sErrorOut = YOU_MUST_SUPPLY_NAME; - return false; - } - - static const RString sInvalidChars = "\\/:*?\"<>|"; - if( strpbrk(sAnswer, sInvalidChars) != NULL ) - { - sErrorOut = ssprintf( EDIT_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() ); - return false; - } - - // Check for name conflicts - vector vpCourses; - EditCourseUtil::GetAllEditCourses( vpCourses ); - FOREACH_CONST( Course*, vpCourses, p ) - { - if( GAMESTATE->m_pCurCourse == *p ) - continue; // don't comepare name against ourself - - if( (*p)->GetDisplayFullTitle() == sAnswer ) - { - sErrorOut = EDIT_NAME_CONFLICTS; - return false; - } - } - - return true; -} - -void EditCourseUtil::UpdateAndSetTrail() -{ - ASSERT( GAMESTATE->m_pCurStyle ); - StepsType st = GAMESTATE->m_pCurStyle->m_StepsType; - Trail *pTrail = NULL; - if( GAMESTATE->m_pCurCourse ) - pTrail = GAMESTATE->m_pCurCourse->GetTrailForceRegenCache( st ); - GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail ); -} - -void EditCourseUtil::PrepareForPlay() -{ - GAMESTATE->m_pCurSong.Set( NULL ); // CurSong will be set if we back out. Set it back to NULL so that ScreenStage won't show the last song. - GAMESTATE->m_PlayMode.Set( PLAY_MODE_ENDLESS ); - GAMESTATE->m_bSideIsJoined[0] = true; - - PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_GoalType = GoalType_Time; - Course *pCourse = GAMESTATE->m_pCurCourse; - PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = static_cast(pCourse->m_fGoalSeconds); -} - -void EditCourseUtil::GetAllEditCourses( vector &vpCoursesOut ) -{ - vector vpCoursesTemp; - SONGMAN->GetAllCourses( vpCoursesTemp, false ); - FOREACH_CONST( Course*, vpCoursesTemp, c ) - { - if( (*c)->GetLoadedFromProfileSlot() != ProfileSlot_Invalid ) - vpCoursesOut.push_back( *c ); - } -} - -void EditCourseUtil::LoadDefaults( Course &out ) -{ - out = Course(); - - out.m_fGoalSeconds = 0; - - // pick a default name - // XXX: Make this localizable - for( int i=0; i<10000; i++ ) - { - out.m_sMainTitle = ssprintf("Workout %d", i+1); - bool bNameInUse = false; - - vector vpCourses; - EditCourseUtil::GetAllEditCourses( vpCourses ); - FOREACH_CONST( Course*, vpCourses, p ) - { - if( out.m_sMainTitle == (*p)->m_sMainTitle ) - { - bNameInUse = true; - break; - } - } - - if( !bNameInUse ) - break; - } - - vector vpSongs; - SONGMAN->GetPreferredSortSongs( vpSongs ); - for( int i=0; i<(int)vpSongs.size() && i<6; i++ ) - { - CourseEntry ce; - ce.songID.FromSong( vpSongs[i] ); - ce.stepsCriteria.m_difficulty = Difficulty_Easy; - out.m_vEntries.push_back( ce ); - } -} - -////////////////////////////////// -// CourseID -////////////////////////////////// - -void CourseID::FromCourse( const Course *p ) -{ - if( p ) - { - if( p->m_bIsAutogen ) - { - sPath = ""; - sFullTitle = p->GetTranslitFullTitle(); - } - else - { - sPath = p->m_sPath; - sFullTitle = ""; - } - } - else - { - sPath = ""; - sFullTitle = ""; - } - - // HACK for backwards compatibility: - // Strip off leading "/". 2005/05/21 file layer changes added a leading slash. - if( sPath.Left(1) == "/" ) - sPath.erase( sPath.begin() ); - - m_Cache.Unset(); -} - -Course *CourseID::ToCourse() const -{ - // HACK for backwards compatibility: - // Re-add the leading "/". 2005/05/21 file layer changes added a leading slash. - RString sPath2 = sPath; - if( sPath2.Left(1) != "/" ) - sPath2 = "/" + sPath2; - - Course *pCourse = NULL; - if( m_Cache.Get(&pCourse) ) - return pCourse; - if( pCourse == NULL && !sPath2.empty() ) - pCourse = SONGMAN->GetCourseFromPath( sPath2 ); - - if( pCourse == NULL && !sFullTitle.empty() ) - pCourse = SONGMAN->GetCourseFromName( sFullTitle ); - m_Cache.Set( pCourse ); - - return pCourse; -} - -XNode* CourseID::CreateNode() const -{ - XNode* pNode = new XNode( "Course" );; - - if( !sPath.empty() ) - pNode->AppendAttr( "Path", sPath ); - if( !sFullTitle.empty() ) - pNode->AppendAttr( "FullTitle", sFullTitle ); - - return pNode; -} - -void CourseID::LoadFromNode( const XNode* pNode ) -{ - ASSERT( pNode->GetName() == "Course" ); - sFullTitle = RString(); - sPath = RString(); - if( !pNode->GetAttrValue("Path", sPath) ) - pNode->GetAttrValue( "FullTitle", sFullTitle ); - m_Cache.Unset(); -} - -RString CourseID::ToString() const -{ - if( !sPath.empty() ) - return sPath; - if( !sFullTitle.empty() ) - return sFullTitle; - return RString(); -} - -bool CourseID::IsValid() const -{ - return !sPath.empty() || !sFullTitle.empty(); -} - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CourseUtil.h" +#include "Course.h" +#include "RageTimer.h" +#include "ProfileManager.h" +#include "Profile.h" +#include "SongManager.h" +#include "XmlFile.h" +#include "GameState.h" +#include "Style.h" +#include "Foreach.h" +#include "GameState.h" +#include "LocalizedString.h" +#include "RageLog.h" +#include "arch/Dialog/Dialog.h" +#include "RageFileManager.h" +#include "CourseWriterCRS.h" + +// Sorting stuff +static bool CompareCoursePointersByName( const Course* pCourse1, const Course* pCourse2 ) +{ + RString sName1 = pCourse1->GetDisplayFullTitle(); + RString sName2 = pCourse2->GetDisplayFullTitle(); + return sName1.CompareNoCase( sName2 ) < 0; +} + +static bool CompareCoursePointersByAutogen( const Course* pCourse1, const Course* pCourse2 ) +{ + int b1 = pCourse1->m_bIsAutogen; + int b2 = pCourse2->m_bIsAutogen; + if( b1 < b2 ) + return true; + else if( b1 > b2 ) + return false; + else + return CompareCoursePointersByName(pCourse1,pCourse2); +} + +static bool CompareCoursePointersByDifficulty( const Course* pCourse1, const Course* pCourse2 ) +{ + int iNum1 = pCourse1->GetEstimatedNumStages(); + int iNum2 = pCourse2->GetEstimatedNumStages(); + if( iNum1 < iNum2 ) + return true; + else if( iNum1 > iNum2 ) + return false; + else // iNum1 == iNum2 + return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); +} + +static bool CompareCoursePointersByTotalDifficulty( const Course* pCourse1, const Course* pCourse2 ) +{ + int iNum1 = pCourse1->m_SortOrder_TotalDifficulty; + int iNum2 = pCourse2->m_SortOrder_TotalDifficulty; + + if( iNum1 == iNum2 ) + return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); + return iNum1 < iNum2; +} + +static bool MovePlayersBestToEnd( const Course* pCourse1, const Course* pCourse2 ) +{ + bool C1HasBest = pCourse1->CourseHasBestOrWorst(); + bool C2HasBest = pCourse2->CourseHasBestOrWorst(); + if( !C1HasBest && !C2HasBest ) + return false; + if( C1HasBest && !C2HasBest ) + return false; + if( !C1HasBest && C2HasBest ) + return true; + + return CompareCoursePointersByName( pCourse1, pCourse2 ); +} + +static bool CompareRandom( const Course* pCourse1, const Course* pCourse2 ) +{ + return ( pCourse1->AllSongsAreFixed() && !pCourse2->AllSongsAreFixed() ); +} + +static bool CompareCoursePointersByRanking( const Course* pCourse1, const Course* pCourse2 ) +{ + int iNum1 = pCourse1->m_SortOrder_Ranking; + int iNum2 = pCourse2->m_SortOrder_Ranking; + + if( iNum1 == iNum2 ) + return CompareCoursePointersByAutogen( pCourse1, pCourse2 ); + return iNum1 < iNum2; +} + +void CourseUtil::SortCoursePointerArrayByDifficulty( vector &vpCoursesInOut ) +{ + sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByDifficulty ); +} + +void CourseUtil::SortCoursePointerArrayByRanking( vector &vpCoursesInOut ) +{ + for( unsigned i=0; iUpdateCourseStats( GAMESTATE->GetCurrentStyle()->m_StepsType ); + sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByRanking ); +} + +void CourseUtil::SortCoursePointerArrayByTotalDifficulty( vector &vpCoursesInOut ) +{ + for( unsigned i=0; iUpdateCourseStats( GAMESTATE->GetCurrentStyle()->m_StepsType ); + sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTotalDifficulty ); +} + +// this code isn't ready yet!! +#if 0 +RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so ) +{ + if( pCourse == NULL ) + return RString(); + // more code here +} + +void SortCoursePointerArrayBySectionName( vector &vpCoursesInOut, SortOrder so ) +{ + RString sOther = SORT_OTHER.GetValue(); + for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) + { + RString val = GetSectionNameFromCourseAndSort( vpCoursesInOut[i], so ); + + /* Make sure 0-9 comes first and OTHER comes last. */ + if( val == "0-9" ) val = "0"; + else if( val == sOther ) val = "2"; + else val = "1" + MakeSortString(val); + + //g_mapSongSortVal[vpSongsInOut[i]] = val; + } +} +#endif +// ok real code begins again + +static bool CompareCoursePointersByType( const Course* pCourse1, const Course* pCourse2 ) +{ + return pCourse1->GetPlayMode() < pCourse2->GetPlayMode(); +} + +void CourseUtil::SortCoursePointerArrayByType( vector &vpCoursesInOut ) +{ + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByType ); +} + +void CourseUtil::MoveRandomToEnd( vector &vpCoursesInOut ) +{ + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareRandom ); +} + +static map course_sort_val; + +bool CompareCoursePointersBySortValueAscending( const Course *pSong1, const Course *pSong2 ) +{ + return course_sort_val[pSong1] < course_sort_val[pSong2]; +} + +bool CompareCoursePointersBySortValueDescending( const Course *pSong1, const Course *pSong2 ) +{ + return course_sort_val[pSong1] > course_sort_val[pSong2]; +} + +bool CompareCoursePointersByTitle( const Course *pCourse1, const Course *pCourse2 ) +{ + return CompareCoursePointersByName( pCourse1, pCourse2 ); +} + +void CourseUtil::SortCoursePointerArrayByTitle( vector &vpCoursesInOut ) +{ + sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle ); +} + +void CourseUtil::SortCoursePointerArrayByAvgDifficulty( vector &vpCoursesInOut ) +{ + RageTimer foo; + course_sort_val.clear(); + for( unsigned i = 0; i < vpCoursesInOut.size(); ++i ) + { + int iMeter = vpCoursesInOut[i]->GetMeter( GAMESTATE->GetCurrentStyle()->m_StepsType, Difficulty_Medium ); + course_sort_val[vpCoursesInOut[i]] = ssprintf( "%06i", iMeter ); + } + sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersByTitle ); + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersBySortValueAscending ); + + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), MovePlayersBestToEnd ); +} + +void CourseUtil::SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, ProfileSlot slot, bool bDescending ) +{ + if( !PROFILEMAN->IsPersistentProfile(slot) ) + return; // nothing to do since we don't have data + Profile* pProfile = PROFILEMAN->GetProfile(slot); + SortCoursePointerArrayByNumPlays( vpCoursesInOut, pProfile, bDescending ); +} + +void CourseUtil::SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, const Profile* pProfile, bool bDescending ) +{ + ASSERT( pProfile ); + for(unsigned i = 0; i < vpCoursesInOut.size(); ++i) + course_sort_val[vpCoursesInOut[i]] = ssprintf( "%09i", pProfile->GetCourseNumTimesPlayed(vpCoursesInOut[i]) ); + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), bDescending ? CompareCoursePointersBySortValueDescending : CompareCoursePointersBySortValueAscending ); + course_sort_val.clear(); +} + +void CourseUtil::SortByMostRecentlyPlayedForMachine( vector &vpCoursesInOut ) +{ + Profile *pProfile = PROFILEMAN->GetMachineProfile(); + + FOREACH_CONST( Course*, vpCoursesInOut, c ) + { + int iNumTimesPlayed = pProfile->GetCourseNumTimesPlayed( *c ); + RString val = iNumTimesPlayed ? pProfile->GetCourseLastPlayedDateTime(*c).GetString() : "9999999999999"; + course_sort_val[*c] = val; + } + + stable_sort( vpCoursesInOut.begin(), vpCoursesInOut.end(), CompareCoursePointersBySortValueAscending ); + course_sort_val.clear(); +} + +void CourseUtil::MakeDefaultEditCourseEntry( CourseEntry& out ) +{ + out.songID.FromSong( GAMESTATE->GetDefaultSong() ); + out.stepsCriteria.m_difficulty = Difficulty_Medium; +} + +////////////////////////////////// +// Autogen +////////////////////////////////// + +void CourseUtil::AutogenEndlessFromGroup( const RString &sGroupName, Difficulty diff, Course &out ) +{ + out.m_bIsAutogen = true; + out.m_bRepeat = true; + out.m_bShuffle = true; + out.m_iLives = -1; + FOREACH_ENUM( Difficulty,dc) + out.m_iCustomMeter[dc] = -1; + + if( sGroupName == "" ) + { + out.m_sMainTitle = "All Songs"; + // this sounds reasonable... -aj + out.m_sBannerPath = THEME->GetPathG("Banner","all music"); + } + else + { + out.m_sMainTitle = SONGMAN->ShortenGroupName( sGroupName ); + out.m_sBannerPath = SONGMAN->GetSongGroupBannerPath( sGroupName ); + } + + // We want multiple songs, so we can try to prevent repeats during + // gameplay. (We might still get a repeat at the repeat boundary, + // but that'd be rare.) -glenn + CourseEntry e; + e.songCriteria.m_sGroupName = sGroupName; + e.stepsCriteria.m_difficulty = diff; + e.bSecret = true; + + // Insert a copy of e for each song in the group. + out.m_vEntries.insert( out.m_vEntries.end(), SONGMAN->GetSongs(sGroupName).size(), e ); +} + +void CourseUtil::AutogenNonstopFromGroup( const RString &sGroupName, Difficulty diff, Course &out ) +{ + AutogenEndlessFromGroup( sGroupName, diff, out ); + + out.m_bRepeat = false; + + out.m_sMainTitle += " Random"; + + // resize to 4 + while( out.m_vEntries.size() < 4 ) + out.m_vEntries.push_back( out.m_vEntries[0] ); + while( out.m_vEntries.size() > 4 ) + out.m_vEntries.pop_back(); +} + +void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector aSongs, Difficulty dc, Course &out ) +{ + out.m_bIsAutogen = true; + out.m_bRepeat = false; + out.m_bShuffle = true; + out.m_bSortByMeter = true; + + out.m_iLives = 4; + FOREACH_ENUM( Difficulty,cd) + out.m_iCustomMeter[cd] = -1; + + ASSERT( sArtistName != "" ); + ASSERT( aSongs.size() > 0 ); + + /* "Artist Oni" is a little repetitive; "by Artist" stands out less, and + * lowercasing "by" puts more emphasis on the artist's name. It also sorts + * them together. */ + out.m_sMainTitle = "by " + sArtistName; + if( sArtistNameTranslit != sArtistName ) + out.m_sMainTitleTranslit = "by " + sArtistNameTranslit; + + // How would we handle Artist Oni course banners, anyways? -aj + // m_sBannerPath = ""; // XXX + + /* Shuffle the list to determine which songs we'll use. Shuffle it + * deterministically, so we always get the same set of songs unless the + * song set changes. */ + { + RandomGen rng( GetHashForString( sArtistName ) + aSongs.size() ); + random_shuffle( aSongs.begin(), aSongs.end(), rng ); + } + + // Only use up to four songs. + if( aSongs.size() > 4 ) + aSongs.erase( aSongs.begin()+4, aSongs.end() ); + + CourseEntry e; + e.stepsCriteria.m_difficulty = dc; + + for( unsigned i = 0; i < aSongs.size(); ++i ) + { + e.songID.FromSong( aSongs[i] ); + out.m_vEntries.push_back( e ); + } +} + +void CourseUtil::WarnOnInvalidMods( RString sMods ) +{ + PlayerOptions po; + SongOptions so; + vector vs; + split( sMods, ",", vs, true ); + FOREACH_CONST( RString, vs, s ) + { + bool bValid = false; + RString sErrorDetail; + bValid |= po.FromOneModString( *s, sErrorDetail ); + bValid |= so.FromOneModString( *s, sErrorDetail ); + /* ==Invalid options that used to be valid== + * all noteskins (solo, note, foon, &c.) + * protiming (done in Lua now) + * ==Things I've seen in real course files== + * 900% BRINK (damnit japan) + * TISPY + * 9000% OVERCOMING (what?) + * 9200% TORNADE (it's like a grenade but a tornado) + * 50% PROTIMING (HOW THE HELL DOES 50% PROTIMING EVEN WORK) + * BREAK + */ + if( !bValid ) + { + RString sFullError = ssprintf("Error processing '%s' in '%s'", (*s).c_str(), sMods.c_str() ); + if( !sErrorDetail.empty() ) + sFullError += ": " + sErrorDetail; + LOG->UserLog( "", "", "%s", sFullError.c_str() ); + Dialog::OK( sFullError, "INVALID_PLAYER_OPTION_WARNING" ); + } + } +} + +int EditCourseUtil::MAX_NAME_LENGTH = 16; +int EditCourseUtil::MAX_PER_PROFILE = 32; +int EditCourseUtil::MIN_WORKOUT_MINUTES = 4; +int EditCourseUtil::MAX_WORKOUT_MINUTES = 90; +bool EditCourseUtil::s_bNewCourseNeedsName = false; + +bool EditCourseUtil::Save( Course *pCourse ) +{ + return EditCourseUtil::RenameAndSave( pCourse, pCourse->GetDisplayFullTitle() ); +} + +bool EditCourseUtil::RenameAndSave( Course *pCourse, RString sNewName ) +{ + ASSERT( !sNewName.empty() ); + + EditCourseUtil::s_bNewCourseNeedsName = false; + + RString sNewFilePath; + if( pCourse->IsAnEdit() ) + { + sNewFilePath = PROFILEMAN->GetProfileDir(ProfileSlot_Machine) + EDIT_COURSES_SUBDIR + sNewName + ".crs"; + } + else + { + RString sDir, sName, sExt; + splitpath( pCourse->m_sPath, sDir, sName, sExt ); + sNewFilePath = sDir + sNewName + sExt; + } + + // remove the old file if the name is changing + if( !pCourse->m_sPath.empty() && sNewFilePath != pCourse->m_sPath ) + FILEMAN->Remove( pCourse->m_sPath ); // not fatal if this fails + + pCourse->m_sMainTitle = sNewName; + pCourse->m_sPath = sNewFilePath; + return CourseWriterCRS::Write( *pCourse, pCourse->m_sPath, false ); +} + +bool EditCourseUtil::RemoveAndDeleteFile( Course *pCourse ) +{ + if( !FILEMAN->Remove( pCourse->m_sPath ) ) + return false; + FILEMAN->Remove( pCourse->GetCacheFilePath() ); + if( pCourse->IsAnEdit() ) + { + PROFILEMAN->LoadMachineProfile(); + } + else + { + SONGMAN->DeleteCourse( pCourse ); + delete pCourse; + } + return true; +} + +static LocalizedString YOU_MUST_SUPPLY_NAME ( "CourseUtil", "You must supply a name for your course." ); +static LocalizedString EDIT_NAME_CONFLICTS ( "CourseUtil", "The name you chose conflicts with another course. Please use a different name." ); +static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "CourseUtil", "The course name cannot contain any of the following characters: %s" ); +bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ) +{ + if( sAnswer.empty() ) + { + sErrorOut = YOU_MUST_SUPPLY_NAME; + return false; + } + + static const RString sInvalidChars = "\\/:*?\"<>|"; + if( strpbrk(sAnswer, sInvalidChars) != NULL ) + { + sErrorOut = ssprintf( EDIT_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() ); + return false; + } + + // Check for name conflicts + vector vpCourses; + EditCourseUtil::GetAllEditCourses( vpCourses ); + FOREACH_CONST( Course*, vpCourses, p ) + { + if( GAMESTATE->m_pCurCourse == *p ) + continue; // don't comepare name against ourself + + if( (*p)->GetDisplayFullTitle() == sAnswer ) + { + sErrorOut = EDIT_NAME_CONFLICTS; + return false; + } + } + + return true; +} + +void EditCourseUtil::UpdateAndSetTrail() +{ + ASSERT( GAMESTATE->m_pCurStyle ); + StepsType st = GAMESTATE->m_pCurStyle->m_StepsType; + Trail *pTrail = NULL; + if( GAMESTATE->m_pCurCourse ) + pTrail = GAMESTATE->m_pCurCourse->GetTrailForceRegenCache( st ); + GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail ); +} + +void EditCourseUtil::PrepareForPlay() +{ + GAMESTATE->m_pCurSong.Set( NULL ); // CurSong will be set if we back out. Set it back to NULL so that ScreenStage won't show the last song. + GAMESTATE->m_PlayMode.Set( PLAY_MODE_ENDLESS ); + GAMESTATE->m_bSideIsJoined[0] = true; + + PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_GoalType = GoalType_Time; + Course *pCourse = GAMESTATE->m_pCurCourse; + PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = static_cast(pCourse->m_fGoalSeconds); +} + +void EditCourseUtil::GetAllEditCourses( vector &vpCoursesOut ) +{ + vector vpCoursesTemp; + SONGMAN->GetAllCourses( vpCoursesTemp, false ); + FOREACH_CONST( Course*, vpCoursesTemp, c ) + { + if( (*c)->GetLoadedFromProfileSlot() != ProfileSlot_Invalid ) + vpCoursesOut.push_back( *c ); + } +} + +void EditCourseUtil::LoadDefaults( Course &out ) +{ + out = Course(); + + out.m_fGoalSeconds = 0; + + // pick a default name + // XXX: Make this localizable + for( int i=0; i<10000; i++ ) + { + out.m_sMainTitle = ssprintf("Workout %d", i+1); + bool bNameInUse = false; + + vector vpCourses; + EditCourseUtil::GetAllEditCourses( vpCourses ); + FOREACH_CONST( Course*, vpCourses, p ) + { + if( out.m_sMainTitle == (*p)->m_sMainTitle ) + { + bNameInUse = true; + break; + } + } + + if( !bNameInUse ) + break; + } + + vector vpSongs; + SONGMAN->GetPreferredSortSongs( vpSongs ); + for( int i=0; i<(int)vpSongs.size() && i<6; i++ ) + { + CourseEntry ce; + ce.songID.FromSong( vpSongs[i] ); + ce.stepsCriteria.m_difficulty = Difficulty_Easy; + out.m_vEntries.push_back( ce ); + } +} + +////////////////////////////////// +// CourseID +////////////////////////////////// + +void CourseID::FromCourse( const Course *p ) +{ + if( p ) + { + if( p->m_bIsAutogen ) + { + sPath = ""; + sFullTitle = p->GetTranslitFullTitle(); + } + else + { + sPath = p->m_sPath; + sFullTitle = ""; + } + } + else + { + sPath = ""; + sFullTitle = ""; + } + + // HACK for backwards compatibility: + // Strip off leading "/". 2005/05/21 file layer changes added a leading slash. + if( sPath.Left(1) == "/" ) + sPath.erase( sPath.begin() ); + + m_Cache.Unset(); +} + +Course *CourseID::ToCourse() const +{ + // HACK for backwards compatibility: + // Re-add the leading "/". 2005/05/21 file layer changes added a leading slash. + RString sPath2 = sPath; + if( sPath2.Left(1) != "/" ) + sPath2 = "/" + sPath2; + + Course *pCourse = NULL; + if( m_Cache.Get(&pCourse) ) + return pCourse; + if( pCourse == NULL && !sPath2.empty() ) + pCourse = SONGMAN->GetCourseFromPath( sPath2 ); + + if( pCourse == NULL && !sFullTitle.empty() ) + pCourse = SONGMAN->GetCourseFromName( sFullTitle ); + m_Cache.Set( pCourse ); + + return pCourse; +} + +XNode* CourseID::CreateNode() const +{ + XNode* pNode = new XNode( "Course" );; + + if( !sPath.empty() ) + pNode->AppendAttr( "Path", sPath ); + if( !sFullTitle.empty() ) + pNode->AppendAttr( "FullTitle", sFullTitle ); + + return pNode; +} + +void CourseID::LoadFromNode( const XNode* pNode ) +{ + ASSERT( pNode->GetName() == "Course" ); + sFullTitle = RString(); + sPath = RString(); + if( !pNode->GetAttrValue("Path", sPath) ) + pNode->GetAttrValue( "FullTitle", sFullTitle ); + m_Cache.Unset(); +} + +RString CourseID::ToString() const +{ + if( !sPath.empty() ) + return sPath; + if( !sFullTitle.empty() ) + return sFullTitle; + return RString(); +} + +bool CourseID::IsValid() const +{ + return !sPath.empty() || !sFullTitle.empty(); +} + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseUtil.h b/src/CourseUtil.h index 3d707a1052..f897617888 100644 --- a/src/CourseUtil.h +++ b/src/CourseUtil.h @@ -1,121 +1,121 @@ -#ifndef COURSEUTIL_H -#define COURSEUTIL_H - -#include "GameConstantsAndTypes.h" -#include "Difficulty.h" -#include "RageUtil_CachedObject.h" - -class Course; -class Profile; -class XNode; -class CourseEntry; -class Song; - -/** @brief Utility functions that deal with Courses. */ -namespace CourseUtil -{ - void SortCoursePointerArrayByDifficulty( vector &vpCoursesInOut ); - void SortCoursePointerArrayByType( vector &vpCoursesInOut ); - void SortCoursePointerArrayByTitle( vector &vpCoursesInOut ); - void SortCoursePointerArrayByAvgDifficulty( vector &vpCoursesInOut ); - void SortCoursePointerArrayByTotalDifficulty( vector &vpCoursesInOut ); - void SortCoursePointerArrayByRanking( vector &vpCoursesInOut ); - void SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, ProfileSlot slot, bool bDescending ); - void SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, const Profile* pProfile, bool bDescending ); - void SortByMostRecentlyPlayedForMachine( vector &vpCoursesInOut ); - // sm-ssc sort additions: - //void SortCoursePointerArrayBySectionName( vector &vpCoursesInOut, SortOrder so ); - - void MoveRandomToEnd( vector &vpCoursesInOut ); - - void MakeDefaultEditCourseEntry( CourseEntry &out ); - - void AutogenEndlessFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); - void AutogenNonstopFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); - void AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector aSongs, Difficulty dc, Course &out ); - - bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); - - void WarnOnInvalidMods( RString sMods ); - - // sm-ssc additions: - //RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so ); -}; - -/** @brief Utility functions that deal with Edit Courses. */ -namespace EditCourseUtil -{ - void UpdateAndSetTrail(); - void PrepareForPlay(); - void LoadDefaults( Course &out ); - bool RemoveAndDeleteFile( Course *pCourse ); - bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); - void GetAllEditCourses( vector &vpCoursesOut ); - bool Save( Course *pCourse ); - bool RenameAndSave( Course *pCourse, RString sName ); - - bool ValidateEditCourseNametName( const RString &sAnswer, RString &sErrorOut ); - - extern int MAX_NAME_LENGTH; - extern int MAX_PER_PROFILE; - extern int MIN_WORKOUT_MINUTES; - extern int MAX_WORKOUT_MINUTES; - - extern bool s_bNewCourseNeedsName; // if true, we are working with a Course that has never been named -}; - - -class CourseID -{ -public: - CourseID() { Unset(); } - void Unset() { FromCourse(NULL); } - void FromCourse( const Course *p ); - Course *ToCourse() const; - const RString &GetPath() const { return sPath; } - bool operator<( const CourseID &other ) const - { - if (sPath != other.sPath) - return sPath < other.sPath; - return sFullTitle < other.sFullTitle; - } - - XNode* CreateNode() const; - void LoadFromNode( const XNode* pNode ); - RString ToString() const; - bool IsValid() const; - -private: - RString sPath; - RString sFullTitle; - mutable CachedObjectPointer m_Cache; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef COURSEUTIL_H +#define COURSEUTIL_H + +#include "GameConstantsAndTypes.h" +#include "Difficulty.h" +#include "RageUtil_CachedObject.h" + +class Course; +class Profile; +class XNode; +class CourseEntry; +class Song; + +/** @brief Utility functions that deal with Courses. */ +namespace CourseUtil +{ + void SortCoursePointerArrayByDifficulty( vector &vpCoursesInOut ); + void SortCoursePointerArrayByType( vector &vpCoursesInOut ); + void SortCoursePointerArrayByTitle( vector &vpCoursesInOut ); + void SortCoursePointerArrayByAvgDifficulty( vector &vpCoursesInOut ); + void SortCoursePointerArrayByTotalDifficulty( vector &vpCoursesInOut ); + void SortCoursePointerArrayByRanking( vector &vpCoursesInOut ); + void SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, ProfileSlot slot, bool bDescending ); + void SortCoursePointerArrayByNumPlays( vector &vpCoursesInOut, const Profile* pProfile, bool bDescending ); + void SortByMostRecentlyPlayedForMachine( vector &vpCoursesInOut ); + // sm-ssc sort additions: + //void SortCoursePointerArrayBySectionName( vector &vpCoursesInOut, SortOrder so ); + + void MoveRandomToEnd( vector &vpCoursesInOut ); + + void MakeDefaultEditCourseEntry( CourseEntry &out ); + + void AutogenEndlessFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); + void AutogenNonstopFromGroup( const RString &sGroupName, Difficulty dc, Course &out ); + void AutogenOniFromArtist( const RString &sArtistName, RString sArtistNameTranslit, vector aSongs, Difficulty dc, Course &out ); + + bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); + + void WarnOnInvalidMods( RString sMods ); + + // sm-ssc additions: + //RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so ); +}; + +/** @brief Utility functions that deal with Edit Courses. */ +namespace EditCourseUtil +{ + void UpdateAndSetTrail(); + void PrepareForPlay(); + void LoadDefaults( Course &out ); + bool RemoveAndDeleteFile( Course *pCourse ); + bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); + void GetAllEditCourses( vector &vpCoursesOut ); + bool Save( Course *pCourse ); + bool RenameAndSave( Course *pCourse, RString sName ); + + bool ValidateEditCourseNametName( const RString &sAnswer, RString &sErrorOut ); + + extern int MAX_NAME_LENGTH; + extern int MAX_PER_PROFILE; + extern int MIN_WORKOUT_MINUTES; + extern int MAX_WORKOUT_MINUTES; + + extern bool s_bNewCourseNeedsName; // if true, we are working with a Course that has never been named +}; + + +class CourseID +{ +public: + CourseID() { Unset(); } + void Unset() { FromCourse(NULL); } + void FromCourse( const Course *p ); + Course *ToCourse() const; + const RString &GetPath() const { return sPath; } + bool operator<( const CourseID &other ) const + { + if (sPath != other.sPath) + return sPath < other.sPath; + return sFullTitle < other.sFullTitle; + } + + XNode* CreateNode() const; + void LoadFromNode( const XNode* pNode ); + RString ToString() const; + bool IsValid() const; + +private: + RString sPath; + RString sFullTitle; + mutable CachedObjectPointer m_Cache; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseWriterCRS.cpp b/src/CourseWriterCRS.cpp index 390fa45367..582653847c 100644 --- a/src/CourseWriterCRS.cpp +++ b/src/CourseWriterCRS.cpp @@ -1,205 +1,205 @@ -#include "global.h" -#include "CourseWriterCRS.h" -#include "Course.h" -#include "RageFile.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "Song.h" -#include "RageFileDriverMemory.h" - -/** @brief Load the difficulty names from CourseLoaderCRS. */ -extern const char *g_CRSDifficultyNames[]; // in CourseLoaderCRS - -/** - * @brief Get the string of the course difficulty. - * @param iVal the course difficulty. - * @return the string. - */ -static RString DifficultyToCRSString( CourseDifficulty iVal ) -{ - return g_CRSDifficultyNames[iVal]; -} - -bool CourseWriterCRS::Write( const Course &course, const RString &sPath, bool bSavingCache ) -{ - RageFile f; - if( !f.Open( sPath, RageFile::WRITE ) ) - { - LOG->UserLog( "Course file", sPath, "couldn't be written: %s", f.GetError().c_str() ); - return false; - } - - return CourseWriterCRS::Write( course, f, bSavingCache ); -} - -void CourseWriterCRS::GetEditFileContents( const Course *pCourse, RString &sOut ) -{ - RageFileObjMem mem; - CourseWriterCRS::Write( *pCourse, mem, true ); - sOut = mem.GetString(); -} - -bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavingCache ) -{ - ASSERT( !course.m_bIsAutogen ); - - f.PutLine( ssprintf("#COURSE:%s;", course.m_sMainTitle.c_str()) ); - if( course.m_sMainTitleTranslit != "" ) - f.PutLine( ssprintf("#COURSETRANSLIT:%s;", course.m_sMainTitleTranslit.c_str()) ); - if( course.m_bRepeat ) - f.PutLine( "#REPEAT:YES;" ); - if( course.m_iLives != -1 ) - f.PutLine( ssprintf("#LIVES:%i;", course.m_iLives) ); - if( !course.m_sBannerPath.empty() ) - f.PutLine( ssprintf("#BANNER:%s;", course.m_sBannerPath.c_str()) ); - - if( !course.m_setStyles.empty() ) - { - vector asStyles; - asStyles.insert( asStyles.begin(), course.m_setStyles.begin(), course.m_setStyles.end() ); - f.PutLine( ssprintf("#STYLE:%s;", join( ",", asStyles ).c_str()) ); - } - - FOREACH_ENUM( CourseDifficulty,cd ) - { - if( course.m_iCustomMeter[cd] == -1 ) - continue; - f.PutLine( ssprintf("#METER:%s:%i;", DifficultyToCRSString(cd).c_str(), course.m_iCustomMeter[cd]) ); - } - - if( bSavingCache ) - { - f.PutLine( "// cache tags:" ); - - Course::RadarCache_t::const_iterator it; - for( it = course.m_RadarCache.begin(); it != course.m_RadarCache.end(); ++it ) - { - // #RADAR:type:difficulty:value,value,value...; - const Course::CacheEntry &entry = it->first; - StepsType st = entry.first; - CourseDifficulty cd = entry.second; - - vector asRadarValues; - const RadarValues &rv = it->second; - for( int r=0; r < NUM_RadarCategory; r++ ) - asRadarValues.push_back( ssprintf("%.3f", rv[r]) ); - RString sLine = ssprintf( "#RADAR:%i:%i:", st, cd ); - sLine += join( ",", asRadarValues ) + ";"; - f.PutLine( sLine ); - } - f.PutLine( "// end cache tags" ); - } - - for( unsigned i=0; i 0 ) - f.PutLine( ssprintf("#GAINSECONDS:%f;", entry.fGainSeconds) ); - - if( entry.songSort == SongSort_MostPlays && entry.iChooseIndex != -1 ) - { - f.Write( ssprintf( "#SONG:BEST%d", entry.iChooseIndex+1 ) ); - } - else if( entry.songSort == SongSort_FewestPlays && entry.iChooseIndex != -1 ) - { - f.Write( ssprintf( "#SONG:WORST%d", entry.iChooseIndex+1 ) ); - } - else if( entry.songID.ToSong() ) - { - Song *pSong = entry.songID.ToSong(); - const RString &sSong = Basename( pSong->GetSongDir() ); - - f.Write( "#SONG:" ); - if( !entry.songCriteria.m_sGroupName.empty() ) - f.Write( entry.songCriteria.m_sGroupName + '/' ); - f.Write( sSong ); - } - else if( !entry.songCriteria.m_sGroupName.empty() ) - { - f.Write( ssprintf( "#SONG:%s/*", entry.songCriteria.m_sGroupName.c_str() ) ); - } - else - { - f.Write( "#SONG:*" ); - } - - f.Write( ":" ); - if( entry.stepsCriteria.m_difficulty != Difficulty_Invalid ) - f.Write( DifficultyToString(entry.stepsCriteria.m_difficulty) ); - else if( entry.stepsCriteria.m_iLowMeter != -1 && entry.stepsCriteria.m_iHighMeter != -1 ) - f.Write( ssprintf( "%d..%d", entry.stepsCriteria.m_iLowMeter, entry.stepsCriteria.m_iHighMeter ) ); - f.Write( ":" ); - - RString sModifiers = entry.sModifiers; - - if( entry.bSecret ) - { - if( sModifiers != "" ) - sModifiers += ","; - sModifiers += entry.bSecret? "noshowcourse":"showcourse"; - } - - if( entry.bNoDifficult ) - { - if( sModifiers != "" ) - sModifiers += ","; - sModifiers += "nodifficult"; - } - - if( entry.iGainLives > -1 ) - { - if( !sModifiers.empty() ) - sModifiers += ','; - sModifiers += ssprintf( "award%d", entry.iGainLives ); - } - - f.Write( sModifiers ); - - f.PutLine( ";" ); - } - - return true; -} - - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CourseWriterCRS.h" +#include "Course.h" +#include "RageFile.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "Song.h" +#include "RageFileDriverMemory.h" + +/** @brief Load the difficulty names from CourseLoaderCRS. */ +extern const char *g_CRSDifficultyNames[]; // in CourseLoaderCRS + +/** + * @brief Get the string of the course difficulty. + * @param iVal the course difficulty. + * @return the string. + */ +static RString DifficultyToCRSString( CourseDifficulty iVal ) +{ + return g_CRSDifficultyNames[iVal]; +} + +bool CourseWriterCRS::Write( const Course &course, const RString &sPath, bool bSavingCache ) +{ + RageFile f; + if( !f.Open( sPath, RageFile::WRITE ) ) + { + LOG->UserLog( "Course file", sPath, "couldn't be written: %s", f.GetError().c_str() ); + return false; + } + + return CourseWriterCRS::Write( course, f, bSavingCache ); +} + +void CourseWriterCRS::GetEditFileContents( const Course *pCourse, RString &sOut ) +{ + RageFileObjMem mem; + CourseWriterCRS::Write( *pCourse, mem, true ); + sOut = mem.GetString(); +} + +bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavingCache ) +{ + ASSERT( !course.m_bIsAutogen ); + + f.PutLine( ssprintf("#COURSE:%s;", course.m_sMainTitle.c_str()) ); + if( course.m_sMainTitleTranslit != "" ) + f.PutLine( ssprintf("#COURSETRANSLIT:%s;", course.m_sMainTitleTranslit.c_str()) ); + if( course.m_bRepeat ) + f.PutLine( "#REPEAT:YES;" ); + if( course.m_iLives != -1 ) + f.PutLine( ssprintf("#LIVES:%i;", course.m_iLives) ); + if( !course.m_sBannerPath.empty() ) + f.PutLine( ssprintf("#BANNER:%s;", course.m_sBannerPath.c_str()) ); + + if( !course.m_setStyles.empty() ) + { + vector asStyles; + asStyles.insert( asStyles.begin(), course.m_setStyles.begin(), course.m_setStyles.end() ); + f.PutLine( ssprintf("#STYLE:%s;", join( ",", asStyles ).c_str()) ); + } + + FOREACH_ENUM( CourseDifficulty,cd ) + { + if( course.m_iCustomMeter[cd] == -1 ) + continue; + f.PutLine( ssprintf("#METER:%s:%i;", DifficultyToCRSString(cd).c_str(), course.m_iCustomMeter[cd]) ); + } + + if( bSavingCache ) + { + f.PutLine( "// cache tags:" ); + + Course::RadarCache_t::const_iterator it; + for( it = course.m_RadarCache.begin(); it != course.m_RadarCache.end(); ++it ) + { + // #RADAR:type:difficulty:value,value,value...; + const Course::CacheEntry &entry = it->first; + StepsType st = entry.first; + CourseDifficulty cd = entry.second; + + vector asRadarValues; + const RadarValues &rv = it->second; + for( int r=0; r < NUM_RadarCategory; r++ ) + asRadarValues.push_back( ssprintf("%.3f", rv[r]) ); + RString sLine = ssprintf( "#RADAR:%i:%i:", st, cd ); + sLine += join( ",", asRadarValues ) + ";"; + f.PutLine( sLine ); + } + f.PutLine( "// end cache tags" ); + } + + for( unsigned i=0; i 0 ) + f.PutLine( ssprintf("#GAINSECONDS:%f;", entry.fGainSeconds) ); + + if( entry.songSort == SongSort_MostPlays && entry.iChooseIndex != -1 ) + { + f.Write( ssprintf( "#SONG:BEST%d", entry.iChooseIndex+1 ) ); + } + else if( entry.songSort == SongSort_FewestPlays && entry.iChooseIndex != -1 ) + { + f.Write( ssprintf( "#SONG:WORST%d", entry.iChooseIndex+1 ) ); + } + else if( entry.songID.ToSong() ) + { + Song *pSong = entry.songID.ToSong(); + const RString &sSong = Basename( pSong->GetSongDir() ); + + f.Write( "#SONG:" ); + if( !entry.songCriteria.m_sGroupName.empty() ) + f.Write( entry.songCriteria.m_sGroupName + '/' ); + f.Write( sSong ); + } + else if( !entry.songCriteria.m_sGroupName.empty() ) + { + f.Write( ssprintf( "#SONG:%s/*", entry.songCriteria.m_sGroupName.c_str() ) ); + } + else + { + f.Write( "#SONG:*" ); + } + + f.Write( ":" ); + if( entry.stepsCriteria.m_difficulty != Difficulty_Invalid ) + f.Write( DifficultyToString(entry.stepsCriteria.m_difficulty) ); + else if( entry.stepsCriteria.m_iLowMeter != -1 && entry.stepsCriteria.m_iHighMeter != -1 ) + f.Write( ssprintf( "%d..%d", entry.stepsCriteria.m_iLowMeter, entry.stepsCriteria.m_iHighMeter ) ); + f.Write( ":" ); + + RString sModifiers = entry.sModifiers; + + if( entry.bSecret ) + { + if( sModifiers != "" ) + sModifiers += ","; + sModifiers += entry.bSecret? "noshowcourse":"showcourse"; + } + + if( entry.bNoDifficult ) + { + if( sModifiers != "" ) + sModifiers += ","; + sModifiers += "nodifficult"; + } + + if( entry.iGainLives > -1 ) + { + if( !sModifiers.empty() ) + sModifiers += ','; + sModifiers += ssprintf( "award%d", entry.iGainLives ); + } + + f.Write( sModifiers ); + + f.PutLine( ";" ); + } + + return true; +} + + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CourseWriterCRS.h b/src/CourseWriterCRS.h index 9b2887c809..8a12096658 100644 --- a/src/CourseWriterCRS.h +++ b/src/CourseWriterCRS.h @@ -1,68 +1,68 @@ -/** @brief CourseWriterCRS - Writes a Course to an .CRS file. */ - -#ifndef COURSE_WRITER_CRS_H -#define COURSE_WRITER_CRS_H - -class Course; -class RageFileBasic; - -/** @brief The Course Writer handles writing the .crs files. */ -namespace CourseWriterCRS -{ - /** - * @brief Write the course to a file. - * @param course the course contents. - * @param f the file being built. - * @param bSavingCache is true if cache information is being saved as well. - * @return its success or failure. - */ - bool Write( const Course &course, RageFileBasic &f, bool bSavingCache ); - /** - * @brief Write the course to a file. - * @param course the course contents. - * @param sPath the path to the file. - * @param bSavingCache is true if cache information is being saved as well. - * @return its success or failure. - */ - bool Write( const Course &course, const RString &sPath, bool bSavingCache ); - /** - * @brief Retrieve course information from a file for eventual writing. - * @param pCourse the course file. - * @param sOut the path to the file. - */ - void GetEditFileContents( const Course *pCourse, RString &sOut ); - /** - * @brief Write the custom course to the machine's hard drive. - * @param pCourse the course file. - */ - void WriteEditFileToMachine( const Course *pCourse ); -} - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2005 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief CourseWriterCRS - Writes a Course to an .CRS file. */ + +#ifndef COURSE_WRITER_CRS_H +#define COURSE_WRITER_CRS_H + +class Course; +class RageFileBasic; + +/** @brief The Course Writer handles writing the .crs files. */ +namespace CourseWriterCRS +{ + /** + * @brief Write the course to a file. + * @param course the course contents. + * @param f the file being built. + * @param bSavingCache is true if cache information is being saved as well. + * @return its success or failure. + */ + bool Write( const Course &course, RageFileBasic &f, bool bSavingCache ); + /** + * @brief Write the course to a file. + * @param course the course contents. + * @param sPath the path to the file. + * @param bSavingCache is true if cache information is being saved as well. + * @return its success or failure. + */ + bool Write( const Course &course, const RString &sPath, bool bSavingCache ); + /** + * @brief Retrieve course information from a file for eventual writing. + * @param pCourse the course file. + * @param sOut the path to the file. + */ + void GetEditFileContents( const Course *pCourse, RString &sOut ); + /** + * @brief Write the custom course to the machine's hard drive. + * @param pCourse the course file. + */ + void WriteEditFileToMachine( const Course *pCourse ); +} + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2005 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CryptHelpers.cpp b/src/CryptHelpers.cpp index 5de78c16b5..f561eb8b84 100644 --- a/src/CryptHelpers.cpp +++ b/src/CryptHelpers.cpp @@ -1,74 +1,74 @@ -#include "global.h" -#include "CryptHelpers.h" - -PRNGWrapper::PRNGWrapper( const struct ltc_prng_descriptor *pPRNGDescriptor ) -{ - m_iPRNG = register_prng( pPRNGDescriptor ); - ASSERT( m_iPRNG >= 0 ); - - int iRet = rng_make_prng( 128, m_iPRNG, &m_PRNG, NULL ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); -} - -PRNGWrapper::~PRNGWrapper() -{ - if( m_iPRNG != -1 ) - prng_descriptor[m_iPRNG].done( &m_PRNG ); -} - -void PRNGWrapper::AddEntropy( const void *pData, int iSize ) -{ - int iRet = prng_descriptor[m_iPRNG].add_entropy( (const unsigned char *) pData, iSize, &m_PRNG ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); - - iRet = prng_descriptor[m_iPRNG].ready( &m_PRNG ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); -} - -void PRNGWrapper::AddRandomEntropy() -{ - unsigned char buf[256]; - int iRet = rng_get_bytes( buf, sizeof(buf), NULL ); - ASSERT( iRet == sizeof(buf) ); - - AddEntropy( buf, sizeof(buf) ); -} - -RSAKeyWrapper::RSAKeyWrapper() -{ - memset( &m_Key, 0, sizeof(m_Key) ); -} - -RSAKeyWrapper::~RSAKeyWrapper() -{ - Unload(); -} - -void RSAKeyWrapper::Unload() -{ - rsa_free( &m_Key ); -} - -void RSAKeyWrapper::Generate( PRNGWrapper &prng, int iKeyLenBits ) -{ - Unload(); - - int iRet = rsa_make_key( &prng.m_PRNG, prng.m_iPRNG, iKeyLenBits / 8, 65537, &m_Key ); - ASSERT( iRet == CRYPT_OK ); -} - -bool RSAKeyWrapper::Load( const RString &sKey, RString &sError ) -{ - Unload(); - - int iRet = rsa_import( (const unsigned char *) sKey.data(), sKey.size(), &m_Key ); - if( iRet != CRYPT_OK ) - { - memset( &m_Key, 0, sizeof(m_Key) ); - sError = error_to_string(iRet); - return false; - } - - return true; -} - +#include "global.h" +#include "CryptHelpers.h" + +PRNGWrapper::PRNGWrapper( const struct ltc_prng_descriptor *pPRNGDescriptor ) +{ + m_iPRNG = register_prng( pPRNGDescriptor ); + ASSERT( m_iPRNG >= 0 ); + + int iRet = rng_make_prng( 128, m_iPRNG, &m_PRNG, NULL ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); +} + +PRNGWrapper::~PRNGWrapper() +{ + if( m_iPRNG != -1 ) + prng_descriptor[m_iPRNG].done( &m_PRNG ); +} + +void PRNGWrapper::AddEntropy( const void *pData, int iSize ) +{ + int iRet = prng_descriptor[m_iPRNG].add_entropy( (const unsigned char *) pData, iSize, &m_PRNG ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); + + iRet = prng_descriptor[m_iPRNG].ready( &m_PRNG ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); +} + +void PRNGWrapper::AddRandomEntropy() +{ + unsigned char buf[256]; + int iRet = rng_get_bytes( buf, sizeof(buf), NULL ); + ASSERT( iRet == sizeof(buf) ); + + AddEntropy( buf, sizeof(buf) ); +} + +RSAKeyWrapper::RSAKeyWrapper() +{ + memset( &m_Key, 0, sizeof(m_Key) ); +} + +RSAKeyWrapper::~RSAKeyWrapper() +{ + Unload(); +} + +void RSAKeyWrapper::Unload() +{ + rsa_free( &m_Key ); +} + +void RSAKeyWrapper::Generate( PRNGWrapper &prng, int iKeyLenBits ) +{ + Unload(); + + int iRet = rsa_make_key( &prng.m_PRNG, prng.m_iPRNG, iKeyLenBits / 8, 65537, &m_Key ); + ASSERT( iRet == CRYPT_OK ); +} + +bool RSAKeyWrapper::Load( const RString &sKey, RString &sError ) +{ + Unload(); + + int iRet = rsa_import( (const unsigned char *) sKey.data(), sKey.size(), &m_Key ); + if( iRet != CRYPT_OK ) + { + memset( &m_Key, 0, sizeof(m_Key) ); + sError = error_to_string(iRet); + return false; + } + + return true; +} + diff --git a/src/CryptHelpers.h b/src/CryptHelpers.h index 930df3d5e7..5171f54e2f 100644 --- a/src/CryptHelpers.h +++ b/src/CryptHelpers.h @@ -1,35 +1,35 @@ -#ifndef CRYPT_HELPERS_H -#define CRYPT_HELPERS_H - -#if !defined(DISABLE_CRYPTO) - -#include "libtomcrypt/src/headers/tomcrypt.h" - -class PRNGWrapper -{ -public: - PRNGWrapper( const struct ltc_prng_descriptor *pPRNGDescriptor ); - ~PRNGWrapper(); - void AddEntropy( const void *pData, int iSize ); - void AddRandomEntropy(); - - int m_iPRNG; - prng_state m_PRNG; -}; - -class RSAKeyWrapper -{ -public: - RSAKeyWrapper(); - ~RSAKeyWrapper(); - void Unload(); - void Generate( PRNGWrapper &prng, int iKeyLenBits ); - bool Load( const RString &sKey, RString &sError ); - - rsa_key m_Key; -}; - -#endif - -#endif - +#ifndef CRYPT_HELPERS_H +#define CRYPT_HELPERS_H + +#if !defined(DISABLE_CRYPTO) + +#include "libtomcrypt/src/headers/tomcrypt.h" + +class PRNGWrapper +{ +public: + PRNGWrapper( const struct ltc_prng_descriptor *pPRNGDescriptor ); + ~PRNGWrapper(); + void AddEntropy( const void *pData, int iSize ); + void AddRandomEntropy(); + + int m_iPRNG; + prng_state m_PRNG; +}; + +class RSAKeyWrapper +{ +public: + RSAKeyWrapper(); + ~RSAKeyWrapper(); + void Unload(); + void Generate( PRNGWrapper &prng, int iKeyLenBits ); + bool Load( const RString &sKey, RString &sError ); + + rsa_key m_Key; +}; + +#endif + +#endif + diff --git a/src/CryptManager.cpp b/src/CryptManager.cpp index 5841a103b3..758415e2a9 100644 --- a/src/CryptManager.cpp +++ b/src/CryptManager.cpp @@ -1,494 +1,494 @@ -#include "global.h" -#include "CryptManager.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "RageFile.h" -#include "RageFileManager.h" -#include "CryptHelpers.h" -#include "LuaBinding.h" -#include "LuaReference.h" -#include "LuaManager.h" - -#include "libtomcrypt/src/headers/tomcrypt.h" - -CryptManager* CRYPTMAN = NULL; // global and accessable from anywhere in our program - -static const RString PRIVATE_KEY_PATH = "Data/private.rsa"; -static const RString PUBLIC_KEY_PATH = "Data/public.rsa"; -static const RString ALTERNATE_PUBLIC_KEY_DIR = "Data/keys/"; - -static bool HashFile( RageFileBasic &f, unsigned char buf_hash[20], int iHash ) -{ - hash_state hash; - int iRet = hash_descriptor[iHash].init( &hash ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); - - RString s; - while( !f.AtEOF() ) - { - s.erase(); - if( f.Read(s, 1024*4) == -1 ) - { - LOG->Warn( "Error reading %s: %s", f.GetDisplayPath().c_str(), f.GetError().c_str() ); - hash_descriptor[iHash].done( &hash, buf_hash ); - return false; - } - - iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) s.data(), s.size() ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); - } - - iRet = hash_descriptor[iHash].done( &hash, buf_hash ); - ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); - - return true; -} - -#if defined(DISABLE_CRYPTO) -CryptManager::CryptManager() { } -CryptManager::~CryptManager() { } -void CryptManager::GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename ) { } -void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) { } -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) { return true; } -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) -{ - return true; -} - -void CryptManager::GetRandomBytes( void *pData, int iBytes ) -{ - uint8_t *pBuf = (uint8_t *) pData; - while( iBytes-- ) - *pBuf++ = (uint8_t) RandomInt( 256 ); -} - -#else - -static const int KEY_LENGTH = 1024; -#define MAX_SIGNATURE_SIZE_BYTES 1024 // 1 KB - - - - -/* - openssl genrsa -out testing -outform DER - openssl rsa -in testing -out testing2 -outform DER - openssl rsa -in testing -out testing2 -pubout -outform DER - - openssl pkcs8 -inform DER -outform DER -nocrypt -in private.rsa -out private.der - * - */ - -static PRNGWrapper *g_pPRNG = NULL; - - -CryptManager::CryptManager() -{ - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "CRYPTMAN" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } - - ltc_mp = ltm_desc; - - g_pPRNG = new PRNGWrapper( &yarrow_desc ); -} - -void CryptManager::GenerateGlobalKeys() -{ - // - // generate keys if none are available - // - bool bGenerate = false; - RSAKeyWrapper key; - RString sKey; - RString sError; - if( !DoesFileExist(PRIVATE_KEY_PATH) || - !GetFileContents(PRIVATE_KEY_PATH, sKey) || - !key.Load(sKey, sError) ) - bGenerate = true; - if( !sError.empty() ) - LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); - - sError.clear(); - if( !DoesFileExist(PUBLIC_KEY_PATH) || - !GetFileContents(PUBLIC_KEY_PATH, sKey) || - !key.Load(sKey, sError) ) - bGenerate = true; - if( !sError.empty() ) - LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); - - if( bGenerate ) - { - LOG->Warn( "Keys missing or failed to load. Generating new keys" ); - GenerateRSAKeyToFile( KEY_LENGTH, PRIVATE_KEY_PATH, PUBLIC_KEY_PATH ); - } -} - -CryptManager::~CryptManager() -{ - SAFE_DELETE( g_pPRNG ); - // Unregister with Lua. - LUA->UnsetGlobal( "CRYPTMAN" ); -} - -static bool WriteFile( RString sFile, RString sBuf ) -{ - RageFile output; - if( !output.Open(sFile, RageFile::WRITE) ) - { - LOG->Warn( "WriteFile: opening %s failed: %s", sFile.c_str(), output.GetError().c_str() ); - return false; - } - - if( output.Write(sBuf) == -1 || output.Flush() == -1 ) - { - LOG->Warn( "WriteFile: writing %s failed: %s", sFile.c_str(), output.GetError().c_str() ); - output.Close(); - FILEMAN->Remove( sFile ); - return false; - } - - return true; -} - -void CryptManager::GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey ) -{ - int iRet; - - rsa_key key; - iRet = rsa_make_key( &g_pPRNG->m_PRNG, g_pPRNG->m_iPRNG, keyLength / 8, 65537, &key ); - if( iRet != CRYPT_OK ) - { - LOG->Warn( "GenerateRSAKey(%i) error: %s", keyLength, error_to_string(iRet) ); - return; - } - - unsigned char buf[1024]; - unsigned long iSize = sizeof(buf); - iRet = rsa_export( buf, &iSize, PK_PUBLIC, &key ); - if( iRet != CRYPT_OK ) - { - LOG->Warn( "Export error: %s", error_to_string(iRet) ); - return; - } - - sPubKey = RString( (const char *) buf, iSize ); - - iSize = sizeof(buf); - iRet = rsa_export( buf, &iSize, PK_PRIVATE, &key ); - if( iRet != CRYPT_OK ) - { - LOG->Warn( "Export error: %s", error_to_string(iRet) ); - return; - } - - sPrivKey = RString( (const char *) buf, iSize ); -} - -void CryptManager::GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ) -{ - RString sPrivKey, sPubKey; - GenerateRSAKey( keyLength, sPrivKey, sPubKey ); - - if( !WriteFile(pubFilename, sPubKey) ) - return; - - if( !WriteFile(privFilename, sPrivKey) ) - { - FILEMAN->Remove( privFilename ); - return; - } -} - -void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) -{ - RString sPrivFilename = PRIVATE_KEY_PATH; - if( sSignatureFile.empty() ) - sSignatureFile = sPath + SIGNATURE_APPEND; - - RString sPrivKey; - if( !GetFileContents(sPrivFilename, sPrivKey) ) - return; - - RString sSignature; - if( !Sign(sPath, sSignature, sPrivKey) ) - return; - - WriteFile( sSignatureFile, sSignature ); -} - -bool CryptManager::Sign( RString sPath, RString &sSignatureOut, RString sPrivKey ) -{ - if( !IsAFile(sPath) ) - { - LOG->Trace( "SignFileToFile: \"%s\" doesn't exist", sPath.c_str() ); - return false; - } - - RageFile file; - if( !file.Open(sPath) ) - { - LOG->Warn( "SignFileToFile: open(%s) failed: %s", sPath.c_str(), file.GetError().c_str() ); - return false; - } - - RSAKeyWrapper key; - RString sError; - if( !key.Load(sPrivKey, sError) ) - { - LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); - return false; - } - - int iHash = register_hash( &sha1_desc ); - ASSERT( iHash >= 0 ); - - unsigned char buf_hash[20]; - if( !HashFile(file, buf_hash, iHash) ) - return false; - - unsigned char signature[256]; - unsigned long signature_len = sizeof(signature); - - int iRet = rsa_sign_hash_ex( - buf_hash, sizeof(buf_hash), - signature, &signature_len, - LTC_PKCS_1_V1_5, &g_pPRNG->m_PRNG, g_pPRNG->m_iPRNG, iHash, - 0, &key.m_Key); - if( iRet != CRYPT_OK ) - { - LOG->Warn( "SignFileToFile error: %s", error_to_string(iRet) ); - return false; - } - - sSignatureOut.assign( (const char *) signature, signature_len ); - return true; -} - -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) -{ - if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) ) - return true; - - vector asKeys; - GetDirListing( ALTERNATE_PUBLIC_KEY_DIR, asKeys, false, true ); - for( unsigned i = 0; i < asKeys.size(); ++i ) - { - const RString &sKey = asKeys[i]; - LOG->Trace( "Trying alternate key \"%s\" ...", sKey.c_str() ); - - if( VerifyFileWithFile(sPath, sSignatureFile, sKey) ) - return true; - } - - return false; -} - -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) -{ - if( sSignatureFile.empty() ) - sSignatureFile = sPath + SIGNATURE_APPEND; - - RString sPublicKey; - if( !GetFileContents(sPublicKeyFile, sPublicKey) ) - return false; - - int iBytes = FILEMAN->GetFileSizeInBytes( sSignatureFile ); - if( iBytes > MAX_SIGNATURE_SIZE_BYTES ) - return false; - - RString sSignature; - if( !GetFileContents(sSignatureFile, sSignature) ) - return false; - - RageFile file; - if( !file.Open(sPath) ) - { - LOG->Warn( "Verify: open(%s) failed: %s", sPath.c_str(), file.GetError().c_str() ); - return false; - } - - return Verify( file, sSignature, sPublicKey ); -} - -bool CryptManager::Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ) -{ - RSAKeyWrapper key; - RString sError; - if( !key.Load(sPublicKey, sError) ) - { - LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); - return false; - } - - int iHash = register_hash( &sha1_desc ); - ASSERT( iHash >= 0 ); - - unsigned char buf_hash[20]; - HashFile( file, buf_hash, iHash ); - - int iMatch; - int iRet = rsa_verify_hash_ex( (const unsigned char *) sSignature.data(), sSignature.size(), - buf_hash, sizeof(buf_hash), - LTC_PKCS_1_EMSA, iHash, 0, &iMatch, &key.m_Key ); - - if( iRet != CRYPT_OK ) - { - LOG->Warn( "Verify(%s) failed: %s", file.GetDisplayPath().c_str(), error_to_string(iRet) ); - return false; - } - - if( !iMatch ) - { - LOG->Warn( "Verify(%s) failed: signature mismatch", file.GetDisplayPath().c_str() ); - return false; - } - - return true; -} - -void CryptManager::GetRandomBytes( void *pData, int iBytes ) -{ - int iRet = prng_descriptor[g_pPRNG->m_iPRNG].read( (unsigned char *) pData, iBytes, &g_pPRNG->m_PRNG ); - ASSERT( iRet == iBytes ); -} -#endif - -RString CryptManager::GetMD5ForFile( RString fn ) -{ - RageFile file; - if( !file.Open( fn, RageFile::READ ) ) - { - LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() ); - return RString(); - } - int iHash = register_hash( &md5_desc ); - ASSERT( iHash >= 0 ); - - unsigned char digest[16]; - HashFile( file, digest, iHash ); - - return RString( (const char *) digest, sizeof(digest) ); -} - -RString CryptManager::GetMD5ForString( RString sData ) -{ - unsigned char digest[16]; - - int iHash = register_hash( &md5_desc ); - - hash_state hash; - int iRet = hash_descriptor[iHash].init( &hash ); - iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) sData.data(), sData.size() ); - iRet = hash_descriptor[iHash].done( &hash, digest ); - - return RString( (const char *) digest, sizeof(digest) ); -} - -RString CryptManager::GetSHA1ForString( RString sData ) -{ - unsigned char digest[20]; - - int iHash = register_hash( &sha1_desc ); - - hash_state hash; - int iRet = hash_descriptor[iHash].init( &hash ); - iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) sData.data(), sData.size() ); - iRet = hash_descriptor[iHash].done( &hash, digest ); - - return RString( (const char *) digest, sizeof(digest) ); -} - -RString CryptManager::GetPublicKeyFileName() -{ - return PUBLIC_KEY_PATH; -} - -/* Generate a version 4 random UUID. */ -RString CryptManager::GenerateRandomUUID() -{ - uint32_t buf[4]; - CryptManager::GetRandomBytes( buf, sizeof(buf) ); - - buf[1] &= 0xFFFF0FFF; - buf[1] |= 0x00004000; - buf[2] &= 0x0FFFFFFF; - buf[2] |= 0xA0000000; - - return ssprintf("%08x-%04x-%04x-%04x-%04x%08x", - buf[0], - buf[1] >> 16, buf[1] & 0xFFFF, - buf[2] >> 16, buf[2] & 0xFFFF, - buf[3]); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the CryptManager. */ -class LunaCryptManager: public Luna -{ -public: - static int MD5String( T* p, lua_State *L ) - { - RString md5out; - md5out = p->GetMD5ForString(SArg(1)); - lua_pushstring( L, md5out ); - return 1; - } - static int MD5File( T* p, lua_State *L ) - { - RString md5fout; - md5fout = p->GetMD5ForFile(SArg(1)); - lua_pushstring( L, md5fout ); - return 1; - } - static int SHA1String( T* p, lua_State *L ) - { - RString sha1out; - sha1out = p->GetSHA1ForString(SArg(1)); - lua_pushstring( L, sha1out ); - return 1; - } - - LunaCryptManager() - { - ADD_METHOD( MD5String ); - ADD_METHOD( MD5File ); - ADD_METHOD( SHA1String ); - } -}; - -LUA_REGISTER_CLASS( CryptManager ) - -// lua end - -/* - * (c) 2004-2007 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CryptManager.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "RageFile.h" +#include "RageFileManager.h" +#include "CryptHelpers.h" +#include "LuaBinding.h" +#include "LuaReference.h" +#include "LuaManager.h" + +#include "libtomcrypt/src/headers/tomcrypt.h" + +CryptManager* CRYPTMAN = NULL; // global and accessable from anywhere in our program + +static const RString PRIVATE_KEY_PATH = "Data/private.rsa"; +static const RString PUBLIC_KEY_PATH = "Data/public.rsa"; +static const RString ALTERNATE_PUBLIC_KEY_DIR = "Data/keys/"; + +static bool HashFile( RageFileBasic &f, unsigned char buf_hash[20], int iHash ) +{ + hash_state hash; + int iRet = hash_descriptor[iHash].init( &hash ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); + + RString s; + while( !f.AtEOF() ) + { + s.erase(); + if( f.Read(s, 1024*4) == -1 ) + { + LOG->Warn( "Error reading %s: %s", f.GetDisplayPath().c_str(), f.GetError().c_str() ); + hash_descriptor[iHash].done( &hash, buf_hash ); + return false; + } + + iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) s.data(), s.size() ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); + } + + iRet = hash_descriptor[iHash].done( &hash, buf_hash ); + ASSERT_M( iRet == CRYPT_OK, error_to_string(iRet) ); + + return true; +} + +#if defined(DISABLE_CRYPTO) +CryptManager::CryptManager() { } +CryptManager::~CryptManager() { } +void CryptManager::GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename ) { } +void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) { } +bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) { return true; } +bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) +{ + return true; +} + +void CryptManager::GetRandomBytes( void *pData, int iBytes ) +{ + uint8_t *pBuf = (uint8_t *) pData; + while( iBytes-- ) + *pBuf++ = (uint8_t) RandomInt( 256 ); +} + +#else + +static const int KEY_LENGTH = 1024; +#define MAX_SIGNATURE_SIZE_BYTES 1024 // 1 KB + + + + +/* + openssl genrsa -out testing -outform DER + openssl rsa -in testing -out testing2 -outform DER + openssl rsa -in testing -out testing2 -pubout -outform DER + + openssl pkcs8 -inform DER -outform DER -nocrypt -in private.rsa -out private.der + * + */ + +static PRNGWrapper *g_pPRNG = NULL; + + +CryptManager::CryptManager() +{ + // Register with Lua. + { + Lua *L = LUA->Get(); + lua_pushstring( L, "CRYPTMAN" ); + this->PushSelf( L ); + lua_settable( L, LUA_GLOBALSINDEX ); + LUA->Release( L ); + } + + ltc_mp = ltm_desc; + + g_pPRNG = new PRNGWrapper( &yarrow_desc ); +} + +void CryptManager::GenerateGlobalKeys() +{ + // + // generate keys if none are available + // + bool bGenerate = false; + RSAKeyWrapper key; + RString sKey; + RString sError; + if( !DoesFileExist(PRIVATE_KEY_PATH) || + !GetFileContents(PRIVATE_KEY_PATH, sKey) || + !key.Load(sKey, sError) ) + bGenerate = true; + if( !sError.empty() ) + LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); + + sError.clear(); + if( !DoesFileExist(PUBLIC_KEY_PATH) || + !GetFileContents(PUBLIC_KEY_PATH, sKey) || + !key.Load(sKey, sError) ) + bGenerate = true; + if( !sError.empty() ) + LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); + + if( bGenerate ) + { + LOG->Warn( "Keys missing or failed to load. Generating new keys" ); + GenerateRSAKeyToFile( KEY_LENGTH, PRIVATE_KEY_PATH, PUBLIC_KEY_PATH ); + } +} + +CryptManager::~CryptManager() +{ + SAFE_DELETE( g_pPRNG ); + // Unregister with Lua. + LUA->UnsetGlobal( "CRYPTMAN" ); +} + +static bool WriteFile( RString sFile, RString sBuf ) +{ + RageFile output; + if( !output.Open(sFile, RageFile::WRITE) ) + { + LOG->Warn( "WriteFile: opening %s failed: %s", sFile.c_str(), output.GetError().c_str() ); + return false; + } + + if( output.Write(sBuf) == -1 || output.Flush() == -1 ) + { + LOG->Warn( "WriteFile: writing %s failed: %s", sFile.c_str(), output.GetError().c_str() ); + output.Close(); + FILEMAN->Remove( sFile ); + return false; + } + + return true; +} + +void CryptManager::GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey ) +{ + int iRet; + + rsa_key key; + iRet = rsa_make_key( &g_pPRNG->m_PRNG, g_pPRNG->m_iPRNG, keyLength / 8, 65537, &key ); + if( iRet != CRYPT_OK ) + { + LOG->Warn( "GenerateRSAKey(%i) error: %s", keyLength, error_to_string(iRet) ); + return; + } + + unsigned char buf[1024]; + unsigned long iSize = sizeof(buf); + iRet = rsa_export( buf, &iSize, PK_PUBLIC, &key ); + if( iRet != CRYPT_OK ) + { + LOG->Warn( "Export error: %s", error_to_string(iRet) ); + return; + } + + sPubKey = RString( (const char *) buf, iSize ); + + iSize = sizeof(buf); + iRet = rsa_export( buf, &iSize, PK_PRIVATE, &key ); + if( iRet != CRYPT_OK ) + { + LOG->Warn( "Export error: %s", error_to_string(iRet) ); + return; + } + + sPrivKey = RString( (const char *) buf, iSize ); +} + +void CryptManager::GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ) +{ + RString sPrivKey, sPubKey; + GenerateRSAKey( keyLength, sPrivKey, sPubKey ); + + if( !WriteFile(pubFilename, sPubKey) ) + return; + + if( !WriteFile(privFilename, sPrivKey) ) + { + FILEMAN->Remove( privFilename ); + return; + } +} + +void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) +{ + RString sPrivFilename = PRIVATE_KEY_PATH; + if( sSignatureFile.empty() ) + sSignatureFile = sPath + SIGNATURE_APPEND; + + RString sPrivKey; + if( !GetFileContents(sPrivFilename, sPrivKey) ) + return; + + RString sSignature; + if( !Sign(sPath, sSignature, sPrivKey) ) + return; + + WriteFile( sSignatureFile, sSignature ); +} + +bool CryptManager::Sign( RString sPath, RString &sSignatureOut, RString sPrivKey ) +{ + if( !IsAFile(sPath) ) + { + LOG->Trace( "SignFileToFile: \"%s\" doesn't exist", sPath.c_str() ); + return false; + } + + RageFile file; + if( !file.Open(sPath) ) + { + LOG->Warn( "SignFileToFile: open(%s) failed: %s", sPath.c_str(), file.GetError().c_str() ); + return false; + } + + RSAKeyWrapper key; + RString sError; + if( !key.Load(sPrivKey, sError) ) + { + LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); + return false; + } + + int iHash = register_hash( &sha1_desc ); + ASSERT( iHash >= 0 ); + + unsigned char buf_hash[20]; + if( !HashFile(file, buf_hash, iHash) ) + return false; + + unsigned char signature[256]; + unsigned long signature_len = sizeof(signature); + + int iRet = rsa_sign_hash_ex( + buf_hash, sizeof(buf_hash), + signature, &signature_len, + LTC_PKCS_1_V1_5, &g_pPRNG->m_PRNG, g_pPRNG->m_iPRNG, iHash, + 0, &key.m_Key); + if( iRet != CRYPT_OK ) + { + LOG->Warn( "SignFileToFile error: %s", error_to_string(iRet) ); + return false; + } + + sSignatureOut.assign( (const char *) signature, signature_len ); + return true; +} + +bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) +{ + if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) ) + return true; + + vector asKeys; + GetDirListing( ALTERNATE_PUBLIC_KEY_DIR, asKeys, false, true ); + for( unsigned i = 0; i < asKeys.size(); ++i ) + { + const RString &sKey = asKeys[i]; + LOG->Trace( "Trying alternate key \"%s\" ...", sKey.c_str() ); + + if( VerifyFileWithFile(sPath, sSignatureFile, sKey) ) + return true; + } + + return false; +} + +bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) +{ + if( sSignatureFile.empty() ) + sSignatureFile = sPath + SIGNATURE_APPEND; + + RString sPublicKey; + if( !GetFileContents(sPublicKeyFile, sPublicKey) ) + return false; + + int iBytes = FILEMAN->GetFileSizeInBytes( sSignatureFile ); + if( iBytes > MAX_SIGNATURE_SIZE_BYTES ) + return false; + + RString sSignature; + if( !GetFileContents(sSignatureFile, sSignature) ) + return false; + + RageFile file; + if( !file.Open(sPath) ) + { + LOG->Warn( "Verify: open(%s) failed: %s", sPath.c_str(), file.GetError().c_str() ); + return false; + } + + return Verify( file, sSignature, sPublicKey ); +} + +bool CryptManager::Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ) +{ + RSAKeyWrapper key; + RString sError; + if( !key.Load(sPublicKey, sError) ) + { + LOG->Warn( "Error loading RSA key: %s", sError.c_str() ); + return false; + } + + int iHash = register_hash( &sha1_desc ); + ASSERT( iHash >= 0 ); + + unsigned char buf_hash[20]; + HashFile( file, buf_hash, iHash ); + + int iMatch; + int iRet = rsa_verify_hash_ex( (const unsigned char *) sSignature.data(), sSignature.size(), + buf_hash, sizeof(buf_hash), + LTC_PKCS_1_EMSA, iHash, 0, &iMatch, &key.m_Key ); + + if( iRet != CRYPT_OK ) + { + LOG->Warn( "Verify(%s) failed: %s", file.GetDisplayPath().c_str(), error_to_string(iRet) ); + return false; + } + + if( !iMatch ) + { + LOG->Warn( "Verify(%s) failed: signature mismatch", file.GetDisplayPath().c_str() ); + return false; + } + + return true; +} + +void CryptManager::GetRandomBytes( void *pData, int iBytes ) +{ + int iRet = prng_descriptor[g_pPRNG->m_iPRNG].read( (unsigned char *) pData, iBytes, &g_pPRNG->m_PRNG ); + ASSERT( iRet == iBytes ); +} +#endif + +RString CryptManager::GetMD5ForFile( RString fn ) +{ + RageFile file; + if( !file.Open( fn, RageFile::READ ) ) + { + LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() ); + return RString(); + } + int iHash = register_hash( &md5_desc ); + ASSERT( iHash >= 0 ); + + unsigned char digest[16]; + HashFile( file, digest, iHash ); + + return RString( (const char *) digest, sizeof(digest) ); +} + +RString CryptManager::GetMD5ForString( RString sData ) +{ + unsigned char digest[16]; + + int iHash = register_hash( &md5_desc ); + + hash_state hash; + int iRet = hash_descriptor[iHash].init( &hash ); + iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) sData.data(), sData.size() ); + iRet = hash_descriptor[iHash].done( &hash, digest ); + + return RString( (const char *) digest, sizeof(digest) ); +} + +RString CryptManager::GetSHA1ForString( RString sData ) +{ + unsigned char digest[20]; + + int iHash = register_hash( &sha1_desc ); + + hash_state hash; + int iRet = hash_descriptor[iHash].init( &hash ); + iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) sData.data(), sData.size() ); + iRet = hash_descriptor[iHash].done( &hash, digest ); + + return RString( (const char *) digest, sizeof(digest) ); +} + +RString CryptManager::GetPublicKeyFileName() +{ + return PUBLIC_KEY_PATH; +} + +/* Generate a version 4 random UUID. */ +RString CryptManager::GenerateRandomUUID() +{ + uint32_t buf[4]; + CryptManager::GetRandomBytes( buf, sizeof(buf) ); + + buf[1] &= 0xFFFF0FFF; + buf[1] |= 0x00004000; + buf[2] &= 0x0FFFFFFF; + buf[2] |= 0xA0000000; + + return ssprintf("%08x-%04x-%04x-%04x-%04x%08x", + buf[0], + buf[1] >> 16, buf[1] & 0xFFFF, + buf[2] >> 16, buf[2] & 0xFFFF, + buf[3]); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the CryptManager. */ +class LunaCryptManager: public Luna +{ +public: + static int MD5String( T* p, lua_State *L ) + { + RString md5out; + md5out = p->GetMD5ForString(SArg(1)); + lua_pushstring( L, md5out ); + return 1; + } + static int MD5File( T* p, lua_State *L ) + { + RString md5fout; + md5fout = p->GetMD5ForFile(SArg(1)); + lua_pushstring( L, md5fout ); + return 1; + } + static int SHA1String( T* p, lua_State *L ) + { + RString sha1out; + sha1out = p->GetSHA1ForString(SArg(1)); + lua_pushstring( L, sha1out ); + return 1; + } + + LunaCryptManager() + { + ADD_METHOD( MD5String ); + ADD_METHOD( MD5File ); + ADD_METHOD( SHA1String ); + } +}; + +LUA_REGISTER_CLASS( CryptManager ) + +// lua end + +/* + * (c) 2004-2007 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CryptManager.h b/src/CryptManager.h index 5d4bf56cab..feda635aed 100644 --- a/src/CryptManager.h +++ b/src/CryptManager.h @@ -1,64 +1,64 @@ -#ifndef CryptManager_H -#define CryptManager_H - -class RageFileBasic; -struct lua_State; - -const RString SIGNATURE_APPEND = ".sig"; - -class CryptManager -{ -public: - CryptManager(); - ~CryptManager(); - - static void GenerateGlobalKeys(); - static void GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey ); - static void GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ); - static void SignFileToFile( RString sPath, RString sSignatureFile = "" ); - static bool Sign( RString sPath, RString &sSignatureOut, RString sPrivateKey ); - static bool VerifyFileWithFile( RString sPath, RString sSignatureFile = "" ); - static bool VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ); - static bool Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ); - - static void GetRandomBytes( void *pData, int iBytes ); - static RString GenerateRandomUUID(); - - static RString GetMD5ForFile( RString fn ); // in binary - static RString GetMD5ForString( RString sData ); // in binary - static RString GetSHA1ForString( RString sData ); // in binary - - static RString GetPublicKeyFileName(); - - // Lua - void PushSelf( lua_State *L ); -}; - -extern CryptManager* CRYPTMAN; // global and accessable from anywhere in our program - -#endif - -/* - * (c) 2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef CryptManager_H +#define CryptManager_H + +class RageFileBasic; +struct lua_State; + +const RString SIGNATURE_APPEND = ".sig"; + +class CryptManager +{ +public: + CryptManager(); + ~CryptManager(); + + static void GenerateGlobalKeys(); + static void GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey ); + static void GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ); + static void SignFileToFile( RString sPath, RString sSignatureFile = "" ); + static bool Sign( RString sPath, RString &sSignatureOut, RString sPrivateKey ); + static bool VerifyFileWithFile( RString sPath, RString sSignatureFile = "" ); + static bool VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ); + static bool Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ); + + static void GetRandomBytes( void *pData, int iBytes ); + static RString GenerateRandomUUID(); + + static RString GetMD5ForFile( RString fn ); // in binary + static RString GetMD5ForString( RString sData ); // in binary + static RString GetSHA1ForString( RString sData ); // in binary + + static RString GetPublicKeyFileName(); + + // Lua + void PushSelf( lua_State *L ); +}; + +extern CryptManager* CRYPTMAN; // global and accessable from anywhere in our program + +#endif + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CsvFile.cpp b/src/CsvFile.cpp index c9b19fb009..68fc44b100 100644 --- a/src/CsvFile.cpp +++ b/src/CsvFile.cpp @@ -1,161 +1,161 @@ -#include "global.h" -#include "CsvFile.h" -#include "RageUtil.h" -#include "RageFile.h" -#include "RageLog.h" -#include "Foreach.h" - -CsvFile::CsvFile() -{ -} - -bool CsvFile::ReadFile( const RString &sPath ) -{ - m_sPath = sPath; - CHECKPOINT_M( ssprintf("Reading '%s'",m_sPath.c_str()) ); - - RageFile f; - if( !f.Open( m_sPath ) ) - { - LOG->Trace( "Reading '%s' failed: %s", m_sPath.c_str(), f.GetError().c_str() ); - m_sError = f.GetError(); - return 0; - } - - return ReadFile( f ); -} - -bool CsvFile::ReadFile( RageFileBasic &f ) -{ - m_vvs.clear(); - - // hi,"hi2,","""hi3""" - - while( 1 ) - { - RString line; - switch( f.GetLine(line) ) - { - case -1: - m_sError = f.GetError(); - return false; - case 0: - return true; /* eof */ - } - - utf8_remove_bom( line ); - - vector vs; - - while( !line.empty() ) - { - if( line[0] == '\"' ) // quoted value - { - line.erase( line.begin() ); // eat open quote - RString::size_type iEnd = 0; - do - { - iEnd = line.find('\"', iEnd); - if( iEnd == line.npos ) - { - iEnd = line.size()-1; // didn't find an end. Take the whole line. - break; - } - - if( line.size() > iEnd+1 && line[iEnd+1] == '\"' ) // next char is also double quote - iEnd = iEnd+2; - else - break; - } - while(true); - - RString sValue = line; - sValue = sValue.Left( iEnd ); - vs.push_back( sValue ); - - line.erase( line.begin(), line.begin()+iEnd ); - - if( !line.empty() && line[0] == '\"' ) - line.erase( line.begin() ); - } - else - { - RString::size_type iEnd = line.find(','); - if( iEnd == line.npos ) - iEnd = line.size(); // didn't find an end. Take the whole line - - RString sValue = line; - sValue = sValue.Left( iEnd ); - vs.push_back( sValue ); - - line.erase( line.begin(), line.begin()+iEnd ); - } - - if( !line.empty() && line[0] == ',' ) - line.erase( line.begin() ); - } - - m_vvs.push_back( vs ); - } -} - -bool CsvFile::WriteFile( const RString &sPath ) const -{ - RageFile f; - if( !f.Open( sPath, RageFile::WRITE ) ) - { - LOG->Trace( "Writing '%s' failed: %s", sPath.c_str(), f.GetError().c_str() ); - m_sError = f.GetError(); - return false; - } - - return CsvFile::WriteFile( f ); -} - -bool CsvFile::WriteFile( RageFileBasic &f ) const -{ - FOREACH_CONST( StringVector, m_vvs, line ) - { - RString sLine; - FOREACH_CONST( RString, *line, value ) - { - RString sVal = *value; - sVal.Replace( "\"", "\"\"" ); // escape quotes to double-quotes - sLine += "\"" + sVal + "\""; - if( value != line->end()-1 ) - sLine += ","; - } - if( f.PutLine(sLine) == -1 ) - { - m_sError = f.GetError(); - return false; - } - } - return true; -} - - -/* - * (c) 2001-2004 Adam Clauss, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "CsvFile.h" +#include "RageUtil.h" +#include "RageFile.h" +#include "RageLog.h" +#include "Foreach.h" + +CsvFile::CsvFile() +{ +} + +bool CsvFile::ReadFile( const RString &sPath ) +{ + m_sPath = sPath; + CHECKPOINT_M( ssprintf("Reading '%s'",m_sPath.c_str()) ); + + RageFile f; + if( !f.Open( m_sPath ) ) + { + LOG->Trace( "Reading '%s' failed: %s", m_sPath.c_str(), f.GetError().c_str() ); + m_sError = f.GetError(); + return 0; + } + + return ReadFile( f ); +} + +bool CsvFile::ReadFile( RageFileBasic &f ) +{ + m_vvs.clear(); + + // hi,"hi2,","""hi3""" + + while( 1 ) + { + RString line; + switch( f.GetLine(line) ) + { + case -1: + m_sError = f.GetError(); + return false; + case 0: + return true; /* eof */ + } + + utf8_remove_bom( line ); + + vector vs; + + while( !line.empty() ) + { + if( line[0] == '\"' ) // quoted value + { + line.erase( line.begin() ); // eat open quote + RString::size_type iEnd = 0; + do + { + iEnd = line.find('\"', iEnd); + if( iEnd == line.npos ) + { + iEnd = line.size()-1; // didn't find an end. Take the whole line. + break; + } + + if( line.size() > iEnd+1 && line[iEnd+1] == '\"' ) // next char is also double quote + iEnd = iEnd+2; + else + break; + } + while(true); + + RString sValue = line; + sValue = sValue.Left( iEnd ); + vs.push_back( sValue ); + + line.erase( line.begin(), line.begin()+iEnd ); + + if( !line.empty() && line[0] == '\"' ) + line.erase( line.begin() ); + } + else + { + RString::size_type iEnd = line.find(','); + if( iEnd == line.npos ) + iEnd = line.size(); // didn't find an end. Take the whole line + + RString sValue = line; + sValue = sValue.Left( iEnd ); + vs.push_back( sValue ); + + line.erase( line.begin(), line.begin()+iEnd ); + } + + if( !line.empty() && line[0] == ',' ) + line.erase( line.begin() ); + } + + m_vvs.push_back( vs ); + } +} + +bool CsvFile::WriteFile( const RString &sPath ) const +{ + RageFile f; + if( !f.Open( sPath, RageFile::WRITE ) ) + { + LOG->Trace( "Writing '%s' failed: %s", sPath.c_str(), f.GetError().c_str() ); + m_sError = f.GetError(); + return false; + } + + return CsvFile::WriteFile( f ); +} + +bool CsvFile::WriteFile( RageFileBasic &f ) const +{ + FOREACH_CONST( StringVector, m_vvs, line ) + { + RString sLine; + FOREACH_CONST( RString, *line, value ) + { + RString sVal = *value; + sVal.Replace( "\"", "\"\"" ); // escape quotes to double-quotes + sLine += "\"" + sVal + "\""; + if( value != line->end()-1 ) + sLine += ","; + } + if( f.PutLine(sLine) == -1 ) + { + m_sError = f.GetError(); + return false; + } + } + return true; +} + + +/* + * (c) 2001-2004 Adam Clauss, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/CsvFile.h b/src/CsvFile.h index 28787f5698..0360e34ded 100644 --- a/src/CsvFile.h +++ b/src/CsvFile.h @@ -1,52 +1,52 @@ -/* CsvFile - Reading and writing .CSV files. */ - -#ifndef CsvFile_H -#define CsvFile_H - -class RageFileBasic; - -class CsvFile -{ -public: - CsvFile(); - - bool ReadFile( const RString &sPath ); - bool ReadFile( RageFileBasic &sFile ); - bool WriteFile( const RString &sPath ) const; - bool WriteFile( RageFileBasic &sFile ) const; - - typedef vector StringVector; - vector m_vvs; - -private: - RString m_sPath; - mutable RString m_sError; -}; - -#endif - -/* - * (c) 2001-2004 Adam Clauss, Chris Danford - * - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* CsvFile - Reading and writing .CSV files. */ + +#ifndef CsvFile_H +#define CsvFile_H + +class RageFileBasic; + +class CsvFile +{ +public: + CsvFile(); + + bool ReadFile( const RString &sPath ); + bool ReadFile( RageFileBasic &sFile ); + bool WriteFile( const RString &sPath ) const; + bool WriteFile( RageFileBasic &sFile ) const; + + typedef vector StringVector; + vector m_vvs; + +private: + RString m_sPath; + mutable RString m_sError; +}; + +#endif + +/* + * (c) 2001-2004 Adam Clauss, Chris Danford + * + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DancingCharacters.cpp b/src/DancingCharacters.cpp index ff4ba85776..3404096a63 100644 --- a/src/DancingCharacters.cpp +++ b/src/DancingCharacters.cpp @@ -1,413 +1,413 @@ -#include "global.h" -#include "DancingCharacters.h" -#include "GameConstantsAndTypes.h" -#include "RageDisplay.h" -#include "RageUtil.h" -#include "RageMath.h" -#include "GameState.h" -#include "Song.h" -#include "Character.h" -#include "StatsManager.h" -#include "PrefsManager.h" -#include "Model.h" - -#define DC_X( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterXP%d",choice+1)) -#define DC_Y( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterYP%d",choice+1)) - -/* - * TODO: - * - Metrics/Lua for lighting and camera sweeping. - * - Ability to load secondary elements i.e. stages. - * - Remove support for 2D characters (Lua can do it). - * - Cleanup! - * - * -- Colby - */ -const float CAMERA_REST_DISTANCE = 32.f; -const float CAMERA_REST_LOOK_AT_HEIGHT = -11.f; - -const float CAMERA_SWEEP_DISTANCE = 28.f; -const float CAMERA_SWEEP_DISTANCE_VARIANCE = 4.f; -const float CAMERA_SWEEP_HEIGHT_VARIANCE = 7.f; -const float CAMERA_SWEEP_PAN_Y_RANGE_DEGREES = 45.f; -const float CAMERA_SWEEP_PAN_Y_VARIANCE_DEGREES = 60.f; -const float CAMERA_SWEEP_LOOK_AT_HEIGHT = -11.f; - -const float CAMERA_STILL_DISTANCE = 26.f; -const float CAMERA_STILL_DISTANCE_VARIANCE = 3.f; -const float CAMERA_STILL_PAN_Y_RANGE_DEGREES = 120.f; -const float CAMERA_STILL_HEIGHT_VARIANCE = 5.f; -const float CAMERA_STILL_LOOK_AT_HEIGHT = -10.f; - -const float MODEL_X_ONE_PLAYER = 0; -const float MODEL_X_TWO_PLAYERS[NUM_PLAYERS] = { +8, -8 }; -const float MODEL_ROTATIONY_TWO_PLAYERS[NUM_PLAYERS] = { -90, 90 }; - -DancingCharacters::DancingCharacters() -{ - m_bDrawDangerLight = false; - - FOREACH_PlayerNumber( p ) - { - m_pCharacter[p] = new Model; - m_2DIdleTimer[p].SetZero(); - m_i2DAnimState[p] = AS2D_IDLE; // start on idle state - if( !GAMESTATE->IsPlayerEnabled(p) ) - continue; - - Character* pChar = GAMESTATE->m_pCurCharacters[p]; - if( !pChar ) - continue; - - // load in any potential 2D stuff - RString sCharacterDirectory = pChar->m_sCharDir; - RString sCurrentAnim; - sCurrentAnim = sCharacterDirectory + "2DIdle"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgIdle[p].Load( sCurrentAnim ); - m_bgIdle[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DMiss"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgMiss[p].Load( sCurrentAnim ); - m_bgMiss[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DGood"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgGood[p].Load( sCurrentAnim ); - m_bgGood[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DGreat"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgGreat[p].Load( sCurrentAnim ); - m_bgGreat[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DFever"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgFever[p].Load( sCurrentAnim ); - m_bgFever[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DFail"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgFail[p].Load( sCurrentAnim ); - m_bgFail[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DWin"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgWin[p].Load( sCurrentAnim ); - m_bgWin[p]->SetXY(DC_X(p),DC_Y(p)); - } - - sCurrentAnim = sCharacterDirectory + "2DWinFever"; - if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists - { - m_bgWinFever[p].Load( sCurrentAnim ); - m_bgWinFever[p]->SetXY(DC_X(p),DC_Y(p)); - } - - if( pChar->GetModelPath().empty() ) - continue; - - if( GAMESTATE->GetNumPlayersEnabled()==2 ) - m_pCharacter[p]->SetX( MODEL_X_TWO_PLAYERS[p] ); - else - m_pCharacter[p]->SetX( MODEL_X_ONE_PLAYER ); - - switch( GAMESTATE->m_PlayMode ) - { - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - m_pCharacter[p]->SetRotationY( MODEL_ROTATIONY_TWO_PLAYERS[p] ); - break; - } - - m_pCharacter[p]->LoadMilkshapeAscii( pChar->GetModelPath() ); - m_pCharacter[p]->LoadMilkshapeAsciiBones( "rest", pChar->GetRestAnimationPath() ); - m_pCharacter[p]->LoadMilkshapeAsciiBones( "warmup", pChar->GetWarmUpAnimationPath() ); - m_pCharacter[p]->LoadMilkshapeAsciiBones( "dance", pChar->GetDanceAnimationPath() ); - m_pCharacter[p]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped - - m_pCharacter[p]->RunCommands( pChar->m_cmdInit ); - } -} - -DancingCharacters::~DancingCharacters() -{ - FOREACH_PlayerNumber( p ) - delete m_pCharacter[p]; -} - -void DancingCharacters::LoadNextSong() -{ - // initial camera sweep is still - m_CameraDistance = CAMERA_REST_DISTANCE; - m_CameraPanYStart = 0; - m_CameraPanYEnd = 0; - m_fCameraHeightStart = CAMERA_REST_LOOK_AT_HEIGHT; - m_fCameraHeightEnd = CAMERA_REST_LOOK_AT_HEIGHT; - m_fLookAtHeight = CAMERA_REST_LOOK_AT_HEIGHT; - m_fThisCameraStartBeat = 0; - m_fThisCameraEndBeat = 0; - - ASSERT( GAMESTATE->m_pCurSong ); - m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->m_fFirstBeat; - - FOREACH_PlayerNumber( p ) - if( GAMESTATE->IsPlayerEnabled(p) ) - m_pCharacter[p]->PlayAnimation( "rest" ); -} - -int Neg1OrPos1() { return RandomInt( 2 ) ? -1 : +1; } - -void DancingCharacters::Update( float fDelta ) -{ - if( GAMESTATE->m_bFreeze || GAMESTATE->m_bDelay ) - { - // spin the camera Matrix-style - m_CameraPanYStart += fDelta*40; - m_CameraPanYEnd += fDelta*40; - } - else - { - // make the characters move - float fBPM = GAMESTATE->m_fCurBPS*60; - float fUpdateScale = SCALE( fBPM, 60.f, 300.f, 0.75f, 1.5f ); - CLAMP( fUpdateScale, 0.75f, 1.5f ); - - /* It's OK for the animation to go slower than natural when we're - * at a very low music rate. */ - fUpdateScale *= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; - - FOREACH_PlayerNumber( p ) - { - if( GAMESTATE->IsPlayerEnabled(p) ) - m_pCharacter[p]->Update( fDelta*fUpdateScale ); - } - } - - static bool bWasGameplayStarting = false; - bool bGameplayStarting = GAMESTATE->m_bGameplayLeadIn; - if( !bWasGameplayStarting && bGameplayStarting ) - { - FOREACH_PlayerNumber( p ) - if( GAMESTATE->IsPlayerEnabled(p) ) - m_pCharacter[p]->PlayAnimation( "warmup" ); - } - bWasGameplayStarting = bGameplayStarting; - - static float fLastBeat = GAMESTATE->m_fSongBeat; - float fThisBeat = GAMESTATE->m_fSongBeat; - if( fLastBeat < GAMESTATE->m_pCurSong->m_fFirstBeat && - fThisBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat ) - { - FOREACH_PlayerNumber( p ) - m_pCharacter[p]->PlayAnimation( "dance" ); - } - fLastBeat = fThisBeat; - - // time for a new sweep? - if( GAMESTATE->m_fSongBeat > m_fThisCameraEndBeat ) - { - if( RandomInt(6) >= 4 ) - { - // sweeping camera - m_CameraDistance = CAMERA_SWEEP_DISTANCE + RandomInt(-1,1) * CAMERA_SWEEP_DISTANCE_VARIANCE; - m_CameraPanYStart = m_CameraPanYEnd = RandomInt(-1,1) * CAMERA_SWEEP_PAN_Y_RANGE_DEGREES; - m_fCameraHeightStart = m_fCameraHeightEnd = CAMERA_STILL_LOOK_AT_HEIGHT; - - m_CameraPanYEnd += RandomInt(-1,1) * CAMERA_SWEEP_PAN_Y_VARIANCE_DEGREES; - m_fCameraHeightStart = m_fCameraHeightEnd = m_fCameraHeightStart + RandomInt(-1,1) * CAMERA_SWEEP_HEIGHT_VARIANCE; - - float fCameraHeightVariance = RandomInt(-1,1) * CAMERA_SWEEP_HEIGHT_VARIANCE; - m_fCameraHeightStart -= fCameraHeightVariance; - m_fCameraHeightEnd += fCameraHeightVariance; - - m_fLookAtHeight = CAMERA_SWEEP_LOOK_AT_HEIGHT; - } - else - { - // still camera - m_CameraDistance = CAMERA_STILL_DISTANCE + RandomInt(-1,1) * CAMERA_STILL_DISTANCE_VARIANCE; - m_CameraPanYStart = m_CameraPanYEnd = Neg1OrPos1() * CAMERA_STILL_PAN_Y_RANGE_DEGREES; - m_fCameraHeightStart = m_fCameraHeightEnd = CAMERA_SWEEP_LOOK_AT_HEIGHT + Neg1OrPos1() * CAMERA_STILL_HEIGHT_VARIANCE; - - m_fLookAtHeight = CAMERA_STILL_LOOK_AT_HEIGHT; - } - - int iCurBeat = (int)GAMESTATE->m_fSongBeat; - iCurBeat -= iCurBeat%8; - - m_fThisCameraStartBeat = (float) iCurBeat; - m_fThisCameraEndBeat = float(iCurBeat + 8); - } - /* - // is there any of this still around? This block of code is _ugly_. -Colby - // update any 2D stuff - FOREACH_PlayerNumber( p ) - { - if( m_bgIdle[p].IsLoaded() ) - { - if( m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) - m_bgIdle[p]->Update( fDelta ); - if( m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS ) - m_bgMiss[p]->Update( fDelta ); - if( m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD ) - m_bgGood[p]->Update( fDelta ); - if( m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT ) - m_bgGreat[p]->Update( fDelta ); - if( m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER ) - m_bgFever[p]->Update( fDelta ); - if( m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL ) - m_bgFail[p]->Update( fDelta ); - if( m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN ) - m_bgWin[p]->Update( fDelta ); - if( m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER ) - m_bgWinFever[p]->Update(fDelta); - - if(m_i2DAnimState[p] != AS2D_IDLE) // if we're not in idle state, start a timer to return us to idle - { - // never return to idle state if we have failed / passed (i.e. completed) the song - if(m_i2DAnimState[p] != AS2D_WINFEVER && m_i2DAnimState[p] != AS2D_FAIL && m_i2DAnimState[p] != AS2D_WIN) - { - if(m_2DIdleTimer[p].IsZero()) - m_2DIdleTimer[p].Touch(); - if(!m_2DIdleTimer[p].IsZero() && m_2DIdleTimer[p].Ago() > 1.0f) - { - m_2DIdleTimer[p].SetZero(); - m_i2DAnimState[p] = AS2D_IDLE; - } - } - } - } - } - */ -} - -void DancingCharacters::Change2DAnimState( PlayerNumber pn, int iState ) -{ - ASSERT( pn < NUM_PLAYERS ); - ASSERT( iState < AS2D_MAXSTATES ); - - m_i2DAnimState[pn] = iState; -} - -void DancingCharacters::DrawPrimitives() -{ - DISPLAY->CameraPushMatrix(); - - float fPercentIntoSweep; - if(m_fThisCameraStartBeat == m_fThisCameraEndBeat) - fPercentIntoSweep = 0; - else - fPercentIntoSweep = SCALE(GAMESTATE->m_fSongBeat, m_fThisCameraStartBeat, m_fThisCameraEndBeat, 0.f, 1.f ); - float fCameraPanY = SCALE( fPercentIntoSweep, 0.f, 1.f, m_CameraPanYStart, m_CameraPanYEnd ); - float fCameraHeight = SCALE( fPercentIntoSweep, 0.f, 1.f, m_fCameraHeightStart, m_fCameraHeightEnd ); - - RageVector3 m_CameraPoint( 0, fCameraHeight, -m_CameraDistance ); - RageMatrix CameraRot; - RageMatrixRotationY( &CameraRot, fCameraPanY ); - RageVec3TransformCoord( &m_CameraPoint, &m_CameraPoint, &CameraRot ); - - RageVector3 m_LookAt( 0, m_fLookAtHeight, 0 ); - - DISPLAY->LoadLookAt( 45, - m_CameraPoint, - m_LookAt, - RageVector3(0,1,0) ); - - FOREACH_EnabledPlayer( p ) - { - bool bFailed = STATSMAN->m_CurStageStats.m_player[p].m_bFailed; - bool bDanger = m_bDrawDangerLight; - - DISPLAY->SetLighting( true ); - - RageColor ambient = bFailed ? RageColor(0.2f,0.1f,0.1f,1) : (bDanger ? RageColor(0.4f,0.1f,0.1f,1) : RageColor(0.4f,0.4f,0.4f,1)); - RageColor diffuse = bFailed ? RageColor(0.4f,0.1f,0.1f,1) : (bDanger ? RageColor(0.8f,0.1f,0.1f,1) : RageColor(1,0.95f,0.925f,1)); - RageColor specular = RageColor(0.8f,0.8f,0.8f,1); - DISPLAY->SetLightDirectional( - 0, - ambient, - diffuse, - specular, - RageVector3(-3, -7.5, +9) ); - - if( PREFSMAN->m_bCelShadeModels ) - { - m_pCharacter[p]->DrawCelShaded(); - - DISPLAY->SetLightOff( 0 ); - DISPLAY->SetLighting( false ); - continue; - } - - m_pCharacter[p]->Draw(); - - DISPLAY->SetLightOff( 0 ); - DISPLAY->SetLighting( false ); - } - - DISPLAY->CameraPopMatrix(); - - /* - // Ugly! -Colby - // now draw any potential 2D stuff - FOREACH_PlayerNumber( p ) - { - if(m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE) - m_bgIdle[p]->Draw(); - if(m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS) - m_bgMiss[p]->Draw(); - if(m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD) - m_bgGood[p]->Draw(); - if(m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT) - m_bgGreat[p]->Draw(); - if(m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER) - m_bgFever[p]->Draw(); - if(m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER) - m_bgWinFever[p]->Draw(); - if(m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN) - m_bgWin[p]->Draw(); - if(m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL) - m_bgFail[p]->Draw(); - } - */ -} - -/* - * (c) 2003-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DancingCharacters.h" +#include "GameConstantsAndTypes.h" +#include "RageDisplay.h" +#include "RageUtil.h" +#include "RageMath.h" +#include "GameState.h" +#include "Song.h" +#include "Character.h" +#include "StatsManager.h" +#include "PrefsManager.h" +#include "Model.h" + +#define DC_X( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterXP%d",choice+1)) +#define DC_Y( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterYP%d",choice+1)) + +/* + * TODO: + * - Metrics/Lua for lighting and camera sweeping. + * - Ability to load secondary elements i.e. stages. + * - Remove support for 2D characters (Lua can do it). + * - Cleanup! + * + * -- Colby + */ +const float CAMERA_REST_DISTANCE = 32.f; +const float CAMERA_REST_LOOK_AT_HEIGHT = -11.f; + +const float CAMERA_SWEEP_DISTANCE = 28.f; +const float CAMERA_SWEEP_DISTANCE_VARIANCE = 4.f; +const float CAMERA_SWEEP_HEIGHT_VARIANCE = 7.f; +const float CAMERA_SWEEP_PAN_Y_RANGE_DEGREES = 45.f; +const float CAMERA_SWEEP_PAN_Y_VARIANCE_DEGREES = 60.f; +const float CAMERA_SWEEP_LOOK_AT_HEIGHT = -11.f; + +const float CAMERA_STILL_DISTANCE = 26.f; +const float CAMERA_STILL_DISTANCE_VARIANCE = 3.f; +const float CAMERA_STILL_PAN_Y_RANGE_DEGREES = 120.f; +const float CAMERA_STILL_HEIGHT_VARIANCE = 5.f; +const float CAMERA_STILL_LOOK_AT_HEIGHT = -10.f; + +const float MODEL_X_ONE_PLAYER = 0; +const float MODEL_X_TWO_PLAYERS[NUM_PLAYERS] = { +8, -8 }; +const float MODEL_ROTATIONY_TWO_PLAYERS[NUM_PLAYERS] = { -90, 90 }; + +DancingCharacters::DancingCharacters() +{ + m_bDrawDangerLight = false; + + FOREACH_PlayerNumber( p ) + { + m_pCharacter[p] = new Model; + m_2DIdleTimer[p].SetZero(); + m_i2DAnimState[p] = AS2D_IDLE; // start on idle state + if( !GAMESTATE->IsPlayerEnabled(p) ) + continue; + + Character* pChar = GAMESTATE->m_pCurCharacters[p]; + if( !pChar ) + continue; + + // load in any potential 2D stuff + RString sCharacterDirectory = pChar->m_sCharDir; + RString sCurrentAnim; + sCurrentAnim = sCharacterDirectory + "2DIdle"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgIdle[p].Load( sCurrentAnim ); + m_bgIdle[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DMiss"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgMiss[p].Load( sCurrentAnim ); + m_bgMiss[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DGood"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgGood[p].Load( sCurrentAnim ); + m_bgGood[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DGreat"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgGreat[p].Load( sCurrentAnim ); + m_bgGreat[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DFever"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgFever[p].Load( sCurrentAnim ); + m_bgFever[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DFail"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgFail[p].Load( sCurrentAnim ); + m_bgFail[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DWin"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgWin[p].Load( sCurrentAnim ); + m_bgWin[p]->SetXY(DC_X(p),DC_Y(p)); + } + + sCurrentAnim = sCharacterDirectory + "2DWinFever"; + if( DoesFileExist(sCurrentAnim + "/BGAnimation.ini") ) // check 2D Idle BGAnim exists + { + m_bgWinFever[p].Load( sCurrentAnim ); + m_bgWinFever[p]->SetXY(DC_X(p),DC_Y(p)); + } + + if( pChar->GetModelPath().empty() ) + continue; + + if( GAMESTATE->GetNumPlayersEnabled()==2 ) + m_pCharacter[p]->SetX( MODEL_X_TWO_PLAYERS[p] ); + else + m_pCharacter[p]->SetX( MODEL_X_ONE_PLAYER ); + + switch( GAMESTATE->m_PlayMode ) + { + case PLAY_MODE_BATTLE: + case PLAY_MODE_RAVE: + m_pCharacter[p]->SetRotationY( MODEL_ROTATIONY_TWO_PLAYERS[p] ); + break; + } + + m_pCharacter[p]->LoadMilkshapeAscii( pChar->GetModelPath() ); + m_pCharacter[p]->LoadMilkshapeAsciiBones( "rest", pChar->GetRestAnimationPath() ); + m_pCharacter[p]->LoadMilkshapeAsciiBones( "warmup", pChar->GetWarmUpAnimationPath() ); + m_pCharacter[p]->LoadMilkshapeAsciiBones( "dance", pChar->GetDanceAnimationPath() ); + m_pCharacter[p]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped + + m_pCharacter[p]->RunCommands( pChar->m_cmdInit ); + } +} + +DancingCharacters::~DancingCharacters() +{ + FOREACH_PlayerNumber( p ) + delete m_pCharacter[p]; +} + +void DancingCharacters::LoadNextSong() +{ + // initial camera sweep is still + m_CameraDistance = CAMERA_REST_DISTANCE; + m_CameraPanYStart = 0; + m_CameraPanYEnd = 0; + m_fCameraHeightStart = CAMERA_REST_LOOK_AT_HEIGHT; + m_fCameraHeightEnd = CAMERA_REST_LOOK_AT_HEIGHT; + m_fLookAtHeight = CAMERA_REST_LOOK_AT_HEIGHT; + m_fThisCameraStartBeat = 0; + m_fThisCameraEndBeat = 0; + + ASSERT( GAMESTATE->m_pCurSong ); + m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->m_fFirstBeat; + + FOREACH_PlayerNumber( p ) + if( GAMESTATE->IsPlayerEnabled(p) ) + m_pCharacter[p]->PlayAnimation( "rest" ); +} + +int Neg1OrPos1() { return RandomInt( 2 ) ? -1 : +1; } + +void DancingCharacters::Update( float fDelta ) +{ + if( GAMESTATE->m_bFreeze || GAMESTATE->m_bDelay ) + { + // spin the camera Matrix-style + m_CameraPanYStart += fDelta*40; + m_CameraPanYEnd += fDelta*40; + } + else + { + // make the characters move + float fBPM = GAMESTATE->m_fCurBPS*60; + float fUpdateScale = SCALE( fBPM, 60.f, 300.f, 0.75f, 1.5f ); + CLAMP( fUpdateScale, 0.75f, 1.5f ); + + /* It's OK for the animation to go slower than natural when we're + * at a very low music rate. */ + fUpdateScale *= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; + + FOREACH_PlayerNumber( p ) + { + if( GAMESTATE->IsPlayerEnabled(p) ) + m_pCharacter[p]->Update( fDelta*fUpdateScale ); + } + } + + static bool bWasGameplayStarting = false; + bool bGameplayStarting = GAMESTATE->m_bGameplayLeadIn; + if( !bWasGameplayStarting && bGameplayStarting ) + { + FOREACH_PlayerNumber( p ) + if( GAMESTATE->IsPlayerEnabled(p) ) + m_pCharacter[p]->PlayAnimation( "warmup" ); + } + bWasGameplayStarting = bGameplayStarting; + + static float fLastBeat = GAMESTATE->m_fSongBeat; + float fThisBeat = GAMESTATE->m_fSongBeat; + if( fLastBeat < GAMESTATE->m_pCurSong->m_fFirstBeat && + fThisBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat ) + { + FOREACH_PlayerNumber( p ) + m_pCharacter[p]->PlayAnimation( "dance" ); + } + fLastBeat = fThisBeat; + + // time for a new sweep? + if( GAMESTATE->m_fSongBeat > m_fThisCameraEndBeat ) + { + if( RandomInt(6) >= 4 ) + { + // sweeping camera + m_CameraDistance = CAMERA_SWEEP_DISTANCE + RandomInt(-1,1) * CAMERA_SWEEP_DISTANCE_VARIANCE; + m_CameraPanYStart = m_CameraPanYEnd = RandomInt(-1,1) * CAMERA_SWEEP_PAN_Y_RANGE_DEGREES; + m_fCameraHeightStart = m_fCameraHeightEnd = CAMERA_STILL_LOOK_AT_HEIGHT; + + m_CameraPanYEnd += RandomInt(-1,1) * CAMERA_SWEEP_PAN_Y_VARIANCE_DEGREES; + m_fCameraHeightStart = m_fCameraHeightEnd = m_fCameraHeightStart + RandomInt(-1,1) * CAMERA_SWEEP_HEIGHT_VARIANCE; + + float fCameraHeightVariance = RandomInt(-1,1) * CAMERA_SWEEP_HEIGHT_VARIANCE; + m_fCameraHeightStart -= fCameraHeightVariance; + m_fCameraHeightEnd += fCameraHeightVariance; + + m_fLookAtHeight = CAMERA_SWEEP_LOOK_AT_HEIGHT; + } + else + { + // still camera + m_CameraDistance = CAMERA_STILL_DISTANCE + RandomInt(-1,1) * CAMERA_STILL_DISTANCE_VARIANCE; + m_CameraPanYStart = m_CameraPanYEnd = Neg1OrPos1() * CAMERA_STILL_PAN_Y_RANGE_DEGREES; + m_fCameraHeightStart = m_fCameraHeightEnd = CAMERA_SWEEP_LOOK_AT_HEIGHT + Neg1OrPos1() * CAMERA_STILL_HEIGHT_VARIANCE; + + m_fLookAtHeight = CAMERA_STILL_LOOK_AT_HEIGHT; + } + + int iCurBeat = (int)GAMESTATE->m_fSongBeat; + iCurBeat -= iCurBeat%8; + + m_fThisCameraStartBeat = (float) iCurBeat; + m_fThisCameraEndBeat = float(iCurBeat + 8); + } + /* + // is there any of this still around? This block of code is _ugly_. -Colby + // update any 2D stuff + FOREACH_PlayerNumber( p ) + { + if( m_bgIdle[p].IsLoaded() ) + { + if( m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) + m_bgIdle[p]->Update( fDelta ); + if( m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS ) + m_bgMiss[p]->Update( fDelta ); + if( m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD ) + m_bgGood[p]->Update( fDelta ); + if( m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT ) + m_bgGreat[p]->Update( fDelta ); + if( m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER ) + m_bgFever[p]->Update( fDelta ); + if( m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL ) + m_bgFail[p]->Update( fDelta ); + if( m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN ) + m_bgWin[p]->Update( fDelta ); + if( m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER ) + m_bgWinFever[p]->Update(fDelta); + + if(m_i2DAnimState[p] != AS2D_IDLE) // if we're not in idle state, start a timer to return us to idle + { + // never return to idle state if we have failed / passed (i.e. completed) the song + if(m_i2DAnimState[p] != AS2D_WINFEVER && m_i2DAnimState[p] != AS2D_FAIL && m_i2DAnimState[p] != AS2D_WIN) + { + if(m_2DIdleTimer[p].IsZero()) + m_2DIdleTimer[p].Touch(); + if(!m_2DIdleTimer[p].IsZero() && m_2DIdleTimer[p].Ago() > 1.0f) + { + m_2DIdleTimer[p].SetZero(); + m_i2DAnimState[p] = AS2D_IDLE; + } + } + } + } + } + */ +} + +void DancingCharacters::Change2DAnimState( PlayerNumber pn, int iState ) +{ + ASSERT( pn < NUM_PLAYERS ); + ASSERT( iState < AS2D_MAXSTATES ); + + m_i2DAnimState[pn] = iState; +} + +void DancingCharacters::DrawPrimitives() +{ + DISPLAY->CameraPushMatrix(); + + float fPercentIntoSweep; + if(m_fThisCameraStartBeat == m_fThisCameraEndBeat) + fPercentIntoSweep = 0; + else + fPercentIntoSweep = SCALE(GAMESTATE->m_fSongBeat, m_fThisCameraStartBeat, m_fThisCameraEndBeat, 0.f, 1.f ); + float fCameraPanY = SCALE( fPercentIntoSweep, 0.f, 1.f, m_CameraPanYStart, m_CameraPanYEnd ); + float fCameraHeight = SCALE( fPercentIntoSweep, 0.f, 1.f, m_fCameraHeightStart, m_fCameraHeightEnd ); + + RageVector3 m_CameraPoint( 0, fCameraHeight, -m_CameraDistance ); + RageMatrix CameraRot; + RageMatrixRotationY( &CameraRot, fCameraPanY ); + RageVec3TransformCoord( &m_CameraPoint, &m_CameraPoint, &CameraRot ); + + RageVector3 m_LookAt( 0, m_fLookAtHeight, 0 ); + + DISPLAY->LoadLookAt( 45, + m_CameraPoint, + m_LookAt, + RageVector3(0,1,0) ); + + FOREACH_EnabledPlayer( p ) + { + bool bFailed = STATSMAN->m_CurStageStats.m_player[p].m_bFailed; + bool bDanger = m_bDrawDangerLight; + + DISPLAY->SetLighting( true ); + + RageColor ambient = bFailed ? RageColor(0.2f,0.1f,0.1f,1) : (bDanger ? RageColor(0.4f,0.1f,0.1f,1) : RageColor(0.4f,0.4f,0.4f,1)); + RageColor diffuse = bFailed ? RageColor(0.4f,0.1f,0.1f,1) : (bDanger ? RageColor(0.8f,0.1f,0.1f,1) : RageColor(1,0.95f,0.925f,1)); + RageColor specular = RageColor(0.8f,0.8f,0.8f,1); + DISPLAY->SetLightDirectional( + 0, + ambient, + diffuse, + specular, + RageVector3(-3, -7.5, +9) ); + + if( PREFSMAN->m_bCelShadeModels ) + { + m_pCharacter[p]->DrawCelShaded(); + + DISPLAY->SetLightOff( 0 ); + DISPLAY->SetLighting( false ); + continue; + } + + m_pCharacter[p]->Draw(); + + DISPLAY->SetLightOff( 0 ); + DISPLAY->SetLighting( false ); + } + + DISPLAY->CameraPopMatrix(); + + /* + // Ugly! -Colby + // now draw any potential 2D stuff + FOREACH_PlayerNumber( p ) + { + if(m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE) + m_bgIdle[p]->Draw(); + if(m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS) + m_bgMiss[p]->Draw(); + if(m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD) + m_bgGood[p]->Draw(); + if(m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT) + m_bgGreat[p]->Draw(); + if(m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER) + m_bgFever[p]->Draw(); + if(m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER) + m_bgWinFever[p]->Draw(); + if(m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN) + m_bgWin[p]->Draw(); + if(m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL) + m_bgFail[p]->Draw(); + } + */ +} + +/* + * (c) 2003-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DancingCharacters.h b/src/DancingCharacters.h index d7d67dfc41..4894b51191 100644 --- a/src/DancingCharacters.h +++ b/src/DancingCharacters.h @@ -1,95 +1,95 @@ -#ifndef DancingCharacters_H -#define DancingCharacters_H - -#include "ActorFrame.h" -#include "PlayerNumber.h" -#include "ThemeManager.h" -#include "RageTimer.h" -#include "AutoActor.h" -class Model; - -/** @brief The different animation states for the dancer. */ -enum ANIM_STATES_2D -{ - AS2D_IDLE = 0, /**< The dancer is idle. */ - AS2D_MISS, /**< The dancer just missed a note. */ - AS2D_GOOD, /**< The dancer is doing a good job. */ - AS2D_GREAT, /**< The dancer is doing a great job. */ - AS2D_FEVER, /**< The dancer is on fire! */ - AS2D_FAIL, /**< The dancer has failed. */ - AS2D_WIN, /**< The dancer has won. */ - AS2D_WINFEVER, /**< The dancer has won while on fire. */ - AS2D_IGNORE, /**< This is a special case -- so that we can timer to idle again. */ - AS2D_MAXSTATES /**< A count of the maximum number of states. */ -}; - -/** @brief Characters that react to how the players are doing. */ -class DancingCharacters : public ActorFrame -{ -public: - DancingCharacters(); - virtual ~DancingCharacters(); - - void LoadNextSong(); - - virtual void Update( float fDelta ); - virtual void DrawPrimitives(); - bool m_bDrawDangerLight; - void Change2DAnimState( PlayerNumber pn, int iState ); -protected: - - Model *m_pCharacter[NUM_PLAYERS]; - - /** @brief How far away is the camera from the dancer? */ - float m_CameraDistance; - float m_CameraPanYStart; - float m_CameraPanYEnd; - float m_fLookAtHeight; - float m_fCameraHeightStart; - float m_fCameraHeightEnd; - float m_fThisCameraStartBeat; - float m_fThisCameraEndBeat; - - bool m_bHas2DElements[NUM_PLAYERS]; - - AutoActor m_bgIdle[NUM_PLAYERS]; - AutoActor m_bgMiss[NUM_PLAYERS]; - AutoActor m_bgGood[NUM_PLAYERS]; - AutoActor m_bgGreat[NUM_PLAYERS]; - AutoActor m_bgFever[NUM_PLAYERS]; - AutoActor m_bgFail[NUM_PLAYERS]; - AutoActor m_bgWin[NUM_PLAYERS]; - AutoActor m_bgWinFever[NUM_PLAYERS]; - RageTimer m_2DIdleTimer[NUM_PLAYERS]; - - int m_i2DAnimState[NUM_PLAYERS]; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2003-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef DancingCharacters_H +#define DancingCharacters_H + +#include "ActorFrame.h" +#include "PlayerNumber.h" +#include "ThemeManager.h" +#include "RageTimer.h" +#include "AutoActor.h" +class Model; + +/** @brief The different animation states for the dancer. */ +enum ANIM_STATES_2D +{ + AS2D_IDLE = 0, /**< The dancer is idle. */ + AS2D_MISS, /**< The dancer just missed a note. */ + AS2D_GOOD, /**< The dancer is doing a good job. */ + AS2D_GREAT, /**< The dancer is doing a great job. */ + AS2D_FEVER, /**< The dancer is on fire! */ + AS2D_FAIL, /**< The dancer has failed. */ + AS2D_WIN, /**< The dancer has won. */ + AS2D_WINFEVER, /**< The dancer has won while on fire. */ + AS2D_IGNORE, /**< This is a special case -- so that we can timer to idle again. */ + AS2D_MAXSTATES /**< A count of the maximum number of states. */ +}; + +/** @brief Characters that react to how the players are doing. */ +class DancingCharacters : public ActorFrame +{ +public: + DancingCharacters(); + virtual ~DancingCharacters(); + + void LoadNextSong(); + + virtual void Update( float fDelta ); + virtual void DrawPrimitives(); + bool m_bDrawDangerLight; + void Change2DAnimState( PlayerNumber pn, int iState ); +protected: + + Model *m_pCharacter[NUM_PLAYERS]; + + /** @brief How far away is the camera from the dancer? */ + float m_CameraDistance; + float m_CameraPanYStart; + float m_CameraPanYEnd; + float m_fLookAtHeight; + float m_fCameraHeightStart; + float m_fCameraHeightEnd; + float m_fThisCameraStartBeat; + float m_fThisCameraEndBeat; + + bool m_bHas2DElements[NUM_PLAYERS]; + + AutoActor m_bgIdle[NUM_PLAYERS]; + AutoActor m_bgMiss[NUM_PLAYERS]; + AutoActor m_bgGood[NUM_PLAYERS]; + AutoActor m_bgGreat[NUM_PLAYERS]; + AutoActor m_bgFever[NUM_PLAYERS]; + AutoActor m_bgFail[NUM_PLAYERS]; + AutoActor m_bgWin[NUM_PLAYERS]; + AutoActor m_bgWinFever[NUM_PLAYERS]; + RageTimer m_2DIdleTimer[NUM_PLAYERS]; + + int m_i2DAnimState[NUM_PLAYERS]; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2003-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DateTime.cpp b/src/DateTime.cpp index ba69d02f03..41b7b934ed 100644 --- a/src/DateTime.cpp +++ b/src/DateTime.cpp @@ -1,353 +1,353 @@ -#include "global.h" -#include "DateTime.h" -#include "RageUtil.h" -#include "EnumHelper.h" -#include "LuaManager.h" -#include "LocalizedString.h" - -DateTime::DateTime() -{ - Init(); -} - -void DateTime::Init() -{ - ZERO( *this ); -} - -bool DateTime::operator<( const DateTime& other ) const -{ -#define COMPARE( v ) if(v!=other.v) return v( const DateTime& other ) const -{ -#define COMPARE( v ) if(v!=other.v) return v>other.v; - COMPARE( tm_year ); - COMPARE( tm_mon ); - COMPARE( tm_mday ); - COMPARE( tm_hour ); - COMPARE( tm_min ); - COMPARE( tm_sec ); -#undef COMPARE - // they're equal - return false; -} - -DateTime DateTime::GetNowDateTime() -{ - time_t now = time(NULL); - tm tNow; - localtime_r( &now, &tNow ); - DateTime dtNow; -#define COPY_M( v ) dtNow.v = tNow.v; - COPY_M( tm_year ); - COPY_M( tm_mon ); - COPY_M( tm_mday ); - COPY_M( tm_hour ); - COPY_M( tm_min ); - COPY_M( tm_sec ); -#undef COPY_M - return dtNow; -} - -DateTime DateTime::GetNowDate() -{ - DateTime tNow = GetNowDateTime(); - tNow.StripTime(); - return tNow; -} - -void DateTime::StripTime() -{ - tm_hour = 0; - tm_min = 0; - tm_sec = 0; -} - -// Common SQL/XML format: "YYYY-MM-DD HH:MM:SS" -RString DateTime::GetString() const -{ - RString s = ssprintf( "%d-%02d-%02d", - tm_year+1900, - tm_mon+1, - tm_mday ); - - if( tm_hour != 0 || - tm_min != 0 || - tm_sec != 0 ) - { - s += ssprintf( " %02d:%02d:%02d", - tm_hour, - tm_min, - tm_sec ); - } - - return s; -} - -bool DateTime::FromString( const RString sDateTime ) -{ - Init(); - - int ret; - - ret = sscanf( sDateTime, "%d-%d-%d %d:%d:%d", - &tm_year, - &tm_mon, - &tm_mday, - &tm_hour, - &tm_min, - &tm_sec ); - if( ret == 6 ) - goto success; - - ret = sscanf( sDateTime, "%d-%d-%d", - &tm_year, - &tm_mon, - &tm_mday ); - if( ret == 3 ) - goto success; - - return false; - -success: - tm_year -= 1900; - tm_mon -= 1; - return true; -} - - - -RString DayInYearToString( int iDayInYear ) -{ - return ssprintf("DayInYear%03d",iDayInYear); -} - -int StringToDayInYear( RString sDayInYear ) -{ - int iDayInYear; - if( sscanf( sDayInYear, "DayInYear%d", &iDayInYear ) != 1 ) - return -1; - return iDayInYear; -} - -static const RString LAST_DAYS_NAME[NUM_LAST_DAYS] = -{ - "Today", - "Yesterday", - "Day2Ago", - "Day3Ago", - "Day4Ago", - "Day5Ago", - "Day6Ago", -}; - -RString LastDayToString( int iLastDayIndex ) -{ - return LAST_DAYS_NAME[iLastDayIndex]; -} - -static const char *DAY_OF_WEEK_TO_NAME[DAYS_IN_WEEK] = -{ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", -}; - -RString DayOfWeekToString( int iDayOfWeekIndex ) -{ - return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex]; -} - -RString HourInDayToString( int iHourInDayIndex ) -{ - return ssprintf("Hour%02d", iHourInDayIndex); -} - -static const char *MonthNames[] = -{ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", -}; -XToString( Month ); -XToLocalizedString( Month ); -LuaXType( Month ); - -RString LastWeekToString( int iLastWeekIndex ) -{ - switch( iLastWeekIndex ) - { - case 0: return "ThisWeek"; break; - case 1: return "LastWeek"; break; - default: return ssprintf("Week%02dAgo",iLastWeekIndex); break; - } -} - -RString LastDayToLocalizedString( int iLastDayIndex ) -{ - RString s = LastDayToString( iLastDayIndex ); - s.Replace( "Day", "" ); - s.Replace( "Ago", " Ago" ); - return s; -} - -RString LastWeekToLocalizedString( int iLastWeekIndex ) -{ - RString s = LastWeekToString( iLastWeekIndex ); - s.Replace( "Week", "" ); - s.Replace( "Ago", " Ago" ); - return s; -} - -RString HourInDayToLocalizedString( int iHourIndex ) -{ - int iBeginHour = iHourIndex; - iBeginHour--; - wrap( iBeginHour, 24 ); - iBeginHour++; - - return ssprintf("%02d:00+", iBeginHour ); -} - - -tm AddDays( tm start, int iDaysToMove ) -{ - /* - * This causes problems on OS X, which doesn't correctly handle range that are below - * their normal values (eg. mday = 0). According to the manpage, it should adjust them: - * - * "If structure members are outside their legal interval, they will be normalized (so - * that, e.g., 40 October is changed into 9 November)." - * - * Instead, it appears to simply fail. - * - * Refs: - * http://bugs.php.net/bug.php?id=10686 - * http://sourceforge.net/tracker/download.php?group_id=37892&atid=421366&file_id=79179&aid=91133 - * - * Note "Log starting 2004-03-07 03:50:42"; mday is 7, and PrintCaloriesBurned calls us - * with iDaysToMove = -7, resulting in an out-of-range value 0. This seems legal, but - * OS X chokes on it. - */ -/* start.tm_mday += iDaysToMove; - time_t seconds = mktime( &start ); - ASSERT( seconds != (time_t)-1 ); - */ - - /* This handles DST differently: it returns the time that was exactly n*60*60*24 seconds - * ago, where the above code always returns the same time of day. I prefer the above - * behavior, but I'm not sure that it mattersmatters. */ - time_t seconds = mktime( &start ); - seconds += iDaysToMove*60*60*24; - - tm time; - localtime_r( &seconds, &time ); - return time; -} - -tm GetYesterday( tm start ) -{ - return AddDays( start, -1 ); -} - -int GetDayOfWeek( tm time ) -{ - int iDayOfWeek = time.tm_wday; - ASSERT( iDayOfWeek < DAYS_IN_WEEK ); - return iDayOfWeek; -} - -tm GetNextSunday( tm start ) -{ - return AddDays( start, DAYS_IN_WEEK-GetDayOfWeek(start) ); -} - - -tm GetDayInYearAndYear( int iDayInYearIndex, int iYear ) -{ - /* If iDayInYearIndex is 200, set the date to Jan 200th, and let mktime - * round it. This shouldn't suffer from the OSX mktime() issue described - * above, since we're not giving it negative values. */ - tm when; - ZERO( when ); - when.tm_mon = 0; - when.tm_mday = iDayInYearIndex+1; - when.tm_year = iYear - 1900; - time_t then = mktime( &when ); - - localtime_r( &then, &when ); - return when; -} - -LuaFunction( MonthToString, MonthToString( Enum::Check(L, 1) ) ); -LuaFunction( MonthToLocalizedString, MonthToLocalizedString( Enum::Check(L, 1) ) ); -LuaFunction( MonthOfYear, GetLocalTime().tm_mon ); -LuaFunction( DayOfMonth, GetLocalTime().tm_mday ); -LuaFunction( Hour, GetLocalTime().tm_hour ); -LuaFunction( Minute, GetLocalTime().tm_min ); -LuaFunction( Second, GetLocalTime().tm_sec ); -LuaFunction( Year, GetLocalTime().tm_year+1900 ); -LuaFunction( Weekday, GetLocalTime().tm_wday ); -LuaFunction( DayOfYear, GetLocalTime().tm_yday ); - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DateTime.h" +#include "RageUtil.h" +#include "EnumHelper.h" +#include "LuaManager.h" +#include "LocalizedString.h" + +DateTime::DateTime() +{ + Init(); +} + +void DateTime::Init() +{ + ZERO( *this ); +} + +bool DateTime::operator<( const DateTime& other ) const +{ +#define COMPARE( v ) if(v!=other.v) return v( const DateTime& other ) const +{ +#define COMPARE( v ) if(v!=other.v) return v>other.v; + COMPARE( tm_year ); + COMPARE( tm_mon ); + COMPARE( tm_mday ); + COMPARE( tm_hour ); + COMPARE( tm_min ); + COMPARE( tm_sec ); +#undef COMPARE + // they're equal + return false; +} + +DateTime DateTime::GetNowDateTime() +{ + time_t now = time(NULL); + tm tNow; + localtime_r( &now, &tNow ); + DateTime dtNow; +#define COPY_M( v ) dtNow.v = tNow.v; + COPY_M( tm_year ); + COPY_M( tm_mon ); + COPY_M( tm_mday ); + COPY_M( tm_hour ); + COPY_M( tm_min ); + COPY_M( tm_sec ); +#undef COPY_M + return dtNow; +} + +DateTime DateTime::GetNowDate() +{ + DateTime tNow = GetNowDateTime(); + tNow.StripTime(); + return tNow; +} + +void DateTime::StripTime() +{ + tm_hour = 0; + tm_min = 0; + tm_sec = 0; +} + +// Common SQL/XML format: "YYYY-MM-DD HH:MM:SS" +RString DateTime::GetString() const +{ + RString s = ssprintf( "%d-%02d-%02d", + tm_year+1900, + tm_mon+1, + tm_mday ); + + if( tm_hour != 0 || + tm_min != 0 || + tm_sec != 0 ) + { + s += ssprintf( " %02d:%02d:%02d", + tm_hour, + tm_min, + tm_sec ); + } + + return s; +} + +bool DateTime::FromString( const RString sDateTime ) +{ + Init(); + + int ret; + + ret = sscanf( sDateTime, "%d-%d-%d %d:%d:%d", + &tm_year, + &tm_mon, + &tm_mday, + &tm_hour, + &tm_min, + &tm_sec ); + if( ret == 6 ) + goto success; + + ret = sscanf( sDateTime, "%d-%d-%d", + &tm_year, + &tm_mon, + &tm_mday ); + if( ret == 3 ) + goto success; + + return false; + +success: + tm_year -= 1900; + tm_mon -= 1; + return true; +} + + + +RString DayInYearToString( int iDayInYear ) +{ + return ssprintf("DayInYear%03d",iDayInYear); +} + +int StringToDayInYear( RString sDayInYear ) +{ + int iDayInYear; + if( sscanf( sDayInYear, "DayInYear%d", &iDayInYear ) != 1 ) + return -1; + return iDayInYear; +} + +static const RString LAST_DAYS_NAME[NUM_LAST_DAYS] = +{ + "Today", + "Yesterday", + "Day2Ago", + "Day3Ago", + "Day4Ago", + "Day5Ago", + "Day6Ago", +}; + +RString LastDayToString( int iLastDayIndex ) +{ + return LAST_DAYS_NAME[iLastDayIndex]; +} + +static const char *DAY_OF_WEEK_TO_NAME[DAYS_IN_WEEK] = +{ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", +}; + +RString DayOfWeekToString( int iDayOfWeekIndex ) +{ + return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex]; +} + +RString HourInDayToString( int iHourInDayIndex ) +{ + return ssprintf("Hour%02d", iHourInDayIndex); +} + +static const char *MonthNames[] = +{ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +}; +XToString( Month ); +XToLocalizedString( Month ); +LuaXType( Month ); + +RString LastWeekToString( int iLastWeekIndex ) +{ + switch( iLastWeekIndex ) + { + case 0: return "ThisWeek"; break; + case 1: return "LastWeek"; break; + default: return ssprintf("Week%02dAgo",iLastWeekIndex); break; + } +} + +RString LastDayToLocalizedString( int iLastDayIndex ) +{ + RString s = LastDayToString( iLastDayIndex ); + s.Replace( "Day", "" ); + s.Replace( "Ago", " Ago" ); + return s; +} + +RString LastWeekToLocalizedString( int iLastWeekIndex ) +{ + RString s = LastWeekToString( iLastWeekIndex ); + s.Replace( "Week", "" ); + s.Replace( "Ago", " Ago" ); + return s; +} + +RString HourInDayToLocalizedString( int iHourIndex ) +{ + int iBeginHour = iHourIndex; + iBeginHour--; + wrap( iBeginHour, 24 ); + iBeginHour++; + + return ssprintf("%02d:00+", iBeginHour ); +} + + +tm AddDays( tm start, int iDaysToMove ) +{ + /* + * This causes problems on OS X, which doesn't correctly handle range that are below + * their normal values (eg. mday = 0). According to the manpage, it should adjust them: + * + * "If structure members are outside their legal interval, they will be normalized (so + * that, e.g., 40 October is changed into 9 November)." + * + * Instead, it appears to simply fail. + * + * Refs: + * http://bugs.php.net/bug.php?id=10686 + * http://sourceforge.net/tracker/download.php?group_id=37892&atid=421366&file_id=79179&aid=91133 + * + * Note "Log starting 2004-03-07 03:50:42"; mday is 7, and PrintCaloriesBurned calls us + * with iDaysToMove = -7, resulting in an out-of-range value 0. This seems legal, but + * OS X chokes on it. + */ +/* start.tm_mday += iDaysToMove; + time_t seconds = mktime( &start ); + ASSERT( seconds != (time_t)-1 ); + */ + + /* This handles DST differently: it returns the time that was exactly n*60*60*24 seconds + * ago, where the above code always returns the same time of day. I prefer the above + * behavior, but I'm not sure that it mattersmatters. */ + time_t seconds = mktime( &start ); + seconds += iDaysToMove*60*60*24; + + tm time; + localtime_r( &seconds, &time ); + return time; +} + +tm GetYesterday( tm start ) +{ + return AddDays( start, -1 ); +} + +int GetDayOfWeek( tm time ) +{ + int iDayOfWeek = time.tm_wday; + ASSERT( iDayOfWeek < DAYS_IN_WEEK ); + return iDayOfWeek; +} + +tm GetNextSunday( tm start ) +{ + return AddDays( start, DAYS_IN_WEEK-GetDayOfWeek(start) ); +} + + +tm GetDayInYearAndYear( int iDayInYearIndex, int iYear ) +{ + /* If iDayInYearIndex is 200, set the date to Jan 200th, and let mktime + * round it. This shouldn't suffer from the OSX mktime() issue described + * above, since we're not giving it negative values. */ + tm when; + ZERO( when ); + when.tm_mon = 0; + when.tm_mday = iDayInYearIndex+1; + when.tm_year = iYear - 1900; + time_t then = mktime( &when ); + + localtime_r( &then, &when ); + return when; +} + +LuaFunction( MonthToString, MonthToString( Enum::Check(L, 1) ) ); +LuaFunction( MonthToLocalizedString, MonthToLocalizedString( Enum::Check(L, 1) ) ); +LuaFunction( MonthOfYear, GetLocalTime().tm_mon ); +LuaFunction( DayOfMonth, GetLocalTime().tm_mday ); +LuaFunction( Hour, GetLocalTime().tm_hour ); +LuaFunction( Minute, GetLocalTime().tm_min ); +LuaFunction( Second, GetLocalTime().tm_sec ); +LuaFunction( Year, GetLocalTime().tm_year+1900 ); +LuaFunction( Weekday, GetLocalTime().tm_wday ); +LuaFunction( DayOfYear, GetLocalTime().tm_yday ); + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DateTime.h b/src/DateTime.h index ced767d92c..58f2cbe6ff 100644 --- a/src/DateTime.h +++ b/src/DateTime.h @@ -1,177 +1,177 @@ -#ifndef DATE_TIME_H -#define DATE_TIME_H - -#include "EnumHelper.h" -#include - -/** @brief The number of days we check for previously. */ -const int NUM_LAST_DAYS = 7; -/** @brief The number of weeks we check for previously. */ -const int NUM_LAST_WEEKS = 52; -/** - * @brief The number of days that are in a year. - * - * This is set up to be a maximum for leap years. */ -const int DAYS_IN_YEAR = 366; -/** - * @brief The number of hours in a day. */ -const int HOURS_IN_DAY = 24; -/** - * @brief The number of days that are in a week. */ -const int DAYS_IN_WEEK = 7; -/** @brief Which month are we focusing on? - * - * Is there any reason why the actual months aren't defined - * in here? -Wolfman2000 */ -enum Month -{ - NUM_Month = 12, /**< The number of months in the year. */ - Month_Invalid /**< There should be no month at this point. */ -}; - -RString DayInYearToString( int iDayInYearIndex ); -RString LastDayToString( int iLastDayIndex ); -RString LastDayToLocalizedString( int iLastDayIndex ); -RString DayOfWeekToString( int iDayOfWeekIndex ); -RString DayOfWeekToLocalizedString( int iDayOfWeekIndex ); -RString HourInDayToString( int iHourIndex ); -RString HourInDayToLocalizedString( int iHourIndex ); -const RString &MonthToString( Month month ); -const RString &MonthToLocalizedString( Month month ); -RString LastWeekToString( int iLastWeekIndex ); -RString LastWeekToLocalizedString( int iLastWeekIndex ); -LuaDeclareType( Month ); - -tm AddDays( tm start, int iDaysToMove ); -tm GetYesterday( tm start ); -int GetDayOfWeek( tm time ); -tm GetNextSunday( tm start ); - -tm GetDayInYearAndYear( int iDayInYearIndex, int iYear ); - -/** @brief A standard way of determining the date and the time. */ -struct DateTime -{ - /** - * @brief The number of seconds after the minute. - * - * Valid values are [0, 59]. */ - int tm_sec; - /** - * @brief The number of minutes after the hour. - * - * Valid values are [0, 59]. */ - int tm_min; - /** - * @brief The number of hours since midnight (or 0000 hours). - * - * Valid values are [0, 23]. */ - int tm_hour; - /** - * @brief The specified day of the current month. - * - * Valid values are [1, 31]. - * - * XXX: Is it possible to set an illegal date through here, - * such as day 30 of February? -Wolfman2000 */ - int tm_mday; - /** - * @brief The number of months since January. - * - * Valid values are [0, 11]. */ - int tm_mon; - /** @brief The number of years since the year 1900. */ - int tm_year; - - /** @brief Set up a default date and time. */ - DateTime(); - /** @brief Initialize the date and time. */ - void Init(); - - /** - * @brief Determine if this DateTime is less than some other time. - * @param other the other DateTime to check. - * @return true if this is less than the other time, or false otherwise. */ - bool operator<( const DateTime& other ) const; - /** - * @brief Determine if this DateTime is greater than some other time. - * @param other the other DateTime to check. - * @return true if this is greater than the other time, or false otherwise. */ - bool operator>( const DateTime& other ) const; - /** - * @brief Determine if this DateTime is equal to some other time. - * @param other the other DateTime to check. - * @return true if this is equal to the other time, or false otherwise. */ - bool operator==( const DateTime& other ) const; - /** - * @brief Determine if this DateTime is not equal to some other time. - * @param other the other DateTime to check. - * @return true if this is not equal to the other time, or false otherwise. */ - bool operator!=( const DateTime& other ) const { return !operator==(other); } - /** - * @brief Determine if this DateTime is less than or equal to some other time. - * @param other the other DateTime to check. - * @return true if this is less than or equal to the other time, or false otherwise. */ - bool operator<=( const DateTime& other ) const { return !operator>(other); } - - /** - * @brief Determine if this DateTime is greater than or equal to some other time. - * @param other the other DateTime to check. - * @return true if this is greater than or equal to the other time, or false otherwise. */ - bool operator>=( const DateTime& other ) const { return !operator<(other); } - - /** - * @brief Retrieve the current date and time. - * @return the current date and time. */ - static DateTime GetNowDateTime(); - /** - * @brief Retrieve the current date. - * @return the current date. */ - static DateTime GetNowDate(); - - /** @brief Remove the time portion from the date. */ - void StripTime(); - - /** - * @brief Retrieve a string representation of the current date and time. - * - * This returns a common SQL/XML format: "YYYY-MM-DD HH:MM:SS". - * @return the string representation of the date and time. */ - RString GetString() const; - /** - * @brief Attempt to turn a string into a DateTime. - * - * As a warning for the squeamish, this code uses the goto keyword. - * @param sDateTime the string to attempt to convert. - * @return true if the conversion worked, or false otherwise. */ - bool FromString( const RString sDateTime ); -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef DATE_TIME_H +#define DATE_TIME_H + +#include "EnumHelper.h" +#include + +/** @brief The number of days we check for previously. */ +const int NUM_LAST_DAYS = 7; +/** @brief The number of weeks we check for previously. */ +const int NUM_LAST_WEEKS = 52; +/** + * @brief The number of days that are in a year. + * + * This is set up to be a maximum for leap years. */ +const int DAYS_IN_YEAR = 366; +/** + * @brief The number of hours in a day. */ +const int HOURS_IN_DAY = 24; +/** + * @brief The number of days that are in a week. */ +const int DAYS_IN_WEEK = 7; +/** @brief Which month are we focusing on? + * + * Is there any reason why the actual months aren't defined + * in here? -Wolfman2000 */ +enum Month +{ + NUM_Month = 12, /**< The number of months in the year. */ + Month_Invalid /**< There should be no month at this point. */ +}; + +RString DayInYearToString( int iDayInYearIndex ); +RString LastDayToString( int iLastDayIndex ); +RString LastDayToLocalizedString( int iLastDayIndex ); +RString DayOfWeekToString( int iDayOfWeekIndex ); +RString DayOfWeekToLocalizedString( int iDayOfWeekIndex ); +RString HourInDayToString( int iHourIndex ); +RString HourInDayToLocalizedString( int iHourIndex ); +const RString &MonthToString( Month month ); +const RString &MonthToLocalizedString( Month month ); +RString LastWeekToString( int iLastWeekIndex ); +RString LastWeekToLocalizedString( int iLastWeekIndex ); +LuaDeclareType( Month ); + +tm AddDays( tm start, int iDaysToMove ); +tm GetYesterday( tm start ); +int GetDayOfWeek( tm time ); +tm GetNextSunday( tm start ); + +tm GetDayInYearAndYear( int iDayInYearIndex, int iYear ); + +/** @brief A standard way of determining the date and the time. */ +struct DateTime +{ + /** + * @brief The number of seconds after the minute. + * + * Valid values are [0, 59]. */ + int tm_sec; + /** + * @brief The number of minutes after the hour. + * + * Valid values are [0, 59]. */ + int tm_min; + /** + * @brief The number of hours since midnight (or 0000 hours). + * + * Valid values are [0, 23]. */ + int tm_hour; + /** + * @brief The specified day of the current month. + * + * Valid values are [1, 31]. + * + * XXX: Is it possible to set an illegal date through here, + * such as day 30 of February? -Wolfman2000 */ + int tm_mday; + /** + * @brief The number of months since January. + * + * Valid values are [0, 11]. */ + int tm_mon; + /** @brief The number of years since the year 1900. */ + int tm_year; + + /** @brief Set up a default date and time. */ + DateTime(); + /** @brief Initialize the date and time. */ + void Init(); + + /** + * @brief Determine if this DateTime is less than some other time. + * @param other the other DateTime to check. + * @return true if this is less than the other time, or false otherwise. */ + bool operator<( const DateTime& other ) const; + /** + * @brief Determine if this DateTime is greater than some other time. + * @param other the other DateTime to check. + * @return true if this is greater than the other time, or false otherwise. */ + bool operator>( const DateTime& other ) const; + /** + * @brief Determine if this DateTime is equal to some other time. + * @param other the other DateTime to check. + * @return true if this is equal to the other time, or false otherwise. */ + bool operator==( const DateTime& other ) const; + /** + * @brief Determine if this DateTime is not equal to some other time. + * @param other the other DateTime to check. + * @return true if this is not equal to the other time, or false otherwise. */ + bool operator!=( const DateTime& other ) const { return !operator==(other); } + /** + * @brief Determine if this DateTime is less than or equal to some other time. + * @param other the other DateTime to check. + * @return true if this is less than or equal to the other time, or false otherwise. */ + bool operator<=( const DateTime& other ) const { return !operator>(other); } + + /** + * @brief Determine if this DateTime is greater than or equal to some other time. + * @param other the other DateTime to check. + * @return true if this is greater than or equal to the other time, or false otherwise. */ + bool operator>=( const DateTime& other ) const { return !operator<(other); } + + /** + * @brief Retrieve the current date and time. + * @return the current date and time. */ + static DateTime GetNowDateTime(); + /** + * @brief Retrieve the current date. + * @return the current date. */ + static DateTime GetNowDate(); + + /** @brief Remove the time portion from the date. */ + void StripTime(); + + /** + * @brief Retrieve a string representation of the current date and time. + * + * This returns a common SQL/XML format: "YYYY-MM-DD HH:MM:SS". + * @return the string representation of the date and time. */ + RString GetString() const; + /** + * @brief Attempt to turn a string into a DateTime. + * + * As a warning for the squeamish, this code uses the goto keyword. + * @param sDateTime the string to attempt to convert. + * @return true if the conversion worked, or false otherwise. */ + bool FromString( const RString sDateTime ); +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Difficulty.cpp b/src/Difficulty.cpp index 1fc675b7db..9e64fe665b 100644 --- a/src/Difficulty.cpp +++ b/src/Difficulty.cpp @@ -1,192 +1,192 @@ -#include "global.h" -#include "Difficulty.h" -#include "GameState.h" -#include "ThemeMetric.h" -#include "LuaManager.h" -#include "LocalizedString.h" -#include "GameConstantsAndTypes.h" -#include "GameManager.h" -#include "Steps.h" -#include "Trail.h" - -static const char *DifficultyNames[] = { - "Beginner", - "Easy", - "Medium", - "Hard", - "Challenge", - "Edit", -}; -XToString( Difficulty ); -StringToX( Difficulty ); -LuaXType( Difficulty ); - -/* We prefer the above names; recognize a number of others, too. (They'll get - * normalized when written to SMs, etc.) TODO: Format specific hacks should be - * moved into the file loader for that format. We don't want to carry these - * hacks forward to file formats that don't need them. */ -Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ) -{ - RString s2 = sDC; - s2.MakeLower(); - if( s2 == "beginner" ) return Difficulty_Beginner; - else if( s2 == "easy" ) return Difficulty_Easy; - else if( s2 == "basic" ) return Difficulty_Easy; - else if( s2 == "light" ) return Difficulty_Easy; - else if( s2 == "medium" ) return Difficulty_Medium; - else if( s2 == "another" ) return Difficulty_Medium; - else if( s2 == "trick" ) return Difficulty_Medium; - else if( s2 == "standard" ) return Difficulty_Medium; - else if( s2 == "difficult") return Difficulty_Medium; - else if( s2 == "hard" ) return Difficulty_Hard; - else if( s2 == "ssr" ) return Difficulty_Hard; - else if( s2 == "maniac" ) return Difficulty_Hard; - else if( s2 == "heavy" ) return Difficulty_Hard; - else if( s2 == "smaniac" ) return Difficulty_Challenge; - else if( s2 == "challenge" ) return Difficulty_Challenge; - else if( s2 == "expert" ) return Difficulty_Challenge; - else if( s2 == "oni" ) return Difficulty_Challenge; - else if( s2 == "edit" ) return Difficulty_Edit; - else return Difficulty_Invalid; -} - -const RString &CourseDifficultyToLocalizedString( CourseDifficulty x ) -{ - static auto_ptr g_CourseDifficultyName[NUM_Difficulty]; - if( g_CourseDifficultyName[0].get() == NULL ) - { - FOREACH_ENUM( Difficulty,i) - { - auto_ptr ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) ); - g_CourseDifficultyName[i] = ap; - } - } - return g_CourseDifficultyName[x]->GetValue(); -} - -LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString(Enum::Check(L, 1)) ); - -CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd ) -{ - for( CourseDifficulty d=(CourseDifficulty)(cd+1); dIsCourseDifficultyShown(d) ) - return d; - } - return Difficulty_Invalid; -} - -static ThemeMetric NAMES("CustomDifficulty","Names"); - -RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct ) -{ - /* XXX GAMEMAN->GetStepsTypeInfo( StepsType_Invalid ) will crash. I'm not - * sure what the correct behavior in this case should be. Should we still - * allow custom difficulties? Why do we not allow custom difficulties for - * Couple, Routine, or Edit? - Steve */ - // CustomDifficulty for Edit defeats the purpose of the edit's name. - // I don't know the other two. -aj - if( st == StepsType_Invalid ) - { - /* This is not totally necessary since DifficultyToString() will - * return "", but the comment there says that the caller should - * really be checking for invalid values. */ - if( dc == Difficulty_Invalid ) - return RString(); - return DifficultyToString( dc ); - } - - const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st ); - - switch( sti.m_StepsTypeCategory ) - { - DEFAULT_FAIL(sti.m_StepsTypeCategory); - case StepsTypeCategory_Single: - case StepsTypeCategory_Double: - if( dc == Difficulty_Edit ) - { - return "Edit"; - } - else - { - // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting - vector vsNames; - split( NAMES, ",", vsNames ); - FOREACH( RString, vsNames, sName ) - { - ThemeMetric STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType"); - if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match - { - ThemeMetric DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty"); - if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match - { - ThemeMetric COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType"); - if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match - { - ThemeMetric STRING("CustomDifficulty",(*sName)+"String"); - return STRING.GetValue(); - } - } - } - } - // no matching CustomDifficulty, so use a regular difficulty name - if( dc == Difficulty_Invalid ) - return RString(); - return DifficultyToString( dc ); - } - case StepsTypeCategory_Couple: - return "Couple"; - case StepsTypeCategory_Routine: - return "Routine"; - } -} - -LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check(L,1), Enum::Check(L, 2), Enum::Check(L, 3, true)) ); - -RString CustomDifficultyToLocalizedString( const RString &sCustomDifficulty ) -{ - return THEME->GetString( "CustomDifficulty", sCustomDifficulty ); -} - -LuaFunction( CustomDifficultyToLocalizedString, CustomDifficultyToLocalizedString(SArg(1)) ); - - -RString StepsToCustomDifficulty( const Steps *pSteps ) -{ - return GetCustomDifficulty( pSteps->m_StepsType, pSteps->GetDifficulty(), CourseType_Invalid ); -} - -RString TrailToCustomDifficulty( const Trail *pTrail ) -{ - return GetCustomDifficulty( pTrail->m_StepsType, pTrail->m_CourseDifficulty, pTrail->m_CourseType ); -} - -#include "LuaBinding.h" - -LuaFunction( StepsToCustomDifficulty, StepsToCustomDifficulty(Luna::check(L, 1)) ); -LuaFunction( TrailToCustomDifficulty, TrailToCustomDifficulty(Luna::check(L, 1)) ); - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Difficulty.h" +#include "GameState.h" +#include "ThemeMetric.h" +#include "LuaManager.h" +#include "LocalizedString.h" +#include "GameConstantsAndTypes.h" +#include "GameManager.h" +#include "Steps.h" +#include "Trail.h" + +static const char *DifficultyNames[] = { + "Beginner", + "Easy", + "Medium", + "Hard", + "Challenge", + "Edit", +}; +XToString( Difficulty ); +StringToX( Difficulty ); +LuaXType( Difficulty ); + +/* We prefer the above names; recognize a number of others, too. (They'll get + * normalized when written to SMs, etc.) TODO: Format specific hacks should be + * moved into the file loader for that format. We don't want to carry these + * hacks forward to file formats that don't need them. */ +Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ) +{ + RString s2 = sDC; + s2.MakeLower(); + if( s2 == "beginner" ) return Difficulty_Beginner; + else if( s2 == "easy" ) return Difficulty_Easy; + else if( s2 == "basic" ) return Difficulty_Easy; + else if( s2 == "light" ) return Difficulty_Easy; + else if( s2 == "medium" ) return Difficulty_Medium; + else if( s2 == "another" ) return Difficulty_Medium; + else if( s2 == "trick" ) return Difficulty_Medium; + else if( s2 == "standard" ) return Difficulty_Medium; + else if( s2 == "difficult") return Difficulty_Medium; + else if( s2 == "hard" ) return Difficulty_Hard; + else if( s2 == "ssr" ) return Difficulty_Hard; + else if( s2 == "maniac" ) return Difficulty_Hard; + else if( s2 == "heavy" ) return Difficulty_Hard; + else if( s2 == "smaniac" ) return Difficulty_Challenge; + else if( s2 == "challenge" ) return Difficulty_Challenge; + else if( s2 == "expert" ) return Difficulty_Challenge; + else if( s2 == "oni" ) return Difficulty_Challenge; + else if( s2 == "edit" ) return Difficulty_Edit; + else return Difficulty_Invalid; +} + +const RString &CourseDifficultyToLocalizedString( CourseDifficulty x ) +{ + static auto_ptr g_CourseDifficultyName[NUM_Difficulty]; + if( g_CourseDifficultyName[0].get() == NULL ) + { + FOREACH_ENUM( Difficulty,i) + { + auto_ptr ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) ); + g_CourseDifficultyName[i] = ap; + } + } + return g_CourseDifficultyName[x]->GetValue(); +} + +LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString(Enum::Check(L, 1)) ); + +CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd ) +{ + for( CourseDifficulty d=(CourseDifficulty)(cd+1); dIsCourseDifficultyShown(d) ) + return d; + } + return Difficulty_Invalid; +} + +static ThemeMetric NAMES("CustomDifficulty","Names"); + +RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct ) +{ + /* XXX GAMEMAN->GetStepsTypeInfo( StepsType_Invalid ) will crash. I'm not + * sure what the correct behavior in this case should be. Should we still + * allow custom difficulties? Why do we not allow custom difficulties for + * Couple, Routine, or Edit? - Steve */ + // CustomDifficulty for Edit defeats the purpose of the edit's name. + // I don't know the other two. -aj + if( st == StepsType_Invalid ) + { + /* This is not totally necessary since DifficultyToString() will + * return "", but the comment there says that the caller should + * really be checking for invalid values. */ + if( dc == Difficulty_Invalid ) + return RString(); + return DifficultyToString( dc ); + } + + const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st ); + + switch( sti.m_StepsTypeCategory ) + { + DEFAULT_FAIL(sti.m_StepsTypeCategory); + case StepsTypeCategory_Single: + case StepsTypeCategory_Double: + if( dc == Difficulty_Edit ) + { + return "Edit"; + } + else + { + // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting + vector vsNames; + split( NAMES, ",", vsNames ); + FOREACH( RString, vsNames, sName ) + { + ThemeMetric STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType"); + if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match + { + ThemeMetric DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty"); + if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match + { + ThemeMetric COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType"); + if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match + { + ThemeMetric STRING("CustomDifficulty",(*sName)+"String"); + return STRING.GetValue(); + } + } + } + } + // no matching CustomDifficulty, so use a regular difficulty name + if( dc == Difficulty_Invalid ) + return RString(); + return DifficultyToString( dc ); + } + case StepsTypeCategory_Couple: + return "Couple"; + case StepsTypeCategory_Routine: + return "Routine"; + } +} + +LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check(L,1), Enum::Check(L, 2), Enum::Check(L, 3, true)) ); + +RString CustomDifficultyToLocalizedString( const RString &sCustomDifficulty ) +{ + return THEME->GetString( "CustomDifficulty", sCustomDifficulty ); +} + +LuaFunction( CustomDifficultyToLocalizedString, CustomDifficultyToLocalizedString(SArg(1)) ); + + +RString StepsToCustomDifficulty( const Steps *pSteps ) +{ + return GetCustomDifficulty( pSteps->m_StepsType, pSteps->GetDifficulty(), CourseType_Invalid ); +} + +RString TrailToCustomDifficulty( const Trail *pTrail ) +{ + return GetCustomDifficulty( pTrail->m_StepsType, pTrail->m_CourseDifficulty, pTrail->m_CourseType ); +} + +#include "LuaBinding.h" + +LuaFunction( StepsToCustomDifficulty, StepsToCustomDifficulty(Luna::check(L, 1)) ); +LuaFunction( TrailToCustomDifficulty, TrailToCustomDifficulty(Luna::check(L, 1)) ); + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Difficulty.h b/src/Difficulty.h index 63840eb1d9..48b97a6006 100644 --- a/src/Difficulty.h +++ b/src/Difficulty.h @@ -1,70 +1,70 @@ -#ifndef DIFFICULTY_H -#define DIFFICULTY_H - -#include "EnumHelper.h" -#include "GameConstantsAndTypes.h" -class Steps; -class Trail; - -// Player number stuff -enum Difficulty -{ - Difficulty_Beginner, - Difficulty_Easy, - Difficulty_Medium, - Difficulty_Hard, - Difficulty_Challenge, - Difficulty_Edit, - NUM_Difficulty, - Difficulty_Invalid -}; -const RString& DifficultyToString( Difficulty dc ); -Difficulty StringToDifficulty( const RString& sDC ); -LuaDeclareType( Difficulty ); - -Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ); - -typedef Difficulty CourseDifficulty; -const int NUM_CourseDifficulty = NUM_Difficulty; -/** @brief Loop through the shown course difficulties. */ -#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) ) - -const RString& CourseDifficultyToLocalizedString( Difficulty dc ); - -Difficulty GetNextShownCourseDifficulty( Difficulty pn ); - - -// CustomDifficulty is a themeable difficulty name based on Difficulty, string matching on StepsType, and CourseType. -// It is used to look up localized strings and look up colors. -RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct ); -RString CustomDifficultyToLocalizedString( const RString &sCustomDifficulty ); -RString StepsToCustomDifficulty( const Steps *pSteps ); -RString TrailToCustomDifficulty( const Trail *pTrail ); - - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef DIFFICULTY_H +#define DIFFICULTY_H + +#include "EnumHelper.h" +#include "GameConstantsAndTypes.h" +class Steps; +class Trail; + +// Player number stuff +enum Difficulty +{ + Difficulty_Beginner, + Difficulty_Easy, + Difficulty_Medium, + Difficulty_Hard, + Difficulty_Challenge, + Difficulty_Edit, + NUM_Difficulty, + Difficulty_Invalid +}; +const RString& DifficultyToString( Difficulty dc ); +Difficulty StringToDifficulty( const RString& sDC ); +LuaDeclareType( Difficulty ); + +Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ); + +typedef Difficulty CourseDifficulty; +const int NUM_CourseDifficulty = NUM_Difficulty; +/** @brief Loop through the shown course difficulties. */ +#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) ) + +const RString& CourseDifficultyToLocalizedString( Difficulty dc ); + +Difficulty GetNextShownCourseDifficulty( Difficulty pn ); + + +// CustomDifficulty is a themeable difficulty name based on Difficulty, string matching on StepsType, and CourseType. +// It is used to look up localized strings and look up colors. +RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct ); +RString CustomDifficultyToLocalizedString( const RString &sCustomDifficulty ); +RString StepsToCustomDifficulty( const Steps *pSteps ); +RString TrailToCustomDifficulty( const Trail *pTrail ); + + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DifficultyIcon.cpp b/src/DifficultyIcon.cpp index 3a7439b45d..26f30287d7 100644 --- a/src/DifficultyIcon.cpp +++ b/src/DifficultyIcon.cpp @@ -1,168 +1,168 @@ -#include "global.h" -#include "DifficultyIcon.h" -#include "RageUtil.h" -#include "GameConstantsAndTypes.h" -#include "RageLog.h" -#include "Steps.h" -#include "GameState.h" -#include "RageDisplay.h" -#include "arch/Dialog/Dialog.h" -#include "Trail.h" -#include "ActorUtil.h" -#include "XmlFile.h" -#include "LuaManager.h" - -REGISTER_ACTOR_CLASS(DifficultyIcon); - -DifficultyIcon::DifficultyIcon() -{ - m_bBlank = false; - m_PlayerNumber = PLAYER_1; -} - -bool DifficultyIcon::Load( RString sPath ) -{ - Sprite::Load( sPath ); - int iStates = GetNumStates(); - bool bWarn = iStates != NUM_Difficulty && iStates != NUM_Difficulty*2; - if( sPath.find("_blank") != string::npos ) - bWarn = false; - if( bWarn ) - { - RString sError = ssprintf( - "The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.", - sPath.c_str(), - NUM_Difficulty, - NUM_Difficulty*2, - iStates ); - Dialog::OK( sError ); - } - StopAnimating(); - return true; -} - -void DifficultyIcon::LoadFromNode( const XNode* pNode ) -{ - RString sFile; - if( !ActorUtil::GetAttrPath(pNode, "File", sFile) ) - RageException::Throw( "%s: DifficultyIcon: missing the \"File\" attribute.", ActorUtil::GetWhere(pNode).c_str() ); - - Load( sFile ); - - // skip Sprite::LoadFromNode - Actor::LoadFromNode( pNode ); -} - -void DifficultyIcon::SetPlayer( PlayerNumber pn ) -{ - m_PlayerNumber = pn; -} - -void DifficultyIcon::SetFromSteps( PlayerNumber pn, const Steps* pSteps ) -{ - SetPlayer( pn ); - if( pSteps == NULL ) - Unset(); - else - SetFromDifficulty( pSteps->GetDifficulty() ); -} - -void DifficultyIcon::SetFromTrail( PlayerNumber pn, const Trail* pTrail ) -{ - SetPlayer( pn ); - if( pTrail == NULL ) - Unset(); - else - SetFromDifficulty( pTrail->m_CourseDifficulty ); -} - -void DifficultyIcon::Unset() -{ - m_bBlank = true; -} - -void DifficultyIcon::SetFromDifficulty( Difficulty dc ) -{ - m_bBlank = false; - switch( GetNumStates() ) - { - case NUM_Difficulty: SetState( dc ); break; - case NUM_Difficulty*2: SetState( dc*2+m_PlayerNumber ); break; - default: m_bBlank = true; break; - } -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the DifficultyIcon. */ -class LunaDifficultyIcon: public Luna -{ -public: - static int SetFromSteps( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) - { - p->Unset(); - } - else - { - Steps *pS = Luna::check(L,1); - p->SetFromSteps( PLAYER_1, pS ); - } - return 0; - } - static int SetFromTrail( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) - { - p->Unset(); - } - else - { - Trail *pT = Luna::check(L,1); - p->SetFromTrail( PLAYER_1, pT ); - } - return 0; - } - static int Unset( T* p, lua_State *L ) { p->Unset(); return 0; } - static int SetPlayer( T* p, lua_State *L ) { p->SetPlayer( Enum::Check(L, 1) ); return 0; } - static int SetFromDifficulty( T* p, lua_State *L ) { p->SetFromDifficulty( Enum::Check(L, 1) ); return 0; } - - LunaDifficultyIcon() - { - ADD_METHOD( Unset ); - ADD_METHOD( SetPlayer ); - ADD_METHOD( SetFromSteps ); - ADD_METHOD( SetFromTrail ); - ADD_METHOD( SetFromDifficulty ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( DifficultyIcon, Sprite ) -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DifficultyIcon.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "RageLog.h" +#include "Steps.h" +#include "GameState.h" +#include "RageDisplay.h" +#include "arch/Dialog/Dialog.h" +#include "Trail.h" +#include "ActorUtil.h" +#include "XmlFile.h" +#include "LuaManager.h" + +REGISTER_ACTOR_CLASS(DifficultyIcon); + +DifficultyIcon::DifficultyIcon() +{ + m_bBlank = false; + m_PlayerNumber = PLAYER_1; +} + +bool DifficultyIcon::Load( RString sPath ) +{ + Sprite::Load( sPath ); + int iStates = GetNumStates(); + bool bWarn = iStates != NUM_Difficulty && iStates != NUM_Difficulty*2; + if( sPath.find("_blank") != string::npos ) + bWarn = false; + if( bWarn ) + { + RString sError = ssprintf( + "The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.", + sPath.c_str(), + NUM_Difficulty, + NUM_Difficulty*2, + iStates ); + Dialog::OK( sError ); + } + StopAnimating(); + return true; +} + +void DifficultyIcon::LoadFromNode( const XNode* pNode ) +{ + RString sFile; + if( !ActorUtil::GetAttrPath(pNode, "File", sFile) ) + RageException::Throw( "%s: DifficultyIcon: missing the \"File\" attribute.", ActorUtil::GetWhere(pNode).c_str() ); + + Load( sFile ); + + // skip Sprite::LoadFromNode + Actor::LoadFromNode( pNode ); +} + +void DifficultyIcon::SetPlayer( PlayerNumber pn ) +{ + m_PlayerNumber = pn; +} + +void DifficultyIcon::SetFromSteps( PlayerNumber pn, const Steps* pSteps ) +{ + SetPlayer( pn ); + if( pSteps == NULL ) + Unset(); + else + SetFromDifficulty( pSteps->GetDifficulty() ); +} + +void DifficultyIcon::SetFromTrail( PlayerNumber pn, const Trail* pTrail ) +{ + SetPlayer( pn ); + if( pTrail == NULL ) + Unset(); + else + SetFromDifficulty( pTrail->m_CourseDifficulty ); +} + +void DifficultyIcon::Unset() +{ + m_bBlank = true; +} + +void DifficultyIcon::SetFromDifficulty( Difficulty dc ) +{ + m_bBlank = false; + switch( GetNumStates() ) + { + case NUM_Difficulty: SetState( dc ); break; + case NUM_Difficulty*2: SetState( dc*2+m_PlayerNumber ); break; + default: m_bBlank = true; break; + } +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the DifficultyIcon. */ +class LunaDifficultyIcon: public Luna +{ +public: + static int SetFromSteps( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) + { + p->Unset(); + } + else + { + Steps *pS = Luna::check(L,1); + p->SetFromSteps( PLAYER_1, pS ); + } + return 0; + } + static int SetFromTrail( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) + { + p->Unset(); + } + else + { + Trail *pT = Luna::check(L,1); + p->SetFromTrail( PLAYER_1, pT ); + } + return 0; + } + static int Unset( T* p, lua_State *L ) { p->Unset(); return 0; } + static int SetPlayer( T* p, lua_State *L ) { p->SetPlayer( Enum::Check(L, 1) ); return 0; } + static int SetFromDifficulty( T* p, lua_State *L ) { p->SetFromDifficulty( Enum::Check(L, 1) ); return 0; } + + LunaDifficultyIcon() + { + ADD_METHOD( Unset ); + ADD_METHOD( SetPlayer ); + ADD_METHOD( SetFromSteps ); + ADD_METHOD( SetFromTrail ); + ADD_METHOD( SetFromDifficulty ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( DifficultyIcon, Sprite ) +// lua end + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DifficultyIcon.h b/src/DifficultyIcon.h index 1431491585..80e7d3437f 100644 --- a/src/DifficultyIcon.h +++ b/src/DifficultyIcon.h @@ -1,64 +1,64 @@ -/* DifficultyIcon - Graphical representation of the difficulty class. */ - -#ifndef DIFFICULTY_ICON_H -#define DIFFICULTY_ICON_H - -#include "Sprite.h" -#include "PlayerNumber.h" -#include "GameConstantsAndTypes.h" -#include "Difficulty.h" -class Steps; -class Trail; - - -class DifficultyIcon : public Sprite -{ -public: - DifficultyIcon(); - virtual bool EarlyAbortDraw() const { return m_bBlank || Sprite::EarlyAbortDraw(); } - - bool Load( RString sFilePath ); - virtual void Load( RageTextureID ID ) { Load( ID.filename ); } - virtual void LoadFromNode( const XNode* pNode ); - virtual DifficultyIcon *Copy() const; - - void SetPlayer( PlayerNumber pn ); - void Unset(); - void SetFromSteps( PlayerNumber pn, const Steps* pSteps ); - void SetFromTrail( PlayerNumber pn, const Trail* pTrail ); - void SetFromDifficulty( Difficulty dc ); - - // Lua - void PushSelf( lua_State *L ); - -protected: - bool m_bBlank; - PlayerNumber m_PlayerNumber; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* DifficultyIcon - Graphical representation of the difficulty class. */ + +#ifndef DIFFICULTY_ICON_H +#define DIFFICULTY_ICON_H + +#include "Sprite.h" +#include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" +#include "Difficulty.h" +class Steps; +class Trail; + + +class DifficultyIcon : public Sprite +{ +public: + DifficultyIcon(); + virtual bool EarlyAbortDraw() const { return m_bBlank || Sprite::EarlyAbortDraw(); } + + bool Load( RString sFilePath ); + virtual void Load( RageTextureID ID ) { Load( ID.filename ); } + virtual void LoadFromNode( const XNode* pNode ); + virtual DifficultyIcon *Copy() const; + + void SetPlayer( PlayerNumber pn ); + void Unset(); + void SetFromSteps( PlayerNumber pn, const Steps* pSteps ); + void SetFromTrail( PlayerNumber pn, const Trail* pTrail ); + void SetFromDifficulty( Difficulty dc ); + + // Lua + void PushSelf( lua_State *L ); + +protected: + bool m_bBlank; + PlayerNumber m_PlayerNumber; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DifficultyList.cpp b/src/DifficultyList.cpp index f8dfa19440..2b79d6fe10 100644 --- a/src/DifficultyList.cpp +++ b/src/DifficultyList.cpp @@ -1,420 +1,420 @@ -#include "global.h" -#include "DifficultyList.h" -#include "GameState.h" -#include "Song.h" -#include "Steps.h" -#include "Style.h" -#include "StepsDisplay.h" -#include "StepsUtil.h" -#include "CommonMetrics.h" -#include "Foreach.h" -#include "SongUtil.h" -#include "XmlFile.h" - -// MAX_METERS was previously set to NUM_Difficulty + MAX_EDITS_PER_SONG. -// This was all fine and well until AutoSetStyle was created. In certain -// gametypes (technomotion for example), if autogen is on, the number of -// available stepcharts exceeds MAX_METERS, resulting in a crash. -// My first thought to fix this was: -// (NUM_Difficulty (6) * NUM_StepsType (32)) + MAX_EDITS_PER_SONG (5*profileSlot (2)) = 202 -// However, 202 rows may be a bit overkill. -// Dance has 6 stepstypes counting 3panel, Pump and Techno have 5. -// (6 difficulties * 6 stepstypes) + MAX_EDITS_PER_SONG (which is 5 * profileSlots) = 46 rows -// 46 seems to be a good enough number for this. If we get a crash again, up the -// "magic" 6. -aj -#define MAX_METERS (NUM_Difficulty * 6) + MAX_EDITS_PER_SONG - -REGISTER_ACTOR_CLASS( StepsDisplayList ); - -StepsDisplayList::StepsDisplayList() -{ - m_bShown = true; - - FOREACH_ENUM( PlayerNumber, pn ) - { - SubscribeToMessage( (MessageID)(Message_CurrentStepsP1Changed+pn) ); - SubscribeToMessage( (MessageID)(Message_CurrentTrailP1Changed+pn) ); - } -} - -StepsDisplayList::~StepsDisplayList() -{ -} - -void StepsDisplayList::LoadFromNode( const XNode* pNode ) -{ - ActorFrame::LoadFromNode( pNode ); - - ASSERT_M( !m_sName.empty(), "StepsDisplayList must have a Name" ); - - ITEMS_SPACING_Y.Load( m_sName, "ItemsSpacingY" ); - NUM_SHOWN_ITEMS.Load( m_sName, "NumShownItems" ); - CAPITALIZE_DIFFICULTY_NAMES.Load( m_sName, "CapitalizeDifficultyNames" ); - MOVE_COMMAND.Load( m_sName, "MoveCommand" ); - - m_Lines.resize( MAX_METERS ); - m_CurSong = NULL; - - FOREACH_ENUM( PlayerNumber, pn ) - { - const XNode *pChild = pNode->GetChild( ssprintf("CursorP%i",pn+1) ); - if( pChild == NULL ) - RageException::Throw( "%s: StepsDisplayList: missing the node \"CursorP%d\"", ActorUtil::GetWhere(pNode).c_str(), pn+1 ); - m_Cursors[pn].LoadActorFromNode( pChild, this ); - - /* Hack: we need to tween cursors both up to down (cursor motion) and visible to - * invisible (fading). Cursor motion needs to stoptweening, so multiple motions - * don't queue and look unresponsive. However, that stoptweening interrupts fading, - * resulting in the cursor remaining invisible or partially invisible. So, do them - * in separate tweening stacks. This means the Cursor command can't change diffuse - * colors; I think we do need a diffuse color stack ... */ - pChild = pNode->GetChild( ssprintf("CursorP%iFrame",pn+1) ); - if( pChild == NULL ) - RageException::Throw( "%s: StepsDisplayList: missing the node \"CursorP%dFrame\"", ActorUtil::GetWhere(pNode).c_str(), pn+1 ); - m_CursorFrames[pn].LoadFromNode( pChild ); - m_CursorFrames[pn].AddChild( m_Cursors[pn] ); - this->AddChild( &m_CursorFrames[pn] ); - } - - for( unsigned m = 0; m < m_Lines.size(); ++m ) - { - // todo: Use Row1, Row2 for names? also m_sName+"Row" -aj - m_Lines[m].m_Meter.SetName( "Row" ); - m_Lines[m].m_Meter.Load( "StepsDisplayListRow", NULL ); - this->AddChild( &m_Lines[m].m_Meter ); - } - - UpdatePositions(); - PositionItems(); -} - -int StepsDisplayList::GetCurrentRowIndex( PlayerNumber pn ) const -{ - Difficulty ClosestDifficulty = GAMESTATE->GetClosestShownDifficulty(pn); - - for( unsigned i=0; im_pCurSteps[pn] == NULL ) - { - if( row.m_dc == ClosestDifficulty ) - return i; - } - else - { - if( GAMESTATE->m_pCurSteps[pn].Get() == row.m_Steps ) - return i; - } - } - - return 0; -} - -// Update m_fY and m_bHidden[]. -void StepsDisplayList::UpdatePositions() -{ - int iCurrentRow[NUM_PLAYERS]; - FOREACH_HumanPlayer( p ) - iCurrentRow[p] = GetCurrentRowIndex( p ); - - const int total = NUM_SHOWN_ITEMS; - const int halfsize = total / 2; - - int first_start, first_end, second_start, second_end; - - // Choices for each player. If only one player is active, it's the same for both. - int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: 0; - int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: 0; - - vector &Rows = m_Rows; - - const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1) && GAMESTATE->IsHumanPlayer(PLAYER_2); - if( !BothPlayersActivated ) - { - // Simply center the cursor. - first_start = max( P1Choice - halfsize, 0 ); - first_end = first_start + total; - second_start = second_end = first_end; - } - else - { - // First half: - const int earliest = min( P1Choice, P2Choice ); - first_start = max( earliest - halfsize/2, 0 ); - first_end = first_start + halfsize; - - // Second half: - const int latest = max( P1Choice, P2Choice ); - - second_start = max( latest - halfsize/2, 0 ); - - // Don't overlap. - second_start = max( second_start, first_end ); - - second_end = second_start + halfsize; - } - - first_end = min( first_end, (int) Rows.size() ); - second_end = min( second_end, (int) Rows.size() ); - - /* If less than total (and Rows.size()) are displayed, fill in the empty - * space intelligently. */ - while(1) - { - const int sum = (first_end - first_start) + (second_end - second_start); - if( sum >= (int) Rows.size() || sum >= total) - break; // nothing more to display, or no room - - /* First priority: expand the top of the second half until it meets - * the first half. */ - if( second_start > first_end ) - second_start--; - // Otherwise, expand either end. - else if( first_start > 0 ) - first_start--; - else if( second_end < (int) Rows.size() ) - second_end++; - else - ASSERT(0); // do we have room to grow or don't we? - } - - int pos = 0; - for( int i=0; i<(int) Rows.size(); i++ ) // foreach row - { - float ItemPosition; - if( i < first_start ) - ItemPosition = -0.5f; - else if( i < first_end ) - ItemPosition = (float) pos++; - else if( i < second_start ) - ItemPosition = halfsize - 0.5f; - else if( i < second_end ) - ItemPosition = (float) pos++; - else - ItemPosition = (float) total - 0.5f; - - Row &row = Rows[i]; - - float fY = ITEMS_SPACING_Y*ItemPosition; - row.m_fY = fY; - row.m_bHidden = i < first_start || - (i >= first_end && i < second_start) || - i >= second_end; - } -} - - -void StepsDisplayList::PositionItems() -{ - for( int i = 0; i < MAX_METERS; ++i ) - { - bool bUnused = ( i >= (int)m_Rows.size() ); - m_Lines[i].m_Meter.SetVisible( !bUnused ); - } - - for( int m = 0; m < (int)m_Rows.size(); ++m ) - { - Row &row = m_Rows[m]; - bool bHidden = row.m_bHidden; - if( !m_bShown ) - bHidden = true; - - const float fDiffuseAlpha = bHidden? 0.0f:1.0f; - if( m_Lines[m].m_Meter.GetDestY() != row.m_fY || - m_Lines[m].m_Meter.DestTweenState().diffuse[0][3] != fDiffuseAlpha ) - { - m_Lines[m].m_Meter.RunCommands( MOVE_COMMAND.GetValue() ); - m_Lines[m].m_Meter.RunCommandsOnChildren( MOVE_COMMAND.GetValue() ); - } - - m_Lines[m].m_Meter.SetY( row.m_fY ); - } - - for( int m=0; m < MAX_METERS; ++m ) - { - bool bHidden = true; - if( m_bShown && m < (int)m_Rows.size() ) - bHidden = m_Rows[m].m_bHidden; - - float fDiffuseAlpha = bHidden?0.0f:1.0f; - - m_Lines[m].m_Meter.SetDiffuseAlpha( fDiffuseAlpha ); - } - - - FOREACH_HumanPlayer( pn ) - { - int iCurrentRow = GetCurrentRowIndex( pn ); - - float fY = 0; - if( iCurrentRow < (int) m_Rows.size() ) - fY = m_Rows[iCurrentRow].m_fY; - - m_CursorFrames[pn].PlayCommand( "Change" ); - m_CursorFrames[pn].SetY( fY ); - } -} - -void StepsDisplayList::SetFromGameState() -{ - const Song *pSong = GAMESTATE->m_pCurSong; - unsigned i = 0; - - if( pSong == NULL ) - { - // FIXME: This clamps to between the min and the max difficulty, but - // it really should round to the nearest difficulty that's in - // DIFFICULTIES_TO_SHOW. - const vector& difficulties = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); - m_Rows.resize( difficulties.size() ); - FOREACH_CONST( Difficulty, difficulties, d ) - { - m_Rows[i].m_dc = *d; - m_Lines[i].m_Meter.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GAMESTATE->m_pCurStyle->m_StepsType, 0, *d, CourseType_Invalid ); - ++i; - } - } - else - { - vector vpSteps; - SongUtil::GetPlayableSteps( pSong, vpSteps ); - // Should match the sort in ScreenSelectMusic::AfterMusicChange. - - m_Rows.resize( vpSteps.size() ); - FOREACH_CONST( Steps*, vpSteps, s ) - { - //LOG->Trace(ssprintf("setting steps for row %i",i)); - m_Rows[i].m_Steps = *s; - m_Lines[i].m_Meter.SetFromSteps( *s ); - ++i; - } - } - - while( i < MAX_METERS ) - m_Lines[i++].m_Meter.Unset(); - - UpdatePositions(); - PositionItems(); - - for( int m = 0; m < MAX_METERS; ++m ) - m_Lines[m].m_Meter.FinishTweening(); -} - -void StepsDisplayList::HideRows() -{ - for( unsigned m = 0; m < m_Rows.size(); ++m ) - { - Line &l = m_Lines[m]; - - l.m_Meter.FinishTweening(); - l.m_Meter.SetDiffuseAlpha(0); - } -} - -void StepsDisplayList::TweenOnScreen() -{ - FOREACH_HumanPlayer( pn ) - ON_COMMAND( m_Cursors[pn] ); - - for( int m = 0; m < MAX_METERS; ++m ) - ON_COMMAND( m_Lines[m].m_Meter ); - - this->SetHibernate( 0.5f ); - m_bShown = true; - for( unsigned m = 0; m < m_Rows.size(); ++m ) - { - Line &l = m_Lines[m]; - - l.m_Meter.FinishTweening(); - } - - HideRows(); - PositionItems(); - - FOREACH_HumanPlayer( pn ) - COMMAND( m_Cursors[pn], "TweenOn" ); -} - -void StepsDisplayList::TweenOffScreen() -{ - -} - -void StepsDisplayList::Show() -{ - m_bShown = true; - - SetFromGameState(); - - HideRows(); - PositionItems(); - - FOREACH_HumanPlayer( pn ) - COMMAND( m_Cursors[pn], "Show" ); -} - -void StepsDisplayList::Hide() -{ - m_bShown = false; - PositionItems(); - - FOREACH_HumanPlayer( pn ) - COMMAND( m_Cursors[pn], "Hide" ); -} - -void StepsDisplayList::HandleMessage( const Message &msg ) -{ - FOREACH_ENUM( PlayerNumber, pn ) - { - if( msg.GetName() == MessageIDToString((MessageID)(Message_CurrentStepsP1Changed+pn)) || - msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+pn)) ) - SetFromGameState(); - } - - ActorFrame::HandleMessage(msg); -} - - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the StepsDisplayList. */ -class LunaStepsDisplayList: public Luna -{ -public: - static int setfromgamestate( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } - - LunaStepsDisplayList() - { - ADD_METHOD( setfromgamestate ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( StepsDisplayList, ActorFrame ) -// lua end - -/* - * (c) 2003-2004 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DifficultyList.h" +#include "GameState.h" +#include "Song.h" +#include "Steps.h" +#include "Style.h" +#include "StepsDisplay.h" +#include "StepsUtil.h" +#include "CommonMetrics.h" +#include "Foreach.h" +#include "SongUtil.h" +#include "XmlFile.h" + +// MAX_METERS was previously set to NUM_Difficulty + MAX_EDITS_PER_SONG. +// This was all fine and well until AutoSetStyle was created. In certain +// gametypes (technomotion for example), if autogen is on, the number of +// available stepcharts exceeds MAX_METERS, resulting in a crash. +// My first thought to fix this was: +// (NUM_Difficulty (6) * NUM_StepsType (32)) + MAX_EDITS_PER_SONG (5*profileSlot (2)) = 202 +// However, 202 rows may be a bit overkill. +// Dance has 6 stepstypes counting 3panel, Pump and Techno have 5. +// (6 difficulties * 6 stepstypes) + MAX_EDITS_PER_SONG (which is 5 * profileSlots) = 46 rows +// 46 seems to be a good enough number for this. If we get a crash again, up the +// "magic" 6. -aj +#define MAX_METERS (NUM_Difficulty * 6) + MAX_EDITS_PER_SONG + +REGISTER_ACTOR_CLASS( StepsDisplayList ); + +StepsDisplayList::StepsDisplayList() +{ + m_bShown = true; + + FOREACH_ENUM( PlayerNumber, pn ) + { + SubscribeToMessage( (MessageID)(Message_CurrentStepsP1Changed+pn) ); + SubscribeToMessage( (MessageID)(Message_CurrentTrailP1Changed+pn) ); + } +} + +StepsDisplayList::~StepsDisplayList() +{ +} + +void StepsDisplayList::LoadFromNode( const XNode* pNode ) +{ + ActorFrame::LoadFromNode( pNode ); + + ASSERT_M( !m_sName.empty(), "StepsDisplayList must have a Name" ); + + ITEMS_SPACING_Y.Load( m_sName, "ItemsSpacingY" ); + NUM_SHOWN_ITEMS.Load( m_sName, "NumShownItems" ); + CAPITALIZE_DIFFICULTY_NAMES.Load( m_sName, "CapitalizeDifficultyNames" ); + MOVE_COMMAND.Load( m_sName, "MoveCommand" ); + + m_Lines.resize( MAX_METERS ); + m_CurSong = NULL; + + FOREACH_ENUM( PlayerNumber, pn ) + { + const XNode *pChild = pNode->GetChild( ssprintf("CursorP%i",pn+1) ); + if( pChild == NULL ) + RageException::Throw( "%s: StepsDisplayList: missing the node \"CursorP%d\"", ActorUtil::GetWhere(pNode).c_str(), pn+1 ); + m_Cursors[pn].LoadActorFromNode( pChild, this ); + + /* Hack: we need to tween cursors both up to down (cursor motion) and visible to + * invisible (fading). Cursor motion needs to stoptweening, so multiple motions + * don't queue and look unresponsive. However, that stoptweening interrupts fading, + * resulting in the cursor remaining invisible or partially invisible. So, do them + * in separate tweening stacks. This means the Cursor command can't change diffuse + * colors; I think we do need a diffuse color stack ... */ + pChild = pNode->GetChild( ssprintf("CursorP%iFrame",pn+1) ); + if( pChild == NULL ) + RageException::Throw( "%s: StepsDisplayList: missing the node \"CursorP%dFrame\"", ActorUtil::GetWhere(pNode).c_str(), pn+1 ); + m_CursorFrames[pn].LoadFromNode( pChild ); + m_CursorFrames[pn].AddChild( m_Cursors[pn] ); + this->AddChild( &m_CursorFrames[pn] ); + } + + for( unsigned m = 0; m < m_Lines.size(); ++m ) + { + // todo: Use Row1, Row2 for names? also m_sName+"Row" -aj + m_Lines[m].m_Meter.SetName( "Row" ); + m_Lines[m].m_Meter.Load( "StepsDisplayListRow", NULL ); + this->AddChild( &m_Lines[m].m_Meter ); + } + + UpdatePositions(); + PositionItems(); +} + +int StepsDisplayList::GetCurrentRowIndex( PlayerNumber pn ) const +{ + Difficulty ClosestDifficulty = GAMESTATE->GetClosestShownDifficulty(pn); + + for( unsigned i=0; im_pCurSteps[pn] == NULL ) + { + if( row.m_dc == ClosestDifficulty ) + return i; + } + else + { + if( GAMESTATE->m_pCurSteps[pn].Get() == row.m_Steps ) + return i; + } + } + + return 0; +} + +// Update m_fY and m_bHidden[]. +void StepsDisplayList::UpdatePositions() +{ + int iCurrentRow[NUM_PLAYERS]; + FOREACH_HumanPlayer( p ) + iCurrentRow[p] = GetCurrentRowIndex( p ); + + const int total = NUM_SHOWN_ITEMS; + const int halfsize = total / 2; + + int first_start, first_end, second_start, second_end; + + // Choices for each player. If only one player is active, it's the same for both. + int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: 0; + int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? iCurrentRow[PLAYER_2]: GAMESTATE->IsHumanPlayer(PLAYER_1)? iCurrentRow[PLAYER_1]: 0; + + vector &Rows = m_Rows; + + const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1) && GAMESTATE->IsHumanPlayer(PLAYER_2); + if( !BothPlayersActivated ) + { + // Simply center the cursor. + first_start = max( P1Choice - halfsize, 0 ); + first_end = first_start + total; + second_start = second_end = first_end; + } + else + { + // First half: + const int earliest = min( P1Choice, P2Choice ); + first_start = max( earliest - halfsize/2, 0 ); + first_end = first_start + halfsize; + + // Second half: + const int latest = max( P1Choice, P2Choice ); + + second_start = max( latest - halfsize/2, 0 ); + + // Don't overlap. + second_start = max( second_start, first_end ); + + second_end = second_start + halfsize; + } + + first_end = min( first_end, (int) Rows.size() ); + second_end = min( second_end, (int) Rows.size() ); + + /* If less than total (and Rows.size()) are displayed, fill in the empty + * space intelligently. */ + while(1) + { + const int sum = (first_end - first_start) + (second_end - second_start); + if( sum >= (int) Rows.size() || sum >= total) + break; // nothing more to display, or no room + + /* First priority: expand the top of the second half until it meets + * the first half. */ + if( second_start > first_end ) + second_start--; + // Otherwise, expand either end. + else if( first_start > 0 ) + first_start--; + else if( second_end < (int) Rows.size() ) + second_end++; + else + ASSERT(0); // do we have room to grow or don't we? + } + + int pos = 0; + for( int i=0; i<(int) Rows.size(); i++ ) // foreach row + { + float ItemPosition; + if( i < first_start ) + ItemPosition = -0.5f; + else if( i < first_end ) + ItemPosition = (float) pos++; + else if( i < second_start ) + ItemPosition = halfsize - 0.5f; + else if( i < second_end ) + ItemPosition = (float) pos++; + else + ItemPosition = (float) total - 0.5f; + + Row &row = Rows[i]; + + float fY = ITEMS_SPACING_Y*ItemPosition; + row.m_fY = fY; + row.m_bHidden = i < first_start || + (i >= first_end && i < second_start) || + i >= second_end; + } +} + + +void StepsDisplayList::PositionItems() +{ + for( int i = 0; i < MAX_METERS; ++i ) + { + bool bUnused = ( i >= (int)m_Rows.size() ); + m_Lines[i].m_Meter.SetVisible( !bUnused ); + } + + for( int m = 0; m < (int)m_Rows.size(); ++m ) + { + Row &row = m_Rows[m]; + bool bHidden = row.m_bHidden; + if( !m_bShown ) + bHidden = true; + + const float fDiffuseAlpha = bHidden? 0.0f:1.0f; + if( m_Lines[m].m_Meter.GetDestY() != row.m_fY || + m_Lines[m].m_Meter.DestTweenState().diffuse[0][3] != fDiffuseAlpha ) + { + m_Lines[m].m_Meter.RunCommands( MOVE_COMMAND.GetValue() ); + m_Lines[m].m_Meter.RunCommandsOnChildren( MOVE_COMMAND.GetValue() ); + } + + m_Lines[m].m_Meter.SetY( row.m_fY ); + } + + for( int m=0; m < MAX_METERS; ++m ) + { + bool bHidden = true; + if( m_bShown && m < (int)m_Rows.size() ) + bHidden = m_Rows[m].m_bHidden; + + float fDiffuseAlpha = bHidden?0.0f:1.0f; + + m_Lines[m].m_Meter.SetDiffuseAlpha( fDiffuseAlpha ); + } + + + FOREACH_HumanPlayer( pn ) + { + int iCurrentRow = GetCurrentRowIndex( pn ); + + float fY = 0; + if( iCurrentRow < (int) m_Rows.size() ) + fY = m_Rows[iCurrentRow].m_fY; + + m_CursorFrames[pn].PlayCommand( "Change" ); + m_CursorFrames[pn].SetY( fY ); + } +} + +void StepsDisplayList::SetFromGameState() +{ + const Song *pSong = GAMESTATE->m_pCurSong; + unsigned i = 0; + + if( pSong == NULL ) + { + // FIXME: This clamps to between the min and the max difficulty, but + // it really should round to the nearest difficulty that's in + // DIFFICULTIES_TO_SHOW. + const vector& difficulties = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); + m_Rows.resize( difficulties.size() ); + FOREACH_CONST( Difficulty, difficulties, d ) + { + m_Rows[i].m_dc = *d; + m_Lines[i].m_Meter.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GAMESTATE->m_pCurStyle->m_StepsType, 0, *d, CourseType_Invalid ); + ++i; + } + } + else + { + vector vpSteps; + SongUtil::GetPlayableSteps( pSong, vpSteps ); + // Should match the sort in ScreenSelectMusic::AfterMusicChange. + + m_Rows.resize( vpSteps.size() ); + FOREACH_CONST( Steps*, vpSteps, s ) + { + //LOG->Trace(ssprintf("setting steps for row %i",i)); + m_Rows[i].m_Steps = *s; + m_Lines[i].m_Meter.SetFromSteps( *s ); + ++i; + } + } + + while( i < MAX_METERS ) + m_Lines[i++].m_Meter.Unset(); + + UpdatePositions(); + PositionItems(); + + for( int m = 0; m < MAX_METERS; ++m ) + m_Lines[m].m_Meter.FinishTweening(); +} + +void StepsDisplayList::HideRows() +{ + for( unsigned m = 0; m < m_Rows.size(); ++m ) + { + Line &l = m_Lines[m]; + + l.m_Meter.FinishTweening(); + l.m_Meter.SetDiffuseAlpha(0); + } +} + +void StepsDisplayList::TweenOnScreen() +{ + FOREACH_HumanPlayer( pn ) + ON_COMMAND( m_Cursors[pn] ); + + for( int m = 0; m < MAX_METERS; ++m ) + ON_COMMAND( m_Lines[m].m_Meter ); + + this->SetHibernate( 0.5f ); + m_bShown = true; + for( unsigned m = 0; m < m_Rows.size(); ++m ) + { + Line &l = m_Lines[m]; + + l.m_Meter.FinishTweening(); + } + + HideRows(); + PositionItems(); + + FOREACH_HumanPlayer( pn ) + COMMAND( m_Cursors[pn], "TweenOn" ); +} + +void StepsDisplayList::TweenOffScreen() +{ + +} + +void StepsDisplayList::Show() +{ + m_bShown = true; + + SetFromGameState(); + + HideRows(); + PositionItems(); + + FOREACH_HumanPlayer( pn ) + COMMAND( m_Cursors[pn], "Show" ); +} + +void StepsDisplayList::Hide() +{ + m_bShown = false; + PositionItems(); + + FOREACH_HumanPlayer( pn ) + COMMAND( m_Cursors[pn], "Hide" ); +} + +void StepsDisplayList::HandleMessage( const Message &msg ) +{ + FOREACH_ENUM( PlayerNumber, pn ) + { + if( msg.GetName() == MessageIDToString((MessageID)(Message_CurrentStepsP1Changed+pn)) || + msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+pn)) ) + SetFromGameState(); + } + + ActorFrame::HandleMessage(msg); +} + + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the StepsDisplayList. */ +class LunaStepsDisplayList: public Luna +{ +public: + static int setfromgamestate( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + + LunaStepsDisplayList() + { + ADD_METHOD( setfromgamestate ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( StepsDisplayList, ActorFrame ) +// lua end + +/* + * (c) 2003-2004 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DifficultyList.h b/src/DifficultyList.h index d6ba5084a1..0d0817fa91 100644 --- a/src/DifficultyList.h +++ b/src/DifficultyList.h @@ -1,100 +1,100 @@ -/* StepsDisplayList - Shows all available difficulties for a Song/Course. */ -#ifndef DIFFICULTY_LIST_H -#define DIFFICULTY_LIST_H - -#include "ActorFrame.h" -#include "PlayerNumber.h" -#include "StepsDisplay.h" -#include "ThemeMetric.h" - -class Song; -class Steps; - -class StepsDisplayList: public ActorFrame -{ -public: - StepsDisplayList(); - virtual ~StepsDisplayList(); - virtual StepsDisplayList *Copy() const; - virtual void LoadFromNode( const XNode* pNode ); - - void HandleMessage( const Message &msg ); - - void SetFromGameState(); - void TweenOnScreen(); - void TweenOffScreen(); - void Hide(); - void Show(); - - // Lua - void PushSelf( lua_State *L ); - -private: - void UpdatePositions(); - void PositionItems(); - int GetCurrentRowIndex( PlayerNumber pn ) const; - void HideRows(); - - ThemeMetric ITEMS_SPACING_Y; - ThemeMetric NUM_SHOWN_ITEMS; - ThemeMetric CAPITALIZE_DIFFICULTY_NAMES; - ThemeMetric MOVE_COMMAND; - - AutoActor m_Cursors[NUM_PLAYERS]; - ActorFrame m_CursorFrames[NUM_PLAYERS]; // contains Cursor so that color can fade independent of other tweens - - struct Line - { - StepsDisplay m_Meter; - }; - vector m_Lines; - - const Song *m_CurSong; - bool m_bShown; - - struct Row - { - Row() - { - m_Steps = NULL; - m_dc = Difficulty_Invalid; - m_fY = 0; - m_bHidden = false; - } - - const Steps *m_Steps; - Difficulty m_dc; - float m_fY; - bool m_bHidden; // currently off screen - }; - - vector m_Rows; - -}; - -#endif - -/* - * (c) 2003-2004 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* StepsDisplayList - Shows all available difficulties for a Song/Course. */ +#ifndef DIFFICULTY_LIST_H +#define DIFFICULTY_LIST_H + +#include "ActorFrame.h" +#include "PlayerNumber.h" +#include "StepsDisplay.h" +#include "ThemeMetric.h" + +class Song; +class Steps; + +class StepsDisplayList: public ActorFrame +{ +public: + StepsDisplayList(); + virtual ~StepsDisplayList(); + virtual StepsDisplayList *Copy() const; + virtual void LoadFromNode( const XNode* pNode ); + + void HandleMessage( const Message &msg ); + + void SetFromGameState(); + void TweenOnScreen(); + void TweenOffScreen(); + void Hide(); + void Show(); + + // Lua + void PushSelf( lua_State *L ); + +private: + void UpdatePositions(); + void PositionItems(); + int GetCurrentRowIndex( PlayerNumber pn ) const; + void HideRows(); + + ThemeMetric ITEMS_SPACING_Y; + ThemeMetric NUM_SHOWN_ITEMS; + ThemeMetric CAPITALIZE_DIFFICULTY_NAMES; + ThemeMetric MOVE_COMMAND; + + AutoActor m_Cursors[NUM_PLAYERS]; + ActorFrame m_CursorFrames[NUM_PLAYERS]; // contains Cursor so that color can fade independent of other tweens + + struct Line + { + StepsDisplay m_Meter; + }; + vector m_Lines; + + const Song *m_CurSong; + bool m_bShown; + + struct Row + { + Row() + { + m_Steps = NULL; + m_dc = Difficulty_Invalid; + m_fY = 0; + m_bHidden = false; + } + + const Steps *m_Steps; + Difficulty m_dc; + float m_fY; + bool m_bHidden; // currently off screen + }; + + vector m_Rows; + +}; + +#endif + +/* + * (c) 2003-2004 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DisplayResolutions.h b/src/DisplayResolutions.h index 3788942db2..ff0289fd98 100644 --- a/src/DisplayResolutions.h +++ b/src/DisplayResolutions.h @@ -1,61 +1,61 @@ -#ifndef DisplayResolutions_H -#define DisplayResolutions_H - -#include -/** @brief The dimensions of the program. */ -class DisplayResolution -{ -public: - /** @brief The width of the program. */ - int iWidth; - /** @brief The height of the program. */ - int iHeight; - /** @brief Is this display stretched/used for widescreen? */ - bool bStretched; - - /** - * @brief Determine if one DisplayResolution is less than the other. - * @param other the other DisplayResolution to check. - * @return true if this DisplayResolution is less than the other, or false otherwise. */ - bool operator<( const DisplayResolution &other ) const - { -/** @brief A quick way to compare the two DisplayResolutions. */ -#define COMPARE(x) if( x != other.x ) return x < other.x; - COMPARE( iWidth ); - COMPARE( iHeight ); - COMPARE( bStretched ); -#undef COMPARE - return false; - } -}; -/** @brief The collection of DisplayResolutions available within the program. */ -typedef set DisplayResolutions; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2005 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef DisplayResolutions_H +#define DisplayResolutions_H + +#include +/** @brief The dimensions of the program. */ +class DisplayResolution +{ +public: + /** @brief The width of the program. */ + int iWidth; + /** @brief The height of the program. */ + int iHeight; + /** @brief Is this display stretched/used for widescreen? */ + bool bStretched; + + /** + * @brief Determine if one DisplayResolution is less than the other. + * @param other the other DisplayResolution to check. + * @return true if this DisplayResolution is less than the other, or false otherwise. */ + bool operator<( const DisplayResolution &other ) const + { +/** @brief A quick way to compare the two DisplayResolutions. */ +#define COMPARE(x) if( x != other.x ) return x < other.x; + COMPARE( iWidth ); + COMPARE( iHeight ); + COMPARE( bStretched ); +#undef COMPARE + return false; + } +}; +/** @brief The collection of DisplayResolutions available within the program. */ +typedef set DisplayResolutions; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2005 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DualScrollBar.cpp b/src/DualScrollBar.cpp index a33706a1bf..2fb28c7f55 100644 --- a/src/DualScrollBar.cpp +++ b/src/DualScrollBar.cpp @@ -1,84 +1,84 @@ -#include "global.h" -#include "DualScrollBar.h" -#include "ThemeManager.h" -#include "RageUtil.h" - -DualScrollBar::DualScrollBar() -{ - m_fBarHeight = 100; - m_fBarTime = 1; -} - -void DualScrollBar::Load( const RString &sType ) -{ - FOREACH_PlayerNumber( pn ) - { - m_sprScrollThumbUnderHalf[pn].Load( THEME->GetPathG(sType,ssprintf("thumb p%i",pn+1)) ); - m_sprScrollThumbUnderHalf[pn]->SetName( ssprintf("ThumbP%i", pn+1) ); - this->AddChild( m_sprScrollThumbUnderHalf[pn] ); - } - - FOREACH_PlayerNumber( pn ) - { - m_sprScrollThumbOverHalf[pn].Load( THEME->GetPathG(sType, ssprintf("thumb p%i",pn+1)) ); - m_sprScrollThumbOverHalf[pn]->SetName( ssprintf("ThumbP%i", pn+1) ); - this->AddChild( m_sprScrollThumbOverHalf[pn] ); - } - - m_sprScrollThumbUnderHalf[0]->SetCropLeft( .5f ); - m_sprScrollThumbUnderHalf[1]->SetCropRight( .5f ); - - m_sprScrollThumbOverHalf[0]->SetCropRight( .5f ); - m_sprScrollThumbOverHalf[1]->SetCropLeft( .5f ); - - FOREACH_PlayerNumber( pn ) - SetPercentage( pn, 0 ); - - FinishTweening(); -} - -void DualScrollBar::EnablePlayer( PlayerNumber pn, bool on ) -{ - m_sprScrollThumbUnderHalf[pn]->SetVisible( on ); - m_sprScrollThumbOverHalf[pn]->SetVisible( on ); -} - -void DualScrollBar::SetPercentage( PlayerNumber pn, float fPercent ) -{ - const float bottom = m_fBarHeight/2 - m_sprScrollThumbUnderHalf[pn]->GetZoomedHeight()/2; - const float top = -bottom; - - /* Position both thumbs. */ - m_sprScrollThumbUnderHalf[pn]->StopTweening(); - m_sprScrollThumbUnderHalf[pn]->BeginTweening( m_fBarTime ); - m_sprScrollThumbUnderHalf[pn]->SetY( SCALE( fPercent, 0, 1, top, bottom ) ); - - m_sprScrollThumbOverHalf[pn]->StopTweening(); - m_sprScrollThumbOverHalf[pn]->BeginTweening( m_fBarTime ); - m_sprScrollThumbOverHalf[pn]->SetY( SCALE( fPercent, 0, 1, top, bottom ) ); -} - -/* - * (c) 2001-2004 Glenn Maynard, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DualScrollBar.h" +#include "ThemeManager.h" +#include "RageUtil.h" + +DualScrollBar::DualScrollBar() +{ + m_fBarHeight = 100; + m_fBarTime = 1; +} + +void DualScrollBar::Load( const RString &sType ) +{ + FOREACH_PlayerNumber( pn ) + { + m_sprScrollThumbUnderHalf[pn].Load( THEME->GetPathG(sType,ssprintf("thumb p%i",pn+1)) ); + m_sprScrollThumbUnderHalf[pn]->SetName( ssprintf("ThumbP%i", pn+1) ); + this->AddChild( m_sprScrollThumbUnderHalf[pn] ); + } + + FOREACH_PlayerNumber( pn ) + { + m_sprScrollThumbOverHalf[pn].Load( THEME->GetPathG(sType, ssprintf("thumb p%i",pn+1)) ); + m_sprScrollThumbOverHalf[pn]->SetName( ssprintf("ThumbP%i", pn+1) ); + this->AddChild( m_sprScrollThumbOverHalf[pn] ); + } + + m_sprScrollThumbUnderHalf[0]->SetCropLeft( .5f ); + m_sprScrollThumbUnderHalf[1]->SetCropRight( .5f ); + + m_sprScrollThumbOverHalf[0]->SetCropRight( .5f ); + m_sprScrollThumbOverHalf[1]->SetCropLeft( .5f ); + + FOREACH_PlayerNumber( pn ) + SetPercentage( pn, 0 ); + + FinishTweening(); +} + +void DualScrollBar::EnablePlayer( PlayerNumber pn, bool on ) +{ + m_sprScrollThumbUnderHalf[pn]->SetVisible( on ); + m_sprScrollThumbOverHalf[pn]->SetVisible( on ); +} + +void DualScrollBar::SetPercentage( PlayerNumber pn, float fPercent ) +{ + const float bottom = m_fBarHeight/2 - m_sprScrollThumbUnderHalf[pn]->GetZoomedHeight()/2; + const float top = -bottom; + + /* Position both thumbs. */ + m_sprScrollThumbUnderHalf[pn]->StopTweening(); + m_sprScrollThumbUnderHalf[pn]->BeginTweening( m_fBarTime ); + m_sprScrollThumbUnderHalf[pn]->SetY( SCALE( fPercent, 0, 1, top, bottom ) ); + + m_sprScrollThumbOverHalf[pn]->StopTweening(); + m_sprScrollThumbOverHalf[pn]->BeginTweening( m_fBarTime ); + m_sprScrollThumbOverHalf[pn]->SetY( SCALE( fPercent, 0, 1, top, bottom ) ); +} + +/* + * (c) 2001-2004 Glenn Maynard, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DualScrollBar.h b/src/DualScrollBar.h index fd362f56cc..3bf67993d3 100644 --- a/src/DualScrollBar.h +++ b/src/DualScrollBar.h @@ -1,55 +1,55 @@ -#ifndef DUAL_SCROLLBAR_H -#define DUAL_SCROLLBAR_H - -#include "ActorFrame.h" -#include "AutoActor.h" -#include "PlayerNumber.h" -/** @brief A scrollbar with two independent thumbs. */ -class DualScrollBar: public ActorFrame -{ -public: - DualScrollBar(); - - void Load( const RString &sType ); - void SetBarHeight( float fHeight ) { m_fBarHeight = fHeight; } - void SetBarTime( float fTime ) { m_fBarTime = fTime; } - void SetPercentage( PlayerNumber pn, float fPercent ); - void EnablePlayer( PlayerNumber pn, bool on ); - -private: - /** @brief The height of the scrollbar. */ - float m_fBarHeight; - float m_fBarTime; - - AutoActor m_sprScrollThumbOverHalf[NUM_PLAYERS]; - AutoActor m_sprScrollThumbUnderHalf[NUM_PLAYERS]; -}; - -#endif - -/** - * @file - * @author Glenn Maynard, Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef DUAL_SCROLLBAR_H +#define DUAL_SCROLLBAR_H + +#include "ActorFrame.h" +#include "AutoActor.h" +#include "PlayerNumber.h" +/** @brief A scrollbar with two independent thumbs. */ +class DualScrollBar: public ActorFrame +{ +public: + DualScrollBar(); + + void Load( const RString &sType ); + void SetBarHeight( float fHeight ) { m_fBarHeight = fHeight; } + void SetBarTime( float fTime ) { m_fBarTime = fTime; } + void SetPercentage( PlayerNumber pn, float fPercent ); + void EnablePlayer( PlayerNumber pn, bool on ); + +private: + /** @brief The height of the scrollbar. */ + float m_fBarHeight; + float m_fBarTime; + + AutoActor m_sprScrollThumbOverHalf[NUM_PLAYERS]; + AutoActor m_sprScrollThumbUnderHalf[NUM_PLAYERS]; +}; + +#endif + +/** + * @file + * @author Glenn Maynard, Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DynamicActorScroller.cpp b/src/DynamicActorScroller.cpp index 51f256cc6a..ba877146de 100644 --- a/src/DynamicActorScroller.cpp +++ b/src/DynamicActorScroller.cpp @@ -1,154 +1,154 @@ -#include "global.h" -#include "DynamicActorScroller.h" -#include "XmlFile.h" -#include "LuaManager.h" -#include "ActorUtil.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "LuaBinding.h" - -DynamicActorScroller *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); } - -void DynamicActorScroller::LoadFromNode( const XNode *pNode ) -{ - ActorScroller::LoadFromNode( pNode ); - - /* All of our children are identical, since they must be interchangeable. - * The node loads only one; we copy the rest. - * - * Make one extra copy if masking is enabled. */ - if( m_SubActors.size() != 1 ) - RageException::Throw( "%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size() ); - - int iNumCopies = (int) m_fNumItemsToDraw; - if( m_quadMask.GetVisible() ) - iNumCopies += 1; - for( int i = 1; i < iNumCopies; ++i ) - { - Actor *pCopy = m_SubActors[0]->Copy(); - this->AddChild( pCopy ); - } - - { - Lua *L = LUA->Get(); - pNode->PushAttrValue( L, "LoadFunction" ); - m_LoadFunction.SetFromStack( L ); - LUA->Release(L); - } - - // Call the expression with line = nil to find out the number of lines. - { - Lua *L = LUA->Get(); - m_LoadFunction.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - lua_pushnil( L ); - lua_pushnil( L ); - - RString sError; - if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 1) ) // 2 args, 1 result - LOG->Warn( "Error running LoadFunction: %s", sError.c_str() ); - - m_iNumItems = (int) luaL_checknumber( L, -1 ); - lua_pop( L, 1 ); - LUA->Release(L); - } - - /* Reconfigure all items, so the loaded actors actually correspond with - * m_iFirstSubActorIndex. */ - ShiftSubActors( INT_MAX ); -} - -/* Shift m_SubActors forward by iDist, and then fill in the new entries. - * - * Important: under normal scrolling, with or without m_bLoop, at most one - * object is created per update, and this normally only happens when an - * object comes on screen. Extra actor updates are avoided for efficiency. */ -void DynamicActorScroller::ShiftSubActors( int iDist ) -{ - ActorScroller::ShiftSubActors( iDist ); - - if( iDist == 0 ) - return; - - if( m_bLoop ) - { - /* Optimization: in a loop of 10, when we loop around from 9 to 0, - * iDist will be -9. Moving -9 is equivalent to moving +1, and - * reconfigures much fewer actors. */ - int iWrapped = iDist; - wrap( iWrapped, m_iNumItems ); - if( abs(iWrapped) < abs(iDist) ) - iDist = iWrapped; - } - - int iFirstToReconfigure = 0; - int iLastToReconfigure = (int)m_SubActors.size(); - if( iDist > 0 && iDist < (int) m_SubActors.size() ) - iFirstToReconfigure = m_SubActors.size()-iDist; - else if( iDist < 0 && -iDist < (int) m_SubActors.size() ) - iLastToReconfigure = -iDist; - - for( int i = iFirstToReconfigure; i < iLastToReconfigure; i++ ) - { - int iIndex = i; // index into m_SubActors - int iItem = i + m_iFirstSubActorIndex; - if( m_bLoop ) - { - wrap( iIndex, m_SubActors.size() ); - wrap( iItem, m_iNumItems ); - } - else if( iIndex < 0 || iIndex >= m_iNumItems || iItem < 0 || iItem >= m_iNumItems ) - continue; - - { - Lua *L = LUA->Get(); - lua_pushnumber( L, i ); - m_SubActors[iIndex]->m_pLuaInstance->Set( L, "ItemIndex" ); - LUA->Release(L); - } - - ConfigureActor( m_SubActors[iIndex], iItem ); - } -} - -void DynamicActorScroller::ConfigureActor( Actor *pActor, int iItem ) -{ - Lua *L = LUA->Get(); - m_LoadFunction.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - pActor->PushSelf( L ); - LuaHelpers::Push( L, iItem ); - - RString sError; - if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) // 2 args, 0 results - LOG->Warn( "Error running LoadFunction: %s", sError.c_str() ); - - LUA->Release(L); -} - -REGISTER_ACTOR_CLASS_WITH_NAME( DynamicActorScrollerAutoDeleteChildren, DynamicActorScroller ); - -/* - * (c) 2005 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "DynamicActorScroller.h" +#include "XmlFile.h" +#include "LuaManager.h" +#include "ActorUtil.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "LuaBinding.h" + +DynamicActorScroller *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); } + +void DynamicActorScroller::LoadFromNode( const XNode *pNode ) +{ + ActorScroller::LoadFromNode( pNode ); + + /* All of our children are identical, since they must be interchangeable. + * The node loads only one; we copy the rest. + * + * Make one extra copy if masking is enabled. */ + if( m_SubActors.size() != 1 ) + RageException::Throw( "%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size() ); + + int iNumCopies = (int) m_fNumItemsToDraw; + if( m_quadMask.GetVisible() ) + iNumCopies += 1; + for( int i = 1; i < iNumCopies; ++i ) + { + Actor *pCopy = m_SubActors[0]->Copy(); + this->AddChild( pCopy ); + } + + { + Lua *L = LUA->Get(); + pNode->PushAttrValue( L, "LoadFunction" ); + m_LoadFunction.SetFromStack( L ); + LUA->Release(L); + } + + // Call the expression with line = nil to find out the number of lines. + { + Lua *L = LUA->Get(); + m_LoadFunction.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + lua_pushnil( L ); + lua_pushnil( L ); + + RString sError; + if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 1) ) // 2 args, 1 result + LOG->Warn( "Error running LoadFunction: %s", sError.c_str() ); + + m_iNumItems = (int) luaL_checknumber( L, -1 ); + lua_pop( L, 1 ); + LUA->Release(L); + } + + /* Reconfigure all items, so the loaded actors actually correspond with + * m_iFirstSubActorIndex. */ + ShiftSubActors( INT_MAX ); +} + +/* Shift m_SubActors forward by iDist, and then fill in the new entries. + * + * Important: under normal scrolling, with or without m_bLoop, at most one + * object is created per update, and this normally only happens when an + * object comes on screen. Extra actor updates are avoided for efficiency. */ +void DynamicActorScroller::ShiftSubActors( int iDist ) +{ + ActorScroller::ShiftSubActors( iDist ); + + if( iDist == 0 ) + return; + + if( m_bLoop ) + { + /* Optimization: in a loop of 10, when we loop around from 9 to 0, + * iDist will be -9. Moving -9 is equivalent to moving +1, and + * reconfigures much fewer actors. */ + int iWrapped = iDist; + wrap( iWrapped, m_iNumItems ); + if( abs(iWrapped) < abs(iDist) ) + iDist = iWrapped; + } + + int iFirstToReconfigure = 0; + int iLastToReconfigure = (int)m_SubActors.size(); + if( iDist > 0 && iDist < (int) m_SubActors.size() ) + iFirstToReconfigure = m_SubActors.size()-iDist; + else if( iDist < 0 && -iDist < (int) m_SubActors.size() ) + iLastToReconfigure = -iDist; + + for( int i = iFirstToReconfigure; i < iLastToReconfigure; i++ ) + { + int iIndex = i; // index into m_SubActors + int iItem = i + m_iFirstSubActorIndex; + if( m_bLoop ) + { + wrap( iIndex, m_SubActors.size() ); + wrap( iItem, m_iNumItems ); + } + else if( iIndex < 0 || iIndex >= m_iNumItems || iItem < 0 || iItem >= m_iNumItems ) + continue; + + { + Lua *L = LUA->Get(); + lua_pushnumber( L, i ); + m_SubActors[iIndex]->m_pLuaInstance->Set( L, "ItemIndex" ); + LUA->Release(L); + } + + ConfigureActor( m_SubActors[iIndex], iItem ); + } +} + +void DynamicActorScroller::ConfigureActor( Actor *pActor, int iItem ) +{ + Lua *L = LUA->Get(); + m_LoadFunction.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + pActor->PushSelf( L ); + LuaHelpers::Push( L, iItem ); + + RString sError; + if( !LuaHelpers::RunScriptOnStack(L, sError, 2, 0) ) // 2 args, 0 results + LOG->Warn( "Error running LoadFunction: %s", sError.c_str() ); + + LUA->Release(L); +} + +REGISTER_ACTOR_CLASS_WITH_NAME( DynamicActorScrollerAutoDeleteChildren, DynamicActorScroller ); + +/* + * (c) 2005 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/DynamicActorScroller.h b/src/DynamicActorScroller.h index 1c72d9ad02..2287804bb5 100644 --- a/src/DynamicActorScroller.h +++ b/src/DynamicActorScroller.h @@ -1,55 +1,55 @@ -#ifndef ACTOR_SCROLLER_H -#define ACTOR_SCROLLER_H - -#include "ActorScroller.h" -#include "LuaReference.h" -/** @brief ActorScroller that fills in its children on the fly. */ -class DynamicActorScroller: public ActorScroller -{ -public: - virtual DynamicActorScroller *Copy() const; - void LoadFromNode( const XNode *pNode ); - -protected: - virtual void ShiftSubActors( int iDist ); - virtual void ConfigureActor( Actor *pActor, int iItem ); - - LuaReference m_LoadFunction; -}; -/** @brief an ActorScroller that deletes its children automatically. */ -class DynamicActorScrollerAutoDeleteChildren: public DynamicActorScroller -{ -public: - DynamicActorScrollerAutoDeleteChildren() { DeleteChildrenWhenDone(true); } - virtual bool AutoLoadChildren() const { return true; } - virtual DynamicActorScrollerAutoDeleteChildren *Copy() const; -}; - -#endif - -/** - * @file - * @author Glenn Maynard (c) 2005 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ACTOR_SCROLLER_H +#define ACTOR_SCROLLER_H + +#include "ActorScroller.h" +#include "LuaReference.h" +/** @brief ActorScroller that fills in its children on the fly. */ +class DynamicActorScroller: public ActorScroller +{ +public: + virtual DynamicActorScroller *Copy() const; + void LoadFromNode( const XNode *pNode ); + +protected: + virtual void ShiftSubActors( int iDist ); + virtual void ConfigureActor( Actor *pActor, int iItem ); + + LuaReference m_LoadFunction; +}; +/** @brief an ActorScroller that deletes its children automatically. */ +class DynamicActorScrollerAutoDeleteChildren: public DynamicActorScroller +{ +public: + DynamicActorScrollerAutoDeleteChildren() { DeleteChildrenWhenDone(true); } + virtual bool AutoLoadChildren() const { return true; } + virtual DynamicActorScrollerAutoDeleteChildren *Copy() const; +}; + +#endif + +/** + * @file + * @author Glenn Maynard (c) 2005 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/EditMenu.cpp b/src/EditMenu.cpp index df779a3dbd..b595a343f6 100644 --- a/src/EditMenu.cpp +++ b/src/EditMenu.cpp @@ -1,588 +1,588 @@ -#include "global.h" -#include "EditMenu.h" -#include "RageLog.h" -#include "SongManager.h" -#include "GameState.h" -#include "ThemeManager.h" -#include "GameManager.h" -#include "Steps.h" -#include "Song.h" -#include "StepsUtil.h" -#include "Foreach.h" -#include "CommonMetrics.h" -#include "BannerCache.h" -#include "UnlockManager.h" -#include "SongUtil.h" - -static const char *EditMenuRowNames[] = { - "Group", - "Song", - "StepsType", - "Steps", - "SourceStepsType", - "SourceSteps", - "Action" -}; -XToString( EditMenuRow ); -XToLocalizedString( EditMenuRow ); - -static const char *EditMenuActionNames[] = { - "Edit", - "Delete", - "Create", - "Practice", -}; -XToString( EditMenuAction ); -XToLocalizedString( EditMenuAction ); -StringToX( EditMenuAction ); - -static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); } -static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); } - -void EditMenu::StripLockedStepsAndDifficulty( vector &v ) -{ - const Song *pSong = GetSelectedSong(); - for( int i=(int)v.size()-1; i>=0; i-- ) - { - if( v[i].pSteps && UNLOCKMAN->StepsIsLocked(pSong, v[i].pSteps) ) - v.erase( v.begin()+i ); - } -} - -void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ) -{ - vpSongsOut = SONGMAN->GetSongs( SHOW_GROUPS.GetValue()? sGroup:GROUP_ALL ); - switch( EDIT_MODE.GetValue() ) - { - case EditMode_Practice: - case EditMode_CourseMods: - case EditMode_Home: - for( int i=vpSongsOut.size()-1; i>=0; i-- ) - { - const Song* pSong = vpSongsOut[i]; - if( !pSong->NormallyDisplayed() || pSong->IsTutorial() || SONGMAN->WasLoadedFromAdditionalSongs(pSong) ) - vpSongsOut.erase( vpSongsOut.begin()+i ); - } - break; - case EditMode_Full: - break; - default: - ASSERT(0); - } - SongUtil::SortSongPointerArrayByTitle( vpSongsOut ); -} - -void EditMenu::GetGroupsToShow( vector &vsGroupsOut ) -{ - vsGroupsOut.clear(); - if( !SHOW_GROUPS.GetValue() ) - return; - - SONGMAN->GetSongGroupNames( vsGroupsOut ); - for( int i = vsGroupsOut.size()-1; i>=0; i-- ) - { - const RString &sGroup = vsGroupsOut[i]; - vector vpSongs; - GetSongsToShowForGroup( sGroup, vpSongs ); - // strip groups that have no unlocked songs - if( vpSongs.empty() ) - vsGroupsOut.erase( vsGroupsOut.begin()+i ); - } -} - -EditMenu::EditMenu() -{ -} - -EditMenu::~EditMenu() -{ - BANNERCACHE->Undemand(); -} - -void EditMenu::Load( const RString &sType ) -{ - LOG->Trace( "EditMenu::Load" ); - - SHOW_GROUPS.Load(sType,"ShowGroups"); - ARROWS_X.Load(sType,ARROWS_X_NAME,NUM_ARROWS); - ARROWS_ENABLED_COMMAND.Load(sType,"ArrowsEnabledCommand"); - ARROWS_DISABLED_COMMAND.Load(sType,"ArrowsDisabledCommand"); - ROW_Y.Load(sType,ROW_Y_NAME,NUM_EditMenuRow); - EDIT_MODE.Load(sType,"EditMode"); - TEXT_BANNER_TYPE.Load( m_sName, "TextBannerType" ); - - for( int i=0; i<2; i++ ) - { - m_sprArrows[i].Load( THEME->GetPathG(sType,i==0?"left":"right") ); - m_sprArrows[i]->SetX( ARROWS_X.GetValue(i) ); - this->AddChild( m_sprArrows[i] ); - } - - m_SelectedRow = GetFirstRow(); - - ZERO( m_iSelection ); - - FOREACH_EditMenuRow( r ) - { - m_textLabel[r].SetName(ssprintf("Label%i",r+1)); - m_textLabel[r].LoadFromFont( THEME->GetPathF(sType,"title") ); - m_textLabel[r].SetText( EditMenuRowToLocalizedString(r) ); - ActorUtil::LoadAllCommandsAndSetXY( m_textLabel[r], sType ); - //m_textLabel[r].SetHorizAlign( align_left ); - this->AddChild( &m_textLabel[r] ); - - m_textValue[r].SetName(ssprintf("Value%i",r+1)); - m_textValue[r].LoadFromFont( THEME->GetPathF(sType,"value") ); - m_textValue[r].SetText( "blah" ); - ActorUtil::LoadAllCommandsAndSetXY( m_textValue[r], sType ); - this->AddChild( &m_textValue[r] ); - } - - m_textLabel[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() ); - m_textValue[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() ); - - // Load low-res banners, if needed. - BANNERCACHE->Demand(); - - if( SHOW_GROUPS.GetValue() ) - { - m_GroupBanner.SetName( "GroupBanner" ); - ActorUtil::SetXY( m_GroupBanner, sType ); - ActorUtil::LoadAllCommands( m_GroupBanner, sType ); - this->AddChild( &m_GroupBanner ); - } - - m_SongBanner.SetName( "SongBanner" ); - ActorUtil::SetXY( m_SongBanner, sType ); - ActorUtil::LoadAllCommands( m_SongBanner, sType ); - this->AddChild( &m_SongBanner ); - - m_SongTextBanner.SetName( "SongTextBanner" ); - m_SongTextBanner.Load( TEXT_BANNER_TYPE ); - ActorUtil::SetXY( m_SongTextBanner, sType ); - ActorUtil::LoadAllCommands( m_SongTextBanner, sType ); - this->AddChild( &m_SongTextBanner ); - - m_StepsDisplay.SetName( "StepsDisplay" ); - m_StepsDisplay.Load( "StepsDisplayEdit", NULL ); - ActorUtil::SetXY( m_StepsDisplay, sType ); - this->AddChild( &m_StepsDisplay ); - - m_StepsDisplaySource.SetName( "StepsDisplaySource" ); - m_StepsDisplaySource.Load( "StepsDisplayEdit", NULL ); - ActorUtil::SetXY( m_StepsDisplaySource, sType ); - this->AddChild( &m_StepsDisplaySource ); - - m_soundChangeRow.Load( THEME->GetPathS(sType,"row"), true ); - m_soundChangeValue.Load( THEME->GetPathS(sType,"value"), true ); - - // fill in data structures - GetGroupsToShow( m_sGroups ); - m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); - - RefreshAll(); -} - -void EditMenu::RefreshAll() -{ - ChangeToRow( GetFirstRow() ); - OnRowValueChanged( (EditMenuRow)0 ); - - // Select the current song if any - if( GAMESTATE->m_pCurSong ) - { - for( unsigned i=0; im_pCurSong->m_sGroupName == m_sGroups[i] ) - m_iSelection[ROW_GROUP] = i; - OnRowValueChanged( ROW_GROUP ); - - for( unsigned i=0; im_pCurSong == m_pSongs[i] ) - m_iSelection[ROW_SONG] = i; - OnRowValueChanged( ROW_SONG ); - - // Select the current StepsType and difficulty if any - if( GAMESTATE->m_pCurSteps[PLAYER_1] ) - { - for( unsigned i=0; im_pCurSteps[PLAYER_1]->m_StepsType ) - { - m_iSelection[ROW_STEPS_TYPE] = i; - OnRowValueChanged( ROW_STEPS_TYPE ); - } - } - - for( unsigned i=0; im_pCurSteps[PLAYER_1] ) - { - m_iSelection[ROW_STEPS] = i; - OnRowValueChanged( ROW_STEPS ); - } - } - } - } -} - -bool EditMenu::CanGoUp() -{ - return m_SelectedRow != GetFirstRow(); -} - -bool EditMenu::CanGoDown() -{ - return m_SelectedRow != NUM_EditMenuRow-1; -} - -bool EditMenu::CanGoLeft() -{ - if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP ) - return true; // wraps - return m_iSelection[m_SelectedRow] != 0; -} - -int EditMenu::GetRowSize( EditMenuRow er ) const -{ - switch( er ) - { - case ROW_GROUP: return m_sGroups.size(); - case ROW_SONG: return m_pSongs.size(); - case ROW_STEPS_TYPE: return m_StepsTypes.size(); - case ROW_STEPS: return m_vpSteps.size(); - case ROW_SOURCE_STEPS_TYPE: return m_StepsTypes.size(); - case ROW_SOURCE_STEPS: return m_vpSourceSteps.size(); - case ROW_ACTION: return m_Actions.size(); - default: FAIL_M( ssprintf("%i", er) ); - } -} - - -bool EditMenu::CanGoRight() -{ - if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP ) - return true; // wraps - return m_iSelection[m_SelectedRow] != GetRowSize(m_SelectedRow)-1; -} - -bool EditMenu::RowIsSelectable( EditMenuRow row ) -{ - if( EDIT_MODE == EditMode_Home && row == ROW_STEPS ) - return false; - - if( GetSelectedSteps() ) - { - switch( row ) - { - case ROW_SOURCE_STEPS_TYPE: - case ROW_SOURCE_STEPS: - return false; - } - } - - return true; -} - -void EditMenu::Up() -{ - EditMenuRow dest = m_SelectedRow; -try_again: - dest = (EditMenuRow)(dest-1); - if( !RowIsSelectable(dest) ) - goto try_again; - ASSERT( dest >= 0 ); - ChangeToRow( dest ); - m_soundChangeRow.Play(); -} - -void EditMenu::Down() -{ - EditMenuRow dest = m_SelectedRow; -try_again: - dest = (EditMenuRow)(dest+1); - if( !RowIsSelectable(dest) ) - goto try_again; - ASSERT( dest < NUM_EditMenuRow ); - ChangeToRow( dest ); - m_soundChangeRow.Play(); -} - -void EditMenu::Left() -{ - if( CanGoLeft() ) - { - m_iSelection[m_SelectedRow]--; - wrap( m_iSelection[m_SelectedRow], GetRowSize(m_SelectedRow) ); - OnRowValueChanged( m_SelectedRow ); - m_soundChangeValue.Play(); - } -} - -void EditMenu::Right() -{ - if( CanGoRight() ) - { - m_iSelection[m_SelectedRow]++; - wrap( m_iSelection[m_SelectedRow], GetRowSize(m_SelectedRow) ); - OnRowValueChanged( m_SelectedRow ); - m_soundChangeValue.Play(); - } -} - -void EditMenu::ChangeToRow( EditMenuRow newRow ) -{ - m_textLabel[newRow].PlayCommand("GainFocus"); - m_textValue[newRow].PlayCommand("GainFocus"); - m_textLabel[m_SelectedRow].PlayCommand("LoseFocus"); - m_textValue[m_SelectedRow].PlayCommand("LoseFocus"); - - m_SelectedRow = newRow; - - for( int i=0; i<2; i++ ) - m_sprArrows[i]->SetY( ROW_Y.GetValue(newRow) ); - UpdateArrows(); -} - -void EditMenu::UpdateArrows() -{ - m_sprArrows[0]->RunCommands( CanGoLeft() ? ARROWS_ENABLED_COMMAND : ARROWS_DISABLED_COMMAND ); - m_sprArrows[1]->RunCommands( CanGoRight() ? ARROWS_ENABLED_COMMAND : ARROWS_DISABLED_COMMAND ); - m_sprArrows[0]->EnableAnimation( CanGoLeft() ); - m_sprArrows[1]->EnableAnimation( CanGoRight() ); -} - -static LocalizedString BLANK ( "EditMenu", "Blank" ); -void EditMenu::OnRowValueChanged( EditMenuRow row ) -{ - UpdateArrows(); - - switch( row ) - { - case ROW_GROUP: - m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); - if( SHOW_GROUPS.GetValue() ) - { - m_GroupBanner.LoadFromSongGroup( GetSelectedGroup() ); - m_GroupBanner.PlayCommand("Changed"); - } - m_pSongs.clear(); - GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs ); - m_iSelection[ROW_SONG] = 0; - // fall through - case ROW_SONG: - m_textValue[ROW_SONG].SetText( "" ); - m_SongBanner.LoadFromSong( GetSelectedSong() ); - m_SongBanner.PlayCommand("Changed"); - m_SongTextBanner.SetFromSong( GetSelectedSong() ); - - // fall through - case ROW_STEPS_TYPE: - m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedStepsType()).GetLocalizedString() ); - - { - Difficulty dcOld = Difficulty_Invalid; - if( !m_vpSteps.empty() ) - dcOld = GetSelectedDifficulty(); - - m_vpSteps.clear(); - - FOREACH_ENUM( Difficulty, dc ) - { - if( dc == Difficulty_Edit ) - { - switch( EDIT_MODE.GetValue() ) - { - case EditMode_Full: - case EditMode_CourseMods: - case EditMode_Practice: - { - vector v; - SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedStepsType(), Difficulty_Edit ); - StepsUtil::SortStepsByDescription( v ); - FOREACH_CONST( Steps*, v, p ) - m_vpSteps.push_back( StepsAndDifficulty(*p,dc) ); - } - break; - case EditMode_Home: - // have only "New Edit" - break; - default: - ASSERT(0); - } - - switch( EDIT_MODE.GetValue() ) - { - case EditMode_Practice: - case EditMode_CourseMods: - break; - case EditMode_Home: - case EditMode_Full: - m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit" - break; - default: - ASSERT(0); - } - } - else - { - Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedStepsType(), dc ); - if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) ) - pSteps = NULL; - - switch( EDIT_MODE.GetValue() ) - { - case EditMode_Home: - // don't allow selecting of non-edits in HomeMode - break; - case EditMode_Practice: - case EditMode_CourseMods: - // only show this difficulty if steps exist - if( pSteps ) - m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) ); - break; - case EditMode_Full: - // show this difficulty whether or not steps exist. - m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) ); - break; - default: - ASSERT(0); - } - } - } - StripLockedStepsAndDifficulty( m_vpSteps ); - - FOREACH( StepsAndDifficulty, m_vpSteps, s ) - { - if( s->dc == dcOld ) - { - m_iSelection[ROW_STEPS] = s - m_vpSteps.begin(); - break; - } - } - } - - CLAMP( m_iSelection[ROW_STEPS], 0, m_vpSteps.size()-1 ); - - // fall through - case ROW_STEPS: - { - RString s = CustomDifficultyToLocalizedString( GetCustomDifficulty( GetSelectedStepsType(), GetSelectedDifficulty(), CourseType_Invalid ) ); - - m_textValue[ROW_STEPS].SetText( s ); - } - if( GetSelectedSteps() ) - m_StepsDisplay.SetFromSteps( GetSelectedSteps() ); - else - m_StepsDisplay.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GetSelectedSourceStepsType(), 0, GetSelectedDifficulty(), CourseType_Invalid ); - // fall through - case ROW_SOURCE_STEPS_TYPE: - m_textLabel[ROW_SOURCE_STEPS_TYPE].SetVisible( GetSelectedSteps() ? false : true ); - m_textValue[ROW_SOURCE_STEPS_TYPE].SetVisible( GetSelectedSteps() ? false : true ); - m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedSourceStepsType()).GetLocalizedString() ); - - m_vpSourceSteps.clear(); - m_vpSourceSteps.push_back( StepsAndDifficulty(NULL,Difficulty_Invalid) ); // "blank" - FOREACH_ENUM( Difficulty, dc ) - { - // fill in m_vpSourceSteps - if( dc != Difficulty_Edit ) - { - Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedSourceStepsType(), dc ); - if( pSteps != NULL ) - m_vpSourceSteps.push_back( StepsAndDifficulty(pSteps,dc) ); - } - else - { - vector v; - SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedSourceStepsType(), dc ); - StepsUtil::SortStepsByDescription( v ); - FOREACH_CONST( Steps*, v, pSteps ) - m_vpSourceSteps.push_back( StepsAndDifficulty(*pSteps,dc) ); - } - } - StripLockedStepsAndDifficulty( m_vpSteps ); - CLAMP( m_iSelection[ROW_SOURCE_STEPS], 0, m_vpSourceSteps.size()-1 ); - // fall through - case ROW_SOURCE_STEPS: - { - m_textLabel[ROW_SOURCE_STEPS].SetVisible( GetSelectedSteps() ? false : true ); - m_textValue[ROW_SOURCE_STEPS].SetVisible( GetSelectedSteps() ? false : true ); - { - RString s; - if( GetSelectedSourceDifficulty() == Difficulty_Invalid ) - { - s = BLANK; - } - else - { - s = CustomDifficultyToLocalizedString( GetCustomDifficulty( GetSelectedSourceStepsType(), GetSelectedSourceDifficulty(), CourseType_Invalid ) ); - } - m_textValue[ROW_SOURCE_STEPS].SetText( s ); - } - bool bHideMeter = false; - if( GetSelectedSourceDifficulty() == Difficulty_Invalid ) - bHideMeter = true; - else if( GetSelectedSourceSteps() ) - m_StepsDisplaySource.SetFromSteps( GetSelectedSourceSteps() ); - else - m_StepsDisplaySource.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GetSelectedSourceStepsType(), 0, GetSelectedSourceDifficulty(), CourseType_Invalid ); - m_StepsDisplaySource.SetVisible( !(bHideMeter || GetSelectedSteps()) ); - - m_Actions.clear(); - if( GetSelectedSteps() ) - { - switch( EDIT_MODE.GetValue() ) - { - case EditMode_Practice: - case EditMode_CourseMods: - m_Actions.push_back( EditMenuAction_Practice ); - break; - case EditMode_Home: - case EditMode_Full: - m_Actions.push_back( EditMenuAction_Edit ); - m_Actions.push_back( EditMenuAction_Delete ); - break; - default: - ASSERT(0); - } - } - else - { - m_Actions.push_back( EditMenuAction_Create ); - } - m_iSelection[ROW_ACTION] = 0; - } - // fall through - case ROW_ACTION: - m_textValue[ROW_ACTION].SetText( EditMenuActionToLocalizedString(GetSelectedAction()) ); - break; - default: - ASSERT(0); // invalid row - } -} - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "EditMenu.h" +#include "RageLog.h" +#include "SongManager.h" +#include "GameState.h" +#include "ThemeManager.h" +#include "GameManager.h" +#include "Steps.h" +#include "Song.h" +#include "StepsUtil.h" +#include "Foreach.h" +#include "CommonMetrics.h" +#include "BannerCache.h" +#include "UnlockManager.h" +#include "SongUtil.h" + +static const char *EditMenuRowNames[] = { + "Group", + "Song", + "StepsType", + "Steps", + "SourceStepsType", + "SourceSteps", + "Action" +}; +XToString( EditMenuRow ); +XToLocalizedString( EditMenuRow ); + +static const char *EditMenuActionNames[] = { + "Edit", + "Delete", + "Create", + "Practice", +}; +XToString( EditMenuAction ); +XToLocalizedString( EditMenuAction ); +StringToX( EditMenuAction ); + +static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); } +static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); } + +void EditMenu::StripLockedStepsAndDifficulty( vector &v ) +{ + const Song *pSong = GetSelectedSong(); + for( int i=(int)v.size()-1; i>=0; i-- ) + { + if( v[i].pSteps && UNLOCKMAN->StepsIsLocked(pSong, v[i].pSteps) ) + v.erase( v.begin()+i ); + } +} + +void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ) +{ + vpSongsOut = SONGMAN->GetSongs( SHOW_GROUPS.GetValue()? sGroup:GROUP_ALL ); + switch( EDIT_MODE.GetValue() ) + { + case EditMode_Practice: + case EditMode_CourseMods: + case EditMode_Home: + for( int i=vpSongsOut.size()-1; i>=0; i-- ) + { + const Song* pSong = vpSongsOut[i]; + if( !pSong->NormallyDisplayed() || pSong->IsTutorial() || SONGMAN->WasLoadedFromAdditionalSongs(pSong) ) + vpSongsOut.erase( vpSongsOut.begin()+i ); + } + break; + case EditMode_Full: + break; + default: + ASSERT(0); + } + SongUtil::SortSongPointerArrayByTitle( vpSongsOut ); +} + +void EditMenu::GetGroupsToShow( vector &vsGroupsOut ) +{ + vsGroupsOut.clear(); + if( !SHOW_GROUPS.GetValue() ) + return; + + SONGMAN->GetSongGroupNames( vsGroupsOut ); + for( int i = vsGroupsOut.size()-1; i>=0; i-- ) + { + const RString &sGroup = vsGroupsOut[i]; + vector vpSongs; + GetSongsToShowForGroup( sGroup, vpSongs ); + // strip groups that have no unlocked songs + if( vpSongs.empty() ) + vsGroupsOut.erase( vsGroupsOut.begin()+i ); + } +} + +EditMenu::EditMenu() +{ +} + +EditMenu::~EditMenu() +{ + BANNERCACHE->Undemand(); +} + +void EditMenu::Load( const RString &sType ) +{ + LOG->Trace( "EditMenu::Load" ); + + SHOW_GROUPS.Load(sType,"ShowGroups"); + ARROWS_X.Load(sType,ARROWS_X_NAME,NUM_ARROWS); + ARROWS_ENABLED_COMMAND.Load(sType,"ArrowsEnabledCommand"); + ARROWS_DISABLED_COMMAND.Load(sType,"ArrowsDisabledCommand"); + ROW_Y.Load(sType,ROW_Y_NAME,NUM_EditMenuRow); + EDIT_MODE.Load(sType,"EditMode"); + TEXT_BANNER_TYPE.Load( m_sName, "TextBannerType" ); + + for( int i=0; i<2; i++ ) + { + m_sprArrows[i].Load( THEME->GetPathG(sType,i==0?"left":"right") ); + m_sprArrows[i]->SetX( ARROWS_X.GetValue(i) ); + this->AddChild( m_sprArrows[i] ); + } + + m_SelectedRow = GetFirstRow(); + + ZERO( m_iSelection ); + + FOREACH_EditMenuRow( r ) + { + m_textLabel[r].SetName(ssprintf("Label%i",r+1)); + m_textLabel[r].LoadFromFont( THEME->GetPathF(sType,"title") ); + m_textLabel[r].SetText( EditMenuRowToLocalizedString(r) ); + ActorUtil::LoadAllCommandsAndSetXY( m_textLabel[r], sType ); + //m_textLabel[r].SetHorizAlign( align_left ); + this->AddChild( &m_textLabel[r] ); + + m_textValue[r].SetName(ssprintf("Value%i",r+1)); + m_textValue[r].LoadFromFont( THEME->GetPathF(sType,"value") ); + m_textValue[r].SetText( "blah" ); + ActorUtil::LoadAllCommandsAndSetXY( m_textValue[r], sType ); + this->AddChild( &m_textValue[r] ); + } + + m_textLabel[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() ); + m_textValue[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() ); + + // Load low-res banners, if needed. + BANNERCACHE->Demand(); + + if( SHOW_GROUPS.GetValue() ) + { + m_GroupBanner.SetName( "GroupBanner" ); + ActorUtil::SetXY( m_GroupBanner, sType ); + ActorUtil::LoadAllCommands( m_GroupBanner, sType ); + this->AddChild( &m_GroupBanner ); + } + + m_SongBanner.SetName( "SongBanner" ); + ActorUtil::SetXY( m_SongBanner, sType ); + ActorUtil::LoadAllCommands( m_SongBanner, sType ); + this->AddChild( &m_SongBanner ); + + m_SongTextBanner.SetName( "SongTextBanner" ); + m_SongTextBanner.Load( TEXT_BANNER_TYPE ); + ActorUtil::SetXY( m_SongTextBanner, sType ); + ActorUtil::LoadAllCommands( m_SongTextBanner, sType ); + this->AddChild( &m_SongTextBanner ); + + m_StepsDisplay.SetName( "StepsDisplay" ); + m_StepsDisplay.Load( "StepsDisplayEdit", NULL ); + ActorUtil::SetXY( m_StepsDisplay, sType ); + this->AddChild( &m_StepsDisplay ); + + m_StepsDisplaySource.SetName( "StepsDisplaySource" ); + m_StepsDisplaySource.Load( "StepsDisplayEdit", NULL ); + ActorUtil::SetXY( m_StepsDisplaySource, sType ); + this->AddChild( &m_StepsDisplaySource ); + + m_soundChangeRow.Load( THEME->GetPathS(sType,"row"), true ); + m_soundChangeValue.Load( THEME->GetPathS(sType,"value"), true ); + + // fill in data structures + GetGroupsToShow( m_sGroups ); + m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); + + RefreshAll(); +} + +void EditMenu::RefreshAll() +{ + ChangeToRow( GetFirstRow() ); + OnRowValueChanged( (EditMenuRow)0 ); + + // Select the current song if any + if( GAMESTATE->m_pCurSong ) + { + for( unsigned i=0; im_pCurSong->m_sGroupName == m_sGroups[i] ) + m_iSelection[ROW_GROUP] = i; + OnRowValueChanged( ROW_GROUP ); + + for( unsigned i=0; im_pCurSong == m_pSongs[i] ) + m_iSelection[ROW_SONG] = i; + OnRowValueChanged( ROW_SONG ); + + // Select the current StepsType and difficulty if any + if( GAMESTATE->m_pCurSteps[PLAYER_1] ) + { + for( unsigned i=0; im_pCurSteps[PLAYER_1]->m_StepsType ) + { + m_iSelection[ROW_STEPS_TYPE] = i; + OnRowValueChanged( ROW_STEPS_TYPE ); + } + } + + for( unsigned i=0; im_pCurSteps[PLAYER_1] ) + { + m_iSelection[ROW_STEPS] = i; + OnRowValueChanged( ROW_STEPS ); + } + } + } + } +} + +bool EditMenu::CanGoUp() +{ + return m_SelectedRow != GetFirstRow(); +} + +bool EditMenu::CanGoDown() +{ + return m_SelectedRow != NUM_EditMenuRow-1; +} + +bool EditMenu::CanGoLeft() +{ + if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP ) + return true; // wraps + return m_iSelection[m_SelectedRow] != 0; +} + +int EditMenu::GetRowSize( EditMenuRow er ) const +{ + switch( er ) + { + case ROW_GROUP: return m_sGroups.size(); + case ROW_SONG: return m_pSongs.size(); + case ROW_STEPS_TYPE: return m_StepsTypes.size(); + case ROW_STEPS: return m_vpSteps.size(); + case ROW_SOURCE_STEPS_TYPE: return m_StepsTypes.size(); + case ROW_SOURCE_STEPS: return m_vpSourceSteps.size(); + case ROW_ACTION: return m_Actions.size(); + default: FAIL_M( ssprintf("%i", er) ); + } +} + + +bool EditMenu::CanGoRight() +{ + if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP ) + return true; // wraps + return m_iSelection[m_SelectedRow] != GetRowSize(m_SelectedRow)-1; +} + +bool EditMenu::RowIsSelectable( EditMenuRow row ) +{ + if( EDIT_MODE == EditMode_Home && row == ROW_STEPS ) + return false; + + if( GetSelectedSteps() ) + { + switch( row ) + { + case ROW_SOURCE_STEPS_TYPE: + case ROW_SOURCE_STEPS: + return false; + } + } + + return true; +} + +void EditMenu::Up() +{ + EditMenuRow dest = m_SelectedRow; +try_again: + dest = (EditMenuRow)(dest-1); + if( !RowIsSelectable(dest) ) + goto try_again; + ASSERT( dest >= 0 ); + ChangeToRow( dest ); + m_soundChangeRow.Play(); +} + +void EditMenu::Down() +{ + EditMenuRow dest = m_SelectedRow; +try_again: + dest = (EditMenuRow)(dest+1); + if( !RowIsSelectable(dest) ) + goto try_again; + ASSERT( dest < NUM_EditMenuRow ); + ChangeToRow( dest ); + m_soundChangeRow.Play(); +} + +void EditMenu::Left() +{ + if( CanGoLeft() ) + { + m_iSelection[m_SelectedRow]--; + wrap( m_iSelection[m_SelectedRow], GetRowSize(m_SelectedRow) ); + OnRowValueChanged( m_SelectedRow ); + m_soundChangeValue.Play(); + } +} + +void EditMenu::Right() +{ + if( CanGoRight() ) + { + m_iSelection[m_SelectedRow]++; + wrap( m_iSelection[m_SelectedRow], GetRowSize(m_SelectedRow) ); + OnRowValueChanged( m_SelectedRow ); + m_soundChangeValue.Play(); + } +} + +void EditMenu::ChangeToRow( EditMenuRow newRow ) +{ + m_textLabel[newRow].PlayCommand("GainFocus"); + m_textValue[newRow].PlayCommand("GainFocus"); + m_textLabel[m_SelectedRow].PlayCommand("LoseFocus"); + m_textValue[m_SelectedRow].PlayCommand("LoseFocus"); + + m_SelectedRow = newRow; + + for( int i=0; i<2; i++ ) + m_sprArrows[i]->SetY( ROW_Y.GetValue(newRow) ); + UpdateArrows(); +} + +void EditMenu::UpdateArrows() +{ + m_sprArrows[0]->RunCommands( CanGoLeft() ? ARROWS_ENABLED_COMMAND : ARROWS_DISABLED_COMMAND ); + m_sprArrows[1]->RunCommands( CanGoRight() ? ARROWS_ENABLED_COMMAND : ARROWS_DISABLED_COMMAND ); + m_sprArrows[0]->EnableAnimation( CanGoLeft() ); + m_sprArrows[1]->EnableAnimation( CanGoRight() ); +} + +static LocalizedString BLANK ( "EditMenu", "Blank" ); +void EditMenu::OnRowValueChanged( EditMenuRow row ) +{ + UpdateArrows(); + + switch( row ) + { + case ROW_GROUP: + m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); + if( SHOW_GROUPS.GetValue() ) + { + m_GroupBanner.LoadFromSongGroup( GetSelectedGroup() ); + m_GroupBanner.PlayCommand("Changed"); + } + m_pSongs.clear(); + GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs ); + m_iSelection[ROW_SONG] = 0; + // fall through + case ROW_SONG: + m_textValue[ROW_SONG].SetText( "" ); + m_SongBanner.LoadFromSong( GetSelectedSong() ); + m_SongBanner.PlayCommand("Changed"); + m_SongTextBanner.SetFromSong( GetSelectedSong() ); + + // fall through + case ROW_STEPS_TYPE: + m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedStepsType()).GetLocalizedString() ); + + { + Difficulty dcOld = Difficulty_Invalid; + if( !m_vpSteps.empty() ) + dcOld = GetSelectedDifficulty(); + + m_vpSteps.clear(); + + FOREACH_ENUM( Difficulty, dc ) + { + if( dc == Difficulty_Edit ) + { + switch( EDIT_MODE.GetValue() ) + { + case EditMode_Full: + case EditMode_CourseMods: + case EditMode_Practice: + { + vector v; + SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedStepsType(), Difficulty_Edit ); + StepsUtil::SortStepsByDescription( v ); + FOREACH_CONST( Steps*, v, p ) + m_vpSteps.push_back( StepsAndDifficulty(*p,dc) ); + } + break; + case EditMode_Home: + // have only "New Edit" + break; + default: + ASSERT(0); + } + + switch( EDIT_MODE.GetValue() ) + { + case EditMode_Practice: + case EditMode_CourseMods: + break; + case EditMode_Home: + case EditMode_Full: + m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit" + break; + default: + ASSERT(0); + } + } + else + { + Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedStepsType(), dc ); + if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) ) + pSteps = NULL; + + switch( EDIT_MODE.GetValue() ) + { + case EditMode_Home: + // don't allow selecting of non-edits in HomeMode + break; + case EditMode_Practice: + case EditMode_CourseMods: + // only show this difficulty if steps exist + if( pSteps ) + m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) ); + break; + case EditMode_Full: + // show this difficulty whether or not steps exist. + m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) ); + break; + default: + ASSERT(0); + } + } + } + StripLockedStepsAndDifficulty( m_vpSteps ); + + FOREACH( StepsAndDifficulty, m_vpSteps, s ) + { + if( s->dc == dcOld ) + { + m_iSelection[ROW_STEPS] = s - m_vpSteps.begin(); + break; + } + } + } + + CLAMP( m_iSelection[ROW_STEPS], 0, m_vpSteps.size()-1 ); + + // fall through + case ROW_STEPS: + { + RString s = CustomDifficultyToLocalizedString( GetCustomDifficulty( GetSelectedStepsType(), GetSelectedDifficulty(), CourseType_Invalid ) ); + + m_textValue[ROW_STEPS].SetText( s ); + } + if( GetSelectedSteps() ) + m_StepsDisplay.SetFromSteps( GetSelectedSteps() ); + else + m_StepsDisplay.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GetSelectedSourceStepsType(), 0, GetSelectedDifficulty(), CourseType_Invalid ); + // fall through + case ROW_SOURCE_STEPS_TYPE: + m_textLabel[ROW_SOURCE_STEPS_TYPE].SetVisible( GetSelectedSteps() ? false : true ); + m_textValue[ROW_SOURCE_STEPS_TYPE].SetVisible( GetSelectedSteps() ? false : true ); + m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->GetStepsTypeInfo(GetSelectedSourceStepsType()).GetLocalizedString() ); + + m_vpSourceSteps.clear(); + m_vpSourceSteps.push_back( StepsAndDifficulty(NULL,Difficulty_Invalid) ); // "blank" + FOREACH_ENUM( Difficulty, dc ) + { + // fill in m_vpSourceSteps + if( dc != Difficulty_Edit ) + { + Steps *pSteps = SongUtil::GetStepsByDifficulty( GetSelectedSong(), GetSelectedSourceStepsType(), dc ); + if( pSteps != NULL ) + m_vpSourceSteps.push_back( StepsAndDifficulty(pSteps,dc) ); + } + else + { + vector v; + SongUtil::GetSteps( GetSelectedSong(), v, GetSelectedSourceStepsType(), dc ); + StepsUtil::SortStepsByDescription( v ); + FOREACH_CONST( Steps*, v, pSteps ) + m_vpSourceSteps.push_back( StepsAndDifficulty(*pSteps,dc) ); + } + } + StripLockedStepsAndDifficulty( m_vpSteps ); + CLAMP( m_iSelection[ROW_SOURCE_STEPS], 0, m_vpSourceSteps.size()-1 ); + // fall through + case ROW_SOURCE_STEPS: + { + m_textLabel[ROW_SOURCE_STEPS].SetVisible( GetSelectedSteps() ? false : true ); + m_textValue[ROW_SOURCE_STEPS].SetVisible( GetSelectedSteps() ? false : true ); + { + RString s; + if( GetSelectedSourceDifficulty() == Difficulty_Invalid ) + { + s = BLANK; + } + else + { + s = CustomDifficultyToLocalizedString( GetCustomDifficulty( GetSelectedSourceStepsType(), GetSelectedSourceDifficulty(), CourseType_Invalid ) ); + } + m_textValue[ROW_SOURCE_STEPS].SetText( s ); + } + bool bHideMeter = false; + if( GetSelectedSourceDifficulty() == Difficulty_Invalid ) + bHideMeter = true; + else if( GetSelectedSourceSteps() ) + m_StepsDisplaySource.SetFromSteps( GetSelectedSourceSteps() ); + else + m_StepsDisplaySource.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GetSelectedSourceStepsType(), 0, GetSelectedSourceDifficulty(), CourseType_Invalid ); + m_StepsDisplaySource.SetVisible( !(bHideMeter || GetSelectedSteps()) ); + + m_Actions.clear(); + if( GetSelectedSteps() ) + { + switch( EDIT_MODE.GetValue() ) + { + case EditMode_Practice: + case EditMode_CourseMods: + m_Actions.push_back( EditMenuAction_Practice ); + break; + case EditMode_Home: + case EditMode_Full: + m_Actions.push_back( EditMenuAction_Edit ); + m_Actions.push_back( EditMenuAction_Delete ); + break; + default: + ASSERT(0); + } + } + else + { + m_Actions.push_back( EditMenuAction_Create ); + } + m_iSelection[ROW_ACTION] = 0; + } + // fall through + case ROW_ACTION: + m_textValue[ROW_ACTION].SetText( EditMenuActionToLocalizedString(GetSelectedAction()) ); + break; + default: + ASSERT(0); // invalid row + } +} + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/EditMenu.h b/src/EditMenu.h index ac5d58be80..28c9730d81 100644 --- a/src/EditMenu.h +++ b/src/EditMenu.h @@ -1,173 +1,173 @@ -#ifndef EDIT_MENU_H -#define EDIT_MENU_H - -#include "ActorFrame.h" -#include "FadingBanner.h" -#include "TextBanner.h" -#include "GameConstantsAndTypes.h" -#include "StepsDisplay.h" -#include "RageSound.h" -#include "EnumHelper.h" -#include "ThemeMetric.h" - -enum EditMenuRow -{ - ROW_GROUP, - ROW_SONG, - ROW_STEPS_TYPE, - ROW_STEPS, - ROW_SOURCE_STEPS_TYPE, - ROW_SOURCE_STEPS, - ROW_ACTION, - NUM_EditMenuRow -}; -/** @brief Loop through each EditMenuRow. */ -#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, r ) -const RString& EditMenuRowToString( EditMenuRow r ); -const RString& EditMenuRowToLocalizedString( EditMenuRow r ); - -/** @brief The different actions one can take on a step. */ -enum EditMenuAction -{ - EditMenuAction_Edit, /**< Modify the current step for the Song. */ - EditMenuAction_Delete, /**< Remove the current step from the Song. */ - EditMenuAction_Create, /**< Create a new step for the Song. */ - EditMenuAction_Practice, /**< Practice the current step for the Song. */ - NUM_EditMenuAction, /**< The number of MenuActions available to choose from. */ - EditMenuAction_Invalid -}; -/** @brief Loop through each EditMenuAction. */ -#define FOREACH_EditMenuAction( ema ) FOREACH_ENUM( EditMenuAction, ema ) -const RString& EditMenuActionToString( EditMenuAction ema ); -const RString& EditMenuActionToLocalizedString( EditMenuAction ema ); - -const int NUM_ARROWS = 2; - -/** - * @brief UI on Edit Menu screen. - * - * Create Steps, delete Steps, or launch Steps in editor. */ -class EditMenu: public ActorFrame -{ -public: - EditMenu(); - ~EditMenu(); - void Load( const RString &sType ); - - bool CanGoUp(); - bool CanGoDown(); - bool CanGoLeft(); - bool CanGoRight(); - bool RowIsSelectable( EditMenuRow row ); - - void Up(); - void Down(); - void Left(); - void Right(); - - void RefreshAll(); - - RString GetSelectedGroup() const - { - if( !SHOW_GROUPS.GetValue() ) return GROUP_ALL; - ASSERT_M((int)m_iSelection[ROW_GROUP] < (int)m_sGroups.size(), - ssprintf("Group selection %d < Number of groups %d", m_iSelection[ROW_GROUP], (int)m_sGroups.size())); - return m_sGroups[m_iSelection[ROW_GROUP]]; - } - Song* GetSelectedSong() const { ASSERT(m_iSelection[ROW_SONG] < (int)m_pSongs.size()); return m_pSongs[m_iSelection[ROW_SONG]]; } - StepsType GetSelectedStepsType() const { ASSERT(m_iSelection[ROW_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_STEPS_TYPE]]; } - Steps* GetSelectedSteps() const { ASSERT(m_iSelection[ROW_STEPS] < (int)m_vpSteps.size()); return m_vpSteps[m_iSelection[ROW_STEPS]].pSteps; } - Difficulty GetSelectedDifficulty() const { ASSERT(m_iSelection[ROW_STEPS] < (int)m_vpSteps.size()); return m_vpSteps[m_iSelection[ROW_STEPS]].dc; } - StepsType GetSelectedSourceStepsType() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_SOURCE_STEPS_TYPE]]; } - Steps* GetSelectedSourceSteps() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].pSteps; } - Difficulty GetSelectedSourceDifficulty() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].dc; } - EditMenuAction GetSelectedAction() const { ASSERT(m_iSelection[ROW_ACTION] < (int)m_Actions.size()); return m_Actions[m_iSelection[ROW_ACTION]]; } - - EditMenuRow GetSelectedRow() const { return m_SelectedRow; } - -private: - struct StepsAndDifficulty; - - void StripLockedStepsAndDifficulty( vector &v ); - void GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ); - void GetGroupsToShow( vector &vsGroupsOut ); - - void UpdateArrows(); - AutoActor m_sprArrows[NUM_ARROWS]; - - EditMenuRow m_SelectedRow; - EditMenuRow GetFirstRow() const { return SHOW_GROUPS.GetValue()? ROW_GROUP:ROW_SONG; } - int GetRowSize( EditMenuRow er ) const; - int m_iSelection[NUM_EditMenuRow]; - BitmapText m_textLabel[NUM_EditMenuRow]; - BitmapText m_textValue[NUM_EditMenuRow]; - - /** @brief The group's banner. */ - FadingBanner m_GroupBanner; - /** @brief The Song's banner. */ - FadingBanner m_SongBanner; - TextBanner m_SongTextBanner; - StepsDisplay m_StepsDisplay; - StepsDisplay m_StepsDisplaySource; - - struct StepsAndDifficulty - { - StepsAndDifficulty( Steps *s, Difficulty d ) { pSteps = s; dc = d; } - Steps *pSteps; - Difficulty dc; - }; - - /** @brief The list of groups. */ - vector m_sGroups; - /** @brief The list of Songs in a group. */ - vector m_pSongs; - vector m_StepsTypes; - vector m_vpSteps; - vector m_vpSourceSteps; - vector m_Actions; - - void OnRowValueChanged( EditMenuRow row ); - void ChangeToRow( EditMenuRow newRow ); - - RageSound m_soundChangeRow; - RageSound m_soundChangeValue; - - /** @brief A metric to determine if groups are shown. */ - ThemeMetric SHOW_GROUPS; - ThemeMetric1D ARROWS_X; - ThemeMetric ARROWS_ENABLED_COMMAND; - ThemeMetric ARROWS_DISABLED_COMMAND; - ThemeMetric1D ROW_Y; -public: - ThemeMetric EDIT_MODE; - ThemeMetric TEXT_BANNER_TYPE; -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef EDIT_MENU_H +#define EDIT_MENU_H + +#include "ActorFrame.h" +#include "FadingBanner.h" +#include "TextBanner.h" +#include "GameConstantsAndTypes.h" +#include "StepsDisplay.h" +#include "RageSound.h" +#include "EnumHelper.h" +#include "ThemeMetric.h" + +enum EditMenuRow +{ + ROW_GROUP, + ROW_SONG, + ROW_STEPS_TYPE, + ROW_STEPS, + ROW_SOURCE_STEPS_TYPE, + ROW_SOURCE_STEPS, + ROW_ACTION, + NUM_EditMenuRow +}; +/** @brief Loop through each EditMenuRow. */ +#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, r ) +const RString& EditMenuRowToString( EditMenuRow r ); +const RString& EditMenuRowToLocalizedString( EditMenuRow r ); + +/** @brief The different actions one can take on a step. */ +enum EditMenuAction +{ + EditMenuAction_Edit, /**< Modify the current step for the Song. */ + EditMenuAction_Delete, /**< Remove the current step from the Song. */ + EditMenuAction_Create, /**< Create a new step for the Song. */ + EditMenuAction_Practice, /**< Practice the current step for the Song. */ + NUM_EditMenuAction, /**< The number of MenuActions available to choose from. */ + EditMenuAction_Invalid +}; +/** @brief Loop through each EditMenuAction. */ +#define FOREACH_EditMenuAction( ema ) FOREACH_ENUM( EditMenuAction, ema ) +const RString& EditMenuActionToString( EditMenuAction ema ); +const RString& EditMenuActionToLocalizedString( EditMenuAction ema ); + +const int NUM_ARROWS = 2; + +/** + * @brief UI on Edit Menu screen. + * + * Create Steps, delete Steps, or launch Steps in editor. */ +class EditMenu: public ActorFrame +{ +public: + EditMenu(); + ~EditMenu(); + void Load( const RString &sType ); + + bool CanGoUp(); + bool CanGoDown(); + bool CanGoLeft(); + bool CanGoRight(); + bool RowIsSelectable( EditMenuRow row ); + + void Up(); + void Down(); + void Left(); + void Right(); + + void RefreshAll(); + + RString GetSelectedGroup() const + { + if( !SHOW_GROUPS.GetValue() ) return GROUP_ALL; + ASSERT_M((int)m_iSelection[ROW_GROUP] < (int)m_sGroups.size(), + ssprintf("Group selection %d < Number of groups %d", m_iSelection[ROW_GROUP], (int)m_sGroups.size())); + return m_sGroups[m_iSelection[ROW_GROUP]]; + } + Song* GetSelectedSong() const { ASSERT(m_iSelection[ROW_SONG] < (int)m_pSongs.size()); return m_pSongs[m_iSelection[ROW_SONG]]; } + StepsType GetSelectedStepsType() const { ASSERT(m_iSelection[ROW_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_STEPS_TYPE]]; } + Steps* GetSelectedSteps() const { ASSERT(m_iSelection[ROW_STEPS] < (int)m_vpSteps.size()); return m_vpSteps[m_iSelection[ROW_STEPS]].pSteps; } + Difficulty GetSelectedDifficulty() const { ASSERT(m_iSelection[ROW_STEPS] < (int)m_vpSteps.size()); return m_vpSteps[m_iSelection[ROW_STEPS]].dc; } + StepsType GetSelectedSourceStepsType() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_SOURCE_STEPS_TYPE]]; } + Steps* GetSelectedSourceSteps() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].pSteps; } + Difficulty GetSelectedSourceDifficulty() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].dc; } + EditMenuAction GetSelectedAction() const { ASSERT(m_iSelection[ROW_ACTION] < (int)m_Actions.size()); return m_Actions[m_iSelection[ROW_ACTION]]; } + + EditMenuRow GetSelectedRow() const { return m_SelectedRow; } + +private: + struct StepsAndDifficulty; + + void StripLockedStepsAndDifficulty( vector &v ); + void GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ); + void GetGroupsToShow( vector &vsGroupsOut ); + + void UpdateArrows(); + AutoActor m_sprArrows[NUM_ARROWS]; + + EditMenuRow m_SelectedRow; + EditMenuRow GetFirstRow() const { return SHOW_GROUPS.GetValue()? ROW_GROUP:ROW_SONG; } + int GetRowSize( EditMenuRow er ) const; + int m_iSelection[NUM_EditMenuRow]; + BitmapText m_textLabel[NUM_EditMenuRow]; + BitmapText m_textValue[NUM_EditMenuRow]; + + /** @brief The group's banner. */ + FadingBanner m_GroupBanner; + /** @brief The Song's banner. */ + FadingBanner m_SongBanner; + TextBanner m_SongTextBanner; + StepsDisplay m_StepsDisplay; + StepsDisplay m_StepsDisplaySource; + + struct StepsAndDifficulty + { + StepsAndDifficulty( Steps *s, Difficulty d ) { pSteps = s; dc = d; } + Steps *pSteps; + Difficulty dc; + }; + + /** @brief The list of groups. */ + vector m_sGroups; + /** @brief The list of Songs in a group. */ + vector m_pSongs; + vector m_StepsTypes; + vector m_vpSteps; + vector m_vpSourceSteps; + vector m_Actions; + + void OnRowValueChanged( EditMenuRow row ); + void ChangeToRow( EditMenuRow newRow ); + + RageSound m_soundChangeRow; + RageSound m_soundChangeValue; + + /** @brief A metric to determine if groups are shown. */ + ThemeMetric SHOW_GROUPS; + ThemeMetric1D ARROWS_X; + ThemeMetric ARROWS_ENABLED_COMMAND; + ThemeMetric ARROWS_DISABLED_COMMAND; + ThemeMetric1D ROW_Y; +public: + ThemeMetric EDIT_MODE; + ThemeMetric TEXT_BANNER_TYPE; +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/EnumHelper.cpp b/src/EnumHelper.cpp index 34c7321247..49e837d33a 100644 --- a/src/EnumHelper.cpp +++ b/src/EnumHelper.cpp @@ -1,163 +1,163 @@ -#include "global.h" -#include "EnumHelper.h" -#include "LuaManager.h" -#include "RageUtil.h" - -int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid ) -{ - luaL_checkany( L, iPos ); - - if( lua_isnil(L, iPos) ) - { - if( bAllowInvalid ) - return iInvalid; - - LuaHelpers::Push( L, ssprintf("Expected %s; got nil", szType) ); - lua_error( L ); - } - - iPos = LuaHelpers::AbsIndex( L, iPos ); - - table.PushSelf( L ); - lua_pushvalue( L, iPos ); - lua_gettable( L, -2 ); - - // If the result is nil, then a string was passed that is not a member of this enum. Throw - // an error. To specify the invalid value, pass nil. That way, typos will throw an error, - // and not silently result in nil, or an out-of-bounds value. - if( unlikely(lua_isnil(L, -1)) ) - { - RString sGot; - if( lua_isstring(L, iPos) ) - { - /* We were given a string, but it wasn't a valid value for this enum. Show - * the string. */ - lua_pushvalue( L, iPos ); - LuaHelpers::Pop( L, sGot ); - sGot = ssprintf( "\"%s\"", sGot.c_str() ); - } - else - { - /* We didn't get a string. Show the type. */ - luaL_pushtype( L, iPos ); - LuaHelpers::Pop( L, sGot ); - } - LuaHelpers::Push( L, ssprintf("Expected %s; got %s", szType, sGot.c_str() ) ); - lua_error( L ); - } - int iRet = lua_tointeger( L, -1 ); - lua_pop( L, 2 ); - return iRet; -} - -// szNameArray is of size iMax; pNameCache is of size iMax+2. -const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr *pNameCache ) -{ - if( unlikely(pNameCache[0].get() == NULL) ) - { - for( int i = 0; i < iMax; ++i ) - { - auto_ptr ap( new RString( szNameArray[i] ) ); - pNameCache[i] = ap; - } - - auto_ptr ap( new RString ); - pNameCache[iMax+1] = ap; - } - - // iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted - // to a string. - // Maybe we should assert on _Invalid? It seems better to make - // the caller check that they're supplying a valid enum value instead of - // returning an inconspicuous garbage value (empty string). -Chris - ASSERT_M( iVal >= 0 && (iVal < iMax || iVal == iMax+1), ssprintf("%i, %i, (%s)", iVal, iMax, szNameArray[0]) ); - return *pNameCache[iVal]; -} - -namespace -{ - int GetName( lua_State *L ) - { - luaL_checktype( L, 1, LUA_TTABLE ); - - /* Look up the reverse table. */ - luaL_getmetafield( L, 1, "name" ); - - /* If there was no metafield, then we were called on the wrong type. */ - if( lua_isnil(L, -1) ) - luaL_typerror( L, 1, "enum" ); - - return 1; - } - - int Reverse( lua_State *L ) - { - luaL_checktype( L, 1, LUA_TTABLE ); - - /* Look up the reverse table. If there is no metafield, then we were - * called on the wrong type. */ - if( !luaL_getmetafield(L, 1, "reverse") ) - luaL_typerror( L, 1, "enum" ); - - return 1; - } -} - -static const luaL_Reg EnumLib[] = { - { "GetName", GetName }, - { "Reverse", Reverse }, - { NULL, NULL } -}; - -static void PushEnumMethodTable( lua_State *L ) -{ - luaL_register( L, "Enum", EnumLib ); -} - -/* Set up the enum table on the stack, and pop the table. */ -void Enum::SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName ) -{ - EnumTable.PushSelf( L ); - { - lua_newtable( L ); - EnumIndexTable.PushSelf( L ); - lua_setfield( L, -2, "reverse" ); - - lua_pushstring( L, szName ); - lua_setfield( L, -2, "name" ); - - PushEnumMethodTable( L ); - lua_setfield( L, -2, "__index" ); - - lua_pushliteral( L, "Enum" ); - LuaHelpers::PushValueFunc( L, 1 ); - lua_setfield( L, -2, "__type" ); // for luaL_pushtype - } - lua_setmetatable( L, -2 ); - lua_pop( L, 2 ); -} - -/* - * (c) 2006 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "EnumHelper.h" +#include "LuaManager.h" +#include "RageUtil.h" + +int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid ) +{ + luaL_checkany( L, iPos ); + + if( lua_isnil(L, iPos) ) + { + if( bAllowInvalid ) + return iInvalid; + + LuaHelpers::Push( L, ssprintf("Expected %s; got nil", szType) ); + lua_error( L ); + } + + iPos = LuaHelpers::AbsIndex( L, iPos ); + + table.PushSelf( L ); + lua_pushvalue( L, iPos ); + lua_gettable( L, -2 ); + + // If the result is nil, then a string was passed that is not a member of this enum. Throw + // an error. To specify the invalid value, pass nil. That way, typos will throw an error, + // and not silently result in nil, or an out-of-bounds value. + if( unlikely(lua_isnil(L, -1)) ) + { + RString sGot; + if( lua_isstring(L, iPos) ) + { + /* We were given a string, but it wasn't a valid value for this enum. Show + * the string. */ + lua_pushvalue( L, iPos ); + LuaHelpers::Pop( L, sGot ); + sGot = ssprintf( "\"%s\"", sGot.c_str() ); + } + else + { + /* We didn't get a string. Show the type. */ + luaL_pushtype( L, iPos ); + LuaHelpers::Pop( L, sGot ); + } + LuaHelpers::Push( L, ssprintf("Expected %s; got %s", szType, sGot.c_str() ) ); + lua_error( L ); + } + int iRet = lua_tointeger( L, -1 ); + lua_pop( L, 2 ); + return iRet; +} + +// szNameArray is of size iMax; pNameCache is of size iMax+2. +const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr *pNameCache ) +{ + if( unlikely(pNameCache[0].get() == NULL) ) + { + for( int i = 0; i < iMax; ++i ) + { + auto_ptr ap( new RString( szNameArray[i] ) ); + pNameCache[i] = ap; + } + + auto_ptr ap( new RString ); + pNameCache[iMax+1] = ap; + } + + // iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted + // to a string. + // Maybe we should assert on _Invalid? It seems better to make + // the caller check that they're supplying a valid enum value instead of + // returning an inconspicuous garbage value (empty string). -Chris + ASSERT_M( iVal >= 0 && (iVal < iMax || iVal == iMax+1), ssprintf("%i, %i, (%s)", iVal, iMax, szNameArray[0]) ); + return *pNameCache[iVal]; +} + +namespace +{ + int GetName( lua_State *L ) + { + luaL_checktype( L, 1, LUA_TTABLE ); + + /* Look up the reverse table. */ + luaL_getmetafield( L, 1, "name" ); + + /* If there was no metafield, then we were called on the wrong type. */ + if( lua_isnil(L, -1) ) + luaL_typerror( L, 1, "enum" ); + + return 1; + } + + int Reverse( lua_State *L ) + { + luaL_checktype( L, 1, LUA_TTABLE ); + + /* Look up the reverse table. If there is no metafield, then we were + * called on the wrong type. */ + if( !luaL_getmetafield(L, 1, "reverse") ) + luaL_typerror( L, 1, "enum" ); + + return 1; + } +} + +static const luaL_Reg EnumLib[] = { + { "GetName", GetName }, + { "Reverse", Reverse }, + { NULL, NULL } +}; + +static void PushEnumMethodTable( lua_State *L ) +{ + luaL_register( L, "Enum", EnumLib ); +} + +/* Set up the enum table on the stack, and pop the table. */ +void Enum::SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName ) +{ + EnumTable.PushSelf( L ); + { + lua_newtable( L ); + EnumIndexTable.PushSelf( L ); + lua_setfield( L, -2, "reverse" ); + + lua_pushstring( L, szName ); + lua_setfield( L, -2, "name" ); + + PushEnumMethodTable( L ); + lua_setfield( L, -2, "__index" ); + + lua_pushliteral( L, "Enum" ); + LuaHelpers::PushValueFunc( L, 1 ); + lua_setfield( L, -2, "__type" ); // for luaL_pushtype + } + lua_setmetatable( L, -2 ); + lua_pop( L, 2 ); +} + +/* + * (c) 2006 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/EnumHelper.h b/src/EnumHelper.h index 5c8b222523..b00c381dfe 100644 --- a/src/EnumHelper.h +++ b/src/EnumHelper.h @@ -1,156 +1,156 @@ -#ifndef ENUM_HELPER_H -#define ENUM_HELPER_H - -#include "LuaReference.h" -#include "RageUtil.h" -#include - -extern "C" -{ -#include "lua-5.1/src/lua.h" -} - -/** @brief A general foreach loop for enumerators, going up to a max value. */ -#define FOREACH_ENUM_N( e, max, var ) for( e var=(e)0; var( var, +1 ) ) -/** @brief A general foreach loop for enumerators. */ -#define FOREACH_ENUM( e, var ) for( e var=(e)0; var( var, +1 ) ) - -int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid ); - -template -struct EnumTraits -{ - static LuaReference StringToEnum; - static LuaReference EnumToString; - static T Invalid; - static const char *szName; -}; -template LuaReference EnumTraits::StringToEnum; -template LuaReference EnumTraits::EnumToString; -/** @brief Lua helpers for Enumerators. */ -namespace Enum -{ - template - static T Check( lua_State *L, int iPos, bool bAllowInvalid = false ) - { - return (T) CheckEnum( L, EnumTraits::StringToEnum, iPos, EnumTraits::Invalid, EnumTraits::szName, bAllowInvalid ); - } - template - static void Push( lua_State *L, T iVal ) - { - /* Enum_Invalid values are nil in Lua. */ - if( iVal == EnumTraits::Invalid ) - { - lua_pushnil( L ); - return; - } - - /* Look up the string value. */ - EnumTraits::EnumToString.PushSelf( L ); - lua_rawgeti( L, -1, iVal + 1 ); - lua_remove( L, -2 ); - } - - void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName ); -}; - -const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr *pNameCache ); // XToString helper - -#define XToString(X) \ - COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \ - const RString& X##ToString( X x ) \ - { \ - static auto_ptr as_##X##Name[NUM_##X+2]; \ - return EnumToString( x, NUM_##X, X##Names, as_##X##Name ); \ - } \ - namespace StringConversion { template<> RString ToString( const X &value ) { return X##ToString(value); } } - -#define XToLocalizedString(X) \ - const RString &X##ToLocalizedString( X x ) \ - { \ - static auto_ptr g_##X##Name[NUM_##X]; \ - if( g_##X##Name[0].get() == NULL ) { \ - for( unsigned i = 0; i < NUM_##X; ++i ) \ - { \ - auto_ptr ap( new LocalizedString(#X, X##ToString((X)i)) ); \ - g_##X##Name[i] = ap; \ - } \ - } \ - return g_##X##Name[x]->GetValue(); \ - } - -#define StringToX(X) \ - X StringTo##X( const RString& s ) \ - { \ - for( unsigned i = 0; i < ARRAYLEN(X##Names); ++i ) \ - if( !s.CompareNoCase(X##Names[i]) ) \ - return (X)i; \ - return X##_Invalid; \ - } \ - namespace StringConversion { template<> bool FromString( const RString &sValue, X &out ) { out = StringTo##X(sValue); return out != X##_Invalid; } } - -// currently unused -#define LuaDeclareType(X) - -#define LuaXType(X) \ -template struct EnumTraits; \ -static void Lua##X(lua_State* L) \ -{ \ - /* Create the EnumToString table: { "UnlockEntry_ArcadePoints", "UnlockEntry_DancePoints" } */ \ - lua_newtable( L ); \ - FOREACH_ENUM( X, i ) \ - { \ - RString s = X##ToString( i ); \ - lua_pushstring( L, (#X "_")+s ); \ - lua_rawseti( L, -2, i+1 ); /* 1-based */ \ - } \ - EnumTraits::EnumToString.SetFromStack( L ); \ - EnumTraits::EnumToString.PushSelf( L ); \ - lua_setglobal( L, #X ); \ - /* Create the StringToEnum table: { "UnlockEntry_ArcadePoints" = 0, "UnlockEntry_DancePoints" = 1 } */ \ - lua_newtable( L ); \ - FOREACH_ENUM( X, i ) \ - { \ - RString s = X##ToString( i ); \ - lua_pushstring( L, (#X "_")+s ); \ - lua_pushnumber( L, i ); /* 0-based */ \ - lua_rawset( L, -3 ); \ - } \ - EnumTraits::StringToEnum.SetFromStack( L ); \ - EnumTraits::StringToEnum.PushSelf( L ); \ - Enum::SetMetatable( L, EnumTraits::EnumToString, EnumTraits::StringToEnum, #X ); \ -} \ -REGISTER_WITH_LUA_FUNCTION( Lua##X ); \ -template<> X EnumTraits::Invalid = X##_Invalid; \ -template<> const char *EnumTraits::szName = #X; \ -namespace LuaHelpers { template<> bool FromStack( lua_State *L, X &Object, int iOffset ) { Object = Enum::Check( L, iOffset, true ); return Object != EnumTraits::Invalid; } } \ -namespace LuaHelpers { template<> void Push( lua_State *L, const X &Object ) { Enum::Push( L, Object ); } } - -#endif - -/** - * @file - * @author Chris Danford, Glenn Maynard (c) 2004-2006 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef ENUM_HELPER_H +#define ENUM_HELPER_H + +#include "LuaReference.h" +#include "RageUtil.h" +#include + +extern "C" +{ +#include "lua-5.1/src/lua.h" +} + +/** @brief A general foreach loop for enumerators, going up to a max value. */ +#define FOREACH_ENUM_N( e, max, var ) for( e var=(e)0; var( var, +1 ) ) +/** @brief A general foreach loop for enumerators. */ +#define FOREACH_ENUM( e, var ) for( e var=(e)0; var( var, +1 ) ) + +int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid ); + +template +struct EnumTraits +{ + static LuaReference StringToEnum; + static LuaReference EnumToString; + static T Invalid; + static const char *szName; +}; +template LuaReference EnumTraits::StringToEnum; +template LuaReference EnumTraits::EnumToString; +/** @brief Lua helpers for Enumerators. */ +namespace Enum +{ + template + static T Check( lua_State *L, int iPos, bool bAllowInvalid = false ) + { + return (T) CheckEnum( L, EnumTraits::StringToEnum, iPos, EnumTraits::Invalid, EnumTraits::szName, bAllowInvalid ); + } + template + static void Push( lua_State *L, T iVal ) + { + /* Enum_Invalid values are nil in Lua. */ + if( iVal == EnumTraits::Invalid ) + { + lua_pushnil( L ); + return; + } + + /* Look up the string value. */ + EnumTraits::EnumToString.PushSelf( L ); + lua_rawgeti( L, -1, iVal + 1 ); + lua_remove( L, -2 ); + } + + void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName ); +}; + +const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr *pNameCache ); // XToString helper + +#define XToString(X) \ + COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \ + const RString& X##ToString( X x ) \ + { \ + static auto_ptr as_##X##Name[NUM_##X+2]; \ + return EnumToString( x, NUM_##X, X##Names, as_##X##Name ); \ + } \ + namespace StringConversion { template<> RString ToString( const X &value ) { return X##ToString(value); } } + +#define XToLocalizedString(X) \ + const RString &X##ToLocalizedString( X x ) \ + { \ + static auto_ptr g_##X##Name[NUM_##X]; \ + if( g_##X##Name[0].get() == NULL ) { \ + for( unsigned i = 0; i < NUM_##X; ++i ) \ + { \ + auto_ptr ap( new LocalizedString(#X, X##ToString((X)i)) ); \ + g_##X##Name[i] = ap; \ + } \ + } \ + return g_##X##Name[x]->GetValue(); \ + } + +#define StringToX(X) \ + X StringTo##X( const RString& s ) \ + { \ + for( unsigned i = 0; i < ARRAYLEN(X##Names); ++i ) \ + if( !s.CompareNoCase(X##Names[i]) ) \ + return (X)i; \ + return X##_Invalid; \ + } \ + namespace StringConversion { template<> bool FromString( const RString &sValue, X &out ) { out = StringTo##X(sValue); return out != X##_Invalid; } } + +// currently unused +#define LuaDeclareType(X) + +#define LuaXType(X) \ +template struct EnumTraits; \ +static void Lua##X(lua_State* L) \ +{ \ + /* Create the EnumToString table: { "UnlockEntry_ArcadePoints", "UnlockEntry_DancePoints" } */ \ + lua_newtable( L ); \ + FOREACH_ENUM( X, i ) \ + { \ + RString s = X##ToString( i ); \ + lua_pushstring( L, (#X "_")+s ); \ + lua_rawseti( L, -2, i+1 ); /* 1-based */ \ + } \ + EnumTraits::EnumToString.SetFromStack( L ); \ + EnumTraits::EnumToString.PushSelf( L ); \ + lua_setglobal( L, #X ); \ + /* Create the StringToEnum table: { "UnlockEntry_ArcadePoints" = 0, "UnlockEntry_DancePoints" = 1 } */ \ + lua_newtable( L ); \ + FOREACH_ENUM( X, i ) \ + { \ + RString s = X##ToString( i ); \ + lua_pushstring( L, (#X "_")+s ); \ + lua_pushnumber( L, i ); /* 0-based */ \ + lua_rawset( L, -3 ); \ + } \ + EnumTraits::StringToEnum.SetFromStack( L ); \ + EnumTraits::StringToEnum.PushSelf( L ); \ + Enum::SetMetatable( L, EnumTraits::EnumToString, EnumTraits::StringToEnum, #X ); \ +} \ +REGISTER_WITH_LUA_FUNCTION( Lua##X ); \ +template<> X EnumTraits::Invalid = X##_Invalid; \ +template<> const char *EnumTraits::szName = #X; \ +namespace LuaHelpers { template<> bool FromStack( lua_State *L, X &Object, int iOffset ) { Object = Enum::Check( L, iOffset, true ); return Object != EnumTraits::Invalid; } } \ +namespace LuaHelpers { template<> void Push( lua_State *L, const X &Object ) { Enum::Push( L, Object ); } } + +#endif + +/** + * @file + * @author Chris Danford, Glenn Maynard (c) 2004-2006 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FadingBanner.cpp b/src/FadingBanner.cpp index cc1948ef2a..e8e536e911 100644 --- a/src/FadingBanner.cpp +++ b/src/FadingBanner.cpp @@ -1,330 +1,330 @@ -#include "global.h" -#include "FadingBanner.h" -#include "RageTextureManager.h" -#include "BannerCache.h" -#include "Song.h" -#include "RageLog.h" -#include "Course.h" -#include "PrefsManager.h" -#include "ThemeManager.h" -#include "SongManager.h" -#include "ThemeMetric.h" -#include "ActorUtil.h" - -REGISTER_ACTOR_CLASS( FadingBanner ); - -/* Allow fading from one banner to another. We can handle two fades at once; - * this is used to fade from an old banner to a low-quality banner to a high- - * quality banner smoothly. - * - * m_iIndexLatest is the latest banner loaded, and the one that we'll end up - * displaying when the fades stop. */ -FadingBanner::FadingBanner() -{ - m_bMovingFast = false; - m_bSkipNextBannerUpdate = false; - m_iIndexLatest = 0; - for( int i=0; iAddChild( &m_Banner[i] ); - } -} - -void FadingBanner::ScaleToClipped( float fWidth, float fHeight ) -{ - for( int i=0; iIsAMovie() ) - return; - m_Banner[m_iIndexLatest].SetSecondsIntoAnimation( 0.f ); - for( int i = 1; i < NUM_BANNERS; ++i ) - { - int index = m_iIndexLatest - i; - wrap( index, NUM_BANNERS ); - if( m_Banner[index].GetTexturePath() == ID.filename ) - m_Banner[index].UnloadTexture(); - } -} - -/* If bLowResToHighRes is true, we're fading from a low-res banner to the - * corresponding high-res banner. */ -void FadingBanner::BeforeChange( bool bLowResToHighRes ) -{ - RString sCommand; - if( bLowResToHighRes ) - sCommand = "FadeFromCached"; - else - sCommand = "FadeOff"; - - m_Banner[m_iIndexLatest].PlayCommand( sCommand ); - ++m_iIndexLatest; - wrap( m_iIndexLatest, NUM_BANNERS ); - - m_Banner[m_iIndexLatest].PlayCommand( "ResetFade" ); - - /* We're about to load a banner. It'll probably cause a frame skip or two. - * Skip an update, so the fade-in doesn't skip. */ - m_bSkipNextBannerUpdate = true; -} - -/* If this returns true, a low-resolution banner was loaded, and the full-res - * banner should be loaded later. */ -bool FadingBanner::LoadFromCachedBanner( const RString &path ) -{ - // If we're already on the given banner, don't fade again. - if( path != "" && m_Banner[m_iIndexLatest].GetTexturePath() == path ) - return false; - - if( path == "" ) - { - LoadFallback(); - return false; - } - - /* If we're currently fading to the given banner, go through this again, - * which will cause the fade-in to be further delayed. */ - - RageTextureID ID; - bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL); - if( !bLowRes ) - { - ID = Sprite::SongBannerTexture( path ); - } - else - { - // Try to load the low quality version. - ID = BANNERCACHE->LoadCachedBanner( path ); - } - - if( !TEXTUREMAN->IsTextureRegistered(ID) ) - { - /* Oops. We couldn't load a banner quickly. We can load the actual - * banner, but that's slow, so we don't want to do that when we're moving - * fast on the music wheel. In that case, we should just keep the banner - * that's there (or load a "moving fast" banner). Once we settle down, - * we'll get called again and load the real banner. */ - - if( m_bMovingFast ) - return false; - - if( IsAFile(path) ) - Load( path ); - else - LoadFallback(); - - return false; - } - - Load( ID ); - - return bLowRes; -} - -void FadingBanner::LoadFromSong( const Song* pSong ) -{ - if( pSong == NULL ) - { - LoadFallback(); - return; - } - - /* Don't call HasBanner. That'll do disk access and cause the music wheel - * to skip. */ - RString sPath = pSong->GetBannerPath(); - if( sPath.empty() ) - LoadFallback(); - else - LoadFromCachedBanner( sPath ); -} - -void FadingBanner::LoadMode() -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadMode(); -} - -void FadingBanner::LoadFromSongGroup( RString sSongGroup ) -{ - const RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); - LoadFromCachedBanner( sGroupBannerPath ); -} - -void FadingBanner::LoadFromCourse( const Course* pCourse ) -{ - if( pCourse == NULL ) - { - LoadFallback(); - return; - } - - /* Don't call HasBanner. That'll do disk access and cause the music wheel - * to skip. */ - RString sPath = pCourse->GetBannerPath(); - if( sPath.empty() ) - LoadCourseFallback(); - else - LoadFromCachedBanner( sPath ); -} - -void FadingBanner::LoadIconFromCharacter( Character* pCharacter ) -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadIconFromCharacter( pCharacter ); -} - -void FadingBanner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE ) -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadBannerFromUnlockEntry( pUE ); -} - -void FadingBanner::LoadRoulette() -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadRoulette(); -} - -void FadingBanner::LoadRandom() -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadRandom(); -} - -void FadingBanner::LoadFromSortOrder( SortOrder so ) -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadFromSortOrder(so); -} - -void FadingBanner::LoadFallback() -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadFallback(); -} - -void FadingBanner::LoadCourseFallback() -{ - BeforeChange(); - m_Banner[m_iIndexLatest].LoadCourseFallback(); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the FadingBanner. */ -class LunaFadingBanner: public Luna -{ -public: - static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int LoadFromSong( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } - else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } - return 0; - } - static int LoadFromCourse( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } - else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } - return 0; - } - static int LoadIconFromCharacter( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } - else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; - } - static int LoadCardFromCharacter( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } - else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; - } - static int LoadFromSongGroup( T* p, lua_State *L ) { p->LoadFromSongGroup( SArg(1) ); return 0; } - static int GetLatestIndex( T* p, lua_State *L ){ lua_pushnumber( L, p->GetLatestIndex() ); return 1; } - - LunaFadingBanner() - { - ADD_METHOD( scaletoclipped ); - ADD_METHOD( ScaleToClipped ); - ADD_METHOD( LoadFromSong ); - ADD_METHOD( LoadFromSongGroup ); - ADD_METHOD( LoadFromCourse ); - ADD_METHOD( LoadIconFromCharacter ); - ADD_METHOD( LoadCardFromCharacter ); - ADD_METHOD( GetLatestIndex ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( FadingBanner, ActorFrame ) -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "FadingBanner.h" +#include "RageTextureManager.h" +#include "BannerCache.h" +#include "Song.h" +#include "RageLog.h" +#include "Course.h" +#include "PrefsManager.h" +#include "ThemeManager.h" +#include "SongManager.h" +#include "ThemeMetric.h" +#include "ActorUtil.h" + +REGISTER_ACTOR_CLASS( FadingBanner ); + +/* Allow fading from one banner to another. We can handle two fades at once; + * this is used to fade from an old banner to a low-quality banner to a high- + * quality banner smoothly. + * + * m_iIndexLatest is the latest banner loaded, and the one that we'll end up + * displaying when the fades stop. */ +FadingBanner::FadingBanner() +{ + m_bMovingFast = false; + m_bSkipNextBannerUpdate = false; + m_iIndexLatest = 0; + for( int i=0; iAddChild( &m_Banner[i] ); + } +} + +void FadingBanner::ScaleToClipped( float fWidth, float fHeight ) +{ + for( int i=0; iIsAMovie() ) + return; + m_Banner[m_iIndexLatest].SetSecondsIntoAnimation( 0.f ); + for( int i = 1; i < NUM_BANNERS; ++i ) + { + int index = m_iIndexLatest - i; + wrap( index, NUM_BANNERS ); + if( m_Banner[index].GetTexturePath() == ID.filename ) + m_Banner[index].UnloadTexture(); + } +} + +/* If bLowResToHighRes is true, we're fading from a low-res banner to the + * corresponding high-res banner. */ +void FadingBanner::BeforeChange( bool bLowResToHighRes ) +{ + RString sCommand; + if( bLowResToHighRes ) + sCommand = "FadeFromCached"; + else + sCommand = "FadeOff"; + + m_Banner[m_iIndexLatest].PlayCommand( sCommand ); + ++m_iIndexLatest; + wrap( m_iIndexLatest, NUM_BANNERS ); + + m_Banner[m_iIndexLatest].PlayCommand( "ResetFade" ); + + /* We're about to load a banner. It'll probably cause a frame skip or two. + * Skip an update, so the fade-in doesn't skip. */ + m_bSkipNextBannerUpdate = true; +} + +/* If this returns true, a low-resolution banner was loaded, and the full-res + * banner should be loaded later. */ +bool FadingBanner::LoadFromCachedBanner( const RString &path ) +{ + // If we're already on the given banner, don't fade again. + if( path != "" && m_Banner[m_iIndexLatest].GetTexturePath() == path ) + return false; + + if( path == "" ) + { + LoadFallback(); + return false; + } + + /* If we're currently fading to the given banner, go through this again, + * which will cause the fade-in to be further delayed. */ + + RageTextureID ID; + bool bLowRes = (PREFSMAN->m_BannerCache != BNCACHE_FULL); + if( !bLowRes ) + { + ID = Sprite::SongBannerTexture( path ); + } + else + { + // Try to load the low quality version. + ID = BANNERCACHE->LoadCachedBanner( path ); + } + + if( !TEXTUREMAN->IsTextureRegistered(ID) ) + { + /* Oops. We couldn't load a banner quickly. We can load the actual + * banner, but that's slow, so we don't want to do that when we're moving + * fast on the music wheel. In that case, we should just keep the banner + * that's there (or load a "moving fast" banner). Once we settle down, + * we'll get called again and load the real banner. */ + + if( m_bMovingFast ) + return false; + + if( IsAFile(path) ) + Load( path ); + else + LoadFallback(); + + return false; + } + + Load( ID ); + + return bLowRes; +} + +void FadingBanner::LoadFromSong( const Song* pSong ) +{ + if( pSong == NULL ) + { + LoadFallback(); + return; + } + + /* Don't call HasBanner. That'll do disk access and cause the music wheel + * to skip. */ + RString sPath = pSong->GetBannerPath(); + if( sPath.empty() ) + LoadFallback(); + else + LoadFromCachedBanner( sPath ); +} + +void FadingBanner::LoadMode() +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadMode(); +} + +void FadingBanner::LoadFromSongGroup( RString sSongGroup ) +{ + const RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); + LoadFromCachedBanner( sGroupBannerPath ); +} + +void FadingBanner::LoadFromCourse( const Course* pCourse ) +{ + if( pCourse == NULL ) + { + LoadFallback(); + return; + } + + /* Don't call HasBanner. That'll do disk access and cause the music wheel + * to skip. */ + RString sPath = pCourse->GetBannerPath(); + if( sPath.empty() ) + LoadCourseFallback(); + else + LoadFromCachedBanner( sPath ); +} + +void FadingBanner::LoadIconFromCharacter( Character* pCharacter ) +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadIconFromCharacter( pCharacter ); +} + +void FadingBanner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE ) +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadBannerFromUnlockEntry( pUE ); +} + +void FadingBanner::LoadRoulette() +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadRoulette(); +} + +void FadingBanner::LoadRandom() +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadRandom(); +} + +void FadingBanner::LoadFromSortOrder( SortOrder so ) +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadFromSortOrder(so); +} + +void FadingBanner::LoadFallback() +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadFallback(); +} + +void FadingBanner::LoadCourseFallback() +{ + BeforeChange(); + m_Banner[m_iIndexLatest].LoadCourseFallback(); +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the FadingBanner. */ +class LunaFadingBanner: public Luna +{ +public: + static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int LoadFromSong( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } + else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } + return 0; + } + static int LoadFromCourse( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } + else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } + return 0; + } + static int LoadIconFromCharacter( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } + else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } + return 0; + } + static int LoadCardFromCharacter( T* p, lua_State *L ) + { + if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } + else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } + return 0; + } + static int LoadFromSongGroup( T* p, lua_State *L ) { p->LoadFromSongGroup( SArg(1) ); return 0; } + static int GetLatestIndex( T* p, lua_State *L ){ lua_pushnumber( L, p->GetLatestIndex() ); return 1; } + + LunaFadingBanner() + { + ADD_METHOD( scaletoclipped ); + ADD_METHOD( ScaleToClipped ); + ADD_METHOD( LoadFromSong ); + ADD_METHOD( LoadFromSongGroup ); + ADD_METHOD( LoadFromCourse ); + ADD_METHOD( LoadIconFromCharacter ); + ADD_METHOD( LoadCardFromCharacter ); + ADD_METHOD( GetLatestIndex ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( FadingBanner, ActorFrame ) +// lua end + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FadingBanner.h b/src/FadingBanner.h index 8d46fcaf78..33cafbfac9 100644 --- a/src/FadingBanner.h +++ b/src/FadingBanner.h @@ -1,81 +1,81 @@ -/* FadingBanner - Fades between two banners. */ - -#ifndef FADING_BANNER_H -#define FADING_BANNER_H - -#include "Banner.h" -#include "ActorFrame.h" -#include "RageTimer.h" - -class FadingBanner : public ActorFrame -{ -public: - FadingBanner(); - virtual FadingBanner *Copy() const; - - void ScaleToClipped( float fWidth, float fHeight ); - - /* If you previously loaded a cached banner, and are now loading the full- - * resolution banner, set bLowResToHighRes to true. */ - void Load( RageTextureID ID, bool bLowResToHighRes=false ); - void LoadFromSong( const Song* pSong ); // NULL means no song - void LoadMode(); - void LoadFromSongGroup( RString sSongGroup ); - void LoadFromCourse( const Course* pCourse ); - void LoadIconFromCharacter( Character* pCharacter ); - void LoadBannerFromUnlockEntry( const UnlockEntry* pUE ); - void LoadRoulette(); - void LoadRandom(); - void LoadFromSortOrder( SortOrder so ); - void LoadFallback(); - void LoadCourseFallback(); - - bool LoadFromCachedBanner( const RString &path ); - bool LoadFromCachedBackground( const RString &path ); - - void SetMovingFast( bool fast ) { m_bMovingFast=fast; } - virtual void UpdateInternal( float fDeltaTime ); - virtual void DrawPrimitives(); - - int GetLatestIndex(){ return m_iIndexLatest; } - - // Lua - void PushSelf( lua_State *L ); - -protected: - void BeforeChange( bool bLowResToHighRes=false ); - - static const int NUM_BANNERS = 5; - Banner m_Banner[NUM_BANNERS]; - int m_iIndexLatest; - - bool m_bMovingFast; - bool m_bSkipNextBannerUpdate; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* FadingBanner - Fades between two banners. */ + +#ifndef FADING_BANNER_H +#define FADING_BANNER_H + +#include "Banner.h" +#include "ActorFrame.h" +#include "RageTimer.h" + +class FadingBanner : public ActorFrame +{ +public: + FadingBanner(); + virtual FadingBanner *Copy() const; + + void ScaleToClipped( float fWidth, float fHeight ); + + /* If you previously loaded a cached banner, and are now loading the full- + * resolution banner, set bLowResToHighRes to true. */ + void Load( RageTextureID ID, bool bLowResToHighRes=false ); + void LoadFromSong( const Song* pSong ); // NULL means no song + void LoadMode(); + void LoadFromSongGroup( RString sSongGroup ); + void LoadFromCourse( const Course* pCourse ); + void LoadIconFromCharacter( Character* pCharacter ); + void LoadBannerFromUnlockEntry( const UnlockEntry* pUE ); + void LoadRoulette(); + void LoadRandom(); + void LoadFromSortOrder( SortOrder so ); + void LoadFallback(); + void LoadCourseFallback(); + + bool LoadFromCachedBanner( const RString &path ); + bool LoadFromCachedBackground( const RString &path ); + + void SetMovingFast( bool fast ) { m_bMovingFast=fast; } + virtual void UpdateInternal( float fDeltaTime ); + virtual void DrawPrimitives(); + + int GetLatestIndex(){ return m_iIndexLatest; } + + // Lua + void PushSelf( lua_State *L ); + +protected: + void BeforeChange( bool bLowResToHighRes=false ); + + static const int NUM_BANNERS = 5; + Banner m_Banner[NUM_BANNERS]; + int m_iIndexLatest; + + bool m_bMovingFast; + bool m_bSkipNextBannerUpdate; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FileDownload.cpp b/src/FileDownload.cpp index 9a643f2195..3f725895b3 100644 --- a/src/FileDownload.cpp +++ b/src/FileDownload.cpp @@ -1,401 +1,401 @@ -#include "global.h" - -#if !defined(WITHOUT_NETWORKING) -#include "FileDownload.h" -#include "RageUtil.h" -#include "RageFileManager.h" -#include "SpecialFiles.h" -#include "RageLog.h" -#include "Preference.h" -#include "Foreach.h" - -FileTransfer::FileTransfer() -{ - m_iPackagesPos = 0; - m_iLinksPos = 0; - m_bIsDownloading = false; - m_sStatus = ""; - m_fLastUpdate = 0; - m_iTotalBytes = 0; - m_iDownloaded = 0; - m_bFinished = false; - - UpdateProgress(); - - // Workaround: For some reason, the first download sometimes corrupts; - // by opening and closing the RageFile, this problem does not occur. - // Go figure? - // XXX: This is a really dirty work around! Why does RageFile do this? - // It's always some strange number of bytes at the end of the file when it corrupts. - m_fOutputFile.Open("Packages/dummy.txt", RageFile::WRITE); - m_fOutputFile.Close(); -} - -FileTransfer::~FileTransfer() -{ - m_fOutputFile.Close(); -} - -RString FileTransfer::Update( float fDeltaTime ) -{ - HTTPUpdate(); - - m_fLastUpdate += fDeltaTime; - if (m_fLastUpdate >= 1.0) - { - if (m_bIsDownloading && m_bGotHeader) - m_sStatus = ssprintf("DL @ %d KB/s", int((m_iDownloaded-m_bytesLastUpdate)/1024)); - - m_bytesLastUpdate = m_iDownloaded; - UpdateProgress(); - m_fLastUpdate = 0; - } - - return m_sStatus; -} - -void FileTransfer::UpdateProgress() -{ - float DownloadedRatio; - - if( m_iTotalBytes < 1 ) - DownloadedRatio = 0; - else - DownloadedRatio = float(m_iDownloaded) / float(m_iTotalBytes); -} - -void FileTransfer::Cancel() -{ - m_wSocket.close(); - m_bIsDownloading = false; - m_iDownloaded = 0; - m_bGotHeader = false; - m_fOutputFile.Close(); - m_sStatus = "Failed."; - m_sBUFFER = ""; - FILEMAN->Remove("Packages/" + m_sEndName); -} - -void FileTransfer::StartDownload( const RString &sURL, const RString &sDestFile ) -{ - StartTransfer( download, sURL, "", sDestFile ); -} - -void FileTransfer::StartUpload( const RString &sURL, const RString &sSrcFile, const RString &sDestFile ) -{ - StartTransfer( upload, sURL, sSrcFile, sDestFile ); -} - -extern Preference g_sCookie; - -void FileTransfer::StartTransfer( TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile ) -{ - RString Proto; - RString Server; - int Port=80; - RString sAddress; - - if( !ParseHTTPAddress( sURL, Proto, Server, Port, sAddress ) ) - { - m_sStatus = "Invalid URL."; - m_bFinished = true; - UpdateProgress(); - return; - } - - m_bSavingFile = sDestFile != ""; - - m_sBaseAddress = "http://" + Server; - if( Port != 80 ) - m_sBaseAddress += ssprintf( ":%d", Port ); - m_sBaseAddress += "/"; - - if( sAddress.Right(1) != "/" ) - { - m_sEndName = Basename( sAddress ); - m_sBaseAddress += Dirname( sAddress ); - } - else - { - m_sEndName = ""; - } - - // Open the file... - - // First find out if a file by this name already exists if so, then we gotta - // ditch out. - // XXX: This should be fixed by a prompt or something? - - // if we are not talking about a file, let's not worry - if( m_sEndName != "" && m_bSavingFile ) - { - if( !m_fOutputFile.Open( sDestFile, RageFile::WRITE | RageFile::STREAMED ) ) - { - m_sStatus = m_fOutputFile.GetError(); - UpdateProgress(); - return; - } - } - // Continue... - - sAddress = URLEncode( sAddress ); - - if ( sAddress != "/" ) - sAddress = "/" + sAddress; - - m_wSocket.close(); - m_wSocket.create(); - - m_wSocket.blocking = true; - - if( !m_wSocket.connect( Server, (short) Port ) ) - { - m_sStatus = "Failed to connect."; - UpdateProgress(); - return; - } - - // Produce HTTP header - RString sAction; - switch( type ) - { - case upload: sAction = "POST"; break; - case download: sAction = "GET"; break; - } - - vector vsHeaders; - vsHeaders.push_back( sAction+" "+sAddress+" HTTP/1.0" ); - vsHeaders.push_back( "Host: " + Server ); - vsHeaders.push_back( "Cookie: " + g_sCookie.Get() ); - vsHeaders.push_back( "Connection: closed" ); - string sBoundary = "--ZzAaB03x"; - vsHeaders.push_back( "Content-Type: multipart/form-data; boundary=" + sBoundary ); - RString sRequestPayload; - if( type == upload ) - { - RageFile f; - if( !f.Open( sSrcFile ) ) - FAIL_M( f.GetError() ); - sRequestPayload.reserve( f.GetFileSize() ); - int iBytesRead = f.Read( sRequestPayload ); - if( iBytesRead == -1 ) - FAIL_M( f.GetError() ); - - sRequestPayload = "--" + sBoundary + "\r\n" + - "Content-Disposition: form-data; name=\"name\"\r\n" + - "\r\n" + - "Chris\r\n" + - "--" + sBoundary + "\r\n" + - "Content-Disposition: form-data; name=\"userfile\"; filename=\"" + Basename(sSrcFile) + "\"\r\n" + - "Content-Type: application/zip\r\n" + - "\r\n" + - sRequestPayload + "\r\n" + - "--" + sBoundary + "--"; - } - /* - if( sRequestPayload.size() > 0 ) - { - sHeader += "Content-Type: application/octet-stream\r\n"; - sHeader += "Content-Length: multipart/form-data; boundary=" + sBoundary + "\r\n"; - //sHeader += "Content-Length: " + ssprintf("%d",sRequestPayload.size()) + "\r\n"; - } - */ - - vsHeaders.push_back( "Content-Length: " + ssprintf("%zd",sRequestPayload.size()) ); - - RString sHeader; - FOREACH_CONST( RString, vsHeaders, h ) - sHeader += *h + "\r\n"; - sHeader += "\r\n"; - - m_wSocket.SendData( sHeader.c_str(), sHeader.length() ); - m_wSocket.SendData( "\r\n" ); - - m_wSocket.SendData( sRequestPayload.GetBuffer(), sRequestPayload.size() ); - - m_sStatus = "Header Sent."; - m_wSocket.blocking = false; - m_bIsDownloading = true; - m_sBUFFER = ""; - m_bGotHeader = false; - UpdateProgress(); -} - -static size_t FindEndOfHeaders( const RString &buf ) -{ - size_t iPos1 = buf.find( "\n\n" ); - size_t iPos2 = buf.find( "\r\n\r\n" ); - LOG->Trace("end: %u, %u", unsigned(iPos1), unsigned(iPos2)); - if( iPos1 != string::npos && (iPos2 == string::npos || iPos2 > iPos1) ) - return iPos1 + 2; - else if( iPos2 != string::npos && (iPos1 == string::npos || iPos1 > iPos2) ) - return iPos2 + 4; - else - return string::npos; -} - -void FileTransfer::HTTPUpdate() -{ - if( !m_bIsDownloading ) - return; - - int BytesGot=0; - // Keep this as a code block, as there may be need to "if" it out some time. - /* If you need a conditional for a large block of code, stick it in - * a function and return. */ - while(1) - { - char Buffer[1024]; - int iSize = m_wSocket.ReadData( Buffer, 1024 ); - if( iSize <= 0 ) - break; - - m_sBUFFER.append( Buffer, iSize ); - BytesGot += iSize; - } - - if( !m_bGotHeader ) - { - m_sStatus = "Waiting for header."; - // We don't know if we are using unix-style or dos-style - size_t iHeaderEnd = FindEndOfHeaders( m_sBUFFER ); - if( iHeaderEnd == m_sBUFFER.npos ) - return; - - // "HTTP/1.1 200 OK" - size_t i = m_sBUFFER.find(" "); - size_t j = m_sBUFFER.find(" ",i+1); - size_t k = m_sBUFFER.find("\n",j+1); - if ( i == string::npos || j == string::npos || k == string::npos ) - { - m_iResponseCode = -100; - m_sResponseName = "Malformed response."; - return; - } - m_iResponseCode = atoi(m_sBUFFER.substr(i+1,j-i).c_str()); - m_sResponseName = m_sBUFFER.substr( j+1, k-j ); - - i = m_sBUFFER.find("Content-Length:"); - j = m_sBUFFER.find("\n", i+1 ); - - if( i != string::npos ) - m_iTotalBytes = atoi(m_sBUFFER.substr(i+16,j-i).c_str()); - else - m_iTotalBytes = -1; // We don't know, so go until disconnect - - m_bGotHeader = true; - m_sBUFFER.erase( 0, iHeaderEnd ); - } - - if( m_bSavingFile ) - { - m_iDownloaded += m_sBUFFER.length(); - m_fOutputFile.Write( m_sBUFFER ); - - // HACK: We're ending up with incomplete files after close() if we don't flush here. Why? - m_fOutputFile.Flush(); - - m_sBUFFER = ""; - } - else - { - m_iDownloaded = m_sBUFFER.length(); - } - - if ( ( m_iTotalBytes <= m_iDownloaded && m_iTotalBytes != -1 ) || - //We have the full doc. (And we knew how big it was) - ( m_iTotalBytes == -1 && - ( m_wSocket.state == EzSockets::skERROR || m_wSocket.state == EzSockets::skDISCONNECTED ) ) ) - // We didn't know how big it was, and were disconnected - // So that means we have it all. - { - m_wSocket.close(); - m_bIsDownloading = false; - m_bGotHeader=false; - m_sStatus = ssprintf( "Done;%dB", int(m_iDownloaded) ); - m_bFinished = true; - - if( m_iResponseCode < 200 || m_iResponseCode >= 400 ) - { - m_sStatus = ssprintf( "%ld", m_iResponseCode ) + m_sResponseName; - } - else - { - if( m_bSavingFile && m_iResponseCode < 300 ) - { - RString sZipFile = m_fOutputFile.GetRealPath(); - m_fOutputFile.Close(); - FILEMAN->FlushDirCache(); - m_iDownloaded = 0; - } - } - } -} - -bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RString &sServer, int &iPort, RString &sAddress ) -{ - // [PROTO://]SERVER[:PORT][/URL] - - Regex re( - "^([A-Z]+)://" // [0]: HTTP:// - "([^/:]+)" // [1]: a.b.com - "(:([0-9]+))?" // [2], [3]: :1234 (optional, default 80) - "(/(.*))?$"); // [4], [5]: /foo.html (optional) - vector asMatches; - if( !re.Compare( URL, asMatches ) ) - return false; - ASSERT( asMatches.size() == 6 ); - - sProto = asMatches[0]; - sServer = asMatches[1]; - if( asMatches[3] != "" ) - { - iPort = atoi(asMatches[3]); - if( iPort == 0 ) - return false; - } - else - iPort = 80; - - sAddress = asMatches[5]; - - return true; -} - -void FileTransfer::Finish() -{ - while( true ) - { - float fSleepSeconds = 0.1f; - this->Update( fSleepSeconds ); - usleep( int( fSleepSeconds * 1000000.0 ) ); - if( this->IsFinished() ) - break; - } -} - -#endif -/* - * (c) 2004 Charles Lohr, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" + +#if !defined(WITHOUT_NETWORKING) +#include "FileDownload.h" +#include "RageUtil.h" +#include "RageFileManager.h" +#include "SpecialFiles.h" +#include "RageLog.h" +#include "Preference.h" +#include "Foreach.h" + +FileTransfer::FileTransfer() +{ + m_iPackagesPos = 0; + m_iLinksPos = 0; + m_bIsDownloading = false; + m_sStatus = ""; + m_fLastUpdate = 0; + m_iTotalBytes = 0; + m_iDownloaded = 0; + m_bFinished = false; + + UpdateProgress(); + + // Workaround: For some reason, the first download sometimes corrupts; + // by opening and closing the RageFile, this problem does not occur. + // Go figure? + // XXX: This is a really dirty work around! Why does RageFile do this? + // It's always some strange number of bytes at the end of the file when it corrupts. + m_fOutputFile.Open("Packages/dummy.txt", RageFile::WRITE); + m_fOutputFile.Close(); +} + +FileTransfer::~FileTransfer() +{ + m_fOutputFile.Close(); +} + +RString FileTransfer::Update( float fDeltaTime ) +{ + HTTPUpdate(); + + m_fLastUpdate += fDeltaTime; + if (m_fLastUpdate >= 1.0) + { + if (m_bIsDownloading && m_bGotHeader) + m_sStatus = ssprintf("DL @ %d KB/s", int((m_iDownloaded-m_bytesLastUpdate)/1024)); + + m_bytesLastUpdate = m_iDownloaded; + UpdateProgress(); + m_fLastUpdate = 0; + } + + return m_sStatus; +} + +void FileTransfer::UpdateProgress() +{ + float DownloadedRatio; + + if( m_iTotalBytes < 1 ) + DownloadedRatio = 0; + else + DownloadedRatio = float(m_iDownloaded) / float(m_iTotalBytes); +} + +void FileTransfer::Cancel() +{ + m_wSocket.close(); + m_bIsDownloading = false; + m_iDownloaded = 0; + m_bGotHeader = false; + m_fOutputFile.Close(); + m_sStatus = "Failed."; + m_sBUFFER = ""; + FILEMAN->Remove("Packages/" + m_sEndName); +} + +void FileTransfer::StartDownload( const RString &sURL, const RString &sDestFile ) +{ + StartTransfer( download, sURL, "", sDestFile ); +} + +void FileTransfer::StartUpload( const RString &sURL, const RString &sSrcFile, const RString &sDestFile ) +{ + StartTransfer( upload, sURL, sSrcFile, sDestFile ); +} + +extern Preference g_sCookie; + +void FileTransfer::StartTransfer( TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile ) +{ + RString Proto; + RString Server; + int Port=80; + RString sAddress; + + if( !ParseHTTPAddress( sURL, Proto, Server, Port, sAddress ) ) + { + m_sStatus = "Invalid URL."; + m_bFinished = true; + UpdateProgress(); + return; + } + + m_bSavingFile = sDestFile != ""; + + m_sBaseAddress = "http://" + Server; + if( Port != 80 ) + m_sBaseAddress += ssprintf( ":%d", Port ); + m_sBaseAddress += "/"; + + if( sAddress.Right(1) != "/" ) + { + m_sEndName = Basename( sAddress ); + m_sBaseAddress += Dirname( sAddress ); + } + else + { + m_sEndName = ""; + } + + // Open the file... + + // First find out if a file by this name already exists if so, then we gotta + // ditch out. + // XXX: This should be fixed by a prompt or something? + + // if we are not talking about a file, let's not worry + if( m_sEndName != "" && m_bSavingFile ) + { + if( !m_fOutputFile.Open( sDestFile, RageFile::WRITE | RageFile::STREAMED ) ) + { + m_sStatus = m_fOutputFile.GetError(); + UpdateProgress(); + return; + } + } + // Continue... + + sAddress = URLEncode( sAddress ); + + if ( sAddress != "/" ) + sAddress = "/" + sAddress; + + m_wSocket.close(); + m_wSocket.create(); + + m_wSocket.blocking = true; + + if( !m_wSocket.connect( Server, (short) Port ) ) + { + m_sStatus = "Failed to connect."; + UpdateProgress(); + return; + } + + // Produce HTTP header + RString sAction; + switch( type ) + { + case upload: sAction = "POST"; break; + case download: sAction = "GET"; break; + } + + vector vsHeaders; + vsHeaders.push_back( sAction+" "+sAddress+" HTTP/1.0" ); + vsHeaders.push_back( "Host: " + Server ); + vsHeaders.push_back( "Cookie: " + g_sCookie.Get() ); + vsHeaders.push_back( "Connection: closed" ); + string sBoundary = "--ZzAaB03x"; + vsHeaders.push_back( "Content-Type: multipart/form-data; boundary=" + sBoundary ); + RString sRequestPayload; + if( type == upload ) + { + RageFile f; + if( !f.Open( sSrcFile ) ) + FAIL_M( f.GetError() ); + sRequestPayload.reserve( f.GetFileSize() ); + int iBytesRead = f.Read( sRequestPayload ); + if( iBytesRead == -1 ) + FAIL_M( f.GetError() ); + + sRequestPayload = "--" + sBoundary + "\r\n" + + "Content-Disposition: form-data; name=\"name\"\r\n" + + "\r\n" + + "Chris\r\n" + + "--" + sBoundary + "\r\n" + + "Content-Disposition: form-data; name=\"userfile\"; filename=\"" + Basename(sSrcFile) + "\"\r\n" + + "Content-Type: application/zip\r\n" + + "\r\n" + + sRequestPayload + "\r\n" + + "--" + sBoundary + "--"; + } + /* + if( sRequestPayload.size() > 0 ) + { + sHeader += "Content-Type: application/octet-stream\r\n"; + sHeader += "Content-Length: multipart/form-data; boundary=" + sBoundary + "\r\n"; + //sHeader += "Content-Length: " + ssprintf("%d",sRequestPayload.size()) + "\r\n"; + } + */ + + vsHeaders.push_back( "Content-Length: " + ssprintf("%zd",sRequestPayload.size()) ); + + RString sHeader; + FOREACH_CONST( RString, vsHeaders, h ) + sHeader += *h + "\r\n"; + sHeader += "\r\n"; + + m_wSocket.SendData( sHeader.c_str(), sHeader.length() ); + m_wSocket.SendData( "\r\n" ); + + m_wSocket.SendData( sRequestPayload.GetBuffer(), sRequestPayload.size() ); + + m_sStatus = "Header Sent."; + m_wSocket.blocking = false; + m_bIsDownloading = true; + m_sBUFFER = ""; + m_bGotHeader = false; + UpdateProgress(); +} + +static size_t FindEndOfHeaders( const RString &buf ) +{ + size_t iPos1 = buf.find( "\n\n" ); + size_t iPos2 = buf.find( "\r\n\r\n" ); + LOG->Trace("end: %u, %u", unsigned(iPos1), unsigned(iPos2)); + if( iPos1 != string::npos && (iPos2 == string::npos || iPos2 > iPos1) ) + return iPos1 + 2; + else if( iPos2 != string::npos && (iPos1 == string::npos || iPos1 > iPos2) ) + return iPos2 + 4; + else + return string::npos; +} + +void FileTransfer::HTTPUpdate() +{ + if( !m_bIsDownloading ) + return; + + int BytesGot=0; + // Keep this as a code block, as there may be need to "if" it out some time. + /* If you need a conditional for a large block of code, stick it in + * a function and return. */ + while(1) + { + char Buffer[1024]; + int iSize = m_wSocket.ReadData( Buffer, 1024 ); + if( iSize <= 0 ) + break; + + m_sBUFFER.append( Buffer, iSize ); + BytesGot += iSize; + } + + if( !m_bGotHeader ) + { + m_sStatus = "Waiting for header."; + // We don't know if we are using unix-style or dos-style + size_t iHeaderEnd = FindEndOfHeaders( m_sBUFFER ); + if( iHeaderEnd == m_sBUFFER.npos ) + return; + + // "HTTP/1.1 200 OK" + size_t i = m_sBUFFER.find(" "); + size_t j = m_sBUFFER.find(" ",i+1); + size_t k = m_sBUFFER.find("\n",j+1); + if ( i == string::npos || j == string::npos || k == string::npos ) + { + m_iResponseCode = -100; + m_sResponseName = "Malformed response."; + return; + } + m_iResponseCode = atoi(m_sBUFFER.substr(i+1,j-i).c_str()); + m_sResponseName = m_sBUFFER.substr( j+1, k-j ); + + i = m_sBUFFER.find("Content-Length:"); + j = m_sBUFFER.find("\n", i+1 ); + + if( i != string::npos ) + m_iTotalBytes = atoi(m_sBUFFER.substr(i+16,j-i).c_str()); + else + m_iTotalBytes = -1; // We don't know, so go until disconnect + + m_bGotHeader = true; + m_sBUFFER.erase( 0, iHeaderEnd ); + } + + if( m_bSavingFile ) + { + m_iDownloaded += m_sBUFFER.length(); + m_fOutputFile.Write( m_sBUFFER ); + + // HACK: We're ending up with incomplete files after close() if we don't flush here. Why? + m_fOutputFile.Flush(); + + m_sBUFFER = ""; + } + else + { + m_iDownloaded = m_sBUFFER.length(); + } + + if ( ( m_iTotalBytes <= m_iDownloaded && m_iTotalBytes != -1 ) || + //We have the full doc. (And we knew how big it was) + ( m_iTotalBytes == -1 && + ( m_wSocket.state == EzSockets::skERROR || m_wSocket.state == EzSockets::skDISCONNECTED ) ) ) + // We didn't know how big it was, and were disconnected + // So that means we have it all. + { + m_wSocket.close(); + m_bIsDownloading = false; + m_bGotHeader=false; + m_sStatus = ssprintf( "Done;%dB", int(m_iDownloaded) ); + m_bFinished = true; + + if( m_iResponseCode < 200 || m_iResponseCode >= 400 ) + { + m_sStatus = ssprintf( "%ld", m_iResponseCode ) + m_sResponseName; + } + else + { + if( m_bSavingFile && m_iResponseCode < 300 ) + { + RString sZipFile = m_fOutputFile.GetRealPath(); + m_fOutputFile.Close(); + FILEMAN->FlushDirCache(); + m_iDownloaded = 0; + } + } + } +} + +bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RString &sServer, int &iPort, RString &sAddress ) +{ + // [PROTO://]SERVER[:PORT][/URL] + + Regex re( + "^([A-Z]+)://" // [0]: HTTP:// + "([^/:]+)" // [1]: a.b.com + "(:([0-9]+))?" // [2], [3]: :1234 (optional, default 80) + "(/(.*))?$"); // [4], [5]: /foo.html (optional) + vector asMatches; + if( !re.Compare( URL, asMatches ) ) + return false; + ASSERT( asMatches.size() == 6 ); + + sProto = asMatches[0]; + sServer = asMatches[1]; + if( asMatches[3] != "" ) + { + iPort = atoi(asMatches[3]); + if( iPort == 0 ) + return false; + } + else + iPort = 80; + + sAddress = asMatches[5]; + + return true; +} + +void FileTransfer::Finish() +{ + while( true ) + { + float fSleepSeconds = 0.1f; + this->Update( fSleepSeconds ); + usleep( int( fSleepSeconds * 1000000.0 ) ); + if( this->IsFinished() ) + break; + } +} + +#endif +/* + * (c) 2004 Charles Lohr, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FileDownload.h b/src/FileDownload.h index 71147bd565..e97e31324f 100644 --- a/src/FileDownload.h +++ b/src/FileDownload.h @@ -1,95 +1,95 @@ -#ifndef FileTransfer_H -#define FileTransfer_H - -#if !defined(WITHOUT_NETWORKING) - -#include "ezsockets.h" -#include "RageFile.h" - -class FileTransfer -{ -public: - FileTransfer(); - ~FileTransfer(); - - void StartDownload(const RString &sURL, const RString &sDestFile); - void StartUpload(const RString &sURL, const RString &sSrcFile, const RString &sDestFile); - - void Cancel(); - RString Update(float fDeltaTime); - bool IsFinished() const { return m_bFinished; } - void Finish(); - int GetResponseCode() const { return m_iResponseCode; } - RString GetResponse() const { return m_sBUFFER; } - RString GetStatus() const { return m_sStatus; } -private: - enum TransferType { download, upload }; - void StartTransfer(TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile); - int m_iPackagesPos; - int m_iLinksPos; - - int m_iDLorLST; - - // HTTP portion - void HTTPUpdate(); - - // True if proper string, false if improper - bool ParseHTTPAddress(const RString & URL, RString & Proto, RString & Server, int & Port, RString & Addy); - - void UpdateProgress(); - - bool m_bIsDownloading; - float m_fLastUpdate; - long m_bytesLastUpdate; - - RString m_sStatus; - - EzSockets m_wSocket; - - bool m_bGotHeader; - - RageFile m_fOutputFile; - RString m_sEndName; - bool m_bSavingFile; - - RString m_sBaseAddress; - // HTTP Header information responce - long m_iTotalBytes; - long m_iDownloaded; - - long m_iResponseCode; - RString m_sResponseName; - - // Raw HTTP Buffer - RString m_sBUFFER; - - bool m_bFinished; -}; - -#endif - -#endif -/* - * (c) 2004 Charles Lohr, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef FileTransfer_H +#define FileTransfer_H + +#if !defined(WITHOUT_NETWORKING) + +#include "ezsockets.h" +#include "RageFile.h" + +class FileTransfer +{ +public: + FileTransfer(); + ~FileTransfer(); + + void StartDownload(const RString &sURL, const RString &sDestFile); + void StartUpload(const RString &sURL, const RString &sSrcFile, const RString &sDestFile); + + void Cancel(); + RString Update(float fDeltaTime); + bool IsFinished() const { return m_bFinished; } + void Finish(); + int GetResponseCode() const { return m_iResponseCode; } + RString GetResponse() const { return m_sBUFFER; } + RString GetStatus() const { return m_sStatus; } +private: + enum TransferType { download, upload }; + void StartTransfer(TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile); + int m_iPackagesPos; + int m_iLinksPos; + + int m_iDLorLST; + + // HTTP portion + void HTTPUpdate(); + + // True if proper string, false if improper + bool ParseHTTPAddress(const RString & URL, RString & Proto, RString & Server, int & Port, RString & Addy); + + void UpdateProgress(); + + bool m_bIsDownloading; + float m_fLastUpdate; + long m_bytesLastUpdate; + + RString m_sStatus; + + EzSockets m_wSocket; + + bool m_bGotHeader; + + RageFile m_fOutputFile; + RString m_sEndName; + bool m_bSavingFile; + + RString m_sBaseAddress; + // HTTP Header information responce + long m_iTotalBytes; + long m_iDownloaded; + + long m_iResponseCode; + RString m_sResponseName; + + // Raw HTTP Buffer + RString m_sBUFFER; + + bool m_bFinished; +}; + +#endif + +#endif +/* + * (c) 2004 Charles Lohr, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Font.cpp b/src/Font.cpp index 3c3cdf1e4a..10c89f5ad8 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -1,821 +1,821 @@ -#include "global.h" -#include "Font.h" -#include "IniFile.h" - -#include "RageTextureManager.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "FontManager.h" -#include "ThemeManager.h" -#include "FontCharmaps.h" -#include "FontCharAliases.h" -#include "arch/Dialog/Dialog.h" - -FontPage::FontPage(): m_iHeight(0), m_iLineSpacing(0), m_fVshift(0), - m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0), - m_sTexturePath("") {} - -void FontPage::Load( const FontPageSettings &cfg ) -{ - m_sTexturePath = cfg.m_sTexturePath; - - // load texture - RageTextureID ID1( m_sTexturePath ); - if( cfg.m_sTextureHints != "default" ) - ID1.AdditionalTextureHints = cfg.m_sTextureHints; - - m_FontPageTextures.m_pTextureMain = TEXTUREMAN->LoadTexture( ID1 ); - ASSERT( m_FontPageTextures.m_pTextureMain != NULL ); - - RageTextureID ID2 = ID1; - // "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png" - if( ID2.filename.find("]") != string::npos ) - { - ID2.filename.Replace( "]", "-stroke]" ); - if( IsAFile(ID2.filename) ) - { - m_FontPageTextures.m_pTextureStroke = TEXTUREMAN->LoadTexture( ID2 ); - ASSERT( m_FontPageTextures.m_pTextureStroke != NULL ); - ASSERT_M( m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() == m_FontPageTextures.m_pTextureStroke->GetSourceFrameWidth(), ssprintf("'%s' and '%s' must have the same frame widths", ID1.filename.c_str(), ID2.filename.c_str()) ); - ASSERT_M( m_FontPageTextures.m_pTextureMain->GetNumFrames() == m_FontPageTextures.m_pTextureStroke->GetNumFrames(), ssprintf("'%s' and '%s' must have the same frame dimensions", ID1.filename.c_str(), ID2.filename.c_str()) ); - } - } - - // load character widths - vector aiFrameWidths; - - int default_width = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth(); - if( cfg.m_iDefaultWidth != -1 ) - default_width = cfg.m_iDefaultWidth; - - // Assume each character is the width of the frame by default. - for( int i=0; iGetNumFrames(); i++ ) - { - map::const_iterator it = cfg.m_mapGlyphWidths.find(i); - if( it != cfg.m_mapGlyphWidths.end() ) - aiFrameWidths.push_back( it->second ); - else - aiFrameWidths.push_back( default_width ); - } - - if( cfg.m_iAddToAllWidths ) - { - for( int i=0; iGetNumFrames(); i++ ) - aiFrameWidths[i] += cfg.m_iAddToAllWidths; - } - - if( cfg.m_fScaleAllWidthsBy != 1 ) - { - for( int i=0; iGetNumFrames(); i++ ) - aiFrameWidths[i] = lrintf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy ); - } - - m_iCharToGlyphNo = cfg.CharToGlyphNo; - - m_iLineSpacing = cfg.m_iLineSpacing; - if( m_iLineSpacing == -1 ) - m_iLineSpacing = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight(); - - int iBaseline=0; - /* If we don't have a top and/or baseline, assume we're centered in the - * frame, and that LineSpacing is the total height. */ - iBaseline = cfg.m_iBaseline; - if( iBaseline == -1 ) - { - float center = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()/2.0f; - iBaseline = int( center + m_iLineSpacing/2 ); - } - - int iTop = cfg.m_iTop; - if( iTop == -1 ) - { - float center = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()/2.0f; - iTop = int( center - m_iLineSpacing/2 ); - } - m_iHeight = iBaseline - iTop; - m_iDrawExtraPixelsLeft = cfg.m_iDrawExtraPixelsLeft; - m_iDrawExtraPixelsRight = cfg.m_iDrawExtraPixelsRight; - - // Shift the character up so the top will be rendered at the baseline. - m_fVshift = (float) -iBaseline; - - SetTextureCoords( aiFrameWidths, cfg.m_iAdvanceExtraPixels ); - SetExtraPixels( cfg.m_iDrawExtraPixelsLeft, cfg.m_iDrawExtraPixelsRight ); - -// LOG->Trace("Font %s: height %i, baseline %i ( == top %i)", -// m_sTexturePath.c_str(), height, baseline, baseline-height); -} - -void FontPage::SetTextureCoords( const vector &widths, int iAdvanceExtraPixels ) -{ - for(int i = 0; i < m_FontPageTextures.m_pTextureMain->GetNumFrames(); ++i) - { - glyph g; - - g.m_pPage = this; - - /* Make a copy of each texture rect, reducing each to the actual dimensions - * of the character (most characters don't take a full block). */ - g.m_TexRect = *m_FontPageTextures.m_pTextureMain->GetTextureCoordRect(i); - - // Set the width and height to the width and line spacing, respectively. - g.m_fWidth = float( widths[i] ); - g.m_fHeight = float(m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()); - - g.m_iHadvance = int(g.m_fWidth) + iAdvanceExtraPixels; - - /* Do the same thing with X. Do this by changing the actual rendered - * m_TexRect, instead of shifting it, so we don't render more than we - * need to. */ - g.m_fHshift = 0; - { - int iSourcePixelsToChopOff = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() - widths[i]; - if( (iSourcePixelsToChopOff % 2) == 1 ) - { - /* We don't want to chop off an odd number of pixels, since that'll - * put our texture coordinates between texels and make things blurrier. - * Note that, since we set m_iHadvance above, this merely expands what - * we render; it doesn't advance the cursor further. So, glyphs - * that have an odd width should err to being a pixel offcenter left, - * not right. */ - --iSourcePixelsToChopOff; - ++g.m_fWidth; - } - - const float fTexCoordsToChopOff = iSourcePixelsToChopOff * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); - - g.m_TexRect.left += fTexCoordsToChopOff/2; - g.m_TexRect.right -= fTexCoordsToChopOff/2; - } - - g.m_FontPageTextures = m_FontPageTextures; - - m_aGlyphs.push_back(g); - } -} - -void FontPage::SetExtraPixels( int iDrawExtraPixelsLeft, int iDrawExtraPixelsRight ) -{ - /* Hack: do one more than we were asked to; I think a lot of fonts are one - * too low. - glenn */ - iDrawExtraPixelsRight++; - iDrawExtraPixelsLeft++; - - if( (iDrawExtraPixelsLeft % 2) == 1 ) - ++iDrawExtraPixelsLeft; - - // Adjust for iDrawExtraPixelsLeft and iDrawExtraPixelsRight. - for( unsigned i = 0; i < m_aGlyphs.size(); ++i ) - { - int iFrameWidth = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth(); - float fCharWidth = m_aGlyphs[i].m_fWidth; - - /* Extra pixels to draw to the left and right. We don't have to - * worry about alignment here; fCharWidth is always even (by - * SetTextureCoords) and iFrameWidth are almost always even. */ - float fExtraLeft = min( float(iDrawExtraPixelsLeft), (iFrameWidth-fCharWidth)/2.0f ); - float fExtraRight = min( float(iDrawExtraPixelsRight), (iFrameWidth-fCharWidth)/2.0f ); - - // Move left and expand right. - m_aGlyphs[i].m_TexRect.left -= fExtraLeft * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); - m_aGlyphs[i].m_TexRect.right += fExtraRight * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); - m_aGlyphs[i].m_fHshift -= fExtraLeft; - m_aGlyphs[i].m_fWidth += fExtraLeft + fExtraRight; - } -} - -FontPage::~FontPage() -{ - if( m_FontPageTextures.m_pTextureMain != NULL ) - { - TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureMain ); - m_FontPageTextures.m_pTextureMain = NULL; - } - if( m_FontPageTextures.m_pTextureStroke != NULL ) - { - TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureStroke ); - m_FontPageTextures.m_pTextureStroke = NULL; - } -} - -int Font::GetLineWidthInSourcePixels( const wstring &szLine ) const -{ - int iLineWidth = 0; - - for( unsigned i=0; im_iHeight ); - - return iLineHeight; -} - - -Font::Font() -{ - m_iRefCount = 1; - m_pDefault = NULL; - m_bRightToLeft = false; - // [sm-ssc] don't show strokes by default - m_DefaultStrokeColor = RageColor(0,0,0,0); -} - -Font::~Font() -{ - Unload(); -} - -void Font::Unload() -{ - //LOG->Trace("Font:Unload '%s'",path.c_str()); - for( unsigned i = 0; i < m_apPages.size(); ++i ) - delete m_apPages[i]; - m_apPages.clear(); - - m_iCharToGlyph.clear(); - m_pDefault = NULL; - - /* Don't clear the refcount. We've unloaded, but that doesn't mean things - * aren't still pointing to us. */ -} - -void Font::Reload() -{ - Unload(); - ASSERT( !path.empty() ); - Load( path, m_sChars ); -} - - -void Font::AddPage( FontPage *m_pPage ) -{ - m_apPages.push_back( m_pPage ); - - for( map::const_iterator it = m_pPage->m_iCharToGlyphNo.begin(); - it != m_pPage->m_iCharToGlyphNo.end(); ++it ) - { - m_iCharToGlyph[it->first] = &m_pPage->m_aGlyphs[it->second]; - } -} - -void Font::MergeFont(Font &f) -{ - /* If we don't have a font page yet, and f does, grab the default font - * page. It'll usually be overridden later on by one of our own font - * pages; this will be used only if we don't have any font pages at - * all. */ - if( m_pDefault == NULL ) - m_pDefault = f.m_pDefault; - - for(map::iterator it = f.m_iCharToGlyph.begin(); - it != f.m_iCharToGlyph.end(); ++it) - { - m_iCharToGlyph[it->first] = it->second; - } - - m_apPages.insert( m_apPages.end(), f.m_apPages.begin(), f.m_apPages.end() ); - - f.m_apPages.clear(); -} - -const glyph &Font::GetGlyph( wchar_t c ) const -{ - ASSERT(c >= 0 && c <= 0xFFFFFF); - - // Fast path: - if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] ) - return *m_iCharToGlyphCache[c]; - - // Try the regular character. - map::const_iterator it = m_iCharToGlyph.find(c); - - // If that's missing, use the default glyph. - if(it == m_iCharToGlyph.end()) - it = m_iCharToGlyph.find(FONT_DEFAULT_GLYPH); - - if(it == m_iCharToGlyph.end()) - RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() ); - - return *it->second; -} - -bool Font::FontCompleteForString( const wstring &str ) const -{ - map::const_iterator mapDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH ); - if( mapDefault == m_iCharToGlyph.end() ) - RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() ); - - for( unsigned i = 0; i < str.size(); ++i ) - { - // If the glyph for this character is the default glyph, we're incomplete. - const glyph &g = GetGlyph( str[i] ); - if( &g == mapDefault->second ) - return false; - } - return true; -} - -void Font::CapsOnly() -{ - /* For each uppercase character that we have a mapping for, add - * a lowercase one. */ - for( char c = 'A'; c <= 'Z'; ++c ) - { - map::const_iterator it = m_iCharToGlyph.find(c); - - if(it == m_iCharToGlyph.end()) - continue; - - m_iCharToGlyph[(char) tolower(c)] = it->second; - } -} - -void Font::SetDefaultGlyph( FontPage *pPage ) -{ - ASSERT( pPage ); - ASSERT( !pPage->m_aGlyphs.empty() ); - m_pDefault = pPage; -} - - -// Given the INI for a font, find all of the texture pages for the font. -void Font::GetFontPaths( const RString &sFontIniPath, vector &asTexturePathsOut ) -{ - RString sPrefix = SetExtension( sFontIniPath, "" ); - vector asFiles; - GetDirListing( sPrefix + "*", asFiles, false, true ); - - for( unsigned i = 0; i < asFiles.size(); ++i ) - { - if( !asFiles[i].Right(4).EqualsNoCase(".ini") ) - asTexturePathsOut.push_back( asFiles[i] ); - } -} - -RString Font::GetPageNameFromFileName( const RString &sFilename ) -{ - size_t begin = sFilename.find_first_of( '[' ); - if( begin == string::npos ) - return "main"; - - size_t end = sFilename.find_first_of( ']', begin ); - if( end == string::npos ) - return "main"; - - begin++; - end--; - if( end == begin ) - return "main"; - return sFilename.substr( begin, end-begin+1 ); -} - -void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &sPageName, RString sChars ) -{ - cfg.m_sTexturePath = sTexturePath; - - // If we have any characters to map, add them. - for( unsigned n=0; nTrace("Loading font page '%s' settings from page name '%s'", -// TexturePath.c_str(), sPageName.c_str()); - - ini.GetValue( sPageName, "DrawExtraPixelsLeft", cfg.m_iDrawExtraPixelsLeft ); - ini.GetValue( sPageName, "DrawExtraPixelsRight", cfg.m_iDrawExtraPixelsRight ); - ini.GetValue( sPageName, "AddToAllWidths", cfg.m_iAddToAllWidths ); - ini.GetValue( sPageName, "ScaleAllWidthsBy", cfg.m_fScaleAllWidthsBy ); - ini.GetValue( sPageName, "LineSpacing", cfg.m_iLineSpacing ); - ini.GetValue( sPageName, "Top", cfg.m_iTop ); - ini.GetValue( sPageName, "Baseline", cfg.m_iBaseline ); - ini.GetValue( sPageName, "DefaultWidth", cfg.m_iDefaultWidth ); - ini.GetValue( sPageName, "AdvanceExtraPixels", cfg.m_iAdvanceExtraPixels ); - ini.GetValue( sPageName, "TextureHints", cfg.m_sTextureHints ); - - // Iterate over all keys. - const XNode* pNode = ini.GetChild( sPageName ); - if( pNode ) - { - FOREACH_CONST_Attr( pNode, pAttr ) - { - RString sName = pAttr->first; - const XNodeValue *pValue = pAttr->second; - - sName.MakeUpper(); - - // If val is an integer, it's a width, eg. "10=27". - if( IsAnInt(sName) ) - { - cfg.m_mapGlyphWidths[atoi(sName)] = pValue->GetValue(); - continue; - } - - // "map codepoint=frame" maps a char to a frame. - if( sName.substr(0, 4) == "MAP " ) - { - /* map CODEPOINT=frame. CODEPOINT can be - * 1. U+hexval - * 2. an alias ("oq") - * 3. a character in quotes ("X") - * - * map 1=2 is the same as - * range unicode #1-1=2 - */ - RString sCodepoint = sName.substr(4); // "CODEPOINT" - - wchar_t c; - if( sCodepoint.substr(0, 2) == "U+" && IsHexVal(sCodepoint.substr(2)) ) - sscanf( sCodepoint.substr(2).c_str(), "%x", &c ); - else if( sCodepoint.size() > 0 && - utf8_get_char_len(sCodepoint[0]) == int(sCodepoint.size()) ) - { - c = utf8_get_char( sCodepoint.c_str() ); - if(c == wchar_t(-1)) - LOG->Warn("Font definition '%s' has an invalid value '%s'.", - ini.GetPath().c_str(), sName.c_str() ); - } - else if( !FontCharAliases::GetChar(sCodepoint, c) ) - { - LOG->Warn("Font definition '%s' has an invalid value '%s'.", - ini.GetPath().c_str(), sName.c_str() ); - continue; - } - - cfg.CharToGlyphNo[c] = pValue->GetValue(); - - continue; - } - - if( sName.substr(0, 6) == "RANGE " ) - { - /* range CODESET=first_frame or - * range CODESET #start-end=first_frame - * eg - * range CP1252=0 (default for 256-frame fonts) - * range ASCII=0 (default for 128-frame fonts) - * - * (Start and end are in hex.) - * - * Map two high-bit portions of ISO-8859- to one font: - * range ISO-8859-2 #80-FF=0 - * range ISO-8859-3 #80-FF=128 - * - * Map hiragana to 0-84: - * range Unicode #3041-3094=0 - */ - vector asMatches; - static Regex parse("^RANGE ([A-Z0-9\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$"); - bool bMatch = parse.Compare( sName, asMatches ); - - ASSERT( asMatches.size() == 4 ); // 4 parens - - if( !bMatch || asMatches[0].empty() ) - RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": parse error.", - ini.GetPath().c_str(), sName.c_str() ); - - // We must have either 1 match (just the codeset) or 4 (the whole thing). - int iCount = -1; - int iFirst = 0; - if( !asMatches[2].empty() ) - { - sscanf( asMatches[2].c_str(), "%x", &iFirst ); - int iLast; - sscanf( asMatches[3].c_str(), "%x", &iLast ); - if( iLast < iFirst ) - RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %i < %i.", - ini.GetPath().c_str(), sName.c_str(), iLast, iFirst ); - - iCount = iLast - iFirst + 1; - } - - RString sRet = cfg.MapRange( asMatches[0], iFirst, pValue->GetValue(), iCount ); - if( !sRet.empty() ) - RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %s.", - ini.GetPath().c_str(), sName.c_str(), sRet.c_str() ); - - continue; - } - - if( sName.substr(0, 5) == "LINE " ) - { - /* line ROW=CHAR1CHAR2CHAR3CHAR4 - * eg. - * line 0=ABCDEFGH - * - * This lets us assign characters very compactly and readably. */ - - RString sRowStr = sName.substr(5); - TrimLeft( sRowStr ); - - ASSERT( IsAnInt(sRowStr) ); - const int iRow = atoi( sRowStr.c_str() ); - const int iFirstFrame = iRow * iNumFramesWide; - - if( iRow > iNumFramesHigh ) - RageException::Throw( "The font definition \"%s\" tries to assign line %i, but the font is only %i characters high.", - ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh ); - - // Decode the string. - const wstring wdata( RStringToWstring(pValue->GetValue()) ); - - if( int(wdata.size()) > iNumFramesWide ) - RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font is only %i characters wide.", - ini.GetPath().c_str(), (int)wdata.size(), iRow, wdata.c_str(), iNumFramesWide ); - - for( unsigned i = 0; i < wdata.size(); ++i ) - cfg.CharToGlyphNo[wdata[i]] = iFirstFrame+i; - } - } - } - - /* If it's 128 or 256 frames, default to ASCII or CP1252, - * respectively. 5x3 and 4x4 numbers fonts are supported as well. - * If it's anything else, we don't know what it is, so don't make - * any default mappings (the INI needs to do that itself). */ - if( sPageName != "common" && cfg.CharToGlyphNo.empty() ) - { - switch( iNumFrames ) - { - case 128: - cfg.MapRange( "ascii", 0, 0, -1 ); - break; - case 256: - cfg.MapRange( "cp1252", 0, 0, -1 ); - break; - case 15: - case 16: - cfg.MapRange( "numbers", 0, 0, -1 ); - break; - default: - LOG->Trace( "Font page \"%s\" has no characters", sTexturePath.c_str() ); - } - } - - // If ' ' is set and nbsp is not, set nbsp. - if( cfg.CharToGlyphNo.find(' ') != cfg.CharToGlyphNo.end() ) - cfg.CharToGlyphNo[0x00A0] = cfg.CharToGlyphNo[' ']; -} - -RString FontPageSettings::MapRange( RString sMapping, int iMapOffset, int iGlyphNo, int iCount ) -{ - if( !sMapping.CompareNoCase("Unicode") ) - { - // Special case. - if( iCount == -1 ) - return "Can't map all of Unicode to one font page"; // don't do that - - /* What's a practical limit? A 2048x2048 texture could contain 16x16 - * characters, which is 16384 glyphs. (Use a grayscale map and that's - * only 4 megs.) Let's use that as a cap. (We don't want to go crazy - * if someone says "range Unicode #0-FFFFFFFF".) */ - if( iCount > 16384 ) - return ssprintf( "Can't map %i glyphs to one font page", iCount ); - - while( iCount ) - { - CharToGlyphNo[iMapOffset] = iGlyphNo; - iMapOffset++; - iGlyphNo++; - iCount--; - } - - return RString(); - } - - const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping ); - if( pMapping == NULL ) - return "Unknown mapping"; - - while( *pMapping != 0 && iMapOffset ) - { - pMapping++; - --iMapOffset; - } - if( iMapOffset ) - return "Map overflow"; // there aren't enough characters in the map - - // If iCount is -1, set it to the number of characters in the map. - if( iCount == -1 ) - for( iCount = 0; pMapping[iCount] != 0; ++iCount ) ; - - while( *pMapping != 0 ) - { - if( *pMapping != FontCharmaps::M_SKIP ) - CharToGlyphNo[*pMapping] = iGlyphNo; - pMapping++; - iGlyphNo++; - iCount--; - } - - if( iCount ) - return "Map overflow"; // there aren't enough characters in the map - - return RString(); -} - -static vector LoadStack; - -/* A font set is a set of files, eg: - * - * Normal 16x16.png - * Normal [other] 16x16.png - * Normal [more] 8x8.png - * Normal 16x16.ini (the 16x16 here is optional) - * - * One INI and at least one texture is required. - * - * The entire font can be redirected; that's handled in ThemeManager. - * Individual font files can not be redirected. - * - * If a file has no characters and sChars is not set, it will receive a default - * mapping of ASCII or ISO-8859-1 if the font has exactly 128 or 256 frames. - * 5x3 (15 frames) and 4x4 (16 frames) numbers sheets are also supported. - * However, if it doesn't, we don't know what it is and the font will receive - * no default mapping. A font isn't useful with no characters mapped. - */ -void Font::Load( const RString &sIniPath, RString sChars ) -{ - ASSERT_M( !GetExtension(sIniPath).CompareNoCase("ini"), sIniPath ); - - //LOG->Trace( "Font: Loading new font '%s'",sIniPath.c_str()); - - // Check for recursion (recursive imports). - for( unsigned i = 0; i < LoadStack.size(); ++i ) - { - if( LoadStack[i] == sIniPath ) - { - RString str = join("\n", LoadStack); - str += "\n" + sIniPath; - RageException::Throw( "Font import recursion detected\n%s", str.c_str() ); - } - } - LoadStack.push_back( sIniPath ); - - // The font is not already loaded. Figure out what we have. - CHECKPOINT_M( ssprintf("Font::Load(\"%s\",\"%s\").", sIniPath.c_str(), m_sChars.c_str()) ); - - path = sIniPath; - m_sChars = sChars; - - // Get the filenames associated with this font. - vector asTexturePaths; - GetFontPaths( sIniPath, asTexturePaths ); - - bool bCapitalsOnly = false; - - // If we have an INI, load it. - IniFile ini; - if( !sIniPath.empty() ) - { - ini.ReadFile( sIniPath ); - ini.RenameKey("Char Widths", "main"); // backward compat - ini.GetValue( "common", "CapitalsOnly", bCapitalsOnly ); - ini.GetValue( "common", "RightToLeft", m_bRightToLeft ); - RString s; - if( ini.GetValue( "common", "DefaultStrokeColor", s ) ) - m_DefaultStrokeColor.FromString( s ); - } - - { - vector ImportList; - - bool bIsTopLevelFont = LoadStack.size() == 1; - - // If this is a top-level font (not a subfont), load the default font first. - if( bIsTopLevelFont ) - ImportList.push_back("Common default"); - - /* Check to see if we need to import any other fonts. Do this - * before loading this font, so any characters in this font - * override imported characters. */ - RString imports; - ini.GetValue( "main", "import", imports ); - split(imports, ",", ImportList, true); - - if( bIsTopLevelFont && imports.empty() && asTexturePaths.empty() ) - { - RString s = ssprintf( "Font \"%s\" is a top-level font with no textures or imports.", sIniPath.c_str() ); - Dialog::OK( s ); - } - - for(unsigned i = 0; i < ImportList.size(); ++i) - { - RString fPath = THEME->GetPathF( "", ImportList[i], true ); - if( fPath == "" ) - { - RString s = ssprintf( "Font \"%s\" imports a font \"%s\" that doesn't exist", sIniPath.c_str(), ImportList[i].c_str() ); - Dialog::OK( s ); - continue; - } - - Font subfont; - subfont.Load(fPath,""); - MergeFont(subfont); - } - } - - // Load each font page. - for( unsigned i = 0; i < asTexturePaths.size(); ++i ) - { - const RString &sTexturePath = asTexturePaths[i]; - - FontPage *pPage = new FontPage; - - // Grab the page name, eg "foo" from "Normal [foo].png". - RString sPagename = GetPageNameFromFileName( sTexturePath ); - - // Ignore stroke textures - if( sTexturePath.find("-stroke") != string::npos ) - continue; - - // Load settings for this page from the INI. - FontPageSettings cfg; - LoadFontPageSettings( cfg, ini, sTexturePath, "common", sChars ); - LoadFontPageSettings( cfg, ini, sTexturePath, sPagename, sChars ); - - // Load. - pPage->Load( cfg ); - - /* Expect at least as many frames as we have premapped characters. */ - /* Make sure that we don't map characters to frames we don't actually - * have. This can happen if the font is too small for an sChars. */ - for( map::const_iterator it = pPage->m_iCharToGlyphNo.begin(); - it != pPage->m_iCharToGlyphNo.end(); ++it ) - { - if( it->second < pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() ) - continue; /* OK */ - RageException::Throw( "The font \"%s\" maps \"%s\" to frame %i, but the font only has %i frames.", - sTexturePath.c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() ); - } - -// LOG->Trace( "Adding page %s (%s) to %s; %i glyphs", -// TexturePaths[i].c_str(), sPagename.c_str(), -// sFontOrTextureFilePath.c_str(), pPage->m_iCharToGlyphNo.size() ); - AddPage( pPage ); - - /* If this is the first font loaded, or it's called "main", this page's - * properties become the font's properties. */ - if( i == 0 || sPagename == "main" ) - SetDefaultGlyph( pPage ); - } - - if( bCapitalsOnly ) - CapsOnly(); - - if( m_iCharToGlyph.empty() ) - LOG->Warn( "Font %s has no characters", sIniPath.c_str() ); - - LoadStack.pop_back(); - - if( LoadStack.empty() ) - { - // Cache ASCII glyphs. - ZERO( m_iCharToGlyphCache ); - map::iterator it; - for( it = m_iCharToGlyph.begin(); it != m_iCharToGlyph.end(); ++it ) - if( it->first < (int) ARRAYLEN(m_iCharToGlyphCache) ) - m_iCharToGlyphCache[it->first] = it->second; - } -} - -/* - * (c) 2001-2004 Glenn Maynard, Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Font.h" +#include "IniFile.h" + +#include "RageTextureManager.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "FontManager.h" +#include "ThemeManager.h" +#include "FontCharmaps.h" +#include "FontCharAliases.h" +#include "arch/Dialog/Dialog.h" + +FontPage::FontPage(): m_iHeight(0), m_iLineSpacing(0), m_fVshift(0), + m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0), + m_sTexturePath("") {} + +void FontPage::Load( const FontPageSettings &cfg ) +{ + m_sTexturePath = cfg.m_sTexturePath; + + // load texture + RageTextureID ID1( m_sTexturePath ); + if( cfg.m_sTextureHints != "default" ) + ID1.AdditionalTextureHints = cfg.m_sTextureHints; + + m_FontPageTextures.m_pTextureMain = TEXTUREMAN->LoadTexture( ID1 ); + ASSERT( m_FontPageTextures.m_pTextureMain != NULL ); + + RageTextureID ID2 = ID1; + // "arial 20 16x16 [main].png" => "arial 20 16x16 [main-stroke].png" + if( ID2.filename.find("]") != string::npos ) + { + ID2.filename.Replace( "]", "-stroke]" ); + if( IsAFile(ID2.filename) ) + { + m_FontPageTextures.m_pTextureStroke = TEXTUREMAN->LoadTexture( ID2 ); + ASSERT( m_FontPageTextures.m_pTextureStroke != NULL ); + ASSERT_M( m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() == m_FontPageTextures.m_pTextureStroke->GetSourceFrameWidth(), ssprintf("'%s' and '%s' must have the same frame widths", ID1.filename.c_str(), ID2.filename.c_str()) ); + ASSERT_M( m_FontPageTextures.m_pTextureMain->GetNumFrames() == m_FontPageTextures.m_pTextureStroke->GetNumFrames(), ssprintf("'%s' and '%s' must have the same frame dimensions", ID1.filename.c_str(), ID2.filename.c_str()) ); + } + } + + // load character widths + vector aiFrameWidths; + + int default_width = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth(); + if( cfg.m_iDefaultWidth != -1 ) + default_width = cfg.m_iDefaultWidth; + + // Assume each character is the width of the frame by default. + for( int i=0; iGetNumFrames(); i++ ) + { + map::const_iterator it = cfg.m_mapGlyphWidths.find(i); + if( it != cfg.m_mapGlyphWidths.end() ) + aiFrameWidths.push_back( it->second ); + else + aiFrameWidths.push_back( default_width ); + } + + if( cfg.m_iAddToAllWidths ) + { + for( int i=0; iGetNumFrames(); i++ ) + aiFrameWidths[i] += cfg.m_iAddToAllWidths; + } + + if( cfg.m_fScaleAllWidthsBy != 1 ) + { + for( int i=0; iGetNumFrames(); i++ ) + aiFrameWidths[i] = lrintf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy ); + } + + m_iCharToGlyphNo = cfg.CharToGlyphNo; + + m_iLineSpacing = cfg.m_iLineSpacing; + if( m_iLineSpacing == -1 ) + m_iLineSpacing = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight(); + + int iBaseline=0; + /* If we don't have a top and/or baseline, assume we're centered in the + * frame, and that LineSpacing is the total height. */ + iBaseline = cfg.m_iBaseline; + if( iBaseline == -1 ) + { + float center = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()/2.0f; + iBaseline = int( center + m_iLineSpacing/2 ); + } + + int iTop = cfg.m_iTop; + if( iTop == -1 ) + { + float center = m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()/2.0f; + iTop = int( center - m_iLineSpacing/2 ); + } + m_iHeight = iBaseline - iTop; + m_iDrawExtraPixelsLeft = cfg.m_iDrawExtraPixelsLeft; + m_iDrawExtraPixelsRight = cfg.m_iDrawExtraPixelsRight; + + // Shift the character up so the top will be rendered at the baseline. + m_fVshift = (float) -iBaseline; + + SetTextureCoords( aiFrameWidths, cfg.m_iAdvanceExtraPixels ); + SetExtraPixels( cfg.m_iDrawExtraPixelsLeft, cfg.m_iDrawExtraPixelsRight ); + +// LOG->Trace("Font %s: height %i, baseline %i ( == top %i)", +// m_sTexturePath.c_str(), height, baseline, baseline-height); +} + +void FontPage::SetTextureCoords( const vector &widths, int iAdvanceExtraPixels ) +{ + for(int i = 0; i < m_FontPageTextures.m_pTextureMain->GetNumFrames(); ++i) + { + glyph g; + + g.m_pPage = this; + + /* Make a copy of each texture rect, reducing each to the actual dimensions + * of the character (most characters don't take a full block). */ + g.m_TexRect = *m_FontPageTextures.m_pTextureMain->GetTextureCoordRect(i); + + // Set the width and height to the width and line spacing, respectively. + g.m_fWidth = float( widths[i] ); + g.m_fHeight = float(m_FontPageTextures.m_pTextureMain->GetSourceFrameHeight()); + + g.m_iHadvance = int(g.m_fWidth) + iAdvanceExtraPixels; + + /* Do the same thing with X. Do this by changing the actual rendered + * m_TexRect, instead of shifting it, so we don't render more than we + * need to. */ + g.m_fHshift = 0; + { + int iSourcePixelsToChopOff = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth() - widths[i]; + if( (iSourcePixelsToChopOff % 2) == 1 ) + { + /* We don't want to chop off an odd number of pixels, since that'll + * put our texture coordinates between texels and make things blurrier. + * Note that, since we set m_iHadvance above, this merely expands what + * we render; it doesn't advance the cursor further. So, glyphs + * that have an odd width should err to being a pixel offcenter left, + * not right. */ + --iSourcePixelsToChopOff; + ++g.m_fWidth; + } + + const float fTexCoordsToChopOff = iSourcePixelsToChopOff * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); + + g.m_TexRect.left += fTexCoordsToChopOff/2; + g.m_TexRect.right -= fTexCoordsToChopOff/2; + } + + g.m_FontPageTextures = m_FontPageTextures; + + m_aGlyphs.push_back(g); + } +} + +void FontPage::SetExtraPixels( int iDrawExtraPixelsLeft, int iDrawExtraPixelsRight ) +{ + /* Hack: do one more than we were asked to; I think a lot of fonts are one + * too low. - glenn */ + iDrawExtraPixelsRight++; + iDrawExtraPixelsLeft++; + + if( (iDrawExtraPixelsLeft % 2) == 1 ) + ++iDrawExtraPixelsLeft; + + // Adjust for iDrawExtraPixelsLeft and iDrawExtraPixelsRight. + for( unsigned i = 0; i < m_aGlyphs.size(); ++i ) + { + int iFrameWidth = m_FontPageTextures.m_pTextureMain->GetSourceFrameWidth(); + float fCharWidth = m_aGlyphs[i].m_fWidth; + + /* Extra pixels to draw to the left and right. We don't have to + * worry about alignment here; fCharWidth is always even (by + * SetTextureCoords) and iFrameWidth are almost always even. */ + float fExtraLeft = min( float(iDrawExtraPixelsLeft), (iFrameWidth-fCharWidth)/2.0f ); + float fExtraRight = min( float(iDrawExtraPixelsRight), (iFrameWidth-fCharWidth)/2.0f ); + + // Move left and expand right. + m_aGlyphs[i].m_TexRect.left -= fExtraLeft * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); + m_aGlyphs[i].m_TexRect.right += fExtraRight * m_FontPageTextures.m_pTextureMain->GetSourceToTexCoordsRatioX(); + m_aGlyphs[i].m_fHshift -= fExtraLeft; + m_aGlyphs[i].m_fWidth += fExtraLeft + fExtraRight; + } +} + +FontPage::~FontPage() +{ + if( m_FontPageTextures.m_pTextureMain != NULL ) + { + TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureMain ); + m_FontPageTextures.m_pTextureMain = NULL; + } + if( m_FontPageTextures.m_pTextureStroke != NULL ) + { + TEXTUREMAN->UnloadTexture( m_FontPageTextures.m_pTextureStroke ); + m_FontPageTextures.m_pTextureStroke = NULL; + } +} + +int Font::GetLineWidthInSourcePixels( const wstring &szLine ) const +{ + int iLineWidth = 0; + + for( unsigned i=0; im_iHeight ); + + return iLineHeight; +} + + +Font::Font() +{ + m_iRefCount = 1; + m_pDefault = NULL; + m_bRightToLeft = false; + // [sm-ssc] don't show strokes by default + m_DefaultStrokeColor = RageColor(0,0,0,0); +} + +Font::~Font() +{ + Unload(); +} + +void Font::Unload() +{ + //LOG->Trace("Font:Unload '%s'",path.c_str()); + for( unsigned i = 0; i < m_apPages.size(); ++i ) + delete m_apPages[i]; + m_apPages.clear(); + + m_iCharToGlyph.clear(); + m_pDefault = NULL; + + /* Don't clear the refcount. We've unloaded, but that doesn't mean things + * aren't still pointing to us. */ +} + +void Font::Reload() +{ + Unload(); + ASSERT( !path.empty() ); + Load( path, m_sChars ); +} + + +void Font::AddPage( FontPage *m_pPage ) +{ + m_apPages.push_back( m_pPage ); + + for( map::const_iterator it = m_pPage->m_iCharToGlyphNo.begin(); + it != m_pPage->m_iCharToGlyphNo.end(); ++it ) + { + m_iCharToGlyph[it->first] = &m_pPage->m_aGlyphs[it->second]; + } +} + +void Font::MergeFont(Font &f) +{ + /* If we don't have a font page yet, and f does, grab the default font + * page. It'll usually be overridden later on by one of our own font + * pages; this will be used only if we don't have any font pages at + * all. */ + if( m_pDefault == NULL ) + m_pDefault = f.m_pDefault; + + for(map::iterator it = f.m_iCharToGlyph.begin(); + it != f.m_iCharToGlyph.end(); ++it) + { + m_iCharToGlyph[it->first] = it->second; + } + + m_apPages.insert( m_apPages.end(), f.m_apPages.begin(), f.m_apPages.end() ); + + f.m_apPages.clear(); +} + +const glyph &Font::GetGlyph( wchar_t c ) const +{ + ASSERT(c >= 0 && c <= 0xFFFFFF); + + // Fast path: + if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] ) + return *m_iCharToGlyphCache[c]; + + // Try the regular character. + map::const_iterator it = m_iCharToGlyph.find(c); + + // If that's missing, use the default glyph. + if(it == m_iCharToGlyph.end()) + it = m_iCharToGlyph.find(FONT_DEFAULT_GLYPH); + + if(it == m_iCharToGlyph.end()) + RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() ); + + return *it->second; +} + +bool Font::FontCompleteForString( const wstring &str ) const +{ + map::const_iterator mapDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH ); + if( mapDefault == m_iCharToGlyph.end() ) + RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() ); + + for( unsigned i = 0; i < str.size(); ++i ) + { + // If the glyph for this character is the default glyph, we're incomplete. + const glyph &g = GetGlyph( str[i] ); + if( &g == mapDefault->second ) + return false; + } + return true; +} + +void Font::CapsOnly() +{ + /* For each uppercase character that we have a mapping for, add + * a lowercase one. */ + for( char c = 'A'; c <= 'Z'; ++c ) + { + map::const_iterator it = m_iCharToGlyph.find(c); + + if(it == m_iCharToGlyph.end()) + continue; + + m_iCharToGlyph[(char) tolower(c)] = it->second; + } +} + +void Font::SetDefaultGlyph( FontPage *pPage ) +{ + ASSERT( pPage ); + ASSERT( !pPage->m_aGlyphs.empty() ); + m_pDefault = pPage; +} + + +// Given the INI for a font, find all of the texture pages for the font. +void Font::GetFontPaths( const RString &sFontIniPath, vector &asTexturePathsOut ) +{ + RString sPrefix = SetExtension( sFontIniPath, "" ); + vector asFiles; + GetDirListing( sPrefix + "*", asFiles, false, true ); + + for( unsigned i = 0; i < asFiles.size(); ++i ) + { + if( !asFiles[i].Right(4).EqualsNoCase(".ini") ) + asTexturePathsOut.push_back( asFiles[i] ); + } +} + +RString Font::GetPageNameFromFileName( const RString &sFilename ) +{ + size_t begin = sFilename.find_first_of( '[' ); + if( begin == string::npos ) + return "main"; + + size_t end = sFilename.find_first_of( ']', begin ); + if( end == string::npos ) + return "main"; + + begin++; + end--; + if( end == begin ) + return "main"; + return sFilename.substr( begin, end-begin+1 ); +} + +void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &sPageName, RString sChars ) +{ + cfg.m_sTexturePath = sTexturePath; + + // If we have any characters to map, add them. + for( unsigned n=0; nTrace("Loading font page '%s' settings from page name '%s'", +// TexturePath.c_str(), sPageName.c_str()); + + ini.GetValue( sPageName, "DrawExtraPixelsLeft", cfg.m_iDrawExtraPixelsLeft ); + ini.GetValue( sPageName, "DrawExtraPixelsRight", cfg.m_iDrawExtraPixelsRight ); + ini.GetValue( sPageName, "AddToAllWidths", cfg.m_iAddToAllWidths ); + ini.GetValue( sPageName, "ScaleAllWidthsBy", cfg.m_fScaleAllWidthsBy ); + ini.GetValue( sPageName, "LineSpacing", cfg.m_iLineSpacing ); + ini.GetValue( sPageName, "Top", cfg.m_iTop ); + ini.GetValue( sPageName, "Baseline", cfg.m_iBaseline ); + ini.GetValue( sPageName, "DefaultWidth", cfg.m_iDefaultWidth ); + ini.GetValue( sPageName, "AdvanceExtraPixels", cfg.m_iAdvanceExtraPixels ); + ini.GetValue( sPageName, "TextureHints", cfg.m_sTextureHints ); + + // Iterate over all keys. + const XNode* pNode = ini.GetChild( sPageName ); + if( pNode ) + { + FOREACH_CONST_Attr( pNode, pAttr ) + { + RString sName = pAttr->first; + const XNodeValue *pValue = pAttr->second; + + sName.MakeUpper(); + + // If val is an integer, it's a width, eg. "10=27". + if( IsAnInt(sName) ) + { + cfg.m_mapGlyphWidths[atoi(sName)] = pValue->GetValue(); + continue; + } + + // "map codepoint=frame" maps a char to a frame. + if( sName.substr(0, 4) == "MAP " ) + { + /* map CODEPOINT=frame. CODEPOINT can be + * 1. U+hexval + * 2. an alias ("oq") + * 3. a character in quotes ("X") + * + * map 1=2 is the same as + * range unicode #1-1=2 + */ + RString sCodepoint = sName.substr(4); // "CODEPOINT" + + wchar_t c; + if( sCodepoint.substr(0, 2) == "U+" && IsHexVal(sCodepoint.substr(2)) ) + sscanf( sCodepoint.substr(2).c_str(), "%x", &c ); + else if( sCodepoint.size() > 0 && + utf8_get_char_len(sCodepoint[0]) == int(sCodepoint.size()) ) + { + c = utf8_get_char( sCodepoint.c_str() ); + if(c == wchar_t(-1)) + LOG->Warn("Font definition '%s' has an invalid value '%s'.", + ini.GetPath().c_str(), sName.c_str() ); + } + else if( !FontCharAliases::GetChar(sCodepoint, c) ) + { + LOG->Warn("Font definition '%s' has an invalid value '%s'.", + ini.GetPath().c_str(), sName.c_str() ); + continue; + } + + cfg.CharToGlyphNo[c] = pValue->GetValue(); + + continue; + } + + if( sName.substr(0, 6) == "RANGE " ) + { + /* range CODESET=first_frame or + * range CODESET #start-end=first_frame + * eg + * range CP1252=0 (default for 256-frame fonts) + * range ASCII=0 (default for 128-frame fonts) + * + * (Start and end are in hex.) + * + * Map two high-bit portions of ISO-8859- to one font: + * range ISO-8859-2 #80-FF=0 + * range ISO-8859-3 #80-FF=128 + * + * Map hiragana to 0-84: + * range Unicode #3041-3094=0 + */ + vector asMatches; + static Regex parse("^RANGE ([A-Z0-9\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$"); + bool bMatch = parse.Compare( sName, asMatches ); + + ASSERT( asMatches.size() == 4 ); // 4 parens + + if( !bMatch || asMatches[0].empty() ) + RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": parse error.", + ini.GetPath().c_str(), sName.c_str() ); + + // We must have either 1 match (just the codeset) or 4 (the whole thing). + int iCount = -1; + int iFirst = 0; + if( !asMatches[2].empty() ) + { + sscanf( asMatches[2].c_str(), "%x", &iFirst ); + int iLast; + sscanf( asMatches[3].c_str(), "%x", &iLast ); + if( iLast < iFirst ) + RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %i < %i.", + ini.GetPath().c_str(), sName.c_str(), iLast, iFirst ); + + iCount = iLast - iFirst + 1; + } + + RString sRet = cfg.MapRange( asMatches[0], iFirst, pValue->GetValue(), iCount ); + if( !sRet.empty() ) + RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %s.", + ini.GetPath().c_str(), sName.c_str(), sRet.c_str() ); + + continue; + } + + if( sName.substr(0, 5) == "LINE " ) + { + /* line ROW=CHAR1CHAR2CHAR3CHAR4 + * eg. + * line 0=ABCDEFGH + * + * This lets us assign characters very compactly and readably. */ + + RString sRowStr = sName.substr(5); + TrimLeft( sRowStr ); + + ASSERT( IsAnInt(sRowStr) ); + const int iRow = atoi( sRowStr.c_str() ); + const int iFirstFrame = iRow * iNumFramesWide; + + if( iRow > iNumFramesHigh ) + RageException::Throw( "The font definition \"%s\" tries to assign line %i, but the font is only %i characters high.", + ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh ); + + // Decode the string. + const wstring wdata( RStringToWstring(pValue->GetValue()) ); + + if( int(wdata.size()) > iNumFramesWide ) + RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font is only %i characters wide.", + ini.GetPath().c_str(), (int)wdata.size(), iRow, wdata.c_str(), iNumFramesWide ); + + for( unsigned i = 0; i < wdata.size(); ++i ) + cfg.CharToGlyphNo[wdata[i]] = iFirstFrame+i; + } + } + } + + /* If it's 128 or 256 frames, default to ASCII or CP1252, + * respectively. 5x3 and 4x4 numbers fonts are supported as well. + * If it's anything else, we don't know what it is, so don't make + * any default mappings (the INI needs to do that itself). */ + if( sPageName != "common" && cfg.CharToGlyphNo.empty() ) + { + switch( iNumFrames ) + { + case 128: + cfg.MapRange( "ascii", 0, 0, -1 ); + break; + case 256: + cfg.MapRange( "cp1252", 0, 0, -1 ); + break; + case 15: + case 16: + cfg.MapRange( "numbers", 0, 0, -1 ); + break; + default: + LOG->Trace( "Font page \"%s\" has no characters", sTexturePath.c_str() ); + } + } + + // If ' ' is set and nbsp is not, set nbsp. + if( cfg.CharToGlyphNo.find(' ') != cfg.CharToGlyphNo.end() ) + cfg.CharToGlyphNo[0x00A0] = cfg.CharToGlyphNo[' ']; +} + +RString FontPageSettings::MapRange( RString sMapping, int iMapOffset, int iGlyphNo, int iCount ) +{ + if( !sMapping.CompareNoCase("Unicode") ) + { + // Special case. + if( iCount == -1 ) + return "Can't map all of Unicode to one font page"; // don't do that + + /* What's a practical limit? A 2048x2048 texture could contain 16x16 + * characters, which is 16384 glyphs. (Use a grayscale map and that's + * only 4 megs.) Let's use that as a cap. (We don't want to go crazy + * if someone says "range Unicode #0-FFFFFFFF".) */ + if( iCount > 16384 ) + return ssprintf( "Can't map %i glyphs to one font page", iCount ); + + while( iCount ) + { + CharToGlyphNo[iMapOffset] = iGlyphNo; + iMapOffset++; + iGlyphNo++; + iCount--; + } + + return RString(); + } + + const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping ); + if( pMapping == NULL ) + return "Unknown mapping"; + + while( *pMapping != 0 && iMapOffset ) + { + pMapping++; + --iMapOffset; + } + if( iMapOffset ) + return "Map overflow"; // there aren't enough characters in the map + + // If iCount is -1, set it to the number of characters in the map. + if( iCount == -1 ) + for( iCount = 0; pMapping[iCount] != 0; ++iCount ) ; + + while( *pMapping != 0 ) + { + if( *pMapping != FontCharmaps::M_SKIP ) + CharToGlyphNo[*pMapping] = iGlyphNo; + pMapping++; + iGlyphNo++; + iCount--; + } + + if( iCount ) + return "Map overflow"; // there aren't enough characters in the map + + return RString(); +} + +static vector LoadStack; + +/* A font set is a set of files, eg: + * + * Normal 16x16.png + * Normal [other] 16x16.png + * Normal [more] 8x8.png + * Normal 16x16.ini (the 16x16 here is optional) + * + * One INI and at least one texture is required. + * + * The entire font can be redirected; that's handled in ThemeManager. + * Individual font files can not be redirected. + * + * If a file has no characters and sChars is not set, it will receive a default + * mapping of ASCII or ISO-8859-1 if the font has exactly 128 or 256 frames. + * 5x3 (15 frames) and 4x4 (16 frames) numbers sheets are also supported. + * However, if it doesn't, we don't know what it is and the font will receive + * no default mapping. A font isn't useful with no characters mapped. + */ +void Font::Load( const RString &sIniPath, RString sChars ) +{ + ASSERT_M( !GetExtension(sIniPath).CompareNoCase("ini"), sIniPath ); + + //LOG->Trace( "Font: Loading new font '%s'",sIniPath.c_str()); + + // Check for recursion (recursive imports). + for( unsigned i = 0; i < LoadStack.size(); ++i ) + { + if( LoadStack[i] == sIniPath ) + { + RString str = join("\n", LoadStack); + str += "\n" + sIniPath; + RageException::Throw( "Font import recursion detected\n%s", str.c_str() ); + } + } + LoadStack.push_back( sIniPath ); + + // The font is not already loaded. Figure out what we have. + CHECKPOINT_M( ssprintf("Font::Load(\"%s\",\"%s\").", sIniPath.c_str(), m_sChars.c_str()) ); + + path = sIniPath; + m_sChars = sChars; + + // Get the filenames associated with this font. + vector asTexturePaths; + GetFontPaths( sIniPath, asTexturePaths ); + + bool bCapitalsOnly = false; + + // If we have an INI, load it. + IniFile ini; + if( !sIniPath.empty() ) + { + ini.ReadFile( sIniPath ); + ini.RenameKey("Char Widths", "main"); // backward compat + ini.GetValue( "common", "CapitalsOnly", bCapitalsOnly ); + ini.GetValue( "common", "RightToLeft", m_bRightToLeft ); + RString s; + if( ini.GetValue( "common", "DefaultStrokeColor", s ) ) + m_DefaultStrokeColor.FromString( s ); + } + + { + vector ImportList; + + bool bIsTopLevelFont = LoadStack.size() == 1; + + // If this is a top-level font (not a subfont), load the default font first. + if( bIsTopLevelFont ) + ImportList.push_back("Common default"); + + /* Check to see if we need to import any other fonts. Do this + * before loading this font, so any characters in this font + * override imported characters. */ + RString imports; + ini.GetValue( "main", "import", imports ); + split(imports, ",", ImportList, true); + + if( bIsTopLevelFont && imports.empty() && asTexturePaths.empty() ) + { + RString s = ssprintf( "Font \"%s\" is a top-level font with no textures or imports.", sIniPath.c_str() ); + Dialog::OK( s ); + } + + for(unsigned i = 0; i < ImportList.size(); ++i) + { + RString fPath = THEME->GetPathF( "", ImportList[i], true ); + if( fPath == "" ) + { + RString s = ssprintf( "Font \"%s\" imports a font \"%s\" that doesn't exist", sIniPath.c_str(), ImportList[i].c_str() ); + Dialog::OK( s ); + continue; + } + + Font subfont; + subfont.Load(fPath,""); + MergeFont(subfont); + } + } + + // Load each font page. + for( unsigned i = 0; i < asTexturePaths.size(); ++i ) + { + const RString &sTexturePath = asTexturePaths[i]; + + FontPage *pPage = new FontPage; + + // Grab the page name, eg "foo" from "Normal [foo].png". + RString sPagename = GetPageNameFromFileName( sTexturePath ); + + // Ignore stroke textures + if( sTexturePath.find("-stroke") != string::npos ) + continue; + + // Load settings for this page from the INI. + FontPageSettings cfg; + LoadFontPageSettings( cfg, ini, sTexturePath, "common", sChars ); + LoadFontPageSettings( cfg, ini, sTexturePath, sPagename, sChars ); + + // Load. + pPage->Load( cfg ); + + /* Expect at least as many frames as we have premapped characters. */ + /* Make sure that we don't map characters to frames we don't actually + * have. This can happen if the font is too small for an sChars. */ + for( map::const_iterator it = pPage->m_iCharToGlyphNo.begin(); + it != pPage->m_iCharToGlyphNo.end(); ++it ) + { + if( it->second < pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() ) + continue; /* OK */ + RageException::Throw( "The font \"%s\" maps \"%s\" to frame %i, but the font only has %i frames.", + sTexturePath.c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, pPage->m_FontPageTextures.m_pTextureMain->GetNumFrames() ); + } + +// LOG->Trace( "Adding page %s (%s) to %s; %i glyphs", +// TexturePaths[i].c_str(), sPagename.c_str(), +// sFontOrTextureFilePath.c_str(), pPage->m_iCharToGlyphNo.size() ); + AddPage( pPage ); + + /* If this is the first font loaded, or it's called "main", this page's + * properties become the font's properties. */ + if( i == 0 || sPagename == "main" ) + SetDefaultGlyph( pPage ); + } + + if( bCapitalsOnly ) + CapsOnly(); + + if( m_iCharToGlyph.empty() ) + LOG->Warn( "Font %s has no characters", sIniPath.c_str() ); + + LoadStack.pop_back(); + + if( LoadStack.empty() ) + { + // Cache ASCII glyphs. + ZERO( m_iCharToGlyphCache ); + map::iterator it; + for( it = m_iCharToGlyph.begin(); it != m_iCharToGlyph.end(); ++it ) + if( it->first < (int) ARRAYLEN(m_iCharToGlyphCache) ) + m_iCharToGlyphCache[it->first] = it->second; + } +} + +/* + * (c) 2001-2004 Glenn Maynard, Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Font.h b/src/Font.h index b83c6da1a9..ef1eeb1f73 100644 --- a/src/Font.h +++ b/src/Font.h @@ -1,244 +1,244 @@ -/** @brief Font - stores a font, used by BitmapText. */ - -#ifndef FONT_H -#define FONT_H - -#include "RageTextureID.h" -#include "RageUtil.h" -#include "RageTypes.h" -#include - -class FontPage; -class RageTexture; -class IniFile; - -/** @brief The textures used by the font. */ -struct FontPageTextures -{ - /** @brief The primary texture drawn underneath Main. */ - RageTexture *m_pTextureMain; - /** @brief an optional texture drawn underneath Main. - * - * This can help to acheive complicated layer styles. */ - RageTexture *m_pTextureStroke; - - /** @brief Set up the initial textures. */ - FontPageTextures() - { - m_pTextureMain = NULL; - m_pTextureStroke = NULL; - } -}; - -/** @brief The components of a glyph (not technically a character). */ -struct glyph -{ - /** @brief the FontPage that is needed. */ - FontPage *m_pPage; - /** @brief the textures for the glyph. */ - FontPageTextures m_FontPageTextures; - FontPageTextures *GetFontPageTextures() const { return const_cast(&m_FontPageTextures); } - - /** @brief Number of pixels to advance horizontally after drawing this character. */ - int m_iHadvance; - - /** @brief Width of the actual rendered character. */ - float m_fWidth; - /** @brief Height of the actual rendered character. */ - float m_fHeight; - - /** @brief Number of pixels to offset this character when rendering. */ - float m_fHshift; // , m_fVshift; - - /** @brief Texture coordinate rect. */ - RectF m_TexRect; -}; - -/** @brief The settings used for the FontPage. */ -struct FontPageSettings -{ - RString m_sTexturePath; - - int m_iDrawExtraPixelsLeft, - m_iDrawExtraPixelsRight, - m_iAddToAllWidths, - m_iLineSpacing, - m_iTop, - m_iBaseline, - m_iDefaultWidth, - m_iAdvanceExtraPixels; - float m_fScaleAllWidthsBy; - RString m_sTextureHints; - - map CharToGlyphNo; - // If a value is missing, the width of the texture frame is used. - map m_mapGlyphWidths; - - /** @brief The initial settings for the FontPage. */ - FontPageSettings(): - m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0), - m_iAddToAllWidths(0), - m_iLineSpacing(-1), - m_iTop(-1), - m_iBaseline(-1), - m_iDefaultWidth(-1), - m_iAdvanceExtraPixels(1), - m_fScaleAllWidthsBy(1), - m_sTextureHints("default") - { } - - /** - * @brief Map a range from a character map to glyphs. - * @param sMapping the intended mapping. - * @param iMapOffset the number of maps to offset. - * @param iGlyphOffset the number of glyphs to offset. - * @param iCount the range to map. If -1, the range is the entire map. - * @return the empty string on success, or an error message on failure. */ - RString MapRange( RString sMapping, int iMapOffset, int iGlyphOffset, int iCount ); -}; - -class FontPage -{ -public: - FontPage(); - ~FontPage(); - - void Load( const FontPageSettings &cfg ); - - // Page-global properties. - int m_iHeight; - int m_iLineSpacing; - float m_fVshift; - int GetCenter() const { return m_iHeight/2; } - - // Remember these only for GetLineWidthInSourcePixels. - int m_iDrawExtraPixelsLeft, - m_iDrawExtraPixelsRight; - - FontPageTextures m_FontPageTextures; - - // XXX: remove? - RString m_sTexturePath; - - /** @brief All glyphs in this list will point to m_pTexture. */ - vector m_aGlyphs; - - map m_iCharToGlyphNo; - -private: - void SetExtraPixels( int iDrawExtraPixelsLeft, int DrawExtraPixelsRight ); - void SetTextureCoords( const vector &aiWidths, int iAdvanceExtraPixels ); -}; - -class Font -{ -public: - int m_iRefCount; - RString path; - - Font(); - ~Font(); - - const glyph &GetGlyph( wchar_t c ) const; - - int GetLineWidthInSourcePixels( const wstring &szLine ) const; - int GetLineHeightInSourcePixels( const wstring &szLine ) const; - - bool FontCompleteForString( const wstring &str ) const; - - /** - * @brief Add a FontPage to this font. - * @param fp the FontPage to be added. - */ - void AddPage(FontPage *fp); - - /** - * @brief Steal all of a font's pages. - * @param f the font whose pages we are stealing. */ - void MergeFont(Font &f); - - void Load(const RString &sFontOrTextureFilePath, RString sChars); - void Unload(); - void Reload(); - - // Load font-wide settings. - void CapsOnly(); - - int GetHeight() const { return m_pDefault->m_iHeight; } - int GetCenter() const { return m_pDefault->GetCenter(); } - int GetLineSpacing() const { return m_pDefault->m_iLineSpacing; } - - void SetDefaultGlyph( FontPage *pPage ); - - bool IsRightToLeft() const { return m_bRightToLeft; }; - const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; }; - -private: - /** @brief List of pages and fonts that we use (and are responsible for freeing). */ - vector m_apPages; - - /** - * @brief This is the primary fontpage of this font. - * - * The font-wide height, center, etc. is pulled from it. - * (This is one of pages[].) */ - FontPage *m_pDefault; - - /** @brief Map from characters to glyphs. */ - map m_iCharToGlyph; - /** @brief Each glyph is part of one of the pages[]. */ - glyph *m_iCharToGlyphCache[128]; - - /** - * @brief True for Hebrew, Arabic, Urdu fonts. - * - * This will also change the way glyphs from the default FontPage are rendered. - * There may be a better way to handle this. */ - bool m_bRightToLeft; - - RageColor m_DefaultStrokeColor; - - /** @brief We keep this around only for reloading. */ - RString m_sChars; - - void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars ); - static void GetFontPaths( const RString &sFontOrTextureFilePath, vector &sTexturePaths ); - RString GetPageNameFromFileName( const RString &sFilename ); - - Font(const Font& rhs); - Font& operator=(const Font& rhs); -}; - -/** - * @brief Last private-use Unicode character: - * - * This is in the header to reduce file dependencies. */ -const wchar_t FONT_DEFAULT_GLYPH = 0xF8FF; - -#endif - -/** - * @file - * @author Glenn Maynard, Chris Danford (c) 2001-2004 - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief Font - stores a font, used by BitmapText. */ + +#ifndef FONT_H +#define FONT_H + +#include "RageTextureID.h" +#include "RageUtil.h" +#include "RageTypes.h" +#include + +class FontPage; +class RageTexture; +class IniFile; + +/** @brief The textures used by the font. */ +struct FontPageTextures +{ + /** @brief The primary texture drawn underneath Main. */ + RageTexture *m_pTextureMain; + /** @brief an optional texture drawn underneath Main. + * + * This can help to acheive complicated layer styles. */ + RageTexture *m_pTextureStroke; + + /** @brief Set up the initial textures. */ + FontPageTextures() + { + m_pTextureMain = NULL; + m_pTextureStroke = NULL; + } +}; + +/** @brief The components of a glyph (not technically a character). */ +struct glyph +{ + /** @brief the FontPage that is needed. */ + FontPage *m_pPage; + /** @brief the textures for the glyph. */ + FontPageTextures m_FontPageTextures; + FontPageTextures *GetFontPageTextures() const { return const_cast(&m_FontPageTextures); } + + /** @brief Number of pixels to advance horizontally after drawing this character. */ + int m_iHadvance; + + /** @brief Width of the actual rendered character. */ + float m_fWidth; + /** @brief Height of the actual rendered character. */ + float m_fHeight; + + /** @brief Number of pixels to offset this character when rendering. */ + float m_fHshift; // , m_fVshift; + + /** @brief Texture coordinate rect. */ + RectF m_TexRect; +}; + +/** @brief The settings used for the FontPage. */ +struct FontPageSettings +{ + RString m_sTexturePath; + + int m_iDrawExtraPixelsLeft, + m_iDrawExtraPixelsRight, + m_iAddToAllWidths, + m_iLineSpacing, + m_iTop, + m_iBaseline, + m_iDefaultWidth, + m_iAdvanceExtraPixels; + float m_fScaleAllWidthsBy; + RString m_sTextureHints; + + map CharToGlyphNo; + // If a value is missing, the width of the texture frame is used. + map m_mapGlyphWidths; + + /** @brief The initial settings for the FontPage. */ + FontPageSettings(): + m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0), + m_iAddToAllWidths(0), + m_iLineSpacing(-1), + m_iTop(-1), + m_iBaseline(-1), + m_iDefaultWidth(-1), + m_iAdvanceExtraPixels(1), + m_fScaleAllWidthsBy(1), + m_sTextureHints("default") + { } + + /** + * @brief Map a range from a character map to glyphs. + * @param sMapping the intended mapping. + * @param iMapOffset the number of maps to offset. + * @param iGlyphOffset the number of glyphs to offset. + * @param iCount the range to map. If -1, the range is the entire map. + * @return the empty string on success, or an error message on failure. */ + RString MapRange( RString sMapping, int iMapOffset, int iGlyphOffset, int iCount ); +}; + +class FontPage +{ +public: + FontPage(); + ~FontPage(); + + void Load( const FontPageSettings &cfg ); + + // Page-global properties. + int m_iHeight; + int m_iLineSpacing; + float m_fVshift; + int GetCenter() const { return m_iHeight/2; } + + // Remember these only for GetLineWidthInSourcePixels. + int m_iDrawExtraPixelsLeft, + m_iDrawExtraPixelsRight; + + FontPageTextures m_FontPageTextures; + + // XXX: remove? + RString m_sTexturePath; + + /** @brief All glyphs in this list will point to m_pTexture. */ + vector m_aGlyphs; + + map m_iCharToGlyphNo; + +private: + void SetExtraPixels( int iDrawExtraPixelsLeft, int DrawExtraPixelsRight ); + void SetTextureCoords( const vector &aiWidths, int iAdvanceExtraPixels ); +}; + +class Font +{ +public: + int m_iRefCount; + RString path; + + Font(); + ~Font(); + + const glyph &GetGlyph( wchar_t c ) const; + + int GetLineWidthInSourcePixels( const wstring &szLine ) const; + int GetLineHeightInSourcePixels( const wstring &szLine ) const; + + bool FontCompleteForString( const wstring &str ) const; + + /** + * @brief Add a FontPage to this font. + * @param fp the FontPage to be added. + */ + void AddPage(FontPage *fp); + + /** + * @brief Steal all of a font's pages. + * @param f the font whose pages we are stealing. */ + void MergeFont(Font &f); + + void Load(const RString &sFontOrTextureFilePath, RString sChars); + void Unload(); + void Reload(); + + // Load font-wide settings. + void CapsOnly(); + + int GetHeight() const { return m_pDefault->m_iHeight; } + int GetCenter() const { return m_pDefault->GetCenter(); } + int GetLineSpacing() const { return m_pDefault->m_iLineSpacing; } + + void SetDefaultGlyph( FontPage *pPage ); + + bool IsRightToLeft() const { return m_bRightToLeft; }; + const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; }; + +private: + /** @brief List of pages and fonts that we use (and are responsible for freeing). */ + vector m_apPages; + + /** + * @brief This is the primary fontpage of this font. + * + * The font-wide height, center, etc. is pulled from it. + * (This is one of pages[].) */ + FontPage *m_pDefault; + + /** @brief Map from characters to glyphs. */ + map m_iCharToGlyph; + /** @brief Each glyph is part of one of the pages[]. */ + glyph *m_iCharToGlyphCache[128]; + + /** + * @brief True for Hebrew, Arabic, Urdu fonts. + * + * This will also change the way glyphs from the default FontPage are rendered. + * There may be a better way to handle this. */ + bool m_bRightToLeft; + + RageColor m_DefaultStrokeColor; + + /** @brief We keep this around only for reloading. */ + RString m_sChars; + + void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars ); + static void GetFontPaths( const RString &sFontOrTextureFilePath, vector &sTexturePaths ); + RString GetPageNameFromFileName( const RString &sFilename ); + + Font(const Font& rhs); + Font& operator=(const Font& rhs); +}; + +/** + * @brief Last private-use Unicode character: + * + * This is in the header to reduce file dependencies. */ +const wchar_t FONT_DEFAULT_GLYPH = 0xF8FF; + +#endif + +/** + * @file + * @author Glenn Maynard, Chris Danford (c) 2001-2004 + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontCharAliases.cpp b/src/FontCharAliases.cpp index 8097f8e3c2..bfe774ac51 100644 --- a/src/FontCharAliases.cpp +++ b/src/FontCharAliases.cpp @@ -1,415 +1,415 @@ -#include "global.h" -#include "FontCharAliases.h" -#include "Font.h" -#include "RageUtil.h" -#include "RageLog.h" - -#include - -// Map from "&foo;" to a UTF-8 string. -typedef map aliasmap; -static aliasmap CharAliases; -static map CharAliasRepl; - -/* Editing this file in VC6 will be rather ugly, since it contains a lot of UTF-8. - * Just don't change anything you can't read. :) */ - -/* If we move this to an INI, group these, so we can display them in a help - * page off of the TextEntry screen reasonably. - * - * [Game Kanji] - * kakumei1=革 - * [Game Symbols] - * doublezeta=SPECIAL - * [Hiragana] - * [Katakana] - * [Punctuation] - * - * I'm not sure how to handle internal-use character, like Zz. Whenever we write - * text to disk, we need to write placeholders (&doublezeta;) for them, and never - * Unicode characters, since the codepoint is prone to change. We can't currently - * write &these; to SMs, due to format limitations. - */ - -// the above comment sounds old, look at the "kakumei1", which reminds me of the -// old SPiGuMuS kanji font hack. -// a more modern implementation would likely involve a Lua file in Data for the -// base character aliases, and any alias not encountered in the list would be -// added at the next possible internal code point. -aj - -/* Here's a copy-and-paste for a basic Japanese font page: - - 、。〃〄々〆〇〈〉《》「」『』 -【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟 -〠 -〰〱〲〳〴〵〶〷 - ぁあぃいぅうぇえぉおかがきぎく -ぐけげこごさざしじすずせぜそぞた -だちぢっつづてでとどなにぬねのは -ばぱひびぴふぶぷへべぺほぼぽまみ -むめもゃやゅゆょよらりるれろゎわ -ゐゑをんゔ      ゛゜ゝゞ  - ァアィイゥウェエォオカガキギク -グケゲコゴサザシジスズセゼソゾタ -ダチヂッツヅテデトドナニヌネノハ -バパヒビピフブプヘベペホボポマミ -ムメモャヤュユョヨラリルレロヮワ -ヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ  - -And here's one for a kanji page: - - 一ニ三四五六七八 -九十 -革命祭桜小坂鬼道 -弐神様民謡明日青 -衝動猫毛亜熱帯爆 -弾谷新大見解魔法 -扉夜空才 - - */ - -static void InitCharAliases() -{ - if(!CharAliases.empty()) - return; - - CharAliases["default"] = FONT_DEFAULT_GLYPH; // ? - CharAliases["invalid"] = INVALID_CHAR; // 0xFFFD - - // The comments here are UTF-8; they won't show up in VC6 - // (use a better editor then -aj) - -#define INTERNAL 0xE000 - - // todo: convert this into a vector? that way we can dynamically add - // to the list easier. -aj(?) - // Hiragana: - struct alias { - const char *str; - wchar_t chr; - } aliases[] = { - { "ha", 0x3042 }, /* あ */ - { "hi", 0x3044 }, /* い */ - { "hu", 0x3046 }, /* う */ - { "he", 0x3048 }, /* え */ - { "ho", 0x304a }, /* お */ - { "hka", 0x304b }, /* か */ - { "hki", 0x304d }, /* き */ - { "hku", 0x304f }, /* く */ - { "hke", 0x3051 }, /* け */ - { "hko", 0x3053 }, /* こ */ - { "hga", 0x304c }, /* が */ - { "hgi", 0x304e }, /* ぎ */ - { "hgu", 0x3050 }, /* ぐ */ - { "hge", 0x3052 }, /* げ */ - { "hgo", 0x3054 }, /* ご */ - { "hza", 0x3056 }, /* ざ */ - { "hzi", 0x3058 }, /* じ */ - { "hzu", 0x305a }, /* ず */ - { "hze", 0x305c }, /* ぜ */ - { "hzo", 0x305e }, /* ぞ */ - { "hta", 0x305f }, /* た */ - { "hti", 0x3061 }, /* ち */ - { "htu", 0x3064 }, /* つ */ - { "hte", 0x3066 }, /* て */ - { "hto", 0x3068 }, /* と */ - { "hda", 0x3060 }, /* だ */ - { "hdi", 0x3062 }, /* ぢ */ - { "hdu", 0x3065 }, /* づ */ - { "hde", 0x3067 }, /* で */ - { "hdo", 0x3069 }, /* ど */ - { "hna", 0x306a }, /* な */ - { "hni", 0x306b }, /* に */ - { "hnu", 0x306c }, /* ぬ */ - { "hne", 0x306d }, /* ね */ - { "hno", 0x306e }, /* の */ - { "hha", 0x306f }, /* は */ - { "hhi", 0x3072 }, /* ひ */ - { "hhu", 0x3075 }, /* ふ */ - { "hhe", 0x3078 }, /* へ */ - { "hho", 0x307b }, /* ほ */ - { "hba", 0x3070 }, /* ば */ - { "hbi", 0x3073 }, /* び */ - { "hbu", 0x3076 }, /* ぶ */ - { "hbe", 0x3079 }, /* べ */ - { "hbo", 0x307c }, /* ぼ */ - { "hpa", 0x3071 }, /* ぱ */ - { "hpi", 0x3074 }, /* ぴ */ - { "hpu", 0x3077 }, /* ぷ */ - { "hpe", 0x307a }, /* ぺ */ - { "hpo", 0x307d }, /* ぽ */ - { "hma", 0x307e }, /* ま */ - { "hmi", 0x307f }, /* み */ - { "hmu", 0x3080 }, /* む */ - { "hme", 0x3081 }, /* め */ - { "hmo", 0x3082 }, /* も */ - { "hya", 0x3084 }, /* や */ - { "hyu", 0x3086 }, /* ゆ */ - { "hyo", 0x3088 }, /* よ */ - { "hra", 0x3089 }, /* ら */ - { "hri", 0x308a }, /* り */ - { "hru", 0x308b }, /* る */ - { "hre", 0x308c }, /* れ */ - { "hro", 0x308d }, /* ろ */ - { "hwa", 0x308f }, /* わ */ - { "hwi", 0x3090 }, /* ゐ */ - { "hwe", 0x3091 }, /* ゑ */ - { "hwo", 0x3092 }, /* を */ - { "hn", 0x3093 }, /* ん */ - { "hvu", 0x3094 }, /* ゔ */ - { "has", 0x3041 }, /* ぁ */ - { "his", 0x3043 }, /* ぃ */ - { "hus", 0x3045 }, /* ぅ */ - { "hes", 0x3047 }, /* ぇ */ - { "hos", 0x3049 }, /* ぉ */ - { "hkas", 0x3095 }, /* ゕ */ - { "hkes", 0x3096 }, /* ゖ */ - { "hsa", 0x3055 }, /* さ */ - { "hsi", 0x3057 }, /* し */ - { "hsu", 0x3059 }, /* す */ - { "hse", 0x305b }, /* せ */ - { "hso", 0x305d }, /* そ */ - { "hyas", 0x3083 }, /* ゃ */ - { "hyus", 0x3085 }, /* ゅ */ - { "hyos", 0x3087 }, /* ょ */ - { "hwas", 0x308e }, /* ゎ */ - - // Katakana: - { "hq", 0x3063 }, /* っ */ - { "ka", 0x30a2 }, /* ア */ - { "ki", 0x30a4 }, /* イ */ - { "ku", 0x30a6 }, /* ウ */ - { "ke", 0x30a8 }, /* エ */ - { "ko", 0x30aa }, /* オ */ - { "kka", 0x30ab }, /* カ */ - { "kki", 0x30ad }, /* キ */ - { "kku", 0x30af }, /* ク */ - { "kke", 0x30b1 }, /* ケ */ - { "kko", 0x30b3 }, /* コ */ - { "kga", 0x30ac }, /* ガ */ - { "kgi", 0x30ae }, /* ギ */ - { "kgu", 0x30b0 }, /* グ */ - { "kge", 0x30b2 }, /* ゲ */ - { "kgo", 0x30b4 }, /* ゴ */ - { "kza", 0x30b6 }, /* ザ */ - { "kzi", 0x30b8 }, /* ジ */ - { "kji", 0x30b8 }, /* ジ */ /* zi/ji alias */ - { "kzu", 0x30ba }, /* ズ */ - { "kze", 0x30bc }, /* ゼ */ - { "kzo", 0x30be }, /* ゾ */ - { "kta", 0x30bf }, /* タ */ - { "kti", 0x30c1 }, /* チ */ - { "ktu", 0x30c4 }, /* ツ */ - { "kte", 0x30c6 }, /* テ */ - { "kto", 0x30c8 }, /* ト */ - { "kda", 0x30c0 }, /* ダ */ - { "kdi", 0x30c2 }, /* ヂ */ - { "kdu", 0x30c5 }, /* ヅ */ - { "kde", 0x30c7 }, /* デ */ - { "kdo", 0x30c9 }, /* ド */ - { "kna", 0x30ca }, /* ナ */ - { "kni", 0x30cb }, /* ニ */ - { "knu", 0x30cc }, /* ヌ */ - { "kne", 0x30cd }, /* ネ */ - { "kno", 0x30ce }, /* ノ */ - { "kha", 0x30cf }, /* ハ */ - { "khi", 0x30d2 }, /* ヒ */ - { "khu", 0x30d5 }, /* フ */ - { "khe", 0x30d8 }, /* ヘ */ - { "kho", 0x30db }, /* ホ */ - { "kba", 0x30d0 }, /* バ */ - { "kbi", 0x30d3 }, /* ビ */ - { "kbu", 0x30d6 }, /* ブ */ - { "kbe", 0x30d9 }, /* ベ */ - { "kbo", 0x30dc }, /* ボ */ - { "kpa", 0x30d1 }, /* パ */ - { "kpi", 0x30d4 }, /* ピ */ - { "kpu", 0x30d7 }, /* プ */ - { "kpe", 0x30da }, /* ペ */ - { "kpo", 0x30dd }, /* ポ */ - { "kma", 0x30de }, /* マ */ - { "kmi", 0x30df }, /* ミ */ - { "kmu", 0x30e0 }, /* ム */ - { "kme", 0x30e1 }, /* メ */ - { "kmo", 0x30e2 }, /* モ */ - { "kya", 0x30e4 }, /* ヤ */ - { "kyu", 0x30e6 }, /* ユ */ - { "kyo", 0x30e8 }, /* ヨ */ - { "kra", 0x30e9 }, /* ラ */ - { "kri", 0x30ea }, /* リ */ - { "kru", 0x30eb }, /* ル */ - { "kre", 0x30ec }, /* レ */ - { "kro", 0x30ed }, /* ロ */ - { "kwa", 0x30ef }, /* ワ */ - { "kwi", 0x30f0 }, /* ヰ */ - { "kwe", 0x30f1 }, /* ヱ */ - { "kwo", 0x30f2 }, /* ヲ */ - { "kn", 0x30f3 }, /* ン */ - { "kvu", 0x30f4 }, /* ヴ */ - { "kas", 0x30a1 }, /* ァ */ - { "kis", 0x30a3 }, /* ィ */ - { "kus", 0x30a5 }, /* ゥ */ - { "kes", 0x30a7 }, /* ェ */ - { "kos", 0x30a9 }, /* ォ */ - { "kkas", 0x30f5 }, /* ヵ */ - { "kkes", 0x30f6 }, /* ヶ */ - { "ksa", 0x30b5 }, /* サ */ - { "ksi", 0x30b7 }, /* シ */ - { "ksu", 0x30b9 }, /* ス */ - { "kse", 0x30bb }, /* セ */ - { "kso", 0x30bd }, /* ソ */ - { "kyas", 0x30e3 }, /* ャ */ - { "kyus", 0x30e5 }, /* ュ */ - { "kyos", 0x30e7 }, /* ョ */ - { "kwas", 0x30ee }, /* ヮ */ - { "kq", 0x30c3 }, /* ッ */ - - { "kdot", 0x30FB }, /* ・ */ - { "kdash", 0x30FC }, /* ー */ - - { "nbsp", 0x00a0 }, /* Non-breaking space */ - - // Symbols: - { "delta", 0x0394 }, /* Δ */ - { "sigma", 0x03a3 }, /* Σ */ - { "omega", 0x03a9 }, /* Ω */ - { "angle", 0x2220 }, /* ∠ */ - { "whiteheart", 0x2661 }, /* ♡ */ - { "blackstar", 0x2605 }, /* ★ */ - { "whitestar", 0x2606 }, /* ☆ */ - { "flipped-a", 0x2200 }, /* ∀ */ - { "squared", 0x00b2 }, /* ² */ - { "cubed", 0x00b3 }, /* ³ */ - { "oq", 0x201c }, /* “ */ - { "cq", 0x201d }, /* ” */ - { "leftarrow", 0x2190 }, /* ← */ - { "uparrow", 0x2191 }, /* ↑ */ - { "rightarrow", 0x2192 }, /* → */ - { "downarrow", 0x2193 }, /* ↓ */ - { "4thnote", 0x2669 }, /* ♩ */ - { "8thnote", 0x266A }, /* ♪ */ - { "b8thnote", 0x266B }, /* ♫ */ - { "b16thnote", 0x266C }, /* ♬ */ - { "flat", 0x266D }, /* ♭ */ - { "natural", 0x266E }, /* ♮ */ - { "sharp", 0x266F }, /* ♯ */ - - /* These are internal-use glyphs; they don't have real Unicode codepoints. */ - { "up", INTERNAL }, - { "down", INTERNAL }, - { "left", INTERNAL }, - { "right", INTERNAL }, - { "downleft", INTERNAL }, - { "downright", INTERNAL }, - { "upleft", INTERNAL }, - { "upright", INTERNAL }, - { "center", INTERNAL }, - { "menuup", INTERNAL }, - { "menudown", INTERNAL }, - { "menuleft", INTERNAL }, - { "menuright", INTERNAL }, - { "start", INTERNAL }, - { "doublezeta", INTERNAL }, - { "planet", INTERNAL }, - { "back", INTERNAL }, - { "ok", INTERNAL }, - { "nextrow", INTERNAL }, - { "select", INTERNAL }, - // PlayStation-style controller - { "auxx", INTERNAL }, - { "auxtriangle",INTERNAL }, - { "auxsquare", INTERNAL }, - { "auxcircle", INTERNAL }, - { "auxl1", INTERNAL }, - { "auxl2", INTERNAL }, - { "auxl3", INTERNAL }, - { "auxr1", INTERNAL }, - { "auxr2", INTERNAL }, - { "auxr3", INTERNAL }, - { "auxselect", INTERNAL }, - { "auxstart", INTERNAL }, - // various other controllers (SNES, Saturn, Dreamcast stick styles) - { "auxa", INTERNAL }, - { "auxb", INTERNAL }, - { "auxc", INTERNAL }, - { "auxd", INTERNAL }, - // auxx is handled above - { "auxy", INTERNAL }, - { "auxz", INTERNAL }, - { "auxl", INTERNAL }, - { "auxr", INTERNAL }, - // Xbox (original, 360)-style controllers - { "auxwhite", INTERNAL }, - { "auxblack", INTERNAL }, - { "auxlb", INTERNAL }, - { "auxrb", INTERNAL }, - { "auxlt", INTERNAL }, - { "auxrt", INTERNAL }, - { "auxback", INTERNAL }, - - { NULL, 0 } - }; - - int iNextInternalUseCodepoint = 0xE000; - for( unsigned n = 0; aliases[n].str; ++n ) - { - int iCodepoint = aliases[n].chr; - if( iCodepoint == INTERNAL ) - iCodepoint = iNextInternalUseCodepoint++; - - CharAliases[aliases[n].str] = iCodepoint; - } - - for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i) - { - RString from = i->first; - RString to = WcharToUTF8(i->second); - from.MakeLower(); - CharAliasRepl[from] = to; - } -} - -// Replace all &markers; and &#NNNN;s with UTF-8. -void FontCharAliases::ReplaceMarkers( RString &sText ) -{ - InitCharAliases(); - ReplaceEntityText( sText, CharAliasRepl ); - Replace_Unicode_Markers(sText); -} - -// Replace all &markers; and &#NNNN;s with UTF-8. -bool FontCharAliases::GetChar( RString &codepoint, wchar_t &ch ) -{ - InitCharAliases(); - aliasmap::const_iterator i = CharAliases.find(codepoint); - if(i == CharAliases.end()) - return false; - - ch = i->second; - return true; -} - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "FontCharAliases.h" +#include "Font.h" +#include "RageUtil.h" +#include "RageLog.h" + +#include + +// Map from "&foo;" to a UTF-8 string. +typedef map aliasmap; +static aliasmap CharAliases; +static map CharAliasRepl; + +/* Editing this file in VC6 will be rather ugly, since it contains a lot of UTF-8. + * Just don't change anything you can't read. :) */ + +/* If we move this to an INI, group these, so we can display them in a help + * page off of the TextEntry screen reasonably. + * + * [Game Kanji] + * kakumei1=革 + * [Game Symbols] + * doublezeta=SPECIAL + * [Hiragana] + * [Katakana] + * [Punctuation] + * + * I'm not sure how to handle internal-use character, like Zz. Whenever we write + * text to disk, we need to write placeholders (&doublezeta;) for them, and never + * Unicode characters, since the codepoint is prone to change. We can't currently + * write &these; to SMs, due to format limitations. + */ + +// the above comment sounds old, look at the "kakumei1", which reminds me of the +// old SPiGuMuS kanji font hack. +// a more modern implementation would likely involve a Lua file in Data for the +// base character aliases, and any alias not encountered in the list would be +// added at the next possible internal code point. -aj + +/* Here's a copy-and-paste for a basic Japanese font page: + + 、。〃〄々〆〇〈〉《》「」『』 +【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟 +〠 +〰〱〲〳〴〵〶〷 + ぁあぃいぅうぇえぉおかがきぎく +ぐけげこごさざしじすずせぜそぞた +だちぢっつづてでとどなにぬねのは +ばぱひびぴふぶぷへべぺほぼぽまみ +むめもゃやゅゆょよらりるれろゎわ +ゐゑをんゔ      ゛゜ゝゞ  + ァアィイゥウェエォオカガキギク +グケゲコゴサザシジスズセゼソゾタ +ダチヂッツヅテデトドナニヌネノハ +バパヒビピフブプヘベペホボポマミ +ムメモャヤュユョヨラリルレロヮワ +ヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ  + +And here's one for a kanji page: + + 一ニ三四五六七八 +九十 +革命祭桜小坂鬼道 +弐神様民謡明日青 +衝動猫毛亜熱帯爆 +弾谷新大見解魔法 +扉夜空才 + + */ + +static void InitCharAliases() +{ + if(!CharAliases.empty()) + return; + + CharAliases["default"] = FONT_DEFAULT_GLYPH; // ? + CharAliases["invalid"] = INVALID_CHAR; // 0xFFFD + + // The comments here are UTF-8; they won't show up in VC6 + // (use a better editor then -aj) + +#define INTERNAL 0xE000 + + // todo: convert this into a vector? that way we can dynamically add + // to the list easier. -aj(?) + // Hiragana: + struct alias { + const char *str; + wchar_t chr; + } aliases[] = { + { "ha", 0x3042 }, /* あ */ + { "hi", 0x3044 }, /* い */ + { "hu", 0x3046 }, /* う */ + { "he", 0x3048 }, /* え */ + { "ho", 0x304a }, /* お */ + { "hka", 0x304b }, /* か */ + { "hki", 0x304d }, /* き */ + { "hku", 0x304f }, /* く */ + { "hke", 0x3051 }, /* け */ + { "hko", 0x3053 }, /* こ */ + { "hga", 0x304c }, /* が */ + { "hgi", 0x304e }, /* ぎ */ + { "hgu", 0x3050 }, /* ぐ */ + { "hge", 0x3052 }, /* げ */ + { "hgo", 0x3054 }, /* ご */ + { "hza", 0x3056 }, /* ざ */ + { "hzi", 0x3058 }, /* じ */ + { "hzu", 0x305a }, /* ず */ + { "hze", 0x305c }, /* ぜ */ + { "hzo", 0x305e }, /* ぞ */ + { "hta", 0x305f }, /* た */ + { "hti", 0x3061 }, /* ち */ + { "htu", 0x3064 }, /* つ */ + { "hte", 0x3066 }, /* て */ + { "hto", 0x3068 }, /* と */ + { "hda", 0x3060 }, /* だ */ + { "hdi", 0x3062 }, /* ぢ */ + { "hdu", 0x3065 }, /* づ */ + { "hde", 0x3067 }, /* で */ + { "hdo", 0x3069 }, /* ど */ + { "hna", 0x306a }, /* な */ + { "hni", 0x306b }, /* に */ + { "hnu", 0x306c }, /* ぬ */ + { "hne", 0x306d }, /* ね */ + { "hno", 0x306e }, /* の */ + { "hha", 0x306f }, /* は */ + { "hhi", 0x3072 }, /* ひ */ + { "hhu", 0x3075 }, /* ふ */ + { "hhe", 0x3078 }, /* へ */ + { "hho", 0x307b }, /* ほ */ + { "hba", 0x3070 }, /* ば */ + { "hbi", 0x3073 }, /* び */ + { "hbu", 0x3076 }, /* ぶ */ + { "hbe", 0x3079 }, /* べ */ + { "hbo", 0x307c }, /* ぼ */ + { "hpa", 0x3071 }, /* ぱ */ + { "hpi", 0x3074 }, /* ぴ */ + { "hpu", 0x3077 }, /* ぷ */ + { "hpe", 0x307a }, /* ぺ */ + { "hpo", 0x307d }, /* ぽ */ + { "hma", 0x307e }, /* ま */ + { "hmi", 0x307f }, /* み */ + { "hmu", 0x3080 }, /* む */ + { "hme", 0x3081 }, /* め */ + { "hmo", 0x3082 }, /* も */ + { "hya", 0x3084 }, /* や */ + { "hyu", 0x3086 }, /* ゆ */ + { "hyo", 0x3088 }, /* よ */ + { "hra", 0x3089 }, /* ら */ + { "hri", 0x308a }, /* り */ + { "hru", 0x308b }, /* る */ + { "hre", 0x308c }, /* れ */ + { "hro", 0x308d }, /* ろ */ + { "hwa", 0x308f }, /* わ */ + { "hwi", 0x3090 }, /* ゐ */ + { "hwe", 0x3091 }, /* ゑ */ + { "hwo", 0x3092 }, /* を */ + { "hn", 0x3093 }, /* ん */ + { "hvu", 0x3094 }, /* ゔ */ + { "has", 0x3041 }, /* ぁ */ + { "his", 0x3043 }, /* ぃ */ + { "hus", 0x3045 }, /* ぅ */ + { "hes", 0x3047 }, /* ぇ */ + { "hos", 0x3049 }, /* ぉ */ + { "hkas", 0x3095 }, /* ゕ */ + { "hkes", 0x3096 }, /* ゖ */ + { "hsa", 0x3055 }, /* さ */ + { "hsi", 0x3057 }, /* し */ + { "hsu", 0x3059 }, /* す */ + { "hse", 0x305b }, /* せ */ + { "hso", 0x305d }, /* そ */ + { "hyas", 0x3083 }, /* ゃ */ + { "hyus", 0x3085 }, /* ゅ */ + { "hyos", 0x3087 }, /* ょ */ + { "hwas", 0x308e }, /* ゎ */ + + // Katakana: + { "hq", 0x3063 }, /* っ */ + { "ka", 0x30a2 }, /* ア */ + { "ki", 0x30a4 }, /* イ */ + { "ku", 0x30a6 }, /* ウ */ + { "ke", 0x30a8 }, /* エ */ + { "ko", 0x30aa }, /* オ */ + { "kka", 0x30ab }, /* カ */ + { "kki", 0x30ad }, /* キ */ + { "kku", 0x30af }, /* ク */ + { "kke", 0x30b1 }, /* ケ */ + { "kko", 0x30b3 }, /* コ */ + { "kga", 0x30ac }, /* ガ */ + { "kgi", 0x30ae }, /* ギ */ + { "kgu", 0x30b0 }, /* グ */ + { "kge", 0x30b2 }, /* ゲ */ + { "kgo", 0x30b4 }, /* ゴ */ + { "kza", 0x30b6 }, /* ザ */ + { "kzi", 0x30b8 }, /* ジ */ + { "kji", 0x30b8 }, /* ジ */ /* zi/ji alias */ + { "kzu", 0x30ba }, /* ズ */ + { "kze", 0x30bc }, /* ゼ */ + { "kzo", 0x30be }, /* ゾ */ + { "kta", 0x30bf }, /* タ */ + { "kti", 0x30c1 }, /* チ */ + { "ktu", 0x30c4 }, /* ツ */ + { "kte", 0x30c6 }, /* テ */ + { "kto", 0x30c8 }, /* ト */ + { "kda", 0x30c0 }, /* ダ */ + { "kdi", 0x30c2 }, /* ヂ */ + { "kdu", 0x30c5 }, /* ヅ */ + { "kde", 0x30c7 }, /* デ */ + { "kdo", 0x30c9 }, /* ド */ + { "kna", 0x30ca }, /* ナ */ + { "kni", 0x30cb }, /* ニ */ + { "knu", 0x30cc }, /* ヌ */ + { "kne", 0x30cd }, /* ネ */ + { "kno", 0x30ce }, /* ノ */ + { "kha", 0x30cf }, /* ハ */ + { "khi", 0x30d2 }, /* ヒ */ + { "khu", 0x30d5 }, /* フ */ + { "khe", 0x30d8 }, /* ヘ */ + { "kho", 0x30db }, /* ホ */ + { "kba", 0x30d0 }, /* バ */ + { "kbi", 0x30d3 }, /* ビ */ + { "kbu", 0x30d6 }, /* ブ */ + { "kbe", 0x30d9 }, /* ベ */ + { "kbo", 0x30dc }, /* ボ */ + { "kpa", 0x30d1 }, /* パ */ + { "kpi", 0x30d4 }, /* ピ */ + { "kpu", 0x30d7 }, /* プ */ + { "kpe", 0x30da }, /* ペ */ + { "kpo", 0x30dd }, /* ポ */ + { "kma", 0x30de }, /* マ */ + { "kmi", 0x30df }, /* ミ */ + { "kmu", 0x30e0 }, /* ム */ + { "kme", 0x30e1 }, /* メ */ + { "kmo", 0x30e2 }, /* モ */ + { "kya", 0x30e4 }, /* ヤ */ + { "kyu", 0x30e6 }, /* ユ */ + { "kyo", 0x30e8 }, /* ヨ */ + { "kra", 0x30e9 }, /* ラ */ + { "kri", 0x30ea }, /* リ */ + { "kru", 0x30eb }, /* ル */ + { "kre", 0x30ec }, /* レ */ + { "kro", 0x30ed }, /* ロ */ + { "kwa", 0x30ef }, /* ワ */ + { "kwi", 0x30f0 }, /* ヰ */ + { "kwe", 0x30f1 }, /* ヱ */ + { "kwo", 0x30f2 }, /* ヲ */ + { "kn", 0x30f3 }, /* ン */ + { "kvu", 0x30f4 }, /* ヴ */ + { "kas", 0x30a1 }, /* ァ */ + { "kis", 0x30a3 }, /* ィ */ + { "kus", 0x30a5 }, /* ゥ */ + { "kes", 0x30a7 }, /* ェ */ + { "kos", 0x30a9 }, /* ォ */ + { "kkas", 0x30f5 }, /* ヵ */ + { "kkes", 0x30f6 }, /* ヶ */ + { "ksa", 0x30b5 }, /* サ */ + { "ksi", 0x30b7 }, /* シ */ + { "ksu", 0x30b9 }, /* ス */ + { "kse", 0x30bb }, /* セ */ + { "kso", 0x30bd }, /* ソ */ + { "kyas", 0x30e3 }, /* ャ */ + { "kyus", 0x30e5 }, /* ュ */ + { "kyos", 0x30e7 }, /* ョ */ + { "kwas", 0x30ee }, /* ヮ */ + { "kq", 0x30c3 }, /* ッ */ + + { "kdot", 0x30FB }, /* ・ */ + { "kdash", 0x30FC }, /* ー */ + + { "nbsp", 0x00a0 }, /* Non-breaking space */ + + // Symbols: + { "delta", 0x0394 }, /* Δ */ + { "sigma", 0x03a3 }, /* Σ */ + { "omega", 0x03a9 }, /* Ω */ + { "angle", 0x2220 }, /* ∠ */ + { "whiteheart", 0x2661 }, /* ♡ */ + { "blackstar", 0x2605 }, /* ★ */ + { "whitestar", 0x2606 }, /* ☆ */ + { "flipped-a", 0x2200 }, /* ∀ */ + { "squared", 0x00b2 }, /* ² */ + { "cubed", 0x00b3 }, /* ³ */ + { "oq", 0x201c }, /* “ */ + { "cq", 0x201d }, /* ” */ + { "leftarrow", 0x2190 }, /* ← */ + { "uparrow", 0x2191 }, /* ↑ */ + { "rightarrow", 0x2192 }, /* → */ + { "downarrow", 0x2193 }, /* ↓ */ + { "4thnote", 0x2669 }, /* ♩ */ + { "8thnote", 0x266A }, /* ♪ */ + { "b8thnote", 0x266B }, /* ♫ */ + { "b16thnote", 0x266C }, /* ♬ */ + { "flat", 0x266D }, /* ♭ */ + { "natural", 0x266E }, /* ♮ */ + { "sharp", 0x266F }, /* ♯ */ + + /* These are internal-use glyphs; they don't have real Unicode codepoints. */ + { "up", INTERNAL }, + { "down", INTERNAL }, + { "left", INTERNAL }, + { "right", INTERNAL }, + { "downleft", INTERNAL }, + { "downright", INTERNAL }, + { "upleft", INTERNAL }, + { "upright", INTERNAL }, + { "center", INTERNAL }, + { "menuup", INTERNAL }, + { "menudown", INTERNAL }, + { "menuleft", INTERNAL }, + { "menuright", INTERNAL }, + { "start", INTERNAL }, + { "doublezeta", INTERNAL }, + { "planet", INTERNAL }, + { "back", INTERNAL }, + { "ok", INTERNAL }, + { "nextrow", INTERNAL }, + { "select", INTERNAL }, + // PlayStation-style controller + { "auxx", INTERNAL }, + { "auxtriangle",INTERNAL }, + { "auxsquare", INTERNAL }, + { "auxcircle", INTERNAL }, + { "auxl1", INTERNAL }, + { "auxl2", INTERNAL }, + { "auxl3", INTERNAL }, + { "auxr1", INTERNAL }, + { "auxr2", INTERNAL }, + { "auxr3", INTERNAL }, + { "auxselect", INTERNAL }, + { "auxstart", INTERNAL }, + // various other controllers (SNES, Saturn, Dreamcast stick styles) + { "auxa", INTERNAL }, + { "auxb", INTERNAL }, + { "auxc", INTERNAL }, + { "auxd", INTERNAL }, + // auxx is handled above + { "auxy", INTERNAL }, + { "auxz", INTERNAL }, + { "auxl", INTERNAL }, + { "auxr", INTERNAL }, + // Xbox (original, 360)-style controllers + { "auxwhite", INTERNAL }, + { "auxblack", INTERNAL }, + { "auxlb", INTERNAL }, + { "auxrb", INTERNAL }, + { "auxlt", INTERNAL }, + { "auxrt", INTERNAL }, + { "auxback", INTERNAL }, + + { NULL, 0 } + }; + + int iNextInternalUseCodepoint = 0xE000; + for( unsigned n = 0; aliases[n].str; ++n ) + { + int iCodepoint = aliases[n].chr; + if( iCodepoint == INTERNAL ) + iCodepoint = iNextInternalUseCodepoint++; + + CharAliases[aliases[n].str] = iCodepoint; + } + + for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i) + { + RString from = i->first; + RString to = WcharToUTF8(i->second); + from.MakeLower(); + CharAliasRepl[from] = to; + } +} + +// Replace all &markers; and &#NNNN;s with UTF-8. +void FontCharAliases::ReplaceMarkers( RString &sText ) +{ + InitCharAliases(); + ReplaceEntityText( sText, CharAliasRepl ); + Replace_Unicode_Markers(sText); +} + +// Replace all &markers; and &#NNNN;s with UTF-8. +bool FontCharAliases::GetChar( RString &codepoint, wchar_t &ch ) +{ + InitCharAliases(); + aliasmap::const_iterator i = CharAliases.find(codepoint); + if(i == CharAliases.end()) + return false; + + ch = i->second; + return true; +} + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontCharAliases.h b/src/FontCharAliases.h index ebb694ab5c..c36267c410 100644 --- a/src/FontCharAliases.h +++ b/src/FontCharAliases.h @@ -1,36 +1,36 @@ -#ifndef FONT_CHAR_ALIASES -#define FONT_CHAR_ALIASES - -/** @brief Provides support for nonstandard characters in text. */ -namespace FontCharAliases -{ - void ReplaceMarkers( RString &sText ); - bool GetChar( RString &codepoint, wchar_t &ch ); -}; - -#endif - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef FONT_CHAR_ALIASES +#define FONT_CHAR_ALIASES + +/** @brief Provides support for nonstandard characters in text. */ +namespace FontCharAliases +{ + void ReplaceMarkers( RString &sText ); + bool GetChar( RString &codepoint, wchar_t &ch ); +}; + +#endif + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontCharmaps.cpp b/src/FontCharmaps.cpp index 84e59a580a..f7cdd9a743 100644 --- a/src/FontCharmaps.cpp +++ b/src/FontCharmaps.cpp @@ -1,257 +1,257 @@ -#include "global.h" -#include "FontCharmaps.h" - -#include - -const wchar_t FontCharmaps::M_SKIP = 0xFEFF; - -static map charmaps; - -using namespace FontCharmaps; - -/* Map ranges of Unicode characters. This is for font mapping; don't try - * to use it for actual conversion (if that's wanted, use iconv). - * - * Use M_SKIP to indicate that a glyph should be skipped, not mapped. Do - * this to skip control codes, for example, while keeping glyphs aligned. */ - -/* - * ASCII: - * - (empty) - (empty) - !"#$%&'()*+,-./ -0123456789:;<=>? -@ABCDEFGHIJKLMNO -PQRSTUVWXYZ[\]^_ -`abcdefghijklmno -pqrstuvwxyz{|}~ - */ -static const wchar_t map_ascii[] = { - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, M_SKIP, - 0 -}; - -/* - * ISO-8859-1 (Latin1): West Europe, US, others: - * - (empty) - (empty) - ¡¢£¤¥¦§¨©ª«¬-®¯ -°±²³´µ¶·¸¹º»¼½¾¿ -ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ -ÐÑÒÓÔÕÖרÙÚÛÜÝÞß -àáâãäåæçèéêëìíîï -ðñòóôõö÷øùúûüýþÿ - * - * Non-breaking space and soft hyphen are not used. - */ -static const wchar_t map_iso_8859_1[] = { - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, - 0 -}; - -/* - * Windows codepage 1252; latin1 plus other stuff (including angled quotes): - * -€ ‚ƒ„…†‡ˆ‰Š‹Œ Ž - ‘’“”•–—˜™š›œ žŸ - ¡¢£¤¥¦§¨©ª«¬-®¯ -°±²³´µ¶·¸¹º»¼½¾¿ -ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ -ÐÑÒÓÔÕÖרÙÚÛÜÝÞß -àáâãäåæçèéêëìíîï -ðñòóôõö÷øùúûüýþÿ - * - * Non-breaking space and soft hyphen are not used. - */ -static const wchar_t map_cp1252[] = { - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, M_SKIP, - 0x20AC, M_SKIP, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, M_SKIP, 0x017D, M_SKIP, - M_SKIP, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x017E, M_SKIP, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, - 0 -}; - -/* - * ISO-8859-2: Czech: (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), - * Slovak (sk), Slovenian (sl), Sorbian. - * - Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ -°ą˛ł´ľśˇ¸šşťź˝žż -ŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎ -ĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢß -ŕáâăäĺćçčéęëěíîď -đńňóôőö÷řůúűüýţ˙ - */ - -static const wchar_t map_iso_8859_2[] = { - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, - 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, - 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, - 0 -}; - -/* - * Unicode range 30: CJK Symbols and Punctuation, Hiragana, Katakana: - - 、。〃〄々〆〇〈〉《》「」『』 -【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟 -〠 -〰〱〲〳〴〵〶〷 - ぁあぃいぅうぇえぉおかがきぎく -ぐけげこごさざしじすずせぜそぞた -だちぢっつづてでとどなにぬねのは -ばぱひびぴふぶぷへべぺほぼぽまみ -むめもゃやゅゆょよらりるれろゎわ -ゐゑをんゔ      ゛゜ゝゞ  - ァアィイゥウェエォオカガキギク -グケゲコゴサザシジスズセゼソゾタ -ダチヂッツヅテデトドナニヌネノハ -バパヒビピフブプヘベペホボポマミ -ムメモャヤュユョヨラリルレロヮワ -ヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ  - - */ -static const wchar_t map_basic_japanese[] = -{ - 0x3000,0x3001,0x3002,0x3003,0x3004,0x3005,0x3006,0x3007,0x3008,0x3009,0x300a,0x300b,0x300c,0x300d,0x300e,0x300f, - 0x3010,0x3011,0x3012,0x3013,0x3014,0x3015,0x3016,0x3017,0x3018,0x3019,0x301a,0x301b,0x301c,0x301d,0x301e,0x301f, - 0x3020,0x3021,0x3022,0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x302a,0x302b,0x302c,0x302d,0x302e,0x302f, - 0x3030,0x3031,0x3032,0x3033,0x3034,0x3035,0x3036,0x3037,0x3038,0x3039,0x303a,0x303b,0x303c,0x303d,0x303e,0x303f, - 0x3040,0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049,0x304a,0x304b,0x304c,0x304d,0x304e,0x304f, - 0x3050,0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059,0x305a,0x305b,0x305c,0x305d,0x305e,0x305f, - 0x3060,0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069,0x306a,0x306b,0x306c,0x306d,0x306e,0x306f, - 0x3070,0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079,0x307a,0x307b,0x307c,0x307d,0x307e,0x307f, - 0x3080,0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089,0x308a,0x308b,0x308c,0x308d,0x308e,0x308f, - 0x3090,0x3091,0x3092,0x3093,0x3094,0x3095,0x3096,0x3097,0x3098,0x3099,0x309a,0x309b,0x309c,0x309d,0x309e,0x309f, - 0x30a0,0x30a1,0x30a2,0x30a3,0x30a4,0x30a5,0x30a6,0x30a7,0x30a8,0x30a9,0x30aa,0x30ab,0x30ac,0x30ad,0x30ae,0x30af, - 0x30b0,0x30b1,0x30b2,0x30b3,0x30b4,0x30b5,0x30b6,0x30b7,0x30b8,0x30b9,0x30ba,0x30bb,0x30bc,0x30bd,0x30be,0x30bf, - 0x30c0,0x30c1,0x30c2,0x30c3,0x30c4,0x30c5,0x30c6,0x30c7,0x30c8,0x30c9,0x30ca,0x30cb,0x30cc,0x30cd,0x30ce,0x30cf, - 0x30d0,0x30d1,0x30d2,0x30d3,0x30d4,0x30d5,0x30d6,0x30d7,0x30d8,0x30d9,0x30da,0x30db,0x30dc,0x30dd,0x30de,0x30df, - 0x30e0,0x30e1,0x30e2,0x30e3,0x30e4,0x30e5,0x30e6,0x30e7,0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,0x30ed,0x30ee,0x30ef, - 0x30f0,0x30f1,0x30f2,0x30f3,0x30f4,0x30f5,0x30f6,0x30f7,0x30f8,0x30f9,0x30fa,0x30fb,0x30fc,0x30fd,0x30fe,0x30ff, - 0 -}; - -/* Korean Jamo */ -static const wchar_t map_korean_jamo[] = -{ - 0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1160,0x1170,0x1180,0x1190,0x11a0,0x11b0,0x11c0,0x11d0,0x11e0,0x11f0, - 0x1101,0x1111,0x1121,0x1131,0x1141,0x1151,0x1161,0x1171,0x1181,0x1191,0x11a1,0x11b1,0x11c1,0x11d1,0x11e1,0x11f1, - 0x1102,0x1112,0x1122,0x1132,0x1142,0x1152,0x1162,0x1172,0x1182,0x1192,0x11a2,0x11b2,0x11c2,0x11d2,0x11e2,0x11f2, - 0x1103,0x1113,0x1123,0x1133,0x1143,0x1153,0x1163,0x1173,0x1183,0x1193,0x11a3,0x11b3,0x11c3,0x11d3,0x11e3,0x11f3, - 0x1104,0x1114,0x1124,0x1134,0x1144,0x1154,0x1164,0x1174,0x1184,0x1194,0x11a4,0x11b4,0x11c4,0x11d4,0x11e4,0x11f4, - 0x1105,0x1115,0x1125,0x1135,0x1145,0x1155,0x1165,0x1175,0x1185,0x1195,0x11a5,0x11b5,0x11c5,0x11d5,0x11e5,0x11f5, - 0x1106,0x1116,0x1126,0x1136,0x1146,0x1156,0x1166,0x1176,0x1186,0x1196,0x11a6,0x11b6,0x11c6,0x11d6,0x11e6,0x11f6, - 0x1107,0x1117,0x1127,0x1137,0x1147,0x1157,0x1167,0x1177,0x1187,0x1197,0x11a7,0x11b7,0x11c7,0x11d7,0x11e7,0x11f7, - 0x1108,0x1118,0x1128,0x1138,0x1148,0x1158,0x1168,0x1178,0x1188,0x1198,0x11a8,0x11b8,0x11c8,0x11d8,0x11e8,0x11f8, - 0x1109,0x1119,0x1129,0x1139,0x1149,0x1159,0x1169,0x1179,0x1189,0x1199,0x11a9,0x11b9,0x11c9,0x11d9,0x11e9,0x11f9, - 0x110a,0x111a,0x112a,0x113a,0x114a,0x115a,0x116a,0x117a,0x118a,0x119a,0x11aa,0x11ba,0x11ca,0x11da,0x11ea,0x11fa, - 0x110b,0x111b,0x112b,0x113b,0x114b,0x115b,0x116b,0x117b,0x118b,0x119b,0x11ab,0x11bb,0x11cb,0x11db,0x11eb,0x11fb, - 0x110c,0x111c,0x112c,0x113c,0x114c,0x115c,0x116c,0x117c,0x118c,0x119c,0x11ac,0x11bc,0x11cc,0x11dc,0x11ec,0x11fc, - 0x110d,0x111d,0x112d,0x113d,0x114d,0x115d,0x116d,0x117d,0x118d,0x119d,0x11ad,0x11bd,0x11cd,0x11dd,0x11ed,0x11fd, - 0x110e,0x111e,0x112e,0x113e,0x114e,0x115e,0x116e,0x117e,0x118e,0x119e,0x11ae,0x11be,0x11ce,0x11de,0x11ee,0x11fe, - 0x110f,0x111f,0x112f,0x113f,0x114f,0x115f,0x116f,0x117f,0x118f,0x119f,0x11af,0x11bf,0x11cf,0x11df,0x11ef,0x11ff, - 0 -}; - -/* 5x3 Numbers. "01234 56789 %. :x" */ -static const wchar_t map_numbers[] = { - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, - 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, - 0x0025, 0x002E, 0x0020, 0x003A, 0x0078, - 0 -}; - - -static void Init() -{ - if(!charmaps.empty()) - return; - - charmaps["ascii"] = map_ascii; - charmaps["basic-japanese"] = map_basic_japanese; - charmaps["iso-8859-1"] = map_iso_8859_1; - charmaps["cp1252"] = map_cp1252; - charmaps["iso-8859-2"] = map_iso_8859_2; - charmaps["korean-jamo"] = map_korean_jamo; - charmaps["numbers"] = map_numbers; -} - -const wchar_t *FontCharmaps::get_char_map(RString name) -{ - Init(); - - name.MakeLower(); - - map::const_iterator i = charmaps.find(name); - if(i == charmaps.end()) - return NULL; - - return i->second; -} - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "FontCharmaps.h" + +#include + +const wchar_t FontCharmaps::M_SKIP = 0xFEFF; + +static map charmaps; + +using namespace FontCharmaps; + +/* Map ranges of Unicode characters. This is for font mapping; don't try + * to use it for actual conversion (if that's wanted, use iconv). + * + * Use M_SKIP to indicate that a glyph should be skipped, not mapped. Do + * this to skip control codes, for example, while keeping glyphs aligned. */ + +/* + * ASCII: + * + (empty) + (empty) + !"#$%&'()*+,-./ +0123456789:;<=>? +@ABCDEFGHIJKLMNO +PQRSTUVWXYZ[\]^_ +`abcdefghijklmno +pqrstuvwxyz{|}~ + */ +static const wchar_t map_ascii[] = { + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, M_SKIP, + 0 +}; + +/* + * ISO-8859-1 (Latin1): West Europe, US, others: + * + (empty) + (empty) + ¡¢£¤¥¦§¨©ª«¬-®¯ +°±²³´µ¶·¸¹º»¼½¾¿ +ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ +ÐÑÒÓÔÕÖרÙÚÛÜÝÞß +àáâãäåæçèéêëìíîï +ðñòóôõö÷øùúûüýþÿ + * + * Non-breaking space and soft hyphen are not used. + */ +static const wchar_t map_iso_8859_1[] = { + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, + 0 +}; + +/* + * Windows codepage 1252; latin1 plus other stuff (including angled quotes): + * +€ ‚ƒ„…†‡ˆ‰Š‹Œ Ž + ‘’“”•–—˜™š›œ žŸ + ¡¢£¤¥¦§¨©ª«¬-®¯ +°±²³´µ¶·¸¹º»¼½¾¿ +ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ +ÐÑÒÓÔÕÖרÙÚÛÜÝÞß +àáâãäåæçèéêëìíîï +ðñòóôõö÷øùúûüýþÿ + * + * Non-breaking space and soft hyphen are not used. + */ +static const wchar_t map_cp1252[] = { + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, M_SKIP, + 0x20AC, M_SKIP, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, M_SKIP, 0x017D, M_SKIP, + M_SKIP, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x017E, M_SKIP, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, + 0 +}; + +/* + * ISO-8859-2: Czech: (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), + * Slovak (sk), Slovenian (sl), Sorbian. + * + Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ +°ą˛ł´ľśˇ¸šşťź˝žż +ŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎ +ĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢß +ŕáâăäĺćçčéęëěíîď +đńňóôőö÷řůúűüýţ˙ + */ + +static const wchar_t map_iso_8859_2[] = { + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, M_SKIP, + 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, + 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, + 0 +}; + +/* + * Unicode range 30: CJK Symbols and Punctuation, Hiragana, Katakana: + + 、。〃〄々〆〇〈〉《》「」『』 +【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟 +〠 +〰〱〲〳〴〵〶〷 + ぁあぃいぅうぇえぉおかがきぎく +ぐけげこごさざしじすずせぜそぞた +だちぢっつづてでとどなにぬねのは +ばぱひびぴふぶぷへべぺほぼぽまみ +むめもゃやゅゆょよらりるれろゎわ +ゐゑをんゔ      ゛゜ゝゞ  + ァアィイゥウェエォオカガキギク +グケゲコゴサザシジスズセゼソゾタ +ダチヂッツヅテデトドナニヌネノハ +バパヒビピフブプヘベペホボポマミ +ムメモャヤュユョヨラリルレロヮワ +ヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ  + + */ +static const wchar_t map_basic_japanese[] = +{ + 0x3000,0x3001,0x3002,0x3003,0x3004,0x3005,0x3006,0x3007,0x3008,0x3009,0x300a,0x300b,0x300c,0x300d,0x300e,0x300f, + 0x3010,0x3011,0x3012,0x3013,0x3014,0x3015,0x3016,0x3017,0x3018,0x3019,0x301a,0x301b,0x301c,0x301d,0x301e,0x301f, + 0x3020,0x3021,0x3022,0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x302a,0x302b,0x302c,0x302d,0x302e,0x302f, + 0x3030,0x3031,0x3032,0x3033,0x3034,0x3035,0x3036,0x3037,0x3038,0x3039,0x303a,0x303b,0x303c,0x303d,0x303e,0x303f, + 0x3040,0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049,0x304a,0x304b,0x304c,0x304d,0x304e,0x304f, + 0x3050,0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059,0x305a,0x305b,0x305c,0x305d,0x305e,0x305f, + 0x3060,0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069,0x306a,0x306b,0x306c,0x306d,0x306e,0x306f, + 0x3070,0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079,0x307a,0x307b,0x307c,0x307d,0x307e,0x307f, + 0x3080,0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089,0x308a,0x308b,0x308c,0x308d,0x308e,0x308f, + 0x3090,0x3091,0x3092,0x3093,0x3094,0x3095,0x3096,0x3097,0x3098,0x3099,0x309a,0x309b,0x309c,0x309d,0x309e,0x309f, + 0x30a0,0x30a1,0x30a2,0x30a3,0x30a4,0x30a5,0x30a6,0x30a7,0x30a8,0x30a9,0x30aa,0x30ab,0x30ac,0x30ad,0x30ae,0x30af, + 0x30b0,0x30b1,0x30b2,0x30b3,0x30b4,0x30b5,0x30b6,0x30b7,0x30b8,0x30b9,0x30ba,0x30bb,0x30bc,0x30bd,0x30be,0x30bf, + 0x30c0,0x30c1,0x30c2,0x30c3,0x30c4,0x30c5,0x30c6,0x30c7,0x30c8,0x30c9,0x30ca,0x30cb,0x30cc,0x30cd,0x30ce,0x30cf, + 0x30d0,0x30d1,0x30d2,0x30d3,0x30d4,0x30d5,0x30d6,0x30d7,0x30d8,0x30d9,0x30da,0x30db,0x30dc,0x30dd,0x30de,0x30df, + 0x30e0,0x30e1,0x30e2,0x30e3,0x30e4,0x30e5,0x30e6,0x30e7,0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,0x30ed,0x30ee,0x30ef, + 0x30f0,0x30f1,0x30f2,0x30f3,0x30f4,0x30f5,0x30f6,0x30f7,0x30f8,0x30f9,0x30fa,0x30fb,0x30fc,0x30fd,0x30fe,0x30ff, + 0 +}; + +/* Korean Jamo */ +static const wchar_t map_korean_jamo[] = +{ + 0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1160,0x1170,0x1180,0x1190,0x11a0,0x11b0,0x11c0,0x11d0,0x11e0,0x11f0, + 0x1101,0x1111,0x1121,0x1131,0x1141,0x1151,0x1161,0x1171,0x1181,0x1191,0x11a1,0x11b1,0x11c1,0x11d1,0x11e1,0x11f1, + 0x1102,0x1112,0x1122,0x1132,0x1142,0x1152,0x1162,0x1172,0x1182,0x1192,0x11a2,0x11b2,0x11c2,0x11d2,0x11e2,0x11f2, + 0x1103,0x1113,0x1123,0x1133,0x1143,0x1153,0x1163,0x1173,0x1183,0x1193,0x11a3,0x11b3,0x11c3,0x11d3,0x11e3,0x11f3, + 0x1104,0x1114,0x1124,0x1134,0x1144,0x1154,0x1164,0x1174,0x1184,0x1194,0x11a4,0x11b4,0x11c4,0x11d4,0x11e4,0x11f4, + 0x1105,0x1115,0x1125,0x1135,0x1145,0x1155,0x1165,0x1175,0x1185,0x1195,0x11a5,0x11b5,0x11c5,0x11d5,0x11e5,0x11f5, + 0x1106,0x1116,0x1126,0x1136,0x1146,0x1156,0x1166,0x1176,0x1186,0x1196,0x11a6,0x11b6,0x11c6,0x11d6,0x11e6,0x11f6, + 0x1107,0x1117,0x1127,0x1137,0x1147,0x1157,0x1167,0x1177,0x1187,0x1197,0x11a7,0x11b7,0x11c7,0x11d7,0x11e7,0x11f7, + 0x1108,0x1118,0x1128,0x1138,0x1148,0x1158,0x1168,0x1178,0x1188,0x1198,0x11a8,0x11b8,0x11c8,0x11d8,0x11e8,0x11f8, + 0x1109,0x1119,0x1129,0x1139,0x1149,0x1159,0x1169,0x1179,0x1189,0x1199,0x11a9,0x11b9,0x11c9,0x11d9,0x11e9,0x11f9, + 0x110a,0x111a,0x112a,0x113a,0x114a,0x115a,0x116a,0x117a,0x118a,0x119a,0x11aa,0x11ba,0x11ca,0x11da,0x11ea,0x11fa, + 0x110b,0x111b,0x112b,0x113b,0x114b,0x115b,0x116b,0x117b,0x118b,0x119b,0x11ab,0x11bb,0x11cb,0x11db,0x11eb,0x11fb, + 0x110c,0x111c,0x112c,0x113c,0x114c,0x115c,0x116c,0x117c,0x118c,0x119c,0x11ac,0x11bc,0x11cc,0x11dc,0x11ec,0x11fc, + 0x110d,0x111d,0x112d,0x113d,0x114d,0x115d,0x116d,0x117d,0x118d,0x119d,0x11ad,0x11bd,0x11cd,0x11dd,0x11ed,0x11fd, + 0x110e,0x111e,0x112e,0x113e,0x114e,0x115e,0x116e,0x117e,0x118e,0x119e,0x11ae,0x11be,0x11ce,0x11de,0x11ee,0x11fe, + 0x110f,0x111f,0x112f,0x113f,0x114f,0x115f,0x116f,0x117f,0x118f,0x119f,0x11af,0x11bf,0x11cf,0x11df,0x11ef,0x11ff, + 0 +}; + +/* 5x3 Numbers. "01234 56789 %. :x" */ +static const wchar_t map_numbers[] = { + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, + 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, + 0x0025, 0x002E, 0x0020, 0x003A, 0x0078, + 0 +}; + + +static void Init() +{ + if(!charmaps.empty()) + return; + + charmaps["ascii"] = map_ascii; + charmaps["basic-japanese"] = map_basic_japanese; + charmaps["iso-8859-1"] = map_iso_8859_1; + charmaps["cp1252"] = map_cp1252; + charmaps["iso-8859-2"] = map_iso_8859_2; + charmaps["korean-jamo"] = map_korean_jamo; + charmaps["numbers"] = map_numbers; +} + +const wchar_t *FontCharmaps::get_char_map(RString name) +{ + Init(); + + name.MakeLower(); + + map::const_iterator i = charmaps.find(name); + if(i == charmaps.end()) + return NULL; + + return i->second; +} + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontCharmaps.h b/src/FontCharmaps.h index 28307dc2a8..2d08aec533 100644 --- a/src/FontCharmaps.h +++ b/src/FontCharmaps.h @@ -1,35 +1,35 @@ -#ifndef FONT_CHARMAPS_H -#define FONT_CHARMAPS_H -/** @brief Defines common frame to character mappings for Fonts. */ -namespace FontCharmaps -{ - extern const wchar_t M_SKIP; - const wchar_t *get_char_map(RString name); -}; - -#endif - -/* - * (c) 2003 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef FONT_CHARMAPS_H +#define FONT_CHARMAPS_H +/** @brief Defines common frame to character mappings for Fonts. */ +namespace FontCharmaps +{ + extern const wchar_t M_SKIP; + const wchar_t *get_char_map(RString name); +}; + +#endif + +/* + * (c) 2003 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontManager.cpp b/src/FontManager.cpp index 380f00384b..4929faaacf 100644 --- a/src/FontManager.cpp +++ b/src/FontManager.cpp @@ -1,134 +1,134 @@ -#include "global.h" -#include "FontManager.h" -#include "Font.h" -#include "RageUtil.h" -#include "RageLog.h" -#include - -FontManager* FONT = NULL; // global and accessable from anywhere in our program - -// map from file name to a texture holder -typedef pair FontName; -static map g_mapPathToFont; - -FontManager::FontManager() -{ -} - -FontManager::~FontManager() -{ - for( std::map::iterator i = g_mapPathToFont.begin(); - i != g_mapPathToFont.end(); ++i) - { - const FontName &fn = i->first; - Font* pFont = i->second; - if(pFont->m_iRefCount > 0) { - LOG->Trace( "FONT LEAK: '%s', RefCount = %d.", fn.first.c_str(), pFont->m_iRefCount ); - } - delete pFont; - } -} - -void FontManager::ReloadFonts() -{ - for(map::iterator i = g_mapPathToFont.begin(); - i != g_mapPathToFont.end(); ++i) - { - i->second->Reload(); - } -} - -Font* FontManager::LoadFont( const RString &sFontOrTextureFilePath, RString sChars ) -{ - Font *pFont; - /* Convert the path to lowercase so that we don't load duplicates. Really, - * this does not solve the duplicate problem. We could have two copies of - * the same bitmap if there are equivalent but different paths - * (e.g. "graphics\blah.png" and "..\stepmania\graphics\blah.png" ). */ - - CHECKPOINT_M( ssprintf("FontManager::LoadFont(%s).", sFontOrTextureFilePath.c_str()) ); - const FontName NewName( sFontOrTextureFilePath, sChars ); - map::iterator p = g_mapPathToFont.find( NewName ); - if( p != g_mapPathToFont.end() ) - { - pFont=p->second; - pFont->m_iRefCount++; - return pFont; - } - - Font *f = new Font; - f->Load(sFontOrTextureFilePath, sChars); - g_mapPathToFont[NewName] = f; - return f; -} - -Font *FontManager::CopyFont( Font *pFont ) -{ - ++pFont->m_iRefCount; - return pFont; -} - -void FontManager::UnloadFont( Font *fp ) -{ - CHECKPOINT_M( ssprintf("FontManager::UnloadFont(%s).", fp->path.c_str()) ); - - for( std::map::iterator i = g_mapPathToFont.begin(); - i != g_mapPathToFont.end(); ++i) - { - if(i->second != fp) - continue; - - ASSERT_M(fp->m_iRefCount > 0,"Attempting to unload a font with zero ref count!"); - - i->second->m_iRefCount--; - - if( fp->m_iRefCount == 0 ) - { - delete i->second; // free the texture - g_mapPathToFont.erase( i ); // and remove the key in the map - } - return; - } - - FAIL_M( ssprintf("Unloaded an unknown font (%p)", fp) ); -} - -/* -void FontManager::PruneFonts() { - for( std::map::iterator i = g_mapPathToFont.begin();i != g_mapPathToFont.end();) { - Font *fp=i->second; - if(fp->m_iRefCount==0) { - delete fp; - g_mapPathToFont.erase(i); - i = g_mapPathToFont.end(); - } else { - ++i; - } - } -} -*/ - -/* - * (c) 2001-2003 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "FontManager.h" +#include "Font.h" +#include "RageUtil.h" +#include "RageLog.h" +#include + +FontManager* FONT = NULL; // global and accessable from anywhere in our program + +// map from file name to a texture holder +typedef pair FontName; +static map g_mapPathToFont; + +FontManager::FontManager() +{ +} + +FontManager::~FontManager() +{ + for( std::map::iterator i = g_mapPathToFont.begin(); + i != g_mapPathToFont.end(); ++i) + { + const FontName &fn = i->first; + Font* pFont = i->second; + if(pFont->m_iRefCount > 0) { + LOG->Trace( "FONT LEAK: '%s', RefCount = %d.", fn.first.c_str(), pFont->m_iRefCount ); + } + delete pFont; + } +} + +void FontManager::ReloadFonts() +{ + for(map::iterator i = g_mapPathToFont.begin(); + i != g_mapPathToFont.end(); ++i) + { + i->second->Reload(); + } +} + +Font* FontManager::LoadFont( const RString &sFontOrTextureFilePath, RString sChars ) +{ + Font *pFont; + /* Convert the path to lowercase so that we don't load duplicates. Really, + * this does not solve the duplicate problem. We could have two copies of + * the same bitmap if there are equivalent but different paths + * (e.g. "graphics\blah.png" and "..\stepmania\graphics\blah.png" ). */ + + CHECKPOINT_M( ssprintf("FontManager::LoadFont(%s).", sFontOrTextureFilePath.c_str()) ); + const FontName NewName( sFontOrTextureFilePath, sChars ); + map::iterator p = g_mapPathToFont.find( NewName ); + if( p != g_mapPathToFont.end() ) + { + pFont=p->second; + pFont->m_iRefCount++; + return pFont; + } + + Font *f = new Font; + f->Load(sFontOrTextureFilePath, sChars); + g_mapPathToFont[NewName] = f; + return f; +} + +Font *FontManager::CopyFont( Font *pFont ) +{ + ++pFont->m_iRefCount; + return pFont; +} + +void FontManager::UnloadFont( Font *fp ) +{ + CHECKPOINT_M( ssprintf("FontManager::UnloadFont(%s).", fp->path.c_str()) ); + + for( std::map::iterator i = g_mapPathToFont.begin(); + i != g_mapPathToFont.end(); ++i) + { + if(i->second != fp) + continue; + + ASSERT_M(fp->m_iRefCount > 0,"Attempting to unload a font with zero ref count!"); + + i->second->m_iRefCount--; + + if( fp->m_iRefCount == 0 ) + { + delete i->second; // free the texture + g_mapPathToFont.erase( i ); // and remove the key in the map + } + return; + } + + FAIL_M( ssprintf("Unloaded an unknown font (%p)", fp) ); +} + +/* +void FontManager::PruneFonts() { + for( std::map::iterator i = g_mapPathToFont.begin();i != g_mapPathToFont.end();) { + Font *fp=i->second; + if(fp->m_iRefCount==0) { + delete fp; + g_mapPathToFont.erase(i); + i = g_mapPathToFont.end(); + } else { + ++i; + } + } +} +*/ + +/* + * (c) 2001-2003 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/FontManager.h b/src/FontManager.h index f3159ab006..5fcdbcfe40 100644 --- a/src/FontManager.h +++ b/src/FontManager.h @@ -1,56 +1,56 @@ -/* FontManager - Interface for loading and releasing fonts. */ - -#ifndef FONTMANAGER_H -#define FONTMANAGER_H - -class Font; -class Game; - -class FontManager -{ -public: - FontManager(); - ~FontManager(); - - Font* LoadFont( const RString &sFontOrTextureFilePath, RString sChars = "" ); - Font *CopyFont( Font *pFont ); - void UnloadFont( Font *fp ); - //void PruneFonts(); - - /* Warning: This reloads fonts completely, so all BitmapTexts need to be - * reset, too. If this isn't done, best case they end up with old font - * metrics; worst case, they get left with stale pointers to RageTextures - * that'll get freed eventually and crash. This is only used for realtime - * adjustment of fonts in ScreenTestFonts at the moment. */ - void ReloadFonts(); -}; - -extern FontManager* FONT; // global and accessable from anywhere in our program - - -#endif - -/* - * (c) 2001-2003 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* FontManager - Interface for loading and releasing fonts. */ + +#ifndef FONTMANAGER_H +#define FONTMANAGER_H + +class Font; +class Game; + +class FontManager +{ +public: + FontManager(); + ~FontManager(); + + Font* LoadFont( const RString &sFontOrTextureFilePath, RString sChars = "" ); + Font *CopyFont( Font *pFont ); + void UnloadFont( Font *fp ); + //void PruneFonts(); + + /* Warning: This reloads fonts completely, so all BitmapTexts need to be + * reset, too. If this isn't done, best case they end up with old font + * metrics; worst case, they get left with stale pointers to RageTextures + * that'll get freed eventually and crash. This is only used for realtime + * adjustment of fonts in ScreenTestFonts at the moment. */ + void ReloadFonts(); +}; + +extern FontManager* FONT; // global and accessable from anywhere in our program + + +#endif + +/* + * (c) 2001-2003 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Foreach.h b/src/Foreach.h index 93ae960c66..699d0a8671 100644 --- a/src/Foreach.h +++ b/src/Foreach.h @@ -1,72 +1,72 @@ -#ifndef Foreach_H -#define Foreach_H - -/** @brief General foreach loop iterating over a vector. */ -#define FOREACH( elemType, vect, var ) \ -for( vector::iterator var = (vect).begin(); var != (vect).end(); ++var ) -/** @brief General foreach loop iterating over a vector, using a constant iterator. */ -#define FOREACH_CONST( elemType, vect, var ) \ -for( vector::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/** @brief General foreach loop iterating over a deque. */ -#define FOREACHD( elemType, vect, var ) \ -for( deque::iterator var = (vect).begin(); var != (vect).end(); ++var ) -/** @brief General foreach loop iterating over a deque, using a constant iterator. */ -#define FOREACHD_CONST( elemType, vect, var ) \ -for( deque::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/** @brief General foreach loop iterating over a set. */ -#define FOREACHS( elemType, vect, var ) \ -for( set::iterator var = (vect).begin(); var != (vect).end(); ++var ) -/** @brief General foreach loop iterating over a set, using a constant iterator. */ -#define FOREACHS_CONST( elemType, vect, var ) \ -for( set::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/** @brief General foreach loop iterating over a list. */ -#define FOREACHL( elemType, vect, var ) \ -for( list::iterator var = (vect).begin(); var != (vect).end(); ++var ) -/** @brief General foreach loop iterating over a list, using a constant iterator. */ -#define FOREACHL_CONST( elemType, vect, var ) \ -for( list::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/** @brief General foreach loop iterating over a map. */ -#define FOREACHM( keyType, valType, vect, var ) \ -for( map::iterator var = (vect).begin(); var != (vect).end(); ++var ) -/** @brief General foreach loop iterating over a map, using a constant iterator. */ -#define FOREACHM_CONST( keyType, valType, vect, var ) \ -for( map::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/** @brief General foreach loop iterating over a multimap. */ -#define FOREACHMM( keyType, valType, vect, var ) \ -for( multimap::iterator var = (vect).begin(); var != (vect).end(); ++var ) - -/* Hmm...any reason why there is no FOREACHMM_CONST? */ - -#endif - -/** - * @file - * @author Chris Danford (c) 2004-2005 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef Foreach_H +#define Foreach_H + +/** @brief General foreach loop iterating over a vector. */ +#define FOREACH( elemType, vect, var ) \ +for( vector::iterator var = (vect).begin(); var != (vect).end(); ++var ) +/** @brief General foreach loop iterating over a vector, using a constant iterator. */ +#define FOREACH_CONST( elemType, vect, var ) \ +for( vector::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/** @brief General foreach loop iterating over a deque. */ +#define FOREACHD( elemType, vect, var ) \ +for( deque::iterator var = (vect).begin(); var != (vect).end(); ++var ) +/** @brief General foreach loop iterating over a deque, using a constant iterator. */ +#define FOREACHD_CONST( elemType, vect, var ) \ +for( deque::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/** @brief General foreach loop iterating over a set. */ +#define FOREACHS( elemType, vect, var ) \ +for( set::iterator var = (vect).begin(); var != (vect).end(); ++var ) +/** @brief General foreach loop iterating over a set, using a constant iterator. */ +#define FOREACHS_CONST( elemType, vect, var ) \ +for( set::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/** @brief General foreach loop iterating over a list. */ +#define FOREACHL( elemType, vect, var ) \ +for( list::iterator var = (vect).begin(); var != (vect).end(); ++var ) +/** @brief General foreach loop iterating over a list, using a constant iterator. */ +#define FOREACHL_CONST( elemType, vect, var ) \ +for( list::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/** @brief General foreach loop iterating over a map. */ +#define FOREACHM( keyType, valType, vect, var ) \ +for( map::iterator var = (vect).begin(); var != (vect).end(); ++var ) +/** @brief General foreach loop iterating over a map, using a constant iterator. */ +#define FOREACHM_CONST( keyType, valType, vect, var ) \ +for( map::const_iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/** @brief General foreach loop iterating over a multimap. */ +#define FOREACHMM( keyType, valType, vect, var ) \ +for( multimap::iterator var = (vect).begin(); var != (vect).end(); ++var ) + +/* Hmm...any reason why there is no FOREACHMM_CONST? */ + +#endif + +/** + * @file + * @author Chris Danford (c) 2004-2005 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Foreground.cpp b/src/Foreground.cpp index aa34e4a891..708fbcb608 100644 --- a/src/Foreground.cpp +++ b/src/Foreground.cpp @@ -1,133 +1,133 @@ -#include "global.h" -#include "Foreground.h" -#include "RageUtil.h" -#include "GameState.h" -#include "RageTextureManager.h" -#include "ActorUtil.h" -#include "Song.h" -#include "BackgroundUtil.h" -#include "Foreach.h" - -Foreground::~Foreground() -{ - Unload(); -} - -void Foreground::Unload() -{ - for( unsigned i=0; i < m_BGAnimations.size(); ++i ) - delete m_BGAnimations[i].m_bga; - m_BGAnimations.clear(); - m_SubActors.clear(); - m_fLastMusicSeconds = -9999; - m_pSong = NULL; -} - -void Foreground::LoadFromSong( const Song *pSong ) -{ - // Song graphics can get very big; never keep them in memory. - RageTextureID::TexPolicy OldPolicy = TEXTUREMAN->GetDefaultTexturePolicy(); - TEXTUREMAN->SetDefaultTexturePolicy( RageTextureID::TEX_VOLATILE ); - - m_pSong = pSong; - FOREACH_CONST( BackgroundChange, pSong->GetForegroundChanges(), bgc ) - { - const BackgroundChange &change = *bgc; - RString sBGName = change.m_def.m_sFile1; - - LoadedBGA bga; - bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName, this ); - bga.m_bga->PlayCommand( "Init" ); - bga.m_fStartBeat = change.m_fStartBeat; - bga.m_bFinished = false; - - const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( bga.m_fStartBeat ); - const float fStopSecond = fStartSecond + bga.m_bga->GetTweenTimeLeft(); - bga.m_fStopBeat = pSong->m_Timing.GetBeatFromElapsedTime( fStopSecond ); - - bga.m_bga->SetVisible( false ); - - this->AddChild( bga.m_bga ); - m_BGAnimations.push_back( bga ); - } - - TEXTUREMAN->SetDefaultTexturePolicy( OldPolicy ); - - this->SortByDrawOrder(); -} - -void Foreground::Update( float fDeltaTime ) -{ - // Calls to Update() should *not* be scaled by music rate. Undo it. - const float fRate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; - - for( unsigned i=0; i < m_BGAnimations.size(); ++i ) - { - LoadedBGA &bga = m_BGAnimations[i]; - - if( GAMESTATE->m_fSongBeat < bga.m_fStartBeat ) - { - // The animation hasn't started yet. - continue; - } - - if( bga.m_bFinished ) - continue; - - /* Update the actor even if we're about to hide it, so queued commands - * are always run. */ - float lDeltaTime; - if( !bga.m_bga->GetVisible() ) - { - bga.m_bga->SetVisible( true ); - bga.m_bga->PlayCommand( "On" ); - - const float fStartSecond = m_pSong->m_Timing.GetElapsedTimeFromBeat( bga.m_fStartBeat ); - lDeltaTime = GAMESTATE->m_fMusicSeconds - fStartSecond; - } - else - { - lDeltaTime = GAMESTATE->m_fMusicSeconds - m_fLastMusicSeconds; - } - - // This shouldn't go down, but be safe: - lDeltaTime = max( lDeltaTime, 0 ); - - bga.m_bga->Update( lDeltaTime / fRate ); - - if( GAMESTATE->m_fSongBeat > bga.m_fStopBeat ) - { - // Finished. - bga.m_bga->SetVisible( false ); - bga.m_bFinished = true; - continue; - } - } - - m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds; -} - -/* - * (c) 2004 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Foreground.h" +#include "RageUtil.h" +#include "GameState.h" +#include "RageTextureManager.h" +#include "ActorUtil.h" +#include "Song.h" +#include "BackgroundUtil.h" +#include "Foreach.h" + +Foreground::~Foreground() +{ + Unload(); +} + +void Foreground::Unload() +{ + for( unsigned i=0; i < m_BGAnimations.size(); ++i ) + delete m_BGAnimations[i].m_bga; + m_BGAnimations.clear(); + m_SubActors.clear(); + m_fLastMusicSeconds = -9999; + m_pSong = NULL; +} + +void Foreground::LoadFromSong( const Song *pSong ) +{ + // Song graphics can get very big; never keep them in memory. + RageTextureID::TexPolicy OldPolicy = TEXTUREMAN->GetDefaultTexturePolicy(); + TEXTUREMAN->SetDefaultTexturePolicy( RageTextureID::TEX_VOLATILE ); + + m_pSong = pSong; + FOREACH_CONST( BackgroundChange, pSong->GetForegroundChanges(), bgc ) + { + const BackgroundChange &change = *bgc; + RString sBGName = change.m_def.m_sFile1; + + LoadedBGA bga; + bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName, this ); + bga.m_bga->PlayCommand( "Init" ); + bga.m_fStartBeat = change.m_fStartBeat; + bga.m_bFinished = false; + + const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( bga.m_fStartBeat ); + const float fStopSecond = fStartSecond + bga.m_bga->GetTweenTimeLeft(); + bga.m_fStopBeat = pSong->m_Timing.GetBeatFromElapsedTime( fStopSecond ); + + bga.m_bga->SetVisible( false ); + + this->AddChild( bga.m_bga ); + m_BGAnimations.push_back( bga ); + } + + TEXTUREMAN->SetDefaultTexturePolicy( OldPolicy ); + + this->SortByDrawOrder(); +} + +void Foreground::Update( float fDeltaTime ) +{ + // Calls to Update() should *not* be scaled by music rate. Undo it. + const float fRate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; + + for( unsigned i=0; i < m_BGAnimations.size(); ++i ) + { + LoadedBGA &bga = m_BGAnimations[i]; + + if( GAMESTATE->m_fSongBeat < bga.m_fStartBeat ) + { + // The animation hasn't started yet. + continue; + } + + if( bga.m_bFinished ) + continue; + + /* Update the actor even if we're about to hide it, so queued commands + * are always run. */ + float lDeltaTime; + if( !bga.m_bga->GetVisible() ) + { + bga.m_bga->SetVisible( true ); + bga.m_bga->PlayCommand( "On" ); + + const float fStartSecond = m_pSong->m_Timing.GetElapsedTimeFromBeat( bga.m_fStartBeat ); + lDeltaTime = GAMESTATE->m_fMusicSeconds - fStartSecond; + } + else + { + lDeltaTime = GAMESTATE->m_fMusicSeconds - m_fLastMusicSeconds; + } + + // This shouldn't go down, but be safe: + lDeltaTime = max( lDeltaTime, 0 ); + + bga.m_bga->Update( lDeltaTime / fRate ); + + if( GAMESTATE->m_fSongBeat > bga.m_fStopBeat ) + { + // Finished. + bga.m_bga->SetVisible( false ); + bga.m_bFinished = true; + continue; + } + } + + m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds; +} + +/* + * (c) 2004 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Foreground.h b/src/Foreground.h index 96f0f0a213..51a0b225fb 100644 --- a/src/Foreground.h +++ b/src/Foreground.h @@ -1,56 +1,56 @@ -#ifndef FOREGROUND_H -#define FOREGROUND_H - -#include "ActorFrame.h" - -class Song; -/** @brief Foreground in front of notes while playing. */ -class Foreground: public ActorFrame -{ -public: - ~Foreground(); - void Unload(); - void LoadFromSong( const Song *pSong ); - - virtual void Update( float fDeltaTime ); - -protected: - struct LoadedBGA - { - Actor *m_bga; - float m_fStartBeat; - float m_fStopBeat; - bool m_bFinished; - }; - - vector m_BGAnimations; - float m_fLastMusicSeconds; - const Song *m_pSong; -}; - -#endif - -/* - * (c) 2004 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef FOREGROUND_H +#define FOREGROUND_H + +#include "ActorFrame.h" + +class Song; +/** @brief Foreground in front of notes while playing. */ +class Foreground: public ActorFrame +{ +public: + ~Foreground(); + void Unload(); + void LoadFromSong( const Song *pSong ); + + virtual void Update( float fDeltaTime ); + +protected: + struct LoadedBGA + { + Actor *m_bga; + float m_fStartBeat; + float m_fStopBeat; + bool m_bFinished; + }; + + vector m_BGAnimations; + float m_fLastMusicSeconds; + const Song *m_pSong; +}; + +#endif + +/* + * (c) 2004 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Game.cpp b/src/Game.cpp index 2e1c09511c..e61074c47f 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -1,83 +1,83 @@ -#include "global.h" -#include "Game.h" -#include "RageLog.h" - -TapNoteScore Game::MapTapNoteScore( TapNoteScore tns ) const -{ - switch( tns ) - { - case TNS_W1: return m_mapW1To; - case TNS_W2: return m_mapW2To; - case TNS_W3: return m_mapW3To; - case TNS_W4: return m_mapW4To; - case TNS_W5: return m_mapW5To; - default: return tns; - } -} - -static const Game::PerButtonInfo g_CommonButtonInfo[] = -{ - { GameButtonType_INVALID }, // GAME_BUTTON_MENULEFT - { GameButtonType_INVALID }, // GAME_BUTTON_MENURIGHT - { GameButtonType_INVALID }, // GAME_BUTTON_MENUUP - { GameButtonType_INVALID }, // GAME_BUTTON_MENUDOWN - { GameButtonType_INVALID }, // GAME_BUTTON_START - { GameButtonType_INVALID }, // GAME_BUTTON_SELECT - { GameButtonType_INVALID }, // GAME_BUTTON_BACK - { GameButtonType_INVALID }, // GAME_BUTTON_COIN - { GameButtonType_INVALID }, // GAME_BUTTON_OPERATOR - { GameButtonType_INVALID }, // GAME_BUTTON_EFFECT_UP - { GameButtonType_INVALID }, // GAME_BUTTON_EFFECT_DOWN -}; - -const Game::PerButtonInfo *Game::GetPerButtonInfo( GameButton gb ) const -{ - COMPILE_ASSERT( GAME_BUTTON_NEXT == ARRAYLEN(g_CommonButtonInfo) ); - if( gb < GAME_BUTTON_NEXT ) - return &g_CommonButtonInfo[gb]; - else - return &m_PerButtonInfo[gb-GAME_BUTTON_NEXT]; -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the Game. */ -class LunaGame: public Luna -{ -public: - static int GetName( T* p, lua_State *L ) { lua_pushstring( L, p->m_szName ); return 1; } - - LunaGame() - { - ADD_METHOD( GetName ); - } -}; - -LUA_REGISTER_CLASS( Game ) -// lua end - -/* - * (c) 2001-2002 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "Game.h" +#include "RageLog.h" + +TapNoteScore Game::MapTapNoteScore( TapNoteScore tns ) const +{ + switch( tns ) + { + case TNS_W1: return m_mapW1To; + case TNS_W2: return m_mapW2To; + case TNS_W3: return m_mapW3To; + case TNS_W4: return m_mapW4To; + case TNS_W5: return m_mapW5To; + default: return tns; + } +} + +static const Game::PerButtonInfo g_CommonButtonInfo[] = +{ + { GameButtonType_INVALID }, // GAME_BUTTON_MENULEFT + { GameButtonType_INVALID }, // GAME_BUTTON_MENURIGHT + { GameButtonType_INVALID }, // GAME_BUTTON_MENUUP + { GameButtonType_INVALID }, // GAME_BUTTON_MENUDOWN + { GameButtonType_INVALID }, // GAME_BUTTON_START + { GameButtonType_INVALID }, // GAME_BUTTON_SELECT + { GameButtonType_INVALID }, // GAME_BUTTON_BACK + { GameButtonType_INVALID }, // GAME_BUTTON_COIN + { GameButtonType_INVALID }, // GAME_BUTTON_OPERATOR + { GameButtonType_INVALID }, // GAME_BUTTON_EFFECT_UP + { GameButtonType_INVALID }, // GAME_BUTTON_EFFECT_DOWN +}; + +const Game::PerButtonInfo *Game::GetPerButtonInfo( GameButton gb ) const +{ + COMPILE_ASSERT( GAME_BUTTON_NEXT == ARRAYLEN(g_CommonButtonInfo) ); + if( gb < GAME_BUTTON_NEXT ) + return &g_CommonButtonInfo[gb]; + else + return &m_PerButtonInfo[gb-GAME_BUTTON_NEXT]; +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the Game. */ +class LunaGame: public Luna +{ +public: + static int GetName( T* p, lua_State *L ) { lua_pushstring( L, p->m_szName ); return 1; } + + LunaGame() + { + ADD_METHOD( GetName ); + } +}; + +LUA_REGISTER_CLASS( Game ) +// lua end + +/* + * (c) 2001-2002 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/Game.h b/src/Game.h index 536bb1f4fe..b8ef7db24f 100644 --- a/src/Game.h +++ b/src/Game.h @@ -1,92 +1,92 @@ -#ifndef GAMEDEF_H -#define GAMEDEF_H - -#include "InputMapper.h" -#include "GameConstantsAndTypes.h" - -struct lua_State; -class Style; - -// PrimaryMenuButton and SecondaryMenuButton are used to support using -// DeviceInputs that only navigate the menus. - -// A button being a primary menu button means that this GameButton will generate -// a the corresponding MenuInput IF AND ONLY IF the GameButton corresponding to -// the pimary input is not mapped. - -// Example 1: A user is using an arcade machine as their controller. Most -// machines have MenuLeft, MenuStart, and MenuRight buttons on the cabinet, so -// they should be used to navigate menus. The user will map these DeviceInputs -// to the GameButtons "MenuLeft (optional)", "MenuStart", and "MenuRight (optional)". - -// Example 2: A user is using PlayStation dance pads to play. These controllers -// don't have dedicated DeviceInputs for MenuLeft and MenuRight. The user maps -// Up, Down, Left, and Right as normal. Since the Left and Right GameButtons -// have the flag FLAG_SECONDARY_MENU_*, they will function as MenuLeft and -// MenuRight as long as "MenuLeft (optional)" and "MenuRight (optional)" are not mapped. - -/** @brief Holds information about a particular style of a game (e.g. "single", "double"). */ -class Game -{ -public: - const char * m_szName; - const Style * const* m_apStyles; - - /** @brief Do we count multiple notes in a row as separate notes, or as one note? */ - bool m_bCountNotesSeparately; - /** @brief Do we allow for hammer-ons and pull-offs? - * - * This is right now only useful for guitar type input. */ - bool m_bAllowHopos; - InputScheme m_InputScheme; - - struct PerButtonInfo - { - GameButtonType m_gbt; - }; - /** - * @brief Data for each Game-specific GameButton. - * - * This starts at GAME_BUTTON_NEXT. */ - PerButtonInfo m_PerButtonInfo[NUM_GameButton]; - const PerButtonInfo *GetPerButtonInfo( GameButton gb ) const; - - TapNoteScore MapTapNoteScore( TapNoteScore tns ) const; - TapNoteScore m_mapW1To; - TapNoteScore m_mapW2To; - TapNoteScore m_mapW3To; - TapNoteScore m_mapW4To; - TapNoteScore m_mapW5To; - - // Lua - void PushSelf( lua_State *L ); -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2002 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef GAMEDEF_H +#define GAMEDEF_H + +#include "InputMapper.h" +#include "GameConstantsAndTypes.h" + +struct lua_State; +class Style; + +// PrimaryMenuButton and SecondaryMenuButton are used to support using +// DeviceInputs that only navigate the menus. + +// A button being a primary menu button means that this GameButton will generate +// a the corresponding MenuInput IF AND ONLY IF the GameButton corresponding to +// the pimary input is not mapped. + +// Example 1: A user is using an arcade machine as their controller. Most +// machines have MenuLeft, MenuStart, and MenuRight buttons on the cabinet, so +// they should be used to navigate menus. The user will map these DeviceInputs +// to the GameButtons "MenuLeft (optional)", "MenuStart", and "MenuRight (optional)". + +// Example 2: A user is using PlayStation dance pads to play. These controllers +// don't have dedicated DeviceInputs for MenuLeft and MenuRight. The user maps +// Up, Down, Left, and Right as normal. Since the Left and Right GameButtons +// have the flag FLAG_SECONDARY_MENU_*, they will function as MenuLeft and +// MenuRight as long as "MenuLeft (optional)" and "MenuRight (optional)" are not mapped. + +/** @brief Holds information about a particular style of a game (e.g. "single", "double"). */ +class Game +{ +public: + const char * m_szName; + const Style * const* m_apStyles; + + /** @brief Do we count multiple notes in a row as separate notes, or as one note? */ + bool m_bCountNotesSeparately; + /** @brief Do we allow for hammer-ons and pull-offs? + * + * This is right now only useful for guitar type input. */ + bool m_bAllowHopos; + InputScheme m_InputScheme; + + struct PerButtonInfo + { + GameButtonType m_gbt; + }; + /** + * @brief Data for each Game-specific GameButton. + * + * This starts at GAME_BUTTON_NEXT. */ + PerButtonInfo m_PerButtonInfo[NUM_GameButton]; + const PerButtonInfo *GetPerButtonInfo( GameButton gb ) const; + + TapNoteScore MapTapNoteScore( TapNoteScore tns ) const; + TapNoteScore m_mapW1To; + TapNoteScore m_mapW2To; + TapNoteScore m_mapW3To; + TapNoteScore m_mapW4To; + TapNoteScore m_mapW5To; + + // Lua + void PushSelf( lua_State *L ); +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2002 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index 43783b8b41..6897956d6f 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -1,925 +1,925 @@ -#include "global.h" -#include "GameCommand.h" -#include "RageUtil.h" -#include "RageLog.h" -#include "GameManager.h" -#include "GameState.h" -#include "AnnouncerManager.h" -#include "PlayerOptions.h" -#include "ProfileManager.h" -#include "Profile.h" -#include "StepMania.h" -#include "ScreenManager.h" -#include "PrefsManager.h" -#include "Game.h" -#include "Style.h" -#include "Foreach.h" -#include "arch/Dialog/Dialog.h" -#include "GameSoundManager.h" -#include "PlayerState.h" -#include "SongManager.h" -#include "Song.h" -#include "UnlockManager.h" -#include "LocalizedString.h" -#include "arch/ArchHooks/ArchHooks.h" -#include "ScreenPrompt.h" - -static LocalizedString COULD_NOT_LAUNCH_BROWSER( "GameCommand", "Could not launch web browser." ); - -REGISTER_CLASS_TRAITS( GameCommand, new GameCommand(*pCopy) ); - -void GameCommand::Init() -{ - m_bApplyCommitsScreens = true; - m_sName = ""; - m_sText = ""; - m_bInvalid = true; - m_iIndex = -1; - m_MultiPlayer = MultiPlayer_Invalid; - m_pStyle = NULL; - m_pm = PlayMode_Invalid; - m_dc = Difficulty_Invalid; - m_CourseDifficulty = Difficulty_Invalid; - m_sPreferredModifiers = ""; - m_sStageModifiers = ""; - m_sAnnouncer = ""; - m_sScreen = ""; - m_LuaFunction.Unset(); - m_pSong = NULL; - m_pSteps = NULL; - m_pCourse = NULL; - m_pTrail = NULL; - m_pCharacter = NULL; - m_SortOrder = SortOrder_Invalid; - m_sSoundPath = ""; - m_vsScreensToPrepare.clear(); - m_iWeightPounds = -1; - m_iGoalCalories = -1; - m_GoalType = GoalType_Invalid; - m_sProfileID = ""; - m_sUrl = ""; - m_bUrlExits = true; - - m_bInsertCredit = false; - m_bClearCredits = false; - m_bStopMusic = false; - m_bApplyDefaultOptions = false; - m_bFadeMusic = false; - m_fMusicFadeOutVolume = -1.0f; - m_fMusicFadeOutSeconds = -1.0f; -} - -class SongOptions; -bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 ); - -bool GameCommand::DescribesCurrentModeForAllPlayers() const -{ - FOREACH_HumanPlayer( pn ) - if( !DescribesCurrentMode(pn) ) - return false; - - return true; -} - -bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const -{ - if( m_pm != PlayMode_Invalid && GAMESTATE->m_PlayMode != m_pm ) - return false; - if( m_pStyle && GAMESTATE->GetCurrentStyle() != m_pStyle ) - return false; - // HACK: don't compare m_dc if m_pSteps is set. This causes problems - // in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty - // doesn't match the difficulty of m_pCurSteps. - if( m_pSteps == NULL && m_dc != Difficulty_Invalid ) - { - // Why is this checking for all players? - FOREACH_HumanPlayer( human ) - if( GAMESTATE->m_PreferredDifficulty[human] != m_dc ) - return false; - } - - if( m_sAnnouncer != "" && m_sAnnouncer != ANNOUNCER->GetCurAnnouncerName() ) - return false; - - if( m_sPreferredModifiers != "" ) - { - PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); - SongOptions so = GAMESTATE->m_SongOptions.GetPreferred(); - po.FromString( m_sPreferredModifiers ); - so.FromString( m_sPreferredModifiers ); - - if( po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred() ) - return false; - if( so != GAMESTATE->m_SongOptions.GetPreferred() ) - return false; - } - if( m_sStageModifiers != "" ) - { - PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage(); - SongOptions so = GAMESTATE->m_SongOptions.GetStage(); - po.FromString( m_sStageModifiers ); - so.FromString( m_sStageModifiers ); - - if( po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage() ) - return false; - if( so != GAMESTATE->m_SongOptions.GetStage() ) - return false; - } - - if( m_pSong && GAMESTATE->m_pCurSong.Get() != m_pSong ) - return false; - if( m_pSteps && GAMESTATE->m_pCurSteps[pn].Get() != m_pSteps ) - return false; - if( m_pCharacter && GAMESTATE->m_pCurCharacters[pn] != m_pCharacter ) - return false; - if( m_pCourse && GAMESTATE->m_pCurCourse.Get() != m_pCourse ) - return false; - if( m_pTrail && GAMESTATE->m_pCurTrail[pn].Get() != m_pTrail ) - return false; - if( !m_sSongGroup.empty() && GAMESTATE->m_sPreferredSongGroup != m_sSongGroup ) - return false; - if( m_SortOrder != SortOrder_Invalid && GAMESTATE->m_PreferredSortOrder != m_SortOrder ) - return false; - if( m_iWeightPounds != -1 && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds ) - return false; - if( m_iGoalCalories != -1 && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories ) - return false; - if( m_GoalType != GoalType_Invalid && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType ) - return false; - if( !m_sProfileID.empty() && ProfileManager::m_sDefaultLocalProfileID[pn].Get() != m_sProfileID ) - return false; - - return true; -} - -void GameCommand::Load( int iIndex, const Commands& cmds ) -{ - m_iIndex = iIndex; - m_bInvalid = false; - m_Commands = cmds; - - FOREACH_CONST( Command, cmds.v, cmd ) - LoadOne( *cmd ); -} - -void GameCommand::LoadOne( const Command& cmd ) -{ - RString sName = cmd.GetName(); - if( sName.empty() ) - return; - - RString sValue; - for( unsigned i = 1; i < cmd.m_vsArgs.size(); ++i ) - { - if( i > 1 ) - sValue += ","; - sValue += cmd.m_vsArgs[i]; - } - - if( sName == "style" ) - { - const Style* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_pCurGame, sValue ); - if( style ) - m_pStyle = style; - else - m_bInvalid = true; - } - - else if( sName == "playmode" ) - { - PlayMode pm = StringToPlayMode( sValue ); - if( pm != PlayMode_Invalid ) - m_pm = pm; - else - m_bInvalid = true; - } - - else if( sName == "difficulty" ) - { - Difficulty dc = StringToDifficulty( sValue ); - if( dc != Difficulty_Invalid ) - m_dc = dc; - else - m_bInvalid = true; - } - - else if( sName == "announcer" ) - { - m_sAnnouncer = sValue; - } - - else if( sName == "name" ) - { - m_sName = sValue; - } - - else if( sName == "text" ) - { - m_sText = sValue; - } - - else if( sName == "mod" ) - { - if( m_sPreferredModifiers != "" ) - m_sPreferredModifiers += ","; - m_sPreferredModifiers += sValue; - } - - else if( sName == "stagemod" ) - { - if( m_sStageModifiers != "" ) - m_sStageModifiers += ","; - m_sStageModifiers += sValue; - } - - else if( sName == "lua" ) - { - m_LuaFunction.SetFromExpression( sValue ); - ASSERT_M( !m_LuaFunction.IsNil(), ssprintf("\"%s\" evaluated to nil", sValue.c_str()) ); - } - - else if( sName == "screen" ) - { - m_sScreen = sValue; - } - - else if( sName == "song" ) - { - m_pSong = SONGMAN->FindSong( sValue ); - if( m_pSong == NULL ) - { - m_sInvalidReason = ssprintf( "Song \"%s\" not found", sValue.c_str() ); - m_bInvalid |= true; - } - } - - else if( sName == "steps" ) - { - RString sSteps = sValue; - - // This must be processed after "song" and "style" commands. - if( !m_bInvalid ) - { - Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong; - const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); - if( pSong == NULL || pStyle == NULL ) - RageException::Throw( "Must set Song and Style to set Steps." ); - - Difficulty dc = StringToDifficulty( sSteps ); - if( dc != Difficulty_Edit ) - m_pSteps = SongUtil::GetStepsByDifficulty( pSong, pStyle->m_StepsType, dc ); - else - m_pSteps = SongUtil::GetStepsByDescription( pSong, pStyle->m_StepsType, sSteps ); - if( m_pSteps == NULL ) - { - m_sInvalidReason = "steps not found"; - m_bInvalid |= true; - } - } - } - - else if( sName == "course" ) - { - m_pCourse = SONGMAN->FindCourse( "", sValue ); - if( m_pCourse == NULL ) - { - m_sInvalidReason = ssprintf( "Course \"%s\" not found", sValue.c_str() ); - m_bInvalid |= true; - } - } - - else if( sName == "trail" ) - { - RString sTrail = sValue; - - // This must be processed after "course" and "style" commands. - if( !m_bInvalid ) - { - Course *pCourse = (m_pCourse != NULL)? m_pCourse:GAMESTATE->m_pCurCourse; - const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); - if( pCourse == NULL || pStyle == NULL ) - RageException::Throw( "Must set Course and Style to set Steps." ); - - const CourseDifficulty cd = StringToDifficulty( sTrail ); - ASSERT_M( cd != Difficulty_Invalid, ssprintf("Invalid difficulty '%s'", sTrail.c_str()) ); - - m_pTrail = pCourse->GetTrail( pStyle->m_StepsType, cd ); - if( m_pTrail == NULL ) - { - m_sInvalidReason = "trail not found"; - m_bInvalid |= true; - } - } - } - - else if( sName == "setenv" ) - { - if( cmd.m_vsArgs.size() == 3 ) - m_SetEnv[ cmd.m_vsArgs[1] ] = cmd.m_vsArgs[2]; - } - - else if( sName == "songgroup" ) - { - m_sSongGroup = sValue; - } - - else if( sName == "sort" ) - { - m_SortOrder = StringToSortOrder( sValue ); - if( m_SortOrder == SortOrder_Invalid ) - { - m_sInvalidReason = ssprintf( "SortOrder \"%s\" is not valid.", sValue.c_str() ); - m_bInvalid |= true; - } - } - - else if( sName == "weight" ) - { - m_iWeightPounds = atoi( sValue ); - } - - else if( sName == "goalcalories" ) - { - m_iGoalCalories = atoi( sValue ); - } - - else if( sName == "goaltype" ) - { - m_GoalType = StringToGoalType( sValue ); - } - - else if( sName == "profileid" ) - { - m_sProfileID = sValue; - } - - else if( sName == "url" ) - { - m_sUrl = sValue; - m_bUrlExits = true; - } - - else if( sName == "sound" ) - { - m_sSoundPath = sValue; - } - - else if( sName == "preparescreen" ) - { - m_vsScreensToPrepare.push_back( sValue ); - } - - else if( sName == "insertcredit" ) - { - m_bInsertCredit = true; - } - - else if( sName == "clearcredits" ) - { - m_bClearCredits = true; - } - - else if( sName == "stopmusic" ) - { - m_bStopMusic = true; - } - - else if( sName == "applydefaultoptions" ) - { - m_bApplyDefaultOptions = true; - } - - // sm-ssc additions begin: - else if( sName == "urlnoexit" ) - { - m_sUrl = sValue; - m_bUrlExits = false; - } - - else if( sName == "setpref" ) - { - if( cmd.m_vsArgs.size() == 3 ) - { - IPreference *pPref = IPreference::GetPreferenceByName( cmd.m_vsArgs[1] ); - if( pPref == NULL ) - { - m_sInvalidReason = ssprintf("unknown preference \"%s\"", cmd.m_vsArgs[1].c_str() ); - m_bInvalid |= true; - } - pPref->FromString(cmd.m_vsArgs[2]); - } - } - - else if( sName == "fademusic" ) - { - if( cmd.m_vsArgs.size() == 3 ) - { - m_bFadeMusic = true; - m_fMusicFadeOutVolume = atof( cmd.m_vsArgs[1] ); - m_fMusicFadeOutSeconds = atof( cmd.m_vsArgs[2] ); - } - } - - else - { - RString sWarning = ssprintf( "Command '%s' is not valid.", cmd.GetOriginalCommandString().c_str() ); - LOG->Warn( "%s", sWarning.c_str() ); - Dialog::OK( sWarning, "INVALID_GAME_COMMAND" ); - } -} - -int GetNumCreditsPaid() -{ - int iNumCreditsPaid = GAMESTATE->GetNumSidesJoined(); - - // players other than the first joined for free - if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit ) - iNumCreditsPaid = min( iNumCreditsPaid, 1 ); - - return iNumCreditsPaid; -} - - -int GetCreditsRequiredToPlayStyle( const Style *style ) -{ - if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit ) - return 1; - - switch( style->m_StyleType ) - { - case StyleType_OnePlayerOneSide: - return 1; - case StyleType_TwoPlayersSharedSides: - case StyleType_TwoPlayersTwoSides: - return 2; - case StyleType_OnePlayerTwoSides: - return (GAMESTATE->GetPremium() == Premium_DoubleFor1Credit) ? 1 : 2; - DEFAULT_FAIL( style->m_StyleType ); - } -} - -static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm ) -{ - if( style == NULL || pm == PlayMode_Invalid ) - return true; - - switch( pm ) - { - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - // Can't play rave if there isn't enough room for two players. - // This is correct for dance (ie, no rave for solo and doubles), - // and should be okay for pump.. not sure about other game types. - // Techno Motion scales down versus arrows, though, so allow this. - if( style->m_iColsPerPlayer >= 6 && RString(GAMESTATE->m_pCurGame->m_szName) != "techno" ) - return false; - - // Don't allow battle modes if the style takes both sides. - if( style->m_StyleType==StyleType_OnePlayerTwoSides || - style->m_StyleType==StyleType_TwoPlayersSharedSides ) - return false; - } - - return true; -} - -bool GameCommand::IsPlayable( RString *why ) const -{ - if( m_bInvalid ) - { - if( why ) - *why = m_sInvalidReason; - return false; - } - - if ( m_pStyle ) - { - int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit; - const int iNumCreditsPaid = GetNumCreditsPaid(); - const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle); - - switch( GAMESTATE->GetCoinMode() ) - { - case CoinMode_Home: - case CoinMode_Free: - iCredits = NUM_PLAYERS; // not iNumCreditsPaid - } - - /* With PREFSMAN->m_bDelayedCreditsReconcile disabled, enough credits must - * be paid. (This means that enough sides must be joined.) Enabled, simply - * having enough credits lying in the machine is sufficient; we'll deduct the - * extra in Apply(). */ - int iNumCreditsAvailable = iNumCreditsPaid; - if( PREFSMAN->m_bDelayedCreditsReconcile ) - iNumCreditsAvailable += iCredits; - - if( iNumCreditsAvailable < iNumCreditsRequired ) - { - if( why ) - *why = ssprintf( "need %i credits, have %i", iNumCreditsRequired, iNumCreditsAvailable ); - return false; - } - - /* If you've paid too much already, don't allow the mode. (If we allow this, - * the credits will be "refunded" in Apply(), but that's confusing.) */ - /* Do allow the mode if they've already joined in more credits than - * are required. Otherwise, people who put in two credits to play - * doubles on a doubles-premium machiune will get locked out. - * the refund logic isn't that awkward because you never see the - * credits number jump up - the credits display is hidden if both - * sides are joined. -Chris */ - /* - if( PREFSMAN->m_iCoinMode == COIN_PAY && iNumCreditsPaid > iNumCreditsRequired ) - { - if( why ) - *why = ssprintf( "too many credits paid (%i > %i)", iNumCreditsPaid, iNumCreditsRequired ); - return false; - } - */ - - /* If both sides are joined, disallow singles modes, since easy to select - * them accidentally, instead of versus mode. */ - if( m_pStyle->m_StyleType == StyleType_OnePlayerOneSide && - GAMESTATE->GetNumSidesJoined() > 1 ) - { - if( why ) - *why = "too many players joined for ONE_PLAYER_ONE_CREDIT"; - return false; - } - } - - /* Don't allow a PlayMode that's incompatible with our current Style (if set), - * and vice versa. */ - if( m_pm != PlayMode_Invalid || m_pStyle != NULL ) - { - const PlayMode pm = (m_pm != PlayMode_Invalid) ? m_pm : GAMESTATE->m_PlayMode; - const Style *style = (m_pStyle != NULL)? m_pStyle: GAMESTATE->GetCurrentStyle(); - if( !AreStyleAndPlayModeCompatible( style, pm ) ) - { - if( why ) - *why = ssprintf("mode %s is incompatible with style %s", - PlayModeToString(pm).c_str(), style->m_szName ); - - return false; - } - } - - if( !m_sScreen.CompareNoCase("ScreenEditCoursesMenu") ) - { - vector vCourses; - SONGMAN->GetAllCourses( vCourses, false ); - - if( vCourses.size() == 0 ) - { - if( why ) - *why = "No courses are installed"; - return false; - } - } - - if( (!m_sScreen.CompareNoCase("ScreenJukeboxMenu") || - !m_sScreen.CompareNoCase("ScreenEditMenu") || - !m_sScreen.CompareNoCase("ScreenEditCoursesMenu")) ) - { - if( SONGMAN->GetNumSongs() == 0 ) - { - if( why ) - *why = "No songs are installed"; - return false; - } - } - - if( !m_sPreferredModifiers.empty() ) - { - // TODO: Split this and check each modifier individually - if( UNLOCKMAN->ModifierIsLocked(m_sPreferredModifiers) ) - { if( why ) - *why = "Modifier is locked"; - return false; - } - } - - if( !m_sStageModifiers.empty() ) - { - // TODO: Split this and check each modifier individually - if( UNLOCKMAN->ModifierIsLocked(m_sStageModifiers) ) - { if( why ) - *why = "Modifier is locked"; - return false; - } - } - - return true; -} - -void GameCommand::ApplyToAllPlayers() const -{ - vector vpns; - - FOREACH_PlayerNumber( pn ) - vpns.push_back( pn ); - - Apply( vpns ); -} - -void GameCommand::Apply( PlayerNumber pn ) const -{ - vector vpns; - vpns.push_back( pn ); - Apply( vpns ); -} - -void GameCommand::Apply( const vector &vpns ) const -{ - if( m_Commands.v.size() ) - { - // We were filled using a GameCommand from metrics. Apply the options in order. - FOREACH_CONST( Command, m_Commands.v, cmd ) - { - GameCommand gc; - gc.m_bInvalid = false; - gc.m_bApplyCommitsScreens = m_bApplyCommitsScreens; - gc.LoadOne( *cmd ); - gc.ApplySelf( vpns ); - } - } - else - { - // We were filled by an OptionRowHandler in code. m_Commands isn't filled, - // so just apply the values that are already set in this. - this->ApplySelf( vpns ); - } -} - -void GameCommand::ApplySelf( const vector &vpns ) const -{ - const PlayMode OldPlayMode = GAMESTATE->m_PlayMode; - - if( m_pm != PlayMode_Invalid ) - GAMESTATE->m_PlayMode.Set( m_pm ); - - if( m_pStyle != NULL ) - { - GAMESTATE->SetCurrentStyle( m_pStyle ); - - // It's possible to choose a style that didn't have enough players joined. - // If enough players aren't joined, then we need to subtract credits - // for the sides that will be joined as a result of applying this option. - if( GAMESTATE->GetCoinMode() == CoinMode_Pay ) - { - int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle); - int iNumCreditsPaid = GetNumCreditsPaid(); - int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid; - GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins - iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit ); - LOG->Trace( "Deducted %i coins, %i remaining", - iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit, GAMESTATE->m_iCoins.Get() ); - } - - // If only one side is joined and we picked a style that requires both - // sides, join the other side. - switch( m_pStyle->m_StyleType ) - { - case StyleType_OnePlayerOneSide: - break; - case StyleType_TwoPlayersTwoSides: - case StyleType_OnePlayerTwoSides: - case StyleType_TwoPlayersSharedSides: - { - FOREACH_PlayerNumber( p ) - GAMESTATE->JoinPlayer( p ); - } - break; - default: - ASSERT(0); - } - } - if( m_dc != Difficulty_Invalid ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->m_PreferredDifficulty[*pn].Set( m_dc ); - if( m_sAnnouncer != "" ) - ANNOUNCER->SwitchAnnouncer( m_sAnnouncer ); - if( m_sPreferredModifiers != "" ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->ApplyPreferredModifiers( *pn, m_sPreferredModifiers ); - if( m_sStageModifiers != "" ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->ApplyStageModifiers( *pn, m_sStageModifiers ); - if( m_LuaFunction.IsSet() ) - { - Lua *L = LUA->Get(); - FOREACH_CONST( PlayerNumber, vpns, pn ) - { - m_LuaFunction.PushSelf( L ); - ASSERT( !lua_isnil(L, -1) ); - - lua_pushnumber( L, *pn ); // 1st parameter - lua_call( L, 1, 0 ); // call function with 1 argument and 0 results - } - LUA->Release(L); - } - if( m_sScreen != "" && m_bApplyCommitsScreens ) - SCREENMAN->SetNewScreen( m_sScreen ); - if( m_pSong ) - { - GAMESTATE->m_pCurSong.Set( m_pSong ); - GAMESTATE->m_pPreferredSong = m_pSong; - } - if( m_pSteps ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->m_pCurSteps[*pn].Set( m_pSteps ); - if( m_pCourse ) - { - GAMESTATE->m_pCurCourse.Set( m_pCourse ); - GAMESTATE->m_pPreferredCourse = m_pCourse; - } - if( m_pTrail ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->m_pCurTrail[*pn].Set( m_pTrail ); - if( m_CourseDifficulty != Difficulty_Invalid ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->ChangePreferredCourseDifficulty( *pn, m_CourseDifficulty ); - if( m_pCharacter ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - GAMESTATE->m_pCurCharacters[*pn] = m_pCharacter; - for( map::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ ) - { - Lua *L = LUA->Get(); - GAMESTATE->m_Environment->PushSelf(L); - lua_pushstring( L, i->first ); - lua_pushstring( L, i->second ); - lua_settable( L, -3 ); - lua_pop( L, 1 ); - LUA->Release(L); - } - if( !m_sSongGroup.empty() ) - GAMESTATE->m_sPreferredSongGroup.Set( m_sSongGroup ); - if( m_SortOrder != SortOrder_Invalid ) - GAMESTATE->m_PreferredSortOrder = m_SortOrder; - if( m_sSoundPath != "" ) - SOUND->PlayOnce( THEME->GetPathS( "", m_sSoundPath ) ); - if( m_iWeightPounds != -1 ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds; - if( m_iGoalCalories != -1 ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories; - if( m_GoalType != GoalType_Invalid ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType; - if( !m_sProfileID.empty() ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - ProfileManager::m_sDefaultLocalProfileID[*pn].Set( m_sProfileID ); - if( !m_sUrl.empty() ) - { - if( HOOKS->GoToURL( m_sUrl ) ) - { - if( m_bUrlExits ) - SCREENMAN->SetNewScreen( "ScreenExit" ); - } - else - ScreenPrompt::Prompt( SM_None, COULD_NOT_LAUNCH_BROWSER ); - } - - /* If we're going to stop music, do so before preparing new screens, so we - * don't stop music between preparing screens and loading screens. */ - if( m_bStopMusic ) - SOUND->StopMusic(); - if( m_bFadeMusic ) - SOUND->DimMusic(m_fMusicFadeOutVolume, m_fMusicFadeOutSeconds); - - FOREACH_CONST( RString, m_vsScreensToPrepare, s ) - SCREENMAN->PrepareScreen( *s ); - - if( m_bInsertCredit ) - { - StepMania::InsertCredit(); - } - - if( m_bClearCredits ) - StepMania::ClearCredits(); - - if( m_bApplyDefaultOptions ) - { - // applying options affects only the current stage - FOREACH_PlayerNumber( p ) - { - PlayerOptions po; - GAMESTATE->GetDefaultPlayerOptions( po ); - GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Assign( ModsLevel_Stage, po ); - } - - SongOptions so; - GAMESTATE->GetDefaultSongOptions( so ); - GAMESTATE->m_SongOptions.Assign( ModsLevel_Stage, so ); - } - // HACK: Set life type to BATTERY just once here so it happens once and - // we don't override the user's changes if they back out. - if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI && - GAMESTATE->m_PlayMode != OldPlayMode && - GAMESTATE->m_SongOptions.GetStage().m_LifeType == SongOptions::LIFE_BAR ) - { - SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_LifeType, SongOptions::LIFE_BATTERY ); - } -} - -bool GameCommand::IsZero() const -{ - if( m_pm != PlayMode_Invalid || - m_pStyle != NULL || - m_dc != Difficulty_Invalid || - m_sAnnouncer != "" || - m_sPreferredModifiers != "" || - m_sStageModifiers != "" || - m_pSong != NULL || - m_pSteps != NULL || - m_pCourse != NULL || - m_pTrail != NULL || - m_pCharacter != NULL || - m_CourseDifficulty != Difficulty_Invalid || - !m_sSongGroup.empty() || - m_SortOrder != SortOrder_Invalid || - m_iWeightPounds != -1 || - m_iGoalCalories != -1 || - m_GoalType != GoalType_Invalid || - !m_sProfileID.empty() || - !m_sUrl.empty() ) - return false; - - return true; -} - -// lua start -#include "LuaBinding.h" -#include "Game.h" -#include "Steps.h" -#include "Character.h" - -/** @brief Allow Lua to have access to the GameCommand. */ -class LunaGameCommand: public Luna -{ -public: - static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sName ); return 1; } - static int GetText( T* p, lua_State *L ) { lua_pushstring(L, p->m_sText ); return 1; } - static int GetIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iIndex ); return 1; } - static int GetMultiPlayer( T* p, lua_State *L ) { lua_pushnumber(L, p->m_MultiPlayer); return 1; } - static int GetStyle( T* p, lua_State *L ) { if(p->m_pStyle==NULL) lua_pushnil(L); else {Style *pStyle = (Style*)p->m_pStyle; pStyle->PushSelf(L);} return 1; } - static int GetScreen( T* p, lua_State *L ) { lua_pushstring(L, p->m_sScreen ); return 1; } - static int GetProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sProfileID ); return 1; } - static int GetSong( T* p, lua_State *L ) { if(p->m_pSong==NULL) lua_pushnil(L); else p->m_pSong->PushSelf(L); return 1; } - static int GetSteps( T* p, lua_State *L ) { if(p->m_pSteps==NULL) lua_pushnil(L); else p->m_pSteps->PushSelf(L); return 1; } - static int GetCourse( T* p, lua_State *L ) { if(p->m_pCourse==NULL) lua_pushnil(L); else p->m_pCourse->PushSelf(L); return 1; } - static int GetTrail( T* p, lua_State *L ) { if(p->m_pTrail==NULL) lua_pushnil(L); else p->m_pTrail->PushSelf(L); return 1; } - static int GetCharacter( T* p, lua_State *L ) { if(p->m_pCharacter==NULL) lua_pushnil(L); else p->m_pCharacter->PushSelf(L); return 1; } - static int GetSongGroup( T* p, lua_State *L ) { lua_pushstring(L, p->m_sSongGroup ); return 1; } - static int GetUrl( T* p, lua_State *L ) { lua_pushstring(L, p->m_sUrl ); return 1; } - - LunaGameCommand() - { - ADD_METHOD( GetName ); - ADD_METHOD( GetText ); - ADD_METHOD( GetIndex ); - ADD_METHOD( GetMultiPlayer ); - ADD_METHOD( GetStyle ); - //ADD_METHOD( GetDifficulty ); - //ADD_METHOD( GetCourseDifficulty ); - ADD_METHOD( GetScreen ); - //ADD_METHOD( GetPlayMode ); - ADD_METHOD( GetProfileID ); - ADD_METHOD( GetSong ); - ADD_METHOD( GetSteps ); - ADD_METHOD( GetCourse ); - ADD_METHOD( GetTrail ); - ADD_METHOD( GetCharacter ); - ADD_METHOD( GetSongGroup ); - //ADD_METHOD( GetSortOrder ); - ADD_METHOD( GetUrl ); - } -}; - -LUA_REGISTER_CLASS( GameCommand ) -// lua end - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GameCommand.h" +#include "RageUtil.h" +#include "RageLog.h" +#include "GameManager.h" +#include "GameState.h" +#include "AnnouncerManager.h" +#include "PlayerOptions.h" +#include "ProfileManager.h" +#include "Profile.h" +#include "StepMania.h" +#include "ScreenManager.h" +#include "PrefsManager.h" +#include "Game.h" +#include "Style.h" +#include "Foreach.h" +#include "arch/Dialog/Dialog.h" +#include "GameSoundManager.h" +#include "PlayerState.h" +#include "SongManager.h" +#include "Song.h" +#include "UnlockManager.h" +#include "LocalizedString.h" +#include "arch/ArchHooks/ArchHooks.h" +#include "ScreenPrompt.h" + +static LocalizedString COULD_NOT_LAUNCH_BROWSER( "GameCommand", "Could not launch web browser." ); + +REGISTER_CLASS_TRAITS( GameCommand, new GameCommand(*pCopy) ); + +void GameCommand::Init() +{ + m_bApplyCommitsScreens = true; + m_sName = ""; + m_sText = ""; + m_bInvalid = true; + m_iIndex = -1; + m_MultiPlayer = MultiPlayer_Invalid; + m_pStyle = NULL; + m_pm = PlayMode_Invalid; + m_dc = Difficulty_Invalid; + m_CourseDifficulty = Difficulty_Invalid; + m_sPreferredModifiers = ""; + m_sStageModifiers = ""; + m_sAnnouncer = ""; + m_sScreen = ""; + m_LuaFunction.Unset(); + m_pSong = NULL; + m_pSteps = NULL; + m_pCourse = NULL; + m_pTrail = NULL; + m_pCharacter = NULL; + m_SortOrder = SortOrder_Invalid; + m_sSoundPath = ""; + m_vsScreensToPrepare.clear(); + m_iWeightPounds = -1; + m_iGoalCalories = -1; + m_GoalType = GoalType_Invalid; + m_sProfileID = ""; + m_sUrl = ""; + m_bUrlExits = true; + + m_bInsertCredit = false; + m_bClearCredits = false; + m_bStopMusic = false; + m_bApplyDefaultOptions = false; + m_bFadeMusic = false; + m_fMusicFadeOutVolume = -1.0f; + m_fMusicFadeOutSeconds = -1.0f; +} + +class SongOptions; +bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 ); + +bool GameCommand::DescribesCurrentModeForAllPlayers() const +{ + FOREACH_HumanPlayer( pn ) + if( !DescribesCurrentMode(pn) ) + return false; + + return true; +} + +bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const +{ + if( m_pm != PlayMode_Invalid && GAMESTATE->m_PlayMode != m_pm ) + return false; + if( m_pStyle && GAMESTATE->GetCurrentStyle() != m_pStyle ) + return false; + // HACK: don't compare m_dc if m_pSteps is set. This causes problems + // in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty + // doesn't match the difficulty of m_pCurSteps. + if( m_pSteps == NULL && m_dc != Difficulty_Invalid ) + { + // Why is this checking for all players? + FOREACH_HumanPlayer( human ) + if( GAMESTATE->m_PreferredDifficulty[human] != m_dc ) + return false; + } + + if( m_sAnnouncer != "" && m_sAnnouncer != ANNOUNCER->GetCurAnnouncerName() ) + return false; + + if( m_sPreferredModifiers != "" ) + { + PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + SongOptions so = GAMESTATE->m_SongOptions.GetPreferred(); + po.FromString( m_sPreferredModifiers ); + so.FromString( m_sPreferredModifiers ); + + if( po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred() ) + return false; + if( so != GAMESTATE->m_SongOptions.GetPreferred() ) + return false; + } + if( m_sStageModifiers != "" ) + { + PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage(); + SongOptions so = GAMESTATE->m_SongOptions.GetStage(); + po.FromString( m_sStageModifiers ); + so.FromString( m_sStageModifiers ); + + if( po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage() ) + return false; + if( so != GAMESTATE->m_SongOptions.GetStage() ) + return false; + } + + if( m_pSong && GAMESTATE->m_pCurSong.Get() != m_pSong ) + return false; + if( m_pSteps && GAMESTATE->m_pCurSteps[pn].Get() != m_pSteps ) + return false; + if( m_pCharacter && GAMESTATE->m_pCurCharacters[pn] != m_pCharacter ) + return false; + if( m_pCourse && GAMESTATE->m_pCurCourse.Get() != m_pCourse ) + return false; + if( m_pTrail && GAMESTATE->m_pCurTrail[pn].Get() != m_pTrail ) + return false; + if( !m_sSongGroup.empty() && GAMESTATE->m_sPreferredSongGroup != m_sSongGroup ) + return false; + if( m_SortOrder != SortOrder_Invalid && GAMESTATE->m_PreferredSortOrder != m_SortOrder ) + return false; + if( m_iWeightPounds != -1 && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds ) + return false; + if( m_iGoalCalories != -1 && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories ) + return false; + if( m_GoalType != GoalType_Invalid && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType ) + return false; + if( !m_sProfileID.empty() && ProfileManager::m_sDefaultLocalProfileID[pn].Get() != m_sProfileID ) + return false; + + return true; +} + +void GameCommand::Load( int iIndex, const Commands& cmds ) +{ + m_iIndex = iIndex; + m_bInvalid = false; + m_Commands = cmds; + + FOREACH_CONST( Command, cmds.v, cmd ) + LoadOne( *cmd ); +} + +void GameCommand::LoadOne( const Command& cmd ) +{ + RString sName = cmd.GetName(); + if( sName.empty() ) + return; + + RString sValue; + for( unsigned i = 1; i < cmd.m_vsArgs.size(); ++i ) + { + if( i > 1 ) + sValue += ","; + sValue += cmd.m_vsArgs[i]; + } + + if( sName == "style" ) + { + const Style* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_pCurGame, sValue ); + if( style ) + m_pStyle = style; + else + m_bInvalid = true; + } + + else if( sName == "playmode" ) + { + PlayMode pm = StringToPlayMode( sValue ); + if( pm != PlayMode_Invalid ) + m_pm = pm; + else + m_bInvalid = true; + } + + else if( sName == "difficulty" ) + { + Difficulty dc = StringToDifficulty( sValue ); + if( dc != Difficulty_Invalid ) + m_dc = dc; + else + m_bInvalid = true; + } + + else if( sName == "announcer" ) + { + m_sAnnouncer = sValue; + } + + else if( sName == "name" ) + { + m_sName = sValue; + } + + else if( sName == "text" ) + { + m_sText = sValue; + } + + else if( sName == "mod" ) + { + if( m_sPreferredModifiers != "" ) + m_sPreferredModifiers += ","; + m_sPreferredModifiers += sValue; + } + + else if( sName == "stagemod" ) + { + if( m_sStageModifiers != "" ) + m_sStageModifiers += ","; + m_sStageModifiers += sValue; + } + + else if( sName == "lua" ) + { + m_LuaFunction.SetFromExpression( sValue ); + ASSERT_M( !m_LuaFunction.IsNil(), ssprintf("\"%s\" evaluated to nil", sValue.c_str()) ); + } + + else if( sName == "screen" ) + { + m_sScreen = sValue; + } + + else if( sName == "song" ) + { + m_pSong = SONGMAN->FindSong( sValue ); + if( m_pSong == NULL ) + { + m_sInvalidReason = ssprintf( "Song \"%s\" not found", sValue.c_str() ); + m_bInvalid |= true; + } + } + + else if( sName == "steps" ) + { + RString sSteps = sValue; + + // This must be processed after "song" and "style" commands. + if( !m_bInvalid ) + { + Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong; + const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); + if( pSong == NULL || pStyle == NULL ) + RageException::Throw( "Must set Song and Style to set Steps." ); + + Difficulty dc = StringToDifficulty( sSteps ); + if( dc != Difficulty_Edit ) + m_pSteps = SongUtil::GetStepsByDifficulty( pSong, pStyle->m_StepsType, dc ); + else + m_pSteps = SongUtil::GetStepsByDescription( pSong, pStyle->m_StepsType, sSteps ); + if( m_pSteps == NULL ) + { + m_sInvalidReason = "steps not found"; + m_bInvalid |= true; + } + } + } + + else if( sName == "course" ) + { + m_pCourse = SONGMAN->FindCourse( "", sValue ); + if( m_pCourse == NULL ) + { + m_sInvalidReason = ssprintf( "Course \"%s\" not found", sValue.c_str() ); + m_bInvalid |= true; + } + } + + else if( sName == "trail" ) + { + RString sTrail = sValue; + + // This must be processed after "course" and "style" commands. + if( !m_bInvalid ) + { + Course *pCourse = (m_pCourse != NULL)? m_pCourse:GAMESTATE->m_pCurCourse; + const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->GetCurrentStyle(); + if( pCourse == NULL || pStyle == NULL ) + RageException::Throw( "Must set Course and Style to set Steps." ); + + const CourseDifficulty cd = StringToDifficulty( sTrail ); + ASSERT_M( cd != Difficulty_Invalid, ssprintf("Invalid difficulty '%s'", sTrail.c_str()) ); + + m_pTrail = pCourse->GetTrail( pStyle->m_StepsType, cd ); + if( m_pTrail == NULL ) + { + m_sInvalidReason = "trail not found"; + m_bInvalid |= true; + } + } + } + + else if( sName == "setenv" ) + { + if( cmd.m_vsArgs.size() == 3 ) + m_SetEnv[ cmd.m_vsArgs[1] ] = cmd.m_vsArgs[2]; + } + + else if( sName == "songgroup" ) + { + m_sSongGroup = sValue; + } + + else if( sName == "sort" ) + { + m_SortOrder = StringToSortOrder( sValue ); + if( m_SortOrder == SortOrder_Invalid ) + { + m_sInvalidReason = ssprintf( "SortOrder \"%s\" is not valid.", sValue.c_str() ); + m_bInvalid |= true; + } + } + + else if( sName == "weight" ) + { + m_iWeightPounds = atoi( sValue ); + } + + else if( sName == "goalcalories" ) + { + m_iGoalCalories = atoi( sValue ); + } + + else if( sName == "goaltype" ) + { + m_GoalType = StringToGoalType( sValue ); + } + + else if( sName == "profileid" ) + { + m_sProfileID = sValue; + } + + else if( sName == "url" ) + { + m_sUrl = sValue; + m_bUrlExits = true; + } + + else if( sName == "sound" ) + { + m_sSoundPath = sValue; + } + + else if( sName == "preparescreen" ) + { + m_vsScreensToPrepare.push_back( sValue ); + } + + else if( sName == "insertcredit" ) + { + m_bInsertCredit = true; + } + + else if( sName == "clearcredits" ) + { + m_bClearCredits = true; + } + + else if( sName == "stopmusic" ) + { + m_bStopMusic = true; + } + + else if( sName == "applydefaultoptions" ) + { + m_bApplyDefaultOptions = true; + } + + // sm-ssc additions begin: + else if( sName == "urlnoexit" ) + { + m_sUrl = sValue; + m_bUrlExits = false; + } + + else if( sName == "setpref" ) + { + if( cmd.m_vsArgs.size() == 3 ) + { + IPreference *pPref = IPreference::GetPreferenceByName( cmd.m_vsArgs[1] ); + if( pPref == NULL ) + { + m_sInvalidReason = ssprintf("unknown preference \"%s\"", cmd.m_vsArgs[1].c_str() ); + m_bInvalid |= true; + } + pPref->FromString(cmd.m_vsArgs[2]); + } + } + + else if( sName == "fademusic" ) + { + if( cmd.m_vsArgs.size() == 3 ) + { + m_bFadeMusic = true; + m_fMusicFadeOutVolume = atof( cmd.m_vsArgs[1] ); + m_fMusicFadeOutSeconds = atof( cmd.m_vsArgs[2] ); + } + } + + else + { + RString sWarning = ssprintf( "Command '%s' is not valid.", cmd.GetOriginalCommandString().c_str() ); + LOG->Warn( "%s", sWarning.c_str() ); + Dialog::OK( sWarning, "INVALID_GAME_COMMAND" ); + } +} + +int GetNumCreditsPaid() +{ + int iNumCreditsPaid = GAMESTATE->GetNumSidesJoined(); + + // players other than the first joined for free + if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit ) + iNumCreditsPaid = min( iNumCreditsPaid, 1 ); + + return iNumCreditsPaid; +} + + +int GetCreditsRequiredToPlayStyle( const Style *style ) +{ + if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit ) + return 1; + + switch( style->m_StyleType ) + { + case StyleType_OnePlayerOneSide: + return 1; + case StyleType_TwoPlayersSharedSides: + case StyleType_TwoPlayersTwoSides: + return 2; + case StyleType_OnePlayerTwoSides: + return (GAMESTATE->GetPremium() == Premium_DoubleFor1Credit) ? 1 : 2; + DEFAULT_FAIL( style->m_StyleType ); + } +} + +static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm ) +{ + if( style == NULL || pm == PlayMode_Invalid ) + return true; + + switch( pm ) + { + case PLAY_MODE_BATTLE: + case PLAY_MODE_RAVE: + // Can't play rave if there isn't enough room for two players. + // This is correct for dance (ie, no rave for solo and doubles), + // and should be okay for pump.. not sure about other game types. + // Techno Motion scales down versus arrows, though, so allow this. + if( style->m_iColsPerPlayer >= 6 && RString(GAMESTATE->m_pCurGame->m_szName) != "techno" ) + return false; + + // Don't allow battle modes if the style takes both sides. + if( style->m_StyleType==StyleType_OnePlayerTwoSides || + style->m_StyleType==StyleType_TwoPlayersSharedSides ) + return false; + } + + return true; +} + +bool GameCommand::IsPlayable( RString *why ) const +{ + if( m_bInvalid ) + { + if( why ) + *why = m_sInvalidReason; + return false; + } + + if ( m_pStyle ) + { + int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit; + const int iNumCreditsPaid = GetNumCreditsPaid(); + const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle); + + switch( GAMESTATE->GetCoinMode() ) + { + case CoinMode_Home: + case CoinMode_Free: + iCredits = NUM_PLAYERS; // not iNumCreditsPaid + } + + /* With PREFSMAN->m_bDelayedCreditsReconcile disabled, enough credits must + * be paid. (This means that enough sides must be joined.) Enabled, simply + * having enough credits lying in the machine is sufficient; we'll deduct the + * extra in Apply(). */ + int iNumCreditsAvailable = iNumCreditsPaid; + if( PREFSMAN->m_bDelayedCreditsReconcile ) + iNumCreditsAvailable += iCredits; + + if( iNumCreditsAvailable < iNumCreditsRequired ) + { + if( why ) + *why = ssprintf( "need %i credits, have %i", iNumCreditsRequired, iNumCreditsAvailable ); + return false; + } + + /* If you've paid too much already, don't allow the mode. (If we allow this, + * the credits will be "refunded" in Apply(), but that's confusing.) */ + /* Do allow the mode if they've already joined in more credits than + * are required. Otherwise, people who put in two credits to play + * doubles on a doubles-premium machiune will get locked out. + * the refund logic isn't that awkward because you never see the + * credits number jump up - the credits display is hidden if both + * sides are joined. -Chris */ + /* + if( PREFSMAN->m_iCoinMode == COIN_PAY && iNumCreditsPaid > iNumCreditsRequired ) + { + if( why ) + *why = ssprintf( "too many credits paid (%i > %i)", iNumCreditsPaid, iNumCreditsRequired ); + return false; + } + */ + + /* If both sides are joined, disallow singles modes, since easy to select + * them accidentally, instead of versus mode. */ + if( m_pStyle->m_StyleType == StyleType_OnePlayerOneSide && + GAMESTATE->GetNumSidesJoined() > 1 ) + { + if( why ) + *why = "too many players joined for ONE_PLAYER_ONE_CREDIT"; + return false; + } + } + + /* Don't allow a PlayMode that's incompatible with our current Style (if set), + * and vice versa. */ + if( m_pm != PlayMode_Invalid || m_pStyle != NULL ) + { + const PlayMode pm = (m_pm != PlayMode_Invalid) ? m_pm : GAMESTATE->m_PlayMode; + const Style *style = (m_pStyle != NULL)? m_pStyle: GAMESTATE->GetCurrentStyle(); + if( !AreStyleAndPlayModeCompatible( style, pm ) ) + { + if( why ) + *why = ssprintf("mode %s is incompatible with style %s", + PlayModeToString(pm).c_str(), style->m_szName ); + + return false; + } + } + + if( !m_sScreen.CompareNoCase("ScreenEditCoursesMenu") ) + { + vector vCourses; + SONGMAN->GetAllCourses( vCourses, false ); + + if( vCourses.size() == 0 ) + { + if( why ) + *why = "No courses are installed"; + return false; + } + } + + if( (!m_sScreen.CompareNoCase("ScreenJukeboxMenu") || + !m_sScreen.CompareNoCase("ScreenEditMenu") || + !m_sScreen.CompareNoCase("ScreenEditCoursesMenu")) ) + { + if( SONGMAN->GetNumSongs() == 0 ) + { + if( why ) + *why = "No songs are installed"; + return false; + } + } + + if( !m_sPreferredModifiers.empty() ) + { + // TODO: Split this and check each modifier individually + if( UNLOCKMAN->ModifierIsLocked(m_sPreferredModifiers) ) + { if( why ) + *why = "Modifier is locked"; + return false; + } + } + + if( !m_sStageModifiers.empty() ) + { + // TODO: Split this and check each modifier individually + if( UNLOCKMAN->ModifierIsLocked(m_sStageModifiers) ) + { if( why ) + *why = "Modifier is locked"; + return false; + } + } + + return true; +} + +void GameCommand::ApplyToAllPlayers() const +{ + vector vpns; + + FOREACH_PlayerNumber( pn ) + vpns.push_back( pn ); + + Apply( vpns ); +} + +void GameCommand::Apply( PlayerNumber pn ) const +{ + vector vpns; + vpns.push_back( pn ); + Apply( vpns ); +} + +void GameCommand::Apply( const vector &vpns ) const +{ + if( m_Commands.v.size() ) + { + // We were filled using a GameCommand from metrics. Apply the options in order. + FOREACH_CONST( Command, m_Commands.v, cmd ) + { + GameCommand gc; + gc.m_bInvalid = false; + gc.m_bApplyCommitsScreens = m_bApplyCommitsScreens; + gc.LoadOne( *cmd ); + gc.ApplySelf( vpns ); + } + } + else + { + // We were filled by an OptionRowHandler in code. m_Commands isn't filled, + // so just apply the values that are already set in this. + this->ApplySelf( vpns ); + } +} + +void GameCommand::ApplySelf( const vector &vpns ) const +{ + const PlayMode OldPlayMode = GAMESTATE->m_PlayMode; + + if( m_pm != PlayMode_Invalid ) + GAMESTATE->m_PlayMode.Set( m_pm ); + + if( m_pStyle != NULL ) + { + GAMESTATE->SetCurrentStyle( m_pStyle ); + + // It's possible to choose a style that didn't have enough players joined. + // If enough players aren't joined, then we need to subtract credits + // for the sides that will be joined as a result of applying this option. + if( GAMESTATE->GetCoinMode() == CoinMode_Pay ) + { + int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle); + int iNumCreditsPaid = GetNumCreditsPaid(); + int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid; + GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins - iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit ); + LOG->Trace( "Deducted %i coins, %i remaining", + iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit, GAMESTATE->m_iCoins.Get() ); + } + + // If only one side is joined and we picked a style that requires both + // sides, join the other side. + switch( m_pStyle->m_StyleType ) + { + case StyleType_OnePlayerOneSide: + break; + case StyleType_TwoPlayersTwoSides: + case StyleType_OnePlayerTwoSides: + case StyleType_TwoPlayersSharedSides: + { + FOREACH_PlayerNumber( p ) + GAMESTATE->JoinPlayer( p ); + } + break; + default: + ASSERT(0); + } + } + if( m_dc != Difficulty_Invalid ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->m_PreferredDifficulty[*pn].Set( m_dc ); + if( m_sAnnouncer != "" ) + ANNOUNCER->SwitchAnnouncer( m_sAnnouncer ); + if( m_sPreferredModifiers != "" ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->ApplyPreferredModifiers( *pn, m_sPreferredModifiers ); + if( m_sStageModifiers != "" ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->ApplyStageModifiers( *pn, m_sStageModifiers ); + if( m_LuaFunction.IsSet() ) + { + Lua *L = LUA->Get(); + FOREACH_CONST( PlayerNumber, vpns, pn ) + { + m_LuaFunction.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + + lua_pushnumber( L, *pn ); // 1st parameter + lua_call( L, 1, 0 ); // call function with 1 argument and 0 results + } + LUA->Release(L); + } + if( m_sScreen != "" && m_bApplyCommitsScreens ) + SCREENMAN->SetNewScreen( m_sScreen ); + if( m_pSong ) + { + GAMESTATE->m_pCurSong.Set( m_pSong ); + GAMESTATE->m_pPreferredSong = m_pSong; + } + if( m_pSteps ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->m_pCurSteps[*pn].Set( m_pSteps ); + if( m_pCourse ) + { + GAMESTATE->m_pCurCourse.Set( m_pCourse ); + GAMESTATE->m_pPreferredCourse = m_pCourse; + } + if( m_pTrail ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->m_pCurTrail[*pn].Set( m_pTrail ); + if( m_CourseDifficulty != Difficulty_Invalid ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->ChangePreferredCourseDifficulty( *pn, m_CourseDifficulty ); + if( m_pCharacter ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->m_pCurCharacters[*pn] = m_pCharacter; + for( map::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ ) + { + Lua *L = LUA->Get(); + GAMESTATE->m_Environment->PushSelf(L); + lua_pushstring( L, i->first ); + lua_pushstring( L, i->second ); + lua_settable( L, -3 ); + lua_pop( L, 1 ); + LUA->Release(L); + } + if( !m_sSongGroup.empty() ) + GAMESTATE->m_sPreferredSongGroup.Set( m_sSongGroup ); + if( m_SortOrder != SortOrder_Invalid ) + GAMESTATE->m_PreferredSortOrder = m_SortOrder; + if( m_sSoundPath != "" ) + SOUND->PlayOnce( THEME->GetPathS( "", m_sSoundPath ) ); + if( m_iWeightPounds != -1 ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds; + if( m_iGoalCalories != -1 ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories; + if( m_GoalType != GoalType_Invalid ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType; + if( !m_sProfileID.empty() ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + ProfileManager::m_sDefaultLocalProfileID[*pn].Set( m_sProfileID ); + if( !m_sUrl.empty() ) + { + if( HOOKS->GoToURL( m_sUrl ) ) + { + if( m_bUrlExits ) + SCREENMAN->SetNewScreen( "ScreenExit" ); + } + else + ScreenPrompt::Prompt( SM_None, COULD_NOT_LAUNCH_BROWSER ); + } + + /* If we're going to stop music, do so before preparing new screens, so we + * don't stop music between preparing screens and loading screens. */ + if( m_bStopMusic ) + SOUND->StopMusic(); + if( m_bFadeMusic ) + SOUND->DimMusic(m_fMusicFadeOutVolume, m_fMusicFadeOutSeconds); + + FOREACH_CONST( RString, m_vsScreensToPrepare, s ) + SCREENMAN->PrepareScreen( *s ); + + if( m_bInsertCredit ) + { + StepMania::InsertCredit(); + } + + if( m_bClearCredits ) + StepMania::ClearCredits(); + + if( m_bApplyDefaultOptions ) + { + // applying options affects only the current stage + FOREACH_PlayerNumber( p ) + { + PlayerOptions po; + GAMESTATE->GetDefaultPlayerOptions( po ); + GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Assign( ModsLevel_Stage, po ); + } + + SongOptions so; + GAMESTATE->GetDefaultSongOptions( so ); + GAMESTATE->m_SongOptions.Assign( ModsLevel_Stage, so ); + } + // HACK: Set life type to BATTERY just once here so it happens once and + // we don't override the user's changes if they back out. + if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI && + GAMESTATE->m_PlayMode != OldPlayMode && + GAMESTATE->m_SongOptions.GetStage().m_LifeType == SongOptions::LIFE_BAR ) + { + SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_LifeType, SongOptions::LIFE_BATTERY ); + } +} + +bool GameCommand::IsZero() const +{ + if( m_pm != PlayMode_Invalid || + m_pStyle != NULL || + m_dc != Difficulty_Invalid || + m_sAnnouncer != "" || + m_sPreferredModifiers != "" || + m_sStageModifiers != "" || + m_pSong != NULL || + m_pSteps != NULL || + m_pCourse != NULL || + m_pTrail != NULL || + m_pCharacter != NULL || + m_CourseDifficulty != Difficulty_Invalid || + !m_sSongGroup.empty() || + m_SortOrder != SortOrder_Invalid || + m_iWeightPounds != -1 || + m_iGoalCalories != -1 || + m_GoalType != GoalType_Invalid || + !m_sProfileID.empty() || + !m_sUrl.empty() ) + return false; + + return true; +} + +// lua start +#include "LuaBinding.h" +#include "Game.h" +#include "Steps.h" +#include "Character.h" + +/** @brief Allow Lua to have access to the GameCommand. */ +class LunaGameCommand: public Luna +{ +public: + static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sName ); return 1; } + static int GetText( T* p, lua_State *L ) { lua_pushstring(L, p->m_sText ); return 1; } + static int GetIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iIndex ); return 1; } + static int GetMultiPlayer( T* p, lua_State *L ) { lua_pushnumber(L, p->m_MultiPlayer); return 1; } + static int GetStyle( T* p, lua_State *L ) { if(p->m_pStyle==NULL) lua_pushnil(L); else {Style *pStyle = (Style*)p->m_pStyle; pStyle->PushSelf(L);} return 1; } + static int GetScreen( T* p, lua_State *L ) { lua_pushstring(L, p->m_sScreen ); return 1; } + static int GetProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sProfileID ); return 1; } + static int GetSong( T* p, lua_State *L ) { if(p->m_pSong==NULL) lua_pushnil(L); else p->m_pSong->PushSelf(L); return 1; } + static int GetSteps( T* p, lua_State *L ) { if(p->m_pSteps==NULL) lua_pushnil(L); else p->m_pSteps->PushSelf(L); return 1; } + static int GetCourse( T* p, lua_State *L ) { if(p->m_pCourse==NULL) lua_pushnil(L); else p->m_pCourse->PushSelf(L); return 1; } + static int GetTrail( T* p, lua_State *L ) { if(p->m_pTrail==NULL) lua_pushnil(L); else p->m_pTrail->PushSelf(L); return 1; } + static int GetCharacter( T* p, lua_State *L ) { if(p->m_pCharacter==NULL) lua_pushnil(L); else p->m_pCharacter->PushSelf(L); return 1; } + static int GetSongGroup( T* p, lua_State *L ) { lua_pushstring(L, p->m_sSongGroup ); return 1; } + static int GetUrl( T* p, lua_State *L ) { lua_pushstring(L, p->m_sUrl ); return 1; } + + LunaGameCommand() + { + ADD_METHOD( GetName ); + ADD_METHOD( GetText ); + ADD_METHOD( GetIndex ); + ADD_METHOD( GetMultiPlayer ); + ADD_METHOD( GetStyle ); + //ADD_METHOD( GetDifficulty ); + //ADD_METHOD( GetCourseDifficulty ); + ADD_METHOD( GetScreen ); + //ADD_METHOD( GetPlayMode ); + ADD_METHOD( GetProfileID ); + ADD_METHOD( GetSong ); + ADD_METHOD( GetSteps ); + ADD_METHOD( GetCourse ); + ADD_METHOD( GetTrail ); + ADD_METHOD( GetCharacter ); + ADD_METHOD( GetSongGroup ); + //ADD_METHOD( GetSortOrder ); + ADD_METHOD( GetUrl ); + } +}; + +LUA_REGISTER_CLASS( GameCommand ) +// lua end + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameCommand.h b/src/GameCommand.h index 0566d9d458..f04f97da6f 100644 --- a/src/GameCommand.h +++ b/src/GameCommand.h @@ -1,131 +1,131 @@ -/* GameCommand */ - -#ifndef GameCommand_H -#define GameCommand_H - -#include "GameConstantsAndTypes.h" -#include "PlayerNumber.h" -#include "Difficulty.h" -#include "LuaReference.h" -#include "Command.h" -#include - -class Song; -class Steps; -class Course; -class Trail; -class Character; -class Style; -class Game; -struct lua_State; - -class GameCommand -{ -public: - GameCommand() { Init(); } - void Init(); - - void Load( int iIndex, const Commands& cmds ); - void LoadOne( const Command& cmd ); - - void ApplyToAllPlayers() const; - void Apply( PlayerNumber pn ) const; -private: - void Apply( const vector &vpns ) const; - void ApplySelf( const vector &vpns ) const; -public: - - bool DescribesCurrentMode( PlayerNumber pn ) const; - bool DescribesCurrentModeForAllPlayers() const; - bool IsPlayable( RString *why = NULL ) const; - bool IsZero() const; - - /* If true, Apply() will apply m_sScreen. If false, it won't, and you need - * to do it yourself. */ - void ApplyCommitsScreens( bool bOn ) { m_bApplyCommitsScreens = bOn; } - - // Same as what was passed to Load. We need to keep the original commands - // so that we know the order of commands when it comes time to Apply. - Commands m_Commands; - - RString m_sName; // choice name - RString m_sText; // display text - bool m_bInvalid; - RString m_sInvalidReason; - int m_iIndex; - MultiPlayer m_MultiPlayer; - const Style* m_pStyle; - PlayMode m_pm; - Difficulty m_dc; - CourseDifficulty m_CourseDifficulty; - RString m_sAnnouncer; - RString m_sPreferredModifiers; - RString m_sStageModifiers; - RString m_sScreen; - LuaReference m_LuaFunction; - Song* m_pSong; - Steps* m_pSteps; - Course* m_pCourse; - Trail* m_pTrail; - Character* m_pCharacter; - std::map m_SetEnv; - RString m_sSongGroup; - SortOrder m_SortOrder; - RString m_sSoundPath; // "" for no sound - vector m_vsScreensToPrepare; - /** - * @brief What is the player's weight in pounds? - * - * If this value is -1, then no weight was specified. */ - int m_iWeightPounds; - int m_iGoalCalories; // -1 == none specified - GoalType m_GoalType; - RString m_sProfileID; - RString m_sUrl; - // sm-ssc adds: - bool m_bUrlExits; // for making stepmania not exit on url - - bool m_bInsertCredit; - bool m_bClearCredits; - bool m_bStopMusic; - bool m_bApplyDefaultOptions; - // sm-ssc also adds: - bool m_bFadeMusic; - float m_fMusicFadeOutVolume; - // currently, GameSoundManager uses consts for fade out/in times, so this - // is kind of pointless, but I want to have it working eventually. -aj - float m_fMusicFadeOutSeconds; - - // Lua - void PushSelf( lua_State *L ); - -private: - bool m_bApplyCommitsScreens; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* GameCommand */ + +#ifndef GameCommand_H +#define GameCommand_H + +#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" +#include "Difficulty.h" +#include "LuaReference.h" +#include "Command.h" +#include + +class Song; +class Steps; +class Course; +class Trail; +class Character; +class Style; +class Game; +struct lua_State; + +class GameCommand +{ +public: + GameCommand() { Init(); } + void Init(); + + void Load( int iIndex, const Commands& cmds ); + void LoadOne( const Command& cmd ); + + void ApplyToAllPlayers() const; + void Apply( PlayerNumber pn ) const; +private: + void Apply( const vector &vpns ) const; + void ApplySelf( const vector &vpns ) const; +public: + + bool DescribesCurrentMode( PlayerNumber pn ) const; + bool DescribesCurrentModeForAllPlayers() const; + bool IsPlayable( RString *why = NULL ) const; + bool IsZero() const; + + /* If true, Apply() will apply m_sScreen. If false, it won't, and you need + * to do it yourself. */ + void ApplyCommitsScreens( bool bOn ) { m_bApplyCommitsScreens = bOn; } + + // Same as what was passed to Load. We need to keep the original commands + // so that we know the order of commands when it comes time to Apply. + Commands m_Commands; + + RString m_sName; // choice name + RString m_sText; // display text + bool m_bInvalid; + RString m_sInvalidReason; + int m_iIndex; + MultiPlayer m_MultiPlayer; + const Style* m_pStyle; + PlayMode m_pm; + Difficulty m_dc; + CourseDifficulty m_CourseDifficulty; + RString m_sAnnouncer; + RString m_sPreferredModifiers; + RString m_sStageModifiers; + RString m_sScreen; + LuaReference m_LuaFunction; + Song* m_pSong; + Steps* m_pSteps; + Course* m_pCourse; + Trail* m_pTrail; + Character* m_pCharacter; + std::map m_SetEnv; + RString m_sSongGroup; + SortOrder m_SortOrder; + RString m_sSoundPath; // "" for no sound + vector m_vsScreensToPrepare; + /** + * @brief What is the player's weight in pounds? + * + * If this value is -1, then no weight was specified. */ + int m_iWeightPounds; + int m_iGoalCalories; // -1 == none specified + GoalType m_GoalType; + RString m_sProfileID; + RString m_sUrl; + // sm-ssc adds: + bool m_bUrlExits; // for making stepmania not exit on url + + bool m_bInsertCredit; + bool m_bClearCredits; + bool m_bStopMusic; + bool m_bApplyDefaultOptions; + // sm-ssc also adds: + bool m_bFadeMusic; + float m_fMusicFadeOutVolume; + // currently, GameSoundManager uses consts for fade out/in times, so this + // is kind of pointless, but I want to have it working eventually. -aj + float m_fMusicFadeOutSeconds; + + // Lua + void PushSelf( lua_State *L ); + +private: + bool m_bApplyCommitsScreens; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index a5bcb68002..e1cbb161e4 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -1,502 +1,502 @@ -#include "global.h" -#include "GameConstantsAndTypes.h" -#include "GameState.h" -#include "RageUtil.h" -#include "ThemeMetric.h" -#include "EnumHelper.h" -#include "Foreach.h" -#include "LuaManager.h" -#include "GameManager.h" -#include "LocalizedString.h" -#include "PlayerNumber.h" -#include - - -static vector GenerateRankingToFillInMarker() -{ - vector vRankings; - FOREACH_ENUM( PlayerNumber, pn ) - vRankings.push_back( ssprintf("#P%d#", pn+1) ); - return vRankings; -} -extern const vector RANKING_TO_FILL_IN_MARKER( GenerateRankingToFillInMarker() ); - -extern const RString GROUP_ALL = "---Group All---"; - -static const char *RadarCategoryNames[] = { - "Stream", - "Voltage", - "Air", - "Freeze", - "Chaos", - "TapsAndHolds", - "Jumps", - "Holds", - "Mines", - "Hands", - "Rolls", - "Lifts", - "Fakes", -}; -XToString( RadarCategory ); -XToLocalizedString( RadarCategory ); -LuaFunction( RadarCategoryToLocalizedString, RadarCategoryToLocalizedString(Enum::Check(L, 1)) ); -LuaXType( RadarCategory ); - -RString StepsTypeToString( StepsType st ) -{ - RString s = GAMEMAN->GetStepsTypeInfo( st ).szName; // "dance-single" - /* foo-bar -> Foo_Bar */ - s.Replace('-','_'); - - bool bCapitalizeNextLetter = true; - for( int i=0; i<(int)s.length(); i++ ) - { - if( bCapitalizeNextLetter ) - { - s[i] = toupper(s[i]); - bCapitalizeNextLetter = false; - } - - if( s[i] == '_' ) - bCapitalizeNextLetter = true; - } - - return s; -} -namespace StringConversion { template<> RString ToString( const StepsType &value ) { return StepsTypeToString(value); } } - -LuaXType( StepsType ); - - -static const char *PlayModeNames[] = { - "Regular", - "Nonstop", - "Oni", - "Endless", - "Battle", - "Rave", -}; -XToString( PlayMode ); -XToLocalizedString( PlayMode ); -StringToX( PlayMode ); -LuaFunction( PlayModeToLocalizedString, PlayModeToLocalizedString(Enum::Check(L, 1)) ); -LuaXType( PlayMode ); - -RankingCategory AverageMeterToRankingCategory( int iAverageMeter ) -{ - if( iAverageMeter <= 3 ) return RANKING_A; - else if( iAverageMeter <= 6 ) return RANKING_B; - else if( iAverageMeter <= 9 ) return RANKING_C; - else return RANKING_D; -} - - -static const char *RankingCategoryNames[] = { - "a", - "b", - "c", - "d", -}; -XToString( RankingCategory ); -StringToX( RankingCategory ); - - -static const char *PlayerControllerNames[] = { - "Human", - "Autoplay", - "Cpu", - //"Replay", -}; -XToString( PlayerController ); -StringToX( PlayerController ); -XToLocalizedString( PlayerController ); -LuaXType( PlayerController ); - - -static const char *HealthStateNames[] = { - "Hot", - "Alive", - "Danger", - "Dead", -}; -XToString( HealthState ); -LuaXType( HealthState ); - - -static const char *CoinModeNames[] = { - "Home", - "Pay", - "Free", -}; -XToString( CoinMode ); -StringToX( CoinMode ); -LuaXType( CoinMode ); - - -static const char *PremiumNames[] = { - "Off", - "DoubleFor1Credit", - "2PlayersFor1Credit", -}; -XToString( Premium ); -StringToX( Premium ); -XToLocalizedString( Premium ); -LuaXType( Premium ); - - -static const char *SortOrderNames[] = { - "Preferred", - "Group", - "Title", - "BPM", - "Popularity", - "TopGrades", - "Artist", - "Genre", - "BeginnerMeter", - "EasyMeter", - "MediumMeter", - "HardMeter", - "ChallengeMeter", - "DoubleEasyMeter", - "DoubleMediumMeter", - "DoubleHardMeter", - "DoubleChallengeMeter", - "ModeMenu", - "AllCourses", - "Nonstop", - "Oni", - "Endless", - "Length", - "Roulette", - "Recent", -}; -XToString( SortOrder ); -StringToX( SortOrder ); -LuaXType( SortOrder ); -XToLocalizedString( SortOrder ); -LuaFunction( SortOrderToLocalizedString, SortOrderToLocalizedString(Enum::Check(L, 1)) ); - - -static const char *TapNoteScoreNames[] = { - "None", - "HitMine", - "AvoidMine", - "CheckpointMiss", - "Miss", - "W5", - "W4", - "W3", - "W2", - "W1", - "CheckpointHit", -}; -XToString( TapNoteScore ); -LuaXType( TapNoteScore ); -TapNoteScore StringToTapNoteScore( const RString &s ) -{ - // new style - if ( s == "None" ) return TNS_None; - else if( s == "HitMine" ) return TNS_HitMine; - else if( s == "AvoidMine" ) return TNS_AvoidMine; - else if( s == "CheckpointHit" ) return TNS_CheckpointHit; - else if( s == "CheckpointMiss" )return TNS_CheckpointMiss; - else if( s == "Miss" ) return TNS_Miss; - else if( s == "W5" ) return TNS_W5; - else if( s == "W4" ) return TNS_W4; - else if( s == "W3" ) return TNS_W3; - else if( s == "W2" ) return TNS_W2; - else if( s == "W1" ) return TNS_W1; - - // for backward compatibility - else if( s == "Boo" ) return TNS_W5; - else if( s == "Good" ) return TNS_W4; - else if( s == "Great" ) return TNS_W3; - else if( s == "Perfect" ) return TNS_W2; - else if( s == "Marvelous" ) return TNS_W1; - - return TapNoteScore_Invalid; -} -XToLocalizedString( TapNoteScore ); -LuaFunction( TapNoteScoreToLocalizedString, TapNoteScoreToLocalizedString(Enum::Check(L, 1)) ); - - -static const char *HoldNoteScoreNames[] = { - "None", - "LetGo", - "Held", -}; -XToString( HoldNoteScore ); -LuaXType( HoldNoteScore ); -HoldNoteScore StringToHoldNoteScore( const RString &s ) -{ - // for backward compatibility - if ( s == "NG" ) return HNS_LetGo; - else if( s == "OK" ) return HNS_Held; - - // new style - else if( s == "None" ) return HNS_None; - else if( s == "LetGo" ) return HNS_LetGo; - else if( s == "Held" ) return HNS_Held; - - return HoldNoteScore_Invalid; -} -XToLocalizedString( HoldNoteScore ); - -static const char *TimingWindowNames[] = { - "W1", - "W2", - "W3", - "W4", - "W5", - "Mine", - "Attack", - "Hold", - "Roll", -}; -XToString( TimingWindow ); - -static const char *ScoreEventNames[] = { - "CheckpointHit", - "W1", - "W2", - "W3", - "W4", - "W5", - "Miss", - "HitMine", - "CheckpointMiss", - "Held", - "LetGo", -}; -XToString( ScoreEvent ); - -static const char *TapNoteScoreJudgeTypeNames[] = { - "MinimumScore", - "LastScore", -}; -XToString( TapNoteScoreJudgeType ); -LuaXType( TapNoteScoreJudgeType ); - -static const char *ProfileSlotNames[] = { - "Player1", - "Player2", - "Machine", -}; -XToString( ProfileSlot ); -LuaXType( ProfileSlot ); - -static const char *MemoryCardStateNames[] = { - "ready", - "checking", - "late", - "error", - "removed", - "none", -}; -XToString( MemoryCardState ); -LuaXType( MemoryCardState ); - -static const char *StageAwardNames[] = { - "FullComboW3", - "SingleDigitW3", - "OneW3", - "FullComboW2", - "SingleDigitW2", - "OneW2", - "FullComboW1", - "80PercentW3", - "90PercentW3", - "100PercentW3", -}; -XToString( StageAward ); -XToLocalizedString( StageAward ); -StringToX( StageAward ); -LuaFunction( StageAwardToLocalizedString, StageAwardToLocalizedString(Enum::Check(L, 1)) ); -LuaXType( StageAward ); - -// Numbers are intentionally not at the front of these strings so that the -// strings can be used as XML entity names. -// Numbers are intentionally not at the back so that "1000" and "10000" don't -// conflict when searching for theme elements. -static const char *PeakComboAwardNames[] = { - "1000", - "2000", - "3000", - "4000", - "5000", - "6000", - "7000", - "8000", - "9000", - "10000", -}; -XToString( PeakComboAward ); -XToLocalizedString( PeakComboAward ); -StringToX( PeakComboAward ); -LuaFunction( PeakComboAwardToLocalizedString, PeakComboAwardToLocalizedString(Enum::Check(L, 1)) ); -LuaXType( PeakComboAward ); - - -void DisplayBpms::Add( float f ) -{ - vfBpms.push_back( f ); -} - -float DisplayBpms::GetMin() const -{ - float fMin = FLT_MAX; - FOREACH_CONST( float, vfBpms, f ) - { - if( *f != -1 ) - fMin = min( fMin, *f ); - } - if( fMin == FLT_MAX ) - return 0; - else - return fMin; -} - -float DisplayBpms::GetMax() const -{ - float fMax = 0; - FOREACH_CONST( float, vfBpms, f ) - { - if( *f != -1 ) - fMax = max( fMax, *f ); - } - return fMax; -} - -bool DisplayBpms::BpmIsConstant() const -{ - return fabsf( GetMin() - GetMax() ) < 0.001f; -} - -bool DisplayBpms::IsSecret() const -{ - FOREACH_CONST( float, vfBpms, f ) - { - if( *f == -1 ) - return true; - } - return false; -} - -static const char *StyleTypeNames[] = { - "OnePlayerOneSide", - "TwoPlayersTwoSides", - "OnePlayerTwoSides", - "TwoPlayersSharedSides", -}; -XToString( StyleType ); -StringToX( StyleType ); -LuaXType( StyleType ); - -static const char *GoalTypeNames[] = { - "Calories", - "Time", - "None", -}; -XToString( GoalType ); -StringToX( GoalType ); -LuaXType( GoalType ); - -static const char *EditModeNames[] = { - "Practice", - "CourseMods", - "Home", - "Full" -}; -XToString( EditMode ); -StringToX( EditMode ); -LuaXType( EditMode ); - -static const char *SampleMusicPreviewModeNames[] = { - "Normal", - "StartToPreview", - "ScreenMusic", - "LastSong" -}; -XToString( SampleMusicPreviewMode ); -StringToX( SampleMusicPreviewMode ); -LuaXType( SampleMusicPreviewMode ); - -static const char *StageNames[] = { - "1st", - "2nd", - "3rd", - "4th", - "5th", - "6th", - "Next", - "Final", - "Extra1", - "Extra2", - "Nonstop", - "Oni", - "Endless", - "Event", - "Demo", -}; -XToString( Stage ); -LuaXType( Stage ); -XToLocalizedString( Stage ); -LuaFunction( StageToLocalizedString, StageToLocalizedString(Enum::Check(L, 1)) ); - -static const char *EarnedExtraStageNames[] = { - "No", - "Extra1", - "Extra2", -}; -XToString( EarnedExtraStage ); -LuaXType( EarnedExtraStage ); - - -static const char *MultiPlayerStatusNames[] = { - "Joined", - "NotJoined", - "Unplugged", - "MissingMultitap", -}; -XToString( MultiPlayerStatus ); - - -static const char *CourseTypeNames[] = { - "Nonstop", - "Oni", - "Endless", - "Survival", -}; -XToString( CourseType ); -XToLocalizedString( CourseType ); -LuaXType( CourseType ); -LuaFunction( CourseTypeToLocalizedString, CourseTypeToLocalizedString( Enum::Check( L, 1 ) ) ); - - - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GameConstantsAndTypes.h" +#include "GameState.h" +#include "RageUtil.h" +#include "ThemeMetric.h" +#include "EnumHelper.h" +#include "Foreach.h" +#include "LuaManager.h" +#include "GameManager.h" +#include "LocalizedString.h" +#include "PlayerNumber.h" +#include + + +static vector GenerateRankingToFillInMarker() +{ + vector vRankings; + FOREACH_ENUM( PlayerNumber, pn ) + vRankings.push_back( ssprintf("#P%d#", pn+1) ); + return vRankings; +} +extern const vector RANKING_TO_FILL_IN_MARKER( GenerateRankingToFillInMarker() ); + +extern const RString GROUP_ALL = "---Group All---"; + +static const char *RadarCategoryNames[] = { + "Stream", + "Voltage", + "Air", + "Freeze", + "Chaos", + "TapsAndHolds", + "Jumps", + "Holds", + "Mines", + "Hands", + "Rolls", + "Lifts", + "Fakes", +}; +XToString( RadarCategory ); +XToLocalizedString( RadarCategory ); +LuaFunction( RadarCategoryToLocalizedString, RadarCategoryToLocalizedString(Enum::Check(L, 1)) ); +LuaXType( RadarCategory ); + +RString StepsTypeToString( StepsType st ) +{ + RString s = GAMEMAN->GetStepsTypeInfo( st ).szName; // "dance-single" + /* foo-bar -> Foo_Bar */ + s.Replace('-','_'); + + bool bCapitalizeNextLetter = true; + for( int i=0; i<(int)s.length(); i++ ) + { + if( bCapitalizeNextLetter ) + { + s[i] = toupper(s[i]); + bCapitalizeNextLetter = false; + } + + if( s[i] == '_' ) + bCapitalizeNextLetter = true; + } + + return s; +} +namespace StringConversion { template<> RString ToString( const StepsType &value ) { return StepsTypeToString(value); } } + +LuaXType( StepsType ); + + +static const char *PlayModeNames[] = { + "Regular", + "Nonstop", + "Oni", + "Endless", + "Battle", + "Rave", +}; +XToString( PlayMode ); +XToLocalizedString( PlayMode ); +StringToX( PlayMode ); +LuaFunction( PlayModeToLocalizedString, PlayModeToLocalizedString(Enum::Check(L, 1)) ); +LuaXType( PlayMode ); + +RankingCategory AverageMeterToRankingCategory( int iAverageMeter ) +{ + if( iAverageMeter <= 3 ) return RANKING_A; + else if( iAverageMeter <= 6 ) return RANKING_B; + else if( iAverageMeter <= 9 ) return RANKING_C; + else return RANKING_D; +} + + +static const char *RankingCategoryNames[] = { + "a", + "b", + "c", + "d", +}; +XToString( RankingCategory ); +StringToX( RankingCategory ); + + +static const char *PlayerControllerNames[] = { + "Human", + "Autoplay", + "Cpu", + //"Replay", +}; +XToString( PlayerController ); +StringToX( PlayerController ); +XToLocalizedString( PlayerController ); +LuaXType( PlayerController ); + + +static const char *HealthStateNames[] = { + "Hot", + "Alive", + "Danger", + "Dead", +}; +XToString( HealthState ); +LuaXType( HealthState ); + + +static const char *CoinModeNames[] = { + "Home", + "Pay", + "Free", +}; +XToString( CoinMode ); +StringToX( CoinMode ); +LuaXType( CoinMode ); + + +static const char *PremiumNames[] = { + "Off", + "DoubleFor1Credit", + "2PlayersFor1Credit", +}; +XToString( Premium ); +StringToX( Premium ); +XToLocalizedString( Premium ); +LuaXType( Premium ); + + +static const char *SortOrderNames[] = { + "Preferred", + "Group", + "Title", + "BPM", + "Popularity", + "TopGrades", + "Artist", + "Genre", + "BeginnerMeter", + "EasyMeter", + "MediumMeter", + "HardMeter", + "ChallengeMeter", + "DoubleEasyMeter", + "DoubleMediumMeter", + "DoubleHardMeter", + "DoubleChallengeMeter", + "ModeMenu", + "AllCourses", + "Nonstop", + "Oni", + "Endless", + "Length", + "Roulette", + "Recent", +}; +XToString( SortOrder ); +StringToX( SortOrder ); +LuaXType( SortOrder ); +XToLocalizedString( SortOrder ); +LuaFunction( SortOrderToLocalizedString, SortOrderToLocalizedString(Enum::Check(L, 1)) ); + + +static const char *TapNoteScoreNames[] = { + "None", + "HitMine", + "AvoidMine", + "CheckpointMiss", + "Miss", + "W5", + "W4", + "W3", + "W2", + "W1", + "CheckpointHit", +}; +XToString( TapNoteScore ); +LuaXType( TapNoteScore ); +TapNoteScore StringToTapNoteScore( const RString &s ) +{ + // new style + if ( s == "None" ) return TNS_None; + else if( s == "HitMine" ) return TNS_HitMine; + else if( s == "AvoidMine" ) return TNS_AvoidMine; + else if( s == "CheckpointHit" ) return TNS_CheckpointHit; + else if( s == "CheckpointMiss" )return TNS_CheckpointMiss; + else if( s == "Miss" ) return TNS_Miss; + else if( s == "W5" ) return TNS_W5; + else if( s == "W4" ) return TNS_W4; + else if( s == "W3" ) return TNS_W3; + else if( s == "W2" ) return TNS_W2; + else if( s == "W1" ) return TNS_W1; + + // for backward compatibility + else if( s == "Boo" ) return TNS_W5; + else if( s == "Good" ) return TNS_W4; + else if( s == "Great" ) return TNS_W3; + else if( s == "Perfect" ) return TNS_W2; + else if( s == "Marvelous" ) return TNS_W1; + + return TapNoteScore_Invalid; +} +XToLocalizedString( TapNoteScore ); +LuaFunction( TapNoteScoreToLocalizedString, TapNoteScoreToLocalizedString(Enum::Check(L, 1)) ); + + +static const char *HoldNoteScoreNames[] = { + "None", + "LetGo", + "Held", +}; +XToString( HoldNoteScore ); +LuaXType( HoldNoteScore ); +HoldNoteScore StringToHoldNoteScore( const RString &s ) +{ + // for backward compatibility + if ( s == "NG" ) return HNS_LetGo; + else if( s == "OK" ) return HNS_Held; + + // new style + else if( s == "None" ) return HNS_None; + else if( s == "LetGo" ) return HNS_LetGo; + else if( s == "Held" ) return HNS_Held; + + return HoldNoteScore_Invalid; +} +XToLocalizedString( HoldNoteScore ); + +static const char *TimingWindowNames[] = { + "W1", + "W2", + "W3", + "W4", + "W5", + "Mine", + "Attack", + "Hold", + "Roll", +}; +XToString( TimingWindow ); + +static const char *ScoreEventNames[] = { + "CheckpointHit", + "W1", + "W2", + "W3", + "W4", + "W5", + "Miss", + "HitMine", + "CheckpointMiss", + "Held", + "LetGo", +}; +XToString( ScoreEvent ); + +static const char *TapNoteScoreJudgeTypeNames[] = { + "MinimumScore", + "LastScore", +}; +XToString( TapNoteScoreJudgeType ); +LuaXType( TapNoteScoreJudgeType ); + +static const char *ProfileSlotNames[] = { + "Player1", + "Player2", + "Machine", +}; +XToString( ProfileSlot ); +LuaXType( ProfileSlot ); + +static const char *MemoryCardStateNames[] = { + "ready", + "checking", + "late", + "error", + "removed", + "none", +}; +XToString( MemoryCardState ); +LuaXType( MemoryCardState ); + +static const char *StageAwardNames[] = { + "FullComboW3", + "SingleDigitW3", + "OneW3", + "FullComboW2", + "SingleDigitW2", + "OneW2", + "FullComboW1", + "80PercentW3", + "90PercentW3", + "100PercentW3", +}; +XToString( StageAward ); +XToLocalizedString( StageAward ); +StringToX( StageAward ); +LuaFunction( StageAwardToLocalizedString, StageAwardToLocalizedString(Enum::Check(L, 1)) ); +LuaXType( StageAward ); + +// Numbers are intentionally not at the front of these strings so that the +// strings can be used as XML entity names. +// Numbers are intentionally not at the back so that "1000" and "10000" don't +// conflict when searching for theme elements. +static const char *PeakComboAwardNames[] = { + "1000", + "2000", + "3000", + "4000", + "5000", + "6000", + "7000", + "8000", + "9000", + "10000", +}; +XToString( PeakComboAward ); +XToLocalizedString( PeakComboAward ); +StringToX( PeakComboAward ); +LuaFunction( PeakComboAwardToLocalizedString, PeakComboAwardToLocalizedString(Enum::Check(L, 1)) ); +LuaXType( PeakComboAward ); + + +void DisplayBpms::Add( float f ) +{ + vfBpms.push_back( f ); +} + +float DisplayBpms::GetMin() const +{ + float fMin = FLT_MAX; + FOREACH_CONST( float, vfBpms, f ) + { + if( *f != -1 ) + fMin = min( fMin, *f ); + } + if( fMin == FLT_MAX ) + return 0; + else + return fMin; +} + +float DisplayBpms::GetMax() const +{ + float fMax = 0; + FOREACH_CONST( float, vfBpms, f ) + { + if( *f != -1 ) + fMax = max( fMax, *f ); + } + return fMax; +} + +bool DisplayBpms::BpmIsConstant() const +{ + return fabsf( GetMin() - GetMax() ) < 0.001f; +} + +bool DisplayBpms::IsSecret() const +{ + FOREACH_CONST( float, vfBpms, f ) + { + if( *f == -1 ) + return true; + } + return false; +} + +static const char *StyleTypeNames[] = { + "OnePlayerOneSide", + "TwoPlayersTwoSides", + "OnePlayerTwoSides", + "TwoPlayersSharedSides", +}; +XToString( StyleType ); +StringToX( StyleType ); +LuaXType( StyleType ); + +static const char *GoalTypeNames[] = { + "Calories", + "Time", + "None", +}; +XToString( GoalType ); +StringToX( GoalType ); +LuaXType( GoalType ); + +static const char *EditModeNames[] = { + "Practice", + "CourseMods", + "Home", + "Full" +}; +XToString( EditMode ); +StringToX( EditMode ); +LuaXType( EditMode ); + +static const char *SampleMusicPreviewModeNames[] = { + "Normal", + "StartToPreview", + "ScreenMusic", + "LastSong" +}; +XToString( SampleMusicPreviewMode ); +StringToX( SampleMusicPreviewMode ); +LuaXType( SampleMusicPreviewMode ); + +static const char *StageNames[] = { + "1st", + "2nd", + "3rd", + "4th", + "5th", + "6th", + "Next", + "Final", + "Extra1", + "Extra2", + "Nonstop", + "Oni", + "Endless", + "Event", + "Demo", +}; +XToString( Stage ); +LuaXType( Stage ); +XToLocalizedString( Stage ); +LuaFunction( StageToLocalizedString, StageToLocalizedString(Enum::Check(L, 1)) ); + +static const char *EarnedExtraStageNames[] = { + "No", + "Extra1", + "Extra2", +}; +XToString( EarnedExtraStage ); +LuaXType( EarnedExtraStage ); + + +static const char *MultiPlayerStatusNames[] = { + "Joined", + "NotJoined", + "Unplugged", + "MissingMultitap", +}; +XToString( MultiPlayerStatus ); + + +static const char *CourseTypeNames[] = { + "Nonstop", + "Oni", + "Endless", + "Survival", +}; +XToString( CourseType ); +XToLocalizedString( CourseType ); +LuaXType( CourseType ); +LuaFunction( CourseTypeToLocalizedString, CourseTypeToLocalizedString( Enum::Check( L, 1 ) ) ); + + + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 38c91cdefc..92b19f1fc7 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -1,703 +1,703 @@ -/* GameConstantsAndTypes - Things used in many places that don't change often. */ - -#ifndef GAME_CONSTANTS_AND_TYPES_H -#define GAME_CONSTANTS_AND_TYPES_H - -#include "EnumHelper.h" - -// Note definitions -/** @brief Define the mininum difficulty value allowed. */ -const int MIN_METER = 1; -/** - * @brief Define the maximum difficulty value allowed. - * - * 35 is used rather than 13 due to a variety of Profile data. - * For more examples, see Profile::InitGeneralData(). -aj - */ -const int MAX_METER = 35; - -/** @brief The maximum number of credits for coin mode. */ -const int MAX_NUM_CREDITS = 20; - - -/** - * @brief The various radar categories available. - * - * This is just cached song data. Not all of it may actually be displayed - * in the radar. */ -enum RadarCategory -{ - RadarCategory_Stream = 0, /**< How much stream is in the song? */ - RadarCategory_Voltage, /**< How much voltage is in the song? */ - RadarCategory_Air, /**< How much air is in the song? */ - RadarCategory_Freeze, /**< How much freeze (holds) is in the song? */ - RadarCategory_Chaos, /**< How much chaos is in the song? */ - RadarCategory_TapsAndHolds, /**< How many taps and holds are in the song? */ - RadarCategory_Jumps, /**< How many jumps are in the song? */ - RadarCategory_Holds, /**< How many holds are in the song? */ - RadarCategory_Mines, /**< How many mines are in the song? */ - RadarCategory_Hands, /**< How many hands are in the song? */ - RadarCategory_Rolls, /**< How many rolls are in the song? */ - RadarCategory_Lifts, /**< How many lifts are in the song? */ - RadarCategory_Fakes, /**< How many fakes are in the song? */ - NUM_RadarCategory, /**< The number of radar categories. */ - RadarCategory_Invalid -}; -/** - * @brief Turn the radar category into a proper string. - * @param cat the radar category. - * @return the string version of the radar category. - */ -const RString& RadarCategoryToString( RadarCategory cat ); -/** - * @brief Turn the radar category into a proper localized string. - * @param cat the radar category. - * @return the localized string version of the radar category. - */ -const RString& RadarCategoryToLocalizedString( RadarCategory cat ); -LuaDeclareType( RadarCategory ); - -/** @brief The different game categories available to play. */ -enum StepsTypeCategory -{ - StepsTypeCategory_Single, /**< One person plays on one side. */ - StepsTypeCategory_Double, /**< One person plays on both sides. */ - StepsTypeCategory_Couple, /**< Two players play on their own side. */ - StepsTypeCategory_Routine, /**< Two players share both sides together. */ -}; - -/** @brief The different steps types for playing. */ -enum StepsType -{ - StepsType_dance_single = 0, - StepsType_dance_double, - StepsType_dance_couple, - StepsType_dance_solo, - StepsType_dance_threepanel, - StepsType_dance_routine, - StepsType_pump_single, - StepsType_pump_halfdouble, - StepsType_pump_double, - StepsType_pump_couple, - StepsType_pump_routine, - StepsType_kb7_single, - StepsType_ez2_single, - StepsType_ez2_double, - StepsType_ez2_real, - StepsType_para_single, - StepsType_ds3ddx_single, - StepsType_beat_single5, - StepsType_beat_double5, - StepsType_beat_single7, - StepsType_beat_double7, - StepsType_maniax_single, - StepsType_maniax_double, - StepsType_techno_single4, - StepsType_techno_single5, - StepsType_techno_single8, - StepsType_techno_double4, - StepsType_techno_double5, - StepsType_techno_double8, - StepsType_popn_five, - StepsType_popn_nine, - StepsType_guitar_five, - StepsType_lights_cabinet, - NUM_StepsType, // leave this at the end - StepsType_Invalid, -}; -LuaDeclareType( StepsType ); - -/** @brief The various play modes available. */ -enum PlayMode -{ - PLAY_MODE_REGULAR, /**< The normal game mode, often with a set number of stages. */ - PLAY_MODE_NONSTOP, /**< Play a set of songs without stopping. */ - PLAY_MODE_ONI, /**< Similar to Nonstop, only there is also the danger of lives or a clock. */ - PLAY_MODE_ENDLESS, /**< Keep playing until you get a game over. */ - PLAY_MODE_BATTLE, /**< Choose when to send attacks to your opponent. */ - PLAY_MODE_RAVE, /**< Have attacks launched during play automatically. */ - NUM_PlayMode, - PlayMode_Invalid -}; -/** - * @brief Turn the play mode into a proper string. - * @param pm the play mode. - * @return the string version of the play mode. - */ -const RString& PlayModeToString( PlayMode pm ); -/** - * @brief Turn the play mode into a proper localized string. - * @param pm the play mode. - * @return the localized string version of the play mode. - */ -const RString& PlayModeToLocalizedString( PlayMode pm ); -/** - * @brief Turn the string into the proper play mode. - * @param s the string. - * @return the play mode based on the string. - */ -PlayMode StringToPlayMode( const RString& s ); -LuaDeclareType( PlayMode ); - -/** - * @brief The list of ways to sort songs and courses. - * - * All song sorts should be listed before course sorts. - */ -enum SortOrder -{ - // song sorts - SORT_PREFERRED, /**< Sort by the user's preferred settings. */ - SORT_GROUP, /**< Sort by the groups the Songs are in. */ - SORT_TITLE, /**< Sort by the Song's title. */ - SORT_BPM, /**< Sort by the Song's BPM. */ - SORT_POPULARITY, /**< Sort by how popular the Song is. */ - SORT_TOP_GRADES, /**< Sort by the highest grades earned on a Song. */ - SORT_ARTIST, /**< Sort by the name of the artist of the Song. */ - SORT_GENRE, /**< Sort by the Song's genre. */ - SORT_BEGINNER_METER, /**< Sort by the difficulty of the single beginner meter. */ - SORT_EASY_METER, /**< Sort by the difficulty of the single easy meter. */ - SORT_MEDIUM_METER, /**< Sort by the difficulty of the single medium meter. */ - SORT_HARD_METER, /**< Sort by the difficulty of the single hard meter. */ - SORT_CHALLENGE_METER, /**< Sort by the difficulty of the single challenge meter. */ - SORT_DOUBLE_EASY_METER, /**< Sort by the difficulty of the double easy meter. */ - SORT_DOUBLE_MEDIUM_METER, /**< Sort by the difficulty of the double medium meter. */ - SORT_DOUBLE_HARD_METER, /**< Sort by the difficulty of the double hard meter. */ - SORT_DOUBLE_CHALLENGE_METER, /**< Sort by the difficulty of the double challenge meter. */ - // - SORT_MODE_MENU, /**< Have access to the menu for choosing the sort. */ - // course sorts - SORT_ALL_COURSES, /**< Sort with all courses available. */ - SORT_NONSTOP_COURSES, /**< View only the nonstop courses. */ - SORT_ONI_COURSES, /**< View only the oni/survival courses. */ - SORT_ENDLESS_COURSES, /**< View only the endless courses. */ - SORT_LENGTH, /**< Sort the courses by how long they would last. */ - SORT_ROULETTE, - SORT_RECENT, - NUM_SortOrder, - SortOrder_Invalid -}; -/** @brief Only allow certain sort modes to be selectable. */ -const SortOrder MAX_SELECTABLE_SORT = (SortOrder)(SORT_ROULETTE-1); -/** - * @brief Turn the sort order into a proper string. - * @param so the sort order. - * @return the string version of the sort order. - */ -const RString& SortOrderToString( SortOrder so ); -/** - * @brief Turn the sort order into a proper localized string. - * @param so the sort order. - * @return the localized string version of the sort order. - */ -const RString& SortOrderToLocalizedString( SortOrder so ); -/** - * @brief Turn the string into the proper sort order. - * @param str the string. - * @return the sort order based on the string. - */ -SortOrder StringToSortOrder( const RString& str ); -LuaDeclareType( SortOrder ); -/** - * @brief Determine if the sort order in question is for songs or not. - * - * This function is mainly used for saving sort order to the profile. -aj - */ -inline bool IsSongSort( SortOrder so ) { return so >= SORT_PREFERRED && so <= SORT_DOUBLE_CHALLENGE_METER; } - -/** @brief The list of tap note scores available during play. */ -enum TapNoteScore { - TNS_None, /**< There is no score involved with this one. */ - TNS_HitMine, /**< A mine was hit successfully. */ - TNS_AvoidMine, /**< A mine was avoided successfully. */ - TNS_CheckpointMiss, /**< A checkpoint was missed during a hold. */ - TNS_Miss, /**< A note was missed entirely. */ - TNS_W5, /**< A note was almost missed, but not quite. */ - TNS_W4, /**< A note was hit either a bit early or a bit late. */ - TNS_W3, /**< A note was hit with decent accuracy, but not the best. */ - TNS_W2, /**< A note was hit off by just a miniscule amount. This used to be the best rating. */ - TNS_W1, /**< A note was hit perfectly. */ - TNS_CheckpointHit, /**< A checkpoint was held during a hold. */ - NUM_TapNoteScore, /**< The number of Tap Note Scores available. */ - TapNoteScore_Invalid, -}; -/** - * @brief Turn the tap note score into a proper string. - * @param tns the tap note score. - * @return the string version of the tap note score. - */ -const RString& TapNoteScoreToString( TapNoteScore tns ); -/** - * @brief Turn the tap note score into a proper localized string. - * @param tns the tap note score. - * @return the localized string version of the tap note score. - */ -const RString& TapNoteScoreToLocalizedString( TapNoteScore tns ); -/** - * @brief Turn the string into the proper tap note score. - * @param str the string. - * @return the tap note score based on the string. - */ -TapNoteScore StringToTapNoteScore( const RString& str ); -LuaDeclareType( TapNoteScore ); - -/** @brief The list of hold note scores available during play. */ -enum HoldNoteScore -{ - HNS_None, /**< The HoldNote was not scored yet. */ - HNS_LetGo, /**< The HoldNote has passed, but the player missed it. */ - HNS_Held, /**< The HoldNote has passed, and was successfully held all the way. */ - NUM_HoldNoteScore, /**< The number of hold note scores. */ - HoldNoteScore_Invalid, -}; -/** - * @brief Turn the hold note score into a proper string. - * @param hns the hold note score. - * @return the string version of the hold note score. - */ -const RString& HoldNoteScoreToString( HoldNoteScore hns ); -/** - * @brief Turn the hold note score into a proper localized string. - * @param hns the hold note score. - * @return the localized string version of the hold note score. - */ -const RString& HoldNoteScoreToLocalizedString( HoldNoteScore hns ); -/** - * @brief Turn the string into the proper hold note score. - * @param str the string. - * @return the hold note score based on the string. - */ -HoldNoteScore StringToHoldNoteScore( const RString& str ); -LuaDeclareType( HoldNoteScore ); - -/** @brief The list of timing windows to deal with when playing. */ -enum TimingWindow -{ - TW_W1, - TW_W2, - TW_W3, - TW_W4, - TW_W5, - TW_Mine, - TW_Attack, - TW_Hold, - TW_Roll, - NUM_TimingWindow -}; -const RString& TimingWindowToString( TimingWindow tw ); - -/** @brief The list of score events that can take place while playing. */ -enum ScoreEvent -{ - SE_CheckpointHit, - SE_W1, - SE_W2, - SE_W3, - SE_W4, - SE_W5, - SE_Miss, - SE_HitMine, - SE_CheckpointMiss, - SE_Held, - SE_LetGo, - NUM_ScoreEvent -}; -const RString& ScoreEventToString( ScoreEvent se ); - -/** @brief The list of game button types available for all game modes. */ -enum GameButtonType -{ - GameButtonType_Step, - GameButtonType_Fret, - GameButtonType_Strum, - GameButtonType_INVALID -}; - -/** @brief The list of judge types for the tap note scores. */ -enum TapNoteScoreJudgeType -{ - TapNoteScoreJudgeType_MinimumScore, - TapNoteScoreJudgeType_LastScore, - NUM_TapNoteScoreJudgeType, - TapNoteScoreJudgeType_Invalid, -}; -const RString& TapNoteScoreJudgeTypeToString( TapNoteScoreJudgeType jt ); -LuaDeclareType( TapNoteScoreJudgeType ); - - -/** @brief The profile slots available. This is mainly for Profiles and Memory Cards. */ -enum ProfileSlot -{ - ProfileSlot_Player1, - ProfileSlot_Player2, - ProfileSlot_Machine, - NUM_ProfileSlot, - ProfileSlot_Invalid -}; -const RString& ProfileSlotToString( ProfileSlot ps ); -LuaDeclareType( ProfileSlot ); - -/** @brief The states of the memory card during play. */ -enum MemoryCardState -{ - MemoryCardState_Ready, - MemoryCardState_Checking, - MemoryCardState_TooLate, - MemoryCardState_Error, - MemoryCardState_Removed, - MemoryCardState_NoCard, - NUM_MemoryCardState, - MemoryCardState_Invalid, -}; - -const RString& MemoryCardStateToString( MemoryCardState mcs ); -LuaDeclareType( MemoryCardState ); - -/** @brief The different ranking categories based on difficulty meter average. */ -enum RankingCategory -{ - RANKING_A, /**< 1-3 meter per song avg. */ - RANKING_B, /**< 4-6 meter per song avg. */ - RANKING_C, /**< 7-9 meter per song avg. */ - RANKING_D, /**< 10+ meter per song avg, not counting extra stages. */ - NUM_RankingCategory, /**< The number of ranking categories. */ - RankingCategory_Invalid -}; -const RString& RankingCategoryToString( RankingCategory rc ); -RankingCategory StringToRankingCategory( const RString& rc ); - -extern const vector RANKING_TO_FILL_IN_MARKER; -inline bool IsRankingToFillIn( const RString& sName ) { return !sName.empty() && sName[0]=='#'; } - -RankingCategory AverageMeterToRankingCategory( int iAverageMeter ); - -// Group stuff -extern const RString GROUP_ALL; - - -/** @brief The different types of players in the game. */ -enum PlayerController -{ - PC_HUMAN, - PC_AUTOPLAY, - PC_CPU, - //PC_REPLAY, - NUM_PlayerController, - PlayerController_Invalid -}; -const RString& PlayerControllerToString( PlayerController pc ); -LuaDeclareType( PlayerController ); - -/** @brief The different health bar states. */ -enum HealthState -{ - HealthState_Hot, /**< The health bar is very full. */ - HealthState_Alive, /**< The health bar is at a decent size. */ - HealthState_Danger, /**< The health bar is about to run out. */ - HealthState_Dead, /**< The health bar is drained completely. */ - NUM_HealthState, - HealthState_Invalid -}; -LuaDeclareType( HealthState ); - -/** @brief The different stage results during battle. */ -enum StageResult -{ - RESULT_WIN, /**< The player has won the battle. */ - RESULT_LOSE, /**< The player has lost the battle. */ - RESULT_DRAW /**< The player has tied with the competitor. */ -}; - - -// Battle stuff -/** @brief The number of inventory slots available for attacks. */ -const int NUM_INVENTORY_SLOTS = 3; -enum AttackLevel -{ - ATTACK_LEVEL_1, - ATTACK_LEVEL_2, - ATTACK_LEVEL_3, - NUM_ATTACK_LEVELS -}; -const int NUM_ATTACKS_PER_LEVEL = 3; -const int ITEM_NONE = -1; - - -// Coin stuff -/** @brief The different coin modes to determine how one can play. */ -enum CoinMode -{ - CoinMode_Home, /**< The full range of options are available. */ - CoinMode_Pay, /**< Coins must be inserted before a game can begin. */ - CoinMode_Free, /**< It costs no money to play, but otherwise is similar to Pay mode. */ - NUM_CoinMode, - CoinMode_Invalid -}; -const RString& CoinModeToString( CoinMode cm ); -LuaDeclareType( CoinMode ); - - -/** @brief The different types of premiums available to take advantage of. */ -enum Premium -{ - Premium_Off, /**< It will cost one credit per side of the machine. */ - Premium_DoubleFor1Credit, /**< It will cost one credit per player of the machine. */ - Premium_2PlayersFor1Credit, /**< One credit gives one or both players full access. */ - NUM_Premium, - Premium_Invalid -}; -const RString& PremiumToString( Premium p ); -const RString& PremiumToLocalizedString( Premium p ); -LuaDeclareType( Premium ); - - -/** @brief The various stage awards that can be given based on excellent play. */ -enum StageAward -{ - StageAward_FullComboW3, /**< A full great combo (or equivalent) was earned. */ - StageAward_SingleDigitW3, /**< A single digit great combo (or equivalent) was earned. */ - StageAward_OneW3, /**< Only one great (or equivalent) was earned. */ - StageAward_FullComboW2, /**< A full excellent combo (or equivalent) was earned. */ - StageAward_SingleDigitW2, /**< A single digit excellent combo (or equivalent) was earned. */ - StageAward_OneW2, /**< Only one excellent (or equivalent) was earned. */ - StageAward_FullComboW1, /**< All fantastics (or equivalent) were earned. */ - StageAward_80PercentW3, - StageAward_90PercentW3, - StageAward_100PercentW3, - NUM_StageAward, - StageAward_Invalid, -}; -const RString& StageAwardToString( StageAward pma ); -const RString& StageAwardToLocalizedString( StageAward pma ); -StageAward StringToStageAward( const RString& pma ); -LuaDeclareType( StageAward ); - -/** @brief The various peak combo awards should such a combo be attained during play. */ -enum PeakComboAward -{ - PeakComboAward_1000, - PeakComboAward_2000, - PeakComboAward_3000, - PeakComboAward_4000, - PeakComboAward_5000, - PeakComboAward_6000, - PeakComboAward_7000, - PeakComboAward_8000, - PeakComboAward_9000, - PeakComboAward_10000, - NUM_PeakComboAward, - PeakComboAward_Invalid, -}; -const RString& PeakComboAwardToString( PeakComboAward pma ); -const RString& PeakComboAwardToLocalizedString( PeakComboAward pma ); -PeakComboAward StringToPeakComboAward( const RString& pma ); -LuaDeclareType( PeakComboAward ); - -/** @brief The list of BPMs to display */ -struct DisplayBpms -{ - /** - * @brief Add a BPM to the list. - * @param f the BPM to add. - */ - void Add( float f ); - /** - * @brief Retrieve the minimum BPM of the set. - * @return the minimum BPM. - */ - float GetMin() const; - /** - * @brief Retrieve the maximum BPM of the set. - * @return the maximum BPM. - */ - float GetMax() const; - /** - * @brief Determine if the BPM is really constant. - * @return Whether the BPM is constant or not. - */ - bool BpmIsConstant() const; - /** - * @brief Determine if the BPM is meant to be a secret. - * @return Whether the BPM is a secret or not. - */ - bool IsSecret() const; - /** - * @brief The list of the BPMs for the song or course. - */ - vector vfBpms; -}; - -/** @brief The various style types available. */ -enum StyleType -{ - StyleType_OnePlayerOneSide, /**< Single style */ - StyleType_TwoPlayersTwoSides, /**< Versus style */ - StyleType_OnePlayerTwoSides, /**< Double style */ - StyleType_TwoPlayersSharedSides, /**< Routine style */ - NUM_StyleType, - StyleType_Invalid -}; -const RString& StyleTypeToString( StyleType s ); -StyleType StringToStyleType( const RString& s ); -LuaDeclareType( StyleType ); - -/** @brief The different goal types, mainly meant for fitness modes. */ -enum GoalType -{ - GoalType_Calories, - GoalType_Time, - GoalType_None, - NUM_GoalType, - GoalType_Invalid, -}; -const RString& GoalTypeToString( GoalType gt ); -GoalType StringToGoalType( const RString& s ); -LuaDeclareType( GoalType ); - -/** @brief The different types of Edit modes available. */ -enum EditMode -{ - EditMode_Practice, - EditMode_CourseMods, - EditMode_Home, - EditMode_Full, - NUM_EditMode, - EditMode_Invalid, -}; -const RString& EditModeToString( EditMode em ); -EditMode StringToEditMode( const RString& s ); -LuaDeclareType( EditMode ); - -/** - * @brief The different types of sample music previews available. - * - * These were originally from the deleted screen ScreenEz2SelectMusic. - * (if no confirm type is mentioned, there is none.) - * - * 0 = play music as you select; SampleMusicPreviewMode_Normal - * 1 = no music plays, select 1x to play preview music, select again to confirm - * 2 = no music plays at all (SampleMusicPreviewMode_ScreenMusic + redir to silent) - * 3 = play music as select, 2x to confirm (SampleMusicPreviewMode_Normal + [SSMusic] TwoPartConfirmsOnly) - * 4 = screen music plays; SampleMusicPreviewMode_ScreenMusic - */ -enum SampleMusicPreviewMode -{ - SampleMusicPreviewMode_Normal, /**< Music is played as the song is highlighted. */ - SampleMusicPreviewMode_StartToPreview, - SampleMusicPreviewMode_ScreenMusic, /**< No music plays. Select it once to preview the music, - * then once more to select the song. */ - SampleMusicPreviewMode_LastSong, /**< continue playing the last song */ - NUM_SampleMusicPreviewMode, - SampleMusicPreviewMode_Invalid, -}; -const RString& SampleMusicPreviewModeToString( SampleMusicPreviewMode ); -SampleMusicPreviewMode StringToSampleMusicPreviewMode( const RString& s ); -LuaDeclareType( SampleMusicPreviewMode ); - -/** - * @brief The different kinds of Stages available. - * - * These are shared stage values shown in StageDisplay. These are not per-player. - */ -enum Stage -{ - Stage_1st, /**< The first stage. */ - Stage_2nd, /**< The second stage. */ - Stage_3rd, /**< The third stage. */ - Stage_4th, /**< The fourth stage. */ - Stage_5th, /**< The fifth stage. */ - Stage_6th, /**< The sixth stage. */ - Stage_Next, /**< Somewhere between the sixth and final stage. - * This won't normally happen because 7 stages is the max in the UI. */ - Stage_Final, /**< The last stage. */ - Stage_Extra1, /**< The first bonus stage, AKA the extra stage. */ - Stage_Extra2, /**< The last bonus stage, AKA the encore extra stage. */ - Stage_Nonstop, /**< Playing a nonstop course. */ - Stage_Oni, /**< Playing an oni or survival course. */ - Stage_Endless, /**< Playing an endless course. */ - Stage_Event, /**< Playing in event mode. */ - Stage_Demo, /**< Playing the demonstration. */ - NUM_Stage, /**< The number of stage types. */ - Stage_Invalid, -}; -const RString& StageToString( Stage s ); -LuaDeclareType( Stage ); -const RString& StageToLocalizedString( Stage i ); - -/** @brief The different possibilities of earning an extra stage. */ -enum EarnedExtraStage -{ - EarnedExtraStage_No, /**< No extra stage was earned. */ - EarnedExtraStage_Extra1, /**< The first extra stage was earned. */ - EarnedExtraStage_Extra2, /**< The second extra stage (or encore extra stage) was earned. */ - NUM_EarnedExtraStage, - EarnedExtraStage_Invalid -}; -const RString& EarnedExtraStageToString( EarnedExtraStage s ); -LuaDeclareType( EarnedExtraStage ); - -/** @brief The different results of loading a profile. */ -enum ProfileLoadResult -{ - ProfileLoadResult_Success, - ProfileLoadResult_FailedNoProfile, - ProfileLoadResult_FailedTampered -}; - -/** @brief The different statuses for multiplayer. */ -enum MultiPlayerStatus -{ - MultiPlayerStatus_Joined, - MultiPlayerStatus_NotJoined, - MultiPlayerStatus_Unplugged, - MultiPlayerStatus_MissingMultitap, - NUM_MultiPlayerStatus, - MultiPlayerStatus_Invalid -}; -const RString& MultiPlayerStatusToString( MultiPlayerStatus i ); - -/** @brief The different course types. */ -enum CourseType -{ - COURSE_TYPE_NONSTOP, /**< The life meter type is set to BAR. */ - COURSE_TYPE_ONI, /**< The life meter type is set to BATTERY. */ - COURSE_TYPE_ENDLESS, /**< The life meter type is set to REPEAT. */ - COURSE_TYPE_SURVIVAL, /**< The life meter type is set to TIME. */ - NUM_CourseType, - CourseType_Invalid -}; -/** @brief A special iterator for handling the CourseTypes. */ -#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, i ) -const RString& CourseTypeToString( CourseType i ); -const RString& CourseTypeToLocalizedString( CourseType i ); -LuaDeclareType( CourseType ); - - -#endif - -/** - * @file - * @author Chris Danford, Chris Gomez (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* GameConstantsAndTypes - Things used in many places that don't change often. */ + +#ifndef GAME_CONSTANTS_AND_TYPES_H +#define GAME_CONSTANTS_AND_TYPES_H + +#include "EnumHelper.h" + +// Note definitions +/** @brief Define the mininum difficulty value allowed. */ +const int MIN_METER = 1; +/** + * @brief Define the maximum difficulty value allowed. + * + * 35 is used rather than 13 due to a variety of Profile data. + * For more examples, see Profile::InitGeneralData(). -aj + */ +const int MAX_METER = 35; + +/** @brief The maximum number of credits for coin mode. */ +const int MAX_NUM_CREDITS = 20; + + +/** + * @brief The various radar categories available. + * + * This is just cached song data. Not all of it may actually be displayed + * in the radar. */ +enum RadarCategory +{ + RadarCategory_Stream = 0, /**< How much stream is in the song? */ + RadarCategory_Voltage, /**< How much voltage is in the song? */ + RadarCategory_Air, /**< How much air is in the song? */ + RadarCategory_Freeze, /**< How much freeze (holds) is in the song? */ + RadarCategory_Chaos, /**< How much chaos is in the song? */ + RadarCategory_TapsAndHolds, /**< How many taps and holds are in the song? */ + RadarCategory_Jumps, /**< How many jumps are in the song? */ + RadarCategory_Holds, /**< How many holds are in the song? */ + RadarCategory_Mines, /**< How many mines are in the song? */ + RadarCategory_Hands, /**< How many hands are in the song? */ + RadarCategory_Rolls, /**< How many rolls are in the song? */ + RadarCategory_Lifts, /**< How many lifts are in the song? */ + RadarCategory_Fakes, /**< How many fakes are in the song? */ + NUM_RadarCategory, /**< The number of radar categories. */ + RadarCategory_Invalid +}; +/** + * @brief Turn the radar category into a proper string. + * @param cat the radar category. + * @return the string version of the radar category. + */ +const RString& RadarCategoryToString( RadarCategory cat ); +/** + * @brief Turn the radar category into a proper localized string. + * @param cat the radar category. + * @return the localized string version of the radar category. + */ +const RString& RadarCategoryToLocalizedString( RadarCategory cat ); +LuaDeclareType( RadarCategory ); + +/** @brief The different game categories available to play. */ +enum StepsTypeCategory +{ + StepsTypeCategory_Single, /**< One person plays on one side. */ + StepsTypeCategory_Double, /**< One person plays on both sides. */ + StepsTypeCategory_Couple, /**< Two players play on their own side. */ + StepsTypeCategory_Routine, /**< Two players share both sides together. */ +}; + +/** @brief The different steps types for playing. */ +enum StepsType +{ + StepsType_dance_single = 0, + StepsType_dance_double, + StepsType_dance_couple, + StepsType_dance_solo, + StepsType_dance_threepanel, + StepsType_dance_routine, + StepsType_pump_single, + StepsType_pump_halfdouble, + StepsType_pump_double, + StepsType_pump_couple, + StepsType_pump_routine, + StepsType_kb7_single, + StepsType_ez2_single, + StepsType_ez2_double, + StepsType_ez2_real, + StepsType_para_single, + StepsType_ds3ddx_single, + StepsType_beat_single5, + StepsType_beat_double5, + StepsType_beat_single7, + StepsType_beat_double7, + StepsType_maniax_single, + StepsType_maniax_double, + StepsType_techno_single4, + StepsType_techno_single5, + StepsType_techno_single8, + StepsType_techno_double4, + StepsType_techno_double5, + StepsType_techno_double8, + StepsType_popn_five, + StepsType_popn_nine, + StepsType_guitar_five, + StepsType_lights_cabinet, + NUM_StepsType, // leave this at the end + StepsType_Invalid, +}; +LuaDeclareType( StepsType ); + +/** @brief The various play modes available. */ +enum PlayMode +{ + PLAY_MODE_REGULAR, /**< The normal game mode, often with a set number of stages. */ + PLAY_MODE_NONSTOP, /**< Play a set of songs without stopping. */ + PLAY_MODE_ONI, /**< Similar to Nonstop, only there is also the danger of lives or a clock. */ + PLAY_MODE_ENDLESS, /**< Keep playing until you get a game over. */ + PLAY_MODE_BATTLE, /**< Choose when to send attacks to your opponent. */ + PLAY_MODE_RAVE, /**< Have attacks launched during play automatically. */ + NUM_PlayMode, + PlayMode_Invalid +}; +/** + * @brief Turn the play mode into a proper string. + * @param pm the play mode. + * @return the string version of the play mode. + */ +const RString& PlayModeToString( PlayMode pm ); +/** + * @brief Turn the play mode into a proper localized string. + * @param pm the play mode. + * @return the localized string version of the play mode. + */ +const RString& PlayModeToLocalizedString( PlayMode pm ); +/** + * @brief Turn the string into the proper play mode. + * @param s the string. + * @return the play mode based on the string. + */ +PlayMode StringToPlayMode( const RString& s ); +LuaDeclareType( PlayMode ); + +/** + * @brief The list of ways to sort songs and courses. + * + * All song sorts should be listed before course sorts. + */ +enum SortOrder +{ + // song sorts + SORT_PREFERRED, /**< Sort by the user's preferred settings. */ + SORT_GROUP, /**< Sort by the groups the Songs are in. */ + SORT_TITLE, /**< Sort by the Song's title. */ + SORT_BPM, /**< Sort by the Song's BPM. */ + SORT_POPULARITY, /**< Sort by how popular the Song is. */ + SORT_TOP_GRADES, /**< Sort by the highest grades earned on a Song. */ + SORT_ARTIST, /**< Sort by the name of the artist of the Song. */ + SORT_GENRE, /**< Sort by the Song's genre. */ + SORT_BEGINNER_METER, /**< Sort by the difficulty of the single beginner meter. */ + SORT_EASY_METER, /**< Sort by the difficulty of the single easy meter. */ + SORT_MEDIUM_METER, /**< Sort by the difficulty of the single medium meter. */ + SORT_HARD_METER, /**< Sort by the difficulty of the single hard meter. */ + SORT_CHALLENGE_METER, /**< Sort by the difficulty of the single challenge meter. */ + SORT_DOUBLE_EASY_METER, /**< Sort by the difficulty of the double easy meter. */ + SORT_DOUBLE_MEDIUM_METER, /**< Sort by the difficulty of the double medium meter. */ + SORT_DOUBLE_HARD_METER, /**< Sort by the difficulty of the double hard meter. */ + SORT_DOUBLE_CHALLENGE_METER, /**< Sort by the difficulty of the double challenge meter. */ + // + SORT_MODE_MENU, /**< Have access to the menu for choosing the sort. */ + // course sorts + SORT_ALL_COURSES, /**< Sort with all courses available. */ + SORT_NONSTOP_COURSES, /**< View only the nonstop courses. */ + SORT_ONI_COURSES, /**< View only the oni/survival courses. */ + SORT_ENDLESS_COURSES, /**< View only the endless courses. */ + SORT_LENGTH, /**< Sort the courses by how long they would last. */ + SORT_ROULETTE, + SORT_RECENT, + NUM_SortOrder, + SortOrder_Invalid +}; +/** @brief Only allow certain sort modes to be selectable. */ +const SortOrder MAX_SELECTABLE_SORT = (SortOrder)(SORT_ROULETTE-1); +/** + * @brief Turn the sort order into a proper string. + * @param so the sort order. + * @return the string version of the sort order. + */ +const RString& SortOrderToString( SortOrder so ); +/** + * @brief Turn the sort order into a proper localized string. + * @param so the sort order. + * @return the localized string version of the sort order. + */ +const RString& SortOrderToLocalizedString( SortOrder so ); +/** + * @brief Turn the string into the proper sort order. + * @param str the string. + * @return the sort order based on the string. + */ +SortOrder StringToSortOrder( const RString& str ); +LuaDeclareType( SortOrder ); +/** + * @brief Determine if the sort order in question is for songs or not. + * + * This function is mainly used for saving sort order to the profile. -aj + */ +inline bool IsSongSort( SortOrder so ) { return so >= SORT_PREFERRED && so <= SORT_DOUBLE_CHALLENGE_METER; } + +/** @brief The list of tap note scores available during play. */ +enum TapNoteScore { + TNS_None, /**< There is no score involved with this one. */ + TNS_HitMine, /**< A mine was hit successfully. */ + TNS_AvoidMine, /**< A mine was avoided successfully. */ + TNS_CheckpointMiss, /**< A checkpoint was missed during a hold. */ + TNS_Miss, /**< A note was missed entirely. */ + TNS_W5, /**< A note was almost missed, but not quite. */ + TNS_W4, /**< A note was hit either a bit early or a bit late. */ + TNS_W3, /**< A note was hit with decent accuracy, but not the best. */ + TNS_W2, /**< A note was hit off by just a miniscule amount. This used to be the best rating. */ + TNS_W1, /**< A note was hit perfectly. */ + TNS_CheckpointHit, /**< A checkpoint was held during a hold. */ + NUM_TapNoteScore, /**< The number of Tap Note Scores available. */ + TapNoteScore_Invalid, +}; +/** + * @brief Turn the tap note score into a proper string. + * @param tns the tap note score. + * @return the string version of the tap note score. + */ +const RString& TapNoteScoreToString( TapNoteScore tns ); +/** + * @brief Turn the tap note score into a proper localized string. + * @param tns the tap note score. + * @return the localized string version of the tap note score. + */ +const RString& TapNoteScoreToLocalizedString( TapNoteScore tns ); +/** + * @brief Turn the string into the proper tap note score. + * @param str the string. + * @return the tap note score based on the string. + */ +TapNoteScore StringToTapNoteScore( const RString& str ); +LuaDeclareType( TapNoteScore ); + +/** @brief The list of hold note scores available during play. */ +enum HoldNoteScore +{ + HNS_None, /**< The HoldNote was not scored yet. */ + HNS_LetGo, /**< The HoldNote has passed, but the player missed it. */ + HNS_Held, /**< The HoldNote has passed, and was successfully held all the way. */ + NUM_HoldNoteScore, /**< The number of hold note scores. */ + HoldNoteScore_Invalid, +}; +/** + * @brief Turn the hold note score into a proper string. + * @param hns the hold note score. + * @return the string version of the hold note score. + */ +const RString& HoldNoteScoreToString( HoldNoteScore hns ); +/** + * @brief Turn the hold note score into a proper localized string. + * @param hns the hold note score. + * @return the localized string version of the hold note score. + */ +const RString& HoldNoteScoreToLocalizedString( HoldNoteScore hns ); +/** + * @brief Turn the string into the proper hold note score. + * @param str the string. + * @return the hold note score based on the string. + */ +HoldNoteScore StringToHoldNoteScore( const RString& str ); +LuaDeclareType( HoldNoteScore ); + +/** @brief The list of timing windows to deal with when playing. */ +enum TimingWindow +{ + TW_W1, + TW_W2, + TW_W3, + TW_W4, + TW_W5, + TW_Mine, + TW_Attack, + TW_Hold, + TW_Roll, + NUM_TimingWindow +}; +const RString& TimingWindowToString( TimingWindow tw ); + +/** @brief The list of score events that can take place while playing. */ +enum ScoreEvent +{ + SE_CheckpointHit, + SE_W1, + SE_W2, + SE_W3, + SE_W4, + SE_W5, + SE_Miss, + SE_HitMine, + SE_CheckpointMiss, + SE_Held, + SE_LetGo, + NUM_ScoreEvent +}; +const RString& ScoreEventToString( ScoreEvent se ); + +/** @brief The list of game button types available for all game modes. */ +enum GameButtonType +{ + GameButtonType_Step, + GameButtonType_Fret, + GameButtonType_Strum, + GameButtonType_INVALID +}; + +/** @brief The list of judge types for the tap note scores. */ +enum TapNoteScoreJudgeType +{ + TapNoteScoreJudgeType_MinimumScore, + TapNoteScoreJudgeType_LastScore, + NUM_TapNoteScoreJudgeType, + TapNoteScoreJudgeType_Invalid, +}; +const RString& TapNoteScoreJudgeTypeToString( TapNoteScoreJudgeType jt ); +LuaDeclareType( TapNoteScoreJudgeType ); + + +/** @brief The profile slots available. This is mainly for Profiles and Memory Cards. */ +enum ProfileSlot +{ + ProfileSlot_Player1, + ProfileSlot_Player2, + ProfileSlot_Machine, + NUM_ProfileSlot, + ProfileSlot_Invalid +}; +const RString& ProfileSlotToString( ProfileSlot ps ); +LuaDeclareType( ProfileSlot ); + +/** @brief The states of the memory card during play. */ +enum MemoryCardState +{ + MemoryCardState_Ready, + MemoryCardState_Checking, + MemoryCardState_TooLate, + MemoryCardState_Error, + MemoryCardState_Removed, + MemoryCardState_NoCard, + NUM_MemoryCardState, + MemoryCardState_Invalid, +}; + +const RString& MemoryCardStateToString( MemoryCardState mcs ); +LuaDeclareType( MemoryCardState ); + +/** @brief The different ranking categories based on difficulty meter average. */ +enum RankingCategory +{ + RANKING_A, /**< 1-3 meter per song avg. */ + RANKING_B, /**< 4-6 meter per song avg. */ + RANKING_C, /**< 7-9 meter per song avg. */ + RANKING_D, /**< 10+ meter per song avg, not counting extra stages. */ + NUM_RankingCategory, /**< The number of ranking categories. */ + RankingCategory_Invalid +}; +const RString& RankingCategoryToString( RankingCategory rc ); +RankingCategory StringToRankingCategory( const RString& rc ); + +extern const vector RANKING_TO_FILL_IN_MARKER; +inline bool IsRankingToFillIn( const RString& sName ) { return !sName.empty() && sName[0]=='#'; } + +RankingCategory AverageMeterToRankingCategory( int iAverageMeter ); + +// Group stuff +extern const RString GROUP_ALL; + + +/** @brief The different types of players in the game. */ +enum PlayerController +{ + PC_HUMAN, + PC_AUTOPLAY, + PC_CPU, + //PC_REPLAY, + NUM_PlayerController, + PlayerController_Invalid +}; +const RString& PlayerControllerToString( PlayerController pc ); +LuaDeclareType( PlayerController ); + +/** @brief The different health bar states. */ +enum HealthState +{ + HealthState_Hot, /**< The health bar is very full. */ + HealthState_Alive, /**< The health bar is at a decent size. */ + HealthState_Danger, /**< The health bar is about to run out. */ + HealthState_Dead, /**< The health bar is drained completely. */ + NUM_HealthState, + HealthState_Invalid +}; +LuaDeclareType( HealthState ); + +/** @brief The different stage results during battle. */ +enum StageResult +{ + RESULT_WIN, /**< The player has won the battle. */ + RESULT_LOSE, /**< The player has lost the battle. */ + RESULT_DRAW /**< The player has tied with the competitor. */ +}; + + +// Battle stuff +/** @brief The number of inventory slots available for attacks. */ +const int NUM_INVENTORY_SLOTS = 3; +enum AttackLevel +{ + ATTACK_LEVEL_1, + ATTACK_LEVEL_2, + ATTACK_LEVEL_3, + NUM_ATTACK_LEVELS +}; +const int NUM_ATTACKS_PER_LEVEL = 3; +const int ITEM_NONE = -1; + + +// Coin stuff +/** @brief The different coin modes to determine how one can play. */ +enum CoinMode +{ + CoinMode_Home, /**< The full range of options are available. */ + CoinMode_Pay, /**< Coins must be inserted before a game can begin. */ + CoinMode_Free, /**< It costs no money to play, but otherwise is similar to Pay mode. */ + NUM_CoinMode, + CoinMode_Invalid +}; +const RString& CoinModeToString( CoinMode cm ); +LuaDeclareType( CoinMode ); + + +/** @brief The different types of premiums available to take advantage of. */ +enum Premium +{ + Premium_Off, /**< It will cost one credit per side of the machine. */ + Premium_DoubleFor1Credit, /**< It will cost one credit per player of the machine. */ + Premium_2PlayersFor1Credit, /**< One credit gives one or both players full access. */ + NUM_Premium, + Premium_Invalid +}; +const RString& PremiumToString( Premium p ); +const RString& PremiumToLocalizedString( Premium p ); +LuaDeclareType( Premium ); + + +/** @brief The various stage awards that can be given based on excellent play. */ +enum StageAward +{ + StageAward_FullComboW3, /**< A full great combo (or equivalent) was earned. */ + StageAward_SingleDigitW3, /**< A single digit great combo (or equivalent) was earned. */ + StageAward_OneW3, /**< Only one great (or equivalent) was earned. */ + StageAward_FullComboW2, /**< A full excellent combo (or equivalent) was earned. */ + StageAward_SingleDigitW2, /**< A single digit excellent combo (or equivalent) was earned. */ + StageAward_OneW2, /**< Only one excellent (or equivalent) was earned. */ + StageAward_FullComboW1, /**< All fantastics (or equivalent) were earned. */ + StageAward_80PercentW3, + StageAward_90PercentW3, + StageAward_100PercentW3, + NUM_StageAward, + StageAward_Invalid, +}; +const RString& StageAwardToString( StageAward pma ); +const RString& StageAwardToLocalizedString( StageAward pma ); +StageAward StringToStageAward( const RString& pma ); +LuaDeclareType( StageAward ); + +/** @brief The various peak combo awards should such a combo be attained during play. */ +enum PeakComboAward +{ + PeakComboAward_1000, + PeakComboAward_2000, + PeakComboAward_3000, + PeakComboAward_4000, + PeakComboAward_5000, + PeakComboAward_6000, + PeakComboAward_7000, + PeakComboAward_8000, + PeakComboAward_9000, + PeakComboAward_10000, + NUM_PeakComboAward, + PeakComboAward_Invalid, +}; +const RString& PeakComboAwardToString( PeakComboAward pma ); +const RString& PeakComboAwardToLocalizedString( PeakComboAward pma ); +PeakComboAward StringToPeakComboAward( const RString& pma ); +LuaDeclareType( PeakComboAward ); + +/** @brief The list of BPMs to display */ +struct DisplayBpms +{ + /** + * @brief Add a BPM to the list. + * @param f the BPM to add. + */ + void Add( float f ); + /** + * @brief Retrieve the minimum BPM of the set. + * @return the minimum BPM. + */ + float GetMin() const; + /** + * @brief Retrieve the maximum BPM of the set. + * @return the maximum BPM. + */ + float GetMax() const; + /** + * @brief Determine if the BPM is really constant. + * @return Whether the BPM is constant or not. + */ + bool BpmIsConstant() const; + /** + * @brief Determine if the BPM is meant to be a secret. + * @return Whether the BPM is a secret or not. + */ + bool IsSecret() const; + /** + * @brief The list of the BPMs for the song or course. + */ + vector vfBpms; +}; + +/** @brief The various style types available. */ +enum StyleType +{ + StyleType_OnePlayerOneSide, /**< Single style */ + StyleType_TwoPlayersTwoSides, /**< Versus style */ + StyleType_OnePlayerTwoSides, /**< Double style */ + StyleType_TwoPlayersSharedSides, /**< Routine style */ + NUM_StyleType, + StyleType_Invalid +}; +const RString& StyleTypeToString( StyleType s ); +StyleType StringToStyleType( const RString& s ); +LuaDeclareType( StyleType ); + +/** @brief The different goal types, mainly meant for fitness modes. */ +enum GoalType +{ + GoalType_Calories, + GoalType_Time, + GoalType_None, + NUM_GoalType, + GoalType_Invalid, +}; +const RString& GoalTypeToString( GoalType gt ); +GoalType StringToGoalType( const RString& s ); +LuaDeclareType( GoalType ); + +/** @brief The different types of Edit modes available. */ +enum EditMode +{ + EditMode_Practice, + EditMode_CourseMods, + EditMode_Home, + EditMode_Full, + NUM_EditMode, + EditMode_Invalid, +}; +const RString& EditModeToString( EditMode em ); +EditMode StringToEditMode( const RString& s ); +LuaDeclareType( EditMode ); + +/** + * @brief The different types of sample music previews available. + * + * These were originally from the deleted screen ScreenEz2SelectMusic. + * (if no confirm type is mentioned, there is none.) + * + * 0 = play music as you select; SampleMusicPreviewMode_Normal + * 1 = no music plays, select 1x to play preview music, select again to confirm + * 2 = no music plays at all (SampleMusicPreviewMode_ScreenMusic + redir to silent) + * 3 = play music as select, 2x to confirm (SampleMusicPreviewMode_Normal + [SSMusic] TwoPartConfirmsOnly) + * 4 = screen music plays; SampleMusicPreviewMode_ScreenMusic + */ +enum SampleMusicPreviewMode +{ + SampleMusicPreviewMode_Normal, /**< Music is played as the song is highlighted. */ + SampleMusicPreviewMode_StartToPreview, + SampleMusicPreviewMode_ScreenMusic, /**< No music plays. Select it once to preview the music, + * then once more to select the song. */ + SampleMusicPreviewMode_LastSong, /**< continue playing the last song */ + NUM_SampleMusicPreviewMode, + SampleMusicPreviewMode_Invalid, +}; +const RString& SampleMusicPreviewModeToString( SampleMusicPreviewMode ); +SampleMusicPreviewMode StringToSampleMusicPreviewMode( const RString& s ); +LuaDeclareType( SampleMusicPreviewMode ); + +/** + * @brief The different kinds of Stages available. + * + * These are shared stage values shown in StageDisplay. These are not per-player. + */ +enum Stage +{ + Stage_1st, /**< The first stage. */ + Stage_2nd, /**< The second stage. */ + Stage_3rd, /**< The third stage. */ + Stage_4th, /**< The fourth stage. */ + Stage_5th, /**< The fifth stage. */ + Stage_6th, /**< The sixth stage. */ + Stage_Next, /**< Somewhere between the sixth and final stage. + * This won't normally happen because 7 stages is the max in the UI. */ + Stage_Final, /**< The last stage. */ + Stage_Extra1, /**< The first bonus stage, AKA the extra stage. */ + Stage_Extra2, /**< The last bonus stage, AKA the encore extra stage. */ + Stage_Nonstop, /**< Playing a nonstop course. */ + Stage_Oni, /**< Playing an oni or survival course. */ + Stage_Endless, /**< Playing an endless course. */ + Stage_Event, /**< Playing in event mode. */ + Stage_Demo, /**< Playing the demonstration. */ + NUM_Stage, /**< The number of stage types. */ + Stage_Invalid, +}; +const RString& StageToString( Stage s ); +LuaDeclareType( Stage ); +const RString& StageToLocalizedString( Stage i ); + +/** @brief The different possibilities of earning an extra stage. */ +enum EarnedExtraStage +{ + EarnedExtraStage_No, /**< No extra stage was earned. */ + EarnedExtraStage_Extra1, /**< The first extra stage was earned. */ + EarnedExtraStage_Extra2, /**< The second extra stage (or encore extra stage) was earned. */ + NUM_EarnedExtraStage, + EarnedExtraStage_Invalid +}; +const RString& EarnedExtraStageToString( EarnedExtraStage s ); +LuaDeclareType( EarnedExtraStage ); + +/** @brief The different results of loading a profile. */ +enum ProfileLoadResult +{ + ProfileLoadResult_Success, + ProfileLoadResult_FailedNoProfile, + ProfileLoadResult_FailedTampered +}; + +/** @brief The different statuses for multiplayer. */ +enum MultiPlayerStatus +{ + MultiPlayerStatus_Joined, + MultiPlayerStatus_NotJoined, + MultiPlayerStatus_Unplugged, + MultiPlayerStatus_MissingMultitap, + NUM_MultiPlayerStatus, + MultiPlayerStatus_Invalid +}; +const RString& MultiPlayerStatusToString( MultiPlayerStatus i ); + +/** @brief The different course types. */ +enum CourseType +{ + COURSE_TYPE_NONSTOP, /**< The life meter type is set to BAR. */ + COURSE_TYPE_ONI, /**< The life meter type is set to BATTERY. */ + COURSE_TYPE_ENDLESS, /**< The life meter type is set to REPEAT. */ + COURSE_TYPE_SURVIVAL, /**< The life meter type is set to TIME. */ + NUM_CourseType, + CourseType_Invalid +}; +/** @brief A special iterator for handling the CourseTypes. */ +#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, i ) +const RString& CourseTypeToString( CourseType i ); +const RString& CourseTypeToLocalizedString( CourseType i ); +LuaDeclareType( CourseType ); + + +#endif + +/** + * @file + * @author Chris Danford, Chris Gomez (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameInput.cpp b/src/GameInput.cpp index f4faa49a3b..4f325f6693 100644 --- a/src/GameInput.cpp +++ b/src/GameInput.cpp @@ -1,83 +1,83 @@ -#include "global.h" -#include "GameInput.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "InputMapper.h" -#include "ThemeManager.h" - - -static const char *GameControllerNames[] = { - "1", - "2", -}; -XToString( GameController ); -StringToX( GameController ); -LuaXType( GameController ); - - -RString GameButtonToString( const InputScheme* pInputs, GameButton i ) -{ - return pInputs->GetGameButtonName(i); -} - -RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ) -{ - return THEME->GetString( "GameButton", GameButtonToString(pInputs,i) ); -} - -GameButton StringToGameButton( const InputScheme* pInputs, const RString& s ) -{ - FOREACH_GameButtonInScheme( pInputs, i ) - { - if( s == GameButtonToString(pInputs, i) ) - return i; - } - return GameButton_Invalid; -} - - -RString GameInput::ToString( const InputScheme* pInputs ) const -{ - return GameControllerToString(controller) + RString("_") + GameButtonToString(pInputs,button); -} - -bool GameInput::FromString( const InputScheme* pInputs, const RString &s ) -{ - char szController[32] = ""; - char szButton[32] = ""; - - if( 2 != sscanf( s, "%31[^_]_%31[^_]", szController, szButton ) ) - { - controller = GameController_Invalid; - return false; - } - - controller = StringToGameController( szController ); - button = StringToGameButton( pInputs, szButton ); - return true; -}; - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GameInput.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "InputMapper.h" +#include "ThemeManager.h" + + +static const char *GameControllerNames[] = { + "1", + "2", +}; +XToString( GameController ); +StringToX( GameController ); +LuaXType( GameController ); + + +RString GameButtonToString( const InputScheme* pInputs, GameButton i ) +{ + return pInputs->GetGameButtonName(i); +} + +RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ) +{ + return THEME->GetString( "GameButton", GameButtonToString(pInputs,i) ); +} + +GameButton StringToGameButton( const InputScheme* pInputs, const RString& s ) +{ + FOREACH_GameButtonInScheme( pInputs, i ) + { + if( s == GameButtonToString(pInputs, i) ) + return i; + } + return GameButton_Invalid; +} + + +RString GameInput::ToString( const InputScheme* pInputs ) const +{ + return GameControllerToString(controller) + RString("_") + GameButtonToString(pInputs,button); +} + +bool GameInput::FromString( const InputScheme* pInputs, const RString &s ) +{ + char szController[32] = ""; + char szButton[32] = ""; + + if( 2 != sscanf( s, "%31[^_]_%31[^_]", szController, szButton ) ) + { + controller = GameController_Invalid; + return false; + } + + controller = StringToGameController( szController ); + button = StringToGameButton( pInputs, szButton ); + return true; +}; + +/* + * (c) 2001-2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameInput.h b/src/GameInput.h index fcdb61bf0e..8ee0532c02 100644 --- a/src/GameInput.h +++ b/src/GameInput.h @@ -1,246 +1,246 @@ -#ifndef GAME_INPUT_H -#define GAME_INPUT_H - -#include "EnumHelper.h" - -class InputScheme; - -/** @brief the list of controllers in use. */ -enum GameController -{ - GameController_1 = 0, /**< The left controller */ - GameController_2, /**< The right controller */ - NUM_GameController, /**< The number of controllers allowed. */ - GameController_Invalid, -}; -const RString& GameControllerToString( GameController mp ); -LuaDeclareType( GameController ); - -/** @brief the list of buttons StepMania recognizes. */ -enum GameButton -{ - GAME_BUTTON_MENULEFT, /**< Navigate the menus to the left. */ - GAME_BUTTON_MENURIGHT, /**< Navigate the menus to the right. */ - GAME_BUTTON_MENUUP, /**< Navigate the menus to the top. */ - GAME_BUTTON_MENUDOWN, /**< Navigate the menus to the bottom. */ - GAME_BUTTON_START, - GAME_BUTTON_SELECT, - GAME_BUTTON_BACK, - GAME_BUTTON_COIN, /**< Insert a coin to play. */ - GAME_BUTTON_OPERATOR, /**< Access the operator menu. */ - GAME_BUTTON_EFFECT_UP, - GAME_BUTTON_EFFECT_DOWN, - GAME_BUTTON_CUSTOM_01, - GAME_BUTTON_CUSTOM_02, - GAME_BUTTON_CUSTOM_03, - GAME_BUTTON_CUSTOM_04, - GAME_BUTTON_CUSTOM_05, - GAME_BUTTON_CUSTOM_06, - GAME_BUTTON_CUSTOM_07, - GAME_BUTTON_CUSTOM_08, - GAME_BUTTON_CUSTOM_09, - GAME_BUTTON_CUSTOM_10, - GAME_BUTTON_CUSTOM_11, - GAME_BUTTON_CUSTOM_12, - GAME_BUTTON_CUSTOM_13, - GAME_BUTTON_CUSTOM_14, - GAME_BUTTON_CUSTOM_15, - GAME_BUTTON_CUSTOM_16, - GAME_BUTTON_CUSTOM_17, - GAME_BUTTON_CUSTOM_18, - GAME_BUTTON_CUSTOM_19, - - NUM_GameButton, - GameButton_Invalid -}; - -RString GameButtonToString( const InputScheme* pInputs, GameButton i ); -RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ); -GameButton StringToGameButton( const InputScheme* pInputs, const RString& s ); - -/** @brief A special way to loop through each game button. */ -#define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb other.controller ) - return false; - return button < other.button; - } - - inline bool IsValid() const { return controller != GameController_Invalid && button != GameButton_Invalid; }; - inline void MakeInvalid() { controller = GameController_Invalid; button = GameButton_Invalid; }; - - RString ToString( const InputScheme* pInputs ) const; - bool FromString( const InputScheme* pInputs, const RString &s ); -}; - -#endif - -/** - * @file - * @author Chris Danford (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef GAME_INPUT_H +#define GAME_INPUT_H + +#include "EnumHelper.h" + +class InputScheme; + +/** @brief the list of controllers in use. */ +enum GameController +{ + GameController_1 = 0, /**< The left controller */ + GameController_2, /**< The right controller */ + NUM_GameController, /**< The number of controllers allowed. */ + GameController_Invalid, +}; +const RString& GameControllerToString( GameController mp ); +LuaDeclareType( GameController ); + +/** @brief the list of buttons StepMania recognizes. */ +enum GameButton +{ + GAME_BUTTON_MENULEFT, /**< Navigate the menus to the left. */ + GAME_BUTTON_MENURIGHT, /**< Navigate the menus to the right. */ + GAME_BUTTON_MENUUP, /**< Navigate the menus to the top. */ + GAME_BUTTON_MENUDOWN, /**< Navigate the menus to the bottom. */ + GAME_BUTTON_START, + GAME_BUTTON_SELECT, + GAME_BUTTON_BACK, + GAME_BUTTON_COIN, /**< Insert a coin to play. */ + GAME_BUTTON_OPERATOR, /**< Access the operator menu. */ + GAME_BUTTON_EFFECT_UP, + GAME_BUTTON_EFFECT_DOWN, + GAME_BUTTON_CUSTOM_01, + GAME_BUTTON_CUSTOM_02, + GAME_BUTTON_CUSTOM_03, + GAME_BUTTON_CUSTOM_04, + GAME_BUTTON_CUSTOM_05, + GAME_BUTTON_CUSTOM_06, + GAME_BUTTON_CUSTOM_07, + GAME_BUTTON_CUSTOM_08, + GAME_BUTTON_CUSTOM_09, + GAME_BUTTON_CUSTOM_10, + GAME_BUTTON_CUSTOM_11, + GAME_BUTTON_CUSTOM_12, + GAME_BUTTON_CUSTOM_13, + GAME_BUTTON_CUSTOM_14, + GAME_BUTTON_CUSTOM_15, + GAME_BUTTON_CUSTOM_16, + GAME_BUTTON_CUSTOM_17, + GAME_BUTTON_CUSTOM_18, + GAME_BUTTON_CUSTOM_19, + + NUM_GameButton, + GameButton_Invalid +}; + +RString GameButtonToString( const InputScheme* pInputs, GameButton i ); +RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ); +GameButton StringToGameButton( const InputScheme* pInputs, const RString& s ); + +/** @brief A special way to loop through each game button. */ +#define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb other.controller ) + return false; + return button < other.button; + } + + inline bool IsValid() const { return controller != GameController_Invalid && button != GameButton_Invalid; }; + inline void MakeInvalid() { controller = GameController_Invalid; button = GameButton_Invalid; }; + + RString ToString( const InputScheme* pInputs ) const; + bool FromString( const InputScheme* pInputs, const RString &s ); +}; + +#endif + +/** + * @file + * @author Chris Danford (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameLoop.cpp b/src/GameLoop.cpp index 2520c8ea26..d30cba98da 100644 --- a/src/GameLoop.cpp +++ b/src/GameLoop.cpp @@ -1,375 +1,375 @@ -#include "global.h" -#include "GameLoop.h" -#include "RageLog.h" -#include "RageTextureManager.h" -#include "RageSoundManager.h" -#include "PrefsManager.h" -#include "RageDisplay.h" - -#include "arch/ArchHooks/ArchHooks.h" - -#include "GameSoundManager.h" -#include "ThemeManager.h" -#include "SongManager.h" -#include "GameState.h" -#include "MemoryCardManager.h" -#include "ScreenManager.h" -#include "InputFilter.h" -#include "InputMapper.h" -#include "RageFileManager.h" -#include "LightsManager.h" -#include "NetworkSyncManager.h" -#include "RageTimer.h" -#include "RageInput.h" - -static RageTimer g_GameplayTimer; - -static Preference g_bNeverBoostAppPriority( "NeverBoostAppPriority", false ); - -/* experimental: force a specific update rate. This prevents big animation - * jumps on frame skips. 0 to disable. */ -static Preference g_fConstantUpdateDeltaSeconds( "ConstantUpdateDeltaSeconds", 0 ); - -void HandleInputEvents( float fDeltaTime ); - -static float g_fUpdateRate = 1; -void GameLoop::SetUpdateRate( float fUpdateRate ) -{ - g_fUpdateRate = fUpdateRate; -} - -static void CheckGameLoopTimerSkips( float fDeltaTime ) -{ - if( !PREFSMAN->m_bLogSkips ) - return; - - static int iLastFPS = 0; - int iThisFPS = DISPLAY->GetFPS(); - - /* If vsync is on, and we have a solid framerate (vsync == refresh and we've - * sustained this for at least one second), we expect the amount of time for - * the last frame to be 1/FPS. */ - if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS ) - { - iLastFPS = iThisFPS; - return; - } - - const float fExpectedTime = 1.0f / iThisFPS; - const float fDifference = fDeltaTime - fExpectedTime; - if( fabsf(fDifference) > 0.002f && fabsf(fDifference) < 0.100f ) - LOG->Trace( "GameLoop timer skip: %i FPS, expected %.3f, got %.3f (%.3f difference)", - iThisFPS, fExpectedTime, fDeltaTime, fDifference ); -} - -static bool ChangeAppPri() -{ - if( g_bNeverBoostAppPriority.Get() ) - return false; - - // if using NTPAD don't boost or else input is laggy -#if defined(_WINDOWS) - { - vector vDevices; - - // This can get called before INPUTMAN is constructed. - if( INPUTMAN ) - { - INPUTMAN->GetDevicesAndDescriptions(vDevices); - FOREACH_CONST( InputDeviceInfo, vDevices, d ) - { - if( d->sDesc.find("NTPAD") != string::npos ) - { - LOG->Trace( "Using NTPAD. Don't boost priority." ); - return false; - } - } - } - } -#endif - - // If this is a debug build, don't. It makes the VC debugger sluggish. -#if defined(WIN32) && defined(DEBUG) - return false; -#else - return true; -#endif -} - -static void CheckFocus() -{ - if( !HOOKS->AppFocusChanged() ) - return; - - // If we lose focus, we may lose input events, especially key releases. - INPUTFILTER->Reset(); - - if( ChangeAppPri() ) - { - if( HOOKS->AppHasFocus() ) - HOOKS->BoostPriority(); - else - HOOKS->UnBoostPriority(); - } -} - -// On the next update, change themes, and load sNewScreen. -static RString g_sNewTheme; -static RString g_sNewScreen; -static bool g_bForceThemeReload; -void GameLoop::ChangeTheme( const RString &sNewTheme, const RString &sNewScreen, bool bForced ) -{ - g_sNewTheme = sNewTheme; - g_sNewScreen = sNewScreen; - g_bForceThemeReload = bForced; -} - -#include "StepMania.h" // XXX -namespace -{ - void DoChangeTheme() - { - SAFE_DELETE( SCREENMAN ); - TEXTUREMAN->DoDelayedDelete(); - - // In case the previous theme overloaded class bindings, reinitialize them. - LUA->RegisterTypes(); - - THEME->SwitchThemeAndLanguage( g_sNewTheme, THEME->GetCurLanguage(), PREFSMAN->m_bPseudoLocalize, g_bForceThemeReload ); - PREFSMAN->m_sTheme.Set( g_sNewTheme ); - - // Apply the new window title, icon and aspect ratio. - StepMania::ApplyGraphicOptions(); - - SCREENMAN = new ScreenManager(); - - StepMania::ResetGame(); - SCREENMAN->ThemeChanged(); - SCREENMAN->SetNewScreen( g_sNewScreen ); - - g_sNewTheme = RString(); - g_sNewScreen = RString(); - } - -} - -void GameLoop::RunGameLoop() -{ - /* People may want to do something else while songs are loading, so do - * this after loading songs. */ - if( ChangeAppPri() ) - HOOKS->BoostPriority(); - - while( !ArchHooks::UserQuit() ) - { - if( !g_sNewTheme.empty() ) - DoChangeTheme(); - - // Update - float fDeltaTime = g_GameplayTimer.GetDeltaTime(); - - if( g_fConstantUpdateDeltaSeconds > 0 ) - fDeltaTime = g_fConstantUpdateDeltaSeconds; - - CheckGameLoopTimerSkips( fDeltaTime ); - - fDeltaTime *= g_fUpdateRate; - - CheckFocus(); - - // Update SOUNDMAN early (before any RageSound::GetPosition calls), to flush position data. - SOUNDMAN->Update(); - - /* Update song beat information -before- calling update on all the classes that - * depend on it. If you don't do this first, the classes are all acting on old - * information and will lag. (but no longer fatally, due to timestamping -glenn) */ - SOUND->Update( fDeltaTime ); - TEXTUREMAN->Update( fDeltaTime ); - GAMESTATE->Update( fDeltaTime ); - SCREENMAN->Update( fDeltaTime ); - MEMCARDMAN->Update(); - NSMAN->Update( fDeltaTime ); - - /* Important: Process input AFTER updating game logic, or input will be - * acting on song beat from last frame */ - HandleInputEvents( fDeltaTime ); - - if( INPUTMAN->DevicesChanged() ) - { - INPUTFILTER->Reset(); // fix "buttons stuck" if button held while unplugged - INPUTMAN->LoadDrivers(); - RString sMessage; - if( INPUTMAPPER->CheckForChangedInputDevicesAndRemap(sMessage) ) - SCREENMAN->SystemMessage( sMessage ); - } - - LIGHTSMAN->Update( fDeltaTime ); - - // Render - SCREENMAN->Draw(); - } - - // If we ended mid-game, finish up. - GAMESTATE->SaveLocalData(); - - if( ChangeAppPri() ) - HOOKS->UnBoostPriority(); -} - -class ConcurrentRenderer -{ -public: - ConcurrentRenderer(); - ~ConcurrentRenderer(); - - void Start(); - void Stop(); - -private: - RageThread m_Thread; - RageEvent m_Event; - bool m_bShutdown; - void RenderThread(); - static int StartRenderThread( void *p ); - - enum State { RENDERING_IDLE, RENDERING_START, RENDERING_ACTIVE, RENDERING_END }; - State m_State; -}; -static ConcurrentRenderer *g_pConcurrentRenderer = NULL; - -ConcurrentRenderer::ConcurrentRenderer(): - m_Event("ConcurrentRenderer") -{ - m_bShutdown = false; - m_State = RENDERING_IDLE; - - m_Thread.SetName( "ConcurrentRenderer" ); - m_Thread.Create( StartRenderThread, this ); -} - -ConcurrentRenderer::~ConcurrentRenderer() -{ - ASSERT( m_State == RENDERING_IDLE ); - m_bShutdown = true; - m_Thread.Wait(); -} - -void ConcurrentRenderer::Start() -{ - DISPLAY->BeginConcurrentRenderingMainThread(); - - m_Event.Lock(); - ASSERT( m_State == RENDERING_IDLE ); - m_State = RENDERING_START; - m_Event.Signal(); - while( m_State != RENDERING_ACTIVE ) - m_Event.Wait(); - m_Event.Unlock(); -} - -void ConcurrentRenderer::Stop() -{ - m_Event.Lock(); - ASSERT( m_State == RENDERING_ACTIVE ); - m_State = RENDERING_END; - m_Event.Signal(); - while( m_State != RENDERING_IDLE ) - m_Event.Wait(); - m_Event.Unlock(); - - DISPLAY->EndConcurrentRenderingMainThread(); -} - -void ConcurrentRenderer::RenderThread() -{ - ASSERT( SCREENMAN != NULL ); - - while( !m_bShutdown ) - { - m_Event.Lock(); - while( m_State == RENDERING_IDLE && !m_bShutdown ) - m_Event.Wait(); - m_Event.Unlock(); - - if( m_State == RENDERING_START ) - { - /* We're starting to render. Set up, and then kick the event to wake - * up the calling thread. */ - DISPLAY->BeginConcurrentRendering(); - HOOKS->SetupConcurrentRenderingThread(); - - LOG->Trace( "ConcurrentRenderer::RenderThread start" ); - - m_Event.Lock(); - m_State = RENDERING_ACTIVE; - m_Event.Signal(); - m_Event.Unlock(); - } - - /* This is started during Update(). The next thing the game loop - * will do is Draw, so shift operations around to put Draw at the - * top. This makes sure updates are seamless. */ - if( m_State == RENDERING_ACTIVE ) - { - SCREENMAN->Draw(); - - float fDeltaTime = g_GameplayTimer.GetDeltaTime(); - SCREENMAN->Update( fDeltaTime ); - } - - if( m_State == RENDERING_END ) - { - LOG->Trace( "ConcurrentRenderer::RenderThread done" ); - - DISPLAY->EndConcurrentRendering(); - - m_Event.Lock(); - m_State = RENDERING_IDLE; - m_Event.Signal(); - m_Event.Unlock(); - } - } -} - -int ConcurrentRenderer::StartRenderThread( void *p ) -{ - ((ConcurrentRenderer *) p)->RenderThread(); - return 0; -} - -void GameLoop::StartConcurrentRendering() -{ - if( g_pConcurrentRenderer == NULL ) - g_pConcurrentRenderer = new ConcurrentRenderer; - g_pConcurrentRenderer->Start(); -} - -void GameLoop::FinishConcurrentRendering() -{ - g_pConcurrentRenderer->Stop(); -} - -/* - * (c) 2001-2005 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GameLoop.h" +#include "RageLog.h" +#include "RageTextureManager.h" +#include "RageSoundManager.h" +#include "PrefsManager.h" +#include "RageDisplay.h" + +#include "arch/ArchHooks/ArchHooks.h" + +#include "GameSoundManager.h" +#include "ThemeManager.h" +#include "SongManager.h" +#include "GameState.h" +#include "MemoryCardManager.h" +#include "ScreenManager.h" +#include "InputFilter.h" +#include "InputMapper.h" +#include "RageFileManager.h" +#include "LightsManager.h" +#include "NetworkSyncManager.h" +#include "RageTimer.h" +#include "RageInput.h" + +static RageTimer g_GameplayTimer; + +static Preference g_bNeverBoostAppPriority( "NeverBoostAppPriority", false ); + +/* experimental: force a specific update rate. This prevents big animation + * jumps on frame skips. 0 to disable. */ +static Preference g_fConstantUpdateDeltaSeconds( "ConstantUpdateDeltaSeconds", 0 ); + +void HandleInputEvents( float fDeltaTime ); + +static float g_fUpdateRate = 1; +void GameLoop::SetUpdateRate( float fUpdateRate ) +{ + g_fUpdateRate = fUpdateRate; +} + +static void CheckGameLoopTimerSkips( float fDeltaTime ) +{ + if( !PREFSMAN->m_bLogSkips ) + return; + + static int iLastFPS = 0; + int iThisFPS = DISPLAY->GetFPS(); + + /* If vsync is on, and we have a solid framerate (vsync == refresh and we've + * sustained this for at least one second), we expect the amount of time for + * the last frame to be 1/FPS. */ + if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS ) + { + iLastFPS = iThisFPS; + return; + } + + const float fExpectedTime = 1.0f / iThisFPS; + const float fDifference = fDeltaTime - fExpectedTime; + if( fabsf(fDifference) > 0.002f && fabsf(fDifference) < 0.100f ) + LOG->Trace( "GameLoop timer skip: %i FPS, expected %.3f, got %.3f (%.3f difference)", + iThisFPS, fExpectedTime, fDeltaTime, fDifference ); +} + +static bool ChangeAppPri() +{ + if( g_bNeverBoostAppPriority.Get() ) + return false; + + // if using NTPAD don't boost or else input is laggy +#if defined(_WINDOWS) + { + vector vDevices; + + // This can get called before INPUTMAN is constructed. + if( INPUTMAN ) + { + INPUTMAN->GetDevicesAndDescriptions(vDevices); + FOREACH_CONST( InputDeviceInfo, vDevices, d ) + { + if( d->sDesc.find("NTPAD") != string::npos ) + { + LOG->Trace( "Using NTPAD. Don't boost priority." ); + return false; + } + } + } + } +#endif + + // If this is a debug build, don't. It makes the VC debugger sluggish. +#if defined(WIN32) && defined(DEBUG) + return false; +#else + return true; +#endif +} + +static void CheckFocus() +{ + if( !HOOKS->AppFocusChanged() ) + return; + + // If we lose focus, we may lose input events, especially key releases. + INPUTFILTER->Reset(); + + if( ChangeAppPri() ) + { + if( HOOKS->AppHasFocus() ) + HOOKS->BoostPriority(); + else + HOOKS->UnBoostPriority(); + } +} + +// On the next update, change themes, and load sNewScreen. +static RString g_sNewTheme; +static RString g_sNewScreen; +static bool g_bForceThemeReload; +void GameLoop::ChangeTheme( const RString &sNewTheme, const RString &sNewScreen, bool bForced ) +{ + g_sNewTheme = sNewTheme; + g_sNewScreen = sNewScreen; + g_bForceThemeReload = bForced; +} + +#include "StepMania.h" // XXX +namespace +{ + void DoChangeTheme() + { + SAFE_DELETE( SCREENMAN ); + TEXTUREMAN->DoDelayedDelete(); + + // In case the previous theme overloaded class bindings, reinitialize them. + LUA->RegisterTypes(); + + THEME->SwitchThemeAndLanguage( g_sNewTheme, THEME->GetCurLanguage(), PREFSMAN->m_bPseudoLocalize, g_bForceThemeReload ); + PREFSMAN->m_sTheme.Set( g_sNewTheme ); + + // Apply the new window title, icon and aspect ratio. + StepMania::ApplyGraphicOptions(); + + SCREENMAN = new ScreenManager(); + + StepMania::ResetGame(); + SCREENMAN->ThemeChanged(); + SCREENMAN->SetNewScreen( g_sNewScreen ); + + g_sNewTheme = RString(); + g_sNewScreen = RString(); + } + +} + +void GameLoop::RunGameLoop() +{ + /* People may want to do something else while songs are loading, so do + * this after loading songs. */ + if( ChangeAppPri() ) + HOOKS->BoostPriority(); + + while( !ArchHooks::UserQuit() ) + { + if( !g_sNewTheme.empty() ) + DoChangeTheme(); + + // Update + float fDeltaTime = g_GameplayTimer.GetDeltaTime(); + + if( g_fConstantUpdateDeltaSeconds > 0 ) + fDeltaTime = g_fConstantUpdateDeltaSeconds; + + CheckGameLoopTimerSkips( fDeltaTime ); + + fDeltaTime *= g_fUpdateRate; + + CheckFocus(); + + // Update SOUNDMAN early (before any RageSound::GetPosition calls), to flush position data. + SOUNDMAN->Update(); + + /* Update song beat information -before- calling update on all the classes that + * depend on it. If you don't do this first, the classes are all acting on old + * information and will lag. (but no longer fatally, due to timestamping -glenn) */ + SOUND->Update( fDeltaTime ); + TEXTUREMAN->Update( fDeltaTime ); + GAMESTATE->Update( fDeltaTime ); + SCREENMAN->Update( fDeltaTime ); + MEMCARDMAN->Update(); + NSMAN->Update( fDeltaTime ); + + /* Important: Process input AFTER updating game logic, or input will be + * acting on song beat from last frame */ + HandleInputEvents( fDeltaTime ); + + if( INPUTMAN->DevicesChanged() ) + { + INPUTFILTER->Reset(); // fix "buttons stuck" if button held while unplugged + INPUTMAN->LoadDrivers(); + RString sMessage; + if( INPUTMAPPER->CheckForChangedInputDevicesAndRemap(sMessage) ) + SCREENMAN->SystemMessage( sMessage ); + } + + LIGHTSMAN->Update( fDeltaTime ); + + // Render + SCREENMAN->Draw(); + } + + // If we ended mid-game, finish up. + GAMESTATE->SaveLocalData(); + + if( ChangeAppPri() ) + HOOKS->UnBoostPriority(); +} + +class ConcurrentRenderer +{ +public: + ConcurrentRenderer(); + ~ConcurrentRenderer(); + + void Start(); + void Stop(); + +private: + RageThread m_Thread; + RageEvent m_Event; + bool m_bShutdown; + void RenderThread(); + static int StartRenderThread( void *p ); + + enum State { RENDERING_IDLE, RENDERING_START, RENDERING_ACTIVE, RENDERING_END }; + State m_State; +}; +static ConcurrentRenderer *g_pConcurrentRenderer = NULL; + +ConcurrentRenderer::ConcurrentRenderer(): + m_Event("ConcurrentRenderer") +{ + m_bShutdown = false; + m_State = RENDERING_IDLE; + + m_Thread.SetName( "ConcurrentRenderer" ); + m_Thread.Create( StartRenderThread, this ); +} + +ConcurrentRenderer::~ConcurrentRenderer() +{ + ASSERT( m_State == RENDERING_IDLE ); + m_bShutdown = true; + m_Thread.Wait(); +} + +void ConcurrentRenderer::Start() +{ + DISPLAY->BeginConcurrentRenderingMainThread(); + + m_Event.Lock(); + ASSERT( m_State == RENDERING_IDLE ); + m_State = RENDERING_START; + m_Event.Signal(); + while( m_State != RENDERING_ACTIVE ) + m_Event.Wait(); + m_Event.Unlock(); +} + +void ConcurrentRenderer::Stop() +{ + m_Event.Lock(); + ASSERT( m_State == RENDERING_ACTIVE ); + m_State = RENDERING_END; + m_Event.Signal(); + while( m_State != RENDERING_IDLE ) + m_Event.Wait(); + m_Event.Unlock(); + + DISPLAY->EndConcurrentRenderingMainThread(); +} + +void ConcurrentRenderer::RenderThread() +{ + ASSERT( SCREENMAN != NULL ); + + while( !m_bShutdown ) + { + m_Event.Lock(); + while( m_State == RENDERING_IDLE && !m_bShutdown ) + m_Event.Wait(); + m_Event.Unlock(); + + if( m_State == RENDERING_START ) + { + /* We're starting to render. Set up, and then kick the event to wake + * up the calling thread. */ + DISPLAY->BeginConcurrentRendering(); + HOOKS->SetupConcurrentRenderingThread(); + + LOG->Trace( "ConcurrentRenderer::RenderThread start" ); + + m_Event.Lock(); + m_State = RENDERING_ACTIVE; + m_Event.Signal(); + m_Event.Unlock(); + } + + /* This is started during Update(). The next thing the game loop + * will do is Draw, so shift operations around to put Draw at the + * top. This makes sure updates are seamless. */ + if( m_State == RENDERING_ACTIVE ) + { + SCREENMAN->Draw(); + + float fDeltaTime = g_GameplayTimer.GetDeltaTime(); + SCREENMAN->Update( fDeltaTime ); + } + + if( m_State == RENDERING_END ) + { + LOG->Trace( "ConcurrentRenderer::RenderThread done" ); + + DISPLAY->EndConcurrentRendering(); + + m_Event.Lock(); + m_State = RENDERING_IDLE; + m_Event.Signal(); + m_Event.Unlock(); + } + } +} + +int ConcurrentRenderer::StartRenderThread( void *p ) +{ + ((ConcurrentRenderer *) p)->RenderThread(); + return 0; +} + +void GameLoop::StartConcurrentRendering() +{ + if( g_pConcurrentRenderer == NULL ) + g_pConcurrentRenderer = new ConcurrentRenderer; + g_pConcurrentRenderer->Start(); +} + +void GameLoop::FinishConcurrentRendering() +{ + g_pConcurrentRenderer->Stop(); +} + +/* + * (c) 2001-2005 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameLoop.h b/src/GameLoop.h index 365e74daf8..3bbc990acc 100644 --- a/src/GameLoop.h +++ b/src/GameLoop.h @@ -1,38 +1,38 @@ -#ifndef GAME_LOOP_H -#define GAME_LOOP_H -/** @brief Main rendering and update loop. */ -namespace GameLoop -{ - void RunGameLoop(); - void SetUpdateRate( float fUpdateRate ); - void ChangeTheme( const RString &sNewTheme, const RString &sNewScreen, bool bForced = false ); - void StartConcurrentRendering(); - void FinishConcurrentRendering(); -}; - -#endif - -/* - * (c) 2001-2005 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef GAME_LOOP_H +#define GAME_LOOP_H +/** @brief Main rendering and update loop. */ +namespace GameLoop +{ + void RunGameLoop(); + void SetUpdateRate( float fUpdateRate ); + void ChangeTheme( const RString &sNewTheme, const RString &sNewScreen, bool bForced = false ); + void StartConcurrentRendering(); + void FinishConcurrentRendering(); +}; + +#endif + +/* + * (c) 2001-2005 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameManager.cpp b/src/GameManager.cpp index 96cafc280f..6a7043d278 100644 --- a/src/GameManager.cpp +++ b/src/GameManager.cpp @@ -1,3168 +1,3168 @@ -#include "global.h" -#include "GameManager.h" -#include "GameConstantsAndTypes.h" -#include "GameInput.h" // for GameButton constants -#include "RageLog.h" -#include "RageUtil.h" -#include "NoteSkinManager.h" -#include "RageInputDevice.h" -#include "ThemeManager.h" -#include "LightsManager.h" // for NUM_CabinetLight -#include "Game.h" -#include "Style.h" -#include "Foreach.h" - -GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program - -enum -{ - TRACK_1 = 0, - TRACK_2, - TRACK_3, - TRACK_4, - TRACK_5, - TRACK_6, - TRACK_7, - TRACK_8, - TRACK_9, - TRACK_10, - TRACK_11, - TRACK_12, - TRACK_13, - TRACK_14, - TRACK_15, - TRACK_16, - // 16 tracks needed for beat-double7 and techno-double8 -}; - -RString StepsTypeInfo::GetLocalizedString() const -{ - if( THEME->HasString( "StepsType", szName ) ) - return THEME->GetString( "StepsType", szName ); - return szName; -} - -static const StepsTypeInfo g_StepsTypeInfos[] = { - // dance - { "dance-single", 4, true, StepsTypeCategory_Single }, - { "dance-double", 8, true, StepsTypeCategory_Double }, - { "dance-couple", 8, true, StepsTypeCategory_Couple }, - { "dance-solo", 6, true, StepsTypeCategory_Single }, - { "dance-threepanel", 3, true, StepsTypeCategory_Single }, // thanks to kurisu - { "dance-routine", 8, false, StepsTypeCategory_Routine }, - // pump - { "pump-single", 5, true, StepsTypeCategory_Single }, - { "pump-halfdouble", 6, true, StepsTypeCategory_Double }, - { "pump-double", 10, true, StepsTypeCategory_Double }, - { "pump-couple", 10, true, StepsTypeCategory_Couple }, - // uh, dance-routine has that one bool as false... wtf? -aj - { "pump-routine", 10, true, StepsTypeCategory_Routine }, - // kb7 - { "kb7-single", 7, true, StepsTypeCategory_Single }, - // ez2dancer - { "ez2-single", 5, true, StepsTypeCategory_Single }, // Single: TL,LHH,D,RHH,TR - { "ez2-double", 10, true, StepsTypeCategory_Double }, // Double: Single x2 - { "ez2-real", 7, true, StepsTypeCategory_Single }, // Real: TL,LHH,LHL,D,RHL,RHH,TR - // parapara paradise - { "para-single", 5, true, StepsTypeCategory_Single }, - // ds3ddx - { "ds3ddx-single", 8, true, StepsTypeCategory_Single }, - // beatmania - { "bm-single5", 6, true, StepsTypeCategory_Single }, // called "bm" for backward compat - { "bm-double5", 12, true, StepsTypeCategory_Double }, // called "bm" for backward compat - { "bm-single7", 8, true, StepsTypeCategory_Single }, // called "bm" for backward compat - { "bm-double7", 16, true, StepsTypeCategory_Double }, // called "bm" for backward compat - // dance maniax - { "maniax-single", 4, true, StepsTypeCategory_Single }, - { "maniax-double", 8, true, StepsTypeCategory_Double }, - // technomotion - { "techno-single4", 4, true, StepsTypeCategory_Single }, - { "techno-single5", 5, true, StepsTypeCategory_Single }, - { "techno-single8", 8, true, StepsTypeCategory_Single }, - { "techno-double4", 8, true, StepsTypeCategory_Double }, - { "techno-double5", 10, true, StepsTypeCategory_Double }, - { "techno-double8", 16, true, StepsTypeCategory_Double }, - // pop'n music - { "pnm-five", 5, true, StepsTypeCategory_Single }, // called "pnm" for backward compat - { "pnm-nine", 9, true, StepsTypeCategory_Single }, // called "pnm" for backward compat - // guitar hero - { "guitar-five", 5, true, StepsTypeCategory_Single }, // 5 frets, no wail - // cabinet lights and other fine StepsTypes that don't exist lol - { "lights-cabinet", NUM_CabinetLight, false, StepsTypeCategory_Single }, // XXX disable lights autogen for now -}; - - -// Important: Every game must define the buttons: "Start", "Back", "MenuLeft", "Operator" and "MenuRight" -static const AutoMappings g_AutoKeyMappings_Dance = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_DEL, GAME_BUTTON_MENULEFT, false ), - AutoMappingEntry( 0, KEY_PGDN, GAME_BUTTON_MENURIGHT, false ), - AutoMappingEntry( 0, KEY_HOME, GAME_BUTTON_MENUUP, false ), - AutoMappingEntry( 0, KEY_END, GAME_BUTTON_MENUDOWN, false ), - AutoMappingEntry( 0, KEY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, KEY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, KEY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, KEY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, KEY_KP_SLASH, GAME_BUTTON_MENULEFT, true ), - AutoMappingEntry( 0, KEY_KP_ASTERISK, GAME_BUTTON_MENURIGHT, true ), - AutoMappingEntry( 0, KEY_KP_HYPHEN, GAME_BUTTON_MENUUP, true ), - AutoMappingEntry( 0, KEY_KP_PLUS, GAME_BUTTON_MENUDOWN, true ), - AutoMappingEntry( 0, KEY_KP_C4, DANCE_BUTTON_LEFT, true ), - AutoMappingEntry( 0, KEY_KP_C6, DANCE_BUTTON_RIGHT, true ), - AutoMappingEntry( 0, KEY_KP_C8, DANCE_BUTTON_UP, true ), - AutoMappingEntry( 0, KEY_KP_C2, DANCE_BUTTON_DOWN, true ), - AutoMappingEntry( 0, KEY_KP_C7, DANCE_BUTTON_UPLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C9, DANCE_BUTTON_UPRIGHT, true ) -); - -// xxx: get this from the theme? (see others) -// the problem with getting it from the noteskin is that this is meant to be -// static const; if we switch to anything we likely won't get const anymore -// but i may be talking out of my ass -aj -static const int DANCE_COL_SPACING = 64; - -//static ThemeMetric DANCE_COL_SPACING("ColumnSpacing","Dance"); -// named after a similar metric in Aldo_MX's build for compatibility/familiarity: -//float DANCE_COL_SPACING NOTESKIN->GetMetricF("NoteDisplay","ArrowColSpacing"); -/* looking for ARROW_SIZE should be enough (ArrowSize) - * just arroweffects.cpp for rowspacing (ArrowRowSpacing) - */ - -static const Style g_Style_Dance_Single = -{ // STYLE_DANCE_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_dance_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 0, 3, 2, 1, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0, 1, 2, 3 - }, - false, // m_bNeedsZoomOutWith2Players - true, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_Versus = -{ // STYLE_DANCE_VERSUS - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_dance_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, - }, - { - { 0, 3, 2, 1, Style::END_MAPPING }, - { 0, 3, 2, 1, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0, 1, 2, 3 - }, - false, // m_bNeedsZoomOutWith2Players - true, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_Double = -{ // STYLE_DANCE_DOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double", // m_szName - StepsType_dance_double, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 4, 7, 6, 5, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_Couple = -{ // STYLE_DANCE_COUPLE - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "couple", // m_szName - StepsType_dance_couple, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_5, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_6, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 0, 3, 2, 1, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3 - }, - false, // m_bNeedsZoomOutWith2Players - true, // m_bCanUseBeginnerHelper - true, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_Solo = -{ // STYLE_DANCE_SOLO - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "solo", // m_szName - StepsType_dance_solo, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 5, 3, 2, 1, 4, Style::END_MAPPING }, - { 0, 5, 3, 2, 1, 4, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_ThreePanel = -{ // STYLE_DANCE_THREEPANEL - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "threepanel", // m_szName - StepsType_dance_threepanel, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 3, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - // 4 3 5 - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, 1, 0, 2, Style::END_MAPPING }, - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, 1, 0, 2, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Dance_Couple_Edit = -{ // STYLE_DANCE_EDIT_COUPLE - false, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "couple-edit", // m_szName - StepsType_dance_couple, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*4.0f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*3.0f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*2.0f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*2.0f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*3.0f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*4.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*4.0f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*3.0f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*2.0f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*2.0f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*3.0f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*4.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, Style::END_MAPPING }, - { 4, 5, 6, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -// todo: re-enable? (lol) -/* -static const Style g_Style_Dance_Solo_Versus = -{ // STYLE_DANCE_SOLO_VERSUS - "dance-solo-versus", // m_szName - StepsType_dance_solo, // m_StepsType - ONE_PLAYER_ONE_CREDIT, // m_StyleType - 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, - { TRACK_2, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, - { TRACK_3, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, - { TRACK_4, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, - { TRACK_5, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, - { TRACK_6, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, - { TRACK_2, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, - { TRACK_3, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, - { TRACK_4, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, - { TRACK_5, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, - { TRACK_6, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 5, 3, 2, 1, 4, Style::END_MAPPING }, - { 0, 5, 3, 2, 1, 4, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,5,1,4,2,3 // outside in - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; */ - -static const Style g_Style_Dance_Routine = -{ // STYLE_DANCE_ROUTINE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "routine", // m_szName - StepsType_dance_routine, // m_StepsType - StyleType_TwoPlayersSharedSides, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 4, 7, 6, 5, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - true, // m_bLockDifficulties - -}; - -static const Style *g_apGame_Dance_Styles[] = -{ - &g_Style_Dance_Single, - &g_Style_Dance_Versus, - &g_Style_Dance_Double, - &g_Style_Dance_Couple, - &g_Style_Dance_Solo, - &g_Style_Dance_Couple_Edit, - &g_Style_Dance_Routine, - &g_Style_Dance_ThreePanel, - NULL -}; - -static const Game g_Game_Dance = -{ - "dance", // m_szName - g_apGame_Dance_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "dance", // m_szName - NUM_DANCE_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Left", GAME_BUTTON_LEFT }, - { "Right", GAME_BUTTON_RIGHT }, - { "Up", GAME_BUTTON_UP }, - { "Down", GAME_BUTTON_DOWN }, - { "UpLeft", GameButton_Invalid }, - { "UpRight", GameButton_Invalid }, - }, - &g_AutoKeyMappings_Dance - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -static const AutoMappings g_AutoKeyMappings_Pump = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cq, PUMP_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, KEY_Ce, PUMP_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cs, PUMP_BUTTON_CENTER, false ), - AutoMappingEntry( 0, KEY_Cz, PUMP_BUTTON_DOWNLEFT, false ), - AutoMappingEntry( 0, KEY_Cc, PUMP_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, KEY_KP_C7, PUMP_BUTTON_UPLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C9, PUMP_BUTTON_UPRIGHT, true ), - AutoMappingEntry( 0, KEY_KP_C5, PUMP_BUTTON_CENTER, true ), - AutoMappingEntry( 0, KEY_KP_C1, PUMP_BUTTON_DOWNLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C3, PUMP_BUTTON_DOWNRIGHT, true ), - - // unmap confusing default MenuButtons - AutoMappingEntry( 0, KEY_KP_C8, GameButton_Invalid, false ), - AutoMappingEntry( 0, KEY_KP_C2, GameButton_Invalid, false ), - AutoMappingEntry( 0, KEY_KP_C4, GameButton_Invalid, false ), - AutoMappingEntry( 0, KEY_KP_C6, GameButton_Invalid, false ) -); - -// PIU Defaults: RowSpacing = 60; ColSpacing = 52; ArrowSize = 54; -// apparently column spacing is 48px -//static ThemeMetric PUMP_COL_SPACING ("ColumnSpacing","Pump"); -static const int PUMP_COL_SPACING = 48; - -static const Style g_Style_Pump_Single = -{ // STYLE_PUMP_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_pump_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_Versus = -{ // STYLE_PUMP_VERSUS - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_pump_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_HalfDouble = -{ // STYLE_PUMP_HALFDOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "halfdouble", // m_szName - StepsType_pump_halfdouble, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { Style::NO_MAPPING, 1, 0, Style::NO_MAPPING, 2, Style::END_MAPPING }, - { 4, Style::NO_MAPPING, 5, 3, Style::NO_MAPPING, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,3,1,4,0,5 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_Double = -{ // STYLE_PUMP_DOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double", // m_szName - StepsType_pump_double, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - { 6, 8, 7, 5, 9, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4, 2+5,1+5,3+5,0+5,4+5 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_Couple = -{ // STYLE_PUMP_COUPLE - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "couple", // m_szName - StepsType_pump_couple, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - true, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_Couple_Edit = -{ // STYLE_PUMP_EDIT_COUPLE - false, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "couple-edit", // m_szName - StepsType_pump_couple, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*5.0f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*4.0f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*3.0f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*2.0f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*1.0f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*1.0f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*2.0f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*3.0f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*4.0f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*5.0f+4, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, 6, 8, 7, 5, 9, Style::END_MAPPING }, - { 1, 3, 2, 0, 4, 6, 8, 7, 5, 9, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Pump_Routine = -{ // STYLE_PUMP_ROUTINE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "routine", // m_szName - StepsType_pump_routine, // m_StepsType - StyleType_TwoPlayersSharedSides, // m_StyleType - 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 3, 2, 0, 4, Style::END_MAPPING }, - { 6, 8, 7, 5, 9, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,1,3,0,4,7,6,8,5,9 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - true, // m_bLockDifficulties -}; - -static const Style *g_apGame_Pump_Styles[] = -{ - &g_Style_Pump_Single, - &g_Style_Pump_Versus, - &g_Style_Pump_HalfDouble, - &g_Style_Pump_Double, - &g_Style_Pump_Couple, - &g_Style_Pump_Couple_Edit, - &g_Style_Pump_Routine, - NULL -}; - -static const Game g_Game_Pump = -{ - "pump", // m_szName - g_apGame_Pump_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "pump", // m_szName - NUM_PUMP_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "UpLeft", GAME_BUTTON_UP }, - { "UpRight", GAME_BUTTON_DOWN }, - { "Center", GAME_BUTTON_START }, - { "DownLeft", GAME_BUTTON_LEFT }, - { "DownRight", GAME_BUTTON_RIGHT }, - }, - &g_AutoKeyMappings_Pump - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -static const AutoMappings g_AutoKeyMappings_KB7 = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cs, KB7_BUTTON_KEY1, false ), - AutoMappingEntry( 0, KEY_Cd, KB7_BUTTON_KEY2, false ), - AutoMappingEntry( 0, KEY_Cf, KB7_BUTTON_KEY3, false ), - AutoMappingEntry( 0, KEY_SPACE, KB7_BUTTON_KEY4, false ), - AutoMappingEntry( 0, KEY_Cj, KB7_BUTTON_KEY5, false ), - AutoMappingEntry( 0, KEY_Ck, KB7_BUTTON_KEY6, false ), - AutoMappingEntry( 0, KEY_Cl, KB7_BUTTON_KEY7, false ) -); - -//ThemeMetric KB7_COL_SPACING ("ColumnSpacing","KB7"); -static const int KB7_COL_SPACING = 64; -static const Style g_Style_KB7_Single = -{ // STYLE_KB7_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_kb7_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -KB7_COL_SPACING*3.25f, NULL }, - { TRACK_2, -KB7_COL_SPACING*2.25f, NULL }, - { TRACK_3, -KB7_COL_SPACING*1.25f, NULL }, - { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, - { TRACK_5, +KB7_COL_SPACING*1.25f, NULL }, - { TRACK_6, +KB7_COL_SPACING*2.25f, NULL }, - { TRACK_7, +KB7_COL_SPACING*3.25f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -KB7_COL_SPACING*3.25f, NULL }, - { TRACK_2, -KB7_COL_SPACING*2.25f, NULL }, - { TRACK_3, -KB7_COL_SPACING*1.25f, NULL }, - { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, - { TRACK_5, +KB7_COL_SPACING*1.25f, NULL }, - { TRACK_6, +KB7_COL_SPACING*2.25f, NULL }, - { TRACK_7, +KB7_COL_SPACING*3.25f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6 // doesn't work? - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_KB7_Versus = -{ // STYLE_KB7_VERSUS - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_kb7_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, - { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, - { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, - { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, - { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, - { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, - { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, - { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, - { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, - { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, - { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, - { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, - { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6 - }, - true, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_KB7_Styles[] = -{ - &g_Style_KB7_Single, - &g_Style_KB7_Versus, - NULL -}; - -static const Game g_Game_KB7 = -{ - "kb7", // m_szName - g_apGame_KB7_Styles, // m_apStyles - true, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "kb7", // m_szName - NUM_KB7_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Key1", GameButton_Invalid }, - { "Key2", GAME_BUTTON_LEFT }, - { "Key3", GAME_BUTTON_DOWN }, - { "Key4", GameButton_Invalid }, - { "Key5", GAME_BUTTON_UP }, - { "Key6", GAME_BUTTON_RIGHT }, - { "Key7", GameButton_Invalid }, - }, - &g_AutoKeyMappings_KB7 - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -//ThemeMetric EZ2_COL_SPACING ("ColumnSpacing","EZ2"); -static const int EZ2_COL_SPACING = 46; -// do you even need this if they're the same now -aj -//ThemeMetric EZ2__REAL_COL_SPACING ("ColumnSpacing","EZ2Real"); -static const int EZ2_REAL_COL_SPACING = 46; -static const Style g_Style_Ez2_Single = -{ // STYLE_EZ2_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_ez2_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, - { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, - { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 4, 2, 1, 3, Style::END_MAPPING }, - { 0, 4, 2, 1, 3, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Ez2_Real = -{ // STYLE_EZ2_REAL - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "real", // m_szName - StepsType_ez2_real, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, - { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, - { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, - { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, - { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, - { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 3,0,6,1,5,2,4 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Ez2_Single_Versus = -{ // STYLE_EZ2_SINGLE_VERSUS - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_ez2_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, - { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, - { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 4, 2, 1, 3, Style::END_MAPPING }, - { 0, 4, 2, 1, 3, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Ez2_Real_Versus = -{ // STYLE_EZ2_REAL_VERSUS - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versusReal", // m_szName - StepsType_ez2_real, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, - { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, - { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, - { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, - { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, - { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Ez2_Double = -{ // STYLE_EZ2_DOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double", // m_szName - StepsType_ez2_double, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 4, 2, 1, 3, Style::END_MAPPING }, - { 5, 9, 7, 6, 8, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Ez2_Styles[] = -{ - &g_Style_Ez2_Single, - &g_Style_Ez2_Real, - &g_Style_Ez2_Single_Versus, - &g_Style_Ez2_Real_Versus, - &g_Style_Ez2_Double, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Ez2 = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cz, EZ2_BUTTON_FOOTUPLEFT, false ), - AutoMappingEntry( 0, KEY_Cb, EZ2_BUTTON_FOOTUPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cc, EZ2_BUTTON_FOOTDOWN, false ), - AutoMappingEntry( 0, KEY_Cx, EZ2_BUTTON_HANDUPLEFT, false ), - AutoMappingEntry( 0, KEY_Cv, EZ2_BUTTON_HANDUPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cs, EZ2_BUTTON_HANDLRLEFT, false ), - AutoMappingEntry( 0, KEY_Cf, EZ2_BUTTON_HANDLRRIGHT, false ) -); - -static const Game g_Game_Ez2 = -{ - "ez2", // m_szName - g_apGame_Ez2_Styles, // m_apStyles - true, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "ez2", // m_szName - NUM_EZ2_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "FootUpLeft", GAME_BUTTON_UP }, - { "FootUpRight", GAME_BUTTON_DOWN }, - { "FootDown", GAME_BUTTON_START }, - { "HandUpLeft", GAME_BUTTON_LEFT }, - { "HandUpRight", GAME_BUTTON_RIGHT }, - { "HandLrLeft", GameButton_Invalid }, - { "HandLrRight", GameButton_Invalid }, - }, - &g_AutoKeyMappings_Ez2 - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W2, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W2, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_Miss, // m_mapW5To -}; - -//ThemeMetric PARA_COL_SPACING ("ColumnSpacing","Para"); -static const int PARA_COL_SPACING = 54; - -static const Style g_Style_Para_Single = -{ // STYLE_PARA_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_para_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,0,4,1,3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Para_Versus = -{ // STYLE_PARA_VERSUS - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_para_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 2,0,4,1,3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Para_Styles[] = -{ - &g_Style_Para_Single, - &g_Style_Para_Versus, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Para = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cz, PARA_BUTTON_LEFT, false ), - AutoMappingEntry( 0, KEY_Cx, PARA_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, KEY_Cc, PARA_BUTTON_UP, false ), - AutoMappingEntry( 0, KEY_Cv, PARA_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cb, PARA_BUTTON_RIGHT, false ) -); - -static const Game g_Game_Para = -{ - "para", // m_szName - g_apGame_Para_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "para", // m_szName - NUM_PARA_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Left", GAME_BUTTON_LEFT }, - { "UpLeft", GAME_BUTTON_DOWN }, - { "Up", GameButton_Invalid }, - { "UpRight", GAME_BUTTON_UP }, - { "Right", GAME_BUTTON_RIGHT }, - }, - &g_AutoKeyMappings_Para - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -//ThemeMetric DS3DDX_COL_SPACING ("ColumnSpacing","DS3DDX"); -static const int DS3DDX_COL_SPACING = 46; -static const Style g_Style_DS3DDX_Single = -{ // STYLE_DS3DDX_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_ds3ddx_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, - { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_8, +DS3DDX_COL_SPACING*3.0f , NULL}, - }, - { // PLAYER_2 - { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, - { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_8, +DS3DDX_COL_SPACING*3.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, 5, 6, 7, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_DS3DDX_Styles[] = -{ - &g_Style_DS3DDX_Single, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_DS3DDX = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Ca, DS3DDX_BUTTON_HANDLEFT, false ), - AutoMappingEntry( 0, KEY_Cz, DS3DDX_BUTTON_FOOTDOWNLEFT, false ), - AutoMappingEntry( 0, KEY_Cq, DS3DDX_BUTTON_FOOTUPLEFT, false ), - AutoMappingEntry( 0, KEY_Cw, DS3DDX_BUTTON_HANDUP, false ), - AutoMappingEntry( 0, KEY_Cx, DS3DDX_BUTTON_HANDDOWN, false ), - AutoMappingEntry( 0, KEY_Ce, DS3DDX_BUTTON_FOOTUPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cc, DS3DDX_BUTTON_FOOTDOWNRIGHT, false ), - AutoMappingEntry( 0, KEY_Cd, DS3DDX_BUTTON_HANDRIGHT, false ) -); - -static const Game g_Game_DS3DDX = -{ - "ds3ddx", // m_szName - g_apGame_DS3DDX_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "ds3ddx", // m_szName - NUM_DS3DDX_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "HandLeft", GAME_BUTTON_LEFT }, - { "FootDownLeft", GameButton_Invalid }, - { "FootUpLeft", GameButton_Invalid }, - { "HandUp", GAME_BUTTON_UP }, - { "HandDown", GAME_BUTTON_DOWN }, - { "FootUpRight", GameButton_Invalid }, - { "FootDownRight", GameButton_Invalid }, - { "HandRight", GAME_BUTTON_RIGHT }, - }, - &g_AutoKeyMappings_DS3DDX - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -//ThemeMetric BEAT_COL_SPACING ("ColumnSpacing","Beat"); -static const int BEAT_COL_SPACING = 34; -static const Style g_Style_Beat_Single5 = -{ // STYLE_BEAT_SINGLE5 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single5", // m_szName - StepsType_beat_single5, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, - }, - { // PLAYER_2 - { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Beat_Double = -{ // STYLE_BEAT_DOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double5", // m_szName - StepsType_beat_double5, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 12, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, - { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, - }, - { // PLAYER_2 - { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, - { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, - { 5, 6, 7, 8, 9, Style::NO_MAPPING, Style::NO_MAPPING, 10, 10, Style::END_MAPPING } - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7,8,9,10,11 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Beat_Single7 = -{ // STYLE_BEAT_SINGLE7 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "single7", // m_szName - StepsType_beat_single7, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_8, -BEAT_COL_SPACING*3.5f, "scratch" }, - { TRACK_1, -BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*1.0f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*0.0f, NULL }, - { TRACK_4, +BEAT_COL_SPACING*1.0f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*3.0f, NULL }, - { TRACK_7, +BEAT_COL_SPACING*4.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_7, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_8, +BEAT_COL_SPACING*4.0f, "scratch" }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 2, 3, 4, 5, 6, 7, 0, 0, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, 7, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Beat_Double7 = -{ // STYLE_BEAT_DOUBLE7 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double7", // m_szName - StepsType_beat_double7, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 16, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, - { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, - }, - { // PLAYER_2 - { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, - { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 2, 3, 4, 5, 6, 7, 0, 0, Style::END_MAPPING }, - { 8, 9, 10, 11, 12, 13, 14, 15, 15, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Beat_Styles[] = -{ - &g_Style_Beat_Single5, - &g_Style_Beat_Double, - &g_Style_Beat_Single7, - &g_Style_Beat_Double7, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Beat = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cm, BEAT_BUTTON_KEY1, false ), - AutoMappingEntry( 0, KEY_Ck, BEAT_BUTTON_KEY2, false ), - AutoMappingEntry( 0, KEY_COMMA, BEAT_BUTTON_KEY3, false ), - AutoMappingEntry( 0, KEY_Cl, BEAT_BUTTON_KEY4, false ), - AutoMappingEntry( 0, KEY_PERIOD, BEAT_BUTTON_KEY5, false ), - AutoMappingEntry( 0, KEY_SEMICOLON, BEAT_BUTTON_KEY6, false ), - AutoMappingEntry( 0, KEY_SLASH, BEAT_BUTTON_KEY7, false ), - AutoMappingEntry( 0, KEY_LSHIFT, BEAT_BUTTON_SCRATCHUP, false ) -); - -static const Game g_Game_Beat = -{ - "beat", // m_szName - g_apGame_Beat_Styles, // m_apStyles - true, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "beat", // m_szName - NUM_BEAT_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Key1", GAME_BUTTON_LEFT }, - { "Key2", GameButton_Invalid }, - { "Key3", GAME_BUTTON_RIGHT }, - { "Key4", GameButton_Invalid }, - { "Key5", GameButton_Invalid }, - { "Key6", GameButton_Invalid }, - { "Key7", GameButton_Invalid }, - { "Scratch up", GAME_BUTTON_UP }, - { "Scratch down", GAME_BUTTON_DOWN }, - }, - &g_AutoKeyMappings_Beat - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -//ThemeMetric MANIAX_COL_SPACING ("ColumnSpacing","Maniax"); -static const int MANIAX_COL_SPACING = 36; -static const Style g_Style_Maniax_Single = -{ // STYLE_MANIAX_SINGLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single", // m_szName - StepsType_maniax_single, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 2, 0, 3, Style::END_MAPPING }, - { 1, 2, 0, 3, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0, 1, 2, 3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Maniax_Versus = -{ // STYLE_MANIAX_VERSUS - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus", // m_szName - StepsType_maniax_single, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 2, 0, 3, Style::END_MAPPING }, - { 1, 2, 0, 3, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0, 1, 2, 3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Maniax_Double = -{ // STYLE_MANIAX_DOUBLE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double", // m_szName - StepsType_maniax_double, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 2, 0, 3, Style::END_MAPPING }, - { 5, 6, 4, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Maniax_Styles[] = -{ - &g_Style_Maniax_Single, - &g_Style_Maniax_Versus, - &g_Style_Maniax_Double, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Maniax = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Ca, MANIAX_BUTTON_HANDUPLEFT, false ), - AutoMappingEntry( 0, KEY_Cs, MANIAX_BUTTON_HANDUPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cz, MANIAX_BUTTON_HANDLRLEFT, false ), - AutoMappingEntry( 0, KEY_Cx, MANIAX_BUTTON_HANDLRRIGHT, false ), - AutoMappingEntry( 0, KEY_KP_C4, MANIAX_BUTTON_HANDUPLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C5, MANIAX_BUTTON_HANDUPRIGHT, true ), - AutoMappingEntry( 0, KEY_KP_C1, MANIAX_BUTTON_HANDLRLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C2, MANIAX_BUTTON_HANDLRRIGHT, true ) -); - -static const Game g_Game_Maniax = -{ - "maniax", // m_szName - g_apGame_Maniax_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "maniax", // m_szName - NUM_MANIAX_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "HandUpLeft", GAME_BUTTON_LEFT }, - { "HandUpRight", GAME_BUTTON_RIGHT }, - { "HandLrLeft", GAME_BUTTON_DOWN }, - { "HandLrRight", GAME_BUTTON_UP }, - }, - &g_AutoKeyMappings_Maniax - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -/** Techno *******************************************************************/ - -//ThemeMetric TECHNO_COL_SPACING ("ColumnSpacing","Techno"); -static const int TECHNO_COL_SPACING = 56; -//ThemeMetric TECHNO_VERSUS_COL_SPACING ("ColumnSpacing","TechnoVersus"); -static const int TECHNO_VERSUS_COL_SPACING = 33; -static const Style g_Style_Techno_Single4 = -{ // STYLE_TECHNO_SINGLE4 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "single4", // m_szName - StepsType_techno_single4, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 0, 3, 2, 1, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Single5 = -{ // STYLE_TECHNO_SINGLE5 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "single5", // m_szName - StepsType_techno_single5, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 1, 3, 2, 0, 4, Style::END_MAPPING }, - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 1, 3, 2, 0, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Single8 = -{ // STYLE_TECHNO_SINGLE8 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "single8", // m_szName - StepsType_techno_single8, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*4.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - true, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Versus4 = -{ // STYLE_TECHNO_VERSUS4 - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus4", // m_szName - StepsType_techno_single4, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 0, 3, 2, 1, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Versus5 = -{ // STYLE_TECHNO_VERSUS5 - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus5", // m_szName - StepsType_techno_single5, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 1, 3, 2, 0, 4, Style::END_MAPPING }, - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 1, 3, 2, 0, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Versus8 = -{ // STYLE_TECHNO_VERSUS8 - true, // m_bUsedForGameplay - false, // m_bUsedForEdit - true, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "versus8", // m_szName - StepsType_techno_single8, // m_StepsType - StyleType_TwoPlayersTwoSides, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, -// { 1, 6, 4, Style::NO_MAPPING, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, -// { 1, 6, 4, Style::NO_MAPPING, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - true, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Double4 = -{ // STYLE_TECHNO_DOUBLE4 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double4", // m_szName - StepsType_techno_double4, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 3, 2, 1, Style::END_MAPPING }, - { 4, 7, 6, 5, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Double5 = -{ // STYLE_TECHNO_DOUBLE5 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double5", // m_szName - StepsType_techno_double5, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Techno_Double8 = -{ // STYLE_TECHNO_DOUBLE8 - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "double8", // m_szName - StepsType_techno_double8, // m_StepsType - StyleType_OnePlayerTwoSides, // m_StyleType - 16, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, - { TRACK_2, -TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, - { TRACK_3, -TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, - { TRACK_4, -TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, - { TRACK_5, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_6, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_7, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_8, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_9, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_10, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_11, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_12, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_13, +TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, - { TRACK_14, +TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, - { TRACK_15, +TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, - { TRACK_16, +TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, - { TRACK_2, -TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, - { TRACK_3, -TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, - { TRACK_4, -TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, - { TRACK_5, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_6, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_7, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_8, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_9, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, - { TRACK_10, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, - { TRACK_11, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, - { TRACK_12, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, - { TRACK_13, +TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, - { TRACK_14, +TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, - { TRACK_15, +TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, - { TRACK_16, +TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 1, 3, 2, 0, 4, Style::END_MAPPING }, - { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, - 6, 8, 7, 5, 9, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7,8,9 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Techno_Styles[] = -{ - &g_Style_Techno_Single4, - &g_Style_Techno_Single5, - &g_Style_Techno_Single8, - &g_Style_Techno_Versus4, - &g_Style_Techno_Versus5, - &g_Style_Techno_Versus8, - &g_Style_Techno_Double4, - &g_Style_Techno_Double5, - &g_Style_Techno_Double8, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Techno = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Ca, TECHNO_BUTTON_LEFT, false ), - AutoMappingEntry( 0, KEY_Cd, TECHNO_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, KEY_Cw, TECHNO_BUTTON_UP, false ), - AutoMappingEntry( 0, KEY_Cx, TECHNO_BUTTON_DOWN, false ), - AutoMappingEntry( 0, KEY_Cq, TECHNO_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, KEY_Ce, TECHNO_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, KEY_Cs, TECHNO_BUTTON_CENTER, false ), - AutoMappingEntry( 0, KEY_Cz, TECHNO_BUTTON_DOWNLEFT, false ), - AutoMappingEntry( 0, KEY_Cc, TECHNO_BUTTON_DOWNRIGHT,false ), - AutoMappingEntry( 0, KEY_KP_C4, TECHNO_BUTTON_LEFT, true ), - AutoMappingEntry( 0, KEY_KP_C6, TECHNO_BUTTON_RIGHT, true ), - AutoMappingEntry( 0, KEY_KP_C8, TECHNO_BUTTON_UP, true ), - AutoMappingEntry( 0, KEY_KP_C2, TECHNO_BUTTON_DOWN, true ), - AutoMappingEntry( 0, KEY_KP_C7, TECHNO_BUTTON_UPLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C9, TECHNO_BUTTON_UPRIGHT, true ), - AutoMappingEntry( 0, KEY_KP_C5, TECHNO_BUTTON_CENTER, true ), - AutoMappingEntry( 0, KEY_KP_C1, TECHNO_BUTTON_DOWNLEFT, true ), - AutoMappingEntry( 0, KEY_KP_C3, TECHNO_BUTTON_DOWNRIGHT,true ) -); - -static const Game g_Game_Techno = -{ - "techno", // m_szName - g_apGame_Techno_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "techno", // m_szName - NUM_TECHNO_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Left", GAME_BUTTON_LEFT }, - { "Right", GAME_BUTTON_RIGHT }, - { "Up", GAME_BUTTON_UP }, - { "Down", GAME_BUTTON_DOWN }, - { "UpLeft", GameButton_Invalid }, - { "UpRight", GameButton_Invalid }, - { "Center", GameButton_Invalid }, - { "DownLeft", GameButton_Invalid }, - { "DownRight", GameButton_Invalid }, - }, - &g_AutoKeyMappings_Techno - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -/** popn *********************************************************************/ -//ThemeMetric POPN5_COL_SPACING ("ColumnSpacing","Popn5"); -static const int POPN5_COL_SPACING = 32; -//ThemeMetric POPN9_COL_SPACING ("ColumnSpacing","Popn9"); -static const int POPN9_COL_SPACING = 32; -static const Style g_Style_Popn_Five = -{ // STYLE_POPN_FIVE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "popn-five", // m_szName - StepsType_popn_five, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, - { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, - { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, - { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, - { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { Style::NO_MAPPING, Style::NO_MAPPING, 0, 1, 2, 3, 4, Style::END_MAPPING }, - { Style::NO_MAPPING, Style::NO_MAPPING, 0, 1, 2, 3, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style g_Style_Popn_Nine = -{ // STYLE_POPN_NINE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "popn-nine", // m_szName - StepsType_popn_nine, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 9, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, - { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, - { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, - { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, - { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7,8 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Popn_Styles[] = -{ - &g_Style_Popn_Five, - &g_Style_Popn_Nine, - NULL -}; - -static const AutoMappings g_AutoKeyMappings_Popn = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cz, POPN_BUTTON_LEFT_WHITE, false ), - AutoMappingEntry( 0, KEY_Cs, POPN_BUTTON_LEFT_YELLOW,false ), - AutoMappingEntry( 0, KEY_Cx, POPN_BUTTON_LEFT_GREEN, false ), - AutoMappingEntry( 0, KEY_Cd, POPN_BUTTON_LEFT_BLUE, false ), - AutoMappingEntry( 0, KEY_Cc, POPN_BUTTON_RED, false ), - AutoMappingEntry( 0, KEY_Cf, POPN_BUTTON_RIGHT_BLUE, false ), - AutoMappingEntry( 0, KEY_Cv, POPN_BUTTON_RIGHT_GREEN,false ), - AutoMappingEntry( 0, KEY_Cg, POPN_BUTTON_RIGHT_YELLOW,false ), - AutoMappingEntry( 0, KEY_Cb, POPN_BUTTON_RIGHT_WHITE,false ) -); - -static const Game g_Game_Popn = -{ - "popn", // m_szName - g_apGame_Popn_Styles, // m_apStyles - true, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "popn", // m_szName - NUM_POPN_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Left White", GameButton_Invalid }, - { "Left Yellow", GAME_BUTTON_UP }, - { "Left Green", GameButton_Invalid }, - { "Left Blue", GAME_BUTTON_LEFT }, - { "Red", GAME_BUTTON_START }, - { "Right Blue", GAME_BUTTON_RIGHT }, - { "Right Green", GameButton_Invalid }, - { "Right Yellow", GAME_BUTTON_DOWN }, - { "Right White", GameButton_Invalid }, - }, - &g_AutoKeyMappings_Popn - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W2, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W3, // m_mapW4To - TNS_Miss, // m_mapW5To -}; - -/** Guitar5 ******************************************************************/ -//ThemeMetric GUITAR5_COL_SPACING ("ColumnSpacing","Guitar5"); -static const int GUITAR5_COL_SPACING = 48; - -static const Style g_Style_Guitar_Five = -{ // STYLE_GUITAR_FIVE - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - true, // m_bUsedForDemonstration - true, // m_bUsedForHowToPlay - "guitar-five", // m_szName - StepsType_guitar_five, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -GUITAR5_COL_SPACING*2.0f, NULL }, - { TRACK_2, -GUITAR5_COL_SPACING*1.0f, NULL }, - { TRACK_3, +GUITAR5_COL_SPACING*0.0f, NULL }, - { TRACK_4, +GUITAR5_COL_SPACING*1.0f, NULL }, - { TRACK_5, +GUITAR5_COL_SPACING*2.0f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -GUITAR5_COL_SPACING*2.0f, NULL }, - { TRACK_2, -GUITAR5_COL_SPACING*1.0f, NULL }, - { TRACK_3, +GUITAR5_COL_SPACING*0.0f, NULL }, - { TRACK_4, +GUITAR5_COL_SPACING*1.0f, NULL }, - { TRACK_5, +GUITAR5_COL_SPACING*2.0f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Guitar_Styles[] = -{ - &g_Style_Guitar_Five, - NULL -}; - -// auto keymappings -static const AutoMappings g_AutoKeyMappings_Guitar = AutoMappings ( - "", - "", - "", -// p1 - AutoMappingEntry( 0, KEY_Cz, GUITAR_BUTTON_FRET1, false ), - AutoMappingEntry( 0, KEY_Cx, GUITAR_BUTTON_FRET2, false ), - AutoMappingEntry( 0, KEY_Cc, GUITAR_BUTTON_FRET3, false ), - AutoMappingEntry( 0, KEY_Cv, GUITAR_BUTTON_FRET4, false ), - AutoMappingEntry( 0, KEY_Cb, GUITAR_BUTTON_FRET5, false ), - AutoMappingEntry( 0, KEY_UP, GUITAR_BUTTON_STRUM_UP, false ), - AutoMappingEntry( 0, KEY_DOWN, GUITAR_BUTTON_STRUM_DOWN,false ), -// p2 - AutoMappingEntry( 0, KEY_Cy, GUITAR_BUTTON_FRET1, true ), - AutoMappingEntry( 0, KEY_Cu, GUITAR_BUTTON_FRET2, true ), - AutoMappingEntry( 0, KEY_Ci, GUITAR_BUTTON_FRET3, true ), - AutoMappingEntry( 0, KEY_Co, GUITAR_BUTTON_FRET4, true ), - AutoMappingEntry( 0, KEY_Cp, GUITAR_BUTTON_FRET5, true ), - AutoMappingEntry( 0, KEY_KP_C8, GUITAR_BUTTON_STRUM_UP, true ), - AutoMappingEntry( 0, KEY_KP_C5, GUITAR_BUTTON_STRUM_DOWN,true ) -); - -static const Game g_Game_Guitar = -{ - "guitar", // m_szName - g_apGame_Guitar_Styles, // m_apStyles - false, // m_bCountNotesSeparately (false stops crashes and failing) - true, // m_bAllowHopos - { // m_InputScheme - "guitar", // m_szName - NUM_GUITAR_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "Fret1", GAME_BUTTON_START }, - { "Fret2", GAME_BUTTON_BACK }, - { "Fret3", GameButton_Invalid }, - { "Fret4", GameButton_Invalid }, - { "Fret5", GameButton_Invalid }, - { "StrumUp", GAME_BUTTON_UP }, - { "StrumDown", GAME_BUTTON_DOWN }, - }, - &g_AutoKeyMappings_Guitar - }, - { - { GameButtonType_Fret }, // Green - { GameButtonType_Fret }, // Red - { GameButtonType_Fret }, // Yellow - { GameButtonType_Fret }, // Blue - { GameButtonType_Fret }, // Orange - { GameButtonType_Strum }, - { GameButtonType_Strum }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -/** Lights *******************************************************************/ - -static const AutoMappings g_AutoKeyMappings_Lights = AutoMappings ( - "", - "", - "", - AutoMappingEntry( 0, KEY_Cq, LIGHTS_BUTTON_MARQUEE_UP_LEFT, false ), - AutoMappingEntry( 0, KEY_Cw, LIGHTS_BUTTON_MARQUEE_UP_RIGHT, false ), - AutoMappingEntry( 0, KEY_Ce, LIGHTS_BUTTON_MARQUEE_LR_LEFT, false ), - AutoMappingEntry( 0, KEY_Cr, LIGHTS_BUTTON_MARQUEE_LR_RIGHT, false ), - AutoMappingEntry( 0, KEY_Ct, LIGHTS_BUTTON_BUTTONS_LEFT, false ), - AutoMappingEntry( 0, KEY_Cy, LIGHTS_BUTTON_BUTTONS_RIGHT, false ), - AutoMappingEntry( 0, KEY_Cu, LIGHTS_BUTTON_BASS_LEFT, false ), - AutoMappingEntry( 0, KEY_Ci, LIGHTS_BUTTON_BASS_RIGHT, false ) -); - -static const Style g_Style_Lights_Cabinet = -{ // STYLE_LIGHTS_CABINET - true, // m_bUsedForGameplay - true, // m_bUsedForEdit - false, // m_bUsedForDemonstration - false, // m_bUsedForHowToPlay - "cabinet", // m_szName - StepsType_lights_cabinet, // m_StepsType - StyleType_OnePlayerOneSide, // m_StyleType - NUM_CabinetLight, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - { // PLAYER_2 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, - }, - { // m_iInputColumn[NUM_GameController][NUM_GameButton] - { 0, 1, 2, 3, 4, 5, 6, 7, 8, Style::END_MAPPING }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, Style::END_MAPPING }, - }, - { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; - 0,1,2,3,4,5,6,7 - }, - false, // m_bNeedsZoomOutWith2Players - false, // m_bCanUseBeginnerHelper - false, // m_bLockDifficulties -}; - -static const Style *g_apGame_Lights_Styles[] = -{ - &g_Style_Lights_Cabinet, - NULL -}; - -static const Game g_Game_Lights = -{ - "lights", // m_szName - g_apGame_Lights_Styles, // m_apStyles - false, // m_bCountNotesSeparately - false, // m_bAllowHopos - { // m_InputScheme - "lights", // m_szName - NUM_LIGHTS_BUTTONS, // m_iButtonsPerController - { // m_szButtonNames - { "MarqueeUpLeft", GAME_BUTTON_LEFT }, - { "MarqueeUpRight", GAME_BUTTON_RIGHT }, - { "MarqueeLrLeft", GAME_BUTTON_UP }, - { "MarqueeLrRight", GAME_BUTTON_DOWN }, - { "ButtonsLeft", GameButton_Invalid }, - { "ButtonsRight", GameButton_Invalid }, - { "BassLeft", GameButton_Invalid }, - { "BassRight", GameButton_Invalid }, - }, - &g_AutoKeyMappings_Lights - }, - { - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - { GameButtonType_Step }, - }, - TNS_W1, // m_mapW1To - TNS_W2, // m_mapW2To - TNS_W3, // m_mapW3To - TNS_W4, // m_mapW4To - TNS_W5, // m_mapW5To -}; - -static const Game *g_Games[] = -{ - &g_Game_Dance, - &g_Game_Pump, - &g_Game_KB7, - &g_Game_Ez2, - &g_Game_Para, - &g_Game_DS3DDX, - &g_Game_Beat, - &g_Game_Maniax, - &g_Game_Techno, - &g_Game_Popn, - //&g_Game_Guitar, // nope, still broken. -aj - &g_Game_Lights, -}; - -GameManager::GameManager() -{ - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "GAMEMAN" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } -} - -GameManager::~GameManager() -{ - // Unregister with Lua. - LUA->UnsetGlobal( "GAMEMAN" ); -} - - -void GameManager::GetStylesForGame( const Game *pGame, vector& aStylesAddTo, bool editor ) -{ - for( int s=0; pGame->m_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( !editor && !style->m_bUsedForGameplay ) - continue; - if( editor && !style->m_bUsedForEdit ) - continue; - - aStylesAddTo.push_back( style ); - } -} - -const Game *GameManager::GetGameForStyle( const Style *pStyle ) -{ - for( size_t g=0; gm_apStyles[s]; ++s ) - { - if( pGame->m_apStyles[s] == pStyle ) - return pGame; - } - } - FAIL_M(pStyle->m_szName); -} - -const Style* GameManager::GetEditorStyleForStepsType( StepsType st ) -{ - for( size_t g=0; gm_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( style->m_StepsType == st && style->m_bUsedForEdit ) - return style; - } - } - - ASSERT(0); // this Game is missing a Style that can be used with the editor - return NULL; -} - - -void GameManager::GetStepsTypesForGame( const Game *pGame, vector& aStepsTypeAddTo ) -{ - FOREACH_ENUM( StepsType, st ) - { - bool found = false; - for( int s=0; pGame->m_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( style->m_StepsType != st ) - continue; - - found = true; - } - if( found ) - aStepsTypeAddTo.push_back( st ); - } -} - -void GameManager::GetDemonstrationStylesForGame( const Game *pGame, vector &vpStylesOut ) -{ - vpStylesOut.clear(); - - for( int s=0; pGame->m_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( style->m_bUsedForDemonstration ) - vpStylesOut.push_back( style ); - } - - ASSERT( vpStylesOut.size()>0 ); // this Game is missing a Style that can be used with the demonstration -} - -const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame ) -{ - for( int s=0; pGame->m_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( style->m_bUsedForHowToPlay ) - return style; - } - - ASSERT(0); // this Game is missing a Style that can be used with HowToPlay - return NULL; -} - -void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector &vpStylesOut ) -{ - FOREACH_ENUM( StyleType, styleType ) - { - int iNumPlayersRequired; - switch( styleType ) - { - DEFAULT_FAIL( styleType ); - case StyleType_OnePlayerOneSide: - case StyleType_OnePlayerTwoSides: - iNumPlayersRequired = 1; - break; - case StyleType_TwoPlayersTwoSides: - case StyleType_TwoPlayersSharedSides: - iNumPlayersRequired = 2; - break; - } - - if( iNumPlayers != iNumPlayersRequired ) - continue; - - for( int s=0; pGame->m_apStyles[s]; ++s ) - { - const Style *style = pGame->m_apStyles[s]; - if( style->m_StyleType != styleType ) - continue; - if( !style->m_bUsedForGameplay ) - continue; - - vpStylesOut.push_back( style ); - } - } -} - -const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ) -{ - vector vpStyles; - GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); - FOREACH_CONST( const Style*, vpStyles, s ) - if( (*s)->m_StepsType == st ) - return *s; - FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName, - GetStepsTypeInfo(st).szName, iNumPlayers, iNumPlayers==1?"":"s") ); - return NULL; -} - - -void GameManager::GetEnabledGames( vector& aGamesOut ) -{ - for( size_t g=0; g= 0 ); - ASSERT( index < (int) ARRAYLEN(g_Games) ); - return g_Games[index]; -} - -bool GameManager::IsGameEnabled( const Game *pGame ) -{ - return NOTESKIN->DoNoteSkinsExistForGame( pGame ); -} - -const StepsTypeInfo &GameManager::GetStepsTypeInfo( StepsType st ) -{ - ASSERT( ARRAYLEN(g_StepsTypeInfos) == NUM_StepsType ); - ASSERT_M( st < NUM_StepsType, ssprintf("StepsType %d < NUM_StepsType (%d)", st, NUM_StepsType) ); - return g_StepsTypeInfos[st]; -} - -StepsType GameManager::StringToStepsType( RString sStepsType ) -{ - sStepsType.MakeLower(); - - // TODO: Format specific hacks should be moved into the file loader for that format. - // If i'm assuming this correctly, these two only apply to .sm files: -aj - - // HACK: We eliminated "ez2-single-hard", but we should still handle it. - if( sStepsType == "ez2-single-hard" ) - sStepsType = "ez2-single"; - - // HACK: "para-single" used to be called just "para" - if( sStepsType == "para" ) - sStepsType = "para-single"; - - for( int i=0; im_szName; - s = Capitalize( s ); - if( THEME->HasString( "Style", s ) ) - return THEME->GetString( "Style", s ); - else - return s; -} - -const Game* GameManager::StringToGame( RString sGame ) -{ - for( size_t i=0; im_szName) ) - return g_Games[i]; - - return NULL; -} - - -const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle ) -{ - for( int s=0; game->m_apStyles[s]; ++s ) - { - const Style* style = game->m_apStyles[s]; - if( sStyle.CompareNoCase(style->m_szName) == 0 ) - return style; - } - - return NULL; -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the GameManager. */ -class LunaGameManager: public Luna -{ -public: - static int StepsTypeToLocalizedString( T* p, lua_State *L ) { lua_pushstring(L, p->GetStepsTypeInfo(Enum::Check(L, 1)).GetLocalizedString() ); return 1; } - static int GetFirstStepsTypeForGame( T* p, lua_State *L ) - { - Game *pGame = Luna::check( L, 1 ); - - vector vstAddTo; - p->GetStepsTypesForGame( pGame, vstAddTo ); - ASSERT( !vstAddTo.empty() ); - StepsType st = vstAddTo[0]; - LuaHelpers::Push( L, st ); - return 1; - } - static int IsGameEnabled( T* p, lua_State *L ) - { - const Game *pGame = p->StringToGame(SArg(1)); - if(pGame) - lua_pushboolean(L, p->IsGameEnabled( pGame ) ); - else - lua_pushnil(L); - - return 1; - } - - LunaGameManager() - { - ADD_METHOD( StepsTypeToLocalizedString ); - ADD_METHOD( GetFirstStepsTypeForGame ); - ADD_METHOD( IsGameEnabled ); - }; -}; - -LUA_REGISTER_CLASS( GameManager ) -// lua end - - -/* - * (c) 2001-2006 Chris Danford, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GameManager.h" +#include "GameConstantsAndTypes.h" +#include "GameInput.h" // for GameButton constants +#include "RageLog.h" +#include "RageUtil.h" +#include "NoteSkinManager.h" +#include "RageInputDevice.h" +#include "ThemeManager.h" +#include "LightsManager.h" // for NUM_CabinetLight +#include "Game.h" +#include "Style.h" +#include "Foreach.h" + +GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program + +enum +{ + TRACK_1 = 0, + TRACK_2, + TRACK_3, + TRACK_4, + TRACK_5, + TRACK_6, + TRACK_7, + TRACK_8, + TRACK_9, + TRACK_10, + TRACK_11, + TRACK_12, + TRACK_13, + TRACK_14, + TRACK_15, + TRACK_16, + // 16 tracks needed for beat-double7 and techno-double8 +}; + +RString StepsTypeInfo::GetLocalizedString() const +{ + if( THEME->HasString( "StepsType", szName ) ) + return THEME->GetString( "StepsType", szName ); + return szName; +} + +static const StepsTypeInfo g_StepsTypeInfos[] = { + // dance + { "dance-single", 4, true, StepsTypeCategory_Single }, + { "dance-double", 8, true, StepsTypeCategory_Double }, + { "dance-couple", 8, true, StepsTypeCategory_Couple }, + { "dance-solo", 6, true, StepsTypeCategory_Single }, + { "dance-threepanel", 3, true, StepsTypeCategory_Single }, // thanks to kurisu + { "dance-routine", 8, false, StepsTypeCategory_Routine }, + // pump + { "pump-single", 5, true, StepsTypeCategory_Single }, + { "pump-halfdouble", 6, true, StepsTypeCategory_Double }, + { "pump-double", 10, true, StepsTypeCategory_Double }, + { "pump-couple", 10, true, StepsTypeCategory_Couple }, + // uh, dance-routine has that one bool as false... wtf? -aj + { "pump-routine", 10, true, StepsTypeCategory_Routine }, + // kb7 + { "kb7-single", 7, true, StepsTypeCategory_Single }, + // ez2dancer + { "ez2-single", 5, true, StepsTypeCategory_Single }, // Single: TL,LHH,D,RHH,TR + { "ez2-double", 10, true, StepsTypeCategory_Double }, // Double: Single x2 + { "ez2-real", 7, true, StepsTypeCategory_Single }, // Real: TL,LHH,LHL,D,RHL,RHH,TR + // parapara paradise + { "para-single", 5, true, StepsTypeCategory_Single }, + // ds3ddx + { "ds3ddx-single", 8, true, StepsTypeCategory_Single }, + // beatmania + { "bm-single5", 6, true, StepsTypeCategory_Single }, // called "bm" for backward compat + { "bm-double5", 12, true, StepsTypeCategory_Double }, // called "bm" for backward compat + { "bm-single7", 8, true, StepsTypeCategory_Single }, // called "bm" for backward compat + { "bm-double7", 16, true, StepsTypeCategory_Double }, // called "bm" for backward compat + // dance maniax + { "maniax-single", 4, true, StepsTypeCategory_Single }, + { "maniax-double", 8, true, StepsTypeCategory_Double }, + // technomotion + { "techno-single4", 4, true, StepsTypeCategory_Single }, + { "techno-single5", 5, true, StepsTypeCategory_Single }, + { "techno-single8", 8, true, StepsTypeCategory_Single }, + { "techno-double4", 8, true, StepsTypeCategory_Double }, + { "techno-double5", 10, true, StepsTypeCategory_Double }, + { "techno-double8", 16, true, StepsTypeCategory_Double }, + // pop'n music + { "pnm-five", 5, true, StepsTypeCategory_Single }, // called "pnm" for backward compat + { "pnm-nine", 9, true, StepsTypeCategory_Single }, // called "pnm" for backward compat + // guitar hero + { "guitar-five", 5, true, StepsTypeCategory_Single }, // 5 frets, no wail + // cabinet lights and other fine StepsTypes that don't exist lol + { "lights-cabinet", NUM_CabinetLight, false, StepsTypeCategory_Single }, // XXX disable lights autogen for now +}; + + +// Important: Every game must define the buttons: "Start", "Back", "MenuLeft", "Operator" and "MenuRight" +static const AutoMappings g_AutoKeyMappings_Dance = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_DEL, GAME_BUTTON_MENULEFT, false ), + AutoMappingEntry( 0, KEY_PGDN, GAME_BUTTON_MENURIGHT, false ), + AutoMappingEntry( 0, KEY_HOME, GAME_BUTTON_MENUUP, false ), + AutoMappingEntry( 0, KEY_END, GAME_BUTTON_MENUDOWN, false ), + AutoMappingEntry( 0, KEY_LEFT, DANCE_BUTTON_LEFT, false ), + AutoMappingEntry( 0, KEY_RIGHT, DANCE_BUTTON_RIGHT, false ), + AutoMappingEntry( 0, KEY_UP, DANCE_BUTTON_UP, false ), + AutoMappingEntry( 0, KEY_DOWN, DANCE_BUTTON_DOWN, false ), + AutoMappingEntry( 0, KEY_KP_SLASH, GAME_BUTTON_MENULEFT, true ), + AutoMappingEntry( 0, KEY_KP_ASTERISK, GAME_BUTTON_MENURIGHT, true ), + AutoMappingEntry( 0, KEY_KP_HYPHEN, GAME_BUTTON_MENUUP, true ), + AutoMappingEntry( 0, KEY_KP_PLUS, GAME_BUTTON_MENUDOWN, true ), + AutoMappingEntry( 0, KEY_KP_C4, DANCE_BUTTON_LEFT, true ), + AutoMappingEntry( 0, KEY_KP_C6, DANCE_BUTTON_RIGHT, true ), + AutoMappingEntry( 0, KEY_KP_C8, DANCE_BUTTON_UP, true ), + AutoMappingEntry( 0, KEY_KP_C2, DANCE_BUTTON_DOWN, true ), + AutoMappingEntry( 0, KEY_KP_C7, DANCE_BUTTON_UPLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C9, DANCE_BUTTON_UPRIGHT, true ) +); + +// xxx: get this from the theme? (see others) +// the problem with getting it from the noteskin is that this is meant to be +// static const; if we switch to anything we likely won't get const anymore +// but i may be talking out of my ass -aj +static const int DANCE_COL_SPACING = 64; + +//static ThemeMetric DANCE_COL_SPACING("ColumnSpacing","Dance"); +// named after a similar metric in Aldo_MX's build for compatibility/familiarity: +//float DANCE_COL_SPACING NOTESKIN->GetMetricF("NoteDisplay","ArrowColSpacing"); +/* looking for ARROW_SIZE should be enough (ArrowSize) + * just arroweffects.cpp for rowspacing (ArrowRowSpacing) + */ + +static const Style g_Style_Dance_Single = +{ // STYLE_DANCE_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_dance_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 0, 3, 2, 1, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + false, // m_bNeedsZoomOutWith2Players + true, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_Versus = +{ // STYLE_DANCE_VERSUS + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_dance_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, + }, + { + { 0, 3, 2, 1, Style::END_MAPPING }, + { 0, 3, 2, 1, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + false, // m_bNeedsZoomOutWith2Players + true, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_Double = +{ // STYLE_DANCE_DOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double", // m_szName + StepsType_dance_double, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 4, 7, 6, 5, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_Couple = +{ // STYLE_DANCE_COUPLE + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "couple", // m_szName + StepsType_dance_couple, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_5, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_6, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 0, 3, 2, 1, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3 + }, + false, // m_bNeedsZoomOutWith2Players + true, // m_bCanUseBeginnerHelper + true, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_Solo = +{ // STYLE_DANCE_SOLO + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "solo", // m_szName + StepsType_dance_solo, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 5, 3, 2, 1, 4, Style::END_MAPPING }, + { 0, 5, 3, 2, 1, 4, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_ThreePanel = +{ // STYLE_DANCE_THREEPANEL + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "threepanel", // m_szName + StepsType_dance_threepanel, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 3, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + // 4 3 5 + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, 1, 0, 2, Style::END_MAPPING }, + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, 1, 0, 2, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Dance_Couple_Edit = +{ // STYLE_DANCE_EDIT_COUPLE + false, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "couple-edit", // m_szName + StepsType_dance_couple, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*4.0f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*3.0f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*2.0f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*2.0f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*3.0f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*4.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*4.0f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*3.0f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*2.0f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*2.0f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*3.0f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*4.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, Style::END_MAPPING }, + { 4, 5, 6, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +// todo: re-enable? (lol) +/* +static const Style g_Style_Dance_Solo_Versus = +{ // STYLE_DANCE_SOLO_VERSUS + "dance-solo-versus", // m_szName + StepsType_dance_solo, // m_StepsType + ONE_PLAYER_ONE_CREDIT, // m_StyleType + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + { TRACK_2, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_3, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_4, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_5, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_6, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + { TRACK_2, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_3, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_4, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_5, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_6, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 5, 3, 2, 1, 4, Style::END_MAPPING }, + { 0, 5, 3, 2, 1, 4, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,5,1,4,2,3 // outside in + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; */ + +static const Style g_Style_Dance_Routine = +{ // STYLE_DANCE_ROUTINE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "routine", // m_szName + StepsType_dance_routine, // m_StepsType + StyleType_TwoPlayersSharedSides, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 4, 7, 6, 5, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + true, // m_bLockDifficulties + +}; + +static const Style *g_apGame_Dance_Styles[] = +{ + &g_Style_Dance_Single, + &g_Style_Dance_Versus, + &g_Style_Dance_Double, + &g_Style_Dance_Couple, + &g_Style_Dance_Solo, + &g_Style_Dance_Couple_Edit, + &g_Style_Dance_Routine, + &g_Style_Dance_ThreePanel, + NULL +}; + +static const Game g_Game_Dance = +{ + "dance", // m_szName + g_apGame_Dance_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "dance", // m_szName + NUM_DANCE_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Left", GAME_BUTTON_LEFT }, + { "Right", GAME_BUTTON_RIGHT }, + { "Up", GAME_BUTTON_UP }, + { "Down", GAME_BUTTON_DOWN }, + { "UpLeft", GameButton_Invalid }, + { "UpRight", GameButton_Invalid }, + }, + &g_AutoKeyMappings_Dance + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +static const AutoMappings g_AutoKeyMappings_Pump = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cq, PUMP_BUTTON_UPLEFT, false ), + AutoMappingEntry( 0, KEY_Ce, PUMP_BUTTON_UPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cs, PUMP_BUTTON_CENTER, false ), + AutoMappingEntry( 0, KEY_Cz, PUMP_BUTTON_DOWNLEFT, false ), + AutoMappingEntry( 0, KEY_Cc, PUMP_BUTTON_DOWNRIGHT, false ), + AutoMappingEntry( 0, KEY_KP_C7, PUMP_BUTTON_UPLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C9, PUMP_BUTTON_UPRIGHT, true ), + AutoMappingEntry( 0, KEY_KP_C5, PUMP_BUTTON_CENTER, true ), + AutoMappingEntry( 0, KEY_KP_C1, PUMP_BUTTON_DOWNLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C3, PUMP_BUTTON_DOWNRIGHT, true ), + + // unmap confusing default MenuButtons + AutoMappingEntry( 0, KEY_KP_C8, GameButton_Invalid, false ), + AutoMappingEntry( 0, KEY_KP_C2, GameButton_Invalid, false ), + AutoMappingEntry( 0, KEY_KP_C4, GameButton_Invalid, false ), + AutoMappingEntry( 0, KEY_KP_C6, GameButton_Invalid, false ) +); + +// PIU Defaults: RowSpacing = 60; ColSpacing = 52; ArrowSize = 54; +// apparently column spacing is 48px +//static ThemeMetric PUMP_COL_SPACING ("ColumnSpacing","Pump"); +static const int PUMP_COL_SPACING = 48; + +static const Style g_Style_Pump_Single = +{ // STYLE_PUMP_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_pump_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_Versus = +{ // STYLE_PUMP_VERSUS + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_pump_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_HalfDouble = +{ // STYLE_PUMP_HALFDOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "halfdouble", // m_szName + StepsType_pump_halfdouble, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { Style::NO_MAPPING, 1, 0, Style::NO_MAPPING, 2, Style::END_MAPPING }, + { 4, Style::NO_MAPPING, 5, 3, Style::NO_MAPPING, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,3,1,4,0,5 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_Double = +{ // STYLE_PUMP_DOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double", // m_szName + StepsType_pump_double, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 10, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + { 6, 8, 7, 5, 9, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4, 2+5,1+5,3+5,0+5,4+5 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_Couple = +{ // STYLE_PUMP_COUPLE + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "couple", // m_szName + StepsType_pump_couple, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + true, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_Couple_Edit = +{ // STYLE_PUMP_EDIT_COUPLE + false, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "couple-edit", // m_szName + StepsType_pump_couple, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 10, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*5.0f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*4.0f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*3.0f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*2.0f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*1.0f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*1.0f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*2.0f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*3.0f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*4.0f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*5.0f+4, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, 6, 8, 7, 5, 9, Style::END_MAPPING }, + { 1, 3, 2, 0, 4, 6, 8, 7, 5, 9, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Pump_Routine = +{ // STYLE_PUMP_ROUTINE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "routine", // m_szName + StepsType_pump_routine, // m_StepsType + StyleType_TwoPlayersSharedSides, // m_StyleType + 10, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 3, 2, 0, 4, Style::END_MAPPING }, + { 6, 8, 7, 5, 9, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,1,3,0,4,7,6,8,5,9 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + true, // m_bLockDifficulties +}; + +static const Style *g_apGame_Pump_Styles[] = +{ + &g_Style_Pump_Single, + &g_Style_Pump_Versus, + &g_Style_Pump_HalfDouble, + &g_Style_Pump_Double, + &g_Style_Pump_Couple, + &g_Style_Pump_Couple_Edit, + &g_Style_Pump_Routine, + NULL +}; + +static const Game g_Game_Pump = +{ + "pump", // m_szName + g_apGame_Pump_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "pump", // m_szName + NUM_PUMP_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "UpLeft", GAME_BUTTON_UP }, + { "UpRight", GAME_BUTTON_DOWN }, + { "Center", GAME_BUTTON_START }, + { "DownLeft", GAME_BUTTON_LEFT }, + { "DownRight", GAME_BUTTON_RIGHT }, + }, + &g_AutoKeyMappings_Pump + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +static const AutoMappings g_AutoKeyMappings_KB7 = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cs, KB7_BUTTON_KEY1, false ), + AutoMappingEntry( 0, KEY_Cd, KB7_BUTTON_KEY2, false ), + AutoMappingEntry( 0, KEY_Cf, KB7_BUTTON_KEY3, false ), + AutoMappingEntry( 0, KEY_SPACE, KB7_BUTTON_KEY4, false ), + AutoMappingEntry( 0, KEY_Cj, KB7_BUTTON_KEY5, false ), + AutoMappingEntry( 0, KEY_Ck, KB7_BUTTON_KEY6, false ), + AutoMappingEntry( 0, KEY_Cl, KB7_BUTTON_KEY7, false ) +); + +//ThemeMetric KB7_COL_SPACING ("ColumnSpacing","KB7"); +static const int KB7_COL_SPACING = 64; +static const Style g_Style_KB7_Single = +{ // STYLE_KB7_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_kb7_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 7, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -KB7_COL_SPACING*3.25f, NULL }, + { TRACK_2, -KB7_COL_SPACING*2.25f, NULL }, + { TRACK_3, -KB7_COL_SPACING*1.25f, NULL }, + { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, + { TRACK_5, +KB7_COL_SPACING*1.25f, NULL }, + { TRACK_6, +KB7_COL_SPACING*2.25f, NULL }, + { TRACK_7, +KB7_COL_SPACING*3.25f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -KB7_COL_SPACING*3.25f, NULL }, + { TRACK_2, -KB7_COL_SPACING*2.25f, NULL }, + { TRACK_3, -KB7_COL_SPACING*1.25f, NULL }, + { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, + { TRACK_5, +KB7_COL_SPACING*1.25f, NULL }, + { TRACK_6, +KB7_COL_SPACING*2.25f, NULL }, + { TRACK_7, +KB7_COL_SPACING*3.25f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6 // doesn't work? + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_KB7_Versus = +{ // STYLE_KB7_VERSUS + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_kb7_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 7, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, + { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, + { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, + { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, + { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, + { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, + { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, + { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, + { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, + { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, + { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, + { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, + { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6 + }, + true, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_KB7_Styles[] = +{ + &g_Style_KB7_Single, + &g_Style_KB7_Versus, + NULL +}; + +static const Game g_Game_KB7 = +{ + "kb7", // m_szName + g_apGame_KB7_Styles, // m_apStyles + true, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "kb7", // m_szName + NUM_KB7_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Key1", GameButton_Invalid }, + { "Key2", GAME_BUTTON_LEFT }, + { "Key3", GAME_BUTTON_DOWN }, + { "Key4", GameButton_Invalid }, + { "Key5", GAME_BUTTON_UP }, + { "Key6", GAME_BUTTON_RIGHT }, + { "Key7", GameButton_Invalid }, + }, + &g_AutoKeyMappings_KB7 + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +//ThemeMetric EZ2_COL_SPACING ("ColumnSpacing","EZ2"); +static const int EZ2_COL_SPACING = 46; +// do you even need this if they're the same now -aj +//ThemeMetric EZ2__REAL_COL_SPACING ("ColumnSpacing","EZ2Real"); +static const int EZ2_REAL_COL_SPACING = 46; +static const Style g_Style_Ez2_Single = +{ // STYLE_EZ2_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_ez2_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, + { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, + { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 4, 2, 1, 3, Style::END_MAPPING }, + { 0, 4, 2, 1, 3, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Ez2_Real = +{ // STYLE_EZ2_REAL + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "real", // m_szName + StepsType_ez2_real, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 7, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, + { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, + { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, + { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, + { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, + { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 3,0,6,1,5,2,4 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Ez2_Single_Versus = +{ // STYLE_EZ2_SINGLE_VERSUS + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_ez2_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, + { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, + { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 4, 2, 1, 3, Style::END_MAPPING }, + { 0, 4, 2, 1, 3, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Ez2_Real_Versus = +{ // STYLE_EZ2_REAL_VERSUS + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versusReal", // m_szName + StepsType_ez2_real, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 7, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, + { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, + { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, + { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, + { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, + { 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Ez2_Double = +{ // STYLE_EZ2_DOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double", // m_szName + StepsType_ez2_double, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 10, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 4, 2, 1, 3, Style::END_MAPPING }, + { 5, 9, 7, 6, 8, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Ez2_Styles[] = +{ + &g_Style_Ez2_Single, + &g_Style_Ez2_Real, + &g_Style_Ez2_Single_Versus, + &g_Style_Ez2_Real_Versus, + &g_Style_Ez2_Double, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Ez2 = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cz, EZ2_BUTTON_FOOTUPLEFT, false ), + AutoMappingEntry( 0, KEY_Cb, EZ2_BUTTON_FOOTUPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cc, EZ2_BUTTON_FOOTDOWN, false ), + AutoMappingEntry( 0, KEY_Cx, EZ2_BUTTON_HANDUPLEFT, false ), + AutoMappingEntry( 0, KEY_Cv, EZ2_BUTTON_HANDUPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cs, EZ2_BUTTON_HANDLRLEFT, false ), + AutoMappingEntry( 0, KEY_Cf, EZ2_BUTTON_HANDLRRIGHT, false ) +); + +static const Game g_Game_Ez2 = +{ + "ez2", // m_szName + g_apGame_Ez2_Styles, // m_apStyles + true, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "ez2", // m_szName + NUM_EZ2_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "FootUpLeft", GAME_BUTTON_UP }, + { "FootUpRight", GAME_BUTTON_DOWN }, + { "FootDown", GAME_BUTTON_START }, + { "HandUpLeft", GAME_BUTTON_LEFT }, + { "HandUpRight", GAME_BUTTON_RIGHT }, + { "HandLrLeft", GameButton_Invalid }, + { "HandLrRight", GameButton_Invalid }, + }, + &g_AutoKeyMappings_Ez2 + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W2, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W2, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_Miss, // m_mapW5To +}; + +//ThemeMetric PARA_COL_SPACING ("ColumnSpacing","Para"); +static const int PARA_COL_SPACING = 54; + +static const Style g_Style_Para_Single = +{ // STYLE_PARA_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_para_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,0,4,1,3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Para_Versus = +{ // STYLE_PARA_VERSUS + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_para_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 2,0,4,1,3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Para_Styles[] = +{ + &g_Style_Para_Single, + &g_Style_Para_Versus, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Para = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cz, PARA_BUTTON_LEFT, false ), + AutoMappingEntry( 0, KEY_Cx, PARA_BUTTON_UPLEFT, false ), + AutoMappingEntry( 0, KEY_Cc, PARA_BUTTON_UP, false ), + AutoMappingEntry( 0, KEY_Cv, PARA_BUTTON_UPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cb, PARA_BUTTON_RIGHT, false ) +); + +static const Game g_Game_Para = +{ + "para", // m_szName + g_apGame_Para_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "para", // m_szName + NUM_PARA_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Left", GAME_BUTTON_LEFT }, + { "UpLeft", GAME_BUTTON_DOWN }, + { "Up", GameButton_Invalid }, + { "UpRight", GAME_BUTTON_UP }, + { "Right", GAME_BUTTON_RIGHT }, + }, + &g_AutoKeyMappings_Para + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +//ThemeMetric DS3DDX_COL_SPACING ("ColumnSpacing","DS3DDX"); +static const int DS3DDX_COL_SPACING = 46; +static const Style g_Style_DS3DDX_Single = +{ // STYLE_DS3DDX_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_ds3ddx_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, + { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_8, +DS3DDX_COL_SPACING*3.0f , NULL}, + }, + { // PLAYER_2 + { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, + { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_8, +DS3DDX_COL_SPACING*3.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, 5, 6, 7, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_DS3DDX_Styles[] = +{ + &g_Style_DS3DDX_Single, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_DS3DDX = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Ca, DS3DDX_BUTTON_HANDLEFT, false ), + AutoMappingEntry( 0, KEY_Cz, DS3DDX_BUTTON_FOOTDOWNLEFT, false ), + AutoMappingEntry( 0, KEY_Cq, DS3DDX_BUTTON_FOOTUPLEFT, false ), + AutoMappingEntry( 0, KEY_Cw, DS3DDX_BUTTON_HANDUP, false ), + AutoMappingEntry( 0, KEY_Cx, DS3DDX_BUTTON_HANDDOWN, false ), + AutoMappingEntry( 0, KEY_Ce, DS3DDX_BUTTON_FOOTUPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cc, DS3DDX_BUTTON_FOOTDOWNRIGHT, false ), + AutoMappingEntry( 0, KEY_Cd, DS3DDX_BUTTON_HANDRIGHT, false ) +); + +static const Game g_Game_DS3DDX = +{ + "ds3ddx", // m_szName + g_apGame_DS3DDX_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "ds3ddx", // m_szName + NUM_DS3DDX_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "HandLeft", GAME_BUTTON_LEFT }, + { "FootDownLeft", GameButton_Invalid }, + { "FootUpLeft", GameButton_Invalid }, + { "HandUp", GAME_BUTTON_UP }, + { "HandDown", GAME_BUTTON_DOWN }, + { "FootUpRight", GameButton_Invalid }, + { "FootDownRight", GameButton_Invalid }, + { "HandRight", GAME_BUTTON_RIGHT }, + }, + &g_AutoKeyMappings_DS3DDX + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +//ThemeMetric BEAT_COL_SPACING ("ColumnSpacing","Beat"); +static const int BEAT_COL_SPACING = 34; +static const Style g_Style_Beat_Single5 = +{ // STYLE_BEAT_SINGLE5 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single5", // m_szName + StepsType_beat_single5, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, + }, + { // PLAYER_2 + { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Beat_Double = +{ // STYLE_BEAT_DOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double5", // m_szName + StepsType_beat_double5, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 12, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, + { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, + }, + { // PLAYER_2 + { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, + { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, + { 5, 6, 7, 8, 9, Style::NO_MAPPING, Style::NO_MAPPING, 10, 10, Style::END_MAPPING } + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7,8,9,10,11 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Beat_Single7 = +{ // STYLE_BEAT_SINGLE7 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "single7", // m_szName + StepsType_beat_single7, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_8, -BEAT_COL_SPACING*3.5f, "scratch" }, + { TRACK_1, -BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*1.0f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*0.0f, NULL }, + { TRACK_4, +BEAT_COL_SPACING*1.0f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*3.0f, NULL }, + { TRACK_7, +BEAT_COL_SPACING*4.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_7, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_8, +BEAT_COL_SPACING*4.0f, "scratch" }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 2, 3, 4, 5, 6, 7, 0, 0, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, 7, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Beat_Double7 = +{ // STYLE_BEAT_DOUBLE7 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double7", // m_szName + StepsType_beat_double7, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 16, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, + { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, + }, + { // PLAYER_2 + { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, + { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 2, 3, 4, 5, 6, 7, 0, 0, Style::END_MAPPING }, + { 8, 9, 10, 11, 12, 13, 14, 15, 15, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Beat_Styles[] = +{ + &g_Style_Beat_Single5, + &g_Style_Beat_Double, + &g_Style_Beat_Single7, + &g_Style_Beat_Double7, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Beat = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cm, BEAT_BUTTON_KEY1, false ), + AutoMappingEntry( 0, KEY_Ck, BEAT_BUTTON_KEY2, false ), + AutoMappingEntry( 0, KEY_COMMA, BEAT_BUTTON_KEY3, false ), + AutoMappingEntry( 0, KEY_Cl, BEAT_BUTTON_KEY4, false ), + AutoMappingEntry( 0, KEY_PERIOD, BEAT_BUTTON_KEY5, false ), + AutoMappingEntry( 0, KEY_SEMICOLON, BEAT_BUTTON_KEY6, false ), + AutoMappingEntry( 0, KEY_SLASH, BEAT_BUTTON_KEY7, false ), + AutoMappingEntry( 0, KEY_LSHIFT, BEAT_BUTTON_SCRATCHUP, false ) +); + +static const Game g_Game_Beat = +{ + "beat", // m_szName + g_apGame_Beat_Styles, // m_apStyles + true, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "beat", // m_szName + NUM_BEAT_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Key1", GAME_BUTTON_LEFT }, + { "Key2", GameButton_Invalid }, + { "Key3", GAME_BUTTON_RIGHT }, + { "Key4", GameButton_Invalid }, + { "Key5", GameButton_Invalid }, + { "Key6", GameButton_Invalid }, + { "Key7", GameButton_Invalid }, + { "Scratch up", GAME_BUTTON_UP }, + { "Scratch down", GAME_BUTTON_DOWN }, + }, + &g_AutoKeyMappings_Beat + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +//ThemeMetric MANIAX_COL_SPACING ("ColumnSpacing","Maniax"); +static const int MANIAX_COL_SPACING = 36; +static const Style g_Style_Maniax_Single = +{ // STYLE_MANIAX_SINGLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single", // m_szName + StepsType_maniax_single, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 2, 0, 3, Style::END_MAPPING }, + { 1, 2, 0, 3, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Maniax_Versus = +{ // STYLE_MANIAX_VERSUS + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus", // m_szName + StepsType_maniax_single, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 2, 0, 3, Style::END_MAPPING }, + { 1, 2, 0, 3, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Maniax_Double = +{ // STYLE_MANIAX_DOUBLE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double", // m_szName + StepsType_maniax_double, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 2, 0, 3, Style::END_MAPPING }, + { 5, 6, 4, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Maniax_Styles[] = +{ + &g_Style_Maniax_Single, + &g_Style_Maniax_Versus, + &g_Style_Maniax_Double, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Maniax = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Ca, MANIAX_BUTTON_HANDUPLEFT, false ), + AutoMappingEntry( 0, KEY_Cs, MANIAX_BUTTON_HANDUPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cz, MANIAX_BUTTON_HANDLRLEFT, false ), + AutoMappingEntry( 0, KEY_Cx, MANIAX_BUTTON_HANDLRRIGHT, false ), + AutoMappingEntry( 0, KEY_KP_C4, MANIAX_BUTTON_HANDUPLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C5, MANIAX_BUTTON_HANDUPRIGHT, true ), + AutoMappingEntry( 0, KEY_KP_C1, MANIAX_BUTTON_HANDLRLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C2, MANIAX_BUTTON_HANDLRRIGHT, true ) +); + +static const Game g_Game_Maniax = +{ + "maniax", // m_szName + g_apGame_Maniax_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "maniax", // m_szName + NUM_MANIAX_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "HandUpLeft", GAME_BUTTON_LEFT }, + { "HandUpRight", GAME_BUTTON_RIGHT }, + { "HandLrLeft", GAME_BUTTON_DOWN }, + { "HandLrRight", GAME_BUTTON_UP }, + }, + &g_AutoKeyMappings_Maniax + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +/** Techno *******************************************************************/ + +//ThemeMetric TECHNO_COL_SPACING ("ColumnSpacing","Techno"); +static const int TECHNO_COL_SPACING = 56; +//ThemeMetric TECHNO_VERSUS_COL_SPACING ("ColumnSpacing","TechnoVersus"); +static const int TECHNO_VERSUS_COL_SPACING = 33; +static const Style g_Style_Techno_Single4 = +{ // STYLE_TECHNO_SINGLE4 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "single4", // m_szName + StepsType_techno_single4, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 0, 3, 2, 1, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Single5 = +{ // STYLE_TECHNO_SINGLE5 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "single5", // m_szName + StepsType_techno_single5, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 1, 3, 2, 0, 4, Style::END_MAPPING }, + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 1, 3, 2, 0, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Single8 = +{ // STYLE_TECHNO_SINGLE8 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "single8", // m_szName + StepsType_techno_single8, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*4.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + true, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Versus4 = +{ // STYLE_TECHNO_VERSUS4 + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus4", // m_szName + StepsType_techno_single4, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 0, 3, 2, 1, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Versus5 = +{ // STYLE_TECHNO_VERSUS5 + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus5", // m_szName + StepsType_techno_single5, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 1, 3, 2, 0, 4, Style::END_MAPPING }, + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 1, 3, 2, 0, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Versus8 = +{ // STYLE_TECHNO_VERSUS8 + true, // m_bUsedForGameplay + false, // m_bUsedForEdit + true, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "versus8", // m_szName + StepsType_techno_single8, // m_StepsType + StyleType_TwoPlayersTwoSides, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, +// { 1, 6, 4, Style::NO_MAPPING, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, +// { 1, 6, 4, Style::NO_MAPPING, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + true, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Double4 = +{ // STYLE_TECHNO_DOUBLE4 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double4", // m_szName + StepsType_techno_double4, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 3, 2, 1, Style::END_MAPPING }, + { 4, 7, 6, 5, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Double5 = +{ // STYLE_TECHNO_DOUBLE5 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double5", // m_szName + StepsType_techno_double5, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 10, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + { 1, 6, 4, 3, 2, 5, Style::NO_MAPPING, 0, 7, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Techno_Double8 = +{ // STYLE_TECHNO_DOUBLE8 + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "double8", // m_szName + StepsType_techno_double8, // m_StepsType + StyleType_OnePlayerTwoSides, // m_StyleType + 16, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, + { TRACK_2, -TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, + { TRACK_3, -TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, + { TRACK_4, -TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, + { TRACK_5, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_6, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_7, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_8, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_9, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_10, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_11, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_12, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_13, +TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, + { TRACK_14, +TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, + { TRACK_15, +TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, + { TRACK_16, +TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, + { TRACK_2, -TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, + { TRACK_3, -TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, + { TRACK_4, -TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, + { TRACK_5, -TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_6, -TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_7, -TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_8, -TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_9, +TECHNO_VERSUS_COL_SPACING*0.5f, NULL }, + { TRACK_10, +TECHNO_VERSUS_COL_SPACING*1.5f, NULL }, + { TRACK_11, +TECHNO_VERSUS_COL_SPACING*2.5f, NULL }, + { TRACK_12, +TECHNO_VERSUS_COL_SPACING*3.5f, NULL }, + { TRACK_13, +TECHNO_VERSUS_COL_SPACING*4.5f, NULL }, + { TRACK_14, +TECHNO_VERSUS_COL_SPACING*5.5f, NULL }, + { TRACK_15, +TECHNO_VERSUS_COL_SPACING*6.5f, NULL }, + { TRACK_16, +TECHNO_VERSUS_COL_SPACING*7.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 1, 3, 2, 0, 4, Style::END_MAPPING }, + { Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, Style::NO_MAPPING, + 6, 8, 7, 5, 9, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7,8,9 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Techno_Styles[] = +{ + &g_Style_Techno_Single4, + &g_Style_Techno_Single5, + &g_Style_Techno_Single8, + &g_Style_Techno_Versus4, + &g_Style_Techno_Versus5, + &g_Style_Techno_Versus8, + &g_Style_Techno_Double4, + &g_Style_Techno_Double5, + &g_Style_Techno_Double8, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Techno = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Ca, TECHNO_BUTTON_LEFT, false ), + AutoMappingEntry( 0, KEY_Cd, TECHNO_BUTTON_RIGHT, false ), + AutoMappingEntry( 0, KEY_Cw, TECHNO_BUTTON_UP, false ), + AutoMappingEntry( 0, KEY_Cx, TECHNO_BUTTON_DOWN, false ), + AutoMappingEntry( 0, KEY_Cq, TECHNO_BUTTON_UPLEFT, false ), + AutoMappingEntry( 0, KEY_Ce, TECHNO_BUTTON_UPRIGHT, false ), + AutoMappingEntry( 0, KEY_Cs, TECHNO_BUTTON_CENTER, false ), + AutoMappingEntry( 0, KEY_Cz, TECHNO_BUTTON_DOWNLEFT, false ), + AutoMappingEntry( 0, KEY_Cc, TECHNO_BUTTON_DOWNRIGHT,false ), + AutoMappingEntry( 0, KEY_KP_C4, TECHNO_BUTTON_LEFT, true ), + AutoMappingEntry( 0, KEY_KP_C6, TECHNO_BUTTON_RIGHT, true ), + AutoMappingEntry( 0, KEY_KP_C8, TECHNO_BUTTON_UP, true ), + AutoMappingEntry( 0, KEY_KP_C2, TECHNO_BUTTON_DOWN, true ), + AutoMappingEntry( 0, KEY_KP_C7, TECHNO_BUTTON_UPLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C9, TECHNO_BUTTON_UPRIGHT, true ), + AutoMappingEntry( 0, KEY_KP_C5, TECHNO_BUTTON_CENTER, true ), + AutoMappingEntry( 0, KEY_KP_C1, TECHNO_BUTTON_DOWNLEFT, true ), + AutoMappingEntry( 0, KEY_KP_C3, TECHNO_BUTTON_DOWNRIGHT,true ) +); + +static const Game g_Game_Techno = +{ + "techno", // m_szName + g_apGame_Techno_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "techno", // m_szName + NUM_TECHNO_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Left", GAME_BUTTON_LEFT }, + { "Right", GAME_BUTTON_RIGHT }, + { "Up", GAME_BUTTON_UP }, + { "Down", GAME_BUTTON_DOWN }, + { "UpLeft", GameButton_Invalid }, + { "UpRight", GameButton_Invalid }, + { "Center", GameButton_Invalid }, + { "DownLeft", GameButton_Invalid }, + { "DownRight", GameButton_Invalid }, + }, + &g_AutoKeyMappings_Techno + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +/** popn *********************************************************************/ +//ThemeMetric POPN5_COL_SPACING ("ColumnSpacing","Popn5"); +static const int POPN5_COL_SPACING = 32; +//ThemeMetric POPN9_COL_SPACING ("ColumnSpacing","Popn9"); +static const int POPN9_COL_SPACING = 32; +static const Style g_Style_Popn_Five = +{ // STYLE_POPN_FIVE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "popn-five", // m_szName + StepsType_popn_five, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, + { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, + { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, + { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, + { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { Style::NO_MAPPING, Style::NO_MAPPING, 0, 1, 2, 3, 4, Style::END_MAPPING }, + { Style::NO_MAPPING, Style::NO_MAPPING, 0, 1, 2, 3, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style g_Style_Popn_Nine = +{ // STYLE_POPN_NINE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "popn-nine", // m_szName + StepsType_popn_nine, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 9, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, + { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, + { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, + { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, + { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7,8 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Popn_Styles[] = +{ + &g_Style_Popn_Five, + &g_Style_Popn_Nine, + NULL +}; + +static const AutoMappings g_AutoKeyMappings_Popn = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cz, POPN_BUTTON_LEFT_WHITE, false ), + AutoMappingEntry( 0, KEY_Cs, POPN_BUTTON_LEFT_YELLOW,false ), + AutoMappingEntry( 0, KEY_Cx, POPN_BUTTON_LEFT_GREEN, false ), + AutoMappingEntry( 0, KEY_Cd, POPN_BUTTON_LEFT_BLUE, false ), + AutoMappingEntry( 0, KEY_Cc, POPN_BUTTON_RED, false ), + AutoMappingEntry( 0, KEY_Cf, POPN_BUTTON_RIGHT_BLUE, false ), + AutoMappingEntry( 0, KEY_Cv, POPN_BUTTON_RIGHT_GREEN,false ), + AutoMappingEntry( 0, KEY_Cg, POPN_BUTTON_RIGHT_YELLOW,false ), + AutoMappingEntry( 0, KEY_Cb, POPN_BUTTON_RIGHT_WHITE,false ) +); + +static const Game g_Game_Popn = +{ + "popn", // m_szName + g_apGame_Popn_Styles, // m_apStyles + true, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "popn", // m_szName + NUM_POPN_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Left White", GameButton_Invalid }, + { "Left Yellow", GAME_BUTTON_UP }, + { "Left Green", GameButton_Invalid }, + { "Left Blue", GAME_BUTTON_LEFT }, + { "Red", GAME_BUTTON_START }, + { "Right Blue", GAME_BUTTON_RIGHT }, + { "Right Green", GameButton_Invalid }, + { "Right Yellow", GAME_BUTTON_DOWN }, + { "Right White", GameButton_Invalid }, + }, + &g_AutoKeyMappings_Popn + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W2, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W3, // m_mapW4To + TNS_Miss, // m_mapW5To +}; + +/** Guitar5 ******************************************************************/ +//ThemeMetric GUITAR5_COL_SPACING ("ColumnSpacing","Guitar5"); +static const int GUITAR5_COL_SPACING = 48; + +static const Style g_Style_Guitar_Five = +{ // STYLE_GUITAR_FIVE + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + true, // m_bUsedForDemonstration + true, // m_bUsedForHowToPlay + "guitar-five", // m_szName + StepsType_guitar_five, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -GUITAR5_COL_SPACING*2.0f, NULL }, + { TRACK_2, -GUITAR5_COL_SPACING*1.0f, NULL }, + { TRACK_3, +GUITAR5_COL_SPACING*0.0f, NULL }, + { TRACK_4, +GUITAR5_COL_SPACING*1.0f, NULL }, + { TRACK_5, +GUITAR5_COL_SPACING*2.0f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -GUITAR5_COL_SPACING*2.0f, NULL }, + { TRACK_2, -GUITAR5_COL_SPACING*1.0f, NULL }, + { TRACK_3, +GUITAR5_COL_SPACING*0.0f, NULL }, + { TRACK_4, +GUITAR5_COL_SPACING*1.0f, NULL }, + { TRACK_5, +GUITAR5_COL_SPACING*2.0f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Guitar_Styles[] = +{ + &g_Style_Guitar_Five, + NULL +}; + +// auto keymappings +static const AutoMappings g_AutoKeyMappings_Guitar = AutoMappings ( + "", + "", + "", +// p1 + AutoMappingEntry( 0, KEY_Cz, GUITAR_BUTTON_FRET1, false ), + AutoMappingEntry( 0, KEY_Cx, GUITAR_BUTTON_FRET2, false ), + AutoMappingEntry( 0, KEY_Cc, GUITAR_BUTTON_FRET3, false ), + AutoMappingEntry( 0, KEY_Cv, GUITAR_BUTTON_FRET4, false ), + AutoMappingEntry( 0, KEY_Cb, GUITAR_BUTTON_FRET5, false ), + AutoMappingEntry( 0, KEY_UP, GUITAR_BUTTON_STRUM_UP, false ), + AutoMappingEntry( 0, KEY_DOWN, GUITAR_BUTTON_STRUM_DOWN,false ), +// p2 + AutoMappingEntry( 0, KEY_Cy, GUITAR_BUTTON_FRET1, true ), + AutoMappingEntry( 0, KEY_Cu, GUITAR_BUTTON_FRET2, true ), + AutoMappingEntry( 0, KEY_Ci, GUITAR_BUTTON_FRET3, true ), + AutoMappingEntry( 0, KEY_Co, GUITAR_BUTTON_FRET4, true ), + AutoMappingEntry( 0, KEY_Cp, GUITAR_BUTTON_FRET5, true ), + AutoMappingEntry( 0, KEY_KP_C8, GUITAR_BUTTON_STRUM_UP, true ), + AutoMappingEntry( 0, KEY_KP_C5, GUITAR_BUTTON_STRUM_DOWN,true ) +); + +static const Game g_Game_Guitar = +{ + "guitar", // m_szName + g_apGame_Guitar_Styles, // m_apStyles + false, // m_bCountNotesSeparately (false stops crashes and failing) + true, // m_bAllowHopos + { // m_InputScheme + "guitar", // m_szName + NUM_GUITAR_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "Fret1", GAME_BUTTON_START }, + { "Fret2", GAME_BUTTON_BACK }, + { "Fret3", GameButton_Invalid }, + { "Fret4", GameButton_Invalid }, + { "Fret5", GameButton_Invalid }, + { "StrumUp", GAME_BUTTON_UP }, + { "StrumDown", GAME_BUTTON_DOWN }, + }, + &g_AutoKeyMappings_Guitar + }, + { + { GameButtonType_Fret }, // Green + { GameButtonType_Fret }, // Red + { GameButtonType_Fret }, // Yellow + { GameButtonType_Fret }, // Blue + { GameButtonType_Fret }, // Orange + { GameButtonType_Strum }, + { GameButtonType_Strum }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +/** Lights *******************************************************************/ + +static const AutoMappings g_AutoKeyMappings_Lights = AutoMappings ( + "", + "", + "", + AutoMappingEntry( 0, KEY_Cq, LIGHTS_BUTTON_MARQUEE_UP_LEFT, false ), + AutoMappingEntry( 0, KEY_Cw, LIGHTS_BUTTON_MARQUEE_UP_RIGHT, false ), + AutoMappingEntry( 0, KEY_Ce, LIGHTS_BUTTON_MARQUEE_LR_LEFT, false ), + AutoMappingEntry( 0, KEY_Cr, LIGHTS_BUTTON_MARQUEE_LR_RIGHT, false ), + AutoMappingEntry( 0, KEY_Ct, LIGHTS_BUTTON_BUTTONS_LEFT, false ), + AutoMappingEntry( 0, KEY_Cy, LIGHTS_BUTTON_BUTTONS_RIGHT, false ), + AutoMappingEntry( 0, KEY_Cu, LIGHTS_BUTTON_BASS_LEFT, false ), + AutoMappingEntry( 0, KEY_Ci, LIGHTS_BUTTON_BASS_RIGHT, false ) +); + +static const Style g_Style_Lights_Cabinet = +{ // STYLE_LIGHTS_CABINET + true, // m_bUsedForGameplay + true, // m_bUsedForEdit + false, // m_bUsedForDemonstration + false, // m_bUsedForHowToPlay + "cabinet", // m_szName + StepsType_lights_cabinet, // m_StepsType + StyleType_OnePlayerOneSide, // m_StyleType + NUM_CabinetLight, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + { // PLAYER_2 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, + }, + { // m_iInputColumn[NUM_GameController][NUM_GameButton] + { 0, 1, 2, 3, 4, 5, 6, 7, 8, Style::END_MAPPING }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, Style::END_MAPPING }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + false, // m_bNeedsZoomOutWith2Players + false, // m_bCanUseBeginnerHelper + false, // m_bLockDifficulties +}; + +static const Style *g_apGame_Lights_Styles[] = +{ + &g_Style_Lights_Cabinet, + NULL +}; + +static const Game g_Game_Lights = +{ + "lights", // m_szName + g_apGame_Lights_Styles, // m_apStyles + false, // m_bCountNotesSeparately + false, // m_bAllowHopos + { // m_InputScheme + "lights", // m_szName + NUM_LIGHTS_BUTTONS, // m_iButtonsPerController + { // m_szButtonNames + { "MarqueeUpLeft", GAME_BUTTON_LEFT }, + { "MarqueeUpRight", GAME_BUTTON_RIGHT }, + { "MarqueeLrLeft", GAME_BUTTON_UP }, + { "MarqueeLrRight", GAME_BUTTON_DOWN }, + { "ButtonsLeft", GameButton_Invalid }, + { "ButtonsRight", GameButton_Invalid }, + { "BassLeft", GameButton_Invalid }, + { "BassRight", GameButton_Invalid }, + }, + &g_AutoKeyMappings_Lights + }, + { + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + { GameButtonType_Step }, + }, + TNS_W1, // m_mapW1To + TNS_W2, // m_mapW2To + TNS_W3, // m_mapW3To + TNS_W4, // m_mapW4To + TNS_W5, // m_mapW5To +}; + +static const Game *g_Games[] = +{ + &g_Game_Dance, + &g_Game_Pump, + &g_Game_KB7, + &g_Game_Ez2, + &g_Game_Para, + &g_Game_DS3DDX, + &g_Game_Beat, + &g_Game_Maniax, + &g_Game_Techno, + &g_Game_Popn, + //&g_Game_Guitar, // nope, still broken. -aj + &g_Game_Lights, +}; + +GameManager::GameManager() +{ + // Register with Lua. + { + Lua *L = LUA->Get(); + lua_pushstring( L, "GAMEMAN" ); + this->PushSelf( L ); + lua_settable( L, LUA_GLOBALSINDEX ); + LUA->Release( L ); + } +} + +GameManager::~GameManager() +{ + // Unregister with Lua. + LUA->UnsetGlobal( "GAMEMAN" ); +} + + +void GameManager::GetStylesForGame( const Game *pGame, vector& aStylesAddTo, bool editor ) +{ + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( !editor && !style->m_bUsedForGameplay ) + continue; + if( editor && !style->m_bUsedForEdit ) + continue; + + aStylesAddTo.push_back( style ); + } +} + +const Game *GameManager::GetGameForStyle( const Style *pStyle ) +{ + for( size_t g=0; gm_apStyles[s]; ++s ) + { + if( pGame->m_apStyles[s] == pStyle ) + return pGame; + } + } + FAIL_M(pStyle->m_szName); +} + +const Style* GameManager::GetEditorStyleForStepsType( StepsType st ) +{ + for( size_t g=0; gm_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( style->m_StepsType == st && style->m_bUsedForEdit ) + return style; + } + } + + ASSERT(0); // this Game is missing a Style that can be used with the editor + return NULL; +} + + +void GameManager::GetStepsTypesForGame( const Game *pGame, vector& aStepsTypeAddTo ) +{ + FOREACH_ENUM( StepsType, st ) + { + bool found = false; + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( style->m_StepsType != st ) + continue; + + found = true; + } + if( found ) + aStepsTypeAddTo.push_back( st ); + } +} + +void GameManager::GetDemonstrationStylesForGame( const Game *pGame, vector &vpStylesOut ) +{ + vpStylesOut.clear(); + + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( style->m_bUsedForDemonstration ) + vpStylesOut.push_back( style ); + } + + ASSERT( vpStylesOut.size()>0 ); // this Game is missing a Style that can be used with the demonstration +} + +const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame ) +{ + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( style->m_bUsedForHowToPlay ) + return style; + } + + ASSERT(0); // this Game is missing a Style that can be used with HowToPlay + return NULL; +} + +void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector &vpStylesOut ) +{ + FOREACH_ENUM( StyleType, styleType ) + { + int iNumPlayersRequired; + switch( styleType ) + { + DEFAULT_FAIL( styleType ); + case StyleType_OnePlayerOneSide: + case StyleType_OnePlayerTwoSides: + iNumPlayersRequired = 1; + break; + case StyleType_TwoPlayersTwoSides: + case StyleType_TwoPlayersSharedSides: + iNumPlayersRequired = 2; + break; + } + + if( iNumPlayers != iNumPlayersRequired ) + continue; + + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + const Style *style = pGame->m_apStyles[s]; + if( style->m_StyleType != styleType ) + continue; + if( !style->m_bUsedForGameplay ) + continue; + + vpStylesOut.push_back( style ); + } + } +} + +const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ) +{ + vector vpStyles; + GetCompatibleStyles( pGame, iNumPlayers, vpStyles ); + FOREACH_CONST( const Style*, vpStyles, s ) + if( (*s)->m_StepsType == st ) + return *s; + FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName, + GetStepsTypeInfo(st).szName, iNumPlayers, iNumPlayers==1?"":"s") ); + return NULL; +} + + +void GameManager::GetEnabledGames( vector& aGamesOut ) +{ + for( size_t g=0; g= 0 ); + ASSERT( index < (int) ARRAYLEN(g_Games) ); + return g_Games[index]; +} + +bool GameManager::IsGameEnabled( const Game *pGame ) +{ + return NOTESKIN->DoNoteSkinsExistForGame( pGame ); +} + +const StepsTypeInfo &GameManager::GetStepsTypeInfo( StepsType st ) +{ + ASSERT( ARRAYLEN(g_StepsTypeInfos) == NUM_StepsType ); + ASSERT_M( st < NUM_StepsType, ssprintf("StepsType %d < NUM_StepsType (%d)", st, NUM_StepsType) ); + return g_StepsTypeInfos[st]; +} + +StepsType GameManager::StringToStepsType( RString sStepsType ) +{ + sStepsType.MakeLower(); + + // TODO: Format specific hacks should be moved into the file loader for that format. + // If i'm assuming this correctly, these two only apply to .sm files: -aj + + // HACK: We eliminated "ez2-single-hard", but we should still handle it. + if( sStepsType == "ez2-single-hard" ) + sStepsType = "ez2-single"; + + // HACK: "para-single" used to be called just "para" + if( sStepsType == "para" ) + sStepsType = "para-single"; + + for( int i=0; im_szName; + s = Capitalize( s ); + if( THEME->HasString( "Style", s ) ) + return THEME->GetString( "Style", s ); + else + return s; +} + +const Game* GameManager::StringToGame( RString sGame ) +{ + for( size_t i=0; im_szName) ) + return g_Games[i]; + + return NULL; +} + + +const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle ) +{ + for( int s=0; game->m_apStyles[s]; ++s ) + { + const Style* style = game->m_apStyles[s]; + if( sStyle.CompareNoCase(style->m_szName) == 0 ) + return style; + } + + return NULL; +} + +// lua start +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the GameManager. */ +class LunaGameManager: public Luna +{ +public: + static int StepsTypeToLocalizedString( T* p, lua_State *L ) { lua_pushstring(L, p->GetStepsTypeInfo(Enum::Check(L, 1)).GetLocalizedString() ); return 1; } + static int GetFirstStepsTypeForGame( T* p, lua_State *L ) + { + Game *pGame = Luna::check( L, 1 ); + + vector vstAddTo; + p->GetStepsTypesForGame( pGame, vstAddTo ); + ASSERT( !vstAddTo.empty() ); + StepsType st = vstAddTo[0]; + LuaHelpers::Push( L, st ); + return 1; + } + static int IsGameEnabled( T* p, lua_State *L ) + { + const Game *pGame = p->StringToGame(SArg(1)); + if(pGame) + lua_pushboolean(L, p->IsGameEnabled( pGame ) ); + else + lua_pushnil(L); + + return 1; + } + + LunaGameManager() + { + ADD_METHOD( StepsTypeToLocalizedString ); + ADD_METHOD( GetFirstStepsTypeForGame ); + ADD_METHOD( IsGameEnabled ); + }; +}; + +LUA_REGISTER_CLASS( GameManager ) +// lua end + + +/* + * (c) 2001-2006 Chris Danford, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameManager.h b/src/GameManager.h index 666700bb62..0f83b043f0 100644 --- a/src/GameManager.h +++ b/src/GameManager.h @@ -1,87 +1,87 @@ -/** @brief GameManager - Manages Games and Styles. */ - -#ifndef GAMEMANAGER_H -#define GAMEMANAGER_H - -class Style; -class Game; -struct lua_State; - -#include "GameConstantsAndTypes.h" -#include "GameInput.h" - -/** @brief The collective information about a Steps' Type. */ -struct StepsTypeInfo -{ - const char *szName; - /** @brief The number of tracks, or columns, of this type. */ - int iNumTracks; - /** @brief A flag to determine if we allow this type to be autogen'ed to other types. */ - bool bAllowAutogen; - /** @brief The most basic StyleType that this StpesTypeInfo is used with. */ - StepsTypeCategory m_StepsTypeCategory; - RString GetLocalizedString() const; -}; - -class GameManager -{ -public: - GameManager(); - ~GameManager(); - - void GetStylesForGame( const Game* pGame, vector& aStylesAddTo, bool editor=false ); - const Game *GetGameForStyle( const Style *pStyle ); - void GetStepsTypesForGame( const Game* pGame, vector& aStepsTypeAddTo ); - const Style *GetEditorStyleForStepsType( StepsType st ); - void GetDemonstrationStylesForGame( const Game *pGame, vector &vpStylesOut ); - const Style *GetHowToPlayStyleForGame( const Game* pGame ); - void GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector &vpStylesOut ); - const Style *GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ); - - void GetEnabledGames( vector& aGamesOut ); - const Game* GetDefaultGame(); - bool IsGameEnabled( const Game* pGame ); - int GetIndexFromGame( const Game* pGame ); - const Game* GetGameFromIndex( int index ); - - const StepsTypeInfo &GetStepsTypeInfo( StepsType st ); - StepsType StringToStepsType( RString sStepsType ); - const Game* StringToGame( RString sGame ); - const Style* GameAndStringToStyle( const Game* pGame, RString sStyle ); - RString StyleToLocalizedString( const Style* s ); - - - // Lua - void PushSelf( lua_State *L ); -}; - -extern GameManager* GAMEMAN; // global and accessable from anywhere in our program - -#endif - -/** - * @file - * @author Chris Danford, Glenn Maynard (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/** @brief GameManager - Manages Games and Styles. */ + +#ifndef GAMEMANAGER_H +#define GAMEMANAGER_H + +class Style; +class Game; +struct lua_State; + +#include "GameConstantsAndTypes.h" +#include "GameInput.h" + +/** @brief The collective information about a Steps' Type. */ +struct StepsTypeInfo +{ + const char *szName; + /** @brief The number of tracks, or columns, of this type. */ + int iNumTracks; + /** @brief A flag to determine if we allow this type to be autogen'ed to other types. */ + bool bAllowAutogen; + /** @brief The most basic StyleType that this StpesTypeInfo is used with. */ + StepsTypeCategory m_StepsTypeCategory; + RString GetLocalizedString() const; +}; + +class GameManager +{ +public: + GameManager(); + ~GameManager(); + + void GetStylesForGame( const Game* pGame, vector& aStylesAddTo, bool editor=false ); + const Game *GetGameForStyle( const Style *pStyle ); + void GetStepsTypesForGame( const Game* pGame, vector& aStepsTypeAddTo ); + const Style *GetEditorStyleForStepsType( StepsType st ); + void GetDemonstrationStylesForGame( const Game *pGame, vector &vpStylesOut ); + const Style *GetHowToPlayStyleForGame( const Game* pGame ); + void GetCompatibleStyles( const Game *pGame, int iNumPlayers, vector &vpStylesOut ); + const Style *GetFirstCompatibleStyle( const Game *pGame, int iNumPlayers, StepsType st ); + + void GetEnabledGames( vector& aGamesOut ); + const Game* GetDefaultGame(); + bool IsGameEnabled( const Game* pGame ); + int GetIndexFromGame( const Game* pGame ); + const Game* GetGameFromIndex( int index ); + + const StepsTypeInfo &GetStepsTypeInfo( StepsType st ); + StepsType StringToStepsType( RString sStepsType ); + const Game* StringToGame( RString sGame ); + const Style* GameAndStringToStyle( const Game* pGame, RString sStyle ); + RString StyleToLocalizedString( const Style* s ); + + + // Lua + void PushSelf( lua_State *L ); +}; + +extern GameManager* GAMEMAN; // global and accessable from anywhere in our program + +#endif + +/** + * @file + * @author Chris Danford, Glenn Maynard (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GamePreferences.cpp b/src/GamePreferences.cpp index 3ac6f032fc..eefc636a3a 100644 --- a/src/GamePreferences.cpp +++ b/src/GamePreferences.cpp @@ -1,33 +1,33 @@ -#include "global.h" -#include "GamePreferences.h" - -// This options has weird interactions depending on m_bEventMode; -// use GameState::GetCoinMode(). -Preference GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home ); -Preference GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN ); - - -/* - * (c) 2001-2004 Chris Danford, Chris Gomez - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#include "global.h" +#include "GamePreferences.h" + +// This options has weird interactions depending on m_bEventMode; +// use GameState::GetCoinMode(). +Preference GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home ); +Preference GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN ); + + +/* + * (c) 2001-2004 Chris Danford, Chris Gomez + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GamePreferences.h b/src/GamePreferences.h index 28ff545170..ee1b1b4f4f 100644 --- a/src/GamePreferences.h +++ b/src/GamePreferences.h @@ -1,38 +1,38 @@ -#ifndef GAME_PREFERENCES_H -#define GAME_PREFERENCES_H - -#include "Preference.h" -#include "GameConstantsAndTypes.h" -/** @brief Quick access to other variables. */ -namespace GamePreferences -{ - extern Preference m_CoinMode; - extern Preference m_AutoPlay; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford, Chris Gomez - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef GAME_PREFERENCES_H +#define GAME_PREFERENCES_H + +#include "Preference.h" +#include "GameConstantsAndTypes.h" +/** @brief Quick access to other variables. */ +namespace GamePreferences +{ + extern Preference m_CoinMode; + extern Preference m_AutoPlay; +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford, Chris Gomez + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 60ba11316b..ca07566f8a 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -1,844 +1,844 @@ -#include "global.h" -#include "RageSoundManager.h" -#include "GameSoundManager.h" -#include "RageSound.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "GameState.h" -#include "TimingData.h" -#include "NotesLoaderSSC.h" -#include "NotesLoaderSM.h" -#include "PrefsManager.h" -#include "RageDisplay.h" -#include "AnnouncerManager.h" -#include "NoteData.h" -#include "Song.h" -#include "Steps.h" -#include "LightsManager.h" -#include "SongUtil.h" -#include "LuaManager.h" - -GameSoundManager *SOUND = NULL; - -/* - * When playing music, automatically search for an SM file for timing data. If one is - * found, automatically handle GAMESTATE->m_fSongBeat, etc. - * - * modf(GAMESTATE->m_fSongBeat) should always be continuously moving from 0 to 1. To do - * this, wait before starting a sound until the fractional portion of the beat will be - * the same. - * - * If PlayMusic(fLengthSeconds) is set, peek at the beat, and extend the length so we'll be - * on the same fractional beat when we loop. - */ - -/* Lock this before touching g_UpdatingTimer or g_Playing. */ -static RageEvent *g_Mutex; -static bool g_UpdatingTimer; -static bool g_Shutdown; -static bool g_bFlushing = false; - -enum FadeState { FADE_NONE, FADE_OUT, FADE_WAIT, FADE_IN }; -static FadeState g_FadeState = FADE_NONE; -static float g_fDimVolume = 1.0f; -static float g_fOriginalVolume = 1.0f; -static float g_fDimDurationRemaining = 0.0f; -static bool g_bWasPlayingOnLastUpdate = false; - -struct MusicPlaying -{ - bool m_bTimingDelayed; - bool m_bHasTiming; - bool m_bApplyMusicRate; - // The timing data that we're currently using. - TimingData m_Timing; - NoteData m_Lights; - - /* If m_bTimingDelayed is true, this will be the timing data for the - * song that's starting. We'll copy it to m_Timing once sound is heard. */ - TimingData m_NewTiming; - RageSound *m_Music; - MusicPlaying( RageSound *Music ) - { - m_Timing.AddBPMSegment( BPMSegment(0,120) ); - m_NewTiming.AddBPMSegment( BPMSegment(0,120) ); - m_bHasTiming = false; - m_bTimingDelayed = false; - m_bApplyMusicRate = false; - m_Music = Music; - } - - ~MusicPlaying() - { - delete m_Music; - } -}; - -static MusicPlaying *g_Playing; - -static RageThread MusicThread; - -vector g_SoundsToPlayOnce; -vector g_SoundsToPlayOnceFromDir; -vector g_SoundsToPlayOnceFromAnnouncer; - -struct MusicToPlay -{ - RString m_sFile, m_sTimingFile; - bool HasTiming; - TimingData m_TimingData; - NoteData m_LightsData; - bool bForceLoop; - float fStartSecond, fLengthSeconds, fFadeInLengthSeconds, fFadeOutLengthSeconds; - bool bAlignBeat, bApplyMusicRate; - MusicToPlay() - { - HasTiming = false; - } -}; -vector g_MusicsToPlay; -static GameSoundManager::PlayMusicParams g_FallbackMusicParams; - -static void StartMusic( MusicToPlay &ToPlay ) -{ - LockMutex L( *g_Mutex ); - if( g_Playing->m_Music->IsPlaying() && g_Playing->m_Music->GetLoadedFilePath().EqualsNoCase(ToPlay.m_sFile) ) - return; - - /* We're changing or stopping the music. If we were dimming, reset. */ - g_FadeState = FADE_NONE; - - if( ToPlay.m_sFile.empty() ) - { - /* StopPlaying() can take a while, so don't hold the lock while we stop the sound. - * Be sure to leave the rest of g_Playing in place. */ - RageSound *pOldSound = g_Playing->m_Music; - g_Playing->m_Music = new RageSound; - L.Unlock(); - - delete pOldSound; - return; - } - - /* Unlock, load the sound here, and relock. Loading may take a while if we're - * reading from CD and we have to seek far, which can throw off the timing below. */ - MusicPlaying *NewMusic; - { - g_Mutex->Unlock(); - RageSound *pSound = new RageSound; - RageSoundLoadParams params; - params.m_bSupportRateChanging = ToPlay.bApplyMusicRate; - pSound->Load( ToPlay.m_sFile, false, ¶ms ); - g_Mutex->Lock(); - - NewMusic = new MusicPlaying( pSound ); - } - - NewMusic->m_Timing = g_Playing->m_Timing; - NewMusic->m_Lights = g_Playing->m_Lights; - - /* See if we can find timing data, if it's not already loaded. */ - if( !ToPlay.HasTiming && IsAFile(ToPlay.m_sTimingFile) ) - { - LOG->Trace( "Found '%s'", ToPlay.m_sTimingFile.c_str() ); - Song song; - if( SSCLoader::LoadFromSSCFile(ToPlay.m_sTimingFile, song) ) - { - ToPlay.HasTiming = true; - ToPlay.m_TimingData = song.m_Timing; - // get cabinet lights if any - Steps *pStepsCabinetLights = SongUtil::GetOneSteps( &song, StepsType_lights_cabinet ); - if( pStepsCabinetLights ) - pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData ); - } - else if( SMLoader::LoadFromSMFile(ToPlay.m_sTimingFile, song) ) - { - ToPlay.HasTiming = true; - ToPlay.m_TimingData = song.m_Timing; - // get cabinet lights if any - Steps *pStepsCabinetLights = SongUtil::GetOneSteps( &song, StepsType_lights_cabinet ); - if( pStepsCabinetLights ) - pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData ); - } - } - - if( ToPlay.HasTiming ) - { - NewMusic->m_NewTiming = ToPlay.m_TimingData; - NewMusic->m_Lights = ToPlay.m_LightsData; - } - - if( ToPlay.bAlignBeat && ToPlay.HasTiming && ToPlay.bForceLoop && ToPlay.fLengthSeconds != -1 ) - { - /* Extend the loop period so it always starts and ends on the same fractional - * beat. That is, if it starts on beat 1.5, and ends on beat 10.2, extend it - * to end on beat 10.5. This way, effects always loop cleanly. */ - float fStartBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( ToPlay.fStartSecond ); - float fEndSec = ToPlay.fStartSecond + ToPlay.fLengthSeconds; - float fEndBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( fEndSec ); - - const float fStartBeatFraction = fmodfp( fStartBeat, 1 ); - const float fEndBeatFraction = fmodfp( fEndBeat, 1 ); - - float fBeatDifference = fStartBeatFraction - fEndBeatFraction; - if( fBeatDifference < 0 ) - fBeatDifference += 1.0f; /* unwrap */ - - fEndBeat += fBeatDifference; - - const float fRealEndSec = NewMusic->m_NewTiming.GetElapsedTimeFromBeatNoOffset( fEndBeat ); - const float fNewLengthSec = fRealEndSec - ToPlay.fStartSecond; - - /* Extend fFadeOutLengthSeconds, so the added time is faded out. */ - ToPlay.fFadeOutLengthSeconds += fNewLengthSec - ToPlay.fLengthSeconds; - ToPlay.fLengthSeconds = fNewLengthSec; - } - - bool StartImmediately = false; - if( !ToPlay.HasTiming ) - { - /* This song has no real timing data. The offset is arbitrary. Change it so - * the beat will line up to where we are now, so we don't have to delay. */ - float fDestBeat = fmodfp( GAMESTATE->m_fSongBeatNoOffset, 1 ); - float fTime = NewMusic->m_NewTiming.GetElapsedTimeFromBeatNoOffset( fDestBeat ); - - NewMusic->m_NewTiming.m_fBeat0OffsetInSeconds = fTime; - - StartImmediately = true; - } - - /* If we have an active timer, try to start on the next update. Otherwise, - * start now. */ - if( !g_Playing->m_bHasTiming && !g_UpdatingTimer ) - StartImmediately = true; - if( !ToPlay.bAlignBeat ) - StartImmediately = true; - - RageTimer when; /* zero */ - if( !StartImmediately ) - { - /* GetPlayLatency returns the minimum time until a sound starts. That's - * common when starting a precached sound, but our sound isn't, so it'll - * probably take a little longer. Nudge the latency up. */ - const float fPresumedLatency = SOUNDMAN->GetPlayLatency() + 0.040f; - const float fCurSecond = GAMESTATE->m_fMusicSeconds + fPresumedLatency; - const float fCurBeat = g_Playing->m_Timing.GetBeatFromElapsedTimeNoOffset( fCurSecond ); - - /* The beat that the new sound will start on. */ - const float fStartBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( ToPlay.fStartSecond ); - const float fStartBeatFraction = fmodfp( fStartBeat, 1 ); - - float fCurBeatToStartOn = truncf(fCurBeat) + fStartBeatFraction; - if( fCurBeatToStartOn < fCurBeat ) - fCurBeatToStartOn += 1.0f; - - const float fSecondToStartOn = g_Playing->m_Timing.GetElapsedTimeFromBeatNoOffset( fCurBeatToStartOn ); - const float fMaximumDistance = 2; - const float fDistance = min( fSecondToStartOn - GAMESTATE->m_fMusicSeconds, fMaximumDistance ); - - when = GAMESTATE->m_LastBeatUpdate + fDistance; - } - - /* Important: don't hold the mutex while we load and seek the actual sound. */ - L.Unlock(); - { - NewMusic->m_bHasTiming = ToPlay.HasTiming; - if( ToPlay.HasTiming ) - NewMusic->m_NewTiming = ToPlay.m_TimingData; - NewMusic->m_bTimingDelayed = true; - NewMusic->m_bApplyMusicRate = ToPlay.bApplyMusicRate; -// NewMusic->m_Music->Load( ToPlay.m_sFile, false ); - - RageSoundParams p; - p.m_StartSecond = ToPlay.fStartSecond; - p.m_LengthSeconds = ToPlay.fLengthSeconds; - p.m_fFadeInSeconds = ToPlay.fFadeInLengthSeconds; - p.m_fFadeOutSeconds = ToPlay.fFadeOutLengthSeconds; - p.m_StartTime = when; - if( ToPlay.bForceLoop ) - p.StopMode = RageSoundParams::M_LOOP; - NewMusic->m_Music->SetParams( p ); - NewMusic->m_Music->StartPlaying(); - } - - LockMut( *g_Mutex ); - delete g_Playing; - g_Playing = NewMusic; -} - -static void DoPlayOnce( RString sPath ) -{ - /* We want this to start quickly, so don't try to prebuffer it. */ - RageSound *pSound = new RageSound; - pSound->Load( sPath, false ); - - pSound->Play(); - pSound->DeleteSelfWhenFinishedPlaying(); -} - -static void DoPlayOnceFromDir( RString sPath ) -{ - if( sPath == "" ) - return; - - // make sure there's a slash at the end of this path - if( sPath.Right(1) != "/" ) - sPath += "/"; - - vector arraySoundFiles; - GetDirListing( sPath + "*.mp3", arraySoundFiles ); - GetDirListing( sPath + "*.wav", arraySoundFiles ); - GetDirListing( sPath + "*.ogg", arraySoundFiles ); - GetDirListing( sPath + "*.oga", arraySoundFiles ); - - if( arraySoundFiles.empty() ) - return; - - int index = RandomInt( arraySoundFiles.size( )); - DoPlayOnce( sPath + arraySoundFiles[index] ); -} - -static bool SoundWaiting() -{ - return !g_SoundsToPlayOnce.empty() || - !g_SoundsToPlayOnceFromDir.empty() || - !g_SoundsToPlayOnceFromAnnouncer.empty() || - !g_MusicsToPlay.empty(); -} - - -static void StartQueuedSounds() -{ - g_Mutex->Lock(); - vector aSoundsToPlayOnce = g_SoundsToPlayOnce; - g_SoundsToPlayOnce.clear(); - vector aSoundsToPlayOnceFromDir = g_SoundsToPlayOnceFromDir; - g_SoundsToPlayOnceFromDir.clear(); - vector aSoundsToPlayOnceFromAnnouncer = g_SoundsToPlayOnceFromAnnouncer; - g_SoundsToPlayOnceFromAnnouncer.clear(); - vector aMusicsToPlay = g_MusicsToPlay; - g_MusicsToPlay.clear(); - g_Mutex->Unlock(); - - for( unsigned i = 0; i < aSoundsToPlayOnce.size(); ++i ) - if( aSoundsToPlayOnce[i] != "" ) - DoPlayOnce( aSoundsToPlayOnce[i] ); - - for( unsigned i = 0; i < aSoundsToPlayOnceFromDir.size(); ++i ) - DoPlayOnceFromDir( aSoundsToPlayOnceFromDir[i] ); - - for( unsigned i = 0; i < aSoundsToPlayOnceFromAnnouncer.size(); ++i ) - { - RString sPath = aSoundsToPlayOnceFromAnnouncer[i]; - if( sPath != "" ) - { - sPath = ANNOUNCER->GetPathTo( sPath ); - DoPlayOnceFromDir( sPath ); - } - } - - for( unsigned i = 0; i < aMusicsToPlay.size(); ++i ) - { - /* Don't bother starting this music if there's another one in the queue after it. */ - /* Actually, it's a little trickier: the editor gives us a stop and then a sound in - * quick succession; if we ignore the stop, we won't rewind the sound if it was - * already playing. We don't want to waste time loading a sound if it's going - * to be replaced immediately, though. So, if we have more music in the queue, - * then forcibly stop the current sound. */ - if( i+1 == aMusicsToPlay.size() ) - StartMusic( aMusicsToPlay[i] ); - else - { - CHECKPOINT; - /* StopPlaying() can take a while, so don't hold the lock while we stop the sound. */ - g_Mutex->Lock(); - RageSound *pOldSound = g_Playing->m_Music; - g_Playing->m_Music = new RageSound; - g_Mutex->Unlock(); - - delete pOldSound; - } - } -} - -void GameSoundManager::Flush() -{ - g_Mutex->Lock(); - g_bFlushing = true; - - g_Mutex->Broadcast(); - - while( g_bFlushing ) - g_Mutex->Wait(); - g_Mutex->Unlock(); -} - -int MusicThread_start( void *p ) -{ - while( !g_Shutdown ) - { - g_Mutex->Lock(); - while( !SoundWaiting() && !g_Shutdown && !g_bFlushing ) - g_Mutex->Wait(); - g_Mutex->Unlock(); - - /* This is a little hack: we want to make sure that we go through - * StartQueuedSounds after Flush() is called, to be sure we're flushed, - * so check g_bFlushing before calling. This won't work if more than - * one thread might call Flush(), but only the main thread is allowed - * to make SOUND calls. */ - bool bFlushing = g_bFlushing; - - StartQueuedSounds(); - - if( bFlushing ) - { - g_Mutex->Lock(); - g_Mutex->Signal(); - g_bFlushing = false; - g_Mutex->Unlock(); - } - } - - return 0; -} - -GameSoundManager::GameSoundManager() -{ - /* Init RageSoundMan first: */ - ASSERT( SOUNDMAN ); - - g_Mutex = new RageEvent("GameSoundManager"); - g_Playing = new MusicPlaying( new RageSound ); - - g_UpdatingTimer = true; - - g_Shutdown = false; - MusicThread.SetName( "Music thread" ); - MusicThread.Create( MusicThread_start, this ); - - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "SOUND" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } -} - -GameSoundManager::~GameSoundManager() -{ - // Unregister with Lua. - LUA->UnsetGlobal( "SOUND" ); - - /* Signal the mixing thread to quit. */ - LOG->Trace("Shutting down music start thread ..."); - g_Mutex->Lock(); - g_Shutdown = true; - g_Mutex->Broadcast(); - g_Mutex->Unlock(); - MusicThread.Wait(); - LOG->Trace("Music start thread shut down."); - - SAFE_DELETE( g_Playing ); - SAFE_DELETE( g_Mutex ); -} - -float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime ) -{ - /* - * We get one update per frame, and we're updated early, almost immediately after vsync, - * near the beginning of the game loop. However, it's very likely that we'll lose the - * scheduler while waiting for vsync, and some other thread will be working. Especially - * with a low-resolution scheduler (Linux 2.4, Win9x), we may not get the scheduler back - * immediately after the vsync; there may be up to a ~10ms delay. This can cause jitter - * in the rendered arrows. - * - * Compensate. If vsync is enabled, and we're maintaining the refresh rate consistently, - * we should have a very precise game loop interval. If we have that, but we're off by - * a small amount (less than the interval), adjust the time to line it up. As long as we - * adjust both the sound time and the timestamp, this won't adversely affect input timing. - * If we're off by more than that, we probably had a frame skip, in which case we have - * bigger skip problems, so don't adjust. - */ - static int iLastFPS = 0; - int iThisFPS = DISPLAY->GetFPS(); - - if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS ) - { - iLastFPS = iThisFPS; - return 0; - } - - const float fExpectedDelay = 1.0f / iThisFPS; - const float fExtraDelay = fDeltaTime - fExpectedDelay; - if( fabsf(fExtraDelay) >= fExpectedDelay/2 ) - return 0; - - /* Subtract the extra delay. */ - return min( -fExtraDelay, 0 ); -} - -void GameSoundManager::Update( float fDeltaTime ) -{ - { - g_Mutex->Lock(); - if( g_Playing->m_bApplyMusicRate ) - { - RageSoundParams p = g_Playing->m_Music->GetParams(); - float fRate = GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate; - if( p.m_fSpeed != fRate ) - { - p.m_fSpeed = fRate; - g_Playing->m_Music->SetParams( p ); - } - } - - bool bIsPlaying = g_Playing->m_Music->IsPlaying(); - g_Mutex->Unlock(); - if( !bIsPlaying && g_bWasPlayingOnLastUpdate && !g_FallbackMusicParams.sFile.empty() ) - { - PlayMusic( g_FallbackMusicParams ); - - g_FallbackMusicParams.sFile = ""; - } - g_bWasPlayingOnLastUpdate = bIsPlaying; - } - - LockMut( *g_Mutex ); - - { - /* Duration of the fade-in and fade-out: */ - //const float fFadeInSpeed = 1.5f; - //const float fFadeOutSpeed = 0.3f; - float fFadeInSpeed = g_Playing->m_Music->GetParams().m_fFadeInSeconds; - float fFadeOutSpeed = g_Playing->m_Music->GetParams().m_fFadeOutSeconds; - float fVolume = g_Playing->m_Music->GetParams().m_Volume; - switch( g_FadeState ) - { - case FADE_NONE: break; - case FADE_OUT: - fapproach( fVolume, g_fDimVolume, fDeltaTime/fFadeOutSpeed ); - if( fabsf(fVolume-g_fDimVolume) < 0.001f ) - g_FadeState = FADE_WAIT; - break; - case FADE_WAIT: - g_fDimDurationRemaining -= fDeltaTime; - if( g_fDimDurationRemaining <= 0 ) - g_FadeState = FADE_IN; - break; - case FADE_IN: - fapproach( fVolume, g_fOriginalVolume, fDeltaTime/fFadeInSpeed ); - if( fabsf(fVolume-g_fOriginalVolume) < 0.001f ) - g_FadeState = FADE_NONE; - break; - } - - RageSoundParams p = g_Playing->m_Music->GetParams(); - if( p.m_Volume != fVolume ) - { - p.m_Volume = fVolume; - g_Playing->m_Music->SetParams( p ); - } - } - - if( !g_UpdatingTimer ) - return; - - const float fAdjust = GetFrameTimingAdjustment( fDeltaTime ); - if( !g_Playing->m_Music->IsPlaying() ) - { - /* There's no song playing. Fake it. */ - CHECKPOINT_M( ssprintf("%f, delta %f", GAMESTATE->m_fMusicSeconds, fDeltaTime) ); - GAMESTATE->UpdateSongPosition( GAMESTATE->m_fMusicSeconds + fDeltaTime, g_Playing->m_Timing ); - return; - } - - /* There's a delay between us calling Play() and the sound actually playing. - * During this time, m_bApproximate will be true. Keep using the previous timing - * data until we get a non-approximate time, indicating that the sound has actually - * started playing. */ - bool m_bApproximate; - RageTimer tm; - const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &m_bApproximate, &tm ); - - // - // Check for song timing skips. - // - if( PREFSMAN->m_bLogSkips && !g_Playing->m_bTimingDelayed ) - { - const float fExpectedTimePassed = (tm - GAMESTATE->m_LastBeatUpdate) * g_Playing->m_Music->GetPlaybackRate(); - const float fSoundTimePassed = fSeconds - GAMESTATE->m_fMusicSeconds; - const float fDiff = fExpectedTimePassed - fSoundTimePassed; - - static RString sLastFile = ""; - const RString ThisFile = g_Playing->m_Music->GetLoadedFilePath(); - - /* If fSoundTimePassed < 0, the sound has probably looped. */ - if( sLastFile == ThisFile && fSoundTimePassed >= 0 && fabsf(fDiff) > 0.003f ) - LOG->Trace("Song position skip in %s: expected %.3f, got %.3f (cur %f, prev %f) (%.3f difference)", - Basename(ThisFile).c_str(), fExpectedTimePassed, fSoundTimePassed, fSeconds, GAMESTATE->m_fMusicSeconds, fDiff ); - sLastFile = ThisFile; - } - - // - // If g_Playing->m_bTimingDelayed, we're waiting for the new music to actually start - // playing. - // - if( g_Playing->m_bTimingDelayed && !m_bApproximate ) - { - /* Load up the new timing data. */ - g_Playing->m_Timing = g_Playing->m_NewTiming; - g_Playing->m_bTimingDelayed = false; - } - - if( g_Playing->m_bTimingDelayed ) - { - /* We're still waiting for the new sound to start playing, so keep using the - * old timing data and fake the time. */ - GAMESTATE->UpdateSongPosition( GAMESTATE->m_fMusicSeconds + fDeltaTime, g_Playing->m_Timing ); - } - else - { - GAMESTATE->UpdateSongPosition( fSeconds + fAdjust, g_Playing->m_Timing, tm + fAdjust ); - } - - - // - // Send crossed messages - // - if( GAMESTATE->m_pCurSong ) - { - static int iBeatLastCrossed = 0; - - float fSongBeat = GAMESTATE->m_fSongBeat; - - int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); - iRowNow = max( 0, iRowNow ); - - int iBeatNow = iRowNow / ROWS_PER_BEAT; - - for( int iBeat = iBeatLastCrossed+1; iBeat<=iBeatNow; ++iBeat ) - { - Message msg("CrossedBeat"); - msg.SetParam( "Beat", iBeat ); - MESSAGEMAN->Broadcast( msg ); - } - - iBeatLastCrossed = iBeatNow; - } - - - // - // Update lights - // - NoteData &lights = g_Playing->m_Lights; - if( lights.GetNumTracks() > 0 ) // lights data was loaded - { - const float fSongBeat = GAMESTATE->m_fLightSongBeat; - const int iSongRow = BeatToNoteRowNotRounded( fSongBeat ); - - static int iRowLastCrossed = 0; - - FOREACH_CabinetLight( cl ) - { - // for each index we crossed since the last update: - FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( lights, cl, r, iRowLastCrossed+1, iSongRow+1 ) - { - if( lights.GetTapNote( cl, r ).type != TapNote::empty ) - { - LIGHTSMAN->BlinkCabinetLight( cl ); - goto done_with_cabinet_light; - } - } - - if( lights.IsHoldNoteAtRow( cl, iSongRow ) ) - { - LIGHTSMAN->BlinkCabinetLight( cl ); - goto done_with_cabinet_light; - } -done_with_cabinet_light: - ; - } - - iRowLastCrossed = iSongRow; - } -} - - -RString GameSoundManager::GetMusicPath() const -{ - LockMut( *g_Mutex ); - return g_Playing->m_Music->GetLoadedFilePath(); -} - -void GameSoundManager::PlayMusic( - RString sFile, - const TimingData *pTiming, - bool bForceLoop, - float fStartSecond, - float fLengthSeconds, - float fFadeInLengthSeconds, - float fFadeOutLengthSeconds, - bool bAlignBeat - ) -{ - PlayMusicParams params; - params.sFile = sFile; - params.pTiming = pTiming; - params.bForceLoop = bForceLoop; - params.fStartSecond = fStartSecond; - params.fLengthSeconds = fLengthSeconds; - params.fFadeInLengthSeconds = fFadeInLengthSeconds; - params.fFadeOutLengthSeconds = fFadeOutLengthSeconds; - params.bAlignBeat = bAlignBeat; - params.bApplyMusicRate = false; - PlayMusic( params ); -} - -void GameSoundManager::PlayMusic( PlayMusicParams params, PlayMusicParams FallbackMusicParams ) -{ - g_FallbackMusicParams = FallbackMusicParams; - - // LOG->Trace("play '%s' (current '%s')", file.c_str(), g_Playing->m_Music->GetLoadedFilePath().c_str()); - - MusicToPlay ToPlay; - - ToPlay.m_sFile = params.sFile; - if( params.pTiming ) - { - ToPlay.HasTiming = true; - ToPlay.m_TimingData = *params.pTiming; - } - else - { - /* If no timing data was provided, look for it in the same place as the music file. */ - // todo: allow loading .ssc files as well -aj - ToPlay.m_sTimingFile = SetExtension( params.sFile, "sm" ); - } - - ToPlay.bForceLoop = params.bForceLoop; - ToPlay.fStartSecond = params.fStartSecond; - ToPlay.fLengthSeconds = params.fLengthSeconds; - ToPlay.fFadeInLengthSeconds = params.fFadeInLengthSeconds; - ToPlay.fFadeOutLengthSeconds = params.fFadeOutLengthSeconds; - ToPlay.bAlignBeat = params.bAlignBeat; - ToPlay.bApplyMusicRate = params.bApplyMusicRate; - - /* Add the MusicToPlay to the g_MusicsToPlay queue. */ - g_Mutex->Lock(); - g_MusicsToPlay.push_back( ToPlay ); - g_Mutex->Broadcast(); - g_Mutex->Unlock(); -} - -void GameSoundManager::DimMusic( float fVolume, float fDurationSeconds ) -{ - LockMut( *g_Mutex ); - - if( g_FadeState == FADE_NONE ) - g_fOriginalVolume = g_Playing->m_Music->GetParams().m_Volume; - // otherwise, g_fOriginalVolume is already set and m_Volume will be the - // current state, not the original state - - g_fDimDurationRemaining = fDurationSeconds; - g_fDimVolume = fVolume; - g_FadeState = FADE_OUT; -} - -void GameSoundManager::HandleSongTimer( bool on ) -{ - LockMut( *g_Mutex ); - g_UpdatingTimer = on; -} - -void GameSoundManager::PlayOnce( RString sPath ) -{ - /* Add the sound to the g_SoundsToPlayOnce queue. */ - g_Mutex->Lock(); - g_SoundsToPlayOnce.push_back( sPath ); - g_Mutex->Broadcast(); - g_Mutex->Unlock(); -} - -void GameSoundManager::PlayOnceFromDir( RString sPath ) -{ - /* Add the path to the g_SoundsToPlayOnceFromDir queue. */ - g_Mutex->Lock(); - g_SoundsToPlayOnceFromDir.push_back( sPath ); - g_Mutex->Broadcast(); - g_Mutex->Unlock(); -} - -void GameSoundManager::PlayOnceFromAnnouncer( RString sPath ) -{ - /* Add the path to the g_SoundsToPlayOnceFromAnnouncer queue. */ - g_Mutex->Lock(); - g_SoundsToPlayOnceFromAnnouncer.push_back( sPath ); - g_Mutex->Broadcast(); - g_Mutex->Unlock(); -} - -float GameSoundManager::GetPlayerBalance( PlayerNumber pn ) -{ - /* If two players are active, play sounds on each players' side. */ - if( GAMESTATE->GetNumPlayersEnabled() == 2 ) - return (pn == PLAYER_1)? -1.0f:1.0f; - else - return 0; -} - - -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the GameSoundManager. */ -class LunaGameSoundManager: public Luna -{ -public: - static int DimMusic( T* p, lua_State *L ) - { - float fVolume = FArg(1); - float fDurationSeconds = FArg(2); - p->DimMusic( fVolume, fDurationSeconds ); - return 0; - } - static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); return 0; } - static int GetPlayerBalance( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); lua_pushnumber( L, p->GetPlayerBalance(pn) ); return 1; } - - LunaGameSoundManager() - { - ADD_METHOD( DimMusic ); - ADD_METHOD( PlayOnce ); - ADD_METHOD( GetPlayerBalance ); - } -}; - -LUA_REGISTER_CLASS( GameSoundManager ) - - -/* - * Copyright (c) 2003-2005 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - +#include "global.h" +#include "RageSoundManager.h" +#include "GameSoundManager.h" +#include "RageSound.h" +#include "RageLog.h" +#include "RageUtil.h" +#include "GameState.h" +#include "TimingData.h" +#include "NotesLoaderSSC.h" +#include "NotesLoaderSM.h" +#include "PrefsManager.h" +#include "RageDisplay.h" +#include "AnnouncerManager.h" +#include "NoteData.h" +#include "Song.h" +#include "Steps.h" +#include "LightsManager.h" +#include "SongUtil.h" +#include "LuaManager.h" + +GameSoundManager *SOUND = NULL; + +/* + * When playing music, automatically search for an SM file for timing data. If one is + * found, automatically handle GAMESTATE->m_fSongBeat, etc. + * + * modf(GAMESTATE->m_fSongBeat) should always be continuously moving from 0 to 1. To do + * this, wait before starting a sound until the fractional portion of the beat will be + * the same. + * + * If PlayMusic(fLengthSeconds) is set, peek at the beat, and extend the length so we'll be + * on the same fractional beat when we loop. + */ + +/* Lock this before touching g_UpdatingTimer or g_Playing. */ +static RageEvent *g_Mutex; +static bool g_UpdatingTimer; +static bool g_Shutdown; +static bool g_bFlushing = false; + +enum FadeState { FADE_NONE, FADE_OUT, FADE_WAIT, FADE_IN }; +static FadeState g_FadeState = FADE_NONE; +static float g_fDimVolume = 1.0f; +static float g_fOriginalVolume = 1.0f; +static float g_fDimDurationRemaining = 0.0f; +static bool g_bWasPlayingOnLastUpdate = false; + +struct MusicPlaying +{ + bool m_bTimingDelayed; + bool m_bHasTiming; + bool m_bApplyMusicRate; + // The timing data that we're currently using. + TimingData m_Timing; + NoteData m_Lights; + + /* If m_bTimingDelayed is true, this will be the timing data for the + * song that's starting. We'll copy it to m_Timing once sound is heard. */ + TimingData m_NewTiming; + RageSound *m_Music; + MusicPlaying( RageSound *Music ) + { + m_Timing.AddBPMSegment( BPMSegment(0,120) ); + m_NewTiming.AddBPMSegment( BPMSegment(0,120) ); + m_bHasTiming = false; + m_bTimingDelayed = false; + m_bApplyMusicRate = false; + m_Music = Music; + } + + ~MusicPlaying() + { + delete m_Music; + } +}; + +static MusicPlaying *g_Playing; + +static RageThread MusicThread; + +vector g_SoundsToPlayOnce; +vector g_SoundsToPlayOnceFromDir; +vector g_SoundsToPlayOnceFromAnnouncer; + +struct MusicToPlay +{ + RString m_sFile, m_sTimingFile; + bool HasTiming; + TimingData m_TimingData; + NoteData m_LightsData; + bool bForceLoop; + float fStartSecond, fLengthSeconds, fFadeInLengthSeconds, fFadeOutLengthSeconds; + bool bAlignBeat, bApplyMusicRate; + MusicToPlay() + { + HasTiming = false; + } +}; +vector g_MusicsToPlay; +static GameSoundManager::PlayMusicParams g_FallbackMusicParams; + +static void StartMusic( MusicToPlay &ToPlay ) +{ + LockMutex L( *g_Mutex ); + if( g_Playing->m_Music->IsPlaying() && g_Playing->m_Music->GetLoadedFilePath().EqualsNoCase(ToPlay.m_sFile) ) + return; + + /* We're changing or stopping the music. If we were dimming, reset. */ + g_FadeState = FADE_NONE; + + if( ToPlay.m_sFile.empty() ) + { + /* StopPlaying() can take a while, so don't hold the lock while we stop the sound. + * Be sure to leave the rest of g_Playing in place. */ + RageSound *pOldSound = g_Playing->m_Music; + g_Playing->m_Music = new RageSound; + L.Unlock(); + + delete pOldSound; + return; + } + + /* Unlock, load the sound here, and relock. Loading may take a while if we're + * reading from CD and we have to seek far, which can throw off the timing below. */ + MusicPlaying *NewMusic; + { + g_Mutex->Unlock(); + RageSound *pSound = new RageSound; + RageSoundLoadParams params; + params.m_bSupportRateChanging = ToPlay.bApplyMusicRate; + pSound->Load( ToPlay.m_sFile, false, ¶ms ); + g_Mutex->Lock(); + + NewMusic = new MusicPlaying( pSound ); + } + + NewMusic->m_Timing = g_Playing->m_Timing; + NewMusic->m_Lights = g_Playing->m_Lights; + + /* See if we can find timing data, if it's not already loaded. */ + if( !ToPlay.HasTiming && IsAFile(ToPlay.m_sTimingFile) ) + { + LOG->Trace( "Found '%s'", ToPlay.m_sTimingFile.c_str() ); + Song song; + if( SSCLoader::LoadFromSSCFile(ToPlay.m_sTimingFile, song) ) + { + ToPlay.HasTiming = true; + ToPlay.m_TimingData = song.m_Timing; + // get cabinet lights if any + Steps *pStepsCabinetLights = SongUtil::GetOneSteps( &song, StepsType_lights_cabinet ); + if( pStepsCabinetLights ) + pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData ); + } + else if( SMLoader::LoadFromSMFile(ToPlay.m_sTimingFile, song) ) + { + ToPlay.HasTiming = true; + ToPlay.m_TimingData = song.m_Timing; + // get cabinet lights if any + Steps *pStepsCabinetLights = SongUtil::GetOneSteps( &song, StepsType_lights_cabinet ); + if( pStepsCabinetLights ) + pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData ); + } + } + + if( ToPlay.HasTiming ) + { + NewMusic->m_NewTiming = ToPlay.m_TimingData; + NewMusic->m_Lights = ToPlay.m_LightsData; + } + + if( ToPlay.bAlignBeat && ToPlay.HasTiming && ToPlay.bForceLoop && ToPlay.fLengthSeconds != -1 ) + { + /* Extend the loop period so it always starts and ends on the same fractional + * beat. That is, if it starts on beat 1.5, and ends on beat 10.2, extend it + * to end on beat 10.5. This way, effects always loop cleanly. */ + float fStartBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( ToPlay.fStartSecond ); + float fEndSec = ToPlay.fStartSecond + ToPlay.fLengthSeconds; + float fEndBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( fEndSec ); + + const float fStartBeatFraction = fmodfp( fStartBeat, 1 ); + const float fEndBeatFraction = fmodfp( fEndBeat, 1 ); + + float fBeatDifference = fStartBeatFraction - fEndBeatFraction; + if( fBeatDifference < 0 ) + fBeatDifference += 1.0f; /* unwrap */ + + fEndBeat += fBeatDifference; + + const float fRealEndSec = NewMusic->m_NewTiming.GetElapsedTimeFromBeatNoOffset( fEndBeat ); + const float fNewLengthSec = fRealEndSec - ToPlay.fStartSecond; + + /* Extend fFadeOutLengthSeconds, so the added time is faded out. */ + ToPlay.fFadeOutLengthSeconds += fNewLengthSec - ToPlay.fLengthSeconds; + ToPlay.fLengthSeconds = fNewLengthSec; + } + + bool StartImmediately = false; + if( !ToPlay.HasTiming ) + { + /* This song has no real timing data. The offset is arbitrary. Change it so + * the beat will line up to where we are now, so we don't have to delay. */ + float fDestBeat = fmodfp( GAMESTATE->m_fSongBeatNoOffset, 1 ); + float fTime = NewMusic->m_NewTiming.GetElapsedTimeFromBeatNoOffset( fDestBeat ); + + NewMusic->m_NewTiming.m_fBeat0OffsetInSeconds = fTime; + + StartImmediately = true; + } + + /* If we have an active timer, try to start on the next update. Otherwise, + * start now. */ + if( !g_Playing->m_bHasTiming && !g_UpdatingTimer ) + StartImmediately = true; + if( !ToPlay.bAlignBeat ) + StartImmediately = true; + + RageTimer when; /* zero */ + if( !StartImmediately ) + { + /* GetPlayLatency returns the minimum time until a sound starts. That's + * common when starting a precached sound, but our sound isn't, so it'll + * probably take a little longer. Nudge the latency up. */ + const float fPresumedLatency = SOUNDMAN->GetPlayLatency() + 0.040f; + const float fCurSecond = GAMESTATE->m_fMusicSeconds + fPresumedLatency; + const float fCurBeat = g_Playing->m_Timing.GetBeatFromElapsedTimeNoOffset( fCurSecond ); + + /* The beat that the new sound will start on. */ + const float fStartBeat = NewMusic->m_NewTiming.GetBeatFromElapsedTimeNoOffset( ToPlay.fStartSecond ); + const float fStartBeatFraction = fmodfp( fStartBeat, 1 ); + + float fCurBeatToStartOn = truncf(fCurBeat) + fStartBeatFraction; + if( fCurBeatToStartOn < fCurBeat ) + fCurBeatToStartOn += 1.0f; + + const float fSecondToStartOn = g_Playing->m_Timing.GetElapsedTimeFromBeatNoOffset( fCurBeatToStartOn ); + const float fMaximumDistance = 2; + const float fDistance = min( fSecondToStartOn - GAMESTATE->m_fMusicSeconds, fMaximumDistance ); + + when = GAMESTATE->m_LastBeatUpdate + fDistance; + } + + /* Important: don't hold the mutex while we load and seek the actual sound. */ + L.Unlock(); + { + NewMusic->m_bHasTiming = ToPlay.HasTiming; + if( ToPlay.HasTiming ) + NewMusic->m_NewTiming = ToPlay.m_TimingData; + NewMusic->m_bTimingDelayed = true; + NewMusic->m_bApplyMusicRate = ToPlay.bApplyMusicRate; +// NewMusic->m_Music->Load( ToPlay.m_sFile, false ); + + RageSoundParams p; + p.m_StartSecond = ToPlay.fStartSecond; + p.m_LengthSeconds = ToPlay.fLengthSeconds; + p.m_fFadeInSeconds = ToPlay.fFadeInLengthSeconds; + p.m_fFadeOutSeconds = ToPlay.fFadeOutLengthSeconds; + p.m_StartTime = when; + if( ToPlay.bForceLoop ) + p.StopMode = RageSoundParams::M_LOOP; + NewMusic->m_Music->SetParams( p ); + NewMusic->m_Music->StartPlaying(); + } + + LockMut( *g_Mutex ); + delete g_Playing; + g_Playing = NewMusic; +} + +static void DoPlayOnce( RString sPath ) +{ + /* We want this to start quickly, so don't try to prebuffer it. */ + RageSound *pSound = new RageSound; + pSound->Load( sPath, false ); + + pSound->Play(); + pSound->DeleteSelfWhenFinishedPlaying(); +} + +static void DoPlayOnceFromDir( RString sPath ) +{ + if( sPath == "" ) + return; + + // make sure there's a slash at the end of this path + if( sPath.Right(1) != "/" ) + sPath += "/"; + + vector arraySoundFiles; + GetDirListing( sPath + "*.mp3", arraySoundFiles ); + GetDirListing( sPath + "*.wav", arraySoundFiles ); + GetDirListing( sPath + "*.ogg", arraySoundFiles ); + GetDirListing( sPath + "*.oga", arraySoundFiles ); + + if( arraySoundFiles.empty() ) + return; + + int index = RandomInt( arraySoundFiles.size( )); + DoPlayOnce( sPath + arraySoundFiles[index] ); +} + +static bool SoundWaiting() +{ + return !g_SoundsToPlayOnce.empty() || + !g_SoundsToPlayOnceFromDir.empty() || + !g_SoundsToPlayOnceFromAnnouncer.empty() || + !g_MusicsToPlay.empty(); +} + + +static void StartQueuedSounds() +{ + g_Mutex->Lock(); + vector aSoundsToPlayOnce = g_SoundsToPlayOnce; + g_SoundsToPlayOnce.clear(); + vector aSoundsToPlayOnceFromDir = g_SoundsToPlayOnceFromDir; + g_SoundsToPlayOnceFromDir.clear(); + vector aSoundsToPlayOnceFromAnnouncer = g_SoundsToPlayOnceFromAnnouncer; + g_SoundsToPlayOnceFromAnnouncer.clear(); + vector aMusicsToPlay = g_MusicsToPlay; + g_MusicsToPlay.clear(); + g_Mutex->Unlock(); + + for( unsigned i = 0; i < aSoundsToPlayOnce.size(); ++i ) + if( aSoundsToPlayOnce[i] != "" ) + DoPlayOnce( aSoundsToPlayOnce[i] ); + + for( unsigned i = 0; i < aSoundsToPlayOnceFromDir.size(); ++i ) + DoPlayOnceFromDir( aSoundsToPlayOnceFromDir[i] ); + + for( unsigned i = 0; i < aSoundsToPlayOnceFromAnnouncer.size(); ++i ) + { + RString sPath = aSoundsToPlayOnceFromAnnouncer[i]; + if( sPath != "" ) + { + sPath = ANNOUNCER->GetPathTo( sPath ); + DoPlayOnceFromDir( sPath ); + } + } + + for( unsigned i = 0; i < aMusicsToPlay.size(); ++i ) + { + /* Don't bother starting this music if there's another one in the queue after it. */ + /* Actually, it's a little trickier: the editor gives us a stop and then a sound in + * quick succession; if we ignore the stop, we won't rewind the sound if it was + * already playing. We don't want to waste time loading a sound if it's going + * to be replaced immediately, though. So, if we have more music in the queue, + * then forcibly stop the current sound. */ + if( i+1 == aMusicsToPlay.size() ) + StartMusic( aMusicsToPlay[i] ); + else + { + CHECKPOINT; + /* StopPlaying() can take a while, so don't hold the lock while we stop the sound. */ + g_Mutex->Lock(); + RageSound *pOldSound = g_Playing->m_Music; + g_Playing->m_Music = new RageSound; + g_Mutex->Unlock(); + + delete pOldSound; + } + } +} + +void GameSoundManager::Flush() +{ + g_Mutex->Lock(); + g_bFlushing = true; + + g_Mutex->Broadcast(); + + while( g_bFlushing ) + g_Mutex->Wait(); + g_Mutex->Unlock(); +} + +int MusicThread_start( void *p ) +{ + while( !g_Shutdown ) + { + g_Mutex->Lock(); + while( !SoundWaiting() && !g_Shutdown && !g_bFlushing ) + g_Mutex->Wait(); + g_Mutex->Unlock(); + + /* This is a little hack: we want to make sure that we go through + * StartQueuedSounds after Flush() is called, to be sure we're flushed, + * so check g_bFlushing before calling. This won't work if more than + * one thread might call Flush(), but only the main thread is allowed + * to make SOUND calls. */ + bool bFlushing = g_bFlushing; + + StartQueuedSounds(); + + if( bFlushing ) + { + g_Mutex->Lock(); + g_Mutex->Signal(); + g_bFlushing = false; + g_Mutex->Unlock(); + } + } + + return 0; +} + +GameSoundManager::GameSoundManager() +{ + /* Init RageSoundMan first: */ + ASSERT( SOUNDMAN ); + + g_Mutex = new RageEvent("GameSoundManager"); + g_Playing = new MusicPlaying( new RageSound ); + + g_UpdatingTimer = true; + + g_Shutdown = false; + MusicThread.SetName( "Music thread" ); + MusicThread.Create( MusicThread_start, this ); + + // Register with Lua. + { + Lua *L = LUA->Get(); + lua_pushstring( L, "SOUND" ); + this->PushSelf( L ); + lua_settable( L, LUA_GLOBALSINDEX ); + LUA->Release( L ); + } +} + +GameSoundManager::~GameSoundManager() +{ + // Unregister with Lua. + LUA->UnsetGlobal( "SOUND" ); + + /* Signal the mixing thread to quit. */ + LOG->Trace("Shutting down music start thread ..."); + g_Mutex->Lock(); + g_Shutdown = true; + g_Mutex->Broadcast(); + g_Mutex->Unlock(); + MusicThread.Wait(); + LOG->Trace("Music start thread shut down."); + + SAFE_DELETE( g_Playing ); + SAFE_DELETE( g_Mutex ); +} + +float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime ) +{ + /* + * We get one update per frame, and we're updated early, almost immediately after vsync, + * near the beginning of the game loop. However, it's very likely that we'll lose the + * scheduler while waiting for vsync, and some other thread will be working. Especially + * with a low-resolution scheduler (Linux 2.4, Win9x), we may not get the scheduler back + * immediately after the vsync; there may be up to a ~10ms delay. This can cause jitter + * in the rendered arrows. + * + * Compensate. If vsync is enabled, and we're maintaining the refresh rate consistently, + * we should have a very precise game loop interval. If we have that, but we're off by + * a small amount (less than the interval), adjust the time to line it up. As long as we + * adjust both the sound time and the timestamp, this won't adversely affect input timing. + * If we're off by more than that, we probably had a frame skip, in which case we have + * bigger skip problems, so don't adjust. + */ + static int iLastFPS = 0; + int iThisFPS = DISPLAY->GetFPS(); + + if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS ) + { + iLastFPS = iThisFPS; + return 0; + } + + const float fExpectedDelay = 1.0f / iThisFPS; + const float fExtraDelay = fDeltaTime - fExpectedDelay; + if( fabsf(fExtraDelay) >= fExpectedDelay/2 ) + return 0; + + /* Subtract the extra delay. */ + return min( -fExtraDelay, 0 ); +} + +void GameSoundManager::Update( float fDeltaTime ) +{ + { + g_Mutex->Lock(); + if( g_Playing->m_bApplyMusicRate ) + { + RageSoundParams p = g_Playing->m_Music->GetParams(); + float fRate = GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate; + if( p.m_fSpeed != fRate ) + { + p.m_fSpeed = fRate; + g_Playing->m_Music->SetParams( p ); + } + } + + bool bIsPlaying = g_Playing->m_Music->IsPlaying(); + g_Mutex->Unlock(); + if( !bIsPlaying && g_bWasPlayingOnLastUpdate && !g_FallbackMusicParams.sFile.empty() ) + { + PlayMusic( g_FallbackMusicParams ); + + g_FallbackMusicParams.sFile = ""; + } + g_bWasPlayingOnLastUpdate = bIsPlaying; + } + + LockMut( *g_Mutex ); + + { + /* Duration of the fade-in and fade-out: */ + //const float fFadeInSpeed = 1.5f; + //const float fFadeOutSpeed = 0.3f; + float fFadeInSpeed = g_Playing->m_Music->GetParams().m_fFadeInSeconds; + float fFadeOutSpeed = g_Playing->m_Music->GetParams().m_fFadeOutSeconds; + float fVolume = g_Playing->m_Music->GetParams().m_Volume; + switch( g_FadeState ) + { + case FADE_NONE: break; + case FADE_OUT: + fapproach( fVolume, g_fDimVolume, fDeltaTime/fFadeOutSpeed ); + if( fabsf(fVolume-g_fDimVolume) < 0.001f ) + g_FadeState = FADE_WAIT; + break; + case FADE_WAIT: + g_fDimDurationRemaining -= fDeltaTime; + if( g_fDimDurationRemaining <= 0 ) + g_FadeState = FADE_IN; + break; + case FADE_IN: + fapproach( fVolume, g_fOriginalVolume, fDeltaTime/fFadeInSpeed ); + if( fabsf(fVolume-g_fOriginalVolume) < 0.001f ) + g_FadeState = FADE_NONE; + break; + } + + RageSoundParams p = g_Playing->m_Music->GetParams(); + if( p.m_Volume != fVolume ) + { + p.m_Volume = fVolume; + g_Playing->m_Music->SetParams( p ); + } + } + + if( !g_UpdatingTimer ) + return; + + const float fAdjust = GetFrameTimingAdjustment( fDeltaTime ); + if( !g_Playing->m_Music->IsPlaying() ) + { + /* There's no song playing. Fake it. */ + CHECKPOINT_M( ssprintf("%f, delta %f", GAMESTATE->m_fMusicSeconds, fDeltaTime) ); + GAMESTATE->UpdateSongPosition( GAMESTATE->m_fMusicSeconds + fDeltaTime, g_Playing->m_Timing ); + return; + } + + /* There's a delay between us calling Play() and the sound actually playing. + * During this time, m_bApproximate will be true. Keep using the previous timing + * data until we get a non-approximate time, indicating that the sound has actually + * started playing. */ + bool m_bApproximate; + RageTimer tm; + const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &m_bApproximate, &tm ); + + // + // Check for song timing skips. + // + if( PREFSMAN->m_bLogSkips && !g_Playing->m_bTimingDelayed ) + { + const float fExpectedTimePassed = (tm - GAMESTATE->m_LastBeatUpdate) * g_Playing->m_Music->GetPlaybackRate(); + const float fSoundTimePassed = fSeconds - GAMESTATE->m_fMusicSeconds; + const float fDiff = fExpectedTimePassed - fSoundTimePassed; + + static RString sLastFile = ""; + const RString ThisFile = g_Playing->m_Music->GetLoadedFilePath(); + + /* If fSoundTimePassed < 0, the sound has probably looped. */ + if( sLastFile == ThisFile && fSoundTimePassed >= 0 && fabsf(fDiff) > 0.003f ) + LOG->Trace("Song position skip in %s: expected %.3f, got %.3f (cur %f, prev %f) (%.3f difference)", + Basename(ThisFile).c_str(), fExpectedTimePassed, fSoundTimePassed, fSeconds, GAMESTATE->m_fMusicSeconds, fDiff ); + sLastFile = ThisFile; + } + + // + // If g_Playing->m_bTimingDelayed, we're waiting for the new music to actually start + // playing. + // + if( g_Playing->m_bTimingDelayed && !m_bApproximate ) + { + /* Load up the new timing data. */ + g_Playing->m_Timing = g_Playing->m_NewTiming; + g_Playing->m_bTimingDelayed = false; + } + + if( g_Playing->m_bTimingDelayed ) + { + /* We're still waiting for the new sound to start playing, so keep using the + * old timing data and fake the time. */ + GAMESTATE->UpdateSongPosition( GAMESTATE->m_fMusicSeconds + fDeltaTime, g_Playing->m_Timing ); + } + else + { + GAMESTATE->UpdateSongPosition( fSeconds + fAdjust, g_Playing->m_Timing, tm + fAdjust ); + } + + + // + // Send crossed messages + // + if( GAMESTATE->m_pCurSong ) + { + static int iBeatLastCrossed = 0; + + float fSongBeat = GAMESTATE->m_fSongBeat; + + int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); + iRowNow = max( 0, iRowNow ); + + int iBeatNow = iRowNow / ROWS_PER_BEAT; + + for( int iBeat = iBeatLastCrossed+1; iBeat<=iBeatNow; ++iBeat ) + { + Message msg("CrossedBeat"); + msg.SetParam( "Beat", iBeat ); + MESSAGEMAN->Broadcast( msg ); + } + + iBeatLastCrossed = iBeatNow; + } + + + // + // Update lights + // + NoteData &lights = g_Playing->m_Lights; + if( lights.GetNumTracks() > 0 ) // lights data was loaded + { + const float fSongBeat = GAMESTATE->m_fLightSongBeat; + const int iSongRow = BeatToNoteRowNotRounded( fSongBeat ); + + static int iRowLastCrossed = 0; + + FOREACH_CabinetLight( cl ) + { + // for each index we crossed since the last update: + FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( lights, cl, r, iRowLastCrossed+1, iSongRow+1 ) + { + if( lights.GetTapNote( cl, r ).type != TapNote::empty ) + { + LIGHTSMAN->BlinkCabinetLight( cl ); + goto done_with_cabinet_light; + } + } + + if( lights.IsHoldNoteAtRow( cl, iSongRow ) ) + { + LIGHTSMAN->BlinkCabinetLight( cl ); + goto done_with_cabinet_light; + } +done_with_cabinet_light: + ; + } + + iRowLastCrossed = iSongRow; + } +} + + +RString GameSoundManager::GetMusicPath() const +{ + LockMut( *g_Mutex ); + return g_Playing->m_Music->GetLoadedFilePath(); +} + +void GameSoundManager::PlayMusic( + RString sFile, + const TimingData *pTiming, + bool bForceLoop, + float fStartSecond, + float fLengthSeconds, + float fFadeInLengthSeconds, + float fFadeOutLengthSeconds, + bool bAlignBeat + ) +{ + PlayMusicParams params; + params.sFile = sFile; + params.pTiming = pTiming; + params.bForceLoop = bForceLoop; + params.fStartSecond = fStartSecond; + params.fLengthSeconds = fLengthSeconds; + params.fFadeInLengthSeconds = fFadeInLengthSeconds; + params.fFadeOutLengthSeconds = fFadeOutLengthSeconds; + params.bAlignBeat = bAlignBeat; + params.bApplyMusicRate = false; + PlayMusic( params ); +} + +void GameSoundManager::PlayMusic( PlayMusicParams params, PlayMusicParams FallbackMusicParams ) +{ + g_FallbackMusicParams = FallbackMusicParams; + + // LOG->Trace("play '%s' (current '%s')", file.c_str(), g_Playing->m_Music->GetLoadedFilePath().c_str()); + + MusicToPlay ToPlay; + + ToPlay.m_sFile = params.sFile; + if( params.pTiming ) + { + ToPlay.HasTiming = true; + ToPlay.m_TimingData = *params.pTiming; + } + else + { + /* If no timing data was provided, look for it in the same place as the music file. */ + // todo: allow loading .ssc files as well -aj + ToPlay.m_sTimingFile = SetExtension( params.sFile, "sm" ); + } + + ToPlay.bForceLoop = params.bForceLoop; + ToPlay.fStartSecond = params.fStartSecond; + ToPlay.fLengthSeconds = params.fLengthSeconds; + ToPlay.fFadeInLengthSeconds = params.fFadeInLengthSeconds; + ToPlay.fFadeOutLengthSeconds = params.fFadeOutLengthSeconds; + ToPlay.bAlignBeat = params.bAlignBeat; + ToPlay.bApplyMusicRate = params.bApplyMusicRate; + + /* Add the MusicToPlay to the g_MusicsToPlay queue. */ + g_Mutex->Lock(); + g_MusicsToPlay.push_back( ToPlay ); + g_Mutex->Broadcast(); + g_Mutex->Unlock(); +} + +void GameSoundManager::DimMusic( float fVolume, float fDurationSeconds ) +{ + LockMut( *g_Mutex ); + + if( g_FadeState == FADE_NONE ) + g_fOriginalVolume = g_Playing->m_Music->GetParams().m_Volume; + // otherwise, g_fOriginalVolume is already set and m_Volume will be the + // current state, not the original state + + g_fDimDurationRemaining = fDurationSeconds; + g_fDimVolume = fVolume; + g_FadeState = FADE_OUT; +} + +void GameSoundManager::HandleSongTimer( bool on ) +{ + LockMut( *g_Mutex ); + g_UpdatingTimer = on; +} + +void GameSoundManager::PlayOnce( RString sPath ) +{ + /* Add the sound to the g_SoundsToPlayOnce queue. */ + g_Mutex->Lock(); + g_SoundsToPlayOnce.push_back( sPath ); + g_Mutex->Broadcast(); + g_Mutex->Unlock(); +} + +void GameSoundManager::PlayOnceFromDir( RString sPath ) +{ + /* Add the path to the g_SoundsToPlayOnceFromDir queue. */ + g_Mutex->Lock(); + g_SoundsToPlayOnceFromDir.push_back( sPath ); + g_Mutex->Broadcast(); + g_Mutex->Unlock(); +} + +void GameSoundManager::PlayOnceFromAnnouncer( RString sPath ) +{ + /* Add the path to the g_SoundsToPlayOnceFromAnnouncer queue. */ + g_Mutex->Lock(); + g_SoundsToPlayOnceFromAnnouncer.push_back( sPath ); + g_Mutex->Broadcast(); + g_Mutex->Unlock(); +} + +float GameSoundManager::GetPlayerBalance( PlayerNumber pn ) +{ + /* If two players are active, play sounds on each players' side. */ + if( GAMESTATE->GetNumPlayersEnabled() == 2 ) + return (pn == PLAYER_1)? -1.0f:1.0f; + else + return 0; +} + + +#include "LuaBinding.h" + +/** @brief Allow Lua to have access to the GameSoundManager. */ +class LunaGameSoundManager: public Luna +{ +public: + static int DimMusic( T* p, lua_State *L ) + { + float fVolume = FArg(1); + float fDurationSeconds = FArg(2); + p->DimMusic( fVolume, fDurationSeconds ); + return 0; + } + static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); return 0; } + static int GetPlayerBalance( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); lua_pushnumber( L, p->GetPlayerBalance(pn) ); return 1; } + + LunaGameSoundManager() + { + ADD_METHOD( DimMusic ); + ADD_METHOD( PlayOnce ); + ADD_METHOD( GetPlayerBalance ); + } +}; + +LUA_REGISTER_CLASS( GameSoundManager ) + + +/* + * Copyright (c) 2003-2005 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + diff --git a/src/GameSoundManager.h b/src/GameSoundManager.h index df7b801d8b..6ce38ca39e 100644 --- a/src/GameSoundManager.h +++ b/src/GameSoundManager.h @@ -1,96 +1,96 @@ -#ifndef RAGE_SOUNDS_H -#define RAGE_SOUNDS_H - -#include "PlayerNumber.h" - -class TimingData; -class RageSound; -struct lua_State; -/** @brief High-level sound utilities. */ -class GameSoundManager -{ -public: - GameSoundManager(); - ~GameSoundManager(); - void Update( float fDeltaTime ); - - struct PlayMusicParams - { - PlayMusicParams() - { - pTiming = NULL; - bForceLoop = false; - fStartSecond = 0; - fLengthSeconds = -1; - fFadeInLengthSeconds = 0; - fFadeOutLengthSeconds = 0; - bAlignBeat = true; - bApplyMusicRate = false; - } - - RString sFile; - const TimingData *pTiming; - bool bForceLoop; - float fStartSecond; - float fLengthSeconds; - float fFadeInLengthSeconds; - float fFadeOutLengthSeconds; - bool bAlignBeat; - bool bApplyMusicRate; - }; - void PlayMusic( PlayMusicParams params, PlayMusicParams FallbackMusicParams = PlayMusicParams() ); - void PlayMusic( - RString sFile, - const TimingData *pTiming = NULL, - bool force_loop = false, - float start_sec = 0, - float length_sec = -1, - float fFadeInLengthSeconds = 0, - float fade_len = 0, - bool align_beat = true ); - void StopMusic() { PlayMusic(""); } - void DimMusic( float fVolume, float fDurationSeconds ); - RString GetMusicPath() const; - void Flush(); - - void PlayOnce( RString sPath ); - void PlayOnceFromDir( RString sDir ); - void PlayOnceFromAnnouncer( RString sFolderName ); - - void HandleSongTimer( bool on=true ); - float GetFrameTimingAdjustment( float fDeltaTime ); - - static float GetPlayerBalance( PlayerNumber pn ); - - // Lua - void PushSelf( lua_State *L ); -}; - -extern GameSoundManager *SOUND; -#endif - -/* - * Copyright (c) 2003-2004 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - +#ifndef RAGE_SOUNDS_H +#define RAGE_SOUNDS_H + +#include "PlayerNumber.h" + +class TimingData; +class RageSound; +struct lua_State; +/** @brief High-level sound utilities. */ +class GameSoundManager +{ +public: + GameSoundManager(); + ~GameSoundManager(); + void Update( float fDeltaTime ); + + struct PlayMusicParams + { + PlayMusicParams() + { + pTiming = NULL; + bForceLoop = false; + fStartSecond = 0; + fLengthSeconds = -1; + fFadeInLengthSeconds = 0; + fFadeOutLengthSeconds = 0; + bAlignBeat = true; + bApplyMusicRate = false; + } + + RString sFile; + const TimingData *pTiming; + bool bForceLoop; + float fStartSecond; + float fLengthSeconds; + float fFadeInLengthSeconds; + float fFadeOutLengthSeconds; + bool bAlignBeat; + bool bApplyMusicRate; + }; + void PlayMusic( PlayMusicParams params, PlayMusicParams FallbackMusicParams = PlayMusicParams() ); + void PlayMusic( + RString sFile, + const TimingData *pTiming = NULL, + bool force_loop = false, + float start_sec = 0, + float length_sec = -1, + float fFadeInLengthSeconds = 0, + float fade_len = 0, + bool align_beat = true ); + void StopMusic() { PlayMusic(""); } + void DimMusic( float fVolume, float fDurationSeconds ); + RString GetMusicPath() const; + void Flush(); + + void PlayOnce( RString sPath ); + void PlayOnceFromDir( RString sDir ); + void PlayOnceFromAnnouncer( RString sFolderName ); + + void HandleSongTimer( bool on=true ); + float GetFrameTimingAdjustment( float fDeltaTime ); + + static float GetPlayerBalance( PlayerNumber pn ); + + // Lua + void PushSelf( lua_State *L ); +}; + +extern GameSoundManager *SOUND; +#endif + +/* + * Copyright (c) 2003-2004 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + diff --git a/src/GameState.cpp b/src/GameState.cpp index 72fb165a55..c1f5b0b0f4 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -1,2582 +1,2582 @@ -#include "global.h" -#include "GameState.h" -#include "Actor.h" -#include "AdjustSync.h" -#include "AnnouncerManager.h" -#include "Bookkeeper.h" -#include "Character.h" -#include "CharacterManager.h" -#include "CommonMetrics.h" -#include "Course.h" -#include "CryptManager.h" -#include "Foreach.h" -#include "Game.h" -#include "GameCommand.h" -#include "GameConstantsAndTypes.h" -#include "GameManager.h" -#include "GamePreferences.h" -#include "HighScore.h" -#include "LightsManager.h" -#include "LuaReference.h" -#include "MessageManager.h" -#include "MemoryCardManager.h" -#include "NoteSkinManager.h" -#include "PlayerState.h" -#include "PrefsManager.h" -#include "Profile.h" -#include "ProfileManager.h" -#include "RageFile.h" -#include "RageLog.h" -#include "RageUtil.h" -#include "Song.h" -#include "SongManager.h" -#include "SongUtil.h" -#include "StatsManager.h" -#include "Steps.h" -#include "Style.h" -#include "ThemeManager.h" -#include "UnlockManager.h" -#include "ScreenManager.h" -#include "Screen.h" - -#include -#include - -GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program - -#define NAME_BLACKLIST_FILE "/Data/NamesBlacklist.txt" - -class GameStateMessageHandler: public MessageSubscriber -{ - void HandleMessage( const Message &msg ) - { - if( msg.GetName() == "RefreshCreditText" ) - { - RString sJoined; - FOREACH_HumanPlayer( pn ) - { - if( sJoined != "" ) - sJoined += ", "; - sJoined += ssprintf( "P%i", pn+1 ); - } - - if( sJoined == "" ) - sJoined = "none"; - - LOG->MapLog( "JOINED", "Players joined: %s", sJoined.c_str() ); - } - } -}; - -struct GameStateImpl -{ - GameStateMessageHandler m_Subscriber; - GameStateImpl() - { - m_Subscriber.SubscribeToMessage( "RefreshCreditText" ); - } -}; -static GameStateImpl *g_pImpl = NULL; - -ThemeMetric ALLOW_LATE_JOIN("GameState","AllowLateJoin"); -ThemeMetric USE_NAME_BLACKLIST("GameState","UseNameBlacklist"); - -ThemeMetric DEFAULT_SORT ("GameState","DefaultSort"); -SortOrder GetDefaultSort() -{ - return StringToSortOrder( DEFAULT_SORT ); -} -ThemeMetric DEFAULT_SONG ("GameState","DefaultSong"); -Song* GameState::GetDefaultSong() const -{ - SongID sid; - sid.FromString( DEFAULT_SONG ); - return sid.ToSong(); -} - -static const ThemeMetric MIN_DIFFICULTY_FOR_EXTRA ("GameState","MinDifficultyForExtra"); -static const ThemeMetric GRADE_TIER_FOR_EXTRA_1 ("GameState","GradeTierForExtra1"); -static const ThemeMetric ALLOW_EXTRA_2 ("GameState","AllowExtra2"); -static const ThemeMetric GRADE_TIER_FOR_EXTRA_2 ("GameState","GradeTierForExtra2"); - -static ThemeMetric ARE_STAGE_PLAYER_MODS_FORCED ("GameState","AreStagePlayerModsForced"); -static ThemeMetric ARE_STAGE_SONG_MODS_FORCED ("GameState","AreStageSongModsForced"); - -static Preference g_Premium( "Premium", Premium_Off ); -Preference GameState::m_bAutoJoin( "AutoJoin", false ); - -GameState::GameState() : - m_pCurGame( Message_CurrentGameChanged ), - m_pCurStyle( Message_CurrentStyleChanged ), - m_PlayMode( Message_PlayModeChanged ), - m_iCoins( Message_CoinsChanged ), - m_sPreferredSongGroup( Message_PreferredSongGroupChanged ), - m_sPreferredCourseGroup( Message_PreferredCourseGroupChanged ), - m_PreferredStepsType( Message_PreferredStepsTypeChanged ), - m_PreferredDifficulty( Message_PreferredDifficultyP1Changed ), - m_PreferredCourseDifficulty( Message_PreferredCourseDifficultyP1Changed ), - m_SortOrder( Message_SortOrderChanged ), - m_pCurSong( Message_CurrentSongChanged ), - m_pCurSteps( Message_CurrentStepsP1Changed ), - m_pCurCourse( Message_CurrentCourseChanged ), - m_pCurTrail( Message_CurrentTrailP1Changed ), - m_bGameplayLeadIn( Message_GameplayLeadInChanged ), - m_bDidModeChangeNoteSkin( false ), - m_stEdit( Message_EditStepsTypeChanged ), - m_cdEdit( Message_EditCourseDifficultyChanged ), - m_pEditSourceSteps( Message_EditSourceStepsChanged ), - m_stEditSource( Message_EditSourceStepsTypeChanged ), - m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ), - m_sEditLocalProfileID( Message_EditLocalProfileIDChanged ) -{ - g_pImpl = new GameStateImpl; - - SetCurrentStyle( NULL ); - - m_pCurGame.Set( NULL ); - m_iCoins.Set( 0 ); - m_timeGameStarted.SetZero(); - m_bDemonstrationOrJukebox = false; - - m_iNumTimesThroughAttract = -1; // initial screen will bump this up to 0 - m_iStageSeed = m_iGameSeed = 0; - - m_PlayMode.Set( PlayMode_Invalid ); // used by IsPlayerEnabled before the first screen - FOREACH_PlayerNumber( p ) - m_bSideIsJoined[p] = false; // used by GetNumSidesJoined before the first screen - - FOREACH_PlayerNumber( p ) - { - m_pPlayerState[p] = new PlayerState; - m_pPlayerState[p]->m_PlayerNumber = p; - } - FOREACH_MultiPlayer( p ) - { - m_pMultiPlayerState[p] = new PlayerState; - m_pMultiPlayerState[p]->m_PlayerNumber = PLAYER_1; - m_pMultiPlayerState[p]->m_mp = p; - } - - m_Environment = new LuaTable; - - m_bDopefish = false; - - // Don't reset yet; let the first screen do it, so we can use PREFSMAN and THEME. - //Reset(); - - // Register with Lua. - { - Lua *L = LUA->Get(); - lua_pushstring( L, "GAMESTATE" ); - this->PushSelf( L ); - lua_settable( L, LUA_GLOBALSINDEX ); - LUA->Release( L ); - } -} - -GameState::~GameState() -{ - // Unregister with Lua. - LUA->UnsetGlobal( "GAMESTATE" ); - - FOREACH_PlayerNumber( p ) - SAFE_DELETE( m_pPlayerState[p] ); - FOREACH_MultiPlayer( p ) - SAFE_DELETE( m_pMultiPlayerState[p] ); - - SAFE_DELETE( m_Environment ); - SAFE_DELETE( g_pImpl ); -} - -void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn ) -{ - GameCommand m; - m.Load( 0, ParseCommands(sCommand) ); - - RString sWhy; - if( !m.IsPlayable(&sWhy) ) - RageException::Throw( "Can't apply mode \"%s\": %s", sCommand.c_str(), sWhy.c_str() ); - - if( pn == PLAYER_INVALID ) - m.ApplyToAllPlayers(); - else - m.Apply( pn ); -} - -void GameState::ApplyCmdline() -{ - // We need to join players before we can set the style. - RString sPlayer; - for( int i = 0; GetCommandlineArgument( "player", &sPlayer, i ); ++i ) - { - int pn = atoi( sPlayer )-1; - if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS ) - RageException::Throw( "Invalid argument \"--player=%s\".", sPlayer.c_str() ); - - JoinPlayer( (PlayerNumber) pn ); - } - - RString sMode; - for( int i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i ) - { - ApplyGameCommand( sMode ); - } -} - -void GameState::ResetPlayer( PlayerNumber pn ) -{ - m_PreferredStepsType.Set( StepsType_Invalid ); - m_PreferredDifficulty[pn].Set( Difficulty_Invalid ); - m_PreferredCourseDifficulty[pn].Set( Difficulty_Medium ); - m_iPlayerStageTokens[pn] = 0; - m_iAwardedExtraStages[pn] = 0; - m_pCurSteps[pn].Set( NULL ); - m_pCurTrail[pn].Set( NULL ); - m_pPlayerState[pn]->Reset(); - PROFILEMAN->UnloadProfile( pn ); - - PlayerOptions po; - GetDefaultPlayerOptions( po ); - m_pPlayerState[pn]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); -} - -void GameState::Reset() -{ - m_MasterPlayerNumber = PLAYER_INVALID; // must initialize for UnjoinPlayer - - FOREACH_PlayerNumber( pn ) - UnjoinPlayer( pn ); - - ASSERT( THEME ); - - m_timeGameStarted.SetZero(); - SetCurrentStyle( NULL ); - FOREACH_MultiPlayer( p ) - m_MultiPlayerStatus[p] = MultiPlayerStatus_NotJoined; - FOREACH_PlayerNumber( pn ) - MEMCARDMAN->UnlockCard( pn ); - //m_iCoins = 0; // don't reset coin count! - m_bMultiplayer = false; - m_iNumMultiplayerNoteFields = 1; - *m_Environment = LuaTable(); - m_sPreferredSongGroup.Set( GROUP_ALL ); - m_sPreferredCourseGroup.Set( GROUP_ALL ); - m_bChangedFailTypeOnScreenSongOptions = false; - m_SortOrder.Set( SortOrder_Invalid ); - m_PreferredSortOrder = GetDefaultSort(); - m_PlayMode.Set( PlayMode_Invalid ); - m_EditMode = EditMode_Invalid; - m_bDemonstrationOrJukebox = false; - m_bJukeboxUsesModifiers = false; - m_iCurrentStageIndex = 0; - - m_bGameplayLeadIn.Set( false ); - m_iNumStagesOfThisSong = 0; - m_bLoadingNextSong = false; - - NOTESKIN->RefreshNoteSkinData( m_pCurGame ); - - m_iGameSeed = rand(); - m_iStageSeed = rand(); - - m_pCurSong.Set( GetDefaultSong() ); - m_pPreferredSong = NULL; - m_pCurCourse.Set( NULL ); - m_pPreferredCourse = NULL; - - FOREACH_MultiPlayer( p ) - m_pMultiPlayerState[p]->Reset(); - - m_SongOptions.Init(); - - ResetMusicStatistics(); - ResetStageStatistics(); - AdjustSync::ResetOriginalSyncData(); - - SONGMAN->UpdatePopular(); - SONGMAN->UpdateShuffled(); - - /* We may have cached trails from before everything was loaded (eg. from - * before SongManager::UpdatePopular could be called). Erase the cache. */ - SONGMAN->RegenerateNonFixedCourses(); - - STATSMAN->Reset(); - - FOREACH_PlayerNumber(p) - { - if( PREFSMAN->m_ShowDancingCharacters == SDC_Random ) - m_pCurCharacters[p] = CHARMAN->GetRandomCharacter(); - else - m_pCurCharacters[p] = CHARMAN->GetDefaultCharacter(); - ASSERT( m_pCurCharacters[p] ); - } - - m_bTemporaryEventMode = false; - - LIGHTSMAN->SetLightsMode( LIGHTSMODE_ATTRACT ); - - m_stEdit.Set( StepsType_Invalid ); - m_pEditSourceSteps.Set( NULL ); - m_stEditSource.Set( StepsType_Invalid ); - m_iEditCourseEntryIndex.Set( -1 ); - m_sEditLocalProfileID.Set( "" ); - - m_bBackedOutOfFinalStage = false; - m_bEarnedExtraStage = false; - ApplyCmdline(); -} - -void GameState::JoinPlayer( PlayerNumber pn ) -{ - /* If joint premium and we're not taking away a credit for the 2nd join, - * give the new player the same number of stage tokens that the old player - * has. */ - if( GetCoinMode() == CoinMode_Pay && GetPremium() == Premium_2PlayersFor1Credit && GetNumSidesJoined() == 1 ) - m_iPlayerStageTokens[pn] = m_iPlayerStageTokens[m_MasterPlayerNumber]; - else - m_iPlayerStageTokens[pn] = PREFSMAN->m_iSongsPerPlay; - - m_bSideIsJoined[pn] = true; - - if( m_MasterPlayerNumber == PLAYER_INVALID ) - m_MasterPlayerNumber = pn; - - // if first player to join, set start time - if( GetNumSidesJoined() == 1 ) - BeginGame(); - - // Count each player join as a play. - { - Profile* pMachineProfile = PROFILEMAN->GetMachineProfile(); - pMachineProfile->m_iTotalSessions++; - } - - // Set the current style to something appropriate for the new number of joined players. - if( ALLOW_LATE_JOIN && m_pCurStyle != NULL ) - { - const Style *pStyle; - // only use one player for StyleType_OnePlayerTwoSides. - // XXX?: still shows joined player as "Insert Card". May not be an issue? -aj - if( m_pCurStyle->m_StyleType == StyleType_OnePlayerTwoSides ) - pStyle = GAMEMAN->GetFirstCompatibleStyle( m_pCurGame, 1, m_pCurStyle->m_StepsType ); - else - pStyle = GAMEMAN->GetFirstCompatibleStyle( m_pCurGame, GetNumSidesJoined(), m_pCurStyle->m_StepsType ); - - // use SetCurrentStyle in case of StyleType_OnePlayerTwoSides - SetCurrentStyle( pStyle ); - } - - Message msg( MessageIDToString(Message_PlayerJoined) ); - msg.SetParam( "Player", pn ); - MESSAGEMAN->Broadcast( msg ); -} - -void GameState::UnjoinPlayer( PlayerNumber pn ) -{ - m_bSideIsJoined[pn] = false; - m_iPlayerStageTokens[pn] = 0; - - ResetPlayer( pn ); - - if( m_MasterPlayerNumber == pn ) - m_MasterPlayerNumber = GetFirstHumanPlayer(); - - /* Unjoin STATSMAN first, so steps used by this player are released - * and can be released by PROFILEMAN. */ - STATSMAN->UnjoinPlayer( pn ); - PROFILEMAN->UnloadProfile( pn ); - - Message msg( MessageIDToString(Message_PlayerUnjoined) ); - msg.SetParam( "Player", pn ); - MESSAGEMAN->Broadcast( msg ); - - // If there are no players left, reset some non-player-specific stuff, too. - if( m_MasterPlayerNumber == PLAYER_INVALID ) - { - SongOptions so; - GetDefaultSongOptions( so ); - m_SongOptions.Assign( ModsLevel_Preferred, so ); - m_bDidModeChangeNoteSkin = false; - } -} - -/* xxx: handle multiplayer join? -aj */ - -namespace -{ - bool JoinInputInternal( PlayerNumber pn ) - { - if( !GAMESTATE->PlayersCanJoin() ) - return false; - - // If this side is already in, don't re-join. - if( GAMESTATE->m_bSideIsJoined[pn] ) - return false; - - // subtract coins - int iCoinsNeededToJoin = GAMESTATE->GetCoinsNeededToJoin(); - - if( GAMESTATE->m_iCoins < iCoinsNeededToJoin ) - return false; // not enough coins - - GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins - iCoinsNeededToJoin ); - - GAMESTATE->JoinPlayer( pn ); - - return true; - } -}; - -// Handle an input that can join a player. Return true if the player joined. -bool GameState::JoinInput( PlayerNumber pn ) -{ - // When AutoJoin is enabled, join all players on a single start press. - if( GAMESTATE->m_bAutoJoin.Get() ) - return JoinPlayers(); - else - return JoinInputInternal( pn ); -} - -// Attempt to join all players, as if each player pressed Start. -bool GameState::JoinPlayers() -{ - bool bJoined = false; - FOREACH_PlayerNumber( pn ) - { - if( JoinInputInternal(pn) ) - bJoined = true; - } - return bJoined; -} - -int GameState::GetCoinsNeededToJoin() const -{ - int iCoinsToCharge = 0; - - if( GetCoinMode() == CoinMode_Pay ) - iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit; - - // If joint premium, don't take away a credit for the second join. - if( GetPremium() == Premium_2PlayersFor1Credit && - GetNumSidesJoined() == 1 ) - iCoinsToCharge = 0; - - return iCoinsToCharge; -} - -/* Game flow: - * - * BeginGame() - the first player has joined; the game is starting. - * - * PlayersFinalized() - player memory cards are loaded; later joins won't have memory cards this stage - * - * BeginStage() - gameplay is beginning - * - * optional: CancelStage() - gameplay aborted (Back pressed), undo BeginStage and back up - * - * CommitStageStats() - gameplay is finished - * Saves STATSMAN->m_CurStageStats to the profiles, so profile information - * is up-to-date for Evaluation. - * - * FinishStage() - gameplay and evaluation is finished - * Clears data which was stored by CommitStageStats. */ -void GameState::BeginGame() -{ - m_timeGameStarted.Touch(); - - m_vpsNamesThatWereFilled.clear(); - - // Play attract on the ending screen, then on the ranking screen - // even if attract sounds are set to off. - m_iNumTimesThroughAttract = -1; - - FOREACH_PlayerNumber( pn ) - MEMCARDMAN->UnlockCard( pn ); -} - -void GameState::LoadProfiles( bool bLoadEdits ) -{ - // Unlock any cards that we might want to load. - FOREACH_HumanPlayer( pn ) - if( !PROFILEMAN->IsPersistentProfile(pn) ) - MEMCARDMAN->UnlockCard( pn ); - - MEMCARDMAN->WaitForCheckingToComplete(); - - FOREACH_HumanPlayer( pn ) - { - // If a profile is already loaded, this was already called. - if( PROFILEMAN->IsPersistentProfile(pn) ) - continue; - - MEMCARDMAN->MountCard( pn ); - bool bSuccess = PROFILEMAN->LoadFirstAvailableProfile( pn, bLoadEdits ); // load full profile - MEMCARDMAN->UnmountCard( pn ); - - if( !bSuccess ) - continue; - - // Lock the card on successful load, so we won't allow it to be changed. - MEMCARDMAN->LockCard( pn ); - - LoadCurrentSettingsFromProfile( pn ); - - Profile* pPlayerProfile = PROFILEMAN->GetProfile( pn ); - if( pPlayerProfile ) - pPlayerProfile->m_iTotalSessions++; - } -} - -void GameState::SavePlayerProfiles() -{ - FOREACH_HumanPlayer( pn ) - SavePlayerProfile( pn ); -} - -void GameState::SavePlayerProfile( PlayerNumber pn ) -{ - if( !PROFILEMAN->IsPersistentProfile(pn) ) - return; - - // AutoplayCPU should not save scores. -aj - // xxx: this MAY cause issues with Multiplayer. However, without a working - // Multiplayer build, we'll never know. -aj - if( m_pPlayerState[pn]->m_PlayerController != PC_HUMAN ) - return; - - bool bWasMemoryCard = PROFILEMAN->ProfileWasLoadedFromMemoryCard(pn); - if( bWasMemoryCard ) - MEMCARDMAN->MountCard( pn ); - PROFILEMAN->SaveProfile( pn ); - if( bWasMemoryCard ) - MEMCARDMAN->UnmountCard( pn ); -} - -bool GameState::HaveProfileToLoad() -{ - FOREACH_HumanPlayer( pn ) - { - // We won't load this profile if it's already loaded. - if( PROFILEMAN->IsPersistentProfile(pn) ) - continue; - - // If a memory card is inserted, we'l try to load it. - if( MEMCARDMAN->CardInserted(pn) ) - return true; - if( !PROFILEMAN->m_sDefaultLocalProfileID[pn].Get().empty() ) - return true; - } - - return false; -} - -bool GameState::HaveProfileToSave() -{ - FOREACH_HumanPlayer( pn ) - if( PROFILEMAN->IsPersistentProfile(pn) ) - return true; - return false; -} - -void GameState::SaveLocalData() -{ - BOOKKEEPER->WriteToDisk(); - PROFILEMAN->SaveMachineProfile(); -} - -int GameState::GetNumStagesMultiplierForSong( const Song* pSong ) -{ - int iNumStages = 1; - - ASSERT( pSong ); - if( pSong->IsMarathon() ) - iNumStages *= 3; - if( pSong->IsLong() ) - iNumStages *= 2; - - return iNumStages; -} - -int GameState::GetNumStagesForSongAndStyleType( const Song* pSong, StyleType st ) -{ - int iNumStages = GetNumStagesMultiplierForSong( pSong ); - - // One player, two-sides styles cost extra - switch( st ) - { - DEFAULT_FAIL( st ); - case StyleType_OnePlayerTwoSides: - if( g_Premium == Premium_Off ) - iNumStages *= 2; - break; - case StyleType_TwoPlayersTwoSides: - case StyleType_OnePlayerOneSide: - case StyleType_TwoPlayersSharedSides: - break; - } - - return iNumStages; -} - -int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() const -{ - int iNumStagesOfThisSong = 1; - if( m_pCurSong ) - { - const Style *pStyle = m_pCurStyle; - int numSidesJoined = GetNumSidesJoined(); - if( pStyle == NULL ) - { - const Steps *pSteps = NULL; - if( m_MasterPlayerNumber != PlayerNumber_Invalid ) - pSteps = m_pCurSteps[m_MasterPlayerNumber]; - // Don't call GetFirstCompatibleStyle if numSidesJoined == 0. - // This happens because on SContinue when players are unjoined, - // pCurSteps will still be set while no players are joined. -Chris - if( pSteps && numSidesJoined > 0 ) - { - // If a style isn't set, use the style of the selected steps. - StepsType st = pSteps->m_StepsType; - pStyle = GAMEMAN->GetFirstCompatibleStyle( m_pCurGame, numSidesJoined, st ); - } - else - { - /* If steps aren't set either, pick any style for the number of - * joined players, or one player if no players are joined. */ - vector vpStyles; - int iJoined = max( numSidesJoined, 1 ); - GAMEMAN->GetCompatibleStyles( m_pCurGame, iJoined, vpStyles ); - ASSERT( !vpStyles.empty() ); - pStyle = vpStyles[0]; - } - } - /* Extra stages need to only count as one stage in case a multi-stage - * song is chosen. */ - if( IsAnExtraStage() ) - iNumStagesOfThisSong = 1; - else - iNumStagesOfThisSong = GameState::GetNumStagesForSongAndStyleType( m_pCurSong, pStyle->m_StyleType ); - } - else if( m_pCurCourse ) - iNumStagesOfThisSong = PREFSMAN->m_iSongsPerPlay; - else - return -1; - - iNumStagesOfThisSong = max( iNumStagesOfThisSong, 1 ); - - return iNumStagesOfThisSong; -} - -// Called by ScreenGameplay. Set the length of the current song. -void GameState::BeginStage() -{ - if( m_bDemonstrationOrJukebox ) - return; - - // This should only be called once per stage. - if( m_iNumStagesOfThisSong != 0 ) - LOG->Warn( "XXX: m_iNumStagesOfThisSong == %i?", m_iNumStagesOfThisSong ); - - ResetStageStatistics(); - AdjustSync::ResetOriginalSyncData(); - - if( !ARE_STAGE_PLAYER_MODS_FORCED ) - { - FOREACH_PlayerNumber( p ) - m_pPlayerState[p]->m_PlayerOptions.Assign( ModsLevel_Stage, m_pPlayerState[p]->m_PlayerOptions.GetPreferred() ); - } - if( !ARE_STAGE_SONG_MODS_FORCED ) - m_SongOptions.Assign( ModsLevel_Stage, m_SongOptions.GetPreferred() ); - - STATSMAN->m_CurStageStats.m_fMusicRate = m_SongOptions.GetSong().m_fMusicRate; - m_iNumStagesOfThisSong = GetNumStagesForCurrentSongAndStepsOrCourse(); - ASSERT( m_iNumStagesOfThisSong != -1 ); - FOREACH_EnabledPlayer( p ) - { - // only do this check with human players, assume CPU players (Rave) - // always have tokens. -aj (this could probably be moved below, even.) - if( !IsEventMode() && !IsCpuPlayer(p) ) - ASSERT( m_iPlayerStageTokens[p] >= m_iNumStagesOfThisSong ); - m_iPlayerStageTokens[p] -= m_iNumStagesOfThisSong; - } - FOREACH_HumanPlayer( pn ) - if( CurrentOptionsDisqualifyPlayer(pn) ) - STATSMAN->m_CurStageStats.m_player[pn].m_bDisqualified = true; - m_bEarnedExtraStage = false; - m_sStageGUID = CryptManager::GenerateRandomUUID(); -} - -void GameState::CancelStage() -{ - FOREACH_CpuPlayer( p ) - { - switch( m_PlayMode ) - { - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - m_iPlayerStageTokens[p] = PREFSMAN->m_iSongsPerPlay; - } - } - - FOREACH_EnabledPlayer( p ) - m_iPlayerStageTokens[p] += m_iNumStagesOfThisSong; - m_iNumStagesOfThisSong = 0; - ResetStageStatistics(); -} - -void GameState::CommitStageStats() -{ - if( m_bDemonstrationOrJukebox ) - return; - - STATSMAN->CommitStatsToProfiles( &STATSMAN->m_CurStageStats ); - - // Update TotalPlaySeconds. - int iPlaySeconds = max( 0, (int) m_timeGameStarted.GetDeltaTime() ); - - Profile* pMachineProfile = PROFILEMAN->GetMachineProfile(); - pMachineProfile->m_iTotalSessionSeconds += iPlaySeconds; - - FOREACH_HumanPlayer( p ) - { - Profile* pPlayerProfile = PROFILEMAN->GetProfile( p ); - if( pPlayerProfile ) - pPlayerProfile->m_iTotalSessionSeconds += iPlaySeconds; - } -} - -/* Called by ScreenSelectMusic (etc). Increment the stage counter if we just - * played a song. Might be called more than once. */ -void GameState::FinishStage() -{ - // Increment the stage counter. - const int iOldStageIndex = m_iCurrentStageIndex; - ++m_iCurrentStageIndex; - - m_iNumStagesOfThisSong = 0; - - EarnedExtraStage e = CalculateEarnedExtraStage(); - STATSMAN->m_CurStageStats.m_EarnedExtraStage = e; - if( e != EarnedExtraStage_No ) - { - LOG->Trace( "awarded extra stage" ); - FOREACH_HumanPlayer( p ) - { - // todo: unhardcode the extra stage limit? -aj - if( m_iAwardedExtraStages[p] < 2 ) - { - ++m_iAwardedExtraStages[p]; - ++m_iPlayerStageTokens[p]; - m_bEarnedExtraStage = true; - } - } - } - - if( m_bDemonstrationOrJukebox ) - return; - - // todo: simplify. profile saving is accomplished in ScreenProfileSave - // now; all this code does differently is save machine profile as well. -aj - if( IsEventMode() ) - { - const int iSaveProfileEvery = 3; - if( iOldStageIndex/iSaveProfileEvery < m_iCurrentStageIndex/iSaveProfileEvery ) - { - LOG->Trace( "Played %i stages; saving profiles ...", iSaveProfileEvery ); - PROFILEMAN->SaveMachineProfile(); - this->SavePlayerProfiles(); - } - } -} - -void GameState::LoadCurrentSettingsFromProfile( PlayerNumber pn ) -{ - if( !PROFILEMAN->IsPersistentProfile(pn) ) - return; - - const Profile *pProfile = PROFILEMAN->GetProfile(pn); - - // apply saved default modifiers if any - RString sModifiers; - if( pProfile->GetDefaultModifiers( m_pCurGame, sModifiers ) ) - { - /* We don't save negative preferences (eg. "no reverse"). If the theme - * sets a default of "reverse", and the player turns it off, we should - * set it off. However, don't reset modifiers that aren't saved by the - * profile, so we don't ignore unsaved modifiers when a profile is in use. */ - PO_GROUP_CALL( m_pPlayerState[pn]->m_PlayerOptions, ModsLevel_Preferred, ResetSavedPrefs ); - ApplyPreferredModifiers( pn, sModifiers ); - } - // Only set the sort order if it wasn't already set by a GameCommand (or by an earlier profile) - if( m_PreferredSortOrder == SortOrder_Invalid && pProfile->m_SortOrder != SortOrder_Invalid ) - m_PreferredSortOrder = pProfile->m_SortOrder; - if( pProfile->m_LastDifficulty != Difficulty_Invalid ) - m_PreferredDifficulty[pn].Set( pProfile->m_LastDifficulty ); - if( pProfile->m_LastCourseDifficulty != Difficulty_Invalid ) - m_PreferredCourseDifficulty[pn].Set( pProfile->m_LastCourseDifficulty ); - // Only set the PreferredStepsType if it wasn't already set by a GameCommand (or by an earlier profile) - if( m_PreferredStepsType == StepsType_Invalid && pProfile->m_LastStepsType != StepsType_Invalid ) - m_PreferredStepsType.Set( pProfile->m_LastStepsType ); - if( m_pPreferredSong == NULL ) - m_pPreferredSong = pProfile->m_lastSong.ToSong(); - if( m_pPreferredCourse == NULL ) - m_pPreferredCourse = pProfile->m_lastCourse.ToCourse(); -} - -void GameState::SaveCurrentSettingsToProfile( PlayerNumber pn ) -{ - if( !PROFILEMAN->IsPersistentProfile(pn) ) - return; - if( m_bDemonstrationOrJukebox ) - return; - - Profile* pProfile = PROFILEMAN->GetProfile(pn); - - pProfile->SetDefaultModifiers( m_pCurGame, m_pPlayerState[pn]->m_PlayerOptions.GetPreferred().GetSavedPrefsString() ); - if( IsSongSort(m_PreferredSortOrder) ) - pProfile->m_SortOrder = m_PreferredSortOrder; - if( m_PreferredDifficulty[pn] != Difficulty_Invalid ) - pProfile->m_LastDifficulty = m_PreferredDifficulty[pn]; - if( m_PreferredCourseDifficulty[pn] != Difficulty_Invalid ) - pProfile->m_LastCourseDifficulty = m_PreferredCourseDifficulty[pn]; - if( m_PreferredStepsType != StepsType_Invalid ) - pProfile->m_LastStepsType = m_PreferredStepsType; - if( m_pPreferredSong ) - pProfile->m_lastSong.FromSong( m_pPreferredSong ); - if( m_pPreferredCourse ) - pProfile->m_lastCourse.FromCourse( m_pPreferredCourse ); -} - -void GameState::Update( float fDelta ) -{ - m_SongOptions.Update( fDelta ); - - FOREACH_PlayerNumber( p ) - { - m_pPlayerState[p]->Update( fDelta ); - - if( !m_bGoalComplete[p] && IsGoalComplete(p) ) - { - m_bGoalComplete[p] = true; - MESSAGEMAN->Broadcast( (MessageID)(Message_GoalCompleteP1+p) ); - } - } - - if( GAMESTATE->m_pCurCourse ) - { - if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 && !m_bWorkoutGoalComplete ) - { - const StageStats &ssCurrent = STATSMAN->m_CurStageStats; - bool bGoalComplete = ssCurrent.m_fGameplaySeconds > GAMESTATE->m_pCurCourse->m_fGoalSeconds; - if( bGoalComplete ) - { - MESSAGEMAN->Broadcast( "WorkoutGoalComplete" ); - m_bWorkoutGoalComplete = true; - } - } - } -} - -void GameState::SetCurGame( const Game *pGame ) -{ - m_pCurGame.Set( pGame ); - RString sGame = pGame ? RString(pGame->m_szName) : RString(); - PREFSMAN->SetCurrentGame( sGame ); -} - -const float GameState::MUSIC_SECONDS_INVALID = -5000.0f; - -void GameState::ResetMusicStatistics() -{ - m_fMusicSeconds = 0; // MUSIC_SECONDS_INVALID; - // todo: move me to FOREACH_EnabledPlayer( p ) after [NUM_PLAYERS]ing - m_fSongBeat = 0; - m_fSongBeatNoOffset = 0; - m_fCurBPS = 10; - //m_bStop = false; - m_bFreeze = false; - m_bDelay = false; - m_iWarpBeginRow = -1; // Set to -1 because some song may want to warp to row 0. -aj - m_fWarpLength = -1; // Set when a warp is encountered. also see above. -aj - m_fMusicSecondsVisible = 0; - m_fSongBeatVisible = 0; - Actor::SetBGMTime( 0, 0, 0, 0 ); - - FOREACH_PlayerNumber( p ) - m_pPlayerState[p]->ClearHopoState(); -} - -void GameState::ResetStageStatistics() -{ - STATSMAN->m_CurStageStats = StageStats(); - - RemoveAllActiveAttacks(); - FOREACH_PlayerNumber( p ) - m_pPlayerState[p]->RemoveAllInventory(); - m_fOpponentHealthPercent = 1; - m_fHasteRate = 0; - m_fLastHasteUpdateMusicSeconds = 0; - m_fAccumulatedHasteSeconds = 0; - m_fTugLifePercentP1 = 0.5f; - FOREACH_PlayerNumber( p ) - { - m_pPlayerState[p]->m_fSuperMeter = 0; - m_pPlayerState[p]->m_HealthState = HealthState_Alive; - - m_pPlayerState[p]->m_iLastPositiveSumOfAttackLevels = 0; - m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected - - m_bGoalComplete[p] = false; - } - m_bWorkoutGoalComplete = false; - - - FOREACH_PlayerNumber( p ) - { - m_vLastStageAwards[p].clear(); - m_vLastPeakComboAwards[p].clear(); - } - - // Reset the round seed. Do this here and not in FinishStage so that players - // get new shuffle patterns if they Back out of gameplay and play again. - m_iStageSeed = rand(); -} - -static Preference g_fVisualDelaySeconds( "VisualDelaySeconds", 0.0f ); -// todo: modify for warps -aj -void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp ) -{ - if( !timestamp.IsZero() ) - m_LastBeatUpdate = timestamp; - else - m_LastBeatUpdate.Touch(); - - // xxx testing: only do this on monotune survivor - /* - if( m_pCurSong && m_pCurSong->GetDisplayFullTitle() == "monotune survivor" ) - LOG->Trace( ssprintf("[GameState::UpdateSongPosition] cur BPS = %f, fPositionSeconds = %f",m_fCurBPS,fPositionSeconds) ); - */ - - timing.GetBeatAndBPSFromElapsedTime( fPositionSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze, m_bDelay, m_iWarpBeginRow, m_fWarpLength ); - // "Crash reason : -243478.890625 -48695.773438" - ASSERT_M( m_fSongBeat > -2000, ssprintf("Song beat %f at %f seconds", m_fSongBeat, fPositionSeconds) ); - - //if( m_iWarpBeginRow != -1 || m_iWarpEndRow == -1 ) - if( m_iWarpBeginRow != -1 && m_fWarpLength > 0.0f ) - { - // There is a warp in this section. - LOG->Trace("warp at %i lasts for %f, jumps to %i",m_iWarpBeginRow,m_fWarpLength,m_iWarpBeginRow+BeatToNoteRow(m_fWarpLength)); - //fPositionSeconds += (m_fWarpLength * m_fCurBPS); - } - - m_fMusicSeconds = fPositionSeconds; - - m_fLightSongBeat = timing.GetBeatFromElapsedTime( fPositionSeconds + g_fLightsAheadSeconds ); - - m_fSongBeatNoOffset = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds ); - - m_fMusicSecondsVisible = fPositionSeconds - g_fVisualDelaySeconds.Get(); - float fThrowAway, fThrowAway2; - bool bThrowAway; - int iThrowAway; - timing.GetBeatAndBPSFromElapsedTime( m_fMusicSecondsVisible, m_fSongBeatVisible, fThrowAway, bThrowAway, bThrowAway, iThrowAway, fThrowAway2 ); - - /* - // xxx testing: only do this on monotune survivor - if( m_pCurSong && m_pCurSong->GetDisplayFullTitle() == "monotune survivor" ) - { - // and only do it in the known negative bpm region. HACKITY HACK - if(m_fSongBeat >= 445.490f && m_fSongBeat <= 453.72f) - { - LOG->Trace( ssprintf("fPositionSeconds = %f",fPositionSeconds) ); - LOG->Trace( ssprintf("Song beat: %f (%f seconds), BPS = %f (%f BPM)",m_fSongBeat,m_fMusicSecondsVisible,m_fCurBPS,m_fCurBPS*60.0f) ); - //LOG->Trace( ssprintf("Music seconds visible %f = fPositionSeconds %f - g_fVisualDelaySeconds %f", m_fMusicSecondsVisible,fPositionSeconds,g_fVisualDelaySeconds.Get()) ); - } - else if(m_fSongBeat == 445.500f) - { - LOG->Trace( ssprintf("[beat 445.500] fPositionSeconds = %f",fPositionSeconds) ); - LOG->Trace( ssprintf("Song beat: %f (%f seconds), BPS = %f (%f BPM)",m_fSongBeat,m_fMusicSecondsVisible,m_fCurBPS,m_fCurBPS*60.0f) ); - } - } - */ - - Actor::SetBGMTime( m_fMusicSecondsVisible, m_fSongBeatVisible, fPositionSeconds, m_fSongBeatNoOffset ); -// LOG->Trace( "m_fMusicSeconds = %f, m_fSongBeat = %f, m_fCurBPS = %f, m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze ); -} - -/* -update player position code goes here - */ - -float GameState::GetSongPercent( float beat ) const -{ - // 0 = first step; 1 = last step - return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat; -} - -int GameState::GetNumStagesLeft( PlayerNumber pn ) const -{ - return m_iPlayerStageTokens[pn]; -} - -int GameState::GetSmallestNumStagesLeftForAnyHumanPlayer() const -{ - if( IsEventMode() ) - return 999; - int iSmallest = INT_MAX; - FOREACH_HumanPlayer( p ) - iSmallest = min( iSmallest, m_iPlayerStageTokens[p] ); - return iSmallest; -} - -bool GameState::IsFinalStageForAnyHumanPlayer() const -{ - return GetSmallestNumStagesLeftForAnyHumanPlayer() == 1; -} - -bool GameState::IsAnExtraStage() const -{ - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) - return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] > 0; -} - -static ThemeMetric LOCK_EXTRA_STAGE_SELECTION("GameState","LockExtraStageSelection"); -bool GameState::IsAnExtraStageAndSelectionLocked() const -{ - return IsAnExtraStage() && LOCK_EXTRA_STAGE_SELECTION; -} - -bool GameState::IsExtraStage() const -{ - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) - return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 1; -} - -bool GameState::IsExtraStage2() const -{ - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) - return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 2; -} - -Stage GameState::GetCurrentStage() const -{ - if( m_bDemonstrationOrJukebox ) return Stage_Demo; - // "event" has precedence - else if( IsEventMode() ) return Stage_Event; - else if( m_PlayMode == PLAY_MODE_ONI ) return Stage_Oni; - else if( m_PlayMode == PLAY_MODE_NONSTOP ) return Stage_Nonstop; - else if( m_PlayMode == PLAY_MODE_ENDLESS ) return Stage_Endless; - else if( IsExtraStage() ) return Stage_Extra1; - else if( IsExtraStage2() ) return Stage_Extra2; - //else if( IsFinalStageForAnyHumanPlayer() ) return Stage_Final; - // above function behaves weirdly, it will always return final stage if any player is - // on final stage, rather than the last remaining player. The below method seems to make a bit more sense. - else if(m_iPlayerStageTokens[PLAYER_1] == 0 && m_iPlayerStageTokens[PLAYER_2] == 0) return Stage_Final; - else - { - switch( this->m_iCurrentStageIndex ) - { - case 0: return Stage_1st; - case 1: return Stage_2nd; - case 2: return Stage_3rd; - case 3: return Stage_4th; - case 4: return Stage_5th; - case 5: return Stage_6th; - default: return Stage_Next; - } - } -} - -int GameState::GetCourseSongIndex() const -{ - // iSongsPlayed includes the current song, so it's 1-based; subtract one. - if( GAMESTATE->m_bMultiplayer ) - { - FOREACH_EnabledMultiPlayer(mp) - return STATSMAN->m_CurStageStats.m_multiPlayer[mp].m_iSongsPlayed-1; - FAIL_M("At least one MultiPlayer must be joined."); - } - else - { - return STATSMAN->m_CurStageStats.m_player[m_MasterPlayerNumber].m_iSongsPlayed-1; - } -} - -/* Hack: when we're loading a new course song, we want to display the new song - * number, even though we haven't started that song yet. */ -int GameState::GetLoadingCourseSongIndex() const -{ - int iIndex = GetCourseSongIndex(); - if( m_bLoadingNextSong ) - ++iIndex; - return iIndex; -} - -static LocalizedString PLAYER1 ("GameState","Player 1"); -static LocalizedString PLAYER2 ("GameState","Player 2"); -static LocalizedString CPU ("GameState","CPU"); -RString GameState::GetPlayerDisplayName( PlayerNumber pn ) const -{ - ASSERT( IsPlayerEnabled(pn) ); - const LocalizedString *pDefaultNames[] = { &PLAYER1, &PLAYER2 }; - if( IsHumanPlayer(pn) ) - { - if( !PROFILEMAN->GetPlayerName(pn).empty() ) - return PROFILEMAN->GetPlayerName(pn); - else - return pDefaultNames[pn]->GetValue(); - } - else - { - return CPU.GetValue(); - } -} - -bool GameState::PlayersCanJoin() const -{ - bool b = GetNumSidesJoined() == 0 || GetCurrentStyle() == NULL; // selecting a style finalizes the players - if( ALLOW_LATE_JOIN.IsLoaded() && ALLOW_LATE_JOIN ) - { - Screen *pScreen = SCREENMAN->GetTopScreen(); - if( pScreen ) - b |= pScreen->AllowLateJoin(); - } - return b; -} - -int GameState::GetNumSidesJoined() const -{ - int iNumSidesJoined = 0; - FOREACH_PlayerNumber( p ) - if( m_bSideIsJoined[p] ) - iNumSidesJoined++; // left side, and right side - return iNumSidesJoined; -} - -const Game* GameState::GetCurrentGame() -{ - ASSERT( m_pCurGame != NULL ); // the game must be set before calling this - return m_pCurGame; -} - -const Style* GameState::GetCurrentStyle() const -{ - return m_pCurStyle; -} - -void GameState::SetCurrentStyle( const Style *pStyle ) -{ - m_pCurStyle.Set( pStyle ); - if( INPUTMAPPER ) - { - if( GetCurrentStyle() && GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides ) - INPUTMAPPER->SetJoinControllers( m_MasterPlayerNumber ); - else - INPUTMAPPER->SetJoinControllers( PLAYER_INVALID ); - } -} - -bool GameState::IsPlayerEnabled( PlayerNumber pn ) const -{ - // In rave, all players are present. Non-human players are CPU controlled. - switch( m_PlayMode ) - { - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - return true; - } - - return IsHumanPlayer( pn ); -} - -bool GameState::IsMultiPlayerEnabled( MultiPlayer mp ) const -{ - return m_MultiPlayerStatus[ mp ] == MultiPlayerStatus_Joined; -} - -bool GameState::IsPlayerEnabled( const PlayerState* pPlayerState ) const -{ - if( pPlayerState->m_mp != MultiPlayer_Invalid ) - return IsMultiPlayerEnabled( pPlayerState->m_mp ); - if( pPlayerState->m_PlayerNumber != PLAYER_INVALID ) - return IsPlayerEnabled( pPlayerState->m_PlayerNumber ); - return false; -} - -int GameState::GetNumPlayersEnabled() const -{ - int count = 0; - FOREACH_EnabledPlayer( pn ) - count++; - return count; -} - -bool GameState::IsHumanPlayer( PlayerNumber pn ) const -{ - if( pn == PLAYER_INVALID ) - return false; - - if( GetCurrentStyle() == NULL ) // no style chosen - { - if( PlayersCanJoin() ) - return m_bSideIsJoined[pn]; // only allow input from sides that have already joined - else - return true; // if we can't join, then we're on a screen like MusicScroll or GameOver - } - - switch( GetCurrentStyle()->m_StyleType ) - { - case StyleType_TwoPlayersTwoSides: - case StyleType_TwoPlayersSharedSides: - return true; - case StyleType_OnePlayerOneSide: - case StyleType_OnePlayerTwoSides: - return pn == m_MasterPlayerNumber; - default: - ASSERT(0); // invalid style type - return false; - } -} - -int GameState::GetNumHumanPlayers() const -{ - int count = 0; - FOREACH_HumanPlayer( pn ) - count++; - return count; -} - -PlayerNumber GameState::GetFirstHumanPlayer() const -{ - FOREACH_HumanPlayer( pn ) - return pn; - return PLAYER_INVALID; -} - -PlayerNumber GameState::GetFirstDisabledPlayer() const -{ - FOREACH_PlayerNumber( pn ) - if( !IsPlayerEnabled(pn) ) - return pn; - return PLAYER_INVALID; -} - -bool GameState::IsCpuPlayer( PlayerNumber pn ) const -{ - return IsPlayerEnabled(pn) && !IsHumanPlayer(pn); -} - -bool GameState::AnyPlayersAreCpu() const -{ - FOREACH_CpuPlayer( pn ) - return true; - return false; -} - - -bool GameState::IsCourseMode() const -{ - switch(m_PlayMode) - { - case PLAY_MODE_ONI: - case PLAY_MODE_NONSTOP: - case PLAY_MODE_ENDLESS: - return true; - default: - return false; - } -} - -bool GameState::IsBattleMode() const -{ - switch( m_PlayMode ) - { - case PLAY_MODE_BATTLE: - return true; - default: - return false; - } -} - -EarnedExtraStage GameState::CalculateEarnedExtraStage() const -{ - if( IsEventMode() ) - return EarnedExtraStage_No; - - if( !PREFSMAN->m_bAllowExtraStage ) - return EarnedExtraStage_No; - - if( m_PlayMode != PLAY_MODE_REGULAR ) - return EarnedExtraStage_No; - - if( m_bBackedOutOfFinalStage ) - return EarnedExtraStage_No; - - if( GetSmallestNumStagesLeftForAnyHumanPlayer() > 0 ) - return EarnedExtraStage_No; - - if( m_iAwardedExtraStages[m_MasterPlayerNumber] >= 2 ) - return EarnedExtraStage_No; - - FOREACH_EnabledPlayer( pn ) - { - Difficulty dc = m_pCurSteps[pn]->GetDifficulty(); - switch( dc ) - { - case Difficulty_Edit: - continue; // can't use edit steps - break; - default: - if( dc < MIN_DIFFICULTY_FOR_EXTRA ) - continue; // not hard enough! - break; - } - - if( IsExtraStage() ) - { - if( ALLOW_EXTRA_2 && STATSMAN->m_CurStageStats.m_player[pn].GetGrade() <= GRADE_TIER_FOR_EXTRA_2 ) - return EarnedExtraStage_Extra2; - } - else if( STATSMAN->m_CurStageStats.m_player[pn].GetGrade() <= GRADE_TIER_FOR_EXTRA_1 ) - { - return EarnedExtraStage_Extra1; - } - } - - return EarnedExtraStage_No; -} - -PlayerNumber GameState::GetBestPlayer() const -{ - FOREACH_PlayerNumber( pn ) - if( GetStageResult(pn) == RESULT_WIN ) - return pn; - return PLAYER_INVALID; // draw -} - -StageResult GameState::GetStageResult( PlayerNumber pn ) const -{ - switch( m_PlayMode ) - { - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - if( fabsf(m_fTugLifePercentP1 - 0.5f) < 0.0001f ) - return RESULT_DRAW; - switch( pn ) - { - case PLAYER_1: return (m_fTugLifePercentP1>=0.5f)?RESULT_WIN:RESULT_LOSE; - case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE; - default: ASSERT(0); return RESULT_LOSE; - } - } - - StageResult win = RESULT_WIN; - FOREACH_PlayerNumber( p ) - { - if( p == pn ) - continue; - - // If anyone did just as well, at best it's a draw. - if( STATSMAN->m_CurStageStats.m_player[p].m_iActualDancePoints == STATSMAN->m_CurStageStats.m_player[pn].m_iActualDancePoints ) - win = RESULT_DRAW; - - // If anyone did better, we lost. - if( STATSMAN->m_CurStageStats.m_player[p].m_iActualDancePoints > STATSMAN->m_CurStageStats.m_player[pn].m_iActualDancePoints ) - return RESULT_LOSE; - } - return win; -} - -void GameState::GetDefaultPlayerOptions( PlayerOptions &po ) -{ - po.Init(); - po.FromString( PREFSMAN->m_sDefaultModifiers ); - po.FromString( CommonMetrics::DEFAULT_MODIFIERS ); - if( po.m_sNoteSkin.empty() ) - po.m_sNoteSkin = CommonMetrics::DEFAULT_NOTESKIN_NAME; -} - -void GameState::GetDefaultSongOptions( SongOptions &so ) -{ - so.Init(); - so.FromString( PREFSMAN->m_sDefaultModifiers ); - so.FromString( CommonMetrics::DEFAULT_MODIFIERS ); -} - -void GameState::ResetToDefaultSongOptions( ModsLevel l ) -{ - SongOptions so; - GetDefaultSongOptions( so ); - m_SongOptions.Assign( l, so ); -} - -void GameState::ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ) -{ - m_pPlayerState[pn]->m_PlayerOptions.FromString( ModsLevel_Preferred, sModifiers ); - m_SongOptions.FromString( ModsLevel_Preferred, sModifiers ); -} - -void GameState::ApplyStageModifiers( PlayerNumber pn, RString sModifiers ) -{ - m_pPlayerState[pn]->m_PlayerOptions.FromString( ModsLevel_Stage, sModifiers ); - m_SongOptions.FromString( ModsLevel_Stage, sModifiers ); -} - -void GameState::ClearStageModifiersIllegalForCourse() -{ - FOREACH_EnabledPlayer( pn ) - PO_GROUP_CALL( m_pPlayerState[pn]->m_PlayerOptions, ModsLevel_Stage, ResetSavedPrefsInvalidForCourse ); -} - -bool GameState::CurrentOptionsDisqualifyPlayer( PlayerNumber pn ) -{ - if( !PREFSMAN->m_bDisqualification ) - return false; - - if( !IsHumanPlayer(pn) ) - return false; - - const PlayerOptions &po = m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); - - // Check the stored player options for disqualify. Don't disqualify because - // of mods that were forced. - if( IsCourseMode() ) - return po.IsEasierForCourseAndTrail( m_pCurCourse, m_pCurTrail[pn] ); - else - return po.IsEasierForSongAndSteps( m_pCurSong, m_pCurSteps[pn], pn); -} - -/* reset noteskins (?) - * GameState::ResetNoteSkins() - * GameState::ResetNoteSkinsForPlayer( PlayerNumber pn ) - * - */ - -void GameState::GetAllUsedNoteSkins( vector &out ) const -{ - FOREACH_EnabledPlayer( pn ) - { - out.push_back( m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_sNoteSkin ); - - // Add noteskins that are used in courses. - if( IsCourseMode() ) - { - const Trail *pTrail = m_pCurTrail[pn]; - ASSERT( pTrail ); - - FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e ) - { - PlayerOptions po; - po.FromString( e->Modifiers ); - if( !po.m_sNoteSkin.empty() ) - out.push_back( po.m_sNoteSkin ); - } - } - } - - // Remove duplicates. - sort( out.begin(), out.end() ); - out.erase( unique( out.begin(), out.end() ), out.end() ); -} - -void GameState::RemoveAllActiveAttacks() // called on end of song -{ - FOREACH_PlayerNumber( p ) - m_pPlayerState[p]->RemoveActiveAttacks(); -} - -template -void setmin( T &a, const T &b ) -{ - a = min(a, b); -} - -template -void setmax( T &a, const T &b ) -{ - a = max(a, b); -} - -PlayerOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const -{ - PlayerNumber pn = pPlayerState->m_PlayerNumber; - PlayerOptions::FailType ft = pPlayerState->m_PlayerOptions.GetCurrent().m_FailType; - - // If the player changed the fail mode explicitly, leave it alone. - if( m_bChangedFailTypeOnScreenSongOptions ) - return ft; - - if( IsCourseMode() ) - { - if( PREFSMAN->m_bMinimum1FullSongInCourses && GetCourseSongIndex()==0 ) - ft = max( ft, PlayerOptions::FAIL_IMMEDIATE_CONTINUE ); // take the least harsh of the two FailTypes - } - else - { - Difficulty dc = Difficulty_Invalid; - if( m_pCurSteps[pn] ) - dc = m_pCurSteps[pn]->GetDifficulty(); - - bool bFirstStage = false; - if( !IsEventMode() ) - bFirstStage |= m_iPlayerStageTokens[pPlayerState->m_PlayerNumber] == PREFSMAN->m_iSongsPerPlay-1; // HACK; -1 because this is called during gameplay - - // Easy and beginner are never harder than FAIL_IMMEDIATE_CONTINUE. - if( dc <= Difficulty_Easy ) - setmax( ft, PlayerOptions::FAIL_IMMEDIATE_CONTINUE ); - - if( dc <= Difficulty_Easy && bFirstStage && PREFSMAN->m_bFailOffForFirstStageEasy ) - setmax( ft, PlayerOptions::FAIL_OFF ); - - /* If beginner's steps were chosen, and this is the first stage, - * turn off failure completely. */ - if( dc == Difficulty_Beginner && bFirstStage ) - setmax( ft, PlayerOptions::FAIL_OFF ); - - if( dc == Difficulty_Beginner && PREFSMAN->m_bFailOffInBeginner ) - setmax( ft, PlayerOptions::FAIL_OFF ); - } - - return ft; -} - -bool GameState::ShowW1() const -{ - switch( PREFSMAN->m_AllowW1 ) - { - case ALLOW_W1_NEVER: return false; - case ALLOW_W1_COURSES_ONLY: return IsCourseMode(); - case ALLOW_W1_EVERYWHERE: return true; - default: ASSERT(0); - } -} - - -static ThemeMetric PROFILE_RECORD_FEATS("GameState","ProfileRecordFeats"); -static ThemeMetric CATEGORY_RECORD_FEATS("GameState","CategoryRecordFeats"); -void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsOut ) const -{ - if( !IsHumanPlayer(pn) ) - return; - - Profile *pProf = PROFILEMAN->GetProfile(pn); - - // Check for feats even if the PlayMode is rave or battle because the player - // may have made high scores then switched modes. - CHECKPOINT_M( ssprintf("PlayMode %i", int(m_PlayMode)) ); - switch( m_PlayMode ) - { - case PLAY_MODE_REGULAR: - case PLAY_MODE_BATTLE: - case PLAY_MODE_RAVE: - { - CHECKPOINT; - - StepsType st = GetCurrentStyle()->m_StepsType; - - // Find unique Song and Steps combinations that were played. - // We must keep only the unique combination or else we'll double-count - // high score markers. - vector vSongAndSteps; - - for( unsigned i=0; im_vPlayedStageStats.size(); i++ ) - { - CHECKPOINT_M( ssprintf("%u/%i", i, (int)STATSMAN->m_vPlayedStageStats.size() ) ); - SongAndSteps sas; - ASSERT( !STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs.empty() ); - sas.pSong = STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs[0]; - ASSERT( sas.pSong ); - if( STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps.empty() ) - continue; - sas.pSteps = STATSMAN->m_vPlayedStageStats[i].m_player[pn].m_vpPossibleSteps[0]; - ASSERT( sas.pSteps ); - vSongAndSteps.push_back( sas ); - } - CHECKPOINT; - - sort( vSongAndSteps.begin(), vSongAndSteps.end() ); - - vector::iterator toDelete = unique( vSongAndSteps.begin(), vSongAndSteps.end() ); - vSongAndSteps.erase(toDelete, vSongAndSteps.end()); - - CHECKPOINT; - for( unsigned i=0; iGetMachineProfile()->GetStepsHighScoreList(pSong,pSteps); - for( unsigned j=0; jGetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); - feat.pStringToFill = hs.GetNameMutable(); - feat.grade = hs.GetGrade(); - feat.fPercentDP = hs.GetPercentDP(); - feat.iScore = hs.GetScore(); - - if( pSong->HasBanner() ) - feat.Banner = pSong->GetBannerPath(); - - asFeatsOut.push_back( feat ); - } - } - - // Find Personal Records - if( pProf && PROFILE_RECORD_FEATS ) - { - HighScoreList &hsl = pProf->GetStepsHighScoreList(pSong,pSteps); - for( unsigned j=0; jGetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); - feat.pStringToFill = hs.GetNameMutable(); - feat.grade = hs.GetGrade(); - feat.fPercentDP = hs.GetPercentDP(); - feat.iScore = hs.GetScore(); - - // XXX: temporary hack - // Why is this here? -aj - if( pSong->HasBackground() ) - feat.Banner = pSong->GetBackgroundPath(); - // if( pSong->HasBanner() ) - // feat.Banner = pSong->GetBannerPath(); - - asFeatsOut.push_back( feat ); - } - } - } - - CHECKPOINT; - StageStats stats; - STATSMAN->GetFinalEvalStageStats( stats ); - - - // Find Machine Category Records - FOREACH_ENUM( RankingCategory, rc ) - { - if( !CATEGORY_RECORD_FEATS ) - continue; - HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList( st, rc ); - for( unsigned j=0; jGetCategoryHighScoreList( st, rc ); - for( unsigned j=0; jm_CourseDifficulty; - - // Find Machine Records - { - Profile* pProfile = PROFILEMAN->GetMachineProfile(); - HighScoreList &hsl = pProfile->GetCourseHighScoreList( pCourse, pTrail ); - for( unsigned i=0; iGetDisplayFullTitle().c_str() ); - if( cd != Difficulty_Medium ) - feat.Feat += " " + CourseDifficultyToLocalizedString(cd); - feat.pStringToFill = hs.GetNameMutable(); - feat.grade = Grade_NoData; - feat.iScore = hs.GetScore(); - feat.fPercentDP = hs.GetPercentDP(); - if( pCourse->HasBanner() ) - feat.Banner = pCourse->GetBannerPath(); - asFeatsOut.push_back( feat ); - } - } - - // Find Personal Records - if( PROFILE_RECORD_FEATS && PROFILEMAN->IsPersistentProfile(pn) ) - { - HighScoreList &hsl = pProf->GetCourseHighScoreList( pCourse, pTrail ); - for( unsigned i=0; iGetDisplayFullTitle().c_str() ); - feat.pStringToFill = hs.GetNameMutable(); - feat.grade = Grade_NoData; - feat.iScore = hs.GetScore(); - feat.fPercentDP = hs.GetPercentDP(); - if( pCourse->HasBanner() ) - feat.Banner = pCourse->GetBannerPath(); - asFeatsOut.push_back( feat ); - } - } - } - break; - default: - ASSERT(0); - } -} - -bool GameState::AnyPlayerHasRankingFeats() const -{ - vector vFeats; - FOREACH_PlayerNumber( p ) - { - GetRankingFeats( p, vFeats ); - if( !vFeats.empty() ) - return true; - } - return false; -} - -void GameState::StoreRankingName( PlayerNumber pn, RString sName ) -{ - sName.MakeUpper(); - - if( USE_NAME_BLACKLIST ) - { - RageFile file; - if( file.Open(NAME_BLACKLIST_FILE) ) - { - RString sLine; - - while( !file.AtEOF() ) - { - if( file.GetLine(sLine) == -1 ) - { - LOG->Warn( "Error reading \"%s\": %s", NAME_BLACKLIST_FILE, file.GetError().c_str() ); - break; - } - - sLine.MakeUpper(); - if( !sLine.empty() && sName.find(sLine) != string::npos ) // name contains a bad word - { - LOG->Trace( "entered '%s' matches blacklisted item '%s'", sName.c_str(), sLine.c_str() ); - sName = ""; - break; - } - } - } - } - - vector aFeats; - GetRankingFeats( pn, aFeats ); - - for( unsigned i=0; iGetMachineProfile(); - - if( !PREFSMAN->m_bAllowMultipleHighScoreWithSameName ) - { - // erase all but the highest score for each name - FOREACHM( SongID, Profile::HighScoresForASong, pProfile->m_SongHighScores, iter ) - FOREACHM( StepsID, Profile::HighScoresForASteps, iter->second.m_StepsHighScores, iter2 ) - iter2->second.hsl.RemoveAllButOneOfEachName(); - - FOREACHM( CourseID, Profile::HighScoresForACourse, pProfile->m_CourseHighScores, iter ) - FOREACHM( TrailID, Profile::HighScoresForATrail, iter->second.m_TrailHighScores, iter2 ) - iter2->second.hsl.RemoveAllButOneOfEachName(); - } - - // clamp high score sizes - FOREACHM( SongID, Profile::HighScoresForASong, pProfile->m_SongHighScores, iter ) - FOREACHM( StepsID, Profile::HighScoresForASteps, iter->second.m_StepsHighScores, iter2 ) - iter2->second.hsl.ClampSize( true ); - - FOREACHM( CourseID, Profile::HighScoresForACourse, pProfile->m_CourseHighScores, iter ) - FOREACHM( TrailID, Profile::HighScoresForATrail, iter->second.m_TrailHighScores, iter2 ) - iter2->second.hsl.ClampSize( true ); -} - -bool GameState::AllAreInDangerOrWorse() const -{ - FOREACH_EnabledPlayer( p ) - if( m_pPlayerState[p]->m_HealthState < HealthState_Danger ) - return false; - return true; -} - -bool GameState::OneIsHot() const -{ - FOREACH_EnabledPlayer( p ) - if( m_pPlayerState[p]->m_HealthState == HealthState_Hot ) - return true; - return false; -} - -bool GameState::IsTimeToPlayAttractSounds() const -{ - // m_iNumTimesThroughAttract will be -1 from the first attract screen after - // the end of a game until the next time FIRST_ATTRACT_SCREEN is reached. - // Play attract sounds for this sort span of time regardless of - // m_AttractSoundFrequency because it's awkward to have the machine go - // silent immediately after the end of a game. - if( m_iNumTimesThroughAttract == -1 ) - return true; - - if( PREFSMAN->m_AttractSoundFrequency == ASF_NEVER ) - return false; - - // play attract sounds once every m_iAttractSoundFrequency times through - if( (m_iNumTimesThroughAttract % PREFSMAN->m_AttractSoundFrequency)==0 ) - return true; - - return false; -} - -void GameState::VisitAttractScreen( const RString sScreenName ) -{ - if( sScreenName == CommonMetrics::FIRST_ATTRACT_SCREEN.GetValue() ) - m_iNumTimesThroughAttract++; -} - -bool GameState::DifficultiesLocked() const -{ - if( m_PlayMode == PLAY_MODE_RAVE ) - return true; - if( IsCourseMode() ) - return PREFSMAN->m_bLockCourseDifficulties; - if( GetCurrentStyle()->m_bLockDifficulties ) - return true; - return false; -} - -bool GameState::ChangePreferredDifficultyAndStepsType( PlayerNumber pn, Difficulty dc, StepsType st ) -{ - m_PreferredDifficulty[pn].Set( dc ); - m_PreferredStepsType.Set( st ); - if( DifficultiesLocked() ) - FOREACH_PlayerNumber( p ) - if( p != pn ) - m_PreferredDifficulty[p].Set( m_PreferredDifficulty[pn] ); - - return true; -} - -/* When only displaying difficulties in DIFFICULTIES_TO_SHOW, use GetClosestShownDifficulty - * to find which difficulty to show, and ChangePreferredDifficulty(pn, dir) to change - * difficulty. */ -bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir ) -{ - const vector &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); - - Difficulty d = GetClosestShownDifficulty(pn); - while( 1 ) - { - d = enum_add2( d, dir ); - if( d < 0 || d >= NUM_Difficulty ) - return false; - if( find(v.begin(), v.end(), d) != v.end() ) - break; // found - } - - m_PreferredDifficulty[pn].Set( d ); - return true; -} - -/* The user may be set to prefer a difficulty that isn't always shown; typically, - * Difficulty_Edit. Return the closest shown difficulty <= m_PreferredDifficulty. */ -Difficulty GameState::GetClosestShownDifficulty( PlayerNumber pn ) const -{ - const vector &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(); - - Difficulty iClosest = (Difficulty) 0; - int iClosestDist = -1; - FOREACH_CONST( Difficulty, v, dc ) - { - int iDist = m_PreferredDifficulty[pn] - *dc; - if( iDist < 0 ) - continue; - if( iClosestDist != -1 && iDist > iClosestDist ) - continue; - iClosestDist = iDist; - iClosest = *dc; - } - - return iClosest; -} - -bool GameState::ChangePreferredCourseDifficultyAndStepsType( PlayerNumber pn, CourseDifficulty cd, StepsType st ) -{ - m_PreferredCourseDifficulty[pn].Set( cd ); - m_PreferredStepsType.Set( st ); - if( PREFSMAN->m_bLockCourseDifficulties ) - FOREACH_PlayerNumber( p ) - if( p != pn ) - m_PreferredCourseDifficulty[p].Set( m_PreferredCourseDifficulty[pn] ); - - return true; -} - -bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, int dir ) -{ - /* If we have a course selected, only choose among difficulties available in the course. */ - const Course *pCourse = m_pCurCourse; - - const vector &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue(); - - CourseDifficulty cd = m_PreferredCourseDifficulty[pn]; - while( 1 ) - { - cd = enum_add2( cd, dir ); - if( cd < 0 || cd >= NUM_Difficulty ) - return false; - if( find(v.begin(),v.end(),cd) == v.end() ) - continue; /* not available */ - if( !pCourse || pCourse->GetTrail( GetCurrentStyle()->m_StepsType, cd ) ) - break; - } - - return ChangePreferredCourseDifficulty( pn, cd ); -} - -bool GameState::IsCourseDifficultyShown( CourseDifficulty cd ) -{ - const vector &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue(); - return find(v.begin(), v.end(), cd) != v.end(); -} - -Difficulty GameState::GetEasiestStepsDifficulty() const -{ - Difficulty dc = Difficulty_Invalid; - FOREACH_HumanPlayer( p ) - { - if( m_pCurSteps[p] == NULL ) - { - LOG->Warn( "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", p+1 ); - continue; - } - dc = min( dc, m_pCurSteps[p]->GetDifficulty() ); - } - return dc; -} - -Difficulty GameState::GetHardestStepsDifficulty() const -{ - Difficulty dc = Difficulty_Beginner; - FOREACH_HumanPlayer( p ) - { - if( m_pCurSteps[p] == NULL ) - { - LOG->Warn( "GetHardestStepsDifficulty called but p%i hasn't chosen notes", p+1 ); - continue; - } - dc = max( dc, m_pCurSteps[p]->GetDifficulty() ); - } - return dc; -} - -bool GameState::IsEventMode() const -{ - return m_bTemporaryEventMode || PREFSMAN->m_bEventMode; -} - -CoinMode GameState::GetCoinMode() const -{ - if( IsEventMode() && GamePreferences::m_CoinMode == CoinMode_Pay ) - return CoinMode_Free; - else - return GamePreferences::m_CoinMode; -} - -ThemeMetric DISABLE_PREMIUM_IN_EVENT_MODE("GameState","DisablePremiumInEventMode"); -Premium GameState::GetPremium() const -{ - return DISABLE_PREMIUM_IN_EVENT_MODE ? Premium_Off : g_Premium; -} - -float GameState::GetGoalPercentComplete( PlayerNumber pn ) -{ - const Profile *pProfile = PROFILEMAN->GetProfile(pn); - const StageStats &ssCurrent = STATSMAN->m_CurStageStats; - const PlayerStageStats &pssCurrent = ssCurrent.m_player[pn]; - - float fActual = 0; - float fGoal = 0; - switch( pProfile->m_GoalType ) - { - case GoalType_Calories: - fActual = pssCurrent.m_fCaloriesBurned; - fGoal = (float)pProfile->m_iGoalCalories; - break; - case GoalType_Time: - fActual = ssCurrent.m_fGameplaySeconds; - fGoal = (float)pProfile->m_iGoalSeconds; - break; - case GoalType_None: - return 0; // never complete - default: - ASSERT(0); - } - if( fGoal == 0 ) - return 0; - else - return fActual / fGoal; -} - -bool GameState::PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier ) -{ - PlayerOptions po = m_pPlayerState[pn]->m_PlayerOptions.GetCurrent(); - SongOptions so = m_SongOptions.GetCurrent(); - po.FromString( sModifier ); - so.FromString( sModifier ); - - return po == m_pPlayerState[pn]->m_PlayerOptions.GetCurrent() && so == m_SongOptions.GetCurrent(); -} - -Profile* GameState::GetEditLocalProfile() -{ - if( m_sEditLocalProfileID.Get().empty() ) - return NULL; - return PROFILEMAN->GetLocalProfile( m_sEditLocalProfileID ); -} - - -PlayerNumber GetNextHumanPlayer( PlayerNumber pn ) -{ - for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) ) - if( GAMESTATE->IsHumanPlayer(pn) ) - return pn; - return PLAYER_INVALID; -} - -PlayerNumber GetNextEnabledPlayer( PlayerNumber pn ) -{ - for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) ) - if( GAMESTATE->IsPlayerEnabled(pn) ) - return pn; - return PLAYER_INVALID; -} - -PlayerNumber GetNextCpuPlayer( PlayerNumber pn ) -{ - for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) ) - if( GAMESTATE->IsCpuPlayer(pn) ) - return pn; - return PLAYER_INVALID; -} - -PlayerNumber GetNextPotentialCpuPlayer( PlayerNumber pn ) -{ - for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) ) - if( !GAMESTATE->IsHumanPlayer(pn) ) - return pn; - return PLAYER_INVALID; -} - -MultiPlayer GetNextEnabledMultiPlayer( MultiPlayer mp ) -{ - for( enum_add(mp, 1); mp < NUM_MultiPlayer; enum_add(mp, 1) ) - if( GAMESTATE->IsMultiPlayerEnabled(mp) ) - return mp; - return MultiPlayer_Invalid; -} - - - -// lua start -#include "LuaBinding.h" -#include "Game.h" - -/** @brief Allow Lua to have access to the GameState. */ -class LunaGameState: public Luna -{ -public: - DEFINE_METHOD( IsPlayerEnabled, IsPlayerEnabled(Enum::Check(L, 1)) ) - DEFINE_METHOD( IsHumanPlayer, IsHumanPlayer(Enum::Check(L, 1)) ) - DEFINE_METHOD( GetPlayerDisplayName, GetPlayerDisplayName(Enum::Check(L, 1)) ) - DEFINE_METHOD( GetMasterPlayerNumber, m_MasterPlayerNumber ) - DEFINE_METHOD( GetMultiplayer, m_bMultiplayer ) - static int SetMultiplayer( T* p, lua_State *L ) - { - p->m_bMultiplayer = BArg(1); - return 0; - } - DEFINE_METHOD( GetNumMultiplayerNoteFields, m_iNumMultiplayerNoteFields ) - DEFINE_METHOD( ShowW1, ShowW1() ) - - static int SetNumMultiplayerNoteFields( T* p, lua_State *L ) - { - p->m_iNumMultiplayerNoteFields = IArg(1); - return 0; - } - static int GetPlayerState( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - p->m_pPlayerState[pn]->PushSelf(L); - return 1; - } - static int GetMultiPlayerState( T* p, lua_State *L ) - { - MultiPlayer mp = Enum::Check(L, 1); - p->m_pMultiPlayerState[mp]->PushSelf(L); - return 1; - } - static int ApplyGameCommand( T* p, lua_State *L ) - { - PlayerNumber pn = PLAYER_INVALID; - if( lua_gettop(L) >= 2 && !lua_isnil(L,2) ) - pn = Enum::Check(L, 2); - p->ApplyGameCommand(SArg(1),pn); - return 0; - } - static int GetCurrentSong( T* p, lua_State *L ) { if(p->m_pCurSong) p->m_pCurSong->PushSelf(L); else lua_pushnil(L); return 1; } - static int SetCurrentSong( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->m_pCurSong.Set( NULL ); } - else { Song *pS = Luna::check( L, 1, true ); p->m_pCurSong.Set( pS ); } - return 0; - } - static int GetCurrentSteps( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - Steps *pSteps = p->m_pCurSteps[pn]; - if( pSteps ) { pSteps->PushSelf(L); } - else { lua_pushnil(L); } - return 1; - } - static int SetCurrentSteps( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - if( lua_isnil(L,2) ) { p->m_pCurSteps[pn].Set( NULL ); } - else { Steps *pS = Luna::check(L,2); p->m_pCurSteps[pn].Set( pS ); } - - // Why Broadcast again? This is double-broadcasting. -Chris - MESSAGEMAN->Broadcast( (MessageID)(Message_CurrentStepsP1Changed+pn) ); - return 0; - } - static int GetCurrentCourse( T* p, lua_State *L ) { if(p->m_pCurCourse) p->m_pCurCourse->PushSelf(L); else lua_pushnil(L); return 1; } - static int SetCurrentCourse( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->m_pCurCourse.Set( NULL ); } - else { Course *pC = Luna::check(L,1); p->m_pCurCourse.Set( pC ); } - return 0; - } - static int GetCurrentTrail( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - Trail *pTrail = p->m_pCurTrail[pn]; - if( pTrail ) { pTrail->PushSelf(L); } - else { lua_pushnil(L); } - return 1; - } - static int SetCurrentTrail( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - if( lua_isnil(L,2) ) { p->m_pCurTrail[pn].Set( NULL ); } - else { Trail *pS = Luna::check(L,2); p->m_pCurTrail[pn].Set( pS ); } - MESSAGEMAN->Broadcast( (MessageID)(Message_CurrentTrailP1Changed+pn) ); - return 0; - } - static int GetPreferredSong( T* p, lua_State *L ) { if(p->m_pPreferredSong) p->m_pPreferredSong->PushSelf(L); else lua_pushnil(L); return 1; } - static int SetPreferredSong( T* p, lua_State *L ) - { - if( lua_isnil(L,1) ) { p->m_pPreferredSong = NULL; } - else { Song *pS = Luna::check(L,1); p->m_pPreferredSong = pS; } - return 0; - } - static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); return 0; } - static int Env( T* p, lua_State *L ) { p->m_Environment->PushSelf(L); return 1; } - static int GetEditSourceSteps( T* p, lua_State *L ) - { - Steps *pSteps = p->m_pEditSourceSteps; - if( pSteps ) { pSteps->PushSelf(L); } - else { lua_pushnil(L); } - return 1; - } - static int SetPreferredDifficulty( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check( L, 1 ); - Difficulty dc = Enum::Check( L, 2 ); - p->m_PreferredDifficulty[pn].Set( dc ); - return 0; - } - DEFINE_METHOD( GetPreferredDifficulty, m_PreferredDifficulty[Enum::Check(L, 1)] ) - DEFINE_METHOD( AnyPlayerHasRankingFeats, AnyPlayerHasRankingFeats() ) - DEFINE_METHOD( IsCourseMode, IsCourseMode() ) - DEFINE_METHOD( IsBattleMode, IsBattleMode() ) - DEFINE_METHOD( IsDemonstration, m_bDemonstrationOrJukebox ) - DEFINE_METHOD( GetPlayMode, m_PlayMode ) - DEFINE_METHOD( GetSortOrder, m_SortOrder ) - DEFINE_METHOD( GetCurrentStageIndex, m_iCurrentStageIndex ) - DEFINE_METHOD( IsGoalComplete, IsGoalComplete(Enum::Check(L, 1)) ) - DEFINE_METHOD( PlayerIsUsingModifier, PlayerIsUsingModifier(Enum::Check(L, 1), SArg(2)) ) - DEFINE_METHOD( GetCourseSongIndex, GetCourseSongIndex() ) - DEFINE_METHOD( GetLoadingCourseSongIndex, GetLoadingCourseSongIndex() ) - DEFINE_METHOD( GetSmallestNumStagesLeftForAnyHumanPlayer, GetSmallestNumStagesLeftForAnyHumanPlayer() ) - DEFINE_METHOD( IsAnExtraStage, IsAnExtraStage() ) - DEFINE_METHOD( IsExtraStage, IsExtraStage() ) - DEFINE_METHOD( IsExtraStage2, IsExtraStage2() ) - DEFINE_METHOD( GetCurrentStage, GetCurrentStage() ) - DEFINE_METHOD( HasEarnedExtraStage, HasEarnedExtraStage() ) - DEFINE_METHOD( GetEasiestStepsDifficulty, GetEasiestStepsDifficulty() ) - DEFINE_METHOD( GetHardestStepsDifficulty, GetHardestStepsDifficulty() ) - DEFINE_METHOD( IsEventMode, IsEventMode() ) - DEFINE_METHOD( GetNumPlayersEnabled, GetNumPlayersEnabled() ) - DEFINE_METHOD( GetSongBeat, m_fSongBeat ) - DEFINE_METHOD( GetSongBeatVisible, m_fSongBeatVisible ) - DEFINE_METHOD( GetSongBPS, m_fCurBPS ) - DEFINE_METHOD( GetSongFreeze, m_bFreeze ) - DEFINE_METHOD( GetSongDelay, m_bDelay ) - DEFINE_METHOD( GetGameplayLeadIn, m_bGameplayLeadIn ) - DEFINE_METHOD( GetCoins, m_iCoins ) - DEFINE_METHOD( IsSideJoined, m_bSideIsJoined[Enum::Check(L, 1)] ) - DEFINE_METHOD( GetCoinsNeededToJoin, GetCoinsNeededToJoin() ) - DEFINE_METHOD( EnoughCreditsToJoin, EnoughCreditsToJoin() ) - DEFINE_METHOD( PlayersCanJoin, PlayersCanJoin() ) - DEFINE_METHOD( GetNumSidesJoined, GetNumSidesJoined() ) - DEFINE_METHOD( GetCoinMode, GetCoinMode() ) - DEFINE_METHOD( GetPremium, GetPremium() ) - DEFINE_METHOD( GetSongOptionsString, m_SongOptions.GetCurrent().GetString() ) - static int GetSongOptions( T* p, lua_State *L ) - { - ModsLevel m = Enum::Check( L, 1 ); - RString s = p->m_SongOptions.Get(m).GetString(); - LuaHelpers::Push( L, s ); - return 1; - } - static int GetDefaultSongOptions( T* p, lua_State *L ) - { - SongOptions so; - p->GetDefaultSongOptions( so ); - lua_pushstring(L, so.GetString()); - return 1; - } - static int ClearStageModifiersIllegalForCourse( T* p, lua_State *L ) - { - p->ClearStageModifiersIllegalForCourse(); - return 0; - } - static int SetSongOptions( T* p, lua_State *L ) - { - ModsLevel m = Enum::Check( L, 1 ); - - SongOptions so; - - so.FromString( SArg(2) ); - p->m_SongOptions.Assign( m, so ); - return 0; - } - static int IsWinner( T* p, lua_State *L ) - { - PlayerNumber pn = Enum::Check(L, 1); - lua_pushboolean(L, p->GetStageResult(pn)==RESULT_WIN); return 1; - } - static int IsDraw( T* p, lua_State *L ) - { - lua_pushboolean(L, p->GetStageResult(PLAYER_1)==RESULT_DRAW); return 1; - } - static int GetCurrentGame( T* p, lua_State *L ) { const_cast(p->GetCurrentGame())->PushSelf( L ); return 1; } - //static int SetCurrentGame( T* p, lua_State *L ) { p->SetCurrentGame( GAMEMAN->StringToGame( SArg(1) ) ); return 0; } - DEFINE_METHOD( GetEditCourseEntryIndex, m_iEditCourseEntryIndex ) - DEFINE_METHOD( GetEditLocalProfileID, m_sEditLocalProfileID.Get() ) - static int GetEditLocalProfile( T* p, lua_State *L ) - { - Profile *pProfile = p->GetEditLocalProfile(); - if( pProfile ) - pProfile->PushSelf(L); - else - lua_pushnil( L ); - return 1; - } - - static int GetCurrentStepsCredits( T* t, lua_State *L ) - { - const Song* pSong = t->m_pCurSong; - if( pSong == NULL ) - return 0; - - // use a vector and not a set so that ordering is maintained - vector vpStepsToShow; - FOREACH_HumanPlayer( p ) - { - const Steps* pSteps = GAMESTATE->m_pCurSteps[p]; - if( pSteps == NULL ) - return 0; - bool bAlreadyAdded = find( vpStepsToShow.begin(), vpStepsToShow.end(), pSteps ) != vpStepsToShow.end(); - if( !bAlreadyAdded ) - vpStepsToShow.push_back( pSteps ); - } - - for( unsigned i=0; im_StepsType, pSteps->GetDifficulty(), CourseType_Invalid ) ); - - lua_pushstring( L, sDifficulty ); - lua_pushstring( L, pSteps->GetDescription() ); - } - - return vpStepsToShow.size()*2; - } - - static int SetPreferredSongGroup( T* p, lua_State *L ) { p->m_sPreferredSongGroup.Set( SArg(1) ); return 0; } - DEFINE_METHOD( GetPreferredSongGroup, m_sPreferredSongGroup.Get() ); - static int GetHumanPlayers( T* p, lua_State *L ) - { - vector vHP; - FOREACH_HumanPlayer( pn ) - vHP.push_back( pn ); - LuaHelpers::CreateTableFromArray( vHP, L ); - return 1; - } - static int GetCurrentStyle( T* p, lua_State *L ) - { - Style *pStyle = const_cast